aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/uio-howto.tmpl90
-rw-r--r--Documentation/lguest/lguest.c9
-rw-r--r--Documentation/namespaces/compatibility-list.txt39
-rw-r--r--Documentation/parport-lowlevel.txt4
-rw-r--r--Documentation/powerpc/booting-without-of.txt5
-rw-r--r--Documentation/thinkpad-acpi.txt73
-rw-r--r--Documentation/tty.txt8
-rw-r--r--Documentation/usb/power-management.txt8
-rw-r--r--Documentation/x86_64/uefi.txt29
-rw-r--r--MAINTAINERS131
-rw-r--r--arch/alpha/kernel/pci-noop.c14
-rw-r--r--arch/arm/common/uengine.c6
-rw-r--r--arch/arm/kernel/entry-armv.S96
-rw-r--r--arch/arm/kernel/traps.c5
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c41
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c43
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c11
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-dk.c15
-rw-r--r--arch/arm/mach-at91/board-eb9200.c10
-rw-r--r--arch/arm/mach-at91/board-ek.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c18
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/clock.c9
-rw-r--r--arch/arm/mach-imx/irq.c51
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-pxa/pxa320.c7
-rw-r--r--arch/arm/mach-pxa/ssp.c1
-rw-r--r--arch/blackfin/Kconfig314
-rw-r--r--arch/blackfin/Kconfig.debug178
-rw-r--r--arch/blackfin/Makefile2
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig27
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig41
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig41
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig83
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig30
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig49
-rw-r--r--arch/blackfin/configs/H8606_defconfig1160
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig75
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c1
-rw-r--r--arch/blackfin/kernel/bfin_ksyms.c7
-rw-r--r--arch/blackfin/kernel/cplbinit.c73
-rw-r--r--arch/blackfin/kernel/early_printk.c3
-rw-r--r--arch/blackfin/kernel/process.c66
-rw-r--r--arch/blackfin/kernel/setup.c9
-rw-r--r--arch/blackfin/kernel/traps.c147
-rw-r--r--arch/blackfin/lib/Makefile2
-rw-r--r--arch/blackfin/lib/ins.S19
-rw-r--r--arch/blackfin/lib/strcmp.c11
-rw-r--r--arch/blackfin/lib/strcpy.c11
-rw-r--r--arch/blackfin/lib/strncmp.c11
-rw-r--r--arch/blackfin/lib/strncpy.c11
-rw-r--r--arch/blackfin/lib/udivdi3.S375
-rw-r--r--arch/blackfin/mach-bf527/Kconfig2
-rw-r--r--arch/blackfin/mach-bf527/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf527/boards/Makefile6
-rw-r--r--arch/blackfin/mach-bf527/boards/eth_mac.c50
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c37
-rw-r--r--arch/blackfin/mach-bf533/Kconfig2
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c12
-rw-r--r--arch/blackfin/mach-bf533/boards/Kconfig34
-rw-r--r--arch/blackfin/mach-bf533/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c4
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c4
-rw-r--r--arch/blackfin/mach-bf533/boards/generic_board.c4
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c4
-rw-r--r--arch/blackfin/mach-bf537/Kconfig2
-rw-r--r--arch/blackfin/mach-bf537/boards/Kconfig29
-rw-r--r--arch/blackfin/mach-bf537/boards/Makefile9
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c11
-rw-r--r--arch/blackfin/mach-bf537/boards/eth_mac.c50
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c13
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c15
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c50
-rw-r--r--arch/blackfin/mach-bf548/Kconfig2
-rw-r--r--arch/blackfin/mach-bf548/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf548/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c20
-rw-r--r--arch/blackfin/mach-bf548/head.S21
-rw-r--r--arch/blackfin/mach-bf561/Kconfig4
-rw-r--r--arch/blackfin/mach-bf561/boards/Kconfig27
-rw-r--r--arch/blackfin/mach-bf561/boards/Makefile2
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c4
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c29
-rw-r--r--arch/blackfin/mach-bf561/boards/generic_board.c4
-rw-r--r--arch/blackfin/mach-bf561/boards/tepla.c4
-rw-r--r--arch/blackfin/mach-common/cplbinfo.c2
-rw-r--r--arch/blackfin/mach-common/cplbmgr.S25
-rw-r--r--arch/blackfin/mach-common/entry.S54
-rw-r--r--arch/blackfin/mach-common/interrupt.S1
-rw-r--r--arch/blackfin/mach-common/ints-priority-dc.c21
-rw-r--r--arch/blackfin/mach-common/ints-priority-sc.c28
-rw-r--r--arch/blackfin/mach-common/irqpanic.c14
-rw-r--r--arch/blackfin/mm/blackfin_sram.c1
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig39
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig12
-rw-r--r--arch/frv/kernel/break.S2
-rw-r--r--arch/frv/kernel/entry.S2
-rw-r--r--arch/frv/kernel/vmlinux.lds.S27
-rw-r--r--arch/frv/mm/tlb-miss.S2
-rw-r--r--arch/m32r/kernel/signal.c17
-rw-r--r--arch/m32r/kernel/syscall_table.S40
-rw-r--r--arch/m68k/atari/atakeyb.c3
-rw-r--r--arch/mips/Kconfig33
-rw-r--r--arch/mips/au1000/Kconfig1
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cevt-r4k.c14
-rw-r--r--arch/mips/kernel/csrc-r4k.c33
-rw-r--r--arch/mips/kernel/setup.c31
-rw-r--r--arch/mips/kernel/smp-up.c67
-rw-r--r--arch/mips/kernel/time.c112
-rw-r--r--arch/mips/kernel/vpe.c4
-rw-r--r--arch/mips/math-emu/ieee754.c2
-rw-r--r--arch/mips/math-emu/ieee754dp.c2
-rw-r--r--arch/mips/math-emu/ieee754sp.c2
-rw-r--r--arch/mips/mipssim/sim_time.c6
-rw-r--r--arch/mips/mm/dma-default.c37
-rw-r--r--arch/mips/mm/init.c43
-rw-r--r--arch/mips/pmc-sierra/Kconfig2
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c134
-rw-r--r--arch/mips/sgi-ip22/ip22-nvram.c40
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c19
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c24
-rw-r--r--arch/mips/vr41xx/Kconfig6
-rw-r--r--arch/powerpc/Kconfig5
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts16
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts20
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts108
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts126
-rw-r--r--arch/powerpc/configs/mpc832x_mds_defconfig48
-rw-r--r--arch/powerpc/configs/mpc832x_rdb_defconfig41
-rw-r--r--arch/powerpc/configs/mpc834x_itx_defconfig2
-rw-r--r--arch/powerpc/configs/mpc834x_itxgp_defconfig88
-rw-r--r--arch/powerpc/configs/mpc834x_mds_defconfig48
-rw-r--r--arch/powerpc/configs/mpc836x_mds_defconfig48
-rw-r--r--arch/powerpc/configs/mpc8568mds_defconfig48
-rw-r--r--arch/powerpc/kernel/asm-offsets.c4
-rw-r--r--arch/powerpc/kernel/rtas.c111
-rw-r--r--arch/powerpc/kernel/time.c5
-rw-r--r--arch/powerpc/kernel/vdso.c11
-rw-r--r--arch/powerpc/kernel/vdso32/cacheflush.S41
-rw-r--r--arch/powerpc/kernel/vdso64/cacheflush.S41
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/mm/mmu_decl.h2
-rw-r--r--arch/powerpc/mm/stab.c1
-rw-r--r--arch/powerpc/platforms/40x/walnut.c3
-rw-r--r--arch/powerpc/platforms/44x/bamboo.c3
-rw-r--r--arch/powerpc/platforms/44x/ebony.c3
-rw-r--r--arch/powerpc/platforms/44x/sequoia.c3
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c31
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c14
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c24
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c55
-rw-r--r--arch/powerpc/platforms/83xx/usb.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c1
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c3
-rw-r--r--arch/powerpc/sysdev/uic.c18
-rw-r--r--arch/ppc/kernel/setup.c7
-rw-r--r--arch/ppc/mm/init.c2
-rw-r--r--arch/ppc/mm/mmu_decl.h2
-rw-r--r--arch/ppc/platforms/4xx/yucca.c1
-rw-r--r--arch/ppc/syslib/virtex_devices.c31
-rw-r--r--arch/s390/appldata/appldata.h1
-rw-r--r--arch/s390/appldata/appldata_base.c74
-rw-r--r--arch/s390/appldata/appldata_mem.c1
-rw-r--r--arch/s390/appldata/appldata_net_sum.c1
-rw-r--r--arch/s390/appldata/appldata_os.c1
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/entry.S120
-rw-r--r--arch/s390/kernel/entry64.S114
-rw-r--r--arch/s390/kernel/setup.c6
-rw-r--r--arch/s390/kernel/smp.c56
-rw-r--r--arch/s390/kernel/traps.c1
-rw-r--r--arch/s390/mm/cmm.c3
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c2
-rw-r--r--arch/sh/configs/r7780mp_defconfig287
-rw-r--r--arch/sh/configs/r7785rp_defconfig10
-rw-r--r--arch/sh/mm/fault.c33
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/drivers/ubd_kern.c1
-rw-r--r--arch/um/os-Linux/time.c54
-rw-r--r--arch/x86/Makefile5
-rw-r--r--arch/x86/boot/header.S41
-rw-r--r--arch/x86/kernel/acpi/processor.c3
-rw-r--r--arch/x86/kernel/acpi/sleep_64.c3
-rw-r--r--arch/x86/kernel/apic_32.c2
-rw-r--r--arch/x86/kernel/i386_ksyms_32.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c33
-rw-r--r--arch/x86/kernel/io_apic_64.c24
-rw-r--r--arch/x86/kernel/kprobes_64.c2
-rw-r--r--arch/x86/kernel/nmi_32.c9
-rw-r--r--arch/x86/kernel/paravirt_32.c4
-rw-r--r--arch/x86/kernel/pci-dma_64.c2
-rw-r--r--arch/x86/kernel/traps_32.c7
-rw-r--r--arch/x86/kernel/traps_64.c9
-rw-r--r--arch/x86/lguest/Kconfig1
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/pci/acpi.c2
-rw-r--r--arch/x86/pci/common.c16
-rw-r--r--arch/x86/xen/mmu.c4
-rw-r--r--block/blktrace.c9
-rw-r--r--block/genhd.c1
-rw-r--r--block/ll_rw_blk.c23
-rw-r--r--crypto/algapi.c6
-rw-r--r--crypto/authenc.c12
-rw-r--r--drivers/acpi/Kconfig18
-rw-r--r--drivers/acpi/Makefile2
-rw-r--r--drivers/acpi/ac.c20
-rw-r--r--drivers/acpi/battery.c22
-rw-r--r--drivers/acpi/ec.c100
-rw-r--r--drivers/acpi/osl.c25
-rw-r--r--drivers/acpi/processor_core.c33
-rw-r--r--drivers/acpi/processor_idle.c112
-rw-r--r--drivers/acpi/processor_throttling.c286
-rw-r--r--drivers/acpi/sbs.c43
-rw-r--r--drivers/acpi/tables/tbutils.c2
-rw-r--r--drivers/acpi/video.c155
-rw-r--r--drivers/ata/ata_piix.c93
-rw-r--r--drivers/ata/libata-core.c108
-rw-r--r--drivers/ata/libata-eh.c95
-rw-r--r--drivers/ata/libata-scsi.c38
-rw-r--r--drivers/ata/pata_ali.c20
-rw-r--r--drivers/ata/pata_bf54x.c6
-rw-r--r--drivers/ata/pata_hpt37x.c2
-rw-r--r--drivers/ata/pata_isapnp.c11
-rw-r--r--drivers/ata/pata_jmicron.c9
-rw-r--r--drivers/ata/pata_sil680.c32
-rw-r--r--drivers/ata/pata_sis.c1
-rw-r--r--drivers/ata/sata_sil24.c26
-rw-r--r--drivers/atm/he.c10
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/power/Makefile3
-rw-r--r--drivers/base/power/main.c8
-rw-r--r--drivers/base/power/power.h28
-rw-r--r--drivers/block/virtio_blk.c10
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/sonypi.c8
-rw-r--r--drivers/char/tpm/tpm_tis.c10
-rw-r--r--drivers/dma/Kconfig8
-rw-r--r--drivers/ide/Kconfig47
-rw-r--r--drivers/ide/Makefile2
-rw-r--r--drivers/ide/cris/ide-cris.c7
-rw-r--r--drivers/ide/ide-dma.c1
-rw-r--r--drivers/ide/ide-iops.c13
-rw-r--r--drivers/ide/ide-probe.c32
-rw-r--r--drivers/ide/legacy/ali14xx.c7
-rw-r--r--drivers/ide/legacy/macide.c2
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/pci/aec62xx.c11
-rw-r--r--drivers/ide/pci/alim15x3.c5
-rw-r--r--drivers/ide/pci/piix.c1
-rw-r--r--drivers/ide/pci/siimage.c45
-rw-r--r--drivers/ide/pci/sis5513.c1
-rw-r--r--drivers/ide/pci/trm290.c3
-rw-r--r--drivers/ide/ppc/pmac.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_av.c8
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_cq.c19
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c15
-rw-r--r--drivers/infiniband/hw/ipath/ipath_srq.c44
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c3
-rw-r--r--drivers/infiniband/ulp/iser/iser_memory.c6
-rw-r--r--drivers/input/keyboard/Kconfig2
-rw-r--r--drivers/input/keyboard/gpio_keys.c38
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h8
-rw-r--r--drivers/isdn/hisax/hfcscard.c3
-rw-r--r--drivers/isdn/i4l/isdn_net.c8
-rw-r--r--drivers/kvm/kvm_main.c3
-rw-r--r--drivers/kvm/svm.c1
-rw-r--r--drivers/kvm/x86_emulate.c6
-rw-r--r--drivers/lguest/lguest_device.c2
-rw-r--r--drivers/mfd/sm501.c2
-rw-r--r--drivers/misc/sony-laptop.c10
-rw-r--r--drivers/misc/thinkpad_acpi.c231
-rw-r--r--drivers/misc/thinkpad_acpi.h4
-rw-r--r--drivers/mmc/card/block.c22
-rw-r--r--drivers/mmc/card/queue.c3
-rw-r--r--drivers/mmc/card/sdio_uart.c2
-rw-r--r--drivers/mmc/host/tifm_sd.c18
-rw-r--r--drivers/net/bfin_mac.c2
-rw-r--r--drivers/net/bfin_mac.h2
-rw-r--r--drivers/net/mlx4/qp.c2
-rw-r--r--drivers/net/plip.c4
-rw-r--r--drivers/net/virtio_net.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c4
-rw-r--r--drivers/pci/hotplug/acpiphp.h8
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c29
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c36
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c47
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c41
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c96
-rw-r--r--drivers/pci/hotplug/fakephp.c14
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c16
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c19
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c15
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c1
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c16
-rw-r--r--drivers/pci/pci-sysfs.c4
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c29
-rw-r--r--drivers/pci/pcie/portdrv_pci.c2
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c39
-rw-r--r--drivers/pnp/resource.c4
-rw-r--r--drivers/ps3/Makefile4
-rw-r--r--drivers/ps3/ps3-sys-manager.c (renamed from drivers/ps3/sys-manager.c)0
-rw-r--r--drivers/ps3/ps3-vuart.c (renamed from drivers/ps3/vuart.c)0
-rw-r--r--drivers/rtc/Kconfig2
-rw-r--r--drivers/rtc/interface.c4
-rw-r--r--drivers/rtc/rtc-dev.c12
-rw-r--r--drivers/s390/cio/css.c2
-rw-r--r--drivers/s390/cio/device_fsm.c2
-rw-r--r--drivers/s390/cio/device_id.c45
-rw-r--r--drivers/scsi/ide-scsi.c22
-rw-r--r--drivers/scsi/zorro7xx.c3
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/serial/ip22zilog.c247
-rw-r--r--drivers/serial/pxa.c4
-rw-r--r--drivers/spi/Kconfig2
-rw-r--r--drivers/spi/atmel_spi.c2
-rw-r--r--drivers/spi/spi_s3c24xx_gpio.c21
-rw-r--r--drivers/usb/README6
-rw-r--r--drivers/usb/core/driver.c11
-rw-r--r--drivers/usb/core/hcd.c3
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/core/message.c36
-rw-r--r--drivers/usb/core/sysfs.c6
-rw-r--r--drivers/usb/core/usb.c25
-rw-r--r--drivers/usb/gadget/omap_udc.c6
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c16
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ehci-hcd.c5
-rw-r--r--drivers/usb/image/microtek.c2
-rw-r--r--drivers/usb/misc/adutux.c262
-rw-r--r--drivers/usb/misc/usbled.c4
-rw-r--r--drivers/usb/serial/generic.c5
-rw-r--r--drivers/usb/serial/keyspan.c32
-rw-r--r--drivers/usb/serial/mos7840.c2
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h3
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/usb/storage/unusual_devs.h17
-rw-r--r--drivers/video/Kconfig11
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/atmel_lcdfb.c4
-rw-r--r--drivers/video/aty/radeon_base.c1
-rw-r--r--drivers/video/console/Kconfig2
-rw-r--r--drivers/video/efifb.c232
-rw-r--r--drivers/video/fb_ddc.c8
-rw-r--r--drivers/video/imacfb.c4
-rw-r--r--drivers/video/ps3fb.c11
-rw-r--r--drivers/virtio/virtio.c13
-rw-r--r--drivers/zorro/zorro-driver.c15
-rw-r--r--fs/Kconfig9
-rw-r--r--fs/cifs/CHANGES3
-rw-r--r--fs/cifs/README27
-rw-r--r--fs/cifs/TODO2
-rw-r--r--fs/cifs/cifs_spnego.c20
-rw-r--r--fs/cifs/cifs_spnego.h1
-rw-r--r--fs/cifs/cifsacl.c13
-rw-r--r--fs/cifs/cifsfs.c7
-rw-r--r--fs/cifs/cifsglob.h13
-rw-r--r--fs/cifs/cifsproto.h17
-rw-r--r--fs/cifs/cifssmb.c97
-rw-r--r--fs/cifs/connect.c141
-rw-r--r--fs/cifs/file.c44
-rw-r--r--fs/cifs/inode.c26
-rw-r--r--fs/cifs/sess.c93
-rw-r--r--fs/cifs/transport.c91
-rw-r--r--fs/compat_ioctl.c6
-rw-r--r--fs/exec.c6
-rw-r--r--fs/ext2/ext2.h7
-rw-r--r--fs/fuse/dir.c81
-rw-r--r--fs/fuse/file.c47
-rw-r--r--fs/fuse/fuse_i.h5
-rw-r--r--fs/fuse/inode.c4
-rw-r--r--fs/nfs/dir.c1
-rw-r--r--fs/nfs/direct.c142
-rw-r--r--fs/nfs/getroot.c81
-rw-r--r--fs/nfs/super.c11
-rw-r--r--fs/nfs/write.c3
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/cluster/masklog.h2
-rw-r--r--fs/ocfs2/dcache.c20
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c4
-rw-r--r--fs/ocfs2/file.c19
-rw-r--r--fs/ocfs2/inode.c6
-rw-r--r--fs/ocfs2/localalloc.c5
-rw-r--r--fs/ocfs2/super.c6
-rw-r--r--fs/proc/array.c4
-rw-r--r--fs/proc/base.c51
-rw-r--r--fs/proc/generic.c37
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/sysfs/file.c6
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-arm/arch-at91/board.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/irqs.h2
-rw-r--r--include/asm-arm/arch-omap/board-innovator.h2
-rw-r--r--include/asm-arm/arch-pxa/irqs.h20
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa300.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa320.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp.h18
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h5
-rw-r--r--include/asm-arm/arch-s3c2410/spi-gpio.h2
-rw-r--r--include/asm-blackfin/bfin-global.h5
-rw-r--r--include/asm-blackfin/cplbinit.h33
-rw-r--r--include/asm-blackfin/delay.h66
-rw-r--r--include/asm-blackfin/io.h1
-rw-r--r--include/asm-blackfin/mach-bf527/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf527/mem_map.h3
-rw-r--r--include/asm-blackfin/mach-bf533/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf533/mem_map.h4
-rw-r--r--include/asm-blackfin/mach-bf537/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf537/mem_map.h3
-rw-r--r--include/asm-blackfin/mach-bf548/bf548.h34
-rw-r--r--include/asm-blackfin/mach-bf548/defBF544.h2
-rw-r--r--include/asm-blackfin/mach-bf548/defBF548.h2
-rw-r--r--include/asm-blackfin/mach-bf548/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf548/mem_map.h18
-rw-r--r--include/asm-blackfin/mach-bf561/bf561.h19
-rw-r--r--include/asm-blackfin/mach-bf561/defBF561.h15
-rw-r--r--include/asm-blackfin/mach-bf561/irq.h4
-rw-r--r--include/asm-blackfin/mach-bf561/mem_map.h7
-rw-r--r--include/asm-blackfin/mach-common/def_LPBlackfin.h8
-rw-r--r--include/asm-blackfin/page_offset.h2
-rw-r--r--include/asm-blackfin/string.h2
-rw-r--r--include/asm-blackfin/traps.h96
-rw-r--r--include/asm-generic/resource.h2
-rw-r--r--include/asm-ia64/acpi.h1
-rw-r--r--include/asm-m32r/thread_info.h11
-rw-r--r--include/asm-m32r/unistd.h66
-rw-r--r--include/asm-mips/8253pit.h10
-rw-r--r--include/asm-mips/cpu-features.h6
-rw-r--r--include/asm-mips/dma.h1
-rw-r--r--include/asm-mips/futex.h6
-rw-r--r--include/asm-mips/i8253.h2
-rw-r--r--include/asm-mips/ip32/ip32_ints.h2
-rw-r--r--include/asm-mips/system.h10
-rw-r--r--include/asm-mips/time.h16
-rw-r--r--include/asm-powerpc/page_32.h4
-rw-r--r--include/asm-powerpc/pci-bridge.h5
-rw-r--r--include/asm-powerpc/rtas.h3
-rw-r--r--include/asm-powerpc/vdso_datapage.h8
-rw-r--r--include/asm-s390/system.h5
-rw-r--r--include/asm-sh/cacheflush.h2
-rw-r--r--include/asm-x86/acpi.h27
-rw-r--r--include/asm-x86/apic_32.h1
-rw-r--r--include/linux/acpi.h5
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/ext2_fs.h7
-rw-r--r--include/linux/fuse.h5
-rw-r--r--include/linux/input.h5
-rw-r--r--include/linux/kd.h2
-rw-r--r--include/linux/libata.h5
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/pnp.h4
-rw-r--r--include/linux/rtc.h5
-rw-r--r--include/linux/scatterlist.h37
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/screen_info.h2
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/linux/sunrpc/debug.h5
-rw-r--r--include/linux/sunrpc/xprtsock.h6
-rw-r--r--include/linux/sysctl.h6
-rw-r--r--include/linux/timex.h1
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--include/net/ieee80211.h8
-rw-r--r--include/net/inet_hashtables.h3
-rw-r--r--include/net/ip_vs.h34
-rw-r--r--include/net/sock.h3
-rw-r--r--include/net/tcp.h3
-rw-r--r--include/sound/version.h2
-rw-r--r--init/Kconfig2
-rw-r--r--ipc/mqueue.c6
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/exit.c11
-rw-r--r--kernel/kallsyms.c7
-rw-r--r--kernel/module.c8
-rw-r--r--kernel/sched.c5
-rw-r--r--kernel/sched_debug.c10
-rw-r--r--kernel/sched_fair.c12
-rw-r--r--kernel/sched_stats.h3
-rw-r--r--kernel/sysctl_check.c45
-rw-r--r--kernel/time/ntp.c9
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--kernel/user.c7
-rw-r--r--kernel/utsname_sysctl.c4
-rw-r--r--lib/Kconfig.debug4
-rw-r--r--lib/hexdump.c3
-rw-r--r--lib/kobject.c4
-rw-r--r--mm/page_alloc.c24
-rw-r--r--mm/rmap.c9
-rw-r--r--mm/shmem.c5
-rw-r--r--mm/slab.c4
-rw-r--r--mm/sparse-vmemmap.c12
-rw-r--r--net/bridge/netfilter/ebt_among.c2
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/core/skbuff.c31
-rw-r--r--net/dccp/ccids/lib/loss_interval.c2
-rw-r--r--net/ieee80211/ieee80211_crypt_ccmp.c2
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c4
-rw-r--r--net/ipv4/arp.c22
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c24
-rw-r--r--net/ipv4/ipvs/ip_vs_lblc.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_proto.c2
-rw-r--r--net/ipv4/netfilter/iptable_raw.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c5
-rw-r--r--net/ipv4/route.c8
-rw-r--r--net/ipv4/sysctl_net_ipv4.c2
-rw-r--r--net/ipv4/tcp_ipv4.c11
-rw-r--r--net/ipv4/tcp_output.c21
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/tcp_ipv6.c11
-rw-r--r--net/irda/iriap.c2
-rw-r--r--net/irda/irlan/irlan_eth.c2
-rw-r--r--net/iucv/iucv.c107
-rw-r--r--net/key/af_key.c4
-rw-r--r--net/mac80211/ieee80211.c27
-rw-r--r--net/mac80211/ieee80211_sta.c2
-rw-r--r--net/sctp/sm_statefuns.c2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c4
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_mech.c8
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seal.c1
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--net/sunrpc/xprt.c2
-rw-r--r--net/sunrpc/xprtrdma/transport.c10
-rw-r--r--net/sunrpc/xprtsock.c4
-rw-r--r--net/wireless/wext.c2
-rw-r--r--net/xfrm/xfrm_state.c2
-rw-r--r--net/xfrm/xfrm_user.c2
-rwxr-xr-xscripts/checkpatch.pl395
-rw-r--r--security/commoncap.c9
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c12
-rw-r--r--sound/drivers/portman2x4.c2
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c18
-rw-r--r--sound/pci/ca0106/ca0106_proc.c4
-rw-r--r--sound/pci/cmipci.c5
-rw-r--r--sound/pci/emu10k1/emumixer.c65
-rw-r--r--sound/pci/emu10k1/p16v.c4
-rw-r--r--sound/pci/hda/hda_codec.c40
-rw-r--r--sound/pci/hda/hda_local.h1
-rw-r--r--sound/pci/hda/patch_analog.c8
-rw-r--r--sound/pci/hda/patch_sigmatel.c57
-rw-r--r--sound/soc/codecs/cs4270.c3
-rw-r--r--sound/soc/s3c24xx/s3c2443-ac97.c2
570 files changed, 8387 insertions, 5329 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 299615d821ac..c3014df066c4 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -262,6 +262,8 @@ mtrr.txt
262 - how to use PPro Memory Type Range Registers to increase performance. 262 - how to use PPro Memory Type Range Registers to increase performance.
263mutex-design.txt 263mutex-design.txt
264 - info on the generic mutex subsystem. 264 - info on the generic mutex subsystem.
265namespaces/
266 - directory with various information about namespaces
265nbd.txt 267nbd.txt
266 - info on a TCP implementation of a network block device. 268 - info on a TCP implementation of a network block device.
267netlabel/ 269netlabel/
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 054a7ecf64c6..4953bc258729 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
11 procfs-guide.xml writing_usb_driver.xml \ 11 procfs-guide.xml writing_usb_driver.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml 14 genericirq.xml s390-drivers.xml uio-howto.xml
15 15
16### 16###
17# The build process is as follows (targets): 17# The build process is as follows (targets):
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index c119484258b8..fdd7f4f887b7 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -30,6 +30,12 @@
30 30
31<revhistory> 31<revhistory>
32 <revision> 32 <revision>
33 <revnumber>0.4</revnumber>
34 <date>2007-11-26</date>
35 <authorinitials>hjk</authorinitials>
36 <revremark>Removed section about uio_dummy.</revremark>
37 </revision>
38 <revision>
33 <revnumber>0.3</revnumber> 39 <revnumber>0.3</revnumber>
34 <date>2007-04-29</date> 40 <date>2007-04-29</date>
35 <authorinitials>hjk</authorinitials> 41 <authorinitials>hjk</authorinitials>
@@ -94,6 +100,26 @@ interested in translating it, please email me
94 user space. This simplifies development and reduces the risk of 100 user space. This simplifies development and reduces the risk of
95 serious bugs within a kernel module. 101 serious bugs within a kernel module.
96 </para> 102 </para>
103 <para>
104 Please note that UIO is not an universal driver interface. Devices
105 that are already handled well by other kernel subsystems (like
106 networking or serial or USB) are no candidates for an UIO driver.
107 Hardware that is ideally suited for an UIO driver fulfills all of
108 the following:
109 </para>
110<itemizedlist>
111<listitem>
112 <para>The device has memory that can be mapped. The device can be
113 controlled completely by writing to this memory.</para>
114</listitem>
115<listitem>
116 <para>The device usually generates interrupts.</para>
117</listitem>
118<listitem>
119 <para>The device does not fit into one of the standard kernel
120 subsystems.</para>
121</listitem>
122</itemizedlist>
97</sect1> 123</sect1>
98 124
99<sect1 id="thanks"> 125<sect1 id="thanks">
@@ -174,8 +200,9 @@ interested in translating it, please email me
174 For cards that don't generate interrupts but need to be 200 For cards that don't generate interrupts but need to be
175 polled, there is the possibility to set up a timer that 201 polled, there is the possibility to set up a timer that
176 triggers the interrupt handler at configurable time intervals. 202 triggers the interrupt handler at configurable time intervals.
177 See <filename>drivers/uio/uio_dummy.c</filename> for an 203 This interrupt simulation is done by calling
178 example of this technique. 204 <function>uio_event_notify()</function>
205 from the timer's event handler.
179 </para> 206 </para>
180 207
181 <para> 208 <para>
@@ -263,63 +290,11 @@ offset = N * getpagesize();
263</sect1> 290</sect1>
264</chapter> 291</chapter>
265 292
266<chapter id="using-uio_dummy" xreflabel="Using uio_dummy">
267<?dbhtml filename="using-uio_dummy.html"?>
268<title>Using uio_dummy</title>
269 <para>
270 Well, there is no real use for uio_dummy. Its only purpose is
271 to test most parts of the UIO system (everything except
272 hardware interrupts), and to serve as an example for the
273 kernel module that you will have to write yourself.
274 </para>
275
276<sect1 id="what_uio_dummy_does">
277<title>What uio_dummy does</title>
278 <para>
279 The kernel module <filename>uio_dummy.ko</filename> creates a
280 device that uses a timer to generate periodic interrupts. The
281 interrupt handler does nothing but increment a counter. The
282 driver adds two custom attributes, <varname>count</varname>
283 and <varname>freq</varname>, that appear under
284 <filename>/sys/devices/platform/uio_dummy/</filename>.
285 </para>
286
287 <para>
288 The attribute <varname>count</varname> can be read and
289 written. The associated file
290 <filename>/sys/devices/platform/uio_dummy/count</filename>
291 appears as a normal text file and contains the total number of
292 timer interrupts. If you look at it (e.g. using
293 <function>cat</function>), you'll notice it is slowly counting
294 up.
295 </para>
296
297 <para>
298 The attribute <varname>freq</varname> can be read and written.
299 The content of
300 <filename>/sys/devices/platform/uio_dummy/freq</filename>
301 represents the number of system timer ticks between two timer
302 interrupts. The default value of <varname>freq</varname> is
303 the value of the kernel variable <varname>HZ</varname>, which
304 gives you an interval of one second. Lower values will
305 increase the frequency. Try the following:
306 </para>
307<programlisting format="linespecific">
308cd /sys/devices/platform/uio_dummy/
309echo 100 > freq
310</programlisting>
311 <para>
312 Use <function>cat count</function> to see how the interrupt
313 frequency changes.
314 </para>
315</sect1>
316</chapter>
317
318<chapter id="custom_kernel_module" xreflabel="Writing your own kernel module"> 293<chapter id="custom_kernel_module" xreflabel="Writing your own kernel module">
319<?dbhtml filename="custom_kernel_module.html"?> 294<?dbhtml filename="custom_kernel_module.html"?>
320<title>Writing your own kernel module</title> 295<title>Writing your own kernel module</title>
321 <para> 296 <para>
322 Please have a look at <filename>uio_dummy.c</filename> as an 297 Please have a look at <filename>uio_cif.c</filename> as an
323 example. The following paragraphs explain the different 298 example. The following paragraphs explain the different
324 sections of this file. 299 sections of this file.
325 </para> 300 </para>
@@ -354,9 +329,8 @@ See the description below for details.
354interrupt, it's your modules task to determine the irq number during 329interrupt, it's your modules task to determine the irq number during
355initialization. If you don't have a hardware generated interrupt but 330initialization. If you don't have a hardware generated interrupt but
356want to trigger the interrupt handler in some other way, set 331want to trigger the interrupt handler in some other way, set
357<varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>. The 332<varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>.
358uio_dummy module does this as it triggers the event mechanism in a timer 333If you had no interrupt at all, you could set
359routine. If you had no interrupt at all, you could set
360<varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this 334<varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this
361rarely makes sense. 335rarely makes sense.
362</para></listitem> 336</para></listitem>
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 42008395534d..9b0e322118b5 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -1040,6 +1040,11 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1040 / getpagesize(); 1040 / getpagesize();
1041 p = get_pages(pages); 1041 p = get_pages(pages);
1042 1042
1043 /* Initialize the virtqueue */
1044 vq->next = NULL;
1045 vq->last_avail_idx = 0;
1046 vq->dev = dev;
1047
1043 /* Initialize the configuration. */ 1048 /* Initialize the configuration. */
1044 vq->config.num = num_descs; 1049 vq->config.num = num_descs;
1045 vq->config.irq = devices.next_irq++; 1050 vq->config.irq = devices.next_irq++;
@@ -1057,9 +1062,6 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1057 for (i = &dev->vq; *i; i = &(*i)->next); 1062 for (i = &dev->vq; *i; i = &(*i)->next);
1058 *i = vq; 1063 *i = vq;
1059 1064
1060 /* Link virtqueue back to device. */
1061 vq->dev = dev;
1062
1063 /* Set the routine to call when the Guest does something to this 1065 /* Set the routine to call when the Guest does something to this
1064 * virtqueue. */ 1066 * virtqueue. */
1065 vq->handle_output = handle_output; 1067 vq->handle_output = handle_output;
@@ -1093,6 +1095,7 @@ static struct device *new_device(const char *name, u16 type, int fd,
1093 dev->desc = new_dev_desc(type); 1095 dev->desc = new_dev_desc(type);
1094 dev->handle_input = handle_input; 1096 dev->handle_input = handle_input;
1095 dev->name = name; 1097 dev->name = name;
1098 dev->vq = NULL;
1096 return dev; 1099 return dev;
1097} 1100}
1098 1101
diff --git a/Documentation/namespaces/compatibility-list.txt b/Documentation/namespaces/compatibility-list.txt
new file mode 100644
index 000000000000..defc5589bfcd
--- /dev/null
+++ b/Documentation/namespaces/compatibility-list.txt
@@ -0,0 +1,39 @@
1 Namespaces compatibility list
2
3This document contains the information about the problems user
4may have when creating tasks living in different namespaces.
5
6Here's the summary. This matrix shows the known problems, that
7occur when tasks share some namespace (the columns) while living
8in different other namespaces (the rows):
9
10 UTS IPC VFS PID User Net
11UTS X
12IPC X 1
13VFS X
14PID 1 1 X
15User 2 2 X
16Net X
17
181. Both the IPC and the PID namespaces provide IDs to address
19 object inside the kernel. E.g. semaphore with IPCID or
20 process group with pid.
21
22 In both cases, tasks shouldn't try exposing this ID to some
23 other task living in a different namespace via a shared filesystem
24 or IPC shmem/message. The fact is that this ID is only valid
25 within the namespace it was obtained in and may refer to some
26 other object in another namespace.
27
282. Intentionally, two equal user IDs in different user namespaces
29 should not be equal from the VFS point of view. In other
30 words, user 10 in one user namespace shouldn't have the same
31 access permissions to files, belonging to user 10 in another
32 namespace.
33
34 The same is true for the IPC namespaces being shared - two users
35 from different user namespaces should not access the same IPC objects
36 even having equal UIDs.
37
38 But currently this is not so.
39
diff --git a/Documentation/parport-lowlevel.txt b/Documentation/parport-lowlevel.txt
index 265fcdcb8e5f..120eb20dbb09 100644
--- a/Documentation/parport-lowlevel.txt
+++ b/Documentation/parport-lowlevel.txt
@@ -339,6 +339,10 @@ Use this function to register your device driver on a parallel port
339('port'). Once you have done that, you will be able to use 339('port'). Once you have done that, you will be able to use
340parport_claim and parport_release in order to use the port. 340parport_claim and parport_release in order to use the port.
341 341
342The ('name') argument is the name of the device that appears in /proc
343filesystem. The string must be valid for the whole lifetime of the
344device (until parport_unregister_device is called).
345
342This function will register three callbacks into your driver: 346This function will register three callbacks into your driver:
343'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to 347'preempt', 'wakeup' and 'irq'. Each of these may be NULL in order to
344indicate that you do not want a callback. 348indicate that you do not want a callback.
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index ac1be25c1e25..e9a3cb1d6b06 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1645,8 +1645,9 @@ platforms are moved over to use the flattened-device-tree model.
1645 MAC addresses passed by the firmware when no information other 1645 MAC addresses passed by the firmware when no information other
1646 than indices is available to associate an address with a device. 1646 than indices is available to associate an address with a device.
1647 - phy-connection-type : a string naming the controller/PHY interface type, 1647 - phy-connection-type : a string naming the controller/PHY interface type,
1648 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "tbi", 1648 i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id" (Internal
1649 or "rtbi". 1649 Delay), "rgmii-txid" (delay on TX only), "rgmii-rxid" (delay on RX only),
1650 "tbi", or "rtbi".
1650 1651
1651 Example: 1652 Example:
1652 ucc@2000 { 1653 ucc@2000 {
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index ec499265deca..10c041ca13c7 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -1,7 +1,7 @@
1 ThinkPad ACPI Extras Driver 1 ThinkPad ACPI Extras Driver
2 2
3 Version 0.16 3 Version 0.17
4 August 2nd, 2007 4 October 04th, 2007
5 5
6 Borislav Deianov <borislav@users.sf.net> 6 Borislav Deianov <borislav@users.sf.net>
7 Henrique de Moraes Holschuh <hmh@hmh.eng.br> 7 Henrique de Moraes Holschuh <hmh@hmh.eng.br>
@@ -923,19 +923,34 @@ sysfs backlight device "thinkpad_screen"
923This feature allows software control of the LCD brightness on ThinkPad 923This feature allows software control of the LCD brightness on ThinkPad
924models which don't have a hardware brightness slider. 924models which don't have a hardware brightness slider.
925 925
926It has some limitations: the LCD backlight cannot be actually turned on or off 926It has some limitations: the LCD backlight cannot be actually turned on or
927by this interface, and in many ThinkPad models, the "dim while on battery" 927off by this interface, and in many ThinkPad models, the "dim while on
928functionality will be enabled by the BIOS when this interface is used, and 928battery" functionality will be enabled by the BIOS when this interface is
929cannot be controlled. 929used, and cannot be controlled.
930 930
931The backlight control has eight levels, ranging from 0 to 7. Some of the 931On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
932levels may not be distinct. 932has eight brightness levels, ranging from 0 to 7. Some of the levels
933 933may not be distinct. Later Lenovo models that implement the ACPI
934There are two interfaces to the firmware for brightness control, EC and CMOS. 934display backlight brightness control methods have 16 levels, ranging
935To select which one should be used, use the brightness_mode module parameter: 935from 0 to 15.
936brightness_mode=1 selects EC mode, brightness_mode=2 selects CMOS mode, 936
937brightness_mode=3 selects both EC and CMOS. The driver tries to autodetect 937There are two interfaces to the firmware for direct brightness control,
938which interface to use. 938EC and CMOS. To select which one should be used, use the
939brightness_mode module parameter: brightness_mode=1 selects EC mode,
940brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC
941and CMOS. The driver tries to autodetect which interface to use.
942
943When display backlight brightness controls are available through the
944standard ACPI interface, it is best to use it instead of this direct
945ThinkPad-specific interface. The driver will disable its native
946backlight brightness control interface if it detects that the standard
947ACPI interface is available in the ThinkPad.
948
949The brightness_enable module parameter can be used to control whether
950the LCD brightness control feature will be enabled when available.
951brightness_enable=0 forces it to be disabled. brightness_enable=1
952forces it to be enabled when available, even if the standard ACPI
953interface is also available.
939 954
940Procfs notes: 955Procfs notes:
941 956
@@ -947,11 +962,11 @@ Procfs notes:
947 962
948Sysfs notes: 963Sysfs notes:
949 964
950The interface is implemented through the backlight sysfs class, which is poorly 965The interface is implemented through the backlight sysfs class, which is
951documented at this time. 966poorly documented at this time.
952 967
953Locate the thinkpad_screen device under /sys/class/backlight, and inside it 968Locate the thinkpad_screen device under /sys/class/backlight, and inside
954there will be the following attributes: 969it there will be the following attributes:
955 970
956 max_brightness: 971 max_brightness:
957 Reads the maximum brightness the hardware can be set to. 972 Reads the maximum brightness the hardware can be set to.
@@ -961,17 +976,19 @@ there will be the following attributes:
961 Reads what brightness the screen is set to at this instant. 976 Reads what brightness the screen is set to at this instant.
962 977
963 brightness: 978 brightness:
964 Writes request the driver to change brightness to the given 979 Writes request the driver to change brightness to the
965 value. Reads will tell you what brightness the driver is trying 980 given value. Reads will tell you what brightness the
966 to set the display to when "power" is set to zero and the display 981 driver is trying to set the display to when "power" is set
967 has not been dimmed by a kernel power management event. 982 to zero and the display has not been dimmed by a kernel
983 power management event.
968 984
969 power: 985 power:
970 power management mode, where 0 is "display on", and 1 to 3 will 986 power management mode, where 0 is "display on", and 1 to 3
971 dim the display backlight to brightness level 0 because 987 will dim the display backlight to brightness level 0
972 thinkpad-acpi cannot really turn the backlight off. Kernel 988 because thinkpad-acpi cannot really turn the backlight
973 power management events can temporarily increase the current 989 off. Kernel power management events can temporarily
974 power management level, i.e. they can dim the display. 990 increase the current power management level, i.e. they can
991 dim the display.
975 992
976 993
977Volume control -- /proc/acpi/ibm/volume 994Volume control -- /proc/acpi/ibm/volume
diff --git a/Documentation/tty.txt b/Documentation/tty.txt
index 048a8762cfb5..8e65c4498c52 100644
--- a/Documentation/tty.txt
+++ b/Documentation/tty.txt
@@ -132,6 +132,14 @@ set_termios() Notify the tty driver that the device's termios
132 tty->termios. Previous settings should be passed in 132 tty->termios. Previous settings should be passed in
133 the "old" argument. 133 the "old" argument.
134 134
135 The API is defined such that the driver should return
136 the actual modes selected. This means that the
137 driver function is responsible for modifying any
138 bits in the request it cannot fulfill to indicate
139 the actual modes being used. A device with no
140 hardware capability for change (eg a USB dongle or
141 virtual port) can provide NULL for this method.
142
135throttle() Notify the tty driver that input buffers for the 143throttle() Notify the tty driver that input buffers for the
136 line discipline are close to full, and it should 144 line discipline are close to full, and it should
137 somehow signal that no more characters should be 145 somehow signal that no more characters should be
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt
index 97842deec471..b2fc4d4a9917 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/usb/power-management.txt
@@ -278,6 +278,14 @@ optional. The methods' jobs are quite simple:
278 (although the interfaces will be in the same altsettings as 278 (although the interfaces will be in the same altsettings as
279 before the suspend). 279 before the suspend).
280 280
281If the device is disconnected or powered down while it is suspended,
282the disconnect method will be called instead of the resume or
283reset_resume method. This is also quite likely to happen when
284waking up from hibernation, as many systems do not maintain suspend
285current to the USB host controllers during hibernation. (It's
286possible to work around the hibernation-forces-disconnect problem by
287using the USB Persist facility.)
288
281The reset_resume method is used by the USB Persist facility (see 289The reset_resume method is used by the USB Persist facility (see
282Documentation/usb/persist.txt) and it can also be used under certain 290Documentation/usb/persist.txt) and it can also be used under certain
283circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a 291circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a
diff --git a/Documentation/x86_64/uefi.txt b/Documentation/x86_64/uefi.txt
new file mode 100644
index 000000000000..91a98edfb588
--- /dev/null
+++ b/Documentation/x86_64/uefi.txt
@@ -0,0 +1,29 @@
1General note on [U]EFI x86_64 support
2-------------------------------------
3
4The nomenclature EFI and UEFI are used interchangeably in this document.
5
6Although the tools below are _not_ needed for building the kernel,
7the needed bootloader support and associated tools for x86_64 platforms
8with EFI firmware and specifications are listed below.
9
101. UEFI specification: http://www.uefi.org
11
122. Booting Linux kernel on UEFI x86_64 platform requires bootloader
13 support. Elilo with x86_64 support can be used.
14
153. x86_64 platform with EFI/UEFI firmware.
16
17Mechanics:
18---------
19- Build the kernel with the following configuration.
20 CONFIG_FB_EFI=y
21 CONFIG_FRAMEBUFFER_CONSOLE=y
22- Create a VFAT partition on the disk
23- Copy the following to the VFAT partition:
24 elilo bootloader with x86_64 support, elilo configuration file,
25 kernel image built in first step and corresponding
26 initrd. Instructions on building elilo and its dependencies
27 can be found in the elilo sourceforge project.
28- Boot to EFI shell and invoke elilo choosing the kernel image built
29 in first step.
diff --git a/MAINTAINERS b/MAINTAINERS
index cad0882754a6..7c8392e1797d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -323,8 +323,7 @@ S: Maintained
323ALCATEL SPEEDTOUCH USB DRIVER 323ALCATEL SPEEDTOUCH USB DRIVER
324P: Duncan Sands 324P: Duncan Sands
325M: duncan.sands@free.fr 325M: duncan.sands@free.fr
326L: linux-usb-users@lists.sourceforge.net 326L: linux-usb@vger.kernel.org
327L: linux-usb-devel@lists.sourceforge.net
328W: http://www.linux-usb.org/SpeedTouch/ 327W: http://www.linux-usb.org/SpeedTouch/
329S: Maintained 328S: Maintained
330 329
@@ -440,7 +439,7 @@ S: Maintained
440 439
441ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 440ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
442P: Andrew Victor 441P: Andrew Victor
443M: andrew@sanpeople.com 442M: linux@maxim.org.za
444L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 443L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
445W: http://maxim.org.za/at91_26.html 444W: http://maxim.org.za/at91_26.html
446S: Maintained 445S: Maintained
@@ -1043,7 +1042,7 @@ S: Maintained
1043CIRRUS LOGIC EP93XX OHCI USB HOST DRIVER 1042CIRRUS LOGIC EP93XX OHCI USB HOST DRIVER
1044P: Lennert Buytenhek 1043P: Lennert Buytenhek
1045M: kernel@wantstofly.org 1044M: kernel@wantstofly.org
1046L: linux-usb-devel@lists.sourceforge.net 1045L: linux-usb@vger.kernel.org
1047S: Maintained 1046S: Maintained
1048 1047
1049CIRRUS LOGIC CS4280/CS461x SOUNDDRIVER 1048CIRRUS LOGIC CS4280/CS461x SOUNDDRIVER
@@ -1552,7 +1551,7 @@ S: Maintained
1552FREESCALE HIGHSPEED USB DEVICE DRIVER 1551FREESCALE HIGHSPEED USB DEVICE DRIVER
1553P: Li Yang 1552P: Li Yang
1554M: leoli@freescale.com 1553M: leoli@freescale.com
1555L: linux-usb-devel@lists.sourceforge.net 1554L: linux-usb@vger.kernel.org
1556L: linuxppc-dev@ozlabs.org 1555L: linuxppc-dev@ozlabs.org
1557S: Maintained 1556S: Maintained
1558 1557
@@ -1914,10 +1913,8 @@ L: linux1394-devel@lists.sourceforge.net
1914S: Maintained 1913S: Maintained
1915 1914
1916IMS TWINTURBO FRAMEBUFFER DRIVER 1915IMS TWINTURBO FRAMEBUFFER DRIVER
1917P: Paul Mundt
1918M: lethal@chaoticdreams.org
1919L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1916L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
1920S: Maintained 1917S: Orphan
1921 1918
1922INFINIBAND SUBSYSTEM 1919INFINIBAND SUBSYSTEM
1923P: Roland Dreier 1920P: Roland Dreier
@@ -2113,6 +2110,14 @@ L: irda-users@lists.sourceforge.net (subscribers-only)
2113W: http://irda.sourceforge.net/ 2110W: http://irda.sourceforge.net/
2114S: Maintained 2111S: Maintained
2115 2112
2113ISCSI
2114P: Mike Christie
2115M: michaelc@cs.wisc.edu
2116L: open-iscsi@googlegroups.com
2117W: www.open-iscsi.org
2118T: git kernel.org:/pub/scm/linux/kernel/mnc/linux-2.6-iscsi.git
2119S: Maintained
2120
2116ISAPNP 2121ISAPNP
2117P: Jaroslav Kysela 2122P: Jaroslav Kysela
2118M: perex@perex.cz 2123M: perex@perex.cz
@@ -2446,7 +2451,7 @@ M68K ON APPLE MACINTOSH
2446P: Joshua Thompson 2451P: Joshua Thompson
2447M: funaho@jurai.org 2452M: funaho@jurai.org
2448W: http://www.mac.linux-m68k.org/ 2453W: http://www.mac.linux-m68k.org/
2449L: linux-mac68k@mac.linux-m68k.org 2454L: linux-m68k@lists.linux-m68k.org
2450S: Maintained 2455S: Maintained
2451 2456
2452M68K ON HP9000/300 2457M68K ON HP9000/300
@@ -3636,18 +3641,12 @@ M: laredo@gnu.org
3636W: http://www.stradis.com/ 3641W: http://www.stradis.com/
3637S: Maintained 3642S: Maintained
3638 3643
3639SUPERH (sh) 3644SUPERH
3640P: Paul Mundt 3645P: Paul Mundt
3641M: lethal@linux-sh.org 3646M: lethal@linux-sh.org
3642L: linuxsh-dev@lists.sourceforge.net (subscribers-only) 3647L: linux-sh@vger.kernel.org
3643W: http://www.linux-sh.org
3644S: Maintained
3645
3646SUPERH64 (sh64)
3647P: Paul Mundt
3648M: lethal@linux-sh.org
3649L: linuxsh-shmedia-dev@lists.sourceforge.net
3650W: http://www.linux-sh.org 3648W: http://www.linux-sh.org
3649T: git kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.git
3651S: Maintained 3650S: Maintained
3652 3651
3653SUN3/3X 3652SUN3/3X
@@ -3733,7 +3732,7 @@ S: Maintained
3733TLAN NETWORK DRIVER 3732TLAN NETWORK DRIVER
3734P: Samuel Chessman 3733P: Samuel Chessman
3735M: chessman@tux.org 3734M: chessman@tux.org
3736L: tlan-devel@lists.sourceforge.net 3735L: tlan-devel@lists.sourceforge.net (subscribers-only)
3737W: http://sourceforge.net/projects/tlan/ 3736W: http://sourceforge.net/projects/tlan/
3738S: Maintained 3737S: Maintained
3739 3738
@@ -3818,22 +3817,20 @@ S: Maintained
3818USB ACM DRIVER 3817USB ACM DRIVER
3819P: Oliver Neukum 3818P: Oliver Neukum
3820M: oliver@neukum.name 3819M: oliver@neukum.name
3821L: linux-usb-users@lists.sourceforge.net 3820L: linux-usb@vger.kernel.org
3822L: linux-usb-devel@lists.sourceforge.net
3823S: Maintained 3821S: Maintained
3824 3822
3825USB BLOCK DRIVER (UB ub) 3823USB BLOCK DRIVER (UB ub)
3826P: Pete Zaitcev 3824P: Pete Zaitcev
3827M: zaitcev@redhat.com 3825M: zaitcev@redhat.com
3828L: linux-kernel@vger.kernel.org 3826L: linux-kernel@vger.kernel.org
3829L: linux-usb-devel@lists.sourceforge.net 3827L: linux-usb@vger.kernel.org
3830S: Supported 3828S: Supported
3831 3829
3832USB CDC ETHERNET DRIVER 3830USB CDC ETHERNET DRIVER
3833P: Greg Kroah-Hartman 3831P: Greg Kroah-Hartman
3834M: greg@kroah.com 3832M: greg@kroah.com
3835L: linux-usb-users@lists.sourceforge.net 3833L: linux-usb@vger.kernel.org
3836L: linux-usb-devel@lists.sourceforge.net
3837S: Maintained 3834S: Maintained
3838W: http://www.kroah.com/linux-usb/ 3835W: http://www.kroah.com/linux-usb/
3839 3836
@@ -3847,13 +3844,13 @@ S: Maintained
3847USB EHCI DRIVER 3844USB EHCI DRIVER
3848P: David Brownell 3845P: David Brownell
3849M: dbrownell@users.sourceforge.net 3846M: dbrownell@users.sourceforge.net
3850L: linux-usb-devel@lists.sourceforge.net 3847L: linux-usb@vger.kernel.org
3851S: Odd Fixes 3848S: Odd Fixes
3852 3849
3853USB ET61X[12]51 DRIVER 3850USB ET61X[12]51 DRIVER
3854P: Luca Risolia 3851P: Luca Risolia
3855M: luca.risolia@studio.unibo.it 3852M: luca.risolia@studio.unibo.it
3856L: linux-usb-devel@lists.sourceforge.net 3853L: linux-usb@vger.kernel.org
3857L: video4linux-list@redhat.com 3854L: video4linux-list@redhat.com
3858W: http://www.linux-projects.org 3855W: http://www.linux-projects.org
3859S: Maintained 3856S: Maintained
@@ -3861,41 +3858,33 @@ S: Maintained
3861USB GADGET/PERIPHERAL SUBSYSTEM 3858USB GADGET/PERIPHERAL SUBSYSTEM
3862P: David Brownell 3859P: David Brownell
3863M: dbrownell@users.sourceforge.net 3860M: dbrownell@users.sourceforge.net
3864L: linux-usb-devel@lists.sourceforge.net 3861L: linux-usb@vger.kernel.org
3865W: http://www.linux-usb.org/gadget 3862W: http://www.linux-usb.org/gadget
3866S: Maintained 3863S: Maintained
3867 3864
3868USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 3865USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
3869P: Jiri Kosina 3866P: Jiri Kosina
3870M: jkosina@suse.cz 3867M: jkosina@suse.cz
3871L: linux-usb-devel@lists.sourceforge.net 3868L: linux-usb@vger.kernel.org
3872T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 3869T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git
3873S: Maintained 3870S: Maintained
3874 3871
3875USB HUB DRIVER
3876P: Johannes Erdfelt
3877M: johannes@erdfelt.com
3878L: linux-usb-users@lists.sourceforge.net
3879L: linux-usb-devel@lists.sourceforge.net
3880S: Maintained
3881
3882USB ISP116X DRIVER 3872USB ISP116X DRIVER
3883P: Olav Kongas 3873P: Olav Kongas
3884M: ok@artecdesign.ee 3874M: ok@artecdesign.ee
3885L: linux-usb-devel@lists.sourceforge.net 3875L: linux-usb@vger.kernel.org
3886S: Maintained 3876S: Maintained
3887 3877
3888USB KAWASAKI LSI DRIVER 3878USB KAWASAKI LSI DRIVER
3889P: Oliver Neukum 3879P: Oliver Neukum
3890M: oliver@neukum.name 3880M: oliver@neukum.name
3891L: linux-usb-users@lists.sourceforge.net 3881L: linux-usb@vger.kernel.org
3892L: linux-usb-devel@lists.sourceforge.net
3893S: Maintained 3882S: Maintained
3894 3883
3895USB MASS STORAGE DRIVER 3884USB MASS STORAGE DRIVER
3896P: Matthew Dharm 3885P: Matthew Dharm
3897M: mdharm-usb@one-eyed-alien.net 3886M: mdharm-usb@one-eyed-alien.net
3898L: linux-usb-users@lists.sourceforge.net 3887L: linux-usb@vger.kernel.org
3899L: usb-storage@lists.one-eyed-alien.net 3888L: usb-storage@lists.one-eyed-alien.net
3900S: Maintained 3889S: Maintained
3901W: http://www.one-eyed-alien.net/~mdharm/linux-usb/ 3890W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
@@ -3903,28 +3892,26 @@ W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
3903USB OHCI DRIVER 3892USB OHCI DRIVER
3904P: David Brownell 3893P: David Brownell
3905M: dbrownell@users.sourceforge.net 3894M: dbrownell@users.sourceforge.net
3906L: linux-usb-users@lists.sourceforge.net 3895L: linux-usb@vger.kernel.org
3907L: linux-usb-devel@lists.sourceforge.net
3908S: Odd Fixes 3896S: Odd Fixes
3909 3897
3910USB OPTION-CARD DRIVER 3898USB OPTION-CARD DRIVER
3911P: Matthias Urlichs 3899P: Matthias Urlichs
3912M: smurf@smurf.noris.de 3900M: smurf@smurf.noris.de
3913L: linux-usb-devel@lists.sourceforge.net 3901L: linux-usb@vger.kernel.org
3914S: Maintained 3902S: Maintained
3915 3903
3916USB OV511 DRIVER 3904USB OV511 DRIVER
3917P: Mark McClelland 3905P: Mark McClelland
3918M: mmcclell@bigfoot.com 3906M: mmcclell@bigfoot.com
3919L: linux-usb-users@lists.sourceforge.net 3907L: linux-usb@vger.kernel.org
3920L: linux-usb-devel@lists.sourceforge.net
3921W: http://alpha.dyndns.org/ov511/ 3908W: http://alpha.dyndns.org/ov511/
3922S: Maintained 3909S: Maintained
3923 3910
3924USB PEGASUS DRIVER 3911USB PEGASUS DRIVER
3925P: Petko Manolov 3912P: Petko Manolov
3926M: petkan@users.sourceforge.net 3913M: petkan@users.sourceforge.net
3927L: linux-usb-devel@lists.sourceforge.net 3914L: linux-usb@vger.kernel.org
3928L: netdev@vger.kernel.org 3915L: netdev@vger.kernel.org
3929W: http://pegasus2.sourceforge.net/ 3916W: http://pegasus2.sourceforge.net/
3930S: Maintained 3917S: Maintained
@@ -3932,14 +3919,13 @@ S: Maintained
3932USB PRINTER DRIVER (usblp) 3919USB PRINTER DRIVER (usblp)
3933P: Pete Zaitcev 3920P: Pete Zaitcev
3934M: zaitcev@redhat.com 3921M: zaitcev@redhat.com
3935L: linux-usb-users@lists.sourceforge.net 3922L: linux-usb@vger.kernel.org
3936L: linux-usb-devel@lists.sourceforge.net
3937S: Supported 3923S: Supported
3938 3924
3939USB RTL8150 DRIVER 3925USB RTL8150 DRIVER
3940P: Petko Manolov 3926P: Petko Manolov
3941M: petkan@users.sourceforge.net 3927M: petkan@users.sourceforge.net
3942L: linux-usb-devel@lists.sourceforge.net 3928L: linux-usb@vger.kernel.org
3943L: netdev@vger.kernel.org 3929L: netdev@vger.kernel.org
3944W: http://pegasus2.sourceforge.net/ 3930W: http://pegasus2.sourceforge.net/
3945S: Maintained 3931S: Maintained
@@ -3947,8 +3933,7 @@ S: Maintained
3947USB SE401 DRIVER 3933USB SE401 DRIVER
3948P: Jeroen Vreeken 3934P: Jeroen Vreeken
3949M: pe1rxq@amsat.org 3935M: pe1rxq@amsat.org
3950L: linux-usb-users@lists.sourceforge.net 3936L: linux-usb@vger.kernel.org
3951L: linux-usb-devel@lists.sourceforge.net
3952W: http://www.chello.nl/~j.vreeken/se401/ 3937W: http://www.chello.nl/~j.vreeken/se401/
3953S: Maintained 3938S: Maintained
3954 3939
@@ -3962,72 +3947,59 @@ USB SERIAL DIGI ACCELEPORT DRIVER
3962P: Peter Berger and Al Borchers 3947P: Peter Berger and Al Borchers
3963M: pberger@brimson.com 3948M: pberger@brimson.com
3964M: alborchers@steinerpoint.com 3949M: alborchers@steinerpoint.com
3965L: linux-usb-users@lists.sourceforge.net 3950L: linux-usb@vger.kernel.org
3966L: linux-usb-devel@lists.sourceforge.net
3967S: Maintained 3951S: Maintained
3968 3952
3969USB SERIAL DRIVER 3953USB SERIAL DRIVER
3970P: Greg Kroah-Hartman 3954P: Greg Kroah-Hartman
3971M: gregkh@suse.de 3955M: gregkh@suse.de
3972L: linux-usb-users@lists.sourceforge.net 3956L: linux-usb@vger.kernel.org
3973L: linux-usb-devel@lists.sourceforge.net
3974S: Supported 3957S: Supported
3975 3958
3976USB SERIAL BELKIN F5U103 DRIVER 3959USB SERIAL BELKIN F5U103 DRIVER
3977P: William Greathouse 3960P: William Greathouse
3978M: wgreathouse@smva.com 3961M: wgreathouse@smva.com
3979L: linux-usb-users@lists.sourceforge.net 3962L: linux-usb@vger.kernel.org
3980L: linux-usb-devel@lists.sourceforge.net
3981S: Maintained 3963S: Maintained
3982 3964
3983USB SERIAL CYPRESS M8 DRIVER 3965USB SERIAL CYPRESS M8 DRIVER
3984P: Lonnie Mendez 3966P: Lonnie Mendez
3985M: dignome@gmail.com 3967M: dignome@gmail.com
3986L: linux-usb-users@lists.sourceforge.net 3968L: linux-usb@vger.kernel.org
3987L: linux-usb-devel@lists.sourceforge.net
3988S: Maintained 3969S: Maintained
3989W: http://geocities.com/i0xox0i 3970W: http://geocities.com/i0xox0i
3990W: http://firstlight.net/cvs 3971W: http://firstlight.net/cvs
3991 3972
3992USB SERIAL CYBERJACK PINPAD/E-COM DRIVER
3993L: linux-usb-users@lists.sourceforge.net
3994L: linux-usb-devel@lists.sourceforge.net
3995S: Maintained
3996
3997USB AUERSWALD DRIVER 3973USB AUERSWALD DRIVER
3998P: Wolfgang Muees 3974P: Wolfgang Muees
3999M: wolfgang@iksw-muees.de 3975M: wolfgang@iksw-muees.de
4000L: linux-usb-users@lists.sourceforge.net 3976L: linux-usb@vger.kernel.org
4001L: linux-usb-devel@lists.sourceforge.net
4002S: Maintained 3977S: Maintained
4003 3978
4004USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER 3979USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER
4005P: Gary Brubaker 3980P: Gary Brubaker
4006M: xavyer@ix.netcom.com 3981M: xavyer@ix.netcom.com
4007L: linux-usb-users@lists.sourceforge.net 3982L: linux-usb@vger.kernel.org
4008L: linux-usb-devel@lists.sourceforge.net
4009S: Maintained 3983S: Maintained
4010 3984
4011USB SERIAL KEYSPAN DRIVER 3985USB SERIAL KEYSPAN DRIVER
4012P: Greg Kroah-Hartman 3986P: Greg Kroah-Hartman
4013M: greg@kroah.com 3987M: greg@kroah.com
4014L: linux-usb-users@lists.sourceforge.net 3988L: linux-usb@vger.kernel.org
4015L: linux-usb-devel@lists.sourceforge.net
4016W: http://www.kroah.com/linux/ 3989W: http://www.kroah.com/linux/
4017S: Maintained 3990S: Maintained
4018 3991
4019USB SERIAL WHITEHEAT DRIVER 3992USB SERIAL WHITEHEAT DRIVER
4020P: Support Department 3993P: Support Department
4021M: support@connecttech.com 3994M: support@connecttech.com
4022L: linux-usb-users@lists.sourceforge.net 3995L: linux-usb@vger.kernel.org
4023L: linux-usb-devel@lists.sourceforge.net
4024W: http://www.connecttech.com 3996W: http://www.connecttech.com
4025S: Supported 3997S: Supported
4026 3998
4027USB SN9C1xx DRIVER 3999USB SN9C1xx DRIVER
4028P: Luca Risolia 4000P: Luca Risolia
4029M: luca.risolia@studio.unibo.it 4001M: luca.risolia@studio.unibo.it
4030L: linux-usb-devel@lists.sourceforge.net 4002L: linux-usb@vger.kernel.org
4031L: video4linux-list@redhat.com 4003L: video4linux-list@redhat.com
4032W: http://www.linux-projects.org 4004W: http://www.linux-projects.org
4033S: Maintained 4005S: Maintained
@@ -4035,8 +4007,7 @@ S: Maintained
4035USB SUBSYSTEM 4007USB SUBSYSTEM
4036P: Greg Kroah-Hartman 4008P: Greg Kroah-Hartman
4037M: gregkh@suse.de 4009M: gregkh@suse.de
4038L: linux-usb-users@lists.sourceforge.net 4010L: linux-usb@vger.kernel.org
4039L: linux-usb-devel@lists.sourceforge.net
4040W: http://www.linux-usb.org 4011W: http://www.linux-usb.org
4041T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 4012T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
4042S: Supported 4013S: Supported
@@ -4044,8 +4015,7 @@ S: Supported
4044USB UHCI DRIVER 4015USB UHCI DRIVER
4045P: Alan Stern 4016P: Alan Stern
4046M: stern@rowland.harvard.edu 4017M: stern@rowland.harvard.edu
4047L: linux-usb-users@lists.sourceforge.net 4018L: linux-usb@vger.kernel.org
4048L: linux-usb-devel@lists.sourceforge.net
4049S: Maintained 4019S: Maintained
4050 4020
4051USB "USBNET" DRIVER FRAMEWORK 4021USB "USBNET" DRIVER FRAMEWORK
@@ -4058,7 +4028,7 @@ S: Maintained
4058USB W996[87]CF DRIVER 4028USB W996[87]CF DRIVER
4059P: Luca Risolia 4029P: Luca Risolia
4060M: luca.risolia@studio.unibo.it 4030M: luca.risolia@studio.unibo.it
4061L: linux-usb-devel@lists.sourceforge.net 4031L: linux-usb@vger.kernel.org
4062L: video4linux-list@redhat.com 4032L: video4linux-list@redhat.com
4063W: http://www.linux-projects.org 4033W: http://www.linux-projects.org
4064S: Maintained 4034S: Maintained
@@ -4066,7 +4036,7 @@ S: Maintained
4066USB ZC0301 DRIVER 4036USB ZC0301 DRIVER
4067P: Luca Risolia 4037P: Luca Risolia
4068M: luca.risolia@studio.unibo.it 4038M: luca.risolia@studio.unibo.it
4069L: linux-usb-devel@lists.sourceforge.net 4039L: linux-usb@vger.kernel.org
4070L: video4linux-list@redhat.com 4040L: video4linux-list@redhat.com
4071W: http://www.linux-projects.org 4041W: http://www.linux-projects.org
4072S: Maintained 4042S: Maintained
@@ -4074,15 +4044,14 @@ S: Maintained
4074USB ZD1201 DRIVER 4044USB ZD1201 DRIVER
4075P: Jeroen Vreeken 4045P: Jeroen Vreeken
4076M: pe1rxq@amsat.org 4046M: pe1rxq@amsat.org
4077L: linux-usb-users@lists.sourceforge.net 4047L: linux-usb@vger.kernel.org
4078L: linux-usb-devel@lists.sourceforge.net
4079W: http://linux-lc100020.sourceforge.net 4048W: http://linux-lc100020.sourceforge.net
4080S: Maintained 4049S: Maintained
4081 4050
4082USB ZR364XX DRIVER 4051USB ZR364XX DRIVER
4083P: Antoine Jacquet 4052P: Antoine Jacquet
4084M: royale@zerezo.com 4053M: royale@zerezo.com
4085L: linux-usb-devel@lists.sourceforge.net 4054L: linux-usb@vger.kernel.org
4086L: video4linux-list@redhat.com 4055L: video4linux-list@redhat.com
4087W: http://royale.zerezo.com/zr364xx/ 4056W: http://royale.zerezo.com/zr364xx/
4088S: Maintained 4057S: Maintained
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index 174b729c504b..468b76ce66a1 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -12,6 +12,7 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/scatterlist.h>
15 16
16#include "proto.h" 17#include "proto.h"
17 18
@@ -172,18 +173,19 @@ dma_alloc_coherent(struct device *dev, size_t size,
172EXPORT_SYMBOL(dma_alloc_coherent); 173EXPORT_SYMBOL(dma_alloc_coherent);
173 174
174int 175int
175dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 176dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
176 enum dma_data_direction direction) 177 enum dma_data_direction direction)
177{ 178{
178 int i; 179 int i;
180 struct scatterlist *sg;
179 181
180 for (i = 0; i < nents; i++ ) { 182 for_each_sg(sgl, sg, nents, i) {
181 void *va; 183 void *va;
182 184
183 BUG_ON(!sg[i].page); 185 BUG_ON(!sg_page(sg));
184 va = page_address(sg[i].page) + sg[i].offset; 186 va = sg_virt(sg);
185 sg_dma_address(sg + i) = (dma_addr_t)virt_to_bus(va); 187 sg_dma_address(sg) = (dma_addr_t)virt_to_bus(va);
186 sg_dma_len(sg + i) = sg[i].length; 188 sg_dma_len(sg) = sg->length;
187 } 189 }
188 190
189 return nents; 191 return nents;
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
index 95c8508c29b7..117cab30bd36 100644
--- a/arch/arm/common/uengine.c
+++ b/arch/arm/common/uengine.c
@@ -374,8 +374,8 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
374 u8 *ucode; 374 u8 *ucode;
375 int i; 375 int i;
376 376
377 gpr_a = kmalloc(128 * sizeof(u32), GFP_KERNEL); 377 gpr_a = kzalloc(128 * sizeof(u32), GFP_KERNEL);
378 gpr_b = kmalloc(128 * sizeof(u32), GFP_KERNEL); 378 gpr_b = kzalloc(128 * sizeof(u32), GFP_KERNEL);
379 ucode = kmalloc(513 * 5, GFP_KERNEL); 379 ucode = kmalloc(513 * 5, GFP_KERNEL);
380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) { 380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) {
381 kfree(ucode); 381 kfree(ucode);
@@ -388,8 +388,6 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS) 388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS)
389 per_ctx_regs = 32; 389 per_ctx_regs = 32;
390 390
391 memset(gpr_a, 0, sizeof(gpr_a));
392 memset(gpr_b, 0, sizeof(gpr_b));
393 for (i = 0; i < 256; i++) { 391 for (i = 0; i < 256; i++) {
394 struct ixp2000_reg_value *r = c->initial_reg_values + i; 392 struct ixp2000_reg_value *r = c->initial_reg_values + i;
395 u32 *bank; 393 u32 *bank;
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d645897652c2..29dec080a604 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -339,16 +339,6 @@ __pabt_svc:
339 str r1, [sp] @ save the "real" r0 copied 339 str r1, [sp] @ save the "real" r0 copied
340 @ from the exception stack 340 @ from the exception stack
341 341
342#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
343#ifndef CONFIG_MMU
344#warning "NPTL on non MMU needs fixing"
345#else
346 @ make sure our user space atomic helper is aborted
347 cmp r2, #TASK_SIZE
348 bichs r3, r3, #PSR_Z_BIT
349#endif
350#endif
351
352 @ 342 @
353 @ We are now ready to fill in the remaining blanks on the stack: 343 @ We are now ready to fill in the remaining blanks on the stack:
354 @ 344 @
@@ -372,9 +362,25 @@ __pabt_svc:
372 zero_fp 362 zero_fp
373 .endm 363 .endm
374 364
365 .macro kuser_cmpxchg_check
366#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
367#ifndef CONFIG_MMU
368#warning "NPTL on non MMU needs fixing"
369#else
370 @ Make sure our user space atomic helper is restarted
371 @ if it was interrupted in a critical region. Here we
372 @ perform a quick test inline since it should be false
373 @ 99.9999% of the time. The rest is done out of line.
374 cmp r2, #TASK_SIZE
375 blhs kuser_cmpxchg_fixup
376#endif
377#endif
378 .endm
379
375 .align 5 380 .align 5
376__dabt_usr: 381__dabt_usr:
377 usr_entry 382 usr_entry
383 kuser_cmpxchg_check
378 384
379 @ 385 @
380 @ Call the processor-specific abort handler: 386 @ Call the processor-specific abort handler:
@@ -404,6 +410,7 @@ __dabt_usr:
404 .align 5 410 .align 5
405__irq_usr: 411__irq_usr:
406 usr_entry 412 usr_entry
413 kuser_cmpxchg_check
407 414
408#ifdef CONFIG_TRACE_IRQFLAGS 415#ifdef CONFIG_TRACE_IRQFLAGS
409 bl trace_hardirqs_off 416 bl trace_hardirqs_off
@@ -446,9 +453,9 @@ __und_usr:
446 @ 453 @
447 @ r0 - instruction 454 @ r0 - instruction
448 @ 455 @
4491: ldrt r0, [r4]
450 adr r9, ret_from_exception 456 adr r9, ret_from_exception
451 adr lr, __und_usr_unknown 457 adr lr, __und_usr_unknown
4581: ldrt r0, [r4]
452 @ 459 @
453 @ fallthrough to call_fpe 460 @ fallthrough to call_fpe
454 @ 461 @
@@ -669,7 +676,7 @@ __kuser_helper_start:
669 * 676 *
670 * Clobbered: 677 * Clobbered:
671 * 678 *
672 * the Z flag might be lost 679 * none
673 * 680 *
674 * Definition and user space usage example: 681 * Definition and user space usage example:
675 * 682 *
@@ -730,9 +737,6 @@ __kuser_memory_barrier: @ 0xffff0fa0
730 * 737 *
731 * - This routine already includes memory barriers as needed. 738 * - This routine already includes memory barriers as needed.
732 * 739 *
733 * - A failure might be transient, i.e. it is possible, although unlikely,
734 * that "failure" be returned even if *ptr == oldval.
735 *
736 * For example, a user space atomic_add implementation could look like this: 740 * For example, a user space atomic_add implementation could look like this:
737 * 741 *
738 * #define atomic_add(ptr, val) \ 742 * #define atomic_add(ptr, val) \
@@ -769,46 +773,62 @@ __kuser_cmpxchg: @ 0xffff0fc0
769 773
770#elif __LINUX_ARM_ARCH__ < 6 774#elif __LINUX_ARM_ARCH__ < 6
771 775
776#ifdef CONFIG_MMU
777
772 /* 778 /*
773 * Theory of operation: 779 * The only thing that can break atomicity in this cmpxchg
774 * 780 * implementation is either an IRQ or a data abort exception
775 * We set the Z flag before loading oldval. If ever an exception 781 * causing another process/thread to be scheduled in the middle
776 * occurs we can not be sure the loaded value will still be the same 782 * of the critical sequence. To prevent this, code is added to
777 * when the exception returns, therefore the user exception handler 783 * the IRQ and data abort exception handlers to set the pc back
778 * will clear the Z flag whenever the interrupted user code was 784 * to the beginning of the critical section if it is found to be
779 * actually from the kernel address space (see the usr_entry macro). 785 * within that critical section (see kuser_cmpxchg_fixup).
780 *
781 * The post-increment on the str is used to prevent a race with an
782 * exception happening just after the str instruction which would
783 * clear the Z flag although the exchange was done.
784 */ 786 */
785#ifdef CONFIG_MMU 7871: ldr r3, [r2] @ load current val
786 teq ip, ip @ set Z flag 788 subs r3, r3, r0 @ compare with oldval
787 ldr ip, [r2] @ load current val 7892: streq r1, [r2] @ store newval if eq
788 add r3, r2, #1 @ prepare store ptr 790 rsbs r0, r3, #0 @ set return val and C flag
789 teqeq ip, r0 @ compare with oldval if still allowed 791 usr_ret lr
790 streq r1, [r3, #-1]! @ store newval if still allowed 792
791 subs r0, r2, r3 @ if r2 == r3 the str occured 793 .text
794kuser_cmpxchg_fixup:
795 @ Called from kuser_cmpxchg_check macro.
796 @ r2 = address of interrupted insn (must be preserved).
797 @ sp = saved regs. r7 and r8 are clobbered.
798 @ 1b = first critical insn, 2b = last critical insn.
799 @ If r2 >= 1b and r2 <= 2b then saved pc_usr is set to 1b.
800 mov r7, #0xffff0fff
801 sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg)))
802 subs r8, r2, r7
803 rsbcss r8, r8, #(2b - 1b)
804 strcs r7, [sp, #S_PC]
805 mov pc, lr
806 .previous
807
792#else 808#else
793#warning "NPTL on non MMU needs fixing" 809#warning "NPTL on non MMU needs fixing"
794 mov r0, #-1 810 mov r0, #-1
795 adds r0, r0, #0 811 adds r0, r0, #0
796#endif
797 usr_ret lr 812 usr_ret lr
813#endif
798 814
799#else 815#else
800 816
801#ifdef CONFIG_SMP 817#ifdef CONFIG_SMP
802 mcr p15, 0, r0, c7, c10, 5 @ dmb 818 mcr p15, 0, r0, c7, c10, 5 @ dmb
803#endif 819#endif
804 ldrex r3, [r2] 8201: ldrex r3, [r2]
805 subs r3, r3, r0 821 subs r3, r3, r0
806 strexeq r3, r1, [r2] 822 strexeq r3, r1, [r2]
823 teqeq r3, #1
824 beq 1b
807 rsbs r0, r3, #0 825 rsbs r0, r3, #0
826 /* beware -- each __kuser slot must be 8 instructions max */
808#ifdef CONFIG_SMP 827#ifdef CONFIG_SMP
809 mcr p15, 0, r0, c7, c10, 5 @ dmb 828 b __kuser_memory_barrier
810#endif 829#else
811 usr_ret lr 830 usr_ret lr
831#endif
812 832
813#endif 833#endif
814 834
@@ -829,7 +849,7 @@ __kuser_cmpxchg: @ 0xffff0fc0
829 * 849 *
830 * Clobbered: 850 * Clobbered:
831 * 851 *
832 * the Z flag might be lost 852 * none
833 * 853 *
834 * Definition and user space usage example: 854 * Definition and user space usage example:
835 * 855 *
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 4764bd9ccee8..c34db4e868fa 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -327,7 +327,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
327 if ((instr & hook->instr_mask) == hook->instr_val && 327 if ((instr & hook->instr_mask) == hook->instr_val &&
328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) { 328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) {
329 if (hook->fn(regs, instr) == 0) { 329 if (hook->fn(regs, instr) == 0) {
330 spin_unlock_irq(&undef_lock); 330 spin_unlock_irqrestore(&undef_lock, flags);
331 return; 331 return;
332 } 332 }
333 } 333 }
@@ -509,7 +509,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
509 * existence. Don't ever use this from user code. 509 * existence. Don't ever use this from user code.
510 */ 510 */
511 case 0xfff0: 511 case 0xfff0:
512 { 512 for (;;) {
513 extern void do_DataAbort(unsigned long addr, unsigned int fsr, 513 extern void do_DataAbort(unsigned long addr, unsigned int fsr,
514 struct pt_regs *regs); 514 struct pt_regs *regs);
515 unsigned long val; 515 unsigned long val;
@@ -545,7 +545,6 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
545 up_read(&mm->mmap_sem); 545 up_read(&mm->mmap_sem);
546 /* simulate a write access fault */ 546 /* simulate a write access fault */
547 do_DataAbort(addr, 15 + (1 << 11), regs); 547 do_DataAbort(addr, 15 + (1 << 11), regs);
548 return -1;
549 } 548 }
550#endif 549#endif
551 550
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 0417c165d50d..9296833f91cc 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -14,6 +14,7 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
18#include <asm/arch/board.h> 19#include <asm/arch/board.h>
19#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
@@ -435,7 +436,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
435 * TWI (i2c) 436 * TWI (i2c)
436 * -------------------------------------------------------------------- */ 437 * -------------------------------------------------------------------- */
437 438
438#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 439/*
440 * Prefer the GPIO code since the TWI controller isn't robust
441 * (gets overruns and underruns under load) and can only issue
442 * repeated STARTs in one scenario (the driver doesn't yet handle them).
443 */
444#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
445
446static struct i2c_gpio_platform_data pdata = {
447 .sda_pin = AT91_PIN_PA25,
448 .sda_is_open_drain = 1,
449 .scl_pin = AT91_PIN_PA26,
450 .scl_is_open_drain = 1,
451 .udelay = 2, /* ~100 kHz */
452};
453
454static struct platform_device at91rm9200_twi_device = {
455 .name = "i2c-gpio",
456 .id = -1,
457 .dev.platform_data = &pdata,
458};
459
460void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{
462 at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
463 at91_set_multi_drive(AT91_PIN_PA25, 1);
464
465 at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
466 at91_set_multi_drive(AT91_PIN_PA26, 1);
467
468 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device);
470}
471
472#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
439 473
440static struct resource twi_resources[] = { 474static struct resource twi_resources[] = {
441 [0] = { 475 [0] = {
@@ -457,7 +491,7 @@ static struct platform_device at91rm9200_twi_device = {
457 .num_resources = ARRAY_SIZE(twi_resources), 491 .num_resources = ARRAY_SIZE(twi_resources),
458}; 492};
459 493
460void __init at91_add_device_i2c(void) 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{ 495{
462 /* pins used for TWI interface */ 496 /* pins used for TWI interface */
463 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */ 497 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
@@ -466,10 +500,11 @@ void __init at91_add_device_i2c(void)
466 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */ 500 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
467 at91_set_multi_drive(AT91_PIN_PA26, 1); 501 at91_set_multi_drive(AT91_PIN_PA26, 1);
468 502
503 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device); 504 platform_device_register(&at91rm9200_twi_device);
470} 505}
471#else 506#else
472void __init at91_add_device_i2c(void) {} 507void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
473#endif 508#endif
474 509
475 510
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index ffd3154c1e54..3091bf47d8c9 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
18#include <asm/arch/gpio.h> 19#include <asm/arch/gpio.h>
@@ -352,7 +353,41 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
352 * TWI (i2c) 353 * TWI (i2c)
353 * -------------------------------------------------------------------- */ 354 * -------------------------------------------------------------------- */
354 355
355#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 356/*
357 * Prefer the GPIO code since the TWI controller isn't robust
358 * (gets overruns and underruns under load) and can only issue
359 * repeated STARTs in one scenario (the driver doesn't yet handle them).
360 */
361
362#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
363
364static struct i2c_gpio_platform_data pdata = {
365 .sda_pin = AT91_PIN_PA23,
366 .sda_is_open_drain = 1,
367 .scl_pin = AT91_PIN_PA24,
368 .scl_is_open_drain = 1,
369 .udelay = 2, /* ~100 kHz */
370};
371
372static struct platform_device at91sam9260_twi_device = {
373 .name = "i2c-gpio",
374 .id = -1,
375 .dev.platform_data = &pdata,
376};
377
378void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
379{
380 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
381 at91_set_multi_drive(AT91_PIN_PA23, 1);
382
383 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
384 at91_set_multi_drive(AT91_PIN_PA24, 1);
385
386 i2c_register_board_info(0, devices, nr_devices);
387 platform_device_register(&at91sam9260_twi_device);
388}
389
390#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
356 391
357static struct resource twi_resources[] = { 392static struct resource twi_resources[] = {
358 [0] = { 393 [0] = {
@@ -374,7 +409,7 @@ static struct platform_device at91sam9260_twi_device = {
374 .num_resources = ARRAY_SIZE(twi_resources), 409 .num_resources = ARRAY_SIZE(twi_resources),
375}; 410};
376 411
377void __init at91_add_device_i2c(void) 412void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
378{ 413{
379 /* pins used for TWI interface */ 414 /* pins used for TWI interface */
380 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 415 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -383,10 +418,11 @@ void __init at91_add_device_i2c(void)
383 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 418 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
384 at91_set_multi_drive(AT91_PIN_PA24, 1); 419 at91_set_multi_drive(AT91_PIN_PA24, 1);
385 420
421 i2c_register_board_info(0, devices, nr_devices);
386 platform_device_register(&at91sam9260_twi_device); 422 platform_device_register(&at91sam9260_twi_device);
387} 423}
388#else 424#else
389void __init at91_add_device_i2c(void) {} 425void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
390#endif 426#endif
391 427
392 428
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 3576595b4941..64979a9023c2 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -14,7 +14,9 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
19#include <linux/fb.h>
18#include <video/atmel_lcdc.h> 20#include <video/atmel_lcdc.h>
19 21
20#include <asm/arch/board.h> 22#include <asm/arch/board.h>
@@ -275,7 +277,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
275 * TWI (i2c) 277 * TWI (i2c)
276 * -------------------------------------------------------------------- */ 278 * -------------------------------------------------------------------- */
277 279
278#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 280/*
281 * Prefer the GPIO code since the TWI controller isn't robust
282 * (gets overruns and underruns under load) and can only issue
283 * repeated STARTs in one scenario (the driver doesn't yet handle them).
284 */
285#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
286
287static struct i2c_gpio_platform_data pdata = {
288 .sda_pin = AT91_PIN_PA7,
289 .sda_is_open_drain = 1,
290 .scl_pin = AT91_PIN_PA8,
291 .scl_is_open_drain = 1,
292 .udelay = 2, /* ~100 kHz */
293};
294
295static struct platform_device at91sam9261_twi_device = {
296 .name = "i2c-gpio",
297 .id = -1,
298 .dev.platform_data = &pdata,
299};
300
301void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
302{
303 at91_set_GPIO_periph(AT91_PIN_PA7, 1); /* TWD (SDA) */
304 at91_set_multi_drive(AT91_PIN_PA7, 1);
305
306 at91_set_GPIO_periph(AT91_PIN_PA8, 1); /* TWCK (SCL) */
307 at91_set_multi_drive(AT91_PIN_PA8, 1);
308
309 i2c_register_board_info(0, devices, nr_devices);
310 platform_device_register(&at91sam9261_twi_device);
311}
312
313#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
279 314
280static struct resource twi_resources[] = { 315static struct resource twi_resources[] = {
281 [0] = { 316 [0] = {
@@ -297,7 +332,7 @@ static struct platform_device at91sam9261_twi_device = {
297 .num_resources = ARRAY_SIZE(twi_resources), 332 .num_resources = ARRAY_SIZE(twi_resources),
298}; 333};
299 334
300void __init at91_add_device_i2c(void) 335void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
301{ 336{
302 /* pins used for TWI interface */ 337 /* pins used for TWI interface */
303 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */ 338 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
@@ -306,10 +341,11 @@ void __init at91_add_device_i2c(void)
306 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */ 341 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
307 at91_set_multi_drive(AT91_PIN_PA8, 1); 342 at91_set_multi_drive(AT91_PIN_PA8, 1);
308 343
344 i2c_register_board_info(0, devices, nr_devices);
309 platform_device_register(&at91sam9261_twi_device); 345 platform_device_register(&at91sam9261_twi_device);
310} 346}
311#else 347#else
312void __init at91_add_device_i2c(void) {} 348void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
313#endif 349#endif
314 350
315 351
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index f924bd5017de..ac329a98e959 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -13,7 +13,9 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
18#include <linux/fb.h>
17#include <video/atmel_lcdc.h> 19#include <video/atmel_lcdc.h>
18 20
19#include <asm/arch/board.h> 21#include <asm/arch/board.h>
@@ -421,7 +423,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
421 * TWI (i2c) 423 * TWI (i2c)
422 * -------------------------------------------------------------------- */ 424 * -------------------------------------------------------------------- */
423 425
424#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 426/*
427 * Prefer the GPIO code since the TWI controller isn't robust
428 * (gets overruns and underruns under load) and can only issue
429 * repeated STARTs in one scenario (the driver doesn't yet handle them).
430 */
431#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
432
433static struct i2c_gpio_platform_data pdata = {
434 .sda_pin = AT91_PIN_PB4,
435 .sda_is_open_drain = 1,
436 .scl_pin = AT91_PIN_PB5,
437 .scl_is_open_drain = 1,
438 .udelay = 2, /* ~100 kHz */
439};
440
441static struct platform_device at91sam9263_twi_device = {
442 .name = "i2c-gpio",
443 .id = -1,
444 .dev.platform_data = &pdata,
445};
446
447void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
448{
449 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
450 at91_set_multi_drive(AT91_PIN_PB4, 1);
451
452 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
453 at91_set_multi_drive(AT91_PIN_PB5, 1);
454
455 i2c_register_board_info(0, devices, nr_devices);
456 platform_device_register(&at91sam9263_twi_device);
457}
458
459#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
425 460
426static struct resource twi_resources[] = { 461static struct resource twi_resources[] = {
427 [0] = { 462 [0] = {
@@ -443,7 +478,7 @@ static struct platform_device at91sam9263_twi_device = {
443 .num_resources = ARRAY_SIZE(twi_resources), 478 .num_resources = ARRAY_SIZE(twi_resources),
444}; 479};
445 480
446void __init at91_add_device_i2c(void) 481void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
447{ 482{
448 /* pins used for TWI interface */ 483 /* pins used for TWI interface */
449 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */ 484 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */
@@ -452,10 +487,11 @@ void __init at91_add_device_i2c(void)
452 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */ 487 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */
453 at91_set_multi_drive(AT91_PIN_PB5, 1); 488 at91_set_multi_drive(AT91_PIN_PB5, 1);
454 489
490 i2c_register_board_info(0, devices, nr_devices);
455 platform_device_register(&at91sam9263_twi_device); 491 platform_device_register(&at91sam9263_twi_device);
456} 492}
457#else 493#else
458void __init at91_add_device_i2c(void) {} 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
459#endif 495#endif
460 496
461 497
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index cd7532bcd4e5..2bd60a3dc623 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -10,8 +10,9 @@
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/fb.h> 13#include <linux/i2c-gpio.h>
14 14
15#include <linux/fb.h>
15#include <video/atmel_lcdc.h> 16#include <video/atmel_lcdc.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
@@ -169,7 +170,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
169 * TWI (i2c) 170 * TWI (i2c)
170 * -------------------------------------------------------------------- */ 171 * -------------------------------------------------------------------- */
171 172
172#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 173/*
174 * Prefer the GPIO code since the TWI controller isn't robust
175 * (gets overruns and underruns under load) and can only issue
176 * repeated STARTs in one scenario (the driver doesn't yet handle them).
177 */
178#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
179
180static struct i2c_gpio_platform_data pdata = {
181 .sda_pin = AT91_PIN_PA23,
182 .sda_is_open_drain = 1,
183 .scl_pin = AT91_PIN_PA24,
184 .scl_is_open_drain = 1,
185 .udelay = 2, /* ~100 kHz */
186};
187
188static struct platform_device at91sam9rl_twi_device = {
189 .name = "i2c-gpio",
190 .id = -1,
191 .dev.platform_data = &pdata,
192};
193
194void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{
196 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
197 at91_set_multi_drive(AT91_PIN_PA23, 1);
198
199 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
200 at91_set_multi_drive(AT91_PIN_PA24, 1);
201
202 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device);
204}
205
206#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
173 207
174static struct resource twi_resources[] = { 208static struct resource twi_resources[] = {
175 [0] = { 209 [0] = {
@@ -191,7 +225,7 @@ static struct platform_device at91sam9rl_twi_device = {
191 .num_resources = ARRAY_SIZE(twi_resources), 225 .num_resources = ARRAY_SIZE(twi_resources),
192}; 226};
193 227
194void __init at91_add_device_i2c(void) 228void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{ 229{
196 /* pins used for TWI interface */ 230 /* pins used for TWI interface */
197 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 231 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -200,10 +234,11 @@ void __init at91_add_device_i2c(void)
200 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 234 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
201 at91_set_multi_drive(AT91_PIN_PA24, 1); 235 at91_set_multi_drive(AT91_PIN_PA24, 1);
202 236
237 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device); 238 platform_device_register(&at91sam9rl_twi_device);
204} 239}
205#else 240#else
206void __init at91_add_device_i2c(void) {} 241void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
207#endif 242#endif
208 243
209 244
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 76ec856cd4f9..0f0878294a67 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -128,7 +128,7 @@ static void __init carmeva_board_init(void)
128 /* USB Device */ 128 /* USB Device */
129 at91_add_device_udc(&carmeva_udc_data); 129 at91_add_device_udc(&carmeva_udc_data);
130 /* I2C */ 130 /* I2C */
131 at91_add_device_i2c(); 131 at91_add_device_i2c(NULL, 0);
132 /* SPI */ 132 /* SPI */
133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices)); 133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices));
134 /* Compact Flash */ 134 /* Compact Flash */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index dde089922e3b..d0aa20c9383e 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -23,7 +23,6 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/i2c.h>
27#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
28#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
29 28
@@ -85,12 +84,12 @@ static struct at91_udc_data __initdata csb337_udc_data = {
85}; 84};
86 85
87static struct i2c_board_info __initdata csb337_i2c_devices[] = { 86static struct i2c_board_info __initdata csb337_i2c_devices[] = {
88 { I2C_BOARD_INFO("rtc-ds1307", 0x68), 87 {
89 .type = "ds1307", 88 I2C_BOARD_INFO("rtc-ds1307", 0x68),
89 .type = "ds1307",
90 }, 90 },
91}; 91};
92 92
93
94static struct at91_cf_data __initdata csb337_cf_data = { 93static struct at91_cf_data __initdata csb337_cf_data = {
95 /* 94 /*
96 * connector P4 on the CSB 337 mates to 95 * connector P4 on the CSB 337 mates to
@@ -168,9 +167,7 @@ static void __init csb337_board_init(void)
168 /* USB Device */ 167 /* USB Device */
169 at91_add_device_udc(&csb337_udc_data); 168 at91_add_device_udc(&csb337_udc_data);
170 /* I2C */ 169 /* I2C */
171 at91_add_device_i2c(); 170 at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));
172 i2c_register_board_info(0, csb337_i2c_devices,
173 ARRAY_SIZE(csb337_i2c_devices));
174 /* Compact Flash */ 171 /* Compact Flash */
175 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */ 172 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
176 at91_add_device_cf(&csb337_cf_data); 173 at91_add_device_cf(&csb337_cf_data);
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 77f04b935b3a..c5c721d27f42 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -129,7 +129,7 @@ static void __init csb637_board_init(void)
129 /* USB Device */ 129 /* USB Device */
130 at91_add_device_udc(&csb637_udc_data); 130 at91_add_device_udc(&csb637_udc_data);
131 /* I2C */ 131 /* I2C */
132 at91_add_device_i2c(); 132 at91_add_device_i2c(NULL, 0);
133 /* SPI */ 133 /* SPI */
134 at91_add_device_spi(NULL, 0); 134 at91_add_device_spi(NULL, 0);
135 /* NOR flash */ 135 /* NOR flash */
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index af497896a96c..40c9e4331706 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -124,6 +124,19 @@ static struct spi_board_info dk_spi_devices[] = {
124#endif 124#endif
125}; 125};
126 126
127static struct i2c_board_info __initdata dk_i2c_devices[] = {
128 {
129 I2C_BOARD_INFO("ics1523", 0x26),
130 },
131 {
132 I2C_BOARD_INFO("x9429", 0x28),
133 },
134 {
135 I2C_BOARD_INFO("at24c", 0x50),
136 .type = "24c1024",
137 }
138};
139
127static struct mtd_partition __initdata dk_nand_partition[] = { 140static struct mtd_partition __initdata dk_nand_partition[] = {
128 { 141 {
129 .name = "NAND Partition 1", 142 .name = "NAND Partition 1",
@@ -185,7 +198,7 @@ static void __init dk_board_init(void)
185 /* Compact Flash */ 198 /* Compact Flash */
186 at91_add_device_cf(&dk_cf_data); 199 at91_add_device_cf(&dk_cf_data);
187 /* I2C */ 200 /* I2C */
188 at91_add_device_i2c(); 201 at91_add_device_i2c(dk_i2c_devices, ARRAY_SIZE(dk_i2c_devices));
189 /* SPI */ 202 /* SPI */
190 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices)); 203 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
191#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 204#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 20458b5548f0..b7b79bb9d6c4 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -91,6 +91,14 @@ static struct at91_mmc_data __initdata eb9200_mmc_data = {
91 .wire4 = 1, 91 .wire4 = 1,
92}; 92};
93 93
94static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
95 {
96 I2C_BOARD_INFO("at24c", 0x50),
97 .type = "24c512",
98 },
99};
100
101
94static void __init eb9200_board_init(void) 102static void __init eb9200_board_init(void)
95{ 103{
96 /* Serial */ 104 /* Serial */
@@ -102,7 +110,7 @@ static void __init eb9200_board_init(void)
102 /* USB Device */ 110 /* USB Device */
103 at91_add_device_udc(&eb9200_udc_data); 111 at91_add_device_udc(&eb9200_udc_data);
104 /* I2C */ 112 /* I2C */
105 at91_add_device_i2c(); 113 at91_add_device_i2c(eb9200_i2c_devices, ARRAY_SIZE(eb9200_i2c_devices));
106 /* Compact Flash */ 114 /* Compact Flash */
107 at91_add_device_cf(&eb9200_cf_data); 115 at91_add_device_cf(&eb9200_cf_data);
108 /* SPI */ 116 /* SPI */
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 322fdd75a1e4..d05b1b2be9fb 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -145,7 +145,7 @@ static void __init ek_board_init(void)
145 at91_add_device_udc(&ek_udc_data); 145 at91_add_device_udc(&ek_udc_data);
146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
147 /* I2C */ 147 /* I2C */
148 at91_add_device_i2c(); 148 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
149 /* SPI */ 149 /* SPI */
150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index c77d84ce9cae..cf1b7b2f76fb 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -92,7 +92,7 @@ static void __init kafa_board_init(void)
92 /* USB Device */ 92 /* USB Device */
93 at91_add_device_udc(&kafa_udc_data); 93 at91_add_device_udc(&kafa_udc_data);
94 /* I2C */ 94 /* I2C */
95 at91_add_device_i2c(); 95 at91_add_device_i2c(NULL, 0);
96 /* SPI */ 96 /* SPI */
97 at91_add_device_spi(NULL, 0); 97 at91_add_device_spi(NULL, 0);
98} 98}
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 7d9b1a278fd6..4b39b9cda75b 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -124,7 +124,7 @@ static void __init kb9202_board_init(void)
124 /* MMC */ 124 /* MMC */
125 at91_add_device_mmc(0, &kb9202_mmc_data); 125 at91_add_device_mmc(0, &kb9202_mmc_data);
126 /* I2C */ 126 /* I2C */
127 at91_add_device_i2c(); 127 at91_add_device_i2c(NULL, 0);
128 /* SPI */ 128 /* SPI */
129 at91_add_device_spi(NULL, 0); 129 at91_add_device_spi(NULL, 0);
130 /* NAND */ 130 /* NAND */
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 49cfe7ab4a85..6acb55c09ae5 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -139,7 +139,7 @@ static void __init picotux200_board_init(void)
139 // at91_add_device_udc(&picotux200_udc_data); 139 // at91_add_device_udc(&picotux200_udc_data);
140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
141 /* I2C */ 141 /* I2C */
142 at91_add_device_i2c(); 142 at91_add_device_i2c(NULL, 0);
143 /* SPI */ 143 /* SPI */
144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices)); 144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices));
145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 65fa532bb4ac..b343a6c28120 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -189,7 +189,7 @@ static void __init ek_board_init(void)
189 /* MMC */ 189 /* MMC */
190 at91_add_device_mmc(0, &ek_mmc_data); 190 at91_add_device_mmc(0, &ek_mmc_data);
191 /* I2C */ 191 /* I2C */
192 at91_add_device_i2c(); 192 at91_add_device_i2c(NULL, 0);
193} 193}
194 194
195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 42e172cb0f49..550ae59a3aca 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -382,14 +382,14 @@ static struct platform_device ek_button_device = {
382 382
383static void __init ek_add_device_buttons(void) 383static void __init ek_add_device_buttons(void)
384{ 384{
385 at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ 385 at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */
386 at91_set_deglitch(AT91_PIN_PB27, 1); 386 at91_set_deglitch(AT91_PIN_PA27, 1);
387 at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ 387 at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */
388 at91_set_deglitch(AT91_PIN_PB26, 1); 388 at91_set_deglitch(AT91_PIN_PA26, 1);
389 at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ 389 at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */
390 at91_set_deglitch(AT91_PIN_PB25, 1); 390 at91_set_deglitch(AT91_PIN_PA25, 1);
391 at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ 391 at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */
392 at91_set_deglitch(AT91_PIN_PB24, 1); 392 at91_set_deglitch(AT91_PIN_PA24, 1);
393 393
394 platform_device_register(&ek_button_device); 394 platform_device_register(&ek_button_device);
395} 395}
@@ -406,7 +406,7 @@ static void __init ek_board_init(void)
406 /* USB Device */ 406 /* USB Device */
407 at91_add_device_udc(&ek_udc_data); 407 at91_add_device_udc(&ek_udc_data);
408 /* I2C */ 408 /* I2C */
409 at91_add_device_i2c(); 409 at91_add_device_i2c(NULL, 0);
410 /* NAND */ 410 /* NAND */
411 at91_add_device_nand(&ek_nand_data); 411 at91_add_device_nand(&ek_nand_data);
412 /* DM9000 ethernet */ 412 /* DM9000 ethernet */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2a1cc73390b7..ab9dcc075454 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -291,7 +291,7 @@ static void __init ek_board_init(void)
291 /* NAND */ 291 /* NAND */
292 at91_add_device_nand(&ek_nand_data); 292 at91_add_device_nand(&ek_nand_data);
293 /* I2C */ 293 /* I2C */
294 at91_add_device_i2c(); 294 at91_add_device_i2c(NULL, 0);
295 /* LCD Controller */ 295 /* LCD Controller */
296 at91_add_device_lcdc(&ek_lcdc_data); 296 at91_add_device_lcdc(&ek_lcdc_data);
297 /* AC97 */ 297 /* AC97 */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 9b61320f295a..bc0546d7245f 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -181,7 +181,7 @@ static void __init ek_board_init(void)
181 /* Serial */ 181 /* Serial */
182 at91_add_device_serial(); 182 at91_add_device_serial();
183 /* I2C */ 183 /* I2C */
184 at91_add_device_i2c(); 184 at91_add_device_i2c(NULL, 0);
185 /* NAND */ 185 /* NAND */
186 at91_add_device_nand(&ek_nand_data); 186 at91_add_device_nand(&ek_nand_data);
187 /* SPI */ 187 /* SPI */
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 848efb2a4ebf..57c3b647ce83 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -351,7 +351,7 @@ static void init_programmable_clock(struct clk *clk)
351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); 351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS); 352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS);
353 clk->parent = parent; 353 clk->parent = parent;
354 clk->rate_hz = parent->rate_hz / (1 << ((pckr >> 2) & 3)); 354 clk->rate_hz = parent->rate_hz / (1 << ((pckr & AT91_PMC_PRES) >> 2));
355} 355}
356 356
357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */ 357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
@@ -587,8 +587,11 @@ int __init at91_clock_init(unsigned long main_clock)
587 mckr = at91_sys_read(AT91_PMC_MCKR); 587 mckr = at91_sys_read(AT91_PMC_MCKR);
588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); 588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
589 freq = mck.parent->rate_hz; 589 freq = mck.parent->rate_hz;
590 freq /= (1 << ((mckr >> 2) & 3)); /* prescale */ 590 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
591 mck.rate_hz = freq / (1 + ((mckr >> 8) & 3)); /* mdiv */ 591 if (cpu_is_at91rm9200())
592 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
593 else
594 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
592 595
593 /* Register the PMC's standard clocks */ 596 /* Register the PMC's standard clocks */
594 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 597 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index 0791b56caecc..a7465db84893 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -43,12 +43,46 @@
43 * 43 *
44 */ 44 */
45 45
46#define INTENNUM_OFF 0x8 46#define INTCNTL_OFF 0x00
47#define INTDISNUM_OFF 0xC 47#define NIMASK_OFF 0x04
48#define INTENNUM_OFF 0x08
49#define INTDISNUM_OFF 0x0C
50#define INTENABLEH_OFF 0x10
51#define INTENABLEL_OFF 0x14
52#define INTTYPEH_OFF 0x18
53#define INTTYPEL_OFF 0x1C
54#define NIPRIORITY_OFF(x) (0x20+4*(7-(x)))
55#define NIVECSR_OFF 0x40
56#define FIVECSR_OFF 0x44
57#define INTSRCH_OFF 0x48
58#define INTSRCL_OFF 0x4C
59#define INTFRCH_OFF 0x50
60#define INTFRCL_OFF 0x54
61#define NIPNDH_OFF 0x58
62#define NIPNDL_OFF 0x5C
63#define FIPNDH_OFF 0x60
64#define FIPNDL_OFF 0x64
48 65
49#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE) 66#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE)
50#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF) 67#define IMX_AITC_INTCNTL (VA_AITC_BASE + INTCNTL_OFF)
68#define IMX_AITC_NIMASK (VA_AITC_BASE + NIMASK_OFF)
51#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF) 69#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF)
70#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF)
71#define IMX_AITC_INTENABLEH (VA_AITC_BASE + INTENABLEH_OFF)
72#define IMX_AITC_INTENABLEL (VA_AITC_BASE + INTENABLEL_OFF)
73#define IMX_AITC_INTTYPEH (VA_AITC_BASE + INTTYPEH_OFF)
74#define IMX_AITC_INTTYPEL (VA_AITC_BASE + INTTYPEL_OFF)
75#define IMX_AITC_NIPRIORITY(x) (VA_AITC_BASE + NIPRIORITY_OFF(x))
76#define IMX_AITC_NIVECSR (VA_AITC_BASE + NIVECSR_OFF)
77#define IMX_AITC_FIVECSR (VA_AITC_BASE + FIVECSR_OFF)
78#define IMX_AITC_INTSRCH (VA_AITC_BASE + INTSRCH_OFF)
79#define IMX_AITC_INTSRCL (VA_AITC_BASE + INTSRCL_OFF)
80#define IMX_AITC_INTFRCH (VA_AITC_BASE + INTFRCH_OFF)
81#define IMX_AITC_INTFRCL (VA_AITC_BASE + INTFRCL_OFF)
82#define IMX_AITC_NIPNDH (VA_AITC_BASE + NIPNDH_OFF)
83#define IMX_AITC_NIPNDL (VA_AITC_BASE + NIPNDL_OFF)
84#define IMX_AITC_FIPNDH (VA_AITC_BASE + FIPNDH_OFF)
85#define IMX_AITC_FIPNDL (VA_AITC_BASE + FIPNDL_OFF)
52 86
53#if 0 87#if 0
54#define DEBUG_IRQ(fmt...) printk(fmt) 88#define DEBUG_IRQ(fmt...) printk(fmt)
@@ -222,7 +256,12 @@ imx_init_irq(void)
222 256
223 DEBUG_IRQ("Initializing imx interrupts\n"); 257 DEBUG_IRQ("Initializing imx interrupts\n");
224 258
225 /* Mask all interrupts initially */ 259 /* Disable all interrupts initially. */
260 /* Do not rely on the bootloader. */
261 __raw_writel(0, IMX_AITC_INTENABLEH);
262 __raw_writel(0, IMX_AITC_INTENABLEL);
263
264 /* Mask all GPIO interrupts as well */
226 IMR(0) = 0; 265 IMR(0) = 0;
227 IMR(1) = 0; 266 IMR(1) = 0;
228 IMR(2) = 0; 267 IMR(2) = 0;
@@ -245,6 +284,6 @@ imx_init_irq(void)
245 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler); 284 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler);
246 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler); 285 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler);
247 286
248 /* Disable all interrupts initially. */ 287 /* Release masking of interrupts according to priority */
249 /* In IMX this is done in the bootloader. */ 288 __raw_writel(-1, IMX_AITC_NIMASK);
250} 289}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index d0f2b597db12..8e126e6b74c3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
148 148
149 INIT_CKEN("USBCLK", USB, 48000000, 0, &pxa27x_device_ohci.dev), 149 INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev),
150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), 150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL), 151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
152 152
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 1010f77d977a..74128eb8f8d0 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -23,8 +23,11 @@
23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { 23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
24 24
25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124), 25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
26 MFP_ADDR_X(GPIO5, GPIO26, 0x028C), 26 MFP_ADDR_X(GPIO5, GPIO9, 0x028C),
27 MFP_ADDR_X(GPIO27, GPIO62, 0x0400), 27 MFP_ADDR(GPIO10, 0x0458),
28 MFP_ADDR_X(GPIO11, GPIO26, 0x02A0),
29 MFP_ADDR_X(GPIO27, GPIO48, 0x0400),
30 MFP_ADDR_X(GPIO49, GPIO62, 0x045C),
28 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4), 31 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4),
29 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0), 32 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0),
30 MFP_ADDR_X(GPIO99, GPIO127, 0x0600), 33 MFP_ADDR_X(GPIO99, GPIO127, 0x0600),
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 71766ac0328b..422afee88169 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -309,6 +309,7 @@ void ssp_exit(struct ssp_dev *dev)
309 309
310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) { 310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) {
311 printk(KERN_WARNING "SSP: tried to close invalid port\n"); 311 printk(KERN_WARNING "SSP: tried to close invalid port\n");
312 mutex_unlock(&mutex);
312 return; 313 return;
313 } 314 }
314 315
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 9f9de3e95826..2a3a7ea5958c 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -3,7 +3,7 @@
3# see Documentation/kbuild/kconfig-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6mainmenu "uClinux/Blackfin (w/o MMU) Kernel Configuration" 6mainmenu "Blackfin Kernel Configuration"
7 7
8config MMU 8config MMU
9 bool 9 bool
@@ -29,10 +29,6 @@ config ZONE_DMA
29 bool 29 bool
30 default y 30 default y
31 31
32config BFIN
33 bool
34 default y
35
36config SEMAPHORE_SLEEPERS 32config SEMAPHORE_SLEEPERS
37 bool 33 bool
38 default y 34 default y
@@ -50,7 +46,7 @@ config GENERIC_HARDIRQS
50 default y 46 default y
51 47
52config GENERIC_IRQ_PROBE 48config GENERIC_IRQ_PROBE
53 bool 49 bool
54 default y 50 default y
55 51
56config GENERIC_TIME 52config GENERIC_TIME
@@ -69,11 +65,6 @@ config GENERIC_CALIBRATE_DELAY
69 bool 65 bool
70 default y 66 default y
71 67
72config IRQCHIP_DEMUX_GPIO
73 bool
74 depends on (BF52x || BF53x || BF561 || BF54x)
75 default y
76
77source "init/Kconfig" 68source "init/Kconfig"
78source "kernel/Kconfig.preempt" 69source "kernel/Kconfig.preempt"
79 70
@@ -140,6 +131,11 @@ config BF544
140 help 131 help
141 BF544 Processor Support. 132 BF544 Processor Support.
142 133
134config BF547
135 bool "BF547"
136 help
137 BF547 Processor Support.
138
143config BF548 139config BF548
144 bool "BF548" 140 bool "BF548"
145 help 141 help
@@ -166,11 +162,11 @@ choice
166 162
167config BF_REV_0_0 163config BF_REV_0_0
168 bool "0.0" 164 bool "0.0"
169 depends on (BF549 || BF527) 165 depends on (BF52x || BF54x)
170 166
171config BF_REV_0_1 167config BF_REV_0_1
172 bool "0.2" 168 bool "0.1"
173 depends on (BF549 || BF527) 169 depends on (BF52x || BF54x)
174 170
175config BF_REV_0_2 171config BF_REV_0_2
176 bool "0.2" 172 bool "0.2"
@@ -208,7 +204,7 @@ config BF53x
208 204
209config BF54x 205config BF54x
210 bool 206 bool
211 depends on (BF542 || BF544 || BF548 || BF549) 207 depends on (BF542 || BF544 || BF547 || BF548 || BF549)
212 default y 208 default y
213 209
214config BFIN_DUAL_CORE 210config BFIN_DUAL_CORE
@@ -221,95 +217,6 @@ config BFIN_SINGLE_CORE
221 depends on !BFIN_DUAL_CORE 217 depends on !BFIN_DUAL_CORE
222 default y 218 default y
223 219
224choice
225 prompt "System type"
226 default BFIN533_STAMP
227 help
228 Do NOT change the board here. Please use the top level
229 configuration to ensure that all the other settings are
230 correct.
231
232config BFIN527_EZKIT
233 bool "BF527-EZKIT"
234 depends on (BF522 || BF525 || BF527)
235 help
236 BF533-EZKIT-LITE board Support.
237
238config BFIN533_EZKIT
239 bool "BF533-EZKIT"
240 depends on (BF533 || BF532 || BF531)
241 help
242 BF533-EZKIT-LITE board Support.
243
244config BFIN533_STAMP
245 bool "BF533-STAMP"
246 depends on (BF533 || BF532 || BF531)
247 help
248 BF533-STAMP board Support.
249
250config BFIN537_STAMP
251 bool "BF537-STAMP"
252 depends on (BF537 || BF536 || BF534)
253 help
254 BF537-STAMP board Support.
255
256config BFIN533_BLUETECHNIX_CM
257 bool "Bluetechnix CM-BF533"
258 depends on (BF533)
259 help
260 CM-BF533 support for EVAL- and DEV-Board.
261
262config BFIN537_BLUETECHNIX_CM
263 bool "Bluetechnix CM-BF537"
264 depends on (BF537)
265 help
266 CM-BF537 support for EVAL- and DEV-Board.
267
268config BFIN548_EZKIT
269 bool "BF548-EZKIT"
270 depends on (BF548 || BF549)
271 help
272 BFIN548-EZKIT board Support.
273
274config BFIN561_BLUETECHNIX_CM
275 bool "Bluetechnix CM-BF561"
276 depends on (BF561)
277 help
278 CM-BF561 support for EVAL- and DEV-Board.
279
280config BFIN561_EZKIT
281 bool "BF561-EZKIT"
282 depends on (BF561)
283 help
284 BF561-EZKIT-LITE board Support.
285
286config BFIN561_TEPLA
287 bool "BF561-TEPLA"
288 depends on (BF561)
289 help
290 BF561-TEPLA board Support.
291
292config PNAV10
293 bool "PNAV 1.0 board"
294 depends on (BF537)
295 help
296 PNAV 1.0 board Support.
297
298config H8606_HVSISTEMAS
299 bool "HV Sistemas H8606"
300 depends on (BF532)
301 help
302 HV Sistemas H8606 board support.
303
304config GENERIC_BOARD
305 bool "Custom"
306 depends on (BF537 || BF536 \
307 || BF534 || BF561 || BF535 || BF533 || BF532 || BF531)
308 help
309 GENERIC or Custom board Support.
310
311endchoice
312
313config MEM_GENERIC_BOARD 220config MEM_GENERIC_BOARD
314 bool 221 bool
315 depends on GENERIC_BOARD 222 depends on GENERIC_BOARD
@@ -389,9 +296,9 @@ config BFIN_KERNEL_CLOCK
389 configuration. 296 configuration.
390 297
391config PLL_BYPASS 298config PLL_BYPASS
392 bool "Bypass PLL" 299 bool "Bypass PLL"
393 depends on BFIN_KERNEL_CLOCK 300 depends on BFIN_KERNEL_CLOCK
394 default n 301 default n
395 302
396config CLKIN_HALF 303config CLKIN_HALF
397 bool "Half Clock In" 304 bool "Half Clock In"
@@ -468,11 +375,11 @@ config MAX_VCO_HZ
468 default 500000000 if BF534 375 default 500000000 if BF534
469 default 400000000 if BF536 376 default 400000000 if BF536
470 default 600000000 if BF537 377 default 600000000 if BF537
471 default 533000000 if BF538 378 default 533333333 if BF538
472 default 533000000 if BF539 379 default 533333333 if BF539
473 default 600000000 if BF542 380 default 600000000 if BF542
474 default 533000000 if BF544 381 default 533333333 if BF544
475 default 533000000 if BF549 382 default 533333333 if BF549
476 default 600000000 if BF561 383 default 600000000 if BF561
477 384
478config MIN_VCO_HZ 385config MIN_VCO_HZ
@@ -481,7 +388,7 @@ config MIN_VCO_HZ
481 388
482config MAX_SCLK_HZ 389config MAX_SCLK_HZ
483 int 390 int
484 default 133000000 391 default 133333333
485 392
486config MIN_SCLK_HZ 393config MIN_SCLK_HZ
487 int 394 int
@@ -959,6 +866,20 @@ config BANK_3
959 default 0x99B3 866 default 0x99B3
960endmenu 867endmenu
961 868
869config EBIU_MBSCTLVAL
870 hex "EBIU Bank Select Control Register"
871 depends on BF54x
872 default 0
873
874config EBIU_MODEVAL
875 hex "Flash Memory Mode Control Register"
876 depends on BF54x
877 default 1
878
879config EBIU_FCTLVAL
880 hex "Flash Memory Bank Control Register"
881 depends on BF54x
882 default 6
962endmenu 883endmenu
963 884
964############################################################################# 885#############################################################################
@@ -1075,174 +996,7 @@ source "fs/Kconfig"
1075 996
1076source "kernel/Kconfig.instrumentation" 997source "kernel/Kconfig.instrumentation"
1077 998
1078menu "Kernel hacking" 999source "arch/blackfin/Kconfig.debug"
1079
1080source "lib/Kconfig.debug"
1081
1082config DEBUG_HWERR
1083 bool "Hardware error interrupt debugging"
1084 depends on DEBUG_KERNEL
1085 help
1086 When enabled, the hardware error interrupt is never disabled, and
1087 will happen immediately when an error condition occurs. This comes
1088 at a slight cost in code size, but is necessary if you are getting
1089 hardware error interrupts and need to know where they are coming
1090 from.
1091
1092config DEBUG_ICACHE_CHECK
1093 bool "Check Instruction cache coherency"
1094 depends on DEBUG_KERNEL
1095 depends on DEBUG_HWERR
1096 help
1097 Say Y here if you are getting weird unexplained errors. This will
1098 ensure that icache is what SDRAM says it should be by doing a
1099 byte wise comparison between SDRAM and instruction cache. This
1100 also relocates the irq_panic() function to L1 memory, (which is
1101 un-cached).
1102
1103config DEBUG_HUNT_FOR_ZERO
1104 bool "Catch NULL pointer reads/writes"
1105 default y
1106 help
1107 Say Y here to catch reads/writes to anywhere in the memory range
1108 from 0x0000 - 0x0FFF (the first 4k) of memory. This is useful in
1109 catching common programming errors such as NULL pointer dereferences.
1110
1111 Misbehaving applications will be killed (generate a SEGV) while the
1112 kernel will trigger a panic.
1113
1114 Enabling this option will take up an extra entry in CPLB table.
1115 Otherwise, there is no extra overhead.
1116
1117config DEBUG_BFIN_HWTRACE_ON
1118 bool "Turn on Blackfin's Hardware Trace"
1119 default y
1120 help
1121 All Blackfins include a Trace Unit which stores a history of the last
1122 16 changes in program flow taken by the program sequencer. The history
1123 allows the user to recreate the program sequencer’s recent path. This
1124 can be handy when an application dies - we print out the execution
1125 path of how it got to the offending instruction.
1126
1127 By turning this off, you may save a tiny amount of power.
1128
1129choice
1130 prompt "Omit loop Tracing"
1131 default DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
1132 depends on DEBUG_BFIN_HWTRACE_ON
1133 help
1134 The trace buffer can be configured to omit recording of changes in
1135 program flow that match either the last entry or one of the last
1136 two entries. Omitting one of these entries from the record prevents
1137 the trace buffer from overflowing because of any sort of loop (for, do
1138 while, etc) in the program.
1139
1140 Because zero-overhead Hardware loops are not recorded in the trace buffer,
1141 this feature can be used to prevent trace overflow from loops that
1142 are nested four deep.
1143
1144config DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
1145 bool "Trace all Loops"
1146 help
1147 The trace buffer records all changes of flow
1148
1149config DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
1150 bool "Compress single-level loops"
1151 help
1152 The trace buffer does not record single loops - helpful if trace
1153 is spinning on a while or do loop.
1154
1155config DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
1156 bool "Compress two-level loops"
1157 help
1158 The trace buffer does not record loops two levels deep. Helpful if
1159 the trace is spinning in a nested loop
1160
1161endchoice
1162
1163config DEBUG_BFIN_HWTRACE_COMPRESSION
1164 int
1165 depends on DEBUG_BFIN_HWTRACE_ON
1166 default 0 if DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
1167 default 1 if DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
1168 default 2 if DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
1169
1170
1171config DEBUG_BFIN_HWTRACE_EXPAND
1172 bool "Expand Trace Buffer greater than 16 entries"
1173 depends on DEBUG_BFIN_HWTRACE_ON
1174 default n
1175 help
1176 By selecting this option, every time the 16 hardware entries in
1177 the Blackfin's HW Trace buffer are full, the kernel will move them
1178 into a software buffer, for dumping when there is an issue. This
1179 has a great impact on performance, (an interrupt every 16 change of
1180 flows) and should normally be turned off, except in those nasty
1181 debugging sessions
1182
1183config DEBUG_BFIN_HWTRACE_EXPAND_LEN
1184 int "Size of Trace buffer (in power of 2k)"
1185 range 0 4
1186 depends on DEBUG_BFIN_HWTRACE_EXPAND
1187 default 1
1188 help
1189 This sets the size of the software buffer that the trace information
1190 is kept in.
1191 0 for (2^0) 1k, or 256 entries,
1192 1 for (2^1) 2k, or 512 entries,
1193 2 for (2^2) 4k, or 1024 entries,
1194 3 for (2^3) 8k, or 2048 entries,
1195 4 for (2^4) 16k, or 4096 entries
1196
1197config DEBUG_BFIN_NO_KERN_HWTRACE
1198 bool "Trace user apps (turn off hwtrace in kernel)"
1199 depends on DEBUG_BFIN_HWTRACE_ON
1200 default n
1201 help
1202 Some pieces of the kernel contain a lot of flow changes which can
1203 quickly fill up the hardware trace buffer. When debugging crashes,
1204 the hardware trace may indicate that the problem lies in kernel
1205 space when in reality an application is buggy.
1206
1207 Say Y here to disable hardware tracing in some known "jumpy" pieces
1208 of code so that the trace buffer will extend further back.
1209
1210config EARLY_PRINTK
1211 bool "Early printk"
1212 default n
1213 help
1214 This option enables special console drivers which allow the kernel
1215 to print messages very early in the bootup process.
1216
1217 This is useful for kernel debugging when your machine crashes very
1218 early before the console code is initialized. After enabling this
1219 feature, you must add "earlyprintk=serial,uart0,57600" to the
1220 command line (bootargs). It is safe to say Y here in all cases, as
1221 all of this lives in the init section and is thrown away after the
1222 kernel boots completely.
1223
1224config DUAL_CORE_TEST_MODULE
1225 tristate "Dual Core Test Module"
1226 depends on (BF561)
1227 default n
1228 help
1229 Say Y here to build-in dual core test module for dual core test.
1230
1231config CPLB_INFO
1232 bool "Display the CPLB information"
1233 help
1234 Display the CPLB information.
1235
1236config ACCESS_CHECK
1237 bool "Check the user pointer address"
1238 default y
1239 help
1240 Usually the pointer transfer from user space is checked to see if its
1241 address is in the kernel space.
1242
1243 Say N here to disable that check to improve the performance.
1244
1245endmenu
1246 1000
1247source "security/Kconfig" 1001source "security/Kconfig"
1248 1002
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
new file mode 100644
index 000000000000..59b87a483c68
--- /dev/null
+++ b/arch/blackfin/Kconfig.debug
@@ -0,0 +1,178 @@
1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5config DEBUG_MMRS
6 bool "Generate Blackfin MMR tree"
7 select DEBUG_FS
8 help
9 Create a tree of Blackfin MMRs via the debugfs tree. If
10 you enable this, you will find all MMRs laid out in the
11 /sys/kernel/debug/blackfin/ directory where you can read/write
12 MMRs directly from userspace. This is obviously just a debug
13 feature.
14
15config DEBUG_HWERR
16 bool "Hardware error interrupt debugging"
17 depends on DEBUG_KERNEL
18 help
19 When enabled, the hardware error interrupt is never disabled, and
20 will happen immediately when an error condition occurs. This comes
21 at a slight cost in code size, but is necessary if you are getting
22 hardware error interrupts and need to know where they are coming
23 from.
24
25config DEBUG_ICACHE_CHECK
26 bool "Check Instruction cache coherency"
27 depends on DEBUG_KERNEL
28 depends on DEBUG_HWERR
29 help
30 Say Y here if you are getting weird unexplained errors. This will
31 ensure that icache is what SDRAM says it should be by doing a
32 byte wise comparison between SDRAM and instruction cache. This
33 also relocates the irq_panic() function to L1 memory, (which is
34 un-cached).
35
36config DEBUG_HUNT_FOR_ZERO
37 bool "Catch NULL pointer reads/writes"
38 default y
39 help
40 Say Y here to catch reads/writes to anywhere in the memory range
41 from 0x0000 - 0x0FFF (the first 4k) of memory. This is useful in
42 catching common programming errors such as NULL pointer dereferences.
43
44 Misbehaving applications will be killed (generate a SEGV) while the
45 kernel will trigger a panic.
46
47 Enabling this option will take up an extra entry in CPLB table.
48 Otherwise, there is no extra overhead.
49
50config DEBUG_BFIN_HWTRACE_ON
51 bool "Turn on Blackfin's Hardware Trace"
52 default y
53 help
54 All Blackfins include a Trace Unit which stores a history of the last
55 16 changes in program flow taken by the program sequencer. The history
56 allows the user to recreate the program sequencer’s recent path. This
57 can be handy when an application dies - we print out the execution
58 path of how it got to the offending instruction.
59
60 By turning this off, you may save a tiny amount of power.
61
62choice
63 prompt "Omit loop Tracing"
64 default DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
65 depends on DEBUG_BFIN_HWTRACE_ON
66 help
67 The trace buffer can be configured to omit recording of changes in
68 program flow that match either the last entry or one of the last
69 two entries. Omitting one of these entries from the record prevents
70 the trace buffer from overflowing because of any sort of loop (for, do
71 while, etc) in the program.
72
73 Because zero-overhead Hardware loops are not recorded in the trace buffer,
74 this feature can be used to prevent trace overflow from loops that
75 are nested four deep.
76
77config DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
78 bool "Trace all Loops"
79 help
80 The trace buffer records all changes of flow
81
82config DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
83 bool "Compress single-level loops"
84 help
85 The trace buffer does not record single loops - helpful if trace
86 is spinning on a while or do loop.
87
88config DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
89 bool "Compress two-level loops"
90 help
91 The trace buffer does not record loops two levels deep. Helpful if
92 the trace is spinning in a nested loop
93
94endchoice
95
96config DEBUG_BFIN_HWTRACE_COMPRESSION
97 int
98 depends on DEBUG_BFIN_HWTRACE_ON
99 default 0 if DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
100 default 1 if DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
101 default 2 if DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
102
103
104config DEBUG_BFIN_HWTRACE_EXPAND
105 bool "Expand Trace Buffer greater than 16 entries"
106 depends on DEBUG_BFIN_HWTRACE_ON
107 default n
108 help
109 By selecting this option, every time the 16 hardware entries in
110 the Blackfin's HW Trace buffer are full, the kernel will move them
111 into a software buffer, for dumping when there is an issue. This
112 has a great impact on performance, (an interrupt every 16 change of
113 flows) and should normally be turned off, except in those nasty
114 debugging sessions
115
116config DEBUG_BFIN_HWTRACE_EXPAND_LEN
117 int "Size of Trace buffer (in power of 2k)"
118 range 0 4
119 depends on DEBUG_BFIN_HWTRACE_EXPAND
120 default 1
121 help
122 This sets the size of the software buffer that the trace information
123 is kept in.
124 0 for (2^0) 1k, or 256 entries,
125 1 for (2^1) 2k, or 512 entries,
126 2 for (2^2) 4k, or 1024 entries,
127 3 for (2^3) 8k, or 2048 entries,
128 4 for (2^4) 16k, or 4096 entries
129
130config DEBUG_BFIN_NO_KERN_HWTRACE
131 bool "Trace user apps (turn off hwtrace in kernel)"
132 depends on DEBUG_BFIN_HWTRACE_ON
133 default n
134 help
135 Some pieces of the kernel contain a lot of flow changes which can
136 quickly fill up the hardware trace buffer. When debugging crashes,
137 the hardware trace may indicate that the problem lies in kernel
138 space when in reality an application is buggy.
139
140 Say Y here to disable hardware tracing in some known "jumpy" pieces
141 of code so that the trace buffer will extend further back.
142
143config EARLY_PRINTK
144 bool "Early printk"
145 default n
146 help
147 This option enables special console drivers which allow the kernel
148 to print messages very early in the bootup process.
149
150 This is useful for kernel debugging when your machine crashes very
151 early before the console code is initialized. After enabling this
152 feature, you must add "earlyprintk=serial,uart0,57600" to the
153 command line (bootargs). It is safe to say Y here in all cases, as
154 all of this lives in the init section and is thrown away after the
155 kernel boots completely.
156
157config DUAL_CORE_TEST_MODULE
158 tristate "Dual Core Test Module"
159 depends on (BF561)
160 default n
161 help
162 Say Y here to build-in dual core test module for dual core test.
163
164config CPLB_INFO
165 bool "Display the CPLB information"
166 help
167 Display the CPLB information.
168
169config ACCESS_CHECK
170 bool "Check the user pointer address"
171 default y
172 help
173 Usually the pointer transfer from user space is checked to see if its
174 address is in the kernel space.
175
176 Say N here to disable that check to improve the performance.
177
178endmenu
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index f7cac7c51e7e..c47e000f8324 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -31,6 +31,7 @@ machine-$(CONFIG_BF536) := bf537
31machine-$(CONFIG_BF537) := bf537 31machine-$(CONFIG_BF537) := bf537
32machine-$(CONFIG_BF542) := bf548 32machine-$(CONFIG_BF542) := bf548
33machine-$(CONFIG_BF544) := bf548 33machine-$(CONFIG_BF544) := bf548
34machine-$(CONFIG_BF547) := bf548
34machine-$(CONFIG_BF548) := bf548 35machine-$(CONFIG_BF548) := bf548
35machine-$(CONFIG_BF549) := bf548 36machine-$(CONFIG_BF549) := bf548
36machine-$(CONFIG_BF561) := bf561 37machine-$(CONFIG_BF561) := bf561
@@ -48,6 +49,7 @@ cpu-$(CONFIG_BF536) := bf536
48cpu-$(CONFIG_BF537) := bf537 49cpu-$(CONFIG_BF537) := bf537
49cpu-$(CONFIG_BF542) := bf542 50cpu-$(CONFIG_BF542) := bf542
50cpu-$(CONFIG_BF544) := bf544 51cpu-$(CONFIG_BF544) := bf544
52cpu-$(CONFIG_BF547) := bf547
51cpu-$(CONFIG_BF548) := bf548 53cpu-$(CONFIG_BF548) := bf548
52cpu-$(CONFIG_BF549) := bf549 54cpu-$(CONFIG_BF549) := bf549
53cpu-$(CONFIG_BF561) := bf561 55cpu-$(CONFIG_BF561) := bf561
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 1f6a93df6b32..fa6eb4e00fae 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.9 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -127,6 +125,7 @@ CONFIG_BF527=y
127# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
128# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
129# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
130# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
131# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
132# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
@@ -140,19 +139,8 @@ CONFIG_BF_REV_0_0=y
140# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
141CONFIG_BF52x=y 140CONFIG_BF52x=y
142CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
143CONFIG_BFIN527_EZKIT=y
144# CONFIG_BFIN533_EZKIT is not set
145# CONFIG_BFIN533_STAMP is not set
146# CONFIG_BFIN537_STAMP is not set
147# CONFIG_BFIN533_BLUETECHNIX_CM is not set
148# CONFIG_BFIN537_BLUETECHNIX_CM is not set
149# CONFIG_BFIN548_EZKIT is not set
150# CONFIG_BFIN561_BLUETECHNIX_CM is not set
151# CONFIG_BFIN561_EZKIT is not set
152# CONFIG_BFIN561_TEPLA is not set
153# CONFIG_PNAV10 is not set
154# CONFIG_GENERIC_BOARD is not set
155CONFIG_MEM_MT48LC32M16A2TG_75=y 142CONFIG_MEM_MT48LC32M16A2TG_75=y
143CONFIG_BFIN527_EZKIT=y
156 144
157# 145#
158# BF527 Specific Configuration 146# BF527 Specific Configuration
@@ -244,7 +232,7 @@ CONFIG_CLKIN_HZ=25000000
244# CONFIG_BFIN_KERNEL_CLOCK is not set 232# CONFIG_BFIN_KERNEL_CLOCK is not set
245CONFIG_MAX_VCO_HZ=600000000 233CONFIG_MAX_VCO_HZ=600000000
246CONFIG_MIN_VCO_HZ=50000000 234CONFIG_MIN_VCO_HZ=50000000
247CONFIG_MAX_SCLK_HZ=133333333 235CONFIG_MAX_SCLK_HZ=133000000
248CONFIG_MIN_SCLK_HZ=27000000 236CONFIG_MIN_SCLK_HZ=27000000
249 237
250# 238#
@@ -301,6 +289,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
301# CONFIG_RESOURCES_64BIT is not set 289# CONFIG_RESOURCES_64BIT is not set
302CONFIG_ZONE_DMA_FLAG=1 290CONFIG_ZONE_DMA_FLAG=1
303CONFIG_LARGE_ALLOCS=y 291CONFIG_LARGE_ALLOCS=y
292# CONFIG_BFIN_GPTIMERS is not set
304CONFIG_BFIN_DMA_5XX=y 293CONFIG_BFIN_DMA_5XX=y
305# CONFIG_DMA_UNCACHED_2M is not set 294# CONFIG_DMA_UNCACHED_2M is not set
306CONFIG_DMA_UNCACHED_1M=y 295CONFIG_DMA_UNCACHED_1M=y
@@ -322,7 +311,7 @@ CONFIG_L1_MAX_PIECE=16
322# 311#
323 312
324# 313#
325# EBIU_AMBCTL Global Control 314# EBIU_AMGCTL Global Control
326# 315#
327CONFIG_C_AMCKEN=y 316CONFIG_C_AMCKEN=y
328CONFIG_C_CDPRIO=y 317CONFIG_C_CDPRIO=y
@@ -548,6 +537,7 @@ CONFIG_BFIN_NAND_CLE=2
548CONFIG_BFIN_NAND_ALE=1 537CONFIG_BFIN_NAND_ALE=1
549CONFIG_BFIN_NAND_READY=3 538CONFIG_BFIN_NAND_READY=3
550CONFIG_MTD_NAND_IDS=m 539CONFIG_MTD_NAND_IDS=m
540# CONFIG_MTD_NAND_BF5XX is not set
551# CONFIG_MTD_NAND_DISKONCHIP is not set 541# CONFIG_MTD_NAND_DISKONCHIP is not set
552# CONFIG_MTD_NAND_NANDSIM is not set 542# CONFIG_MTD_NAND_NANDSIM is not set
553# CONFIG_MTD_NAND_PLATFORM is not set 543# CONFIG_MTD_NAND_PLATFORM is not set
@@ -637,6 +627,7 @@ CONFIG_BFIN_MAC_RMII=y
637# CONFIG_DM9000 is not set 627# CONFIG_DM9000 is not set
638CONFIG_NETDEV_1000=y 628CONFIG_NETDEV_1000=y
639CONFIG_NETDEV_10000=y 629CONFIG_NETDEV_10000=y
630# CONFIG_AX88180 is not set
640 631
641# 632#
642# Wireless LAN 633# Wireless LAN
@@ -708,7 +699,7 @@ CONFIG_INPUT_MISC=y
708# CONFIG_SPI_ADC_BF533 is not set 699# CONFIG_SPI_ADC_BF533 is not set
709# CONFIG_BF5xx_PFLAGS is not set 700# CONFIG_BF5xx_PFLAGS is not set
710# CONFIG_BF5xx_PPIFCD is not set 701# CONFIG_BF5xx_PPIFCD is not set
711# CONFIG_BF5xx_TIMERS is not set 702# CONFIG_BFIN_SIMPLE_TIMER is not set
712# CONFIG_BF5xx_PPI is not set 703# CONFIG_BF5xx_PPI is not set
713# CONFIG_BFIN_SPORT is not set 704# CONFIG_BFIN_SPORT is not set
714# CONFIG_BFIN_TIMER_LATENCY is not set 705# CONFIG_BFIN_TIMER_LATENCY is not set
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 9e9b420342d1..4fdb49362ba3 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.6 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122CONFIG_BF533=y 122CONFIG_BF533=y
@@ -125,10 +125,12 @@ CONFIG_BF533=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133CONFIG_BF_REV_0_3=y 135CONFIG_BF_REV_0_3=y
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,18 +139,12 @@ CONFIG_BF_REV_0_3=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 140CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
142CONFIG_MEM_MT48LC16M16A2TG_75=y
140CONFIG_BFIN533_EZKIT=y 143CONFIG_BFIN533_EZKIT=y
141# CONFIG_BFIN533_STAMP is not set 144# CONFIG_BFIN533_STAMP is not set
142# CONFIG_BFIN537_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set 145# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set 146# CONFIG_H8606_HVSISTEMAS is not set
145# CONFIG_BFIN548_EZKIT is not set 147# CONFIG_GENERIC_BF533_BOARD is not set
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_MEM_MT48LC16M16A2TG_75=y
152 148
153# 149#
154# BF533/2/1 Specific Configuration 150# BF533/2/1 Specific Configuration
@@ -198,7 +194,7 @@ CONFIG_CLKIN_HZ=27000000
198# CONFIG_BFIN_KERNEL_CLOCK is not set 194# CONFIG_BFIN_KERNEL_CLOCK is not set
199CONFIG_MAX_VCO_HZ=750000000 195CONFIG_MAX_VCO_HZ=750000000
200CONFIG_MIN_VCO_HZ=50000000 196CONFIG_MIN_VCO_HZ=50000000
201CONFIG_MAX_SCLK_HZ=133333333 197CONFIG_MAX_SCLK_HZ=133000000
202CONFIG_MIN_SCLK_HZ=27000000 198CONFIG_MIN_SCLK_HZ=27000000
203 199
204# 200#
@@ -255,6 +251,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
255# CONFIG_RESOURCES_64BIT is not set 251# CONFIG_RESOURCES_64BIT is not set
256CONFIG_ZONE_DMA_FLAG=1 252CONFIG_ZONE_DMA_FLAG=1
257CONFIG_LARGE_ALLOCS=y 253CONFIG_LARGE_ALLOCS=y
254# CONFIG_BFIN_GPTIMERS is not set
258CONFIG_BFIN_DMA_5XX=y 255CONFIG_BFIN_DMA_5XX=y
259# CONFIG_DMA_UNCACHED_2M is not set 256# CONFIG_DMA_UNCACHED_2M is not set
260CONFIG_DMA_UNCACHED_1M=y 257CONFIG_DMA_UNCACHED_1M=y
@@ -276,7 +273,7 @@ CONFIG_L1_MAX_PIECE=16
276# 273#
277 274
278# 275#
279# EBIU_AMBCTL Global Control 276# EBIU_AMGCTL Global Control
280# 277#
281CONFIG_C_AMCKEN=y 278CONFIG_C_AMCKEN=y
282CONFIG_C_CDPRIO=y 279CONFIG_C_CDPRIO=y
@@ -526,14 +523,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
526CONFIG_MTD_BF5xx=m 523CONFIG_MTD_BF5xx=m
527CONFIG_BFIN_FLASH_SIZE=0x400000 524CONFIG_BFIN_FLASH_SIZE=0x400000
528CONFIG_EBIU_FLASH_BASE=0x20000000 525CONFIG_EBIU_FLASH_BASE=0x20000000
529
530#
531# FLASH_EBIU_AMBCTL Control
532#
533CONFIG_BFIN_FLASH_BANK_0=0x7BB0
534CONFIG_BFIN_FLASH_BANK_1=0x7BB0
535CONFIG_BFIN_FLASH_BANK_2=0x7BB0
536CONFIG_BFIN_FLASH_BANK_3=0x7BB0
537# CONFIG_MTD_UCLINUX is not set 526# CONFIG_MTD_UCLINUX is not set
538# CONFIG_MTD_PLATRAM is not set 527# CONFIG_MTD_PLATRAM is not set
539 528
@@ -622,6 +611,7 @@ CONFIG_SMC91X=y
622# CONFIG_DM9000 is not set 611# CONFIG_DM9000 is not set
623CONFIG_NETDEV_1000=y 612CONFIG_NETDEV_1000=y
624CONFIG_NETDEV_10000=y 613CONFIG_NETDEV_10000=y
614# CONFIG_AX88180 is not set
625 615
626# 616#
627# Wireless LAN 617# Wireless LAN
@@ -683,9 +673,9 @@ CONFIG_INPUT_EVDEV=m
683# 673#
684# CONFIG_AD9960 is not set 674# CONFIG_AD9960 is not set
685# CONFIG_SPI_ADC_BF533 is not set 675# CONFIG_SPI_ADC_BF533 is not set
686# CONFIG_BFIN_PFLAGS is not set 676# CONFIG_BF5xx_PFLAGS is not set
687# CONFIG_BF5xx_PPIFCD is not set 677# CONFIG_BF5xx_PPIFCD is not set
688# CONFIG_BF5xx_TIMERS is not set 678# CONFIG_BFIN_SIMPLE_TIMER is not set
689# CONFIG_BF5xx_PPI is not set 679# CONFIG_BF5xx_PPI is not set
690CONFIG_BFIN_SPORT=y 680CONFIG_BFIN_SPORT=y
691# CONFIG_BFIN_TIMER_LATENCY is not set 681# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -708,6 +698,7 @@ CONFIG_SERIAL_BFIN_DMA=y
708# CONFIG_SERIAL_BFIN_PIO is not set 698# CONFIG_SERIAL_BFIN_PIO is not set
709CONFIG_SERIAL_BFIN_UART0=y 699CONFIG_SERIAL_BFIN_UART0=y
710# CONFIG_BFIN_UART0_CTSRTS is not set 700# CONFIG_BFIN_UART0_CTSRTS is not set
701# CONFIG_SERIAL_BFIN_UART1 is not set
711CONFIG_SERIAL_CORE=y 702CONFIG_SERIAL_CORE=y
712CONFIG_SERIAL_CORE_CONSOLE=y 703CONFIG_SERIAL_CORE_CONSOLE=y
713# CONFIG_SERIAL_BFIN_SPORT is not set 704# CONFIG_SERIAL_BFIN_SPORT is not set
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index f59ade980109..b04e8e533e9a 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.6 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122CONFIG_BF533=y 122CONFIG_BF533=y
@@ -125,10 +125,12 @@ CONFIG_BF533=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133CONFIG_BF_REV_0_3=y 135CONFIG_BF_REV_0_3=y
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,19 +139,13 @@ CONFIG_BF_REV_0_3=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 140CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
142CONFIG_MEM_MT48LC64M4A2FB_7E=y
143CONFIG_BFIN_SHARED_FLASH_ENET=y
140# CONFIG_BFIN533_EZKIT is not set 144# CONFIG_BFIN533_EZKIT is not set
141CONFIG_BFIN533_STAMP=y 145CONFIG_BFIN533_STAMP=y
142# CONFIG_BFIN537_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set 146# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set 147# CONFIG_H8606_HVSISTEMAS is not set
145# CONFIG_BFIN548_EZKIT is not set 148# CONFIG_GENERIC_BF533_BOARD is not set
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_MEM_MT48LC64M4A2FB_7E=y
152CONFIG_BFIN_SHARED_FLASH_ENET=y
153 149
154# 150#
155# BF533/2/1 Specific Configuration 151# BF533/2/1 Specific Configuration
@@ -199,7 +195,7 @@ CONFIG_CLKIN_HZ=11059200
199# CONFIG_BFIN_KERNEL_CLOCK is not set 195# CONFIG_BFIN_KERNEL_CLOCK is not set
200CONFIG_MAX_VCO_HZ=750000000 196CONFIG_MAX_VCO_HZ=750000000
201CONFIG_MIN_VCO_HZ=50000000 197CONFIG_MIN_VCO_HZ=50000000
202CONFIG_MAX_SCLK_HZ=133333333 198CONFIG_MAX_SCLK_HZ=133000000
203CONFIG_MIN_SCLK_HZ=27000000 199CONFIG_MIN_SCLK_HZ=27000000
204 200
205# 201#
@@ -267,6 +263,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
267# CONFIG_RESOURCES_64BIT is not set 263# CONFIG_RESOURCES_64BIT is not set
268CONFIG_ZONE_DMA_FLAG=1 264CONFIG_ZONE_DMA_FLAG=1
269CONFIG_LARGE_ALLOCS=y 265CONFIG_LARGE_ALLOCS=y
266# CONFIG_BFIN_GPTIMERS is not set
270CONFIG_BFIN_DMA_5XX=y 267CONFIG_BFIN_DMA_5XX=y
271# CONFIG_DMA_UNCACHED_2M is not set 268# CONFIG_DMA_UNCACHED_2M is not set
272CONFIG_DMA_UNCACHED_1M=y 269CONFIG_DMA_UNCACHED_1M=y
@@ -288,7 +285,7 @@ CONFIG_L1_MAX_PIECE=16
288# 285#
289 286
290# 287#
291# EBIU_AMBCTL Global Control 288# EBIU_AMGCTL Global Control
292# 289#
293CONFIG_C_AMCKEN=y 290CONFIG_C_AMCKEN=y
294CONFIG_C_CDPRIO=y 291CONFIG_C_CDPRIO=y
@@ -634,6 +631,7 @@ CONFIG_SMC91X=y
634# CONFIG_DM9000 is not set 631# CONFIG_DM9000 is not set
635CONFIG_NETDEV_1000=y 632CONFIG_NETDEV_1000=y
636CONFIG_NETDEV_10000=y 633CONFIG_NETDEV_10000=y
634# CONFIG_AX88180 is not set
637 635
638# 636#
639# Wireless LAN 637# Wireless LAN
@@ -704,9 +702,9 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
704# 702#
705# CONFIG_AD9960 is not set 703# CONFIG_AD9960 is not set
706# CONFIG_SPI_ADC_BF533 is not set 704# CONFIG_SPI_ADC_BF533 is not set
707# CONFIG_BFIN_PFLAGS is not set 705# CONFIG_BF5xx_PFLAGS is not set
708# CONFIG_BF5xx_PPIFCD is not set 706# CONFIG_BF5xx_PPIFCD is not set
709# CONFIG_BF5xx_TIMERS is not set 707# CONFIG_BFIN_SIMPLE_TIMER is not set
710# CONFIG_BF5xx_PPI is not set 708# CONFIG_BF5xx_PPI is not set
711CONFIG_BFIN_SPORT=y 709CONFIG_BFIN_SPORT=y
712# CONFIG_BFIN_TIMER_LATENCY is not set 710# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -732,6 +730,7 @@ CONFIG_SERIAL_BFIN_DMA=y
732# CONFIG_SERIAL_BFIN_PIO is not set 730# CONFIG_SERIAL_BFIN_PIO is not set
733CONFIG_SERIAL_BFIN_UART0=y 731CONFIG_SERIAL_BFIN_UART0=y
734# CONFIG_BFIN_UART0_CTSRTS is not set 732# CONFIG_BFIN_UART0_CTSRTS is not set
733# CONFIG_SERIAL_BFIN_UART1 is not set
735CONFIG_SERIAL_CORE=y 734CONFIG_SERIAL_CORE=y
736CONFIG_SERIAL_CORE_CONSOLE=y 735CONFIG_SERIAL_CORE_CONSOLE=y
737# CONFIG_SERIAL_BFIN_SPORT is not set 736# CONFIG_SERIAL_BFIN_SPORT is not set
@@ -925,6 +924,7 @@ CONFIG_NTSC=y
925# CONFIG_PAL_YCBCR is not set 924# CONFIG_PAL_YCBCR is not set
926CONFIG_ADV7393_1XMEM=y 925CONFIG_ADV7393_1XMEM=y
927# CONFIG_ADV7393_2XMEM is not set 926# CONFIG_ADV7393_2XMEM is not set
927# CONFIG_FB_BFIN_T350MCQB is not set
928# CONFIG_FB_S1D13XXX is not set 928# CONFIG_FB_S1D13XXX is not set
929# CONFIG_FB_VIRTUAL is not set 929# CONFIG_FB_VIRTUAL is not set
930# CONFIG_LOGO is not set 930# CONFIG_LOGO is not set
@@ -979,11 +979,6 @@ CONFIG_SND_BFIN_AD73311_SE=4
979# CONFIG_SND_SOC is not set 979# CONFIG_SND_SOC is not set
980 980
981# 981#
982# SoC Audio for the ADI Blackfin
983#
984# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
985
986#
987# Open Sound System 982# Open Sound System
988# 983#
989# CONFIG_SOUND_PRIME is not set 984# CONFIG_SOUND_PRIME is not set
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 07eb63dc25e0..f812b66318b9 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.6 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122# CONFIG_BF533 is not set 122# CONFIG_BF533 is not set
@@ -125,10 +125,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
125CONFIG_BF537=y 125CONFIG_BF537=y
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132CONFIG_BF_REV_0_2=y 134CONFIG_BF_REV_0_2=y
133# CONFIG_BF_REV_0_3 is not set 135# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -137,33 +139,8 @@ CONFIG_BF_REV_0_2=y
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y 140CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
140# CONFIG_BFIN533_EZKIT is not set
141# CONFIG_BFIN533_STAMP is not set
142CONFIG_BFIN537_STAMP=y
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144# CONFIG_BFIN537_BLUETECHNIX_CM is not set
145# CONFIG_BFIN548_EZKIT is not set
146# CONFIG_BFIN561_BLUETECHNIX_CM is not set
147# CONFIG_BFIN561_EZKIT is not set
148# CONFIG_BFIN561_TEPLA is not set
149# CONFIG_PNAV10 is not set
150# CONFIG_GENERIC_BOARD is not set
151CONFIG_MEM_MT48LC32M8A2_75=y 142CONFIG_MEM_MT48LC32M8A2_75=y
152CONFIG_IRQ_PLL_WAKEUP=7 143CONFIG_IRQ_PLL_WAKEUP=7
153
154#
155# BF537 Specific Configuration
156#
157
158#
159# Interrupt Priority Assignment
160#
161
162#
163# Priority
164#
165CONFIG_IRQ_DMA_ERROR=7
166CONFIG_IRQ_ERROR=7
167CONFIG_IRQ_RTC=8 144CONFIG_IRQ_RTC=8
168CONFIG_IRQ_PPI=8 145CONFIG_IRQ_PPI=8
169CONFIG_IRQ_SPORT0_RX=9 146CONFIG_IRQ_SPORT0_RX=9
@@ -176,8 +153,6 @@ CONFIG_IRQ_UART0_RX=10
176CONFIG_IRQ_UART0_TX=10 153CONFIG_IRQ_UART0_TX=10
177CONFIG_IRQ_UART1_RX=10 154CONFIG_IRQ_UART1_RX=10
178CONFIG_IRQ_UART1_TX=10 155CONFIG_IRQ_UART1_TX=10
179CONFIG_IRQ_CAN_RX=11
180CONFIG_IRQ_CAN_TX=11
181CONFIG_IRQ_MAC_RX=11 156CONFIG_IRQ_MAC_RX=11
182CONFIG_IRQ_MAC_TX=11 157CONFIG_IRQ_MAC_TX=11
183CONFIG_IRQ_TMR0=12 158CONFIG_IRQ_TMR0=12
@@ -188,11 +163,31 @@ CONFIG_IRQ_TMR4=12
188CONFIG_IRQ_TMR5=12 163CONFIG_IRQ_TMR5=12
189CONFIG_IRQ_TMR6=12 164CONFIG_IRQ_TMR6=12
190CONFIG_IRQ_TMR7=12 165CONFIG_IRQ_TMR7=12
191CONFIG_IRQ_PROG_INTA=12
192CONFIG_IRQ_PORTG_INTB=12 166CONFIG_IRQ_PORTG_INTB=12
193CONFIG_IRQ_MEM_DMA0=13 167CONFIG_IRQ_MEM_DMA0=13
194CONFIG_IRQ_MEM_DMA1=13 168CONFIG_IRQ_MEM_DMA1=13
195CONFIG_IRQ_WATCH=13 169CONFIG_IRQ_WATCH=13
170CONFIG_BFIN537_STAMP=y
171# CONFIG_BFIN537_BLUETECHNIX_CM is not set
172# CONFIG_PNAV10 is not set
173# CONFIG_GENERIC_BF537_BOARD is not set
174
175#
176# BF537 Specific Configuration
177#
178
179#
180# Interrupt Priority Assignment
181#
182
183#
184# Priority
185#
186CONFIG_IRQ_DMA_ERROR=7
187CONFIG_IRQ_ERROR=7
188CONFIG_IRQ_CAN_RX=11
189CONFIG_IRQ_CAN_TX=11
190CONFIG_IRQ_PROG_INTA=12
196 191
197# 192#
198# Board customizations 193# Board customizations
@@ -206,7 +201,7 @@ CONFIG_CLKIN_HZ=25000000
206# CONFIG_BFIN_KERNEL_CLOCK is not set 201# CONFIG_BFIN_KERNEL_CLOCK is not set
207CONFIG_MAX_VCO_HZ=600000000 202CONFIG_MAX_VCO_HZ=600000000
208CONFIG_MIN_VCO_HZ=50000000 203CONFIG_MIN_VCO_HZ=50000000
209CONFIG_MAX_SCLK_HZ=133333333 204CONFIG_MAX_SCLK_HZ=133000000
210CONFIG_MIN_SCLK_HZ=27000000 205CONFIG_MIN_SCLK_HZ=27000000
211 206
212# 207#
@@ -263,6 +258,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
263# CONFIG_RESOURCES_64BIT is not set 258# CONFIG_RESOURCES_64BIT is not set
264CONFIG_ZONE_DMA_FLAG=1 259CONFIG_ZONE_DMA_FLAG=1
265CONFIG_LARGE_ALLOCS=y 260CONFIG_LARGE_ALLOCS=y
261# CONFIG_BFIN_GPTIMERS is not set
266CONFIG_BFIN_DMA_5XX=y 262CONFIG_BFIN_DMA_5XX=y
267# CONFIG_DMA_UNCACHED_2M is not set 263# CONFIG_DMA_UNCACHED_2M is not set
268CONFIG_DMA_UNCACHED_1M=y 264CONFIG_DMA_UNCACHED_1M=y
@@ -284,7 +280,7 @@ CONFIG_L1_MAX_PIECE=16
284# 280#
285 281
286# 282#
287# EBIU_AMBCTL Global Control 283# EBIU_AMGCTL Global Control
288# 284#
289CONFIG_C_AMCKEN=y 285CONFIG_C_AMCKEN=y
290CONFIG_C_CDPRIO=y 286CONFIG_C_CDPRIO=y
@@ -534,14 +530,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
534CONFIG_MTD_BF5xx=m 530CONFIG_MTD_BF5xx=m
535CONFIG_BFIN_FLASH_SIZE=0x400000 531CONFIG_BFIN_FLASH_SIZE=0x400000
536CONFIG_EBIU_FLASH_BASE=0x20000000 532CONFIG_EBIU_FLASH_BASE=0x20000000
537
538#
539# FLASH_EBIU_AMBCTL Control
540#
541CONFIG_BFIN_FLASH_BANK_0=0x7BB0
542CONFIG_BFIN_FLASH_BANK_1=0x7BB0
543CONFIG_BFIN_FLASH_BANK_2=0x7BB0
544CONFIG_BFIN_FLASH_BANK_3=0x7BB0
545# CONFIG_MTD_UCLINUX is not set 533# CONFIG_MTD_UCLINUX is not set
546# CONFIG_MTD_PLATRAM is not set 534# CONFIG_MTD_PLATRAM is not set
547 535
@@ -660,6 +648,7 @@ CONFIG_BFIN_RX_DESC_NUM=20
660# CONFIG_DM9000 is not set 648# CONFIG_DM9000 is not set
661CONFIG_NETDEV_1000=y 649CONFIG_NETDEV_1000=y
662CONFIG_NETDEV_10000=y 650CONFIG_NETDEV_10000=y
651# CONFIG_AX88180 is not set
663 652
664# 653#
665# Wireless LAN 654# Wireless LAN
@@ -730,9 +719,9 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
730# 719#
731# CONFIG_AD9960 is not set 720# CONFIG_AD9960 is not set
732# CONFIG_SPI_ADC_BF533 is not set 721# CONFIG_SPI_ADC_BF533 is not set
733# CONFIG_BFIN_PFLAGS is not set 722# CONFIG_BF5xx_PFLAGS is not set
734# CONFIG_BF5xx_PPIFCD is not set 723# CONFIG_BF5xx_PPIFCD is not set
735# CONFIG_BF5xx_TIMERS is not set 724# CONFIG_BFIN_SIMPLE_TIMER is not set
736# CONFIG_BF5xx_PPI is not set 725# CONFIG_BF5xx_PPI is not set
737CONFIG_BFIN_SPORT=y 726CONFIG_BFIN_SPORT=y
738# CONFIG_BFIN_TIMER_LATENCY is not set 727# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -967,6 +956,7 @@ CONFIG_FB_BF537_LQ035=m
967CONFIG_LQ035_SLAVE_ADDR=0x58 956CONFIG_LQ035_SLAVE_ADDR=0x58
968# CONFIG_FB_BFIN_LANDSCAPE is not set 957# CONFIG_FB_BFIN_LANDSCAPE is not set
969# CONFIG_FB_BFIN_BGR is not set 958# CONFIG_FB_BFIN_BGR is not set
959# CONFIG_FB_BFIN_T350MCQB is not set
970# CONFIG_FB_S1D13XXX is not set 960# CONFIG_FB_S1D13XXX is not set
971# CONFIG_FB_VIRTUAL is not set 961# CONFIG_FB_VIRTUAL is not set
972# CONFIG_LOGO is not set 962# CONFIG_LOGO is not set
@@ -1021,11 +1011,6 @@ CONFIG_SND_BFIN_AD73311_SE=4
1021# CONFIG_SND_SOC is not set 1011# CONFIG_SND_SOC is not set
1022 1012
1023# 1013#
1024# SoC Audio for the ADI Blackfin
1025#
1026# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1027
1028#
1029# Open Sound System 1014# Open Sound System
1030# 1015#
1031# CONFIG_SOUND_PRIME is not set 1016# CONFIG_SOUND_PRIME is not set
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 0dd3d2253dc2..48367cc9fe35 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -1,7 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.10 3# Linux kernel version: 2.6.22.12
4# Sat Oct 27 02:34:07 2007
5# 4#
6# CONFIG_MMU is not set 5# CONFIG_MMU is not set
7# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -9,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
11CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
12CONFIG_BFIN=y
13CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
14CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
15CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -19,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
20CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
21CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_IRQCHIP_DEMUX_GPIO=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 21
25# 22#
@@ -128,6 +125,7 @@ CONFIG_PREEMPT_VOLUNTARY=y
128# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
129# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
130# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
131# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
132CONFIG_BF549=y 130CONFIG_BF549=y
133# CONFIG_BF561 is not set 131# CONFIG_BF561 is not set
@@ -141,19 +139,6 @@ CONFIG_BF_REV_0_0=y
141# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
142CONFIG_BF54x=y 140CONFIG_BF54x=y
143CONFIG_BFIN_SINGLE_CORE=y 141CONFIG_BFIN_SINGLE_CORE=y
144# CONFIG_BFIN527_EZKIT is not set
145# CONFIG_BFIN533_EZKIT is not set
146# CONFIG_BFIN533_STAMP is not set
147# CONFIG_BFIN537_STAMP is not set
148# CONFIG_BFIN533_BLUETECHNIX_CM is not set
149# CONFIG_BFIN537_BLUETECHNIX_CM is not set
150CONFIG_BFIN548_EZKIT=y
151# CONFIG_BFIN561_BLUETECHNIX_CM is not set
152# CONFIG_BFIN561_EZKIT is not set
153# CONFIG_BFIN561_TEPLA is not set
154# CONFIG_PNAV10 is not set
155# CONFIG_H8606_HVSISTEMAS is not set
156# CONFIG_GENERIC_BOARD is not set
157CONFIG_IRQ_PLL_WAKEUP=7 142CONFIG_IRQ_PLL_WAKEUP=7
158CONFIG_IRQ_RTC=8 143CONFIG_IRQ_RTC=8
159CONFIG_IRQ_SPORT0_RX=9 144CONFIG_IRQ_SPORT0_RX=9
@@ -180,6 +165,7 @@ CONFIG_IRQ_TIMER7=11
180CONFIG_IRQ_TIMER8=11 165CONFIG_IRQ_TIMER8=11
181CONFIG_IRQ_TIMER9=11 166CONFIG_IRQ_TIMER9=11
182CONFIG_IRQ_TIMER10=11 167CONFIG_IRQ_TIMER10=11
168CONFIG_BFIN548_EZKIT=y
183 169
184# 170#
185# BF548 Specific Configuration 171# BF548 Specific Configuration
@@ -279,9 +265,9 @@ CONFIG_PINT3_ASSIGN=0x02020303
279# 265#
280CONFIG_CLKIN_HZ=25000000 266CONFIG_CLKIN_HZ=25000000
281# CONFIG_BFIN_KERNEL_CLOCK is not set 267# CONFIG_BFIN_KERNEL_CLOCK is not set
282CONFIG_MAX_VCO_HZ=533333333 268CONFIG_MAX_VCO_HZ=533000000
283CONFIG_MIN_VCO_HZ=50000000 269CONFIG_MIN_VCO_HZ=50000000
284CONFIG_MAX_SCLK_HZ=133333333 270CONFIG_MAX_SCLK_HZ=133000000
285CONFIG_MIN_SCLK_HZ=27000000 271CONFIG_MIN_SCLK_HZ=27000000
286 272
287# 273#
@@ -376,6 +362,9 @@ CONFIG_BANK_0=0x7BB0
376CONFIG_BANK_1=0x5554 362CONFIG_BANK_1=0x5554
377CONFIG_BANK_2=0x7BB0 363CONFIG_BANK_2=0x7BB0
378CONFIG_BANK_3=0x99B3 364CONFIG_BANK_3=0x99B3
365CONFIG_EBUI_MBSCTLVAL=0x0
366CONFIG_EBUI_MODEVAL=0x1
367CONFIG_EBUI_FCTLVAL=0x6
379 368
380# 369#
381# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 370# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -702,6 +691,7 @@ CONFIG_SMSC911X=y
702# CONFIG_DM9000 is not set 691# CONFIG_DM9000 is not set
703CONFIG_NETDEV_1000=y 692CONFIG_NETDEV_1000=y
704CONFIG_NETDEV_10000=y 693CONFIG_NETDEV_10000=y
694# CONFIG_AX88180 is not set
705 695
706# 696#
707# Wireless LAN 697# Wireless LAN
@@ -1058,6 +1048,8 @@ CONFIG_SND_SOC=y
1058CONFIG_SND_BF5XX_SOC=y 1048CONFIG_SND_BF5XX_SOC=y
1059CONFIG_SND_BF5XX_SOC_AC97=y 1049CONFIG_SND_BF5XX_SOC_AC97=y
1060CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y 1050CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1051# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1052# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1061CONFIG_SND_BF5XX_SPORT_NUM=0 1053CONFIG_SND_BF5XX_SPORT_NUM=0
1062# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set 1054# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1063CONFIG_SND_SOC_AD1980=y 1055CONFIG_SND_SOC_AD1980=y
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 277d72dac0f9..e9f100b45eb1 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.6 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -64,7 +62,6 @@ CONFIG_FUTEX=y
64CONFIG_ANON_INODES=y 62CONFIG_ANON_INODES=y
65CONFIG_EPOLL=y 63CONFIG_EPOLL=y
66CONFIG_SIGNALFD=y 64CONFIG_SIGNALFD=y
67CONFIG_TIMERFD=y
68CONFIG_EVENTFD=y 65CONFIG_EVENTFD=y
69CONFIG_VM_EVENT_COUNTERS=y 66CONFIG_VM_EVENT_COUNTERS=y
70CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3 67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
@@ -117,6 +114,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
117# 114#
118# Processor and Board Settings 115# Processor and Board Settings
119# 116#
117# CONFIG_BF522 is not set
118# CONFIG_BF525 is not set
119# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 120# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 121# CONFIG_BF532 is not set
122# CONFIG_BF533 is not set 122# CONFIG_BF533 is not set
@@ -125,10 +125,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
125# CONFIG_BF537 is not set 125# CONFIG_BF537 is not set
126# CONFIG_BF542 is not set 126# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 127# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set
128# CONFIG_BF548 is not set 129# CONFIG_BF548 is not set
129# CONFIG_BF549 is not set 130# CONFIG_BF549 is not set
130CONFIG_BF561=y 131CONFIG_BF561=y
131# CONFIG_BF_REV_0_0 is not set 132# CONFIG_BF_REV_0_0 is not set
133# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set 134# CONFIG_BF_REV_0_2 is not set
133CONFIG_BF_REV_0_3=y 135CONFIG_BF_REV_0_3=y
134# CONFIG_BF_REV_0_4 is not set 136# CONFIG_BF_REV_0_4 is not set
@@ -136,18 +138,15 @@ CONFIG_BF_REV_0_3=y
136# CONFIG_BF_REV_ANY is not set 138# CONFIG_BF_REV_ANY is not set
137# CONFIG_BF_REV_NONE is not set 139# CONFIG_BF_REV_NONE is not set
138CONFIG_BFIN_DUAL_CORE=y 140CONFIG_BFIN_DUAL_CORE=y
139# CONFIG_BFIN533_EZKIT is not set 141CONFIG_MEM_MT48LC16M16A2TG_75=y
140# CONFIG_BFIN533_STAMP is not set 142CONFIG_IRQ_PLL_WAKEUP=7
141# CONFIG_BFIN537_STAMP is not set 143CONFIG_IRQ_SPORT0_ERROR=7
142# CONFIG_BFIN533_BLUETECHNIX_CM is not set 144CONFIG_IRQ_SPORT1_ERROR=7
143# CONFIG_BFIN537_BLUETECHNIX_CM is not set 145CONFIG_IRQ_SPI_ERROR=7
144# CONFIG_BFIN548_EZKIT is not set
145# CONFIG_BFIN561_BLUETECHNIX_CM is not set
146CONFIG_BFIN561_EZKIT=y 146CONFIG_BFIN561_EZKIT=y
147# CONFIG_BFIN561_TEPLA is not set 147# CONFIG_BFIN561_TEPLA is not set
148# CONFIG_PNAV10 is not set 148# CONFIG_BFIN561_BLUETECHNIX_CM is not set
149# CONFIG_GENERIC_BOARD is not set 149# CONFIG_GENERIC_BF561_BOARD is not set
150CONFIG_MEM_MT48LC16M16A2TG_75=y
151 150
152# 151#
153# BF561 Specific Configuration 152# BF561 Specific Configuration
@@ -170,15 +169,11 @@ CONFIG_BF561_COREB_RESET=y
170# 169#
171# Priority 170# Priority
172# 171#
173CONFIG_IRQ_PLL_WAKEUP=7
174CONFIG_IRQ_DMA1_ERROR=7 172CONFIG_IRQ_DMA1_ERROR=7
175CONFIG_IRQ_DMA2_ERROR=7 173CONFIG_IRQ_DMA2_ERROR=7
176CONFIG_IRQ_IMDMA_ERROR=7 174CONFIG_IRQ_IMDMA_ERROR=7
177CONFIG_IRQ_PPI0_ERROR=7 175CONFIG_IRQ_PPI0_ERROR=7
178CONFIG_IRQ_PPI1_ERROR=7 176CONFIG_IRQ_PPI1_ERROR=7
179CONFIG_IRQ_SPORT0_ERROR=7
180CONFIG_IRQ_SPORT1_ERROR=7
181CONFIG_IRQ_SPI_ERROR=7
182CONFIG_IRQ_UART_ERROR=7 177CONFIG_IRQ_UART_ERROR=7
183CONFIG_IRQ_RESERVED_ERROR=7 178CONFIG_IRQ_RESERVED_ERROR=7
184CONFIG_IRQ_DMA1_0=8 179CONFIG_IRQ_DMA1_0=8
@@ -243,7 +238,7 @@ CONFIG_CLKIN_HZ=30000000
243# CONFIG_BFIN_KERNEL_CLOCK is not set 238# CONFIG_BFIN_KERNEL_CLOCK is not set
244CONFIG_MAX_VCO_HZ=600000000 239CONFIG_MAX_VCO_HZ=600000000
245CONFIG_MIN_VCO_HZ=50000000 240CONFIG_MIN_VCO_HZ=50000000
246CONFIG_MAX_SCLK_HZ=133333333 241CONFIG_MAX_SCLK_HZ=133000000
247CONFIG_MIN_SCLK_HZ=27000000 242CONFIG_MIN_SCLK_HZ=27000000
248 243
249# 244#
@@ -300,6 +295,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
300# CONFIG_RESOURCES_64BIT is not set 295# CONFIG_RESOURCES_64BIT is not set
301CONFIG_ZONE_DMA_FLAG=1 296CONFIG_ZONE_DMA_FLAG=1
302CONFIG_LARGE_ALLOCS=y 297CONFIG_LARGE_ALLOCS=y
298# CONFIG_BFIN_GPTIMERS is not set
303CONFIG_BFIN_DMA_5XX=y 299CONFIG_BFIN_DMA_5XX=y
304# CONFIG_DMA_UNCACHED_2M is not set 300# CONFIG_DMA_UNCACHED_2M is not set
305CONFIG_DMA_UNCACHED_1M=y 301CONFIG_DMA_UNCACHED_1M=y
@@ -321,7 +317,7 @@ CONFIG_L1_MAX_PIECE=16
321# 317#
322 318
323# 319#
324# EBIU_AMBCTL Global Control 320# EBIU_AMGCTL Global Control
325# 321#
326CONFIG_C_AMCKEN=y 322CONFIG_C_AMCKEN=y
327CONFIG_C_CDPRIO=y 323CONFIG_C_CDPRIO=y
@@ -564,14 +560,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
564CONFIG_MTD_BF5xx=m 560CONFIG_MTD_BF5xx=m
565CONFIG_BFIN_FLASH_SIZE=0x0400000 561CONFIG_BFIN_FLASH_SIZE=0x0400000
566CONFIG_EBIU_FLASH_BASE=0x20000000 562CONFIG_EBIU_FLASH_BASE=0x20000000
567
568#
569# FLASH_EBIU_AMBCTL Control
570#
571CONFIG_BFIN_FLASH_BANK_0=0x7BB0
572CONFIG_BFIN_FLASH_BANK_1=0x7BB0
573CONFIG_BFIN_FLASH_BANK_2=0x7BB0
574CONFIG_BFIN_FLASH_BANK_3=0x7BB0
575# CONFIG_MTD_UCLINUX is not set 563# CONFIG_MTD_UCLINUX is not set
576# CONFIG_MTD_PLATRAM is not set 564# CONFIG_MTD_PLATRAM is not set
577 565
@@ -660,6 +648,7 @@ CONFIG_SMC91X=y
660# CONFIG_DM9000 is not set 648# CONFIG_DM9000 is not set
661CONFIG_NETDEV_1000=y 649CONFIG_NETDEV_1000=y
662CONFIG_NETDEV_10000=y 650CONFIG_NETDEV_10000=y
651# CONFIG_AX88180 is not set
663 652
664# 653#
665# Wireless LAN 654# Wireless LAN
@@ -721,9 +710,9 @@ CONFIG_INPUT_EVDEV=m
721# 710#
722# CONFIG_AD9960 is not set 711# CONFIG_AD9960 is not set
723# CONFIG_SPI_ADC_BF533 is not set 712# CONFIG_SPI_ADC_BF533 is not set
724# CONFIG_BFIN_PFLAGS is not set 713# CONFIG_BF5xx_PFLAGS is not set
725# CONFIG_BF5xx_PPIFCD is not set 714# CONFIG_BF5xx_PPIFCD is not set
726# CONFIG_BF5xx_TIMERS is not set 715# CONFIG_BFIN_SIMPLE_TIMER is not set
727# CONFIG_BF5xx_PPI is not set 716# CONFIG_BF5xx_PPI is not set
728# CONFIG_BFIN_SPORT is not set 717# CONFIG_BFIN_SPORT is not set
729# CONFIG_BFIN_TIMER_LATENCY is not set 718# CONFIG_BFIN_TIMER_LATENCY is not set
diff --git a/arch/blackfin/configs/H8606_defconfig b/arch/blackfin/configs/H8606_defconfig
new file mode 100644
index 000000000000..18cbb8c3c373
--- /dev/null
+++ b/arch/blackfin/configs/H8606_defconfig
@@ -0,0 +1,1160 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12
4#
5# CONFIG_MMU is not set
6# CONFIG_FPU is not set
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y
11CONFIG_SEMAPHORE_SLEEPERS=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y
16# CONFIG_GENERIC_TIME is not set
17CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21
22#
23# Code maturity level options
24#
25CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set
46# CONFIG_BLK_DEV_INITRD is not set
47# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
48CONFIG_SYSCTL=y
49CONFIG_EMBEDDED=y
50CONFIG_UID16=y
51CONFIG_SYSCTL_SYSCALL=y
52CONFIG_KALLSYMS=y
53# CONFIG_KALLSYMS_EXTRA_PASS is not set
54CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y
56CONFIG_BUG=y
57CONFIG_ELF_CORE=y
58CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y
63CONFIG_EVENTFD=y
64CONFIG_VM_EVENT_COUNTERS=y
65CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
66# CONFIG_NP2 is not set
67CONFIG_SLAB=y
68# CONFIG_SLUB is not set
69# CONFIG_SLOB is not set
70CONFIG_RT_MUTEXES=y
71CONFIG_TINY_SHMEM=y
72CONFIG_BASE_SMALL=0
73
74#
75# Loadable module support
76#
77CONFIG_MODULES=y
78CONFIG_MODULE_UNLOAD=y
79# CONFIG_MODULE_FORCE_UNLOAD is not set
80# CONFIG_MODVERSIONS is not set
81# CONFIG_MODULE_SRCVERSION_ALL is not set
82CONFIG_KMOD=y
83
84#
85# Block layer
86#
87CONFIG_BLOCK=y
88# CONFIG_LBD is not set
89# CONFIG_BLK_DEV_IO_TRACE is not set
90# CONFIG_LSF is not set
91
92#
93# IO Schedulers
94#
95CONFIG_IOSCHED_NOOP=y
96CONFIG_IOSCHED_AS=y
97# CONFIG_IOSCHED_DEADLINE is not set
98CONFIG_IOSCHED_CFQ=y
99CONFIG_DEFAULT_AS=y
100# CONFIG_DEFAULT_DEADLINE is not set
101# CONFIG_DEFAULT_CFQ is not set
102# CONFIG_DEFAULT_NOOP is not set
103CONFIG_DEFAULT_IOSCHED="anticipatory"
104CONFIG_PREEMPT_NONE=y
105# CONFIG_PREEMPT_VOLUNTARY is not set
106# CONFIG_PREEMPT is not set
107
108#
109# Blackfin Processor Options
110#
111
112#
113# Processor and Board Settings
114#
115# CONFIG_BF522 is not set
116# CONFIG_BF525 is not set
117# CONFIG_BF527 is not set
118# CONFIG_BF531 is not set
119CONFIG_BF532=y
120# CONFIG_BF533 is not set
121# CONFIG_BF534 is not set
122# CONFIG_BF536 is not set
123# CONFIG_BF537 is not set
124# CONFIG_BF542 is not set
125# CONFIG_BF544 is not set
126# CONFIG_BF547 is not set
127# CONFIG_BF548 is not set
128# CONFIG_BF549 is not set
129# CONFIG_BF561 is not set
130# CONFIG_BF_REV_0_0 is not set
131# CONFIG_BF_REV_0_1 is not set
132# CONFIG_BF_REV_0_2 is not set
133# CONFIG_BF_REV_0_3 is not set
134# CONFIG_BF_REV_0_4 is not set
135CONFIG_BF_REV_0_5=y
136# CONFIG_BF_REV_ANY is not set
137# CONFIG_BF_REV_NONE is not set
138CONFIG_BF53x=y
139CONFIG_BFIN_SINGLE_CORE=y
140CONFIG_MEM_MT48LC16M16A2TG_75=y
141# CONFIG_BFIN533_EZKIT is not set
142# CONFIG_BFIN533_STAMP is not set
143# CONFIG_BFIN533_BLUETECHNIX_CM is not set
144CONFIG_H8606_HVSISTEMAS=y
145# CONFIG_GENERIC_BF533_BOARD is not set
146
147#
148# BF533/2/1 Specific Configuration
149#
150
151#
152# Interrupt Priority Assignment
153#
154
155#
156# Priority
157#
158CONFIG_UART_ERROR=7
159CONFIG_SPORT0_ERROR=7
160CONFIG_SPI_ERROR=7
161CONFIG_SPORT1_ERROR=7
162CONFIG_PPI_ERROR=7
163CONFIG_DMA_ERROR=7
164CONFIG_PLLWAKE_ERROR=7
165CONFIG_RTC_ERROR=8
166CONFIG_DMA0_PPI=8
167CONFIG_DMA1_SPORT0RX=9
168CONFIG_DMA2_SPORT0TX=9
169CONFIG_DMA3_SPORT1RX=9
170CONFIG_DMA4_SPORT1TX=9
171CONFIG_DMA5_SPI=10
172CONFIG_DMA6_UARTRX=10
173CONFIG_DMA7_UARTTX=10
174CONFIG_TIMER0=11
175CONFIG_TIMER1=11
176CONFIG_TIMER2=11
177CONFIG_PFA=12
178CONFIG_PFB=12
179CONFIG_MEMDMA0=13
180CONFIG_MEMDMA1=13
181CONFIG_WDTIMER=13
182
183#
184# Board customizations
185#
186# CONFIG_CMDLINE_BOOL is not set
187
188#
189# Clock/PLL Setup
190#
191CONFIG_CLKIN_HZ=25000000
192# CONFIG_BFIN_KERNEL_CLOCK is not set
193CONFIG_MAX_VCO_HZ=400000000
194CONFIG_MIN_VCO_HZ=50000000
195CONFIG_MAX_SCLK_HZ=133000000
196CONFIG_MIN_SCLK_HZ=27000000
197
198#
199# Kernel Timer/Scheduler
200#
201# CONFIG_HZ_100 is not set
202CONFIG_HZ_250=y
203# CONFIG_HZ_300 is not set
204# CONFIG_HZ_1000 is not set
205CONFIG_HZ=250
206
207#
208# Memory Setup
209#
210CONFIG_MEM_SIZE=32
211CONFIG_MEM_ADD_WIDTH=9
212CONFIG_BOOT_LOAD=0x1000
213CONFIG_BFIN_SCRATCH_REG_RETN=y
214# CONFIG_BFIN_SCRATCH_REG_RETE is not set
215# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
216
217#
218# Blackfin Kernel Optimizations
219#
220
221#
222# Memory Optimizations
223#
224CONFIG_I_ENTRY_L1=y
225CONFIG_EXCPT_IRQ_SYSC_L1=y
226CONFIG_DO_IRQ_L1=y
227CONFIG_CORE_TIMER_IRQ_L1=y
228CONFIG_IDLE_L1=y
229CONFIG_SCHEDULE_L1=y
230CONFIG_ARITHMETIC_OPS_L1=y
231CONFIG_ACCESS_OK_L1=y
232CONFIG_MEMSET_L1=y
233CONFIG_MEMCPY_L1=y
234CONFIG_SYS_BFIN_SPINLOCK_L1=y
235# CONFIG_IP_CHECKSUM_L1 is not set
236# CONFIG_CACHELINE_ALIGNED_L1 is not set
237# CONFIG_SYSCALL_TAB_L1 is not set
238# CONFIG_CPLB_SWITCH_TAB_L1 is not set
239CONFIG_RAMKERNEL=y
240# CONFIG_ROMKERNEL is not set
241CONFIG_SELECT_MEMORY_MODEL=y
242CONFIG_FLATMEM_MANUAL=y
243# CONFIG_DISCONTIGMEM_MANUAL is not set
244# CONFIG_SPARSEMEM_MANUAL is not set
245CONFIG_FLATMEM=y
246CONFIG_FLAT_NODE_MEM_MAP=y
247# CONFIG_SPARSEMEM_STATIC is not set
248CONFIG_SPLIT_PTLOCK_CPUS=4
249# CONFIG_RESOURCES_64BIT is not set
250CONFIG_ZONE_DMA_FLAG=1
251CONFIG_LARGE_ALLOCS=y
252CONFIG_BFIN_GPTIMERS=y
253CONFIG_BFIN_DMA_5XX=y
254# CONFIG_DMA_UNCACHED_2M is not set
255CONFIG_DMA_UNCACHED_1M=y
256# CONFIG_DMA_UNCACHED_NONE is not set
257
258#
259# Cache Support
260#
261CONFIG_BFIN_ICACHE=y
262CONFIG_BFIN_DCACHE=y
263# CONFIG_BFIN_DCACHE_BANKA is not set
264CONFIG_BFIN_ICACHE_LOCK=y
265CONFIG_BFIN_WB=y
266# CONFIG_BFIN_WT is not set
267CONFIG_L1_MAX_PIECE=16
268
269#
270# Asynchonous Memory Configuration
271#
272
273#
274# EBIU_AMGCTL Global Control
275#
276CONFIG_C_AMCKEN=y
277CONFIG_C_CDPRIO=y
278# CONFIG_C_AMBEN is not set
279# CONFIG_C_AMBEN_B0 is not set
280# CONFIG_C_AMBEN_B0_B1 is not set
281# CONFIG_C_AMBEN_B0_B1_B2 is not set
282CONFIG_C_AMBEN_ALL=y
283
284#
285# EBIU_AMBCTL Control
286#
287CONFIG_BANK_0=0x7BB0
288CONFIG_BANK_1=0x7BB0
289CONFIG_BANK_2=0x7BB0
290CONFIG_BANK_3=0x99B3
291
292#
293# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
294#
295# CONFIG_PCI is not set
296# CONFIG_ARCH_SUPPORTS_MSI is not set
297
298#
299# PCCARD (PCMCIA/CardBus) support
300#
301# CONFIG_PCCARD is not set
302
303#
304# Executable file formats
305#
306CONFIG_BINFMT_ELF_FDPIC=y
307CONFIG_BINFMT_FLAT=y
308CONFIG_BINFMT_ZFLAT=y
309# CONFIG_BINFMT_SHARED_FLAT is not set
310# CONFIG_BINFMT_MISC is not set
311
312#
313# Power management options
314#
315CONFIG_PM=y
316CONFIG_PM_LEGACY=y
317# CONFIG_PM_DEBUG is not set
318# CONFIG_PM_SYSFS_DEPRECATED is not set
319CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
320# CONFIG_PM_WAKEUP_BY_GPIO is not set
321# CONFIG_PM_WAKEUP_GPIO_API is not set
322CONFIG_PM_WAKEUP_SIC_IWR=0x100000
323
324#
325# Networking
326#
327CONFIG_NET=y
328
329#
330# Networking options
331#
332CONFIG_PACKET=y
333# CONFIG_PACKET_MMAP is not set
334CONFIG_UNIX=y
335CONFIG_XFRM=y
336# CONFIG_XFRM_USER is not set
337# CONFIG_XFRM_SUB_POLICY is not set
338# CONFIG_XFRM_MIGRATE is not set
339# CONFIG_NET_KEY is not set
340CONFIG_INET=y
341# CONFIG_IP_MULTICAST is not set
342# CONFIG_IP_ADVANCED_ROUTER is not set
343CONFIG_IP_FIB_HASH=y
344CONFIG_IP_PNP=y
345# CONFIG_IP_PNP_DHCP is not set
346# CONFIG_IP_PNP_BOOTP is not set
347# CONFIG_IP_PNP_RARP is not set
348# CONFIG_NET_IPIP is not set
349# CONFIG_NET_IPGRE is not set
350# CONFIG_ARPD is not set
351CONFIG_SYN_COOKIES=y
352# CONFIG_INET_AH is not set
353# CONFIG_INET_ESP is not set
354# CONFIG_INET_IPCOMP is not set
355# CONFIG_INET_XFRM_TUNNEL is not set
356# CONFIG_INET_TUNNEL is not set
357CONFIG_INET_XFRM_MODE_TRANSPORT=y
358CONFIG_INET_XFRM_MODE_TUNNEL=y
359CONFIG_INET_XFRM_MODE_BEET=y
360CONFIG_INET_DIAG=y
361CONFIG_INET_TCP_DIAG=y
362# CONFIG_TCP_CONG_ADVANCED is not set
363CONFIG_TCP_CONG_CUBIC=y
364CONFIG_DEFAULT_TCP_CONG="cubic"
365# CONFIG_TCP_MD5SIG is not set
366# CONFIG_IPV6 is not set
367# CONFIG_INET6_XFRM_TUNNEL is not set
368# CONFIG_INET6_TUNNEL is not set
369# CONFIG_NETLABEL is not set
370# CONFIG_NETWORK_SECMARK is not set
371# CONFIG_NETFILTER is not set
372# CONFIG_IP_DCCP is not set
373# CONFIG_IP_SCTP is not set
374# CONFIG_TIPC is not set
375# CONFIG_ATM is not set
376# CONFIG_BRIDGE is not set
377# CONFIG_VLAN_8021Q is not set
378# CONFIG_DECNET is not set
379# CONFIG_LLC2 is not set
380# CONFIG_IPX is not set
381# CONFIG_ATALK is not set
382# CONFIG_X25 is not set
383# CONFIG_LAPB is not set
384# CONFIG_ECONET is not set
385# CONFIG_WAN_ROUTER is not set
386
387#
388# QoS and/or fair queueing
389#
390# CONFIG_NET_SCHED is not set
391
392#
393# Network testing
394#
395# CONFIG_NET_PKTGEN is not set
396# CONFIG_HAMRADIO is not set
397CONFIG_IRDA=m
398
399#
400# IrDA protocols
401#
402CONFIG_IRLAN=m
403CONFIG_IRCOMM=m
404# CONFIG_IRDA_ULTRA is not set
405
406#
407# IrDA options
408#
409CONFIG_IRDA_CACHE_LAST_LSAP=y
410# CONFIG_IRDA_FAST_RR is not set
411# CONFIG_IRDA_DEBUG is not set
412
413#
414# Infrared-port device drivers
415#
416
417#
418# SIR device drivers
419#
420CONFIG_IRTTY_SIR=m
421
422#
423# Dongle support
424#
425# CONFIG_DONGLE is not set
426
427#
428# Old SIR device drivers
429#
430# CONFIG_IRPORT_SIR is not set
431
432#
433# Old Serial dongle support
434#
435
436#
437# FIR device drivers
438#
439# CONFIG_BT is not set
440# CONFIG_AF_RXRPC is not set
441
442#
443# Wireless
444#
445# CONFIG_CFG80211 is not set
446# CONFIG_WIRELESS_EXT is not set
447# CONFIG_MAC80211 is not set
448# CONFIG_IEEE80211 is not set
449# CONFIG_RFKILL is not set
450
451#
452# Device Drivers
453#
454
455#
456# Generic Driver Options
457#
458CONFIG_STANDALONE=y
459CONFIG_PREVENT_FIRMWARE_BUILD=y
460# CONFIG_FW_LOADER is not set
461# CONFIG_SYS_HYPERVISOR is not set
462
463#
464# Connector - unified userspace <-> kernelspace linker
465#
466# CONFIG_CONNECTOR is not set
467CONFIG_MTD=y
468# CONFIG_MTD_DEBUG is not set
469# CONFIG_MTD_CONCAT is not set
470CONFIG_MTD_PARTITIONS=y
471# CONFIG_MTD_REDBOOT_PARTS is not set
472# CONFIG_MTD_CMDLINE_PARTS is not set
473
474#
475# User Modules And Translation Layers
476#
477CONFIG_MTD_CHAR=y
478CONFIG_MTD_BLKDEVS=y
479CONFIG_MTD_BLOCK=y
480# CONFIG_FTL is not set
481# CONFIG_NFTL is not set
482# CONFIG_INFTL is not set
483# CONFIG_RFD_FTL is not set
484# CONFIG_SSFDC is not set
485
486#
487# RAM/ROM/Flash chip drivers
488#
489# CONFIG_MTD_CFI is not set
490# CONFIG_MTD_JEDECPROBE is not set
491CONFIG_MTD_MAP_BANK_WIDTH_1=y
492CONFIG_MTD_MAP_BANK_WIDTH_2=y
493CONFIG_MTD_MAP_BANK_WIDTH_4=y
494# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
495# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
496# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
497CONFIG_MTD_CFI_I1=y
498CONFIG_MTD_CFI_I2=y
499# CONFIG_MTD_CFI_I4 is not set
500# CONFIG_MTD_CFI_I8 is not set
501CONFIG_MTD_RAM=y
502CONFIG_MTD_ROM=y
503# CONFIG_MTD_ABSENT is not set
504
505#
506# Mapping drivers for chip access
507#
508CONFIG_MTD_COMPLEX_MAPPINGS=y
509# CONFIG_MTD_PHYSMAP is not set
510# CONFIG_MTD_BF5xx is not set
511# CONFIG_MTD_UCLINUX is not set
512# CONFIG_MTD_PLATRAM is not set
513
514#
515# Self-contained MTD device drivers
516#
517# CONFIG_MTD_DATAFLASH is not set
518CONFIG_MTD_M25P80=y
519CONFIG_M25PXX_USE_FAST_READ=y
520# CONFIG_MTD_SLRAM is not set
521# CONFIG_MTD_PHRAM is not set
522# CONFIG_MTD_MTDRAM is not set
523# CONFIG_MTD_BLOCK2MTD is not set
524
525#
526# Disk-On-Chip Device Drivers
527#
528# CONFIG_MTD_DOC2000 is not set
529# CONFIG_MTD_DOC2001 is not set
530# CONFIG_MTD_DOC2001PLUS is not set
531# CONFIG_MTD_NAND is not set
532# CONFIG_MTD_ONENAND is not set
533
534#
535# UBI - Unsorted block images
536#
537# CONFIG_MTD_UBI is not set
538
539#
540# Parallel port support
541#
542# CONFIG_PARPORT is not set
543
544#
545# Plug and Play support
546#
547# CONFIG_PNPACPI is not set
548
549#
550# Block devices
551#
552# CONFIG_BLK_DEV_COW_COMMON is not set
553# CONFIG_BLK_DEV_LOOP is not set
554# CONFIG_BLK_DEV_NBD is not set
555CONFIG_BLK_DEV_RAM=y
556CONFIG_BLK_DEV_RAM_COUNT=16
557CONFIG_BLK_DEV_RAM_SIZE=4096
558CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
559# CONFIG_CDROM_PKTCDVD is not set
560# CONFIG_ATA_OVER_ETH is not set
561
562#
563# Misc devices
564#
565# CONFIG_IDE is not set
566
567#
568# SCSI device support
569#
570# CONFIG_RAID_ATTRS is not set
571# CONFIG_SCSI is not set
572# CONFIG_SCSI_NETLINK is not set
573# CONFIG_ATA is not set
574
575#
576# Multi-device support (RAID and LVM)
577#
578# CONFIG_MD is not set
579
580#
581# Network device support
582#
583CONFIG_NETDEVICES=y
584# CONFIG_DUMMY is not set
585# CONFIG_BONDING is not set
586# CONFIG_EQUALIZER is not set
587# CONFIG_TUN is not set
588# CONFIG_PHYLIB is not set
589
590#
591# Ethernet (10 or 100Mbit)
592#
593CONFIG_NET_ETHERNET=y
594CONFIG_MII=y
595# CONFIG_SMC91X is not set
596# CONFIG_SMSC911X is not set
597CONFIG_DM9000=y
598CONFIG_NETDEV_1000=y
599CONFIG_NETDEV_10000=y
600# CONFIG_AX88180 is not set
601
602#
603# Wireless LAN
604#
605# CONFIG_WLAN_PRE80211 is not set
606# CONFIG_WLAN_80211 is not set
607# CONFIG_WAN is not set
608# CONFIG_PPP is not set
609# CONFIG_SLIP is not set
610# CONFIG_SHAPER is not set
611# CONFIG_NETCONSOLE is not set
612# CONFIG_NETPOLL is not set
613# CONFIG_NET_POLL_CONTROLLER is not set
614
615#
616# ISDN subsystem
617#
618# CONFIG_ISDN is not set
619
620#
621# Telephony Support
622#
623# CONFIG_PHONE is not set
624
625#
626# Input device support
627#
628CONFIG_INPUT=y
629# CONFIG_INPUT_FF_MEMLESS is not set
630# CONFIG_INPUT_POLLDEV is not set
631
632#
633# Userland interfaces
634#
635# CONFIG_INPUT_MOUSEDEV is not set
636# CONFIG_INPUT_JOYDEV is not set
637# CONFIG_INPUT_TSDEV is not set
638CONFIG_INPUT_EVDEV=m
639# CONFIG_INPUT_EVBUG is not set
640
641#
642# Input Device Drivers
643#
644# CONFIG_INPUT_KEYBOARD is not set
645# CONFIG_INPUT_MOUSE is not set
646# CONFIG_INPUT_JOYSTICK is not set
647# CONFIG_INPUT_TABLET is not set
648# CONFIG_INPUT_TOUCHSCREEN is not set
649CONFIG_INPUT_MISC=y
650# CONFIG_INPUT_ATI_REMOTE is not set
651# CONFIG_INPUT_ATI_REMOTE2 is not set
652# CONFIG_INPUT_KEYSPAN_REMOTE is not set
653# CONFIG_INPUT_POWERMATE is not set
654# CONFIG_INPUT_YEALINK is not set
655# CONFIG_INPUT_UINPUT is not set
656# CONFIG_BF53X_PFBUTTONS is not set
657
658#
659# Hardware I/O ports
660#
661# CONFIG_SERIO is not set
662# CONFIG_GAMEPORT is not set
663
664#
665# Character devices
666#
667# CONFIG_AD9960 is not set
668# CONFIG_SPI_ADC_BF533 is not set
669CONFIG_BF5xx_PFLAGS=y
670# CONFIG_BF5xx_PFLAGS_PROC is not set
671# CONFIG_BF5xx_PPIFCD is not set
672CONFIG_BFIN_SIMPLE_TIMER=y
673# CONFIG_BF5xx_PPI is not set
674CONFIG_BFIN_SPORT=y
675CONFIG_BFIN_TIMER_LATENCY=y
676# CONFIG_AD5304 is not set
677# CONFIG_BF5xx_FBDMA is not set
678# CONFIG_VT is not set
679# CONFIG_SERIAL_NONSTANDARD is not set
680
681#
682# Serial drivers
683#
684# CONFIG_SERIAL_8250 is not set
685
686#
687# Non-8250 serial port support
688#
689CONFIG_SERIAL_BFIN=y
690CONFIG_SERIAL_BFIN_CONSOLE=y
691CONFIG_SERIAL_BFIN_DMA=y
692# CONFIG_SERIAL_BFIN_PIO is not set
693CONFIG_SERIAL_BFIN_UART0=y
694# CONFIG_BFIN_UART0_CTSRTS is not set
695# CONFIG_SERIAL_BFIN_UART1 is not set
696CONFIG_SERIAL_CORE=y
697CONFIG_SERIAL_CORE_CONSOLE=y
698# CONFIG_SERIAL_BFIN_SPORT is not set
699CONFIG_UNIX98_PTYS=y
700# CONFIG_LEGACY_PTYS is not set
701
702#
703# CAN, the car bus and industrial fieldbus
704#
705# CONFIG_CAN4LINUX is not set
706
707#
708# IPMI
709#
710# CONFIG_IPMI_HANDLER is not set
711CONFIG_WATCHDOG=y
712# CONFIG_WATCHDOG_NOWAYOUT is not set
713
714#
715# Watchdog Device Drivers
716#
717# CONFIG_SOFT_WATCHDOG is not set
718# CONFIG_BFIN_WDT is not set
719# CONFIG_HW_RANDOM is not set
720# CONFIG_GEN_RTC is not set
721CONFIG_BLACKFIN_DPMC=y
722# CONFIG_R3964 is not set
723# CONFIG_RAW_DRIVER is not set
724
725#
726# TPM devices
727#
728# CONFIG_TCG_TPM is not set
729# CONFIG_I2C is not set
730
731#
732# SPI support
733#
734CONFIG_SPI=y
735CONFIG_SPI_MASTER=y
736
737#
738# SPI Master Controller Drivers
739#
740CONFIG_SPI_BFIN=y
741# CONFIG_SPI_BITBANG is not set
742
743#
744# SPI Protocol Masters
745#
746CONFIG_SPI_AT25=y
747CONFIG_SPI_SPIDEV=y
748
749#
750# Dallas's 1-wire bus
751#
752# CONFIG_W1 is not set
753CONFIG_HWMON=y
754# CONFIG_HWMON_VID is not set
755# CONFIG_SENSORS_ABITUGURU is not set
756# CONFIG_SENSORS_F71805F is not set
757# CONFIG_SENSORS_LM70 is not set
758# CONFIG_SENSORS_PC87427 is not set
759# CONFIG_SENSORS_SMSC47M1 is not set
760# CONFIG_SENSORS_SMSC47B397 is not set
761# CONFIG_SENSORS_VT1211 is not set
762# CONFIG_SENSORS_W83627HF is not set
763# CONFIG_HWMON_DEBUG_CHIP is not set
764
765#
766# Multifunction device drivers
767#
768# CONFIG_MFD_SM501 is not set
769
770#
771# Multimedia devices
772#
773# CONFIG_VIDEO_DEV is not set
774# CONFIG_DVB_CORE is not set
775CONFIG_DAB=y
776
777#
778# Graphics support
779#
780# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
781
782#
783# Display device support
784#
785# CONFIG_DISPLAY_SUPPORT is not set
786# CONFIG_VGASTATE is not set
787# CONFIG_FB is not set
788
789#
790# Sound
791#
792CONFIG_SOUND=m
793
794#
795# Advanced Linux Sound Architecture
796#
797CONFIG_SND=m
798CONFIG_SND_TIMER=m
799CONFIG_SND_PCM=m
800# CONFIG_SND_SEQUENCER is not set
801CONFIG_SND_OSSEMUL=y
802CONFIG_SND_MIXER_OSS=m
803CONFIG_SND_PCM_OSS=m
804CONFIG_SND_PCM_OSS_PLUGINS=y
805# CONFIG_SND_DYNAMIC_MINORS is not set
806CONFIG_SND_SUPPORT_OLD_API=y
807CONFIG_SND_VERBOSE_PROCFS=y
808# CONFIG_SND_VERBOSE_PRINTK is not set
809# CONFIG_SND_DEBUG is not set
810
811#
812# Generic devices
813#
814# CONFIG_SND_DUMMY is not set
815# CONFIG_SND_MTPAV is not set
816# CONFIG_SND_SERIAL_U16550 is not set
817# CONFIG_SND_MPU401 is not set
818
819#
820# ALSA Blackfin devices
821#
822CONFIG_SND_BLACKFIN_AD1836=m
823CONFIG_SND_BLACKFIN_AD1836_TDM=y
824# CONFIG_SND_BLACKFIN_AD1836_I2S is not set
825CONFIG_SND_BLACKFIN_AD1836_MULSUB=y
826# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
827CONFIG_SND_BLACKFIN_SPORT=0
828CONFIG_SND_BLACKFIN_SPI_PFBIT=4
829# CONFIG_SND_BFIN_AD73311 is not set
830
831#
832# System on Chip audio support
833#
834# CONFIG_SND_SOC is not set
835
836#
837# Open Sound System
838#
839# CONFIG_SOUND_PRIME is not set
840
841#
842# HID Devices
843#
844CONFIG_HID=y
845# CONFIG_HID_DEBUG is not set
846
847#
848# USB support
849#
850CONFIG_USB_ARCH_HAS_HCD=y
851# CONFIG_USB_ARCH_HAS_OHCI is not set
852# CONFIG_USB_ARCH_HAS_EHCI is not set
853# CONFIG_USB is not set
854
855#
856# Enable Host or Gadget support to see Inventra options
857#
858
859#
860# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
861#
862
863#
864# USB Gadget Support
865#
866# CONFIG_USB_GADGET is not set
867# CONFIG_MMC is not set
868
869#
870# LED devices
871#
872# CONFIG_NEW_LEDS is not set
873
874#
875# LED drivers
876#
877
878#
879# LED Triggers
880#
881
882#
883# InfiniBand support
884#
885
886#
887# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
888#
889
890#
891# Real Time Clock
892#
893CONFIG_RTC_LIB=y
894CONFIG_RTC_CLASS=y
895CONFIG_RTC_HCTOSYS=y
896CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
897# CONFIG_RTC_DEBUG is not set
898
899#
900# RTC interfaces
901#
902CONFIG_RTC_INTF_SYSFS=y
903CONFIG_RTC_INTF_PROC=y
904CONFIG_RTC_INTF_DEV=y
905CONFIG_RTC_INTF_DEV_UIE_EMUL=y
906# CONFIG_RTC_DRV_TEST is not set
907
908#
909# I2C RTC drivers
910#
911
912#
913# SPI RTC drivers
914#
915# CONFIG_RTC_DRV_RS5C348 is not set
916# CONFIG_RTC_DRV_MAX6902 is not set
917
918#
919# Platform RTC drivers
920#
921# CONFIG_RTC_DRV_DS1553 is not set
922# CONFIG_RTC_DRV_DS1742 is not set
923# CONFIG_RTC_DRV_M48T86 is not set
924# CONFIG_RTC_DRV_V3020 is not set
925
926#
927# on-CPU RTC drivers
928#
929CONFIG_RTC_DRV_BFIN=y
930
931#
932# DMA Engine support
933#
934# CONFIG_DMA_ENGINE is not set
935
936#
937# DMA Clients
938#
939
940#
941# DMA Devices
942#
943
944#
945# PBX support
946#
947# CONFIG_PBX is not set
948
949#
950# File systems
951#
952CONFIG_EXT2_FS=y
953CONFIG_EXT2_FS_XATTR=y
954# CONFIG_EXT2_FS_POSIX_ACL is not set
955# CONFIG_EXT2_FS_SECURITY is not set
956# CONFIG_EXT3_FS is not set
957# CONFIG_EXT4DEV_FS is not set
958CONFIG_FS_MBCACHE=y
959# CONFIG_REISERFS_FS is not set
960# CONFIG_JFS_FS is not set
961# CONFIG_FS_POSIX_ACL is not set
962# CONFIG_XFS_FS is not set
963# CONFIG_GFS2_FS is not set
964# CONFIG_OCFS2_FS is not set
965# CONFIG_MINIX_FS is not set
966# CONFIG_ROMFS_FS is not set
967CONFIG_INOTIFY=y
968CONFIG_INOTIFY_USER=y
969# CONFIG_QUOTA is not set
970CONFIG_DNOTIFY=y
971# CONFIG_AUTOFS_FS is not set
972# CONFIG_AUTOFS4_FS is not set
973# CONFIG_FUSE_FS is not set
974
975#
976# CD-ROM/DVD Filesystems
977#
978# CONFIG_ISO9660_FS is not set
979# CONFIG_UDF_FS is not set
980
981#
982# DOS/FAT/NT Filesystems
983#
984# CONFIG_MSDOS_FS is not set
985# CONFIG_VFAT_FS is not set
986# CONFIG_NTFS_FS is not set
987
988#
989# Pseudo filesystems
990#
991CONFIG_PROC_FS=y
992CONFIG_PROC_SYSCTL=y
993CONFIG_SYSFS=y
994# CONFIG_TMPFS is not set
995# CONFIG_HUGETLB_PAGE is not set
996CONFIG_RAMFS=y
997# CONFIG_CONFIGFS_FS is not set
998
999#
1000# Miscellaneous filesystems
1001#
1002# CONFIG_ADFS_FS is not set
1003# CONFIG_AFFS_FS is not set
1004# CONFIG_HFS_FS is not set
1005# CONFIG_HFSPLUS_FS is not set
1006# CONFIG_BEFS_FS is not set
1007# CONFIG_BFS_FS is not set
1008# CONFIG_EFS_FS is not set
1009# CONFIG_YAFFS_FS is not set
1010CONFIG_JFFS2_FS=y
1011CONFIG_JFFS2_FS_DEBUG=0
1012CONFIG_JFFS2_FS_WRITEBUFFER=y
1013# CONFIG_JFFS2_SUMMARY is not set
1014# CONFIG_JFFS2_FS_XATTR is not set
1015# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1016CONFIG_JFFS2_ZLIB=y
1017CONFIG_JFFS2_RTIME=y
1018# CONFIG_JFFS2_RUBIN is not set
1019# CONFIG_CRAMFS is not set
1020# CONFIG_VXFS_FS is not set
1021# CONFIG_HPFS_FS is not set
1022# CONFIG_QNX4FS_FS is not set
1023# CONFIG_SYSV_FS is not set
1024# CONFIG_UFS_FS is not set
1025
1026#
1027# Network File Systems
1028#
1029CONFIG_NFS_FS=m
1030CONFIG_NFS_V3=y
1031# CONFIG_NFS_V3_ACL is not set
1032# CONFIG_NFS_V4 is not set
1033# CONFIG_NFS_DIRECTIO is not set
1034# CONFIG_NFSD is not set
1035CONFIG_LOCKD=m
1036CONFIG_LOCKD_V4=y
1037CONFIG_NFS_COMMON=y
1038CONFIG_SUNRPC=m
1039# CONFIG_SUNRPC_BIND34 is not set
1040# CONFIG_RPCSEC_GSS_KRB5 is not set
1041# CONFIG_RPCSEC_GSS_SPKM3 is not set
1042# CONFIG_SMB_FS is not set
1043# CONFIG_CIFS is not set
1044# CONFIG_NCP_FS is not set
1045# CONFIG_CODA_FS is not set
1046# CONFIG_AFS_FS is not set
1047# CONFIG_9P_FS is not set
1048
1049#
1050# Partition Types
1051#
1052# CONFIG_PARTITION_ADVANCED is not set
1053CONFIG_MSDOS_PARTITION=y
1054
1055#
1056# Native Language Support
1057#
1058CONFIG_NLS=m
1059CONFIG_NLS_DEFAULT="iso8859-1"
1060# CONFIG_NLS_CODEPAGE_437 is not set
1061# CONFIG_NLS_CODEPAGE_737 is not set
1062# CONFIG_NLS_CODEPAGE_775 is not set
1063# CONFIG_NLS_CODEPAGE_850 is not set
1064# CONFIG_NLS_CODEPAGE_852 is not set
1065# CONFIG_NLS_CODEPAGE_855 is not set
1066# CONFIG_NLS_CODEPAGE_857 is not set
1067# CONFIG_NLS_CODEPAGE_860 is not set
1068# CONFIG_NLS_CODEPAGE_861 is not set
1069# CONFIG_NLS_CODEPAGE_862 is not set
1070# CONFIG_NLS_CODEPAGE_863 is not set
1071# CONFIG_NLS_CODEPAGE_864 is not set
1072# CONFIG_NLS_CODEPAGE_865 is not set
1073# CONFIG_NLS_CODEPAGE_866 is not set
1074# CONFIG_NLS_CODEPAGE_869 is not set
1075# CONFIG_NLS_CODEPAGE_936 is not set
1076# CONFIG_NLS_CODEPAGE_950 is not set
1077# CONFIG_NLS_CODEPAGE_932 is not set
1078# CONFIG_NLS_CODEPAGE_949 is not set
1079# CONFIG_NLS_CODEPAGE_874 is not set
1080# CONFIG_NLS_ISO8859_8 is not set
1081# CONFIG_NLS_CODEPAGE_1250 is not set
1082# CONFIG_NLS_CODEPAGE_1251 is not set
1083# CONFIG_NLS_ASCII is not set
1084# CONFIG_NLS_ISO8859_1 is not set
1085# CONFIG_NLS_ISO8859_2 is not set
1086# CONFIG_NLS_ISO8859_3 is not set
1087# CONFIG_NLS_ISO8859_4 is not set
1088# CONFIG_NLS_ISO8859_5 is not set
1089# CONFIG_NLS_ISO8859_6 is not set
1090# CONFIG_NLS_ISO8859_7 is not set
1091# CONFIG_NLS_ISO8859_9 is not set
1092# CONFIG_NLS_ISO8859_13 is not set
1093# CONFIG_NLS_ISO8859_14 is not set
1094# CONFIG_NLS_ISO8859_15 is not set
1095# CONFIG_NLS_KOI8_R is not set
1096# CONFIG_NLS_KOI8_U is not set
1097# CONFIG_NLS_UTF8 is not set
1098
1099#
1100# Distributed Lock Manager
1101#
1102# CONFIG_DLM is not set
1103
1104#
1105# Profiling support
1106#
1107# CONFIG_PROFILING is not set
1108
1109#
1110# Kernel hacking
1111#
1112# CONFIG_PRINTK_TIME is not set
1113CONFIG_ENABLE_MUST_CHECK=y
1114# CONFIG_MAGIC_SYSRQ is not set
1115# CONFIG_UNUSED_SYMBOLS is not set
1116# CONFIG_DEBUG_FS is not set
1117# CONFIG_HEADERS_CHECK is not set
1118# CONFIG_DEBUG_KERNEL is not set
1119# CONFIG_DEBUG_BUGVERBOSE is not set
1120# CONFIG_DEBUG_MMRS is not set
1121CONFIG_DEBUG_HUNT_FOR_ZERO=y
1122CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1123CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
1124# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
1125# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_TWO is not set
1126CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1127# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
1128# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1129# CONFIG_EARLY_PRINTK is not set
1130CONFIG_CPLB_INFO=y
1131CONFIG_ACCESS_CHECK=y
1132
1133#
1134# Security options
1135#
1136# CONFIG_KEYS is not set
1137CONFIG_SECURITY=y
1138# CONFIG_SECURITY_NETWORK is not set
1139CONFIG_SECURITY_CAPABILITIES=y
1140
1141#
1142# Cryptographic options
1143#
1144# CONFIG_CRYPTO is not set
1145
1146#
1147# Library routines
1148#
1149CONFIG_BITREVERSE=y
1150CONFIG_CRC_CCITT=m
1151# CONFIG_CRC16 is not set
1152# CONFIG_CRC_ITU_T is not set
1153CONFIG_CRC32=y
1154# CONFIG_LIBCRC32C is not set
1155CONFIG_ZLIB_INFLATE=y
1156CONFIG_ZLIB_DEFLATE=y
1157CONFIG_PLIST=y
1158CONFIG_HAS_IOMEM=y
1159CONFIG_HAS_IOPORT=y
1160CONFIG_HAS_DMA=y
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index 3d403e0b82c2..25709f504d8f 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.6 3# Linux kernel version: 2.6.22.12
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -8,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set 8# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
9CONFIG_BLACKFIN=y 9CONFIG_BLACKFIN=y
10CONFIG_ZONE_DMA=y 10CONFIG_ZONE_DMA=y
11CONFIG_BFIN=y
12CONFIG_SEMAPHORE_SLEEPERS=y 11CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y 12CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
@@ -18,7 +17,6 @@ CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_GPIO=y 17CONFIG_GENERIC_GPIO=y
19CONFIG_FORCE_MAX_ZONEORDER=14 18CONFIG_FORCE_MAX_ZONEORDER=14
20CONFIG_GENERIC_CALIBRATE_DELAY=y 19CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_IRQCHIP_DEMUX_GPIO=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 21
24# 22#
@@ -62,7 +60,6 @@ CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y 60CONFIG_ANON_INODES=y
63CONFIG_EPOLL=y 61CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 62CONFIG_SIGNALFD=y
65CONFIG_TIMERFD=y
66CONFIG_EVENTFD=y 63CONFIG_EVENTFD=y
67CONFIG_VM_EVENT_COUNTERS=y 64CONFIG_VM_EVENT_COUNTERS=y
68CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9 65CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=9
@@ -115,6 +112,9 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# 112#
116# Processor and Board Settings 113# Processor and Board Settings
117# 114#
115# CONFIG_BF522 is not set
116# CONFIG_BF525 is not set
117# CONFIG_BF527 is not set
118# CONFIG_BF531 is not set 118# CONFIG_BF531 is not set
119# CONFIG_BF532 is not set 119# CONFIG_BF532 is not set
120# CONFIG_BF533 is not set 120# CONFIG_BF533 is not set
@@ -123,10 +123,12 @@ CONFIG_PREEMPT_VOLUNTARY=y
123CONFIG_BF537=y 123CONFIG_BF537=y
124# CONFIG_BF542 is not set 124# CONFIG_BF542 is not set
125# CONFIG_BF544 is not set 125# CONFIG_BF544 is not set
126# CONFIG_BF547 is not set
126# CONFIG_BF548 is not set 127# CONFIG_BF548 is not set
127# CONFIG_BF549 is not set 128# CONFIG_BF549 is not set
128# CONFIG_BF561 is not set 129# CONFIG_BF561 is not set
129# CONFIG_BF_REV_0_0 is not set 130# CONFIG_BF_REV_0_0 is not set
131# CONFIG_BF_REV_0_1 is not set
130CONFIG_BF_REV_0_2=y 132CONFIG_BF_REV_0_2=y
131# CONFIG_BF_REV_0_3 is not set 133# CONFIG_BF_REV_0_3 is not set
132# CONFIG_BF_REV_0_4 is not set 134# CONFIG_BF_REV_0_4 is not set
@@ -135,33 +137,8 @@ CONFIG_BF_REV_0_2=y
135# CONFIG_BF_REV_NONE is not set 137# CONFIG_BF_REV_NONE is not set
136CONFIG_BF53x=y 138CONFIG_BF53x=y
137CONFIG_BFIN_SINGLE_CORE=y 139CONFIG_BFIN_SINGLE_CORE=y
138# CONFIG_BFIN533_EZKIT is not set
139# CONFIG_BFIN533_STAMP is not set
140# CONFIG_BFIN537_STAMP is not set
141# CONFIG_BFIN533_BLUETECHNIX_CM is not set
142# CONFIG_BFIN537_BLUETECHNIX_CM is not set
143# CONFIG_BFIN548_EZKIT is not set
144# CONFIG_BFIN561_BLUETECHNIX_CM is not set
145# CONFIG_BFIN561_EZKIT is not set
146# CONFIG_BFIN561_TEPLA is not set
147CONFIG_PNAV10=y
148# CONFIG_GENERIC_BOARD is not set
149CONFIG_MEM_MT48LC32M8A2_75=y 140CONFIG_MEM_MT48LC32M8A2_75=y
150CONFIG_IRQ_PLL_WAKEUP=7 141CONFIG_IRQ_PLL_WAKEUP=7
151
152#
153# BF537 Specific Configuration
154#
155
156#
157# Interrupt Priority Assignment
158#
159
160#
161# Priority
162#
163CONFIG_IRQ_DMA_ERROR=7
164CONFIG_IRQ_ERROR=7
165CONFIG_IRQ_RTC=8 142CONFIG_IRQ_RTC=8
166CONFIG_IRQ_PPI=8 143CONFIG_IRQ_PPI=8
167CONFIG_IRQ_SPORT0_RX=9 144CONFIG_IRQ_SPORT0_RX=9
@@ -174,8 +151,6 @@ CONFIG_IRQ_UART0_RX=10
174CONFIG_IRQ_UART0_TX=10 151CONFIG_IRQ_UART0_TX=10
175CONFIG_IRQ_UART1_RX=10 152CONFIG_IRQ_UART1_RX=10
176CONFIG_IRQ_UART1_TX=10 153CONFIG_IRQ_UART1_TX=10
177CONFIG_IRQ_CAN_RX=11
178CONFIG_IRQ_CAN_TX=11
179CONFIG_IRQ_MAC_RX=11 154CONFIG_IRQ_MAC_RX=11
180CONFIG_IRQ_MAC_TX=11 155CONFIG_IRQ_MAC_TX=11
181CONFIG_IRQ_TMR0=12 156CONFIG_IRQ_TMR0=12
@@ -186,11 +161,31 @@ CONFIG_IRQ_TMR4=12
186CONFIG_IRQ_TMR5=12 161CONFIG_IRQ_TMR5=12
187CONFIG_IRQ_TMR6=12 162CONFIG_IRQ_TMR6=12
188CONFIG_IRQ_TMR7=12 163CONFIG_IRQ_TMR7=12
189CONFIG_IRQ_PROG_INTA=12
190CONFIG_IRQ_PORTG_INTB=12 164CONFIG_IRQ_PORTG_INTB=12
191CONFIG_IRQ_MEM_DMA0=13 165CONFIG_IRQ_MEM_DMA0=13
192CONFIG_IRQ_MEM_DMA1=13 166CONFIG_IRQ_MEM_DMA1=13
193CONFIG_IRQ_WATCH=13 167CONFIG_IRQ_WATCH=13
168# CONFIG_BFIN537_STAMP is not set
169# CONFIG_BFIN537_BLUETECHNIX_CM is not set
170CONFIG_PNAV10=y
171# CONFIG_GENERIC_BF537_BOARD is not set
172
173#
174# BF537 Specific Configuration
175#
176
177#
178# Interrupt Priority Assignment
179#
180
181#
182# Priority
183#
184CONFIG_IRQ_DMA_ERROR=7
185CONFIG_IRQ_ERROR=7
186CONFIG_IRQ_CAN_RX=11
187CONFIG_IRQ_CAN_TX=11
188CONFIG_IRQ_PROG_INTA=12
194 189
195# 190#
196# Board customizations 191# Board customizations
@@ -204,7 +199,7 @@ CONFIG_CLKIN_HZ=24576000
204# CONFIG_BFIN_KERNEL_CLOCK is not set 199# CONFIG_BFIN_KERNEL_CLOCK is not set
205CONFIG_MAX_VCO_HZ=600000000 200CONFIG_MAX_VCO_HZ=600000000
206CONFIG_MIN_VCO_HZ=50000000 201CONFIG_MIN_VCO_HZ=50000000
207CONFIG_MAX_SCLK_HZ=133333333 202CONFIG_MAX_SCLK_HZ=133000000
208CONFIG_MIN_SCLK_HZ=27000000 203CONFIG_MIN_SCLK_HZ=27000000
209 204
210# 205#
@@ -261,6 +256,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
261# CONFIG_RESOURCES_64BIT is not set 256# CONFIG_RESOURCES_64BIT is not set
262CONFIG_ZONE_DMA_FLAG=1 257CONFIG_ZONE_DMA_FLAG=1
263CONFIG_LARGE_ALLOCS=y 258CONFIG_LARGE_ALLOCS=y
259# CONFIG_BFIN_GPTIMERS is not set
264CONFIG_BFIN_DMA_5XX=y 260CONFIG_BFIN_DMA_5XX=y
265# CONFIG_DMA_UNCACHED_2M is not set 261# CONFIG_DMA_UNCACHED_2M is not set
266CONFIG_DMA_UNCACHED_1M=y 262CONFIG_DMA_UNCACHED_1M=y
@@ -282,7 +278,7 @@ CONFIG_L1_MAX_PIECE=16
282# 278#
283 279
284# 280#
285# EBIU_AMBCTL Global Control 281# EBIU_AMGCTL Global Control
286# 282#
287CONFIG_C_AMCKEN=y 283CONFIG_C_AMCKEN=y
288CONFIG_C_CDPRIO=y 284CONFIG_C_CDPRIO=y
@@ -593,6 +589,7 @@ CONFIG_BFIN_MAC_RMII=y
593# CONFIG_DM9000 is not set 589# CONFIG_DM9000 is not set
594CONFIG_NETDEV_1000=y 590CONFIG_NETDEV_1000=y
595CONFIG_NETDEV_10000=y 591CONFIG_NETDEV_10000=y
592# CONFIG_AX88180 is not set
596 593
597# 594#
598# Wireless LAN 595# Wireless LAN
@@ -675,9 +672,9 @@ CONFIG_INPUT_UINPUT=y
675# 672#
676# CONFIG_AD9960 is not set 673# CONFIG_AD9960 is not set
677# CONFIG_SPI_ADC_BF533 is not set 674# CONFIG_SPI_ADC_BF533 is not set
678# CONFIG_BFIN_PFLAGS is not set 675# CONFIG_BF5xx_PFLAGS is not set
679# CONFIG_BF5xx_PPIFCD is not set 676# CONFIG_BF5xx_PPIFCD is not set
680# CONFIG_BF5xx_TIMERS is not set 677# CONFIG_BFIN_SIMPLE_TIMER is not set
681# CONFIG_BF5xx_PPI is not set 678# CONFIG_BF5xx_PPI is not set
682CONFIG_BFIN_SPORT=y 679CONFIG_BFIN_SPORT=y
683# CONFIG_BFIN_TIMER_LATENCY is not set 680# CONFIG_BFIN_TIMER_LATENCY is not set
@@ -897,6 +894,7 @@ CONFIG_FB_BF537_LQ035=y
897CONFIG_LQ035_SLAVE_ADDR=0x58 894CONFIG_LQ035_SLAVE_ADDR=0x58
898CONFIG_FB_BFIN_LANDSCAPE=y 895CONFIG_FB_BFIN_LANDSCAPE=y
899# CONFIG_FB_BFIN_BGR is not set 896# CONFIG_FB_BFIN_BGR is not set
897# CONFIG_FB_BFIN_T350MCQB is not set
900# CONFIG_FB_S1D13XXX is not set 898# CONFIG_FB_S1D13XXX is not set
901# CONFIG_FB_VIRTUAL is not set 899# CONFIG_FB_VIRTUAL is not set
902# CONFIG_LOGO is not set 900# CONFIG_LOGO is not set
@@ -939,11 +937,6 @@ CONFIG_SND=m
939# CONFIG_SND_SOC is not set 937# CONFIG_SND_SOC is not set
940 938
941# 939#
942# SoC Audio for the ADI Blackfin
943#
944# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
945
946#
947# Open Sound System 940# Open Sound System
948# 941#
949CONFIG_SOUND_PRIME=y 942CONFIG_SOUND_PRIME=y
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 503eef4c7fec..b54446055a43 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -436,6 +436,7 @@ unsigned long get_dma_curr_desc_ptr(unsigned int channel)
436 436
437 return dma_ch[channel].regs->curr_desc_ptr; 437 return dma_ch[channel].regs->curr_desc_ptr;
438} 438}
439EXPORT_SYMBOL(get_dma_curr_desc_ptr);
439 440
440unsigned long get_dma_curr_addr(unsigned int channel) 441unsigned long get_dma_curr_addr(unsigned int channel)
441{ 442{
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c
index 2198afe40f33..0bfbb269e350 100644
--- a/arch/blackfin/kernel/bfin_ksyms.c
+++ b/arch/blackfin/kernel/bfin_ksyms.c
@@ -37,9 +37,6 @@
37/* platform dependent support */ 37/* platform dependent support */
38 38
39EXPORT_SYMBOL(__ioremap); 39EXPORT_SYMBOL(__ioremap);
40EXPORT_SYMBOL(strcmp);
41EXPORT_SYMBOL(strncmp);
42EXPORT_SYMBOL(dump_thread);
43 40
44EXPORT_SYMBOL(ip_fast_csum); 41EXPORT_SYMBOL(ip_fast_csum);
45 42
@@ -51,6 +48,7 @@ EXPORT_SYMBOL(__down_trylock);
51EXPORT_SYMBOL(__down_interruptible); 48EXPORT_SYMBOL(__down_interruptible);
52 49
53EXPORT_SYMBOL(is_in_rom); 50EXPORT_SYMBOL(is_in_rom);
51EXPORT_SYMBOL(bfin_return_from_exception);
54 52
55/* Networking helper routines. */ 53/* Networking helper routines. */
56EXPORT_SYMBOL(csum_partial_copy); 54EXPORT_SYMBOL(csum_partial_copy);
@@ -60,13 +58,11 @@ EXPORT_SYMBOL(csum_partial_copy);
60 * their interface isn't gonna change any time soon now, so 58 * their interface isn't gonna change any time soon now, so
61 * it's OK to leave it out of version control. 59 * it's OK to leave it out of version control.
62 */ 60 */
63EXPORT_SYMBOL(strcpy);
64EXPORT_SYMBOL(memcpy); 61EXPORT_SYMBOL(memcpy);
65EXPORT_SYMBOL(memset); 62EXPORT_SYMBOL(memset);
66EXPORT_SYMBOL(memcmp); 63EXPORT_SYMBOL(memcmp);
67EXPORT_SYMBOL(memmove); 64EXPORT_SYMBOL(memmove);
68EXPORT_SYMBOL(memchr); 65EXPORT_SYMBOL(memchr);
69EXPORT_SYMBOL(get_wchan);
70 66
71/* 67/*
72 * libgcc functions - functions that are used internally by the 68 * libgcc functions - functions that are used internally by the
@@ -102,6 +98,7 @@ EXPORT_SYMBOL(outsw);
102EXPORT_SYMBOL(insw); 98EXPORT_SYMBOL(insw);
103EXPORT_SYMBOL(outsl); 99EXPORT_SYMBOL(outsl);
104EXPORT_SYMBOL(insl); 100EXPORT_SYMBOL(insl);
101EXPORT_SYMBOL(insl_16);
105EXPORT_SYMBOL(irq_flags); 102EXPORT_SYMBOL(irq_flags);
106EXPORT_SYMBOL(iounmap); 103EXPORT_SYMBOL(iounmap);
107EXPORT_SYMBOL(blackfin_dcache_invalidate_range); 104EXPORT_SYMBOL(blackfin_dcache_invalidate_range);
diff --git a/arch/blackfin/kernel/cplbinit.c b/arch/blackfin/kernel/cplbinit.c
index f2db6a5e2b5b..6320bc45fbba 100644
--- a/arch/blackfin/kernel/cplbinit.c
+++ b/arch/blackfin/kernel/cplbinit.c
@@ -26,29 +26,22 @@
26#include <asm/cplb.h> 26#include <asm/cplb.h>
27#include <asm/cplbinit.h> 27#include <asm/cplbinit.h>
28 28
29u_long icplb_table[MAX_CPLBS+1]; 29u_long icplb_table[MAX_CPLBS + 1];
30u_long dcplb_table[MAX_CPLBS+1]; 30u_long dcplb_table[MAX_CPLBS + 1];
31 31
32#ifdef CONFIG_CPLB_SWITCH_TAB_L1 32#ifdef CONFIG_CPLB_SWITCH_TAB_L1
33u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]__attribute__((l1_data)); 33# define PDT_ATTR __attribute__((l1_data))
34u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]__attribute__((l1_data));
35
36#ifdef CONFIG_CPLB_INFO
37u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]__attribute__((l1_data));
38u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]__attribute__((l1_data));
39#endif /* CONFIG_CPLB_INFO */
40
41#else 34#else
35# define PDT_ATTR
36#endif
42 37
43u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]; 38u_long ipdt_table[MAX_SWITCH_I_CPLBS + 1] PDT_ATTR;
44u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]; 39u_long dpdt_table[MAX_SWITCH_D_CPLBS + 1] PDT_ATTR;
45 40
46#ifdef CONFIG_CPLB_INFO 41#ifdef CONFIG_CPLB_INFO
47u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]; 42u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS] PDT_ATTR;
48u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]; 43u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS] PDT_ATTR;
49#endif /* CONFIG_CPLB_INFO */ 44#endif
50
51#endif /*CONFIG_CPLB_SWITCH_TAB_L1*/
52 45
53struct s_cplb { 46struct s_cplb {
54 struct cplb_tab init_i; 47 struct cplb_tab init_i;
@@ -71,7 +64,7 @@ static struct cplb_desc cplb_data[] = {
71#else 64#else
72 .valid = 0, 65 .valid = 0,
73#endif 66#endif
74 .name = "ZERO Pointer Saveguard", 67 .name = "Zero Pointer Guard Page",
75 }, 68 },
76 { 69 {
77 .start = L1_CODE_START, 70 .start = L1_CODE_START,
@@ -102,20 +95,20 @@ static struct cplb_desc cplb_data[] = {
102 .end = 0, /* dynamic */ 95 .end = 0, /* dynamic */
103 .psize = 0, 96 .psize = 0,
104 .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB, 97 .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB,
105 .i_conf = SDRAM_IGENERIC, 98 .i_conf = SDRAM_IGENERIC,
106 .d_conf = SDRAM_DGENERIC, 99 .d_conf = SDRAM_DGENERIC,
107 .valid = 1, 100 .valid = 1,
108 .name = "SDRAM Kernel", 101 .name = "Kernel Memory",
109 }, 102 },
110 { 103 {
111 .start = 0, /* dynamic */ 104 .start = 0, /* dynamic */
112 .end = 0, /* dynamic */ 105 .end = 0, /* dynamic */
113 .psize = 0, 106 .psize = 0,
114 .attr = INITIAL_T | SWITCH_T | D_CPLB, 107 .attr = INITIAL_T | SWITCH_T | D_CPLB,
115 .i_conf = SDRAM_IGENERIC, 108 .i_conf = SDRAM_IGENERIC,
116 .d_conf = SDRAM_DNON_CHBL, 109 .d_conf = SDRAM_DNON_CHBL,
117 .valid = 1, 110 .valid = 1,
118 .name = "SDRAM RAM MTD", 111 .name = "uClinux MTD Memory",
119 }, 112 },
120 { 113 {
121 .start = 0, /* dynamic */ 114 .start = 0, /* dynamic */
@@ -124,7 +117,7 @@ static struct cplb_desc cplb_data[] = {
124 .attr = INITIAL_T | SWITCH_T | D_CPLB, 117 .attr = INITIAL_T | SWITCH_T | D_CPLB,
125 .d_conf = SDRAM_DNON_CHBL, 118 .d_conf = SDRAM_DNON_CHBL,
126 .valid = 1, 119 .valid = 1,
127 .name = "SDRAM Uncached DMA ZONE", 120 .name = "Uncached DMA Zone",
128 }, 121 },
129 { 122 {
130 .start = 0, /* dynamic */ 123 .start = 0, /* dynamic */
@@ -134,7 +127,7 @@ static struct cplb_desc cplb_data[] = {
134 .i_conf = 0, /* dynamic */ 127 .i_conf = 0, /* dynamic */
135 .d_conf = 0, /* dynamic */ 128 .d_conf = 0, /* dynamic */
136 .valid = 1, 129 .valid = 1,
137 .name = "SDRAM Reserved Memory", 130 .name = "Reserved Memory",
138 }, 131 },
139 { 132 {
140 .start = ASYNC_BANK0_BASE, 133 .start = ASYNC_BANK0_BASE,
@@ -143,14 +136,14 @@ static struct cplb_desc cplb_data[] = {
143 .attr = SWITCH_T | D_CPLB, 136 .attr = SWITCH_T | D_CPLB,
144 .d_conf = SDRAM_EBIU, 137 .d_conf = SDRAM_EBIU,
145 .valid = 1, 138 .valid = 1,
146 .name = "ASYNC Memory", 139 .name = "Asynchronous Memory Banks",
147 }, 140 },
148 { 141 {
149#if defined(CONFIG_BF561) 142#ifdef L2_START
150 .start = L2_SRAM, 143 .start = L2_START,
151 .end = L2_SRAM_END, 144 .end = L2_START + L2_LENGTH,
152 .psize = SIZE_1M, 145 .psize = SIZE_1M,
153 .attr = SWITCH_T | D_CPLB, 146 .attr = SWITCH_T | I_CPLB | D_CPLB,
154 .i_conf = L2_MEMORY, 147 .i_conf = L2_MEMORY,
155 .d_conf = L2_MEMORY, 148 .d_conf = L2_MEMORY,
156 .valid = 1, 149 .valid = 1,
@@ -158,13 +151,23 @@ static struct cplb_desc cplb_data[] = {
158 .valid = 0, 151 .valid = 0,
159#endif 152#endif
160 .name = "L2 Memory", 153 .name = "L2 Memory",
161 } 154 },
155 {
156 .start = BOOT_ROM_START,
157 .end = BOOT_ROM_START + BOOT_ROM_LENGTH,
158 .psize = SIZE_1M,
159 .attr = SWITCH_T | I_CPLB | D_CPLB,
160 .i_conf = SDRAM_IGENERIC,
161 .d_conf = SDRAM_DGENERIC,
162 .valid = 1,
163 .name = "On-Chip BootROM",
164 },
162}; 165};
163 166
164static u16 __init lock_kernel_check(u32 start, u32 end) 167static u16 __init lock_kernel_check(u32 start, u32 end)
165{ 168{
166 if ((start <= (u32) _stext && end >= (u32) _end) 169 if ((end <= (u32) _end && end >= (u32)_stext) ||
167 || (start >= (u32) _stext && end <= (u32) _end)) 170 (start <= (u32) _end && start >= (u32)_stext))
168 return IN_KERNEL; 171 return IN_KERNEL;
169 return 0; 172 return 0;
170} 173}
@@ -350,7 +353,7 @@ void __init generate_cpl_tables(void)
350 else 353 else
351 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL; 354 cplb_data[RES_MEM].i_conf = SDRAM_INON_CHBL;
352 355
353 for (i = ZERO_P; i <= L2_MEM; i++) { 356 for (i = ZERO_P; i < ARRAY_SIZE(cplb_data); ++i) {
354 if (!cplb_data[i].valid) 357 if (!cplb_data[i].valid)
355 continue; 358 continue;
356 359
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c
index 6ec518a81113..724f4a5a1d46 100644
--- a/arch/blackfin/kernel/early_printk.c
+++ b/arch/blackfin/kernel/early_printk.c
@@ -205,7 +205,8 @@ asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr)
205 if (likely(early_console == NULL)) 205 if (likely(early_console == NULL))
206 setup_early_printk(DEFAULT_EARLY_PORT); 206 setup_early_printk(DEFAULT_EARLY_PORT);
207 207
208 dump_bfin_regs(fp, retaddr); 208 dump_bfin_mem((void *)fp->retx);
209 show_regs(fp);
209 dump_bfin_trace_buffer(); 210 dump_bfin_trace_buffer();
210 211
211 panic("Died early"); 212 panic("Died early");
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 9124467651c4..5bf15125f0d6 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -134,27 +134,6 @@ void cpu_idle(void)
134 } 134 }
135} 135}
136 136
137void show_regs(struct pt_regs *regs)
138{
139 printk(KERN_NOTICE "\n");
140 printk(KERN_NOTICE
141 "PC: %08lu Status: %04lu SysStatus: %04lu RETS: %08lu\n",
142 regs->pc, regs->astat, regs->seqstat, regs->rets);
143 printk(KERN_NOTICE
144 "A0.x: %08lx A0.w: %08lx A1.x: %08lx A1.w: %08lx\n",
145 regs->a0x, regs->a0w, regs->a1x, regs->a1w);
146 printk(KERN_NOTICE "P0: %08lx P1: %08lx P2: %08lx P3: %08lx\n",
147 regs->p0, regs->p1, regs->p2, regs->p3);
148 printk(KERN_NOTICE "P4: %08lx P5: %08lx\n", regs->p4, regs->p5);
149 printk(KERN_NOTICE "R0: %08lx R1: %08lx R2: %08lx R3: %08lx\n",
150 regs->r0, regs->r1, regs->r2, regs->r3);
151 printk(KERN_NOTICE "R4: %08lx R5: %08lx R6: %08lx R7: %08lx\n",
152 regs->r4, regs->r5, regs->r6, regs->r7);
153
154 if (!regs->ipend)
155 printk(KERN_NOTICE "USP: %08lx\n", rdusp());
156}
157
158/* Fill in the fpu structure for a core dump. */ 137/* Fill in the fpu structure for a core dump. */
159 138
160int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs) 139int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs)
@@ -239,51 +218,6 @@ copy_thread(int nr, unsigned long clone_flags,
239} 218}
240 219
241/* 220/*
242 * fill in the user structure for a core dump..
243 */
244void dump_thread(struct pt_regs *regs, struct user *dump)
245{
246 dump->magic = CMAGIC;
247 dump->start_code = 0;
248 dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
249 dump->u_tsize = ((unsigned long)current->mm->end_code) >> PAGE_SHIFT;
250 dump->u_dsize = ((unsigned long)(current->mm->brk +
251 (PAGE_SIZE - 1))) >> PAGE_SHIFT;
252 dump->u_dsize -= dump->u_tsize;
253 dump->u_ssize = 0;
254
255 if (dump->start_stack < TASK_SIZE)
256 dump->u_ssize =
257 ((unsigned long)(TASK_SIZE -
258 dump->start_stack)) >> PAGE_SHIFT;
259
260 dump->u_ar0 = (struct user_regs_struct *)((int)&dump->regs - (int)dump);
261
262 dump->regs.r0 = regs->r0;
263 dump->regs.r1 = regs->r1;
264 dump->regs.r2 = regs->r2;
265 dump->regs.r3 = regs->r3;
266 dump->regs.r4 = regs->r4;
267 dump->regs.r5 = regs->r5;
268 dump->regs.r6 = regs->r6;
269 dump->regs.r7 = regs->r7;
270 dump->regs.p0 = regs->p0;
271 dump->regs.p1 = regs->p1;
272 dump->regs.p2 = regs->p2;
273 dump->regs.p3 = regs->p3;
274 dump->regs.p4 = regs->p4;
275 dump->regs.p5 = regs->p5;
276 dump->regs.orig_p0 = regs->orig_p0;
277 dump->regs.a0w = regs->a0w;
278 dump->regs.a1w = regs->a1w;
279 dump->regs.a0x = regs->a0x;
280 dump->regs.a1x = regs->a1x;
281 dump->regs.rets = regs->rets;
282 dump->regs.astat = regs->astat;
283 dump->regs.pc = regs->pc;
284}
285
286/*
287 * sys_execve() executes a new program. 221 * sys_execve() executes a new program.
288 */ 222 */
289 223
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 934234f43839..d2822010b7ce 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -43,6 +43,7 @@
43#include <asm/cacheflush.h> 43#include <asm/cacheflush.h>
44#include <asm/blackfin.h> 44#include <asm/blackfin.h>
45#include <asm/cplbinit.h> 45#include <asm/cplbinit.h>
46#include <asm/div64.h>
46#include <asm/fixed_code.h> 47#include <asm/fixed_code.h>
47#include <asm/early_printk.h> 48#include <asm/early_printk.h>
48 49
@@ -504,13 +505,17 @@ EXPORT_SYMBOL(get_sclk);
504 505
505unsigned long sclk_to_usecs(unsigned long sclk) 506unsigned long sclk_to_usecs(unsigned long sclk)
506{ 507{
507 return (USEC_PER_SEC * (u64)sclk) / get_sclk(); 508 u64 tmp = USEC_PER_SEC * (u64)sclk;
509 do_div(tmp, get_sclk());
510 return tmp;
508} 511}
509EXPORT_SYMBOL(sclk_to_usecs); 512EXPORT_SYMBOL(sclk_to_usecs);
510 513
511unsigned long usecs_to_sclk(unsigned long usecs) 514unsigned long usecs_to_sclk(unsigned long usecs)
512{ 515{
513 return (get_sclk() * (u64)usecs) / USEC_PER_SEC; 516 u64 tmp = get_sclk() * (u64)usecs;
517 do_div(tmp, USEC_PER_SEC);
518 return tmp;
514} 519}
515EXPORT_SYMBOL(usecs_to_sclk); 520EXPORT_SYMBOL(usecs_to_sclk);
516 521
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index cfa05436c972..21a55ef19cbd 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -158,7 +158,7 @@ static void decode_address(char *buf, unsigned long address)
158 } 158 }
159 159
160 /* we were unable to find this address anywhere */ 160 /* we were unable to find this address anywhere */
161 sprintf(buf, "[<0x%p>]", (void *)address); 161 sprintf(buf, "<0x%p> /* unknown address */", (void *)address);
162 162
163done: 163done:
164 write_unlock_irqrestore(&tasklist_lock, flags); 164 write_unlock_irqrestore(&tasklist_lock, flags);
@@ -169,7 +169,9 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
169 console_verbose(); 169 console_verbose();
170 oops_in_progress = 1; 170 oops_in_progress = 1;
171 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); 171 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
172 dump_bfin_regs(fp, (void *)fp->retx); 172 dump_bfin_process(fp);
173 dump_bfin_mem((void *)fp->retx);
174 show_regs(fp);
173 panic("Double Fault - unrecoverable event\n"); 175 panic("Double Fault - unrecoverable event\n");
174 176
175} 177}
@@ -250,7 +252,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
250 case VEC_EXCPT03: 252 case VEC_EXCPT03:
251 info.si_code = SEGV_STACKFLOW; 253 info.si_code = SEGV_STACKFLOW;
252 sig = SIGSEGV; 254 sig = SIGSEGV;
253 printk(KERN_NOTICE EXC_0x03); 255 printk(KERN_NOTICE EXC_0x03(KERN_NOTICE));
254 CHK_DEBUGGER_TRAP(); 256 CHK_DEBUGGER_TRAP();
255 break; 257 break;
256 /* 0x04 - User Defined, Caught by default */ 258 /* 0x04 - User Defined, Caught by default */
@@ -279,7 +281,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
279 case VEC_OVFLOW: 281 case VEC_OVFLOW:
280 info.si_code = TRAP_TRACEFLOW; 282 info.si_code = TRAP_TRACEFLOW;
281 sig = SIGTRAP; 283 sig = SIGTRAP;
282 printk(KERN_NOTICE EXC_0x11); 284 printk(KERN_NOTICE EXC_0x11(KERN_NOTICE));
283 CHK_DEBUGGER_TRAP(); 285 CHK_DEBUGGER_TRAP();
284 break; 286 break;
285 /* 0x12 - Reserved, Caught by default */ 287 /* 0x12 - Reserved, Caught by default */
@@ -301,36 +303,35 @@ asmlinkage void trap_c(struct pt_regs *fp)
301 case VEC_UNDEF_I: 303 case VEC_UNDEF_I:
302 info.si_code = ILL_ILLOPC; 304 info.si_code = ILL_ILLOPC;
303 sig = SIGILL; 305 sig = SIGILL;
304 printk(KERN_NOTICE EXC_0x21); 306 printk(KERN_NOTICE EXC_0x21(KERN_NOTICE));
305 CHK_DEBUGGER_TRAP(); 307 CHK_DEBUGGER_TRAP();
306 break; 308 break;
307 /* 0x22 - Illegal Instruction Combination, handled here */ 309 /* 0x22 - Illegal Instruction Combination, handled here */
308 case VEC_ILGAL_I: 310 case VEC_ILGAL_I:
309 info.si_code = ILL_ILLPARAOP; 311 info.si_code = ILL_ILLPARAOP;
310 sig = SIGILL; 312 sig = SIGILL;
311 printk(KERN_NOTICE EXC_0x22); 313 printk(KERN_NOTICE EXC_0x22(KERN_NOTICE));
312 CHK_DEBUGGER_TRAP(); 314 CHK_DEBUGGER_TRAP();
313 break; 315 break;
314 /* 0x23 - Data CPLB Protection Violation, 316 /* 0x23 - Data CPLB protection violation, handled here */
315 normal case is handled in _cplb_hdr */
316 case VEC_CPLB_VL: 317 case VEC_CPLB_VL:
317 info.si_code = ILL_CPLB_VI; 318 info.si_code = ILL_CPLB_VI;
318 sig = SIGILL; 319 sig = SIGBUS;
319 printk(KERN_NOTICE EXC_0x23); 320 printk(KERN_NOTICE EXC_0x23(KERN_NOTICE));
320 CHK_DEBUGGER_TRAP(); 321 CHK_DEBUGGER_TRAP();
321 break; 322 break;
322 /* 0x24 - Data access misaligned, handled here */ 323 /* 0x24 - Data access misaligned, handled here */
323 case VEC_MISALI_D: 324 case VEC_MISALI_D:
324 info.si_code = BUS_ADRALN; 325 info.si_code = BUS_ADRALN;
325 sig = SIGBUS; 326 sig = SIGBUS;
326 printk(KERN_NOTICE EXC_0x24); 327 printk(KERN_NOTICE EXC_0x24(KERN_NOTICE));
327 CHK_DEBUGGER_TRAP(); 328 CHK_DEBUGGER_TRAP();
328 break; 329 break;
329 /* 0x25 - Unrecoverable Event, handled here */ 330 /* 0x25 - Unrecoverable Event, handled here */
330 case VEC_UNCOV: 331 case VEC_UNCOV:
331 info.si_code = ILL_ILLEXCPT; 332 info.si_code = ILL_ILLEXCPT;
332 sig = SIGILL; 333 sig = SIGILL;
333 printk(KERN_NOTICE EXC_0x25); 334 printk(KERN_NOTICE EXC_0x25(KERN_NOTICE));
334 CHK_DEBUGGER_TRAP(); 335 CHK_DEBUGGER_TRAP();
335 break; 336 break;
336 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, 337 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
@@ -338,7 +339,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
338 case VEC_CPLB_M: 339 case VEC_CPLB_M:
339 info.si_code = BUS_ADRALN; 340 info.si_code = BUS_ADRALN;
340 sig = SIGBUS; 341 sig = SIGBUS;
341 printk(KERN_NOTICE EXC_0x26); 342 printk(KERN_NOTICE EXC_0x26(KERN_NOTICE));
342 CHK_DEBUGGER_TRAP(); 343 CHK_DEBUGGER_TRAP();
343 break; 344 break;
344 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ 345 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
@@ -349,7 +350,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
349 printk(KERN_NOTICE "NULL pointer access (probably)\n"); 350 printk(KERN_NOTICE "NULL pointer access (probably)\n");
350#else 351#else
351 sig = SIGILL; 352 sig = SIGILL;
352 printk(KERN_NOTICE EXC_0x27); 353 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE));
353#endif 354#endif
354 CHK_DEBUGGER_TRAP(); 355 CHK_DEBUGGER_TRAP();
355 break; 356 break;
@@ -357,7 +358,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
357 case VEC_WATCH: 358 case VEC_WATCH:
358 info.si_code = TRAP_WATCHPT; 359 info.si_code = TRAP_WATCHPT;
359 sig = SIGTRAP; 360 sig = SIGTRAP;
360 pr_debug(EXC_0x28); 361 pr_debug(EXC_0x28(KERN_DEBUG));
361 CHK_DEBUGGER_TRAP_MAYBE(); 362 CHK_DEBUGGER_TRAP_MAYBE();
362 /* Check if this is a watchpoint in kernel space */ 363 /* Check if this is a watchpoint in kernel space */
363 if (fp->ipend & 0xffc0) 364 if (fp->ipend & 0xffc0)
@@ -379,22 +380,21 @@ asmlinkage void trap_c(struct pt_regs *fp)
379 case VEC_MISALI_I: 380 case VEC_MISALI_I:
380 info.si_code = BUS_ADRALN; 381 info.si_code = BUS_ADRALN;
381 sig = SIGBUS; 382 sig = SIGBUS;
382 printk(KERN_NOTICE EXC_0x2A); 383 printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE));
383 CHK_DEBUGGER_TRAP(); 384 CHK_DEBUGGER_TRAP();
384 break; 385 break;
385 /* 0x2B - Instruction CPLB protection Violation, 386 /* 0x2B - Instruction CPLB protection violation, handled here */
386 handled in _cplb_hdr */
387 case VEC_CPLB_I_VL: 387 case VEC_CPLB_I_VL:
388 info.si_code = ILL_CPLB_VI; 388 info.si_code = ILL_CPLB_VI;
389 sig = SIGILL; 389 sig = SIGBUS;
390 printk(KERN_NOTICE EXC_0x2B); 390 printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE));
391 CHK_DEBUGGER_TRAP(); 391 CHK_DEBUGGER_TRAP();
392 break; 392 break;
393 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ 393 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */
394 case VEC_CPLB_I_M: 394 case VEC_CPLB_I_M:
395 info.si_code = ILL_CPLB_MISS; 395 info.si_code = ILL_CPLB_MISS;
396 sig = SIGBUS; 396 sig = SIGBUS;
397 printk(KERN_NOTICE EXC_0x2C); 397 printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE));
398 CHK_DEBUGGER_TRAP(); 398 CHK_DEBUGGER_TRAP();
399 break; 399 break;
400 /* 0x2D - Instruction CPLB Multiple Hits, handled here */ 400 /* 0x2D - Instruction CPLB Multiple Hits, handled here */
@@ -405,7 +405,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
405 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n"); 405 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n");
406#else 406#else
407 sig = SIGILL; 407 sig = SIGILL;
408 printk(KERN_NOTICE EXC_0x2D); 408 printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE));
409#endif 409#endif
410 CHK_DEBUGGER_TRAP(); 410 CHK_DEBUGGER_TRAP();
411 break; 411 break;
@@ -413,7 +413,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
413 case VEC_ILL_RES: 413 case VEC_ILL_RES:
414 info.si_code = ILL_PRVOPC; 414 info.si_code = ILL_PRVOPC;
415 sig = SIGILL; 415 sig = SIGILL;
416 printk(KERN_NOTICE EXC_0x2E); 416 printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE));
417 CHK_DEBUGGER_TRAP(); 417 CHK_DEBUGGER_TRAP();
418 break; 418 break;
419 /* 0x2F - Reserved, Caught by default */ 419 /* 0x2F - Reserved, Caught by default */
@@ -446,7 +446,9 @@ asmlinkage void trap_c(struct pt_regs *fp)
446 446
447 if (sig != SIGTRAP) { 447 if (sig != SIGTRAP) {
448 unsigned long stack; 448 unsigned long stack;
449 dump_bfin_regs(fp, (void *)fp->retx); 449 dump_bfin_process(fp);
450 dump_bfin_mem((void *)fp->retx);
451 show_regs(fp);
450 452
451 /* Print out the trace buffer if it makes sense */ 453 /* Print out the trace buffer if it makes sense */
452#ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE 454#ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
@@ -460,22 +462,25 @@ asmlinkage void trap_c(struct pt_regs *fp)
460 show_stack(current, &stack); 462 show_stack(current, &stack);
461 if (oops_in_progress) { 463 if (oops_in_progress) {
462#ifndef CONFIG_ACCESS_CHECK 464#ifndef CONFIG_ACCESS_CHECK
463 printk(KERN_EMERG "Hey - dork - please turn on " 465 printk(KERN_EMERG "Please turn on "
464 "CONFIG_ACCESS_CHECK\n"); 466 "CONFIG_ACCESS_CHECK\n");
465#endif 467#endif
466 panic("Kernel exception"); 468 panic("Kernel exception");
467 } 469 }
468
469 /* Ensure that bad return addresses don't end up in an infinite
470 * loop, due to speculative loads/reads
471 */
472 fp->pc = SAFE_USER_INSTRUCTION;
473 } 470 }
471
474 info.si_signo = sig; 472 info.si_signo = sig;
475 info.si_errno = 0; 473 info.si_errno = 0;
476 info.si_addr = (void *)fp->pc; 474 info.si_addr = (void *)fp->pc;
477 force_sig_info(sig, &info, current); 475 force_sig_info(sig, &info, current);
478 476
477 /* Ensure that bad return addresses don't end up in an infinite
478 * loop, due to speculative loads/reads. This needs to be done after
479 * the signal has been sent.
480 */
481 if (trapnr == VEC_CPLB_I_M && sig != SIGTRAP)
482 fp->pc = SAFE_USER_INSTRUCTION;
483
479 trace_buffer_restore(j); 484 trace_buffer_restore(j);
480 return; 485 return;
481} 486}
@@ -600,37 +605,48 @@ void dump_stack(void)
600 show_stack(current, &stack); 605 show_stack(current, &stack);
601 trace_buffer_restore(tflags); 606 trace_buffer_restore(tflags);
602} 607}
603
604EXPORT_SYMBOL(dump_stack); 608EXPORT_SYMBOL(dump_stack);
605 609
606void dump_bfin_regs(struct pt_regs *fp, void *retaddr) 610void dump_bfin_process(struct pt_regs *fp)
607{ 611{
608 char buf [150]; 612 /* We should be able to look at fp->ipend, but we don't push it on the
613 * stack all the time, so do this until we fix that */
614 unsigned int context = bfin_read_IPEND();
615
616 if (oops_in_progress)
617 printk(KERN_EMERG "Kernel OOPS in progress\n");
618
619 if (context & 0x0020)
620 printk(KERN_NOTICE "Deferred excecption or HW Error context\n");
621 else if (context & 0x3FC0)
622 printk(KERN_NOTICE "Interrupt context\n");
623 else if (context & 0x4000)
624 printk(KERN_NOTICE "Deferred Interrupt context\n");
625 else if (context & 0x8000)
626 printk(KERN_NOTICE "Kernel process context\n");
627
628 if (current->pid && current->mm) {
629 printk(KERN_NOTICE "CURRENT PROCESS:\n");
630 printk(KERN_NOTICE "COMM=%s PID=%d\n",
631 current->comm, current->pid);
632
633 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
634 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
635 KERN_NOTICE "\n",
636 (void *)current->mm->start_code,
637 (void *)current->mm->end_code,
638 (void *)current->mm->start_data,
639 (void *)current->mm->end_data,
640 (void *)current->mm->end_data,
641 (void *)current->mm->brk,
642 (void *)current->mm->start_stack);
643 } else
644 printk(KERN_NOTICE "\n" KERN_NOTICE
645 "No Valid process in current context\n");
646}
609 647
610 if (!oops_in_progress) { 648void dump_bfin_mem(void *retaddr)
611 if (current->pid && current->mm) { 649{
612 printk(KERN_NOTICE "\n" KERN_NOTICE "CURRENT PROCESS:\n");
613 printk(KERN_NOTICE "COMM=%s PID=%d\n",
614 current->comm, current->pid);
615
616 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
617 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
618 KERN_NOTICE "\n",
619 (void *)current->mm->start_code,
620 (void *)current->mm->end_code,
621 (void *)current->mm->start_data,
622 (void *)current->mm->end_data,
623 (void *)current->mm->end_data,
624 (void *)current->mm->brk,
625 (void *)current->mm->start_stack);
626 } else {
627 printk (KERN_NOTICE "\n" KERN_NOTICE
628 "No Valid pid - Either things are really messed up,"
629 " or you are in the kernel\n");
630 }
631 } else {
632 printk(KERN_NOTICE "Kernel or interrupt exception\n");
633 }
634 650
635 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end 651 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end
636#if L1_CODE_LENGTH != 0 652#if L1_CODE_LENGTH != 0
@@ -671,8 +687,13 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
671 printk("\n"); 687 printk("\n");
672 } else 688 } else
673 printk("\n" KERN_NOTICE 689 printk("\n" KERN_NOTICE
674 "Cannot look at the [PC] for it is" 690 "Cannot look at the [PC] <%p> for it is"
675 " in unreadable memory - sorry\n"); 691 " in unreadable memory - sorry\n", retaddr);
692}
693
694void show_regs(struct pt_regs *fp)
695{
696 char buf [150];
676 697
677 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n"); 698 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
678 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", 699 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
@@ -686,6 +707,8 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
686 printk(KERN_NOTICE " RETX: %s\n", buf); 707 printk(KERN_NOTICE " RETX: %s\n", buf);
687 decode_address(buf, fp->rets); 708 decode_address(buf, fp->rets);
688 printk(KERN_NOTICE " RETS: %s\n", buf); 709 printk(KERN_NOTICE " RETS: %s\n", buf);
710 decode_address(buf, fp->pc);
711 printk(KERN_NOTICE " PC: %s\n", buf);
689 712
690 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) { 713 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) {
691 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR()); 714 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
@@ -800,7 +823,9 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
800 823
801 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); 824 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
802 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR()); 825 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
803 dump_bfin_regs(fp, (void *)fp->retx); 826 dump_bfin_process(fp);
827 dump_bfin_mem((void *)fp->retx);
828 show_regs(fp);
804 dump_stack(); 829 dump_stack();
805 panic("Unrecoverable event\n"); 830 panic("Unrecoverable event\n");
806} 831}
diff --git a/arch/blackfin/lib/Makefile b/arch/blackfin/lib/Makefile
index bfdad52c570b..635288fc5f54 100644
--- a/arch/blackfin/lib/Makefile
+++ b/arch/blackfin/lib/Makefile
@@ -4,7 +4,7 @@
4 4
5lib-y := \ 5lib-y := \
6 ashldi3.o ashrdi3.o lshrdi3.o \ 6 ashldi3.o ashrdi3.o lshrdi3.o \
7 muldi3.o divsi3.o udivsi3.o udivdi3.o modsi3.o umodsi3.o \ 7 muldi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
8 checksum.o memcpy.o memset.o memcmp.o memchr.o memmove.o \ 8 checksum.o memcpy.o memset.o memcmp.o memchr.o memmove.o \
9 strcmp.o strcpy.o strncmp.o strncpy.o \ 9 strcmp.o strcpy.o strncmp.o strncpy.o \
10 umulsi3_highpart.o smulsi3_highpart.o \ 10 umulsi3_highpart.o smulsi3_highpart.o \
diff --git a/arch/blackfin/lib/ins.S b/arch/blackfin/lib/ins.S
index a17cc77ac36f..df7b8833a0c5 100644
--- a/arch/blackfin/lib/ins.S
+++ b/arch/blackfin/lib/ins.S
@@ -77,3 +77,22 @@ ENTRY(_insb)
77 sti R3; 77 sti R3;
78 RTS; 78 RTS;
79ENDPROC(_insb) 79ENDPROC(_insb)
80
81
82
83ENTRY(_insl_16)
84 P0 = R0; /* P0 = port */
85 cli R3;
86 P1 = R1; /* P1 = address */
87 P2 = R2; /* P2 = count */
88 SSYNC;
89 LSETUP( .Llong16_loop_s, .Llong16_loop_e) LC0 = P2;
90.Llong16_loop_s: R0 = [P0];
91 W[P1++] = R0;
92 R0 = R0 >> 16;
93 W[P1++] = R0;
94 NOP;
95.Llong16_loop_e: NOP;
96 sti R3;
97 RTS;
98ENDPROC(_insl_16)
diff --git a/arch/blackfin/lib/strcmp.c b/arch/blackfin/lib/strcmp.c
index 4eeefd86907f..fde39a1950ce 100644
--- a/arch/blackfin/lib/strcmp.c
+++ b/arch/blackfin/lib/strcmp.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strcmp __inline_strcmp 9#define strcmp __inline_strcmp
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strcmp 11#undef strcmp
6 12
13#include <linux/module.h>
14
7int strcmp(const char *dest, const char *src) 15int strcmp(const char *dest, const char *src)
8{ 16{
9 return __inline_strcmp(dest, src); 17 return __inline_strcmp(dest, src);
10} 18}
19EXPORT_SYMBOL(strcmp);
diff --git a/arch/blackfin/lib/strcpy.c b/arch/blackfin/lib/strcpy.c
index 534589db7256..2a8836b1f4d3 100644
--- a/arch/blackfin/lib/strcpy.c
+++ b/arch/blackfin/lib/strcpy.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strcpy __inline_strcpy 9#define strcpy __inline_strcpy
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strcpy 11#undef strcpy
6 12
13#include <linux/module.h>
14
7char *strcpy(char *dest, const char *src) 15char *strcpy(char *dest, const char *src)
8{ 16{
9 return __inline_strcpy(dest, src); 17 return __inline_strcpy(dest, src);
10} 18}
19EXPORT_SYMBOL(strcpy);
diff --git a/arch/blackfin/lib/strncmp.c b/arch/blackfin/lib/strncmp.c
index d791f120bff7..2aaae78a68e0 100644
--- a/arch/blackfin/lib/strncmp.c
+++ b/arch/blackfin/lib/strncmp.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strncmp __inline_strncmp 9#define strncmp __inline_strncmp
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strncmp 11#undef strncmp
6 12
13#include <linux/module.h>
14
7int strncmp(const char *cs, const char *ct, size_t count) 15int strncmp(const char *cs, const char *ct, size_t count)
8{ 16{
9 return __inline_strncmp(cs, ct, count); 17 return __inline_strncmp(cs, ct, count);
10} 18}
19EXPORT_SYMBOL(strncmp);
diff --git a/arch/blackfin/lib/strncpy.c b/arch/blackfin/lib/strncpy.c
index 1fecb5c71ffb..ea1dc6bf2373 100644
--- a/arch/blackfin/lib/strncpy.c
+++ b/arch/blackfin/lib/strncpy.c
@@ -1,10 +1,19 @@
1#include <linux/types.h> 1/*
2 * Provide symbol in case str func is not inlined.
3 *
4 * Copyright (c) 2006-2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
2 8
3#define strncpy __inline_strncpy 9#define strncpy __inline_strncpy
4#include <asm/string.h> 10#include <asm/string.h>
5#undef strncpy 11#undef strncpy
6 12
13#include <linux/module.h>
14
7char *strncpy(char *dest, const char *src, size_t n) 15char *strncpy(char *dest, const char *src, size_t n)
8{ 16{
9 return __inline_strncpy(dest, src, n); 17 return __inline_strncpy(dest, src, n);
10} 18}
19EXPORT_SYMBOL(strncpy);
diff --git a/arch/blackfin/lib/udivdi3.S b/arch/blackfin/lib/udivdi3.S
deleted file mode 100644
index ad1ebee675e1..000000000000
--- a/arch/blackfin/lib/udivdi3.S
+++ /dev/null
@@ -1,375 +0,0 @@
1/*
2 * udivdi3.S - unsigned long long division
3 *
4 * Copyright 2003-2007 Analog Devices Inc.
5 * Enter bugs at http://blackfin.uclinux.org/
6 *
7 * Licensed under the GPLv2 or later.
8 */
9
10#include <linux/linkage.h>
11
12#define CARRY AC0
13
14#ifdef CONFIG_ARITHMETIC_OPS_L1
15.section .l1.text
16#else
17.text
18#endif
19
20
21ENTRY(___udivdi3)
22 R3 = [SP + 12];
23 [--SP] = (R7:4, P5:3);
24
25 /* Attempt to use divide primitive first; these will handle
26 ** most cases, and they're quick - avoids stalls incurred by
27 ** testing for identities.
28 */
29
30 R4 = R2 | R3;
31 CC = R4 == 0;
32 IF CC JUMP .LDIV_BY_ZERO;
33
34 R4.H = 0x8000;
35 R4 >>>= 16; // R4 now 0xFFFF8000
36 R5 = R0 | R2; // If either dividend or
37 R4 = R5 & R4; // divisor have bits in
38 CC = R4; // top half or low half's sign
39 IF CC JUMP .LIDENTS; // bit, skip builtins.
40 R4 = R1 | R3; // Also check top halves
41 CC = R4;
42 IF CC JUMP .LIDENTS;
43
44 /* Can use the builtins. */
45
46 AQ = CC; // Clear AQ (CC==0)
47 DIVQ(R0, R2);
48 DIVQ(R0, R2);
49 DIVQ(R0, R2);
50 DIVQ(R0, R2);
51 DIVQ(R0, R2);
52 DIVQ(R0, R2);
53 DIVQ(R0, R2);
54 DIVQ(R0, R2);
55 DIVQ(R0, R2);
56 DIVQ(R0, R2);
57 DIVQ(R0, R2);
58 DIVQ(R0, R2);
59 DIVQ(R0, R2);
60 DIVQ(R0, R2);
61 DIVQ(R0, R2);
62 DIVQ(R0, R2);
63 DIVQ(R0, R2);
64 R0 = R0.L (Z);
65 R1 = 0;
66 (R7:4, P5:3) = [SP++];
67 RTS;
68
69.LIDENTS:
70 /* Test for common identities. Value to be returned is
71 ** placed in R6,R7.
72 */
73 // Check for 0/y, return 0
74 R4 = R0 | R1;
75 CC = R4 == 0;
76 IF CC JUMP .LRETURN_R0;
77
78 // Check for x/x, return 1
79 R6 = R0 - R2; // If x == y, then both R6 and R7 will be zero
80 R7 = R1 - R3;
81 R4 = R6 | R7; // making R4 zero.
82 R6 += 1; // which would now make R6:R7==1.
83 CC = R4 == 0;
84 IF CC JUMP .LRETURN_IDENT;
85
86 // Check for x/1, return x
87 R6 = R0;
88 R7 = R1;
89 CC = R3 == 0;
90 IF !CC JUMP .Lnexttest;
91 CC = R2 == 1;
92 IF CC JUMP .LRETURN_IDENT;
93
94.Lnexttest:
95 R4.L = ONES R2; // check for div by power of two which
96 R5.L = ONES R3; // can be done using a shift
97 R6 = PACK (R5.L, R4.L);
98 CC = R6 == 1;
99 IF CC JUMP .Lpower_of_two_upper_zero;
100 R6 = PACK (R4.L, R5.L);
101 CC = R6 == 1;
102 IF CC JUMP .Lpower_of_two_lower_zero;
103
104 // Check for x < y, return 0
105 R6 = 0;
106 R7 = R6;
107 CC = R1 < R3 (IU);
108 IF CC JUMP .LRETURN_IDENT;
109 CC = R1 == R3;
110 IF !CC JUMP .Lno_idents;
111 CC = R0 < R2 (IU);
112 IF CC JUMP .LRETURN_IDENT;
113
114.Lno_idents: // Idents don't match. Go for the full operation
115
116
117 // If X, or X and Y have high bit set, it'll affect the
118 // results, so shift right one to stop this. Note: we've already
119 // checked that X >= Y, so Y's msb won't be set unless X's
120 // is.
121
122 R4 = 0;
123 CC = R1 < 0;
124 IF !CC JUMP .Lx_msb_clear;
125 CC = !CC; // 1 -> 0;
126 R1 = ROT R1 BY -1; // Shift X >> 1
127 R0 = ROT R0 BY -1; // lsb -> CC
128 BITSET(R4,31); // to record only x msb was set
129 CC = R3 < 0;
130 IF !CC JUMP .Ly_msb_clear;
131 CC = !CC;
132 R3 = ROT R3 BY -1; // Shift Y >> 1
133 R2 = ROT R2 BY -1;
134 BITCLR(R4,31); // clear bit to record only x msb was set
135
136.Ly_msb_clear:
137.Lx_msb_clear:
138 // Bit 31 in R4 indicates X msb set, but Y msb wasn't, and no bits
139 // were lost, so we should shift result left by one.
140
141 [--SP] = R4; // save for later
142
143 // In the loop that follows, each iteration we add
144 // either Y' or -Y' to the Remainder. We compute the
145 // negated Y', and store, for convenience. Y' goes
146 // into P0:P1, while -Y' goes into P2:P3.
147
148 P0 = R2;
149 P1 = R3;
150 R2 = -R2;
151 CC = CARRY;
152 CC = !CC;
153 R4 = CC;
154 R3 = -R3;
155 R3 = R3 - R4;
156
157 R6 = 0; // remainder = 0
158 R7 = R6;
159
160 [--SP] = R2; P2 = SP;
161 [--SP] = R3; P3 = SP;
162 [--SP] = R6; P5 = SP; // AQ = 0
163 [--SP] = P1;
164
165 /* In the loop that follows, we use the following
166 ** register assignments:
167 ** R0,R1 X, workspace
168 ** R2,R3 Y, workspace
169 ** R4,R5 partial Div
170 ** R6,R7 partial remainder
171 ** P5 AQ
172 ** The remainder and div form a 128-bit number, with
173 ** the remainder in the high 64-bits.
174 */
175 R4 = R0; // Div = X'
176 R5 = R1;
177 R3 = 0;
178
179 P4 = 64; // Iterate once per bit
180 LSETUP(.LULST,.LULEND) LC0 = P4;
181.LULST:
182 /* Shift Div and remainder up by one. The bit shifted
183 ** out of the top of the quotient is shifted into the bottom
184 ** of the remainder.
185 */
186 CC = R3;
187 R4 = ROT R4 BY 1;
188 R5 = ROT R5 BY 1 || // low q to high q
189 R2 = [P5]; // load saved AQ
190 R6 = ROT R6 BY 1 || // high q to low r
191 R0 = [P2]; // load -Y'
192 R7 = ROT R7 BY 1 || // low r to high r
193 R1 = [P3];
194
195 // Assume add -Y'
196 CC = R2 < 0; // But if AQ is set...
197 IF CC R0 = P0; // then add Y' instead
198 IF CC R1 = P1;
199
200 R6 = R6 + R0; // Rem += (Y' or -Y')
201 CC = CARRY;
202 R0 = CC;
203 R7 = R7 + R1;
204 R7 = R7 + R0 (NS) ||
205 R1 = [SP];
206 // Set the next AQ bit
207 R1 = R7 ^ R1; // from Remainder and Y'
208 R1 = R1 >> 31 || // Negate AQ's value, and
209 [P5] = R1; // save next AQ
210 BITTGL(R1, 0); // add neg AQ to the Div
211.LULEND: R4 = R4 + R1;
212
213 R6 = [SP + 16];
214
215 R0 = R4;
216 R1 = R5;
217 CC = BITTST(R6,30); // Just set CC=0
218 R4 = ROT R0 BY 1; // but if we had to shift X,
219 R5 = ROT R1 BY 1; // and didn't shift any bits out,
220 CC = BITTST(R6,31); // then the result will be half as
221 IF CC R0 = R4; // much as required, so shift left
222 IF CC R1 = R5; // one space.
223
224 SP += 20;
225 (R7:4, P5:3) = [SP++];
226 RTS;
227
228.Lpower_of_two:
229 /* Y has a single bit set, which means it's a power of two.
230 ** That means we can perform the division just by shifting
231 ** X to the right the appropriate number of bits
232 */
233
234 /* signbits returns the number of sign bits, minus one.
235 ** 1=>30, 2=>29, ..., 0x40000000=>0. Which means we need
236 ** to shift right n-signbits spaces. It also means 0x80000000
237 ** is a special case, because that *also* gives a signbits of 0
238 */
239.Lpower_of_two_lower_zero:
240 R7 = 0;
241 R6 = R1 >> 31;
242 CC = R3 < 0;
243 IF CC JUMP .LRETURN_IDENT;
244
245 R2.L = SIGNBITS R3;
246 R2 = R2.L (Z);
247 R2 += -62;
248 (R7:4, P5:3) = [SP++];
249 JUMP ___lshftli;
250
251.Lpower_of_two_upper_zero:
252 CC = R2 < 0;
253 IF CC JUMP .Lmaxint_shift;
254
255 R2.L = SIGNBITS R2;
256 R2 = R2.L (Z);
257 R2 += -30;
258 (R7:4, P5:3) = [SP++];
259 JUMP ___lshftli;
260
261.Lmaxint_shift:
262 R2 = -31;
263 (R7:4, P5:3) = [SP++];
264 JUMP ___lshftli;
265
266.LRETURN_IDENT:
267 R0 = R6;
268 R1 = R7;
269.LRETURN_R0:
270 (R7:4, P5:3) = [SP++];
271 RTS;
272.LDIV_BY_ZERO:
273 R0 = ~R2;
274 R1 = R0;
275 (R7:4, P5:3) = [SP++];
276 RTS;
277
278ENDPROC(___udivdi3)
279
280
281ENTRY(___lshftli)
282 CC = R2 == 0;
283 IF CC JUMP .Lfinished; // nothing to do
284 CC = R2 < 0;
285 IF CC JUMP .Lrshift;
286 R3 = 64;
287 CC = R2 < R3;
288 IF !CC JUMP .Lretzero;
289
290 // We're shifting left, and it's less than 64 bits, so
291 // a valid result will be returned.
292
293 R3 >>= 1; // R3 now 32
294 CC = R2 < R3;
295
296 IF !CC JUMP .Lzerohalf;
297
298 // We're shifting left, between 1 and 31 bits, which means
299 // some of the low half will be shifted into the high half.
300 // Work out how much.
301
302 R3 = R3 - R2;
303
304 // Save that much data from the bottom half.
305
306 P1 = R7;
307 R7 = R0;
308 R7 >>= R3;
309
310 // Adjust both parts of the parameter.
311
312 R0 <<= R2;
313 R1 <<= R2;
314
315 // And include the bits moved across.
316
317 R1 = R1 | R7;
318 R7 = P1;
319 RTS;
320
321.Lzerohalf:
322 // We're shifting left, between 32 and 63 bits, so the
323 // bottom half will become zero, and the top half will
324 // lose some bits. How many?
325
326 R2 = R2 - R3; // N - 32
327 R1 = LSHIFT R0 BY R2.L;
328 R0 = R0 - R0;
329 RTS;
330
331.Lretzero:
332 R0 = R0 - R0;
333 R1 = R0;
334.Lfinished:
335 RTS;
336
337.Lrshift:
338 // We're shifting right, but by how much?
339 R2 = -R2;
340 R3 = 64;
341 CC = R2 < R3;
342 IF !CC JUMP .Lretzero;
343
344 // Shifting right less than 64 bits, so some result bits will
345 // be retained.
346
347 R3 >>= 1; // R3 now 32
348 CC = R2 < R3;
349 IF !CC JUMP .Lsignhalf;
350
351 // Shifting right between 1 and 31 bits, so need to copy
352 // data across words.
353
354 P1 = R7;
355 R3 = R3 - R2;
356 R7 = R1;
357 R7 <<= R3;
358 R1 >>= R2;
359 R0 >>= R2;
360 R0 = R7 | R0;
361 R7 = P1;
362 RTS;
363
364.Lsignhalf:
365 // Shifting right between 32 and 63 bits, so the top half
366 // will become all zero-bits, and the bottom half is some
367 // of the top half. But how much?
368
369 R2 = R2 - R3;
370 R0 = R1;
371 R0 >>= R2;
372 R1 = 0;
373 RTS;
374
375ENDPROC(___lshftli)
diff --git a/arch/blackfin/mach-bf527/Kconfig b/arch/blackfin/mach-bf527/Kconfig
index 50321f723dee..5c736837d4bf 100644
--- a/arch/blackfin/mach-bf527/Kconfig
+++ b/arch/blackfin/mach-bf527/Kconfig
@@ -1,5 +1,7 @@
1if (BF52x) 1if (BF52x)
2 2
3source "arch/blackfin/mach-bf527/boards/Kconfig"
4
3menu "BF527 Specific Configuration" 5menu "BF527 Specific Configuration"
4 6
5comment "Alternative Multiplexing Scheme" 7comment "Alternative Multiplexing Scheme"
diff --git a/arch/blackfin/mach-bf527/boards/Kconfig b/arch/blackfin/mach-bf527/boards/Kconfig
new file mode 100644
index 000000000000..6a570ad03746
--- /dev/null
+++ b/arch/blackfin/mach-bf527/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN527_EZKIT
4 help
5 Select your board!
6
7config BFIN527_EZKIT
8 bool "BF527-EZKIT"
9 help
10 BF527-EZKIT-LITE board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf527/boards/Makefile b/arch/blackfin/mach-bf527/boards/Makefile
index 912ac8ebc889..7277d35ef111 100644
--- a/arch/blackfin/mach-bf527/boards/Makefile
+++ b/arch/blackfin/mach-bf527/boards/Makefile
@@ -1,7 +1,5 @@
1# 1#
2# arch/blackfin/mach-bf532/boards/Makefile 2# arch/blackfin/mach-bf527/boards/Makefile
3# 3#
4 4
5obj-y += eth_mac.o 5obj-$(CONFIG_BFIN527_EZKIT) += ezkit.o
6obj-$(CONFIG_BFIN527_EZKIT) += ezkit.o
7
diff --git a/arch/blackfin/mach-bf527/boards/eth_mac.c b/arch/blackfin/mach-bf527/boards/eth_mac.c
deleted file mode 100644
index a725cc8a9290..000000000000
--- a/arch/blackfin/mach-bf527/boards/eth_mac.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/blackfin/mach-bf537/board/eth_mac.c
3 *
4 * Copyright (C) 2007 Analog Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/module.h>
21#include <asm/blackfin.h>
22
23#if defined(CONFIG_GENERIC_BOARD) || defined(CONFIG_BFIN537_STAMP)
24
25/*
26 * Currently the MAC address is saved in Flash by U-Boot
27 */
28#define FLASH_MAC 0x203f0000
29
30void get_bf537_ether_addr(char *addr)
31{
32 unsigned int flash_mac = (unsigned int) FLASH_MAC;
33 *(u32 *)(&(addr[0])) = bfin_read32(flash_mac);
34 flash_mac += 4;
35 *(u16 *)(&(addr[4])) = bfin_read16(flash_mac);
36}
37
38#else
39
40/*
41 * Provide MAC address function for other specific board setting
42 */
43void get_bf537_ether_addr(char *addr)
44{
45 printk(KERN_WARNING "%s: No valid Ethernet MAC address found\n", __FILE__);
46}
47
48#endif
49
50EXPORT_SYMBOL(get_bf537_ether_addr);
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index bf1bedcc8868..003e2ac654d8 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -35,17 +35,18 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/usb_sl811.h> 43#include <linux/usb/sl811.h>
44#include <asm/cplb.h> 44#include <asm/cplb.h>
45#include <asm/dma.h> 45#include <asm/dma.h>
46#include <asm/bfin5xx_spi.h> 46#include <asm/bfin5xx_spi.h>
47#include <asm/reboot.h> 47#include <asm/reboot.h>
48#include <asm/nand.h> 48#include <asm/nand.h>
49#include <asm/portmux.h>
49#include <linux/spi/ad7877.h> 50#include <linux/spi/ad7877.h>
50 51
51/* 52/*
@@ -450,6 +451,13 @@ static const struct ad7877_platform_data bfin_ad7877_ts_info = {
450}; 451};
451#endif 452#endif
452 453
454#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
455 && defined(CONFIG_SND_SOC_WM8731_SPI)
456static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
457 .enable_dma = 0,
458 .bits_per_word = 16,
459};
460#endif
453static struct spi_board_info bfin_spi_board_info[] __initdata = { 461static struct spi_board_info bfin_spi_board_info[] __initdata = {
454#if defined(CONFIG_MTD_M25P80) \ 462#if defined(CONFIG_MTD_M25P80) \
455 || defined(CONFIG_MTD_M25P80_MODULE) 463 || defined(CONFIG_MTD_M25P80_MODULE)
@@ -551,17 +559,29 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
551 .platform_data = &bfin_ad7877_ts_info, 559 .platform_data = &bfin_ad7877_ts_info,
552 .irq = IRQ_PF6, 560 .irq = IRQ_PF6,
553 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 561 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
554 .bus_num = 1, 562 .bus_num = 0,
555 .chip_select = 1, 563 .chip_select = 1,
556 .controller_data = &spi_ad7877_chip_info, 564 .controller_data = &spi_ad7877_chip_info,
557 }, 565 },
558#endif 566#endif
567#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
568 && defined(CONFIG_SND_SOC_WM8731_SPI)
569 {
570 .modalias = "wm8731",
571 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
572 .bus_num = 0,
573 .chip_select = 5,
574 .controller_data = &spi_wm8731_chip_info,
575 .mode = SPI_MODE_0,
576 },
577#endif
559}; 578};
560 579
561/* SPI controller data */ 580/* SPI controller data */
562static struct bfin5xx_spi_master bfin_spi0_info = { 581static struct bfin5xx_spi_master bfin_spi0_info = {
563 .num_chipselect = 8, 582 .num_chipselect = 8,
564 .enable_dma = 1, /* master has the ability to do dma transfer */ 583 .enable_dma = 1, /* master has the ability to do dma transfer */
584 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
565}; 585};
566 586
567/* SPI (0) */ 587/* SPI (0) */
@@ -788,3 +808,14 @@ void native_machine_restart(char *cmd)
788 if ((bfin_read_SYSCR() & 0x7) == 0x3) 808 if ((bfin_read_SYSCR() & 0x7) == 0x3)
789 bfin_gpio_reset_spi0_ssel1(); 809 bfin_gpio_reset_spi0_ssel1();
790} 810}
811
812/*
813 * Currently the MAC address is saved in Flash by U-Boot
814 */
815#define FLASH_MAC 0x203f0000
816void bfin_get_ether_addr(char *addr)
817{
818 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
819 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
820}
821EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf533/Kconfig b/arch/blackfin/mach-bf533/Kconfig
index 14297b3ed5c3..76beb75f12da 100644
--- a/arch/blackfin/mach-bf533/Kconfig
+++ b/arch/blackfin/mach-bf533/Kconfig
@@ -1,5 +1,7 @@
1if (BF533 || BF532 || BF531) 1if (BF533 || BF532 || BF531)
2 2
3source "arch/blackfin/mach-bf533/boards/Kconfig"
4
3menu "BF533/2/1 Specific Configuration" 5menu "BF533/2/1 Specific Configuration"
4 6
5comment "Interrupt Priority Assignment" 7comment "Interrupt Priority Assignment"
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index b941550f9568..6bcf4047f89c 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -36,20 +36,21 @@
36#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h> 37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39#include <linux/usb_isp1362.h> 39#include <linux/usb/isp1362.h>
40#endif 40#endif
41#include <linux/pata_platform.h> 41#include <linux/pata_platform.h>
42#include <linux/irq.h> 42#include <linux/irq.h>
43#include <asm/dma.h> 43#include <asm/dma.h>
44#include <asm/bfin5xx_spi.h> 44#include <asm/bfin5xx_spi.h>
45#include <asm/reboot.h> 45#include <asm/reboot.h>
46#include <asm/portmux.h>
46 47
47/* 48/*
48 * Name the Board for the /proc/cpuinfo 49 * Name the Board for the /proc/cpuinfo
49 */ 50 */
50const char bfin_board_name[] = "HV Sistemas H8606"; 51const char bfin_board_name[] = "HV Sistemas H8606";
51 52
52#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_BFIN_MODULE) 53#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
53static struct platform_device rtc_device = { 54static struct platform_device rtc_device = {
54 .name = "rtc-bfin", 55 .name = "rtc-bfin",
55 .id = -1, 56 .id = -1,
@@ -93,10 +94,6 @@ static struct resource smc91x_resources[] = {
93 .end = IRQ_PROG_INTB, 94 .end = IRQ_PROG_INTB,
94 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 95 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
95 }, { 96 }, {
96 /*
97 * denotes the flag pin and is used directly if
98 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
99 */
100 .start = IRQ_PF7, 97 .start = IRQ_PF7,
101 .end = IRQ_PF7, 98 .end = IRQ_PF7,
102 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 99 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
@@ -269,6 +266,7 @@ static struct resource bfin_spi0_resource[] = {
269static struct bfin5xx_spi_master bfin_spi0_info = { 266static struct bfin5xx_spi_master bfin_spi0_info = {
270 .num_chipselect = 8, 267 .num_chipselect = 8,
271 .enable_dma = 1, /* master has the ability to do dma transfer */ 268 .enable_dma = 1, /* master has the ability to do dma transfer */
269 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
272}; 270};
273 271
274static struct platform_device bfin_spi0_device = { 272static struct platform_device bfin_spi0_device = {
@@ -342,4 +340,4 @@ static int __init H8606_init(void)
342 return 0; 340 return 0;
343} 341}
344 342
345arch_initcall(H8606_init); \ No newline at end of file 343arch_initcall(H8606_init);
diff --git a/arch/blackfin/mach-bf533/boards/Kconfig b/arch/blackfin/mach-bf533/boards/Kconfig
new file mode 100644
index 000000000000..751de5110afc
--- /dev/null
+++ b/arch/blackfin/mach-bf533/boards/Kconfig
@@ -0,0 +1,34 @@
1choice
2 prompt "System type"
3 default BFIN533_STAMP
4 help
5 Select your board!
6
7config BFIN533_EZKIT
8 bool "BF533-EZKIT"
9 help
10 BF533-EZKIT-LITE board support.
11
12config BFIN533_STAMP
13 bool "BF533-STAMP"
14 help
15 BF533-STAMP board support.
16
17config BFIN533_BLUETECHNIX_CM
18 bool "Bluetechnix CM-BF533"
19 depends on (BF533)
20 help
21 CM-BF533 support for EVAL- and DEV-Board.
22
23config H8606_HVSISTEMAS
24 bool "HV Sistemas H8606"
25 depends on (BF532)
26 help
27 HV Sistemas H8606 board support.
28
29config GENERIC_BF533_BOARD
30 bool "Generic"
31 help
32 Generic or Custom board support.
33
34endchoice
diff --git a/arch/blackfin/mach-bf533/boards/Makefile b/arch/blackfin/mach-bf533/boards/Makefile
index 2452b456ccbd..54f57fb9791e 100644
--- a/arch/blackfin/mach-bf533/boards/Makefile
+++ b/arch/blackfin/mach-bf533/boards/Makefile
@@ -2,7 +2,7 @@
2# arch/blackfin/mach-bf533/boards/Makefile 2# arch/blackfin/mach-bf533/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BOARD) += generic_board.o 5obj-$(CONFIG_GENERIC_BF533_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN533_STAMP) += stamp.o 6obj-$(CONFIG_BFIN533_STAMP) += stamp.o
7obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o 7obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o
8obj-$(CONFIG_BFIN533_BLUETECHNIX_CM) += cm_bf533.o 8obj-$(CONFIG_BFIN533_BLUETECHNIX_CM) += cm_bf533.o
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index a863522a4467..21df2f375497 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -33,11 +33,12 @@
33#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb_isp1362.h> 36#include <linux/usb/isp1362.h>
37#include <linux/pata_platform.h> 37#include <linux/pata_platform.h>
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
41#include <asm/portmux.h>
41 42
42/* 43/*
43 * Name the Board for the /proc/cpuinfo 44 * Name the Board for the /proc/cpuinfo
@@ -175,6 +176,7 @@ static struct resource bfin_spi0_resource[] = {
175static struct bfin5xx_spi_master bfin_spi0_info = { 176static struct bfin5xx_spi_master bfin_spi0_info = {
176 .num_chipselect = 8, 177 .num_chipselect = 8,
177 .enable_dma = 1, /* master has the ability to do dma transfer */ 178 .enable_dma = 1, /* master has the ability to do dma transfer */
179 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
178}; 180};
179 181
180static struct platform_device bfin_spi0_device = { 182static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 34b63920e272..be852034a68b 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -34,11 +34,12 @@
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#include <linux/usb_isp1362.h> 37#include <linux/usb/isp1362.h>
38#include <linux/pata_platform.h> 38#include <linux/pata_platform.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <asm/dma.h> 40#include <asm/dma.h>
41#include <asm/bfin5xx_spi.h> 41#include <asm/bfin5xx_spi.h>
42#include <asm/portmux.h>
42 43
43/* 44/*
44 * Name the Board for the /proc/cpuinfo 45 * Name the Board for the /proc/cpuinfo
@@ -187,6 +188,7 @@ static struct resource bfin_spi0_resource[] = {
187static struct bfin5xx_spi_master bfin_spi0_info = { 188static struct bfin5xx_spi_master bfin_spi0_info = {
188 .num_chipselect = 8, 189 .num_chipselect = 8,
189 .enable_dma = 1, /* master has the ability to do dma transfer */ 190 .enable_dma = 1, /* master has the ability to do dma transfer */
191 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
190}; 192};
191 193
192static struct platform_device bfin_spi0_device = { 194static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf533/boards/generic_board.c b/arch/blackfin/mach-bf533/boards/generic_board.c
index 310b7772c458..e359a0d6467f 100644
--- a/arch/blackfin/mach-bf533/boards/generic_board.c
+++ b/arch/blackfin/mach-bf533/boards/generic_board.c
@@ -58,10 +58,6 @@ static struct resource smc91x_resources[] = {
58 .end = IRQ_PROG_INTB, 58 .end = IRQ_PROG_INTB,
59 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 59 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
60 }, { 60 }, {
61 /*
62 * denotes the flag pin and is used directly if
63 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
64 */
65 .start = IRQ_PF7, 61 .start = IRQ_PF7,
66 .end = IRQ_PF7, 62 .end = IRQ_PF7,
67 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 63 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 62ffa500420f..8fde8d832850 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -35,13 +35,14 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <asm/dma.h> 42#include <asm/dma.h>
43#include <asm/bfin5xx_spi.h> 43#include <asm/bfin5xx_spi.h>
44#include <asm/reboot.h> 44#include <asm/reboot.h>
45#include <asm/portmux.h>
45 46
46/* 47/*
47 * Name the Board for the /proc/cpuinfo 48 * Name the Board for the /proc/cpuinfo
@@ -286,6 +287,7 @@ static struct resource bfin_spi0_resource[] = {
286static struct bfin5xx_spi_master bfin_spi0_info = { 287static struct bfin5xx_spi_master bfin_spi0_info = {
287 .num_chipselect = 8, 288 .num_chipselect = 8,
288 .enable_dma = 1, /* master has the ability to do dma transfer */ 289 .enable_dma = 1, /* master has the ability to do dma transfer */
290 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
289}; 291};
290 292
291static struct platform_device bfin_spi0_device = { 293static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf537/Kconfig b/arch/blackfin/mach-bf537/Kconfig
index e6648db09519..8255374c04aa 100644
--- a/arch/blackfin/mach-bf537/Kconfig
+++ b/arch/blackfin/mach-bf537/Kconfig
@@ -1,5 +1,7 @@
1if (BF537 || BF534 || BF536) 1if (BF537 || BF534 || BF536)
2 2
3source "arch/blackfin/mach-bf537/boards/Kconfig"
4
3menu "BF537 Specific Configuration" 5menu "BF537 Specific Configuration"
4 6
5comment "Interrupt Priority Assignment" 7comment "Interrupt Priority Assignment"
diff --git a/arch/blackfin/mach-bf537/boards/Kconfig b/arch/blackfin/mach-bf537/boards/Kconfig
new file mode 100644
index 000000000000..96a15196e416
--- /dev/null
+++ b/arch/blackfin/mach-bf537/boards/Kconfig
@@ -0,0 +1,29 @@
1choice
2 prompt "System type"
3 default BFIN537_STAMP
4 help
5 Select your board!
6
7config BFIN537_STAMP
8 bool "BF537-STAMP"
9 help
10 BF537-STAMP board support.
11
12config BFIN537_BLUETECHNIX_CM
13 bool "Bluetechnix CM-BF537"
14 depends on (BF537)
15 help
16 CM-BF537 support for EVAL- and DEV-Board.
17
18config PNAV10
19 bool "PNAV board"
20 depends on (BF537)
21 help
22 PNAV board support.
23
24config GENERIC_BF537_BOARD
25 bool "Generic"
26 help
27 Generic or Custom board support.
28
29endchoice
diff --git a/arch/blackfin/mach-bf537/boards/Makefile b/arch/blackfin/mach-bf537/boards/Makefile
index 23323cacc3aa..94a85174283a 100644
--- a/arch/blackfin/mach-bf537/boards/Makefile
+++ b/arch/blackfin/mach-bf537/boards/Makefile
@@ -2,8 +2,7 @@
2# arch/blackfin/mach-bf537/boards/Makefile 2# arch/blackfin/mach-bf537/boards/Makefile
3# 3#
4 4
5obj-y += eth_mac.o 5obj-$(CONFIG_GENERIC_BF537_BOARD) += generic_board.o
6obj-$(CONFIG_GENERIC_BOARD) += generic_board.o 6obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o
7obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o 7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o
8obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o 8obj-$(CONFIG_PNAV10) += pnav10.o
9obj-$(CONFIG_PNAV10) += pnav10.o
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 2915931045e3..c0fb06dbc42e 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -34,11 +34,12 @@
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#include <linux/usb_isp1362.h> 37#include <linux/usb/isp1362.h>
38#include <linux/pata_platform.h> 38#include <linux/pata_platform.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <asm/dma.h> 40#include <asm/dma.h>
41#include <asm/bfin5xx_spi.h> 41#include <asm/bfin5xx_spi.h>
42#include <asm/portmux.h>
42 43
43/* 44/*
44 * Name the Board for the /proc/cpuinfo 45 * Name the Board for the /proc/cpuinfo
@@ -194,6 +195,7 @@ static struct resource bfin_spi0_resource[] = {
194static struct bfin5xx_spi_master bfin_spi0_info = { 195static struct bfin5xx_spi_master bfin_spi0_info = {
195 .num_chipselect = 8, 196 .num_chipselect = 8,
196 .enable_dma = 1, /* master has the ability to do dma transfer */ 197 .enable_dma = 1, /* master has the ability to do dma transfer */
198 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
197}; 199};
198 200
199static struct platform_device bfin_spi0_device = { 201static struct platform_device bfin_spi0_device = {
@@ -425,3 +427,10 @@ static int __init cm_bf537_init(void)
425} 427}
426 428
427arch_initcall(cm_bf537_init); 429arch_initcall(cm_bf537_init);
430
431void bfin_get_ether_addr(char *addr)
432{
433 random_ether_addr(addr);
434 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
435}
436EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/eth_mac.c b/arch/blackfin/mach-bf537/boards/eth_mac.c
deleted file mode 100644
index a725cc8a9290..000000000000
--- a/arch/blackfin/mach-bf537/boards/eth_mac.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/blackfin/mach-bf537/board/eth_mac.c
3 *
4 * Copyright (C) 2007 Analog Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/module.h>
21#include <asm/blackfin.h>
22
23#if defined(CONFIG_GENERIC_BOARD) || defined(CONFIG_BFIN537_STAMP)
24
25/*
26 * Currently the MAC address is saved in Flash by U-Boot
27 */
28#define FLASH_MAC 0x203f0000
29
30void get_bf537_ether_addr(char *addr)
31{
32 unsigned int flash_mac = (unsigned int) FLASH_MAC;
33 *(u32 *)(&(addr[0])) = bfin_read32(flash_mac);
34 flash_mac += 4;
35 *(u16 *)(&(addr[4])) = bfin_read16(flash_mac);
36}
37
38#else
39
40/*
41 * Provide MAC address function for other specific board setting
42 */
43void get_bf537_ether_addr(char *addr)
44{
45 printk(KERN_WARNING "%s: No valid Ethernet MAC address found\n", __FILE__);
46}
47
48#endif
49
50EXPORT_SYMBOL(get_bf537_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 255da7a98481..09f4bfbd2350 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -35,7 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
@@ -44,6 +44,7 @@
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 46#include <asm/reboot.h>
47#include <asm/portmux.h>
47#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
48 49
49/* 50/*
@@ -502,7 +503,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
502 .platform_data = &bfin_ad7877_ts_info, 503 .platform_data = &bfin_ad7877_ts_info,
503 .irq = IRQ_PF6, 504 .irq = IRQ_PF6,
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 505 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
505 .bus_num = 1, 506 .bus_num = 0,
506 .chip_select = 1, 507 .chip_select = 1,
507 .controller_data = &spi_ad7877_chip_info, 508 .controller_data = &spi_ad7877_chip_info,
508 }, 509 },
@@ -513,6 +514,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
513static struct bfin5xx_spi_master bfin_spi0_info = { 514static struct bfin5xx_spi_master bfin_spi0_info = {
514 .num_chipselect = 8, 515 .num_chipselect = 8,
515 .enable_dma = 1, /* master has the ability to do dma transfer */ 516 .enable_dma = 1, /* master has the ability to do dma transfer */
517 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
516}; 518};
517 519
518/* SPI (0) */ 520/* SPI (0) */
@@ -730,3 +732,10 @@ void native_machine_restart(char *cmd)
730 if ((bfin_read_SYSCR() & 0x7) == 0x3) 732 if ((bfin_read_SYSCR() & 0x7) == 0x3)
731 bfin_gpio_reset_spi0_ssel1(); 733 bfin_gpio_reset_spi0_ssel1();
732} 734}
735
736void bfin_get_ether_addr(char *addr)
737{
738 random_ether_addr(addr);
739 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
740}
741EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 87b808926789..fd5f4a6f08e4 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -35,11 +35,12 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/irq.h> 40#include <linux/irq.h>
41#include <asm/dma.h> 41#include <asm/dma.h>
42#include <asm/bfin5xx_spi.h> 42#include <asm/bfin5xx_spi.h>
43#include <asm/portmux.h>
43#include <linux/usb/sl811.h> 44#include <linux/usb/sl811.h>
44 45
45#include <linux/spi/ad7877.h> 46#include <linux/spi/ad7877.h>
@@ -295,7 +296,7 @@ static struct bfin5xx_spi_chip spi_mmc_chip_info = {
295 296
296#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 297#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
297static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 298static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
298 .cs_change_per_word = 1, 299 .cs_change_per_word = 0,
299 .enable_dma = 0, 300 .enable_dma = 0,
300 .bits_per_word = 16, 301 .bits_per_word = 16,
301}; 302};
@@ -387,7 +388,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
387 .platform_data = &bfin_ad7877_ts_info, 388 .platform_data = &bfin_ad7877_ts_info,
388 .irq = IRQ_PF2, 389 .irq = IRQ_PF2,
389 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 390 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
390 .bus_num = 1, 391 .bus_num = 0,
391 .chip_select = 5, 392 .chip_select = 5,
392 .controller_data = &spi_ad7877_chip_info, 393 .controller_data = &spi_ad7877_chip_info,
393}, 394},
@@ -413,6 +414,7 @@ static struct resource bfin_spi0_resource[] = {
413static struct bfin5xx_spi_master bfin_spi0_info = { 414static struct bfin5xx_spi_master bfin_spi0_info = {
414 .num_chipselect = 8, 415 .num_chipselect = 8,
415 .enable_dma = 1, /* master has the ability to do dma transfer */ 416 .enable_dma = 1, /* master has the ability to do dma transfer */
417 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
416}; 418};
417 419
418static struct platform_device bfin_spi0_device = { 420static struct platform_device bfin_spi0_device = {
@@ -508,3 +510,10 @@ static int __init stamp_init(void)
508} 510}
509 511
510arch_initcall(stamp_init); 512arch_initcall(stamp_init);
513
514void bfin_get_ether_addr(char *addr)
515{
516 random_ether_addr(addr);
517 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
518}
519EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 5f7b91fbafe8..07b0dc273d2f 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -35,7 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 36#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h> 38#include <linux/usb/isp1362.h>
39#endif 39#endif
40#include <linux/pata_platform.h> 40#include <linux/pata_platform.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
@@ -44,6 +44,7 @@
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h> 46#include <asm/reboot.h>
47#include <asm/portmux.h>
47#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
48 49
49/* 50/*
@@ -182,6 +183,28 @@ static struct platform_device dm9000_device = {
182}; 183};
183#endif 184#endif
184 185
186#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
187static struct resource ax88180_resources[] = {
188 [0] = {
189 .start = 0x20300000,
190 .end = 0x20300000 + 0x8000,
191 .flags = IORESOURCE_MEM,
192 },
193 [1] = {
194 .start = IRQ_PF7,
195 .end = IRQ_PF7,
196 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
197 },
198};
199
200static struct platform_device ax88180_device = {
201 .name = "ax88180",
202 .id = -1,
203 .num_resources = ARRAY_SIZE(ax88180_resources),
204 .resource = ax88180_resources,
205};
206#endif
207
185#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) 208#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
186static struct resource sl811_hcd_resources[] = { 209static struct resource sl811_hcd_resources[] = {
187 { 210 {
@@ -502,7 +525,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
502 .platform_data = &bfin_ad7877_ts_info, 525 .platform_data = &bfin_ad7877_ts_info,
503 .irq = IRQ_PF6, 526 .irq = IRQ_PF6,
504 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ 527 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
505 .bus_num = 1, 528 .bus_num = 0,
506 .chip_select = 1, 529 .chip_select = 1,
507 .controller_data = &spi_ad7877_chip_info, 530 .controller_data = &spi_ad7877_chip_info,
508 }, 531 },
@@ -513,6 +536,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
513static struct bfin5xx_spi_master bfin_spi0_info = { 536static struct bfin5xx_spi_master bfin_spi0_info = {
514 .num_chipselect = 8, 537 .num_chipselect = 8,
515 .enable_dma = 1, /* master has the ability to do dma transfer */ 538 .enable_dma = 1, /* master has the ability to do dma transfer */
539 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
516}; 540};
517 541
518/* SPI (0) */ 542/* SPI (0) */
@@ -554,15 +578,20 @@ static struct platform_device bfin_fb_adv7393_device = {
554 578
555#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 579#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
556static struct resource bfin_uart_resources[] = { 580static struct resource bfin_uart_resources[] = {
581#ifdef CONFIG_SERIAL_BFIN_UART0
557 { 582 {
558 .start = 0xFFC00400, 583 .start = 0xFFC00400,
559 .end = 0xFFC004FF, 584 .end = 0xFFC004FF,
560 .flags = IORESOURCE_MEM, 585 .flags = IORESOURCE_MEM,
561 }, { 586 },
587#endif
588#ifdef CONFIG_SERIAL_BFIN_UART1
589 {
562 .start = 0xFFC02000, 590 .start = 0xFFC02000,
563 .end = 0xFFC020FF, 591 .end = 0xFFC020FF,
564 .flags = IORESOURCE_MEM, 592 .flags = IORESOURCE_MEM,
565 }, 593 },
594#endif
566}; 595};
567 596
568static struct platform_device bfin_uart_device = { 597static struct platform_device bfin_uart_device = {
@@ -669,6 +698,10 @@ static struct platform_device *stamp_devices[] __initdata = {
669 &dm9000_device, 698 &dm9000_device,
670#endif 699#endif
671 700
701#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
702 &ax88180_device,
703#endif
704
672#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 705#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
673 &bfin_mac_device, 706 &bfin_mac_device,
674#endif 707#endif
@@ -730,3 +763,14 @@ void native_machine_restart(char *cmd)
730 if ((bfin_read_SYSCR() & 0x7) == 0x3) 763 if ((bfin_read_SYSCR() & 0x7) == 0x3)
731 bfin_gpio_reset_spi0_ssel1(); 764 bfin_gpio_reset_spi0_ssel1();
732} 765}
766
767/*
768 * Currently the MAC address is saved in Flash by U-Boot
769 */
770#define FLASH_MAC 0x203f0000
771void bfin_get_ether_addr(char *addr)
772{
773 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
774 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
775}
776EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf548/Kconfig b/arch/blackfin/mach-bf548/Kconfig
index 08d8dc83701c..d8bd3b49f150 100644
--- a/arch/blackfin/mach-bf548/Kconfig
+++ b/arch/blackfin/mach-bf548/Kconfig
@@ -1,5 +1,7 @@
1if (BF54x) 1if (BF54x)
2 2
3source "arch/blackfin/mach-bf548/boards/Kconfig"
4
3menu "BF548 Specific Configuration" 5menu "BF548 Specific Configuration"
4 6
5config DEB_DMA_URGENT 7config DEB_DMA_URGENT
diff --git a/arch/blackfin/mach-bf548/boards/Kconfig b/arch/blackfin/mach-bf548/boards/Kconfig
new file mode 100644
index 000000000000..057129064037
--- /dev/null
+++ b/arch/blackfin/mach-bf548/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN548_EZKIT
4 help
5 Select your board!
6
7config BFIN548_EZKIT
8 bool "BF548-EZKIT"
9 help
10 BFIN548-EZKIT board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf548/boards/Makefile b/arch/blackfin/mach-bf548/boards/Makefile
index 486e07c99a51..a444cc739578 100644
--- a/arch/blackfin/mach-bf548/boards/Makefile
+++ b/arch/blackfin/mach-bf548/boards/Makefile
@@ -2,4 +2,4 @@
2# arch/blackfin/mach-bf548/boards/Makefile 2# arch/blackfin/mach-bf548/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_BFIN548_EZKIT) += ezkit.o led.o 5obj-$(CONFIG_BFIN548_EZKIT) += ezkit.o led.o
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 6b6490e66b30..d37d6653c4bc 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -42,6 +42,7 @@
42#include <asm/dma.h> 42#include <asm/dma.h>
43#include <asm/gpio.h> 43#include <asm/gpio.h>
44#include <asm/nand.h> 44#include <asm/nand.h>
45#include <asm/portmux.h>
45#include <asm/mach/bf54x_keys.h> 46#include <asm/mach/bf54x_keys.h>
46#include <linux/input.h> 47#include <linux/input.h>
47#include <linux/spi/ad7877.h> 48#include <linux/spi/ad7877.h>
@@ -377,7 +378,7 @@ static struct bfin5xx_spi_chip spi_flash_chip_info = {
377 378
378#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) 379#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
379static struct bfin5xx_spi_chip spi_ad7877_chip_info = { 380static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
380 .cs_change_per_word = 1, 381 .cs_change_per_word = 0,
381 .enable_dma = 0, 382 .enable_dma = 0,
382 .bits_per_word = 16, 383 .bits_per_word = 16,
383}; 384};
@@ -453,9 +454,10 @@ static struct resource bfin_spi1_resource[] = {
453}; 454};
454 455
455/* SPI controller data */ 456/* SPI controller data */
456static struct bfin5xx_spi_master bf54x_spi_master_info = { 457static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
457 .num_chipselect = 8, 458 .num_chipselect = 8,
458 .enable_dma = 1, /* master has the ability to do dma transfer */ 459 .enable_dma = 1, /* master has the ability to do dma transfer */
460 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
459}; 461};
460 462
461static struct platform_device bf54x_spi_master0 = { 463static struct platform_device bf54x_spi_master0 = {
@@ -464,17 +466,23 @@ static struct platform_device bf54x_spi_master0 = {
464 .num_resources = ARRAY_SIZE(bfin_spi0_resource), 466 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
465 .resource = bfin_spi0_resource, 467 .resource = bfin_spi0_resource,
466 .dev = { 468 .dev = {
467 .platform_data = &bf54x_spi_master_info, /* Passed to driver */ 469 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
468 }, 470 },
469}; 471};
470 472
473static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
474 .num_chipselect = 8,
475 .enable_dma = 1, /* master has the ability to do dma transfer */
476 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
477};
478
471static struct platform_device bf54x_spi_master1 = { 479static struct platform_device bf54x_spi_master1 = {
472 .name = "bfin-spi", 480 .name = "bfin-spi",
473 .id = 1, /* Bus number */ 481 .id = 1, /* Bus number */
474 .num_resources = ARRAY_SIZE(bfin_spi1_resource), 482 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
475 .resource = bfin_spi1_resource, 483 .resource = bfin_spi1_resource,
476 .dev = { 484 .dev = {
477 .platform_data = &bf54x_spi_master_info, /* Passed to driver */ 485 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
478 }, 486 },
479}; 487};
480#endif /* spi master and devices */ 488#endif /* spi master and devices */
@@ -500,6 +508,7 @@ static struct platform_device i2c_bfin_twi0_device = {
500 .resource = bfin_twi0_resource, 508 .resource = bfin_twi0_resource,
501}; 509};
502 510
511#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
503static struct resource bfin_twi1_resource[] = { 512static struct resource bfin_twi1_resource[] = {
504 [0] = { 513 [0] = {
505 .start = TWI1_REGBASE, 514 .start = TWI1_REGBASE,
@@ -520,6 +529,7 @@ static struct platform_device i2c_bfin_twi1_device = {
520 .resource = bfin_twi1_resource, 529 .resource = bfin_twi1_resource,
521}; 530};
522#endif 531#endif
532#endif
523 533
524static struct platform_device *ezkit_devices[] __initdata = { 534static struct platform_device *ezkit_devices[] __initdata = {
525#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 535#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
@@ -569,8 +579,10 @@ static struct platform_device *ezkit_devices[] __initdata = {
569 579
570#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 580#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
571 &i2c_bfin_twi0_device, 581 &i2c_bfin_twi0_device,
582#if !defined(CONFIG_BF542)
572 &i2c_bfin_twi1_device, 583 &i2c_bfin_twi1_device,
573#endif 584#endif
585#endif
574}; 586};
575 587
576static int __init stamp_init(void) 588static int __init stamp_init(void)
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
index 3071c243d426..74b34c7f3629 100644
--- a/arch/blackfin/mach-bf548/head.S
+++ b/arch/blackfin/mach-bf548/head.S
@@ -158,6 +158,27 @@ ENTRY(__stext)
158 w[p2] = r0; 158 w[p2] = r0;
159 ssync; 159 ssync;
160 160
161 p2.h = hi(EBIU_MBSCTL);
162 p2.l = lo(EBIU_MBSCTL);
163 r0.h = hi(CONFIG_EBIU_MBSCTLVAL);
164 r0.l = lo(CONFIG_EBIU_MBSCTLVAL);
165 [p2] = r0;
166 ssync;
167
168 p2.h = hi(EBIU_MODE);
169 p2.l = lo(EBIU_MODE);
170 r0.h = hi(CONFIG_EBIU_MODEVAL);
171 r0.l = lo(CONFIG_EBIU_MODEVAL);
172 [p2] = r0;
173 ssync;
174
175 p2.h = hi(EBIU_FCTL);
176 p2.l = lo(EBIU_FCTL);
177 r0.h = hi(CONFIG_EBIU_FCTLVAL);
178 r0.l = lo(CONFIG_EBIU_FCTLVAL);
179 [p2] = r0;
180 ssync;
181
161 /* This section keeps the processor in supervisor mode 182 /* This section keeps the processor in supervisor mode
162 * during kernel boot. Switches to user mode at end of boot. 183 * during kernel boot. Switches to user mode at end of boot.
163 * See page 3-9 of Hardware Reference manual for documentation. 184 * See page 3-9 of Hardware Reference manual for documentation.
diff --git a/arch/blackfin/mach-bf561/Kconfig b/arch/blackfin/mach-bf561/Kconfig
index 0a17c4cf0059..3f4895450bea 100644
--- a/arch/blackfin/mach-bf561/Kconfig
+++ b/arch/blackfin/mach-bf561/Kconfig
@@ -1,4 +1,6 @@
1if BF561 1if (BF561)
2
3source "arch/blackfin/mach-bf561/boards/Kconfig"
2 4
3menu "BF561 Specific Configuration" 5menu "BF561 Specific Configuration"
4 6
diff --git a/arch/blackfin/mach-bf561/boards/Kconfig b/arch/blackfin/mach-bf561/boards/Kconfig
new file mode 100644
index 000000000000..e41a67b1fb53
--- /dev/null
+++ b/arch/blackfin/mach-bf561/boards/Kconfig
@@ -0,0 +1,27 @@
1choice
2 prompt "System type"
3 default BFIN561_EZKIT
4 help
5 Select your board!
6
7config BFIN561_EZKIT
8 bool "BF561-EZKIT"
9 help
10 BF561-EZKIT-LITE board support.
11
12config BFIN561_TEPLA
13 bool "BF561-TEPLA"
14 help
15 BF561-TEPLA board support.
16
17config BFIN561_BLUETECHNIX_CM
18 bool "Bluetechnix CM-BF561"
19 help
20 CM-BF561 support for EVAL- and DEV-Board.
21
22config GENERIC_BF561_BOARD
23 bool "Generic"
24 help
25 Generic or Custom board support.
26
27endchoice
diff --git a/arch/blackfin/mach-bf561/boards/Makefile b/arch/blackfin/mach-bf561/boards/Makefile
index 495a1cf9d452..04add010b568 100644
--- a/arch/blackfin/mach-bf561/boards/Makefile
+++ b/arch/blackfin/mach-bf561/boards/Makefile
@@ -2,7 +2,7 @@
2# arch/blackfin/mach-bf561/boards/Makefile 2# arch/blackfin/mach-bf561/boards/Makefile
3# 3#
4 4
5obj-$(CONFIG_GENERIC_BOARD) += generic_board.o 5obj-$(CONFIG_GENERIC_BF561_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN561_BLUETECHNIX_CM) += cm_bf561.o 6obj-$(CONFIG_BFIN561_BLUETECHNIX_CM) += cm_bf561.o
7obj-$(CONFIG_BFIN561_EZKIT) += ezkit.o 7obj-$(CONFIG_BFIN561_EZKIT) += ezkit.o
8obj-$(CONFIG_BFIN561_TEPLA) += tepla.o 8obj-$(CONFIG_BFIN561_TEPLA) += tepla.o
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 97aeb43fd8b4..c19cd29b948a 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -33,11 +33,12 @@
33#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
34#include <linux/spi/spi.h> 34#include <linux/spi/spi.h>
35#include <linux/spi/flash.h> 35#include <linux/spi/flash.h>
36#include <linux/usb_isp1362.h> 36#include <linux/usb/isp1362.h>
37#include <linux/pata_platform.h> 37#include <linux/pata_platform.h>
38#include <linux/irq.h> 38#include <linux/irq.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/bfin5xx_spi.h> 40#include <asm/bfin5xx_spi.h>
41#include <asm/portmux.h>
41 42
42/* 43/*
43 * Name the Board for the /proc/cpuinfo 44 * Name the Board for the /proc/cpuinfo
@@ -182,6 +183,7 @@ static struct resource bfin_spi0_resource[] = {
182static struct bfin5xx_spi_master bfin_spi0_info = { 183static struct bfin5xx_spi_master bfin_spi0_info = {
183 .num_chipselect = 8, 184 .num_chipselect = 8,
184 .enable_dma = 1, /* master has the ability to do dma transfer */ 185 .enable_dma = 1, /* master has the ability to do dma transfer */
186 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
185}; 187};
186 188
187static struct platform_device bfin_spi0_device = { 189static struct platform_device bfin_spi0_device = {
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 059d516cec23..4ff8f6e7a11f 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -35,6 +35,7 @@
35#include <linux/pata_platform.h> 35#include <linux/pata_platform.h>
36#include <asm/dma.h> 36#include <asm/dma.h>
37#include <asm/bfin5xx_spi.h> 37#include <asm/bfin5xx_spi.h>
38#include <asm/portmux.h>
38 39
39/* 40/*
40 * Name the Board for the /proc/cpuinfo 41 * Name the Board for the /proc/cpuinfo
@@ -115,6 +116,28 @@ static struct platform_device smc91x_device = {
115}; 116};
116#endif 117#endif
117 118
119#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
120static struct resource ax88180_resources[] = {
121 [0] = {
122 .start = 0x2c000000,
123 .end = 0x2c000000 + 0x8000,
124 .flags = IORESOURCE_MEM,
125 },
126 [1] = {
127 .start = IRQ_PF10,
128 .end = IRQ_PF10,
129 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
130 },
131};
132
133static struct platform_device ax88180_device = {
134 .name = "ax88180",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(ax88180_resources),
137 .resource = ax88180_resources,
138};
139#endif
140
118#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 141#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
119static struct resource bfin_uart_resources[] = { 142static struct resource bfin_uart_resources[] = {
120 { 143 {
@@ -160,6 +183,7 @@ static struct resource bfin_spi0_resource[] = {
160static struct bfin5xx_spi_master bfin_spi0_info = { 183static struct bfin5xx_spi_master bfin_spi0_info = {
161 .num_chipselect = 8, 184 .num_chipselect = 8,
162 .enable_dma = 1, /* master has the ability to do dma transfer */ 185 .enable_dma = 1, /* master has the ability to do dma transfer */
186 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
163}; 187};
164 188
165static struct platform_device bfin_spi0_device = { 189static struct platform_device bfin_spi0_device = {
@@ -226,6 +250,11 @@ static struct platform_device *ezkit_devices[] __initdata = {
226#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 250#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
227 &smc91x_device, 251 &smc91x_device,
228#endif 252#endif
253
254#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
255 &ax88180_device,
256#endif
257
229#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 258#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
230 &bfin_spi0_device, 259 &bfin_spi0_device,
231#endif 260#endif
diff --git a/arch/blackfin/mach-bf561/boards/generic_board.c b/arch/blackfin/mach-bf561/boards/generic_board.c
index 46816be4b2ba..fc80c5d059f8 100644
--- a/arch/blackfin/mach-bf561/boards/generic_board.c
+++ b/arch/blackfin/mach-bf561/boards/generic_board.c
@@ -48,10 +48,6 @@ static struct resource smc91x_resources[] = {
48 .end = IRQ_PROG_INTB, 48 .end = IRQ_PROG_INTB,
49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 49 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
50 }, { 50 }, {
51 /*
52 * denotes the flag pin and is used directly if
53 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
54 */
55 .start = IRQ_PF9, 51 .start = IRQ_PF9,
56 .end = IRQ_PF9, 52 .end = IRQ_PF9,
57 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 53 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
diff --git a/arch/blackfin/mach-bf561/boards/tepla.c b/arch/blackfin/mach-bf561/boards/tepla.c
index 4a17c6da2a59..ec6a2207c202 100644
--- a/arch/blackfin/mach-bf561/boards/tepla.c
+++ b/arch/blackfin/mach-bf561/boards/tepla.c
@@ -31,10 +31,6 @@ static struct resource smc91x_resources[] = {
31 .end = IRQ_PROG_INTB, 31 .end = IRQ_PROG_INTB,
32 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL, 32 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
33 }, { 33 }, {
34 /*
35 * denotes the flag pin and is used directly if
36 * CONFIG_IRQCHIP_DEMUX_GPIO is defined.
37 */
38 .start = IRQ_PF7, 34 .start = IRQ_PF7,
39 .end = IRQ_PF7, 35 .end = IRQ_PF7,
40 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL, 36 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
diff --git a/arch/blackfin/mach-common/cplbinfo.c b/arch/blackfin/mach-common/cplbinfo.c
index 785ca9816971..a4f0b428a34d 100644
--- a/arch/blackfin/mach-common/cplbinfo.c
+++ b/arch/blackfin/mach-common/cplbinfo.c
@@ -91,7 +91,7 @@ static char *cplb_print_entry(char *buf, int type)
91 } else 91 } else
92 buf += sprintf(buf, "Data CPLB entry:\n"); 92 buf += sprintf(buf, "Data CPLB entry:\n");
93 93
94 buf += sprintf(buf, "Address\t\tData\tSize\tValid\tLocked\tSwapin\n\tiCount\toCount\n"); 94 buf += sprintf(buf, "Address\t\tData\tSize\tValid\tLocked\tSwapin\tiCount\toCount\n");
95 95
96 while (*p_addr != 0xffffffff) { 96 while (*p_addr != 0xffffffff) {
97 entry = cplb_find_entry(cplb_addr, cplb_data, *p_addr, *p_data); 97 entry = cplb_find_entry(cplb_addr, cplb_data, *p_addr, *p_data);
diff --git a/arch/blackfin/mach-common/cplbmgr.S b/arch/blackfin/mach-common/cplbmgr.S
index 946703ef48ff..6f909cbfac7b 100644
--- a/arch/blackfin/mach-common/cplbmgr.S
+++ b/arch/blackfin/mach-common/cplbmgr.S
@@ -73,7 +73,7 @@ ENTRY(_cplb_mgr)
73 /* ICPLB Miss Exception. We need to choose one of the 73 /* ICPLB Miss Exception. We need to choose one of the
74 * currently-installed CPLBs, and replace it with one 74 * currently-installed CPLBs, and replace it with one
75 * from the configuration table. 75 * from the configuration table.
76 */ 76 */
77 77
78 P4.L = LO(ICPLB_FAULT_ADDR); 78 P4.L = LO(ICPLB_FAULT_ADDR);
79 P4.H = HI(ICPLB_FAULT_ADDR); 79 P4.H = HI(ICPLB_FAULT_ADDR);
@@ -222,7 +222,7 @@ ENTRY(_cplb_mgr)
222 222
223 /* See if failed address > start address */ 223 /* See if failed address > start address */
224 CC = R4 <= R0(IU); 224 CC = R4 <= R0(IU);
225 IF !CC JUMP .Linext; 225 IF !CC JUMP .Linext;
226 226
227 /* extract page size (17:16)*/ 227 /* extract page size (17:16)*/
228 R3 = EXTRACT(R2, R1.L) (Z); 228 R3 = EXTRACT(R2, R1.L) (Z);
@@ -271,16 +271,27 @@ ENTRY(_cplb_mgr)
271 271
272/* FAILED CASES*/ 272/* FAILED CASES*/
273.Lno_page_in_table: 273.Lno_page_in_table:
274 ( R7:4,P5:3 ) = [SP++];
275 R0 = CPLB_NO_ADDR_MATCH; 274 R0 = CPLB_NO_ADDR_MATCH;
276 RTS; 275 JUMP .Lfail_ret;
276
277.Lall_locked: 277.Lall_locked:
278 ( R7:4,P5:3 ) = [SP++];
279 R0 = CPLB_NO_UNLOCKED; 278 R0 = CPLB_NO_UNLOCKED;
280 RTS; 279 JUMP .Lfail_ret;
280
281.Lprot_violation: 281.Lprot_violation:
282 ( R7:4,P5:3 ) = [SP++];
283 R0 = CPLB_PROT_VIOL; 282 R0 = CPLB_PROT_VIOL;
283
284.Lfail_ret:
285 /* Make sure we turn protection/cache back on, even in the failing case */
286 BITSET(R5,ENICPLB_P);
287 CLI R2;
288 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
289 .align 8;
290 [P4] = R5;
291 SSYNC;
292 STI R2;
293
294 ( R7:4,P5:3 ) = [SP++];
284 RTS; 295 RTS;
285 296
286.Ldcplb_write: 297.Ldcplb_write:
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 1b13fa470977..dc9d3ee2e691 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -33,7 +33,7 @@
33 * after a timer-interrupt and after each system call. 33 * after a timer-interrupt and after each system call.
34 */ 34 */
35 35
36 36#include <linux/init.h>
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <linux/unistd.h> 38#include <linux/unistd.h>
39#include <asm/blackfin.h> 39#include <asm/blackfin.h>
@@ -71,25 +71,44 @@ ENDPROC(_safe_speculative_execution)
71 * This one does not lower the level to IRQ5, and thus can be used to 71 * This one does not lower the level to IRQ5, and thus can be used to
72 * patch up CPLB misses on the kernel stack. 72 * patch up CPLB misses on the kernel stack.
73 */ 73 */
74ENTRY(_ex_dcplb)
75#if ANOMALY_05000261 74#if ANOMALY_05000261
75#define _ex_dviol _ex_workaround_261
76#define _ex_dmiss _ex_workaround_261
77#define _ex_dmult _ex_workaround_261
78
79ENTRY(_ex_workaround_261)
76 /* 80 /*
77 * Work around an anomaly: if we see a new DCPLB fault, return 81 * Work around an anomaly: if we see a new DCPLB fault, return
78 * without doing anything. Then, if we get the same fault again, 82 * without doing anything. Then, if we get the same fault again,
79 * handle it. 83 * handle it.
80 */ 84 */
85 P4 = R7; /* Store EXCAUSE */
81 p5.l = _last_cplb_fault_retx; 86 p5.l = _last_cplb_fault_retx;
82 p5.h = _last_cplb_fault_retx; 87 p5.h = _last_cplb_fault_retx;
83 r7 = [p5]; 88 r7 = [p5];
84 r6 = retx; 89 r6 = retx;
85 [p5] = r6; 90 [p5] = r6;
86 cc = r6 == r7; 91 cc = r6 == r7;
87 if !cc jump _return_from_exception; 92 if !cc jump _bfin_return_from_exception;
88 /* fall through */ 93 /* fall through */
94 R7 = P4;
95 R6 = 0x26; /* Data CPLB Miss */
96 cc = R6 == R7;
97 if cc jump _ex_dcplb_miss (BP);
98 /* Handle 0x23 Data CPLB Protection Violation
99 * and Data CPLB Multiple Hits - Linux Trap Zero
100 */
101 jump _ex_trap_c;
102ENDPROC(_ex_workaround_261)
103
104#else
105#define _ex_dviol _ex_trap_c
106#define _ex_dmiss _ex_dcplb_miss
107#define _ex_dmult _ex_trap_c
89#endif 108#endif
90ENDPROC(_ex_dcplb)
91 109
92ENTRY(_ex_icplb) 110ENTRY(_ex_dcplb_miss)
111ENTRY(_ex_icplb_miss)
93 (R7:6,P5:4) = [sp++]; 112 (R7:6,P5:4) = [sp++];
94 ASTAT = [sp++]; 113 ASTAT = [sp++];
95 SAVE_ALL_SYS 114 SAVE_ALL_SYS
@@ -98,7 +117,7 @@ ENTRY(_ex_icplb)
98 RESTORE_ALL_SYS 117 RESTORE_ALL_SYS
99 SP = EX_SCRATCH_REG; 118 SP = EX_SCRATCH_REG;
100 rtx; 119 rtx;
101ENDPROC(_ex_icplb) 120ENDPROC(_ex_icplb_miss)
102 121
103ENTRY(_ex_syscall) 122ENTRY(_ex_syscall)
104 DEBUG_START_HWTRACE(p5, r7) 123 DEBUG_START_HWTRACE(p5, r7)
@@ -120,7 +139,7 @@ ENTRY(_ex_single_step)
120 r7 = retx; 139 r7 = retx;
121 r6 = reti; 140 r6 = reti;
122 cc = r7 == r6; 141 cc = r7 == r6;
123 if cc jump _return_from_exception 142 if cc jump _bfin_return_from_exception
124 r7 = syscfg; 143 r7 = syscfg;
125 bitclr (r7, 0); 144 bitclr (r7, 0);
126 syscfg = R7; 145 syscfg = R7;
@@ -137,8 +156,9 @@ ENTRY(_ex_single_step)
137 r7 = [p4]; 156 r7 = [p4];
138 cc = r6 == r7; 157 cc = r6 == r7;
139 if !cc jump _ex_trap_c; 158 if !cc jump _ex_trap_c;
159ENDPROC(_ex_single_step)
140 160
141ENTRY(_return_from_exception) 161ENTRY(_bfin_return_from_exception)
142 DEBUG_START_HWTRACE(p5, r7) 162 DEBUG_START_HWTRACE(p5, r7)
143#if ANOMALY_05000257 163#if ANOMALY_05000257
144 R7=LC0; 164 R7=LC0;
@@ -150,7 +170,7 @@ ENTRY(_return_from_exception)
150 ASTAT = [sp++]; 170 ASTAT = [sp++];
151 sp = EX_SCRATCH_REG; 171 sp = EX_SCRATCH_REG;
152 rtx; 172 rtx;
153ENDPROC(_ex_soft_bp) 173ENDPROC(_bfin_return_from_exception)
154 174
155ENTRY(_handle_bad_cplb) 175ENTRY(_handle_bad_cplb)
156 /* To get here, we just tried and failed to change a CPLB 176 /* To get here, we just tried and failed to change a CPLB
@@ -843,7 +863,7 @@ ENTRY(_ex_trace_buff_full)
843 LC0 = [sp++]; 863 LC0 = [sp++];
844 P2 = [sp++]; 864 P2 = [sp++];
845 P3 = [sp++]; 865 P3 = [sp++];
846 jump _return_from_exception; 866 jump _bfin_return_from_exception;
847ENDPROC(_ex_trace_buff_full) 867ENDPROC(_ex_trace_buff_full)
848 868
849#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4 869#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
@@ -861,7 +881,7 @@ ENTRY(_software_trace_buff)
861#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */ 881#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
862 882
863#if CONFIG_EARLY_PRINTK 883#if CONFIG_EARLY_PRINTK
864.section .init.text 884__INIT
865ENTRY(_early_trap) 885ENTRY(_early_trap)
866 SAVE_ALL_SYS 886 SAVE_ALL_SYS
867 trace_buffer_stop(p0,r0); 887 trace_buffer_stop(p0,r0);
@@ -896,6 +916,7 @@ ENTRY(_early_trap)
896 call _early_trap_c; 916 call _early_trap_c;
897 SP += 12; 917 SP += 12;
898ENDPROC(_early_trap) 918ENDPROC(_early_trap)
919__FINIT
899#endif /* CONFIG_EARLY_PRINTK */ 920#endif /* CONFIG_EARLY_PRINTK */
900 921
901/* 922/*
@@ -908,6 +929,7 @@ ENDPROC(_early_trap)
908#else 929#else
909.data 930.data
910#endif 931#endif
932
911ENTRY(_ex_table) 933ENTRY(_ex_table)
912 /* entry for each EXCAUSE[5:0] 934 /* entry for each EXCAUSE[5:0]
913 * This table must be in sync with the table in ./kernel/traps.c 935 * This table must be in sync with the table in ./kernel/traps.c
@@ -952,16 +974,16 @@ ENTRY(_ex_table)
952 .long _ex_trap_c /* 0x20 - Reserved */ 974 .long _ex_trap_c /* 0x20 - Reserved */
953 .long _ex_trap_c /* 0x21 - Undefined Instruction */ 975 .long _ex_trap_c /* 0x21 - Undefined Instruction */
954 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */ 976 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
955 .long _ex_dcplb /* 0x23 - Data CPLB Protection Violation */ 977 .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
956 .long _ex_trap_c /* 0x24 - Data access misaligned */ 978 .long _ex_trap_c /* 0x24 - Data access misaligned */
957 .long _ex_trap_c /* 0x25 - Unrecoverable Event */ 979 .long _ex_trap_c /* 0x25 - Unrecoverable Event */
958 .long _ex_dcplb /* 0x26 - Data CPLB Miss */ 980 .long _ex_dmiss /* 0x26 - Data CPLB Miss */
959 .long _ex_trap_c /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */ 981 .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
960 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */ 982 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
961 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */ 983 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
962 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */ 984 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
963 .long _ex_icplb /* 0x2B - Instruction CPLB protection Violation */ 985 .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
964 .long _ex_icplb /* 0x2C - Instruction CPLB miss */ 986 .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
965 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */ 987 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
966 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ 988 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
967 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ 989 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index c6b32fe0f6e9..4de376418a18 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -30,7 +30,6 @@
30 30
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33#include <linux/autoconf.h>
34#include <linux/linkage.h> 33#include <linux/linkage.h>
35#include <asm/entry.h> 34#include <asm/entry.h>
36#include <asm/asm-offsets.h> 35#include <asm/asm-offsets.h>
diff --git a/arch/blackfin/mach-common/ints-priority-dc.c b/arch/blackfin/mach-common/ints-priority-dc.c
index c2f05fabedc1..4882f0e801a9 100644
--- a/arch/blackfin/mach-common/ints-priority-dc.c
+++ b/arch/blackfin/mach-common/ints-priority-dc.c
@@ -181,7 +181,6 @@ static struct irq_chip bf561_internal_irqchip = {
181 .unmask = bf561_internal_unmask_irq, 181 .unmask = bf561_internal_unmask_irq,
182}; 182};
183 183
184#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
185static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)]; 184static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
186static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)]; 185static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
187 186
@@ -362,8 +361,6 @@ static void bf561_demux_gpio_irq(unsigned int inta_irq,
362 361
363} 362}
364 363
365#endif /* CONFIG_IRQCHIP_DEMUX_GPIO */
366
367void __init init_exception_vectors(void) 364void __init init_exception_vectors(void)
368{ 365{
369 SSYNC(); 366 SSYNC();
@@ -413,26 +410,21 @@ int __init init_arch_irq(void)
413 set_irq_chip(irq, &bf561_core_irqchip); 410 set_irq_chip(irq, &bf561_core_irqchip);
414 else 411 else
415 set_irq_chip(irq, &bf561_internal_irqchip); 412 set_irq_chip(irq, &bf561_internal_irqchip);
416#ifdef CONFIG_IRQCHIP_DEMUX_GPIO 413
417 if ((irq != IRQ_PROG0_INTA) && 414 if ((irq != IRQ_PROG0_INTA) &&
418 (irq != IRQ_PROG1_INTA) && (irq != IRQ_PROG2_INTA)) { 415 (irq != IRQ_PROG1_INTA) &&
419#endif 416 (irq != IRQ_PROG2_INTA))
420 set_irq_handler(irq, handle_simple_irq); 417 set_irq_handler(irq, handle_simple_irq);
421#ifdef CONFIG_IRQCHIP_DEMUX_GPIO 418 else
422 } else {
423 set_irq_chained_handler(irq, bf561_demux_gpio_irq); 419 set_irq_chained_handler(irq, bf561_demux_gpio_irq);
424 }
425#endif
426
427 } 420 }
428 421
429#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
430 for (irq = IRQ_PF0; irq <= IRQ_PF47; irq++) { 422 for (irq = IRQ_PF0; irq <= IRQ_PF47; irq++) {
431 set_irq_chip(irq, &bf561_gpio_irqchip); 423 set_irq_chip(irq, &bf561_gpio_irqchip);
432 /* if configured as edge, then will be changed to do_edge_IRQ */ 424 /* if configured as edge, then will be changed to do_edge_IRQ */
433 set_irq_handler(irq, handle_level_irq); 425 set_irq_handler(irq, handle_level_irq);
434 } 426 }
435#endif 427
436 bfin_write_IMASK(0); 428 bfin_write_IMASK(0);
437 CSYNC(); 429 CSYNC();
438 ilat = bfin_read_ILAT(); 430 ilat = bfin_read_ILAT();
@@ -457,9 +449,8 @@ int __init init_arch_irq(void)
457} 449}
458 450
459#ifdef CONFIG_DO_IRQ_L1 451#ifdef CONFIG_DO_IRQ_L1
460void do_irq(int vec, struct pt_regs *fp)__attribute__((l1_text)); 452__attribute__((l1_text))
461#endif 453#endif
462
463void do_irq(int vec, struct pt_regs *fp) 454void do_irq(int vec, struct pt_regs *fp)
464{ 455{
465 if (vec == EVT_IVTMR_P) { 456 if (vec == EVT_IVTMR_P) {
diff --git a/arch/blackfin/mach-common/ints-priority-sc.c b/arch/blackfin/mach-common/ints-priority-sc.c
index 2d2b63567b30..147f0731087a 100644
--- a/arch/blackfin/mach-common/ints-priority-sc.c
+++ b/arch/blackfin/mach-common/ints-priority-sc.c
@@ -308,7 +308,7 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
308} 308}
309#endif /* BF537_GENERIC_ERROR_INT_DEMUX */ 309#endif /* BF537_GENERIC_ERROR_INT_DEMUX */
310 310
311#if defined(CONFIG_IRQCHIP_DEMUX_GPIO) && !defined(CONFIG_BF54x) 311#if !defined(CONFIG_BF54x)
312 312
313static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)]; 313static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
314static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)]; 314static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
@@ -464,7 +464,7 @@ static void bfin_demux_gpio_irq(unsigned int intb_irq,
464 } 464 }
465} 465}
466 466
467#else /* CONFIG_IRQCHIP_DEMUX_GPIO */ 467#else /* CONFIG_BF54x */
468 468
469#define NR_PINT_SYS_IRQS 4 469#define NR_PINT_SYS_IRQS 4
470#define NR_PINT_BITS 32 470#define NR_PINT_BITS 32
@@ -726,7 +726,7 @@ static void bfin_demux_gpio_irq(unsigned int intb_irq,
726 } 726 }
727 727
728} 728}
729#endif /* CONFIG_IRQCHIP_DEMUX_GPIO */ 729#endif
730 730
731void __init init_exception_vectors(void) 731void __init init_exception_vectors(void)
732{ 732{
@@ -766,10 +766,10 @@ int __init init_arch_irq(void)
766 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); 766 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL);
767 bfin_write_SIC_IWR0(IWR_ENABLE_ALL); 767 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
768 bfin_write_SIC_IWR1(IWR_ENABLE_ALL); 768 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
769#ifdef CONFIG_BF54x 769# ifdef CONFIG_BF54x
770 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 770 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
771 bfin_write_SIC_IWR2(IWR_ENABLE_ALL); 771 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
772#endif 772# endif
773#else 773#else
774 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 774 bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
775 bfin_write_SIC_IWR(IWR_ENABLE_ALL); 775 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
@@ -778,13 +778,13 @@ int __init init_arch_irq(void)
778 778
779 local_irq_disable(); 779 local_irq_disable();
780 780
781#if defined(CONFIG_IRQCHIP_DEMUX_GPIO) && defined(CONFIG_BF54x) 781#ifdef CONFIG_BF54x
782#ifdef CONFIG_PINTx_REASSIGN 782# ifdef CONFIG_PINTx_REASSIGN
783 pint[0]->assign = CONFIG_PINT0_ASSIGN; 783 pint[0]->assign = CONFIG_PINT0_ASSIGN;
784 pint[1]->assign = CONFIG_PINT1_ASSIGN; 784 pint[1]->assign = CONFIG_PINT1_ASSIGN;
785 pint[2]->assign = CONFIG_PINT2_ASSIGN; 785 pint[2]->assign = CONFIG_PINT2_ASSIGN;
786 pint[3]->assign = CONFIG_PINT3_ASSIGN; 786 pint[3]->assign = CONFIG_PINT3_ASSIGN;
787#endif 787# endif
788 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 788 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */
789 init_pint_lut(); 789 init_pint_lut();
790#endif 790#endif
@@ -799,18 +799,17 @@ int __init init_arch_irq(void)
799#endif 799#endif
800 800
801 switch (irq) { 801 switch (irq) {
802#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
803#if defined(CONFIG_BF53x) 802#if defined(CONFIG_BF53x)
804 case IRQ_PROG_INTA: 803 case IRQ_PROG_INTA:
805 set_irq_chained_handler(irq, 804 set_irq_chained_handler(irq,
806 bfin_demux_gpio_irq); 805 bfin_demux_gpio_irq);
807 break; 806 break;
808#if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) 807# if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE))
809 case IRQ_MAC_RX: 808 case IRQ_MAC_RX:
810 set_irq_chained_handler(irq, 809 set_irq_chained_handler(irq,
811 bfin_demux_gpio_irq); 810 bfin_demux_gpio_irq);
812 break; 811 break;
813#endif 812# endif
814#elif defined(CONFIG_BF54x) 813#elif defined(CONFIG_BF54x)
815 case IRQ_PINT0: 814 case IRQ_PINT0:
816 set_irq_chained_handler(irq, 815 set_irq_chained_handler(irq,
@@ -842,7 +841,6 @@ int __init init_arch_irq(void)
842 bfin_demux_gpio_irq); 841 bfin_demux_gpio_irq);
843 break; 842 break;
844#endif 843#endif
845#endif
846 default: 844 default:
847 set_irq_handler(irq, handle_simple_irq); 845 set_irq_handler(irq, handle_simple_irq);
848 break; 846 break;
@@ -861,7 +859,6 @@ int __init init_arch_irq(void)
861 } 859 }
862#endif 860#endif
863 861
864#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
865#ifndef CONFIG_BF54x 862#ifndef CONFIG_BF54x
866 for (irq = IRQ_PF0; irq < NR_IRQS; irq++) { 863 for (irq = IRQ_PF0; irq < NR_IRQS; irq++) {
867#else 864#else
@@ -871,7 +868,7 @@ int __init init_arch_irq(void)
871 /* if configured as edge, then will be changed to do_edge_IRQ */ 868 /* if configured as edge, then will be changed to do_edge_IRQ */
872 set_irq_handler(irq, handle_level_irq); 869 set_irq_handler(irq, handle_level_irq);
873 } 870 }
874#endif 871
875 bfin_write_IMASK(0); 872 bfin_write_IMASK(0);
876 CSYNC(); 873 CSYNC();
877 ilat = bfin_read_ILAT(); 874 ilat = bfin_read_ILAT();
@@ -896,9 +893,8 @@ int __init init_arch_irq(void)
896} 893}
897 894
898#ifdef CONFIG_DO_IRQ_L1 895#ifdef CONFIG_DO_IRQ_L1
899void do_irq(int vec, struct pt_regs *fp) __attribute__((l1_text)); 896__attribute__((l1_text))
900#endif 897#endif
901
902void do_irq(int vec, struct pt_regs *fp) 898void do_irq(int vec, struct pt_regs *fp)
903{ 899{
904 if (vec == EVT_IVTMR_P) { 900 if (vec == EVT_IVTMR_P) {
diff --git a/arch/blackfin/mach-common/irqpanic.c b/arch/blackfin/mach-common/irqpanic.c
index f05e3dadaf33..b22959b197e5 100644
--- a/arch/blackfin/mach-common/irqpanic.c
+++ b/arch/blackfin/mach-common/irqpanic.c
@@ -153,27 +153,29 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs)
153 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): /* System MMR Error */ 153 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): /* System MMR Error */
154 info.si_code = BUS_ADRALN; 154 info.si_code = BUS_ADRALN;
155 sig = SIGBUS; 155 sig = SIGBUS;
156 printk(KERN_EMERG HWC_x2); 156 printk(KERN_EMERG HWC_x2(KERN_EMERG));
157 break; 157 break;
158 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): /* External Memory Addressing Error */ 158 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): /* External Memory Addressing Error */
159 info.si_code = BUS_ADRERR; 159 info.si_code = BUS_ADRERR;
160 sig = SIGBUS; 160 sig = SIGBUS;
161 printk(KERN_EMERG HWC_x3); 161 printk(KERN_EMERG HWC_x3(KERN_EMERG));
162 break; 162 break;
163 case (SEQSTAT_HWERRCAUSE_PERF_FLOW): /* Performance Monitor Overflow */ 163 case (SEQSTAT_HWERRCAUSE_PERF_FLOW): /* Performance Monitor Overflow */
164 printk(KERN_EMERG HWC_x12); 164 printk(KERN_EMERG HWC_x12(KERN_EMERG));
165 break; 165 break;
166 case (SEQSTAT_HWERRCAUSE_RAISE_5): /* RAISE 5 instruction */ 166 case (SEQSTAT_HWERRCAUSE_RAISE_5): /* RAISE 5 instruction */
167 printk(KERN_EMERG HWC_x18); 167 printk(KERN_EMERG HWC_x18(KERN_EMERG));
168 break; 168 break;
169 default: /* Reserved */ 169 default: /* Reserved */
170 printk(KERN_EMERG HWC_default); 170 printk(KERN_EMERG HWC_default(KERN_EMERG));
171 break; 171 break;
172 } 172 }
173 } 173 }
174 174
175 regs->ipend = bfin_read_IPEND(); 175 regs->ipend = bfin_read_IPEND();
176 dump_bfin_regs(regs, (void *)regs->pc); 176 dump_bfin_process(regs);
177 dump_bfin_mem((void *)regs->pc);
178 show_regs(regs);
177 if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */ 179 if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */
178 panic("Unhandled IRQ or exceptions!\n"); 180 panic("Unhandled IRQ or exceptions!\n");
179 else { /* in userspace */ 181 else { /* in userspace */
diff --git a/arch/blackfin/mm/blackfin_sram.c b/arch/blackfin/mm/blackfin_sram.c
index b99ea883cd22..e41f0e8ecacb 100644
--- a/arch/blackfin/mm/blackfin_sram.c
+++ b/arch/blackfin/mm/blackfin_sram.c
@@ -27,7 +27,6 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30#include <linux/autoconf.h>
31#include <linux/module.h> 30#include <linux/module.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
33#include <linux/types.h> 32#include <linux/types.h>
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index faf8b4d3ca01..e3c0f2928149 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -542,45 +542,6 @@ config ETRAX_RS485_DISABLE_RECEIVER
542 loopback. Not all products are able to do this in software only. 542 loopback. Not all products are able to do this in software only.
543 Axis 2400/2401 must disable receiver. 543 Axis 2400/2401 must disable receiver.
544 544
545config ETRAX_IDE
546 bool "ATA/IDE support"
547 select IDE
548 select BLK_DEV_IDE
549 select BLK_DEV_IDEDISK
550 select BLK_DEV_IDECD
551 select BLK_DEV_IDEDMA
552 select IDE_GENERIC
553 help
554 Enable this to get support for ATA/IDE.
555 You can't use parallel ports or SCSI ports
556 at the same time.
557
558
559config ETRAX_IDE_DELAY
560 int "Delay for drives to regain consciousness"
561 depends on ETRAX_IDE
562 default 15
563 help
564 Number of seconds to wait for IDE drives to spin up after an IDE
565 reset.
566choice
567 prompt "IDE reset pin"
568 depends on ETRAX_IDE
569 default ETRAX_IDE_PB7_RESET
570
571config ETRAX_IDE_PB7_RESET
572 bool "Port_PB_Bit_7"
573 help
574 IDE reset on pin 7 on port B
575
576config ETRAX_IDE_G27_RESET
577 bool "Port_G_Bit_27"
578 help
579 IDE reset on pin 27 on port G
580
581endchoice
582
583
584config ETRAX_USB_HOST 545config ETRAX_USB_HOST
585 bool "USB host" 546 bool "USB host"
586 select USB 547 select USB
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 7f72d7c9e1ce..9bccb5e2a960 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -582,18 +582,6 @@ config ETRAX_PE_CHANGEABLE_BITS
582 that a user can change the value on using ioctl's. 582 that a user can change the value on using ioctl's.
583 Bit set = changeable. 583 Bit set = changeable.
584 584
585config ETRAX_IDE
586 bool "ATA/IDE support"
587 depends on ETRAX_ARCH_V32
588 select IDE
589 select BLK_DEV_IDE
590 select BLK_DEV_IDEDISK
591 select BLK_DEV_IDECD
592 select BLK_DEV_IDEDMA
593 select IDE_GENERIC
594 help
595 Enables the ETRAX IDE driver.
596
597config ETRAX_CARDBUS 585config ETRAX_CARDBUS
598 bool "Cardbus support" 586 bool "Cardbus support"
599 depends on ETRAX_ARCH_V32 587 depends on ETRAX_ARCH_V32
diff --git a/arch/frv/kernel/break.S b/arch/frv/kernel/break.S
index dac4a5f68c2e..bd0bdf908d93 100644
--- a/arch/frv/kernel/break.S
+++ b/arch/frv/kernel/break.S
@@ -63,7 +63,7 @@ __break_trace_through_exceptions:
63# entry point for Break Exceptions/Interrupts 63# entry point for Break Exceptions/Interrupts
64# 64#
65############################################################################### 65###############################################################################
66 .text 66 .section .text.break
67 .balign 4 67 .balign 4
68 .globl __entry_break 68 .globl __entry_break
69__entry_break: 69__entry_break:
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 1e74f3c5cee2..f926c7094776 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -38,7 +38,7 @@
38 38
39#define nr_syscalls ((syscall_table_size)/4) 39#define nr_syscalls ((syscall_table_size)/4)
40 40
41 .text 41 .section .text.entry
42 .balign 4 42 .balign 4
43 43
44.macro LEDS val 44.macro LEDS val
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index 3b71e0c86399..a17a81d58bf6 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -76,6 +76,12 @@ SECTIONS
76 *(.data.init_task) 76 *(.data.init_task)
77 } 77 }
78 78
79 . = ALIGN(4096);
80 .data.page_aligned : { *(.data.idt) }
81
82 . = ALIGN(L1_CACHE_BYTES);
83 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
84
79 .trap : { 85 .trap : {
80 /* trap table management - read entry-table.S before modifying */ 86 /* trap table management - read entry-table.S before modifying */
81 . = ALIGN(8192); 87 . = ALIGN(8192);
@@ -86,28 +92,25 @@ SECTIONS
86 *(.trap.break) 92 *(.trap.break)
87 } 93 }
88 94
89 . = ALIGN(4096);
90 .data.page_aligned : { *(.data.idt) }
91
92 . = ALIGN(L1_CACHE_BYTES);
93 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
94
95 /* Text and read-only data */ 95 /* Text and read-only data */
96 . = ALIGN(4); 96 . = ALIGN(4);
97 _text = .; 97 _text = .;
98 _stext = .; 98 _stext = .;
99 .text : { 99 .text : {
100 *( 100 *(.text.start)
101 .text.start .text.* 101 *(.text.entry)
102 *(.text.break)
103 *(.text.tlbmiss)
104 TEXT_TEXT
105 SCHED_TEXT
106 LOCK_TEXT
102#ifdef CONFIG_DEBUG_INFO 107#ifdef CONFIG_DEBUG_INFO
108 *(
103 .init.text 109 .init.text
104 .exit.text 110 .exit.text
105 .exitcall.exit 111 .exitcall.exit
106#endif
107 ) 112 )
108 TEXT_TEXT 113#endif
109 SCHED_TEXT
110 LOCK_TEXT
111 *(.fixup) 114 *(.fixup)
112 *(.gnu.warning) 115 *(.gnu.warning)
113 *(.exitcall.exit) 116 *(.exitcall.exit)
diff --git a/arch/frv/mm/tlb-miss.S b/arch/frv/mm/tlb-miss.S
index 04da67468378..07643482cad2 100644
--- a/arch/frv/mm/tlb-miss.S
+++ b/arch/frv/mm/tlb-miss.S
@@ -16,7 +16,7 @@
16#include <asm/highmem.h> 16#include <asm/highmem.h>
17#include <asm/spr-regs.h> 17#include <asm/spr-regs.h>
18 18
19 .section .text 19 .section .text.tlbmiss
20 .balign 4 20 .balign 4
21 21
22 .globl __entry_insn_mmu_miss 22 .globl __entry_insn_mmu_miss
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index a753d79c4e89..18124542a6eb 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -36,7 +36,7 @@ sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
36 unsigned long r2, unsigned long r3, unsigned long r4, 36 unsigned long r2, unsigned long r3, unsigned long r4,
37 unsigned long r5, unsigned long r6, struct pt_regs *regs) 37 unsigned long r5, unsigned long r6, struct pt_regs *regs)
38{ 38{
39 sigset_t saveset, newset; 39 sigset_t newset;
40 40
41 /* XXX: Don't preclude handling different sized sigset_t's. */ 41 /* XXX: Don't preclude handling different sized sigset_t's. */
42 if (sigsetsize != sizeof(sigset_t)) 42 if (sigsetsize != sizeof(sigset_t))
@@ -44,21 +44,18 @@ sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
44 44
45 if (copy_from_user(&newset, unewset, sizeof(newset))) 45 if (copy_from_user(&newset, unewset, sizeof(newset)))
46 return -EFAULT; 46 return -EFAULT;
47 sigdelsetmask(&newset, ~_BLOCKABLE); 47 sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP));
48 48
49 spin_lock_irq(&current->sighand->siglock); 49 spin_lock_irq(&current->sighand->siglock);
50 saveset = current->blocked; 50 current->saved_sigmask = current->blocked;
51 current->blocked = newset; 51 current->blocked = newset;
52 recalc_sigpending(); 52 recalc_sigpending();
53 spin_unlock_irq(&current->sighand->siglock); 53 spin_unlock_irq(&current->sighand->siglock);
54 54
55 regs->r0 = -EINTR; 55 current->state = TASK_INTERRUPTIBLE;
56 while (1) { 56 schedule();
57 current->state = TASK_INTERRUPTIBLE; 57 set_thread_flag(TIF_RESTORE_SIGMASK);
58 schedule(); 58 return -ERESTARTNOHAND;
59 if (do_signal(regs, &saveset))
60 return regs->r0;
61 }
62} 59}
63 60
64asmlinkage int 61asmlinkage int
diff --git a/arch/m32r/kernel/syscall_table.S b/arch/m32r/kernel/syscall_table.S
index 751ac2a3d120..95aa79874847 100644
--- a/arch/m32r/kernel/syscall_table.S
+++ b/arch/m32r/kernel/syscall_table.S
@@ -284,3 +284,43 @@ ENTRY(sys_call_table)
284 .long sys_mq_getsetattr 284 .long sys_mq_getsetattr
285 .long sys_ni_syscall /* reserved for kexec */ 285 .long sys_ni_syscall /* reserved for kexec */
286 .long sys_waitid 286 .long sys_waitid
287 .long sys_ni_syscall /* 285 */ /* available */
288 .long sys_add_key
289 .long sys_request_key
290 .long sys_keyctl
291 .long sys_ioprio_set
292 .long sys_ioprio_get /* 290 */
293 .long sys_inotify_init
294 .long sys_inotify_add_watch
295 .long sys_inotify_rm_watch
296 .long sys_migrate_pages
297 .long sys_openat /* 295 */
298 .long sys_mkdirat
299 .long sys_mknodat
300 .long sys_fchownat
301 .long sys_futimesat
302 .long sys_fstatat64 /* 300 */
303 .long sys_unlinkat
304 .long sys_renameat
305 .long sys_linkat
306 .long sys_symlinkat
307 .long sys_readlinkat /* 305 */
308 .long sys_fchmodat
309 .long sys_faccessat
310 .long sys_pselect6
311 .long sys_ppoll
312 .long sys_unshare /* 310 */
313 .long sys_set_robust_list
314 .long sys_get_robust_list
315 .long sys_splice
316 .long sys_sync_file_range
317 .long sys_tee /* 315 */
318 .long sys_vmsplice
319 .long sys_move_pages
320 .long sys_getcpu
321 .long sys_epoll_pwait
322 .long sys_utimensat /* 320 */
323 .long sys_signalfd
324 .long sys_timerfd
325 .long sys_eventfd
326 .long sys_fallocate
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 880add120eb3..8a2a53b33616 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -565,7 +565,7 @@ void atari_kbd_leds(unsigned int leds)
565 565
566static int atari_keyb_done = 0; 566static int atari_keyb_done = 0;
567 567
568int __init atari_keyb_init(void) 568int atari_keyb_init(void)
569{ 569{
570 if (atari_keyb_done) 570 if (atari_keyb_done)
571 return 0; 571 return 0;
@@ -631,6 +631,7 @@ int __init atari_keyb_init(void)
631 atari_keyb_done = 1; 631 atari_keyb_done = 1;
632 return 0; 632 return 0;
633} 633}
634EXPORT_SYMBOL_GPL(atari_keyb_init);
634 635
635int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode) 636int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
636{ 637{
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2f2ce0c28bc0..455bd1f560aa 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -22,6 +22,7 @@ config MACH_ALCHEMY
22config BASLER_EXCITE 22config BASLER_EXCITE
23 bool "Basler eXcite smart camera" 23 bool "Basler eXcite smart camera"
24 select CEVT_R4K 24 select CEVT_R4K
25 select CSRC_R4K
25 select DMA_COHERENT 26 select DMA_COHERENT
26 select HW_HAS_PCI 27 select HW_HAS_PCI
27 select IRQ_CPU 28 select IRQ_CPU
@@ -49,6 +50,7 @@ config BASLER_EXCITE_PROTOTYPE
49config BCM47XX 50config BCM47XX
50 bool "BCM47XX based boards" 51 bool "BCM47XX based boards"
51 select CEVT_R4K 52 select CEVT_R4K
53 select CSRC_R4K
52 select DMA_NONCOHERENT 54 select DMA_NONCOHERENT
53 select HW_HAS_PCI 55 select HW_HAS_PCI
54 select IRQ_CPU 56 select IRQ_CPU
@@ -66,6 +68,7 @@ config BCM47XX
66config MIPS_COBALT 68config MIPS_COBALT
67 bool "Cobalt Server" 69 bool "Cobalt Server"
68 select CEVT_R4K 70 select CEVT_R4K
71 select CSRC_R4K
69 select CEVT_GT641XX 72 select CEVT_GT641XX
70 select DMA_NONCOHERENT 73 select DMA_NONCOHERENT
71 select HW_HAS_PCI 74 select HW_HAS_PCI
@@ -85,6 +88,7 @@ config MACH_DECSTATION
85 bool "DECstations" 88 bool "DECstations"
86 select BOOT_ELF32 89 select BOOT_ELF32
87 select CEVT_R4K 90 select CEVT_R4K
91 select CSRC_R4K
88 select DMA_NONCOHERENT 92 select DMA_NONCOHERENT
89 select NO_IOPORT 93 select NO_IOPORT
90 select IRQ_CPU 94 select IRQ_CPU
@@ -117,6 +121,7 @@ config MACH_JAZZ
117 select ARC32 121 select ARC32
118 select ARCH_MAY_HAVE_PC_FDC 122 select ARCH_MAY_HAVE_PC_FDC
119 select CEVT_R4K 123 select CEVT_R4K
124 select CSRC_R4K
120 select GENERIC_ISA_DMA 125 select GENERIC_ISA_DMA
121 select IRQ_CPU 126 select IRQ_CPU
122 select I8253 127 select I8253
@@ -137,6 +142,7 @@ config MACH_JAZZ
137config LASAT 142config LASAT
138 bool "LASAT Networks platforms" 143 bool "LASAT Networks platforms"
139 select CEVT_R4K 144 select CEVT_R4K
145 select CSRC_R4K
140 select DMA_NONCOHERENT 146 select DMA_NONCOHERENT
141 select SYS_HAS_EARLY_PRINTK 147 select SYS_HAS_EARLY_PRINTK
142 select HW_HAS_PCI 148 select HW_HAS_PCI
@@ -154,6 +160,7 @@ config LEMOTE_FULONG
154 bool "Lemote Fulong mini-PC" 160 bool "Lemote Fulong mini-PC"
155 select ARCH_SPARSEMEM_ENABLE 161 select ARCH_SPARSEMEM_ENABLE
156 select CEVT_R4K 162 select CEVT_R4K
163 select CSRC_R4K
157 select SYS_HAS_CPU_LOONGSON2 164 select SYS_HAS_CPU_LOONGSON2
158 select DMA_NONCOHERENT 165 select DMA_NONCOHERENT
159 select BOOT_ELF32 166 select BOOT_ELF32
@@ -179,6 +186,7 @@ config MIPS_ATLAS
179 bool "MIPS Atlas board" 186 bool "MIPS Atlas board"
180 select BOOT_ELF32 187 select BOOT_ELF32
181 select CEVT_R4K 188 select CEVT_R4K
189 select CSRC_R4K
182 select DMA_NONCOHERENT 190 select DMA_NONCOHERENT
183 select SYS_HAS_EARLY_PRINTK 191 select SYS_HAS_EARLY_PRINTK
184 select IRQ_CPU 192 select IRQ_CPU
@@ -210,6 +218,7 @@ config MIPS_MALTA
210 select ARCH_MAY_HAVE_PC_FDC 218 select ARCH_MAY_HAVE_PC_FDC
211 select BOOT_ELF32 219 select BOOT_ELF32
212 select CEVT_R4K 220 select CEVT_R4K
221 select CSRC_R4K
213 select DMA_NONCOHERENT 222 select DMA_NONCOHERENT
214 select GENERIC_ISA_DMA 223 select GENERIC_ISA_DMA
215 select IRQ_CPU 224 select IRQ_CPU
@@ -241,6 +250,7 @@ config MIPS_MALTA
241config MIPS_SEAD 250config MIPS_SEAD
242 bool "MIPS SEAD board" 251 bool "MIPS SEAD board"
243 select CEVT_R4K 252 select CEVT_R4K
253 select CSRC_R4K
244 select IRQ_CPU 254 select IRQ_CPU
245 select DMA_NONCOHERENT 255 select DMA_NONCOHERENT
246 select SYS_HAS_EARLY_PRINTK 256 select SYS_HAS_EARLY_PRINTK
@@ -260,6 +270,7 @@ config MIPS_SEAD
260config MIPS_SIM 270config MIPS_SIM
261 bool 'MIPS simulator (MIPSsim)' 271 bool 'MIPS simulator (MIPSsim)'
262 select CEVT_R4K 272 select CEVT_R4K
273 select CSRC_R4K
263 select DMA_NONCOHERENT 274 select DMA_NONCOHERENT
264 select SYS_HAS_EARLY_PRINTK 275 select SYS_HAS_EARLY_PRINTK
265 select IRQ_CPU 276 select IRQ_CPU
@@ -278,6 +289,7 @@ config MIPS_SIM
278config MARKEINS 289config MARKEINS
279 bool "NEC EMMA2RH Mark-eins" 290 bool "NEC EMMA2RH Mark-eins"
280 select CEVT_R4K 291 select CEVT_R4K
292 select CSRC_R4K
281 select DMA_NONCOHERENT 293 select DMA_NONCOHERENT
282 select HW_HAS_PCI 294 select HW_HAS_PCI
283 select IRQ_CPU 295 select IRQ_CPU
@@ -293,6 +305,7 @@ config MARKEINS
293config MACH_VR41XX 305config MACH_VR41XX
294 bool "NEC VR4100 series based machines" 306 bool "NEC VR4100 series based machines"
295 select CEVT_R4K 307 select CEVT_R4K
308 select CSRC_R4K
296 select SYS_HAS_CPU_VR41XX 309 select SYS_HAS_CPU_VR41XX
297 select GENERIC_HARDIRQS_NO__DO_IRQ 310 select GENERIC_HARDIRQS_NO__DO_IRQ
298 311
@@ -330,6 +343,7 @@ config PMC_MSP
330config PMC_YOSEMITE 343config PMC_YOSEMITE
331 bool "PMC-Sierra Yosemite eval board" 344 bool "PMC-Sierra Yosemite eval board"
332 select CEVT_R4K 345 select CEVT_R4K
346 select CSRC_R4K
333 select DMA_COHERENT 347 select DMA_COHERENT
334 select HW_HAS_PCI 348 select HW_HAS_PCI
335 select IRQ_CPU 349 select IRQ_CPU
@@ -351,6 +365,7 @@ config PMC_YOSEMITE
351config QEMU 365config QEMU
352 bool "Qemu" 366 bool "Qemu"
353 select CEVT_R4K 367 select CEVT_R4K
368 select CSRC_R4K
354 select DMA_COHERENT 369 select DMA_COHERENT
355 select GENERIC_ISA_DMA 370 select GENERIC_ISA_DMA
356 select HAVE_STD_PC_SERIAL_PORT 371 select HAVE_STD_PC_SERIAL_PORT
@@ -382,9 +397,11 @@ config SGI_IP22
382 select ARC32 397 select ARC32
383 select BOOT_ELF32 398 select BOOT_ELF32
384 select CEVT_R4K 399 select CEVT_R4K
400 select CSRC_R4K
385 select DMA_NONCOHERENT 401 select DMA_NONCOHERENT
386 select HW_HAS_EISA 402 select HW_HAS_EISA
387 select I8253 403 select I8253
404 select I8259
388 select IP22_CPU_SCACHE 405 select IP22_CPU_SCACHE
389 select IRQ_CPU 406 select IRQ_CPU
390 select GENERIC_ISA_DMA_SUPPORT_BROKEN 407 select GENERIC_ISA_DMA_SUPPORT_BROKEN
@@ -427,6 +444,7 @@ config SGI_IP32
427 select ARC32 444 select ARC32
428 select BOOT_ELF32 445 select BOOT_ELF32
429 select CEVT_R4K 446 select CEVT_R4K
447 select CSRC_R4K
430 select DMA_NONCOHERENT 448 select DMA_NONCOHERENT
431 select HW_HAS_PCI 449 select HW_HAS_PCI
432 select IRQ_CPU 450 select IRQ_CPU
@@ -498,6 +516,7 @@ config SIBYTE_SWARM
498 select SYS_SUPPORTS_HIGHMEM 516 select SYS_SUPPORTS_HIGHMEM
499 select SYS_SUPPORTS_KGDB 517 select SYS_SUPPORTS_KGDB
500 select SYS_SUPPORTS_LITTLE_ENDIAN 518 select SYS_SUPPORTS_LITTLE_ENDIAN
519 select ZONE_DMA32 if 64BIT
501 520
502config SIBYTE_LITTLESUR 521config SIBYTE_LITTLESUR
503 bool "Sibyte BCM91250C2-LittleSur" 522 bool "Sibyte BCM91250C2-LittleSur"
@@ -548,6 +567,7 @@ config SIBYTE_BIGSUR
548 select SYS_SUPPORTS_BIG_ENDIAN 567 select SYS_SUPPORTS_BIG_ENDIAN
549 select SYS_SUPPORTS_HIGHMEM 568 select SYS_SUPPORTS_HIGHMEM
550 select SYS_SUPPORTS_LITTLE_ENDIAN 569 select SYS_SUPPORTS_LITTLE_ENDIAN
570 select ZONE_DMA32 if 64BIT
551 571
552config SNI_RM 572config SNI_RM
553 bool "SNI RM200/300/400" 573 bool "SNI RM200/300/400"
@@ -556,6 +576,7 @@ config SNI_RM
556 select ARCH_MAY_HAVE_PC_FDC 576 select ARCH_MAY_HAVE_PC_FDC
557 select BOOT_ELF32 577 select BOOT_ELF32
558 select CEVT_R4K 578 select CEVT_R4K
579 select CSRC_R4K
559 select DMA_NONCOHERENT 580 select DMA_NONCOHERENT
560 select GENERIC_ISA_DMA 581 select GENERIC_ISA_DMA
561 select HW_HAS_EISA 582 select HW_HAS_EISA
@@ -599,6 +620,7 @@ config TOSHIBA_JMR3927
599config TOSHIBA_RBTX4927 620config TOSHIBA_RBTX4927
600 bool "Toshiba RBTX49[23]7 board" 621 bool "Toshiba RBTX49[23]7 board"
601 select CEVT_R4K 622 select CEVT_R4K
623 select CSRC_R4K
602 select CEVT_TXX9 624 select CEVT_TXX9
603 select DMA_NONCOHERENT 625 select DMA_NONCOHERENT
604 select HAS_TXX9_SERIAL 626 select HAS_TXX9_SERIAL
@@ -621,6 +643,7 @@ config TOSHIBA_RBTX4927
621config TOSHIBA_RBTX4938 643config TOSHIBA_RBTX4938
622 bool "Toshiba RBTX4938 board" 644 bool "Toshiba RBTX4938 board"
623 select CEVT_R4K 645 select CEVT_R4K
646 select CSRC_R4K
624 select CEVT_TXX9 647 select CEVT_TXX9
625 select DMA_NONCOHERENT 648 select DMA_NONCOHERENT
626 select HAS_TXX9_SERIAL 649 select HAS_TXX9_SERIAL
@@ -642,6 +665,7 @@ config TOSHIBA_RBTX4938
642config WR_PPMC 665config WR_PPMC
643 bool "Wind River PPMC board" 666 bool "Wind River PPMC board"
644 select CEVT_R4K 667 select CEVT_R4K
668 select CSRC_R4K
645 select IRQ_CPU 669 select IRQ_CPU
646 select BOOT_ELF32 670 select BOOT_ELF32
647 select DMA_NONCOHERENT 671 select DMA_NONCOHERENT
@@ -752,6 +776,9 @@ config CEVT_TXX9
752config CSRC_BCM1480 776config CSRC_BCM1480
753 bool 777 bool
754 778
779config CSRC_R4K
780 bool
781
755config CSRC_SB1250 782config CSRC_SB1250
756 bool 783 bool
757 784
@@ -1640,6 +1667,9 @@ config ARCH_DISCONTIGMEM_ENABLE
1640 or have huge holes in the physical address space for other reasons. 1667 or have huge holes in the physical address space for other reasons.
1641 See <file:Documentation/vm/numa> for more. 1668 See <file:Documentation/vm/numa> for more.
1642 1669
1670config ARCH_POPULATES_NODE_MAP
1671 def_bool y
1672
1643config ARCH_SPARSEMEM_ENABLE 1673config ARCH_SPARSEMEM_ENABLE
1644 bool 1674 bool
1645 select SPARSEMEM_STATIC 1675 select SPARSEMEM_STATIC
@@ -1945,6 +1975,9 @@ config I8253
1945config PCSPEAKER 1975config PCSPEAKER
1946 bool 1976 bool
1947 1977
1978config ZONE_DMA32
1979 bool
1980
1948source "drivers/pcmcia/Kconfig" 1981source "drivers/pcmcia/Kconfig"
1949 1982
1950source "drivers/pci/hotplug/Kconfig" 1983source "drivers/pci/hotplug/Kconfig"
diff --git a/arch/mips/au1000/Kconfig b/arch/mips/au1000/Kconfig
index b36cec58a9a8..05d1354aad3a 100644
--- a/arch/mips/au1000/Kconfig
+++ b/arch/mips/au1000/Kconfig
@@ -138,6 +138,7 @@ config SOC_AU1X00
138 bool 138 bool
139 select 64BIT_PHYS_ADDR 139 select 64BIT_PHYS_ADDR
140 select CEVT_R4K 140 select CEVT_R4K
141 select CSRC_R4K
141 select IRQ_CPU 142 select IRQ_CPU
142 select SYS_HAS_CPU_MIPS32_R1 143 select SYS_HAS_CPU_MIPS32_R1
143 select SYS_SUPPORTS_32BIT_KERNEL 144 select SYS_SUPPORTS_32BIT_KERNEL
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index b551535b7e48..ffa08362de17 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
14obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o 14obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
15obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o 15obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
16obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o 16obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
17obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o
17obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 18obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
18 19
19binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ 20binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
@@ -43,6 +44,7 @@ obj-$(CONFIG_CPU_TX49XX) += r4k_fpu.o r4k_switch.o
43obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o 44obj-$(CONFIG_CPU_VR41XX) += r4k_fpu.o r4k_switch.o
44 45
45obj-$(CONFIG_SMP) += smp.o 46obj-$(CONFIG_SMP) += smp.o
47obj-$(CONFIG_SMP_UP) += smp-up.o
46 48
47obj-$(CONFIG_MIPS_MT) += mips-mt.o 49obj-$(CONFIG_MIPS_MT) += mips-mt.o
48obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o 50obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index bab935a3d74b..24a2d907aa0d 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -219,7 +219,7 @@ static int c0_compare_int_usable(void)
219 return 1; 219 return 1;
220} 220}
221 221
222void __cpuinit mips_clockevent_init(void) 222int __cpuinit mips_clockevent_init(void)
223{ 223{
224 uint64_t mips_freq = mips_hpt_frequency; 224 uint64_t mips_freq = mips_hpt_frequency;
225 unsigned int cpu = smp_processor_id(); 225 unsigned int cpu = smp_processor_id();
@@ -227,7 +227,7 @@ void __cpuinit mips_clockevent_init(void)
227 unsigned int irq; 227 unsigned int irq;
228 228
229 if (!cpu_has_counter || !mips_hpt_frequency) 229 if (!cpu_has_counter || !mips_hpt_frequency)
230 return; 230 return -ENXIO;
231 231
232#ifdef CONFIG_MIPS_MT_SMTC 232#ifdef CONFIG_MIPS_MT_SMTC
233 setup_smtc_dummy_clockevent_device(); 233 setup_smtc_dummy_clockevent_device();
@@ -237,11 +237,11 @@ void __cpuinit mips_clockevent_init(void)
237 * device. 237 * device.
238 */ 238 */
239 if (cpu) 239 if (cpu)
240 return; 240 return 0;
241#endif 241#endif
242 242
243 if (!c0_compare_int_usable()) 243 if (!c0_compare_int_usable())
244 return; 244 return -ENXIO;
245 245
246 /* 246 /*
247 * With vectored interrupts things are getting platform specific. 247 * With vectored interrupts things are getting platform specific.
@@ -276,8 +276,8 @@ void __cpuinit mips_clockevent_init(void)
276 276
277 clockevents_register_device(cd); 277 clockevents_register_device(cd);
278 278
279 if (!cp0_timer_irq_installed) 279 if (cp0_timer_irq_installed)
280 return; 280 return 0;
281 281
282 cp0_timer_irq_installed = 1; 282 cp0_timer_irq_installed = 1;
283 283
@@ -287,4 +287,6 @@ void __cpuinit mips_clockevent_init(void)
287#else 287#else
288 setup_irq(irq, &c0_compare_irqaction); 288 setup_irq(irq, &c0_compare_irqaction);
289#endif 289#endif
290
291 return 0;
290} 292}
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
new file mode 100644
index 000000000000..0e2b5cd81f67
--- /dev/null
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -0,0 +1,33 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 by Ralf Baechle
7 */
8#include <linux/clocksource.h>
9#include <linux/init.h>
10
11#include <asm/time.h>
12
13static cycle_t c0_hpt_read(void)
14{
15 return read_c0_count();
16}
17
18static struct clocksource clocksource_mips = {
19 .name = "MIPS",
20 .read = c0_hpt_read,
21 .mask = CLOCKSOURCE_MASK(32),
22 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
23};
24
25void __init init_mips_clocksource(void)
26{
27 /* Calclate a somewhat reasonable rating value */
28 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
29
30 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
31
32 clocksource_register(&clocksource_mips);
33}
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a06a27d6cfcd..7f6ddcb5d485 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -269,7 +269,7 @@ static void __init bootmem_init(void)
269 269
270static void __init bootmem_init(void) 270static void __init bootmem_init(void)
271{ 271{
272 unsigned long reserved_end; 272 unsigned long init_begin, reserved_end;
273 unsigned long mapstart = ~0UL; 273 unsigned long mapstart = ~0UL;
274 unsigned long bootmap_size; 274 unsigned long bootmap_size;
275 int i; 275 int i;
@@ -342,6 +342,35 @@ static void __init bootmem_init(void)
342 */ 342 */
343 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart, 343 bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
344 min_low_pfn, max_low_pfn); 344 min_low_pfn, max_low_pfn);
345
346
347 init_begin = PFN_UP(__pa_symbol(&__init_begin));
348 for (i = 0; i < boot_mem_map.nr_map; i++) {
349 unsigned long start, end;
350
351 start = PFN_UP(boot_mem_map.map[i].addr);
352 end = PFN_DOWN(boot_mem_map.map[i].addr
353 + boot_mem_map.map[i].size);
354
355 if (start <= init_begin)
356 start = init_begin;
357 if (start >= end)
358 continue;
359
360#ifndef CONFIG_HIGHMEM
361 if (end > max_low_pfn)
362 end = max_low_pfn;
363
364 /*
365 * ... finally, is the area going away?
366 */
367 if (end <= start)
368 continue;
369#endif
370
371 add_active_range(0, start, end);
372 }
373
345 /* 374 /*
346 * Register fully available low RAM pages with the bootmem allocator. 375 * Register fully available low RAM pages with the bootmem allocator.
347 */ 376 */
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
new file mode 100644
index 000000000000..ead6c30eeb14
--- /dev/null
+++ b/arch/mips/kernel/smp-up.c
@@ -0,0 +1,67 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006, 07 by Ralf Baechle (ralf@linux-mips.org)
7 *
8 * Symmetric Uniprocessor (TM) Support
9 */
10#include <linux/kernel.h>
11#include <linux/sched.h>
12
13/*
14 * Send inter-processor interrupt
15 */
16void up_send_ipi_single(int cpu, unsigned int action)
17{
18 panic(KERN_ERR "%s called", __func__);
19}
20
21static inline void up_send_ipi_mask(cpumask_t mask, unsigned int action)
22{
23 panic(KERN_ERR "%s called", __func__);
24}
25
26/*
27 * After we've done initial boot, this function is called to allow the
28 * board code to clean up state, if needed
29 */
30void __cpuinit up_init_secondary(void)
31{
32}
33
34void __cpuinit up_smp_finish(void)
35{
36}
37
38/* Hook for after all CPUs are online */
39void up_cpus_done(void)
40{
41}
42
43/*
44 * Firmware CPU startup hook
45 */
46void __cpuinit up_boot_secondary(int cpu, struct task_struct *idle)
47{
48}
49
50void __init up_smp_setup(void)
51{
52}
53
54void __init up_prepare_cpus(unsigned int max_cpus)
55{
56}
57
58struct plat_smp_ops up_smp_ops = {
59 .send_ipi_single = up_send_ipi_single,
60 .send_ipi_mask = up_send_ipi_mask,
61 .init_secondary = up_init_secondary,
62 .smp_finish = up_smp_finish,
63 .cpus_done = up_cpus_done,
64 .boot_secondary = up_boot_secondary,
65 .smp_setup = up_smp_setup,
66 .prepare_cpus = up_prepare_cpus,
67};
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 3284b9b4ecac..52075426c373 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -50,14 +50,6 @@ int update_persistent_clock(struct timespec now)
50 return rtc_mips_set_mmss(now.tv_sec); 50 return rtc_mips_set_mmss(now.tv_sec);
51} 51}
52 52
53/*
54 * High precision timer functions for a R4k-compatible timer.
55 */
56static cycle_t c0_hpt_read(void)
57{
58 return read_c0_count();
59}
60
61int (*mips_timer_state)(void); 53int (*mips_timer_state)(void);
62 54
63int null_perf_irq(void) 55int null_perf_irq(void)
@@ -84,55 +76,6 @@ EXPORT_SYMBOL(perf_irq);
84 76
85unsigned int mips_hpt_frequency; 77unsigned int mips_hpt_frequency;
86 78
87static struct clocksource clocksource_mips = {
88 .name = "MIPS",
89 .read = c0_hpt_read,
90 .mask = CLOCKSOURCE_MASK(32),
91 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
92};
93
94static unsigned int __init calibrate_hpt(void)
95{
96 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
97
98 const int loops = HZ / 10;
99 int log_2_loops = 0;
100 int i;
101
102 /*
103 * We want to calibrate for 0.1s, but to avoid a 64-bit
104 * division we round the number of loops up to the nearest
105 * power of 2.
106 */
107 while (loops > 1 << log_2_loops)
108 log_2_loops++;
109 i = 1 << log_2_loops;
110
111 /*
112 * Wait for a rising edge of the timer interrupt.
113 */
114 while (mips_timer_state());
115 while (!mips_timer_state());
116
117 /*
118 * Now see how many high precision timer ticks happen
119 * during the calculated number of periods between timer
120 * interrupts.
121 */
122 hpt_start = clocksource_mips.read();
123 do {
124 while (mips_timer_state());
125 while (!mips_timer_state());
126 } while (--i);
127 hpt_end = clocksource_mips.read();
128
129 hpt_count = (hpt_end - hpt_start) & clocksource_mips.mask;
130 hz = HZ;
131 frequency = hpt_count * hz;
132
133 return frequency >> log_2_loops;
134}
135
136void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) 79void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
137{ 80{
138 u64 temp; 81 u64 temp;
@@ -166,16 +109,6 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
166 cd->mult = (u32) temp; 109 cd->mult = (u32) temp;
167} 110}
168 111
169static void __init init_mips_clocksource(void)
170{
171 /* Calclate a somewhat reasonable rating value */
172 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
173
174 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
175
176 clocksource_register(&clocksource_mips);
177}
178
179void __init __weak plat_time_init(void) 112void __init __weak plat_time_init(void)
180{ 113{
181} 114}
@@ -194,21 +127,42 @@ void __init plat_timer_setup(void)
194 BUG(); 127 BUG();
195} 128}
196 129
130static __init int cpu_has_mfc0_count_bug(void)
131{
132 switch (current_cpu_type()) {
133 case CPU_R4000PC:
134 case CPU_R4000SC:
135 case CPU_R4000MC:
136 /*
137 * V3.0 is documented as suffering from the mfc0 from count bug.
138 * Afaik this is the last version of the R4000. Later versions
139 * were marketed as R4400.
140 */
141 return 1;
142
143 case CPU_R4400PC:
144 case CPU_R4400SC:
145 case CPU_R4400MC:
146 /*
147 * The published errata for the R4400 upto 3.0 say the CPU
148 * has the mfc0 from count bug.
149 */
150 if ((current_cpu_data.processor_id & 0xff) <= 0x30)
151 return 1;
152
153 /*
154 * I don't have erratas for newer R4400 so be paranoid.
155 */
156 return 1;
157 }
158
159 return 0;
160}
161
197void __init time_init(void) 162void __init time_init(void)
198{ 163{
199 plat_time_init(); 164 plat_time_init();
200 165
201 if (cpu_has_counter && (mips_hpt_frequency || mips_timer_state)) { 166 if (mips_clockevent_init() || !cpu_has_mfc0_count_bug())
202 /* We know counter frequency. Or we can get it. */
203 if (!mips_hpt_frequency)
204 mips_hpt_frequency = calibrate_hpt();
205
206 /* Report the high precision timer rate for a reference. */
207 printk("Using %u.%03u MHz high precision timer.\n",
208 ((mips_hpt_frequency + 500) / 1000) / 1000,
209 ((mips_hpt_frequency + 500) / 1000) % 1000);
210 init_mips_clocksource(); 167 init_mips_clocksource();
211 }
212
213 mips_clockevent_init();
214} 168}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 38bd33fa2a23..c06eb812a95e 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -470,7 +470,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
470 */ 470 */
471 if (v != l->value) { 471 if (v != l->value) {
472 printk(KERN_DEBUG "VPE loader: " 472 printk(KERN_DEBUG "VPE loader: "
473 "apply_r_mips_lo16/hi16: " 473 "apply_r_mips_lo16/hi16: \t"
474 "inconsistent value information\n"); 474 "inconsistent value information\n");
475 return -ENOEXEC; 475 return -ENOEXEC;
476 } 476 }
@@ -629,7 +629,7 @@ static void simplify_symbols(Elf_Shdr * sechdrs,
629 break; 629 break;
630 630
631 case SHN_MIPS_SCOMMON: 631 case SHN_MIPS_SCOMMON:
632 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON" 632 printk(KERN_DEBUG "simplify_symbols: ignoring SHN_MIPS_SCOMMON "
633 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name, 633 "symbol <%s> st_shndx %d\n", strtab + sym[i].st_name,
634 sym[i].st_shndx); 634 sym[i].st_shndx);
635 // .sbss section 635 // .sbss section
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c
index 946aee331788..cb1b6822711a 100644
--- a/arch/mips/math-emu/ieee754.c
+++ b/arch/mips/math-emu/ieee754.c
@@ -108,6 +108,7 @@ int ieee754si_xcpt(int r, const char *op, ...)
108 ax.rv.si = r; 108 ax.rv.si = r;
109 va_start(ax.ap, op); 109 va_start(ax.ap, op);
110 ieee754_xcpt(&ax); 110 ieee754_xcpt(&ax);
111 va_end(ax.ap);
111 return ax.rv.si; 112 return ax.rv.si;
112} 113}
113 114
@@ -122,5 +123,6 @@ s64 ieee754di_xcpt(s64 r, const char *op, ...)
122 ax.rv.di = r; 123 ax.rv.di = r;
123 va_start(ax.ap, op); 124 va_start(ax.ap, op);
124 ieee754_xcpt(&ax); 125 ieee754_xcpt(&ax);
126 va_end(ax.ap);
125 return ax.rv.di; 127 return ax.rv.di;
126} 128}
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c
index 3e214aac4b12..6d2d89f32472 100644
--- a/arch/mips/math-emu/ieee754dp.c
+++ b/arch/mips/math-emu/ieee754dp.c
@@ -57,6 +57,7 @@ ieee754dp ieee754dp_xcpt(ieee754dp r, const char *op, ...)
57 ax.rv.dp = r; 57 ax.rv.dp = r;
58 va_start(ax.ap, op); 58 va_start(ax.ap, op);
59 ieee754_xcpt(&ax); 59 ieee754_xcpt(&ax);
60 va_end(ax.ap);
60 return ax.rv.dp; 61 return ax.rv.dp;
61} 62}
62 63
@@ -83,6 +84,7 @@ ieee754dp ieee754dp_nanxcpt(ieee754dp r, const char *op, ...)
83 ax.rv.dp = r; 84 ax.rv.dp = r;
84 va_start(ax.ap, op); 85 va_start(ax.ap, op);
85 ieee754_xcpt(&ax); 86 ieee754_xcpt(&ax);
87 va_end(ax.ap);
86 return ax.rv.dp; 88 return ax.rv.dp;
87} 89}
88 90
diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c
index adda851cd04f..463534045ab6 100644
--- a/arch/mips/math-emu/ieee754sp.c
+++ b/arch/mips/math-emu/ieee754sp.c
@@ -58,6 +58,7 @@ ieee754sp ieee754sp_xcpt(ieee754sp r, const char *op, ...)
58 ax.rv.sp = r; 58 ax.rv.sp = r;
59 va_start(ax.ap, op); 59 va_start(ax.ap, op);
60 ieee754_xcpt(&ax); 60 ieee754_xcpt(&ax);
61 va_end(ax.ap);
61 return ax.rv.sp; 62 return ax.rv.sp;
62} 63}
63 64
@@ -84,6 +85,7 @@ ieee754sp ieee754sp_nanxcpt(ieee754sp r, const char *op, ...)
84 ax.rv.sp = r; 85 ax.rv.sp = r;
85 va_start(ax.ap, op); 86 va_start(ax.ap, op);
86 ieee754_xcpt(&ax); 87 ieee754_xcpt(&ax);
88 va_end(ax.ap);
87 return ax.rv.sp; 89 return ax.rv.sp;
88} 90}
89 91
diff --git a/arch/mips/mipssim/sim_time.c b/arch/mips/mipssim/sim_time.c
index bfaafa38846f..e39bbe989da3 100644
--- a/arch/mips/mipssim/sim_time.c
+++ b/arch/mips/mipssim/sim_time.c
@@ -101,9 +101,7 @@ unsigned __init get_c0_compare_int(void)
101 101
102void __init plat_time_init(void) 102void __init plat_time_init(void)
103{ 103{
104 unsigned int est_freq, flags; 104 unsigned int est_freq;
105
106 local_irq_save(flags);
107 105
108 /* Set Data mode - binary. */ 106 /* Set Data mode - binary. */
109 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL); 107 CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_DM_BINARY, RTC_CONTROL);
@@ -114,6 +112,4 @@ void __init plat_time_init(void)
114 (est_freq % 1000000) * 100 / 1000000); 112 (est_freq % 1000000) * 100 / 1000000);
115 113
116 cpu_khz = est_freq / 1000; 114 cpu_khz = est_freq / 1000;
117
118 local_irq_restore(flags);
119} 115}
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 33519ce49540..ae76795685cc 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -40,16 +40,38 @@ static inline int cpu_is_noncoherent_r10000(struct device *dev)
40 current_cpu_type() == CPU_R12000); 40 current_cpu_type() == CPU_R12000);
41} 41}
42 42
43static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
44{
45 /* ignore region specifiers */
46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
47
48#ifdef CONFIG_ZONE_DMA32
49 if (dev == NULL)
50 gfp |= __GFP_DMA;
51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
52 gfp |= __GFP_DMA;
53 else
54#endif
55#ifdef CONFIG_ZONE_DMA32
56 if (dev->coherent_dma_mask < DMA_BIT_MASK(32))
57 gfp |= __GFP_DMA32;
58 else
59#endif
60 ;
61
62 /* Don't invoke OOM killer */
63 gfp |= __GFP_NORETRY;
64
65 return gfp;
66}
67
43void *dma_alloc_noncoherent(struct device *dev, size_t size, 68void *dma_alloc_noncoherent(struct device *dev, size_t size,
44 dma_addr_t * dma_handle, gfp_t gfp) 69 dma_addr_t * dma_handle, gfp_t gfp)
45{ 70{
46 void *ret; 71 void *ret;
47 72
48 /* ignore region specifiers */ 73 gfp = massage_gfp_flags(dev, gfp);
49 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
50 74
51 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
52 gfp |= GFP_DMA;
53 ret = (void *) __get_free_pages(gfp, get_order(size)); 75 ret = (void *) __get_free_pages(gfp, get_order(size));
54 76
55 if (ret != NULL) { 77 if (ret != NULL) {
@@ -67,11 +89,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
67{ 89{
68 void *ret; 90 void *ret;
69 91
70 /* ignore region specifiers */ 92 gfp = massage_gfp_flags(dev, gfp);
71 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
72 93
73 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
74 gfp |= GFP_DMA;
75 ret = (void *) __get_free_pages(gfp, get_order(size)); 94 ret = (void *) __get_free_pages(gfp, get_order(size));
76 95
77 if (ret) { 96 if (ret) {
@@ -343,7 +362,7 @@ int dma_supported(struct device *dev, u64 mask)
343 * so we can't guarantee allocations that must be 362 * so we can't guarantee allocations that must be
344 * within a tighter range than GFP_DMA.. 363 * within a tighter range than GFP_DMA..
345 */ 364 */
346 if (mask < 0x00ffffff) 365 if (mask < DMA_BIT_MASK(24))
347 return 0; 366 return 0;
348 367
349 return 1; 368 return 1;
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index ec3b9e9f30f4..480dec04f552 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -347,11 +347,8 @@ static int __init page_is_ram(unsigned long pagenr)
347 347
348void __init paging_init(void) 348void __init paging_init(void)
349{ 349{
350 unsigned long zones_size[MAX_NR_ZONES] = { 0, }; 350 unsigned long max_zone_pfns[MAX_NR_ZONES];
351#ifndef CONFIG_FLATMEM 351 unsigned long lastpfn;
352 unsigned long zholes_size[MAX_NR_ZONES] = { 0, };
353 unsigned long i, j, pfn;
354#endif
355 352
356 pagetable_init(); 353 pagetable_init();
357 354
@@ -361,35 +358,27 @@ void __init paging_init(void)
361 kmap_coherent_init(); 358 kmap_coherent_init();
362 359
363#ifdef CONFIG_ZONE_DMA 360#ifdef CONFIG_ZONE_DMA
364 if (min_low_pfn < MAX_DMA_PFN && MAX_DMA_PFN <= max_low_pfn) { 361 max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
365 zones_size[ZONE_DMA] = MAX_DMA_PFN - min_low_pfn;
366 zones_size[ZONE_NORMAL] = max_low_pfn - MAX_DMA_PFN;
367 } else if (max_low_pfn < MAX_DMA_PFN)
368 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn;
369 else
370#endif 362#endif
371 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; 363#ifdef CONFIG_ZONE_DMA32
372 364 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
365#endif
366 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
367 lastpfn = max_low_pfn;
373#ifdef CONFIG_HIGHMEM 368#ifdef CONFIG_HIGHMEM
374 zones_size[ZONE_HIGHMEM] = highend_pfn - highstart_pfn; 369 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
370 lastpfn = highend_pfn;
375 371
376 if (cpu_has_dc_aliases && zones_size[ZONE_HIGHMEM]) { 372 if (cpu_has_dc_aliases && max_low_pfn != highend_pfn) {
377 printk(KERN_WARNING "This processor doesn't support highmem." 373 printk(KERN_WARNING "This processor doesn't support highmem."
378 " %ldk highmem ignored\n", zones_size[ZONE_HIGHMEM]); 374 " %ldk highmem ignored\n",
379 zones_size[ZONE_HIGHMEM] = 0; 375 (highend_pfn - max_low_pfn) << (PAGE_SHIFT - 10));
376 max_zone_pfns[ZONE_HIGHMEM] = max_low_pfn;
377 lastpfn = max_low_pfn;
380 } 378 }
381#endif 379#endif
382 380
383#ifdef CONFIG_FLATMEM 381 free_area_init_nodes(max_zone_pfns);
384 free_area_init(zones_size);
385#else
386 pfn = min_low_pfn;
387 for (i = 0; i < MAX_NR_ZONES; i++)
388 for (j = 0; j < zones_size[i]; j++, pfn++)
389 if (!page_is_ram(pfn))
390 zholes_size[i]++;
391 free_area_init_node(0, NODE_DATA(0), zones_size, 0, zholes_size);
392#endif
393} 382}
394 383
395static struct kcore_list kcore_mem, kcore_vmalloc; 384static struct kcore_list kcore_mem, kcore_vmalloc;
diff --git a/arch/mips/pmc-sierra/Kconfig b/arch/mips/pmc-sierra/Kconfig
index 6b293ce0935f..90261b83db04 100644
--- a/arch/mips/pmc-sierra/Kconfig
+++ b/arch/mips/pmc-sierra/Kconfig
@@ -5,12 +5,14 @@ choice
5config PMC_MSP4200_EVAL 5config PMC_MSP4200_EVAL
6 bool "PMC-Sierra MSP4200 Eval Board" 6 bool "PMC-Sierra MSP4200 Eval Board"
7 select CEVT_R4K 7 select CEVT_R4K
8 select CSRC_R4K
8 select IRQ_MSP_SLP 9 select IRQ_MSP_SLP
9 select HW_HAS_PCI 10 select HW_HAS_PCI
10 11
11config PMC_MSP4200_GW 12config PMC_MSP4200_GW
12 bool "PMC-Sierra MSP4200 VoIP Gateway" 13 bool "PMC-Sierra MSP4200 VoIP Gateway"
13 select CEVT_R4K 14 select CEVT_R4K
15 select CSRC_R4K
14 select IRQ_MSP_SLP 16 select IRQ_MSP_SLP
15 select HW_HAS_PCI 17 select HW_HAS_PCI
16 18
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index 26854fb11e7c..1617241d2737 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -36,6 +36,7 @@
36#include <asm/sgi/ioc.h> 36#include <asm/sgi/ioc.h>
37#include <asm/sgi/mc.h> 37#include <asm/sgi/mc.h>
38#include <asm/sgi/ip22.h> 38#include <asm/sgi/ip22.h>
39#include <asm/i8259.h>
39 40
40/* I2 has four EISA slots. */ 41/* I2 has four EISA slots. */
41#define IP22_EISA_MAX_SLOTS 4 42#define IP22_EISA_MAX_SLOTS 4
@@ -93,126 +94,11 @@ static irqreturn_t ip22_eisa_intr(int irq, void *dev_id)
93 return IRQ_NONE; 94 return IRQ_NONE;
94} 95}
95 96
96static void enable_eisa1_irq(unsigned int irq)
97{
98 u8 mask;
99
100 mask = inb(EISA_INT1_MASK);
101 mask &= ~((u8) (1 << irq));
102 outb(mask, EISA_INT1_MASK);
103}
104
105static unsigned int startup_eisa1_irq(unsigned int irq)
106{
107 u8 edge;
108
109 /* Only use edge interrupts for EISA */
110
111 edge = inb(EISA_INT1_EDGE_LEVEL);
112 edge &= ~((u8) (1 << irq));
113 outb(edge, EISA_INT1_EDGE_LEVEL);
114
115 enable_eisa1_irq(irq);
116 return 0;
117}
118
119static void disable_eisa1_irq(unsigned int irq)
120{
121 u8 mask;
122
123 mask = inb(EISA_INT1_MASK);
124 mask |= ((u8) (1 << irq));
125 outb(mask, EISA_INT1_MASK);
126}
127
128static void mask_and_ack_eisa1_irq(unsigned int irq)
129{
130 disable_eisa1_irq(irq);
131
132 outb(0x20, EISA_INT1_CTRL);
133}
134
135static void end_eisa1_irq(unsigned int irq)
136{
137 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
138 enable_eisa1_irq(irq);
139}
140
141static struct irq_chip ip22_eisa1_irq_type = {
142 .name = "IP22 EISA",
143 .startup = startup_eisa1_irq,
144 .ack = mask_and_ack_eisa1_irq,
145 .mask = disable_eisa1_irq,
146 .mask_ack = mask_and_ack_eisa1_irq,
147 .unmask = enable_eisa1_irq,
148 .end = end_eisa1_irq,
149};
150
151static void enable_eisa2_irq(unsigned int irq)
152{
153 u8 mask;
154
155 mask = inb(EISA_INT2_MASK);
156 mask &= ~((u8) (1 << (irq - 8)));
157 outb(mask, EISA_INT2_MASK);
158}
159
160static unsigned int startup_eisa2_irq(unsigned int irq)
161{
162 u8 edge;
163
164 /* Only use edge interrupts for EISA */
165
166 edge = inb(EISA_INT2_EDGE_LEVEL);
167 edge &= ~((u8) (1 << (irq - 8)));
168 outb(edge, EISA_INT2_EDGE_LEVEL);
169
170 enable_eisa2_irq(irq);
171 return 0;
172}
173
174static void disable_eisa2_irq(unsigned int irq)
175{
176 u8 mask;
177
178 mask = inb(EISA_INT2_MASK);
179 mask |= ((u8) (1 << (irq - 8)));
180 outb(mask, EISA_INT2_MASK);
181}
182
183static void mask_and_ack_eisa2_irq(unsigned int irq)
184{
185 disable_eisa2_irq(irq);
186
187 outb(0x20, EISA_INT2_CTRL);
188}
189
190static void end_eisa2_irq(unsigned int irq)
191{
192 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
193 enable_eisa2_irq(irq);
194}
195
196static struct irq_chip ip22_eisa2_irq_type = {
197 .name = "IP22 EISA",
198 .startup = startup_eisa2_irq,
199 .ack = mask_and_ack_eisa2_irq,
200 .mask = disable_eisa2_irq,
201 .mask_ack = mask_and_ack_eisa2_irq,
202 .unmask = enable_eisa2_irq,
203 .end = end_eisa2_irq,
204};
205
206static struct irqaction eisa_action = { 97static struct irqaction eisa_action = {
207 .handler = ip22_eisa_intr, 98 .handler = ip22_eisa_intr,
208 .name = "EISA", 99 .name = "EISA",
209}; 100};
210 101
211static struct irqaction cascade_action = {
212 .handler = no_action,
213 .name = "EISA cascade",
214};
215
216int __init ip22_eisa_init(void) 102int __init ip22_eisa_init(void)
217{ 103{
218 int i, c; 104 int i, c;
@@ -248,29 +134,13 @@ int __init ip22_eisa_init(void)
248 outb(1, EISA_EXT_NMI_RESET_CTRL); 134 outb(1, EISA_EXT_NMI_RESET_CTRL);
249 udelay(50); /* Wait long enough for the dust to settle */ 135 udelay(50); /* Wait long enough for the dust to settle */
250 outb(0, EISA_EXT_NMI_RESET_CTRL); 136 outb(0, EISA_EXT_NMI_RESET_CTRL);
251 outb(0x11, EISA_INT1_CTRL);
252 outb(0x11, EISA_INT2_CTRL);
253 outb(0, EISA_INT1_MASK);
254 outb(8, EISA_INT2_MASK);
255 outb(4, EISA_INT1_MASK);
256 outb(2, EISA_INT2_MASK);
257 outb(1, EISA_INT1_MASK);
258 outb(1, EISA_INT2_MASK);
259 outb(0xfb, EISA_INT1_MASK);
260 outb(0xff, EISA_INT2_MASK);
261 outb(0, EISA_DMA2_WRITE_SINGLE); 137 outb(0, EISA_DMA2_WRITE_SINGLE);
262 138
263 for (i = SGINT_EISA; i < (SGINT_EISA + EISA_MAX_IRQ); i++) { 139 init_i8259_irqs();
264 if (i < (SGINT_EISA + 8))
265 set_irq_chip(i, &ip22_eisa1_irq_type);
266 else
267 set_irq_chip(i, &ip22_eisa2_irq_type);
268 }
269 140
270 /* Cannot use request_irq because of kmalloc not being ready at such 141 /* Cannot use request_irq because of kmalloc not being ready at such
271 * an early stage. Yes, I've been bitten... */ 142 * an early stage. Yes, I've been bitten... */
272 setup_irq(SGI_EISA_IRQ, &eisa_action); 143 setup_irq(SGI_EISA_IRQ, &eisa_action);
273 setup_irq(SGINT_EISA + 2, &cascade_action);
274 144
275 EISA_bus = 1; 145 EISA_bus = 1;
276 return 0; 146 return 0;
diff --git a/arch/mips/sgi-ip22/ip22-nvram.c b/arch/mips/sgi-ip22/ip22-nvram.c
index e19d60d5fcc1..0177566475d4 100644
--- a/arch/mips/sgi-ip22/ip22-nvram.c
+++ b/arch/mips/sgi-ip22/ip22-nvram.c
@@ -32,19 +32,19 @@
32 for (x=0; x<100000; x++) __asm__ __volatile__(""); }) 32 for (x=0; x<100000; x++) __asm__ __volatile__(""); })
33 33
34#define eeprom_cs_on(ptr) ({ \ 34#define eeprom_cs_on(ptr) ({ \
35 *ptr &= ~EEPROM_DATO; \ 35 __raw_writel(__raw_readl(ptr) & ~EEPROM_DATO, ptr); \
36 *ptr &= ~EEPROM_ECLK; \ 36 __raw_writel(__raw_readl(ptr) & ~EEPROM_ECLK, ptr); \
37 *ptr &= ~EEPROM_EPROT; \ 37 __raw_writel(__raw_readl(ptr) & ~EEPROM_EPROT, ptr); \
38 delay(); \ 38 delay(); \
39 *ptr |= EEPROM_CSEL; \ 39 __raw_writel(__raw_readl(ptr) | EEPROM_CSEL, ptr); \
40 *ptr |= EEPROM_ECLK; }) 40 __raw_writel(__raw_readl(ptr) | EEPROM_ECLK, ptr); })
41 41
42 42
43#define eeprom_cs_off(ptr) ({ \ 43#define eeprom_cs_off(ptr) ({ \
44 *ptr &= ~EEPROM_ECLK; \ 44 __raw_writel(__raw_readl(ptr) & ~EEPROM_ECLK, ptr); \
45 *ptr &= ~EEPROM_CSEL; \ 45 __raw_writel(__raw_readl(ptr) & ~EEPROM_CSEL, ptr); \
46 *ptr |= EEPROM_EPROT; \ 46 __raw_writel(__raw_readl(ptr) | EEPROM_EPROT, ptr); \
47 *ptr |= EEPROM_ECLK; }) 47 __raw_writel(__raw_readl(ptr) | EEPROM_ECLK, ptr); })
48 48
49#define BITS_IN_COMMAND 11 49#define BITS_IN_COMMAND 11
50/* 50/*
@@ -60,15 +60,17 @@ static inline void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg)
60 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND)); 60 ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND));
61 for (i = 0; i < BITS_IN_COMMAND; i++) { 61 for (i = 0; i < BITS_IN_COMMAND; i++) {
62 if (ser_cmd & (1<<15)) /* if high order bit set */ 62 if (ser_cmd & (1<<15)) /* if high order bit set */
63 writel(readl(ctrl) | EEPROM_DATO, ctrl); 63 __raw_writel(__raw_readl(ctrl) | EEPROM_DATO, ctrl);
64 else 64 else
65 writel(readl(ctrl) & ~EEPROM_DATO, ctrl); 65 __raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
66 writel(readl(ctrl) & ~EEPROM_ECLK, ctrl); 66 __raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
67 writel(readl(ctrl) | EEPROM_ECLK, ctrl); 67 delay();
68 __raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
69 delay();
68 ser_cmd <<= 1; 70 ser_cmd <<= 1;
69 } 71 }
70 /* see data sheet timing diagram */ 72 /* see data sheet timing diagram */
71 writel(readl(ctrl) & ~EEPROM_DATO, ctrl); 73 __raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
72} 74}
73 75
74unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg) 76unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
@@ -76,18 +78,18 @@ unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
76 unsigned short res = 0; 78 unsigned short res = 0;
77 int i; 79 int i;
78 80
79 writel(readl(ctrl) & ~EEPROM_EPROT, ctrl); 81 __raw_writel(__raw_readl(ctrl) & ~EEPROM_EPROT, ctrl);
80 eeprom_cs_on(ctrl); 82 eeprom_cs_on(ctrl);
81 eeprom_cmd(ctrl, EEPROM_READ, reg); 83 eeprom_cmd(ctrl, EEPROM_READ, reg);
82 84
83 /* clock the data ouf of serial mem */ 85 /* clock the data ouf of serial mem */
84 for (i = 0; i < 16; i++) { 86 for (i = 0; i < 16; i++) {
85 writel(readl(ctrl) & ~EEPROM_ECLK, ctrl); 87 __raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
86 delay(); 88 delay();
87 writel(readl(ctrl) | EEPROM_ECLK, ctrl); 89 __raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
88 delay(); 90 delay();
89 res <<= 1; 91 res <<= 1;
90 if (readl(ctrl) & EEPROM_DATI) 92 if (__raw_readl(ctrl) & EEPROM_DATI)
91 res |= 1; 93 res |= 1;
92 } 94 }
93 95
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 174f09e42f6b..5f389ee26fca 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -31,25 +31,6 @@
31unsigned long sgi_gfxaddr; 31unsigned long sgi_gfxaddr;
32EXPORT_SYMBOL_GPL(sgi_gfxaddr); 32EXPORT_SYMBOL_GPL(sgi_gfxaddr);
33 33
34/*
35 * Stop-A is originally a Sun thing that isn't standard on IP22 so to avoid
36 * accidents it's disabled by default on IP22.
37 *
38 * FIXME: provide a mechanism to change the value of stop_a_enabled.
39 */
40int stop_a_enabled;
41
42void ip22_do_break(void)
43{
44 if (!stop_a_enabled)
45 return;
46
47 printk("\n");
48 ArcEnterInteractiveMode();
49}
50
51EXPORT_SYMBOL(ip22_do_break);
52
53extern void ip22_be_init(void) __init; 34extern void ip22_be_init(void) __init;
54 35
55void __init plat_mem_setup(void) 36void __init plat_mem_setup(void)
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index aab17ddd2f30..cab7cc22ab67 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -209,18 +209,18 @@ static unsigned long macepci_mask;
209 209
210static void enable_macepci_irq(unsigned int irq) 210static void enable_macepci_irq(unsigned int irq)
211{ 211{
212 macepci_mask |= MACEPCI_CONTROL_INT(irq - 9); 212 macepci_mask |= MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ);
213 mace->pci.control = macepci_mask; 213 mace->pci.control = macepci_mask;
214 crime_mask |= 1 << (irq - 1); 214 crime_mask |= 1 << (irq - CRIME_IRQ_BASE);
215 crime->imask = crime_mask; 215 crime->imask = crime_mask;
216} 216}
217 217
218static void disable_macepci_irq(unsigned int irq) 218static void disable_macepci_irq(unsigned int irq)
219{ 219{
220 crime_mask &= ~(1 << (irq - 1)); 220 crime_mask &= ~(1 << (irq - CRIME_IRQ_BASE));
221 crime->imask = crime_mask; 221 crime->imask = crime_mask;
222 flush_crime_bus(); 222 flush_crime_bus();
223 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - 9); 223 macepci_mask &= ~MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ);
224 mace->pci.control = macepci_mask; 224 mace->pci.control = macepci_mask;
225 flush_mace_bus(); 225 flush_mace_bus();
226} 226}
@@ -299,7 +299,7 @@ static void enable_maceisa_irq(unsigned int irq)
299 pr_debug("crime_int %08x enabled\n", crime_int); 299 pr_debug("crime_int %08x enabled\n", crime_int);
300 crime_mask |= crime_int; 300 crime_mask |= crime_int;
301 crime->imask = crime_mask; 301 crime->imask = crime_mask;
302 maceisa_mask |= 1 << (irq - 33); 302 maceisa_mask |= 1 << (irq - MACEISA_AUDIO_SW_IRQ);
303 mace->perif.ctrl.imask = maceisa_mask; 303 mace->perif.ctrl.imask = maceisa_mask;
304} 304}
305 305
@@ -307,7 +307,7 @@ static void disable_maceisa_irq(unsigned int irq)
307{ 307{
308 unsigned int crime_int = 0; 308 unsigned int crime_int = 0;
309 309
310 maceisa_mask &= ~(1 << (irq - 33)); 310 maceisa_mask &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ));
311 if (!(maceisa_mask & MACEISA_AUDIO_INT)) 311 if (!(maceisa_mask & MACEISA_AUDIO_INT))
312 crime_int |= MACE_AUDIO_INT; 312 crime_int |= MACE_AUDIO_INT;
313 if (!(maceisa_mask & MACEISA_MISC_INT)) 313 if (!(maceisa_mask & MACEISA_MISC_INT))
@@ -331,7 +331,7 @@ static void mask_and_ack_maceisa_irq(unsigned int irq)
331 case MACEISA_SERIAL2_TDMAPR_IRQ: 331 case MACEISA_SERIAL2_TDMAPR_IRQ:
332 /* edge triggered */ 332 /* edge triggered */
333 mace_int = mace->perif.ctrl.istat; 333 mace_int = mace->perif.ctrl.istat;
334 mace_int &= ~(1 << (irq - 33)); 334 mace_int &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ));
335 mace->perif.ctrl.istat = mace_int; 335 mace->perif.ctrl.istat = mace_int;
336 break; 336 break;
337 } 337 }
@@ -359,13 +359,17 @@ static struct irq_chip ip32_maceisa_interrupt = {
359 359
360static void enable_mace_irq(unsigned int irq) 360static void enable_mace_irq(unsigned int irq)
361{ 361{
362 crime_mask |= 1 << (irq - 1); 362 unsigned int bit = irq - CRIME_IRQ_BASE;
363
364 crime_mask |= (1 << bit);
363 crime->imask = crime_mask; 365 crime->imask = crime_mask;
364} 366}
365 367
366static void disable_mace_irq(unsigned int irq) 368static void disable_mace_irq(unsigned int irq)
367{ 369{
368 crime_mask &= ~(1 << (irq - 1)); 370 unsigned int bit = irq - CRIME_IRQ_BASE;
371
372 crime_mask &= ~(1 << bit);
369 crime->imask = crime_mask; 373 crime->imask = crime_mask;
370 flush_crime_bus(); 374 flush_crime_bus();
371} 375}
@@ -489,7 +493,7 @@ void __init arch_init_irq(void)
489 mace->perif.ctrl.imask = 0; 493 mace->perif.ctrl.imask = 0;
490 494
491 mips_cpu_irq_init(); 495 mips_cpu_irq_init();
492 for (irq = MIPS_CPU_IRQ_BASE + 8; irq <= IP32_IRQ_MAX; irq++) { 496 for (irq = CRIME_IRQ_BASE; irq <= IP32_IRQ_MAX; irq++) {
493 switch (irq) { 497 switch (irq) {
494 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ: 498 case MACE_VID_IN1_IRQ ... MACE_PCI_BRIDGE_IRQ:
495 set_irq_chip(irq, &ip32_mace_interrupt); 499 set_irq_chip(irq, &ip32_mace_interrupt);
diff --git a/arch/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig
index eeb089f20c0d..559acc09c819 100644
--- a/arch/mips/vr41xx/Kconfig
+++ b/arch/mips/vr41xx/Kconfig
@@ -6,6 +6,7 @@ choice
6config CASIO_E55 6config CASIO_E55
7 bool "CASIO CASSIOPEIA E-10/15/55/65" 7 bool "CASIO CASSIOPEIA E-10/15/55/65"
8 select CEVT_R4K 8 select CEVT_R4K
9 select CSRC_R4K
9 select DMA_NONCOHERENT 10 select DMA_NONCOHERENT
10 select IRQ_CPU 11 select IRQ_CPU
11 select ISA 12 select ISA
@@ -15,6 +16,7 @@ config CASIO_E55
15config IBM_WORKPAD 16config IBM_WORKPAD
16 bool "IBM WorkPad z50" 17 bool "IBM WorkPad z50"
17 select CEVT_R4K 18 select CEVT_R4K
19 select CSRC_R4K
18 select DMA_NONCOHERENT 20 select DMA_NONCOHERENT
19 select IRQ_CPU 21 select IRQ_CPU
20 select ISA 22 select ISA
@@ -24,6 +26,7 @@ config IBM_WORKPAD
24config NEC_CMBVR4133 26config NEC_CMBVR4133
25 bool "NEC CMB-VR4133" 27 bool "NEC CMB-VR4133"
26 select CEVT_R4K 28 select CEVT_R4K
29 select CSRC_R4K
27 select DMA_NONCOHERENT 30 select DMA_NONCOHERENT
28 select IRQ_CPU 31 select IRQ_CPU
29 select HW_HAS_PCI 32 select HW_HAS_PCI
@@ -33,6 +36,7 @@ config NEC_CMBVR4133
33config TANBAC_TB022X 36config TANBAC_TB022X
34 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM" 37 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM"
35 select CEVT_R4K 38 select CEVT_R4K
39 select CSRC_R4K
36 select DMA_NONCOHERENT 40 select DMA_NONCOHERENT
37 select IRQ_CPU 41 select IRQ_CPU
38 select HW_HAS_PCI 42 select HW_HAS_PCI
@@ -48,6 +52,7 @@ config TANBAC_TB022X
48config VICTOR_MPC30X 52config VICTOR_MPC30X
49 bool "Victor MP-C303/304" 53 bool "Victor MP-C303/304"
50 select CEVT_R4K 54 select CEVT_R4K
55 select CSRC_R4K
51 select DMA_NONCOHERENT 56 select DMA_NONCOHERENT
52 select IRQ_CPU 57 select IRQ_CPU
53 select HW_HAS_PCI 58 select HW_HAS_PCI
@@ -58,6 +63,7 @@ config VICTOR_MPC30X
58config ZAO_CAPCELLA 63config ZAO_CAPCELLA
59 bool "ZAO Networks Capcella" 64 bool "ZAO Networks Capcella"
60 select CEVT_R4K 65 select CEVT_R4K
66 select CSRC_R4K
61 select DMA_NONCOHERENT 67 select DMA_NONCOHERENT
62 select IRQ_CPU 68 select IRQ_CPU
63 select HW_HAS_PCI 69 select HW_HAS_PCI
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 18f397ca05ef..232c298c933f 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -187,6 +187,11 @@ config FORCE_MAX_ZONEORDER
187 default "9" if PPC_64K_PAGES 187 default "9" if PPC_64K_PAGES
188 default "13" 188 default "13"
189 189
190config HUGETLB_PAGE_SIZE_VARIABLE
191 bool
192 depends on HUGETLB_PAGE
193 default y
194
190config MATH_EMULATION 195config MATH_EMULATION
191 bool "Math emulation" 196 bool "Math emulation"
192 depends on 4xx || 8xx || E200 || PPC_MPC832x || E500 197 depends on 4xx || 8xx || E200 || PPC_MPC832x || E500
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index fcd333c391ec..c64f3037a13b 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -57,12 +57,19 @@
57 }; 57 };
58 58
59 i2c@3000 { 59 i2c@3000 {
60 #address-cells = <1>;
61 #size-cells = <0>;
60 device_type = "i2c"; 62 device_type = "i2c";
61 compatible = "fsl-i2c"; 63 compatible = "fsl-i2c";
62 reg = <3000 100>; 64 reg = <3000 100>;
63 interrupts = <e 8>; 65 interrupts = <e 8>;
64 interrupt-parent = < &ipic >; 66 interrupt-parent = < &ipic >;
65 dfsrr; 67 dfsrr;
68
69 rtc@68 {
70 compatible = "dallas,ds1374";
71 reg = <68>;
72 };
66 }; 73 };
67 74
68 serial@4500 { 75 serial@4500 {
@@ -104,7 +111,7 @@
104 reg = <700 100>; 111 reg = <700 100>;
105 device_type = "ipic"; 112 device_type = "ipic";
106 }; 113 };
107 114
108 par_io@1400 { 115 par_io@1400 {
109 reg = <1400 100>; 116 reg = <1400 100>;
110 device_type = "par_io"; 117 device_type = "par_io";
@@ -117,7 +124,6 @@
117 3 5 1 0 2 0 /* MDC */ 124 3 5 1 0 2 0 /* MDC */
118 0 d 2 0 1 0 /* RX_CLK (CLK9) */ 125 0 d 2 0 1 0 /* RX_CLK (CLK9) */
119 3 18 2 0 1 0 /* TX_CLK (CLK10) */ 126 3 18 2 0 1 0 /* TX_CLK (CLK10) */
120 1 1 1 0 1 0 /* TxD1 */
121 1 0 1 0 1 0 /* TxD0 */ 127 1 0 1 0 1 0 /* TxD0 */
122 1 1 1 0 1 0 /* TxD1 */ 128 1 1 1 0 1 0 /* TxD1 */
123 1 2 1 0 1 0 /* TxD2 */ 129 1 2 1 0 1 0 /* TxD2 */
@@ -165,11 +171,11 @@
165 reg = <e0100000 480>; 171 reg = <e0100000 480>;
166 brg-frequency = <0>; 172 brg-frequency = <0>;
167 bus-frequency = <BCD3D80>; 173 bus-frequency = <BCD3D80>;
168 174
169 muram@10000 { 175 muram@10000 {
170 device_type = "muram"; 176 device_type = "muram";
171 ranges = <0 00010000 00004000>; 177 ranges = <0 00010000 00004000>;
172 178
173 data-only@0 { 179 data-only@0 {
174 reg = <0 4000>; 180 reg = <0 4000>;
175 }; 181 };
@@ -228,7 +234,7 @@
228 compatible = "ucc_geth"; 234 compatible = "ucc_geth";
229 model = "UCC"; 235 model = "UCC";
230 device-id = <4>; 236 device-id = <4>;
231 reg = <3000 200>; 237 reg = <3200 200>;
232 interrupts = <23>; 238 interrupts = <23>;
233 interrupt-parent = < &qeic >; 239 interrupt-parent = < &qeic >;
234 /* 240 /*
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index e5a84ef9f4b0..49363f89cb71 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -57,15 +57,24 @@
57 }; 57 };
58 58
59 i2c@3000 { 59 i2c@3000 {
60 #address-cells = <1>;
61 #size-cells = <0>;
60 device_type = "i2c"; 62 device_type = "i2c";
61 compatible = "fsl-i2c"; 63 compatible = "fsl-i2c";
62 reg = <3000 100>; 64 reg = <3000 100>;
63 interrupts = <e 8>; 65 interrupts = <e 8>;
64 interrupt-parent = < &ipic >; 66 interrupt-parent = < &ipic >;
65 dfsrr; 67 dfsrr;
68
69 rtc@68 {
70 compatible = "dallas,ds1374";
71 reg = <68>;
72 };
66 }; 73 };
67 74
68 i2c@3100 { 75 i2c@3100 {
76 #address-cells = <1>;
77 #size-cells = <0>;
69 device_type = "i2c"; 78 device_type = "i2c";
70 compatible = "fsl-i2c"; 79 compatible = "fsl-i2c";
71 reg = <3100 100>; 80 reg = <3100 100>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index fbd1573c348b..0b2d2b588daa 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -62,15 +62,24 @@
62 }; 62 };
63 63
64 i2c@3000 { 64 i2c@3000 {
65 #address-cells = <1>;
66 #size-cells = <0>;
65 device_type = "i2c"; 67 device_type = "i2c";
66 compatible = "fsl-i2c"; 68 compatible = "fsl-i2c";
67 reg = <3000 100>; 69 reg = <3000 100>;
68 interrupts = <e 8>; 70 interrupts = <e 8>;
69 interrupt-parent = < &ipic >; 71 interrupt-parent = < &ipic >;
70 dfsrr; 72 dfsrr;
73
74 rtc@68 {
75 compatible = "dallas,ds1374";
76 reg = <68>;
77 };
71 }; 78 };
72 79
73 i2c@3100 { 80 i2c@3100 {
81 #address-cells = <1>;
82 #size-cells = <0>;
74 device_type = "i2c"; 83 device_type = "i2c";
75 compatible = "fsl-i2c"; 84 compatible = "fsl-i2c";
76 reg = <3100 100>; 85 reg = <3100 100>;
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 3f9d15cf13e0..6c608de1fc1b 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -272,24 +272,24 @@
272 clock-frequency = <1fca055>; 272 clock-frequency = <1fca055>;
273 interrupt-parent = <&mpic>; 273 interrupt-parent = <&mpic>;
274 interrupts = <1b 2>; 274 interrupts = <1b 2>;
275 interrupt-map-mask = <fb00 0 0 0>; 275 interrupt-map-mask = <ff00 0 0 1>;
276 interrupt-map = < 276 interrupt-map = <
277 // IDSEL 0x1c USB 277 // IDSEL 0x1c USB
278 e000 0 0 0 &i8259 c 2 278 e000 0 0 1 &i8259 c 2
279 e100 0 0 0 &i8259 9 2 279 e100 0 0 1 &i8259 9 2
280 e200 0 0 0 &i8259 a 2 280 e200 0 0 1 &i8259 a 2
281 e300 0 0 0 &i8259 b 2 281 e300 0 0 1 &i8259 b 2
282 282
283 // IDSEL 0x1d Audio 283 // IDSEL 0x1d Audio
284 e800 0 0 0 &i8259 6 2 284 e800 0 0 1 &i8259 6 2
285 285
286 // IDSEL 0x1e Legacy 286 // IDSEL 0x1e Legacy
287 f000 0 0 0 &i8259 7 2 287 f000 0 0 1 &i8259 7 2
288 f100 0 0 0 &i8259 7 2 288 f100 0 0 1 &i8259 7 2
289 289
290 // IDSEL 0x1f IDE/SATA 290 // IDSEL 0x1f IDE/SATA
291 f800 0 0 0 &i8259 e 2 291 f800 0 0 1 &i8259 e 2
292 f900 0 0 0 &i8259 5 2 292 f900 0 0 1 &i8259 5 2
293 >; 293 >;
294 294
295 pcie@0 { 295 pcie@0 {
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index d638deec7652..0eb44fb9647d 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -219,36 +219,120 @@
219 clock-frequency = <1fca055>; 219 clock-frequency = <1fca055>;
220 interrupt-parent = <&mpic>; 220 interrupt-parent = <&mpic>;
221 interrupts = <18 2>; 221 interrupts = <18 2>;
222 interrupt-map-mask = <fb00 0 0 0>; 222 interrupt-map-mask = <ff00 0 0 7>;
223 interrupt-map = < 223 interrupt-map = <
224 /* IDSEL 0x11 - PCI slot 1 */ 224 /* IDSEL 0x11 func 0 - PCI slot 1 */
225 8800 0 0 1 &mpic 2 1 225 8800 0 0 1 &mpic 2 1
226 8800 0 0 2 &mpic 3 1 226 8800 0 0 2 &mpic 3 1
227 8800 0 0 3 &mpic 4 1 227 8800 0 0 3 &mpic 4 1
228 8800 0 0 4 &mpic 1 1 228 8800 0 0 4 &mpic 1 1
229 229
230 /* IDSEL 0x12 - PCI slot 2 */ 230 /* IDSEL 0x11 func 1 - PCI slot 1 */
231 8900 0 0 1 &mpic 2 1
232 8900 0 0 2 &mpic 3 1
233 8900 0 0 3 &mpic 4 1
234 8900 0 0 4 &mpic 1 1
235
236 /* IDSEL 0x11 func 2 - PCI slot 1 */
237 8a00 0 0 1 &mpic 2 1
238 8a00 0 0 2 &mpic 3 1
239 8a00 0 0 3 &mpic 4 1
240 8a00 0 0 4 &mpic 1 1
241
242 /* IDSEL 0x11 func 3 - PCI slot 1 */
243 8b00 0 0 1 &mpic 2 1
244 8b00 0 0 2 &mpic 3 1
245 8b00 0 0 3 &mpic 4 1
246 8b00 0 0 4 &mpic 1 1
247
248 /* IDSEL 0x11 func 4 - PCI slot 1 */
249 8c00 0 0 1 &mpic 2 1
250 8c00 0 0 2 &mpic 3 1
251 8c00 0 0 3 &mpic 4 1
252 8c00 0 0 4 &mpic 1 1
253
254 /* IDSEL 0x11 func 5 - PCI slot 1 */
255 8d00 0 0 1 &mpic 2 1
256 8d00 0 0 2 &mpic 3 1
257 8d00 0 0 3 &mpic 4 1
258 8d00 0 0 4 &mpic 1 1
259
260 /* IDSEL 0x11 func 6 - PCI slot 1 */
261 8e00 0 0 1 &mpic 2 1
262 8e00 0 0 2 &mpic 3 1
263 8e00 0 0 3 &mpic 4 1
264 8e00 0 0 4 &mpic 1 1
265
266 /* IDSEL 0x11 func 7 - PCI slot 1 */
267 8f00 0 0 1 &mpic 2 1
268 8f00 0 0 2 &mpic 3 1
269 8f00 0 0 3 &mpic 4 1
270 8f00 0 0 4 &mpic 1 1
271
272 /* IDSEL 0x12 func 0 - PCI slot 2 */
231 9000 0 0 1 &mpic 3 1 273 9000 0 0 1 &mpic 3 1
232 9000 0 0 2 &mpic 4 1 274 9000 0 0 2 &mpic 4 1
233 9000 0 0 3 &mpic 1 1 275 9000 0 0 3 &mpic 1 1
234 9000 0 0 4 &mpic 2 1 276 9000 0 0 4 &mpic 2 1
235 277
278 /* IDSEL 0x12 func 1 - PCI slot 2 */
279 9100 0 0 1 &mpic 3 1
280 9100 0 0 2 &mpic 4 1
281 9100 0 0 3 &mpic 1 1
282 9100 0 0 4 &mpic 2 1
283
284 /* IDSEL 0x12 func 2 - PCI slot 2 */
285 9200 0 0 1 &mpic 3 1
286 9200 0 0 2 &mpic 4 1
287 9200 0 0 3 &mpic 1 1
288 9200 0 0 4 &mpic 2 1
289
290 /* IDSEL 0x12 func 3 - PCI slot 2 */
291 9300 0 0 1 &mpic 3 1
292 9300 0 0 2 &mpic 4 1
293 9300 0 0 3 &mpic 1 1
294 9300 0 0 4 &mpic 2 1
295
296 /* IDSEL 0x12 func 4 - PCI slot 2 */
297 9400 0 0 1 &mpic 3 1
298 9400 0 0 2 &mpic 4 1
299 9400 0 0 3 &mpic 1 1
300 9400 0 0 4 &mpic 2 1
301
302 /* IDSEL 0x12 func 5 - PCI slot 2 */
303 9500 0 0 1 &mpic 3 1
304 9500 0 0 2 &mpic 4 1
305 9500 0 0 3 &mpic 1 1
306 9500 0 0 4 &mpic 2 1
307
308 /* IDSEL 0x12 func 6 - PCI slot 2 */
309 9600 0 0 1 &mpic 3 1
310 9600 0 0 2 &mpic 4 1
311 9600 0 0 3 &mpic 1 1
312 9600 0 0 4 &mpic 2 1
313
314 /* IDSEL 0x12 func 7 - PCI slot 2 */
315 9700 0 0 1 &mpic 3 1
316 9700 0 0 2 &mpic 4 1
317 9700 0 0 3 &mpic 1 1
318 9700 0 0 4 &mpic 2 1
319
236 // IDSEL 0x1c USB 320 // IDSEL 0x1c USB
237 e000 0 0 0 &i8259 c 2 321 e000 0 0 1 &i8259 c 2
238 e100 0 0 0 &i8259 9 2 322 e100 0 0 1 &i8259 9 2
239 e200 0 0 0 &i8259 a 2 323 e200 0 0 1 &i8259 a 2
240 e300 0 0 0 &i8259 b 2 324 e300 0 0 1 &i8259 b 2
241 325
242 // IDSEL 0x1d Audio 326 // IDSEL 0x1d Audio
243 e800 0 0 0 &i8259 6 2 327 e800 0 0 1 &i8259 6 2
244 328
245 // IDSEL 0x1e Legacy 329 // IDSEL 0x1e Legacy
246 f000 0 0 0 &i8259 7 2 330 f000 0 0 1 &i8259 7 2
247 f100 0 0 0 &i8259 7 2 331 f100 0 0 1 &i8259 7 2
248 332
249 // IDSEL 0x1f IDE/SATA 333 // IDSEL 0x1f IDE/SATA
250 f800 0 0 0 &i8259 e 2 334 f800 0 0 1 &i8259 e 2
251 f900 0 0 0 &i8259 5 2 335 f900 0 0 1 &i8259 5 2
252 336
253 >; 337 >;
254 338
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index 367765937a06..abb26dc42558 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -235,36 +235,120 @@
235 clock-frequency = <1fca055>; 235 clock-frequency = <1fca055>;
236 interrupt-parent = <&mpic>; 236 interrupt-parent = <&mpic>;
237 interrupts = <18 2>; 237 interrupts = <18 2>;
238 interrupt-map-mask = <fb00 0 0 0>; 238 interrupt-map-mask = <ff00 0 0 7>;
239 interrupt-map = < 239 interrupt-map = <
240 /* IDSEL 0x11 */ 240 /* IDSEL 0x11 func 0 - PCI slot 1 */
241 8800 0 0 1 &i8259 9 2 241 8800 0 0 1 &mpic 2 1
242 8800 0 0 2 &i8259 a 2 242 8800 0 0 2 &mpic 3 1
243 8800 0 0 3 &i8259 b 2 243 8800 0 0 3 &mpic 4 1
244 8800 0 0 4 &i8259 c 2 244 8800 0 0 4 &mpic 1 1
245 245
246 /* IDSEL 0x12 */ 246 /* IDSEL 0x11 func 1 - PCI slot 1 */
247 9000 0 0 1 &i8259 a 2 247 8900 0 0 1 &mpic 2 1
248 9000 0 0 2 &i8259 b 2 248 8900 0 0 2 &mpic 3 1
249 9000 0 0 3 &i8259 c 2 249 8900 0 0 3 &mpic 4 1
250 9000 0 0 4 &i8259 9 2 250 8900 0 0 4 &mpic 1 1
251
252 /* IDSEL 0x11 func 2 - PCI slot 1 */
253 8a00 0 0 1 &mpic 2 1
254 8a00 0 0 2 &mpic 3 1
255 8a00 0 0 3 &mpic 4 1
256 8a00 0 0 4 &mpic 1 1
257
258 /* IDSEL 0x11 func 3 - PCI slot 1 */
259 8b00 0 0 1 &mpic 2 1
260 8b00 0 0 2 &mpic 3 1
261 8b00 0 0 3 &mpic 4 1
262 8b00 0 0 4 &mpic 1 1
263
264 /* IDSEL 0x11 func 4 - PCI slot 1 */
265 8c00 0 0 1 &mpic 2 1
266 8c00 0 0 2 &mpic 3 1
267 8c00 0 0 3 &mpic 4 1
268 8c00 0 0 4 &mpic 1 1
269
270 /* IDSEL 0x11 func 5 - PCI slot 1 */
271 8d00 0 0 1 &mpic 2 1
272 8d00 0 0 2 &mpic 3 1
273 8d00 0 0 3 &mpic 4 1
274 8d00 0 0 4 &mpic 1 1
275
276 /* IDSEL 0x11 func 6 - PCI slot 1 */
277 8e00 0 0 1 &mpic 2 1
278 8e00 0 0 2 &mpic 3 1
279 8e00 0 0 3 &mpic 4 1
280 8e00 0 0 4 &mpic 1 1
281
282 /* IDSEL 0x11 func 7 - PCI slot 1 */
283 8f00 0 0 1 &mpic 2 1
284 8f00 0 0 2 &mpic 3 1
285 8f00 0 0 3 &mpic 4 1
286 8f00 0 0 4 &mpic 1 1
287
288 /* IDSEL 0x12 func 0 - PCI slot 2 */
289 9000 0 0 1 &mpic 3 1
290 9000 0 0 2 &mpic 4 1
291 9000 0 0 3 &mpic 1 1
292 9000 0 0 4 &mpic 2 1
293
294 /* IDSEL 0x12 func 1 - PCI slot 2 */
295 9100 0 0 1 &mpic 3 1
296 9100 0 0 2 &mpic 4 1
297 9100 0 0 3 &mpic 1 1
298 9100 0 0 4 &mpic 2 1
299
300 /* IDSEL 0x12 func 2 - PCI slot 2 */
301 9200 0 0 1 &mpic 3 1
302 9200 0 0 2 &mpic 4 1
303 9200 0 0 3 &mpic 1 1
304 9200 0 0 4 &mpic 2 1
305
306 /* IDSEL 0x12 func 3 - PCI slot 2 */
307 9300 0 0 1 &mpic 3 1
308 9300 0 0 2 &mpic 4 1
309 9300 0 0 3 &mpic 1 1
310 9300 0 0 4 &mpic 2 1
311
312 /* IDSEL 0x12 func 4 - PCI slot 2 */
313 9400 0 0 1 &mpic 3 1
314 9400 0 0 2 &mpic 4 1
315 9400 0 0 3 &mpic 1 1
316 9400 0 0 4 &mpic 2 1
317
318 /* IDSEL 0x12 func 5 - PCI slot 2 */
319 9500 0 0 1 &mpic 3 1
320 9500 0 0 2 &mpic 4 1
321 9500 0 0 3 &mpic 1 1
322 9500 0 0 4 &mpic 2 1
323
324 /* IDSEL 0x12 func 6 - PCI slot 2 */
325 9600 0 0 1 &mpic 3 1
326 9600 0 0 2 &mpic 4 1
327 9600 0 0 3 &mpic 1 1
328 9600 0 0 4 &mpic 2 1
329
330 /* IDSEL 0x12 func 7 - PCI slot 2 */
331 9700 0 0 1 &mpic 3 1
332 9700 0 0 2 &mpic 4 1
333 9700 0 0 3 &mpic 1 1
334 9700 0 0 4 &mpic 2 1
251 335
252 // IDSEL 0x1c USB 336 // IDSEL 0x1c USB
253 e000 0 0 0 &i8259 c 2 337 e000 0 0 1 &i8259 c 2
254 e100 0 0 0 &i8259 9 2 338 e100 0 0 1 &i8259 9 2
255 e200 0 0 0 &i8259 a 2 339 e200 0 0 1 &i8259 a 2
256 e300 0 0 0 &i8259 b 2 340 e300 0 0 1 &i8259 b 2
257 341
258 // IDSEL 0x1d Audio 342 // IDSEL 0x1d Audio
259 e800 0 0 0 &i8259 6 2 343 e800 0 0 1 &i8259 6 2
260 344
261 // IDSEL 0x1e Legacy 345 // IDSEL 0x1e Legacy
262 f000 0 0 0 &i8259 7 2 346 f000 0 0 1 &i8259 7 2
263 f100 0 0 0 &i8259 7 2 347 f100 0 0 1 &i8259 7 2
264 348
265 // IDSEL 0x1f IDE/SATA 349 // IDSEL 0x1f IDE/SATA
266 f800 0 0 0 &i8259 e 2 350 f800 0 0 1 &i8259 e 2
267 f900 0 0 0 &i8259 5 2 351 f900 0 0 1 &i8259 5 2
268 >; 352 >;
269 353
270 pcie@0 { 354 pcie@0 {
diff --git a/arch/powerpc/configs/mpc832x_mds_defconfig b/arch/powerpc/configs/mpc832x_mds_defconfig
index dd68d1818d6b..e069018276ca 100644
--- a/arch/powerpc/configs/mpc832x_mds_defconfig
+++ b/arch/powerpc/configs/mpc832x_mds_defconfig
@@ -774,7 +774,53 @@ CONFIG_USB_ARCH_HAS_EHCI=y
774# CONFIG_NEW_LEDS is not set 774# CONFIG_NEW_LEDS is not set
775# CONFIG_INFINIBAND is not set 775# CONFIG_INFINIBAND is not set
776# CONFIG_EDAC is not set 776# CONFIG_EDAC is not set
777# CONFIG_RTC_CLASS is not set 777CONFIG_RTC_LIB=y
778CONFIG_RTC_CLASS=y
779CONFIG_RTC_HCTOSYS=y
780CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
781# CONFIG_RTC_DEBUG is not set
782
783#
784# RTC interfaces
785#
786CONFIG_RTC_INTF_SYSFS=y
787CONFIG_RTC_INTF_PROC=y
788CONFIG_RTC_INTF_DEV=y
789# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
790# CONFIG_RTC_DRV_TEST is not set
791
792#
793# I2C RTC drivers
794#
795# CONFIG_RTC_DRV_DS1307 is not set
796CONFIG_RTC_DRV_DS1374=y
797# CONFIG_RTC_DRV_DS1672 is not set
798# CONFIG_RTC_DRV_MAX6900 is not set
799# CONFIG_RTC_DRV_RS5C372 is not set
800# CONFIG_RTC_DRV_ISL1208 is not set
801# CONFIG_RTC_DRV_X1205 is not set
802# CONFIG_RTC_DRV_PCF8563 is not set
803# CONFIG_RTC_DRV_PCF8583 is not set
804# CONFIG_RTC_DRV_M41T80 is not set
805
806#
807# SPI RTC drivers
808#
809
810#
811# Platform RTC drivers
812#
813# CONFIG_RTC_DRV_CMOS is not set
814# CONFIG_RTC_DRV_DS1553 is not set
815# CONFIG_RTC_DRV_STK17TA8 is not set
816# CONFIG_RTC_DRV_DS1742 is not set
817# CONFIG_RTC_DRV_M48T86 is not set
818# CONFIG_RTC_DRV_M48T59 is not set
819# CONFIG_RTC_DRV_V3020 is not set
820
821#
822# on-CPU RTC drivers
823#
778 824
779# 825#
780# DMA Engine support 826# DMA Engine support
diff --git a/arch/powerpc/configs/mpc832x_rdb_defconfig b/arch/powerpc/configs/mpc832x_rdb_defconfig
index 4f391028c79c..7a5b13f4140f 100644
--- a/arch/powerpc/configs/mpc832x_rdb_defconfig
+++ b/arch/powerpc/configs/mpc832x_rdb_defconfig
@@ -685,8 +685,21 @@ CONFIG_I2C_MPC=y
685# 685#
686# SPI support 686# SPI support
687# 687#
688# CONFIG_SPI is not set 688CONFIG_SPI=y
689# CONFIG_SPI_MASTER is not set 689CONFIG_SPI_MASTER=y
690
691#
692# SPI Master Controller Drivers
693#
694CONFIG_SPI_BITBANG=y
695CONFIG_SPI_MPC83xx=y
696
697#
698# SPI Protocol Masters
699#
700# CONFIG_SPI_AT25 is not set
701# CONFIG_SPI_SPIDEV is not set
702# CONFIG_SPI_TLE62X0 is not set
690# CONFIG_W1 is not set 703# CONFIG_W1 is not set
691# CONFIG_POWER_SUPPLY is not set 704# CONFIG_POWER_SUPPLY is not set
692CONFIG_HWMON=y 705CONFIG_HWMON=y
@@ -710,6 +723,7 @@ CONFIG_HWMON=y
710# CONFIG_SENSORS_GL520SM is not set 723# CONFIG_SENSORS_GL520SM is not set
711# CONFIG_SENSORS_IT87 is not set 724# CONFIG_SENSORS_IT87 is not set
712# CONFIG_SENSORS_LM63 is not set 725# CONFIG_SENSORS_LM63 is not set
726# CONFIG_SENSORS_LM70 is not set
713# CONFIG_SENSORS_LM75 is not set 727# CONFIG_SENSORS_LM75 is not set
714# CONFIG_SENSORS_LM77 is not set 728# CONFIG_SENSORS_LM77 is not set
715# CONFIG_SENSORS_LM78 is not set 729# CONFIG_SENSORS_LM78 is not set
@@ -896,7 +910,24 @@ CONFIG_USB_MON=y
896# USB Gadget Support 910# USB Gadget Support
897# 911#
898# CONFIG_USB_GADGET is not set 912# CONFIG_USB_GADGET is not set
899# CONFIG_MMC is not set 913CONFIG_MMC=y
914# CONFIG_MMC_DEBUG is not set
915# CONFIG_MMC_UNSAFE_RESUME is not set
916
917#
918# MMC/SD Card Drivers
919#
920CONFIG_MMC_BLOCK=y
921CONFIG_MMC_BLOCK_BOUNCE=y
922# CONFIG_SDIO_UART is not set
923
924#
925# MMC/SD Host Controller Drivers
926#
927# CONFIG_MMC_SDHCI is not set
928# CONFIG_MMC_WBSD is not set
929# CONFIG_MMC_TIFM_SD is not set
930CONFIG_MMC_SPI=y
900# CONFIG_NEW_LEDS is not set 931# CONFIG_NEW_LEDS is not set
901# CONFIG_INFINIBAND is not set 932# CONFIG_INFINIBAND is not set
902# CONFIG_EDAC is not set 933# CONFIG_EDAC is not set
@@ -1101,9 +1132,9 @@ CONFIG_UCC=y
1101CONFIG_BITREVERSE=y 1132CONFIG_BITREVERSE=y
1102# CONFIG_CRC_CCITT is not set 1133# CONFIG_CRC_CCITT is not set
1103# CONFIG_CRC16 is not set 1134# CONFIG_CRC16 is not set
1104# CONFIG_CRC_ITU_T is not set 1135CONFIG_CRC_ITU_T=y
1105CONFIG_CRC32=y 1136CONFIG_CRC32=y
1106# CONFIG_CRC7 is not set 1137CONFIG_CRC7=y
1107# CONFIG_LIBCRC32C is not set 1138# CONFIG_LIBCRC32C is not set
1108CONFIG_PLIST=y 1139CONFIG_PLIST=y
1109CONFIG_HAS_IOMEM=y 1140CONFIG_HAS_IOMEM=y
diff --git a/arch/powerpc/configs/mpc834x_itx_defconfig b/arch/powerpc/configs/mpc834x_itx_defconfig
index eb28dd85cb2b..ba512d13f3a3 100644
--- a/arch/powerpc/configs/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/mpc834x_itx_defconfig
@@ -867,7 +867,7 @@ CONFIG_USB_EHCI_ROOT_HUB_TT=y
867CONFIG_USB_EHCI_FSL=y 867CONFIG_USB_EHCI_FSL=y
868# CONFIG_USB_ISP116X_HCD is not set 868# CONFIG_USB_ISP116X_HCD is not set
869# CONFIG_USB_OHCI_HCD is not set 869# CONFIG_USB_OHCI_HCD is not set
870# CONFIG_USB_UHCI_HCD is not set 870CONFIG_USB_UHCI_HCD=y
871# CONFIG_USB_SL811_HCD is not set 871# CONFIG_USB_SL811_HCD is not set
872# CONFIG_USB_R8A66597_HCD is not set 872# CONFIG_USB_R8A66597_HCD is not set
873 873
diff --git a/arch/powerpc/configs/mpc834x_itxgp_defconfig b/arch/powerpc/configs/mpc834x_itxgp_defconfig
index 22b95462c913..9faa948c22ad 100644
--- a/arch/powerpc/configs/mpc834x_itxgp_defconfig
+++ b/arch/powerpc/configs/mpc834x_itxgp_defconfig
@@ -760,15 +760,101 @@ CONFIG_USB_SUPPORT=y
760CONFIG_USB_ARCH_HAS_HCD=y 760CONFIG_USB_ARCH_HAS_HCD=y
761CONFIG_USB_ARCH_HAS_OHCI=y 761CONFIG_USB_ARCH_HAS_OHCI=y
762CONFIG_USB_ARCH_HAS_EHCI=y 762CONFIG_USB_ARCH_HAS_EHCI=y
763# CONFIG_USB is not set 763CONFIG_USB=y
764# CONFIG_USB_DEBUG is not set
765
766#
767# Miscellaneous USB options
768#
769# CONFIG_USB_DEVICEFS is not set
770CONFIG_USB_DEVICE_CLASS=y
771# CONFIG_USB_DYNAMIC_MINORS is not set
772# CONFIG_USB_OTG is not set
773
774#
775# USB Host Controller Drivers
776#
777CONFIG_USB_EHCI_HCD=y
778# CONFIG_USB_EHCI_SPLIT_ISO is not set
764CONFIG_USB_EHCI_ROOT_HUB_TT=y 779CONFIG_USB_EHCI_ROOT_HUB_TT=y
780# CONFIG_USB_EHCI_TT_NEWSCHED is not set
765CONFIG_USB_EHCI_FSL=y 781CONFIG_USB_EHCI_FSL=y
782# CONFIG_USB_ISP116X_HCD is not set
783# CONFIG_USB_OHCI_HCD is not set
784CONFIG_USB_UHCI_HCD=y
785# CONFIG_USB_SL811_HCD is not set
786# CONFIG_USB_R8A66597_HCD is not set
787
788#
789# USB Device Class drivers
790#
791# CONFIG_USB_ACM is not set
792# CONFIG_USB_PRINTER is not set
766 793
767# 794#
768# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 795# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
769# 796#
770 797
771# 798#
799# may also be needed; see USB_STORAGE Help for more information
800#
801CONFIG_USB_STORAGE=y
802# CONFIG_USB_STORAGE_DEBUG is not set
803# CONFIG_USB_STORAGE_DATAFAB is not set
804# CONFIG_USB_STORAGE_FREECOM is not set
805# CONFIG_USB_STORAGE_DPCM is not set
806# CONFIG_USB_STORAGE_USBAT is not set
807# CONFIG_USB_STORAGE_SDDR09 is not set
808# CONFIG_USB_STORAGE_SDDR55 is not set
809# CONFIG_USB_STORAGE_JUMPSHOT is not set
810# CONFIG_USB_STORAGE_ALAUDA is not set
811# CONFIG_USB_STORAGE_KARMA is not set
812# CONFIG_USB_LIBUSUAL is not set
813
814#
815# USB Imaging devices
816#
817# CONFIG_USB_MDC800 is not set
818# CONFIG_USB_MICROTEK is not set
819CONFIG_USB_MON=y
820
821#
822# USB port drivers
823#
824
825#
826# USB Serial Converter support
827#
828# CONFIG_USB_SERIAL is not set
829
830#
831# USB Miscellaneous drivers
832#
833# CONFIG_USB_EMI62 is not set
834# CONFIG_USB_EMI26 is not set
835# CONFIG_USB_ADUTUX is not set
836# CONFIG_USB_AUERSWALD is not set
837# CONFIG_USB_RIO500 is not set
838# CONFIG_USB_LEGOTOWER is not set
839# CONFIG_USB_LCD is not set
840# CONFIG_USB_BERRY_CHARGE is not set
841# CONFIG_USB_LED is not set
842# CONFIG_USB_CYPRESS_CY7C63 is not set
843# CONFIG_USB_CYTHERM is not set
844# CONFIG_USB_PHIDGET is not set
845# CONFIG_USB_IDMOUSE is not set
846# CONFIG_USB_FTDI_ELAN is not set
847# CONFIG_USB_APPLEDISPLAY is not set
848# CONFIG_USB_SISUSBVGA is not set
849# CONFIG_USB_LD is not set
850# CONFIG_USB_TRANCEVIBRATOR is not set
851# CONFIG_USB_IOWARRIOR is not set
852
853#
854# USB DSL modem support
855#
856
857#
772# USB Gadget Support 858# USB Gadget Support
773# 859#
774# CONFIG_USB_GADGET is not set 860# CONFIG_USB_GADGET is not set
diff --git a/arch/powerpc/configs/mpc834x_mds_defconfig b/arch/powerpc/configs/mpc834x_mds_defconfig
index e59a88e95486..356f736a5d3d 100644
--- a/arch/powerpc/configs/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/mpc834x_mds_defconfig
@@ -721,7 +721,53 @@ CONFIG_USB_EHCI_FSL=y
721# CONFIG_NEW_LEDS is not set 721# CONFIG_NEW_LEDS is not set
722# CONFIG_INFINIBAND is not set 722# CONFIG_INFINIBAND is not set
723# CONFIG_EDAC is not set 723# CONFIG_EDAC is not set
724# CONFIG_RTC_CLASS is not set 724CONFIG_RTC_LIB=y
725CONFIG_RTC_CLASS=y
726CONFIG_RTC_HCTOSYS=y
727CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
728# CONFIG_RTC_DEBUG is not set
729
730#
731# RTC interfaces
732#
733CONFIG_RTC_INTF_SYSFS=y
734CONFIG_RTC_INTF_PROC=y
735CONFIG_RTC_INTF_DEV=y
736# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
737# CONFIG_RTC_DRV_TEST is not set
738
739#
740# I2C RTC drivers
741#
742# CONFIG_RTC_DRV_DS1307 is not set
743CONFIG_RTC_DRV_DS1374=y
744# CONFIG_RTC_DRV_DS1672 is not set
745# CONFIG_RTC_DRV_MAX6900 is not set
746# CONFIG_RTC_DRV_RS5C372 is not set
747# CONFIG_RTC_DRV_ISL1208 is not set
748# CONFIG_RTC_DRV_X1205 is not set
749# CONFIG_RTC_DRV_PCF8563 is not set
750# CONFIG_RTC_DRV_PCF8583 is not set
751# CONFIG_RTC_DRV_M41T80 is not set
752
753#
754# SPI RTC drivers
755#
756
757#
758# Platform RTC drivers
759#
760# CONFIG_RTC_DRV_CMOS is not set
761# CONFIG_RTC_DRV_DS1553 is not set
762# CONFIG_RTC_DRV_STK17TA8 is not set
763# CONFIG_RTC_DRV_DS1742 is not set
764# CONFIG_RTC_DRV_M48T86 is not set
765# CONFIG_RTC_DRV_M48T59 is not set
766# CONFIG_RTC_DRV_V3020 is not set
767
768#
769# on-CPU RTC drivers
770#
725 771
726# 772#
727# DMA Engine support 773# DMA Engine support
diff --git a/arch/powerpc/configs/mpc836x_mds_defconfig b/arch/powerpc/configs/mpc836x_mds_defconfig
index 75657528518e..1b4d37570eb1 100644
--- a/arch/powerpc/configs/mpc836x_mds_defconfig
+++ b/arch/powerpc/configs/mpc836x_mds_defconfig
@@ -773,7 +773,53 @@ CONFIG_USB_ARCH_HAS_EHCI=y
773# CONFIG_NEW_LEDS is not set 773# CONFIG_NEW_LEDS is not set
774# CONFIG_INFINIBAND is not set 774# CONFIG_INFINIBAND is not set
775# CONFIG_EDAC is not set 775# CONFIG_EDAC is not set
776# CONFIG_RTC_CLASS is not set 776CONFIG_RTC_LIB=y
777CONFIG_RTC_CLASS=y
778CONFIG_RTC_HCTOSYS=y
779CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
780# CONFIG_RTC_DEBUG is not set
781
782#
783# RTC interfaces
784#
785CONFIG_RTC_INTF_SYSFS=y
786CONFIG_RTC_INTF_PROC=y
787CONFIG_RTC_INTF_DEV=y
788# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
789# CONFIG_RTC_DRV_TEST is not set
790
791#
792# I2C RTC drivers
793#
794# CONFIG_RTC_DRV_DS1307 is not set
795CONFIG_RTC_DRV_DS1374=y
796# CONFIG_RTC_DRV_DS1672 is not set
797# CONFIG_RTC_DRV_MAX6900 is not set
798# CONFIG_RTC_DRV_RS5C372 is not set
799# CONFIG_RTC_DRV_ISL1208 is not set
800# CONFIG_RTC_DRV_X1205 is not set
801# CONFIG_RTC_DRV_PCF8563 is not set
802# CONFIG_RTC_DRV_PCF8583 is not set
803# CONFIG_RTC_DRV_M41T80 is not set
804
805#
806# SPI RTC drivers
807#
808
809#
810# Platform RTC drivers
811#
812# CONFIG_RTC_DRV_CMOS is not set
813# CONFIG_RTC_DRV_DS1553 is not set
814# CONFIG_RTC_DRV_STK17TA8 is not set
815# CONFIG_RTC_DRV_DS1742 is not set
816# CONFIG_RTC_DRV_M48T86 is not set
817# CONFIG_RTC_DRV_M48T59 is not set
818# CONFIG_RTC_DRV_V3020 is not set
819
820#
821# on-CPU RTC drivers
822#
777 823
778# 824#
779# DMA Engine support 825# DMA Engine support
diff --git a/arch/powerpc/configs/mpc8568mds_defconfig b/arch/powerpc/configs/mpc8568mds_defconfig
index 883d8af9debd..d665e7a797c0 100644
--- a/arch/powerpc/configs/mpc8568mds_defconfig
+++ b/arch/powerpc/configs/mpc8568mds_defconfig
@@ -768,7 +768,53 @@ CONFIG_USB_ARCH_HAS_EHCI=y
768# CONFIG_NEW_LEDS is not set 768# CONFIG_NEW_LEDS is not set
769# CONFIG_INFINIBAND is not set 769# CONFIG_INFINIBAND is not set
770# CONFIG_EDAC is not set 770# CONFIG_EDAC is not set
771# CONFIG_RTC_CLASS is not set 771CONFIG_RTC_LIB=y
772CONFIG_RTC_CLASS=y
773CONFIG_RTC_HCTOSYS=y
774CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
775# CONFIG_RTC_DEBUG is not set
776
777#
778# RTC interfaces
779#
780CONFIG_RTC_INTF_SYSFS=y
781CONFIG_RTC_INTF_PROC=y
782CONFIG_RTC_INTF_DEV=y
783# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
784# CONFIG_RTC_DRV_TEST is not set
785
786#
787# I2C RTC drivers
788#
789# CONFIG_RTC_DRV_DS1307 is not set
790CONFIG_RTC_DRV_DS1374=y
791# CONFIG_RTC_DRV_DS1672 is not set
792# CONFIG_RTC_DRV_MAX6900 is not set
793# CONFIG_RTC_DRV_RS5C372 is not set
794# CONFIG_RTC_DRV_ISL1208 is not set
795# CONFIG_RTC_DRV_X1205 is not set
796# CONFIG_RTC_DRV_PCF8563 is not set
797# CONFIG_RTC_DRV_PCF8583 is not set
798# CONFIG_RTC_DRV_M41T80 is not set
799
800#
801# SPI RTC drivers
802#
803
804#
805# Platform RTC drivers
806#
807# CONFIG_RTC_DRV_CMOS is not set
808# CONFIG_RTC_DRV_DS1553 is not set
809# CONFIG_RTC_DRV_STK17TA8 is not set
810# CONFIG_RTC_DRV_DS1742 is not set
811# CONFIG_RTC_DRV_M48T86 is not set
812# CONFIG_RTC_DRV_M48T59 is not set
813# CONFIG_RTC_DRV_V3020 is not set
814
815#
816# on-CPU RTC drivers
817#
772 818
773# 819#
774# DMA Engine support 820# DMA Engine support
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 2c8e756d19a3..d67bcd84f329 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -284,6 +284,10 @@ int main(void)
284 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32)); 284 DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
285 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec)); 285 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
286 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 286 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
287 DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size));
288 DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size));
289 DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size));
290 DEFINE(CFG_DCACHE_LOGBLOCKSZ, offsetof(struct vdso_data, dcache_log_block_size));
287#ifdef CONFIG_PPC64 291#ifdef CONFIG_PPC64
288 DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64)); 292 DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64));
289 DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec)); 293 DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec));
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 214780798289..053cac19f714 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -19,6 +19,9 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/smp.h>
23#include <linux/completion.h>
24#include <linux/cpumask.h>
22 25
23#include <asm/prom.h> 26#include <asm/prom.h>
24#include <asm/rtas.h> 27#include <asm/rtas.h>
@@ -34,6 +37,8 @@
34#include <asm/lmb.h> 37#include <asm/lmb.h>
35#include <asm/udbg.h> 38#include <asm/udbg.h>
36#include <asm/syscalls.h> 39#include <asm/syscalls.h>
40#include <asm/smp.h>
41#include <asm/atomic.h>
37 42
38struct rtas_t rtas = { 43struct rtas_t rtas = {
39 .lock = SPIN_LOCK_UNLOCKED 44 .lock = SPIN_LOCK_UNLOCKED
@@ -41,8 +46,10 @@ struct rtas_t rtas = {
41EXPORT_SYMBOL(rtas); 46EXPORT_SYMBOL(rtas);
42 47
43struct rtas_suspend_me_data { 48struct rtas_suspend_me_data {
44 long waiting; 49 atomic_t working; /* number of cpus accessing this struct */
45 struct rtas_args *args; 50 int token; /* ibm,suspend-me */
51 int error;
52 struct completion *complete; /* wait on this until working == 0 */
46}; 53};
47 54
48DEFINE_SPINLOCK(rtas_data_buf_lock); 55DEFINE_SPINLOCK(rtas_data_buf_lock);
@@ -631,18 +638,18 @@ void rtas_halt(void)
631/* Must be in the RMO region, so we place it here */ 638/* Must be in the RMO region, so we place it here */
632static char rtas_os_term_buf[2048]; 639static char rtas_os_term_buf[2048];
633 640
634void rtas_os_term(char *str) 641void rtas_panic_msg(char *str)
635{ 642{
636 int status; 643 snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
644}
637 645
638 if (panic_timeout) 646void rtas_os_term(void)
639 return; 647{
648 int status;
640 649
641 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) 650 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term"))
642 return; 651 return;
643 652
644 snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str);
645
646 do { 653 do {
647 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL, 654 status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL,
648 __pa(rtas_os_term_buf)); 655 __pa(rtas_os_term_buf));
@@ -657,50 +664,62 @@ static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
657#ifdef CONFIG_PPC_PSERIES 664#ifdef CONFIG_PPC_PSERIES
658static void rtas_percpu_suspend_me(void *info) 665static void rtas_percpu_suspend_me(void *info)
659{ 666{
660 int i;
661 long rc; 667 long rc;
662 long flags; 668 unsigned long msr_save;
669 int cpu;
663 struct rtas_suspend_me_data *data = 670 struct rtas_suspend_me_data *data =
664 (struct rtas_suspend_me_data *)info; 671 (struct rtas_suspend_me_data *)info;
665 672
666 /* 673 atomic_inc(&data->working);
667 * We use "waiting" to indicate our state. As long 674
668 * as it is >0, we are still trying to all join up. 675 /* really need to ensure MSR.EE is off for H_JOIN */
669 * If it goes to 0, we have successfully joined up and 676 msr_save = mfmsr();
670 * one thread got H_CONTINUE. If any error happens, 677 mtmsr(msr_save & ~(MSR_EE));
671 * we set it to <0. 678
672 */ 679 rc = plpar_hcall_norets(H_JOIN);
673 local_irq_save(flags);
674 do {
675 rc = plpar_hcall_norets(H_JOIN);
676 smp_rmb();
677 } while (rc == H_SUCCESS && data->waiting > 0);
678 if (rc == H_SUCCESS)
679 goto out;
680 680
681 if (rc == H_CONTINUE) { 681 mtmsr(msr_save);
682 data->waiting = 0; 682
683 data->args->args[data->args->nargs] = 683 if (rc == H_SUCCESS) {
684 rtas_call(ibm_suspend_me_token, 0, 1, NULL); 684 /* This cpu was prodded and the suspend is complete. */
685 for_each_possible_cpu(i) 685 goto out;
686 plpar_hcall_norets(H_PROD,i); 686 } else if (rc == H_CONTINUE) {
687 /* All other cpus are in H_JOIN, this cpu does
688 * the suspend.
689 */
690 printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n",
691 smp_processor_id());
692 data->error = rtas_call(data->token, 0, 1, NULL);
693
694 if (data->error)
695 printk(KERN_DEBUG "ibm,suspend-me returned %d\n",
696 data->error);
687 } else { 697 } else {
688 data->waiting = -EBUSY; 698 printk(KERN_ERR "H_JOIN on cpu %i failed with rc = %ld\n",
689 printk(KERN_ERR "Error on H_JOIN hypervisor call\n"); 699 smp_processor_id(), rc);
700 data->error = rc;
690 } 701 }
691 702 /* This cpu did the suspend or got an error; in either case,
703 * we need to prod all other other cpus out of join state.
704 * Extra prods are harmless.
705 */
706 for_each_online_cpu(cpu)
707 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
692out: 708out:
693 local_irq_restore(flags); 709 if (atomic_dec_return(&data->working) == 0)
694 return; 710 complete(data->complete);
695} 711}
696 712
697static int rtas_ibm_suspend_me(struct rtas_args *args) 713static int rtas_ibm_suspend_me(struct rtas_args *args)
698{ 714{
699 int i;
700 long state; 715 long state;
701 long rc; 716 long rc;
702 unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 717 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
703 struct rtas_suspend_me_data data; 718 struct rtas_suspend_me_data data;
719 DECLARE_COMPLETION_ONSTACK(done);
720
721 if (!rtas_service_present("ibm,suspend-me"))
722 return -ENOSYS;
704 723
705 /* Make sure the state is valid */ 724 /* Make sure the state is valid */
706 rc = plpar_hcall(H_VASI_STATE, retbuf, 725 rc = plpar_hcall(H_VASI_STATE, retbuf,
@@ -721,25 +740,23 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
721 return 0; 740 return 0;
722 } 741 }
723 742
724 data.waiting = 1; 743 atomic_set(&data.working, 0);
725 data.args = args; 744 data.token = rtas_token("ibm,suspend-me");
745 data.error = 0;
746 data.complete = &done;
726 747
727 /* Call function on all CPUs. One of us will make the 748 /* Call function on all CPUs. One of us will make the
728 * rtas call 749 * rtas call
729 */ 750 */
730 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0)) 751 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0))
731 data.waiting = -EINVAL; 752 data.error = -EINVAL;
732 753
733 if (data.waiting != 0) 754 wait_for_completion(&done);
734 printk(KERN_ERR "Error doing global join\n");
735 755
736 /* Prod each CPU. This won't hurt, and will wake 756 if (data.error != 0)
737 * anyone we successfully put to sleep with H_JOIN. 757 printk(KERN_ERR "Error doing global join\n");
738 */
739 for_each_possible_cpu(i)
740 plpar_hcall_norets(H_PROD, i);
741 758
742 return data.waiting; 759 return data.error;
743} 760}
744#else /* CONFIG_PPC_PSERIES */ 761#else /* CONFIG_PPC_PSERIES */
745static int rtas_ibm_suspend_me(struct rtas_args *args) 762static int rtas_ibm_suspend_me(struct rtas_args *args)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c0d77723ba11..a925a8eae121 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -241,8 +241,9 @@ void account_system_vtime(struct task_struct *tsk)
241 /* deltascaled includes both user and system time. 241 /* deltascaled includes both user and system time.
242 * Hence scale it based on the purr ratio to estimate 242 * Hence scale it based on the purr ratio to estimate
243 * the system time */ 243 * the system time */
244 deltascaled = deltascaled * get_paca()->system_time / 244 if (get_paca()->user_time)
245 (get_paca()->system_time + get_paca()->user_time); 245 deltascaled = deltascaled * get_paca()->system_time /
246 (get_paca()->system_time + get_paca()->user_time);
246 delta += get_paca()->system_time; 247 delta += get_paca()->system_time;
247 get_paca()->system_time = 0; 248 get_paca()->system_time = 0;
248 } 249 }
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 2322ba5cce4c..3702df7dc567 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -699,11 +699,22 @@ static int __init vdso_init(void)
699 vdso_data->icache_size = ppc64_caches.isize; 699 vdso_data->icache_size = ppc64_caches.isize;
700 vdso_data->icache_line_size = ppc64_caches.iline_size; 700 vdso_data->icache_line_size = ppc64_caches.iline_size;
701 701
702 /* XXXOJN: Blocks should be added to ppc64_caches and used instead */
703 vdso_data->dcache_block_size = ppc64_caches.dline_size;
704 vdso_data->icache_block_size = ppc64_caches.iline_size;
705 vdso_data->dcache_log_block_size = ppc64_caches.log_dline_size;
706 vdso_data->icache_log_block_size = ppc64_caches.log_iline_size;
707
702 /* 708 /*
703 * Calculate the size of the 64 bits vDSO 709 * Calculate the size of the 64 bits vDSO
704 */ 710 */
705 vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT; 711 vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT;
706 DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages); 712 DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages);
713#else
714 vdso_data->dcache_block_size = L1_CACHE_BYTES;
715 vdso_data->dcache_log_block_size = L1_CACHE_SHIFT;
716 vdso_data->icache_block_size = L1_CACHE_BYTES;
717 vdso_data->icache_log_block_size = L1_CACHE_SHIFT;
707#endif /* CONFIG_PPC64 */ 718#endif /* CONFIG_PPC64 */
708 719
709 720
diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S
index 9cb319992c38..1ba6feb71b31 100644
--- a/arch/powerpc/kernel/vdso32/cacheflush.S
+++ b/arch/powerpc/kernel/vdso32/cacheflush.S
@@ -23,29 +23,46 @@
23 * 23 *
24 * Flushes the data cache & invalidate the instruction cache for the 24 * Flushes the data cache & invalidate the instruction cache for the
25 * provided range [start, end[ 25 * provided range [start, end[
26 *
27 * Note: all CPUs supported by this kernel have a 128 bytes cache
28 * line size so we don't have to peek that info from the datapage
29 */ 26 */
30V_FUNCTION_BEGIN(__kernel_sync_dicache) 27V_FUNCTION_BEGIN(__kernel_sync_dicache)
31 .cfi_startproc 28 .cfi_startproc
32 li r5,127 29 mflr r12
33 andc r6,r3,r5 /* round low to line bdy */ 30 .cfi_register lr,r12
31 mr r11,r3
32 bl __get_datapage@local
33 mtlr r12
34 mr r10,r3
35
36 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
37 addi r5,r7,-1
38 andc r6,r11,r5 /* round low to line bdy */
34 subf r8,r6,r4 /* compute length */ 39 subf r8,r6,r4 /* compute length */
35 add r8,r8,r5 /* ensure we get enough */ 40 add r8,r8,r5 /* ensure we get enough */
36 srwi. r8,r8,7 /* compute line count */ 41 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
42 srw. r8,r8,r9 /* compute line count */
37 crclr cr0*4+so 43 crclr cr0*4+so
38 beqlr /* nothing to do? */ 44 beqlr /* nothing to do? */
39 mtctr r8 45 mtctr r8
40 mr r3,r6 461: dcbst 0,r6
411: dcbst 0,r3 47 add r6,r6,r7
42 addi r3,r3,128
43 bdnz 1b 48 bdnz 1b
44 sync 49 sync
50
51/* Now invalidate the instruction cache */
52
53 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
54 addi r5,r7,-1
55 andc r6,r11,r5 /* round low to line bdy */
56 subf r8,r6,r4 /* compute length */
57 add r8,r8,r5
58 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
59 srw. r8,r8,r9 /* compute line count */
60 crclr cr0*4+so
61 beqlr /* nothing to do? */
45 mtctr r8 62 mtctr r8
461: icbi 0,r6 632: icbi 0,r6
47 addi r6,r6,128 64 add r6,r6,r7
48 bdnz 1b 65 bdnz 2b
49 isync 66 isync
50 li r3,0 67 li r3,0
51 blr 68 blr
diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S
index 66a36d3cc6ad..69c5af2b3c96 100644
--- a/arch/powerpc/kernel/vdso64/cacheflush.S
+++ b/arch/powerpc/kernel/vdso64/cacheflush.S
@@ -23,29 +23,46 @@
23 * 23 *
24 * Flushes the data cache & invalidate the instruction cache for the 24 * Flushes the data cache & invalidate the instruction cache for the
25 * provided range [start, end[ 25 * provided range [start, end[
26 *
27 * Note: all CPUs supported by this kernel have a 128 bytes cache
28 * line size so we don't have to peek that info from the datapage
29 */ 26 */
30V_FUNCTION_BEGIN(__kernel_sync_dicache) 27V_FUNCTION_BEGIN(__kernel_sync_dicache)
31 .cfi_startproc 28 .cfi_startproc
32 li r5,127 29 mflr r12
33 andc r6,r3,r5 /* round low to line bdy */ 30 .cfi_register lr,r12
31 mr r11,r3
32 bl V_LOCAL_FUNC(__get_datapage)
33 mtlr r12
34 mr r10,r3
35
36 lwz r7,CFG_DCACHE_BLOCKSZ(r10)
37 addi r5,r7,-1
38 andc r6,r11,r5 /* round low to line bdy */
34 subf r8,r6,r4 /* compute length */ 39 subf r8,r6,r4 /* compute length */
35 add r8,r8,r5 /* ensure we get enough */ 40 add r8,r8,r5 /* ensure we get enough */
36 srwi. r8,r8,7 /* compute line count */ 41 lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10)
42 srw. r8,r8,r9 /* compute line count */
37 crclr cr0*4+so 43 crclr cr0*4+so
38 beqlr /* nothing to do? */ 44 beqlr /* nothing to do? */
39 mtctr r8 45 mtctr r8
40 mr r3,r6 461: dcbst 0,r6
411: dcbst 0,r3 47 add r6,r6,r7
42 addi r3,r3,128
43 bdnz 1b 48 bdnz 1b
44 sync 49 sync
50
51/* Now invalidate the instruction cache */
52
53 lwz r7,CFG_ICACHE_BLOCKSZ(r10)
54 addi r5,r7,-1
55 andc r6,r11,r5 /* round low to line bdy */
56 subf r8,r6,r4 /* compute length */
57 add r8,r8,r5
58 lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10)
59 srw. r8,r8,r9 /* compute line count */
60 crclr cr0*4+so
61 beqlr /* nothing to do? */
45 mtctr r8 62 mtctr r8
461: icbi 0,r6 632: icbi 0,r6
47 addi r6,r6,128 64 add r6,r6,r7
48 bdnz 1b 65 bdnz 2b
49 isync 66 isync
50 li r3,0 67 li r3,0
51 blr 68 blr
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 81eb96ec13b2..5402fb6b3aae 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -464,7 +464,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
464 * we invalidate the TLB here, thus avoiding dcbst 464 * we invalidate the TLB here, thus avoiding dcbst
465 * misbehaviour. 465 * misbehaviour.
466 */ 466 */
467 _tlbie(address); 467 _tlbie(address, 0 /* 8xx doesn't care about PID */);
468#endif 468#endif
469 if (!PageReserved(page) 469 if (!PageReserved(page)
470 && !test_bit(PG_arch_1, &page->flags)) { 470 && !test_bit(PG_arch_1, &page->flags)) {
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index eb3a732e91db..ebfd13dc9d19 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -56,7 +56,7 @@ extern unsigned long total_lowmem;
56 * architectures. -- Dan 56 * architectures. -- Dan
57 */ 57 */
58#if defined(CONFIG_8xx) 58#if defined(CONFIG_8xx)
59#define flush_HPTE(X, va, pg) _tlbie(va) 59#define flush_HPTE(X, va, pg) _tlbie(va, 0 /* 8xx doesn't care about PID */)
60#define MMU_init_hw() do { } while(0) 60#define MMU_init_hw() do { } while(0)
61#define mmu_mapin_ram() (0UL) 61#define mmu_mapin_ram() (0UL)
62 62
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 9e85bda76216..50448d5de9d2 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -20,6 +20,7 @@
20#include <asm/lmb.h> 20#include <asm/lmb.h>
21#include <asm/abs_addr.h> 21#include <asm/abs_addr.h>
22#include <asm/firmware.h> 22#include <asm/firmware.h>
23#include <asm/iseries/hv_call.h>
23 24
24struct stab_entry { 25struct stab_entry {
25 unsigned long esid_data; 26 unsigned long esid_data;
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index eb0c136b1c44..ff6db2431798 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -17,12 +17,13 @@
17 */ 17 */
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h>
21
20#include <asm/machdep.h> 22#include <asm/machdep.h>
21#include <asm/prom.h> 23#include <asm/prom.h>
22#include <asm/udbg.h> 24#include <asm/udbg.h>
23#include <asm/time.h> 25#include <asm/time.h>
24#include <asm/uic.h> 26#include <asm/uic.h>
25#include <asm/of_platform.h>
26 27
27static struct of_device_id walnut_of_bus[] = { 28static struct of_device_id walnut_of_bus[] = {
28 { .compatible = "ibm,plb3", }, 29 { .compatible = "ibm,plb3", },
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index 470e1a3fd755..be23f112184f 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -14,12 +14,13 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/of_platform.h>
18
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18#include <asm/prom.h> 20#include <asm/prom.h>
19#include <asm/udbg.h> 21#include <asm/udbg.h>
20#include <asm/time.h> 22#include <asm/time.h>
21#include <asm/uic.h> 23#include <asm/uic.h>
22#include <asm/of_platform.h>
23#include "44x.h" 24#include "44x.h"
24 25
25static struct of_device_id bamboo_of_bus[] = { 26static struct of_device_id bamboo_of_bus[] = {
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 40e18fcb666c..6cd3476767cc 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -17,12 +17,13 @@
17 */ 17 */
18 18
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h>
21
20#include <asm/machdep.h> 22#include <asm/machdep.h>
21#include <asm/prom.h> 23#include <asm/prom.h>
22#include <asm/udbg.h> 24#include <asm/udbg.h>
23#include <asm/time.h> 25#include <asm/time.h>
24#include <asm/uic.h> 26#include <asm/uic.h>
25#include <asm/of_platform.h>
26 27
27#include "44x.h" 28#include "44x.h"
28 29
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index 30700b31d43b..21a9dd14f297 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -14,12 +14,13 @@
14 * option) any later version. 14 * option) any later version.
15 */ 15 */
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/of_platform.h>
18
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18#include <asm/prom.h> 20#include <asm/prom.h>
19#include <asm/udbg.h> 21#include <asm/udbg.h>
20#include <asm/time.h> 22#include <asm/time.h>
21#include <asm/uic.h> 23#include <asm/uic.h>
22#include <asm/of_platform.h>
23#include "44x.h" 24#include "44x.h"
24 25
25static struct of_device_id sequoia_of_bus[] = { 26static struct of_device_id sequoia_of_bus[] = {
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 972fa8528a8c..39ee7a13b25a 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -90,10 +90,11 @@ static void __init mpc832x_sys_setup_arch(void)
90 90
91 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth")) 91 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
92 != NULL){ 92 != NULL){
93 /* Reset the Ethernet PHY */ 93 /* Reset the Ethernet PHYs */
94 bcsr_regs[9] &= ~0x20; 94#define BCSR8_FETH_RST 0x50
95 bcsr_regs[8] &= ~BCSR8_FETH_RST;
95 udelay(1000); 96 udelay(1000);
96 bcsr_regs[9] |= 0x20; 97 bcsr_regs[8] |= BCSR8_FETH_RST;
97 iounmap(bcsr_regs); 98 iounmap(bcsr_regs);
98 of_node_put(np); 99 of_node_put(np);
99 } 100 }
@@ -145,30 +146,6 @@ static void __init mpc832x_sys_init_IRQ(void)
145#endif /* CONFIG_QUICC_ENGINE */ 146#endif /* CONFIG_QUICC_ENGINE */
146} 147}
147 148
148#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
149extern ulong ds1374_get_rtc_time(void);
150extern int ds1374_set_rtc_time(ulong);
151
152static int __init mpc832x_rtc_hookup(void)
153{
154 struct timespec tv;
155
156 if (!machine_is(mpc832x_mds))
157 return 0;
158
159 ppc_md.get_rtc_time = ds1374_get_rtc_time;
160 ppc_md.set_rtc_time = ds1374_set_rtc_time;
161
162 tv.tv_nsec = 0;
163 tv.tv_sec = (ppc_md.get_rtc_time) ();
164 do_settimeofday(&tv);
165
166 return 0;
167}
168
169late_initcall(mpc832x_rtc_hookup);
170#endif
171
172/* 149/*
173 * Called very early, MMU is off, device-tree isn't unflattened 150 * Called very early, MMU is off, device-tree isn't unflattened
174 */ 151 */
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index fbca336aa0ae..d4bd04001b99 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -15,7 +15,10 @@
15 */ 15 */
16 16
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/interrupt.h>
18#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/spi/mmc_spi.h>
21#include <linux/mmc/host.h>
19 22
20#include <asm/of_platform.h> 23#include <asm/of_platform.h>
21#include <asm/time.h> 24#include <asm/time.h>
@@ -46,15 +49,16 @@ static void mpc83xx_spi_deactivate_cs(u8 cs, u8 polarity)
46 par_io_data_set(3, 13, !polarity); 49 par_io_data_set(3, 13, !polarity);
47} 50}
48 51
52static struct mmc_spi_platform_data mpc832x_mmc_pdata = {
53 .ocr_mask = MMC_VDD_33_34,
54};
55
49static struct spi_board_info mpc832x_spi_boardinfo = { 56static struct spi_board_info mpc832x_spi_boardinfo = {
50 .bus_num = 0x4c0, 57 .bus_num = 0x4c0,
51 .chip_select = 0, 58 .chip_select = 0,
52 .max_speed_hz = 50000000, 59 .max_speed_hz = 50000000,
53 /* 60 .modalias = "mmc_spi",
54 * XXX: This is spidev (spi in userspace) stub, should 61 .platform_data = &mpc832x_mmc_pdata,
55 * be replaced by "mmc_spi" when mmc_spi will hit mainline.
56 */
57 .modalias = "spidev",
58}; 62};
59 63
60static int __init mpc832x_spi_init(void) 64static int __init mpc832x_spi_init(void)
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index 00aed7c2269e..a81bb3ce6b94 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -106,30 +106,6 @@ static void __init mpc834x_mds_init_IRQ(void)
106 ipic_set_default_priority(); 106 ipic_set_default_priority();
107} 107}
108 108
109#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
110extern ulong ds1374_get_rtc_time(void);
111extern int ds1374_set_rtc_time(ulong);
112
113static int __init mpc834x_rtc_hookup(void)
114{
115 struct timespec tv;
116
117 if (!machine_is(mpc834x_mds))
118 return 0;
119
120 ppc_md.get_rtc_time = ds1374_get_rtc_time;
121 ppc_md.set_rtc_time = ds1374_set_rtc_time;
122
123 tv.tv_nsec = 0;
124 tv.tv_sec = (ppc_md.get_rtc_time) ();
125 do_settimeofday(&tv);
126
127 return 0;
128}
129
130late_initcall(mpc834x_rtc_hookup);
131#endif
132
133/* 109/*
134 * Called very early, MMU is off, device-tree isn't unflattened 110 * Called very early, MMU is off, device-tree isn't unflattened
135 */ 111 */
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 0f3855c95ff5..e40012f8f488 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -96,14 +96,39 @@ static void __init mpc836x_mds_setup_arch(void)
96 96
97 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth")) 97 if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
98 != NULL){ 98 != NULL){
99 uint svid;
100
99 /* Reset the Ethernet PHY */ 101 /* Reset the Ethernet PHY */
100 bcsr_regs[9] &= ~0x20; 102#define BCSR9_GETHRST 0x20
103 clrbits8(&bcsr_regs[9], BCSR9_GETHRST);
101 udelay(1000); 104 udelay(1000);
102 bcsr_regs[9] |= 0x20; 105 setbits8(&bcsr_regs[9], BCSR9_GETHRST);
106
107 /* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */
108 svid = mfspr(SPRN_SVR);
109 if (svid == 0x80480021) {
110 void __iomem *immap;
111
112 immap = ioremap(get_immrbase() + 0x14a8, 8);
113
114 /*
115 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2)
116 * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1)
117 */
118 setbits32(immap, 0x0c003000);
119
120 /*
121 * IMMR + 0x14AC[20:27] = 10101010
122 * (data delay for both UCC's)
123 */
124 clrsetbits_be32(immap + 4, 0xff0, 0xaa0);
125
126 iounmap(immap);
127 }
128
103 iounmap(bcsr_regs); 129 iounmap(bcsr_regs);
104 of_node_put(np); 130 of_node_put(np);
105 } 131 }
106
107#endif /* CONFIG_QUICC_ENGINE */ 132#endif /* CONFIG_QUICC_ENGINE */
108} 133}
109 134
@@ -152,30 +177,6 @@ static void __init mpc836x_mds_init_IRQ(void)
152#endif /* CONFIG_QUICC_ENGINE */ 177#endif /* CONFIG_QUICC_ENGINE */
153} 178}
154 179
155#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
156extern ulong ds1374_get_rtc_time(void);
157extern int ds1374_set_rtc_time(ulong);
158
159static int __init mpc8360_rtc_hookup(void)
160{
161 struct timespec tv;
162
163 if (!machine_is(mpc836x_mds))
164 return 0;
165
166 ppc_md.get_rtc_time = ds1374_get_rtc_time;
167 ppc_md.set_rtc_time = ds1374_set_rtc_time;
168
169 tv.tv_nsec = 0;
170 tv.tv_sec = (ppc_md.get_rtc_time) ();
171 do_settimeofday(&tv);
172
173 return 0;
174}
175
176late_initcall(mpc8360_rtc_hookup);
177#endif
178
179/* 180/*
180 * Called very early, MMU is off, device-tree isn't unflattened 181 * Called very early, MMU is off, device-tree isn't unflattened
181 */ 182 */
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index eafe7605cdac..b45160f8d084 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -130,7 +130,7 @@ int mpc831x_usb_cfg(void)
130 out_be32(immap + MPC83XX_SCCR_OFFS, temp); 130 out_be32(immap + MPC83XX_SCCR_OFFS, temp);
131 131
132 /* Configure pin mux for ULPI. There is no pin mux for UTMI */ 132 /* Configure pin mux for ULPI. There is no pin mux for UTMI */
133 if (!strcmp(prop, "ulpi")) { 133 if (prop && !strcmp(prop, "ulpi")) {
134 temp = in_be32(immap + MPC83XX_SICRL_OFFS); 134 temp = in_be32(immap + MPC83XX_SICRL_OFFS);
135 temp &= ~MPC831X_SICRL_USB_MASK; 135 temp &= ~MPC831X_SICRL_USB_MASK;
136 temp |= MPC831X_SICRL_USB_ULPI; 136 temp |= MPC831X_SICRL_USB_ULPI;
@@ -153,13 +153,13 @@ int mpc831x_usb_cfg(void)
153 usb_regs = ioremap(res.start, res.end - res.start + 1); 153 usb_regs = ioremap(res.start, res.end - res.start + 1);
154 154
155 /* Using on-chip PHY */ 155 /* Using on-chip PHY */
156 if (!strcmp(prop, "utmi_wide") || 156 if (prop && (!strcmp(prop, "utmi_wide") ||
157 !strcmp(prop, "utmi")) { 157 !strcmp(prop, "utmi"))) {
158 /* Set UTMI_PHY_EN, REFSEL to 48MHZ */ 158 /* Set UTMI_PHY_EN, REFSEL to 48MHZ */
159 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, 159 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS,
160 CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ); 160 CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ);
161 /* Using external UPLI PHY */ 161 /* Using external UPLI PHY */
162 } else if (!strcmp(prop, "ulpi")) { 162 } else if (prop && !strcmp(prop, "ulpi")) {
163 /* Set PHY_CLK_SEL to ULPI */ 163 /* Set PHY_CLK_SEL to ULPI */
164 temp = CONTROL_PHY_CLK_SEL_ULPI; 164 temp = CONTROL_PHY_CLK_SEL_ULPI;
165#ifdef CONFIG_USB_OTG 165#ifdef CONFIG_USB_OTG
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 0966d093db43..c0e968a4c211 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -171,6 +171,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
171{ 171{
172 /* remove all entries */ 172 /* remove all entries */
173 spufs_prune_dir(dir); 173 spufs_prune_dir(dir);
174 d_drop(dir);
174 175
175 return simple_rmdir(parent, dir); 176 return simple_rmdir(parent, dir);
176} 177}
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index e484cac75095..653a5eb91c90 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -144,6 +144,7 @@ static int __init prpmc2800_probe(void)
144 strncpy(prpmc2800_platform_name, m, 144 strncpy(prpmc2800_platform_name, m,
145 min((int)len, PLATFORM_NAME_MAX - 1)); 145 min((int)len, PLATFORM_NAME_MAX - 1));
146 146
147 _set_L2CR(_get_L2CR() | L2CR_L2E);
147 return 1; 148 return 1;
148} 149}
149 150
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 3a5d112af5e0..3d62060498b4 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -214,7 +214,7 @@ static __init void pas_init_IRQ(void)
214 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 214 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
215 215
216 mpic = mpic_alloc(mpic_node, openpic_addr, 216 mpic = mpic_alloc(mpic_node, openpic_addr,
217 MPIC_PRIMARY|MPIC_LARGE_VECTORS|MPIC_WANTS_RESET, 217 MPIC_PRIMARY|MPIC_LARGE_VECTORS,
218 0, 0, " PAS-OPIC "); 218 0, 0, " PAS-OPIC ");
219 BUG_ON(!mpic); 219 BUG_ON(!mpic);
220 220
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 16e4e401b820..306a9d07491d 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -21,7 +21,7 @@ config PPC_SPLPAR
21 21
22config EEH 22config EEH
23 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 23 bool "PCI Extended Error Handling (EEH)" if EMBEDDED
24 depends on PPC_PSERIES 24 depends on PPC_PSERIES && PCI
25 default y if !EMBEDDED 25 default y if !EMBEDDED
26 26
27config SCANLOG 27config SCANLOG
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fdb9b1c8f977..fdeefe54ea91 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -507,7 +507,8 @@ define_machine(pseries) {
507 .restart = rtas_restart, 507 .restart = rtas_restart,
508 .power_off = pSeries_power_off, 508 .power_off = pSeries_power_off,
509 .halt = rtas_halt, 509 .halt = rtas_halt,
510 .panic = rtas_os_term, 510 .panic = rtas_panic_msg,
511 .machine_shutdown = rtas_os_term,
511 .get_boot_time = rtas_get_boot_time, 512 .get_boot_time = rtas_get_boot_time,
512 .get_rtc_time = rtas_get_rtc_time, 513 .get_rtc_time = rtas_get_rtc_time,
513 .set_rtc_time = rtas_set_rtc_time, 514 .set_rtc_time = rtas_set_rtc_time,
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 5149716c734d..847a5496b869 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -97,6 +97,22 @@ static void uic_ack_irq(unsigned int virq)
97 spin_unlock_irqrestore(&uic->lock, flags); 97 spin_unlock_irqrestore(&uic->lock, flags);
98} 98}
99 99
100static void uic_mask_ack_irq(unsigned int virq)
101{
102 struct uic *uic = get_irq_chip_data(virq);
103 unsigned int src = uic_irq_to_hw(virq);
104 unsigned long flags;
105 u32 er, sr;
106
107 sr = 1 << (31-src);
108 spin_lock_irqsave(&uic->lock, flags);
109 er = mfdcr(uic->dcrbase + UIC_ER);
110 er &= ~sr;
111 mtdcr(uic->dcrbase + UIC_ER, er);
112 mtdcr(uic->dcrbase + UIC_SR, sr);
113 spin_unlock_irqrestore(&uic->lock, flags);
114}
115
100static int uic_set_irq_type(unsigned int virq, unsigned int flow_type) 116static int uic_set_irq_type(unsigned int virq, unsigned int flow_type)
101{ 117{
102 struct uic *uic = get_irq_chip_data(virq); 118 struct uic *uic = get_irq_chip_data(virq);
@@ -152,7 +168,7 @@ static struct irq_chip uic_irq_chip = {
152 .typename = " UIC ", 168 .typename = " UIC ",
153 .unmask = uic_unmask_irq, 169 .unmask = uic_unmask_irq,
154 .mask = uic_mask_irq, 170 .mask = uic_mask_irq,
155/* .mask_ack = uic_mask_irq_and_ack, */ 171 .mask_ack = uic_mask_ack_irq,
156 .ack = uic_ack_irq, 172 .ack = uic_ack_irq,
157 .set_type = uic_set_irq_type, 173 .set_type = uic_set_irq_type,
158}; 174};
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index aac88c2f3db9..5255bd80aa6b 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -312,7 +312,14 @@ early_init(int r3, int r4, int r5)
312 * Identify the CPU type and fix up code sections 312 * Identify the CPU type and fix up code sections
313 * that depend on which cpu we have. 313 * that depend on which cpu we have.
314 */ 314 */
315#if defined(CONFIG_440EP) && defined(CONFIG_PPC_FPU)
316 /* We pass the virtual PVR here for 440EP as 440EP and 440GR have
317 * identical PVRs and there is no reliable way to check for the FPU
318 */
319 spec = identify_cpu(offset, (mfspr(SPRN_PVR) | 0x8));
320#else
315 spec = identify_cpu(offset, mfspr(SPRN_PVR)); 321 spec = identify_cpu(offset, mfspr(SPRN_PVR));
322#endif
316 do_feature_fixups(spec->cpu_features, 323 do_feature_fixups(spec->cpu_features,
317 PTRRELOC(&__start___ftr_fixup), 324 PTRRELOC(&__start___ftr_fixup),
318 PTRRELOC(&__stop___ftr_fixup)); 325 PTRRELOC(&__stop___ftr_fixup));
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 390dd1995c2a..dd898d32480e 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -561,7 +561,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
561 * That means the zeroed TLB has to be invalidated 561 * That means the zeroed TLB has to be invalidated
562 * whenever a page miss occurs. 562 * whenever a page miss occurs.
563 */ 563 */
564 _tlbie(address); 564 _tlbie(address, 0 /* 8xx doesn't care about PID */);
565#endif 565#endif
566 if (!PageReserved(page) 566 if (!PageReserved(page)
567 && !test_bit(PG_arch_1, &page->flags)) { 567 && !test_bit(PG_arch_1, &page->flags)) {
diff --git a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h
index f1d4f2109a99..b298b60c202f 100644
--- a/arch/ppc/mm/mmu_decl.h
+++ b/arch/ppc/mm/mmu_decl.h
@@ -49,7 +49,7 @@ extern unsigned int num_tlbcam_entries;
49 * architectures. -- Dan 49 * architectures. -- Dan
50 */ 50 */
51#if defined(CONFIG_8xx) 51#if defined(CONFIG_8xx)
52#define flush_HPTE(X, va, pg) _tlbie(va) 52#define flush_HPTE(X, va, pg) _tlbie(va, 0 /* 8xx doesn't care about PID */)
53#define MMU_init_hw() do { } while(0) 53#define MMU_init_hw() do { } while(0)
54#define mmu_mapin_ram() (0UL) 54#define mmu_mapin_ram() (0UL)
55 55
diff --git a/arch/ppc/platforms/4xx/yucca.c b/arch/ppc/platforms/4xx/yucca.c
index a83b0baea011..66a44ff0d926 100644
--- a/arch/ppc/platforms/4xx/yucca.c
+++ b/arch/ppc/platforms/4xx/yucca.c
@@ -211,6 +211,7 @@ static void __init yucca_setup_pcie_fpga_rootpoint(int port)
211 break; 211 break;
212 212
213 default: 213 default:
214 iounmap(pcie_reg_fpga_base);
214 return; 215 return;
215 } 216 }
216 217
diff --git a/arch/ppc/syslib/virtex_devices.c b/arch/ppc/syslib/virtex_devices.c
index ace4ec08de51..f658ff3b3890 100644
--- a/arch/ppc/syslib/virtex_devices.c
+++ b/arch/ppc/syslib/virtex_devices.c
@@ -87,6 +87,29 @@
87 }, \ 87 }, \
88} 88}
89 89
90#define XPAR_AC97_CONTROLLER_REFERENCE(num) { \
91 .name = "ml403_ac97cr", \
92 .id = num, \
93 .num_resources = 3, \
94 .resource = (struct resource[]) { \
95 { \
96 .start = XPAR_OPB_AC97_CONTROLLER_REF_##num##_BASEADDR, \
97 .end = XPAR_OPB_AC97_CONTROLLER_REF_##num##_HIGHADDR, \
98 .flags = IORESOURCE_MEM, \
99 }, \
100 { \
101 .start = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_PLAYBACK_INTERRUPT_INTR, \
102 .end = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_PLAYBACK_INTERRUPT_INTR, \
103 .flags = IORESOURCE_IRQ, \
104 }, \
105 { \
106 .start = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_RECORD_INTERRUPT_INTR, \
107 .end = XPAR_OPB_INTC_0_OPB_AC97_CONTROLLER_REF_##num##_RECORD_INTERRUPT_INTR, \
108 .flags = IORESOURCE_IRQ, \
109 }, \
110 }, \
111}
112
90/* UART 8250 driver platform data table */ 113/* UART 8250 driver platform data table */
91struct plat_serial8250_port virtex_serial_platform_data[] = { 114struct plat_serial8250_port virtex_serial_platform_data[] = {
92#if defined(XPAR_UARTNS550_0_BASEADDR) 115#if defined(XPAR_UARTNS550_0_BASEADDR)
@@ -173,6 +196,14 @@ struct platform_device virtex_platform_devices[] = {
173#if defined(XPAR_TFT_3_BASEADDR) 196#if defined(XPAR_TFT_3_BASEADDR)
174 XPAR_TFT(3), 197 XPAR_TFT(3),
175#endif 198#endif
199
200 /* AC97 Controller Reference instances */
201#if defined(XPAR_OPB_AC97_CONTROLLER_REF_0_BASEADDR)
202 XPAR_AC97_CONTROLLER_REFERENCE(0),
203#endif
204#if defined(XPAR_OPB_AC97_CONTROLLER_REF_1_BASEADDR)
205 XPAR_AC97_CONTROLLER_REFERENCE(1),
206#endif
176}; 207};
177 208
178/* Early serial support functions */ 209/* Early serial support functions */
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h
index 4069b81f7f1d..db3ae8505103 100644
--- a/arch/s390/appldata/appldata.h
+++ b/arch/s390/appldata/appldata.h
@@ -45,7 +45,6 @@ struct appldata_ops {
45 int active; /* monitoring status */ 45 int active; /* monitoring status */
46 46
47 /* fill in from here */ 47 /* fill in from here */
48 unsigned int ctl_nr; /* sysctl ID */
49 char name[APPLDATA_PROC_NAME_LENGTH]; /* name of /proc fs node */ 48 char name[APPLDATA_PROC_NAME_LENGTH]; /* name of /proc fs node */
50 unsigned char record_nr; /* Record Nr. for Product ID */ 49 unsigned char record_nr; /* Record Nr. for Product ID */
51 void (*callback)(void *data); /* callback function */ 50 void (*callback)(void *data); /* callback function */
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index ac61cf43a7d9..655d52543e2d 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -53,29 +53,26 @@ static int appldata_interval_handler(ctl_table *ctl, int write,
53static struct ctl_table_header *appldata_sysctl_header; 53static struct ctl_table_header *appldata_sysctl_header;
54static struct ctl_table appldata_table[] = { 54static struct ctl_table appldata_table[] = {
55 { 55 {
56 .ctl_name = CTL_APPLDATA_TIMER,
57 .procname = "timer", 56 .procname = "timer",
58 .mode = S_IRUGO | S_IWUSR, 57 .mode = S_IRUGO | S_IWUSR,
59 .proc_handler = &appldata_timer_handler, 58 .proc_handler = &appldata_timer_handler,
60 }, 59 },
61 { 60 {
62 .ctl_name = CTL_APPLDATA_INTERVAL,
63 .procname = "interval", 61 .procname = "interval",
64 .mode = S_IRUGO | S_IWUSR, 62 .mode = S_IRUGO | S_IWUSR,
65 .proc_handler = &appldata_interval_handler, 63 .proc_handler = &appldata_interval_handler,
66 }, 64 },
67 { .ctl_name = 0 } 65 { },
68}; 66};
69 67
70static struct ctl_table appldata_dir_table[] = { 68static struct ctl_table appldata_dir_table[] = {
71 { 69 {
72 .ctl_name = CTL_APPLDATA,
73 .procname = appldata_proc_name, 70 .procname = appldata_proc_name,
74 .maxlen = 0, 71 .maxlen = 0,
75 .mode = S_IRUGO | S_IXUGO, 72 .mode = S_IRUGO | S_IXUGO,
76 .child = appldata_table, 73 .child = appldata_table,
77 }, 74 },
78 { .ctl_name = 0 } 75 { },
79}; 76};
80 77
81/* 78/*
@@ -441,75 +438,38 @@ out:
441 */ 438 */
442int appldata_register_ops(struct appldata_ops *ops) 439int appldata_register_ops(struct appldata_ops *ops)
443{ 440{
444 struct list_head *lh; 441 if ((ops->size > APPLDATA_MAX_REC_SIZE) || (ops->size < 0))
445 struct appldata_ops *tmp_ops; 442 return -EINVAL;
446 int i;
447
448 i = 0;
449 443
450 if ((ops->size > APPLDATA_MAX_REC_SIZE) || 444 ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL);
451 (ops->size < 0)){ 445 if (!ops->ctl_table)
452 P_ERROR("Invalid size of %s record = %i, maximum = %i!\n",
453 ops->name, ops->size, APPLDATA_MAX_REC_SIZE);
454 return -ENOMEM;
455 }
456 if ((ops->ctl_nr == CTL_APPLDATA) ||
457 (ops->ctl_nr == CTL_APPLDATA_TIMER) ||
458 (ops->ctl_nr == CTL_APPLDATA_INTERVAL)) {
459 P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr);
460 return -EBUSY;
461 }
462 ops->ctl_table = kzalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
463 if (ops->ctl_table == NULL) {
464 P_ERROR("Not enough memory for %s ctl_table!\n", ops->name);
465 return -ENOMEM; 446 return -ENOMEM;
466 }
467 447
468 spin_lock(&appldata_ops_lock); 448 spin_lock(&appldata_ops_lock);
469 list_for_each(lh, &appldata_ops_list) {
470 tmp_ops = list_entry(lh, struct appldata_ops, list);
471 P_DEBUG("register_ops loop: %i) name = %s, ctl = %i\n",
472 ++i, tmp_ops->name, tmp_ops->ctl_nr);
473 P_DEBUG("Comparing %s (ctl %i) with %s (ctl %i)\n",
474 tmp_ops->name, tmp_ops->ctl_nr, ops->name,
475 ops->ctl_nr);
476 if (strncmp(tmp_ops->name, ops->name,
477 APPLDATA_PROC_NAME_LENGTH) == 0) {
478 P_ERROR("Name \"%s\" already registered!\n", ops->name);
479 kfree(ops->ctl_table);
480 spin_unlock(&appldata_ops_lock);
481 return -EBUSY;
482 }
483 if (tmp_ops->ctl_nr == ops->ctl_nr) {
484 P_ERROR("ctl_nr %i already registered!\n", ops->ctl_nr);
485 kfree(ops->ctl_table);
486 spin_unlock(&appldata_ops_lock);
487 return -EBUSY;
488 }
489 }
490 list_add(&ops->list, &appldata_ops_list); 449 list_add(&ops->list, &appldata_ops_list);
491 spin_unlock(&appldata_ops_lock); 450 spin_unlock(&appldata_ops_lock);
492 451
493 ops->ctl_table[0].ctl_name = CTL_APPLDATA;
494 ops->ctl_table[0].procname = appldata_proc_name; 452 ops->ctl_table[0].procname = appldata_proc_name;
495 ops->ctl_table[0].maxlen = 0; 453 ops->ctl_table[0].maxlen = 0;
496 ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; 454 ops->ctl_table[0].mode = S_IRUGO | S_IXUGO;
497 ops->ctl_table[0].child = &ops->ctl_table[2]; 455 ops->ctl_table[0].child = &ops->ctl_table[2];
498 456
499 ops->ctl_table[1].ctl_name = 0;
500
501 ops->ctl_table[2].ctl_name = ops->ctl_nr;
502 ops->ctl_table[2].procname = ops->name; 457 ops->ctl_table[2].procname = ops->name;
503 ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; 458 ops->ctl_table[2].mode = S_IRUGO | S_IWUSR;
504 ops->ctl_table[2].proc_handler = appldata_generic_handler; 459 ops->ctl_table[2].proc_handler = appldata_generic_handler;
505 ops->ctl_table[2].data = ops; 460 ops->ctl_table[2].data = ops;
506 461
507 ops->ctl_table[3].ctl_name = 0;
508
509 ops->sysctl_header = register_sysctl_table(ops->ctl_table); 462 ops->sysctl_header = register_sysctl_table(ops->ctl_table);
510 463 if (!ops->sysctl_header)
464 goto out;
511 P_INFO("%s-ops registered!\n", ops->name); 465 P_INFO("%s-ops registered!\n", ops->name);
512 return 0; 466 return 0;
467out:
468 spin_lock(&appldata_ops_lock);
469 list_del(&ops->list);
470 spin_unlock(&appldata_ops_lock);
471 kfree(ops->ctl_table);
472 return -ENOMEM;
513} 473}
514 474
515/* 475/*
@@ -519,15 +479,11 @@ int appldata_register_ops(struct appldata_ops *ops)
519 */ 479 */
520void appldata_unregister_ops(struct appldata_ops *ops) 480void appldata_unregister_ops(struct appldata_ops *ops)
521{ 481{
522 void *table;
523 spin_lock(&appldata_ops_lock); 482 spin_lock(&appldata_ops_lock);
524 list_del(&ops->list); 483 list_del(&ops->list);
525 /* at that point any incoming access will fail */
526 table = ops->ctl_table;
527 ops->ctl_table = NULL;
528 spin_unlock(&appldata_ops_lock); 484 spin_unlock(&appldata_ops_lock);
529 unregister_sysctl_table(ops->sysctl_header); 485 unregister_sysctl_table(ops->sysctl_header);
530 kfree(table); 486 kfree(ops->ctl_table);
531 P_INFO("%s-ops unregistered!\n", ops->name); 487 P_INFO("%s-ops unregistered!\n", ops->name);
532} 488}
533/********************** module-ops management <END> **************************/ 489/********************** module-ops management <END> **************************/
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 697eb30a68a3..51181ccdb87b 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -147,7 +147,6 @@ static void appldata_get_mem_data(void *data)
147 147
148 148
149static struct appldata_ops ops = { 149static struct appldata_ops ops = {
150 .ctl_nr = CTL_APPLDATA_MEM,
151 .name = "mem", 150 .name = "mem",
152 .record_nr = APPLDATA_RECORD_MEM_ID, 151 .record_nr = APPLDATA_RECORD_MEM_ID,
153 .size = sizeof(struct appldata_mem_data), 152 .size = sizeof(struct appldata_mem_data),
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 6c1815a47714..4d8344336001 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -142,7 +142,6 @@ static void appldata_get_net_sum_data(void *data)
142 142
143 143
144static struct appldata_ops ops = { 144static struct appldata_ops ops = {
145 .ctl_nr = CTL_APPLDATA_NET_SUM,
146 .name = "net_sum", 145 .name = "net_sum",
147 .record_nr = APPLDATA_RECORD_NET_SUM_ID, 146 .record_nr = APPLDATA_RECORD_NET_SUM_ID,
148 .size = sizeof(struct appldata_net_sum_data), 147 .size = sizeof(struct appldata_net_sum_data),
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index 76a15523ae9e..6b3eafe10453 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -82,7 +82,6 @@ struct appldata_os_data {
82static struct appldata_os_data *appldata_os_data; 82static struct appldata_os_data *appldata_os_data;
83 83
84static struct appldata_ops ops = { 84static struct appldata_ops ops = {
85 .ctl_nr = CTL_APPLDATA_OS,
86 .name = "os", 85 .name = "os",
87 .record_nr = APPLDATA_RECORD_OS_ID, 86 .record_nr = APPLDATA_RECORD_OS_ID,
88 .owner = THIS_MODULE, 87 .owner = THIS_MODULE,
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 8bf4ae1150be..1b3af7dab816 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -200,7 +200,7 @@ static noinline __init void find_memory_chunks(unsigned long memsize)
200 cc = __tprot(addr); 200 cc = __tprot(addr);
201 while (cc == old_cc) { 201 while (cc == old_cc) {
202 addr += CHUNK_INCR; 202 addr += CHUNK_INCR;
203 if (addr >= memsize) 203 if (memsize && addr >= memsize)
204 break; 204 break;
205#ifndef CONFIG_64BIT 205#ifndef CONFIG_64BIT
206 if (addr == ADDR2G) 206 if (addr == ADDR2G)
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 139ca153d5cc..b2b2edc40eb1 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -69,13 +69,31 @@ STACK_SIZE = 1 << STACK_SHIFT
69 basr %r14,%r1 69 basr %r14,%r1
70 .endm 70 .endm
71 71
72 .macro LOCKDEP_SYS_EXIT 72 .macro TRACE_IRQS_CHECK
73 l %r1,BASED(.Llockdep_sys_exit) 73 tm SP_PSW(%r15),0x03 # irqs enabled?
74 jz 0f
75 l %r1,BASED(.Ltrace_irq_on)
74 basr %r14,%r1 76 basr %r14,%r1
77 j 1f
780: l %r1,BASED(.Ltrace_irq_off)
79 basr %r14,%r1
801:
75 .endm 81 .endm
76#else 82#else
77#define TRACE_IRQS_ON 83#define TRACE_IRQS_ON
78#define TRACE_IRQS_OFF 84#define TRACE_IRQS_OFF
85#define TRACE_IRQS_CHECK
86#endif
87
88#ifdef CONFIG_LOCKDEP
89 .macro LOCKDEP_SYS_EXIT
90 tm SP_PSW+1(%r15),0x01 # returning to user ?
91 jz 0f
92 l %r1,BASED(.Llockdep_sys_exit)
93 basr %r14,%r1
940:
95 .endm
96#else
79#define LOCKDEP_SYS_EXIT 97#define LOCKDEP_SYS_EXIT
80#endif 98#endif
81 99
@@ -234,8 +252,6 @@ sysc_saveall:
234 lh %r7,0x8a # get svc number from lowcore 252 lh %r7,0x8a # get svc number from lowcore
235#ifdef CONFIG_VIRT_CPU_ACCOUNTING 253#ifdef CONFIG_VIRT_CPU_ACCOUNTING
236sysc_vtime: 254sysc_vtime:
237 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
238 bz BASED(sysc_do_svc)
239 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 255 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
240sysc_stime: 256sysc_stime:
241 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 257 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
@@ -263,19 +279,34 @@ sysc_do_restart:
263 279
264sysc_return: 280sysc_return:
265 tm SP_PSW+1(%r15),0x01 # returning to user ? 281 tm SP_PSW+1(%r15),0x01 # returning to user ?
266 bno BASED(sysc_leave) 282 bno BASED(sysc_restore)
267 tm __TI_flags+3(%r9),_TIF_WORK_SVC 283 tm __TI_flags+3(%r9),_TIF_WORK_SVC
268 bnz BASED(sysc_work) # there is work to do (signals etc.) 284 bnz BASED(sysc_work) # there is work to do (signals etc.)
285sysc_restore:
286#ifdef CONFIG_TRACE_IRQFLAGS
287 la %r1,BASED(sysc_restore_trace_psw)
288 lpsw 0(%r1)
289sysc_restore_trace:
290 TRACE_IRQS_CHECK
269 LOCKDEP_SYS_EXIT 291 LOCKDEP_SYS_EXIT
292#endif
270sysc_leave: 293sysc_leave:
271 RESTORE_ALL __LC_RETURN_PSW,1 294 RESTORE_ALL __LC_RETURN_PSW,1
295sysc_done:
296
297#ifdef CONFIG_TRACE_IRQFLAGS
298 .align 8
299 .globl sysc_restore_trace_psw
300sysc_restore_trace_psw:
301 .long 0, sysc_restore_trace + 0x80000000
302#endif
272 303
273# 304#
274# recheck if there is more work to do 305# recheck if there is more work to do
275# 306#
276sysc_work_loop: 307sysc_work_loop:
277 tm __TI_flags+3(%r9),_TIF_WORK_SVC 308 tm __TI_flags+3(%r9),_TIF_WORK_SVC
278 bz BASED(sysc_leave) # there is no work to do 309 bz BASED(sysc_restore) # there is no work to do
279# 310#
280# One of the work bits is on. Find out which one. 311# One of the work bits is on. Find out which one.
281# 312#
@@ -290,8 +321,8 @@ sysc_work:
290 bo BASED(sysc_restart) 321 bo BASED(sysc_restart)
291 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP 322 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP
292 bo BASED(sysc_singlestep) 323 bo BASED(sysc_singlestep)
293 LOCKDEP_SYS_EXIT 324 b BASED(sysc_restore)
294 b BASED(sysc_leave) 325sysc_work_done:
295 326
296# 327#
297# _TIF_NEED_RESCHED is set, call schedule 328# _TIF_NEED_RESCHED is set, call schedule
@@ -458,6 +489,7 @@ pgm_check_handler:
458pgm_no_vtime: 489pgm_no_vtime:
459#endif 490#endif
460 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 491 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
492 TRACE_IRQS_OFF
461 l %r3,__LC_PGM_ILC # load program interruption code 493 l %r3,__LC_PGM_ILC # load program interruption code
462 la %r8,0x7f 494 la %r8,0x7f
463 nr %r8,%r3 495 nr %r8,%r3
@@ -497,6 +529,7 @@ pgm_per_std:
497pgm_no_vtime2: 529pgm_no_vtime2:
498#endif 530#endif
499 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 531 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
532 TRACE_IRQS_OFF
500 l %r1,__TI_task(%r9) 533 l %r1,__TI_task(%r9)
501 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID 534 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
502 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS 535 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
@@ -517,15 +550,13 @@ pgm_svcper:
517 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 550 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
518 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 551 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
519#ifdef CONFIG_VIRT_CPU_ACCOUNTING 552#ifdef CONFIG_VIRT_CPU_ACCOUNTING
520 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
521 bz BASED(pgm_no_vtime3)
522 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 553 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
523 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 554 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
524 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 555 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
525pgm_no_vtime3:
526#endif 556#endif
527 lh %r7,0x8a # get svc number from lowcore 557 lh %r7,0x8a # get svc number from lowcore
528 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct 558 l %r9,__LC_THREAD_INFO # load pointer to thread_info struct
559 TRACE_IRQS_OFF
529 l %r1,__TI_task(%r9) 560 l %r1,__TI_task(%r9)
530 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID 561 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
531 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS 562 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
@@ -542,7 +573,7 @@ kernel_per:
542 mvi SP_TRAP+1(%r15),0x28 # set trap indication to pgm check 573 mvi SP_TRAP+1(%r15),0x28 # set trap indication to pgm check
543 la %r2,SP_PTREGS(%r15) # address of register-save area 574 la %r2,SP_PTREGS(%r15) # address of register-save area
544 l %r1,BASED(.Lhandle_per) # load adr. of per handler 575 l %r1,BASED(.Lhandle_per) # load adr. of per handler
545 la %r14,BASED(sysc_leave) # load adr. of system return 576 la %r14,BASED(sysc_restore)# load adr. of system return
546 br %r1 # branch to do_single_step 577 br %r1 # branch to do_single_step
547 578
548/* 579/*
@@ -569,26 +600,38 @@ io_no_vtime:
569 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ 600 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ
570 la %r2,SP_PTREGS(%r15) # address of register-save area 601 la %r2,SP_PTREGS(%r15) # address of register-save area
571 basr %r14,%r1 # branch to standard irq handler 602 basr %r14,%r1 # branch to standard irq handler
572 TRACE_IRQS_ON
573
574io_return: 603io_return:
575 tm SP_PSW+1(%r15),0x01 # returning to user ? 604 tm SP_PSW+1(%r15),0x01 # returning to user ?
576#ifdef CONFIG_PREEMPT 605#ifdef CONFIG_PREEMPT
577 bno BASED(io_preempt) # no -> check for preemptive scheduling 606 bno BASED(io_preempt) # no -> check for preemptive scheduling
578#else 607#else
579 bno BASED(io_leave) # no-> skip resched & signal 608 bno BASED(io_restore) # no-> skip resched & signal
580#endif 609#endif
581 tm __TI_flags+3(%r9),_TIF_WORK_INT 610 tm __TI_flags+3(%r9),_TIF_WORK_INT
582 bnz BASED(io_work) # there is work to do (signals etc.) 611 bnz BASED(io_work) # there is work to do (signals etc.)
612io_restore:
613#ifdef CONFIG_TRACE_IRQFLAGS
614 la %r1,BASED(io_restore_trace_psw)
615 lpsw 0(%r1)
616io_restore_trace:
617 TRACE_IRQS_CHECK
583 LOCKDEP_SYS_EXIT 618 LOCKDEP_SYS_EXIT
619#endif
584io_leave: 620io_leave:
585 RESTORE_ALL __LC_RETURN_PSW,0 621 RESTORE_ALL __LC_RETURN_PSW,0
586io_done: 622io_done:
587 623
624#ifdef CONFIG_TRACE_IRQFLAGS
625 .align 8
626 .globl io_restore_trace_psw
627io_restore_trace_psw:
628 .long 0, io_restore_trace + 0x80000000
629#endif
630
588#ifdef CONFIG_PREEMPT 631#ifdef CONFIG_PREEMPT
589io_preempt: 632io_preempt:
590 icm %r0,15,__TI_precount(%r9) 633 icm %r0,15,__TI_precount(%r9)
591 bnz BASED(io_leave) 634 bnz BASED(io_restore)
592 l %r1,SP_R15(%r15) 635 l %r1,SP_R15(%r15)
593 s %r1,BASED(.Lc_spsize) 636 s %r1,BASED(.Lc_spsize)
594 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) 637 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15)
@@ -596,14 +639,10 @@ io_preempt:
596 lr %r15,%r1 639 lr %r15,%r1
597io_resume_loop: 640io_resume_loop:
598 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED 641 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
599 bno BASED(io_leave) 642 bno BASED(io_restore)
600 mvc __TI_precount(4,%r9),BASED(.Lc_pactive) 643 l %r1,BASED(.Lpreempt_schedule_irq)
601 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 644 la %r14,BASED(io_resume_loop)
602 l %r1,BASED(.Lschedule) 645 br %r1 # call schedule
603 basr %r14,%r1 # call schedule
604 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
605 xc __TI_precount(4,%r9),__TI_precount(%r9)
606 b BASED(io_resume_loop)
607#endif 646#endif
608 647
609# 648#
@@ -627,40 +666,42 @@ io_work_loop:
627 bo BASED(io_reschedule) 666 bo BASED(io_reschedule)
628 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 667 tm __TI_flags+3(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
629 bnz BASED(io_sigpending) 668 bnz BASED(io_sigpending)
630 LOCKDEP_SYS_EXIT 669 b BASED(io_restore)
631 b BASED(io_leave) 670io_work_done:
632 671
633# 672#
634# _TIF_MCCK_PENDING is set, call handler 673# _TIF_MCCK_PENDING is set, call handler
635# 674#
636io_mcck_pending: 675io_mcck_pending:
637 TRACE_IRQS_OFF
638 l %r1,BASED(.Ls390_handle_mcck) 676 l %r1,BASED(.Ls390_handle_mcck)
639 basr %r14,%r1 # TIF bit will be cleared by handler 677 basr %r14,%r1 # TIF bit will be cleared by handler
640 TRACE_IRQS_ON
641 b BASED(io_work_loop) 678 b BASED(io_work_loop)
642 679
643# 680#
644# _TIF_NEED_RESCHED is set, call schedule 681# _TIF_NEED_RESCHED is set, call schedule
645# 682#
646io_reschedule: 683io_reschedule:
684 TRACE_IRQS_ON
647 l %r1,BASED(.Lschedule) 685 l %r1,BASED(.Lschedule)
648 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 686 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
649 basr %r14,%r1 # call scheduler 687 basr %r14,%r1 # call scheduler
650 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 688 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
689 TRACE_IRQS_OFF
651 tm __TI_flags+3(%r9),_TIF_WORK_INT 690 tm __TI_flags+3(%r9),_TIF_WORK_INT
652 bz BASED(io_leave) # there is no work to do 691 bz BASED(io_restore) # there is no work to do
653 b BASED(io_work_loop) 692 b BASED(io_work_loop)
654 693
655# 694#
656# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 695# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
657# 696#
658io_sigpending: 697io_sigpending:
698 TRACE_IRQS_ON
659 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 699 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
660 la %r2,SP_PTREGS(%r15) # load pt_regs 700 la %r2,SP_PTREGS(%r15) # load pt_regs
661 l %r1,BASED(.Ldo_signal) 701 l %r1,BASED(.Ldo_signal)
662 basr %r14,%r1 # call do_signal 702 basr %r14,%r1 # call do_signal
663 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 703 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
704 TRACE_IRQS_OFF
664 b BASED(io_work_loop) 705 b BASED(io_work_loop)
665 706
666/* 707/*
@@ -688,7 +729,6 @@ ext_no_vtime:
688 lh %r3,__LC_EXT_INT_CODE # get interruption code 729 lh %r3,__LC_EXT_INT_CODE # get interruption code
689 l %r1,BASED(.Ldo_extint) 730 l %r1,BASED(.Ldo_extint)
690 basr %r14,%r1 731 basr %r14,%r1
691 TRACE_IRQS_ON
692 b BASED(io_return) 732 b BASED(io_return)
693 733
694__critical_end: 734__critical_end:
@@ -853,15 +893,15 @@ cleanup_table_system_call:
853cleanup_table_sysc_return: 893cleanup_table_sysc_return:
854 .long sysc_return + 0x80000000, sysc_leave + 0x80000000 894 .long sysc_return + 0x80000000, sysc_leave + 0x80000000
855cleanup_table_sysc_leave: 895cleanup_table_sysc_leave:
856 .long sysc_leave + 0x80000000, sysc_work_loop + 0x80000000 896 .long sysc_leave + 0x80000000, sysc_done + 0x80000000
857cleanup_table_sysc_work_loop: 897cleanup_table_sysc_work_loop:
858 .long sysc_work_loop + 0x80000000, sysc_reschedule + 0x80000000 898 .long sysc_work_loop + 0x80000000, sysc_work_done + 0x80000000
859cleanup_table_io_return: 899cleanup_table_io_return:
860 .long io_return + 0x80000000, io_leave + 0x80000000 900 .long io_return + 0x80000000, io_leave + 0x80000000
861cleanup_table_io_leave: 901cleanup_table_io_leave:
862 .long io_leave + 0x80000000, io_done + 0x80000000 902 .long io_leave + 0x80000000, io_done + 0x80000000
863cleanup_table_io_work_loop: 903cleanup_table_io_work_loop:
864 .long io_work_loop + 0x80000000, io_mcck_pending + 0x80000000 904 .long io_work_loop + 0x80000000, io_work_done + 0x80000000
865 905
866cleanup_critical: 906cleanup_critical:
867 clc 4(4,%r12),BASED(cleanup_table_system_call) 907 clc 4(4,%r12),BASED(cleanup_table_system_call)
@@ -930,8 +970,6 @@ cleanup_system_call:
930cleanup_vtime: 970cleanup_vtime:
931 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12) 971 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+12)
932 bhe BASED(cleanup_stime) 972 bhe BASED(cleanup_stime)
933 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
934 bz BASED(cleanup_novtime)
935 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 973 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
936cleanup_stime: 974cleanup_stime:
937 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+16) 975 clc __LC_RETURN_PSW+4(4),BASED(cleanup_system_call_insn+16)
@@ -939,7 +977,6 @@ cleanup_stime:
939 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 977 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
940cleanup_update: 978cleanup_update:
941 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 979 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
942cleanup_novtime:
943#endif 980#endif
944 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4) 981 mvc __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4)
945 la %r12,__LC_RETURN_PSW 982 la %r12,__LC_RETURN_PSW
@@ -978,10 +1015,10 @@ cleanup_sysc_leave:
9782: la %r12,__LC_RETURN_PSW 10152: la %r12,__LC_RETURN_PSW
979 br %r14 1016 br %r14
980cleanup_sysc_leave_insn: 1017cleanup_sysc_leave_insn:
1018 .long sysc_done - 4 + 0x80000000
981#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1019#ifdef CONFIG_VIRT_CPU_ACCOUNTING
982 .long sysc_leave + 14 + 0x80000000 1020 .long sysc_done - 8 + 0x80000000
983#endif 1021#endif
984 .long sysc_leave + 10 + 0x80000000
985 1022
986cleanup_io_return: 1023cleanup_io_return:
987 mvc __LC_RETURN_PSW(4),0(%r12) 1024 mvc __LC_RETURN_PSW(4),0(%r12)
@@ -1008,10 +1045,10 @@ cleanup_io_leave:
10082: la %r12,__LC_RETURN_PSW 10452: la %r12,__LC_RETURN_PSW
1009 br %r14 1046 br %r14
1010cleanup_io_leave_insn: 1047cleanup_io_leave_insn:
1048 .long io_done - 4 + 0x80000000
1011#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1049#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1012 .long io_leave + 18 + 0x80000000 1050 .long io_done - 8 + 0x80000000
1013#endif 1051#endif
1014 .long io_leave + 14 + 0x80000000
1015 1052
1016/* 1053/*
1017 * Integer constants 1054 * Integer constants
@@ -1019,7 +1056,6 @@ cleanup_io_leave_insn:
1019 .align 4 1056 .align 4
1020.Lc_spsize: .long SP_SIZE 1057.Lc_spsize: .long SP_SIZE
1021.Lc_overhead: .long STACK_FRAME_OVERHEAD 1058.Lc_overhead: .long STACK_FRAME_OVERHEAD
1022.Lc_pactive: .long PREEMPT_ACTIVE
1023.Lnr_syscalls: .long NR_syscalls 1059.Lnr_syscalls: .long NR_syscalls
1024.L0x018: .short 0x018 1060.L0x018: .short 0x018
1025.L0x020: .short 0x020 1061.L0x020: .short 0x020
@@ -1043,6 +1079,8 @@ cleanup_io_leave_insn:
1043.Lexecve_tail: .long execve_tail 1079.Lexecve_tail: .long execve_tail
1044.Ljump_table: .long pgm_check_table 1080.Ljump_table: .long pgm_check_table
1045.Lschedule: .long schedule 1081.Lschedule: .long schedule
1082.Lpreempt_schedule_irq:
1083 .long preempt_schedule_irq
1046.Ltrace: .long syscall_trace 1084.Ltrace: .long syscall_trace
1047.Lschedtail: .long schedule_tail 1085.Lschedtail: .long schedule_tail
1048.Lsysc_table: .long sys_call_table 1086.Lsysc_table: .long sys_call_table
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 05e26d1fdf40..a3e47b893f07 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -67,12 +67,28 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | _TIF_NEED_RESCHED | \
67 brasl %r14,trace_hardirqs_off 67 brasl %r14,trace_hardirqs_off
68 .endm 68 .endm
69 69
70 .macro LOCKDEP_SYS_EXIT 70 .macro TRACE_IRQS_CHECK
71 brasl %r14,lockdep_sys_exit 71 tm SP_PSW(%r15),0x03 # irqs enabled?
72 jz 0f
73 brasl %r14,trace_hardirqs_on
74 j 1f
750: brasl %r14,trace_hardirqs_off
761:
72 .endm 77 .endm
73#else 78#else
74#define TRACE_IRQS_ON 79#define TRACE_IRQS_ON
75#define TRACE_IRQS_OFF 80#define TRACE_IRQS_OFF
81#define TRACE_IRQS_CHECK
82#endif
83
84#ifdef CONFIG_LOCKDEP
85 .macro LOCKDEP_SYS_EXIT
86 tm SP_PSW+1(%r15),0x01 # returning to user ?
87 jz 0f
88 brasl %r14,lockdep_sys_exit
890:
90 .endm
91#else
76#define LOCKDEP_SYS_EXIT 92#define LOCKDEP_SYS_EXIT
77#endif 93#endif
78 94
@@ -222,8 +238,6 @@ sysc_saveall:
222 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore 238 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore
223#ifdef CONFIG_VIRT_CPU_ACCOUNTING 239#ifdef CONFIG_VIRT_CPU_ACCOUNTING
224sysc_vtime: 240sysc_vtime:
225 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
226 jz sysc_do_svc
227 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 241 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
228sysc_stime: 242sysc_stime:
229 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 243 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
@@ -257,19 +271,34 @@ sysc_noemu:
257 271
258sysc_return: 272sysc_return:
259 tm SP_PSW+1(%r15),0x01 # returning to user ? 273 tm SP_PSW+1(%r15),0x01 # returning to user ?
260 jno sysc_leave 274 jno sysc_restore
261 tm __TI_flags+7(%r9),_TIF_WORK_SVC 275 tm __TI_flags+7(%r9),_TIF_WORK_SVC
262 jnz sysc_work # there is work to do (signals etc.) 276 jnz sysc_work # there is work to do (signals etc.)
277sysc_restore:
278#ifdef CONFIG_TRACE_IRQFLAGS
279 larl %r1,sysc_restore_trace_psw
280 lpswe 0(%r1)
281sysc_restore_trace:
282 TRACE_IRQS_CHECK
263 LOCKDEP_SYS_EXIT 283 LOCKDEP_SYS_EXIT
284#endif
264sysc_leave: 285sysc_leave:
265 RESTORE_ALL __LC_RETURN_PSW,1 286 RESTORE_ALL __LC_RETURN_PSW,1
287sysc_done:
288
289#ifdef CONFIG_TRACE_IRQFLAGS
290 .align 8
291 .globl sysc_restore_trace_psw
292sysc_restore_trace_psw:
293 .quad 0, sysc_restore_trace
294#endif
266 295
267# 296#
268# recheck if there is more work to do 297# recheck if there is more work to do
269# 298#
270sysc_work_loop: 299sysc_work_loop:
271 tm __TI_flags+7(%r9),_TIF_WORK_SVC 300 tm __TI_flags+7(%r9),_TIF_WORK_SVC
272 jz sysc_leave # there is no work to do 301 jz sysc_restore # there is no work to do
273# 302#
274# One of the work bits is on. Find out which one. 303# One of the work bits is on. Find out which one.
275# 304#
@@ -284,8 +313,8 @@ sysc_work:
284 jo sysc_restart 313 jo sysc_restart
285 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP 314 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP
286 jo sysc_singlestep 315 jo sysc_singlestep
287 LOCKDEP_SYS_EXIT 316 j sysc_restore
288 j sysc_leave 317sysc_work_done:
289 318
290# 319#
291# _TIF_NEED_RESCHED is set, call schedule 320# _TIF_NEED_RESCHED is set, call schedule
@@ -445,6 +474,7 @@ pgm_check_handler:
445pgm_no_vtime: 474pgm_no_vtime:
446#endif 475#endif
447 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 476 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
477 TRACE_IRQS_OFF
448 lgf %r3,__LC_PGM_ILC # load program interruption code 478 lgf %r3,__LC_PGM_ILC # load program interruption code
449 lghi %r8,0x7f 479 lghi %r8,0x7f
450 ngr %r8,%r3 480 ngr %r8,%r3
@@ -484,6 +514,7 @@ pgm_per_std:
484pgm_no_vtime2: 514pgm_no_vtime2:
485#endif 515#endif
486 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 516 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
517 TRACE_IRQS_OFF
487 lg %r1,__TI_task(%r9) 518 lg %r1,__TI_task(%r9)
488 tm SP_PSW+1(%r15),0x01 # kernel per event ? 519 tm SP_PSW+1(%r15),0x01 # kernel per event ?
489 jz kernel_per 520 jz kernel_per
@@ -504,12 +535,9 @@ pgm_svcper:
504 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA 535 SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA
505 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA 536 CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA
506#ifdef CONFIG_VIRT_CPU_ACCOUNTING 537#ifdef CONFIG_VIRT_CPU_ACCOUNTING
507 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
508 jz pgm_no_vtime3
509 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 538 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
510 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 539 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
511 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 540 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
512pgm_no_vtime3:
513#endif 541#endif
514 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore 542 llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore
515 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct 543 lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct
@@ -529,7 +557,7 @@ kernel_per:
529 lhi %r0,__LC_PGM_OLD_PSW 557 lhi %r0,__LC_PGM_OLD_PSW
530 sth %r0,SP_TRAP(%r15) # set trap indication to pgm check 558 sth %r0,SP_TRAP(%r15) # set trap indication to pgm check
531 la %r2,SP_PTREGS(%r15) # address of register-save area 559 la %r2,SP_PTREGS(%r15) # address of register-save area
532 larl %r14,sysc_leave # load adr. of system ret, no work 560 larl %r14,sysc_restore # load adr. of system ret, no work
533 jg do_single_step # branch to do_single_step 561 jg do_single_step # branch to do_single_step
534 562
535/* 563/*
@@ -554,26 +582,38 @@ io_no_vtime:
554 TRACE_IRQS_OFF 582 TRACE_IRQS_OFF
555 la %r2,SP_PTREGS(%r15) # address of register-save area 583 la %r2,SP_PTREGS(%r15) # address of register-save area
556 brasl %r14,do_IRQ # call standard irq handler 584 brasl %r14,do_IRQ # call standard irq handler
557 TRACE_IRQS_ON
558
559io_return: 585io_return:
560 tm SP_PSW+1(%r15),0x01 # returning to user ? 586 tm SP_PSW+1(%r15),0x01 # returning to user ?
561#ifdef CONFIG_PREEMPT 587#ifdef CONFIG_PREEMPT
562 jno io_preempt # no -> check for preemptive scheduling 588 jno io_preempt # no -> check for preemptive scheduling
563#else 589#else
564 jno io_leave # no-> skip resched & signal 590 jno io_restore # no-> skip resched & signal
565#endif 591#endif
566 tm __TI_flags+7(%r9),_TIF_WORK_INT 592 tm __TI_flags+7(%r9),_TIF_WORK_INT
567 jnz io_work # there is work to do (signals etc.) 593 jnz io_work # there is work to do (signals etc.)
594io_restore:
595#ifdef CONFIG_TRACE_IRQFLAGS
596 larl %r1,io_restore_trace_psw
597 lpswe 0(%r1)
598io_restore_trace:
599 TRACE_IRQS_CHECK
568 LOCKDEP_SYS_EXIT 600 LOCKDEP_SYS_EXIT
601#endif
569io_leave: 602io_leave:
570 RESTORE_ALL __LC_RETURN_PSW,0 603 RESTORE_ALL __LC_RETURN_PSW,0
571io_done: 604io_done:
572 605
606#ifdef CONFIG_TRACE_IRQFLAGS
607 .align 8
608 .globl io_restore_trace_psw
609io_restore_trace_psw:
610 .quad 0, io_restore_trace
611#endif
612
573#ifdef CONFIG_PREEMPT 613#ifdef CONFIG_PREEMPT
574io_preempt: 614io_preempt:
575 icm %r0,15,__TI_precount(%r9) 615 icm %r0,15,__TI_precount(%r9)
576 jnz io_leave 616 jnz io_restore
577 # switch to kernel stack 617 # switch to kernel stack
578 lg %r1,SP_R15(%r15) 618 lg %r1,SP_R15(%r15)
579 aghi %r1,-SP_SIZE 619 aghi %r1,-SP_SIZE
@@ -582,14 +622,9 @@ io_preempt:
582 lgr %r15,%r1 622 lgr %r15,%r1
583io_resume_loop: 623io_resume_loop:
584 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED 624 tm __TI_flags+7(%r9),_TIF_NEED_RESCHED
585 jno io_leave 625 jno io_restore
586 larl %r1,.Lc_pactive 626 larl %r14,io_resume_loop
587 mvc __TI_precount(4,%r9),0(%r1) 627 jg preempt_schedule_irq
588 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
589 brasl %r14,schedule # call schedule
590 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
591 xc __TI_precount(4,%r9),__TI_precount(%r9)
592 j io_resume_loop
593#endif 628#endif
594 629
595# 630#
@@ -613,37 +648,39 @@ io_work_loop:
613 jo io_reschedule 648 jo io_reschedule
614 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK) 649 tm __TI_flags+7(%r9),(_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)
615 jnz io_sigpending 650 jnz io_sigpending
616 LOCKDEP_SYS_EXIT 651 j io_restore
617 j io_leave 652io_work_done:
618 653
619# 654#
620# _TIF_MCCK_PENDING is set, call handler 655# _TIF_MCCK_PENDING is set, call handler
621# 656#
622io_mcck_pending: 657io_mcck_pending:
623 TRACE_IRQS_OFF
624 brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler 658 brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler
625 TRACE_IRQS_ON
626 j io_work_loop 659 j io_work_loop
627 660
628# 661#
629# _TIF_NEED_RESCHED is set, call schedule 662# _TIF_NEED_RESCHED is set, call schedule
630# 663#
631io_reschedule: 664io_reschedule:
665 TRACE_IRQS_ON
632 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 666 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
633 brasl %r14,schedule # call scheduler 667 brasl %r14,schedule # call scheduler
634 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 668 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
669 TRACE_IRQS_OFF
635 tm __TI_flags+7(%r9),_TIF_WORK_INT 670 tm __TI_flags+7(%r9),_TIF_WORK_INT
636 jz io_leave # there is no work to do 671 jz io_restore # there is no work to do
637 j io_work_loop 672 j io_work_loop
638 673
639# 674#
640# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal 675# _TIF_SIGPENDING or _TIF_RESTORE_SIGMASK is set, call do_signal
641# 676#
642io_sigpending: 677io_sigpending:
678 TRACE_IRQS_ON
643 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts 679 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
644 la %r2,SP_PTREGS(%r15) # load pt_regs 680 la %r2,SP_PTREGS(%r15) # load pt_regs
645 brasl %r14,do_signal # call do_signal 681 brasl %r14,do_signal # call do_signal
646 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts 682 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
683 TRACE_IRQS_OFF
647 j io_work_loop 684 j io_work_loop
648 685
649/* 686/*
@@ -669,7 +706,6 @@ ext_no_vtime:
669 la %r2,SP_PTREGS(%r15) # address of register-save area 706 la %r2,SP_PTREGS(%r15) # address of register-save area
670 llgh %r3,__LC_EXT_INT_CODE # get interruption code 707 llgh %r3,__LC_EXT_INT_CODE # get interruption code
671 brasl %r14,do_extint 708 brasl %r14,do_extint
672 TRACE_IRQS_ON
673 j io_return 709 j io_return
674 710
675__critical_end: 711__critical_end:
@@ -824,15 +860,15 @@ cleanup_table_system_call:
824cleanup_table_sysc_return: 860cleanup_table_sysc_return:
825 .quad sysc_return, sysc_leave 861 .quad sysc_return, sysc_leave
826cleanup_table_sysc_leave: 862cleanup_table_sysc_leave:
827 .quad sysc_leave, sysc_work_loop 863 .quad sysc_leave, sysc_done
828cleanup_table_sysc_work_loop: 864cleanup_table_sysc_work_loop:
829 .quad sysc_work_loop, sysc_reschedule 865 .quad sysc_work_loop, sysc_work_done
830cleanup_table_io_return: 866cleanup_table_io_return:
831 .quad io_return, io_leave 867 .quad io_return, io_leave
832cleanup_table_io_leave: 868cleanup_table_io_leave:
833 .quad io_leave, io_done 869 .quad io_leave, io_done
834cleanup_table_io_work_loop: 870cleanup_table_io_work_loop:
835 .quad io_work_loop, io_mcck_pending 871 .quad io_work_loop, io_work_done
836 872
837cleanup_critical: 873cleanup_critical:
838 clc 8(8,%r12),BASED(cleanup_table_system_call) 874 clc 8(8,%r12),BASED(cleanup_table_system_call)
@@ -901,8 +937,6 @@ cleanup_system_call:
901cleanup_vtime: 937cleanup_vtime:
902 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24) 938 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24)
903 jhe cleanup_stime 939 jhe cleanup_stime
904 tm SP_PSW+1(%r15),0x01 # interrupting from user ?
905 jz cleanup_novtime
906 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER 940 UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER
907cleanup_stime: 941cleanup_stime:
908 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+32) 942 clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+32)
@@ -910,7 +944,6 @@ cleanup_stime:
910 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER 944 UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER
911cleanup_update: 945cleanup_update:
912 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 946 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
913cleanup_novtime:
914#endif 947#endif
915 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8) 948 mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8)
916 la %r12,__LC_RETURN_PSW 949 la %r12,__LC_RETURN_PSW
@@ -949,10 +982,10 @@ cleanup_sysc_leave:
9492: la %r12,__LC_RETURN_PSW 9822: la %r12,__LC_RETURN_PSW
950 br %r14 983 br %r14
951cleanup_sysc_leave_insn: 984cleanup_sysc_leave_insn:
985 .quad sysc_done - 4
952#ifdef CONFIG_VIRT_CPU_ACCOUNTING 986#ifdef CONFIG_VIRT_CPU_ACCOUNTING
953 .quad sysc_leave + 16 987 .quad sysc_done - 8
954#endif 988#endif
955 .quad sysc_leave + 12
956 989
957cleanup_io_return: 990cleanup_io_return:
958 mvc __LC_RETURN_PSW(8),0(%r12) 991 mvc __LC_RETURN_PSW(8),0(%r12)
@@ -979,17 +1012,16 @@ cleanup_io_leave:
9792: la %r12,__LC_RETURN_PSW 10122: la %r12,__LC_RETURN_PSW
980 br %r14 1013 br %r14
981cleanup_io_leave_insn: 1014cleanup_io_leave_insn:
1015 .quad io_done - 4
982#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1016#ifdef CONFIG_VIRT_CPU_ACCOUNTING
983 .quad io_leave + 20 1017 .quad io_done - 8
984#endif 1018#endif
985 .quad io_leave + 16
986 1019
987/* 1020/*
988 * Integer constants 1021 * Integer constants
989 */ 1022 */
990 .align 4 1023 .align 4
991.Lconst: 1024.Lconst:
992.Lc_pactive: .long PREEMPT_ACTIVE
993.Lnr_syscalls: .long NR_syscalls 1025.Lnr_syscalls: .long NR_syscalls
994.L0x0130: .short 0x130 1026.L0x0130: .short 0x130
995.L0x0140: .short 0x140 1027.L0x0140: .short 0x140
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 7e1bfb984064..50f8f1e3760e 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -347,7 +347,7 @@ void (*_machine_power_off)(void) = do_machine_power_off_nonsmp;
347 347
348void machine_restart(char *command) 348void machine_restart(char *command)
349{ 349{
350 if (!in_interrupt() || oops_in_progress) 350 if ((!in_interrupt() && !in_atomic()) || oops_in_progress)
351 /* 351 /*
352 * Only unblank the console if we are called in enabled 352 * Only unblank the console if we are called in enabled
353 * context or a bust_spinlocks cleared the way for us. 353 * context or a bust_spinlocks cleared the way for us.
@@ -492,6 +492,10 @@ static void setup_addressing_mode(void)
492 printk("S390 address spaces switched, "); 492 printk("S390 address spaces switched, ");
493 set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY); 493 set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY);
494 } 494 }
495#ifdef CONFIG_TRACE_IRQFLAGS
496 sysc_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
497 io_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
498#endif
495} 499}
496 500
497static void __init 501static void __init
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b05ae8584258..264ea906db4c 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -193,72 +193,30 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
193} 193}
194EXPORT_SYMBOL(smp_call_function_single); 194EXPORT_SYMBOL(smp_call_function_single);
195 195
196static void do_send_stop(void) 196void smp_send_stop(void)
197{ 197{
198 int cpu, rc; 198 int cpu, rc;
199 199
200 /* stop all processors */ 200 /* Disable all interrupts/machine checks */
201 for_each_online_cpu(cpu) { 201 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
202 if (cpu == smp_processor_id())
203 continue;
204 do {
205 rc = signal_processor(cpu, sigp_stop);
206 } while (rc == sigp_busy);
207 }
208}
209 202
210static void do_store_status(void) 203 /* write magic number to zero page (absolute 0) */
211{ 204 lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC;
212 int cpu, rc;
213 205
214 /* store status of all processors in their lowcores (real 0) */ 206 /* stop all processors */
215 for_each_online_cpu(cpu) { 207 for_each_online_cpu(cpu) {
216 if (cpu == smp_processor_id()) 208 if (cpu == smp_processor_id())
217 continue; 209 continue;
218 do { 210 do {
219 rc = signal_processor_p( 211 rc = signal_processor(cpu, sigp_stop);
220 (__u32)(unsigned long) lowcore_ptr[cpu], cpu,
221 sigp_store_status_at_address);
222 } while (rc == sigp_busy); 212 } while (rc == sigp_busy);
223 }
224}
225 213
226static void do_wait_for_stop(void)
227{
228 int cpu;
229
230 /* Wait for all other cpus to enter stopped state */
231 for_each_online_cpu(cpu) {
232 if (cpu == smp_processor_id())
233 continue;
234 while (!smp_cpu_not_running(cpu)) 214 while (!smp_cpu_not_running(cpu))
235 cpu_relax(); 215 cpu_relax();
236 } 216 }
237} 217}
238 218
239/* 219/*
240 * this function sends a 'stop' sigp to all other CPUs in the system.
241 * it goes straight through.
242 */
243void smp_send_stop(void)
244{
245 /* Disable all interrupts/machine checks */
246 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
247
248 /* write magic number to zero page (absolute 0) */
249 lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC;
250
251 /* stop other processors. */
252 do_send_stop();
253
254 /* wait until other processors are stopped */
255 do_wait_for_stop();
256
257 /* store status of other processors. */
258 do_store_status();
259}
260
261/*
262 * Reboot, halt and power_off routines for SMP. 220 * Reboot, halt and power_off routines for SMP.
263 */ 221 */
264void machine_restart_smp(char *__unused) 222void machine_restart_smp(char *__unused)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 8ec9def83ccb..8ed16a83fba7 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -260,6 +260,7 @@ void die(const char * str, struct pt_regs * regs, long err)
260 bust_spinlocks(1); 260 bust_spinlocks(1);
261 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 261 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
262 print_modules(); 262 print_modules();
263 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
263 show_regs(regs); 264 show_regs(regs);
264 bust_spinlocks(0); 265 bust_spinlocks(0);
265 add_taint(TAINT_DIE); 266 add_taint(TAINT_DIE);
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index d4ed93dfb9c7..413c240cbca7 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -341,19 +341,16 @@ cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
341 341
342static struct ctl_table cmm_table[] = { 342static struct ctl_table cmm_table[] = {
343 { 343 {
344 .ctl_name = VM_CMM_PAGES,
345 .procname = "cmm_pages", 344 .procname = "cmm_pages",
346 .mode = 0644, 345 .mode = 0644,
347 .proc_handler = &cmm_pages_handler, 346 .proc_handler = &cmm_pages_handler,
348 }, 347 },
349 { 348 {
350 .ctl_name = VM_CMM_TIMED_PAGES,
351 .procname = "cmm_timed_pages", 349 .procname = "cmm_timed_pages",
352 .mode = 0644, 350 .mode = 0644,
353 .proc_handler = &cmm_pages_handler, 351 .proc_handler = &cmm_pages_handler,
354 }, 352 },
355 { 353 {
356 .ctl_name = VM_CMM_TIMEOUT,
357 .procname = "cmm_timeout", 354 .procname = "cmm_timeout",
358 .mode = 0644, 355 .mode = 0644,
359 .proc_handler = &cmm_timeout_handler, 356 .proc_handler = &cmm_timeout_handler,
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 37f2c0b447fe..8125d20fdbd8 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -53,10 +53,12 @@ static struct resource cf_ide_resources[] = {
53 .end = PA_AREA5_IO + 0x80c, 53 .end = PA_AREA5_IO + 0x80c,
54 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
55 }, 55 },
56#ifndef CONFIG_RTS7751R2D_1 /* For R2D-1 polling is preferred */
56 [2] = { 57 [2] = {
57 .start = IRQ_CF_IDE, 58 .start = IRQ_CF_IDE,
58 .flags = IORESOURCE_IRQ, 59 .flags = IORESOURCE_IRQ,
59 }, 60 },
61#endif
60}; 62};
61 63
62static struct pata_platform_info pata_info = { 64static struct pata_platform_info pata_info = {
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index ac4de4973b60..2ad804ec920a 100644
--- a/arch/sh/configs/r7780mp_defconfig
+++ b/arch/sh/configs/r7780mp_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc4 3# Linux kernel version: 2.6.24-rc2
4# Mon Jun 11 10:24:57 2007 4# Tue Nov 13 20:32:39 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -13,38 +13,39 @@ CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_TIME=y 14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y 15CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_SYS_SUPPORTS_PCI=y
16CONFIG_STACKTRACE_SUPPORT=y 17CONFIG_STACKTRACE_SUPPORT=y
17CONFIG_LOCKDEP_SUPPORT=y 18CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 23
22# 24#
23# Code maturity level options 25# General setup
24# 26#
25CONFIG_EXPERIMENTAL=y 27CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 28CONFIG_BROKEN_ON_SMP=y
27CONFIG_LOCK_KERNEL=y 29CONFIG_LOCK_KERNEL=y
28CONFIG_INIT_ENV_ARG_LIMIT=32 30CONFIG_INIT_ENV_ARG_LIMIT=32
29
30#
31# General setup
32#
33CONFIG_LOCALVERSION="" 31CONFIG_LOCALVERSION=""
34CONFIG_LOCALVERSION_AUTO=y 32CONFIG_LOCALVERSION_AUTO=y
35CONFIG_SWAP=y 33CONFIG_SWAP=y
36CONFIG_SYSVIPC=y 34CONFIG_SYSVIPC=y
37# CONFIG_IPC_NS is not set
38CONFIG_SYSVIPC_SYSCTL=y 35CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set 36# CONFIG_POSIX_MQUEUE is not set
40CONFIG_BSD_PROCESS_ACCT=y 37CONFIG_BSD_PROCESS_ACCT=y
41# CONFIG_BSD_PROCESS_ACCT_V3 is not set 38# CONFIG_BSD_PROCESS_ACCT_V3 is not set
42# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
43# CONFIG_UTS_NS is not set 40# CONFIG_USER_NS is not set
44# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
45CONFIG_IKCONFIG=y 42CONFIG_IKCONFIG=y
46CONFIG_IKCONFIG_PROC=y 43CONFIG_IKCONFIG_PROC=y
47CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_CGROUPS is not set
46CONFIG_FAIR_GROUP_SCHED=y
47CONFIG_FAIR_USER_SCHED=y
48# CONFIG_FAIR_CGROUP_SCHED is not set
48# CONFIG_SYSFS_DEPRECATED is not set 49# CONFIG_SYSFS_DEPRECATED is not set
49# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
50# CONFIG_BLK_DEV_INITRD is not set 51# CONFIG_BLK_DEV_INITRD is not set
@@ -65,7 +66,6 @@ CONFIG_BASE_FULL=y
65CONFIG_ANON_INODES=y 66CONFIG_ANON_INODES=y
66# CONFIG_EPOLL is not set 67# CONFIG_EPOLL is not set
67CONFIG_SIGNALFD=y 68CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y 69CONFIG_EVENTFD=y
70CONFIG_SHMEM=y 70CONFIG_SHMEM=y
71CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
@@ -74,24 +74,17 @@ CONFIG_SLAB=y
74# CONFIG_SLOB is not set 74# CONFIG_SLOB is not set
75# CONFIG_TINY_SHMEM is not set 75# CONFIG_TINY_SHMEM is not set
76CONFIG_BASE_SMALL=0 76CONFIG_BASE_SMALL=0
77
78#
79# Loadable module support
80#
81CONFIG_MODULES=y 77CONFIG_MODULES=y
82CONFIG_MODULE_UNLOAD=y 78CONFIG_MODULE_UNLOAD=y
83# CONFIG_MODULE_FORCE_UNLOAD is not set 79# CONFIG_MODULE_FORCE_UNLOAD is not set
84# CONFIG_MODVERSIONS is not set 80# CONFIG_MODVERSIONS is not set
85# CONFIG_MODULE_SRCVERSION_ALL is not set 81# CONFIG_MODULE_SRCVERSION_ALL is not set
86CONFIG_KMOD=y 82CONFIG_KMOD=y
87
88#
89# Block layer
90#
91CONFIG_BLOCK=y 83CONFIG_BLOCK=y
92# CONFIG_LBD is not set 84# CONFIG_LBD is not set
93# CONFIG_BLK_DEV_IO_TRACE is not set 85# CONFIG_BLK_DEV_IO_TRACE is not set
94# CONFIG_LSF is not set 86# CONFIG_LSF is not set
87# CONFIG_BLK_DEV_BSG is not set
95 88
96# 89#
97# IO Schedulers 90# IO Schedulers
@@ -113,7 +106,6 @@ CONFIG_CPU_SH4=y
113CONFIG_CPU_SH4A=y 106CONFIG_CPU_SH4A=y
114# CONFIG_CPU_SUBTYPE_SH7619 is not set 107# CONFIG_CPU_SUBTYPE_SH7619 is not set
115# CONFIG_CPU_SUBTYPE_SH7206 is not set 108# CONFIG_CPU_SUBTYPE_SH7206 is not set
116# CONFIG_CPU_SUBTYPE_SH7300 is not set
117# CONFIG_CPU_SUBTYPE_SH7705 is not set 109# CONFIG_CPU_SUBTYPE_SH7705 is not set
118# CONFIG_CPU_SUBTYPE_SH7706 is not set 110# CONFIG_CPU_SUBTYPE_SH7706 is not set
119# CONFIG_CPU_SUBTYPE_SH7707 is not set 111# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -121,6 +113,7 @@ CONFIG_CPU_SH4A=y
121# CONFIG_CPU_SUBTYPE_SH7709 is not set 113# CONFIG_CPU_SUBTYPE_SH7709 is not set
122# CONFIG_CPU_SUBTYPE_SH7710 is not set 114# CONFIG_CPU_SUBTYPE_SH7710 is not set
123# CONFIG_CPU_SUBTYPE_SH7712 is not set 115# CONFIG_CPU_SUBTYPE_SH7712 is not set
116# CONFIG_CPU_SUBTYPE_SH7720 is not set
124# CONFIG_CPU_SUBTYPE_SH7750 is not set 117# CONFIG_CPU_SUBTYPE_SH7750 is not set
125# CONFIG_CPU_SUBTYPE_SH7091 is not set 118# CONFIG_CPU_SUBTYPE_SH7091 is not set
126# CONFIG_CPU_SUBTYPE_SH7750R is not set 119# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -129,12 +122,10 @@ CONFIG_CPU_SH4A=y
129# CONFIG_CPU_SUBTYPE_SH7751R is not set 122# CONFIG_CPU_SUBTYPE_SH7751R is not set
130# CONFIG_CPU_SUBTYPE_SH7760 is not set 123# CONFIG_CPU_SUBTYPE_SH7760 is not set
131# CONFIG_CPU_SUBTYPE_SH4_202 is not set 124# CONFIG_CPU_SUBTYPE_SH4_202 is not set
132# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
133# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
134# CONFIG_CPU_SUBTYPE_SH7770 is not set 125# CONFIG_CPU_SUBTYPE_SH7770 is not set
135CONFIG_CPU_SUBTYPE_SH7780=y 126CONFIG_CPU_SUBTYPE_SH7780=y
136# CONFIG_CPU_SUBTYPE_SH7785 is not set 127# CONFIG_CPU_SUBTYPE_SH7785 is not set
137# CONFIG_CPU_SUBTYPE_SH73180 is not set 128# CONFIG_CPU_SUBTYPE_SHX3 is not set
138# CONFIG_CPU_SUBTYPE_SH7343 is not set 129# CONFIG_CPU_SUBTYPE_SH7343 is not set
139# CONFIG_CPU_SUBTYPE_SH7722 is not set 130# CONFIG_CPU_SUBTYPE_SH7722 is not set
140 131
@@ -169,6 +160,7 @@ CONFIG_FLATMEM_MANUAL=y
169CONFIG_FLATMEM=y 160CONFIG_FLATMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 161CONFIG_FLAT_NODE_MEM_MAP=y
171CONFIG_SPARSEMEM_STATIC=y 162CONFIG_SPARSEMEM_STATIC=y
163# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
172CONFIG_SPLIT_PTLOCK_CPUS=4 164CONFIG_SPLIT_PTLOCK_CPUS=4
173# CONFIG_RESOURCES_64BIT is not set 165# CONFIG_RESOURCES_64BIT is not set
174CONFIG_ZONE_DMA_FLAG=0 166CONFIG_ZONE_DMA_FLAG=0
@@ -178,8 +170,9 @@ CONFIG_NR_QUICK=2
178# Cache configuration 170# Cache configuration
179# 171#
180# CONFIG_SH_DIRECT_MAPPED is not set 172# CONFIG_SH_DIRECT_MAPPED is not set
181# CONFIG_SH_WRITETHROUGH is not set 173CONFIG_CACHE_WRITEBACK=y
182# CONFIG_SH_OCRAM is not set 174# CONFIG_CACHE_WRITETHROUGH is not set
175# CONFIG_CACHE_OFF is not set
183 176
184# 177#
185# Processor features 178# Processor features
@@ -187,12 +180,11 @@ CONFIG_NR_QUICK=2
187CONFIG_CPU_LITTLE_ENDIAN=y 180CONFIG_CPU_LITTLE_ENDIAN=y
188# CONFIG_CPU_BIG_ENDIAN is not set 181# CONFIG_CPU_BIG_ENDIAN is not set
189CONFIG_SH_FPU=y 182CONFIG_SH_FPU=y
190# CONFIG_SH_DSP is not set
191CONFIG_SH_STORE_QUEUES=y 183CONFIG_SH_STORE_QUEUES=y
192CONFIG_SPECULATIVE_EXECUTION=y 184CONFIG_SPECULATIVE_EXECUTION=y
193CONFIG_CPU_HAS_INTEVT=y 185CONFIG_CPU_HAS_INTEVT=y
194CONFIG_CPU_HAS_INTC_IRQ=y
195CONFIG_CPU_HAS_SR_RB=y 186CONFIG_CPU_HAS_SR_RB=y
187CONFIG_CPU_HAS_FPU=y
196 188
197# 189#
198# Board support 190# Board support
@@ -212,6 +204,7 @@ CONFIG_SH_PCLK_FREQ=32000000
212# CONFIG_TICK_ONESHOT is not set 204# CONFIG_TICK_ONESHOT is not set
213# CONFIG_NO_HZ is not set 205# CONFIG_NO_HZ is not set
214# CONFIG_HIGH_RES_TIMERS is not set 206# CONFIG_HIGH_RES_TIMERS is not set
207CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
215 208
216# 209#
217# CPU Frequency scaling 210# CPU Frequency scaling
@@ -226,7 +219,6 @@ CONFIG_SH_PCLK_FREQ=32000000
226# 219#
227# Companion Chips 220# Companion Chips
228# 221#
229# CONFIG_HD6446X_SERIES is not set
230 222
231# 223#
232# Additional SuperH Device Drivers 224# Additional SuperH Device Drivers
@@ -244,18 +236,17 @@ CONFIG_HZ_250=y
244CONFIG_HZ=250 236CONFIG_HZ=250
245CONFIG_KEXEC=y 237CONFIG_KEXEC=y
246# CONFIG_CRASH_DUMP is not set 238# CONFIG_CRASH_DUMP is not set
247# CONFIG_SMP is not set
248# CONFIG_PREEMPT_NONE is not set 239# CONFIG_PREEMPT_NONE is not set
249# CONFIG_PREEMPT_VOLUNTARY is not set 240# CONFIG_PREEMPT_VOLUNTARY is not set
250CONFIG_PREEMPT=y 241CONFIG_PREEMPT=y
251CONFIG_PREEMPT_BKL=y 242CONFIG_PREEMPT_BKL=y
243CONFIG_GUSA=y
252 244
253# 245#
254# Boot options 246# Boot options
255# 247#
256CONFIG_ZERO_PAGE_OFFSET=0x00001000 248CONFIG_ZERO_PAGE_OFFSET=0x00001000
257CONFIG_BOOT_LINK_OFFSET=0x00800000 249CONFIG_BOOT_LINK_OFFSET=0x00800000
258# CONFIG_UBC_WAKEUP is not set
259CONFIG_CMDLINE_BOOL=y 250CONFIG_CMDLINE_BOOL=y
260CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 251CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
261 252
@@ -267,11 +258,8 @@ CONFIG_SH_PCIDMA_NONCOHERENT=y
267CONFIG_PCI_AUTO=y 258CONFIG_PCI_AUTO=y
268CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 259CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
269# CONFIG_ARCH_SUPPORTS_MSI is not set 260# CONFIG_ARCH_SUPPORTS_MSI is not set
261CONFIG_PCI_LEGACY=y
270# CONFIG_PCI_DEBUG is not set 262# CONFIG_PCI_DEBUG is not set
271
272#
273# PCCARD (PCMCIA/CardBus) support
274#
275# CONFIG_PCCARD is not set 263# CONFIG_PCCARD is not set
276# CONFIG_HOTPLUG_PCI is not set 264# CONFIG_HOTPLUG_PCI is not set
277 265
@@ -282,11 +270,6 @@ CONFIG_BINFMT_ELF=y
282# CONFIG_BINFMT_MISC is not set 270# CONFIG_BINFMT_MISC is not set
283 271
284# 272#
285# Power management options (EXPERIMENTAL)
286#
287# CONFIG_PM is not set
288
289#
290# Networking 273# Networking
291# 274#
292CONFIG_NET=y 275CONFIG_NET=y
@@ -327,6 +310,7 @@ CONFIG_IP_PNP_DHCP=y
327CONFIG_INET_XFRM_MODE_TRANSPORT=y 310CONFIG_INET_XFRM_MODE_TRANSPORT=y
328CONFIG_INET_XFRM_MODE_TUNNEL=y 311CONFIG_INET_XFRM_MODE_TUNNEL=y
329CONFIG_INET_XFRM_MODE_BEET=y 312CONFIG_INET_XFRM_MODE_BEET=y
313# CONFIG_INET_LRO is not set
330CONFIG_INET_DIAG=y 314CONFIG_INET_DIAG=y
331CONFIG_INET_TCP_DIAG=y 315CONFIG_INET_TCP_DIAG=y
332# CONFIG_TCP_CONG_ADVANCED is not set 316# CONFIG_TCP_CONG_ADVANCED is not set
@@ -353,10 +337,6 @@ CONFIG_LLC=m
353# CONFIG_LAPB is not set 337# CONFIG_LAPB is not set
354# CONFIG_ECONET is not set 338# CONFIG_ECONET is not set
355# CONFIG_WAN_ROUTER is not set 339# CONFIG_WAN_ROUTER is not set
356
357#
358# QoS and/or fair queueing
359#
360# CONFIG_NET_SCHED is not set 340# CONFIG_NET_SCHED is not set
361 341
362# 342#
@@ -376,6 +356,7 @@ CONFIG_WIRELESS_EXT=y
376# CONFIG_MAC80211 is not set 356# CONFIG_MAC80211 is not set
377# CONFIG_IEEE80211 is not set 357# CONFIG_IEEE80211 is not set
378# CONFIG_RFKILL is not set 358# CONFIG_RFKILL is not set
359# CONFIG_NET_9P is not set
379 360
380# 361#
381# Device Drivers 362# Device Drivers
@@ -384,33 +365,17 @@ CONFIG_WIRELESS_EXT=y
384# 365#
385# Generic Driver Options 366# Generic Driver Options
386# 367#
368CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
387CONFIG_STANDALONE=y 369CONFIG_STANDALONE=y
388CONFIG_PREVENT_FIRMWARE_BUILD=y 370CONFIG_PREVENT_FIRMWARE_BUILD=y
389CONFIG_FW_LOADER=m 371CONFIG_FW_LOADER=m
390# CONFIG_DEBUG_DRIVER is not set 372# CONFIG_DEBUG_DRIVER is not set
391# CONFIG_DEBUG_DEVRES is not set 373# CONFIG_DEBUG_DEVRES is not set
392# CONFIG_SYS_HYPERVISOR is not set 374# CONFIG_SYS_HYPERVISOR is not set
393
394#
395# Connector - unified userspace <-> kernelspace linker
396#
397# CONFIG_CONNECTOR is not set 375# CONFIG_CONNECTOR is not set
398# CONFIG_MTD is not set 376# CONFIG_MTD is not set
399
400#
401# Parallel port support
402#
403# CONFIG_PARPORT is not set 377# CONFIG_PARPORT is not set
404 378CONFIG_BLK_DEV=y
405#
406# Plug and Play support
407#
408# CONFIG_PNPACPI is not set
409
410#
411# Block devices
412#
413# CONFIG_BLK_CPQ_DA is not set
414# CONFIG_BLK_CPQ_CISS_DA is not set 379# CONFIG_BLK_CPQ_CISS_DA is not set
415# CONFIG_BLK_DEV_DAC960 is not set 380# CONFIG_BLK_DEV_DAC960 is not set
416# CONFIG_BLK_DEV_UMEM is not set 381# CONFIG_BLK_DEV_UMEM is not set
@@ -424,14 +389,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
424CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 389CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
425# CONFIG_CDROM_PKTCDVD is not set 390# CONFIG_CDROM_PKTCDVD is not set
426# CONFIG_ATA_OVER_ETH is not set 391# CONFIG_ATA_OVER_ETH is not set
427 392CONFIG_MISC_DEVICES=y
428#
429# Misc devices
430#
431# CONFIG_PHANTOM is not set 393# CONFIG_PHANTOM is not set
394CONFIG_EEPROM_93CX6=y
432# CONFIG_SGI_IOC4 is not set 395# CONFIG_SGI_IOC4 is not set
433# CONFIG_TIFM_CORE is not set 396# CONFIG_TIFM_CORE is not set
434# CONFIG_BLINK is not set
435# CONFIG_IDE is not set 397# CONFIG_IDE is not set
436 398
437# 399#
@@ -439,6 +401,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
439# 401#
440# CONFIG_RAID_ATTRS is not set 402# CONFIG_RAID_ATTRS is not set
441CONFIG_SCSI=y 403CONFIG_SCSI=y
404CONFIG_SCSI_DMA=y
442# CONFIG_SCSI_TGT is not set 405# CONFIG_SCSI_TGT is not set
443# CONFIG_SCSI_NETLINK is not set 406# CONFIG_SCSI_NETLINK is not set
444CONFIG_SCSI_PROC_FS=y 407CONFIG_SCSI_PROC_FS=y
@@ -468,12 +431,9 @@ CONFIG_SCSI_WAIT_SCAN=m
468# CONFIG_SCSI_SPI_ATTRS is not set 431# CONFIG_SCSI_SPI_ATTRS is not set
469# CONFIG_SCSI_FC_ATTRS is not set 432# CONFIG_SCSI_FC_ATTRS is not set
470# CONFIG_SCSI_ISCSI_ATTRS is not set 433# CONFIG_SCSI_ISCSI_ATTRS is not set
471# CONFIG_SCSI_SAS_ATTRS is not set
472# CONFIG_SCSI_SAS_LIBSAS is not set 434# CONFIG_SCSI_SAS_LIBSAS is not set
473 435# CONFIG_SCSI_SRP_ATTRS is not set
474# 436CONFIG_SCSI_LOWLEVEL=y
475# SCSI low-level drivers
476#
477# CONFIG_ISCSI_TCP is not set 437# CONFIG_ISCSI_TCP is not set
478# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 438# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
479# CONFIG_SCSI_3W_9XXX is not set 439# CONFIG_SCSI_3W_9XXX is not set
@@ -483,7 +443,6 @@ CONFIG_SCSI_WAIT_SCAN=m
483# CONFIG_SCSI_AIC7XXX_OLD is not set 443# CONFIG_SCSI_AIC7XXX_OLD is not set
484# CONFIG_SCSI_AIC79XX is not set 444# CONFIG_SCSI_AIC79XX is not set
485# CONFIG_SCSI_AIC94XX is not set 445# CONFIG_SCSI_AIC94XX is not set
486# CONFIG_SCSI_DPT_I2O is not set
487# CONFIG_SCSI_ARCMSR is not set 446# CONFIG_SCSI_ARCMSR is not set
488# CONFIG_MEGARAID_NEWGEN is not set 447# CONFIG_MEGARAID_NEWGEN is not set
489# CONFIG_MEGARAID_LEGACY is not set 448# CONFIG_MEGARAID_LEGACY is not set
@@ -548,6 +507,7 @@ CONFIG_SATA_SIL=y
548# CONFIG_PATA_OLDPIIX is not set 507# CONFIG_PATA_OLDPIIX is not set
549# CONFIG_PATA_NETCELL is not set 508# CONFIG_PATA_NETCELL is not set
550# CONFIG_PATA_NS87410 is not set 509# CONFIG_PATA_NS87410 is not set
510# CONFIG_PATA_NS87415 is not set
551# CONFIG_PATA_OPTI is not set 511# CONFIG_PATA_OPTI is not set
552# CONFIG_PATA_OPTIDMA is not set 512# CONFIG_PATA_OPTIDMA is not set
553# CONFIG_PATA_PDC_OLD is not set 513# CONFIG_PATA_PDC_OLD is not set
@@ -561,59 +521,43 @@ CONFIG_SATA_SIL=y
561# CONFIG_PATA_VIA is not set 521# CONFIG_PATA_VIA is not set
562# CONFIG_PATA_WINBOND is not set 522# CONFIG_PATA_WINBOND is not set
563CONFIG_PATA_PLATFORM=y 523CONFIG_PATA_PLATFORM=y
564
565#
566# Multi-device support (RAID and LVM)
567#
568# CONFIG_MD is not set 524# CONFIG_MD is not set
569
570#
571# Fusion MPT device support
572#
573# CONFIG_FUSION is not set 525# CONFIG_FUSION is not set
574# CONFIG_FUSION_SPI is not set
575# CONFIG_FUSION_FC is not set
576# CONFIG_FUSION_SAS is not set
577 526
578# 527#
579# IEEE 1394 (FireWire) support 528# IEEE 1394 (FireWire) support
580# 529#
581# CONFIG_FIREWIRE is not set 530# CONFIG_FIREWIRE is not set
582# CONFIG_IEEE1394 is not set 531# CONFIG_IEEE1394 is not set
583
584#
585# I2O device support
586#
587# CONFIG_I2O is not set 532# CONFIG_I2O is not set
588
589#
590# Network device support
591#
592CONFIG_NETDEVICES=y 533CONFIG_NETDEVICES=y
534# CONFIG_NETDEVICES_MULTIQUEUE is not set
593# CONFIG_DUMMY is not set 535# CONFIG_DUMMY is not set
594# CONFIG_BONDING is not set 536# CONFIG_BONDING is not set
537# CONFIG_MACVLAN is not set
595# CONFIG_EQUALIZER is not set 538# CONFIG_EQUALIZER is not set
596# CONFIG_TUN is not set 539# CONFIG_TUN is not set
540# CONFIG_VETH is not set
541# CONFIG_IP1000 is not set
597# CONFIG_ARCNET is not set 542# CONFIG_ARCNET is not set
598# CONFIG_PHYLIB is not set 543# CONFIG_PHYLIB is not set
599
600#
601# Ethernet (10 or 100Mbit)
602#
603CONFIG_NET_ETHERNET=y 544CONFIG_NET_ETHERNET=y
604CONFIG_MII=y 545CONFIG_MII=y
546CONFIG_AX88796=y
547CONFIG_AX88796_93CX6=y
605# CONFIG_STNIC is not set 548# CONFIG_STNIC is not set
606# CONFIG_HAPPYMEAL is not set 549# CONFIG_HAPPYMEAL is not set
607# CONFIG_SUNGEM is not set 550# CONFIG_SUNGEM is not set
608# CONFIG_CASSINI is not set 551# CONFIG_CASSINI is not set
609# CONFIG_NET_VENDOR_3COM is not set 552# CONFIG_NET_VENDOR_3COM is not set
610# CONFIG_SMC91X is not set 553# CONFIG_SMC91X is not set
611 554# CONFIG_SMC911X is not set
612#
613# Tulip family network device support
614#
615# CONFIG_NET_TULIP is not set 555# CONFIG_NET_TULIP is not set
616# CONFIG_HP100 is not set 556# CONFIG_HP100 is not set
557# CONFIG_IBM_NEW_EMAC_ZMII is not set
558# CONFIG_IBM_NEW_EMAC_RGMII is not set
559# CONFIG_IBM_NEW_EMAC_TAH is not set
560# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
617CONFIG_NET_PCI=y 561CONFIG_NET_PCI=y
618CONFIG_PCNET32=m 562CONFIG_PCNET32=m
619# CONFIG_PCNET32_NAPI is not set 563# CONFIG_PCNET32_NAPI is not set
@@ -621,7 +565,6 @@ CONFIG_PCNET32=m
621# CONFIG_ADAPTEC_STARFIRE is not set 565# CONFIG_ADAPTEC_STARFIRE is not set
622# CONFIG_B44 is not set 566# CONFIG_B44 is not set
623# CONFIG_FORCEDETH is not set 567# CONFIG_FORCEDETH is not set
624# CONFIG_DGRS is not set
625# CONFIG_EEPRO100 is not set 568# CONFIG_EEPRO100 is not set
626# CONFIG_E100 is not set 569# CONFIG_E100 is not set
627# CONFIG_FEALNX is not set 570# CONFIG_FEALNX is not set
@@ -647,6 +590,7 @@ CONFIG_NETDEV_1000=y
647CONFIG_E1000=m 590CONFIG_E1000=m
648# CONFIG_E1000_NAPI is not set 591# CONFIG_E1000_NAPI is not set
649# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 592# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
593# CONFIG_E1000E is not set
650# CONFIG_NS83820 is not set 594# CONFIG_NS83820 is not set
651# CONFIG_HAMACHI is not set 595# CONFIG_HAMACHI is not set
652# CONFIG_YELLOWFIN is not set 596# CONFIG_YELLOWFIN is not set
@@ -664,11 +608,14 @@ CONFIG_R8169=y
664CONFIG_NETDEV_10000=y 608CONFIG_NETDEV_10000=y
665# CONFIG_CHELSIO_T1 is not set 609# CONFIG_CHELSIO_T1 is not set
666# CONFIG_CHELSIO_T3 is not set 610# CONFIG_CHELSIO_T3 is not set
611# CONFIG_IXGBE is not set
667# CONFIG_IXGB is not set 612# CONFIG_IXGB is not set
668# CONFIG_S2IO is not set 613# CONFIG_S2IO is not set
669# CONFIG_MYRI10GE is not set 614# CONFIG_MYRI10GE is not set
670# CONFIG_NETXEN_NIC is not set 615# CONFIG_NETXEN_NIC is not set
616# CONFIG_NIU is not set
671# CONFIG_MLX4_CORE is not set 617# CONFIG_MLX4_CORE is not set
618# CONFIG_TEHUTI is not set
672# CONFIG_TR is not set 619# CONFIG_TR is not set
673 620
674# 621#
@@ -686,15 +633,7 @@ CONFIG_NETDEV_10000=y
686# CONFIG_NETCONSOLE is not set 633# CONFIG_NETCONSOLE is not set
687# CONFIG_NETPOLL is not set 634# CONFIG_NETPOLL is not set
688# CONFIG_NET_POLL_CONTROLLER is not set 635# CONFIG_NET_POLL_CONTROLLER is not set
689
690#
691# ISDN subsystem
692#
693# CONFIG_ISDN is not set 636# CONFIG_ISDN is not set
694
695#
696# Telephony Support
697#
698# CONFIG_PHONE is not set 637# CONFIG_PHONE is not set
699 638
700# 639#
@@ -702,6 +641,7 @@ CONFIG_NETDEV_10000=y
702# 641#
703CONFIG_INPUT=y 642CONFIG_INPUT=y
704# CONFIG_INPUT_FF_MEMLESS is not set 643# CONFIG_INPUT_FF_MEMLESS is not set
644# CONFIG_INPUT_POLLDEV is not set
705 645
706# 646#
707# Userland interfaces 647# Userland interfaces
@@ -711,7 +651,6 @@ CONFIG_INPUT_MOUSEDEV=y
711CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 651CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
712CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 652CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
713# CONFIG_INPUT_JOYDEV is not set 653# CONFIG_INPUT_JOYDEV is not set
714# CONFIG_INPUT_TSDEV is not set
715# CONFIG_INPUT_EVDEV is not set 654# CONFIG_INPUT_EVDEV is not set
716# CONFIG_INPUT_EVBUG is not set 655# CONFIG_INPUT_EVBUG is not set
717 656
@@ -765,21 +704,11 @@ CONFIG_SERIAL_CORE_CONSOLE=y
765CONFIG_UNIX98_PTYS=y 704CONFIG_UNIX98_PTYS=y
766CONFIG_LEGACY_PTYS=y 705CONFIG_LEGACY_PTYS=y
767CONFIG_LEGACY_PTY_COUNT=256 706CONFIG_LEGACY_PTY_COUNT=256
768
769#
770# IPMI
771#
772# CONFIG_IPMI_HANDLER is not set 707# CONFIG_IPMI_HANDLER is not set
773# CONFIG_WATCHDOG is not set
774CONFIG_HW_RANDOM=y 708CONFIG_HW_RANDOM=y
775# CONFIG_R3964 is not set 709# CONFIG_R3964 is not set
776# CONFIG_APPLICOM is not set 710# CONFIG_APPLICOM is not set
777# CONFIG_DRM is not set
778# CONFIG_RAW_DRIVER is not set 711# CONFIG_RAW_DRIVER is not set
779
780#
781# TPM devices
782#
783# CONFIG_TCG_TPM is not set 712# CONFIG_TCG_TPM is not set
784CONFIG_DEVPORT=y 713CONFIG_DEVPORT=y
785# CONFIG_I2C is not set 714# CONFIG_I2C is not set
@@ -789,21 +718,31 @@ CONFIG_DEVPORT=y
789# 718#
790# CONFIG_SPI is not set 719# CONFIG_SPI is not set
791# CONFIG_SPI_MASTER is not set 720# CONFIG_SPI_MASTER is not set
792
793#
794# Dallas's 1-wire bus
795#
796# CONFIG_W1 is not set 721# CONFIG_W1 is not set
722# CONFIG_POWER_SUPPLY is not set
797CONFIG_HWMON=y 723CONFIG_HWMON=y
798# CONFIG_HWMON_VID is not set 724# CONFIG_HWMON_VID is not set
799# CONFIG_SENSORS_ABITUGURU is not set
800# CONFIG_SENSORS_F71805F is not set 725# CONFIG_SENSORS_F71805F is not set
726# CONFIG_SENSORS_F71882FG is not set
727# CONFIG_SENSORS_IT87 is not set
728# CONFIG_SENSORS_PC87360 is not set
801# CONFIG_SENSORS_PC87427 is not set 729# CONFIG_SENSORS_PC87427 is not set
730# CONFIG_SENSORS_SIS5595 is not set
802# CONFIG_SENSORS_SMSC47M1 is not set 731# CONFIG_SENSORS_SMSC47M1 is not set
803# CONFIG_SENSORS_SMSC47B397 is not set 732# CONFIG_SENSORS_SMSC47B397 is not set
733# CONFIG_SENSORS_VIA686A is not set
804# CONFIG_SENSORS_VT1211 is not set 734# CONFIG_SENSORS_VT1211 is not set
735# CONFIG_SENSORS_VT8231 is not set
805# CONFIG_SENSORS_W83627HF is not set 736# CONFIG_SENSORS_W83627HF is not set
737# CONFIG_SENSORS_W83627EHF is not set
806# CONFIG_HWMON_DEBUG_CHIP is not set 738# CONFIG_HWMON_DEBUG_CHIP is not set
739# CONFIG_WATCHDOG is not set
740
741#
742# Sonics Silicon Backplane
743#
744CONFIG_SSB_POSSIBLE=y
745# CONFIG_SSB is not set
807 746
808# 747#
809# Multifunction device drivers 748# Multifunction device drivers
@@ -820,14 +759,16 @@ CONFIG_DAB=y
820# 759#
821# Graphics support 760# Graphics support
822# 761#
762# CONFIG_DRM is not set
763# CONFIG_VGASTATE is not set
764# CONFIG_VIDEO_OUTPUT_CONTROL is not set
765# CONFIG_FB is not set
823# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 766# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
824 767
825# 768#
826# Display device support 769# Display device support
827# 770#
828# CONFIG_DISPLAY_SUPPORT is not set 771# CONFIG_DISPLAY_SUPPORT is not set
829# CONFIG_VGASTATE is not set
830# CONFIG_FB is not set
831 772
832# 773#
833# Sound 774# Sound
@@ -843,20 +784,14 @@ CONFIG_SOUND=m
843# Open Sound System 784# Open Sound System
844# 785#
845CONFIG_SOUND_PRIME=m 786CONFIG_SOUND_PRIME=m
846# CONFIG_OSS_OBSOLETE is not set
847# CONFIG_SOUND_TRIDENT is not set 787# CONFIG_SOUND_TRIDENT is not set
848# CONFIG_SOUND_MSNDCLAS is not set 788# CONFIG_SOUND_MSNDCLAS is not set
849# CONFIG_SOUND_MSNDPIN is not set 789# CONFIG_SOUND_MSNDPIN is not set
850 790CONFIG_HID_SUPPORT=y
851#
852# HID Devices
853#
854CONFIG_HID=y 791CONFIG_HID=y
855# CONFIG_HID_DEBUG is not set 792# CONFIG_HID_DEBUG is not set
856 793# CONFIG_HIDRAW is not set
857# 794CONFIG_USB_SUPPORT=y
858# USB support
859#
860CONFIG_USB_ARCH_HAS_HCD=y 795CONFIG_USB_ARCH_HAS_HCD=y
861CONFIG_USB_ARCH_HAS_OHCI=y 796CONFIG_USB_ARCH_HAS_OHCI=y
862CONFIG_USB_ARCH_HAS_EHCI=y 797CONFIG_USB_ARCH_HAS_EHCI=y
@@ -871,32 +806,8 @@ CONFIG_USB_ARCH_HAS_EHCI=y
871# 806#
872# CONFIG_USB_GADGET is not set 807# CONFIG_USB_GADGET is not set
873# CONFIG_MMC is not set 808# CONFIG_MMC is not set
874
875#
876# LED devices
877#
878# CONFIG_NEW_LEDS is not set 809# CONFIG_NEW_LEDS is not set
879
880#
881# LED drivers
882#
883
884#
885# LED Triggers
886#
887
888#
889# InfiniBand support
890#
891# CONFIG_INFINIBAND is not set 810# CONFIG_INFINIBAND is not set
892
893#
894# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
895#
896
897#
898# Real Time Clock
899#
900CONFIG_RTC_LIB=y 811CONFIG_RTC_LIB=y
901CONFIG_RTC_CLASS=y 812CONFIG_RTC_CLASS=y
902CONFIG_RTC_HCTOSYS=y 813CONFIG_RTC_HCTOSYS=y
@@ -913,10 +824,6 @@ CONFIG_RTC_INTF_DEV=y
913# CONFIG_RTC_DRV_TEST is not set 824# CONFIG_RTC_DRV_TEST is not set
914 825
915# 826#
916# I2C RTC drivers
917#
918
919#
920# SPI RTC drivers 827# SPI RTC drivers
921# 828#
922 829
@@ -924,8 +831,10 @@ CONFIG_RTC_INTF_DEV=y
924# Platform RTC drivers 831# Platform RTC drivers
925# 832#
926# CONFIG_RTC_DRV_DS1553 is not set 833# CONFIG_RTC_DRV_DS1553 is not set
834# CONFIG_RTC_DRV_STK17TA8 is not set
927# CONFIG_RTC_DRV_DS1742 is not set 835# CONFIG_RTC_DRV_DS1742 is not set
928# CONFIG_RTC_DRV_M48T86 is not set 836# CONFIG_RTC_DRV_M48T86 is not set
837# CONFIG_RTC_DRV_M48T59 is not set
929# CONFIG_RTC_DRV_V3020 is not set 838# CONFIG_RTC_DRV_V3020 is not set
930 839
931# 840#
@@ -934,17 +843,9 @@ CONFIG_RTC_INTF_DEV=y
934CONFIG_RTC_DRV_SH=y 843CONFIG_RTC_DRV_SH=y
935 844
936# 845#
937# DMA Engine support 846# Userspace I/O
938#
939# CONFIG_DMA_ENGINE is not set
940
941#
942# DMA Clients
943#
944
945#
946# DMA Devices
947# 847#
848# CONFIG_UIO is not set
948 849
949# 850#
950# File systems 851# File systems
@@ -1005,7 +906,6 @@ CONFIG_TMPFS=y
1005# CONFIG_TMPFS_POSIX_ACL is not set 906# CONFIG_TMPFS_POSIX_ACL is not set
1006CONFIG_HUGETLBFS=y 907CONFIG_HUGETLBFS=y
1007CONFIG_HUGETLB_PAGE=y 908CONFIG_HUGETLB_PAGE=y
1008CONFIG_RAMFS=y
1009CONFIG_CONFIGFS_FS=m 909CONFIG_CONFIGFS_FS=m
1010 910
1011# 911#
@@ -1024,10 +924,7 @@ CONFIG_CONFIGFS_FS=m
1024# CONFIG_QNX4FS_FS is not set 924# CONFIG_QNX4FS_FS is not set
1025# CONFIG_SYSV_FS is not set 925# CONFIG_SYSV_FS is not set
1026# CONFIG_UFS_FS is not set 926# CONFIG_UFS_FS is not set
1027 927CONFIG_NETWORK_FILESYSTEMS=y
1028#
1029# Network File Systems
1030#
1031CONFIG_NFS_FS=y 928CONFIG_NFS_FS=y
1032CONFIG_NFS_V3=y 929CONFIG_NFS_V3=y
1033# CONFIG_NFS_V3_ACL is not set 930# CONFIG_NFS_V3_ACL is not set
@@ -1053,17 +950,12 @@ CONFIG_RPCSEC_GSS_KRB5=y
1053# CONFIG_NCP_FS is not set 950# CONFIG_NCP_FS is not set
1054# CONFIG_CODA_FS is not set 951# CONFIG_CODA_FS is not set
1055# CONFIG_AFS_FS is not set 952# CONFIG_AFS_FS is not set
1056# CONFIG_9P_FS is not set
1057 953
1058# 954#
1059# Partition Types 955# Partition Types
1060# 956#
1061# CONFIG_PARTITION_ADVANCED is not set 957# CONFIG_PARTITION_ADVANCED is not set
1062CONFIG_MSDOS_PARTITION=y 958CONFIG_MSDOS_PARTITION=y
1063
1064#
1065# Native Language Support
1066#
1067CONFIG_NLS=y 959CONFIG_NLS=y
1068CONFIG_NLS_DEFAULT="iso8859-1" 960CONFIG_NLS_DEFAULT="iso8859-1"
1069CONFIG_NLS_CODEPAGE_437=y 961CONFIG_NLS_CODEPAGE_437=y
@@ -1104,23 +996,18 @@ CONFIG_NLS_ISO8859_1=y
1104# CONFIG_NLS_KOI8_R is not set 996# CONFIG_NLS_KOI8_R is not set
1105# CONFIG_NLS_KOI8_U is not set 997# CONFIG_NLS_KOI8_U is not set
1106# CONFIG_NLS_UTF8 is not set 998# CONFIG_NLS_UTF8 is not set
1107
1108#
1109# Distributed Lock Manager
1110#
1111# CONFIG_DLM is not set 999# CONFIG_DLM is not set
1112 1000CONFIG_INSTRUMENTATION=y
1113#
1114# Profiling support
1115#
1116CONFIG_PROFILING=y 1001CONFIG_PROFILING=y
1117CONFIG_OPROFILE=m 1002CONFIG_OPROFILE=m
1003# CONFIG_MARKERS is not set
1118 1004
1119# 1005#
1120# Kernel hacking 1006# Kernel hacking
1121# 1007#
1122CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1008CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1123# CONFIG_PRINTK_TIME is not set 1009# CONFIG_PRINTK_TIME is not set
1010CONFIG_ENABLE_WARN_DEPRECATED=y
1124CONFIG_ENABLE_MUST_CHECK=y 1011CONFIG_ENABLE_MUST_CHECK=y
1125CONFIG_MAGIC_SYSRQ=y 1012CONFIG_MAGIC_SYSRQ=y
1126# CONFIG_UNUSED_SYMBOLS is not set 1013# CONFIG_UNUSED_SYMBOLS is not set
@@ -1129,6 +1016,7 @@ CONFIG_DEBUG_FS=y
1129CONFIG_DEBUG_KERNEL=y 1016CONFIG_DEBUG_KERNEL=y
1130# CONFIG_DEBUG_SHIRQ is not set 1017# CONFIG_DEBUG_SHIRQ is not set
1131CONFIG_DETECT_SOFTLOCKUP=y 1018CONFIG_DETECT_SOFTLOCKUP=y
1019CONFIG_SCHED_DEBUG=y
1132# CONFIG_SCHEDSTATS is not set 1020# CONFIG_SCHEDSTATS is not set
1133# CONFIG_TIMER_STATS is not set 1021# CONFIG_TIMER_STATS is not set
1134# CONFIG_DEBUG_SLAB is not set 1022# CONFIG_DEBUG_SLAB is not set
@@ -1137,6 +1025,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1137# CONFIG_DEBUG_MUTEXES is not set 1025# CONFIG_DEBUG_MUTEXES is not set
1138# CONFIG_DEBUG_LOCK_ALLOC is not set 1026# CONFIG_DEBUG_LOCK_ALLOC is not set
1139# CONFIG_PROVE_LOCKING is not set 1027# CONFIG_PROVE_LOCKING is not set
1028# CONFIG_LOCK_STAT is not set
1140# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1029# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1141# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1030# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1142# CONFIG_DEBUG_KOBJECT is not set 1031# CONFIG_DEBUG_KOBJECT is not set
@@ -1144,10 +1033,13 @@ CONFIG_DEBUG_BUGVERBOSE=y
1144CONFIG_DEBUG_INFO=y 1033CONFIG_DEBUG_INFO=y
1145# CONFIG_DEBUG_VM is not set 1034# CONFIG_DEBUG_VM is not set
1146# CONFIG_DEBUG_LIST is not set 1035# CONFIG_DEBUG_LIST is not set
1036# CONFIG_DEBUG_SG is not set
1147# CONFIG_FRAME_POINTER is not set 1037# CONFIG_FRAME_POINTER is not set
1148CONFIG_FORCED_INLINING=y 1038CONFIG_FORCED_INLINING=y
1039# CONFIG_BOOT_PRINTK_DELAY is not set
1149# CONFIG_RCU_TORTURE_TEST is not set 1040# CONFIG_RCU_TORTURE_TEST is not set
1150# CONFIG_FAULT_INJECTION is not set 1041# CONFIG_FAULT_INJECTION is not set
1042# CONFIG_SAMPLES is not set
1151CONFIG_SH_STANDARD_BIOS=y 1043CONFIG_SH_STANDARD_BIOS=y
1152# CONFIG_EARLY_SCIF_CONSOLE is not set 1044# CONFIG_EARLY_SCIF_CONSOLE is not set
1153CONFIG_EARLY_PRINTK=y 1045CONFIG_EARLY_PRINTK=y
@@ -1155,6 +1047,7 @@ CONFIG_EARLY_PRINTK=y
1155CONFIG_DEBUG_STACKOVERFLOW=y 1047CONFIG_DEBUG_STACKOVERFLOW=y
1156# CONFIG_DEBUG_STACK_USAGE is not set 1048# CONFIG_DEBUG_STACK_USAGE is not set
1157# CONFIG_4KSTACKS is not set 1049# CONFIG_4KSTACKS is not set
1050# CONFIG_IRQSTACKS is not set
1158# CONFIG_SH_KGDB is not set 1051# CONFIG_SH_KGDB is not set
1159 1052
1160# 1053#
@@ -1162,10 +1055,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y
1162# 1055#
1163# CONFIG_KEYS is not set 1056# CONFIG_KEYS is not set
1164# CONFIG_SECURITY is not set 1057# CONFIG_SECURITY is not set
1165 1058# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1166#
1167# Cryptographic options
1168#
1169CONFIG_CRYPTO=y 1059CONFIG_CRYPTO=y
1170CONFIG_CRYPTO_ALGAPI=y 1060CONFIG_CRYPTO_ALGAPI=y
1171CONFIG_CRYPTO_BLKCIPHER=y 1061CONFIG_CRYPTO_BLKCIPHER=y
@@ -1186,6 +1076,7 @@ CONFIG_CRYPTO_ECB=m
1186CONFIG_CRYPTO_CBC=y 1076CONFIG_CRYPTO_CBC=y
1187CONFIG_CRYPTO_PCBC=m 1077CONFIG_CRYPTO_PCBC=m
1188# CONFIG_CRYPTO_LRW is not set 1078# CONFIG_CRYPTO_LRW is not set
1079# CONFIG_CRYPTO_XTS is not set
1189# CONFIG_CRYPTO_CRYPTD is not set 1080# CONFIG_CRYPTO_CRYPTD is not set
1190CONFIG_CRYPTO_DES=y 1081CONFIG_CRYPTO_DES=y
1191# CONFIG_CRYPTO_FCRYPT is not set 1082# CONFIG_CRYPTO_FCRYPT is not set
@@ -1199,15 +1090,14 @@ CONFIG_CRYPTO_DES=y
1199# CONFIG_CRYPTO_ARC4 is not set 1090# CONFIG_CRYPTO_ARC4 is not set
1200# CONFIG_CRYPTO_KHAZAD is not set 1091# CONFIG_CRYPTO_KHAZAD is not set
1201# CONFIG_CRYPTO_ANUBIS is not set 1092# CONFIG_CRYPTO_ANUBIS is not set
1093# CONFIG_CRYPTO_SEED is not set
1202# CONFIG_CRYPTO_DEFLATE is not set 1094# CONFIG_CRYPTO_DEFLATE is not set
1203# CONFIG_CRYPTO_MICHAEL_MIC is not set 1095# CONFIG_CRYPTO_MICHAEL_MIC is not set
1204# CONFIG_CRYPTO_CRC32C is not set 1096# CONFIG_CRYPTO_CRC32C is not set
1205# CONFIG_CRYPTO_CAMELLIA is not set 1097# CONFIG_CRYPTO_CAMELLIA is not set
1206# CONFIG_CRYPTO_TEST is not set 1098# CONFIG_CRYPTO_TEST is not set
1207 1099# CONFIG_CRYPTO_AUTHENC is not set
1208# 1100CONFIG_CRYPTO_HW=y
1209# Hardware crypto devices
1210#
1211 1101
1212# 1102#
1213# Library routines 1103# Library routines
@@ -1217,6 +1107,7 @@ CONFIG_BITREVERSE=y
1217# CONFIG_CRC16 is not set 1107# CONFIG_CRC16 is not set
1218# CONFIG_CRC_ITU_T is not set 1108# CONFIG_CRC_ITU_T is not set
1219CONFIG_CRC32=y 1109CONFIG_CRC32=y
1110# CONFIG_CRC7 is not set
1220# CONFIG_LIBCRC32C is not set 1111# CONFIG_LIBCRC32C is not set
1221CONFIG_HAS_IOMEM=y 1112CONFIG_HAS_IOMEM=y
1222CONFIG_HAS_IOPORT=y 1113CONFIG_HAS_IOPORT=y
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index 158e03f0b1ef..2e43a2a971a9 100644
--- a/arch/sh/configs/r7785rp_defconfig
+++ b/arch/sh/configs/r7785rp_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc1 3# Linux kernel version: 2.6.24-rc2
4# Fri Nov 2 14:30:49 2007 4# Tue Nov 13 20:34:57 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 7CONFIG_RWSEM_GENERIC_SPINLOCK=y
@@ -124,8 +124,6 @@ CONFIG_CPU_SHX2=y
124# CONFIG_CPU_SUBTYPE_SH7751R is not set 124# CONFIG_CPU_SUBTYPE_SH7751R is not set
125# CONFIG_CPU_SUBTYPE_SH7760 is not set 125# CONFIG_CPU_SUBTYPE_SH7760 is not set
126# CONFIG_CPU_SUBTYPE_SH4_202 is not set 126# CONFIG_CPU_SUBTYPE_SH4_202 is not set
127# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
128# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
129# CONFIG_CPU_SUBTYPE_SH7770 is not set 127# CONFIG_CPU_SUBTYPE_SH7770 is not set
130# CONFIG_CPU_SUBTYPE_SH7780 is not set 128# CONFIG_CPU_SUBTYPE_SH7780 is not set
131CONFIG_CPU_SUBTYPE_SH7785=y 129CONFIG_CPU_SUBTYPE_SH7785=y
@@ -254,7 +252,6 @@ CONFIG_GUSA=y
254# 252#
255CONFIG_ZERO_PAGE_OFFSET=0x00001000 253CONFIG_ZERO_PAGE_OFFSET=0x00001000
256CONFIG_BOOT_LINK_OFFSET=0x00800000 254CONFIG_BOOT_LINK_OFFSET=0x00800000
257# CONFIG_UBC_WAKEUP is not set
258CONFIG_CMDLINE_BOOL=y 255CONFIG_CMDLINE_BOOL=y
259CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 256CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
260 257
@@ -266,6 +263,7 @@ CONFIG_SH_PCIDMA_NONCOHERENT=y
266CONFIG_PCI_AUTO=y 263CONFIG_PCI_AUTO=y
267CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 264CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
268# CONFIG_ARCH_SUPPORTS_MSI is not set 265# CONFIG_ARCH_SUPPORTS_MSI is not set
266CONFIG_PCI_LEGACY=y
269# CONFIG_PCI_DEBUG is not set 267# CONFIG_PCI_DEBUG is not set
270# CONFIG_PCCARD is not set 268# CONFIG_PCCARD is not set
271# CONFIG_HOTPLUG_PCI is not set 269# CONFIG_HOTPLUG_PCI is not set
@@ -550,6 +548,8 @@ CONFIG_NETDEVICES=y
550# CONFIG_PHYLIB is not set 548# CONFIG_PHYLIB is not set
551CONFIG_NET_ETHERNET=y 549CONFIG_NET_ETHERNET=y
552CONFIG_MII=y 550CONFIG_MII=y
551CONFIG_AX88796=y
552CONFIG_AX88796_93CX6=y
553# CONFIG_STNIC is not set 553# CONFIG_STNIC is not set
554# CONFIG_HAPPYMEAL is not set 554# CONFIG_HAPPYMEAL is not set
555# CONFIG_SUNGEM is not set 555# CONFIG_SUNGEM is not set
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index f33cedb353fc..60d74f793a1d 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -258,9 +258,6 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
258 pmd_t *pmd; 258 pmd_t *pmd;
259 pte_t *pte; 259 pte_t *pte;
260 pte_t entry; 260 pte_t entry;
261 struct mm_struct *mm = current->mm;
262 spinlock_t *ptl = NULL;
263 int ret = 1;
264 261
265#ifdef CONFIG_SH_KGDB 262#ifdef CONFIG_SH_KGDB
266 if (kgdb_nofault && kgdb_bus_err_hook) 263 if (kgdb_nofault && kgdb_bus_err_hook)
@@ -274,12 +271,11 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
274 */ 271 */
275 if (address >= P3SEG && address < P3_ADDR_MAX) { 272 if (address >= P3SEG && address < P3_ADDR_MAX) {
276 pgd = pgd_offset_k(address); 273 pgd = pgd_offset_k(address);
277 mm = NULL;
278 } else { 274 } else {
279 if (unlikely(address >= TASK_SIZE || !mm)) 275 if (unlikely(address >= TASK_SIZE || !current->mm))
280 return 1; 276 return 1;
281 277
282 pgd = pgd_offset(mm, address); 278 pgd = pgd_offset(current->mm, address);
283 } 279 }
284 280
285 pud = pud_offset(pgd, address); 281 pud = pud_offset(pgd, address);
@@ -289,34 +285,19 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
289 if (pmd_none_or_clear_bad(pmd)) 285 if (pmd_none_or_clear_bad(pmd))
290 return 1; 286 return 1;
291 287
292 if (mm) 288 pte = pte_offset_kernel(pmd, address);
293 pte = pte_offset_map_lock(mm, pmd, address, &ptl);
294 else
295 pte = pte_offset_kernel(pmd, address);
296
297 entry = *pte; 289 entry = *pte;
298 if (unlikely(pte_none(entry) || pte_not_present(entry))) 290 if (unlikely(pte_none(entry) || pte_not_present(entry)))
299 goto unlock; 291 return 1;
300 if (unlikely(writeaccess && !pte_write(entry))) 292 if (unlikely(writeaccess && !pte_write(entry)))
301 goto unlock; 293 return 1;
302 294
303 if (writeaccess) 295 if (writeaccess)
304 entry = pte_mkdirty(entry); 296 entry = pte_mkdirty(entry);
305 entry = pte_mkyoung(entry); 297 entry = pte_mkyoung(entry);
306 298
307#ifdef CONFIG_CPU_SH4
308 /*
309 * ITLB is not affected by "ldtlb" instruction.
310 * So, we need to flush the entry by ourselves.
311 */
312 local_flush_tlb_one(get_asid(), address & PAGE_MASK);
313#endif
314
315 set_pte(pte, entry); 299 set_pte(pte, entry);
316 update_mmu_cache(NULL, address, entry); 300 update_mmu_cache(NULL, address, entry);
317 ret = 0; 301
318unlock: 302 return 0;
319 if (mm)
320 pte_unmap_unlock(pte, ptl);
321 return ret;
322} 303}
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 31999bc1c8a4..ba6813a4aa37 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
168 $(Q)mkdir -p $(objtree)/include/asm-um 168 $(Q)mkdir -p $(objtree)/include/asm-um
169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch 169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
170else 170else
171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(SUBARCH) arch 171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch
172endif 172endif
173 173
174$(objtree)/$(ARCH_DIR)/include: 174$(objtree)/$(ARCH_DIR)/include:
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 7e6cdde62ead..b1a77b11f089 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1128,6 +1128,7 @@ static void do_ubd_request(struct request_queue *q)
1128 "errno = %d\n", -n); 1128 "errno = %d\n", -n);
1129 else if(list_empty(&dev->restart)) 1129 else if(list_empty(&dev->restart))
1130 list_add(&dev->restart, &restart); 1130 list_add(&dev->restart, &restart);
1131 kfree(io_req);
1131 return; 1132 return;
1132 } 1133 }
1133 1134
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index e34e1effe0f5..ef02d941c2ad 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -59,7 +59,7 @@ long long disable_timer(void)
59{ 59{
60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); 60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
61 61
62 if(setitimer(ITIMER_VIRTUAL, &time, &time) < 0) 62 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
63 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 63 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
64 "errno = %d\n", errno); 64 "errno = %d\n", errno);
65 65
@@ -74,13 +74,61 @@ long long os_nsecs(void)
74 return timeval_to_ns(&tv); 74 return timeval_to_ns(&tv);
75} 75}
76 76
77#ifdef UML_CONFIG_NO_HZ
78static int after_sleep_interval(struct timespec *ts)
79{
80}
81#else
82static inline long long timespec_to_us(const struct timespec *ts)
83{
84 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
85 ts->tv_nsec / UM_NSEC_PER_USEC;
86}
87
88static int after_sleep_interval(struct timespec *ts)
89{
90 int usec = UM_USEC_PER_SEC / UM_HZ;
91 long long start_usecs = timespec_to_us(ts);
92 struct timeval tv;
93 struct itimerval interval;
94
95 /*
96 * It seems that rounding can increase the value returned from
97 * setitimer to larger than the one passed in. Over time,
98 * this will cause the remaining time to be greater than the
99 * tick interval. If this happens, then just reduce the first
100 * tick to the interval value.
101 */
102 if (start_usecs > usec)
103 start_usecs = usec;
104 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC,
105 .tv_usec = start_usecs % UM_USEC_PER_SEC });
106 interval = ((struct itimerval) { { 0, usec }, tv });
107
108 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
109 return -errno;
110
111 return 0;
112}
113#endif
114
77extern void alarm_handler(int sig, struct sigcontext *sc); 115extern void alarm_handler(int sig, struct sigcontext *sc);
78 116
79void idle_sleep(unsigned long long nsecs) 117void idle_sleep(unsigned long long nsecs)
80{ 118{
81 struct timespec ts = { .tv_sec = nsecs / UM_NSEC_PER_SEC, 119 struct timespec ts;
82 .tv_nsec = nsecs % UM_NSEC_PER_SEC }; 120
121 /*
122 * nsecs can come in as zero, in which case, this starts a
123 * busy loop. To prevent this, reset nsecs to the tick
124 * interval if it is zero.
125 */
126 if (nsecs == 0)
127 nsecs = UM_NSEC_PER_SEC / UM_HZ;
128 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
129 .tv_nsec = nsecs % UM_NSEC_PER_SEC });
83 130
84 if (nanosleep(&ts, &ts) == 0) 131 if (nanosleep(&ts, &ts) == 0)
85 alarm_handler(SIGVTALRM, NULL); 132 alarm_handler(SIGVTALRM, NULL);
133 after_sleep_interval(&ts);
86} 134}
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 116b03a45636..7aa1dc6d67c8 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -11,10 +11,9 @@ endif
11$(srctree)/arch/x86/Makefile%: ; 11$(srctree)/arch/x86/Makefile%: ;
12 12
13ifeq ($(CONFIG_X86_32),y) 13ifeq ($(CONFIG_X86_32),y)
14 UTS_MACHINE := i386
14 include $(srctree)/arch/x86/Makefile_32 15 include $(srctree)/arch/x86/Makefile_32
15else 16else
17 UTS_MACHINE := x86_64
16 include $(srctree)/arch/x86/Makefile_64 18 include $(srctree)/arch/x86/Makefile_64
17endif 19endif
18
19
20
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 6ef5a060fa11..4cc5b0411db5 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -236,39 +236,30 @@ start_of_setup:
236 movw %ax, %es 236 movw %ax, %es
237 cld 237 cld
238 238
239# Apparently some ancient versions of LILO invoked the kernel 239# Apparently some ancient versions of LILO invoked the kernel with %ss != %ds,
240# with %ss != %ds, which happened to work by accident for the 240# which happened to work by accident for the old code. Recalculate the stack
241# old code. If the CAN_USE_HEAP flag is set in loadflags, or 241# pointer if %ss is invalid. Otherwise leave it alone, LOADLIN sets up the
242# %ss != %ds, then adjust the stack pointer. 242# stack behind its own code, so we can't blindly put it directly past the heap.
243 243
244 # Smallest possible stack we can tolerate
245 movw $(_end+STACK_SIZE), %cx
246
247 movw heap_end_ptr, %dx
248 addw $512, %dx
249 jnc 1f
250 xorw %dx, %dx # Wraparound - whole segment available
2511: testb $CAN_USE_HEAP, loadflags
252 jnz 2f
253
254 # No CAN_USE_HEAP
255 movw %ss, %dx 244 movw %ss, %dx
256 cmpw %ax, %dx # %ds == %ss? 245 cmpw %ax, %dx # %ds == %ss?
257 movw %sp, %dx 246 movw %sp, %dx
258 # If so, assume %sp is reasonably set, otherwise use 247 je 2f # -> assume %sp is reasonably set
259 # the smallest possible stack. 248
260 jne 4f # -> Smallest possible stack... 249 # Invalid %ss, make up a new stack
250 movw $_end, %dx
251 testb $CAN_USE_HEAP, loadflags
252 jz 1f
253 movw heap_end_ptr, %dx
2541: addw $STACK_SIZE, %dx
255 jnc 2f
256 xorw %dx, %dx # Prevent wraparound
261 257
262 # Make sure the stack is at least minimum size. Take a value 2582: # Now %dx should point to the end of our stack space
263 # of zero to mean "full segment."
2642:
265 andw $~3, %dx # dword align (might as well...) 259 andw $~3, %dx # dword align (might as well...)
266 jnz 3f 260 jnz 3f
267 movw $0xfffc, %dx # Make sure we're not zero 261 movw $0xfffc, %dx # Make sure we're not zero
2683: cmpw %cx, %dx 2623: movw %ax, %ss
269 jnb 5f
2704: movw %cx, %dx # Minimum value we can possibly use
2715: movw %ax, %ss
272 movzwl %dx, %esp # Clear upper half of %esp 263 movzwl %dx, %esp # Clear upper half of %esp
273 sti # Now we should have a working stack 264 sti # Now we should have a working stack
274 265
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index f63e5ff0aca1..a25db514c719 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
49 if (cpu_has(c, X86_FEATURE_EST)) 49 if (cpu_has(c, X86_FEATURE_EST))
50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; 50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
51 51
52 if (cpu_has(c, X86_FEATURE_ACPI))
53 buf[2] |= ACPI_PDC_T_FFH;
54
52 obj->type = ACPI_TYPE_BUFFER; 55 obj->type = ACPI_TYPE_BUFFER;
53 obj->buffer.length = 12; 56 obj->buffer.length = 12;
54 obj->buffer.pointer = (u8 *) buf; 57 obj->buffer.pointer = (u8 *) buf;
diff --git a/arch/x86/kernel/acpi/sleep_64.c b/arch/x86/kernel/acpi/sleep_64.c
index 79475d237071..da42de261ba8 100644
--- a/arch/x86/kernel/acpi/sleep_64.c
+++ b/arch/x86/kernel/acpi/sleep_64.c
@@ -115,6 +115,3 @@ static int __init acpi_sleep_setup(char *str)
115 115
116__setup("acpi_sleep=", acpi_sleep_setup); 116__setup("acpi_sleep=", acpi_sleep_setup);
117 117
118void acpi_pci_link_exit(void)
119{
120}
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 08b07c176962..96986b46bc85 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -789,7 +789,7 @@ void __init sync_Arb_IDs(void)
789 * Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 And not 789 * Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 And not
790 * needed on AMD. 790 * needed on AMD.
791 */ 791 */
792 if (modern_apic()) 792 if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
793 return; 793 return;
794 /* 794 /*
795 * Wait for idle. 795 * Wait for idle.
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index edd39ccf139e..02112fcc0de7 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -2,6 +2,7 @@
2#include <asm/semaphore.h> 2#include <asm/semaphore.h>
3#include <asm/checksum.h> 3#include <asm/checksum.h>
4#include <asm/desc.h> 4#include <asm/desc.h>
5#include <asm/pgtable.h>
5 6
6EXPORT_SYMBOL(__down_failed); 7EXPORT_SYMBOL(__down_failed);
7EXPORT_SYMBOL(__down_failed_interruptible); 8EXPORT_SYMBOL(__down_failed_interruptible);
@@ -29,3 +30,4 @@ EXPORT_SYMBOL(__read_lock_failed);
29#endif 30#endif
30 31
31EXPORT_SYMBOL(csum_partial); 32EXPORT_SYMBOL(csum_partial);
33EXPORT_SYMBOL(empty_zero_page);
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index f35c6eb33da9..6cf27319a91c 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq)
962#define default_MCA_trigger(idx) (1) 962#define default_MCA_trigger(idx) (1)
963#define default_MCA_polarity(idx) (0) 963#define default_MCA_polarity(idx) (0)
964 964
965static int __init MPBIOS_polarity(int idx) 965static int MPBIOS_polarity(int idx)
966{ 966{
967 int bus = mp_irqs[idx].mpc_srcbus; 967 int bus = mp_irqs[idx].mpc_srcbus;
968 int polarity; 968 int polarity;
@@ -2166,6 +2166,10 @@ static inline void __init check_timer(void)
2166{ 2166{
2167 int apic1, pin1, apic2, pin2; 2167 int apic1, pin1, apic2, pin2;
2168 int vector; 2168 int vector;
2169 unsigned int ver;
2170
2171 ver = apic_read(APIC_LVR);
2172 ver = GET_APIC_VERSION(ver);
2169 2173
2170 /* 2174 /*
2171 * get/set the timer IRQ vector: 2175 * get/set the timer IRQ vector:
@@ -2179,11 +2183,15 @@ static inline void __init check_timer(void)
2179 * mode for the 8259A whenever interrupts are routed 2183 * mode for the 8259A whenever interrupts are routed
2180 * through I/O APICs. Also IRQ0 has to be enabled in 2184 * through I/O APICs. Also IRQ0 has to be enabled in
2181 * the 8259A which implies the virtual wire has to be 2185 * the 8259A which implies the virtual wire has to be
2182 * disabled in the local APIC. 2186 * disabled in the local APIC. Finally timer interrupts
2187 * need to be acknowledged manually in the 8259A for
2188 * timer_interrupt() and for the i82489DX when using
2189 * the NMI watchdog.
2183 */ 2190 */
2184 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2191 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2185 init_8259A(1); 2192 init_8259A(1);
2186 timer_ack = 1; 2193 timer_ack = !cpu_has_tsc;
2194 timer_ack |= (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
2187 if (timer_over_8254 > 0) 2195 if (timer_over_8254 > 0)
2188 enable_8259A_irq(0); 2196 enable_8259A_irq(0);
2189 2197
@@ -2830,6 +2838,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2830 return 0; 2838 return 0;
2831} 2839}
2832 2840
2841int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2842{
2843 int i;
2844
2845 if (skip_ioapic_setup)
2846 return -1;
2847
2848 for (i = 0; i < mp_irq_entries; i++)
2849 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2850 mp_irqs[i].mpc_srcbusirq == bus_irq)
2851 break;
2852 if (i >= mp_irq_entries)
2853 return -1;
2854
2855 *trigger = irq_trigger(i);
2856 *polarity = irq_polarity(i);
2857 return 0;
2858}
2859
2833#endif /* CONFIG_ACPI */ 2860#endif /* CONFIG_ACPI */
2834 2861
2835static int __init parse_disable_timer_pin_1(char *arg) 2862static int __init parse_disable_timer_pin_1(char *arg)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 953328b55a30..435a8c9b55f8 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
546#define default_PCI_trigger(idx) (1) 546#define default_PCI_trigger(idx) (1)
547#define default_PCI_polarity(idx) (1) 547#define default_PCI_polarity(idx) (1)
548 548
549static int __init MPBIOS_polarity(int idx) 549static int MPBIOS_polarity(int idx)
550{ 550{
551 int bus = mp_irqs[idx].mpc_srcbus; 551 int bus = mp_irqs[idx].mpc_srcbus;
552 int polarity; 552 int polarity;
@@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
2222 return 0; 2222 return 0;
2223} 2223}
2224 2224
2225#endif /* CONFIG_ACPI */
2226 2225
2226int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2227{
2228 int i;
2229
2230 if (skip_ioapic_setup)
2231 return -1;
2232
2233 for (i = 0; i < mp_irq_entries; i++)
2234 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2235 mp_irqs[i].mpc_srcbusirq == bus_irq)
2236 break;
2237 if (i >= mp_irq_entries)
2238 return -1;
2239
2240 *trigger = irq_trigger(i);
2241 *polarity = irq_polarity(i);
2242 return 0;
2243}
2244
2245#endif /* CONFIG_ACPI */
2227 2246
2228/* 2247/*
2229 * This function currently is only a helper for the i386 smp boot process where 2248 * This function currently is only a helper for the i386 smp boot process where
@@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void)
2260 } 2279 }
2261} 2280}
2262#endif 2281#endif
2282
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index 3db3611933d8..0c467644589c 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -58,7 +58,7 @@ const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
58/* 58/*
59 * returns non-zero if opcode modifies the interrupt flag. 59 * returns non-zero if opcode modifies the interrupt flag.
60 */ 60 */
61static __always_inline int is_IF_modifier(kprobe_opcode_t *insn) 61static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
62{ 62{
63 switch (*insn) { 63 switch (*insn) {
64 case 0xfa: /* cli */ 64 case 0xfa: /* cli */
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 600fd404e440..f5cc47c60b13 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -25,6 +25,7 @@
25 25
26#include <asm/smp.h> 26#include <asm/smp.h>
27#include <asm/nmi.h> 27#include <asm/nmi.h>
28#include <asm/timer.h>
28 29
29#include "mach_traps.h" 30#include "mach_traps.h"
30 31
@@ -83,7 +84,7 @@ static int __init check_nmi_watchdog(void)
83 84
84 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 85 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
85 if (!prev_nmi_count) 86 if (!prev_nmi_count)
86 return -1; 87 goto error;
87 88
88 printk(KERN_INFO "Testing NMI watchdog ... "); 89 printk(KERN_INFO "Testing NMI watchdog ... ");
89 90
@@ -117,7 +118,7 @@ static int __init check_nmi_watchdog(void)
117 if (!atomic_read(&nmi_active)) { 118 if (!atomic_read(&nmi_active)) {
118 kfree(prev_nmi_count); 119 kfree(prev_nmi_count);
119 atomic_set(&nmi_active, -1); 120 atomic_set(&nmi_active, -1);
120 return -1; 121 goto error;
121 } 122 }
122 printk("OK.\n"); 123 printk("OK.\n");
123 124
@@ -128,6 +129,10 @@ static int __init check_nmi_watchdog(void)
128 129
129 kfree(prev_nmi_count); 130 kfree(prev_nmi_count);
130 return 0; 131 return 0;
132error:
133 timer_ack = !cpu_has_tsc;
134
135 return -1;
131} 136}
132/* This needs to happen later in boot so counters are working */ 137/* This needs to happen later in boot so counters are working */
133late_initcall(check_nmi_watchdog); 138late_initcall(check_nmi_watchdog);
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index 6a80d67c2121..f5000799f8ef 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -465,8 +465,8 @@ struct pv_mmu_ops pv_mmu_ops = {
465}; 465};
466 466
467EXPORT_SYMBOL_GPL(pv_time_ops); 467EXPORT_SYMBOL_GPL(pv_time_ops);
468EXPORT_SYMBOL_GPL(pv_cpu_ops); 468EXPORT_SYMBOL (pv_cpu_ops);
469EXPORT_SYMBOL_GPL(pv_mmu_ops); 469EXPORT_SYMBOL (pv_mmu_ops);
470EXPORT_SYMBOL_GPL(pv_apic_ops); 470EXPORT_SYMBOL_GPL(pv_apic_ops);
471EXPORT_SYMBOL_GPL(pv_info); 471EXPORT_SYMBOL_GPL(pv_info);
472EXPORT_SYMBOL (pv_irq_ops); 472EXPORT_SYMBOL (pv_irq_ops);
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index aa805b11b24f..5552d23d23c2 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -12,7 +12,7 @@
12#include <asm/gart.h> 12#include <asm/gart.h>
13#include <asm/calgary.h> 13#include <asm/calgary.h>
14 14
15int iommu_merge __read_mostly = 1; 15int iommu_merge __read_mostly = 0;
16EXPORT_SYMBOL(iommu_merge); 16EXPORT_SYMBOL(iommu_merge);
17 17
18dma_addr_t bad_dma_address __read_mostly; 18dma_addr_t bad_dma_address __read_mostly;
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 298d13ed3ab3..ef6010262597 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -283,6 +283,11 @@ void dump_stack(void)
283{ 283{
284 unsigned long stack; 284 unsigned long stack;
285 285
286 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
287 current->pid, current->comm, print_tainted(),
288 init_utsname()->release,
289 (int)strcspn(init_utsname()->version, " "),
290 init_utsname()->version);
286 show_trace(current, NULL, &stack); 291 show_trace(current, NULL, &stack);
287} 292}
288 293
@@ -828,6 +833,8 @@ fastcall void __kprobes do_debug(struct pt_regs * regs, long error_code)
828 unsigned int condition; 833 unsigned int condition;
829 struct task_struct *tsk = current; 834 struct task_struct *tsk = current;
830 835
836 trace_hardirqs_fixup();
837
831 get_debugreg(condition, 6); 838 get_debugreg(condition, 6);
832 839
833 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, 840 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 4a6bd4965f56..d11525ad81b4 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -31,6 +31,7 @@
31#include <linux/uaccess.h> 31#include <linux/uaccess.h>
32#include <linux/bug.h> 32#include <linux/bug.h>
33#include <linux/kdebug.h> 33#include <linux/kdebug.h>
34#include <linux/utsname.h>
34 35
35#if defined(CONFIG_EDAC) 36#if defined(CONFIG_EDAC)
36#include <linux/edac.h> 37#include <linux/edac.h>
@@ -400,6 +401,12 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
400void dump_stack(void) 401void dump_stack(void)
401{ 402{
402 unsigned long dummy; 403 unsigned long dummy;
404
405 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
406 current->pid, current->comm, print_tainted(),
407 init_utsname()->release,
408 (int)strcspn(init_utsname()->version, " "),
409 init_utsname()->version);
403 show_trace(NULL, NULL, &dummy); 410 show_trace(NULL, NULL, &dummy);
404} 411}
405 412
@@ -846,6 +853,8 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
846 struct task_struct *tsk = current; 853 struct task_struct *tsk = current;
847 siginfo_t info; 854 siginfo_t info;
848 855
856 trace_hardirqs_fixup();
857
849 get_debugreg(condition, 6); 858 get_debugreg(condition, 6);
850 859
851 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code, 860 if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index c4dffbeea5e1..19626ace0f50 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -2,6 +2,7 @@ config LGUEST_GUEST
2 bool "Lguest guest support" 2 bool "Lguest guest support"
3 select PARAVIRT 3 select PARAVIRT
4 depends on !X86_PAE 4 depends on !X86_PAE
5 depends on !(X86_VISWS || X86_VOYAGER)
5 select VIRTIO 6 select VIRTIO
6 select VIRTIO_RING 7 select VIRTIO_RING
7 select VIRTIO_CONSOLE 8 select VIRTIO_CONSOLE
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a7308b2cd058..0f9c8c890658 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -345,7 +345,7 @@ static void __init find_early_table_space(unsigned long end)
345/* Setup the direct mapping of the physical memory at PAGE_OFFSET. 345/* Setup the direct mapping of the physical memory at PAGE_OFFSET.
346 This runs before bootmem is initialized and gets pages directly from the 346 This runs before bootmem is initialized and gets pages directly from the
347 physical memory. To access them they are temporarily mapped. */ 347 physical memory. To access them they are temporarily mapped. */
348void __meminit init_memory_mapping(unsigned long start, unsigned long end) 348void __init_refok init_memory_mapping(unsigned long start, unsigned long end)
349{ 349{
350 unsigned long next; 350 unsigned long next;
351 351
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 7e35078673a4..0234f2831bf3 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -13,7 +13,7 @@ static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
13 return 0; 13 return 0;
14} 14}
15 15
16static struct dmi_system_id acpi_pciprobe_dmi_table[] = { 16static struct dmi_system_id acpi_pciprobe_dmi_table[] __devinitdata = {
17/* 17/*
18 * Systems where PCI IO resource ISA alignment can be skipped 18 * Systems where PCI IO resource ISA alignment can be skipped
19 * when the ISA enable bit in the bridge control is not set 19 * when the ISA enable bit in the bridge control is not set
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index f4386990b150..862746390666 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -315,6 +315,22 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
315 }, 315 },
316 }, 316 },
317#endif 317#endif
318 {
319 .callback = set_bf_sort,
320 .ident = "HP ProLiant DL385 G2",
321 .matches = {
322 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
323 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"),
324 },
325 },
326 {
327 .callback = set_bf_sort,
328 .ident = "HP ProLiant DL585 G2",
329 .matches = {
330 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
331 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"),
332 },
333 },
318 {} 334 {}
319}; 335};
320 336
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index b2e32f9d0071..0ac6c5dc49ba 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -244,6 +244,8 @@ pte_t xen_make_pte(unsigned long long pte)
244 if (pte & 1) 244 if (pte & 1)
245 pte = phys_to_machine(XPADDR(pte)).maddr; 245 pte = phys_to_machine(XPADDR(pte)).maddr;
246 246
247 pte &= ~_PAGE_PCD;
248
247 return (pte_t){ pte, pte >> 32 }; 249 return (pte_t){ pte, pte >> 32 };
248} 250}
249 251
@@ -291,6 +293,8 @@ pte_t xen_make_pte(unsigned long pte)
291 if (pte & _PAGE_PRESENT) 293 if (pte & _PAGE_PRESENT)
292 pte = phys_to_machine(XPADDR(pte)).maddr; 294 pte = phys_to_machine(XPADDR(pte)).maddr;
293 295
296 pte &= ~_PAGE_PCD;
297
294 return (pte_t){ pte }; 298 return (pte_t){ pte };
295} 299}
296 300
diff --git a/block/blktrace.c b/block/blktrace.c
index d00ac3993c18..498a0a54a6aa 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -202,6 +202,7 @@ static void blk_remove_tree(struct dentry *dir)
202static struct dentry *blk_create_tree(const char *blk_name) 202static struct dentry *blk_create_tree(const char *blk_name)
203{ 203{
204 struct dentry *dir = NULL; 204 struct dentry *dir = NULL;
205 int created = 0;
205 206
206 mutex_lock(&blk_tree_mutex); 207 mutex_lock(&blk_tree_mutex);
207 208
@@ -209,13 +210,17 @@ static struct dentry *blk_create_tree(const char *blk_name)
209 blk_tree_root = debugfs_create_dir("block", NULL); 210 blk_tree_root = debugfs_create_dir("block", NULL);
210 if (!blk_tree_root) 211 if (!blk_tree_root)
211 goto err; 212 goto err;
213 created = 1;
212 } 214 }
213 215
214 dir = debugfs_create_dir(blk_name, blk_tree_root); 216 dir = debugfs_create_dir(blk_name, blk_tree_root);
215 if (dir) 217 if (dir)
216 root_users++; 218 root_users++;
217 else 219 else {
218 blk_remove_root(); 220 /* Delete root only if we created it */
221 if (created)
222 blk_remove_root();
223 }
219 224
220err: 225err:
221 mutex_unlock(&blk_tree_mutex); 226 mutex_unlock(&blk_tree_mutex);
diff --git a/block/genhd.c b/block/genhd.c
index e609996f2e76..f2ac914160d1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -715,6 +715,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
715 disk->part = kmalloc_node(size, 715 disk->part = kmalloc_node(size,
716 GFP_KERNEL | __GFP_ZERO, node_id); 716 GFP_KERNEL | __GFP_ZERO, node_id);
717 if (!disk->part) { 717 if (!disk->part) {
718 free_disk_stats(disk);
718 kfree(disk); 719 kfree(disk);
719 return NULL; 720 return NULL;
720 } 721 }
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 3b927be03850..8b919940b2ab 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -4080,23 +4080,7 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page)
4080 return queue_var_show(max_hw_sectors_kb, (page)); 4080 return queue_var_show(max_hw_sectors_kb, (page));
4081} 4081}
4082 4082
4083static ssize_t queue_max_segments_show(struct request_queue *q, char *page)
4084{
4085 return queue_var_show(q->max_phys_segments, page);
4086}
4087
4088static ssize_t queue_max_segments_store(struct request_queue *q,
4089 const char *page, size_t count)
4090{
4091 unsigned long segments;
4092 ssize_t ret = queue_var_store(&segments, page, count);
4093 4083
4094 spin_lock_irq(q->queue_lock);
4095 q->max_phys_segments = segments;
4096 spin_unlock_irq(q->queue_lock);
4097
4098 return ret;
4099}
4100static struct queue_sysfs_entry queue_requests_entry = { 4084static struct queue_sysfs_entry queue_requests_entry = {
4101 .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, 4085 .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
4102 .show = queue_requests_show, 4086 .show = queue_requests_show,
@@ -4120,12 +4104,6 @@ static struct queue_sysfs_entry queue_max_hw_sectors_entry = {
4120 .show = queue_max_hw_sectors_show, 4104 .show = queue_max_hw_sectors_show,
4121}; 4105};
4122 4106
4123static struct queue_sysfs_entry queue_max_segments_entry = {
4124 .attr = {.name = "max_segments", .mode = S_IRUGO | S_IWUSR },
4125 .show = queue_max_segments_show,
4126 .store = queue_max_segments_store,
4127};
4128
4129static struct queue_sysfs_entry queue_iosched_entry = { 4107static struct queue_sysfs_entry queue_iosched_entry = {
4130 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR }, 4108 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
4131 .show = elv_iosched_show, 4109 .show = elv_iosched_show,
@@ -4137,7 +4115,6 @@ static struct attribute *default_attrs[] = {
4137 &queue_ra_entry.attr, 4115 &queue_ra_entry.attr,
4138 &queue_max_hw_sectors_entry.attr, 4116 &queue_max_hw_sectors_entry.attr,
4139 &queue_max_sectors_entry.attr, 4117 &queue_max_sectors_entry.attr,
4140 &queue_max_segments_entry.attr,
4141 &queue_iosched_entry.attr, 4118 &queue_iosched_entry.attr,
4142 NULL, 4119 NULL,
4143}; 4120};
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 8ff8c2656d9c..8383282de1dd 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -95,6 +95,9 @@ static void crypto_remove_spawn(struct crypto_spawn *spawn,
95 return; 95 return;
96 96
97 inst->alg.cra_flags |= CRYPTO_ALG_DEAD; 97 inst->alg.cra_flags |= CRYPTO_ALG_DEAD;
98 if (hlist_unhashed(&inst->list))
99 return;
100
98 if (!tmpl || !crypto_tmpl_get(tmpl)) 101 if (!tmpl || !crypto_tmpl_get(tmpl))
99 return; 102 return;
100 103
@@ -335,9 +338,6 @@ int crypto_register_instance(struct crypto_template *tmpl,
335 LIST_HEAD(list); 338 LIST_HEAD(list);
336 int err = -EINVAL; 339 int err = -EINVAL;
337 340
338 if (inst->alg.cra_destroy)
339 goto err;
340
341 err = crypto_check_alg(&inst->alg); 341 err = crypto_check_alg(&inst->alg);
342 if (err) 342 if (err)
343 goto err; 343 goto err;
diff --git a/crypto/authenc.c b/crypto/authenc.c
index 0b29a6ae673d..126a529b496d 100644
--- a/crypto/authenc.c
+++ b/crypto/authenc.c
@@ -84,8 +84,8 @@ static int crypto_authenc_hash(struct aead_request *req)
84 .tfm = auth, 84 .tfm = auth,
85 }; 85 };
86 u8 *hash = aead_request_ctx(req); 86 u8 *hash = aead_request_ctx(req);
87 struct scatterlist *dst; 87 struct scatterlist *dst = req->dst;
88 unsigned int cryptlen; 88 unsigned int cryptlen = req->cryptlen;
89 int err; 89 int err;
90 90
91 hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth), 91 hash = (u8 *)ALIGN((unsigned long)hash + crypto_hash_alignmask(auth),
@@ -100,8 +100,6 @@ static int crypto_authenc_hash(struct aead_request *req)
100 if (err) 100 if (err)
101 goto auth_unlock; 101 goto auth_unlock;
102 102
103 cryptlen = req->cryptlen;
104 dst = req->dst;
105 err = crypto_hash_update(&desc, dst, cryptlen); 103 err = crypto_hash_update(&desc, dst, cryptlen);
106 if (err) 104 if (err)
107 goto auth_unlock; 105 goto auth_unlock;
@@ -159,8 +157,8 @@ static int crypto_authenc_verify(struct aead_request *req)
159 }; 157 };
160 u8 *ohash = aead_request_ctx(req); 158 u8 *ohash = aead_request_ctx(req);
161 u8 *ihash; 159 u8 *ihash;
162 struct scatterlist *src; 160 struct scatterlist *src = req->src;
163 unsigned int cryptlen; 161 unsigned int cryptlen = req->cryptlen;
164 unsigned int authsize; 162 unsigned int authsize;
165 int err; 163 int err;
166 164
@@ -177,8 +175,6 @@ static int crypto_authenc_verify(struct aead_request *req)
177 if (err) 175 if (err)
178 goto auth_unlock; 176 goto auth_unlock;
179 177
180 cryptlen = req->cryptlen;
181 src = req->src;
182 err = crypto_hash_update(&desc, src, cryptlen); 178 err = crypto_hash_update(&desc, src, cryptlen);
183 if (err) 179 if (err)
184 goto auth_unlock; 180 goto auth_unlock;
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 087a7028ae84..b9f923ef173d 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -50,7 +50,6 @@ config ACPI_SLEEP
50config ACPI_PROCFS 50config ACPI_PROCFS
51 bool "Deprecated /proc/acpi files" 51 bool "Deprecated /proc/acpi files"
52 depends on PROC_FS 52 depends on PROC_FS
53 default y
54 ---help--- 53 ---help---
55 For backwards compatibility, this option allows 54 For backwards compatibility, this option allows
56 deprecated /proc/acpi/ files to exist, even when 55 deprecated /proc/acpi/ files to exist, even when
@@ -61,7 +60,6 @@ config ACPI_PROCFS
61 /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) 60 /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version)
62 /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) 61 /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
63 /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) 62 /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
64 /proc/acpi/battery (/sys/class/power_supply)
65 /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) 63 /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
66 /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) 64 /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
67 65
@@ -69,7 +67,21 @@ config ACPI_PROCFS
69 and functions which do not yet exist in /sys. 67 and functions which do not yet exist in /sys.
70 68
71 Say N to delete /proc/acpi/ files that have moved to /sys/ 69 Say N to delete /proc/acpi/ files that have moved to /sys/
72 70config ACPI_PROCFS_POWER
71 bool "Deprecated power /proc/acpi folders"
72 depends on PROC_FS
73 default y
74 ---help---
75 For backwards compatibility, this option allows
76 deprecated power /proc/acpi/ folders to exist, even when
77 they have been replaced by functions in /sys.
78 The deprecated folders (and their replacements) include:
79 /proc/acpi/battery/* (/sys/class/power_supply/*)
80 /proc/acpi/ac_adapter/* (sys/class/power_supply/*)
81 This option has no effect on /proc/acpi/ folders
82 and functions, which do not yet exist in /sys
83
84 Say N to delete power /proc/acpi/ folders that have moved to /sys/
73config ACPI_PROC_EVENT 85config ACPI_PROC_EVENT
74 bool "Deprecated /proc/acpi/event support" 86 bool "Deprecated /proc/acpi/event support"
75 depends on PROC_FS 87 depends on PROC_FS
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 54e3ab0e5fc0..456446f90077 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o
58obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o 58obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
59obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o 59obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
61obj-y += cm_sbs.o 61obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
62obj-$(CONFIG_ACPI_SBS) += sbs.o 62obj-$(CONFIG_ACPI_SBS) += sbs.o
63obj-$(CONFIG_ACPI_SBS) += sbshc.o 63obj-$(CONFIG_ACPI_SBS) += sbshc.o
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 30238f6ff232..76ed4f52bebd 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -27,7 +27,7 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef CONFIG_ACPI_PROCFS 30#ifdef CONFIG_ACPI_PROCFS_POWER
31#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif 33#endif
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");
51MODULE_DESCRIPTION("ACPI AC Adapter Driver"); 51MODULE_DESCRIPTION("ACPI AC Adapter Driver");
52MODULE_LICENSE("GPL"); 52MODULE_LICENSE("GPL");
53 53
54#ifdef CONFIG_ACPI_PROCFS 54#ifdef CONFIG_ACPI_PROCFS_POWER
55extern struct proc_dir_entry *acpi_lock_ac_dir(void); 55extern struct proc_dir_entry *acpi_lock_ac_dir(void);
56extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 56extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
57static int acpi_ac_open_fs(struct inode *inode, struct file *file); 57static int acpi_ac_open_fs(struct inode *inode, struct file *file);
@@ -86,7 +86,7 @@ struct acpi_ac {
86 86
87#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); 87#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
88 88
89#ifdef CONFIG_ACPI_PROCFS 89#ifdef CONFIG_ACPI_PROCFS_POWER
90static const struct file_operations acpi_ac_fops = { 90static const struct file_operations acpi_ac_fops = {
91 .open = acpi_ac_open_fs, 91 .open = acpi_ac_open_fs,
92 .read = seq_read, 92 .read = seq_read,
@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
136 return 0; 136 return 0;
137} 137}
138 138
139#ifdef CONFIG_ACPI_PROCFS 139#ifdef CONFIG_ACPI_PROCFS_POWER
140/* -------------------------------------------------------------------------- 140/* --------------------------------------------------------------------------
141 FS Interface (/proc) 141 FS Interface (/proc)
142 -------------------------------------------------------------------------- */ 142 -------------------------------------------------------------------------- */
@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device)
275 if (result) 275 if (result)
276 goto end; 276 goto end;
277 277
278#ifdef CONFIG_ACPI_PROCFS 278#ifdef CONFIG_ACPI_PROCFS_POWER
279 result = acpi_ac_add_fs(device); 279 result = acpi_ac_add_fs(device);
280#endif 280#endif
281 if (result) 281 if (result)
@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device)
300 300
301 end: 301 end:
302 if (result) { 302 if (result) {
303#ifdef CONFIG_ACPI_PROCFS 303#ifdef CONFIG_ACPI_PROCFS_POWER
304 acpi_ac_remove_fs(device); 304 acpi_ac_remove_fs(device);
305#endif 305#endif
306 kfree(ac); 306 kfree(ac);
@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
339 ACPI_ALL_NOTIFY, acpi_ac_notify); 339 ACPI_ALL_NOTIFY, acpi_ac_notify);
340 if (ac->charger.dev) 340 if (ac->charger.dev)
341 power_supply_unregister(&ac->charger); 341 power_supply_unregister(&ac->charger);
342#ifdef CONFIG_ACPI_PROCFS 342#ifdef CONFIG_ACPI_PROCFS_POWER
343 acpi_ac_remove_fs(device); 343 acpi_ac_remove_fs(device);
344#endif 344#endif
345 345
@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void)
355 if (acpi_disabled) 355 if (acpi_disabled)
356 return -ENODEV; 356 return -ENODEV;
357 357
358#ifdef CONFIG_ACPI_PROCFS 358#ifdef CONFIG_ACPI_PROCFS_POWER
359 acpi_ac_dir = acpi_lock_ac_dir(); 359 acpi_ac_dir = acpi_lock_ac_dir();
360 if (!acpi_ac_dir) 360 if (!acpi_ac_dir)
361 return -ENODEV; 361 return -ENODEV;
@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void)
363 363
364 result = acpi_bus_register_driver(&acpi_ac_driver); 364 result = acpi_bus_register_driver(&acpi_ac_driver);
365 if (result < 0) { 365 if (result < 0) {
366#ifdef CONFIG_ACPI_PROCFS 366#ifdef CONFIG_ACPI_PROCFS_POWER
367 acpi_unlock_ac_dir(acpi_ac_dir); 367 acpi_unlock_ac_dir(acpi_ac_dir);
368#endif 368#endif
369 return -ENODEV; 369 return -ENODEV;
@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void)
377 377
378 acpi_bus_unregister_driver(&acpi_ac_driver); 378 acpi_bus_unregister_driver(&acpi_ac_driver);
379 379
380#ifdef CONFIG_ACPI_PROCFS 380#ifdef CONFIG_ACPI_PROCFS_POWER
381 acpi_unlock_ac_dir(acpi_ac_dir); 381 acpi_unlock_ac_dir(acpi_ac_dir);
382#endif 382#endif
383 383
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 192c244f6190..7d6be23eff89 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -31,7 +31,7 @@
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33 33
34#ifdef CONFIG_ACPI_PROCFS 34#ifdef CONFIG_ACPI_PROCFS_POWER
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000;
63module_param(cache_time, uint, 0644); 63module_param(cache_time, uint, 0644);
64MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 64MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
65 65
66#ifdef CONFIG_ACPI_PROCFS 66#ifdef CONFIG_ACPI_PROCFS_POWER
67extern struct proc_dir_entry *acpi_lock_battery_dir(void); 67extern struct proc_dir_entry *acpi_lock_battery_dir(void);
68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); 68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
69 69
@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
153 val->intval = POWER_SUPPLY_STATUS_CHARGING; 153 val->intval = POWER_SUPPLY_STATUS_CHARGING;
154 else if (battery->state == 0) 154 else if (battery->state == 0)
155 val->intval = POWER_SUPPLY_STATUS_FULL; 155 val->intval = POWER_SUPPLY_STATUS_FULL;
156 else
157 val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
156 break; 158 break;
157 case POWER_SUPPLY_PROP_PRESENT: 159 case POWER_SUPPLY_PROP_PRESENT:
158 val->intval = acpi_battery_present(battery); 160 val->intval = acpi_battery_present(battery);
@@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = {
221 POWER_SUPPLY_PROP_MANUFACTURER, 223 POWER_SUPPLY_PROP_MANUFACTURER,
222}; 224};
223 225
224#ifdef CONFIG_ACPI_PROCFS 226#ifdef CONFIG_ACPI_PROCFS_POWER
225inline char *acpi_battery_units(struct acpi_battery *battery) 227inline char *acpi_battery_units(struct acpi_battery *battery)
226{ 228{
227 return (battery->power_unit)?"mA":"mW"; 229 return (battery->power_unit)?"mA":"mW";
@@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
479 FS Interface (/proc) 481 FS Interface (/proc)
480 -------------------------------------------------------------------------- */ 482 -------------------------------------------------------------------------- */
481 483
482#ifdef CONFIG_ACPI_PROCFS 484#ifdef CONFIG_ACPI_PROCFS_POWER
483static struct proc_dir_entry *acpi_battery_dir; 485static struct proc_dir_entry *acpi_battery_dir;
484 486
485static int acpi_battery_print_info(struct seq_file *seq, int result) 487static int acpi_battery_print_info(struct seq_file *seq, int result)
@@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device)
786 acpi_driver_data(device) = battery; 788 acpi_driver_data(device) = battery;
787 mutex_init(&battery->lock); 789 mutex_init(&battery->lock);
788 acpi_battery_update(battery); 790 acpi_battery_update(battery);
789#ifdef CONFIG_ACPI_PROCFS 791#ifdef CONFIG_ACPI_PROCFS_POWER
790 result = acpi_battery_add_fs(device); 792 result = acpi_battery_add_fs(device);
791 if (result) 793 if (result)
792 goto end; 794 goto end;
@@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device)
804 device->status.battery_present ? "present" : "absent"); 806 device->status.battery_present ? "present" : "absent");
805 end: 807 end:
806 if (result) { 808 if (result) {
807#ifdef CONFIG_ACPI_PROCFS 809#ifdef CONFIG_ACPI_PROCFS_POWER
808 acpi_battery_remove_fs(device); 810 acpi_battery_remove_fs(device);
809#endif 811#endif
810 kfree(battery); 812 kfree(battery);
@@ -823,7 +825,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
823 status = acpi_remove_notify_handler(device->handle, 825 status = acpi_remove_notify_handler(device->handle,
824 ACPI_ALL_NOTIFY, 826 ACPI_ALL_NOTIFY,
825 acpi_battery_notify); 827 acpi_battery_notify);
826#ifdef CONFIG_ACPI_PROCFS 828#ifdef CONFIG_ACPI_PROCFS_POWER
827 acpi_battery_remove_fs(device); 829 acpi_battery_remove_fs(device);
828#endif 830#endif
829 sysfs_remove_battery(battery); 831 sysfs_remove_battery(battery);
@@ -859,13 +861,13 @@ static int __init acpi_battery_init(void)
859{ 861{
860 if (acpi_disabled) 862 if (acpi_disabled)
861 return -ENODEV; 863 return -ENODEV;
862#ifdef CONFIG_ACPI_PROCFS 864#ifdef CONFIG_ACPI_PROCFS_POWER
863 acpi_battery_dir = acpi_lock_battery_dir(); 865 acpi_battery_dir = acpi_lock_battery_dir();
864 if (!acpi_battery_dir) 866 if (!acpi_battery_dir)
865 return -ENODEV; 867 return -ENODEV;
866#endif 868#endif
867 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { 869 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
868#ifdef CONFIG_ACPI_PROCFS 870#ifdef CONFIG_ACPI_PROCFS_POWER
869 acpi_unlock_battery_dir(acpi_battery_dir); 871 acpi_unlock_battery_dir(acpi_battery_dir);
870#endif 872#endif
871 return -ENODEV; 873 return -ENODEV;
@@ -876,7 +878,7 @@ static int __init acpi_battery_init(void)
876static void __exit acpi_battery_exit(void) 878static void __exit acpi_battery_exit(void)
877{ 879{
878 acpi_bus_unregister_driver(&acpi_battery_driver); 880 acpi_bus_unregister_driver(&acpi_battery_driver);
879#ifdef CONFIG_ACPI_PROCFS 881#ifdef CONFIG_ACPI_PROCFS_POWER
880 acpi_unlock_battery_dir(acpi_battery_dir); 882 acpi_unlock_battery_dir(acpi_battery_dir);
881#endif 883#endif
882} 884}
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 06b78e5e33a1..d411017f8c06 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -47,6 +47,9 @@
47#undef PREFIX 47#undef PREFIX
48#define PREFIX "ACPI: EC: " 48#define PREFIX "ACPI: EC: "
49 49
50/* Uncomment next line to get verbose print outs*/
51/* #define DEBUG */
52
50/* EC status register */ 53/* EC status register */
51#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ 54#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
52#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ 55#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
@@ -75,7 +78,10 @@ enum {
75 EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ 78 EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
76 EC_FLAGS_QUERY_PENDING, /* Query is pending */ 79 EC_FLAGS_QUERY_PENDING, /* Query is pending */
77 EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ 80 EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
78 EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */ 81 EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */
82 EC_FLAGS_ADDRESS, /* Address is being written */
83 EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */
84 EC_FLAGS_WDATA, /* Data is being written */
79}; 85};
80 86
81static int acpi_ec_remove(struct acpi_device *device, int type); 87static int acpi_ec_remove(struct acpi_device *device, int type);
@@ -131,21 +137,27 @@ static struct acpi_ec {
131 137
132static inline u8 acpi_ec_read_status(struct acpi_ec *ec) 138static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
133{ 139{
134 return inb(ec->command_addr); 140 u8 x = inb(ec->command_addr);
141 pr_debug(PREFIX "---> status = 0x%2x\n", x);
142 return x;
135} 143}
136 144
137static inline u8 acpi_ec_read_data(struct acpi_ec *ec) 145static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
138{ 146{
147 u8 x = inb(ec->data_addr);
148 pr_debug(PREFIX "---> data = 0x%2x\n", x);
139 return inb(ec->data_addr); 149 return inb(ec->data_addr);
140} 150}
141 151
142static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) 152static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
143{ 153{
154 pr_debug(PREFIX "<--- command = 0x%2x\n", command);
144 outb(command, ec->command_addr); 155 outb(command, ec->command_addr);
145} 156}
146 157
147static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) 158static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
148{ 159{
160 pr_debug(PREFIX "<--- data = 0x%2x\n", data);
149 outb(data, ec->data_addr); 161 outb(data, ec->data_addr);
150} 162}
151 163
@@ -166,38 +178,54 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
166 178
167static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) 179static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
168{ 180{
181 int ret = 0;
182 if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) &&
183 test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags)))
184 force_poll = 1;
185 if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) &&
186 test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags)))
187 force_poll = 1;
169 if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && 188 if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
170 likely(!force_poll)) { 189 likely(!force_poll)) {
171 if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), 190 if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
172 msecs_to_jiffies(ACPI_EC_DELAY))) 191 msecs_to_jiffies(ACPI_EC_DELAY)))
173 return 0; 192 goto end;
174 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); 193 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
175 if (acpi_ec_check_status(ec, event)) { 194 if (acpi_ec_check_status(ec, event)) {
176 if (event == ACPI_EC_EVENT_OBF_1) { 195 if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) {
177 /* miss OBF = 1 GPE, don't expect it anymore */ 196 /* miss address GPE, don't expect it anymore */
178 printk(KERN_INFO PREFIX "missing OBF_1 confirmation," 197 pr_info(PREFIX "missing address confirmation, "
179 "switching to degraded mode.\n"); 198 "don't expect it any longer.\n");
180 set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags); 199 set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags);
200 } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) {
201 /* miss write data GPE, don't expect it */
202 pr_info(PREFIX "missing write data confirmation, "
203 "don't expect it any longer.\n");
204 set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags);
181 } else { 205 } else {
182 /* missing GPEs, switch back to poll mode */ 206 /* missing GPEs, switch back to poll mode */
183 printk(KERN_INFO PREFIX "missing IBF_1 confirmations," 207 if (printk_ratelimit())
184 "switch off interrupt mode.\n"); 208 pr_info(PREFIX "missing confirmations, "
209 "switch off interrupt mode.\n");
185 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); 210 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
186 } 211 }
187 return 0; 212 goto end;
188 } 213 }
189 } else { 214 } else {
190 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 215 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
191 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); 216 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
192 while (time_before(jiffies, delay)) { 217 while (time_before(jiffies, delay)) {
193 if (acpi_ec_check_status(ec, event)) 218 if (acpi_ec_check_status(ec, event))
194 return 0; 219 goto end;
195 } 220 }
196 } 221 }
197 printk(KERN_ERR PREFIX "acpi_ec_wait timeout," 222 pr_err(PREFIX "acpi_ec_wait timeout,"
198 " status = %d, expect_event = %d\n", 223 " status = %d, expect_event = %d\n",
199 acpi_ec_read_status(ec), event); 224 acpi_ec_read_status(ec), event);
200 return -ETIME; 225 ret = -ETIME;
226 end:
227 clear_bit(EC_FLAGS_ADDRESS, &ec->flags);
228 return ret;
201} 229}
202 230
203static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, 231static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
@@ -208,22 +236,26 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
208 int result = 0; 236 int result = 0;
209 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); 237 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
210 acpi_ec_write_cmd(ec, command); 238 acpi_ec_write_cmd(ec, command);
211 239 pr_debug(PREFIX "transaction start\n");
212 for (; wdata_len > 0; --wdata_len) { 240 for (; wdata_len > 0; --wdata_len) {
213 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); 241 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
214 if (result) { 242 if (result) {
215 printk(KERN_ERR PREFIX 243 pr_err(PREFIX
216 "write_cmd timeout, command = %d\n", command); 244 "write_cmd timeout, command = %d\n", command);
217 goto end; 245 goto end;
218 } 246 }
247 /* mark the address byte written to EC */
248 if (rdata_len + wdata_len > 1)
249 set_bit(EC_FLAGS_ADDRESS, &ec->flags);
219 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); 250 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
220 acpi_ec_write_data(ec, *(wdata++)); 251 acpi_ec_write_data(ec, *(wdata++));
221 } 252 }
222 253
223 if (!rdata_len) { 254 if (!rdata_len) {
255 set_bit(EC_FLAGS_WDATA, &ec->flags);
224 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); 256 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
225 if (result) { 257 if (result) {
226 printk(KERN_ERR PREFIX 258 pr_err(PREFIX
227 "finish-write timeout, command = %d\n", command); 259 "finish-write timeout, command = %d\n", command);
228 goto end; 260 goto end;
229 } 261 }
@@ -231,12 +263,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
231 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); 263 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
232 264
233 for (; rdata_len > 0; --rdata_len) { 265 for (; rdata_len > 0; --rdata_len) {
234 if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags))
235 force_poll = 1;
236 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); 266 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll);
237 if (result) { 267 if (result) {
238 printk(KERN_ERR PREFIX "read timeout, command = %d\n", 268 pr_err(PREFIX "read timeout, command = %d\n", command);
239 command);
240 goto end; 269 goto end;
241 } 270 }
242 /* Don't expect GPE after last read */ 271 /* Don't expect GPE after last read */
@@ -245,6 +274,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
245 *(rdata++) = acpi_ec_read_data(ec); 274 *(rdata++) = acpi_ec_read_data(ec);
246 } 275 }
247 end: 276 end:
277 pr_debug(PREFIX "transaction end\n");
248 return result; 278 return result;
249} 279}
250 280
@@ -273,8 +303,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
273 303
274 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); 304 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
275 if (status) { 305 if (status) {
276 printk(KERN_ERR PREFIX 306 pr_err(PREFIX "input buffer is not empty, "
277 "input buffer is not empty, aborting transaction\n"); 307 "aborting transaction\n");
278 goto end; 308 goto end;
279 } 309 }
280 310
@@ -488,6 +518,7 @@ static u32 acpi_ec_gpe_handler(void *data)
488 acpi_status status = AE_OK; 518 acpi_status status = AE_OK;
489 struct acpi_ec *ec = data; 519 struct acpi_ec *ec = data;
490 520
521 pr_debug(PREFIX "~~~> interrupt\n");
491 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); 522 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
492 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) 523 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
493 wake_up(&ec->wait); 524 wake_up(&ec->wait);
@@ -498,8 +529,9 @@ static u32 acpi_ec_gpe_handler(void *data)
498 acpi_ec_gpe_query, ec); 529 acpi_ec_gpe_query, ec);
499 } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { 530 } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) {
500 /* this is non-query, must be confirmation */ 531 /* this is non-query, must be confirmation */
501 printk(KERN_INFO PREFIX "non-query interrupt received," 532 if (printk_ratelimit())
502 " switching to interrupt mode\n"); 533 pr_info(PREFIX "non-query interrupt received,"
534 " switching to interrupt mode\n");
503 set_bit(EC_FLAGS_GPE_MODE, &ec->flags); 535 set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
504 } 536 }
505 537
@@ -701,10 +733,10 @@ static void ec_remove_handlers(struct acpi_ec *ec)
701{ 733{
702 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 734 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
703 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 735 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
704 printk(KERN_ERR PREFIX "failed to remove space handler\n"); 736 pr_err(PREFIX "failed to remove space handler\n");
705 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, 737 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
706 &acpi_ec_gpe_handler))) 738 &acpi_ec_gpe_handler)))
707 printk(KERN_ERR PREFIX "failed to remove gpe handler\n"); 739 pr_err(PREFIX "failed to remove gpe handler\n");
708 ec->handlers_installed = 0; 740 ec->handlers_installed = 0;
709} 741}
710 742
@@ -747,9 +779,9 @@ static int acpi_ec_add(struct acpi_device *device)
747 first_ec = ec; 779 first_ec = ec;
748 acpi_driver_data(device) = ec; 780 acpi_driver_data(device) = ec;
749 acpi_ec_add_fs(device); 781 acpi_ec_add_fs(device);
750 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", 782 pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
751 ec->gpe, ec->command_addr, ec->data_addr); 783 ec->gpe, ec->command_addr, ec->data_addr);
752 printk(KERN_INFO PREFIX "driver started in %s mode\n", 784 pr_info(PREFIX "driver started in %s mode\n",
753 (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); 785 (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll");
754 return 0; 786 return 0;
755} 787}
@@ -875,18 +907,26 @@ int __init acpi_ec_ecdt_probe(void)
875 status = acpi_get_table(ACPI_SIG_ECDT, 1, 907 status = acpi_get_table(ACPI_SIG_ECDT, 1,
876 (struct acpi_table_header **)&ecdt_ptr); 908 (struct acpi_table_header **)&ecdt_ptr);
877 if (ACPI_SUCCESS(status)) { 909 if (ACPI_SUCCESS(status)) {
878 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); 910 pr_info(PREFIX "EC description table is found, configuring boot EC\n");
879 boot_ec->command_addr = ecdt_ptr->control.address; 911 boot_ec->command_addr = ecdt_ptr->control.address;
880 boot_ec->data_addr = ecdt_ptr->data.address; 912 boot_ec->data_addr = ecdt_ptr->data.address;
881 boot_ec->gpe = ecdt_ptr->gpe; 913 boot_ec->gpe = ecdt_ptr->gpe;
882 boot_ec->handle = ACPI_ROOT_OBJECT; 914 boot_ec->handle = ACPI_ROOT_OBJECT;
883 } else { 915 } else {
916 /* This workaround is needed only on some broken machines,
917 * which require early EC, but fail to provide ECDT */
918 acpi_handle x;
884 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); 919 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
885 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, 920 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
886 boot_ec, NULL); 921 boot_ec, NULL);
887 /* Check that acpi_get_devices actually find something */ 922 /* Check that acpi_get_devices actually find something */
888 if (ACPI_FAILURE(status) || !boot_ec->handle) 923 if (ACPI_FAILURE(status) || !boot_ec->handle)
889 goto error; 924 goto error;
925 /* We really need to limit this workaround, the only ASUS,
926 * which needs it, has fake EC._INI method, so use it as flag.
927 */
928 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
929 goto error;
890 } 930 }
891 931
892 ret = ec_install_handlers(boot_ec); 932 ret = ec_install_handlers(boot_ec);
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index aabc6ca4a81c..e3a673a00845 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
387 if (!value) 387 if (!value)
388 value = &dummy; 388 value = &dummy;
389 389
390 switch (width) { 390 *value = 0;
391 case 8: 391 if (width <= 8) {
392 *(u8 *) value = inb(port); 392 *(u8 *) value = inb(port);
393 break; 393 } else if (width <= 16) {
394 case 16:
395 *(u16 *) value = inw(port); 394 *(u16 *) value = inw(port);
396 break; 395 } else if (width <= 32) {
397 case 32:
398 *(u32 *) value = inl(port); 396 *(u32 *) value = inl(port);
399 break; 397 } else {
400 default:
401 BUG(); 398 BUG();
402 } 399 }
403 400
@@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port);
408 405
409acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) 406acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
410{ 407{
411 switch (width) { 408 if (width <= 8) {
412 case 8:
413 outb(value, port); 409 outb(value, port);
414 break; 410 } else if (width <= 16) {
415 case 16:
416 outw(value, port); 411 outw(value, port);
417 break; 412 } else if (width <= 32) {
418 case 32:
419 outl(value, port); 413 outl(value, port);
420 break; 414 } else {
421 default:
422 BUG(); 415 BUG();
423 } 416 }
424 417
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 235a51e328c3..e48ee4f8749f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -494,7 +494,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id)
494 if (apic_id == -1) 494 if (apic_id == -1)
495 return apic_id; 495 return apic_id;
496 496
497 for (i = 0; i < NR_CPUS; ++i) { 497 for_each_possible_cpu(i) {
498 if (cpu_physical_id(i) == apic_id) 498 if (cpu_physical_id(i) == apic_id)
499 return i; 499 return i;
500 } 500 }
@@ -612,12 +612,6 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
612 request_region(pr->throttling.address, 6, "ACPI CPU throttle"); 612 request_region(pr->throttling.address, 6, "ACPI CPU throttle");
613 } 613 }
614 614
615#ifdef CONFIG_CPU_FREQ
616 acpi_processor_ppc_has_changed(pr);
617#endif
618 acpi_processor_get_throttling_info(pr);
619 acpi_processor_get_limit_info(pr);
620
621 return 0; 615 return 0;
622} 616}
623 617
@@ -638,7 +632,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
638 return 0; 632 return 0;
639 } 633 }
640 634
641 BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); 635 BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
642 636
643 /* 637 /*
644 * Buggy BIOS check 638 * Buggy BIOS check
@@ -647,7 +641,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
647 */ 641 */
648 if (processor_device_array[pr->id] != NULL && 642 if (processor_device_array[pr->id] != NULL &&
649 processor_device_array[pr->id] != device) { 643 processor_device_array[pr->id] != device) {
650 printk(KERN_WARNING "BIOS reported wrong ACPI id" 644 printk(KERN_WARNING "BIOS reported wrong ACPI id "
651 "for the processor\n"); 645 "for the processor\n");
652 return -ENODEV; 646 return -ENODEV;
653 } 647 }
@@ -665,6 +659,12 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
665 /* _PDC call should be done before doing anything else (if reqd.). */ 659 /* _PDC call should be done before doing anything else (if reqd.). */
666 arch_acpi_processor_init_pdc(pr); 660 arch_acpi_processor_init_pdc(pr);
667 acpi_processor_set_pdc(pr); 661 acpi_processor_set_pdc(pr);
662#ifdef CONFIG_CPU_FREQ
663 acpi_processor_ppc_has_changed(pr);
664#endif
665 acpi_processor_get_throttling_info(pr);
666 acpi_processor_get_limit_info(pr);
667
668 668
669 acpi_processor_power_init(pr, device); 669 acpi_processor_power_init(pr, device);
670 670
@@ -684,7 +684,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
684{ 684{
685 struct acpi_processor *pr = data; 685 struct acpi_processor *pr = data;
686 struct acpi_device *device = NULL; 686 struct acpi_device *device = NULL;
687 687 int saved;
688 688
689 if (!pr) 689 if (!pr)
690 return; 690 return;
@@ -694,7 +694,10 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
694 694
695 switch (event) { 695 switch (event) {
696 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: 696 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
697 saved = pr->performance_platform_limit;
697 acpi_processor_ppc_has_changed(pr); 698 acpi_processor_ppc_has_changed(pr);
699 if (saved == pr->performance_platform_limit)
700 break;
698 acpi_bus_generate_proc_event(device, event, 701 acpi_bus_generate_proc_event(device, event,
699 pr->performance_platform_limit); 702 pr->performance_platform_limit);
700 acpi_bus_generate_netlink_event(device->pnp.device_class, 703 acpi_bus_generate_netlink_event(device->pnp.device_class,
@@ -771,7 +774,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
771 774
772 pr = acpi_driver_data(device); 775 pr = acpi_driver_data(device);
773 776
774 if (pr->id >= NR_CPUS) { 777 if (pr->id >= nr_cpu_ids) {
775 kfree(pr); 778 kfree(pr);
776 return 0; 779 return 0;
777 } 780 }
@@ -842,7 +845,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
842 if (!pr) 845 if (!pr)
843 return -ENODEV; 846 return -ENODEV;
844 847
845 if ((pr->id >= 0) && (pr->id < NR_CPUS)) { 848 if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) {
846 kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); 849 kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE);
847 } 850 }
848 return 0; 851 return 0;
@@ -880,13 +883,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
880 break; 883 break;
881 } 884 }
882 885
883 if (pr->id >= 0 && (pr->id < NR_CPUS)) { 886 if (pr->id >= 0 && (pr->id < nr_cpu_ids)) {
884 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 887 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
885 break; 888 break;
886 } 889 }
887 890
888 result = acpi_processor_start(device); 891 result = acpi_processor_start(device);
889 if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { 892 if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) {
890 kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); 893 kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
891 } else { 894 } else {
892 printk(KERN_ERR PREFIX "Device [%s] failed to start\n", 895 printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
@@ -909,7 +912,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
909 return; 912 return;
910 } 913 }
911 914
912 if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) 915 if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id)))
913 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 916 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
914 break; 917 break;
915 default: 918 default:
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f996d0e37689..b1fbee3f7fe1 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -197,6 +197,19 @@ static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2)
197 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); 197 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2);
198} 198}
199 199
200static void acpi_safe_halt(void)
201{
202 current_thread_info()->status &= ~TS_POLLING;
203 /*
204 * TS_POLLING-cleared state must be visible before we
205 * test NEED_RESCHED:
206 */
207 smp_mb();
208 if (!need_resched())
209 safe_halt();
210 current_thread_info()->status |= TS_POLLING;
211}
212
200#ifndef CONFIG_CPU_IDLE 213#ifndef CONFIG_CPU_IDLE
201 214
202static void 215static void
@@ -239,19 +252,6 @@ acpi_processor_power_activate(struct acpi_processor *pr,
239 return; 252 return;
240} 253}
241 254
242static void acpi_safe_halt(void)
243{
244 current_thread_info()->status &= ~TS_POLLING;
245 /*
246 * TS_POLLING-cleared state must be visible before we
247 * test NEED_RESCHED:
248 */
249 smp_mb();
250 if (!need_resched())
251 safe_halt();
252 current_thread_info()->status |= TS_POLLING;
253}
254
255static atomic_t c3_cpu_count; 255static atomic_t c3_cpu_count;
256 256
257/* Common C-state entry for C2, C3, .. */ 257/* Common C-state entry for C2, C3, .. */
@@ -1373,15 +1373,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1373 if (pr->flags.bm_check) 1373 if (pr->flags.bm_check)
1374 acpi_idle_update_bm_rld(pr, cx); 1374 acpi_idle_update_bm_rld(pr, cx);
1375 1375
1376 current_thread_info()->status &= ~TS_POLLING; 1376 acpi_safe_halt();
1377 /*
1378 * TS_POLLING-cleared state must be visible before we test
1379 * NEED_RESCHED:
1380 */
1381 smp_mb();
1382 if (!need_resched())
1383 safe_halt();
1384 current_thread_info()->status |= TS_POLLING;
1385 1377
1386 cx->usage++; 1378 cx->usage++;
1387 1379
@@ -1399,6 +1391,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1399 struct acpi_processor *pr; 1391 struct acpi_processor *pr;
1400 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1392 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1401 u32 t1, t2; 1393 u32 t1, t2;
1394 int sleep_ticks = 0;
1395
1402 pr = processors[smp_processor_id()]; 1396 pr = processors[smp_processor_id()];
1403 1397
1404 if (unlikely(!pr)) 1398 if (unlikely(!pr))
@@ -1428,6 +1422,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1428 ACPI_FLUSH_CPU_CACHE(); 1422 ACPI_FLUSH_CPU_CACHE();
1429 1423
1430 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1424 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1425 /* Tell the scheduler that we are going deep-idle: */
1426 sched_clock_idle_sleep_event();
1431 acpi_state_timer_broadcast(pr, cx, 1); 1427 acpi_state_timer_broadcast(pr, cx, 1);
1432 acpi_idle_do_entry(cx); 1428 acpi_idle_do_entry(cx);
1433 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1429 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -1436,6 +1432,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1436 /* TSC could halt in idle, so notify users */ 1432 /* TSC could halt in idle, so notify users */
1437 mark_tsc_unstable("TSC halts in idle");; 1433 mark_tsc_unstable("TSC halts in idle");;
1438#endif 1434#endif
1435 sleep_ticks = ticks_elapsed(t1, t2);
1436
1437 /* Tell the scheduler how much we idled: */
1438 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
1439 1439
1440 local_irq_enable(); 1440 local_irq_enable();
1441 current_thread_info()->status |= TS_POLLING; 1441 current_thread_info()->status |= TS_POLLING;
@@ -1443,7 +1443,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1443 cx->usage++; 1443 cx->usage++;
1444 1444
1445 acpi_state_timer_broadcast(pr, cx, 0); 1445 acpi_state_timer_broadcast(pr, cx, 0);
1446 cx->time += ticks_elapsed(t1, t2); 1446 cx->time += sleep_ticks;
1447 return ticks_elapsed_in_us(t1, t2); 1447 return ticks_elapsed_in_us(t1, t2);
1448} 1448}
1449 1449
@@ -1463,6 +1463,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1463 struct acpi_processor *pr; 1463 struct acpi_processor *pr;
1464 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 1464 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1465 u32 t1, t2; 1465 u32 t1, t2;
1466 int sleep_ticks = 0;
1467
1466 pr = processors[smp_processor_id()]; 1468 pr = processors[smp_processor_id()];
1467 1469
1468 if (unlikely(!pr)) 1470 if (unlikely(!pr))
@@ -1471,6 +1473,15 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1471 if (acpi_idle_suspend) 1473 if (acpi_idle_suspend)
1472 return(acpi_idle_enter_c1(dev, state)); 1474 return(acpi_idle_enter_c1(dev, state));
1473 1475
1476 if (acpi_idle_bm_check()) {
1477 if (dev->safe_state) {
1478 return dev->safe_state->enter(dev, dev->safe_state);
1479 } else {
1480 acpi_safe_halt();
1481 return 0;
1482 }
1483 }
1484
1474 local_irq_disable(); 1485 local_irq_disable();
1475 current_thread_info()->status &= ~TS_POLLING; 1486 current_thread_info()->status &= ~TS_POLLING;
1476 /* 1487 /*
@@ -1485,38 +1496,45 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1485 return 0; 1496 return 0;
1486 } 1497 }
1487 1498
1499 /* Tell the scheduler that we are going deep-idle: */
1500 sched_clock_idle_sleep_event();
1488 /* 1501 /*
1489 * Must be done before busmaster disable as we might need to 1502 * Must be done before busmaster disable as we might need to
1490 * access HPET ! 1503 * access HPET !
1491 */ 1504 */
1492 acpi_state_timer_broadcast(pr, cx, 1); 1505 acpi_state_timer_broadcast(pr, cx, 1);
1493 1506
1494 if (acpi_idle_bm_check()) { 1507 acpi_idle_update_bm_rld(pr, cx);
1495 cx = pr->power.bm_state;
1496
1497 acpi_idle_update_bm_rld(pr, cx);
1498
1499 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1500 acpi_idle_do_entry(cx);
1501 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1502 } else {
1503 acpi_idle_update_bm_rld(pr, cx);
1504 1508
1509 /*
1510 * disable bus master
1511 * bm_check implies we need ARB_DIS
1512 * !bm_check implies we need cache flush
1513 * bm_control implies whether we can do ARB_DIS
1514 *
1515 * That leaves a case where bm_check is set and bm_control is
1516 * not set. In that case we cannot do much, we enter C3
1517 * without doing anything.
1518 */
1519 if (pr->flags.bm_check && pr->flags.bm_control) {
1505 spin_lock(&c3_lock); 1520 spin_lock(&c3_lock);
1506 c3_cpu_count++; 1521 c3_cpu_count++;
1507 /* Disable bus master arbitration when all CPUs are in C3 */ 1522 /* Disable bus master arbitration when all CPUs are in C3 */
1508 if (c3_cpu_count == num_online_cpus()) 1523 if (c3_cpu_count == num_online_cpus())
1509 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); 1524 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
1510 spin_unlock(&c3_lock); 1525 spin_unlock(&c3_lock);
1526 } else if (!pr->flags.bm_check) {
1527 ACPI_FLUSH_CPU_CACHE();
1528 }
1511 1529
1512 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1530 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1513 acpi_idle_do_entry(cx); 1531 acpi_idle_do_entry(cx);
1514 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 1532 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1515 1533
1534 /* Re-enable bus master arbitration */
1535 if (pr->flags.bm_check && pr->flags.bm_control) {
1516 spin_lock(&c3_lock); 1536 spin_lock(&c3_lock);
1517 /* Re-enable bus master arbitration */ 1537 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
1518 if (c3_cpu_count == num_online_cpus())
1519 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
1520 c3_cpu_count--; 1538 c3_cpu_count--;
1521 spin_unlock(&c3_lock); 1539 spin_unlock(&c3_lock);
1522 } 1540 }
@@ -1525,6 +1543,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1525 /* TSC could halt in idle, so notify users */ 1543 /* TSC could halt in idle, so notify users */
1526 mark_tsc_unstable("TSC halts in idle"); 1544 mark_tsc_unstable("TSC halts in idle");
1527#endif 1545#endif
1546 sleep_ticks = ticks_elapsed(t1, t2);
1547 /* Tell the scheduler how much we idled: */
1548 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
1528 1549
1529 local_irq_enable(); 1550 local_irq_enable();
1530 current_thread_info()->status |= TS_POLLING; 1551 current_thread_info()->status |= TS_POLLING;
@@ -1532,7 +1553,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1532 cx->usage++; 1553 cx->usage++;
1533 1554
1534 acpi_state_timer_broadcast(pr, cx, 0); 1555 acpi_state_timer_broadcast(pr, cx, 0);
1535 cx->time += ticks_elapsed(t1, t2); 1556 cx->time += sleep_ticks;
1536 return ticks_elapsed_in_us(t1, t2); 1557 return ticks_elapsed_in_us(t1, t2);
1537} 1558}
1538 1559
@@ -1584,12 +1605,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1584 case ACPI_STATE_C1: 1605 case ACPI_STATE_C1:
1585 state->flags |= CPUIDLE_FLAG_SHALLOW; 1606 state->flags |= CPUIDLE_FLAG_SHALLOW;
1586 state->enter = acpi_idle_enter_c1; 1607 state->enter = acpi_idle_enter_c1;
1608 dev->safe_state = state;
1587 break; 1609 break;
1588 1610
1589 case ACPI_STATE_C2: 1611 case ACPI_STATE_C2:
1590 state->flags |= CPUIDLE_FLAG_BALANCED; 1612 state->flags |= CPUIDLE_FLAG_BALANCED;
1591 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1613 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1592 state->enter = acpi_idle_enter_simple; 1614 state->enter = acpi_idle_enter_simple;
1615 dev->safe_state = state;
1593 break; 1616 break;
1594 1617
1595 case ACPI_STATE_C3: 1618 case ACPI_STATE_C3:
@@ -1610,14 +1633,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1610 if (!count) 1633 if (!count)
1611 return -EINVAL; 1634 return -EINVAL;
1612 1635
1613 /* find the deepest state that can handle active BM */
1614 if (pr->flags.bm_check) {
1615 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++)
1616 if (pr->power.states[i].type == ACPI_STATE_C3)
1617 break;
1618 pr->power.bm_state = &pr->power.states[i-1];
1619 }
1620
1621 return 0; 1636 return 0;
1622} 1637}
1623 1638
@@ -1658,6 +1673,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1658 1673
1659 if (!first_run) { 1674 if (!first_run) {
1660 dmi_check_system(processor_power_dmi_table); 1675 dmi_check_system(processor_power_dmi_table);
1676 max_cstate = acpi_processor_cstate_check(max_cstate);
1661 if (max_cstate < ACPI_C_STATES_MAX) 1677 if (max_cstate < ACPI_C_STATES_MAX)
1662 printk(KERN_NOTICE 1678 printk(KERN_NOTICE
1663 "ACPI: processor limited to max C-state %d\n", 1679 "ACPI: processor limited to max C-state %d\n",
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 0b8204e7082a..c26c61fb36c3 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -70,7 +70,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
70 70
71int acpi_processor_tstate_has_changed(struct acpi_processor *pr) 71int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
72{ 72{
73 return acpi_processor_get_platform_limit(pr); 73 int result = 0;
74 int throttling_limit;
75 int current_state;
76 struct acpi_processor_limit *limit;
77 int target_state;
78
79 result = acpi_processor_get_platform_limit(pr);
80 if (result) {
81 /* Throttling Limit is unsupported */
82 return result;
83 }
84
85 throttling_limit = pr->throttling_platform_limit;
86 if (throttling_limit >= pr->throttling.state_count) {
87 /* Uncorrect Throttling Limit */
88 return -EINVAL;
89 }
90
91 current_state = pr->throttling.state;
92 if (current_state > throttling_limit) {
93 /*
94 * The current state can meet the requirement of
95 * _TPC limit. But it is reasonable that OSPM changes
96 * t-states from high to low for better performance.
97 * Of course the limit condition of thermal
98 * and user should be considered.
99 */
100 limit = &pr->limit;
101 target_state = throttling_limit;
102 if (limit->thermal.tx > target_state)
103 target_state = limit->thermal.tx;
104 if (limit->user.tx > target_state)
105 target_state = limit->user.tx;
106 } else if (current_state == throttling_limit) {
107 /*
108 * Unnecessary to change the throttling state
109 */
110 return 0;
111 } else {
112 /*
113 * If the current state is lower than the limit of _TPC, it
114 * will be forced to switch to the throttling state defined
115 * by throttling_platfor_limit.
116 * Because the previous state meets with the limit condition
117 * of thermal and user, it is unnecessary to check it again.
118 */
119 target_state = throttling_limit;
120 }
121 return acpi_processor_set_throttling(pr, target_state);
74} 122}
75 123
76/* 124/*
@@ -83,6 +131,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
83 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 131 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
84 union acpi_object *ptc = NULL; 132 union acpi_object *ptc = NULL;
85 union acpi_object obj = { 0 }; 133 union acpi_object obj = { 0 };
134 struct acpi_processor_throttling *throttling;
86 135
87 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); 136 status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
88 if (ACPI_FAILURE(status)) { 137 if (ACPI_FAILURE(status)) {
@@ -134,6 +183,22 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
134 memcpy(&pr->throttling.status_register, obj.buffer.pointer, 183 memcpy(&pr->throttling.status_register, obj.buffer.pointer,
135 sizeof(struct acpi_ptc_register)); 184 sizeof(struct acpi_ptc_register));
136 185
186 throttling = &pr->throttling;
187
188 if ((throttling->control_register.bit_width +
189 throttling->control_register.bit_offset) > 32) {
190 printk(KERN_ERR PREFIX "Invalid _PTC control register\n");
191 result = -EFAULT;
192 goto end;
193 }
194
195 if ((throttling->status_register.bit_width +
196 throttling->status_register.bit_offset) > 32) {
197 printk(KERN_ERR PREFIX "Invalid _PTC status register\n");
198 result = -EFAULT;
199 goto end;
200 }
201
137 end: 202 end:
138 kfree(buffer.pointer); 203 kfree(buffer.pointer);
139 204
@@ -328,44 +393,132 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
328 return 0; 393 return 0;
329} 394}
330 395
331static int acpi_read_throttling_status(struct acpi_processor_throttling 396#ifdef CONFIG_X86
332 *throttling) 397static int acpi_throttling_rdmsr(struct acpi_processor *pr,
398 acpi_integer * value)
333{ 399{
334 int value = -1; 400 struct cpuinfo_x86 *c;
401 u64 msr_high, msr_low;
402 unsigned int cpu;
403 u64 msr = 0;
404 int ret = -1;
405
406 cpu = pr->id;
407 c = &cpu_data(cpu);
408
409 if ((c->x86_vendor != X86_VENDOR_INTEL) ||
410 !cpu_has(c, X86_FEATURE_ACPI)) {
411 printk(KERN_ERR PREFIX
412 "HARDWARE addr space,NOT supported yet\n");
413 } else {
414 msr_low = 0;
415 msr_high = 0;
416 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
417 (u32 *)&msr_low , (u32 *) &msr_high);
418 msr = (msr_high << 32) | msr_low;
419 *value = (acpi_integer) msr;
420 ret = 0;
421 }
422 return ret;
423}
424
425static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
426{
427 struct cpuinfo_x86 *c;
428 unsigned int cpu;
429 int ret = -1;
430 u64 msr;
431
432 cpu = pr->id;
433 c = &cpu_data(cpu);
434
435 if ((c->x86_vendor != X86_VENDOR_INTEL) ||
436 !cpu_has(c, X86_FEATURE_ACPI)) {
437 printk(KERN_ERR PREFIX
438 "HARDWARE addr space,NOT supported yet\n");
439 } else {
440 msr = value;
441 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
442 msr & 0xffffffff, msr >> 32);
443 ret = 0;
444 }
445 return ret;
446}
447#else
448static int acpi_throttling_rdmsr(struct acpi_processor *pr,
449 acpi_integer * value)
450{
451 printk(KERN_ERR PREFIX
452 "HARDWARE addr space,NOT supported yet\n");
453 return -1;
454}
455
456static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
457{
458 printk(KERN_ERR PREFIX
459 "HARDWARE addr space,NOT supported yet\n");
460 return -1;
461}
462#endif
463
464static int acpi_read_throttling_status(struct acpi_processor *pr,
465 acpi_integer *value)
466{
467 u32 bit_width, bit_offset;
468 u64 ptc_value;
469 u64 ptc_mask;
470 struct acpi_processor_throttling *throttling;
471 int ret = -1;
472
473 throttling = &pr->throttling;
335 switch (throttling->status_register.space_id) { 474 switch (throttling->status_register.space_id) {
336 case ACPI_ADR_SPACE_SYSTEM_IO: 475 case ACPI_ADR_SPACE_SYSTEM_IO:
476 ptc_value = 0;
477 bit_width = throttling->status_register.bit_width;
478 bit_offset = throttling->status_register.bit_offset;
479
337 acpi_os_read_port((acpi_io_address) throttling->status_register. 480 acpi_os_read_port((acpi_io_address) throttling->status_register.
338 address, &value, 481 address, (u32 *) &ptc_value,
339 (u32) throttling->status_register.bit_width * 482 (u32) (bit_width + bit_offset));
340 8); 483 ptc_mask = (1 << bit_width) - 1;
484 *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask);
485 ret = 0;
341 break; 486 break;
342 case ACPI_ADR_SPACE_FIXED_HARDWARE: 487 case ACPI_ADR_SPACE_FIXED_HARDWARE:
343 printk(KERN_ERR PREFIX 488 ret = acpi_throttling_rdmsr(pr, value);
344 "HARDWARE addr space,NOT supported yet\n");
345 break; 489 break;
346 default: 490 default:
347 printk(KERN_ERR PREFIX "Unknown addr space %d\n", 491 printk(KERN_ERR PREFIX "Unknown addr space %d\n",
348 (u32) (throttling->status_register.space_id)); 492 (u32) (throttling->status_register.space_id));
349 } 493 }
350 return value; 494 return ret;
351} 495}
352 496
353static int acpi_write_throttling_state(struct acpi_processor_throttling 497static int acpi_write_throttling_state(struct acpi_processor *pr,
354 *throttling, int value) 498 acpi_integer value)
355{ 499{
500 u32 bit_width, bit_offset;
501 u64 ptc_value;
502 u64 ptc_mask;
503 struct acpi_processor_throttling *throttling;
356 int ret = -1; 504 int ret = -1;
357 505
506 throttling = &pr->throttling;
358 switch (throttling->control_register.space_id) { 507 switch (throttling->control_register.space_id) {
359 case ACPI_ADR_SPACE_SYSTEM_IO: 508 case ACPI_ADR_SPACE_SYSTEM_IO:
509 bit_width = throttling->control_register.bit_width;
510 bit_offset = throttling->control_register.bit_offset;
511 ptc_mask = (1 << bit_width) - 1;
512 ptc_value = value & ptc_mask;
513
360 acpi_os_write_port((acpi_io_address) throttling-> 514 acpi_os_write_port((acpi_io_address) throttling->
361 control_register.address, value, 515 control_register.address,
362 (u32) throttling->control_register. 516 (u32) (ptc_value << bit_offset),
363 bit_width * 8); 517 (u32) (bit_width + bit_offset));
364 ret = 0; 518 ret = 0;
365 break; 519 break;
366 case ACPI_ADR_SPACE_FIXED_HARDWARE: 520 case ACPI_ADR_SPACE_FIXED_HARDWARE:
367 printk(KERN_ERR PREFIX 521 ret = acpi_throttling_wrmsr(pr, value);
368 "HARDWARE addr space,NOT supported yet\n");
369 break; 522 break;
370 default: 523 default:
371 printk(KERN_ERR PREFIX "Unknown addr space %d\n", 524 printk(KERN_ERR PREFIX "Unknown addr space %d\n",
@@ -374,7 +527,8 @@ static int acpi_write_throttling_state(struct acpi_processor_throttling
374 return ret; 527 return ret;
375} 528}
376 529
377static int acpi_get_throttling_state(struct acpi_processor *pr, int value) 530static int acpi_get_throttling_state(struct acpi_processor *pr,
531 acpi_integer value)
378{ 532{
379 int i; 533 int i;
380 534
@@ -390,22 +544,26 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, int value)
390 return i; 544 return i;
391} 545}
392 546
393static int acpi_get_throttling_value(struct acpi_processor *pr, int state) 547static int acpi_get_throttling_value(struct acpi_processor *pr,
548 int state, acpi_integer *value)
394{ 549{
395 int value = -1; 550 int ret = -1;
551
396 if (state >= 0 && state <= pr->throttling.state_count) { 552 if (state >= 0 && state <= pr->throttling.state_count) {
397 struct acpi_processor_tx_tss *tx = 553 struct acpi_processor_tx_tss *tx =
398 (struct acpi_processor_tx_tss *)&(pr->throttling. 554 (struct acpi_processor_tx_tss *)&(pr->throttling.
399 states_tss[state]); 555 states_tss[state]);
400 value = tx->control; 556 *value = tx->control;
557 ret = 0;
401 } 558 }
402 return value; 559 return ret;
403} 560}
404 561
405static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) 562static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
406{ 563{
407 int state = 0; 564 int state = 0;
408 u32 value = 0; 565 int ret;
566 acpi_integer value;
409 567
410 if (!pr) 568 if (!pr)
411 return -EINVAL; 569 return -EINVAL;
@@ -415,8 +573,9 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
415 573
416 pr->throttling.state = 0; 574 pr->throttling.state = 0;
417 local_irq_disable(); 575 local_irq_disable();
418 value = acpi_read_throttling_status(&pr->throttling); 576 value = 0;
419 if (value >= 0) { 577 ret = acpi_read_throttling_status(pr, &value);
578 if (ret >= 0) {
420 state = acpi_get_throttling_state(pr, value); 579 state = acpi_get_throttling_state(pr, value);
421 pr->throttling.state = state; 580 pr->throttling.state = state;
422 } 581 }
@@ -430,6 +589,40 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
430 return pr->throttling.acpi_processor_get_throttling(pr); 589 return pr->throttling.acpi_processor_get_throttling(pr);
431} 590}
432 591
592static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
593{
594 int i, step;
595
596 if (!pr->throttling.address) {
597 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
598 return -EINVAL;
599 } else if (!pr->throttling.duty_width) {
600 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
601 return -EINVAL;
602 }
603 /* TBD: Support duty_cycle values that span bit 4. */
604 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
605 printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
606 return -EINVAL;
607 }
608
609 pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
610
611 /*
612 * Compute state values. Note that throttling displays a linear power
613 * performance relationship (at 50% performance the CPU will consume
614 * 50% power). Values are in 1/10th of a percent to preserve accuracy.
615 */
616
617 step = (1000 / pr->throttling.state_count);
618
619 for (i = 0; i < pr->throttling.state_count; i++) {
620 pr->throttling.states[i].performance = 1000 - step * i;
621 pr->throttling.states[i].power = 1000 - step * i;
622 }
623 return 0;
624}
625
433static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, 626static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
434 int state) 627 int state)
435{ 628{
@@ -506,7 +699,8 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr,
506static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, 699static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
507 int state) 700 int state)
508{ 701{
509 u32 value = 0; 702 int ret;
703 acpi_integer value;
510 704
511 if (!pr) 705 if (!pr)
512 return -EINVAL; 706 return -EINVAL;
@@ -524,10 +718,10 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
524 return -EPERM; 718 return -EPERM;
525 719
526 local_irq_disable(); 720 local_irq_disable();
527 721 value = 0;
528 value = acpi_get_throttling_value(pr, state); 722 ret = acpi_get_throttling_value(pr, state, &value);
529 if (value >= 0) { 723 if (ret >= 0) {
530 acpi_write_throttling_state(&pr->throttling, value); 724 acpi_write_throttling_state(pr, value);
531 pr->throttling.state = state; 725 pr->throttling.state = state;
532 } 726 }
533 local_irq_enable(); 727 local_irq_enable();
@@ -543,8 +737,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
543int acpi_processor_get_throttling_info(struct acpi_processor *pr) 737int acpi_processor_get_throttling_info(struct acpi_processor *pr)
544{ 738{
545 int result = 0; 739 int result = 0;
546 int step = 0;
547 int i = 0;
548 740
549 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 741 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
550 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", 742 "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
@@ -563,6 +755,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
563 acpi_processor_get_throttling_states(pr) || 755 acpi_processor_get_throttling_states(pr) ||
564 acpi_processor_get_platform_limit(pr)) 756 acpi_processor_get_platform_limit(pr))
565 { 757 {
758 if (acpi_processor_get_fadt_info(pr))
759 return 0;
566 pr->throttling.acpi_processor_get_throttling = 760 pr->throttling.acpi_processor_get_throttling =
567 &acpi_processor_get_throttling_fadt; 761 &acpi_processor_get_throttling_fadt;
568 pr->throttling.acpi_processor_set_throttling = 762 pr->throttling.acpi_processor_set_throttling =
@@ -576,19 +770,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
576 770
577 acpi_processor_get_tsd(pr); 771 acpi_processor_get_tsd(pr);
578 772
579 if (!pr->throttling.address) {
580 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
581 return 0;
582 } else if (!pr->throttling.duty_width) {
583 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
584 return 0;
585 }
586 /* TBD: Support duty_cycle values that span bit 4. */
587 else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
588 printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
589 return 0;
590 }
591
592 /* 773 /*
593 * PIIX4 Errata: We don't support throttling on the original PIIX4. 774 * PIIX4 Errata: We don't support throttling on the original PIIX4.
594 * This shouldn't be an issue as few (if any) mobile systems ever 775 * This shouldn't be an issue as few (if any) mobile systems ever
@@ -600,21 +781,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
600 return 0; 781 return 0;
601 } 782 }
602 783
603 pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width;
604
605 /*
606 * Compute state values. Note that throttling displays a linear power/
607 * performance relationship (at 50% performance the CPU will consume
608 * 50% power). Values are in 1/10th of a percent to preserve accuracy.
609 */
610
611 step = (1000 / pr->throttling.state_count);
612
613 for (i = 0; i < pr->throttling.state_count; i++) {
614 pr->throttling.states[i].performance = step * i;
615 pr->throttling.states[i].power = step * i;
616 }
617
618 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", 784 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n",
619 pr->throttling.state_count)); 785 pr->throttling.state_count));
620 786
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 90fd09c65f95..6045cdbe176b 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -29,7 +29,7 @@
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31 31
32#ifdef CONFIG_ACPI_PROCFS 32#ifdef CONFIG_ACPI_PROCFS_POWER
33#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
88struct acpi_battery { 88struct acpi_battery {
89 struct power_supply bat; 89 struct power_supply bat;
90 struct acpi_sbs *sbs; 90 struct acpi_sbs *sbs;
91#ifdef CONFIG_ACPI_PROCFS 91#ifdef CONFIG_ACPI_PROCFS_POWER
92 struct proc_dir_entry *proc_entry; 92 struct proc_dir_entry *proc_entry;
93#endif 93#endif
94 unsigned long update_time; 94 unsigned long update_time;
@@ -113,6 +113,7 @@ struct acpi_battery {
113 u16 spec; 113 u16 spec;
114 u8 id; 114 u8 id;
115 u8 present:1; 115 u8 present:1;
116 u8 have_sysfs_alarm:1;
116}; 117};
117 118
118#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 119#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
@@ -122,7 +123,7 @@ struct acpi_sbs {
122 struct acpi_device *device; 123 struct acpi_device *device;
123 struct acpi_smb_hc *hc; 124 struct acpi_smb_hc *hc;
124 struct mutex lock; 125 struct mutex lock;
125#ifdef CONFIG_ACPI_PROCFS 126#ifdef CONFIG_ACPI_PROCFS_POWER
126 struct proc_dir_entry *charger_entry; 127 struct proc_dir_entry *charger_entry;
127#endif 128#endif
128 struct acpi_battery battery[MAX_SBS_BAT]; 129 struct acpi_battery battery[MAX_SBS_BAT];
@@ -468,7 +469,7 @@ static struct device_attribute alarm_attr = {
468 FS Interface (/proc/acpi) 469 FS Interface (/proc/acpi)
469 -------------------------------------------------------------------------- */ 470 -------------------------------------------------------------------------- */
470 471
471#ifdef CONFIG_ACPI_PROCFS 472#ifdef CONFIG_ACPI_PROCFS_POWER
472/* Generic Routines */ 473/* Generic Routines */
473static int 474static int
474acpi_sbs_add_fs(struct proc_dir_entry **dir, 475acpi_sbs_add_fs(struct proc_dir_entry **dir,
@@ -789,7 +790,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
789 return result; 790 return result;
790 791
791 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); 792 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id);
792#ifdef CONFIG_ACPI_PROCFS 793#ifdef CONFIG_ACPI_PROCFS_POWER
793 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, 794 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir,
794 battery->name, &acpi_battery_info_fops, 795 battery->name, &acpi_battery_info_fops,
795 &acpi_battery_state_fops, &acpi_battery_alarm_fops, 796 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
@@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
808 } 809 }
809 battery->bat.get_property = acpi_sbs_battery_get_property; 810 battery->bat.get_property = acpi_sbs_battery_get_property;
810 result = power_supply_register(&sbs->device->dev, &battery->bat); 811 result = power_supply_register(&sbs->device->dev, &battery->bat);
811 device_create_file(battery->bat.dev, &alarm_attr); 812 if (result)
813 goto end;
814 result = device_create_file(battery->bat.dev, &alarm_attr);
815 if (result)
816 goto end;
817 battery->have_sysfs_alarm = 1;
818 end:
812 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 819 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
813 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 820 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
814 battery->name, sbs->battery->present ? "present" : "absent"); 821 battery->name, sbs->battery->present ? "present" : "absent");
@@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
817 824
818static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 825static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
819{ 826{
820 if (sbs->battery[id].bat.dev) 827 struct acpi_battery *battery = &sbs->battery[id];
821 device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); 828
822 power_supply_unregister(&sbs->battery[id].bat); 829 if (battery->bat.dev) {
823#ifdef CONFIG_ACPI_PROCFS 830 if (battery->have_sysfs_alarm)
824 if (sbs->battery[id].proc_entry) { 831 device_remove_file(battery->bat.dev, &alarm_attr);
825 acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), 832 power_supply_unregister(&battery->bat);
826 acpi_battery_dir);
827 } 833 }
834#ifdef CONFIG_ACPI_PROCFS_POWER
835 if (battery->proc_entry)
836 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
828#endif 837#endif
829} 838}
830 839
@@ -835,7 +844,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
835 result = acpi_ac_get_present(sbs); 844 result = acpi_ac_get_present(sbs);
836 if (result) 845 if (result)
837 goto end; 846 goto end;
838#ifdef CONFIG_ACPI_PROCFS 847#ifdef CONFIG_ACPI_PROCFS_POWER
839 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, 848 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir,
840 ACPI_AC_DIR_NAME, NULL, 849 ACPI_AC_DIR_NAME, NULL,
841 &acpi_ac_state_fops, NULL, sbs); 850 &acpi_ac_state_fops, NULL, sbs);
@@ -859,7 +868,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
859{ 868{
860 if (sbs->charger.dev) 869 if (sbs->charger.dev)
861 power_supply_unregister(&sbs->charger); 870 power_supply_unregister(&sbs->charger);
862#ifdef CONFIG_ACPI_PROCFS 871#ifdef CONFIG_ACPI_PROCFS_POWER
863 if (sbs->charger_entry) 872 if (sbs->charger_entry)
864 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 873 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
865#endif 874#endif
@@ -965,7 +974,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type)
965 974
966static void acpi_sbs_rmdirs(void) 975static void acpi_sbs_rmdirs(void)
967{ 976{
968#ifdef CONFIG_ACPI_PROCFS 977#ifdef CONFIG_ACPI_PROCFS_POWER
969 if (acpi_ac_dir) { 978 if (acpi_ac_dir) {
970 acpi_unlock_ac_dir(acpi_ac_dir); 979 acpi_unlock_ac_dir(acpi_ac_dir);
971 acpi_ac_dir = NULL; 980 acpi_ac_dir = NULL;
@@ -1004,7 +1013,7 @@ static int __init acpi_sbs_init(void)
1004 1013
1005 if (acpi_disabled) 1014 if (acpi_disabled)
1006 return -ENODEV; 1015 return -ENODEV;
1007#ifdef CONFIG_ACPI_PROCFS 1016#ifdef CONFIG_ACPI_PROCFS_POWER
1008 acpi_ac_dir = acpi_lock_ac_dir(); 1017 acpi_ac_dir = acpi_lock_ac_dir();
1009 if (!acpi_ac_dir) 1018 if (!acpi_ac_dir)
1010 return -ENODEV; 1019 return -ENODEV;
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 5f1d85f2ffe4..010f19652f80 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -449,7 +449,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
449 /* XSDT has NULL entry, RSDT is used */ 449 /* XSDT has NULL entry, RSDT is used */
450 address = rsdt_address; 450 address = rsdt_address;
451 table_entry_size = sizeof(u32); 451 table_entry_size = sizeof(u32);
452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry," 452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry, "
453 "using RSDT")); 453 "using RSDT"));
454 } 454 }
455 } 455 }
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bac956b30c57..44a0d9ba9bd6 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -29,6 +29,7 @@
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/mutex.h>
32#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 34#include <linux/seq_file.h>
34#include <linux/input.h> 35#include <linux/input.h>
@@ -135,8 +136,8 @@ struct acpi_video_bus {
135 u8 attached_count; 136 u8 attached_count;
136 struct acpi_video_bus_cap cap; 137 struct acpi_video_bus_cap cap;
137 struct acpi_video_bus_flags flags; 138 struct acpi_video_bus_flags flags;
138 struct semaphore sem;
139 struct list_head video_device_list; 139 struct list_head video_device_list;
140 struct mutex device_list_lock; /* protects video_device_list */
140 struct proc_dir_entry *dir; 141 struct proc_dir_entry *dir;
141 struct input_dev *input; 142 struct input_dev *input;
142 char phys[32]; /* for input device */ 143 char phys[32]; /* for input device */
@@ -896,7 +897,7 @@ acpi_video_device_write_brightness(struct file *file,
896{ 897{
897 struct seq_file *m = file->private_data; 898 struct seq_file *m = file->private_data;
898 struct acpi_video_device *dev = m->private; 899 struct acpi_video_device *dev = m->private;
899 char str[4] = { 0 }; 900 char str[5] = { 0 };
900 unsigned int level = 0; 901 unsigned int level = 0;
901 int i; 902 int i;
902 903
@@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1436 return -ENODEV; 1437 return -ENODEV;
1437 } 1438 }
1438 1439
1439 down(&video->sem); 1440 mutex_lock(&video->device_list_lock);
1440 list_add_tail(&data->entry, &video->video_device_list); 1441 list_add_tail(&data->entry, &video->video_device_list);
1441 up(&video->sem); 1442 mutex_unlock(&video->device_list_lock);
1442 1443
1443 acpi_video_device_add_fs(device); 1444 acpi_video_device_add_fs(device);
1444 1445
@@ -1462,12 +1463,14 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1462 1463
1463static void acpi_video_device_rebind(struct acpi_video_bus *video) 1464static void acpi_video_device_rebind(struct acpi_video_bus *video)
1464{ 1465{
1465 struct list_head *node, *next; 1466 struct acpi_video_device *dev;
1466 list_for_each_safe(node, next, &video->video_device_list) { 1467
1467 struct acpi_video_device *dev = 1468 mutex_lock(&video->device_list_lock);
1468 container_of(node, struct acpi_video_device, entry); 1469
1470 list_for_each_entry(dev, &video->video_device_list, entry)
1469 acpi_video_device_bind(video, dev); 1471 acpi_video_device_bind(video, dev);
1470 } 1472
1473 mutex_unlock(&video->device_list_lock);
1471} 1474}
1472 1475
1473/* 1476/*
@@ -1592,30 +1595,33 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1592 1595
1593static int acpi_video_switch_output(struct acpi_video_bus *video, int event) 1596static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1594{ 1597{
1595 struct list_head *node, *next; 1598 struct list_head *node;
1596 struct acpi_video_device *dev = NULL; 1599 struct acpi_video_device *dev = NULL;
1597 struct acpi_video_device *dev_next = NULL; 1600 struct acpi_video_device *dev_next = NULL;
1598 struct acpi_video_device *dev_prev = NULL; 1601 struct acpi_video_device *dev_prev = NULL;
1599 unsigned long state; 1602 unsigned long state;
1600 int status = 0; 1603 int status = 0;
1601 1604
1605 mutex_lock(&video->device_list_lock);
1602 1606
1603 list_for_each_safe(node, next, &video->video_device_list) { 1607 list_for_each(node, &video->video_device_list) {
1604 dev = container_of(node, struct acpi_video_device, entry); 1608 dev = container_of(node, struct acpi_video_device, entry);
1605 status = acpi_video_device_get_state(dev, &state); 1609 status = acpi_video_device_get_state(dev, &state);
1606 if (state & 0x2) { 1610 if (state & 0x2) {
1607 dev_next = 1611 dev_next = container_of(node->next,
1608 container_of(node->next, struct acpi_video_device, 1612 struct acpi_video_device, entry);
1609 entry); 1613 dev_prev = container_of(node->prev,
1610 dev_prev = 1614 struct acpi_video_device, entry);
1611 container_of(node->prev, struct acpi_video_device,
1612 entry);
1613 goto out; 1615 goto out;
1614 } 1616 }
1615 } 1617 }
1618
1616 dev_next = container_of(node->next, struct acpi_video_device, entry); 1619 dev_next = container_of(node->next, struct acpi_video_device, entry);
1617 dev_prev = container_of(node->prev, struct acpi_video_device, entry); 1620 dev_prev = container_of(node->prev, struct acpi_video_device, entry);
1618 out: 1621
1622 out:
1623 mutex_unlock(&video->device_list_lock);
1624
1619 switch (event) { 1625 switch (event) {
1620 case ACPI_VIDEO_NOTIFY_CYCLE: 1626 case ACPI_VIDEO_NOTIFY_CYCLE:
1621 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: 1627 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
@@ -1691,24 +1697,17 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
1691 struct acpi_device *device) 1697 struct acpi_device *device)
1692{ 1698{
1693 int status = 0; 1699 int status = 0;
1694 struct list_head *node, *next; 1700 struct acpi_device *dev;
1695
1696 1701
1697 acpi_video_device_enumerate(video); 1702 acpi_video_device_enumerate(video);
1698 1703
1699 list_for_each_safe(node, next, &device->children) { 1704 list_for_each_entry(dev, &device->children, node) {
1700 struct acpi_device *dev =
1701 list_entry(node, struct acpi_device, node);
1702
1703 if (!dev)
1704 continue;
1705 1705
1706 status = acpi_video_bus_get_one_device(dev, video); 1706 status = acpi_video_bus_get_one_device(dev, video);
1707 if (ACPI_FAILURE(status)) { 1707 if (ACPI_FAILURE(status)) {
1708 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); 1708 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device"));
1709 continue; 1709 continue;
1710 } 1710 }
1711
1712 } 1711 }
1713 return status; 1712 return status;
1714} 1713}
@@ -1724,9 +1723,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1724 1723
1725 video = device->video; 1724 video = device->video;
1726 1725
1727 down(&video->sem);
1728 list_del(&device->entry);
1729 up(&video->sem);
1730 acpi_video_device_remove_fs(device->dev); 1726 acpi_video_device_remove_fs(device->dev);
1731 1727
1732 status = acpi_remove_notify_handler(device->dev->handle, 1728 status = acpi_remove_notify_handler(device->dev->handle,
@@ -1734,32 +1730,34 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1734 acpi_video_device_notify); 1730 acpi_video_device_notify);
1735 backlight_device_unregister(device->backlight); 1731 backlight_device_unregister(device->backlight);
1736 video_output_unregister(device->output_dev); 1732 video_output_unregister(device->output_dev);
1733
1737 return 0; 1734 return 0;
1738} 1735}
1739 1736
1740static int acpi_video_bus_put_devices(struct acpi_video_bus *video) 1737static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1741{ 1738{
1742 int status; 1739 int status;
1743 struct list_head *node, *next; 1740 struct acpi_video_device *dev, *next;
1744 1741
1742 mutex_lock(&video->device_list_lock);
1745 1743
1746 list_for_each_safe(node, next, &video->video_device_list) { 1744 list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
1747 struct acpi_video_device *data =
1748 list_entry(node, struct acpi_video_device, entry);
1749 if (!data)
1750 continue;
1751 1745
1752 status = acpi_video_bus_put_one_device(data); 1746 status = acpi_video_bus_put_one_device(dev);
1753 if (ACPI_FAILURE(status)) 1747 if (ACPI_FAILURE(status))
1754 printk(KERN_WARNING PREFIX 1748 printk(KERN_WARNING PREFIX
1755 "hhuuhhuu bug in acpi video driver.\n"); 1749 "hhuuhhuu bug in acpi video driver.\n");
1756 1750
1757 if (data->brightness) 1751 if (dev->brightness) {
1758 kfree(data->brightness->levels); 1752 kfree(dev->brightness->levels);
1759 kfree(data->brightness); 1753 kfree(dev->brightness);
1760 kfree(data); 1754 }
1755 list_del(&dev->entry);
1756 kfree(dev);
1761 } 1757 }
1762 1758
1759 mutex_unlock(&video->device_list_lock);
1760
1763 return 0; 1761 return 0;
1764} 1762}
1765 1763
@@ -1782,9 +1780,6 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1782 struct input_dev *input; 1780 struct input_dev *input;
1783 int keycode; 1781 int keycode;
1784 1782
1785
1786 printk("video bus notify\n");
1787
1788 if (!video) 1783 if (!video)
1789 return; 1784 return;
1790 1785
@@ -1897,14 +1892,10 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1897static int instance; 1892static int instance;
1898static int acpi_video_bus_add(struct acpi_device *device) 1893static int acpi_video_bus_add(struct acpi_device *device)
1899{ 1894{
1900 int result = 0; 1895 acpi_status status;
1901 acpi_status status = 0; 1896 struct acpi_video_bus *video;
1902 struct acpi_video_bus *video = NULL;
1903 struct input_dev *input; 1897 struct input_dev *input;
1904 1898 int error;
1905
1906 if (!device)
1907 return -EINVAL;
1908 1899
1909 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); 1900 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1910 if (!video) 1901 if (!video)
@@ -1923,15 +1914,15 @@ static int acpi_video_bus_add(struct acpi_device *device)
1923 acpi_driver_data(device) = video; 1914 acpi_driver_data(device) = video;
1924 1915
1925 acpi_video_bus_find_cap(video); 1916 acpi_video_bus_find_cap(video);
1926 result = acpi_video_bus_check(video); 1917 error = acpi_video_bus_check(video);
1927 if (result) 1918 if (error)
1928 goto end; 1919 goto err_free_video;
1929 1920
1930 result = acpi_video_bus_add_fs(device); 1921 error = acpi_video_bus_add_fs(device);
1931 if (result) 1922 if (error)
1932 goto end; 1923 goto err_free_video;
1933 1924
1934 init_MUTEX(&video->sem); 1925 mutex_init(&video->device_list_lock);
1935 INIT_LIST_HEAD(&video->video_device_list); 1926 INIT_LIST_HEAD(&video->video_device_list);
1936 1927
1937 acpi_video_bus_get_devices(video, device); 1928 acpi_video_bus_get_devices(video, device);
@@ -1943,16 +1934,15 @@ static int acpi_video_bus_add(struct acpi_device *device)
1943 if (ACPI_FAILURE(status)) { 1934 if (ACPI_FAILURE(status)) {
1944 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1935 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1945 "Error installing notify handler\n")); 1936 "Error installing notify handler\n"));
1946 acpi_video_bus_stop_devices(video); 1937 error = -ENODEV;
1947 acpi_video_bus_put_devices(video); 1938 goto err_stop_video;
1948 kfree(video->attached_array);
1949 acpi_video_bus_remove_fs(device);
1950 result = -ENODEV;
1951 goto end;
1952 } 1939 }
1953 1940
1954
1955 video->input = input = input_allocate_device(); 1941 video->input = input = input_allocate_device();
1942 if (!input) {
1943 error = -ENOMEM;
1944 goto err_uninstall_notify;
1945 }
1956 1946
1957 snprintf(video->phys, sizeof(video->phys), 1947 snprintf(video->phys, sizeof(video->phys),
1958 "%s/video/input0", acpi_device_hid(video->device)); 1948 "%s/video/input0", acpi_device_hid(video->device));
@@ -1961,6 +1951,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
1961 input->phys = video->phys; 1951 input->phys = video->phys;
1962 input->id.bustype = BUS_HOST; 1952 input->id.bustype = BUS_HOST;
1963 input->id.product = 0x06; 1953 input->id.product = 0x06;
1954 input->dev.parent = &device->dev;
1964 input->evbit[0] = BIT(EV_KEY); 1955 input->evbit[0] = BIT(EV_KEY);
1965 set_bit(KEY_SWITCHVIDEOMODE, input->keybit); 1956 set_bit(KEY_SWITCHVIDEOMODE, input->keybit);
1966 set_bit(KEY_VIDEO_NEXT, input->keybit); 1957 set_bit(KEY_VIDEO_NEXT, input->keybit);
@@ -1971,18 +1962,10 @@ static int acpi_video_bus_add(struct acpi_device *device)
1971 set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); 1962 set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
1972 set_bit(KEY_DISPLAY_OFF, input->keybit); 1963 set_bit(KEY_DISPLAY_OFF, input->keybit);
1973 set_bit(KEY_UNKNOWN, input->keybit); 1964 set_bit(KEY_UNKNOWN, input->keybit);
1974 result = input_register_device(input);
1975 if (result) {
1976 acpi_remove_notify_handler(video->device->handle,
1977 ACPI_DEVICE_NOTIFY,
1978 acpi_video_bus_notify);
1979 acpi_video_bus_stop_devices(video);
1980 acpi_video_bus_put_devices(video);
1981 kfree(video->attached_array);
1982 acpi_video_bus_remove_fs(device);
1983 goto end;
1984 }
1985 1965
1966 error = input_register_device(input);
1967 if (error)
1968 goto err_free_input_dev;
1986 1969
1987 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", 1970 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
1988 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), 1971 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
@@ -1990,11 +1973,23 @@ static int acpi_video_bus_add(struct acpi_device *device)
1990 video->flags.rom ? "yes" : "no", 1973 video->flags.rom ? "yes" : "no",
1991 video->flags.post ? "yes" : "no"); 1974 video->flags.post ? "yes" : "no");
1992 1975
1993 end: 1976 return 0;
1994 if (result) 1977
1995 kfree(video); 1978 err_free_input_dev:
1979 input_free_device(input);
1980 err_uninstall_notify:
1981 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
1982 acpi_video_bus_notify);
1983 err_stop_video:
1984 acpi_video_bus_stop_devices(video);
1985 acpi_video_bus_put_devices(video);
1986 kfree(video->attached_array);
1987 acpi_video_bus_remove_fs(device);
1988 err_free_video:
1989 kfree(video);
1990 acpi_driver_data(device) = NULL;
1996 1991
1997 return result; 1992 return error;
1998} 1993}
1999 1994
2000static int acpi_video_bus_remove(struct acpi_device *device, int type) 1995static int acpi_video_bus_remove(struct acpi_device *device, int type)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 328ce8a08426..483269db2c7d 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -119,18 +119,19 @@ enum {
119 PIIX_80C_SEC = (1 << 7) | (1 << 6), 119 PIIX_80C_SEC = (1 << 7) | (1 << 6),
120 120
121 /* controller IDs */ 121 /* controller IDs */
122 piix_pata_33 = 0, /* PIIX4 at 33Mhz */ 122 piix_pata_mwdma = 0, /* PIIX3 MWDMA only */
123 ich_pata_33 = 1, /* ICH up to UDMA 33 only */ 123 piix_pata_33, /* PIIX4 at 33Mhz */
124 ich_pata_66 = 2, /* ICH up to 66 Mhz */ 124 ich_pata_33, /* ICH up to UDMA 33 only */
125 ich_pata_100 = 3, /* ICH up to UDMA 100 */ 125 ich_pata_66, /* ICH up to 66 Mhz */
126 ich5_sata = 5, 126 ich_pata_100, /* ICH up to UDMA 100 */
127 ich6_sata = 6, 127 ich5_sata,
128 ich6_sata_ahci = 7, 128 ich6_sata,
129 ich6m_sata_ahci = 8, 129 ich6_sata_ahci,
130 ich8_sata_ahci = 9, 130 ich6m_sata_ahci,
131 piix_pata_mwdma = 10, /* PIIX3 MWDMA only */ 131 ich8_sata_ahci,
132 tolapai_sata_ahci = 11, 132 ich8_2port_sata,
133 ich9_2port_sata = 12, 133 ich8m_apple_sata_ahci, /* locks up on second port enable */
134 tolapai_sata_ahci,
134 135
135 /* constants for mapping table */ 136 /* constants for mapping table */
136 P0 = 0, /* port 0 */ 137 P0 = 0, /* port 0 */
@@ -239,19 +240,21 @@ static const struct pci_device_id piix_pci_tbl[] = {
239 /* SATA Controller 1 IDE (ICH8) */ 240 /* SATA Controller 1 IDE (ICH8) */
240 { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 241 { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
241 /* SATA Controller 2 IDE (ICH8) */ 242 /* SATA Controller 2 IDE (ICH8) */
242 { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 243 { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
243 /* Mobile SATA Controller IDE (ICH8M) */ 244 /* Mobile SATA Controller IDE (ICH8M) */
244 { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 245 { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
246 /* Mobile SATA Controller IDE (ICH8M), Apple */
247 { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata_ahci },
245 /* SATA Controller IDE (ICH9) */ 248 /* SATA Controller IDE (ICH9) */
246 { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 249 { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
247 /* SATA Controller IDE (ICH9) */ 250 /* SATA Controller IDE (ICH9) */
248 { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 251 { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
249 /* SATA Controller IDE (ICH9) */ 252 /* SATA Controller IDE (ICH9) */
250 { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 253 { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
251 /* SATA Controller IDE (ICH9M) */ 254 /* SATA Controller IDE (ICH9M) */
252 { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 255 { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
253 /* SATA Controller IDE (ICH9M) */ 256 /* SATA Controller IDE (ICH9M) */
254 { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, 257 { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
255 /* SATA Controller IDE (ICH9M) */ 258 /* SATA Controller IDE (ICH9M) */
256 { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, 259 { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci },
257 /* SATA Controller IDE (Tolapai) */ 260 /* SATA Controller IDE (Tolapai) */
@@ -427,7 +430,7 @@ static const struct piix_map_db ich6m_map_db = {
427 430
428static const struct piix_map_db ich8_map_db = { 431static const struct piix_map_db ich8_map_db = {
429 .mask = 0x3, 432 .mask = 0x3,
430 .port_enable = 0x3, 433 .port_enable = 0xf,
431 .map = { 434 .map = {
432 /* PM PS SM SS MAP */ 435 /* PM PS SM SS MAP */
433 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ 436 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */
@@ -437,7 +440,7 @@ static const struct piix_map_db ich8_map_db = {
437 }, 440 },
438}; 441};
439 442
440static const struct piix_map_db tolapai_map_db = { 443static const struct piix_map_db ich8_2port_map_db = {
441 .mask = 0x3, 444 .mask = 0x3,
442 .port_enable = 0x3, 445 .port_enable = 0x3,
443 .map = { 446 .map = {
@@ -449,7 +452,19 @@ static const struct piix_map_db tolapai_map_db = {
449 }, 452 },
450}; 453};
451 454
452static const struct piix_map_db ich9_2port_map_db = { 455static const struct piix_map_db ich8m_apple_map_db = {
456 .mask = 0x3,
457 .port_enable = 0x1,
458 .map = {
459 /* PM PS SM SS MAP */
460 { P0, NA, NA, NA }, /* 00b */
461 { RV, RV, RV, RV },
462 { P0, P2, IDE, IDE }, /* 10b */
463 { RV, RV, RV, RV },
464 },
465};
466
467static const struct piix_map_db tolapai_map_db = {
453 .mask = 0x3, 468 .mask = 0x3,
454 .port_enable = 0x3, 469 .port_enable = 0x3,
455 .map = { 470 .map = {
@@ -467,11 +482,21 @@ static const struct piix_map_db *piix_map_db_table[] = {
467 [ich6_sata_ahci] = &ich6_map_db, 482 [ich6_sata_ahci] = &ich6_map_db,
468 [ich6m_sata_ahci] = &ich6m_map_db, 483 [ich6m_sata_ahci] = &ich6m_map_db,
469 [ich8_sata_ahci] = &ich8_map_db, 484 [ich8_sata_ahci] = &ich8_map_db,
485 [ich8_2port_sata] = &ich8_2port_map_db,
486 [ich8m_apple_sata_ahci] = &ich8m_apple_map_db,
470 [tolapai_sata_ahci] = &tolapai_map_db, 487 [tolapai_sata_ahci] = &tolapai_map_db,
471 [ich9_2port_sata] = &ich9_2port_map_db,
472}; 488};
473 489
474static struct ata_port_info piix_port_info[] = { 490static struct ata_port_info piix_port_info[] = {
491 [piix_pata_mwdma] = /* PIIX3 MWDMA only */
492 {
493 .sht = &piix_sht,
494 .flags = PIIX_PATA_FLAGS,
495 .pio_mask = 0x1f, /* pio0-4 */
496 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
497 .port_ops = &piix_pata_ops,
498 },
499
475 [piix_pata_33] = /* PIIX4 at 33MHz */ 500 [piix_pata_33] = /* PIIX4 at 33MHz */
476 { 501 {
477 .sht = &piix_sht, 502 .sht = &piix_sht,
@@ -565,13 +590,15 @@ static struct ata_port_info piix_port_info[] = {
565 .port_ops = &piix_sata_ops, 590 .port_ops = &piix_sata_ops,
566 }, 591 },
567 592
568 [piix_pata_mwdma] = /* PIIX3 MWDMA only */ 593 [ich8_2port_sata] =
569 { 594 {
570 .sht = &piix_sht, 595 .sht = &piix_sht,
571 .flags = PIIX_PATA_FLAGS, 596 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR |
597 PIIX_FLAG_AHCI,
572 .pio_mask = 0x1f, /* pio0-4 */ 598 .pio_mask = 0x1f, /* pio0-4 */
573 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */ 599 .mwdma_mask = 0x07, /* mwdma0-2 */
574 .port_ops = &piix_pata_ops, 600 .udma_mask = ATA_UDMA6,
601 .port_ops = &piix_sata_ops,
575 }, 602 },
576 603
577 [tolapai_sata_ahci] = 604 [tolapai_sata_ahci] =
@@ -585,7 +612,7 @@ static struct ata_port_info piix_port_info[] = {
585 .port_ops = &piix_sata_ops, 612 .port_ops = &piix_sata_ops,
586 }, 613 },
587 614
588 [ich9_2port_sata] = 615 [ich8m_apple_sata_ahci] =
589 { 616 {
590 .sht = &piix_sht, 617 .sht = &piix_sht,
591 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | 618 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR |
@@ -595,6 +622,7 @@ static struct ata_port_info piix_port_info[] = {
595 .udma_mask = ATA_UDMA6, 622 .udma_mask = ATA_UDMA6,
596 .port_ops = &piix_sata_ops, 623 .port_ops = &piix_sata_ops,
597 }, 624 },
625
598}; 626};
599 627
600static struct pci_bits piix_enable_bits[] = { 628static struct pci_bits piix_enable_bits[] = {
@@ -974,6 +1002,13 @@ static int piix_broken_suspend(void)
974 }, 1002 },
975 }, 1003 },
976 { 1004 {
1005 .ident = "SATELLITE U205",
1006 .matches = {
1007 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
1008 DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U205"),
1009 },
1010 },
1011 {
977 .ident = "Portege M500", 1012 .ident = "Portege M500",
978 .matches = { 1013 .matches = {
979 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 1014 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -1086,12 +1121,12 @@ static int piix_disable_ahci(struct pci_dev *pdev)
1086 if (!mmio) 1121 if (!mmio)
1087 return -ENOMEM; 1122 return -ENOMEM;
1088 1123
1089 tmp = readl(mmio + AHCI_GLOBAL_CTL); 1124 tmp = ioread32(mmio + AHCI_GLOBAL_CTL);
1090 if (tmp & AHCI_ENABLE) { 1125 if (tmp & AHCI_ENABLE) {
1091 tmp &= ~AHCI_ENABLE; 1126 tmp &= ~AHCI_ENABLE;
1092 writel(tmp, mmio + AHCI_GLOBAL_CTL); 1127 iowrite32(tmp, mmio + AHCI_GLOBAL_CTL);
1093 1128
1094 tmp = readl(mmio + AHCI_GLOBAL_CTL); 1129 tmp = ioread32(mmio + AHCI_GLOBAL_CTL);
1095 if (tmp & AHCI_ENABLE) 1130 if (tmp & AHCI_ENABLE)
1096 rc = -EIO; 1131 rc = -EIO;
1097 } 1132 }
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 81898036dbca..33f06277b3be 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -30,6 +30,14 @@
30 * Hardware documentation available from http://www.t13.org/ and 30 * Hardware documentation available from http://www.t13.org/ and
31 * http://www.sata-io.org/ 31 * http://www.sata-io.org/
32 * 32 *
33 * Standards documents from:
34 * http://www.t13.org (ATA standards, PCI DMA IDE spec)
35 * http://www.t10.org (SCSI MMC - for ATAPI MMC)
36 * http://www.sata-io.org (SATA)
37 * http://www.compactflash.org (CF)
38 * http://www.qic.org (QIC157 - Tape and DSC)
39 * http://www.ce-ata.org (CE-ATA: not supported)
40 *
33 */ 41 */
34 42
35#include <linux/kernel.h> 43#include <linux/kernel.h>
@@ -2307,8 +2315,10 @@ int ata_dev_configure(struct ata_device *dev)
2307 } 2315 }
2308 2316
2309 if ((dev->class == ATA_DEV_ATAPI) && 2317 if ((dev->class == ATA_DEV_ATAPI) &&
2310 (atapi_command_packet_set(id) == TYPE_TAPE)) 2318 (atapi_command_packet_set(id) == TYPE_TAPE)) {
2311 dev->max_sectors = ATA_MAX_SECTORS_TAPE; 2319 dev->max_sectors = ATA_MAX_SECTORS_TAPE;
2320 dev->horkage |= ATA_HORKAGE_STUCK_ERR;
2321 }
2312 2322
2313 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) 2323 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
2314 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, 2324 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
@@ -2581,81 +2591,6 @@ void sata_print_link_status(struct ata_link *link)
2581} 2591}
2582 2592
2583/** 2593/**
2584 * __sata_phy_reset - Wake/reset a low-level SATA PHY
2585 * @ap: SATA port associated with target SATA PHY.
2586 *
2587 * This function issues commands to standard SATA Sxxx
2588 * PHY registers, to wake up the phy (and device), and
2589 * clear any reset condition.
2590 *
2591 * LOCKING:
2592 * PCI/etc. bus probe sem.
2593 *
2594 */
2595void __sata_phy_reset(struct ata_port *ap)
2596{
2597 struct ata_link *link = &ap->link;
2598 unsigned long timeout = jiffies + (HZ * 5);
2599 u32 sstatus;
2600
2601 if (ap->flags & ATA_FLAG_SATA_RESET) {
2602 /* issue phy wake/reset */
2603 sata_scr_write_flush(link, SCR_CONTROL, 0x301);
2604 /* Couldn't find anything in SATA I/II specs, but
2605 * AHCI-1.1 10.4.2 says at least 1 ms. */
2606 mdelay(1);
2607 }
2608 /* phy wake/clear reset */
2609 sata_scr_write_flush(link, SCR_CONTROL, 0x300);
2610
2611 /* wait for phy to become ready, if necessary */
2612 do {
2613 msleep(200);
2614 sata_scr_read(link, SCR_STATUS, &sstatus);
2615 if ((sstatus & 0xf) != 1)
2616 break;
2617 } while (time_before(jiffies, timeout));
2618
2619 /* print link status */
2620 sata_print_link_status(link);
2621
2622 /* TODO: phy layer with polling, timeouts, etc. */
2623 if (!ata_link_offline(link))
2624 ata_port_probe(ap);
2625 else
2626 ata_port_disable(ap);
2627
2628 if (ap->flags & ATA_FLAG_DISABLED)
2629 return;
2630
2631 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
2632 ata_port_disable(ap);
2633 return;
2634 }
2635
2636 ap->cbl = ATA_CBL_SATA;
2637}
2638
2639/**
2640 * sata_phy_reset - Reset SATA bus.
2641 * @ap: SATA port associated with target SATA PHY.
2642 *
2643 * This function resets the SATA bus, and then probes
2644 * the bus for devices.
2645 *
2646 * LOCKING:
2647 * PCI/etc. bus probe sem.
2648 *
2649 */
2650void sata_phy_reset(struct ata_port *ap)
2651{
2652 __sata_phy_reset(ap);
2653 if (ap->flags & ATA_FLAG_DISABLED)
2654 return;
2655 ata_bus_reset(ap);
2656}
2657
2658/**
2659 * ata_dev_pair - return other device on cable 2594 * ata_dev_pair - return other device on cable
2660 * @adev: device 2595 * @adev: device
2661 * 2596 *
@@ -5490,11 +5425,19 @@ fsm_start:
5490 * let the EH abort the command or reset the device. 5425 * let the EH abort the command or reset the device.
5491 */ 5426 */
5492 if (unlikely(status & (ATA_ERR | ATA_DF))) { 5427 if (unlikely(status & (ATA_ERR | ATA_DF))) {
5493 ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device " 5428 /* Some ATAPI tape drives forget to clear the ERR bit
5494 "error, dev_stat 0x%X\n", status); 5429 * when doing the next command (mostly request sense).
5495 qc->err_mask |= AC_ERR_HSM; 5430 * We ignore ERR here to workaround and proceed sending
5496 ap->hsm_task_state = HSM_ST_ERR; 5431 * the CDB.
5497 goto fsm_start; 5432 */
5433 if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
5434 ata_port_printk(ap, KERN_WARNING,
5435 "DRQ=1 with device error, "
5436 "dev_stat 0x%X\n", status);
5437 qc->err_mask |= AC_ERR_HSM;
5438 ap->hsm_task_state = HSM_ST_ERR;
5439 goto fsm_start;
5440 }
5498 } 5441 }
5499 5442
5500 /* Send the CDB (atapi) or the first data block (ata pio out). 5443 /* Send the CDB (atapi) or the first data block (ata pio out).
@@ -7653,8 +7596,6 @@ EXPORT_SYMBOL_GPL(ata_dev_disable);
7653EXPORT_SYMBOL_GPL(sata_set_spd); 7596EXPORT_SYMBOL_GPL(sata_set_spd);
7654EXPORT_SYMBOL_GPL(sata_link_debounce); 7597EXPORT_SYMBOL_GPL(sata_link_debounce);
7655EXPORT_SYMBOL_GPL(sata_link_resume); 7598EXPORT_SYMBOL_GPL(sata_link_resume);
7656EXPORT_SYMBOL_GPL(sata_phy_reset);
7657EXPORT_SYMBOL_GPL(__sata_phy_reset);
7658EXPORT_SYMBOL_GPL(ata_bus_reset); 7599EXPORT_SYMBOL_GPL(ata_bus_reset);
7659EXPORT_SYMBOL_GPL(ata_std_prereset); 7600EXPORT_SYMBOL_GPL(ata_std_prereset);
7660EXPORT_SYMBOL_GPL(ata_std_softreset); 7601EXPORT_SYMBOL_GPL(ata_std_softreset);
@@ -7725,7 +7666,6 @@ EXPORT_SYMBOL_GPL(ata_port_desc);
7725#ifdef CONFIG_PCI 7666#ifdef CONFIG_PCI
7726EXPORT_SYMBOL_GPL(ata_port_pbar_desc); 7667EXPORT_SYMBOL_GPL(ata_port_pbar_desc);
7727#endif /* CONFIG_PCI */ 7668#endif /* CONFIG_PCI */
7728EXPORT_SYMBOL_GPL(ata_eng_timeout);
7729EXPORT_SYMBOL_GPL(ata_port_schedule_eh); 7669EXPORT_SYMBOL_GPL(ata_port_schedule_eh);
7730EXPORT_SYMBOL_GPL(ata_link_abort); 7670EXPORT_SYMBOL_GPL(ata_link_abort);
7731EXPORT_SYMBOL_GPL(ata_port_abort); 7671EXPORT_SYMBOL_GPL(ata_port_abort);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index ed8813b222a0..0dac69db1fdf 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -559,101 +559,6 @@ void ata_port_wait_eh(struct ata_port *ap)
559 } 559 }
560} 560}
561 561
562/**
563 * ata_qc_timeout - Handle timeout of queued command
564 * @qc: Command that timed out
565 *
566 * Some part of the kernel (currently, only the SCSI layer)
567 * has noticed that the active command on port @ap has not
568 * completed after a specified length of time. Handle this
569 * condition by disabling DMA (if necessary) and completing
570 * transactions, with error if necessary.
571 *
572 * This also handles the case of the "lost interrupt", where
573 * for some reason (possibly hardware bug, possibly driver bug)
574 * an interrupt was not delivered to the driver, even though the
575 * transaction completed successfully.
576 *
577 * TODO: kill this function once old EH is gone.
578 *
579 * LOCKING:
580 * Inherited from SCSI layer (none, can sleep)
581 */
582static void ata_qc_timeout(struct ata_queued_cmd *qc)
583{
584 struct ata_port *ap = qc->ap;
585 u8 host_stat = 0, drv_stat;
586 unsigned long flags;
587
588 DPRINTK("ENTER\n");
589
590 ap->hsm_task_state = HSM_ST_IDLE;
591
592 spin_lock_irqsave(ap->lock, flags);
593
594 switch (qc->tf.protocol) {
595
596 case ATA_PROT_DMA:
597 case ATA_PROT_ATAPI_DMA:
598 host_stat = ap->ops->bmdma_status(ap);
599
600 /* before we do anything else, clear DMA-Start bit */
601 ap->ops->bmdma_stop(qc);
602
603 /* fall through */
604
605 default:
606 ata_altstatus(ap);
607 drv_stat = ata_chk_status(ap);
608
609 /* ack bmdma irq events */
610 ap->ops->irq_clear(ap);
611
612 ata_dev_printk(qc->dev, KERN_ERR, "command 0x%x timeout, "
613 "stat 0x%x host_stat 0x%x\n",
614 qc->tf.command, drv_stat, host_stat);
615
616 /* complete taskfile transaction */
617 qc->err_mask |= AC_ERR_TIMEOUT;
618 break;
619 }
620
621 spin_unlock_irqrestore(ap->lock, flags);
622
623 ata_eh_qc_complete(qc);
624
625 DPRINTK("EXIT\n");
626}
627
628/**
629 * ata_eng_timeout - Handle timeout of queued command
630 * @ap: Port on which timed-out command is active
631 *
632 * Some part of the kernel (currently, only the SCSI layer)
633 * has noticed that the active command on port @ap has not
634 * completed after a specified length of time. Handle this
635 * condition by disabling DMA (if necessary) and completing
636 * transactions, with error if necessary.
637 *
638 * This also handles the case of the "lost interrupt", where
639 * for some reason (possibly hardware bug, possibly driver bug)
640 * an interrupt was not delivered to the driver, even though the
641 * transaction completed successfully.
642 *
643 * TODO: kill this function once old EH is gone.
644 *
645 * LOCKING:
646 * Inherited from SCSI layer (none, can sleep)
647 */
648void ata_eng_timeout(struct ata_port *ap)
649{
650 DPRINTK("ENTER\n");
651
652 ata_qc_timeout(ata_qc_from_tag(ap, ap->link.active_tag));
653
654 DPRINTK("EXIT\n");
655}
656
657static int ata_eh_nr_in_flight(struct ata_port *ap) 562static int ata_eh_nr_in_flight(struct ata_port *ap)
658{ 563{
659 unsigned int tag; 564 unsigned int tag;
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 94144ed50a6b..a883bb03d4c7 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2485,11 +2485,40 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2485 if (!using_pio && ata_check_atapi_dma(qc)) 2485 if (!using_pio && ata_check_atapi_dma(qc))
2486 using_pio = 1; 2486 using_pio = 1;
2487 2487
2488 /* Some controller variants snoop this value for Packet transfers 2488 /* Some controller variants snoop this value for Packet
2489 to do state machine and FIFO management. Thus we want to set it 2489 * transfers to do state machine and FIFO management. Thus we
2490 properly, and for DMA where it is effectively meaningless */ 2490 * want to set it properly, and for DMA where it is
2491 * effectively meaningless.
2492 */
2491 nbytes = min(qc->nbytes, (unsigned int)63 * 1024); 2493 nbytes = min(qc->nbytes, (unsigned int)63 * 1024);
2492 2494
2495 /* Most ATAPI devices which honor transfer chunk size don't
2496 * behave according to the spec when odd chunk size which
2497 * matches the transfer length is specified. If the number of
2498 * bytes to transfer is 2n+1. According to the spec, what
2499 * should happen is to indicate that 2n+1 is going to be
2500 * transferred and transfer 2n+2 bytes where the last byte is
2501 * padding.
2502 *
2503 * In practice, this doesn't happen. ATAPI devices first
2504 * indicate and transfer 2n bytes and then indicate and
2505 * transfer 2 bytes where the last byte is padding.
2506 *
2507 * This inconsistency confuses several controllers which
2508 * perform PIO using DMA such as Intel AHCIs and sil3124/32.
2509 * These controllers use actual number of transferred bytes to
2510 * update DMA poitner and transfer of 4n+2 bytes make those
2511 * controller push DMA pointer by 4n+4 bytes because SATA data
2512 * FISes are aligned to 4 bytes. This causes data corruption
2513 * and buffer overrun.
2514 *
2515 * Always setting nbytes to even number solves this problem
2516 * because then ATAPI devices don't have to split data at 2n
2517 * boundaries.
2518 */
2519 if (nbytes & 0x1)
2520 nbytes++;
2521
2493 qc->tf.lbam = (nbytes & 0xFF); 2522 qc->tf.lbam = (nbytes & 0xFF);
2494 qc->tf.lbah = (nbytes >> 8); 2523 qc->tf.lbah = (nbytes >> 8);
2495 2524
@@ -2869,7 +2898,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
2869 xlat_func = NULL; 2898 xlat_func = NULL;
2870 if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { 2899 if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
2871 /* relay SCSI command to ATAPI device */ 2900 /* relay SCSI command to ATAPI device */
2872 if (unlikely(scmd->cmd_len > dev->cdb_len)) 2901 int len = COMMAND_SIZE(scsi_op);
2902 if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
2873 goto bad_cdb_len; 2903 goto bad_cdb_len;
2874 2904
2875 xlat_func = atapi_xlat; 2905 xlat_func = atapi_xlat;
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 364534e7aff4..8caf9afc8b90 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -63,6 +63,9 @@ static int ali_cable_override(struct pci_dev *pdev)
63 /* Fujitsu P2000 */ 63 /* Fujitsu P2000 */
64 if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF) 64 if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF)
65 return 1; 65 return 1;
66 /* Mitac 8317 (Winbook-A) and relatives */
67 if (pdev->subsystem_vendor == 0x1071 && pdev->subsystem_device == 0x8317)
68 return 1;
66 /* Systems by DMI */ 69 /* Systems by DMI */
67 if (dmi_check_system(cable_dmi_table)) 70 if (dmi_check_system(cable_dmi_table))
68 return 1; 71 return 1;
@@ -282,6 +285,21 @@ static void ali_lock_sectors(struct ata_device *adev)
282 adev->max_sectors = 255; 285 adev->max_sectors = 255;
283} 286}
284 287
288/**
289 * ali_check_atapi_dma - DMA check for most ALi controllers
290 * @adev: Device
291 *
292 * Called to decide whether commands should be sent by DMA or PIO
293 */
294
295static int ali_check_atapi_dma(struct ata_queued_cmd *qc)
296{
297 /* If its not a media command, its not worth it */
298 if (qc->nbytes < 2048)
299 return -EOPNOTSUPP;
300 return 0;
301}
302
285static struct scsi_host_template ali_sht = { 303static struct scsi_host_template ali_sht = {
286 .module = THIS_MODULE, 304 .module = THIS_MODULE,
287 .name = DRV_NAME, 305 .name = DRV_NAME,
@@ -378,6 +396,7 @@ static struct ata_port_operations ali_c2_port_ops = {
378 .mode_filter = ata_pci_default_filter, 396 .mode_filter = ata_pci_default_filter,
379 .tf_load = ata_tf_load, 397 .tf_load = ata_tf_load,
380 .tf_read = ata_tf_read, 398 .tf_read = ata_tf_read,
399 .check_atapi_dma = ali_check_atapi_dma,
381 .check_status = ata_check_status, 400 .check_status = ata_check_status,
382 .exec_command = ata_exec_command, 401 .exec_command = ata_exec_command,
383 .dev_select = ata_std_dev_select, 402 .dev_select = ata_std_dev_select,
@@ -415,6 +434,7 @@ static struct ata_port_operations ali_c5_port_ops = {
415 .mode_filter = ata_pci_default_filter, 434 .mode_filter = ata_pci_default_filter,
416 .tf_load = ata_tf_load, 435 .tf_load = ata_tf_load,
417 .tf_read = ata_tf_read, 436 .tf_read = ata_tf_read,
437 .check_atapi_dma = ali_check_atapi_dma,
418 .check_status = ata_check_status, 438 .check_status = ata_check_status,
419 .exec_command = ata_exec_command, 439 .exec_command = ata_exec_command,
420 .dev_select = ata_std_dev_select, 440 .dev_select = ata_std_dev_select,
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index b5e38426b815..81db405a5445 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1145,13 +1145,13 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap)
1145 unsigned short int_status = ATAPI_GET_INT_STATUS(base); 1145 unsigned short int_status = ATAPI_GET_INT_STATUS(base);
1146 1146
1147 if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) { 1147 if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) {
1148 host_stat = ATA_DMA_ACTIVE; 1148 host_stat |= ATA_DMA_ACTIVE;
1149 } 1149 }
1150 if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) { 1150 if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) {
1151 host_stat = ATA_DMA_INTR; 1151 host_stat |= ATA_DMA_INTR;
1152 } 1152 }
1153 if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) { 1153 if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) {
1154 host_stat = ATA_DMA_ERR; 1154 host_stat |= ATA_DMA_ERR;
1155 } 1155 }
1156 1156
1157 return host_stat; 1157 return host_stat;
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 3816b8605e0d..46dc70e0dee7 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -329,7 +329,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline)
329 /* Restore state */ 329 /* Restore state */
330 pci_write_config_byte(pdev, 0x5B, scr2); 330 pci_write_config_byte(pdev, 0x5B, scr2);
331 331
332 if (ata66 & (1 << ap->port_no)) 332 if (ata66 & (2 >> ap->port_no))
333 ap->cbl = ATA_CBL_PATA40; 333 ap->cbl = ATA_CBL_PATA40;
334 else 334 else
335 ap->cbl = ATA_CBL_PATA80; 335 ap->cbl = ATA_CBL_PATA80;
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 88ab0e1d353f..4320e7986321 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -75,13 +75,16 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
75 struct ata_host *host; 75 struct ata_host *host;
76 struct ata_port *ap; 76 struct ata_port *ap;
77 void __iomem *cmd_addr, *ctl_addr; 77 void __iomem *cmd_addr, *ctl_addr;
78 int irq = 0;
79 irq_handler_t handler = NULL;
78 80
79 if (pnp_port_valid(idev, 0) == 0) 81 if (pnp_port_valid(idev, 0) == 0)
80 return -ENODEV; 82 return -ENODEV;
81 83
82 /* FIXME: Should selected polled PIO here not fail */ 84 if (pnp_irq_valid(idev, 0)) {
83 if (pnp_irq_valid(idev, 0) == 0) 85 irq = pnp_irq(idev, 0);
84 return -ENODEV; 86 handler = ata_interrupt;
87 }
85 88
86 /* allocate host */ 89 /* allocate host */
87 host = ata_host_alloc(&idev->dev, 1); 90 host = ata_host_alloc(&idev->dev, 1);
@@ -115,7 +118,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
115 (unsigned long long)pnp_port_start(idev, 1)); 118 (unsigned long long)pnp_port_start(idev, 1));
116 119
117 /* activate */ 120 /* activate */
118 return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0, 121 return ata_host_activate(host, irq, handler, 0,
119 &isapnp_sht); 122 &isapnp_sht);
120} 123}
121 124
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 225a7223a726..5b8174d94067 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
80 * actually do our cable checking etc. Thankfully we don't need 80 * actually do our cable checking etc. Thankfully we don't need
81 * to do the plumbing for other cases. 81 * to do the plumbing for other cases.
82 */ 82 */
83 switch (port_map[port]) 83 switch (port_map[port]) {
84 {
85 case PORT_PATA0: 84 case PORT_PATA0:
86 if (control & (1 << 5)) 85 if ((control & (1 << 5)) == 0)
87 return 0; 86 return -ENOENT;
88 if (control & (1 << 3)) /* 40/80 pin primary */ 87 if (control & (1 << 3)) /* 40/80 pin primary */
89 ap->cbl = ATA_CBL_PATA40; 88 ap->cbl = ATA_CBL_PATA40;
90 else 89 else
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
93 case PORT_PATA1: 92 case PORT_PATA1:
94 /* Bit 21 is set if the port is enabled */ 93 /* Bit 21 is set if the port is enabled */
95 if ((control5 & (1 << 21)) == 0) 94 if ((control5 & (1 << 21)) == 0)
96 return 0; 95 return -ENOENT;
97 if (control5 & (1 << 19)) /* 40/80 pin secondary */ 96 if (control5 & (1 << 19)) /* 40/80 pin secondary */
98 ap->cbl = ATA_CBL_PATA40; 97 ap->cbl = ATA_CBL_PATA40;
99 else 98 else
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 5c1e9cb59ecb..503245a1eafa 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -33,7 +33,7 @@
33#include <linux/libata.h> 33#include <linux/libata.h>
34 34
35#define DRV_NAME "pata_sil680" 35#define DRV_NAME "pata_sil680"
36#define DRV_VERSION "0.4.7" 36#define DRV_VERSION "0.4.8"
37 37
38#define SIL680_MMIO_BAR 5 38#define SIL680_MMIO_BAR 5
39 39
@@ -94,34 +94,6 @@ static int sil680_cable_detect(struct ata_port *ap) {
94} 94}
95 95
96/** 96/**
97 * sil680_bus_reset - reset the SIL680 bus
98 * @link: ATA link to reset
99 * @deadline: deadline jiffies for the operation
100 *
101 * Perform the SIL680 housekeeping when doing an ATA bus reset
102 */
103
104static int sil680_bus_reset(struct ata_link *link, unsigned int *classes,
105 unsigned long deadline)
106{
107 struct ata_port *ap = link->ap;
108 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
109 unsigned long addr = sil680_selreg(ap, 0);
110 u8 reset;
111
112 pci_read_config_byte(pdev, addr, &reset);
113 pci_write_config_byte(pdev, addr, reset | 0x03);
114 udelay(25);
115 pci_write_config_byte(pdev, addr, reset);
116 return ata_std_softreset(link, classes, deadline);
117}
118
119static void sil680_error_handler(struct ata_port *ap)
120{
121 ata_bmdma_drive_eh(ap, ata_std_prereset, sil680_bus_reset, NULL, ata_std_postreset);
122}
123
124/**
125 * sil680_set_piomode - set initial PIO mode data 97 * sil680_set_piomode - set initial PIO mode data
126 * @ap: ATA interface 98 * @ap: ATA interface
127 * @adev: ATA device 99 * @adev: ATA device
@@ -249,7 +221,7 @@ static struct ata_port_operations sil680_port_ops = {
249 221
250 .freeze = ata_bmdma_freeze, 222 .freeze = ata_bmdma_freeze,
251 .thaw = ata_bmdma_thaw, 223 .thaw = ata_bmdma_thaw,
252 .error_handler = sil680_error_handler, 224 .error_handler = ata_bmdma_error_handler,
253 .post_internal_cmd = ata_bmdma_post_internal_cmd, 225 .post_internal_cmd = ata_bmdma_post_internal_cmd,
254 .cable_detect = sil680_cable_detect, 226 .cable_detect = sil680_cable_detect,
255 227
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 3b5be77e861c..87546d9f1ca0 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -55,6 +55,7 @@ static const struct sis_laptop sis_laptop[] = {
55 /* devid, subvendor, subdev */ 55 /* devid, subvendor, subdev */
56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
57 { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */ 57 { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */
58 { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */
58 /* end marker */ 59 /* end marker */
59 { 0, } 60 { 0, }
60}; 61};
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 187dcb02c681..96fd5260446d 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -63,6 +63,21 @@ enum {
63 SIL24_HOST_BAR = 0, 63 SIL24_HOST_BAR = 0,
64 SIL24_PORT_BAR = 2, 64 SIL24_PORT_BAR = 2,
65 65
66 /* sil24 fetches in chunks of 64bytes. The first block
67 * contains the PRB and two SGEs. From the second block, it's
68 * consisted of four SGEs and called SGT. Calculate the
69 * number of SGTs that fit into one page.
70 */
71 SIL24_PRB_SZ = sizeof(struct sil24_prb)
72 + 2 * sizeof(struct sil24_sge),
73 SIL24_MAX_SGT = (PAGE_SIZE - SIL24_PRB_SZ)
74 / (4 * sizeof(struct sil24_sge)),
75
76 /* This will give us one unused SGEs for ATA. This extra SGE
77 * will be used to store CDB for ATAPI devices.
78 */
79 SIL24_MAX_SGE = 4 * SIL24_MAX_SGT + 1,
80
66 /* 81 /*
67 * Global controller registers (128 bytes @ BAR0) 82 * Global controller registers (128 bytes @ BAR0)
68 */ 83 */
@@ -247,13 +262,13 @@ enum {
247 262
248struct sil24_ata_block { 263struct sil24_ata_block {
249 struct sil24_prb prb; 264 struct sil24_prb prb;
250 struct sil24_sge sge[LIBATA_MAX_PRD]; 265 struct sil24_sge sge[SIL24_MAX_SGE];
251}; 266};
252 267
253struct sil24_atapi_block { 268struct sil24_atapi_block {
254 struct sil24_prb prb; 269 struct sil24_prb prb;
255 u8 cdb[16]; 270 u8 cdb[16];
256 struct sil24_sge sge[LIBATA_MAX_PRD - 1]; 271 struct sil24_sge sge[SIL24_MAX_SGE];
257}; 272};
258 273
259union sil24_cmd_block { 274union sil24_cmd_block {
@@ -378,7 +393,7 @@ static struct scsi_host_template sil24_sht = {
378 .change_queue_depth = ata_scsi_change_queue_depth, 393 .change_queue_depth = ata_scsi_change_queue_depth,
379 .can_queue = SIL24_MAX_CMDS, 394 .can_queue = SIL24_MAX_CMDS,
380 .this_id = ATA_SHT_THIS_ID, 395 .this_id = ATA_SHT_THIS_ID,
381 .sg_tablesize = LIBATA_MAX_PRD, 396 .sg_tablesize = SIL24_MAX_SGE,
382 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 397 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
383 .emulated = ATA_SHT_EMULATED, 398 .emulated = ATA_SHT_EMULATED,
384 .use_clustering = ATA_SHT_USE_CLUSTERING, 399 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -1284,6 +1299,7 @@ static void sil24_init_controller(struct ata_host *host)
1284 1299
1285static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1300static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1286{ 1301{
1302 extern int __MARKER__sil24_cmd_block_is_sized_wrongly;
1287 static int printed_version; 1303 static int printed_version;
1288 struct ata_port_info pi = sil24_port_info[ent->driver_data]; 1304 struct ata_port_info pi = sil24_port_info[ent->driver_data];
1289 const struct ata_port_info *ppi[] = { &pi, NULL }; 1305 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1292,6 +1308,10 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1292 int i, rc; 1308 int i, rc;
1293 u32 tmp; 1309 u32 tmp;
1294 1310
1311 /* cause link error if sil24_cmd_block is sized wrongly */
1312 if (sizeof(union sil24_cmd_block) != PAGE_SIZE)
1313 __MARKER__sil24_cmd_block_is_sized_wrongly = 1;
1314
1295 if (!printed_version++) 1315 if (!printed_version++)
1296 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1316 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1297 1317
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d33aba6864c2..3b64a99772ea 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -394,6 +394,11 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
394 he_dev->atm_dev->dev_data = he_dev; 394 he_dev->atm_dev->dev_data = he_dev;
395 atm_dev->dev_data = he_dev; 395 atm_dev->dev_data = he_dev;
396 he_dev->number = atm_dev->number; 396 he_dev->number = atm_dev->number;
397#ifdef USE_TASKLET
398 tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev);
399#endif
400 spin_lock_init(&he_dev->global_lock);
401
397 if (he_start(atm_dev)) { 402 if (he_start(atm_dev)) {
398 he_stop(he_dev); 403 he_stop(he_dev);
399 err = -ENODEV; 404 err = -ENODEV;
@@ -1173,11 +1178,6 @@ he_start(struct atm_dev *dev)
1173 if ((err = he_init_irq(he_dev)) != 0) 1178 if ((err = he_init_irq(he_dev)) != 0)
1174 return err; 1179 return err;
1175 1180
1176#ifdef USE_TASKLET
1177 tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev);
1178#endif
1179 spin_lock_init(&he_dev->global_lock);
1180
1181 /* 4.11 enable pci bus controller state machines */ 1181 /* 4.11 enable pci bus controller state machines */
1182 host_cntl |= (OUTFF_ENB | CMDFF_ENB | 1182 host_cntl |= (OUTFF_ENB | CMDFF_ENB |
1183 QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB); 1183 QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 3f4d6aa13990..2683eac30c68 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -770,9 +770,10 @@ int device_add(struct device *dev)
770 error = device_add_attrs(dev); 770 error = device_add_attrs(dev);
771 if (error) 771 if (error)
772 goto AttrsError; 772 goto AttrsError;
773 error = device_pm_add(dev); 773 error = dpm_sysfs_add(dev);
774 if (error) 774 if (error)
775 goto PMError; 775 goto PMError;
776 device_pm_add(dev);
776 error = bus_add_device(dev); 777 error = bus_add_device(dev);
777 if (error) 778 if (error)
778 goto BusError; 779 goto BusError;
@@ -797,6 +798,7 @@ int device_add(struct device *dev)
797 return error; 798 return error;
798 BusError: 799 BusError:
799 device_pm_remove(dev); 800 device_pm_remove(dev);
801 dpm_sysfs_remove(dev);
800 PMError: 802 PMError:
801 if (dev->bus) 803 if (dev->bus)
802 blocking_notifier_call_chain(&dev->bus->bus_notifier, 804 blocking_notifier_call_chain(&dev->bus->bus_notifier,
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile
index a803733c839e..44504e6618fb 100644
--- a/drivers/base/power/Makefile
+++ b/drivers/base/power/Makefile
@@ -1,5 +1,6 @@
1obj-y := shutdown.o 1obj-y := shutdown.o
2obj-$(CONFIG_PM_SLEEP) += main.o sysfs.o 2obj-$(CONFIG_PM) += sysfs.o
3obj-$(CONFIG_PM_SLEEP) += main.o
3obj-$(CONFIG_PM_TRACE) += trace.o 4obj-$(CONFIG_PM_TRACE) += trace.o
4 5
5ifeq ($(CONFIG_DEBUG_DRIVER),y) 6ifeq ($(CONFIG_DEBUG_DRIVER),y)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 0ab4ab21f564..691ffb64cc37 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -38,20 +38,14 @@ static DEFINE_MUTEX(dpm_list_mtx);
38int (*platform_enable_wakeup)(struct device *dev, int is_on); 38int (*platform_enable_wakeup)(struct device *dev, int is_on);
39 39
40 40
41int device_pm_add(struct device *dev) 41void device_pm_add(struct device *dev)
42{ 42{
43 int error;
44
45 pr_debug("PM: Adding info for %s:%s\n", 43 pr_debug("PM: Adding info for %s:%s\n",
46 dev->bus ? dev->bus->name : "No Bus", 44 dev->bus ? dev->bus->name : "No Bus",
47 kobject_name(&dev->kobj)); 45 kobject_name(&dev->kobj));
48 mutex_lock(&dpm_list_mtx); 46 mutex_lock(&dpm_list_mtx);
49 list_add_tail(&dev->power.entry, &dpm_active); 47 list_add_tail(&dev->power.entry, &dpm_active);
50 error = dpm_sysfs_add(dev);
51 if (error)
52 list_del(&dev->power.entry);
53 mutex_unlock(&dpm_list_mtx); 48 mutex_unlock(&dpm_list_mtx);
54 return error;
55} 49}
56 50
57void device_pm_remove(struct device *dev) 51void device_pm_remove(struct device *dev)
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 5c4efd493fa5..379da4e958e0 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -13,14 +13,29 @@ extern void device_shutdown(void);
13 13
14extern struct list_head dpm_active; /* The active device list */ 14extern struct list_head dpm_active; /* The active device list */
15 15
16static inline struct device * to_device(struct list_head * entry) 16static inline struct device *to_device(struct list_head *entry)
17{ 17{
18 return container_of(entry, struct device, power.entry); 18 return container_of(entry, struct device, power.entry);
19} 19}
20 20
21extern int device_pm_add(struct device *); 21extern void device_pm_add(struct device *);
22extern void device_pm_remove(struct device *); 22extern void device_pm_remove(struct device *);
23 23
24#else /* CONFIG_PM_SLEEP */
25
26
27static inline void device_pm_add(struct device *dev)
28{
29}
30
31static inline void device_pm_remove(struct device *dev)
32{
33}
34
35#endif
36
37#ifdef CONFIG_PM
38
24/* 39/*
25 * sysfs.c 40 * sysfs.c
26 */ 41 */
@@ -28,16 +43,15 @@ extern void device_pm_remove(struct device *);
28extern int dpm_sysfs_add(struct device *); 43extern int dpm_sysfs_add(struct device *);
29extern void dpm_sysfs_remove(struct device *); 44extern void dpm_sysfs_remove(struct device *);
30 45
31#else /* CONFIG_PM_SLEEP */ 46#else /* CONFIG_PM */
32
33 47
34static inline int device_pm_add(struct device * dev) 48static inline int dpm_sysfs_add(struct device *dev)
35{ 49{
36 return 0; 50 return 0;
37} 51}
38static inline void device_pm_remove(struct device * dev)
39{
40 52
53static inline void dpm_sysfs_remove(struct device *dev)
54{
41} 55}
42 56
43#endif 57#endif
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 3cf7129d83e6..924ddd8bccd2 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -223,7 +223,7 @@ static int virtblk_probe(struct virtio_device *vdev)
223 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); 223 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap);
224 if (err) { 224 if (err) {
225 dev_err(&vdev->dev, "Bad/missing capacity in config\n"); 225 dev_err(&vdev->dev, "Bad/missing capacity in config\n");
226 goto out_put_disk; 226 goto out_cleanup_queue;
227 } 227 }
228 228
229 /* If capacity is too big, truncate with warning. */ 229 /* If capacity is too big, truncate with warning. */
@@ -239,7 +239,7 @@ static int virtblk_probe(struct virtio_device *vdev)
239 blk_queue_max_segment_size(vblk->disk->queue, v); 239 blk_queue_max_segment_size(vblk->disk->queue, v);
240 else if (err != -ENOENT) { 240 else if (err != -ENOENT) {
241 dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); 241 dev_err(&vdev->dev, "Bad SIZE_MAX in config\n");
242 goto out_put_disk; 242 goto out_cleanup_queue;
243 } 243 }
244 244
245 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); 245 err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v);
@@ -247,12 +247,14 @@ static int virtblk_probe(struct virtio_device *vdev)
247 blk_queue_max_hw_segments(vblk->disk->queue, v); 247 blk_queue_max_hw_segments(vblk->disk->queue, v);
248 else if (err != -ENOENT) { 248 else if (err != -ENOENT) {
249 dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); 249 dev_err(&vdev->dev, "Bad SEG_MAX in config\n");
250 goto out_put_disk; 250 goto out_cleanup_queue;
251 } 251 }
252 252
253 add_disk(vblk->disk); 253 add_disk(vblk->disk);
254 return 0; 254 return 0;
255 255
256out_cleanup_queue:
257 blk_cleanup_queue(vblk->disk->queue);
256out_put_disk: 258out_put_disk:
257 put_disk(vblk->disk); 259 put_disk(vblk->disk);
258out_unregister_blkdev: 260out_unregister_blkdev:
@@ -277,6 +279,8 @@ static void virtblk_remove(struct virtio_device *vdev)
277 put_disk(vblk->disk); 279 put_disk(vblk->disk);
278 unregister_blkdev(major, "virtblk"); 280 unregister_blkdev(major, "virtblk");
279 mempool_destroy(vblk->pool); 281 mempool_destroy(vblk->pool);
282 /* There should be nothing in the queue now, so no need to shutdown */
283 vdev->config->del_vq(vblk->vq);
280 kfree(vblk); 284 kfree(vblk);
281} 285}
282 286
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index bf18d757b876..a509b8d79781 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -457,7 +457,7 @@ config LEGACY_PTYS
457config LEGACY_PTY_COUNT 457config LEGACY_PTY_COUNT
458 int "Maximum number of legacy PTY in use" 458 int "Maximum number of legacy PTY in use"
459 depends on LEGACY_PTYS 459 depends on LEGACY_PTYS
460 range 1 256 460 range 0 256
461 default "256" 461 default "256"
462 ---help--- 462 ---help---
463 The maximum number of legacy PTYs that can be used at any one time. 463 The maximum number of legacy PTYs that can be used at any one time.
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 877e53dcb996..921c6d2bc8fc 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1163,7 +1163,7 @@ static struct acpi_driver sonypi_acpi_driver = {
1163}; 1163};
1164#endif 1164#endif
1165 1165
1166static int __devinit sonypi_create_input_devices(void) 1166static int __devinit sonypi_create_input_devices(struct platform_device *pdev)
1167{ 1167{
1168 struct input_dev *jog_dev; 1168 struct input_dev *jog_dev;
1169 struct input_dev *key_dev; 1169 struct input_dev *key_dev;
@@ -1177,6 +1177,7 @@ static int __devinit sonypi_create_input_devices(void)
1177 jog_dev->name = "Sony Vaio Jogdial"; 1177 jog_dev->name = "Sony Vaio Jogdial";
1178 jog_dev->id.bustype = BUS_ISA; 1178 jog_dev->id.bustype = BUS_ISA;
1179 jog_dev->id.vendor = PCI_VENDOR_ID_SONY; 1179 jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
1180 jog_dev->dev.parent = &pdev->dev;
1180 1181
1181 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 1182 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
1182 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); 1183 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE);
@@ -1191,6 +1192,7 @@ static int __devinit sonypi_create_input_devices(void)
1191 key_dev->name = "Sony Vaio Keys"; 1192 key_dev->name = "Sony Vaio Keys";
1192 key_dev->id.bustype = BUS_ISA; 1193 key_dev->id.bustype = BUS_ISA;
1193 key_dev->id.vendor = PCI_VENDOR_ID_SONY; 1194 key_dev->id.vendor = PCI_VENDOR_ID_SONY;
1195 key_dev->dev.parent = &pdev->dev;
1194 1196
1195 /* Initialize the Input Drivers: special keys */ 1197 /* Initialize the Input Drivers: special keys */
1196 key_dev->evbit[0] = BIT_MASK(EV_KEY); 1198 key_dev->evbit[0] = BIT_MASK(EV_KEY);
@@ -1385,7 +1387,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1385 1387
1386 if (useinput) { 1388 if (useinput) {
1387 1389
1388 error = sonypi_create_input_devices(); 1390 error = sonypi_create_input_devices(dev);
1389 if (error) { 1391 if (error) {
1390 printk(KERN_ERR 1392 printk(KERN_ERR
1391 "sonypi: failed to create input devices\n"); 1393 "sonypi: failed to create input devices\n");
@@ -1432,7 +1434,7 @@ static int __devexit sonypi_remove(struct platform_device *dev)
1432{ 1434{
1433 sonypi_disable(); 1435 sonypi_disable();
1434 1436
1435 synchronize_sched(); /* Allow sonypi interrupt to complete. */ 1437 synchronize_irq(sonypi_device.irq);
1436 flush_scheduled_work(); 1438 flush_scheduled_work();
1437 1439
1438 if (useinput) { 1440 if (useinput) {
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index fd771a4d6d18..81503d94fecc 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -450,6 +450,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
450 goto out_err; 450 goto out_err;
451 } 451 }
452 452
453 if (request_locality(chip, 0) != 0) {
454 rc = -ENODEV;
455 goto out_err;
456 }
457
453 vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); 458 vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
454 459
455 /* Default timeouts */ 460 /* Default timeouts */
@@ -487,11 +492,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
487 if (intfcaps & TPM_INTF_DATA_AVAIL_INT) 492 if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
488 dev_dbg(dev, "\tData Avail Int Support\n"); 493 dev_dbg(dev, "\tData Avail Int Support\n");
489 494
490 if (request_locality(chip, 0) != 0) {
491 rc = -ENODEV;
492 goto out_err;
493 }
494
495 /* INTERRUPT Setup */ 495 /* INTERRUPT Setup */
496 init_waitqueue_head(&chip->vendor.read_queue); 496 init_waitqueue_head(&chip->vendor.read_queue);
497 init_waitqueue_head(&chip->vendor.int_queue); 497 init_waitqueue_head(&chip->vendor.int_queue);
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 6a7d25fc2470..c46b7c219ee9 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -3,11 +3,13 @@
3# 3#
4 4
5menuconfig DMADEVICES 5menuconfig DMADEVICES
6 bool "DMA Offload Engine support" 6 bool "DMA Engine support"
7 depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX 7 depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX
8 help 8 help
9 Intel(R) offload engines enable offloading memory copies in the 9 DMA engines can do asynchronous data transfers without
10 network stack and RAID operations in the MD driver. 10 involving the host CPU. Currently, this framework can be
11 used to offload memory copies in the network stack and
12 RAID operations in the MD driver.
11 13
12if DMADEVICES 14if DMADEVICES
13 15
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index e445fe6e4ba9..45b22282f149 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -313,7 +313,6 @@ comment "IDE chipset support/bugfixes"
313 313
314config IDE_GENERIC 314config IDE_GENERIC
315 tristate "generic/default IDE chipset support" 315 tristate "generic/default IDE chipset support"
316 default H8300
317 help 316 help
318 If unsure, say N. 317 If unsure, say N.
319 318
@@ -484,6 +483,7 @@ config WDC_ALI15X3
484 483
485config BLK_DEV_AMD74XX 484config BLK_DEV_AMD74XX
486 tristate "AMD and nVidia IDE support" 485 tristate "AMD and nVidia IDE support"
486 depends on !ARM
487 select BLK_DEV_IDEDMA_PCI 487 select BLK_DEV_IDEDMA_PCI
488 help 488 help
489 This driver adds explicit support for AMD-7xx and AMD-8111 chips 489 This driver adds explicit support for AMD-7xx and AMD-8111 chips
@@ -883,6 +883,49 @@ config BLK_DEV_IDE_BAST
883 Say Y here if you want to support the onboard IDE channels on the 883 Say Y here if you want to support the onboard IDE channels on the
884 Simtec BAST or the Thorcom VR1000 884 Simtec BAST or the Thorcom VR1000
885 885
886config ETRAX_IDE
887 bool "ETRAX IDE support"
888 depends on CRIS && BROKEN
889 select BLK_DEV_IDEDMA
890 select IDE_GENERIC
891 help
892 Enables the ETRAX IDE driver.
893
894 You can't use parallel ports or SCSI ports at the same time.
895
896config ETRAX_IDE_DELAY
897 int "Delay for drives to regain consciousness"
898 depends on ETRAX_IDE && ETRAX_ARCH_V10
899 default 15
900 help
901 Number of seconds to wait for IDE drives to spin up after an IDE
902 reset.
903
904choice
905 prompt "IDE reset pin"
906 depends on ETRAX_IDE && ETRAX_ARCH_V10
907 default ETRAX_IDE_PB7_RESET
908
909config ETRAX_IDE_PB7_RESET
910 bool "Port_PB_Bit_7"
911 help
912 IDE reset on pin 7 on port B
913
914config ETRAX_IDE_G27_RESET
915 bool "Port_G_Bit_27"
916 help
917 IDE reset on pin 27 on port G
918
919endchoice
920
921config IDE_H8300
922 bool "H8300 IDE support"
923 depends on H8300
924 select IDE_GENERIC
925 default y
926 help
927 Enables the H8300 IDE driver.
928
886config BLK_DEV_GAYLE 929config BLK_DEV_GAYLE
887 bool "Amiga Gayle IDE interface support" 930 bool "Amiga Gayle IDE interface support"
888 depends on AMIGA 931 depends on AMIGA
@@ -963,7 +1006,7 @@ config BLK_DEV_Q40IDE
963 1006
964config BLK_DEV_MPC8xx_IDE 1007config BLK_DEV_MPC8xx_IDE
965 bool "MPC8xx IDE support" 1008 bool "MPC8xx IDE support"
966 depends on 8xx && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE 1009 depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE
967 select IDE_GENERIC 1010 select IDE_GENERIC
968 help 1011 help
969 This option provides support for IDE on Motorola MPC8xx Systems. 1012 This option provides support for IDE on Motorola MPC8xx Systems.
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 75dc6969e0a7..b181fc672057 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -39,7 +39,7 @@ ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o 39ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
40 40
41# built-in only drivers from h8300/ 41# built-in only drivers from h8300/
42ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o 42ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o
43 43
44obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o 44obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o
45obj-$(CONFIG_IDE_GENERIC) += ide-generic.o 45obj-$(CONFIG_IDE_GENERIC) += ide-generic.o
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 7f5bc2ee6c7e..476e0d65ed43 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -773,15 +773,16 @@ init_e100_ide (void)
773 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ 773 /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */
774 ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0); 774 ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0);
775 775
776 /* first fill in some stuff in the ide_hwifs fields */ 776 for (h = 0; h < 4; h++) {
777 ide_hwif_t *hwif = NULL;
777 778
778 for(h = 0; h < MAX_HWIFS; h++) {
779 ide_hwif_t *hwif = &ide_hwifs[h];
780 ide_setup_ports(&hw, cris_ide_base_address(h), 779 ide_setup_ports(&hw, cris_ide_base_address(h),
781 ide_offsets, 780 ide_offsets,
782 0, 0, cris_ide_ack_intr, 781 0, 0, cris_ide_ack_intr,
783 ide_default_irq(0)); 782 ide_default_irq(0));
784 ide_register_hw(&hw, NULL, 1, &hwif); 783 ide_register_hw(&hw, NULL, 1, &hwif);
784 if (hwif == NULL)
785 continue;
785 hwif->mmio = 1; 786 hwif->mmio = 1;
786 hwif->chipset = ide_etrax100; 787 hwif->chipset = ide_etrax100;
787 hwif->set_pio_mode = &cris_set_pio_mode; 788 hwif->set_pio_mode = &cris_set_pio_mode;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index e3add70b9cd8..0d795a1678c7 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -130,6 +130,7 @@ static const struct drive_list_entry drive_blacklist [] = {
130 { "_NEC DV5800A", NULL }, 130 { "_NEC DV5800A", NULL },
131 { "SAMSUNG CD-ROM SN-124", "N001" }, 131 { "SAMSUNG CD-ROM SN-124", "N001" },
132 { "Seagate STT20000A", NULL }, 132 { "Seagate STT20000A", NULL },
133 { "CD-ROM CDR_U200", "1.09" },
133 { NULL , NULL } 134 { NULL , NULL }
134 135
135}; 136};
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index e17a9ee120ea..5c3256180ae5 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -303,9 +303,6 @@ void default_hwif_transport(ide_hwif_t *hwif)
303 hwif->atapi_output_bytes = atapi_output_bytes; 303 hwif->atapi_output_bytes = atapi_output_bytes;
304} 304}
305 305
306/*
307 * Beginning of Taskfile OPCODE Library and feature sets.
308 */
309void ide_fix_driveid (struct hd_driveid *id) 306void ide_fix_driveid (struct hd_driveid *id)
310{ 307{
311#ifndef __LITTLE_ENDIAN 308#ifndef __LITTLE_ENDIAN
@@ -592,6 +589,9 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list);
592static const struct drive_list_entry ivb_list[] = { 589static const struct drive_list_entry ivb_list[] = {
593 { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, 590 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
594 { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, 591 { "TSSTcorp CDDVDW SH-S202J" , "SB00" },
592 { "TSSTcorp CDDVDW SH-S202J" , "SB01" },
593 { "TSSTcorp CDDVDW SH-S202N" , "SB00" },
594 { "TSSTcorp CDDVDW SH-S202N" , "SB01" },
595 { NULL , NULL } 595 { NULL , NULL }
596}; 596};
597 597
@@ -756,7 +756,7 @@ int ide_driveid_update(ide_drive_t *drive)
756int ide_config_drive_speed(ide_drive_t *drive, u8 speed) 756int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
757{ 757{
758 ide_hwif_t *hwif = drive->hwif; 758 ide_hwif_t *hwif = drive->hwif;
759 int error; 759 int error = 0;
760 u8 stat; 760 u8 stat;
761 761
762// while (HWGROUP(drive)->busy) 762// while (HWGROUP(drive)->busy)
@@ -767,6 +767,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
767 hwif->dma_host_off(drive); 767 hwif->dma_host_off(drive);
768#endif 768#endif
769 769
770 /* Skip setting PIO flow-control modes on pre-EIDE drives */
771 if ((speed & 0xf8) == XFER_PIO_0 && !(drive->id->capability & 0x08))
772 goto skip;
773
770 /* 774 /*
771 * Don't use ide_wait_cmd here - it will 775 * Don't use ide_wait_cmd here - it will
772 * attempt to set_geometry and recalibrate, 776 * attempt to set_geometry and recalibrate,
@@ -814,6 +818,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
814 drive->id->dma_mword &= ~0x0F00; 818 drive->id->dma_mword &= ~0x0F00;
815 drive->id->dma_1word &= ~0x0F00; 819 drive->id->dma_1word &= ~0x0F00;
816 820
821 skip:
817#ifdef CONFIG_BLK_DEV_IDEDMA 822#ifdef CONFIG_BLK_DEV_IDEDMA
818 if (speed >= XFER_SW_DMA_0) 823 if (speed >= XFER_SW_DMA_0)
819 hwif->dma_host_on(drive); 824 hwif->dma_host_on(drive);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 56fb0b843429..ee848c705995 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -644,7 +644,7 @@ static void hwif_register (ide_hwif_t *hwif)
644 644
645static int wait_hwif_ready(ide_hwif_t *hwif) 645static int wait_hwif_ready(ide_hwif_t *hwif)
646{ 646{
647 int rc; 647 int unit, rc;
648 648
649 printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); 649 printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);
650 650
@@ -661,20 +661,26 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
661 return rc; 661 return rc;
662 662
663 /* Now make sure both master & slave are ready */ 663 /* Now make sure both master & slave are ready */
664 SELECT_DRIVE(&hwif->drives[0]); 664 for (unit = 0; unit < MAX_DRIVES; unit++) {
665 hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); 665 ide_drive_t *drive = &hwif->drives[unit];
666 mdelay(2);
667 rc = ide_wait_not_busy(hwif, 35000);
668 if (rc)
669 return rc;
670 SELECT_DRIVE(&hwif->drives[1]);
671 hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
672 mdelay(2);
673 rc = ide_wait_not_busy(hwif, 35000);
674 666
667 /* Ignore disks that we will not probe for later. */
668 if (!drive->noprobe || drive->present) {
669 SELECT_DRIVE(drive);
670 hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
671 mdelay(2);
672 rc = ide_wait_not_busy(hwif, 35000);
673 if (rc)
674 goto out;
675 } else
676 printk(KERN_DEBUG "%s: ide_wait_not_busy() skipped\n",
677 drive->name);
678 }
679out:
675 /* Exit function with master reselected (let's be sane) */ 680 /* Exit function with master reselected (let's be sane) */
676 SELECT_DRIVE(&hwif->drives[0]); 681 if (unit)
677 682 SELECT_DRIVE(&hwif->drives[0]);
683
678 return rc; 684 return rc;
679} 685}
680 686
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 10311ecc674a..38c3a6d63f30 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -53,12 +53,13 @@
53 53
54/* port addresses for auto-detection */ 54/* port addresses for auto-detection */
55#define ALI_NUM_PORTS 4 55#define ALI_NUM_PORTS 4
56static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4}; 56static const int ports[ALI_NUM_PORTS] __initdata =
57 { 0x074, 0x0f4, 0x034, 0x0e4 };
57 58
58/* register initialization data */ 59/* register initialization data */
59typedef struct { u8 reg, data; } RegInitializer; 60typedef struct { u8 reg, data; } RegInitializer;
60 61
61static RegInitializer initData[] __initdata = { 62static const RegInitializer initData[] __initdata = {
62 {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00}, 63 {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00},
63 {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f}, 64 {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f},
64 {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00}, 65 {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00},
@@ -177,7 +178,7 @@ static int __init findPort (void)
177 * Initialize controller registers with default values. 178 * Initialize controller registers with default values.
178 */ 179 */
179static int __init initRegisters (void) { 180static int __init initRegisters (void) {
180 RegInitializer *p; 181 const RegInitializer *p;
181 u8 t; 182 u8 t;
182 unsigned long flags; 183 unsigned long flags;
183 184
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index e87cd2f16430..5c6aa77c2370 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -81,7 +81,7 @@ int macide_ack_intr(ide_hwif_t* hwif)
81 * Probe for a Macintosh IDE interface 81 * Probe for a Macintosh IDE interface
82 */ 82 */
83 83
84void macide_init(void) 84void __init macide_init(void)
85{ 85{
86 hw_regs_t hw; 86 hw_regs_t hw;
87 ide_hwif_t *hwif; 87 ide_hwif_t *hwif;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index a73db1bd482d..6ea46a6723e2 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -111,7 +111,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
111 * Probe for Q40 IDE interfaces 111 * Probe for Q40 IDE interfaces
112 */ 112 */
113 113
114void q40ide_init(void) 114void __init q40ide_init(void)
115{ 115{
116 int i; 116 int i;
117 ide_hwif_t *hwif; 117 ide_hwif_t *hwif;
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 19ec421f7b9f..44268504ae43 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -260,6 +260,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
260{ 260{
261 struct ide_port_info d; 261 struct ide_port_info d;
262 u8 idx = id->driver_data; 262 u8 idx = id->driver_data;
263 int err;
264
265 err = pci_enable_device(dev);
266 if (err)
267 return err;
263 268
264 d = aec62xx_chipsets[idx]; 269 d = aec62xx_chipsets[idx];
265 270
@@ -272,7 +277,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
272 } 277 }
273 } 278 }
274 279
275 return ide_setup_pci_device(dev, &d); 280 err = ide_setup_pci_device(dev, &d);
281 if (err)
282 pci_disable_device(dev);
283
284 return err;
276} 285}
277 286
278static const struct pci_device_id aec62xx_pci_tbl[] = { 287static const struct pci_device_id aec62xx_pci_tbl[] = {
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index a607dd31a64c..ce293936af4b 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -603,6 +603,11 @@ static int ali_cable_override(struct pci_dev *pdev)
603 pdev->subsystem_device == 0x10AF) 603 pdev->subsystem_device == 0x10AF)
604 return 1; 604 return 1;
605 605
606 /* Mitac 8317 (Winbook-A) and relatives */
607 if (pdev->subsystem_vendor == 0x1071 &&
608 pdev->subsystem_device == 0x8317)
609 return 1;
610
606 /* Systems by DMI */ 611 /* Systems by DMI */
607 if (dmi_check_system(cable_dmi_table)) 612 if (dmi_check_system(cable_dmi_table))
608 return 1; 613 return 1;
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 63625a0be712..27781d294cea 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -306,6 +306,7 @@ static const struct ich_laptop ich_laptop[] = {
306 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 306 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
307 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 307 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
308 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 308 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
309 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */
309 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ 310 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */
310 /* end marker */ 311 /* end marker */
311 { 0, } 312 { 0, }
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 6d99441c605b..5709c252543b 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 2 * linux/drivers/ide/pci/siimage.c Version 1.19 Nov 16 2007
3 * 3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
@@ -460,48 +460,6 @@ static void sil_sata_pre_reset(ide_drive_t *drive)
460} 460}
461 461
462/** 462/**
463 * siimage_reset - reset a device on an siimage controller
464 * @drive: drive to reset
465 *
466 * Perform a controller level reset fo the device. For
467 * SATA we must also check the PHY.
468 */
469
470static void siimage_reset (ide_drive_t *drive)
471{
472 ide_hwif_t *hwif = HWIF(drive);
473 u8 reset = 0;
474 unsigned long addr = siimage_selreg(hwif, 0);
475
476 if (hwif->mmio) {
477 reset = hwif->INB(addr);
478 hwif->OUTB((reset|0x03), addr);
479 /* FIXME:posting */
480 udelay(25);
481 hwif->OUTB(reset, addr);
482 (void) hwif->INB(addr);
483 } else {
484 pci_read_config_byte(hwif->pci_dev, addr, &reset);
485 pci_write_config_byte(hwif->pci_dev, addr, reset|0x03);
486 udelay(25);
487 pci_write_config_byte(hwif->pci_dev, addr, reset);
488 pci_read_config_byte(hwif->pci_dev, addr, &reset);
489 }
490
491 if (SATA_STATUS_REG) {
492 /* SATA_STATUS_REG is valid only when in MMIO mode */
493 u32 sata_stat = readl((void __iomem *)SATA_STATUS_REG);
494 printk(KERN_WARNING "%s: reset phy, status=0x%08x, %s\n",
495 hwif->name, sata_stat, __FUNCTION__);
496 if (!(sata_stat)) {
497 printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
498 hwif->name, sata_stat);
499 drive->failures++;
500 }
501 }
502}
503
504/**
505 * proc_reports_siimage - add siimage controller to proc 463 * proc_reports_siimage - add siimage controller to proc
506 * @dev: PCI device 464 * @dev: PCI device
507 * @clocking: SCSC value 465 * @clocking: SCSC value
@@ -857,7 +815,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
857{ 815{
858 u8 sata = is_sata(hwif); 816 u8 sata = is_sata(hwif);
859 817
860 hwif->resetproc = &siimage_reset;
861 hwif->set_pio_mode = &sil_set_pio_mode; 818 hwif->set_pio_mode = &sil_set_pio_mode;
862 hwif->set_dma_mode = &sil_set_dma_mode; 819 hwif->set_dma_mode = &sil_set_dma_mode;
863 820
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index f6e2ab3dd166..d90b42917775 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -526,6 +526,7 @@ static const struct sis_laptop sis_laptop[] = {
526 /* devid, subvendor, subdev */ 526 /* devid, subvendor, subdev */
527 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 527 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
528 { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ 528 { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */
529 { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */
529 /* end marker */ 530 /* end marker */
530 { 0, } 531 { 0, }
531}; 532};
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 5011ba22e36c..0895e753a35d 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -240,9 +240,6 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
240 return (status == 0x00ff); 240 return (status == 0x00ff);
241} 241}
242 242
243/*
244 * Invoked from ide-dma.c at boot time.
245 */
246static void __devinit init_hwif_trm290(ide_hwif_t *hwif) 243static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
247{ 244{
248 unsigned int cfgbase = 0; 245 unsigned int cfgbase = 0;
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 5afdfef7264c..7f7a59885777 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1513,7 +1513,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
1513 1513
1514 if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) { 1514 if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) {
1515 if (pmif->broken_dma_warn == 0) { 1515 if (pmif->broken_dma_warn == 0) {
1516 printk(KERN_WARNING "%s: DMA on non aligned address," 1516 printk(KERN_WARNING "%s: DMA on non aligned address, "
1517 "switching to PIO on Ohare chipset\n", drive->name); 1517 "switching to PIO on Ohare chipset\n", drive->name);
1518 pmif->broken_dma_warn = 1; 1518 pmif->broken_dma_warn = 1;
1519 } 1519 }
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c
index 453eb995c1d4..f7782c882ab4 100644
--- a/drivers/infiniband/hw/ehca/ehca_av.c
+++ b/drivers/infiniband/hw/ehca/ehca_av.c
@@ -76,8 +76,12 @@ int ehca_calc_ipd(struct ehca_shca *shca, int port,
76 76
77 link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; 77 link = ib_width_enum_to_int(pa.active_width) * pa.active_speed;
78 78
79 /* IPD = round((link / path) - 1) */ 79 if (path >= link)
80 *ipd = ((link + (path >> 1)) / path) - 1; 80 /* no need to throttle if path faster than link */
81 *ipd = 0;
82 else
83 /* IPD = round((link / path) - 1) */
84 *ipd = ((link + (path >> 1)) / path) - 1;
81 85
82 return 0; 86 return 0;
83} 87}
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 2e3e6547cb78..dd126681fed0 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -1203,7 +1203,7 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1203 mqpcb->service_level = attr->ah_attr.sl; 1203 mqpcb->service_level = attr->ah_attr.sl;
1204 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); 1204 update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1);
1205 1205
1206 if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, 1206 if (ehca_calc_ipd(shca, mqpcb->prim_phys_port,
1207 attr->ah_attr.static_rate, 1207 attr->ah_attr.static_rate,
1208 &mqpcb->max_static_rate)) { 1208 &mqpcb->max_static_rate)) {
1209 ret = -EINVAL; 1209 ret = -EINVAL;
@@ -1302,7 +1302,7 @@ static int internal_modify_qp(struct ib_qp *ibqp,
1302 mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; 1302 mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits;
1303 mqpcb->service_level_al = attr->alt_ah_attr.sl; 1303 mqpcb->service_level_al = attr->alt_ah_attr.sl;
1304 1304
1305 if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, 1305 if (ehca_calc_ipd(shca, mqpcb->alt_phys_port,
1306 attr->alt_ah_attr.static_rate, 1306 attr->alt_ah_attr.static_rate,
1307 &mqpcb->max_static_rate_al)) { 1307 &mqpcb->max_static_rate_al)) {
1308 ret = -EINVAL; 1308 ret = -EINVAL;
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c
index 08d8ae148cd0..d1380c7a1703 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -395,12 +395,9 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
395 goto bail; 395 goto bail;
396 } 396 }
397 397
398 /* 398 /* Check that we can write the offset to mmap. */
399 * Return the address of the WC as the offset to mmap.
400 * See ipath_mmap() for details.
401 */
402 if (udata && udata->outlen >= sizeof(__u64)) { 399 if (udata && udata->outlen >= sizeof(__u64)) {
403 __u64 offset = (__u64) wc; 400 __u64 offset = 0;
404 401
405 ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); 402 ret = ib_copy_to_udata(udata, &offset, sizeof(offset));
406 if (ret) 403 if (ret)
@@ -450,6 +447,18 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
450 struct ipath_mmap_info *ip = cq->ip; 447 struct ipath_mmap_info *ip = cq->ip;
451 448
452 ipath_update_mmap_info(dev, ip, sz, wc); 449 ipath_update_mmap_info(dev, ip, sz, wc);
450
451 /*
452 * Return the offset to mmap.
453 * See ipath_mmap() for details.
454 */
455 if (udata && udata->outlen >= sizeof(__u64)) {
456 ret = ib_copy_to_udata(udata, &ip->offset,
457 sizeof(ip->offset));
458 if (ret)
459 goto bail;
460 }
461
453 spin_lock_irq(&dev->pending_lock); 462 spin_lock_irq(&dev->pending_lock);
454 if (list_empty(&ip->pending_mmaps)) 463 if (list_empty(&ip->pending_mmaps))
455 list_add(&ip->pending_mmaps, &dev->pending_mmaps); 464 list_add(&ip->pending_mmaps, &dev->pending_mmaps);
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 6a41fdbc8e57..b997ff88401b 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -835,7 +835,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
835 init_attr->qp_type); 835 init_attr->qp_type);
836 if (err) { 836 if (err) {
837 ret = ERR_PTR(err); 837 ret = ERR_PTR(err);
838 goto bail_rwq; 838 vfree(qp->r_rq.wq);
839 goto bail_qp;
839 } 840 }
840 qp->ip = NULL; 841 qp->ip = NULL;
841 ipath_reset_qp(qp); 842 ipath_reset_qp(qp);
@@ -863,7 +864,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
863 sizeof(offset)); 864 sizeof(offset));
864 if (err) { 865 if (err) {
865 ret = ERR_PTR(err); 866 ret = ERR_PTR(err);
866 goto bail_rwq; 867 goto bail_ip;
867 } 868 }
868 } else { 869 } else {
869 u32 s = sizeof(struct ipath_rwq) + 870 u32 s = sizeof(struct ipath_rwq) +
@@ -875,7 +876,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
875 qp->r_rq.wq); 876 qp->r_rq.wq);
876 if (!qp->ip) { 877 if (!qp->ip) {
877 ret = ERR_PTR(-ENOMEM); 878 ret = ERR_PTR(-ENOMEM);
878 goto bail_rwq; 879 goto bail_ip;
879 } 880 }
880 881
881 err = ib_copy_to_udata(udata, &(qp->ip->offset), 882 err = ib_copy_to_udata(udata, &(qp->ip->offset),
@@ -907,9 +908,11 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
907 goto bail; 908 goto bail;
908 909
909bail_ip: 910bail_ip:
910 kfree(qp->ip); 911 if (qp->ip)
911bail_rwq: 912 kref_put(&qp->ip->ref, ipath_release_mmap_info);
912 vfree(qp->r_rq.wq); 913 else
914 vfree(qp->r_rq.wq);
915 ipath_free_qp(&dev->qp_table, qp);
913bail_qp: 916bail_qp:
914 kfree(qp); 917 kfree(qp);
915bail_swq: 918bail_swq:
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c
index 40c36ec19016..2fef36f4b675 100644
--- a/drivers/infiniband/hw/ipath/ipath_srq.c
+++ b/drivers/infiniband/hw/ipath/ipath_srq.c
@@ -59,7 +59,7 @@ int ipath_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
59 59
60 if ((unsigned) wr->num_sge > srq->rq.max_sge) { 60 if ((unsigned) wr->num_sge > srq->rq.max_sge) {
61 *bad_wr = wr; 61 *bad_wr = wr;
62 ret = -ENOMEM; 62 ret = -EINVAL;
63 goto bail; 63 goto bail;
64 } 64 }
65 65
@@ -211,11 +211,11 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
211 struct ib_udata *udata) 211 struct ib_udata *udata)
212{ 212{
213 struct ipath_srq *srq = to_isrq(ibsrq); 213 struct ipath_srq *srq = to_isrq(ibsrq);
214 struct ipath_rwq *wq;
214 int ret = 0; 215 int ret = 0;
215 216
216 if (attr_mask & IB_SRQ_MAX_WR) { 217 if (attr_mask & IB_SRQ_MAX_WR) {
217 struct ipath_rwq *owq; 218 struct ipath_rwq *owq;
218 struct ipath_rwq *wq;
219 struct ipath_rwqe *p; 219 struct ipath_rwqe *p;
220 u32 sz, size, n, head, tail; 220 u32 sz, size, n, head, tail;
221 221
@@ -236,27 +236,20 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
236 goto bail; 236 goto bail;
237 } 237 }
238 238
239 /* 239 /* Check that we can write the offset to mmap. */
240 * Return the address of the RWQ as the offset to mmap.
241 * See ipath_mmap() for details.
242 */
243 if (udata && udata->inlen >= sizeof(__u64)) { 240 if (udata && udata->inlen >= sizeof(__u64)) {
244 __u64 offset_addr; 241 __u64 offset_addr;
245 __u64 offset = (__u64) wq; 242 __u64 offset = 0;
246 243
247 ret = ib_copy_from_udata(&offset_addr, udata, 244 ret = ib_copy_from_udata(&offset_addr, udata,
248 sizeof(offset_addr)); 245 sizeof(offset_addr));
249 if (ret) { 246 if (ret)
250 vfree(wq); 247 goto bail_free;
251 goto bail;
252 }
253 udata->outbuf = (void __user *) offset_addr; 248 udata->outbuf = (void __user *) offset_addr;
254 ret = ib_copy_to_udata(udata, &offset, 249 ret = ib_copy_to_udata(udata, &offset,
255 sizeof(offset)); 250 sizeof(offset));
256 if (ret) { 251 if (ret)
257 vfree(wq); 252 goto bail_free;
258 goto bail;
259 }
260 } 253 }
261 254
262 spin_lock_irq(&srq->rq.lock); 255 spin_lock_irq(&srq->rq.lock);
@@ -277,10 +270,8 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
277 else 270 else
278 n -= tail; 271 n -= tail;
279 if (size <= n) { 272 if (size <= n) {
280 spin_unlock_irq(&srq->rq.lock);
281 vfree(wq);
282 ret = -EINVAL; 273 ret = -EINVAL;
283 goto bail; 274 goto bail_unlock;
284 } 275 }
285 n = 0; 276 n = 0;
286 p = wq->wq; 277 p = wq->wq;
@@ -314,6 +305,18 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
314 u32 s = sizeof(struct ipath_rwq) + size * sz; 305 u32 s = sizeof(struct ipath_rwq) + size * sz;
315 306
316 ipath_update_mmap_info(dev, ip, s, wq); 307 ipath_update_mmap_info(dev, ip, s, wq);
308
309 /*
310 * Return the offset to mmap.
311 * See ipath_mmap() for details.
312 */
313 if (udata && udata->inlen >= sizeof(__u64)) {
314 ret = ib_copy_to_udata(udata, &ip->offset,
315 sizeof(ip->offset));
316 if (ret)
317 goto bail;
318 }
319
317 spin_lock_irq(&dev->pending_lock); 320 spin_lock_irq(&dev->pending_lock);
318 if (list_empty(&ip->pending_mmaps)) 321 if (list_empty(&ip->pending_mmaps))
319 list_add(&ip->pending_mmaps, 322 list_add(&ip->pending_mmaps,
@@ -328,7 +331,12 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
328 srq->limit = attr->srq_limit; 331 srq->limit = attr->srq_limit;
329 spin_unlock_irq(&srq->rq.lock); 332 spin_unlock_irq(&srq->rq.lock);
330 } 333 }
334 goto bail;
331 335
336bail_unlock:
337 spin_unlock_irq(&srq->rq.lock);
338bail_free:
339 vfree(wq);
332bail: 340bail:
333 return ret; 341 return ret;
334} 342}
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 74f77e7c2c1b..c4c998446c7b 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -302,8 +302,10 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr)
302 next = qp->s_head + 1; 302 next = qp->s_head + 1;
303 if (next >= qp->s_size) 303 if (next >= qp->s_size)
304 next = 0; 304 next = 0;
305 if (next == qp->s_last) 305 if (next == qp->s_last) {
306 goto bail_inval; 306 ret = -ENOMEM;
307 goto bail;
308 }
307 309
308 wqe = get_swqe_ptr(qp, qp->s_head); 310 wqe = get_swqe_ptr(qp, qp->s_head);
309 wqe->wr = *wr; 311 wqe->wr = *wr;
@@ -404,7 +406,7 @@ static int ipath_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
404 406
405 if ((unsigned) wr->num_sge > qp->r_rq.max_sge) { 407 if ((unsigned) wr->num_sge > qp->r_rq.max_sge) {
406 *bad_wr = wr; 408 *bad_wr = wr;
407 ret = -ENOMEM; 409 ret = -EINVAL;
408 goto bail; 410 goto bail;
409 } 411 }
410 412
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index a03a65ebcf0c..c9f6077b615e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -460,6 +460,9 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
460 struct ipoib_dev_priv *priv = netdev_priv(dev); 460 struct ipoib_dev_priv *priv = netdev_priv(dev);
461 struct ipoib_path *path; 461 struct ipoib_path *path;
462 462
463 if (!priv->broadcast)
464 return NULL;
465
463 path = kzalloc(sizeof *path, GFP_ATOMIC); 466 path = kzalloc(sizeof *path, GFP_ATOMIC);
464 if (!path) 467 if (!path)
465 return NULL; 468 return NULL;
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index d68798061795..4a17743a639f 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -310,13 +310,15 @@ static unsigned int iser_data_buf_aligned_len(struct iser_data_buf *data,
310 if (i + 1 < data->dma_nents) { 310 if (i + 1 < data->dma_nents) {
311 next_addr = ib_sg_dma_address(ibdev, sg_next(sg)); 311 next_addr = ib_sg_dma_address(ibdev, sg_next(sg));
312 /* are i, i+1 fragments of the same page? */ 312 /* are i, i+1 fragments of the same page? */
313 if (end_addr == next_addr) 313 if (end_addr == next_addr) {
314 cnt++;
314 continue; 315 continue;
315 else if (!IS_4K_ALIGNED(end_addr)) { 316 } else if (!IS_4K_ALIGNED(end_addr)) {
316 ret_len = cnt + 1; 317 ret_len = cnt + 1;
317 break; 318 break;
318 } 319 }
319 } 320 }
321 cnt++;
320 } 322 }
321 if (i == data->dma_nents) 323 if (i == data->dma_nents)
322 ret_len = cnt; /* loop ended */ 324 ret_len = cnt; /* loop ended */
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 2316a018fae6..dfa6592c10f6 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -286,7 +286,7 @@ config KEYBOARD_MAPLE
286 286
287config KEYBOARD_BFIN 287config KEYBOARD_BFIN
288 tristate "Blackfin BF54x keypad support" 288 tristate "Blackfin BF54x keypad support"
289 depends on BF54x 289 depends on (BF54x && !BF544)
290 help 290 help
291 Say Y here if you want to use the BF54x keypad. 291 Say Y here if you want to use the BF54x keypad.
292 292
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 3eddf52a0bba..6a9ca4bdcb74 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -75,16 +75,32 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
75 75
76 for (i = 0; i < pdata->nbuttons; i++) { 76 for (i = 0; i < pdata->nbuttons; i++) {
77 struct gpio_keys_button *button = &pdata->buttons[i]; 77 struct gpio_keys_button *button = &pdata->buttons[i];
78 int irq = gpio_to_irq(button->gpio); 78 int irq;
79 unsigned int type = button->type ?: EV_KEY; 79 unsigned int type = button->type ?: EV_KEY;
80 80
81 error = gpio_request(button->gpio, button->desc ?: "gpio_keys");
82 if (error < 0) {
83 pr_err("gpio-keys: failed to request GPIO %d,"
84 " error %d\n", button->gpio, error);
85 goto fail;
86 }
87
88 error = gpio_direction_input(button->gpio);
89 if (error < 0) {
90 pr_err("gpio-keys: failed to configure input"
91 " direction for GPIO %d, error %d\n",
92 button->gpio, error);
93 gpio_free(button->gpio);
94 goto fail;
95 }
96
97 irq = gpio_to_irq(button->gpio);
81 if (irq < 0) { 98 if (irq < 0) {
82 error = irq; 99 error = irq;
83 printk(KERN_ERR 100 pr_err("gpio-keys: Unable to get irq number"
84 "gpio-keys: " 101 " for GPIO %d, error %d\n",
85 "Unable to get irq number for GPIO %d,"
86 "error %d\n",
87 button->gpio, error); 102 button->gpio, error);
103 gpio_free(button->gpio);
88 goto fail; 104 goto fail;
89 } 105 }
90 106
@@ -94,9 +110,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
94 button->desc ? button->desc : "gpio_keys", 110 button->desc ? button->desc : "gpio_keys",
95 pdev); 111 pdev);
96 if (error) { 112 if (error) {
97 printk(KERN_ERR 113 pr_err("gpio-keys: Unable to claim irq %d; error %d\n",
98 "gpio-keys: Unable to claim irq %d; error %d\n",
99 irq, error); 114 irq, error);
115 gpio_free(button->gpio);
100 goto fail; 116 goto fail;
101 } 117 }
102 118
@@ -108,8 +124,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
108 124
109 error = input_register_device(input); 125 error = input_register_device(input);
110 if (error) { 126 if (error) {
111 printk(KERN_ERR 127 pr_err("gpio-keys: Unable to register input device, "
112 "gpio-keys: Unable to register input device, "
113 "error: %d\n", error); 128 "error: %d\n", error);
114 goto fail; 129 goto fail;
115 } 130 }
@@ -119,8 +134,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
119 return 0; 134 return 0;
120 135
121 fail: 136 fail:
122 while (--i >= 0) 137 while (--i >= 0) {
123 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); 138 free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev);
139 gpio_free(pdata->buttons[i].gpio);
140 }
124 141
125 platform_set_drvdata(pdev, NULL); 142 platform_set_drvdata(pdev, NULL);
126 input_free_device(input); 143 input_free_device(input);
@@ -139,6 +156,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
139 for (i = 0; i < pdata->nbuttons; i++) { 156 for (i = 0; i < pdata->nbuttons; i++) {
140 int irq = gpio_to_irq(pdata->buttons[i].gpio); 157 int irq = gpio_to_irq(pdata->buttons[i].gpio);
141 free_irq(irq, pdev); 158 free_irq(irq, pdev);
159 gpio_free(pdata->buttons[i].gpio);
142 } 160 }
143 161
144 input_unregister_device(input); 162 input_unregister_device(input);
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 5ce632ca6815..b88569e21d60 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -21,7 +21,7 @@ if SERIO
21config SERIO_I8042 21config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BFIN 24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BLACKFIN
25 ---help--- 25 ---help---
26 i8042 is the chip over which the standard AT keyboard and PS/2 26 i8042 is the chip over which the standard AT keyboard and PS/2
27 mouse are connected to the computer. If you use these devices, 27 mouse are connected to the computer. If you use these devices,
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index f8fe42148093..c5e68dcd88ac 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -110,6 +110,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
110 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), 110 DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
111 }, 111 },
112 }, 112 },
113 {
114 .ident = "Microsoft Virtual Machine",
115 .matches = {
116 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
117 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
118 DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
119 },
120 },
113 { } 121 { }
114}; 122};
115 123
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c
index 57670dc5034d..909d6709ec16 100644
--- a/drivers/isdn/hisax/hfcscard.c
+++ b/drivers/isdn/hisax/hfcscard.c
@@ -118,8 +118,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg)
118 return(0); 118 return(0);
119 case CARD_INIT: 119 case CARD_INIT:
120 delay = (75*HZ)/100 +1; 120 delay = (75*HZ)/100 +1;
121 cs->hw.hfcD.timer.expires = jiffies + delay; 121 mod_timer(&cs->hw.hfcD.timer, jiffies + delay);
122 add_timer(&cs->hw.hfcD.timer);
123 spin_lock_irqsave(&cs->lock, flags); 122 spin_lock_irqsave(&cs->lock, flags);
124 reset_hfcs(cs); 123 reset_hfcs(cs);
125 init2bds0(cs); 124 init2bds0(cs);
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index b39d1f5b378e..ced83c202cac 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -2104,7 +2104,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2104 u_long flags; 2104 u_long flags;
2105 isdn_net_dev *p; 2105 isdn_net_dev *p;
2106 isdn_net_phone *n; 2106 isdn_net_phone *n;
2107 char nr[32]; 2107 char nr[ISDN_MSNLEN];
2108 char *my_eaz; 2108 char *my_eaz;
2109 2109
2110 /* Search name in netdev-chain */ 2110 /* Search name in netdev-chain */
@@ -2113,7 +2113,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2113 nr[1] = '\0'; 2113 nr[1] = '\0';
2114 printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n"); 2114 printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n");
2115 } else 2115 } else
2116 strcpy(nr, setup->phone); 2116 strlcpy(nr, setup->phone, ISDN_MSNLEN);
2117 si1 = (int) setup->si1; 2117 si1 = (int) setup->si1;
2118 si2 = (int) setup->si2; 2118 si2 = (int) setup->si2;
2119 if (!setup->eazmsn[0]) { 2119 if (!setup->eazmsn[0]) {
@@ -2789,7 +2789,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2789 chidx = -1; 2789 chidx = -1;
2790 } 2790 }
2791 } 2791 }
2792 strcpy(lp->msn, cfg->eaz); 2792 strlcpy(lp->msn, cfg->eaz, sizeof(lp->msn));
2793 lp->pre_device = drvidx; 2793 lp->pre_device = drvidx;
2794 lp->pre_channel = chidx; 2794 lp->pre_channel = chidx;
2795 lp->onhtime = cfg->onhtime; 2795 lp->onhtime = cfg->onhtime;
@@ -2936,7 +2936,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone)
2936 if (p) { 2936 if (p) {
2937 if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) 2937 if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL)))
2938 return -ENOMEM; 2938 return -ENOMEM;
2939 strcpy(n->num, phone->phone); 2939 strlcpy(n->num, phone->phone, sizeof(n->num));
2940 n->next = p->local->phone[phone->outgoing & 1]; 2940 n->next = p->local->phone[phone->outgoing & 1];
2941 p->local->phone[phone->outgoing & 1] = n; 2941 p->local->phone[phone->outgoing & 1] = n;
2942 return 0; 2942 return 0;
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 07ae280e8fe5..47c10b8f89b3 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1188,8 +1188,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
1188 1188
1189int emulate_clts(struct kvm_vcpu *vcpu) 1189int emulate_clts(struct kvm_vcpu *vcpu)
1190{ 1190{
1191 vcpu->cr0 &= ~X86_CR0_TS; 1191 kvm_x86_ops->set_cr0(vcpu, vcpu->cr0 & ~X86_CR0_TS);
1192 kvm_x86_ops->set_cr0(vcpu, vcpu->cr0);
1193 return X86EMUL_CONTINUE; 1192 return X86EMUL_CONTINUE;
1194} 1193}
1195 1194
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 7a6eead63a6b..4e04e49a2f1c 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -663,6 +663,7 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
663 wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); 663 wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]);
664 664
665 rdtscll(vcpu->host_tsc); 665 rdtscll(vcpu->host_tsc);
666 kvm_put_guest_fpu(vcpu);
666} 667}
667 668
668static void svm_vcpu_decache(struct kvm_vcpu *vcpu) 669static void svm_vcpu_decache(struct kvm_vcpu *vcpu)
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 33b181451557..bd46de6bf891 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -448,8 +448,7 @@ struct operand {
448 448
449#define JMP_REL(rel) \ 449#define JMP_REL(rel) \
450 do { \ 450 do { \
451 _eip += (int)(rel); \ 451 register_address_increment(_eip, rel); \
452 _eip = ((op_bytes == 2) ? (uint16_t)_eip : (uint32_t)_eip); \
453 } while (0) 452 } while (0)
454 453
455/* 454/*
@@ -1147,7 +1146,7 @@ done_prefixes:
1147 } 1146 }
1148 register_address_increment(_regs[VCPU_REGS_RSP], 1147 register_address_increment(_regs[VCPU_REGS_RSP],
1149 -dst.bytes); 1148 -dst.bytes);
1150 if ((rc = ops->write_std( 1149 if ((rc = ops->write_emulated(
1151 register_address(ctxt->ss_base, 1150 register_address(ctxt->ss_base,
1152 _regs[VCPU_REGS_RSP]), 1151 _regs[VCPU_REGS_RSP]),
1153 &dst.val, dst.bytes, ctxt->vcpu)) != 0) 1152 &dst.val, dst.bytes, ctxt->vcpu)) != 0)
@@ -1359,6 +1358,7 @@ special_insn:
1359 } 1358 }
1360 src.val = (unsigned long) _eip; 1359 src.val = (unsigned long) _eip;
1361 JMP_REL(rel); 1360 JMP_REL(rel);
1361 op_bytes = ad_bytes;
1362 goto push; 1362 goto push;
1363 } 1363 }
1364 case 0xe9: /* jmp rel */ 1364 case 0xe9: /* jmp rel */
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 66f38722253a..e2eec38c83c2 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -247,6 +247,8 @@ static void lg_del_vq(struct virtqueue *vq)
247{ 247{
248 struct lguest_vq_info *lvq = vq->priv; 248 struct lguest_vq_info *lvq = vq->priv;
249 249
250 /* Release the interrupt */
251 free_irq(lvq->config.irq, vq);
250 /* Tell virtio_ring.c to free the virtqueue. */ 252 /* Tell virtio_ring.c to free the virtqueue. */
251 vring_del_virtqueue(vq); 253 vring_del_virtqueue(vq);
252 /* Unmap the pages containing the ring. */ 254 /* Unmap the pages containing the ring. */
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 8135e4c3bf47..afd82966f9a0 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -156,7 +156,7 @@ static void sm501_dump_clk(struct sm501_devdata *sm)
156 156
157 dev_dbg(sm->dev, "PM0[%c]: " 157 dev_dbg(sm->dev, "PM0[%c]: "
158 "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " 158 "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), "
159x "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", 159 "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n",
160 (pmc & 3 ) == 0 ? '*' : '-', 160 (pmc & 3 ) == 0 ? '*' : '-',
161 fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), 161 fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)),
162 fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), 162 fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)),
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index bb13858f60a1..b0f68031b49d 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -338,7 +338,7 @@ static void sony_laptop_report_input_event(u8 event)
338 dprintk("unknown input event %.2x\n", event); 338 dprintk("unknown input event %.2x\n", event);
339} 339}
340 340
341static int sony_laptop_setup_input(void) 341static int sony_laptop_setup_input(struct acpi_device *acpi_device)
342{ 342{
343 struct input_dev *jog_dev; 343 struct input_dev *jog_dev;
344 struct input_dev *key_dev; 344 struct input_dev *key_dev;
@@ -379,6 +379,7 @@ static int sony_laptop_setup_input(void)
379 key_dev->name = "Sony Vaio Keys"; 379 key_dev->name = "Sony Vaio Keys";
380 key_dev->id.bustype = BUS_ISA; 380 key_dev->id.bustype = BUS_ISA;
381 key_dev->id.vendor = PCI_VENDOR_ID_SONY; 381 key_dev->id.vendor = PCI_VENDOR_ID_SONY;
382 key_dev->dev.parent = &acpi_device->dev;
382 383
383 /* Initialize the Input Drivers: special keys */ 384 /* Initialize the Input Drivers: special keys */
384 set_bit(EV_KEY, key_dev->evbit); 385 set_bit(EV_KEY, key_dev->evbit);
@@ -410,6 +411,7 @@ static int sony_laptop_setup_input(void)
410 jog_dev->name = "Sony Vaio Jogdial"; 411 jog_dev->name = "Sony Vaio Jogdial";
411 jog_dev->id.bustype = BUS_ISA; 412 jog_dev->id.bustype = BUS_ISA;
412 jog_dev->id.vendor = PCI_VENDOR_ID_SONY; 413 jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
414 key_dev->dev.parent = &acpi_device->dev;
413 415
414 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); 416 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
415 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); 417 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE);
@@ -1006,7 +1008,7 @@ static int sony_nc_add(struct acpi_device *device)
1006 } 1008 }
1007 1009
1008 /* setup input devices and helper fifo */ 1010 /* setup input devices and helper fifo */
1009 result = sony_laptop_setup_input(); 1011 result = sony_laptop_setup_input(device);
1010 if (result) { 1012 if (result) {
1011 printk(KERN_ERR DRV_PFX 1013 printk(KERN_ERR DRV_PFX
1012 "Unabe to create input devices.\n"); 1014 "Unabe to create input devices.\n");
@@ -1034,7 +1036,7 @@ static int sony_nc_add(struct acpi_device *device)
1034 sony_backlight_device->props.brightness = 1036 sony_backlight_device->props.brightness =
1035 sony_backlight_get_brightness 1037 sony_backlight_get_brightness
1036 (sony_backlight_device); 1038 (sony_backlight_device);
1037 sony_backlight_device->props.max_brightness = 1039 sony_backlight_device->props.max_brightness =
1038 SONY_MAX_BRIGHTNESS - 1; 1040 SONY_MAX_BRIGHTNESS - 1;
1039 } 1041 }
1040 1042
@@ -2453,7 +2455,7 @@ static int sony_pic_add(struct acpi_device *device)
2453 } 2455 }
2454 2456
2455 /* setup input devices and helper fifo */ 2457 /* setup input devices and helper fifo */
2456 result = sony_laptop_setup_input(); 2458 result = sony_laptop_setup_input(device);
2457 if (result) { 2459 if (result) {
2458 printk(KERN_ERR DRV_PFX 2460 printk(KERN_ERR DRV_PFX
2459 "Unabe to create input devices.\n"); 2461 "Unabe to create input devices.\n");
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index e953276664a0..ab23a3221585 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -21,7 +21,7 @@
21 * 02110-1301, USA. 21 * 02110-1301, USA.
22 */ 22 */
23 23
24#define IBM_VERSION "0.16" 24#define IBM_VERSION "0.17"
25#define TPACPI_SYSFS_VERSION 0x020000 25#define TPACPI_SYSFS_VERSION 0x020000
26 26
27/* 27/*
@@ -964,15 +964,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
964 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ 964 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */
965 KEY_UNKNOWN, /* 0x0D: FN+INSERT */ 965 KEY_UNKNOWN, /* 0x0D: FN+INSERT */
966 KEY_UNKNOWN, /* 0x0E: FN+DELETE */ 966 KEY_UNKNOWN, /* 0x0E: FN+DELETE */
967 KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ 967 KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */
968 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ 968 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */
969 KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ 969 KEY_RESERVED, /* 0x10: FN+END (brightness down) */
970 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 970 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
971 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 971 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
972 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 972 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
973 KEY_VOLUMEUP, /* 0x14: VOLUME UP */ 973 KEY_RESERVED, /* 0x14: VOLUME UP */
974 KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ 974 KEY_RESERVED, /* 0x15: VOLUME DOWN */
975 KEY_MUTE, /* 0x16: MUTE */ 975 KEY_RESERVED, /* 0x16: MUTE */
976 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ 976 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */
977 /* (assignments unknown, please report if found) */ 977 /* (assignments unknown, please report if found) */
978 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 978 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
@@ -993,9 +993,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
996 KEY_VOLUMEUP, /* 0x14: VOLUME UP */ 996 KEY_RESERVED, /* 0x14: VOLUME UP */
997 KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ 997 KEY_RESERVED, /* 0x15: VOLUME DOWN */
998 KEY_MUTE, /* 0x16: MUTE */ 998 KEY_RESERVED, /* 0x16: MUTE */
999 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ 999 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */
1000 /* (assignments unknown, please report if found) */ 1000 /* (assignments unknown, please report if found) */
1001 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 1001 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
@@ -1342,9 +1342,8 @@ static int hotkey_read(char *p)
1342 return len; 1342 return len;
1343 } 1343 }
1344 1344
1345 res = mutex_lock_interruptible(&hotkey_mutex); 1345 if (mutex_lock_interruptible(&hotkey_mutex))
1346 if (res < 0) 1346 return -ERESTARTSYS;
1347 return res;
1348 res = hotkey_get(&status, &mask); 1347 res = hotkey_get(&status, &mask);
1349 mutex_unlock(&hotkey_mutex); 1348 mutex_unlock(&hotkey_mutex);
1350 if (res) 1349 if (res)
@@ -1373,9 +1372,8 @@ static int hotkey_write(char *buf)
1373 if (!tp_features.hotkey) 1372 if (!tp_features.hotkey)
1374 return -ENODEV; 1373 return -ENODEV;
1375 1374
1376 res = mutex_lock_interruptible(&hotkey_mutex); 1375 if (mutex_lock_interruptible(&hotkey_mutex))
1377 if (res < 0) 1376 return -ERESTARTSYS;
1378 return res;
1379 1377
1380 res = hotkey_get(&status, &mask); 1378 res = hotkey_get(&status, &mask);
1381 if (res) 1379 if (res)
@@ -3114,6 +3112,99 @@ static struct backlight_ops ibm_backlight_data = {
3114 3112
3115static struct mutex brightness_mutex; 3113static struct mutex brightness_mutex;
3116 3114
3115static int __init tpacpi_query_bcll_levels(acpi_handle handle)
3116{
3117 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
3118 union acpi_object *obj;
3119 int rc;
3120
3121 if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) {
3122 obj = (union acpi_object *)buffer.pointer;
3123 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
3124 printk(IBM_ERR "Unknown BCLL data, "
3125 "please report this to %s\n", IBM_MAIL);
3126 rc = 0;
3127 } else {
3128 rc = obj->package.count;
3129 }
3130 } else {
3131 return 0;
3132 }
3133
3134 kfree(buffer.pointer);
3135 return rc;
3136}
3137
3138static acpi_status __init brightness_find_bcll(acpi_handle handle, u32 lvl,
3139 void *context, void **rv)
3140{
3141 char name[ACPI_PATH_SEGMENT_LENGTH];
3142 struct acpi_buffer buffer = { sizeof(name), &name };
3143
3144 if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) &&
3145 !strncmp("BCLL", name, sizeof(name) - 1)) {
3146 if (tpacpi_query_bcll_levels(handle) == 16) {
3147 *rv = handle;
3148 return AE_CTRL_TERMINATE;
3149 } else {
3150 return AE_OK;
3151 }
3152 } else {
3153 return AE_OK;
3154 }
3155}
3156
3157static int __init brightness_check_levels(void)
3158{
3159 int status;
3160 void *found_node = NULL;
3161
3162 if (!vid_handle) {
3163 IBM_ACPIHANDLE_INIT(vid);
3164 }
3165 if (!vid_handle)
3166 return 0;
3167
3168 /* Search for a BCLL package with 16 levels */
3169 status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3,
3170 brightness_find_bcll, NULL, &found_node);
3171
3172 return (ACPI_SUCCESS(status) && found_node != NULL);
3173}
3174
3175static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl,
3176 void *context, void **rv)
3177{
3178 char name[ACPI_PATH_SEGMENT_LENGTH];
3179 struct acpi_buffer buffer = { sizeof(name), &name };
3180
3181 if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) &&
3182 !strncmp("_BCL", name, sizeof(name) - 1)) {
3183 *rv = handle;
3184 return AE_CTRL_TERMINATE;
3185 } else {
3186 return AE_OK;
3187 }
3188}
3189
3190static int __init brightness_check_std_acpi_support(void)
3191{
3192 int status;
3193 void *found_node = NULL;
3194
3195 if (!vid_handle) {
3196 IBM_ACPIHANDLE_INIT(vid);
3197 }
3198 if (!vid_handle)
3199 return 0;
3200
3201 /* Search for a _BCL method, but don't execute it */
3202 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3,
3203 brightness_find_bcl, NULL, &found_node);
3204
3205 return (ACPI_SUCCESS(status) && found_node != NULL);
3206}
3207
3117static int __init brightness_init(struct ibm_init_struct *iibm) 3208static int __init brightness_init(struct ibm_init_struct *iibm)
3118{ 3209{
3119 int b; 3210 int b;
@@ -3122,6 +3213,18 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3122 3213
3123 mutex_init(&brightness_mutex); 3214 mutex_init(&brightness_mutex);
3124 3215
3216 if (!brightness_enable) {
3217 dbg_printk(TPACPI_DBG_INIT,
3218 "brightness support disabled by module parameter\n");
3219 return 1;
3220 } else if (brightness_enable > 1) {
3221 if (brightness_check_std_acpi_support()) {
3222 printk(IBM_NOTICE
3223 "standard ACPI backlight interface available, not loading native one...\n");
3224 return 1;
3225 }
3226 }
3227
3125 if (!brightness_mode) { 3228 if (!brightness_mode) {
3126 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) 3229 if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO)
3127 brightness_mode = 2; 3230 brightness_mode = 2;
@@ -3135,10 +3238,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3135 if (brightness_mode > 3) 3238 if (brightness_mode > 3)
3136 return -EINVAL; 3239 return -EINVAL;
3137 3240
3241 tp_features.bright_16levels =
3242 thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO &&
3243 brightness_check_levels();
3244
3138 b = brightness_get(NULL); 3245 b = brightness_get(NULL);
3139 if (b < 0) 3246 if (b < 0)
3140 return 1; 3247 return 1;
3141 3248
3249 if (tp_features.bright_16levels)
3250 printk(IBM_INFO "detected a 16-level brightness capable ThinkPad\n");
3251
3142 ibm_backlight_device = backlight_device_register( 3252 ibm_backlight_device = backlight_device_register(
3143 TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, 3253 TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
3144 &ibm_backlight_data); 3254 &ibm_backlight_data);
@@ -3148,7 +3258,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
3148 } 3258 }
3149 vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); 3259 vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n");
3150 3260
3151 ibm_backlight_device->props.max_brightness = 7; 3261 ibm_backlight_device->props.max_brightness =
3262 (tp_features.bright_16levels)? 15 : 7;
3152 ibm_backlight_device->props.brightness = b; 3263 ibm_backlight_device->props.brightness = b;
3153 backlight_update_status(ibm_backlight_device); 3264 backlight_update_status(ibm_backlight_device);
3154 3265
@@ -3167,6 +3278,8 @@ static void brightness_exit(void)
3167 3278
3168static int brightness_update_status(struct backlight_device *bd) 3279static int brightness_update_status(struct backlight_device *bd)
3169{ 3280{
3281 /* it is the backlight class's job (caller) to handle
3282 * EINTR and other errors properly */
3170 return brightness_set( 3283 return brightness_set(
3171 (bd->props.fb_blank == FB_BLANK_UNBLANK && 3284 (bd->props.fb_blank == FB_BLANK_UNBLANK &&
3172 bd->props.power == FB_BLANK_UNBLANK) ? 3285 bd->props.power == FB_BLANK_UNBLANK) ?
@@ -3184,13 +3297,14 @@ static int brightness_get(struct backlight_device *bd)
3184 if (brightness_mode & 1) { 3297 if (brightness_mode & 1) {
3185 if (!acpi_ec_read(brightness_offset, &lec)) 3298 if (!acpi_ec_read(brightness_offset, &lec))
3186 return -EIO; 3299 return -EIO;
3187 lec &= 7; 3300 lec &= (tp_features.bright_16levels)? 0x0f : 0x07;
3188 level = lec; 3301 level = lec;
3189 }; 3302 };
3190 if (brightness_mode & 2) { 3303 if (brightness_mode & 2) {
3191 lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) 3304 lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
3192 & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) 3305 & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
3193 >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; 3306 >> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
3307 lcmos &= (tp_features.bright_16levels)? 0x0f : 0x07;
3194 level = lcmos; 3308 level = lcmos;
3195 } 3309 }
3196 3310
@@ -3206,12 +3320,13 @@ static int brightness_get(struct backlight_device *bd)
3206 return level; 3320 return level;
3207} 3321}
3208 3322
3323/* May return EINTR which can always be mapped to ERESTARTSYS */
3209static int brightness_set(int value) 3324static int brightness_set(int value)
3210{ 3325{
3211 int cmos_cmd, inc, i, res; 3326 int cmos_cmd, inc, i, res;
3212 int current_value; 3327 int current_value;
3213 3328
3214 if (value > 7) 3329 if (value > ((tp_features.bright_16levels)? 15 : 7))
3215 return -EINVAL; 3330 return -EINVAL;
3216 3331
3217 res = mutex_lock_interruptible(&brightness_mutex); 3332 res = mutex_lock_interruptible(&brightness_mutex);
@@ -3227,7 +3342,7 @@ static int brightness_set(int value)
3227 cmos_cmd = value > current_value ? 3342 cmos_cmd = value > current_value ?
3228 TP_CMOS_BRIGHTNESS_UP : 3343 TP_CMOS_BRIGHTNESS_UP :
3229 TP_CMOS_BRIGHTNESS_DOWN; 3344 TP_CMOS_BRIGHTNESS_DOWN;
3230 inc = value > current_value ? 1 : -1; 3345 inc = (value > current_value)? 1 : -1;
3231 3346
3232 res = 0; 3347 res = 0;
3233 for (i = current_value; i != value; i += inc) { 3348 for (i = current_value; i != value; i += inc) {
@@ -3256,10 +3371,11 @@ static int brightness_read(char *p)
3256 if ((level = brightness_get(NULL)) < 0) { 3371 if ((level = brightness_get(NULL)) < 0) {
3257 len += sprintf(p + len, "level:\t\tunreadable\n"); 3372 len += sprintf(p + len, "level:\t\tunreadable\n");
3258 } else { 3373 } else {
3259 len += sprintf(p + len, "level:\t\t%d\n", level & 0x7); 3374 len += sprintf(p + len, "level:\t\t%d\n", level);
3260 len += sprintf(p + len, "commands:\tup, down\n"); 3375 len += sprintf(p + len, "commands:\tup, down\n");
3261 len += sprintf(p + len, "commands:\tlevel <level>" 3376 len += sprintf(p + len, "commands:\tlevel <level>"
3262 " (<level> is 0-7)\n"); 3377 " (<level> is 0-%d)\n",
3378 (tp_features.bright_16levels) ? 15 : 7);
3263 } 3379 }
3264 3380
3265 return len; 3381 return len;
@@ -3268,28 +3384,34 @@ static int brightness_read(char *p)
3268static int brightness_write(char *buf) 3384static int brightness_write(char *buf)
3269{ 3385{
3270 int level; 3386 int level;
3271 int new_level; 3387 int rc;
3272 char *cmd; 3388 char *cmd;
3389 int max_level = (tp_features.bright_16levels) ? 15 : 7;
3273 3390
3274 while ((cmd = next_cmd(&buf))) { 3391 level = brightness_get(NULL);
3275 if ((level = brightness_get(NULL)) < 0) 3392 if (level < 0)
3276 return level; 3393 return level;
3277 level &= 7;
3278 3394
3395 while ((cmd = next_cmd(&buf))) {
3279 if (strlencmp(cmd, "up") == 0) { 3396 if (strlencmp(cmd, "up") == 0) {
3280 new_level = level == 7 ? 7 : level + 1; 3397 if (level < max_level)
3398 level++;
3281 } else if (strlencmp(cmd, "down") == 0) { 3399 } else if (strlencmp(cmd, "down") == 0) {
3282 new_level = level == 0 ? 0 : level - 1; 3400 if (level > 0)
3283 } else if (sscanf(cmd, "level %d", &new_level) == 1 && 3401 level--;
3284 new_level >= 0 && new_level <= 7) { 3402 } else if (sscanf(cmd, "level %d", &level) == 1 &&
3285 /* new_level set */ 3403 level >= 0 && level <= max_level) {
3404 /* new level set */
3286 } else 3405 } else
3287 return -EINVAL; 3406 return -EINVAL;
3288
3289 brightness_set(new_level);
3290 } 3407 }
3291 3408
3292 return 0; 3409 /*
3410 * Now we know what the final level should be, so we try to set it.
3411 * Doing it this way makes the syscall restartable in case of EINTR
3412 */
3413 rc = brightness_set(level);
3414 return (rc == -EINTR)? ERESTARTSYS : rc;
3293} 3415}
3294 3416
3295static struct ibm_struct brightness_driver_data = { 3417static struct ibm_struct brightness_driver_data = {
@@ -3652,9 +3774,8 @@ static ssize_t fan_pwm1_store(struct device *dev,
3652 /* scale down from 0-255 to 0-7 */ 3774 /* scale down from 0-255 to 0-7 */
3653 newlevel = (s >> 5) & 0x07; 3775 newlevel = (s >> 5) & 0x07;
3654 3776
3655 rc = mutex_lock_interruptible(&fan_mutex); 3777 if (mutex_lock_interruptible(&fan_mutex))
3656 if (rc < 0) 3778 return -ERESTARTSYS;
3657 return rc;
3658 3779
3659 rc = fan_get_status(&status); 3780 rc = fan_get_status(&status);
3660 if (!rc && (status & 3781 if (!rc && (status &
@@ -3904,9 +4025,8 @@ static int fan_get_status_safe(u8 *status)
3904 int rc; 4025 int rc;
3905 u8 s; 4026 u8 s;
3906 4027
3907 rc = mutex_lock_interruptible(&fan_mutex); 4028 if (mutex_lock_interruptible(&fan_mutex))
3908 if (rc < 0) 4029 return -ERESTARTSYS;
3909 return rc;
3910 rc = fan_get_status(&s); 4030 rc = fan_get_status(&s);
3911 if (!rc) 4031 if (!rc)
3912 fan_update_desired_level(s); 4032 fan_update_desired_level(s);
@@ -4040,9 +4160,8 @@ static int fan_set_level_safe(int level)
4040 if (!fan_control_allowed) 4160 if (!fan_control_allowed)
4041 return -EPERM; 4161 return -EPERM;
4042 4162
4043 rc = mutex_lock_interruptible(&fan_mutex); 4163 if (mutex_lock_interruptible(&fan_mutex))
4044 if (rc < 0) 4164 return -ERESTARTSYS;
4045 return rc;
4046 4165
4047 if (level == TPACPI_FAN_LAST_LEVEL) 4166 if (level == TPACPI_FAN_LAST_LEVEL)
4048 level = fan_control_desired_level; 4167 level = fan_control_desired_level;
@@ -4063,9 +4182,8 @@ static int fan_set_enable(void)
4063 if (!fan_control_allowed) 4182 if (!fan_control_allowed)
4064 return -EPERM; 4183 return -EPERM;
4065 4184
4066 rc = mutex_lock_interruptible(&fan_mutex); 4185 if (mutex_lock_interruptible(&fan_mutex))
4067 if (rc < 0) 4186 return -ERESTARTSYS;
4068 return rc;
4069 4187
4070 switch (fan_control_access_mode) { 4188 switch (fan_control_access_mode) {
4071 case TPACPI_FAN_WR_ACPI_FANS: 4189 case TPACPI_FAN_WR_ACPI_FANS:
@@ -4119,9 +4237,8 @@ static int fan_set_disable(void)
4119 if (!fan_control_allowed) 4237 if (!fan_control_allowed)
4120 return -EPERM; 4238 return -EPERM;
4121 4239
4122 rc = mutex_lock_interruptible(&fan_mutex); 4240 if (mutex_lock_interruptible(&fan_mutex))
4123 if (rc < 0) 4241 return -ERESTARTSYS;
4124 return rc;
4125 4242
4126 rc = 0; 4243 rc = 0;
4127 switch (fan_control_access_mode) { 4244 switch (fan_control_access_mode) {
@@ -4158,9 +4275,8 @@ static int fan_set_speed(int speed)
4158 if (!fan_control_allowed) 4275 if (!fan_control_allowed)
4159 return -EPERM; 4276 return -EPERM;
4160 4277
4161 rc = mutex_lock_interruptible(&fan_mutex); 4278 if (mutex_lock_interruptible(&fan_mutex))
4162 if (rc < 0) 4279 return -ERESTARTSYS;
4163 return rc;
4164 4280
4165 rc = 0; 4281 rc = 0;
4166 switch (fan_control_access_mode) { 4282 switch (fan_control_access_mode) {
@@ -4701,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
4701 unsigned int i; 4817 unsigned int i;
4702 struct ibm_struct *ibm; 4818 struct ibm_struct *ibm;
4703 4819
4820 if (!kp || !kp->name || !val)
4821 return -EINVAL;
4822
4704 for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { 4823 for (i = 0; i < ARRAY_SIZE(ibms_init); i++) {
4705 ibm = ibms_init[i].data; 4824 ibm = ibms_init[i].data;
4706 BUG_ON(ibm == NULL); 4825 WARN_ON(ibm == NULL);
4826
4827 if (!ibm || !ibm->name)
4828 continue;
4707 4829
4708 if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { 4830 if (strcmp(ibm->name, kp->name) == 0 && ibm->write) {
4709 if (strlen(val) > sizeof(ibms_init[i].param) - 2) 4831 if (strlen(val) > sizeof(ibms_init[i].param) - 2)
@@ -4732,6 +4854,9 @@ module_param_named(fan_control, fan_control_allowed, bool, 0);
4732static int brightness_mode; 4854static int brightness_mode;
4733module_param_named(brightness_mode, brightness_mode, int, 0); 4855module_param_named(brightness_mode, brightness_mode, int, 0);
4734 4856
4857static unsigned int brightness_enable = 2; /* 2 = auto, 0 = no, 1 = yes */
4858module_param(brightness_enable, uint, 0);
4859
4735static unsigned int hotkey_report_mode; 4860static unsigned int hotkey_report_mode;
4736module_param(hotkey_report_mode, uint, 0); 4861module_param(hotkey_report_mode, uint, 0);
4737 4862
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 3abcc8120634..8fba2bbe345e 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -84,7 +84,7 @@
84 84
85/* ThinkPad CMOS NVRAM constants */ 85/* ThinkPad CMOS NVRAM constants */
86#define TP_NVRAM_ADDR_BRIGHTNESS 0x5e 86#define TP_NVRAM_ADDR_BRIGHTNESS 0x5e
87#define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07 87#define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x0f
88#define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 88#define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0
89 89
90#define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") 90#define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off")
@@ -246,6 +246,7 @@ static struct {
246 u32 hotkey_wlsw:1; 246 u32 hotkey_wlsw:1;
247 u32 light:1; 247 u32 light:1;
248 u32 light_status:1; 248 u32 light_status:1;
249 u32 bright_16levels:1;
249 u32 wan:1; 250 u32 wan:1;
250 u32 fan_ctrl_status_undef:1; 251 u32 fan_ctrl_status_undef:1;
251 u32 input_device_registered:1; 252 u32 input_device_registered:1;
@@ -338,6 +339,7 @@ static int bluetooth_write(char *buf);
338static struct backlight_device *ibm_backlight_device; 339static struct backlight_device *ibm_backlight_device;
339static int brightness_offset = 0x31; 340static int brightness_offset = 0x31;
340static int brightness_mode; 341static int brightness_mode;
342static unsigned int brightness_enable; /* 0 = no, 1 = yes, 2 = auto */
341 343
342static int brightness_init(struct ibm_init_struct *iibm); 344static int brightness_init(struct ibm_init_struct *iibm);
343static void brightness_exit(void); 345static void brightness_exit(void);
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index e38d5a3b2a89..aeb32a93f6a0 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -44,6 +44,9 @@
44 * max 8 partitions per card 44 * max 8 partitions per card
45 */ 45 */
46#define MMC_SHIFT 3 46#define MMC_SHIFT 3
47#define MMC_NUM_MINORS (256 >> MMC_SHIFT)
48
49static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))];
47 50
48/* 51/*
49 * There is one mmc_blk_data per slot. 52 * There is one mmc_blk_data per slot.
@@ -80,6 +83,9 @@ static void mmc_blk_put(struct mmc_blk_data *md)
80 mutex_lock(&open_lock); 83 mutex_lock(&open_lock);
81 md->usage--; 84 md->usage--;
82 if (md->usage == 0) { 85 if (md->usage == 0) {
86 int devidx = md->disk->first_minor >> MMC_SHIFT;
87 __clear_bit(devidx, dev_use);
88
83 put_disk(md->disk); 89 put_disk(md->disk);
84 kfree(md); 90 kfree(md);
85 } 91 }
@@ -321,7 +327,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
321 req->rq_disk->disk_name, err); 327 req->rq_disk->disk_name, err);
322 goto cmd_err; 328 goto cmd_err;
323 } 329 }
324 } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); 330 /*
331 * Some cards mishandle the status bits,
332 * so make sure to check both the busy
333 * indication and the card state.
334 */
335 } while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
336 (R1_CURRENT_STATE(cmd.resp[0]) == 7));
325 337
326#if 0 338#if 0
327 if (cmd.resp[0] & ~0x00000900) 339 if (cmd.resp[0] & ~0x00000900)
@@ -400,9 +412,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
400 return 0; 412 return 0;
401} 413}
402 414
403#define MMC_NUM_MINORS (256 >> MMC_SHIFT)
404
405static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))];
406 415
407static inline int mmc_blk_readonly(struct mmc_card *card) 416static inline int mmc_blk_readonly(struct mmc_card *card)
408{ 417{
@@ -568,17 +577,12 @@ static void mmc_blk_remove(struct mmc_card *card)
568 struct mmc_blk_data *md = mmc_get_drvdata(card); 577 struct mmc_blk_data *md = mmc_get_drvdata(card);
569 578
570 if (md) { 579 if (md) {
571 int devidx;
572
573 /* Stop new requests from getting into the queue */ 580 /* Stop new requests from getting into the queue */
574 del_gendisk(md->disk); 581 del_gendisk(md->disk);
575 582
576 /* Then flush out any already in there */ 583 /* Then flush out any already in there */
577 mmc_cleanup_queue(&md->queue); 584 mmc_cleanup_queue(&md->queue);
578 585
579 devidx = md->disk->first_minor >> MMC_SHIFT;
580 __clear_bit(devidx, dev_use);
581
582 mmc_blk_put(md); 586 mmc_blk_put(md);
583 } 587 }
584 mmc_set_drvdata(card, NULL); 588 mmc_set_drvdata(card, NULL);
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 1b9c9b6da5b7..30cd13b13ac3 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -180,12 +180,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
180 blk_queue_max_hw_segments(mq->queue, host->max_hw_segs); 180 blk_queue_max_hw_segments(mq->queue, host->max_hw_segs);
181 blk_queue_max_segment_size(mq->queue, host->max_seg_size); 181 blk_queue_max_segment_size(mq->queue, host->max_seg_size);
182 182
183 mq->sg = kzalloc(sizeof(struct scatterlist) * 183 mq->sg = kmalloc(sizeof(struct scatterlist) *
184 host->max_phys_segs, GFP_KERNEL); 184 host->max_phys_segs, GFP_KERNEL);
185 if (!mq->sg) { 185 if (!mq->sg) {
186 ret = -ENOMEM; 186 ret = -ENOMEM;
187 goto cleanup_queue; 187 goto cleanup_queue;
188 } 188 }
189 sg_init_table(mq->sg, host->max_phys_segs);
189 } 190 }
190 191
191 init_MUTEX(&mq->thread_sem); 192 init_MUTEX(&mq->thread_sem);
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index d552de683110..eeea84c309e6 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -386,7 +386,7 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)
386 sdio_out(port, UART_IER, port->ier); 386 sdio_out(port, UART_IER, port->ier);
387} 387}
388 388
389static void sdio_uart_receive_chars(struct sdio_uart_port *port, int *status) 389static void sdio_uart_receive_chars(struct sdio_uart_port *port, unsigned int *status)
390{ 390{
391 struct tty_struct *tty = port->tty; 391 struct tty_struct *tty = port->tty;
392 unsigned int ch, flag; 392 unsigned int ch, flag;
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index c11a3d256051..20d5c7bd940a 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -16,7 +16,6 @@
16#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
17#include <linux/highmem.h> 17#include <linux/highmem.h>
18#include <linux/scatterlist.h> 18#include <linux/scatterlist.h>
19#include <linux/log2.h>
20#include <asm/io.h> 19#include <asm/io.h>
21 20
22#define DRIVER_NAME "tifm_sd" 21#define DRIVER_NAME "tifm_sd"
@@ -638,17 +637,15 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
638 goto err_out; 637 goto err_out;
639 } 638 }
640 639
641 if (mrq->data && !is_power_of_2(mrq->data->blksz)) {
642 printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n",
643 sock->dev.bus_id, mrq->data->blksz);
644 mrq->cmd->error = -EINVAL;
645 goto err_out;
646 }
647
648 host->cmd_flags = 0; 640 host->cmd_flags = 0;
649 host->block_pos = 0; 641 host->block_pos = 0;
650 host->sg_pos = 0; 642 host->sg_pos = 0;
651 643
644 if (mrq->data && !is_power_of_2(mrq->data->blksz))
645 host->no_dma = 1;
646 else
647 host->no_dma = no_dma ? 1 : 0;
648
652 if (r_data) { 649 if (r_data) {
653 tifm_sd_set_data_timeout(host, r_data); 650 tifm_sd_set_data_timeout(host, r_data);
654 651
@@ -676,7 +673,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
676 : PCI_DMA_FROMDEVICE)) { 673 : PCI_DMA_FROMDEVICE)) {
677 printk(KERN_ERR "%s : scatterlist map failed\n", 674 printk(KERN_ERR "%s : scatterlist map failed\n",
678 sock->dev.bus_id); 675 sock->dev.bus_id);
679 spin_unlock_irqrestore(&sock->lock, flags); 676 mrq->cmd->error = -ENOMEM;
680 goto err_out; 677 goto err_out;
681 } 678 }
682 host->sg_len = tifm_map_sg(sock, r_data->sg, 679 host->sg_len = tifm_map_sg(sock, r_data->sg,
@@ -692,7 +689,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
692 r_data->flags & MMC_DATA_WRITE 689 r_data->flags & MMC_DATA_WRITE
693 ? PCI_DMA_TODEVICE 690 ? PCI_DMA_TODEVICE
694 : PCI_DMA_FROMDEVICE); 691 : PCI_DMA_FROMDEVICE);
695 spin_unlock_irqrestore(&sock->lock, flags); 692 mrq->cmd->error = -ENOMEM;
696 goto err_out; 693 goto err_out;
697 } 694 }
698 695
@@ -966,7 +963,6 @@ static int tifm_sd_probe(struct tifm_dev *sock)
966 return -ENOMEM; 963 return -ENOMEM;
967 964
968 host = mmc_priv(mmc); 965 host = mmc_priv(mmc);
969 host->no_dma = no_dma;
970 tifm_set_drvdata(sock, mmc); 966 tifm_set_drvdata(sock, mmc);
971 host->dev = sock; 967 host->dev = sock;
972 host->timeout_jiffies = msecs_to_jiffies(1000); 968 host->timeout_jiffies = msecs_to_jiffies(1000);
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index f0f851693897..eb971755a3ff 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -924,7 +924,7 @@ static int __init bf537mac_probe(struct net_device *dev)
924 if (!is_valid_ether_addr(dev->dev_addr)) { 924 if (!is_valid_ether_addr(dev->dev_addr)) {
925 /* Grab the MAC from the board somehow - this is done in the 925 /* Grab the MAC from the board somehow - this is done in the
926 arch/blackfin/mach-bf537/boards/eth_mac.c */ 926 arch/blackfin/mach-bf537/boards/eth_mac.c */
927 get_bf537_ether_addr(dev->dev_addr); 927 bfin_get_ether_addr(dev->dev_addr);
928 } 928 }
929 929
930 /* If still not valid, get a random one */ 930 /* If still not valid, get a random one */
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h
index 3a107ad75381..5970ea7142cd 100644
--- a/drivers/net/bfin_mac.h
+++ b/drivers/net/bfin_mac.h
@@ -92,4 +92,4 @@ struct bf537mac_local {
92 struct mii_bus mii_bus; 92 struct mii_bus mii_bus;
93}; 93};
94 94
95extern void get_bf537_ether_addr(char *addr); 95extern void bfin_get_ether_addr(char *addr);
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c
index 42b47639c81c..fa24e6597591 100644
--- a/drivers/net/mlx4/qp.c
+++ b/drivers/net/mlx4/qp.c
@@ -113,7 +113,7 @@ int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
113 struct mlx4_cmd_mailbox *mailbox; 113 struct mlx4_cmd_mailbox *mailbox;
114 int ret = 0; 114 int ret = 0;
115 115
116 if (cur_state >= MLX4_QP_NUM_STATE || cur_state >= MLX4_QP_NUM_STATE || 116 if (cur_state >= MLX4_QP_NUM_STATE || new_state >= MLX4_QP_NUM_STATE ||
117 !op[cur_state][new_state]) 117 !op[cur_state][new_state])
118 return -EINVAL; 118 return -EINVAL;
119 119
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 5071fcd8a0bd..57c98669984d 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -663,7 +663,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl,
663 case PLIP_PK_DONE: 663 case PLIP_PK_DONE:
664 /* Inform the upper layer for the arrival of a packet. */ 664 /* Inform the upper layer for the arrival of a packet. */
665 rcv->skb->protocol=plip_type_trans(rcv->skb, dev); 665 rcv->skb->protocol=plip_type_trans(rcv->skb, dev);
666 netif_rx(rcv->skb); 666 netif_rx_ni(rcv->skb);
667 dev->last_rx = jiffies; 667 dev->last_rx = jiffies;
668 dev->stats.rx_bytes += rcv->length.h; 668 dev->stats.rx_bytes += rcv->length.h;
669 dev->stats.rx_packets++; 669 dev->stats.rx_packets++;
@@ -1269,7 +1269,7 @@ static void plip_attach (struct parport *port)
1269 1269
1270 nl = netdev_priv(dev); 1270 nl = netdev_priv(dev);
1271 nl->dev = dev; 1271 nl->dev = dev;
1272 nl->pardev = parport_register_device(port, name, plip_preempt, 1272 nl->pardev = parport_register_device(port, dev->name, plip_preempt,
1273 plip_wakeup, plip_interrupt, 1273 plip_wakeup, plip_interrupt,
1274 0, dev); 1274 0, dev);
1275 1275
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a75be57fb209..5413dbf3d4ac 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -198,8 +198,8 @@ again:
198 if (vi->num < vi->max / 2) 198 if (vi->num < vi->max / 2)
199 try_fill_recv(vi); 199 try_fill_recv(vi);
200 200
201 /* All done? */ 201 /* Out of packets? */
202 if (!skb) { 202 if (received < budget) {
203 netif_rx_complete(vi->dev, napi); 203 netif_rx_complete(vi->dev, napi);
204 if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) 204 if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq))
205 && netif_rx_reschedule(vi->dev, napi)) 205 && netif_rx_reschedule(vi->dev, napi))
@@ -404,8 +404,12 @@ free:
404 404
405static void virtnet_remove(struct virtio_device *vdev) 405static void virtnet_remove(struct virtio_device *vdev)
406{ 406{
407 unregister_netdev(vdev->priv); 407 struct virtnet_info *vi = vdev->priv;
408 free_netdev(vdev->priv); 408
409 vdev->config->del_vq(vi->svq);
410 vdev->config->del_vq(vi->rvq);
411 unregister_netdev(vi->dev);
412 free_netdev(vi->dev);
409} 413}
410 414
411static struct virtio_device_id id_table[] = { 415static struct virtio_device_id id_table[] = {
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 277a020b35e9..50775f9234cc 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1032,7 +1032,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1032} 1032}
1033 1033
1034static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1034static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1035 int maxpacket, struct sk_buff *skb) 1035 struct sk_buff *skb)
1036{ 1036{
1037 int length; 1037 int length;
1038 1038
@@ -1041,7 +1041,7 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1041 * but it must _not_ be a multiple of the USB packet size. 1041 * but it must _not_ be a multiple of the USB packet size.
1042 */ 1042 */
1043 length = roundup(skb->len, 2); 1043 length = roundup(skb->len, 2);
1044 length += (2 * !(length % maxpacket)); 1044 length += (2 * !(length % rt2x00dev->usb_maxpacket));
1045 1045
1046 return length; 1046 return length;
1047} 1047}
@@ -1643,7 +1643,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1643 struct data_entry *beacon; 1643 struct data_entry *beacon;
1644 struct data_entry *guardian; 1644 struct data_entry *guardian;
1645 int pipe = usb_sndbulkpipe(usb_dev, 1); 1645 int pipe = usb_sndbulkpipe(usb_dev, 1);
1646 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
1647 int length; 1646 int length;
1648 1647
1649 /* 1648 /*
@@ -1672,7 +1671,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1672 ring->desc_size), 1671 ring->desc_size),
1673 skb->len - ring->desc_size, control); 1672 skb->len - ring->desc_size, control);
1674 1673
1675 length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); 1674 length = rt2500usb_get_tx_data_len(rt2x00dev, skb);
1676 1675
1677 usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, 1676 usb_fill_bulk_urb(beacon->priv, usb_dev, pipe,
1678 skb->data, length, rt2500usb_beacondone, beacon); 1677 skb->data, length, rt2500usb_beacondone, beacon);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index d1ad5251a77a..c8f16f161c28 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -418,7 +418,7 @@ struct rt2x00lib_ops {
418 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, 418 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev,
419 struct data_ring *ring, struct sk_buff *skb, 419 struct data_ring *ring, struct sk_buff *skb,
420 struct ieee80211_tx_control *control); 420 struct ieee80211_tx_control *control);
421 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, int maxpacket, 421 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
422 struct sk_buff *skb); 422 struct sk_buff *skb);
423 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 423 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
424 unsigned int queue); 424 unsigned int queue);
@@ -599,6 +599,11 @@ struct rt2x00_dev {
599 u32 *rf; 599 u32 *rf;
600 600
601 /* 601 /*
602 * USB Max frame size (for rt2500usb & rt73usb).
603 */
604 u16 usb_maxpacket;
605
606 /*
602 * Current TX power value. 607 * Current TX power value.
603 */ 608 */
604 u16 tx_power; 609 u16 tx_power;
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 73cc726c4046..1f5675dd329f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -159,7 +159,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); 159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
160 struct data_entry *entry = rt2x00_get_data_entry(ring); 160 struct data_entry *entry = rt2x00_get_data_entry(ring);
161 int pipe = usb_sndbulkpipe(usb_dev, 1); 161 int pipe = usb_sndbulkpipe(usb_dev, 1);
162 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
163 u32 length; 162 u32 length;
164 163
165 if (rt2x00_ring_full(ring)) { 164 if (rt2x00_ring_full(ring)) {
@@ -194,8 +193,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
194 * length of the data to usb_fill_bulk_urb. Pass the skb 193 * length of the data to usb_fill_bulk_urb. Pass the skb
195 * to the driver to determine what the length should be. 194 * to the driver to determine what the length should be.
196 */ 195 */
197 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, 196 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, skb);
198 max_packet, skb);
199 197
200 /* 198 /*
201 * Initialize URB and send the frame to the device. 199 * Initialize URB and send the frame to the device.
@@ -490,6 +488,11 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
490 rt2x00dev->ops = ops; 488 rt2x00dev->ops = ops;
491 rt2x00dev->hw = hw; 489 rt2x00dev->hw = hw;
492 490
491 rt2x00dev->usb_maxpacket =
492 usb_maxpacket(usb_dev, usb_sndbulkpipe(usb_dev, 1), 1);
493 if (!rt2x00dev->usb_maxpacket)
494 rt2x00dev->usb_maxpacket = 1;
495
493 retval = rt2x00usb_alloc_reg(rt2x00dev); 496 retval = rt2x00usb_alloc_reg(rt2x00dev);
494 if (retval) 497 if (retval)
495 goto exit_free_device; 498 goto exit_free_device;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index dc640bf6b5eb..c0671c2e6e73 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1251,7 +1251,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1251} 1251}
1252 1252
1253static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1253static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1254 int maxpacket, struct sk_buff *skb) 1254 struct sk_buff *skb)
1255{ 1255{
1256 int length; 1256 int length;
1257 1257
@@ -1260,7 +1260,7 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1260 * but it must _not_ be a multiple of the USB packet size. 1260 * but it must _not_ be a multiple of the USB packet size.
1261 */ 1261 */
1262 length = roundup(skb->len, 4); 1262 length = roundup(skb->len, 4);
1263 length += (4 * !(length % maxpacket)); 1263 length += (4 * !(length % rt2x00dev->usb_maxpacket));
1264 1264
1265 return length; 1265 return length;
1266} 1266}
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index f6cc0c5b5657..1ef417cca2db 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -66,7 +66,7 @@ struct slot {
66 char name[SLOT_NAME_SIZE]; 66 char name[SLOT_NAME_SIZE];
67}; 67};
68 68
69/** 69/*
70 * struct acpiphp_bridge - PCI bridge information 70 * struct acpiphp_bridge - PCI bridge information
71 * 71 *
72 * for each bridge device in ACPI namespace 72 * for each bridge device in ACPI namespace
@@ -97,7 +97,7 @@ struct acpiphp_bridge {
97}; 97};
98 98
99 99
100/** 100/*
101 * struct acpiphp_slot - PCI slot information 101 * struct acpiphp_slot - PCI slot information
102 * 102 *
103 * PCI slot information for each *physical* PCI slot 103 * PCI slot information for each *physical* PCI slot
@@ -118,7 +118,7 @@ struct acpiphp_slot {
118}; 118};
119 119
120 120
121/** 121/*
122 * struct acpiphp_func - PCI function information 122 * struct acpiphp_func - PCI function information
123 * 123 *
124 * PCI function information for each object in ACPI namespace 124 * PCI function information for each object in ACPI namespace
@@ -137,7 +137,7 @@ struct acpiphp_func {
137 u32 flags; /* see below */ 137 u32 flags; /* see below */
138}; 138};
139 139
140/** 140/*
141 * struct acpiphp_attention_info - device specific attention registration 141 * struct acpiphp_attention_info - device specific attention registration
142 * 142 *
143 * ACPI has no generic method of setting/getting attention status 143 * ACPI has no generic method of setting/getting attention status
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index a0ca63adad5a..c8c263875c21 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -91,10 +91,10 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = {
91 * acpiphp_register_attention - set attention LED callback 91 * acpiphp_register_attention - set attention LED callback
92 * @info: must be completely filled with LED callbacks 92 * @info: must be completely filled with LED callbacks
93 * 93 *
94 * Description: this is used to register a hardware specific ACPI 94 * Description: This is used to register a hardware specific ACPI
95 * driver that manipulates the attention LED. All the fields in 95 * driver that manipulates the attention LED. All the fields in
96 * info must be set. 96 * info must be set.
97 **/ 97 */
98int acpiphp_register_attention(struct acpiphp_attention_info *info) 98int acpiphp_register_attention(struct acpiphp_attention_info *info)
99{ 99{
100 int retval = -EINVAL; 100 int retval = -EINVAL;
@@ -112,10 +112,10 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info)
112 * acpiphp_unregister_attention - unset attention LED callback 112 * acpiphp_unregister_attention - unset attention LED callback
113 * @info: must match the pointer used to register 113 * @info: must match the pointer used to register
114 * 114 *
115 * Description: this is used to un-register a hardware specific acpi 115 * Description: This is used to un-register a hardware specific acpi
116 * driver that manipulates the attention LED. The pointer to the 116 * driver that manipulates the attention LED. The pointer to the
117 * info struct must be the same as the one used to set it. 117 * info struct must be the same as the one used to set it.
118 **/ 118 */
119int acpiphp_unregister_attention(struct acpiphp_attention_info *info) 119int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
120{ 120{
121 int retval = -EINVAL; 121 int retval = -EINVAL;
@@ -133,7 +133,6 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
133 * @hotplug_slot: slot to enable 133 * @hotplug_slot: slot to enable
134 * 134 *
135 * Actual tasks are done in acpiphp_enable_slot() 135 * Actual tasks are done in acpiphp_enable_slot()
136 *
137 */ 136 */
138static int enable_slot(struct hotplug_slot *hotplug_slot) 137static int enable_slot(struct hotplug_slot *hotplug_slot)
139{ 138{
@@ -151,7 +150,6 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
151 * @hotplug_slot: slot to disable 150 * @hotplug_slot: slot to disable
152 * 151 *
153 * Actual tasks are done in acpiphp_disable_slot() 152 * Actual tasks are done in acpiphp_disable_slot()
154 *
155 */ 153 */
156static int disable_slot(struct hotplug_slot *hotplug_slot) 154static int disable_slot(struct hotplug_slot *hotplug_slot)
157{ 155{
@@ -168,15 +166,15 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
168} 166}
169 167
170 168
171 /** 169/**
172 * set_attention_status - set attention LED 170 * set_attention_status - set attention LED
173 * @hotplug_slot: slot to set attention LED on 171 * @hotplug_slot: slot to set attention LED on
174 * @status: value to set attention LED to (0 or 1) 172 * @status: value to set attention LED to (0 or 1)
175 * 173 *
176 * attention status LED, so we use a callback that 174 * attention status LED, so we use a callback that
177 * was registered with us. This allows hardware specific 175 * was registered with us. This allows hardware specific
178 * ACPI implementations to blink the light for us. 176 * ACPI implementations to blink the light for us.
179 **/ 177 */
180 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) 178 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
181 { 179 {
182 int retval = -ENODEV; 180 int retval = -ENODEV;
@@ -199,7 +197,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
199 * 197 *
200 * Some platforms may not implement _STA method properly. 198 * Some platforms may not implement _STA method properly.
201 * In that case, the value returned may not be reliable. 199 * In that case, the value returned may not be reliable.
202 *
203 */ 200 */
204static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 201static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
205{ 202{
@@ -213,7 +210,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
213} 210}
214 211
215 212
216 /** 213/**
217 * get_attention_status - get attention LED status 214 * get_attention_status - get attention LED status
218 * @hotplug_slot: slot to get status from 215 * @hotplug_slot: slot to get status from
219 * @value: returns with value of attention LED 216 * @value: returns with value of attention LED
@@ -221,8 +218,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
221 * ACPI doesn't have known method to determine the state 218 * ACPI doesn't have known method to determine the state
222 * of the attention status LED, so we use a callback that 219 * of the attention status LED, so we use a callback that
223 * was registered with us. This allows hardware specific 220 * was registered with us. This allows hardware specific
224 * ACPI implementations to determine its state 221 * ACPI implementations to determine its state.
225 **/ 222 */
226static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 223static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
227{ 224{
228 int retval = -EINVAL; 225 int retval = -EINVAL;
@@ -244,8 +241,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
244 * @value: pointer to store status 241 * @value: pointer to store status
245 * 242 *
246 * ACPI doesn't provide any formal means to access latch status. 243 * ACPI doesn't provide any formal means to access latch status.
247 * Instead, we fake latch status from _STA 244 * Instead, we fake latch status from _STA.
248 *
249 */ 245 */
250static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 246static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
251{ 247{
@@ -265,8 +261,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
265 * @value: pointer to store status 261 * @value: pointer to store status
266 * 262 *
267 * ACPI doesn't provide any formal means to access adapter status. 263 * ACPI doesn't provide any formal means to access adapter status.
268 * Instead, we fake adapter status from _STA 264 * Instead, we fake adapter status from _STA.
269 *
270 */ 265 */
271static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 266static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
272{ 267{
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 1e125b56c9a9..ff1b1c71291a 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -82,7 +82,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex
82 * 2. has _PS0 method 82 * 2. has _PS0 method
83 * 3. has _PS3 method 83 * 3. has _PS3 method
84 * 4. .. 84 * 4. ..
85 *
86 */ 85 */
87static int is_ejectable(acpi_handle handle) 86static int is_ejectable(acpi_handle handle)
88{ 87{
@@ -986,10 +985,8 @@ static int power_off_slot(struct acpiphp_slot *slot)
986 985
987 986
988/** 987/**
989 * acpiphp_max_busnr - return the highest reserved bus number under 988 * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
990 * the given bus.
991 * @bus: bus to start search with 989 * @bus: bus to start search with
992 *
993 */ 990 */
994static unsigned char acpiphp_max_busnr(struct pci_bus *bus) 991static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
995{ 992{
@@ -1018,7 +1015,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
1018/** 1015/**
1019 * acpiphp_bus_add - add a new bus to acpi subsystem 1016 * acpiphp_bus_add - add a new bus to acpi subsystem
1020 * @func: acpiphp_func of the bridge 1017 * @func: acpiphp_func of the bridge
1021 *
1022 */ 1018 */
1023static int acpiphp_bus_add(struct acpiphp_func *func) 1019static int acpiphp_bus_add(struct acpiphp_func *func)
1024{ 1020{
@@ -1063,7 +1059,6 @@ acpiphp_bus_add_out:
1063/** 1059/**
1064 * acpiphp_bus_trim - trim a bus from acpi subsystem 1060 * acpiphp_bus_trim - trim a bus from acpi subsystem
1065 * @handle: handle to acpi namespace 1061 * @handle: handle to acpi namespace
1066 *
1067 */ 1062 */
1068static int acpiphp_bus_trim(acpi_handle handle) 1063static int acpiphp_bus_trim(acpi_handle handle)
1069{ 1064{
@@ -1089,7 +1084,6 @@ static int acpiphp_bus_trim(acpi_handle handle)
1089 * 1084 *
1090 * This function should be called per *physical slot*, 1085 * This function should be called per *physical slot*,
1091 * not per each slot object in ACPI namespace. 1086 * not per each slot object in ACPI namespace.
1092 *
1093 */ 1087 */
1094static int enable_device(struct acpiphp_slot *slot) 1088static int enable_device(struct acpiphp_slot *slot)
1095{ 1089{
@@ -1185,6 +1179,7 @@ static void disable_bridges(struct pci_bus *bus)
1185 1179
1186/** 1180/**
1187 * disable_device - disable a slot 1181 * disable_device - disable a slot
1182 * @slot: ACPI PHP slot
1188 */ 1183 */
1189static int disable_device(struct acpiphp_slot *slot) 1184static int disable_device(struct acpiphp_slot *slot)
1190{ 1185{
@@ -1240,14 +1235,15 @@ static int disable_device(struct acpiphp_slot *slot)
1240 1235
1241/** 1236/**
1242 * get_slot_status - get ACPI slot status 1237 * get_slot_status - get ACPI slot status
1238 * @slot: ACPI PHP slot
1243 * 1239 *
1244 * if a slot has _STA for each function and if any one of them 1240 * If a slot has _STA for each function and if any one of them
1245 * returned non-zero status, return it 1241 * returned non-zero status, return it.
1246 * 1242 *
1247 * if a slot doesn't have _STA and if any one of its functions' 1243 * If a slot doesn't have _STA and if any one of its functions'
1248 * configuration space is configured, return 0x0f as a _STA 1244 * configuration space is configured, return 0x0f as a _STA.
1249 * 1245 *
1250 * otherwise return 0 1246 * Otherwise return 0.
1251 */ 1247 */
1252static unsigned int get_slot_status(struct acpiphp_slot *slot) 1248static unsigned int get_slot_status(struct acpiphp_slot *slot)
1253{ 1249{
@@ -1281,6 +1277,7 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
1281 1277
1282/** 1278/**
1283 * acpiphp_eject_slot - physically eject the slot 1279 * acpiphp_eject_slot - physically eject the slot
1280 * @slot: ACPI PHP slot
1284 */ 1281 */
1285int acpiphp_eject_slot(struct acpiphp_slot *slot) 1282int acpiphp_eject_slot(struct acpiphp_slot *slot)
1286{ 1283{
@@ -1314,6 +1311,7 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot)
1314 1311
1315/** 1312/**
1316 * acpiphp_check_bridge - re-enumerate devices 1313 * acpiphp_check_bridge - re-enumerate devices
1314 * @bridge: where to begin re-enumeration
1317 * 1315 *
1318 * Iterate over all slots under this bridge and make sure that if a 1316 * Iterate over all slots under this bridge and make sure that if a
1319 * card is present they are enabled, and if not they are disabled. 1317 * card is present they are enabled, and if not they are disabled.
@@ -1538,13 +1536,11 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
1538 1536
1539/** 1537/**
1540 * handle_hotplug_event_bridge - handle ACPI event on bridges 1538 * handle_hotplug_event_bridge - handle ACPI event on bridges
1541 *
1542 * @handle: Notify()'ed acpi_handle 1539 * @handle: Notify()'ed acpi_handle
1543 * @type: Notify code 1540 * @type: Notify code
1544 * @context: pointer to acpiphp_bridge structure 1541 * @context: pointer to acpiphp_bridge structure
1545 * 1542 *
1546 * handles ACPI event notification on {host,p2p} bridges 1543 * Handles ACPI event notification on {host,p2p} bridges.
1547 *
1548 */ 1544 */
1549static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context) 1545static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context)
1550{ 1546{
@@ -1634,13 +1630,11 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1634 1630
1635/** 1631/**
1636 * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) 1632 * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots)
1637 *
1638 * @handle: Notify()'ed acpi_handle 1633 * @handle: Notify()'ed acpi_handle
1639 * @type: Notify code 1634 * @type: Notify code
1640 * @context: pointer to acpiphp_func structure 1635 * @context: pointer to acpiphp_func structure
1641 * 1636 *
1642 * handles ACPI event notification on slots 1637 * Handles ACPI event notification on slots.
1643 *
1644 */ 1638 */
1645static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) 1639static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context)
1646{ 1640{
@@ -1705,7 +1699,6 @@ static struct acpi_pci_driver acpi_pci_hp_driver = {
1705 1699
1706/** 1700/**
1707 * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures 1701 * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures
1708 *
1709 */ 1702 */
1710int __init acpiphp_glue_init(void) 1703int __init acpiphp_glue_init(void)
1711{ 1704{
@@ -1726,7 +1719,7 @@ int __init acpiphp_glue_init(void)
1726/** 1719/**
1727 * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures 1720 * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures
1728 * 1721 *
1729 * This function frees all data allocated in acpiphp_glue_init() 1722 * This function frees all data allocated in acpiphp_glue_init().
1730 */ 1723 */
1731void acpiphp_glue_exit(void) 1724void acpiphp_glue_exit(void)
1732{ 1725{
@@ -1760,7 +1753,6 @@ int __init acpiphp_get_num_slots(void)
1760 * acpiphp_for_each_slot - call function for each slot 1753 * acpiphp_for_each_slot - call function for each slot
1761 * @fn: callback function 1754 * @fn: callback function
1762 * @data: context to be passed to callback function 1755 * @data: context to be passed to callback function
1763 *
1764 */ 1756 */
1765static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) 1757static int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
1766{ 1758{
@@ -1786,6 +1778,7 @@ static int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
1786 1778
1787/** 1779/**
1788 * acpiphp_enable_slot - power on slot 1780 * acpiphp_enable_slot - power on slot
1781 * @slot: ACPI PHP slot
1789 */ 1782 */
1790int acpiphp_enable_slot(struct acpiphp_slot *slot) 1783int acpiphp_enable_slot(struct acpiphp_slot *slot)
1791{ 1784{
@@ -1815,6 +1808,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot)
1815 1808
1816/** 1809/**
1817 * acpiphp_disable_slot - power off slot 1810 * acpiphp_disable_slot - power off slot
1811 * @slot: ACPI PHP slot
1818 */ 1812 */
1819int acpiphp_disable_slot(struct acpiphp_slot *slot) 1813int acpiphp_disable_slot(struct acpiphp_slot *slot)
1820{ 1814{
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 56829f82be4a..47d26b65e99a 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -134,11 +134,11 @@ static struct acpiphp_attention_info ibm_attention_info =
134 * ibm_slot_from_id - workaround for bad ibm hardware 134 * ibm_slot_from_id - workaround for bad ibm hardware
135 * @id: the slot number that linux refers to the slot by 135 * @id: the slot number that linux refers to the slot by
136 * 136 *
137 * Description: this method returns the aCPI slot descriptor 137 * Description: This method returns the aCPI slot descriptor
138 * corresponding to the Linux slot number. This descriptor 138 * corresponding to the Linux slot number. This descriptor
139 * has info about the aPCI slot id and attention status. 139 * has info about the aPCI slot id and attention status.
140 * This descriptor must be freed using kfree when done. 140 * This descriptor must be freed using kfree when done.
141 **/ 141 */
142static union apci_descriptor *ibm_slot_from_id(int id) 142static union apci_descriptor *ibm_slot_from_id(int id)
143{ 143{
144 int ind = 0, size; 144 int ind = 0, size;
@@ -173,9 +173,9 @@ ibm_slot_done:
173 * @slot: the hotplug_slot to work with 173 * @slot: the hotplug_slot to work with
174 * @status: what to set the LED to (0 or 1) 174 * @status: what to set the LED to (0 or 1)
175 * 175 *
176 * Description: this method is registered with the acpiphp module as a 176 * Description: This method is registered with the acpiphp module as a
177 * callback to do the device specific task of setting the LED status 177 * callback to do the device specific task of setting the LED status.
178 **/ 178 */
179static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) 179static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
180{ 180{
181 union acpi_object args[2]; 181 union acpi_object args[2];
@@ -213,13 +213,13 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
213 * @slot: the hotplug_slot to work with 213 * @slot: the hotplug_slot to work with
214 * @status: returns what the LED is set to (0 or 1) 214 * @status: returns what the LED is set to (0 or 1)
215 * 215 *
216 * Description: this method is registered with the acpiphp module as a 216 * Description: This method is registered with the acpiphp module as a
217 * callback to do the device specific task of getting the LED status 217 * callback to do the device specific task of getting the LED status.
218 * 218 *
219 * Because there is no direct method of getting the LED status directly 219 * Because there is no direct method of getting the LED status directly
220 * from an ACPI call, we read the aPCI table and parse out our 220 * from an ACPI call, we read the aPCI table and parse out our
221 * slot descriptor to read the status from that. 221 * slot descriptor to read the status from that.
222 **/ 222 */
223static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) 223static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
224{ 224{
225 union apci_descriptor *ibm_slot; 225 union apci_descriptor *ibm_slot;
@@ -245,8 +245,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
245 * @event: the event info (device specific) 245 * @event: the event info (device specific)
246 * @context: passed context (our notification struct) 246 * @context: passed context (our notification struct)
247 * 247 *
248 * Description: this method is registered as a callback with the ACPI 248 * Description: This method is registered as a callback with the ACPI
249 * subsystem it is called when this device has an event to notify the OS of 249 * subsystem it is called when this device has an event to notify the OS of.
250 * 250 *
251 * The events actually come from the device as two events that get 251 * The events actually come from the device as two events that get
252 * synthesized into one event with data by this function. The event 252 * synthesized into one event with data by this function. The event
@@ -256,7 +256,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
256 * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will 256 * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will
257 * only re-enable the interrupt that causes this event AFTER this method 257 * only re-enable the interrupt that causes this event AFTER this method
258 * has returned, thereby enforcing serial access for the notification struct. 258 * has returned, thereby enforcing serial access for the notification struct.
259 **/ 259 */
260static void ibm_handle_events(acpi_handle handle, u32 event, void *context) 260static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
261{ 261{
262 u8 detail = event & 0x0f; 262 u8 detail = event & 0x0f;
@@ -279,16 +279,16 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
279 * ibm_get_table_from_acpi - reads the APLS buffer from ACPI 279 * ibm_get_table_from_acpi - reads the APLS buffer from ACPI
280 * @bufp: address to pointer to allocate for the table 280 * @bufp: address to pointer to allocate for the table
281 * 281 *
282 * Description: this method reads the APLS buffer in from ACPI and 282 * Description: This method reads the APLS buffer in from ACPI and
283 * stores the "stripped" table into a single buffer 283 * stores the "stripped" table into a single buffer
284 * it allocates and passes the address back in bufp 284 * it allocates and passes the address back in bufp.
285 * 285 *
286 * If NULL is passed in as buffer, this method only calculates 286 * If NULL is passed in as buffer, this method only calculates
287 * the size of the table and returns that without filling 287 * the size of the table and returns that without filling
288 * in the buffer 288 * in the buffer.
289 * 289 *
290 * returns < 0 on error or the size of the table on success 290 * Returns < 0 on error or the size of the table on success.
291 **/ 291 */
292static int ibm_get_table_from_acpi(char **bufp) 292static int ibm_get_table_from_acpi(char **bufp)
293{ 293{
294 union acpi_object *package; 294 union acpi_object *package;
@@ -349,17 +349,18 @@ read_table_done:
349/** 349/**
350 * ibm_read_apci_table - callback for the sysfs apci_table file 350 * ibm_read_apci_table - callback for the sysfs apci_table file
351 * @kobj: the kobject this binary attribute is a part of 351 * @kobj: the kobject this binary attribute is a part of
352 * @bin_attr: struct bin_attribute for this file
352 * @buffer: the kernel space buffer to fill 353 * @buffer: the kernel space buffer to fill
353 * @pos: the offset into the file 354 * @pos: the offset into the file
354 * @size: the number of bytes requested 355 * @size: the number of bytes requested
355 * 356 *
356 * Description: gets registered with sysfs as the reader callback 357 * Description: Gets registered with sysfs as the reader callback
357 * to be executed when /sys/bus/pci/slots/apci_table gets read 358 * to be executed when /sys/bus/pci/slots/apci_table gets read.
358 * 359 *
359 * Since we don't get notified on open and close for this file, 360 * Since we don't get notified on open and close for this file,
360 * things get really tricky here... 361 * things get really tricky here...
361 * our solution is to only allow reading the table in all at once 362 * our solution is to only allow reading the table in all at once.
362 **/ 363 */
363static ssize_t ibm_read_apci_table(struct kobject *kobj, 364static ssize_t ibm_read_apci_table(struct kobject *kobj,
364 struct bin_attribute *bin_attr, 365 struct bin_attribute *bin_attr,
365 char *buffer, loff_t pos, size_t size) 366 char *buffer, loff_t pos, size_t size)
@@ -385,10 +386,10 @@ static ssize_t ibm_read_apci_table(struct kobject *kobj,
385 * @context: a pointer to our handle to fill when we find the device 386 * @context: a pointer to our handle to fill when we find the device
386 * @rv: a return value to fill if desired 387 * @rv: a return value to fill if desired
387 * 388 *
388 * Description: used as a callback when calling acpi_walk_namespace 389 * Description: Used as a callback when calling acpi_walk_namespace
389 * to find our device. When this method returns non-zero 390 * to find our device. When this method returns non-zero
390 * acpi_walk_namespace quits its search and returns our value 391 * acpi_walk_namespace quits its search and returns our value.
391 **/ 392 */
392static acpi_status __init ibm_find_acpi_device(acpi_handle handle, 393static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
393 u32 lvl, void *context, void **rv) 394 u32 lvl, void *context, void **rv)
394{ 395{
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index a96b739b2d35..74178875b949 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -117,12 +117,10 @@ static inline int is_slot66mhz(struct slot *slot)
117 117
118/** 118/**
119 * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region. 119 * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region.
120 *
121 * @begin: begin pointer for region to be scanned. 120 * @begin: begin pointer for region to be scanned.
122 * @end: end pointer for region to be scanned. 121 * @end: end pointer for region to be scanned.
123 * 122 *
124 * Returns pointer to the head of the SMBIOS tables (or NULL) 123 * Returns pointer to the head of the SMBIOS tables (or %NULL).
125 *
126 */ 124 */
127static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) 125static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end)
128{ 126{
@@ -157,9 +155,9 @@ static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *e
157 155
158/** 156/**
159 * init_SERR - Initializes the per slot SERR generation. 157 * init_SERR - Initializes the per slot SERR generation.
158 * @ctrl: controller to use
160 * 159 *
161 * For unexpected switch opens 160 * For unexpected switch opens
162 *
163 */ 161 */
164static int init_SERR(struct controller * ctrl) 162static int init_SERR(struct controller * ctrl)
165{ 163{
@@ -224,14 +222,15 @@ static int pci_print_IRQ_route (void)
224 222
225/** 223/**
226 * get_subsequent_smbios_entry: get the next entry from bios table. 224 * get_subsequent_smbios_entry: get the next entry from bios table.
227 * 225 * @smbios_start: where to start in the SMBIOS table
228 * Gets the first entry if previous == NULL 226 * @smbios_table: location of the SMBIOS table
229 * Otherwise, returns the next entry
230 * Uses global SMBIOS Table pointer
231 *
232 * @curr: %NULL or pointer to previously returned structure 227 * @curr: %NULL or pointer to previously returned structure
233 * 228 *
234 * returns a pointer to an SMBIOS structure or NULL if none found 229 * Gets the first entry if previous == NULL;
230 * otherwise, returns the next entry.
231 * Uses global SMBIOS Table pointer.
232 *
233 * Returns a pointer to an SMBIOS structure or NULL if none found.
235 */ 234 */
236static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, 235static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start,
237 void __iomem *smbios_table, 236 void __iomem *smbios_table,
@@ -272,17 +271,18 @@ static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start,
272 271
273 272
274/** 273/**
275 * get_SMBIOS_entry 274 * get_SMBIOS_entry - return the requested SMBIOS entry or %NULL
276 * 275 * @smbios_start: where to start in the SMBIOS table
277 * @type:SMBIOS structure type to be returned 276 * @smbios_table: location of the SMBIOS table
277 * @type: SMBIOS structure type to be returned
278 * @previous: %NULL or pointer to previously returned structure 278 * @previous: %NULL or pointer to previously returned structure
279 * 279 *
280 * Gets the first entry of the specified type if previous == NULL 280 * Gets the first entry of the specified type if previous == %NULL;
281 * Otherwise, returns the next entry of the given type. 281 * Otherwise, returns the next entry of the given type.
282 * Uses global SMBIOS Table pointer 282 * Uses global SMBIOS Table pointer.
283 * Uses get_subsequent_smbios_entry 283 * Uses get_subsequent_smbios_entry.
284 * 284 *
285 * returns a pointer to an SMBIOS structure or %NULL if none found 285 * Returns a pointer to an SMBIOS structure or %NULL if none found.
286 */ 286 */
287static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, 287static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start,
288 void __iomem *smbios_table, 288 void __iomem *smbios_table,
@@ -581,7 +581,9 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
581 581
582/** 582/**
583 * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off 583 * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off
584 * 584 * @ctrl: struct controller to use
585 * @func: PCI device/function info
586 * @status: LED control flag: 1 = LED on, 0 = LED off
585 */ 587 */
586static int 588static int
587cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, 589cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func,
@@ -621,7 +623,8 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func,
621 623
622/** 624/**
623 * set_attention_status - Turns the Amber LED for a slot on or off 625 * set_attention_status - Turns the Amber LED for a slot on or off
624 * 626 * @hotplug_slot: slot to change LED on
627 * @status: LED control flag
625 */ 628 */
626static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) 629static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
627{ 630{
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 856d57b4d604..4018420c6f95 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -123,7 +123,7 @@ static u8 handle_switch_change(u8 change, struct controller * ctrl)
123} 123}
124 124
125/** 125/**
126 * cpqhp_find_slot: find the struct slot of given device 126 * cpqhp_find_slot - find the struct slot of given device
127 * @ctrl: scan lots of this controller 127 * @ctrl: scan lots of this controller
128 * @device: the device id to find 128 * @device: the device id to find
129 */ 129 */
@@ -305,9 +305,8 @@ static u8 handle_power_fault(u8 change, struct controller * ctrl)
305 305
306 306
307/** 307/**
308 * sort_by_size: sort nodes on the list by their length, smallest first. 308 * sort_by_size - sort nodes on the list by their length, smallest first.
309 * @head: list to sort 309 * @head: list to sort
310 *
311 */ 310 */
312static int sort_by_size(struct pci_resource **head) 311static int sort_by_size(struct pci_resource **head)
313{ 312{
@@ -354,9 +353,8 @@ static int sort_by_size(struct pci_resource **head)
354 353
355 354
356/** 355/**
357 * sort_by_max_size: sort nodes on the list by their length, largest first. 356 * sort_by_max_size - sort nodes on the list by their length, largest first.
358 * @head: list to sort 357 * @head: list to sort
359 *
360 */ 358 */
361static int sort_by_max_size(struct pci_resource **head) 359static int sort_by_max_size(struct pci_resource **head)
362{ 360{
@@ -403,8 +401,10 @@ static int sort_by_max_size(struct pci_resource **head)
403 401
404 402
405/** 403/**
406 * do_pre_bridge_resource_split: find node of resources that are unused 404 * do_pre_bridge_resource_split - find node of resources that are unused
407 * 405 * @head: new list head
406 * @orig_head: original list head
407 * @alignment: max node size (?)
408 */ 408 */
409static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, 409static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head,
410 struct pci_resource **orig_head, u32 alignment) 410 struct pci_resource **orig_head, u32 alignment)
@@ -477,8 +477,9 @@ static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **h
477 477
478 478
479/** 479/**
480 * do_bridge_resource_split: find one node of resources that aren't in use 480 * do_bridge_resource_split - find one node of resources that aren't in use
481 * 481 * @head: list head
482 * @alignment: max node size (?)
482 */ 483 */
483static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) 484static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment)
484{ 485{
@@ -525,14 +526,13 @@ error:
525 526
526 527
527/** 528/**
528 * get_io_resource: find first node of given size not in ISA aliasing window. 529 * get_io_resource - find first node of given size not in ISA aliasing window.
529 * @head: list to search 530 * @head: list to search
530 * @size: size of node to find, must be a power of two. 531 * @size: size of node to find, must be a power of two.
531 * 532 *
532 * Description: this function sorts the resource list by size and then returns 533 * Description: This function sorts the resource list by size and then returns
533 * returns the first node of "size" length that is not in the ISA aliasing 534 * returns the first node of "size" length that is not in the ISA aliasing
534 * window. If it finds a node larger than "size" it will split it up. 535 * window. If it finds a node larger than "size" it will split it up.
535 *
536 */ 536 */
537static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) 537static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size)
538{ 538{
@@ -620,7 +620,7 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size
620 620
621 621
622/** 622/**
623 * get_max_resource: get largest node which has at least the given size. 623 * get_max_resource - get largest node which has at least the given size.
624 * @head: the list to search the node in 624 * @head: the list to search the node in
625 * @size: the minimum size of the node to find 625 * @size: the minimum size of the node to find
626 * 626 *
@@ -712,7 +712,7 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz
712 712
713 713
714/** 714/**
715 * get_resource: find resource of given size and split up larger ones. 715 * get_resource - find resource of given size and split up larger ones.
716 * @head: the list to search for resources 716 * @head: the list to search for resources
717 * @size: the size limit to use 717 * @size: the size limit to use
718 * 718 *
@@ -804,14 +804,14 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
804 804
805 805
806/** 806/**
807 * cpqhp_resource_sort_and_combine: sort nodes by base addresses and clean up. 807 * cpqhp_resource_sort_and_combine - sort nodes by base addresses and clean up
808 * @head: the list to sort and clean up 808 * @head: the list to sort and clean up
809 * 809 *
810 * Description: Sorts all of the nodes in the list in ascending order by 810 * Description: Sorts all of the nodes in the list in ascending order by
811 * their base addresses. Also does garbage collection by 811 * their base addresses. Also does garbage collection by
812 * combining adjacent nodes. 812 * combining adjacent nodes.
813 * 813 *
814 * returns 0 if success 814 * Returns %0 if success.
815 */ 815 */
816int cpqhp_resource_sort_and_combine(struct pci_resource **head) 816int cpqhp_resource_sort_and_combine(struct pci_resource **head)
817{ 817{
@@ -951,9 +951,9 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
951 951
952/** 952/**
953 * cpqhp_slot_create - Creates a node and adds it to the proper bus. 953 * cpqhp_slot_create - Creates a node and adds it to the proper bus.
954 * @busnumber - bus where new node is to be located 954 * @busnumber: bus where new node is to be located
955 * 955 *
956 * Returns pointer to the new node or NULL if unsuccessful 956 * Returns pointer to the new node or %NULL if unsuccessful.
957 */ 957 */
958struct pci_func *cpqhp_slot_create(u8 busnumber) 958struct pci_func *cpqhp_slot_create(u8 busnumber)
959{ 959{
@@ -986,7 +986,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber)
986 * slot_remove - Removes a node from the linked list of slots. 986 * slot_remove - Removes a node from the linked list of slots.
987 * @old_slot: slot to remove 987 * @old_slot: slot to remove
988 * 988 *
989 * Returns 0 if successful, !0 otherwise. 989 * Returns %0 if successful, !0 otherwise.
990 */ 990 */
991static int slot_remove(struct pci_func * old_slot) 991static int slot_remove(struct pci_func * old_slot)
992{ 992{
@@ -1026,7 +1026,7 @@ static int slot_remove(struct pci_func * old_slot)
1026 * bridge_slot_remove - Removes a node from the linked list of slots. 1026 * bridge_slot_remove - Removes a node from the linked list of slots.
1027 * @bridge: bridge to remove 1027 * @bridge: bridge to remove
1028 * 1028 *
1029 * Returns 0 if successful, !0 otherwise. 1029 * Returns %0 if successful, !0 otherwise.
1030 */ 1030 */
1031static int bridge_slot_remove(struct pci_func *bridge) 1031static int bridge_slot_remove(struct pci_func *bridge)
1032{ 1032{
@@ -1071,7 +1071,7 @@ out:
1071 * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed 1071 * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed
1072 * @bus: bus to find 1072 * @bus: bus to find
1073 * @device: device to find 1073 * @device: device to find
1074 * @index: is 0 for first function found, 1 for the second... 1074 * @index: is %0 for first function found, %1 for the second...
1075 * 1075 *
1076 * Returns pointer to the node if successful, %NULL otherwise. 1076 * Returns pointer to the node if successful, %NULL otherwise.
1077 */ 1077 */
@@ -1115,16 +1115,13 @@ static int is_bridge(struct pci_func * func)
1115 1115
1116 1116
1117/** 1117/**
1118 * set_controller_speed - set the frequency and/or mode of a specific 1118 * set_controller_speed - set the frequency and/or mode of a specific controller segment.
1119 * controller segment.
1120 *
1121 * @ctrl: controller to change frequency/mode for. 1119 * @ctrl: controller to change frequency/mode for.
1122 * @adapter_speed: the speed of the adapter we want to match. 1120 * @adapter_speed: the speed of the adapter we want to match.
1123 * @hp_slot: the slot number where the adapter is installed. 1121 * @hp_slot: the slot number where the adapter is installed.
1124 * 1122 *
1125 * Returns 0 if we successfully change frequency and/or mode to match the 1123 * Returns %0 if we successfully change frequency and/or mode to match the
1126 * adapter speed. 1124 * adapter speed.
1127 *
1128 */ 1125 */
1129static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot) 1126static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot)
1130{ 1127{
@@ -1253,13 +1250,14 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
1253 1250
1254/** 1251/**
1255 * board_replaced - Called after a board has been replaced in the system. 1252 * board_replaced - Called after a board has been replaced in the system.
1253 * @func: PCI device/function information
1254 * @ctrl: hotplug controller
1256 * 1255 *
1257 * This is only used if we don't have resources for hot add 1256 * This is only used if we don't have resources for hot add.
1258 * Turns power on for the board 1257 * Turns power on for the board.
1259 * Checks to see if board is the same 1258 * Checks to see if board is the same.
1260 * If board is same, reconfigures it 1259 * If board is same, reconfigures it.
1261 * If board isn't same, turns it back off. 1260 * If board isn't same, turns it back off.
1262 *
1263 */ 1261 */
1264static u32 board_replaced(struct pci_func *func, struct controller *ctrl) 1262static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
1265{ 1263{
@@ -1403,10 +1401,11 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
1403 1401
1404/** 1402/**
1405 * board_added - Called after a board has been added to the system. 1403 * board_added - Called after a board has been added to the system.
1404 * @func: PCI device/function info
1405 * @ctrl: hotplug controller
1406 * 1406 *
1407 * Turns power on for the board 1407 * Turns power on for the board.
1408 * Configures board 1408 * Configures board.
1409 *
1410 */ 1409 */
1411static u32 board_added(struct pci_func *func, struct controller *ctrl) 1410static u32 board_added(struct pci_func *func, struct controller *ctrl)
1412{ 1411{
@@ -1607,8 +1606,10 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
1607 1606
1608 1607
1609/** 1608/**
1610 * remove_board - Turns off slot and LED's 1609 * remove_board - Turns off slot and LEDs
1611 * 1610 * @func: PCI device/function info
1611 * @replace_flag: whether replacing or adding a new device
1612 * @ctrl: target controller
1612 */ 1613 */
1613static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) 1614static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl)
1614{ 1615{
@@ -1902,11 +1903,11 @@ static void interrupt_event_handler(struct controller *ctrl)
1902 1903
1903 1904
1904/** 1905/**
1905 * cpqhp_pushbutton_thread 1906 * cpqhp_pushbutton_thread - handle pushbutton events
1907 * @slot: target slot (struct)
1906 * 1908 *
1907 * Scheduled procedure to handle blocking stuff for the pushbuttons 1909 * Scheduled procedure to handle blocking stuff for the pushbuttons.
1908 * Handles all pending events and exits. 1910 * Handles all pending events and exits.
1909 *
1910 */ 1911 */
1911void cpqhp_pushbutton_thread(unsigned long slot) 1912void cpqhp_pushbutton_thread(unsigned long slot)
1912{ 1913{
@@ -2137,9 +2138,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
2137} 2138}
2138 2139
2139/** 2140/**
2140 * switch_leds: switch the leds, go from one site to the other. 2141 * switch_leds - switch the leds, go from one site to the other.
2141 * @ctrl: controller to use 2142 * @ctrl: controller to use
2142 * @num_of_slots: number of slots to use 2143 * @num_of_slots: number of slots to use
2144 * @work_LED: LED control value
2143 * @direction: 1 to start from the left side, 0 to start right. 2145 * @direction: 1 to start from the left side, 0 to start right.
2144 */ 2146 */
2145static void switch_leds(struct controller *ctrl, const int num_of_slots, 2147static void switch_leds(struct controller *ctrl, const int num_of_slots,
@@ -2165,11 +2167,11 @@ static void switch_leds(struct controller *ctrl, const int num_of_slots,
2165} 2167}
2166 2168
2167/** 2169/**
2168 * hardware_test - runs hardware tests 2170 * cpqhp_hardware_test - runs hardware tests
2171 * @ctrl: target controller
2172 * @test_num: the number written to the "test" file in sysfs.
2169 * 2173 *
2170 * For hot plug ctrl folks to play with. 2174 * For hot plug ctrl folks to play with.
2171 * test_num is the number written to the "test" file in sysfs
2172 *
2173 */ 2175 */
2174int cpqhp_hardware_test(struct controller *ctrl, int test_num) 2176int cpqhp_hardware_test(struct controller *ctrl, int test_num)
2175{ 2177{
@@ -2249,14 +2251,12 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num)
2249 2251
2250/** 2252/**
2251 * configure_new_device - Configures the PCI header information of one board. 2253 * configure_new_device - Configures the PCI header information of one board.
2252 *
2253 * @ctrl: pointer to controller structure 2254 * @ctrl: pointer to controller structure
2254 * @func: pointer to function structure 2255 * @func: pointer to function structure
2255 * @behind_bridge: 1 if this is a recursive call, 0 if not 2256 * @behind_bridge: 1 if this is a recursive call, 0 if not
2256 * @resources: pointer to set of resource lists 2257 * @resources: pointer to set of resource lists
2257 * 2258 *
2258 * Returns 0 if success 2259 * Returns 0 if success.
2259 *
2260 */ 2260 */
2261static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, 2261static u32 configure_new_device(struct controller * ctrl, struct pci_func * func,
2262 u8 behind_bridge, struct resource_lists * resources) 2262 u8 behind_bridge, struct resource_lists * resources)
@@ -2346,15 +2346,13 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func
2346 2346
2347/** 2347/**
2348 * configure_new_function - Configures the PCI header information of one device 2348 * configure_new_function - Configures the PCI header information of one device
2349 *
2350 * @ctrl: pointer to controller structure 2349 * @ctrl: pointer to controller structure
2351 * @func: pointer to function structure 2350 * @func: pointer to function structure
2352 * @behind_bridge: 1 if this is a recursive call, 0 if not 2351 * @behind_bridge: 1 if this is a recursive call, 0 if not
2353 * @resources: pointer to set of resource lists 2352 * @resources: pointer to set of resource lists
2354 * 2353 *
2355 * Calls itself recursively for bridged devices. 2354 * Calls itself recursively for bridged devices.
2356 * Returns 0 if success 2355 * Returns 0 if success.
2357 *
2358 */ 2356 */
2359static int configure_new_function(struct controller *ctrl, struct pci_func *func, 2357static int configure_new_function(struct controller *ctrl, struct pci_func *func,
2360 u8 behind_bridge, 2358 u8 behind_bridge,
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 027f6865d7e3..d7a293e3faf5 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -165,11 +165,11 @@ static void remove_slot(struct dummy_slot *dslot)
165} 165}
166 166
167/** 167/**
168 * Rescan slot. 168 * pci_rescan_slot - Rescan slot
169 * Tries hard not to re-enable already existing devices 169 * @temp: Device template. Should be set: bus and devfn.
170 * also handles scanning of subfunctions
171 * 170 *
172 * @param temp Device template. Should be set: bus and devfn. 171 * Tries hard not to re-enable already existing devices;
172 * also handles scanning of subfunctions.
173 */ 173 */
174static void pci_rescan_slot(struct pci_dev *temp) 174static void pci_rescan_slot(struct pci_dev *temp)
175{ 175{
@@ -229,10 +229,10 @@ static void pci_rescan_slot(struct pci_dev *temp)
229 229
230 230
231/** 231/**
232 * Rescan PCI bus. 232 * pci_rescan_bus - Rescan PCI bus
233 * call pci_rescan_slot for each possible function of the bus 233 * @bus: the PCI bus to rescan
234 * 234 *
235 * @param bus 235 * Call pci_rescan_slot for each possible function of the bus.
236 */ 236 */
237static void pci_rescan_bus(const struct pci_bus *bus) 237static void pci_rescan_bus(const struct pci_bus *bus)
238{ 238{
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index c8cb49c5a752..f1e0966cee95 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -208,10 +208,10 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
208 208
209/** 209/**
210 * board_added - Called after a board has been added to the system. 210 * board_added - Called after a board has been added to the system.
211 * @p_slot: &slot where board is added
211 * 212 *
212 * Turns power on for the board 213 * Turns power on for the board.
213 * Configures board 214 * Configures board.
214 *
215 */ 215 */
216static int board_added(struct slot *p_slot) 216static int board_added(struct slot *p_slot)
217{ 217{
@@ -276,8 +276,8 @@ err_exit:
276} 276}
277 277
278/** 278/**
279 * remove_board - Turns off slot and LED's 279 * remove_board - Turns off slot and LEDs
280 * 280 * @p_slot: slot where board is being removed
281 */ 281 */
282static int remove_board(struct slot *p_slot) 282static int remove_board(struct slot *p_slot)
283{ 283{
@@ -319,11 +319,11 @@ struct power_work_info {
319}; 319};
320 320
321/** 321/**
322 * pciehp_pushbutton_thread 322 * pciehp_power_thread - handle pushbutton events
323 * @work: &struct work_struct describing work to be done
323 * 324 *
324 * Scheduled procedure to handle blocking stuff for the pushbuttons 325 * Scheduled procedure to handle blocking stuff for the pushbuttons.
325 * Handles all pending events and exits. 326 * Handles all pending events and exits.
326 *
327 */ 327 */
328static void pciehp_power_thread(struct work_struct *work) 328static void pciehp_power_thread(struct work_struct *work)
329{ 329{
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index deb6b5e35feb..b169b0e2647f 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -100,6 +100,7 @@ static struct device_node *find_dlpar_node(char *drc_name, int *node_type)
100 100
101/** 101/**
102 * find_php_slot - return hotplug slot structure for device node 102 * find_php_slot - return hotplug slot structure for device node
103 * @dn: target &device_node
103 * 104 *
104 * This routine will return the hotplug slot structure 105 * This routine will return the hotplug slot structure
105 * for a given device node. Note that built-in PCI slots 106 * for a given device node. Note that built-in PCI slots
@@ -293,9 +294,8 @@ static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn)
293 * dlpar_add_slot - DLPAR add an I/O Slot 294 * dlpar_add_slot - DLPAR add an I/O Slot
294 * @drc_name: drc-name of newly added slot 295 * @drc_name: drc-name of newly added slot
295 * 296 *
296 * Make the hotplug module and the kernel aware 297 * Make the hotplug module and the kernel aware of a newly added I/O Slot.
297 * of a newly added I/O Slot. 298 * Return Codes:
298 * Return Codes -
299 * 0 Success 299 * 0 Success
300 * -ENODEV Not a valid drc_name 300 * -ENODEV Not a valid drc_name
301 * -EINVAL Slot already added 301 * -EINVAL Slot already added
@@ -339,9 +339,9 @@ exit:
339/** 339/**
340 * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot 340 * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot
341 * @drc_name: drc-name of newly added slot 341 * @drc_name: drc-name of newly added slot
342 * @dn: &device_node
342 * 343 *
343 * Remove the kernel and hotplug representations 344 * Remove the kernel and hotplug representations of an I/O Slot.
344 * of an I/O Slot.
345 * Return Codes: 345 * Return Codes:
346 * 0 Success 346 * 0 Success
347 * -EINVAL Vio dev doesn't exist 347 * -EINVAL Vio dev doesn't exist
@@ -359,11 +359,11 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn)
359} 359}
360 360
361/** 361/**
362 * dlpar_remove_slot - DLPAR remove a PCI I/O Slot 362 * dlpar_remove_pci_slot - DLPAR remove a PCI I/O Slot
363 * @drc_name: drc-name of newly added slot 363 * @drc_name: drc-name of newly added slot
364 * @dn: &device_node
364 * 365 *
365 * Remove the kernel and hotplug representations 366 * Remove the kernel and hotplug representations of a PCI I/O Slot.
366 * of a PCI I/O Slot.
367 * Return Codes: 367 * Return Codes:
368 * 0 Success 368 * 0 Success
369 * -ENODEV Not a valid drc_name 369 * -ENODEV Not a valid drc_name
@@ -405,8 +405,7 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
405 * dlpar_remove_slot - DLPAR remove an I/O Slot 405 * dlpar_remove_slot - DLPAR remove an I/O Slot
406 * @drc_name: drc-name of newly added slot 406 * @drc_name: drc-name of newly added slot
407 * 407 *
408 * Remove the kernel and hotplug representations 408 * Remove the kernel and hotplug representations of an I/O Slot.
409 * of an I/O Slot.
410 * Return Codes: 409 * Return Codes:
411 * 0 Success 410 * 0 Success
412 * -ENODEV Not a valid drc_name 411 * -ENODEV Not a valid drc_name
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 458c08ef2654..58f1a9927709 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -54,10 +54,12 @@ module_param(debug, bool, 0644);
54 54
55/** 55/**
56 * set_attention_status - set attention LED 56 * set_attention_status - set attention LED
57 * @hotplug_slot: target &hotplug_slot
58 * @value: LED control value
59 *
57 * echo 0 > attention -- set LED OFF 60 * echo 0 > attention -- set LED OFF
58 * echo 1 > attention -- set LED ON 61 * echo 1 > attention -- set LED ON
59 * echo 2 > attention -- set LED ID(identify, light is blinking) 62 * echo 2 > attention -- set LED ID(identify, light is blinking)
60 *
61 */ 63 */
62static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) 64static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
63{ 65{
@@ -99,6 +101,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
99 101
100/** 102/**
101 * get_attention_status - get attention LED status 103 * get_attention_status - get attention LED status
104 * @hotplug_slot: slot to get status
105 * @value: pointer to store status
102 */ 106 */
103static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 107static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
104{ 108{
@@ -254,6 +258,11 @@ static int is_php_type(char *drc_type)
254 258
255/** 259/**
256 * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 260 * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0
261 * @dn: target &device_node
262 * @indexes: passed to get_children_props()
263 * @names: passed to get_children_props()
264 * @types: returned from get_children_props()
265 * @power_domains:
257 * 266 *
258 * This routine will return true only if the device node is 267 * This routine will return true only if the device node is
259 * a hotpluggable slot. This routine will return false 268 * a hotpluggable slot. This routine will return false
@@ -279,7 +288,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes,
279 288
280/** 289/**
281 * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. 290 * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem.
282 * @dn device node of slot 291 * @dn: device node of slot
283 * 292 *
284 * This subroutine will register a hotplugable slot with the 293 * This subroutine will register a hotplugable slot with the
285 * PCI hotplug infrastructure. This routine is typicaly called 294 * PCI hotplug infrastructure. This routine is typicaly called
@@ -291,7 +300,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes,
291 * routine will just return without doing anything, since embedded 300 * routine will just return without doing anything, since embedded
292 * slots cannot be hotplugged. 301 * slots cannot be hotplugged.
293 * 302 *
294 * To remove a slot, it suffices to call rpaphp_deregister_slot() 303 * To remove a slot, it suffices to call rpaphp_deregister_slot().
295 */ 304 */
296int rpaphp_add_slot(struct device_node *dn) 305int rpaphp_add_slot(struct device_node *dn)
297{ 306{
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 54ca8650d511..0de84533cd80 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -79,6 +79,7 @@ static void set_slot_name(struct slot *slot)
79 79
80/** 80/**
81 * rpaphp_enable_slot - record slot state, config pci device 81 * rpaphp_enable_slot - record slot state, config pci device
82 * @slot: target &slot
82 * 83 *
83 * Initialize values in the slot, and the hotplug_slot info 84 * Initialize values in the slot, and the hotplug_slot info
84 * structures to indicate if there is a pci card plugged into 85 * structures to indicate if there is a pci card plugged into
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index d2fc35598cdd..eb5cac6f08ae 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -231,10 +231,10 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
231 231
232/** 232/**
233 * board_added - Called after a board has been added to the system. 233 * board_added - Called after a board has been added to the system.
234 * @p_slot: target &slot
234 * 235 *
235 * Turns power on for the board 236 * Turns power on for the board.
236 * Configures board 237 * Configures board.
237 *
238 */ 238 */
239static int board_added(struct slot *p_slot) 239static int board_added(struct slot *p_slot)
240{ 240{
@@ -350,8 +350,8 @@ err_exit:
350 350
351 351
352/** 352/**
353 * remove_board - Turns off slot and LED's 353 * remove_board - Turns off slot and LEDs
354 * 354 * @p_slot: target &slot
355 */ 355 */
356static int remove_board(struct slot *p_slot) 356static int remove_board(struct slot *p_slot)
357{ 357{
@@ -397,11 +397,11 @@ struct pushbutton_work_info {
397}; 397};
398 398
399/** 399/**
400 * shpchp_pushbutton_thread 400 * shpchp_pushbutton_thread - handle pushbutton events
401 * @work: &struct work_struct to be handled
401 * 402 *
402 * Scheduled procedure to handle blocking stuff for the pushbuttons 403 * Scheduled procedure to handle blocking stuff for the pushbuttons.
403 * Handles all pending events and exits. 404 * Handles all pending events and exits.
404 *
405 */ 405 */
406static void shpchp_pushbutton_thread(struct work_struct *work) 406static void shpchp_pushbutton_thread(struct work_struct *work)
407{ 407{
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 1b7b2812bf2d..7d1877341aad 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -702,8 +702,10 @@ static int __init pci_sysfs_init(void)
702 sysfs_initialized = 1; 702 sysfs_initialized = 1;
703 for_each_pci_dev(pdev) { 703 for_each_pci_dev(pdev) {
704 retval = pci_create_sysfs_dev_files(pdev); 704 retval = pci_create_sysfs_dev_files(pdev);
705 if (retval) 705 if (retval) {
706 pci_dev_put(pdev);
706 return retval; 707 return retval;
708 }
707 } 709 }
708 710
709 return 0; 711 return 0;
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 92a8469b21ba..3c0d8d138f5a 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -168,11 +168,11 @@ static int find_device_iter(struct device *device, void *data)
168 168
169/** 169/**
170 * find_source_device - search through device hierarchy for source device 170 * find_source_device - search through device hierarchy for source device
171 * @p_dev: pointer to Root Port pci_dev data structure 171 * @parent: pointer to Root Port pci_dev data structure
172 * @id: device ID of agent who sends an error message to this Root Port 172 * @id: device ID of agent who sends an error message to this Root Port
173 * 173 *
174 * Invoked when error is detected at the Root Port. 174 * Invoked when error is detected at the Root Port.
175 **/ 175 */
176static struct device* find_source_device(struct pci_dev *parent, u16 id) 176static struct device* find_source_device(struct pci_dev *parent, u16 id)
177{ 177{
178 struct pci_dev *dev = parent; 178 struct pci_dev *dev = parent;
@@ -286,14 +286,15 @@ static void report_resume(struct pci_dev *dev, void *data)
286 286
287/** 287/**
288 * broadcast_error_message - handle message broadcast to downstream drivers 288 * broadcast_error_message - handle message broadcast to downstream drivers
289 * @device: pointer to from where in a hierarchy message is broadcasted down 289 * @dev: pointer to from where in a hierarchy message is broadcasted down
290 * @api: callback to be broadcasted
291 * @state: error state 290 * @state: error state
291 * @error_mesg: message to print
292 * @cb: callback to be broadcasted
292 * 293 *
293 * Invoked during error recovery process. Once being invoked, the content 294 * Invoked during error recovery process. Once being invoked, the content
294 * of error severity will be broadcasted to all downstream drivers in a 295 * of error severity will be broadcasted to all downstream drivers in a
295 * hierarchy in question. 296 * hierarchy in question.
296 **/ 297 */
297static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, 298static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,
298 enum pci_channel_state state, 299 enum pci_channel_state state,
299 char *error_mesg, 300 char *error_mesg,
@@ -428,7 +429,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
428 * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast 429 * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast
429 * error detected message to all downstream drivers within a hierarchy in 430 * error detected message to all downstream drivers within a hierarchy in
430 * question and return the returned code. 431 * question and return the returned code.
431 **/ 432 */
432static pci_ers_result_t do_recovery(struct pcie_device *aerdev, 433static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
433 struct pci_dev *dev, 434 struct pci_dev *dev,
434 int severity) 435 int severity)
@@ -488,7 +489,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
488 * @info: comprehensive error information 489 * @info: comprehensive error information
489 * 490 *
490 * Invoked when an error being detected by Root Port. 491 * Invoked when an error being detected by Root Port.
491 **/ 492 */
492static void handle_error_source(struct pcie_device * aerdev, 493static void handle_error_source(struct pcie_device * aerdev,
493 struct pci_dev *dev, 494 struct pci_dev *dev,
494 struct aer_err_info info) 495 struct aer_err_info info)
@@ -521,7 +522,7 @@ static void handle_error_source(struct pcie_device * aerdev,
521 * @rpc: pointer to a Root Port data structure 522 * @rpc: pointer to a Root Port data structure
522 * 523 *
523 * Invoked when PCIE bus loads AER service driver. 524 * Invoked when PCIE bus loads AER service driver.
524 **/ 525 */
525void aer_enable_rootport(struct aer_rpc *rpc) 526void aer_enable_rootport(struct aer_rpc *rpc)
526{ 527{
527 struct pci_dev *pdev = rpc->rpd->port; 528 struct pci_dev *pdev = rpc->rpd->port;
@@ -569,7 +570,7 @@ void aer_enable_rootport(struct aer_rpc *rpc)
569 * @rpc: pointer to a Root Port data structure 570 * @rpc: pointer to a Root Port data structure
570 * 571 *
571 * Invoked when PCIE bus unloads AER service driver. 572 * Invoked when PCIE bus unloads AER service driver.
572 **/ 573 */
573static void disable_root_aer(struct aer_rpc *rpc) 574static void disable_root_aer(struct aer_rpc *rpc)
574{ 575{
575 struct pci_dev *pdev = rpc->rpd->port; 576 struct pci_dev *pdev = rpc->rpd->port;
@@ -590,7 +591,7 @@ static void disable_root_aer(struct aer_rpc *rpc)
590 * @rpc: pointer to the root port which holds an error 591 * @rpc: pointer to the root port which holds an error
591 * 592 *
592 * Invoked by DPC handler to consume an error. 593 * Invoked by DPC handler to consume an error.
593 **/ 594 */
594static struct aer_err_source* get_e_source(struct aer_rpc *rpc) 595static struct aer_err_source* get_e_source(struct aer_rpc *rpc)
595{ 596{
596 struct aer_err_source *e_source; 597 struct aer_err_source *e_source;
@@ -655,7 +656,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
655 * aer_isr_one_error - consume an error detected by root port 656 * aer_isr_one_error - consume an error detected by root port
656 * @p_device: pointer to error root port service device 657 * @p_device: pointer to error root port service device
657 * @e_src: pointer to an error source 658 * @e_src: pointer to an error source
658 **/ 659 */
659static void aer_isr_one_error(struct pcie_device *p_device, 660static void aer_isr_one_error(struct pcie_device *p_device,
660 struct aer_err_source *e_src) 661 struct aer_err_source *e_src)
661{ 662{
@@ -706,7 +707,7 @@ static void aer_isr_one_error(struct pcie_device *p_device,
706 * @work: definition of this work item 707 * @work: definition of this work item
707 * 708 *
708 * Invoked, as DPC, when root port records new detected error 709 * Invoked, as DPC, when root port records new detected error
709 **/ 710 */
710void aer_isr(struct work_struct *work) 711void aer_isr(struct work_struct *work)
711{ 712{
712 struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler); 713 struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler);
@@ -729,7 +730,7 @@ void aer_isr(struct work_struct *work)
729 * @rpc: pointer to a root port device being deleted 730 * @rpc: pointer to a root port device being deleted
730 * 731 *
731 * Invoked when AER service unloaded on a specific Root Port 732 * Invoked when AER service unloaded on a specific Root Port
732 **/ 733 */
733void aer_delete_rootport(struct aer_rpc *rpc) 734void aer_delete_rootport(struct aer_rpc *rpc)
734{ 735{
735 /* Disable root port AER itself */ 736 /* Disable root port AER itself */
@@ -743,7 +744,7 @@ void aer_delete_rootport(struct aer_rpc *rpc)
743 * @dev: pointer to AER pcie device 744 * @dev: pointer to AER pcie device
744 * 745 *
745 * Invoked when AER service driver is loaded. 746 * Invoked when AER service driver is loaded.
746 **/ 747 */
747int aer_init(struct pcie_device *dev) 748int aer_init(struct pcie_device *dev)
748{ 749{
749 if (aer_osc_setup(dev) && !forceload) 750 if (aer_osc_setup(dev) && !forceload)
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index df383645e366..26057f98f72e 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -217,7 +217,7 @@ static int slot_reset_iter(struct device *device, void *data)
217 217
218static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) 218static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev)
219{ 219{
220 pci_ers_result_t status; 220 pci_ers_result_t status = PCI_ERS_RESULT_NONE;
221 int retval; 221 int retval;
222 222
223 /* If fatal, restore cfg space for possible link reset at upstream */ 223 /* If fatal, restore cfg space for possible link reset at upstream */
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index cd0a204d96d1..3c5eb374adf8 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -75,6 +75,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
75{ 75{
76 int i = 0; 76 int i = 0;
77 int irq; 77 int irq;
78 int p, t;
78 79
79 if (!valid_IRQ(gsi)) 80 if (!valid_IRQ(gsi))
80 return; 81 return;
@@ -82,18 +83,27 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
82 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && 83 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
83 i < PNP_MAX_IRQ) 84 i < PNP_MAX_IRQ)
84 i++; 85 i++;
85 if (i >= PNP_MAX_IRQ) 86 if (i >= PNP_MAX_IRQ) {
87 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
88 "resources: %d \n", PNP_MAX_IRQ);
86 return; 89 return;
87
88#ifdef CONFIG_X86
89 if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE ||
90 polarity != ACPI_ACTIVE_HIGH)) {
91 pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, "
92 "active high", gsi);
93 triggering = ACPI_EDGE_SENSITIVE;
94 polarity = ACPI_ACTIVE_HIGH;
95 } 90 }
96#endif 91 /*
92 * in IO-APIC mode, use overrided attribute. Two reasons:
93 * 1. BIOS bug in DSDT
94 * 2. BIOS uses IO-APIC mode Interrupt Source Override
95 */
96 if (!acpi_get_override_irq(gsi, &t, &p)) {
97 t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
98 p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
99
100 if (triggering != t || polarity != p) {
101 pnp_warn("IRQ %d override to %s, %s",
102 gsi, t ? "edge":"level", p ? "low":"high");
103 triggering = t;
104 polarity = p;
105 }
106 }
97 107
98 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 108 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
99 res->irq_resource[i].flags |= irq_flags(triggering, polarity); 109 res->irq_resource[i].flags |= irq_flags(triggering, polarity);
@@ -173,6 +183,9 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
173 } 183 }
174 res->dma_resource[i].start = dma; 184 res->dma_resource[i].start = dma;
175 res->dma_resource[i].end = dma; 185 res->dma_resource[i].end = dma;
186 } else {
187 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
188 "resources: %d \n", PNP_MAX_DMA);
176 } 189 }
177} 190}
178 191
@@ -194,6 +207,9 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
194 } 207 }
195 res->port_resource[i].start = io; 208 res->port_resource[i].start = io;
196 res->port_resource[i].end = io + len - 1; 209 res->port_resource[i].end = io + len - 1;
210 } else {
211 printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
212 "resources: %d \n", PNP_MAX_PORT);
197 } 213 }
198} 214}
199 215
@@ -217,6 +233,9 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
217 233
218 res->mem_resource[i].start = mem; 234 res->mem_resource[i].start = mem;
219 res->mem_resource[i].end = mem + len - 1; 235 res->mem_resource[i].end = mem + len - 1;
236 } else {
237 printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
238 "resources: %d\n", PNP_MAX_MEM);
220 } 239 }
221} 240}
222 241
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 41d73a5e9312..e50ebcffb962 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
367 { 367 {
368 struct pci_dev *pci = NULL; 368 struct pci_dev *pci = NULL;
369 for_each_pci_dev(pci) { 369 for_each_pci_dev(pci) {
370 if (pci->irq == *irq) 370 if (pci->irq == *irq) {
371 pci_dev_put(pci);
371 return 0; 372 return 0;
373 }
372 } 374 }
373 } 375 }
374#endif 376#endif
diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile
index 746031de2195..1f5a2d33bf5b 100644
--- a/drivers/ps3/Makefile
+++ b/drivers/ps3/Makefile
@@ -1,6 +1,6 @@
1obj-$(CONFIG_PS3_VUART) += vuart.o 1obj-$(CONFIG_PS3_VUART) += ps3-vuart.o
2obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o 2obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o
3ps3av_mod-objs += ps3av.o ps3av_cmd.o 3ps3av_mod-objs += ps3av.o ps3av_cmd.o
4obj-$(CONFIG_PPC_PS3) += sys-manager-core.o 4obj-$(CONFIG_PPC_PS3) += sys-manager-core.o
5obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o 5obj-$(CONFIG_PS3_SYS_MANAGER) += ps3-sys-manager.o
6obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o 6obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o
diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/ps3-sys-manager.c
index 8461b08ab9fb..8461b08ab9fb 100644
--- a/drivers/ps3/sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/ps3-vuart.c
index 9dea585ef806..9dea585ef806 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/ps3-vuart.c
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index e5cdc0294aaa..1e6715ec51ef 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -447,7 +447,7 @@ config RTC_DRV_AT91RM9200
447 447
448config RTC_DRV_BFIN 448config RTC_DRV_BFIN
449 tristate "Blackfin On-Chip RTC" 449 tristate "Blackfin On-Chip RTC"
450 depends on BFIN 450 depends on BLACKFIN
451 help 451 help
452 If you say yes here you will get support for the 452 If you say yes here you will get support for the
453 Blackfin On-Chip Real Time Clock. 453 Blackfin On-Chip Real Time Clock.
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index de0da545c7a1..a4f56e95cf96 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -293,7 +293,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
293 return -EINVAL; 293 return -EINVAL;
294 294
295 /* Cannot register while the char dev is in use */ 295 /* Cannot register while the char dev is in use */
296 if (!(mutex_trylock(&rtc->char_lock))) 296 if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags))
297 return -EBUSY; 297 return -EBUSY;
298 298
299 spin_lock_irq(&rtc->irq_task_lock); 299 spin_lock_irq(&rtc->irq_task_lock);
@@ -303,7 +303,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
303 } 303 }
304 spin_unlock_irq(&rtc->irq_task_lock); 304 spin_unlock_irq(&rtc->irq_task_lock);
305 305
306 mutex_unlock(&rtc->char_lock); 306 clear_bit(RTC_DEV_BUSY, &rtc->flags);
307 307
308 return retval; 308 return retval;
309} 309}
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 814583bd2fe7..ae1bf177d625 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -26,10 +26,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
26 struct rtc_device, char_dev); 26 struct rtc_device, char_dev);
27 const struct rtc_class_ops *ops = rtc->ops; 27 const struct rtc_class_ops *ops = rtc->ops;
28 28
29 /* We keep the lock as long as the device is in use 29 if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags))
30 * and return immediately if busy
31 */
32 if (!(mutex_trylock(&rtc->char_lock)))
33 return -EBUSY; 30 return -EBUSY;
34 31
35 file->private_data = rtc; 32 file->private_data = rtc;
@@ -43,8 +40,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
43 return 0; 40 return 0;
44 } 41 }
45 42
46 /* something has gone wrong, release the lock */ 43 /* something has gone wrong */
47 mutex_unlock(&rtc->char_lock); 44 clear_bit(RTC_DEV_BUSY, &rtc->flags);
48 return err; 45 return err;
49} 46}
50 47
@@ -405,7 +402,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
405 if (rtc->ops->release) 402 if (rtc->ops->release)
406 rtc->ops->release(rtc->dev.parent); 403 rtc->ops->release(rtc->dev.parent);
407 404
408 mutex_unlock(&rtc->char_lock); 405 clear_bit(RTC_DEV_BUSY, &rtc->flags);
409 return 0; 406 return 0;
410} 407}
411 408
@@ -440,7 +437,6 @@ void rtc_dev_prepare(struct rtc_device *rtc)
440 437
441 rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); 438 rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id);
442 439
443 mutex_init(&rtc->char_lock);
444#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 440#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
445 INIT_WORK(&rtc->uie_task, rtc_uie_task); 441 INIT_WORK(&rtc->uie_task, rtc_uie_task);
446 setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); 442 setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc);
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 838f7ac0dc32..6db31089d2d7 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -483,7 +483,7 @@ static DECLARE_WORK(css_reprobe_work, reprobe_all);
483void css_schedule_reprobe(void) 483void css_schedule_reprobe(void)
484{ 484{
485 need_reprobe = 1; 485 need_reprobe = 1;
486 queue_work(ccw_device_work, &css_reprobe_work); 486 queue_work(slow_path_wq, &css_reprobe_work);
487} 487}
488 488
489EXPORT_SYMBOL_GPL(css_schedule_reprobe); 489EXPORT_SYMBOL_GPL(css_schedule_reprobe);
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 8867443b8060..bfad421cda66 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -1034,7 +1034,7 @@ device_trigger_reprobe(struct subchannel *sch)
1034 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { 1034 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
1035 PREPARE_WORK(&cdev->private->kick_work, 1035 PREPARE_WORK(&cdev->private->kick_work,
1036 ccw_device_move_to_orphanage); 1036 ccw_device_move_to_orphanage);
1037 queue_work(ccw_device_work, &cdev->private->kick_work); 1037 queue_work(slow_path_wq, &cdev->private->kick_work);
1038 } else 1038 } else
1039 ccw_device_start_id(cdev, 0); 1039 ccw_device_start_id(cdev, 0);
1040} 1040}
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c
index f232832f2b22..2f6bf462425e 100644
--- a/drivers/s390/cio/device_id.c
+++ b/drivers/s390/cio/device_id.c
@@ -113,19 +113,10 @@ __ccw_device_sense_id_start(struct ccw_device *cdev)
113{ 113{
114 struct subchannel *sch; 114 struct subchannel *sch;
115 struct ccw1 *ccw; 115 struct ccw1 *ccw;
116 int ret;
117 116
118 sch = to_subchannel(cdev->dev.parent); 117 sch = to_subchannel(cdev->dev.parent);
119 /* Setup sense channel program. */ 118 /* Setup sense channel program. */
120 ccw = cdev->private->iccws; 119 ccw = cdev->private->iccws;
121 if (sch->schib.pmcw.pim != 0x80) {
122 /* more than one path installed. */
123 ccw->cmd_code = CCW_CMD_SUSPEND_RECONN;
124 ccw->cda = 0;
125 ccw->count = 0;
126 ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC;
127 ccw++;
128 }
129 ccw->cmd_code = CCW_CMD_SENSE_ID; 120 ccw->cmd_code = CCW_CMD_SENSE_ID;
130 ccw->cda = (__u32) __pa (&cdev->private->senseid); 121 ccw->cda = (__u32) __pa (&cdev->private->senseid);
131 ccw->count = sizeof (struct senseid); 122 ccw->count = sizeof (struct senseid);
@@ -133,25 +124,9 @@ __ccw_device_sense_id_start(struct ccw_device *cdev)
133 124
134 /* Reset device status. */ 125 /* Reset device status. */
135 memset(&cdev->private->irb, 0, sizeof(struct irb)); 126 memset(&cdev->private->irb, 0, sizeof(struct irb));
127 cdev->private->flags.intretry = 0;
136 128
137 /* Try on every path. */ 129 return cio_start(sch, ccw, LPM_ANYPATH);
138 ret = -ENODEV;
139 while (cdev->private->imask != 0) {
140 if ((sch->opm & cdev->private->imask) != 0 &&
141 cdev->private->iretry > 0) {
142 cdev->private->iretry--;
143 /* Reset internal retry indication. */
144 cdev->private->flags.intretry = 0;
145 ret = cio_start (sch, cdev->private->iccws,
146 cdev->private->imask);
147 /* ret is 0, -EBUSY, -EACCES or -ENODEV */
148 if (ret != -EACCES)
149 return ret;
150 }
151 cdev->private->imask >>= 1;
152 cdev->private->iretry = 5;
153 }
154 return ret;
155} 130}
156 131
157void 132void
@@ -161,8 +136,7 @@ ccw_device_sense_id_start(struct ccw_device *cdev)
161 136
162 memset (&cdev->private->senseid, 0, sizeof (struct senseid)); 137 memset (&cdev->private->senseid, 0, sizeof (struct senseid));
163 cdev->private->senseid.cu_type = 0xFFFF; 138 cdev->private->senseid.cu_type = 0xFFFF;
164 cdev->private->imask = 0x80; 139 cdev->private->iretry = 3;
165 cdev->private->iretry = 5;
166 ret = __ccw_device_sense_id_start(cdev); 140 ret = __ccw_device_sense_id_start(cdev);
167 if (ret && ret != -EBUSY) 141 if (ret && ret != -EBUSY)
168 ccw_device_sense_id_done(cdev, ret); 142 ccw_device_sense_id_done(cdev, ret);
@@ -278,14 +252,13 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event)
278 ccw_device_sense_id_done(cdev, ret); 252 ccw_device_sense_id_done(cdev, ret);
279 break; 253 break;
280 case -EACCES: /* channel is not operational. */ 254 case -EACCES: /* channel is not operational. */
281 sch->lpm &= ~cdev->private->imask;
282 cdev->private->imask >>= 1;
283 cdev->private->iretry = 5;
284 /* fall through. */
285 case -EAGAIN: /* try again. */ 255 case -EAGAIN: /* try again. */
286 ret = __ccw_device_sense_id_start(cdev); 256 cdev->private->iretry--;
287 if (ret == 0 || ret == -EBUSY) 257 if (cdev->private->iretry > 0) {
288 break; 258 ret = __ccw_device_sense_id_start(cdev);
259 if (ret == 0 || ret == -EBUSY)
260 break;
261 }
289 /* fall through. */ 262 /* fall through. */
290 default: /* Sense ID failed. Try asking VM. */ 263 default: /* Sense ID failed. Try asking VM. */
291 if (MACHINE_IS_VM) { 264 if (MACHINE_IS_VM) {
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 8d0244c2e7d4..7a835a35f21d 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -242,16 +242,6 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
242 } 242 }
243} 243}
244 244
245static void hexdump(u8 *x, int len)
246{
247 int i;
248
249 printk("[ ");
250 for (i = 0; i < len; i++)
251 printk("%x ", x[i]);
252 printk("]\n");
253}
254
255static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) 245static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command)
256{ 246{
257 idescsi_scsi_t *scsi = drive_to_idescsi(drive); 247 idescsi_scsi_t *scsi = drive_to_idescsi(drive);
@@ -282,7 +272,8 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
282 pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; 272 pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd;
283 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 273 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
284 printk ("ide-scsi: %s: queue cmd = ", drive->name); 274 printk ("ide-scsi: %s: queue cmd = ", drive->name);
285 hexdump(pc->c, 6); 275 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, pc->c,
276 6, 0);
286 } 277 }
287 rq->rq_disk = scsi->disk; 278 rq->rq_disk = scsi->disk;
288 return ide_do_drive_cmd(drive, rq, ide_preempt); 279 return ide_do_drive_cmd(drive, rq, ide_preempt);
@@ -337,7 +328,8 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
337 idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; 328 idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer;
338 if (log) { 329 if (log) {
339 printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); 330 printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number);
340 hexdump(pc->buffer,16); 331 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1,
332 pc->buffer, 16, 0);
341 } 333 }
342 memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); 334 memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE);
343 kfree(pc->buffer); 335 kfree(pc->buffer);
@@ -816,10 +808,12 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
816 808
817 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 809 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
818 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); 810 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number);
819 hexdump(cmd->cmnd, cmd->cmd_len); 811 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1,
812 cmd->cmnd, cmd->cmd_len, 0);
820 if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { 813 if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) {
821 printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); 814 printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number);
822 hexdump(pc->c, 12); 815 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1,
816 pc->c, 12, 0);
823 } 817 }
824 } 818 }
825 819
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index ac67394c7373..64d40a2d4d4d 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -13,7 +13,10 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/zorro.h> 15#include <linux/zorro.h>
16
17#include <asm/amigahw.h>
16#include <asm/amigaints.h> 18#include <asm/amigaints.h>
19
17#include <scsi/scsi_host.h> 20#include <scsi/scsi_host.h>
18#include <scsi/scsi_transport_spi.h> 21#include <scsi/scsi_transport_spi.h>
19 22
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ed438bc7e98d..d7e1996e2fec 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -600,7 +600,7 @@ config SERIAL_SA1100_CONSOLE
600 600
601config SERIAL_BFIN 601config SERIAL_BFIN
602 tristate "Blackfin serial port support" 602 tristate "Blackfin serial port support"
603 depends on BFIN 603 depends on BLACKFIN
604 select SERIAL_CORE 604 select SERIAL_CORE
605 select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) 605 select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561)
606 help 606 help
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index f3257f708ef9..9c95bc0398ad 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -45,8 +45,6 @@
45 45
46#include "ip22zilog.h" 46#include "ip22zilog.h"
47 47
48void ip22_do_break(void);
49
50/* 48/*
51 * On IP22 we need to delay after register accesses but we do not need to 49 * On IP22 we need to delay after register accesses but we do not need to
52 * flush writes. 50 * flush writes.
@@ -81,12 +79,9 @@ struct uart_ip22zilog_port {
81#define IP22ZILOG_FLAG_REGS_HELD 0x00000040 79#define IP22ZILOG_FLAG_REGS_HELD 0x00000040
82#define IP22ZILOG_FLAG_TX_STOPPED 0x00000080 80#define IP22ZILOG_FLAG_TX_STOPPED 0x00000080
83#define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100 81#define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100
82#define IP22ZILOG_FLAG_RESET_DONE 0x00000200
84 83
85 unsigned int cflag; 84 unsigned int tty_break;
86
87 /* L1-A keyboard break state. */
88 int kbd_id;
89 int l1_down;
90 85
91 unsigned char parity_mask; 86 unsigned char parity_mask;
92 unsigned char prev_status; 87 unsigned char prev_status;
@@ -250,13 +245,26 @@ static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up,
250 } 245 }
251} 246}
252 247
253static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, 248#define Rx_BRK 0x0100 /* BREAK event software flag. */
254 struct zilog_channel *channel) 249#define Rx_SYS 0x0200 /* SysRq event software flag. */
250
251static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
252 struct zilog_channel *channel)
255{ 253{
256 struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */ 254 struct tty_struct *tty;
255 unsigned char ch, flag;
256 unsigned int r1;
257
258 tty = NULL;
259 if (up->port.info != NULL &&
260 up->port.info->tty != NULL)
261 tty = up->port.info->tty;
257 262
258 while (1) { 263 for (;;) {
259 unsigned char ch, r1, flag; 264 ch = readb(&channel->control);
265 ZSDELAY();
266 if (!(ch & Rx_CH_AV))
267 break;
260 268
261 r1 = read_zsreg(channel, R1); 269 r1 = read_zsreg(channel, R1);
262 if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { 270 if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
@@ -265,43 +273,26 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
265 ZS_WSYNC(channel); 273 ZS_WSYNC(channel);
266 } 274 }
267 275
268 ch = readb(&channel->control);
269 ZSDELAY();
270
271 /* This funny hack depends upon BRK_ABRT not interfering
272 * with the other bits we care about in R1.
273 */
274 if (ch & BRK_ABRT)
275 r1 |= BRK_ABRT;
276
277 ch = readb(&channel->data); 276 ch = readb(&channel->data);
278 ZSDELAY(); 277 ZSDELAY();
279 278
280 ch &= up->parity_mask; 279 ch &= up->parity_mask;
281 280
282 if (ZS_IS_CONS(up) && (r1 & BRK_ABRT)) { 281 /* Handle the null char got when BREAK is removed. */
283 /* Wait for BREAK to deassert to avoid potentially 282 if (!ch)
284 * confusing the PROM. 283 r1 |= up->tty_break;
285 */
286 while (1) {
287 ch = readb(&channel->control);
288 ZSDELAY();
289 if (!(ch & BRK_ABRT))
290 break;
291 }
292 ip22_do_break();
293 return;
294 }
295 284
296 /* A real serial line, record the character and status. */ 285 /* A real serial line, record the character and status. */
297 flag = TTY_NORMAL; 286 flag = TTY_NORMAL;
298 up->port.icount.rx++; 287 up->port.icount.rx++;
299 if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { 288 if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) {
300 if (r1 & BRK_ABRT) { 289 up->tty_break = 0;
301 r1 &= ~(PAR_ERR | CRC_ERR); 290
291 if (r1 & (Rx_SYS | Rx_BRK)) {
302 up->port.icount.brk++; 292 up->port.icount.brk++;
303 if (uart_handle_break(&up->port)) 293 if (r1 & Rx_SYS)
304 goto next_char; 294 continue;
295 r1 &= ~(PAR_ERR | CRC_ERR);
305 } 296 }
306 else if (r1 & PAR_ERR) 297 else if (r1 & PAR_ERR)
307 up->port.icount.parity++; 298 up->port.icount.parity++;
@@ -310,30 +301,21 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
310 if (r1 & Rx_OVR) 301 if (r1 & Rx_OVR)
311 up->port.icount.overrun++; 302 up->port.icount.overrun++;
312 r1 &= up->port.read_status_mask; 303 r1 &= up->port.read_status_mask;
313 if (r1 & BRK_ABRT) 304 if (r1 & Rx_BRK)
314 flag = TTY_BREAK; 305 flag = TTY_BREAK;
315 else if (r1 & PAR_ERR) 306 else if (r1 & PAR_ERR)
316 flag = TTY_PARITY; 307 flag = TTY_PARITY;
317 else if (r1 & CRC_ERR) 308 else if (r1 & CRC_ERR)
318 flag = TTY_FRAME; 309 flag = TTY_FRAME;
319 } 310 }
320 if (uart_handle_sysrq_char(&up->port, ch))
321 goto next_char;
322 311
323 if (up->port.ignore_status_mask == 0xff || 312 if (uart_handle_sysrq_char(&up->port, ch))
324 (r1 & up->port.ignore_status_mask) == 0) 313 continue;
325 tty_insert_flip_char(tty, ch, flag);
326 314
327 if (r1 & Rx_OVR) 315 if (tty)
328 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 316 uart_insert_char(&up->port, r1, Rx_OVR, ch, flag);
329 next_char:
330 ch = readb(&channel->control);
331 ZSDELAY();
332 if (!(ch & Rx_CH_AV))
333 break;
334 } 317 }
335 318 return tty;
336 tty_flip_buffer_push(tty);
337} 319}
338 320
339static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, 321static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
@@ -348,6 +330,15 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
348 ZSDELAY(); 330 ZSDELAY();
349 ZS_WSYNC(channel); 331 ZS_WSYNC(channel);
350 332
333 if (up->curregs[R15] & BRKIE) {
334 if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) {
335 if (uart_handle_break(&up->port))
336 up->tty_break = Rx_SYS;
337 else
338 up->tty_break = Rx_BRK;
339 }
340 }
341
351 if (ZS_WANTS_MODEM_STATUS(up)) { 342 if (ZS_WANTS_MODEM_STATUS(up)) {
352 if (status & SYNC) 343 if (status & SYNC)
353 up->port.icount.dsr++; 344 up->port.icount.dsr++;
@@ -356,10 +347,10 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
356 * But it does not tell us which bit has changed, we have to keep 347 * But it does not tell us which bit has changed, we have to keep
357 * track of this ourselves. 348 * track of this ourselves.
358 */ 349 */
359 if ((status & DCD) ^ up->prev_status) 350 if ((status ^ up->prev_status) ^ DCD)
360 uart_handle_dcd_change(&up->port, 351 uart_handle_dcd_change(&up->port,
361 (status & DCD)); 352 (status & DCD));
362 if ((status & CTS) ^ up->prev_status) 353 if ((status ^ up->prev_status) ^ CTS)
363 uart_handle_cts_change(&up->port, 354 uart_handle_cts_change(&up->port,
364 (status & CTS)); 355 (status & CTS));
365 356
@@ -447,19 +438,21 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
447 while (up) { 438 while (up) {
448 struct zilog_channel *channel 439 struct zilog_channel *channel
449 = ZILOG_CHANNEL_FROM_PORT(&up->port); 440 = ZILOG_CHANNEL_FROM_PORT(&up->port);
441 struct tty_struct *tty;
450 unsigned char r3; 442 unsigned char r3;
451 443
452 spin_lock(&up->port.lock); 444 spin_lock(&up->port.lock);
453 r3 = read_zsreg(channel, R3); 445 r3 = read_zsreg(channel, R3);
454 446
455 /* Channel A */ 447 /* Channel A */
448 tty = NULL;
456 if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { 449 if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
457 writeb(RES_H_IUS, &channel->control); 450 writeb(RES_H_IUS, &channel->control);
458 ZSDELAY(); 451 ZSDELAY();
459 ZS_WSYNC(channel); 452 ZS_WSYNC(channel);
460 453
461 if (r3 & CHARxIP) 454 if (r3 & CHARxIP)
462 ip22zilog_receive_chars(up, channel); 455 tty = ip22zilog_receive_chars(up, channel);
463 if (r3 & CHAEXT) 456 if (r3 & CHAEXT)
464 ip22zilog_status_handle(up, channel); 457 ip22zilog_status_handle(up, channel);
465 if (r3 & CHATxIP) 458 if (r3 & CHATxIP)
@@ -467,18 +460,22 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
467 } 460 }
468 spin_unlock(&up->port.lock); 461 spin_unlock(&up->port.lock);
469 462
463 if (tty)
464 tty_flip_buffer_push(tty);
465
470 /* Channel B */ 466 /* Channel B */
471 up = up->next; 467 up = up->next;
472 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); 468 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
473 469
474 spin_lock(&up->port.lock); 470 spin_lock(&up->port.lock);
471 tty = NULL;
475 if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { 472 if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
476 writeb(RES_H_IUS, &channel->control); 473 writeb(RES_H_IUS, &channel->control);
477 ZSDELAY(); 474 ZSDELAY();
478 ZS_WSYNC(channel); 475 ZS_WSYNC(channel);
479 476
480 if (r3 & CHBRxIP) 477 if (r3 & CHBRxIP)
481 ip22zilog_receive_chars(up, channel); 478 tty = ip22zilog_receive_chars(up, channel);
482 if (r3 & CHBEXT) 479 if (r3 & CHBEXT)
483 ip22zilog_status_handle(up, channel); 480 ip22zilog_status_handle(up, channel);
484 if (r3 & CHBTxIP) 481 if (r3 & CHBTxIP)
@@ -486,6 +483,9 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
486 } 483 }
487 spin_unlock(&up->port.lock); 484 spin_unlock(&up->port.lock);
488 485
486 if (tty)
487 tty_flip_buffer_push(tty);
488
489 up = up->next; 489 up = up->next;
490 } 490 }
491 491
@@ -681,11 +681,46 @@ static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
681 spin_unlock_irqrestore(&port->lock, flags); 681 spin_unlock_irqrestore(&port->lock, flags);
682} 682}
683 683
684static void __ip22zilog_reset(struct uart_ip22zilog_port *up)
685{
686 struct zilog_channel *channel;
687 int i;
688
689 if (up->flags & IP22ZILOG_FLAG_RESET_DONE)
690 return;
691
692 /* Let pending transmits finish. */
693 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
694 for (i = 0; i < 1000; i++) {
695 unsigned char stat = read_zsreg(channel, R1);
696 if (stat & ALL_SNT)
697 break;
698 udelay(100);
699 }
700
701 if (!ZS_IS_CHANNEL_A(up)) {
702 up++;
703 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
704 }
705 write_zsreg(channel, R9, FHWRES);
706 ZSDELAY_LONG();
707 (void) read_zsreg(channel, R0);
708
709 up->flags |= IP22ZILOG_FLAG_RESET_DONE;
710 up->next->flags |= IP22ZILOG_FLAG_RESET_DONE;
711}
712
684static void __ip22zilog_startup(struct uart_ip22zilog_port *up) 713static void __ip22zilog_startup(struct uart_ip22zilog_port *up)
685{ 714{
686 struct zilog_channel *channel; 715 struct zilog_channel *channel;
687 716
688 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); 717 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
718
719 __ip22zilog_reset(up);
720
721 __load_zsregs(channel, up->curregs);
722 /* set master interrupt enable */
723 write_zsreg(channel, R9, up->curregs[R9]);
689 up->prev_status = readb(&channel->control); 724 up->prev_status = readb(&channel->control);
690 725
691 /* Enable receiver and transmitter. */ 726 /* Enable receiver and transmitter. */
@@ -859,8 +894,6 @@ ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios,
859 else 894 else
860 up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS; 895 up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS;
861 896
862 up->cflag = termios->c_cflag;
863
864 ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); 897 ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
865 uart_update_timeout(port, termios->c_cflag, baud); 898 uart_update_timeout(port, termios->c_cflag, baud);
866 899
@@ -992,74 +1025,29 @@ ip22zilog_console_write(struct console *con, const char *s, unsigned int count)
992 spin_unlock_irqrestore(&up->port.lock, flags); 1025 spin_unlock_irqrestore(&up->port.lock, flags);
993} 1026}
994 1027
995void
996ip22serial_console_termios(struct console *con, char *options)
997{
998 int baud = 9600, bits = 8, cflag;
999 int parity = 'n';
1000 int flow = 'n';
1001
1002 if (options)
1003 uart_parse_options(options, &baud, &parity, &bits, &flow);
1004
1005 cflag = CREAD | HUPCL | CLOCAL;
1006
1007 switch (baud) {
1008 case 150: cflag |= B150; break;
1009 case 300: cflag |= B300; break;
1010 case 600: cflag |= B600; break;
1011 case 1200: cflag |= B1200; break;
1012 case 2400: cflag |= B2400; break;
1013 case 4800: cflag |= B4800; break;
1014 case 9600: cflag |= B9600; break;
1015 case 19200: cflag |= B19200; break;
1016 case 38400: cflag |= B38400; break;
1017 default: baud = 9600; cflag |= B9600; break;
1018 }
1019
1020 con->cflag = cflag | CS8; /* 8N1 */
1021
1022 uart_update_timeout(&ip22zilog_port_table[con->index].port, cflag, baud);
1023}
1024
1025static int __init ip22zilog_console_setup(struct console *con, char *options) 1028static int __init ip22zilog_console_setup(struct console *con, char *options)
1026{ 1029{
1027 struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; 1030 struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
1028 unsigned long flags; 1031 unsigned long flags;
1029 int baud, brg; 1032 int baud = 9600, bits = 8;
1030 1033 int parity = 'n';
1031 printk("Console: ttyS%d (IP22-Zilog)\n", con->index); 1034 int flow = 'n';
1032 1035
1033 /* Get firmware console settings. */ 1036 up->flags |= IP22ZILOG_FLAG_IS_CONS;
1034 ip22serial_console_termios(con, options);
1035 1037
1036 /* Firmware console speed is limited to 150-->38400 baud so 1038 printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index);
1037 * this hackish cflag thing is OK.
1038 */
1039 switch (con->cflag & CBAUD) {
1040 case B150: baud = 150; break;
1041 case B300: baud = 300; break;
1042 case B600: baud = 600; break;
1043 case B1200: baud = 1200; break;
1044 case B2400: baud = 2400; break;
1045 case B4800: baud = 4800; break;
1046 default: case B9600: baud = 9600; break;
1047 case B19200: baud = 19200; break;
1048 case B38400: baud = 38400; break;
1049 };
1050
1051 brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
1052 1039
1053 spin_lock_irqsave(&up->port.lock, flags); 1040 spin_lock_irqsave(&up->port.lock, flags);
1054 1041
1055 up->curregs[R15] = BRKIE; 1042 up->curregs[R15] |= BRKIE;
1056 ip22zilog_convert_to_zs(up, con->cflag, 0, brg);
1057 1043
1058 __ip22zilog_startup(up); 1044 __ip22zilog_startup(up);
1059 1045
1060 spin_unlock_irqrestore(&up->port.lock, flags); 1046 spin_unlock_irqrestore(&up->port.lock, flags);
1061 1047
1062 return 0; 1048 if (options)
1049 uart_parse_options(options, &baud, &parity, &bits, &flow);
1050 return uart_set_options(&up->port, con, baud, parity, bits, flow);
1063} 1051}
1064 1052
1065static struct uart_driver ip22zilog_reg; 1053static struct uart_driver ip22zilog_reg;
@@ -1140,25 +1128,10 @@ static void __init ip22zilog_prepare(void)
1140 up[(chip * 2) + 1].port.line = (chip * 2) + 1; 1128 up[(chip * 2) + 1].port.line = (chip * 2) + 1;
1141 up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; 1129 up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A;
1142 } 1130 }
1143}
1144
1145static void __init ip22zilog_init_hw(void)
1146{
1147 int i;
1148
1149 for (i = 0; i < NUM_CHANNELS; i++) {
1150 struct uart_ip22zilog_port *up = &ip22zilog_port_table[i];
1151 struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
1152 unsigned long flags;
1153 int baud, brg;
1154 1131
1155 spin_lock_irqsave(&up->port.lock, flags); 1132 for (channel = 0; channel < NUM_CHANNELS; channel++) {
1156 1133 struct uart_ip22zilog_port *up = &ip22zilog_port_table[channel];
1157 if (ZS_IS_CHANNEL_A(up)) { 1134 int brg;
1158 write_zsreg(channel, R9, FHWRES);
1159 ZSDELAY_LONG();
1160 (void) read_zsreg(channel, R0);
1161 }
1162 1135
1163 /* Normal serial TTY. */ 1136 /* Normal serial TTY. */
1164 up->parity_mask = 0xff; 1137 up->parity_mask = 0xff;
@@ -1169,16 +1142,10 @@ static void __init ip22zilog_init_hw(void)
1169 up->curregs[R9] = NV | MIE; 1142 up->curregs[R9] = NV | MIE;
1170 up->curregs[R10] = NRZ; 1143 up->curregs[R10] = NRZ;
1171 up->curregs[R11] = TCBR | RCBR; 1144 up->curregs[R11] = TCBR | RCBR;
1172 baud = 9600; 1145 brg = BPS_TO_BRG(9600, ZS_CLOCK / ZS_CLOCK_DIVISOR);
1173 brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
1174 up->curregs[R12] = (brg & 0xff); 1146 up->curregs[R12] = (brg & 0xff);
1175 up->curregs[R13] = (brg >> 8) & 0xff; 1147 up->curregs[R13] = (brg >> 8) & 0xff;
1176 up->curregs[R14] = BRENAB; 1148 up->curregs[R14] = BRENAB;
1177 __load_zsregs(channel, up->curregs);
1178 /* set master interrupt enable */
1179 write_zsreg(channel, R9, up->curregs[R9]);
1180
1181 spin_unlock_irqrestore(&up->port.lock, flags);
1182 } 1149 }
1183} 1150}
1184 1151
@@ -1195,8 +1162,6 @@ static int __init ip22zilog_ports_init(void)
1195 panic("IP22-Zilog: Unable to register zs interrupt handler.\n"); 1162 panic("IP22-Zilog: Unable to register zs interrupt handler.\n");
1196 } 1163 }
1197 1164
1198 ip22zilog_init_hw();
1199
1200 ret = uart_register_driver(&ip22zilog_reg); 1165 ret = uart_register_driver(&ip22zilog_reg);
1201 if (ret == 0) { 1166 if (ret == 0) {
1202 int i; 1167 int i;
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index af3a011b2b24..352fcb8926a6 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -585,11 +585,11 @@ serial_pxa_type(struct uart_port *port)
585 return up->name; 585 return up->name;
586} 586}
587 587
588#ifdef CONFIG_SERIAL_PXA_CONSOLE
589
590static struct uart_pxa_port *serial_pxa_ports[4]; 588static struct uart_pxa_port *serial_pxa_ports[4];
591static struct uart_driver serial_pxa_reg; 589static struct uart_driver serial_pxa_reg;
592 590
591#ifdef CONFIG_SERIAL_PXA_CONSOLE
592
593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
594 594
595/* 595/*
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index a77ede598d34..abf05048c638 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -61,7 +61,7 @@ config SPI_ATMEL
61 61
62config SPI_BFIN 62config SPI_BFIN
63 tristate "SPI controller driver for ADI Blackfin5xx" 63 tristate "SPI controller driver for ADI Blackfin5xx"
64 depends on SPI_MASTER && BFIN 64 depends on SPI_MASTER && BLACKFIN
65 help 65 help
66 This is the SPI controller master driver for Blackfin 5xx processor. 66 This is the SPI controller master driver for Blackfin 5xx processor.
67 67
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 0d342dcdd302..ff6a14bf1280 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -497,7 +497,7 @@ static int atmel_spi_setup(struct spi_device *spi)
497 /* chipselect must have been muxed as GPIO (e.g. in board setup) */ 497 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
498 npcs_pin = (unsigned int)spi->controller_data; 498 npcs_pin = (unsigned int)spi->controller_data;
499 if (!spi->controller_state) { 499 if (!spi->controller_state) {
500 ret = gpio_request(npcs_pin, "spi_npcs"); 500 ret = gpio_request(npcs_pin, spi->dev.bus_id);
501 if (ret) 501 if (ret)
502 return ret; 502 return ret;
503 spi->controller_state = (void *)npcs_pin; 503 spi->controller_state = (void *)npcs_pin;
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index 0fa25e2e80fe..109d82c1abc0 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -96,6 +96,7 @@ static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value)
96 96
97static int s3c2410_spigpio_probe(struct platform_device *dev) 97static int s3c2410_spigpio_probe(struct platform_device *dev)
98{ 98{
99 struct s3c2410_spigpio_info *info;
99 struct spi_master *master; 100 struct spi_master *master;
100 struct s3c2410_spigpio *sp; 101 struct s3c2410_spigpio *sp;
101 int ret; 102 int ret;
@@ -113,10 +114,11 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
113 platform_set_drvdata(dev, sp); 114 platform_set_drvdata(dev, sp);
114 115
115 /* copy in the plkatform data */ 116 /* copy in the plkatform data */
116 sp->info = dev->dev.platform_data; 117 info = sp->info = dev->dev.platform_data;
117 118
118 /* setup spi bitbang adaptor */ 119 /* setup spi bitbang adaptor */
119 sp->bitbang.master = spi_master_get(master); 120 sp->bitbang.master = spi_master_get(master);
121 sp->bitbang.master->bus_num = info->bus_num;
120 sp->bitbang.chipselect = s3c2410_spigpio_chipselect; 122 sp->bitbang.chipselect = s3c2410_spigpio_chipselect;
121 123
122 sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; 124 sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0;
@@ -124,13 +126,18 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
124 sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; 126 sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2;
125 sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; 127 sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3;
126 128
127 /* set state of spi pins */ 129 /* set state of spi pins, always assume that the clock is
128 s3c2410_gpio_setpin(sp->info->pin_clk, 0); 130 * available, but do check the MOSI and MISO. */
129 s3c2410_gpio_setpin(sp->info->pin_mosi, 0); 131 s3c2410_gpio_setpin(info->pin_clk, 0);
132 s3c2410_gpio_cfgpin(info->pin_clk, S3C2410_GPIO_OUTPUT);
130 133
131 s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); 134 if (info->pin_mosi < S3C2410_GPH10) {
132 s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); 135 s3c2410_gpio_setpin(info->pin_mosi, 0);
133 s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); 136 s3c2410_gpio_cfgpin(info->pin_mosi, S3C2410_GPIO_OUTPUT);
137 }
138
139 if (info->pin_miso != S3C2410_GPA0 && info->pin_miso < S3C2410_GPH10)
140 s3c2410_gpio_cfgpin(info->pin_miso, S3C2410_GPIO_INPUT);
134 141
135 ret = spi_bitbang_start(&sp->bitbang); 142 ret = spi_bitbang_start(&sp->bitbang);
136 if (ret) 143 if (ret)
diff --git a/drivers/usb/README b/drivers/usb/README
index 3c8434128554..284f46b3e1cc 100644
--- a/drivers/usb/README
+++ b/drivers/usb/README
@@ -39,12 +39,12 @@ first subdirectory in the list below that it fits into.
39 39
40image/ - This is for still image drivers, like scanners or 40image/ - This is for still image drivers, like scanners or
41 digital cameras. 41 digital cameras.
42input/ - This is for any driver that uses the input subsystem, 42../input/ - This is for any driver that uses the input subsystem,
43 like keyboard, mice, touchscreens, tablets, etc. 43 like keyboard, mice, touchscreens, tablets, etc.
44media/ - This is for multimedia drivers, like video cameras, 44../media/ - This is for multimedia drivers, like video cameras,
45 radios, and any other drivers that talk to the v4l 45 radios, and any other drivers that talk to the v4l
46 subsystem. 46 subsystem.
47net/ - This is for network drivers. 47../net/ - This is for network drivers.
48serial/ - This is for USB to serial drivers. 48serial/ - This is for USB to serial drivers.
49storage/ - This is for USB mass-storage drivers. 49storage/ - This is for USB mass-storage drivers.
50class/ - This is for all USB device drivers that do not fit 50class/ - This is for all USB device drivers that do not fit
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 8586817698ad..c51f8e9312e0 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -585,9 +585,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
585{ 585{
586 struct usb_device *usb_dev; 586 struct usb_device *usb_dev;
587 587
588 if (!dev)
589 return -ENODEV;
590
591 /* driver is often null here; dev_dbg() would oops */ 588 /* driver is often null here; dev_dbg() would oops */
592 pr_debug ("usb %s: uevent\n", dev->bus_id); 589 pr_debug ("usb %s: uevent\n", dev->bus_id);
593 590
@@ -631,14 +628,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
631 usb_dev->descriptor.bDeviceProtocol)) 628 usb_dev->descriptor.bDeviceProtocol))
632 return -ENOMEM; 629 return -ENOMEM;
633 630
634 if (add_uevent_var(env, "BUSNUM=%03d",
635 usb_dev->bus->busnum))
636 return -ENOMEM;
637
638 if (add_uevent_var(env, "DEVNUM=%03d",
639 usb_dev->devnum))
640 return -ENOMEM;
641
642 return 0; 631 return 0;
643} 632}
644 633
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fea8256a18d6..d5ed3fa9e304 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1311,8 +1311,8 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
1311 hcd = bus_to_hcd(udev->bus); 1311 hcd = bus_to_hcd(udev->bus);
1312 1312
1313 /* No more submits can occur */ 1313 /* No more submits can occur */
1314rescan:
1315 spin_lock_irq(&hcd_urb_list_lock); 1314 spin_lock_irq(&hcd_urb_list_lock);
1315rescan:
1316 list_for_each_entry (urb, &ep->urb_list, urb_list) { 1316 list_for_each_entry (urb, &ep->urb_list, urb_list) {
1317 int is_in; 1317 int is_in;
1318 1318
@@ -1345,6 +1345,7 @@ rescan:
1345 usb_put_urb (urb); 1345 usb_put_urb (urb);
1346 1346
1347 /* list contents may have changed */ 1347 /* list contents may have changed */
1348 spin_lock(&hcd_urb_list_lock);
1348 goto rescan; 1349 goto rescan;
1349 } 1350 }
1350 spin_unlock_irq(&hcd_urb_list_lock); 1351 spin_unlock_irq(&hcd_urb_list_lock);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 036c3dea855e..13b326a13377 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -335,7 +335,7 @@ static void kick_khubd(struct usb_hub *hub)
335 to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; 335 to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
336 336
337 spin_lock_irqsave(&hub_event_lock, flags); 337 spin_lock_irqsave(&hub_event_lock, flags);
338 if (!hub->disconnected & list_empty(&hub->event_list)) { 338 if (!hub->disconnected && list_empty(&hub->event_list)) {
339 list_add_tail(&hub->event_list, &hub_event_list); 339 list_add_tail(&hub->event_list, &hub_event_list);
340 wake_up(&khubd_wait); 340 wake_up(&khubd_wait);
341 } 341 }
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 316a746e0080..fcd40ecbeecc 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1172,7 +1172,6 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1172 struct usb_host_interface *alt; 1172 struct usb_host_interface *alt;
1173 int ret; 1173 int ret;
1174 int manual = 0; 1174 int manual = 0;
1175 int changed;
1176 1175
1177 if (dev->state == USB_STATE_SUSPENDED) 1176 if (dev->state == USB_STATE_SUSPENDED)
1178 return -EHOSTUNREACH; 1177 return -EHOSTUNREACH;
@@ -1212,8 +1211,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1212 */ 1211 */
1213 1212
1214 /* prevent submissions using previous endpoint settings */ 1213 /* prevent submissions using previous endpoint settings */
1215 changed = (iface->cur_altsetting != alt); 1214 if (iface->cur_altsetting != alt && device_is_registered(&iface->dev))
1216 if (changed && device_is_registered(&iface->dev))
1217 usb_remove_sysfs_intf_files(iface); 1215 usb_remove_sysfs_intf_files(iface);
1218 usb_disable_interface(dev, iface); 1216 usb_disable_interface(dev, iface);
1219 1217
@@ -1250,7 +1248,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1250 * (Likewise, EP0 never "halts" on well designed devices.) 1248 * (Likewise, EP0 never "halts" on well designed devices.)
1251 */ 1249 */
1252 usb_enable_interface(dev, iface); 1250 usb_enable_interface(dev, iface);
1253 if (changed && device_is_registered(&iface->dev)) 1251 if (device_is_registered(&iface->dev))
1254 usb_create_sysfs_intf_files(iface); 1252 usb_create_sysfs_intf_files(iface);
1255 1253
1256 return 0; 1254 return 0;
@@ -1348,34 +1346,10 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env)
1348 struct usb_interface *intf; 1346 struct usb_interface *intf;
1349 struct usb_host_interface *alt; 1347 struct usb_host_interface *alt;
1350 1348
1351 if (!dev)
1352 return -ENODEV;
1353
1354 /* driver is often null here; dev_dbg() would oops */
1355 pr_debug ("usb %s: uevent\n", dev->bus_id);
1356
1357 intf = to_usb_interface(dev); 1349 intf = to_usb_interface(dev);
1358 usb_dev = interface_to_usbdev(intf); 1350 usb_dev = interface_to_usbdev(intf);
1359 alt = intf->cur_altsetting; 1351 alt = intf->cur_altsetting;
1360 1352
1361#ifdef CONFIG_USB_DEVICEFS
1362 if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d",
1363 usb_dev->bus->busnum, usb_dev->devnum))
1364 return -ENOMEM;
1365#endif
1366
1367 if (add_uevent_var(env, "PRODUCT=%x/%x/%x",
1368 le16_to_cpu(usb_dev->descriptor.idVendor),
1369 le16_to_cpu(usb_dev->descriptor.idProduct),
1370 le16_to_cpu(usb_dev->descriptor.bcdDevice)))
1371 return -ENOMEM;
1372
1373 if (add_uevent_var(env, "TYPE=%d/%d/%d",
1374 usb_dev->descriptor.bDeviceClass,
1375 usb_dev->descriptor.bDeviceSubClass,
1376 usb_dev->descriptor.bDeviceProtocol))
1377 return -ENOMEM;
1378
1379 if (add_uevent_var(env, "INTERFACE=%d/%d/%d", 1353 if (add_uevent_var(env, "INTERFACE=%d/%d/%d",
1380 alt->desc.bInterfaceClass, 1354 alt->desc.bInterfaceClass,
1381 alt->desc.bInterfaceSubClass, 1355 alt->desc.bInterfaceSubClass,
@@ -1641,12 +1615,6 @@ free_interfaces:
1641 intf->dev.bus_id, ret); 1615 intf->dev.bus_id, ret);
1642 continue; 1616 continue;
1643 } 1617 }
1644
1645 /* The driver's probe method can call usb_set_interface(),
1646 * which would mean the interface's sysfs files are already
1647 * created. Just in case, we'll remove them first.
1648 */
1649 usb_remove_sysfs_intf_files(intf);
1650 usb_create_sysfs_intf_files(intf); 1618 usb_create_sysfs_intf_files(intf);
1651 } 1619 }
1652 1620
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index b04afd06e502..32bd130b1eed 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -735,6 +735,8 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
735 struct usb_host_interface *alt = intf->cur_altsetting; 735 struct usb_host_interface *alt = intf->cur_altsetting;
736 int retval; 736 int retval;
737 737
738 if (intf->sysfs_files_created)
739 return 0;
738 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); 740 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp);
739 if (retval) 741 if (retval)
740 return retval; 742 return retval;
@@ -746,6 +748,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
746 if (intf->intf_assoc) 748 if (intf->intf_assoc)
747 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); 749 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp);
748 usb_create_intf_ep_files(intf, udev); 750 usb_create_intf_ep_files(intf, udev);
751 intf->sysfs_files_created = 1;
749 return 0; 752 return 0;
750} 753}
751 754
@@ -753,8 +756,11 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf)
753{ 756{
754 struct device *dev = &intf->dev; 757 struct device *dev = &intf->dev;
755 758
759 if (!intf->sysfs_files_created)
760 return;
756 usb_remove_intf_ep_files(intf); 761 usb_remove_intf_ep_files(intf);
757 device_remove_file(dev, &dev_attr_interface); 762 device_remove_file(dev, &dev_attr_interface);
758 sysfs_remove_group(&dev->kobj, &intf_attr_grp); 763 sysfs_remove_group(&dev->kobj, &intf_attr_grp);
759 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); 764 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp);
765 intf->sysfs_files_created = 0;
760} 766}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c4a6f1095b8b..8f142370103d 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -192,9 +192,34 @@ static void usb_release_dev(struct device *dev)
192 kfree(udev); 192 kfree(udev);
193} 193}
194 194
195#ifdef CONFIG_HOTPLUG
196static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
197{
198 struct usb_device *usb_dev;
199
200 usb_dev = to_usb_device(dev);
201
202 if (add_uevent_var(env, "BUSNUM=%03d", usb_dev->bus->busnum))
203 return -ENOMEM;
204
205 if (add_uevent_var(env, "DEVNUM=%03d", usb_dev->devnum))
206 return -ENOMEM;
207
208 return 0;
209}
210
211#else
212
213static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
214{
215 return -ENODEV;
216}
217#endif /* CONFIG_HOTPLUG */
218
195struct device_type usb_device_type = { 219struct device_type usb_device_type = {
196 .name = "usb_device", 220 .name = "usb_device",
197 .release = usb_release_dev, 221 .release = usb_release_dev,
222 .uevent = usb_dev_uevent,
198}; 223};
199 224
200#ifdef CONFIG_PM 225#ifdef CONFIG_PM
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 87c4f50dfb61..d377154658b5 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1241,14 +1241,14 @@ static void pullup_enable(struct omap_udc *udc)
1241 udc->gadget.dev.parent->power.power_state = PMSG_ON; 1241 udc->gadget.dev.parent->power.power_state = PMSG_ON;
1242 udc->gadget.dev.power.power_state = PMSG_ON; 1242 udc->gadget.dev.power.power_state = PMSG_ON;
1243 UDC_SYSCON1_REG |= UDC_PULLUP_EN; 1243 UDC_SYSCON1_REG |= UDC_PULLUP_EN;
1244 if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) 1244 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx())
1245 OTG_CTRL_REG |= OTG_BSESSVLD; 1245 OTG_CTRL_REG |= OTG_BSESSVLD;
1246 UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1246 UDC_IRQ_EN_REG = UDC_DS_CHG_IE;
1247} 1247}
1248 1248
1249static void pullup_disable(struct omap_udc *udc) 1249static void pullup_disable(struct omap_udc *udc)
1250{ 1250{
1251 if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) 1251 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx())
1252 OTG_CTRL_REG &= ~OTG_BSESSVLD; 1252 OTG_CTRL_REG &= ~OTG_BSESSVLD;
1253 UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1253 UDC_IRQ_EN_REG = UDC_DS_CHG_IE;
1254 UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; 1254 UDC_SYSCON1_REG &= ~UDC_PULLUP_EN;
@@ -1386,7 +1386,7 @@ static void update_otg(struct omap_udc *udc)
1386{ 1386{
1387 u16 devstat; 1387 u16 devstat;
1388 1388
1389 if (!gadget_is_otg(udc->gadget)) 1389 if (!gadget_is_otg(&udc->gadget))
1390 return; 1390 return;
1391 1391
1392 if (OTG_CTRL_REG & OTG_ID) 1392 if (OTG_CTRL_REG & OTG_ID)
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index e3e90f8a75e7..4ce050c3d13f 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -52,10 +52,10 @@
52#include <asm/arch/irqs.h> 52#include <asm/arch/irqs.h>
53 53
54#include <asm/arch/hardware.h> 54#include <asm/arch/hardware.h>
55#include <asm/arch/regs-clock.h>
56#include <asm/arch/regs-gpio.h> 55#include <asm/arch/regs-gpio.h>
57#include <asm/arch/regs-udc.h> 56
58#include <asm/arch/udc.h> 57#include <asm/plat-s3c24xx/regs-udc.h>
58#include <asm/plat-s3c24xx/udc.h>
59 59
60#include <asm/mach-types.h> 60#include <asm/mach-types.h>
61 61
@@ -1511,7 +1511,11 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev)
1511 unsigned int value; 1511 unsigned int value;
1512 1512
1513 dprintk(DEBUG_NORMAL, "%s()\n", __func__); 1513 dprintk(DEBUG_NORMAL, "%s()\n", __func__);
1514
1515 /* some cpus cannot read from an line configured to IRQ! */
1516 s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT);
1514 value = s3c2410_gpio_getpin(udc_info->vbus_pin); 1517 value = s3c2410_gpio_getpin(udc_info->vbus_pin);
1518 s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2);
1515 1519
1516 if (udc_info->vbus_pin_inverted) 1520 if (udc_info->vbus_pin_inverted)
1517 value = !value; 1521 value = !value;
@@ -1872,9 +1876,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1872 if (udc_info && udc_info->vbus_pin > 0) { 1876 if (udc_info && udc_info->vbus_pin > 0) {
1873 irq = s3c2410_gpio_getirq(udc_info->vbus_pin); 1877 irq = s3c2410_gpio_getirq(udc_info->vbus_pin);
1874 retval = request_irq(irq, s3c2410_udc_vbus_irq, 1878 retval = request_irq(irq, s3c2410_udc_vbus_irq,
1875 IRQF_DISABLED | IRQF_TRIGGER_RISING 1879 IRQF_DISABLED | IRQF_TRIGGER_RISING
1876 | IRQF_TRIGGER_FALLING, 1880 | IRQF_TRIGGER_FALLING | IRQF_SHARED,
1877 gadget_name, udc); 1881 gadget_name, udc);
1878 1882
1879 if (retval != 0) { 1883 if (retval != 0) {
1880 dev_err(dev, "can't get vbus irq %i, err %d\n", 1884 dev_err(dev, "can't get vbus irq %i, err %d\n",
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 177e78ed241b..49a91c5ee51b 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -156,7 +156,7 @@ config USB_OHCI_HCD_PCI
156 156
157config USB_OHCI_HCD_SSB 157config USB_OHCI_HCD_SSB
158 bool "OHCI support for Broadcom SSB OHCI core" 158 bool "OHCI support for Broadcom SSB OHCI core"
159 depends on USB_OHCI_HCD && (SSB = y || SSB = CONFIG_USB_OHCI_HCD) && EXPERIMENTAL 159 depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL
160 default n 160 default n
161 ---help--- 161 ---help---
162 Support for the Sonics Silicon Backplane (SSB) attached 162 Support for the Sonics Silicon Backplane (SSB) attached
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c1514442883e..5f2d74ed5ad7 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -575,12 +575,15 @@ static int ehci_run (struct usb_hcd *hcd)
575 * from the companions to the EHCI controller. If any of the 575 * from the companions to the EHCI controller. If any of the
576 * companions are in the middle of a port reset at the time, it 576 * companions are in the middle of a port reset at the time, it
577 * could cause trouble. Write-locking ehci_cf_port_reset_rwsem 577 * could cause trouble. Write-locking ehci_cf_port_reset_rwsem
578 * guarantees that no resets are in progress. 578 * guarantees that no resets are in progress. After we set CF,
579 * a short delay lets the hardware catch up; new resets shouldn't
580 * be started before the port switching actions could complete.
579 */ 581 */
580 down_write(&ehci_cf_port_reset_rwsem); 582 down_write(&ehci_cf_port_reset_rwsem);
581 hcd->state = HC_STATE_RUNNING; 583 hcd->state = HC_STATE_RUNNING;
582 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); 584 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
583 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ 585 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
586 msleep(5);
584 up_write(&ehci_cf_port_reset_rwsem); 587 up_write(&ehci_cf_port_reset_rwsem);
585 588
586 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); 589 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 91e999c9f680..bc207e3c21f5 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -819,7 +819,7 @@ static int mts_usb_probe(struct usb_interface *intf,
819 goto out_kfree2; 819 goto out_kfree2;
820 820
821 new_desc->host->hostdata[0] = (unsigned long)new_desc; 821 new_desc->host->hostdata[0] = (unsigned long)new_desc;
822 if (scsi_add_host(new_desc->host, NULL)) { 822 if (scsi_add_host(new_desc->host, &dev->dev)) {
823 err_retval = -EIO; 823 err_retval = -EIO;
824 goto out_host_put; 824 goto out_host_put;
825 } 825 }
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index c567aa7a41ea..5a2c44e4c1f7 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -79,12 +79,22 @@ MODULE_DEVICE_TABLE(usb, device_table);
79 79
80#define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */ 80#define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */
81 81
82/*
83 * The locking scheme is a vanilla 3-lock:
84 * adu_device.buflock: A spinlock, covers what IRQs touch.
85 * adutux_mutex: A Static lock to cover open_count. It would also cover
86 * any globals, but we don't have them in 2.6.
87 * adu_device.mtx: A mutex to hold across sleepers like copy_from_user.
88 * It covers all of adu_device, except the open_count
89 * and what .buflock covers.
90 */
91
82/* Structure to hold all of our device specific stuff */ 92/* Structure to hold all of our device specific stuff */
83struct adu_device { 93struct adu_device {
84 struct mutex mtx; /* locks this structure */ 94 struct mutex mtx;
85 struct usb_device* udev; /* save off the usb device pointer */ 95 struct usb_device* udev; /* save off the usb device pointer */
86 struct usb_interface* interface; 96 struct usb_interface* interface;
87 unsigned char minor; /* the starting minor number for this device */ 97 unsigned int minor; /* the starting minor number for this device */
88 char serial_number[8]; 98 char serial_number[8];
89 99
90 int open_count; /* number of times this port has been opened */ 100 int open_count; /* number of times this port has been opened */
@@ -107,8 +117,11 @@ struct adu_device {
107 char* interrupt_out_buffer; 117 char* interrupt_out_buffer;
108 struct usb_endpoint_descriptor* interrupt_out_endpoint; 118 struct usb_endpoint_descriptor* interrupt_out_endpoint;
109 struct urb* interrupt_out_urb; 119 struct urb* interrupt_out_urb;
120 int out_urb_finished;
110}; 121};
111 122
123static DEFINE_MUTEX(adutux_mutex);
124
112static struct usb_driver adu_driver; 125static struct usb_driver adu_driver;
113 126
114static void adu_debug_data(int level, const char *function, int size, 127static void adu_debug_data(int level, const char *function, int size,
@@ -132,27 +145,31 @@ static void adu_debug_data(int level, const char *function, int size,
132 */ 145 */
133static void adu_abort_transfers(struct adu_device *dev) 146static void adu_abort_transfers(struct adu_device *dev)
134{ 147{
135 dbg(2," %s : enter", __FUNCTION__); 148 unsigned long flags;
136 149
137 if (dev == NULL) { 150 dbg(2," %s : enter", __FUNCTION__);
138 dbg(1," %s : dev is null", __FUNCTION__);
139 goto exit;
140 }
141 151
142 if (dev->udev == NULL) { 152 if (dev->udev == NULL) {
143 dbg(1," %s : udev is null", __FUNCTION__); 153 dbg(1," %s : udev is null", __FUNCTION__);
144 goto exit; 154 goto exit;
145 } 155 }
146 156
147 dbg(2," %s : udev state %d", __FUNCTION__, dev->udev->state);
148 if (dev->udev->state == USB_STATE_NOTATTACHED) {
149 dbg(1," %s : udev is not attached", __FUNCTION__);
150 goto exit;
151 }
152
153 /* shutdown transfer */ 157 /* shutdown transfer */
154 usb_unlink_urb(dev->interrupt_in_urb); 158
155 usb_unlink_urb(dev->interrupt_out_urb); 159 /* XXX Anchor these instead */
160 spin_lock_irqsave(&dev->buflock, flags);
161 if (!dev->read_urb_finished) {
162 spin_unlock_irqrestore(&dev->buflock, flags);
163 usb_kill_urb(dev->interrupt_in_urb);
164 } else
165 spin_unlock_irqrestore(&dev->buflock, flags);
166
167 spin_lock_irqsave(&dev->buflock, flags);
168 if (!dev->out_urb_finished) {
169 spin_unlock_irqrestore(&dev->buflock, flags);
170 usb_kill_urb(dev->interrupt_out_urb);
171 } else
172 spin_unlock_irqrestore(&dev->buflock, flags);
156 173
157exit: 174exit:
158 dbg(2," %s : leave", __FUNCTION__); 175 dbg(2," %s : leave", __FUNCTION__);
@@ -162,8 +179,6 @@ static void adu_delete(struct adu_device *dev)
162{ 179{
163 dbg(2, "%s enter", __FUNCTION__); 180 dbg(2, "%s enter", __FUNCTION__);
164 181
165 adu_abort_transfers(dev);
166
167 /* free data structures */ 182 /* free data structures */
168 usb_free_urb(dev->interrupt_in_urb); 183 usb_free_urb(dev->interrupt_in_urb);
169 usb_free_urb(dev->interrupt_out_urb); 184 usb_free_urb(dev->interrupt_out_urb);
@@ -239,7 +254,10 @@ static void adu_interrupt_out_callback(struct urb *urb)
239 goto exit; 254 goto exit;
240 } 255 }
241 256
242 wake_up_interruptible(&dev->write_wait); 257 spin_lock(&dev->buflock);
258 dev->out_urb_finished = 1;
259 wake_up(&dev->write_wait);
260 spin_unlock(&dev->buflock);
243exit: 261exit:
244 262
245 adu_debug_data(5, __FUNCTION__, urb->actual_length, 263 adu_debug_data(5, __FUNCTION__, urb->actual_length,
@@ -252,12 +270,17 @@ static int adu_open(struct inode *inode, struct file *file)
252 struct adu_device *dev = NULL; 270 struct adu_device *dev = NULL;
253 struct usb_interface *interface; 271 struct usb_interface *interface;
254 int subminor; 272 int subminor;
255 int retval = 0; 273 int retval;
256 274
257 dbg(2,"%s : enter", __FUNCTION__); 275 dbg(2,"%s : enter", __FUNCTION__);
258 276
259 subminor = iminor(inode); 277 subminor = iminor(inode);
260 278
279 if ((retval = mutex_lock_interruptible(&adutux_mutex))) {
280 dbg(2, "%s : mutex lock failed", __FUNCTION__);
281 goto exit_no_lock;
282 }
283
261 interface = usb_find_interface(&adu_driver, subminor); 284 interface = usb_find_interface(&adu_driver, subminor);
262 if (!interface) { 285 if (!interface) {
263 err("%s - error, can't find device for minor %d", 286 err("%s - error, can't find device for minor %d",
@@ -267,54 +290,54 @@ static int adu_open(struct inode *inode, struct file *file)
267 } 290 }
268 291
269 dev = usb_get_intfdata(interface); 292 dev = usb_get_intfdata(interface);
270 if (!dev) { 293 if (!dev || !dev->udev) {
271 retval = -ENODEV; 294 retval = -ENODEV;
272 goto exit_no_device; 295 goto exit_no_device;
273 } 296 }
274 297
275 /* lock this device */ 298 /* check that nobody else is using the device */
276 if ((retval = mutex_lock_interruptible(&dev->mtx))) { 299 if (dev->open_count) {
277 dbg(2, "%s : mutex lock failed", __FUNCTION__); 300 retval = -EBUSY;
278 goto exit_no_device; 301 goto exit_no_device;
279 } 302 }
280 303
281 /* increment our usage count for the device */
282 ++dev->open_count; 304 ++dev->open_count;
283 dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); 305 dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count);
284 306
285 /* save device in the file's private structure */ 307 /* save device in the file's private structure */
286 file->private_data = dev; 308 file->private_data = dev;
287 309
288 if (dev->open_count == 1) { 310 /* initialize in direction */
289 /* initialize in direction */ 311 dev->read_buffer_length = 0;
290 dev->read_buffer_length = 0;
291 312
292 /* fixup first read by having urb waiting for it */ 313 /* fixup first read by having urb waiting for it */
293 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, 314 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
294 usb_rcvintpipe(dev->udev, 315 usb_rcvintpipe(dev->udev,
295 dev->interrupt_in_endpoint->bEndpointAddress), 316 dev->interrupt_in_endpoint->bEndpointAddress),
296 dev->interrupt_in_buffer, 317 dev->interrupt_in_buffer,
297 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 318 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize),
298 adu_interrupt_in_callback, dev, 319 adu_interrupt_in_callback, dev,
299 dev->interrupt_in_endpoint->bInterval); 320 dev->interrupt_in_endpoint->bInterval);
300 /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ 321 dev->read_urb_finished = 0;
301 dev->read_urb_finished = 0; 322 if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL))
302 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); 323 dev->read_urb_finished = 1;
303 if (retval) 324 /* we ignore failure */
304 --dev->open_count; 325 /* end of fixup for first read */
305 } 326
306 mutex_unlock(&dev->mtx); 327 /* initialize out direction */
328 dev->out_urb_finished = 1;
329
330 retval = 0;
307 331
308exit_no_device: 332exit_no_device:
333 mutex_unlock(&adutux_mutex);
334exit_no_lock:
309 dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); 335 dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval);
310
311 return retval; 336 return retval;
312} 337}
313 338
314static int adu_release_internal(struct adu_device *dev) 339static void adu_release_internal(struct adu_device *dev)
315{ 340{
316 int retval = 0;
317
318 dbg(2," %s : enter", __FUNCTION__); 341 dbg(2," %s : enter", __FUNCTION__);
319 342
320 /* decrement our usage count for the device */ 343 /* decrement our usage count for the device */
@@ -326,12 +349,11 @@ static int adu_release_internal(struct adu_device *dev)
326 } 349 }
327 350
328 dbg(2," %s : leave", __FUNCTION__); 351 dbg(2," %s : leave", __FUNCTION__);
329 return retval;
330} 352}
331 353
332static int adu_release(struct inode *inode, struct file *file) 354static int adu_release(struct inode *inode, struct file *file)
333{ 355{
334 struct adu_device *dev = NULL; 356 struct adu_device *dev;
335 int retval = 0; 357 int retval = 0;
336 358
337 dbg(2," %s : enter", __FUNCTION__); 359 dbg(2," %s : enter", __FUNCTION__);
@@ -343,15 +365,13 @@ static int adu_release(struct inode *inode, struct file *file)
343 } 365 }
344 366
345 dev = file->private_data; 367 dev = file->private_data;
346
347 if (dev == NULL) { 368 if (dev == NULL) {
348 dbg(1," %s : object is NULL", __FUNCTION__); 369 dbg(1," %s : object is NULL", __FUNCTION__);
349 retval = -ENODEV; 370 retval = -ENODEV;
350 goto exit; 371 goto exit;
351 } 372 }
352 373
353 /* lock our device */ 374 mutex_lock(&adutux_mutex); /* not interruptible */
354 mutex_lock(&dev->mtx); /* not interruptible */
355 375
356 if (dev->open_count <= 0) { 376 if (dev->open_count <= 0) {
357 dbg(1," %s : device not opened", __FUNCTION__); 377 dbg(1," %s : device not opened", __FUNCTION__);
@@ -359,19 +379,15 @@ static int adu_release(struct inode *inode, struct file *file)
359 goto exit; 379 goto exit;
360 } 380 }
361 381
382 adu_release_internal(dev);
362 if (dev->udev == NULL) { 383 if (dev->udev == NULL) {
363 /* the device was unplugged before the file was released */ 384 /* the device was unplugged before the file was released */
364 mutex_unlock(&dev->mtx); 385 if (!dev->open_count) /* ... and we're the last user */
365 adu_delete(dev); 386 adu_delete(dev);
366 dev = NULL;
367 } else {
368 /* do the work */
369 retval = adu_release_internal(dev);
370 } 387 }
371 388
372exit: 389exit:
373 if (dev) 390 mutex_unlock(&adutux_mutex);
374 mutex_unlock(&dev->mtx);
375 dbg(2," %s : leave, return value %d", __FUNCTION__, retval); 391 dbg(2," %s : leave, return value %d", __FUNCTION__, retval);
376 return retval; 392 return retval;
377} 393}
@@ -393,12 +409,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
393 409
394 dev = file->private_data; 410 dev = file->private_data;
395 dbg(2," %s : dev=%p", __FUNCTION__, dev); 411 dbg(2," %s : dev=%p", __FUNCTION__, dev);
396 /* lock this object */ 412
397 if (mutex_lock_interruptible(&dev->mtx)) 413 if (mutex_lock_interruptible(&dev->mtx))
398 return -ERESTARTSYS; 414 return -ERESTARTSYS;
399 415
400 /* verify that the device wasn't unplugged */ 416 /* verify that the device wasn't unplugged */
401 if (dev->udev == NULL || dev->minor == 0) { 417 if (dev->udev == NULL) {
402 retval = -ENODEV; 418 retval = -ENODEV;
403 err("No device or device unplugged %d", retval); 419 err("No device or device unplugged %d", retval);
404 goto exit; 420 goto exit;
@@ -452,7 +468,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
452 should_submit = 1; 468 should_submit = 1;
453 } else { 469 } else {
454 /* even the primary was empty - we may need to do IO */ 470 /* even the primary was empty - we may need to do IO */
455 if (dev->interrupt_in_urb->status == -EINPROGRESS) { 471 if (!dev->read_urb_finished) {
456 /* somebody is doing IO */ 472 /* somebody is doing IO */
457 spin_unlock_irqrestore(&dev->buflock, flags); 473 spin_unlock_irqrestore(&dev->buflock, flags);
458 dbg(2," %s : submitted already", __FUNCTION__); 474 dbg(2," %s : submitted already", __FUNCTION__);
@@ -460,6 +476,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
460 /* we must initiate input */ 476 /* we must initiate input */
461 dbg(2," %s : initiate input", __FUNCTION__); 477 dbg(2," %s : initiate input", __FUNCTION__);
462 dev->read_urb_finished = 0; 478 dev->read_urb_finished = 0;
479 spin_unlock_irqrestore(&dev->buflock, flags);
463 480
464 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, 481 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
465 usb_rcvintpipe(dev->udev, 482 usb_rcvintpipe(dev->udev,
@@ -469,15 +486,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
469 adu_interrupt_in_callback, 486 adu_interrupt_in_callback,
470 dev, 487 dev,
471 dev->interrupt_in_endpoint->bInterval); 488 dev->interrupt_in_endpoint->bInterval);
472 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); 489 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
473 if (!retval) { 490 if (retval) {
474 spin_unlock_irqrestore(&dev->buflock, flags); 491 dev->read_urb_finished = 1;
475 dbg(2," %s : submitted OK", __FUNCTION__);
476 } else {
477 if (retval == -ENOMEM) { 492 if (retval == -ENOMEM) {
478 retval = bytes_read ? bytes_read : -ENOMEM; 493 retval = bytes_read ? bytes_read : -ENOMEM;
479 } 494 }
480 spin_unlock_irqrestore(&dev->buflock, flags);
481 dbg(2," %s : submit failed", __FUNCTION__); 495 dbg(2," %s : submit failed", __FUNCTION__);
482 goto exit; 496 goto exit;
483 } 497 }
@@ -486,10 +500,14 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
486 /* we wait for I/O to complete */ 500 /* we wait for I/O to complete */
487 set_current_state(TASK_INTERRUPTIBLE); 501 set_current_state(TASK_INTERRUPTIBLE);
488 add_wait_queue(&dev->read_wait, &wait); 502 add_wait_queue(&dev->read_wait, &wait);
489 if (!dev->read_urb_finished) 503 spin_lock_irqsave(&dev->buflock, flags);
504 if (!dev->read_urb_finished) {
505 spin_unlock_irqrestore(&dev->buflock, flags);
490 timeout = schedule_timeout(COMMAND_TIMEOUT); 506 timeout = schedule_timeout(COMMAND_TIMEOUT);
491 else 507 } else {
508 spin_unlock_irqrestore(&dev->buflock, flags);
492 set_current_state(TASK_RUNNING); 509 set_current_state(TASK_RUNNING);
510 }
493 remove_wait_queue(&dev->read_wait, &wait); 511 remove_wait_queue(&dev->read_wait, &wait);
494 512
495 if (timeout <= 0) { 513 if (timeout <= 0) {
@@ -509,19 +527,23 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
509 527
510 retval = bytes_read; 528 retval = bytes_read;
511 /* if the primary buffer is empty then use it */ 529 /* if the primary buffer is empty then use it */
512 if (should_submit && !dev->interrupt_in_urb->status==-EINPROGRESS) { 530 spin_lock_irqsave(&dev->buflock, flags);
531 if (should_submit && dev->read_urb_finished) {
532 dev->read_urb_finished = 0;
533 spin_unlock_irqrestore(&dev->buflock, flags);
513 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, 534 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
514 usb_rcvintpipe(dev->udev, 535 usb_rcvintpipe(dev->udev,
515 dev->interrupt_in_endpoint->bEndpointAddress), 536 dev->interrupt_in_endpoint->bEndpointAddress),
516 dev->interrupt_in_buffer, 537 dev->interrupt_in_buffer,
517 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 538 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize),
518 adu_interrupt_in_callback, 539 adu_interrupt_in_callback,
519 dev, 540 dev,
520 dev->interrupt_in_endpoint->bInterval); 541 dev->interrupt_in_endpoint->bInterval);
521 /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ 542 if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL) != 0)
522 dev->read_urb_finished = 0; 543 dev->read_urb_finished = 1;
523 usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
524 /* we ignore failure */ 544 /* we ignore failure */
545 } else {
546 spin_unlock_irqrestore(&dev->buflock, flags);
525 } 547 }
526 548
527exit: 549exit:
@@ -535,24 +557,24 @@ exit:
535static ssize_t adu_write(struct file *file, const __user char *buffer, 557static ssize_t adu_write(struct file *file, const __user char *buffer,
536 size_t count, loff_t *ppos) 558 size_t count, loff_t *ppos)
537{ 559{
560 DECLARE_WAITQUEUE(waita, current);
538 struct adu_device *dev; 561 struct adu_device *dev;
539 size_t bytes_written = 0; 562 size_t bytes_written = 0;
540 size_t bytes_to_write; 563 size_t bytes_to_write;
541 size_t buffer_size; 564 size_t buffer_size;
565 unsigned long flags;
542 int retval; 566 int retval;
543 int timeout = 0;
544 567
545 dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); 568 dbg(2," %s : enter, count = %Zd", __FUNCTION__, count);
546 569
547 dev = file->private_data; 570 dev = file->private_data;
548 571
549 /* lock this object */
550 retval = mutex_lock_interruptible(&dev->mtx); 572 retval = mutex_lock_interruptible(&dev->mtx);
551 if (retval) 573 if (retval)
552 goto exit_nolock; 574 goto exit_nolock;
553 575
554 /* verify that the device wasn't unplugged */ 576 /* verify that the device wasn't unplugged */
555 if (dev->udev == NULL || dev->minor == 0) { 577 if (dev->udev == NULL) {
556 retval = -ENODEV; 578 retval = -ENODEV;
557 err("No device or device unplugged %d", retval); 579 err("No device or device unplugged %d", retval);
558 goto exit; 580 goto exit;
@@ -564,42 +586,37 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
564 goto exit; 586 goto exit;
565 } 587 }
566 588
567
568 while (count > 0) { 589 while (count > 0) {
569 if (dev->interrupt_out_urb->status == -EINPROGRESS) { 590 add_wait_queue(&dev->write_wait, &waita);
570 timeout = COMMAND_TIMEOUT; 591 set_current_state(TASK_INTERRUPTIBLE);
592 spin_lock_irqsave(&dev->buflock, flags);
593 if (!dev->out_urb_finished) {
594 spin_unlock_irqrestore(&dev->buflock, flags);
571 595
572 while (timeout > 0) { 596 mutex_unlock(&dev->mtx);
573 if (signal_pending(current)) { 597 if (signal_pending(current)) {
574 dbg(1," %s : interrupted", __FUNCTION__); 598 dbg(1," %s : interrupted", __FUNCTION__);
599 set_current_state(TASK_RUNNING);
575 retval = -EINTR; 600 retval = -EINTR;
576 goto exit; 601 goto exit_onqueue;
577 } 602 }
578 mutex_unlock(&dev->mtx); 603 if (schedule_timeout(COMMAND_TIMEOUT) == 0) {
579 timeout = interruptible_sleep_on_timeout(&dev->write_wait, timeout); 604 dbg(1, "%s - command timed out.", __FUNCTION__);
605 retval = -ETIMEDOUT;
606 goto exit_onqueue;
607 }
608 remove_wait_queue(&dev->write_wait, &waita);
580 retval = mutex_lock_interruptible(&dev->mtx); 609 retval = mutex_lock_interruptible(&dev->mtx);
581 if (retval) { 610 if (retval) {
582 retval = bytes_written ? bytes_written : retval; 611 retval = bytes_written ? bytes_written : retval;
583 goto exit_nolock; 612 goto exit_nolock;
584 } 613 }
585 if (timeout > 0) {
586 break;
587 }
588 dbg(1," %s : interrupted timeout: %d", __FUNCTION__, timeout);
589 }
590
591
592 dbg(1," %s : final timeout: %d", __FUNCTION__, timeout);
593
594 if (timeout == 0) {
595 dbg(1, "%s - command timed out.", __FUNCTION__);
596 retval = -ETIMEDOUT;
597 goto exit;
598 }
599
600 dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count);
601 614
615 dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count);
602 } else { 616 } else {
617 spin_unlock_irqrestore(&dev->buflock, flags);
618 set_current_state(TASK_RUNNING);
619 remove_wait_queue(&dev->write_wait, &waita);
603 dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); 620 dbg(4," %s : sending, count = %Zd", __FUNCTION__, count);
604 621
605 /* write the data into interrupt_out_buffer from userspace */ 622 /* write the data into interrupt_out_buffer from userspace */
@@ -622,11 +639,12 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
622 bytes_to_write, 639 bytes_to_write,
623 adu_interrupt_out_callback, 640 adu_interrupt_out_callback,
624 dev, 641 dev,
625 dev->interrupt_in_endpoint->bInterval); 642 dev->interrupt_out_endpoint->bInterval);
626 /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */
627 dev->interrupt_out_urb->actual_length = bytes_to_write; 643 dev->interrupt_out_urb->actual_length = bytes_to_write;
644 dev->out_urb_finished = 0;
628 retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); 645 retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL);
629 if (retval < 0) { 646 if (retval < 0) {
647 dev->out_urb_finished = 1;
630 err("Couldn't submit interrupt_out_urb %d", retval); 648 err("Couldn't submit interrupt_out_urb %d", retval);
631 goto exit; 649 goto exit;
632 } 650 }
@@ -637,16 +655,17 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
637 bytes_written += bytes_to_write; 655 bytes_written += bytes_to_write;
638 } 656 }
639 } 657 }
640 658 mutex_unlock(&dev->mtx);
641 retval = bytes_written; 659 return bytes_written;
642 660
643exit: 661exit:
644 /* unlock the device */
645 mutex_unlock(&dev->mtx); 662 mutex_unlock(&dev->mtx);
646exit_nolock: 663exit_nolock:
647
648 dbg(2," %s : leave, return value %d", __FUNCTION__, retval); 664 dbg(2," %s : leave, return value %d", __FUNCTION__, retval);
665 return retval;
649 666
667exit_onqueue:
668 remove_wait_queue(&dev->write_wait, &waita);
650 return retval; 669 return retval;
651} 670}
652 671
@@ -831,25 +850,22 @@ static void adu_disconnect(struct usb_interface *interface)
831 dbg(2," %s : enter", __FUNCTION__); 850 dbg(2," %s : enter", __FUNCTION__);
832 851
833 dev = usb_get_intfdata(interface); 852 dev = usb_get_intfdata(interface);
834 usb_set_intfdata(interface, NULL);
835 853
854 mutex_lock(&dev->mtx); /* not interruptible */
855 dev->udev = NULL; /* poison */
836 minor = dev->minor; 856 minor = dev->minor;
837
838 /* give back our minor */
839 usb_deregister_dev(interface, &adu_class); 857 usb_deregister_dev(interface, &adu_class);
840 dev->minor = 0; 858 mutex_unlock(&dev->mtx);
841 859
842 mutex_lock(&dev->mtx); /* not interruptible */ 860 mutex_lock(&adutux_mutex);
861 usb_set_intfdata(interface, NULL);
843 862
844 /* if the device is not opened, then we clean up right now */ 863 /* if the device is not opened, then we clean up right now */
845 dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); 864 dbg(2," %s : open count %d", __FUNCTION__, dev->open_count);
846 if (!dev->open_count) { 865 if (!dev->open_count)
847 mutex_unlock(&dev->mtx);
848 adu_delete(dev); 866 adu_delete(dev);
849 } else { 867
850 dev->udev = NULL; 868 mutex_unlock(&adutux_mutex);
851 mutex_unlock(&dev->mtx);
852 }
853 869
854 dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", 870 dev_info(&interface->dev, "ADU device adutux%d now disconnected\n",
855 (minor - ADU_MINOR_BASE)); 871 (minor - ADU_MINOR_BASE));
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 49c5c5c4c431..06cb71942dc7 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -144,12 +144,14 @@ static void led_disconnect(struct usb_interface *interface)
144 struct usb_led *dev; 144 struct usb_led *dev;
145 145
146 dev = usb_get_intfdata (interface); 146 dev = usb_get_intfdata (interface);
147 usb_set_intfdata (interface, NULL);
148 147
149 device_remove_file(&interface->dev, &dev_attr_blue); 148 device_remove_file(&interface->dev, &dev_attr_blue);
150 device_remove_file(&interface->dev, &dev_attr_red); 149 device_remove_file(&interface->dev, &dev_attr_red);
151 device_remove_file(&interface->dev, &dev_attr_green); 150 device_remove_file(&interface->dev, &dev_attr_green);
152 151
152 /* first remove the files, then set the pointer to NULL */
153 usb_set_intfdata (interface, NULL);
154
153 usb_put_dev(dev->udev); 155 usb_put_dev(dev->udev);
154 156
155 kfree(dev); 157 kfree(dev);
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 9eb4a65ee4d9..d41531139c55 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -327,6 +327,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb)
327 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 327 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
328 unsigned char *data = urb->transfer_buffer; 328 unsigned char *data = urb->transfer_buffer;
329 int status = urb->status; 329 int status = urb->status;
330 unsigned long flags;
330 331
331 dbg("%s - port %d", __FUNCTION__, port->number); 332 dbg("%s - port %d", __FUNCTION__, port->number);
332 333
@@ -339,11 +340,11 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb)
339 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); 340 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
340 341
341 /* Throttle the device if requested by tty */ 342 /* Throttle the device if requested by tty */
342 spin_lock(&port->lock); 343 spin_lock_irqsave(&port->lock, flags);
343 if (!(port->throttled = port->throttle_req)) 344 if (!(port->throttled = port->throttle_req))
344 /* Handle data and continue reading from device */ 345 /* Handle data and continue reading from device */
345 flush_and_resubmit_read_urb(port); 346 flush_and_resubmit_read_urb(port);
346 spin_unlock(&port->lock); 347 spin_unlock_irqrestore(&port->lock, flags);
347} 348}
348EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); 349EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback);
349 350
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 1f7ab15df36d..feba9679ace8 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1215,12 +1215,14 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port)
1215 1215
1216static int keyspan_open (struct usb_serial_port *port, struct file *filp) 1216static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1217{ 1217{
1218 struct keyspan_port_private *p_priv; 1218 struct keyspan_port_private *p_priv;
1219 struct keyspan_serial_private *s_priv; 1219 struct keyspan_serial_private *s_priv;
1220 struct usb_serial *serial = port->serial; 1220 struct usb_serial *serial = port->serial;
1221 const struct keyspan_device_details *d_details; 1221 const struct keyspan_device_details *d_details;
1222 int i, err; 1222 int i, err;
1223 int baud_rate, device_port;
1223 struct urb *urb; 1224 struct urb *urb;
1225 unsigned int cflag;
1224 1226
1225 s_priv = usb_get_serial_data(serial); 1227 s_priv = usb_get_serial_data(serial);
1226 p_priv = usb_get_serial_port_data(port); 1228 p_priv = usb_get_serial_port_data(port);
@@ -1263,6 +1265,30 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1263 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ 1265 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
1264 } 1266 }
1265 1267
1268 /* get the terminal config for the setup message now so we don't
1269 * need to send 2 of them */
1270
1271 cflag = port->tty->termios->c_cflag;
1272 device_port = port->number - port->serial->minor;
1273
1274 /* Baud rate calculation takes baud rate as an integer
1275 so other rates can be generated if desired. */
1276 baud_rate = tty_get_baud_rate(port->tty);
1277 /* If no match or invalid, leave as default */
1278 if (baud_rate >= 0
1279 && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
1280 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
1281 p_priv->baud = baud_rate;
1282 }
1283
1284 /* set CTS/RTS handshake etc. */
1285 p_priv->cflag = cflag;
1286 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
1287
1288 keyspan_send_setup(port, 1);
1289 //mdelay(100);
1290 //keyspan_set_termios(port, NULL);
1291
1266 return (0); 1292 return (0);
1267} 1293}
1268 1294
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a5ced7e08cbf..c29c91271133 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2711,7 +2711,7 @@ static int mos7840_startup(struct usb_serial *serial)
2711 status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); 2711 status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data);
2712 if (status < 0) { 2712 if (status < 0) {
2713 dbg("Writing ZLP_REG5 failed status-0x%x\n", status); 2713 dbg("Writing ZLP_REG5 failed status-0x%x\n", status);
2714 return -1; 2714 goto error;
2715 } else 2715 } else
2716 dbg("ZLP_REG5 Writing success status%d\n", status); 2716 dbg("ZLP_REG5 Writing success status%d\n", status);
2717 2717
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 2cd3f1d4b687..cf8add91de05 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -86,6 +86,7 @@ static struct usb_device_id id_table [] = {
86 { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, 86 { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) },
87 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) }, 87 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) },
88 { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, 88 { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) },
89 { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) },
89 { } /* Terminating entry */ 90 { } /* Terminating entry */
90}; 91};
91 92
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index ed603e3decd6..d31f5d299989 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -104,3 +104,6 @@
104#define WS002IN_VENDOR_ID 0x11f6 104#define WS002IN_VENDOR_ID 0x11f6
105#define WS002IN_PRODUCT_ID 0x2001 105#define WS002IN_PRODUCT_ID 0x2001
106 106
107/* Corega CG-USBRS232R Serial Adapter */
108#define COREGA_VENDOR_ID 0x07aa
109#define COREGA_PRODUCT_ID 0x002a
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 833f6e1e3721..605ebccdcd51 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -136,6 +136,8 @@ static struct usb_device_id id_table_3port [] = {
136 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ 136 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
137 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 137 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
138 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 138 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
139 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
140 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
139 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 141 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
140 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 142 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
141 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ 143 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 1ba19eaa1970..836a34ae6ec6 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -177,6 +177,10 @@ static int slave_configure(struct scsi_device *sdev)
177 * is an occasional series of retries that will all fail. */ 177 * is an occasional series of retries that will all fail. */
178 sdev->retry_hwerror = 1; 178 sdev->retry_hwerror = 1;
179 179
180 /* USB disks should allow restart. Some drives spin down
181 * automatically, requiring a START-STOP UNIT command. */
182 sdev->allow_restart = 1;
183
180 } else { 184 } else {
181 185
182 /* Non-disk-type devices don't need to blacklist any pages 186 /* Non-disk-type devices don't need to blacklist any pages
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 22ab2380367d..2c27721bd259 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -342,11 +342,11 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
342 US_FL_FIX_CAPACITY), 342 US_FL_FIX_CAPACITY),
343 343
344/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */ 344/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */
345UNUSUAL_DEV( 0x04b0, 0x040f, 0x0200, 0x0200, 345UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
346 "NIKON", 346 "NIKON",
347 "NIKON DSC D200", 347 "NIKON DSC D200",
348 US_SC_DEVICE, US_PR_DEVICE, NULL, 348 US_SC_DEVICE, US_PR_DEVICE, NULL,
349 US_FL_FIX_CAPACITY), 349 US_FL_FIX_CAPACITY),
350 350
351/* Reported by Emil Larsson <emil@swip.net> */ 351/* Reported by Emil Larsson <emil@swip.net> */
352UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, 352UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101,
@@ -731,6 +731,13 @@ UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
731 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ), 731 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
732#endif 732#endif
733 733
734/* Reported by RTE <raszilki@yandex.ru> */
735UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141,
736 "JetFlash",
737 "TS1GJF2A/120",
738 US_SC_DEVICE, US_PR_DEVICE, NULL,
739 US_FL_MAX_SECTORS_64 ),
740
734/* Fabrizio Fellini <fello@libero.it> */ 741/* Fabrizio Fellini <fello@libero.it> */
735UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, 742UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
736 "Fujifilm", 743 "Fujifilm",
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7d86e9eae915..5b3dbcfcda48 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -641,6 +641,17 @@ config FB_VESA
641 You will get a boot time penguin logo at no additional cost. Please 641 You will get a boot time penguin logo at no additional cost. Please
642 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. 642 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y.
643 643
644config FB_EFI
645 bool "EFI-based Framebuffer Support"
646 depends on (FB = y) && X86
647 select FB_CFB_FILLRECT
648 select FB_CFB_COPYAREA
649 select FB_CFB_IMAGEBLIT
650 help
651 This is the EFI frame buffer device driver. If the firmware on
652 your platform is UEFI2.0, select Y to add support for
653 Graphics Output Protocol for early console messages to appear.
654
644config FB_IMAC 655config FB_IMAC
645 bool "Intel-based Macintosh Framebuffer Support" 656 bool "Intel-based Macintosh Framebuffer Support"
646 depends on (FB = y) && X86 && EFI 657 depends on (FB = y) && X86 && EFI
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 59d6c45a910d..83e02b3429b6 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_FB_OMAP) += omap/
118obj-$(CONFIG_FB_UVESA) += uvesafb.o 118obj-$(CONFIG_FB_UVESA) += uvesafb.o
119obj-$(CONFIG_FB_VESA) += vesafb.o 119obj-$(CONFIG_FB_VESA) += vesafb.o
120obj-$(CONFIG_FB_IMAC) += imacfb.o 120obj-$(CONFIG_FB_IMAC) += imacfb.o
121obj-$(CONFIG_FB_EFI) += efifb.o
121obj-$(CONFIG_FB_VGA16) += vga16fb.o 122obj-$(CONFIG_FB_VGA16) += vga16fb.o
122obj-$(CONFIG_FB_OF) += offb.o 123obj-$(CONFIG_FB_OF) += offb.o
123obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o 124obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 235b618b4117..11a3a222dfc3 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -268,6 +268,10 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
268 /* Turn off the LCD controller and the DMA controller */ 268 /* Turn off the LCD controller and the DMA controller */
269 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); 269 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
270 270
271 /* Wait for the LCDC core to become idle */
272 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
273 msleep(10);
274
271 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); 275 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
272 276
273 if (info->var.bits_per_pixel == 1) 277 if (info->var.bits_per_pixel == 1)
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 1e32b3d13f2e..62867cb63fef 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -202,6 +202,7 @@ static struct pci_device_id radeonfb_pci_table[] = {
202 CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), 202 CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
203 CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2), 203 CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2),
204 CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2), 204 CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2),
205 CHIP_DEF(PCI_CHIP_RV370_5B63, RV380, CHIP_HAS_CRTC2),
205 CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2), 206 CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2),
206 CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2), 207 CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2),
207 CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), 208 CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 267422f66255..b87ed37ac0c1 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -6,7 +6,7 @@ menu "Console display driver support"
6 6
7config VGA_CONSOLE 7config VGA_CONSOLE
8 bool "VGA text console" if EMBEDDED || !X86 8 bool "VGA text console" if EMBEDDED || !X86
9 depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BFIN 9 depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BLACKFIN
10 default y 10 default y
11 help 11 help
12 Saying Y here will allow you to use Linux in text mode through a 12 Saying Y here will allow you to use Linux in text mode through a
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
new file mode 100644
index 000000000000..bd779ae44b1e
--- /dev/null
+++ b/drivers/video/efifb.c
@@ -0,0 +1,232 @@
1/*
2 * Framebuffer driver for EFI/UEFI based system
3 *
4 * (c) 2006 Edgar Hucek <gimli@dark-green.com>
5 * Original efi driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
6 *
7 */
8
9#include <linux/module.h>
10#include <linux/kernel.h>
11#include <linux/errno.h>
12#include <linux/fb.h>
13#include <linux/platform_device.h>
14#include <linux/screen_info.h>
15
16#include <video/vga.h>
17
18static struct fb_var_screeninfo efifb_defined __initdata = {
19 .activate = FB_ACTIVATE_NOW,
20 .height = -1,
21 .width = -1,
22 .right_margin = 32,
23 .upper_margin = 16,
24 .lower_margin = 4,
25 .vsync_len = 4,
26 .vmode = FB_VMODE_NONINTERLACED,
27};
28
29static struct fb_fix_screeninfo efifb_fix __initdata = {
30 .id = "EFI VGA",
31 .type = FB_TYPE_PACKED_PIXELS,
32 .accel = FB_ACCEL_NONE,
33 .visual = FB_VISUAL_TRUECOLOR,
34};
35
36static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
37 unsigned blue, unsigned transp,
38 struct fb_info *info)
39{
40 /*
41 * Set a single color register. The values supplied are
42 * already rounded down to the hardware's capabilities
43 * (according to the entries in the `var' structure). Return
44 * != 0 for invalid regno.
45 */
46
47 if (regno >= info->cmap.len)
48 return 1;
49
50 if (regno < 16) {
51 red >>= 8;
52 green >>= 8;
53 blue >>= 8;
54 ((u32 *)(info->pseudo_palette))[regno] =
55 (red << info->var.red.offset) |
56 (green << info->var.green.offset) |
57 (blue << info->var.blue.offset);
58 }
59 return 0;
60}
61
62static struct fb_ops efifb_ops = {
63 .owner = THIS_MODULE,
64 .fb_setcolreg = efifb_setcolreg,
65 .fb_fillrect = cfb_fillrect,
66 .fb_copyarea = cfb_copyarea,
67 .fb_imageblit = cfb_imageblit,
68};
69
70static int __init efifb_probe(struct platform_device *dev)
71{
72 struct fb_info *info;
73 int err;
74 unsigned int size_vmode;
75 unsigned int size_remap;
76 unsigned int size_total;
77
78 efifb_fix.smem_start = screen_info.lfb_base;
79 efifb_defined.bits_per_pixel = screen_info.lfb_depth;
80 efifb_defined.xres = screen_info.lfb_width;
81 efifb_defined.yres = screen_info.lfb_height;
82 efifb_fix.line_length = screen_info.lfb_linelength;
83
84 /* size_vmode -- that is the amount of memory needed for the
85 * used video mode, i.e. the minimum amount of
86 * memory we need. */
87 size_vmode = efifb_defined.yres * efifb_fix.line_length;
88
89 /* size_total -- all video memory we have. Used for
90 * entries, ressource allocation and bounds
91 * checking. */
92 size_total = screen_info.lfb_size;
93 if (size_total < size_vmode)
94 size_total = size_vmode;
95
96 /* size_remap -- the amount of video memory we are going to
97 * use for efifb. With modern cards it is no
98 * option to simply use size_total as that
99 * wastes plenty of kernel address space. */
100 size_remap = size_vmode * 2;
101 if (size_remap < size_vmode)
102 size_remap = size_vmode;
103 if (size_remap > size_total)
104 size_remap = size_total;
105 efifb_fix.smem_len = size_remap;
106
107 if (!request_mem_region(efifb_fix.smem_start, size_total, "efifb"))
108 /* We cannot make this fatal. Sometimes this comes from magic
109 spaces our resource handlers simply don't know about */
110 printk(KERN_WARNING
111 "efifb: cannot reserve video memory at 0x%lx\n",
112 efifb_fix.smem_start);
113
114 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
115 if (!info) {
116 err = -ENOMEM;
117 goto err_release_mem;
118 }
119 info->pseudo_palette = info->par;
120 info->par = NULL;
121
122 info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len);
123 if (!info->screen_base) {
124 printk(KERN_ERR "efifb: abort, cannot ioremap video memory "
125 "0x%x @ 0x%lx\n",
126 efifb_fix.smem_len, efifb_fix.smem_start);
127 err = -EIO;
128 goto err_unmap;
129 }
130
131 printk(KERN_INFO "efifb: framebuffer at 0x%lx, mapped to 0x%p, "
132 "using %dk, total %dk\n",
133 efifb_fix.smem_start, info->screen_base,
134 size_remap/1024, size_total/1024);
135 printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
136 efifb_defined.xres, efifb_defined.yres,
137 efifb_defined.bits_per_pixel, efifb_fix.line_length,
138 screen_info.pages);
139
140 efifb_defined.xres_virtual = efifb_defined.xres;
141 efifb_defined.yres_virtual = efifb_fix.smem_len /
142 efifb_fix.line_length;
143 printk(KERN_INFO "efifb: scrolling: redraw\n");
144 efifb_defined.yres_virtual = efifb_defined.yres;
145
146 /* some dummy values for timing to make fbset happy */
147 efifb_defined.pixclock = 10000000 / efifb_defined.xres *
148 1000 / efifb_defined.yres;
149 efifb_defined.left_margin = (efifb_defined.xres / 8) & 0xf8;
150 efifb_defined.hsync_len = (efifb_defined.xres / 8) & 0xf8;
151
152 efifb_defined.red.offset = screen_info.red_pos;
153 efifb_defined.red.length = screen_info.red_size;
154 efifb_defined.green.offset = screen_info.green_pos;
155 efifb_defined.green.length = screen_info.green_size;
156 efifb_defined.blue.offset = screen_info.blue_pos;
157 efifb_defined.blue.length = screen_info.blue_size;
158 efifb_defined.transp.offset = screen_info.rsvd_pos;
159 efifb_defined.transp.length = screen_info.rsvd_size;
160
161 printk(KERN_INFO "efifb: %s: "
162 "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
163 "Truecolor",
164 screen_info.rsvd_size,
165 screen_info.red_size,
166 screen_info.green_size,
167 screen_info.blue_size,
168 screen_info.rsvd_pos,
169 screen_info.red_pos,
170 screen_info.green_pos,
171 screen_info.blue_pos);
172
173 efifb_fix.ypanstep = 0;
174 efifb_fix.ywrapstep = 0;
175
176 info->fbops = &efifb_ops;
177 info->var = efifb_defined;
178 info->fix = efifb_fix;
179 info->flags = FBINFO_FLAG_DEFAULT;
180
181 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
182 err = -ENOMEM;
183 goto err_unmap;
184 }
185 if (register_framebuffer(info) < 0) {
186 err = -EINVAL;
187 goto err_fb_dealoc;
188 }
189 printk(KERN_INFO "fb%d: %s frame buffer device\n",
190 info->node, info->fix.id);
191 return 0;
192
193err_fb_dealoc:
194 fb_dealloc_cmap(&info->cmap);
195err_unmap:
196 iounmap(info->screen_base);
197 framebuffer_release(info);
198err_release_mem:
199 release_mem_region(efifb_fix.smem_start, size_total);
200 return err;
201}
202
203static struct platform_driver efifb_driver = {
204 .probe = efifb_probe,
205 .driver = {
206 .name = "efifb",
207 },
208};
209
210static struct platform_device efifb_device = {
211 .name = "efifb",
212};
213
214static int __init efifb_init(void)
215{
216 int ret;
217
218 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
219 return -ENODEV;
220
221 ret = platform_driver_register(&efifb_driver);
222
223 if (!ret) {
224 ret = platform_device_register(&efifb_device);
225 if (ret)
226 platform_driver_unregister(&efifb_driver);
227 }
228 return ret;
229}
230module_init(efifb_init);
231
232MODULE_LICENSE("GPL");
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c
index f836137a0eda..a0df63289b5f 100644
--- a/drivers/video/fb_ddc.c
+++ b/drivers/video/fb_ddc.c
@@ -56,13 +56,12 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
56 int i, j; 56 int i, j;
57 57
58 algo_data->setscl(algo_data->data, 1); 58 algo_data->setscl(algo_data->data, 1);
59 algo_data->setscl(algo_data->data, 0);
60 59
61 for (i = 0; i < 3; i++) { 60 for (i = 0; i < 3; i++) {
62 /* For some old monitors we need the 61 /* For some old monitors we need the
63 * following process to initialize/stop DDC 62 * following process to initialize/stop DDC
64 */ 63 */
65 algo_data->setsda(algo_data->data, 0); 64 algo_data->setsda(algo_data->data, 1);
66 msleep(13); 65 msleep(13);
67 66
68 algo_data->setscl(algo_data->data, 1); 67 algo_data->setscl(algo_data->data, 1);
@@ -97,14 +96,15 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
97 algo_data->setsda(algo_data->data, 1); 96 algo_data->setsda(algo_data->data, 1);
98 msleep(15); 97 msleep(15);
99 algo_data->setscl(algo_data->data, 0); 98 algo_data->setscl(algo_data->data, 0);
99 algo_data->setsda(algo_data->data, 0);
100 if (edid) 100 if (edid)
101 break; 101 break;
102 } 102 }
103 /* Release the DDC lines when done or the Apple Cinema HD display 103 /* Release the DDC lines when done or the Apple Cinema HD display
104 * will switch off 104 * will switch off
105 */ 105 */
106 algo_data->setsda(algo_data->data, 0); 106 algo_data->setsda(algo_data->data, 1);
107 algo_data->setscl(algo_data->data, 0); 107 algo_data->setscl(algo_data->data, 1);
108 108
109 return edid; 109 return edid;
110} 110}
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c
index 6455fd2a39f2..9366ef2bb5f7 100644
--- a/drivers/video/imacfb.c
+++ b/drivers/video/imacfb.c
@@ -234,10 +234,6 @@ static int __init imacfb_probe(struct platform_device *dev)
234 size_remap = size_total; 234 size_remap = size_total;
235 imacfb_fix.smem_len = size_remap; 235 imacfb_fix.smem_len = size_remap;
236 236
237#ifndef __i386__
238 screen_info.imacpm_seg = 0;
239#endif
240
241 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { 237 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) {
242 printk(KERN_WARNING 238 printk(KERN_WARNING
243 "imacfb: cannot reserve video memory at 0x%lx\n", 239 "imacfb: cannot reserve video memory at 0x%lx\n",
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 75836aa83191..9c56c492a693 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -51,7 +51,6 @@
51#define L1GPU_DISPLAY_SYNC_HSYNC 1 51#define L1GPU_DISPLAY_SYNC_HSYNC 1
52#define L1GPU_DISPLAY_SYNC_VSYNC 2 52#define L1GPU_DISPLAY_SYNC_VSYNC 2
53 53
54#define DDR_SIZE (0) /* used no ddr */
55#define GPU_CMD_BUF_SIZE (64 * 1024) 54#define GPU_CMD_BUF_SIZE (64 * 1024)
56#define GPU_IOIF (0x0d000000UL) 55#define GPU_IOIF (0x0d000000UL)
57#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) 56#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64)
@@ -1060,6 +1059,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1060 u64 xdr_lpar; 1059 u64 xdr_lpar;
1061 int status, res_index; 1060 int status, res_index;
1062 struct task_struct *task; 1061 struct task_struct *task;
1062 unsigned long max_ps3fb_size;
1063 1063
1064 status = ps3_open_hv_device(dev); 1064 status = ps3_open_hv_device(dev);
1065 if (status) { 1065 if (status) {
@@ -1085,8 +1085,15 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1085 1085
1086 ps3fb_set_sync(&dev->core); 1086 ps3fb_set_sync(&dev->core);
1087 1087
1088 max_ps3fb_size = _ALIGN_UP(GPU_IOIF, 256*1024*1024) - GPU_IOIF;
1089 if (ps3fb_videomemory.size > max_ps3fb_size) {
1090 dev_info(&dev->core, "Limiting ps3fb mem size to %lu bytes\n",
1091 max_ps3fb_size);
1092 ps3fb_videomemory.size = max_ps3fb_size;
1093 }
1094
1088 /* get gpu context handle */ 1095 /* get gpu context handle */
1089 status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, 1096 status = lv1_gpu_memory_allocate(ps3fb_videomemory.size, 0, 0, 0, 0,
1090 &ps3fb.memory_handle, &ddr_lpar); 1097 &ps3fb.memory_handle, &ddr_lpar);
1091 if (status) { 1098 if (status) {
1092 dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", 1099 dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n",
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 15d7787dea87..69d7ea02cd48 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -96,10 +96,23 @@ static int virtio_dev_probe(struct device *_d)
96 return err; 96 return err;
97} 97}
98 98
99static int virtio_dev_remove(struct device *_d)
100{
101 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
102 struct virtio_driver *drv = container_of(dev->dev.driver,
103 struct virtio_driver, driver);
104
105 dev->config->set_status(dev, dev->config->get_status(dev)
106 & ~VIRTIO_CONFIG_S_DRIVER);
107 drv->remove(dev);
108 return 0;
109}
110
99int register_virtio_driver(struct virtio_driver *driver) 111int register_virtio_driver(struct virtio_driver *driver)
100{ 112{
101 driver->driver.bus = &virtio_bus; 113 driver->driver.bus = &virtio_bus;
102 driver->driver.probe = virtio_dev_probe; 114 driver->driver.probe = virtio_dev_probe;
115 driver->driver.remove = virtio_dev_remove;
103 return driver_register(&driver->driver); 116 return driver_register(&driver->driver);
104} 117}
105EXPORT_SYMBOL_GPL(register_virtio_driver); 118EXPORT_SYMBOL_GPL(register_virtio_driver);
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index 067c07be928c..e6c4390d8bd6 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -60,6 +60,20 @@ static int zorro_device_probe(struct device *dev)
60} 60}
61 61
62 62
63static int zorro_device_remove(struct device *dev)
64{
65 struct zorro_dev *z = to_zorro_dev(dev);
66 struct zorro_driver *drv = to_zorro_driver(dev->driver);
67
68 if (drv) {
69 if (drv->remove)
70 drv->remove(z);
71 z->driver = NULL;
72 }
73 return 0;
74}
75
76
63 /** 77 /**
64 * zorro_register_driver - register a new Zorro driver 78 * zorro_register_driver - register a new Zorro driver
65 * @drv: the driver structure to register 79 * @drv: the driver structure to register
@@ -128,6 +142,7 @@ struct bus_type zorro_bus_type = {
128 .name = "zorro", 142 .name = "zorro",
129 .match = zorro_bus_match, 143 .match = zorro_bus_match,
130 .probe = zorro_device_probe, 144 .probe = zorro_device_probe,
145 .remove = zorro_device_remove,
131}; 146};
132 147
133 148
diff --git a/fs/Kconfig b/fs/Kconfig
index 429a00228507..635f3e286ad8 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -459,6 +459,15 @@ config OCFS2_DEBUG_MASKLOG
459 This option will enlarge your kernel, but it allows debugging of 459 This option will enlarge your kernel, but it allows debugging of
460 ocfs2 filesystem issues. 460 ocfs2 filesystem issues.
461 461
462config OCFS2_DEBUG_FS
463 bool "OCFS2 expensive checks"
464 depends on OCFS2_FS
465 default n
466 help
467 This option will enable expensive consistency checks. Enable
468 this option for debugging only as it is likely to decrease
469 performance of the filesystem.
470
462config MINIX_FS 471config MINIX_FS
463 tristate "Minix fs support" 472 tristate "Minix fs support"
464 help 473 help
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 64dd22239b21..a609599287aa 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,6 +1,9 @@
1Version 1.52 1Version 1.52
2------------ 2------------
3Fix oops on second mount to server when null auth is used. 3Fix oops on second mount to server when null auth is used.
4Enable experimental Kerberos support. Return writebehind errors on flush
5and sync so that events like out of disk space get reported properly on
6cached files.
4 7
5Version 1.51 8Version 1.51
6------------ 9------------
diff --git a/fs/cifs/README b/fs/cifs/README
index b806b11b5560..bf11329ac784 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -225,12 +225,9 @@ If no password is provided, mount.cifs will prompt for password entry
225 225
226Restrictions 226Restrictions
227============ 227============
228Servers must support the NTLM SMB dialect (which is the most recent, supported
229by Samba and Windows NT version 4, 2000 and XP and many other SMB/CIFS servers)
230Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC 228Servers must support either "pure-TCP" (port 445 TCP/IP CIFS connections) or RFC
2311001/1002 support for "Netbios-Over-TCP/IP." Neither of these is likely to be a 2291001/1002 support for "Netbios-Over-TCP/IP." This is not likely to be a
232problem as most servers support this. IPv6 support is planned for the future, 230problem as most servers support this.
233and is almost complete.
234 231
235Valid filenames differ between Windows and Linux. Windows typically restricts 232Valid filenames differ between Windows and Linux. Windows typically restricts
236filenames which contain certain reserved characters (e.g.the character : 233filenames which contain certain reserved characters (e.g.the character :
@@ -458,6 +455,8 @@ A partial list of the supported mount options follows:
458 byte range locks). 455 byte range locks).
459 remount remount the share (often used to change from ro to rw mounts 456 remount remount the share (often used to change from ro to rw mounts
460 or vice versa) 457 or vice versa)
458 cifsacl Report mode bits (e.g. on stat) based on the Windows ACL for
459 the file. (EXPERIMENTAL)
461 servern Specify the server 's netbios name (RFC1001 name) to use 460 servern Specify the server 's netbios name (RFC1001 name) to use
462 when attempting to setup a session to the server. This is 461 when attempting to setup a session to the server. This is
463 This is needed for mounting to some older servers (such 462 This is needed for mounting to some older servers (such
@@ -584,8 +583,8 @@ Experimental When set to 1 used to enable certain experimental
584 performance enhancement was disabled when 583 performance enhancement was disabled when
585 signing turned on in case buffer was modified 584 signing turned on in case buffer was modified
586 just before it was sent, also this flag will 585 just before it was sent, also this flag will
587 be used to use the new experimental sessionsetup 586 be used to use the new experimental directory change
588 code). 587 notification code).
589 588
590These experimental features and tracing can be enabled by changing flags in 589These experimental features and tracing can be enabled by changing flags in
591/proc/fs/cifs (after the cifs module has been installed or built into the 590/proc/fs/cifs (after the cifs module has been installed or built into the
@@ -608,7 +607,8 @@ the start of smb requests and responses can be enabled via:
608Two other experimental features are under development. To test these 607Two other experimental features are under development. To test these
609requires enabling CONFIG_CIFS_EXPERIMENTAL 608requires enabling CONFIG_CIFS_EXPERIMENTAL
610 609
611 ipv6 enablement 610 cifsacl support needed to retrieve approximated mode bits based on
611 the contents on the CIFS ACL.
612 612
613 DNOTIFY fcntl: needed for support of directory change 613 DNOTIFY fcntl: needed for support of directory change
614 notification and perhaps later for file leases) 614 notification and perhaps later for file leases)
@@ -625,10 +625,7 @@ that they represent all for that share, not just those for which the server
625returned success. 625returned success.
626 626
627Also note that "cat /proc/fs/cifs/DebugData" will display information about 627Also note that "cat /proc/fs/cifs/DebugData" will display information about
628the active sessions and the shares that are mounted. Note: NTLMv2 enablement 628the active sessions and the shares that are mounted.
629will not work since its implementation is not quite complete yet. Do not alter 629Enabling Kerberos (extended security) works when CONFIG_CIFS_EXPERIMENTAL is enabled
630the ExtendedSecurity configuration value unless you are doing specific testing. 630but requires a user space helper (from the Samba project). NTLM and NTLMv2 and
631Enabling extended security works to Windows 2000 Workstations and XP but not to 631LANMAN support do not require this helpr.
632Windows 2000 server or Samba since it does not usually send "raw NTLMSSP"
633(instead it sends NTLMSSP encapsulated in SPNEGO/GSSAPI, which support is not
634complete in the CIFS VFS yet).
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index 29d4b2715254..a8852c200728 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -16,7 +16,7 @@ SecurityDescriptors
16c) Better pam/winbind integration (e.g. to handle uid mapping 16c) Better pam/winbind integration (e.g. to handle uid mapping
17better) 17better)
18 18
19d) Kerberos/SPNEGO session setup support - (started) 19d) Verify that Kerberos signing works
20 20
21e) Cleanup now unneeded SessSetup code in 21e) Cleanup now unneeded SessSetup code in
22fs/cifs/connect.c and add back in NTLMSSP code if any servers 22fs/cifs/connect.c and add back in NTLMSSP code if any servers
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
index ad54a3a6e434..1529d2b12e9c 100644
--- a/fs/cifs/cifs_spnego.c
+++ b/fs/cifs/cifs_spnego.c
@@ -66,20 +66,26 @@ struct key_type cifs_spnego_key_type = {
66 .describe = user_describe, 66 .describe = user_describe,
67}; 67};
68 68
69#define MAX_VER_STR_LEN 9 /* length of longest version string e.g.
70 strlen(";ver=0xFF") */
71#define MAX_MECH_STR_LEN 13 /* length of longest security mechanism name, eg
72 in future could have strlen(";sec=ntlmsspi") */
73#define MAX_IPV6_ADDR_LEN 42 /* eg FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/60 */
69/* get a key struct with a SPNEGO security blob, suitable for session setup */ 74/* get a key struct with a SPNEGO security blob, suitable for session setup */
70struct key * 75struct key *
71cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname) 76cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
72{ 77{
73 struct TCP_Server_Info *server = sesInfo->server; 78 struct TCP_Server_Info *server = sesInfo->server;
74 char *description, *dp; 79 char *description, *dp;
75 size_t desc_len; 80 size_t desc_len;
76 struct key *spnego_key; 81 struct key *spnego_key;
82 const char *hostname = server->hostname;
77 83
78 84 /* BB: come up with better scheme for determining length */
79 /* version + ;ip{4|6}= + address + ;host=hostname + 85 /* length of fields (with semicolons): ver=0xyz ipv4= ipaddress host=
80 ;sec= + ;uid= + NULL */ 86 hostname sec=mechanism uid=0x uid */
81 desc_len = 4 + 5 + 32 + 1 + 5 + strlen(hostname) + 87 desc_len = MAX_VER_STR_LEN + 5 + MAX_IPV6_ADDR_LEN + 1 + 6 +
82 strlen(";sec=krb5") + 7 + sizeof(uid_t)*2 + 1; 88 strlen(hostname) + MAX_MECH_STR_LEN + 8 + (sizeof(uid_t) * 2);
83 spnego_key = ERR_PTR(-ENOMEM); 89 spnego_key = ERR_PTR(-ENOMEM);
84 description = kzalloc(desc_len, GFP_KERNEL); 90 description = kzalloc(desc_len, GFP_KERNEL);
85 if (description == NULL) 91 if (description == NULL)
@@ -88,7 +94,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo, const char *hostname)
88 dp = description; 94 dp = description;
89 /* start with version and hostname portion of UNC string */ 95 /* start with version and hostname portion of UNC string */
90 spnego_key = ERR_PTR(-EINVAL); 96 spnego_key = ERR_PTR(-EINVAL);
91 sprintf(dp, "0x%2.2x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, 97 sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION,
92 hostname); 98 hostname);
93 dp = description + strlen(description); 99 dp = description + strlen(description);
94 100
diff --git a/fs/cifs/cifs_spnego.h b/fs/cifs/cifs_spnego.h
index f443f3b35134..05a34b17a1ab 100644
--- a/fs/cifs/cifs_spnego.h
+++ b/fs/cifs/cifs_spnego.h
@@ -41,6 +41,7 @@ struct cifs_spnego_msg {
41 41
42#ifdef __KERNEL__ 42#ifdef __KERNEL__
43extern struct key_type cifs_spnego_key_type; 43extern struct key_type cifs_spnego_key_type;
44extern struct key *cifs_get_spnego_key(struct cifsSesInfo *sesInfo);
44#endif /* KERNEL */ 45#endif /* KERNEL */
45 46
46#endif /* _CIFS_SPNEGO_H */ 47#endif /* _CIFS_SPNEGO_H */
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index dabbce00712b..f02fdef463a7 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -269,6 +269,13 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
269 269
270 /* BB need to add parm so we can store the SID BB */ 270 /* BB need to add parm so we can store the SID BB */
271 271
272 if (!pdacl) {
273 /* no DACL in the security descriptor, set
274 all the permissions for user/group/other */
275 inode->i_mode |= S_IRWXUGO;
276 return;
277 }
278
272 /* validate that we do not go past end of acl */ 279 /* validate that we do not go past end of acl */
273 if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) { 280 if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
274 cERROR(1, ("ACL too small to parse DACL")); 281 cERROR(1, ("ACL too small to parse DACL"));
@@ -286,12 +293,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
286 user/group/other have no permissions */ 293 user/group/other have no permissions */
287 inode->i_mode &= ~(S_IRWXUGO); 294 inode->i_mode &= ~(S_IRWXUGO);
288 295
289 if (!pdacl) {
290 /* no DACL in the security descriptor, set
291 all the permissions for user/group/other */
292 inode->i_mode |= S_IRWXUGO;
293 return;
294 }
295 acl_base = (char *)pdacl; 296 acl_base = (char *)pdacl;
296 acl_size = sizeof(struct cifs_acl); 297 acl_size = sizeof(struct cifs_acl);
297 298
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 416dc9fe8961..093beaa3900d 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -266,6 +266,7 @@ cifs_alloc_inode(struct super_block *sb)
266 cifs_inode->cifsAttrs = 0x20; /* default */ 266 cifs_inode->cifsAttrs = 0x20; /* default */
267 atomic_set(&cifs_inode->inUse, 0); 267 atomic_set(&cifs_inode->inUse, 0);
268 cifs_inode->time = 0; 268 cifs_inode->time = 0;
269 cifs_inode->write_behind_rc = 0;
269 /* Until the file is open and we have gotten oplock 270 /* Until the file is open and we have gotten oplock
270 info back from the server, can not assume caching of 271 info back from the server, can not assume caching of
271 file data or metadata */ 272 file data or metadata */
@@ -852,7 +853,7 @@ static int cifs_oplock_thread(void *dummyarg)
852 struct cifsTconInfo *pTcon; 853 struct cifsTconInfo *pTcon;
853 struct inode *inode; 854 struct inode *inode;
854 __u16 netfid; 855 __u16 netfid;
855 int rc; 856 int rc, waitrc = 0;
856 857
857 set_freezable(); 858 set_freezable();
858 do { 859 do {
@@ -884,9 +885,11 @@ static int cifs_oplock_thread(void *dummyarg)
884 filemap_fdatawrite(inode->i_mapping); 885 filemap_fdatawrite(inode->i_mapping);
885 if (CIFS_I(inode)->clientCanCacheRead 886 if (CIFS_I(inode)->clientCanCacheRead
886 == 0) { 887 == 0) {
887 filemap_fdatawait(inode->i_mapping); 888 waitrc = filemap_fdatawait(inode->i_mapping);
888 invalidate_remote_inode(inode); 889 invalidate_remote_inode(inode);
889 } 890 }
891 if (rc == 0)
892 rc = waitrc;
890 } else 893 } else
891 rc = 0; 894 rc = 0;
892 /* mutex_unlock(&inode->i_mutex);*/ 895 /* mutex_unlock(&inode->i_mutex);*/
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 87f51f23276f..1fde2197ad76 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -110,6 +110,7 @@ struct mac_key {
110 unsigned int len; 110 unsigned int len;
111 union { 111 union {
112 char ntlm[CIFS_SESS_KEY_SIZE + 16]; 112 char ntlm[CIFS_SESS_KEY_SIZE + 16];
113 char krb5[CIFS_SESS_KEY_SIZE + 16]; /* BB: length correct? */
113 struct { 114 struct {
114 char key[16]; 115 char key[16];
115 struct ntlmv2_resp resp; 116 struct ntlmv2_resp resp;
@@ -139,6 +140,7 @@ struct TCP_Server_Info {
139 /* 15 character server name + 0x20 16th byte indicating type = srv */ 140 /* 15 character server name + 0x20 16th byte indicating type = srv */
140 char server_RFC1001_name[SERVER_NAME_LEN_WITH_NULL]; 141 char server_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
141 char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2]; 142 char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2];
143 char *hostname; /* hostname portion of UNC string */
142 struct socket *ssocket; 144 struct socket *ssocket;
143 union { 145 union {
144 struct sockaddr_in sockAddr; 146 struct sockaddr_in sockAddr;
@@ -471,6 +473,17 @@ struct dir_notify_req {
471#define CIFS_LARGE_BUFFER 2 473#define CIFS_LARGE_BUFFER 2
472#define CIFS_IOVEC 4 /* array of response buffers */ 474#define CIFS_IOVEC 4 /* array of response buffers */
473 475
476/* Type of Request to SendReceive2 */
477#define CIFS_STD_OP 0 /* normal request timeout */
478#define CIFS_LONG_OP 1 /* long op (up to 45 sec, oplock time) */
479#define CIFS_VLONG_OP 2 /* sloow op - can take up to 180 seconds */
480#define CIFS_BLOCKING_OP 4 /* operation can block */
481#define CIFS_ASYNC_OP 8 /* do not wait for response */
482#define CIFS_TIMEOUT_MASK 0x00F /* only one of 5 above set in req */
483#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */
484#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */
485#define CIFS_NO_RESP 0x040 /* no response buffer required */
486
474/* Security Flags: indicate type of session setup needed */ 487/* Security Flags: indicate type of session setup needed */
475#define CIFSSEC_MAY_SIGN 0x00001 488#define CIFSSEC_MAY_SIGN 0x00001
476#define CIFSSEC_MAY_NTLM 0x00002 489#define CIFSSEC_MAY_NTLM 0x00002
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index dd1d7c200ee6..8350eec49663 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -48,10 +48,11 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
48 struct smb_hdr * /* input */ , 48 struct smb_hdr * /* input */ ,
49 struct smb_hdr * /* out */ , 49 struct smb_hdr * /* out */ ,
50 int * /* bytes returned */ , const int long_op); 50 int * /* bytes returned */ , const int long_op);
51extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
52 struct smb_hdr *in_buf, int flags);
51extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, 53extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *,
52 struct kvec *, int /* nvec to send */, 54 struct kvec *, int /* nvec to send */,
53 int * /* type of buf returned */ , const int long_op, 55 int * /* type of buf returned */ , const int flags);
54 const int logError /* whether to log status code*/ );
55extern int SendReceiveBlockingLock(const unsigned int /* xid */ , 56extern int SendReceiveBlockingLock(const unsigned int /* xid */ ,
56 struct cifsTconInfo *, 57 struct cifsTconInfo *,
57 struct smb_hdr * /* input */ , 58 struct smb_hdr * /* input */ ,
@@ -76,8 +77,6 @@ extern void header_assemble(struct smb_hdr *, char /* command */ ,
76extern int small_smb_init_no_tc(const int smb_cmd, const int wct, 77extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
77 struct cifsSesInfo *ses, 78 struct cifsSesInfo *ses,
78 void **request_buf); 79 void **request_buf);
79extern struct key *cifs_get_spnego_key(struct cifsSesInfo *sesInfo,
80 const char *hostname);
81extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, 80extern int CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
82 const int stage, 81 const int stage,
83 const struct nls_table *nls_cp); 82 const struct nls_table *nls_cp);
@@ -248,15 +247,15 @@ extern int CIFSSMBQueryReparseLinkInfo(const int xid,
248extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, 247extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
249 const char *fileName, const int disposition, 248 const char *fileName, const int disposition,
250 const int access_flags, const int omode, 249 const int access_flags, const int omode,
251 __u16 * netfid, int *pOplock, FILE_ALL_INFO *, 250 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
252 const struct nls_table *nls_codepage, int remap); 251 const struct nls_table *nls_codepage, int remap);
253extern int SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, 252extern int SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
254 const char *fileName, const int disposition, 253 const char *fileName, const int disposition,
255 const int access_flags, const int omode, 254 const int access_flags, const int omode,
256 __u16 * netfid, int *pOplock, FILE_ALL_INFO *, 255 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
257 const struct nls_table *nls_codepage, int remap); 256 const struct nls_table *nls_codepage, int remap);
258extern int CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, 257extern int CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon,
259 u32 posix_flags, __u64 mode, __u16 * netfid, 258 u32 posix_flags, __u64 mode, __u16 *netfid,
260 FILE_UNIX_BASIC_INFO *pRetData, 259 FILE_UNIX_BASIC_INFO *pRetData,
261 __u32 *pOplock, const char *name, 260 __u32 *pOplock, const char *name,
262 const struct nls_table *nls_codepage, int remap); 261 const struct nls_table *nls_codepage, int remap);
@@ -277,7 +276,7 @@ extern int CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
277 const __u64 offset, unsigned int *nbytes, 276 const __u64 offset, unsigned int *nbytes,
278 struct kvec *iov, const int nvec, const int long_op); 277 struct kvec *iov, const int nvec, const int long_op);
279extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, 278extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
280 const unsigned char *searchName, __u64 * inode_number, 279 const unsigned char *searchName, __u64 *inode_number,
281 const struct nls_table *nls_codepage, 280 const struct nls_table *nls_codepage,
282 int remap_special_chars); 281 int remap_special_chars);
283extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen, 282extern int cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,
@@ -352,5 +351,5 @@ extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
352 const char *local_acl, const int buflen, const int acl_type, 351 const char *local_acl, const int buflen, const int acl_type,
353 const struct nls_table *nls_codepage, int remap_special_chars); 352 const struct nls_table *nls_codepage, int remap_special_chars);
354extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, 353extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon,
355 const int netfid, __u64 * pExtAttrBits, __u64 *pMask); 354 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
356#endif /* _CIFSPROTO_H */ 355#endif /* _CIFSPROTO_H */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 59d7b7c037ad..9e8a6bef029a 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -698,9 +698,7 @@ int
698CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon) 698CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
699{ 699{
700 struct smb_hdr *smb_buffer; 700 struct smb_hdr *smb_buffer;
701 struct smb_hdr *smb_buffer_response; /* BB removeme BB */
702 int rc = 0; 701 int rc = 0;
703 int length;
704 702
705 cFYI(1, ("In tree disconnect")); 703 cFYI(1, ("In tree disconnect"));
706 /* 704 /*
@@ -737,16 +735,12 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
737 if (rc) { 735 if (rc) {
738 up(&tcon->tconSem); 736 up(&tcon->tconSem);
739 return rc; 737 return rc;
740 } else {
741 smb_buffer_response = smb_buffer; /* BB removeme BB */
742 } 738 }
743 rc = SendReceive(xid, tcon->ses, smb_buffer, smb_buffer_response, 739
744 &length, 0); 740 rc = SendReceiveNoRsp(xid, tcon->ses, smb_buffer, 0);
745 if (rc) 741 if (rc)
746 cFYI(1, ("Tree disconnect failed %d", rc)); 742 cFYI(1, ("Tree disconnect failed %d", rc));
747 743
748 if (smb_buffer)
749 cifs_small_buf_release(smb_buffer);
750 up(&tcon->tconSem); 744 up(&tcon->tconSem);
751 745
752 /* No need to return error on this operation if tid invalidated and 746 /* No need to return error on this operation if tid invalidated and
@@ -760,10 +754,8 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
760int 754int
761CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) 755CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
762{ 756{
763 struct smb_hdr *smb_buffer_response;
764 LOGOFF_ANDX_REQ *pSMB; 757 LOGOFF_ANDX_REQ *pSMB;
765 int rc = 0; 758 int rc = 0;
766 int length;
767 759
768 cFYI(1, ("In SMBLogoff for session disconnect")); 760 cFYI(1, ("In SMBLogoff for session disconnect"));
769 if (ses) 761 if (ses)
@@ -782,8 +774,6 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
782 return rc; 774 return rc;
783 } 775 }
784 776
785 smb_buffer_response = (struct smb_hdr *)pSMB; /* BB removeme BB */
786
787 if (ses->server) { 777 if (ses->server) {
788 pSMB->hdr.Mid = GetNextMid(ses->server); 778 pSMB->hdr.Mid = GetNextMid(ses->server);
789 779
@@ -795,8 +785,7 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
795 pSMB->hdr.Uid = ses->Suid; 785 pSMB->hdr.Uid = ses->Suid;
796 786
797 pSMB->AndXCommand = 0xFF; 787 pSMB->AndXCommand = 0xFF;
798 rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB, 788 rc = SendReceiveNoRsp(xid, ses, (struct smb_hdr *) pSMB, 0);
799 smb_buffer_response, &length, 0);
800 if (ses->server) { 789 if (ses->server) {
801 atomic_dec(&ses->server->socketUseCount); 790 atomic_dec(&ses->server->socketUseCount);
802 if (atomic_read(&ses->server->socketUseCount) == 0) { 791 if (atomic_read(&ses->server->socketUseCount) == 0) {
@@ -807,7 +796,6 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
807 } 796 }
808 } 797 }
809 up(&ses->sesSem); 798 up(&ses->sesSem);
810 cifs_small_buf_release(pSMB);
811 799
812 /* if session dead then we do not need to do ulogoff, 800 /* if session dead then we do not need to do ulogoff,
813 since server closed smb session, no sense reporting 801 since server closed smb session, no sense reporting
@@ -1255,7 +1243,7 @@ OldOpenRetry:
1255 pSMB->ByteCount = cpu_to_le16(count); 1243 pSMB->ByteCount = cpu_to_le16(count);
1256 /* long_op set to 1 to allow for oplock break timeouts */ 1244 /* long_op set to 1 to allow for oplock break timeouts */
1257 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1245 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1258 (struct smb_hdr *) pSMBr, &bytes_returned, 1); 1246 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP);
1259 cifs_stats_inc(&tcon->num_opens); 1247 cifs_stats_inc(&tcon->num_opens);
1260 if (rc) { 1248 if (rc) {
1261 cFYI(1, ("Error in Open = %d", rc)); 1249 cFYI(1, ("Error in Open = %d", rc));
@@ -1368,7 +1356,7 @@ openRetry:
1368 pSMB->ByteCount = cpu_to_le16(count); 1356 pSMB->ByteCount = cpu_to_le16(count);
1369 /* long_op set to 1 to allow for oplock break timeouts */ 1357 /* long_op set to 1 to allow for oplock break timeouts */
1370 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1358 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1371 (struct smb_hdr *) pSMBr, &bytes_returned, 1); 1359 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP);
1372 cifs_stats_inc(&tcon->num_opens); 1360 cifs_stats_inc(&tcon->num_opens);
1373 if (rc) { 1361 if (rc) {
1374 cFYI(1, ("Error in Open = %d", rc)); 1362 cFYI(1, ("Error in Open = %d", rc));
@@ -1446,7 +1434,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1446 iov[0].iov_base = (char *)pSMB; 1434 iov[0].iov_base = (char *)pSMB;
1447 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 1435 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1448 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, 1436 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1449 &resp_buf_type, 0 /* not long op */, 1 /* log err */ ); 1437 &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR);
1450 cifs_stats_inc(&tcon->num_reads); 1438 cifs_stats_inc(&tcon->num_reads);
1451 pSMBr = (READ_RSP *)iov[0].iov_base; 1439 pSMBr = (READ_RSP *)iov[0].iov_base;
1452 if (rc) { 1440 if (rc) {
@@ -1665,7 +1653,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1665 1653
1666 1654
1667 rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, 1655 rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type,
1668 long_op, 0 /* do not log STATUS code */ ); 1656 long_op);
1669 cifs_stats_inc(&tcon->num_writes); 1657 cifs_stats_inc(&tcon->num_writes);
1670 if (rc) { 1658 if (rc) {
1671 cFYI(1, ("Send error Write2 = %d", rc)); 1659 cFYI(1, ("Send error Write2 = %d", rc));
@@ -1707,7 +1695,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1707 int timeout = 0; 1695 int timeout = 0;
1708 __u16 count; 1696 __u16 count;
1709 1697
1710 cFYI(1, ("In CIFSSMBLock - timeout %d numLock %d", waitFlag, numLock)); 1698 cFYI(1, ("CIFSSMBLock timeout %d numLock %d", waitFlag, numLock));
1711 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); 1699 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
1712 1700
1713 if (rc) 1701 if (rc)
@@ -1716,10 +1704,10 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1716 pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */ 1704 pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */
1717 1705
1718 if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { 1706 if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
1719 timeout = -1; /* no response expected */ 1707 timeout = CIFS_ASYNC_OP; /* no response expected */
1720 pSMB->Timeout = 0; 1708 pSMB->Timeout = 0;
1721 } else if (waitFlag == TRUE) { 1709 } else if (waitFlag == TRUE) {
1722 timeout = 3; /* blocking operation, no timeout */ 1710 timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
1723 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ 1711 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
1724 } else { 1712 } else {
1725 pSMB->Timeout = 0; 1713 pSMB->Timeout = 0;
@@ -1749,15 +1737,16 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1749 if (waitFlag) { 1737 if (waitFlag) {
1750 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB, 1738 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
1751 (struct smb_hdr *) pSMBr, &bytes_returned); 1739 (struct smb_hdr *) pSMBr, &bytes_returned);
1740 cifs_small_buf_release(pSMB);
1752 } else { 1741 } else {
1753 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1742 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *)pSMB,
1754 (struct smb_hdr *) pSMBr, &bytes_returned, timeout); 1743 timeout);
1744 /* SMB buffer freed by function above */
1755 } 1745 }
1756 cifs_stats_inc(&tcon->num_locks); 1746 cifs_stats_inc(&tcon->num_locks);
1757 if (rc) { 1747 if (rc) {
1758 cFYI(1, ("Send error in Lock = %d", rc)); 1748 cFYI(1, ("Send error in Lock = %d", rc));
1759 } 1749 }
1760 cifs_small_buf_release(pSMB);
1761 1750
1762 /* Note: On -EAGAIN error only caller can retry on handle based calls 1751 /* Note: On -EAGAIN error only caller can retry on handle based calls
1763 since file handle passed in no longer valid */ 1752 since file handle passed in no longer valid */
@@ -1776,7 +1765,9 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1776 int rc = 0; 1765 int rc = 0;
1777 int timeout = 0; 1766 int timeout = 0;
1778 int bytes_returned = 0; 1767 int bytes_returned = 0;
1768 int resp_buf_type = 0;
1779 __u16 params, param_offset, offset, byte_count, count; 1769 __u16 params, param_offset, offset, byte_count, count;
1770 struct kvec iov[1];
1780 1771
1781 cFYI(1, ("Posix Lock")); 1772 cFYI(1, ("Posix Lock"));
1782 1773
@@ -1818,7 +1809,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1818 1809
1819 parm_data->lock_type = cpu_to_le16(lock_type); 1810 parm_data->lock_type = cpu_to_le16(lock_type);
1820 if (waitFlag) { 1811 if (waitFlag) {
1821 timeout = 3; /* blocking operation, no timeout */ 1812 timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
1822 parm_data->lock_flags = cpu_to_le16(1); 1813 parm_data->lock_flags = cpu_to_le16(1);
1823 pSMB->Timeout = cpu_to_le32(-1); 1814 pSMB->Timeout = cpu_to_le32(-1);
1824 } else 1815 } else
@@ -1838,8 +1829,13 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
1838 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB, 1829 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
1839 (struct smb_hdr *) pSMBr, &bytes_returned); 1830 (struct smb_hdr *) pSMBr, &bytes_returned);
1840 } else { 1831 } else {
1841 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1832 iov[0].iov_base = (char *)pSMB;
1842 (struct smb_hdr *) pSMBr, &bytes_returned, timeout); 1833 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1834 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1835 &resp_buf_type, timeout);
1836 pSMB = NULL; /* request buf already freed by SendReceive2. Do
1837 not try to free it twice below on exit */
1838 pSMBr = (struct smb_com_transaction2_sfi_rsp *)iov[0].iov_base;
1843 } 1839 }
1844 1840
1845 if (rc) { 1841 if (rc) {
@@ -1874,6 +1870,11 @@ plk_err_exit:
1874 if (pSMB) 1870 if (pSMB)
1875 cifs_small_buf_release(pSMB); 1871 cifs_small_buf_release(pSMB);
1876 1872
1873 if (resp_buf_type == CIFS_SMALL_BUFFER)
1874 cifs_small_buf_release(iov[0].iov_base);
1875 else if (resp_buf_type == CIFS_LARGE_BUFFER)
1876 cifs_buf_release(iov[0].iov_base);
1877
1877 /* Note: On -EAGAIN error only caller can retry on handle based calls 1878 /* Note: On -EAGAIN error only caller can retry on handle based calls
1878 since file handle passed in no longer valid */ 1879 since file handle passed in no longer valid */
1879 1880
@@ -1886,8 +1887,6 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1886{ 1887{
1887 int rc = 0; 1888 int rc = 0;
1888 CLOSE_REQ *pSMB = NULL; 1889 CLOSE_REQ *pSMB = NULL;
1889 CLOSE_RSP *pSMBr = NULL;
1890 int bytes_returned;
1891 cFYI(1, ("In CIFSSMBClose")); 1890 cFYI(1, ("In CIFSSMBClose"));
1892 1891
1893/* do not retry on dead session on close */ 1892/* do not retry on dead session on close */
@@ -1897,13 +1896,10 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1897 if (rc) 1896 if (rc)
1898 return rc; 1897 return rc;
1899 1898
1900 pSMBr = (CLOSE_RSP *)pSMB; /* BB removeme BB */
1901
1902 pSMB->FileID = (__u16) smb_file_id; 1899 pSMB->FileID = (__u16) smb_file_id;
1903 pSMB->LastWriteTime = 0xFFFFFFFF; 1900 pSMB->LastWriteTime = 0xFFFFFFFF;
1904 pSMB->ByteCount = 0; 1901 pSMB->ByteCount = 0;
1905 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1902 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
1906 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1907 cifs_stats_inc(&tcon->num_closes); 1903 cifs_stats_inc(&tcon->num_closes);
1908 if (rc) { 1904 if (rc) {
1909 if (rc != -EINTR) { 1905 if (rc != -EINTR) {
@@ -1912,8 +1908,6 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1912 } 1908 }
1913 } 1909 }
1914 1910
1915 cifs_small_buf_release(pSMB);
1916
1917 /* Since session is dead, file will be closed on server already */ 1911 /* Since session is dead, file will be closed on server already */
1918 if (rc == -EAGAIN) 1912 if (rc == -EAGAIN)
1919 rc = 0; 1913 rc = 0;
@@ -3102,7 +3096,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3102 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 3096 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
3103 3097
3104 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, 3098 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type,
3105 0 /* not long op */, 0 /* do not log STATUS codes */ ); 3099 CIFS_STD_OP);
3106 cifs_stats_inc(&tcon->num_acl_get); 3100 cifs_stats_inc(&tcon->num_acl_get);
3107 if (rc) { 3101 if (rc) {
3108 cFYI(1, ("Send error in QuerySecDesc = %d", rc)); 3102 cFYI(1, ("Send error in QuerySecDesc = %d", rc));
@@ -3763,8 +3757,6 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon,
3763{ 3757{
3764 int rc = 0; 3758 int rc = 0;
3765 FINDCLOSE_REQ *pSMB = NULL; 3759 FINDCLOSE_REQ *pSMB = NULL;
3766 CLOSE_RSP *pSMBr = NULL; /* BB removeme BB */
3767 int bytes_returned;
3768 3760
3769 cFYI(1, ("In CIFSSMBFindClose")); 3761 cFYI(1, ("In CIFSSMBFindClose"));
3770 rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB); 3762 rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB);
@@ -3776,16 +3768,13 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon,
3776 if (rc) 3768 if (rc)
3777 return rc; 3769 return rc;
3778 3770
3779 pSMBr = (CLOSE_RSP *)pSMB; /* BB removeme BB */
3780 pSMB->FileID = searchHandle; 3771 pSMB->FileID = searchHandle;
3781 pSMB->ByteCount = 0; 3772 pSMB->ByteCount = 0;
3782 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 3773 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
3783 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
3784 if (rc) { 3774 if (rc) {
3785 cERROR(1, ("Send error in FindClose = %d", rc)); 3775 cERROR(1, ("Send error in FindClose = %d", rc));
3786 } 3776 }
3787 cifs_stats_inc(&tcon->num_fclose); 3777 cifs_stats_inc(&tcon->num_fclose);
3788 cifs_small_buf_release(pSMB);
3789 3778
3790 /* Since session is dead, search handle closed on server already */ 3779 /* Since session is dead, search handle closed on server already */
3791 if (rc == -EAGAIN) 3780 if (rc == -EAGAIN)
@@ -4707,11 +4696,9 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4707 __u16 fid, __u32 pid_of_opener, int SetAllocation) 4696 __u16 fid, __u32 pid_of_opener, int SetAllocation)
4708{ 4697{
4709 struct smb_com_transaction2_sfi_req *pSMB = NULL; 4698 struct smb_com_transaction2_sfi_req *pSMB = NULL;
4710 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
4711 char *data_offset; 4699 char *data_offset;
4712 struct file_end_of_file_info *parm_data; 4700 struct file_end_of_file_info *parm_data;
4713 int rc = 0; 4701 int rc = 0;
4714 int bytes_returned = 0;
4715 __u16 params, param_offset, offset, byte_count, count; 4702 __u16 params, param_offset, offset, byte_count, count;
4716 4703
4717 cFYI(1, ("SetFileSize (via SetFileInfo) %lld", 4704 cFYI(1, ("SetFileSize (via SetFileInfo) %lld",
@@ -4721,8 +4708,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4721 if (rc) 4708 if (rc)
4722 return rc; 4709 return rc;
4723 4710
4724 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
4725
4726 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); 4711 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
4727 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); 4712 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
4728 4713
@@ -4773,17 +4758,13 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
4773 pSMB->Reserved4 = 0; 4758 pSMB->Reserved4 = 0;
4774 pSMB->hdr.smb_buf_length += byte_count; 4759 pSMB->hdr.smb_buf_length += byte_count;
4775 pSMB->ByteCount = cpu_to_le16(byte_count); 4760 pSMB->ByteCount = cpu_to_le16(byte_count);
4776 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 4761 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
4777 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4778 if (rc) { 4762 if (rc) {
4779 cFYI(1, 4763 cFYI(1,
4780 ("Send error in SetFileInfo (SetFileSize) = %d", 4764 ("Send error in SetFileInfo (SetFileSize) = %d",
4781 rc)); 4765 rc));
4782 } 4766 }
4783 4767
4784 if (pSMB)
4785 cifs_small_buf_release(pSMB);
4786
4787 /* Note: On -EAGAIN error only caller can retry on handle based calls 4768 /* Note: On -EAGAIN error only caller can retry on handle based calls
4788 since file handle passed in no longer valid */ 4769 since file handle passed in no longer valid */
4789 4770
@@ -4801,10 +4782,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4801 const FILE_BASIC_INFO *data, __u16 fid) 4782 const FILE_BASIC_INFO *data, __u16 fid)
4802{ 4783{
4803 struct smb_com_transaction2_sfi_req *pSMB = NULL; 4784 struct smb_com_transaction2_sfi_req *pSMB = NULL;
4804 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
4805 char *data_offset; 4785 char *data_offset;
4806 int rc = 0; 4786 int rc = 0;
4807 int bytes_returned = 0;
4808 __u16 params, param_offset, offset, byte_count, count; 4787 __u16 params, param_offset, offset, byte_count, count;
4809 4788
4810 cFYI(1, ("Set Times (via SetFileInfo)")); 4789 cFYI(1, ("Set Times (via SetFileInfo)"));
@@ -4813,8 +4792,6 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4813 if (rc) 4792 if (rc)
4814 return rc; 4793 return rc;
4815 4794
4816 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
4817
4818 /* At this point there is no need to override the current pid 4795 /* At this point there is no need to override the current pid
4819 with the pid of the opener, but that could change if we someday 4796 with the pid of the opener, but that could change if we someday
4820 use an existing handle (rather than opening one on the fly) */ 4797 use an existing handle (rather than opening one on the fly) */
@@ -4854,14 +4831,11 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4854 pSMB->hdr.smb_buf_length += byte_count; 4831 pSMB->hdr.smb_buf_length += byte_count;
4855 pSMB->ByteCount = cpu_to_le16(byte_count); 4832 pSMB->ByteCount = cpu_to_le16(byte_count);
4856 memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); 4833 memcpy(data_offset, data, sizeof(FILE_BASIC_INFO));
4857 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 4834 rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0);
4858 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
4859 if (rc) { 4835 if (rc) {
4860 cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); 4836 cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc));
4861 } 4837 }
4862 4838
4863 cifs_small_buf_release(pSMB);
4864
4865 /* Note: On -EAGAIN error only caller can retry on handle based calls 4839 /* Note: On -EAGAIN error only caller can retry on handle based calls
4866 since file handle passed in no longer valid */ 4840 since file handle passed in no longer valid */
4867 4841
@@ -5152,7 +5126,8 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
5152 pSMB->ByteCount = 0; 5126 pSMB->ByteCount = 0;
5153 5127
5154 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 5128 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5155 (struct smb_hdr *) pSMBr, &bytes_returned, -1); 5129 (struct smb_hdr *)pSMBr, &bytes_returned,
5130 CIFS_ASYNC_OP);
5156 if (rc) { 5131 if (rc) {
5157 cFYI(1, ("Error in Notify = %d", rc)); 5132 cFYI(1, ("Error in Notify = %d", rc));
5158 } else { 5133 } else {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index c52a76ff4bb9..fd9147cdb5a9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -438,9 +438,9 @@ incomplete_rcv:
438 csocket = server->ssocket; 438 csocket = server->ssocket;
439 wake_up(&server->response_q); 439 wake_up(&server->response_q);
440 continue; 440 continue;
441 } else if (length < 4) { 441 } else if (length < pdu_length) {
442 cFYI(1, ("less than four bytes received (%d bytes)", 442 cFYI(1, ("requested %d bytes but only got %d bytes",
443 length)); 443 pdu_length, length));
444 pdu_length -= length; 444 pdu_length -= length;
445 msleep(1); 445 msleep(1);
446 goto incomplete_rcv; 446 goto incomplete_rcv;
@@ -752,6 +752,7 @@ multi_t2_fnd:
752 } 752 }
753 write_unlock(&GlobalSMBSeslock); 753 write_unlock(&GlobalSMBSeslock);
754 754
755 kfree(server->hostname);
755 kfree(server); 756 kfree(server);
756 if (length > 0) 757 if (length > 0)
757 mempool_resize(cifs_req_poolp, length + cifs_min_rcv, 758 mempool_resize(cifs_req_poolp, length + cifs_min_rcv,
@@ -760,6 +761,34 @@ multi_t2_fnd:
760 return 0; 761 return 0;
761} 762}
762 763
764/* extract the host portion of the UNC string */
765static char *
766extract_hostname(const char *unc)
767{
768 const char *src;
769 char *dst, *delim;
770 unsigned int len;
771
772 /* skip double chars at beginning of string */
773 /* BB: check validity of these bytes? */
774 src = unc + 2;
775
776 /* delimiter between hostname and sharename is always '\\' now */
777 delim = strchr(src, '\\');
778 if (!delim)
779 return ERR_PTR(-EINVAL);
780
781 len = delim - src;
782 dst = kmalloc((len + 1), GFP_KERNEL);
783 if (dst == NULL)
784 return ERR_PTR(-ENOMEM);
785
786 memcpy(dst, src, len);
787 dst[len] = '\0';
788
789 return dst;
790}
791
763static int 792static int
764cifs_parse_mount_options(char *options, const char *devname, 793cifs_parse_mount_options(char *options, const char *devname,
765 struct smb_vol *vol) 794 struct smb_vol *vol)
@@ -1781,11 +1810,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1781 1810
1782 memset(&volume_info, 0, sizeof(struct smb_vol)); 1811 memset(&volume_info, 0, sizeof(struct smb_vol));
1783 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { 1812 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
1784 kfree(volume_info.UNC); 1813 rc = -EINVAL;
1785 kfree(volume_info.password); 1814 goto out;
1786 kfree(volume_info.prepath);
1787 FreeXid(xid);
1788 return -EINVAL;
1789 } 1815 }
1790 1816
1791 if (volume_info.nullauth) { 1817 if (volume_info.nullauth) {
@@ -1798,11 +1824,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1798 cifserror("No username specified"); 1824 cifserror("No username specified");
1799 /* In userspace mount helper we can get user name from alternate 1825 /* In userspace mount helper we can get user name from alternate
1800 locations such as env variables and files on disk */ 1826 locations such as env variables and files on disk */
1801 kfree(volume_info.UNC); 1827 rc = -EINVAL;
1802 kfree(volume_info.password); 1828 goto out;
1803 kfree(volume_info.prepath);
1804 FreeXid(xid);
1805 return -EINVAL;
1806 } 1829 }
1807 1830
1808 if (volume_info.UNCip && volume_info.UNC) { 1831 if (volume_info.UNCip && volume_info.UNC) {
@@ -1821,11 +1844,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1821 1844
1822 if (rc <= 0) { 1845 if (rc <= 0) {
1823 /* we failed translating address */ 1846 /* we failed translating address */
1824 kfree(volume_info.UNC); 1847 rc = -EINVAL;
1825 kfree(volume_info.password); 1848 goto out;
1826 kfree(volume_info.prepath);
1827 FreeXid(xid);
1828 return -EINVAL;
1829 } 1849 }
1830 1850
1831 cFYI(1, ("UNC: %s ip: %s", volume_info.UNC, volume_info.UNCip)); 1851 cFYI(1, ("UNC: %s ip: %s", volume_info.UNC, volume_info.UNCip));
@@ -1835,20 +1855,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1835 /* BB using ip addr as server name to connect to the 1855 /* BB using ip addr as server name to connect to the
1836 DFS root below */ 1856 DFS root below */
1837 cERROR(1, ("Connecting to DFS root not implemented yet")); 1857 cERROR(1, ("Connecting to DFS root not implemented yet"));
1838 kfree(volume_info.UNC); 1858 rc = -EINVAL;
1839 kfree(volume_info.password); 1859 goto out;
1840 kfree(volume_info.prepath);
1841 FreeXid(xid);
1842 return -EINVAL;
1843 } else /* which servers DFS root would we conect to */ { 1860 } else /* which servers DFS root would we conect to */ {
1844 cERROR(1, 1861 cERROR(1,
1845 ("CIFS mount error: No UNC path (e.g. -o " 1862 ("CIFS mount error: No UNC path (e.g. -o "
1846 "unc=//192.168.1.100/public) specified")); 1863 "unc=//192.168.1.100/public) specified"));
1847 kfree(volume_info.UNC); 1864 rc = -EINVAL;
1848 kfree(volume_info.password); 1865 goto out;
1849 kfree(volume_info.prepath);
1850 FreeXid(xid);
1851 return -EINVAL;
1852 } 1866 }
1853 1867
1854 /* this is needed for ASCII cp to Unicode converts */ 1868 /* this is needed for ASCII cp to Unicode converts */
@@ -1860,11 +1874,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1860 if (cifs_sb->local_nls == NULL) { 1874 if (cifs_sb->local_nls == NULL) {
1861 cERROR(1, ("CIFS mount error: iocharset %s not found", 1875 cERROR(1, ("CIFS mount error: iocharset %s not found",
1862 volume_info.iocharset)); 1876 volume_info.iocharset));
1863 kfree(volume_info.UNC); 1877 rc = -ELIBACC;
1864 kfree(volume_info.password); 1878 goto out;
1865 kfree(volume_info.prepath);
1866 FreeXid(xid);
1867 return -ELIBACC;
1868 } 1879 }
1869 } 1880 }
1870 1881
@@ -1878,11 +1889,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1878 &sin_server6.sin6_addr, 1889 &sin_server6.sin6_addr,
1879 volume_info.username, &srvTcp); 1890 volume_info.username, &srvTcp);
1880 } else { 1891 } else {
1881 kfree(volume_info.UNC); 1892 rc = -EINVAL;
1882 kfree(volume_info.password); 1893 goto out;
1883 kfree(volume_info.prepath);
1884 FreeXid(xid);
1885 return -EINVAL;
1886 } 1894 }
1887 1895
1888 if (srvTcp) { 1896 if (srvTcp) {
@@ -1906,22 +1914,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1906 "Aborting operation")); 1914 "Aborting operation"));
1907 if (csocket != NULL) 1915 if (csocket != NULL)
1908 sock_release(csocket); 1916 sock_release(csocket);
1909 kfree(volume_info.UNC); 1917 goto out;
1910 kfree(volume_info.password);
1911 kfree(volume_info.prepath);
1912 FreeXid(xid);
1913 return rc;
1914 } 1918 }
1915 1919
1916 srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL); 1920 srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL);
1917 if (!srvTcp) { 1921 if (!srvTcp) {
1918 rc = -ENOMEM; 1922 rc = -ENOMEM;
1919 sock_release(csocket); 1923 sock_release(csocket);
1920 kfree(volume_info.UNC); 1924 goto out;
1921 kfree(volume_info.password);
1922 kfree(volume_info.prepath);
1923 FreeXid(xid);
1924 return rc;
1925 } else { 1925 } else {
1926 memcpy(&srvTcp->addr.sockAddr, &sin_server, 1926 memcpy(&srvTcp->addr.sockAddr, &sin_server,
1927 sizeof(struct sockaddr_in)); 1927 sizeof(struct sockaddr_in));
@@ -1929,6 +1929,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1929 /* BB Add code for ipv6 case too */ 1929 /* BB Add code for ipv6 case too */
1930 srvTcp->ssocket = csocket; 1930 srvTcp->ssocket = csocket;
1931 srvTcp->protocolType = IPV4; 1931 srvTcp->protocolType = IPV4;
1932 srvTcp->hostname = extract_hostname(volume_info.UNC);
1933 if (IS_ERR(srvTcp->hostname)) {
1934 rc = PTR_ERR(srvTcp->hostname);
1935 sock_release(csocket);
1936 goto out;
1937 }
1932 init_waitqueue_head(&srvTcp->response_q); 1938 init_waitqueue_head(&srvTcp->response_q);
1933 init_waitqueue_head(&srvTcp->request_q); 1939 init_waitqueue_head(&srvTcp->request_q);
1934 INIT_LIST_HEAD(&srvTcp->pending_mid_q); 1940 INIT_LIST_HEAD(&srvTcp->pending_mid_q);
@@ -1938,16 +1944,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1938 srvTcp->tcpStatus = CifsNew; 1944 srvTcp->tcpStatus = CifsNew;
1939 init_MUTEX(&srvTcp->tcpSem); 1945 init_MUTEX(&srvTcp->tcpSem);
1940 srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd"); 1946 srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd");
1941 if ( IS_ERR(srvTcp->tsk) ) { 1947 if (IS_ERR(srvTcp->tsk)) {
1942 rc = PTR_ERR(srvTcp->tsk); 1948 rc = PTR_ERR(srvTcp->tsk);
1943 cERROR(1, ("error %d create cifsd thread", rc)); 1949 cERROR(1, ("error %d create cifsd thread", rc));
1944 srvTcp->tsk = NULL; 1950 srvTcp->tsk = NULL;
1945 sock_release(csocket); 1951 sock_release(csocket);
1946 kfree(volume_info.UNC); 1952 kfree(srvTcp->hostname);
1947 kfree(volume_info.password); 1953 goto out;
1948 kfree(volume_info.prepath);
1949 FreeXid(xid);
1950 return rc;
1951 } 1954 }
1952 wait_for_completion(&cifsd_complete); 1955 wait_for_completion(&cifsd_complete);
1953 rc = 0; 1956 rc = 0;
@@ -1962,8 +1965,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1962 if (existingCifsSes) { 1965 if (existingCifsSes) {
1963 pSesInfo = existingCifsSes; 1966 pSesInfo = existingCifsSes;
1964 cFYI(1, ("Existing smb sess found")); 1967 cFYI(1, ("Existing smb sess found"));
1965 kfree(volume_info.password);
1966 /* volume_info.UNC freed at end of function */
1967 } else if (!rc) { 1968 } else if (!rc) {
1968 cFYI(1, ("Existing smb sess not found")); 1969 cFYI(1, ("Existing smb sess not found"));
1969 pSesInfo = sesInfoAlloc(); 1970 pSesInfo = sesInfoAlloc();
@@ -1977,8 +1978,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1977 1978
1978 if (!rc) { 1979 if (!rc) {
1979 /* volume_info.password freed at unmount */ 1980 /* volume_info.password freed at unmount */
1980 if (volume_info.password) 1981 if (volume_info.password) {
1981 pSesInfo->password = volume_info.password; 1982 pSesInfo->password = volume_info.password;
1983 /* set to NULL to prevent freeing on exit */
1984 volume_info.password = NULL;
1985 }
1982 if (volume_info.username) 1986 if (volume_info.username)
1983 strncpy(pSesInfo->userName, 1987 strncpy(pSesInfo->userName,
1984 volume_info.username, 1988 volume_info.username,
@@ -2000,8 +2004,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2000 up(&pSesInfo->sesSem); 2004 up(&pSesInfo->sesSem);
2001 if (!rc) 2005 if (!rc)
2002 atomic_inc(&srvTcp->socketUseCount); 2006 atomic_inc(&srvTcp->socketUseCount);
2003 } else 2007 }
2004 kfree(volume_info.password);
2005 } 2008 }
2006 2009
2007 /* search for existing tcon to this server share */ 2010 /* search for existing tcon to this server share */
@@ -2106,9 +2109,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2106 "", cifs_sb->local_nls, 2109 "", cifs_sb->local_nls,
2107 cifs_sb->mnt_cifs_flags & 2110 cifs_sb->mnt_cifs_flags &
2108 CIFS_MOUNT_MAP_SPECIAL_CHR); 2111 CIFS_MOUNT_MAP_SPECIAL_CHR);
2109 kfree(volume_info.UNC); 2112 rc = -ENODEV;
2110 FreeXid(xid); 2113 goto out;
2111 return -ENODEV;
2112 } else { 2114 } else {
2113 /* BB Do we need to wrap sesSem around 2115 /* BB Do we need to wrap sesSem around
2114 * this TCon call and Unix SetFS as 2116 * this TCon call and Unix SetFS as
@@ -2231,6 +2233,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2231 (in which case it is not needed anymore) but when new sesion is created 2233 (in which case it is not needed anymore) but when new sesion is created
2232 the password ptr is put in the new session structure (in which case the 2234 the password ptr is put in the new session structure (in which case the
2233 password will be freed at unmount time) */ 2235 password will be freed at unmount time) */
2236out:
2237 /* zero out password before freeing */
2238 if (volume_info.password != NULL) {
2239 memset(volume_info.password, 0, strlen(volume_info.password));
2240 kfree(volume_info.password);
2241 }
2234 kfree(volume_info.UNC); 2242 kfree(volume_info.UNC);
2235 kfree(volume_info.prepath); 2243 kfree(volume_info.prepath);
2236 FreeXid(xid); 2244 FreeXid(xid);
@@ -2374,7 +2382,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2374 pSMB->req_no_secext.ByteCount = cpu_to_le16(count); 2382 pSMB->req_no_secext.ByteCount = cpu_to_le16(count);
2375 2383
2376 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 2384 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
2377 &bytes_returned, 1); 2385 &bytes_returned, CIFS_LONG_OP);
2378 if (rc) { 2386 if (rc) {
2379/* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */ 2387/* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */
2380 } else if ((smb_buffer_response->WordCount == 3) 2388 } else if ((smb_buffer_response->WordCount == 3)
@@ -2678,7 +2686,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2678 pSMB->req.ByteCount = cpu_to_le16(count); 2686 pSMB->req.ByteCount = cpu_to_le16(count);
2679 2687
2680 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 2688 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
2681 &bytes_returned, 1); 2689 &bytes_returned, CIFS_LONG_OP);
2682 2690
2683 if (smb_buffer_response->Status.CifsError == 2691 if (smb_buffer_response->Status.CifsError ==
2684 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED)) 2692 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))
@@ -3105,7 +3113,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3105 pSMB->req.ByteCount = cpu_to_le16(count); 3113 pSMB->req.ByteCount = cpu_to_le16(count);
3106 3114
3107 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 3115 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
3108 &bytes_returned, 1); 3116 &bytes_returned, CIFS_LONG_OP);
3109 if (rc) { 3117 if (rc) {
3110/* rc = map_smb_to_linux_error(smb_buffer_response) done in SendReceive now */ 3118/* rc = map_smb_to_linux_error(smb_buffer_response) done in SendReceive now */
3111 } else if ((smb_buffer_response->WordCount == 3) || 3119 } else if ((smb_buffer_response->WordCount == 3) ||
@@ -3381,7 +3389,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3381 pSMB->hdr.smb_buf_length += count; 3389 pSMB->hdr.smb_buf_length += count;
3382 pSMB->ByteCount = cpu_to_le16(count); 3390 pSMB->ByteCount = cpu_to_le16(count);
3383 3391
3384 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0); 3392 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
3393 CIFS_STD_OP);
3385 3394
3386 /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */ 3395 /* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */
3387 /* above now done in SendReceive */ 3396 /* above now done in SendReceive */
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 68ad4ca0cfa3..dd26e2759b17 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -130,7 +130,9 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
130 if (file->f_path.dentry->d_inode->i_mapping) { 130 if (file->f_path.dentry->d_inode->i_mapping) {
131 /* BB no need to lock inode until after invalidate 131 /* BB no need to lock inode until after invalidate
132 since namei code should already have it locked? */ 132 since namei code should already have it locked? */
133 filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); 133 rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
134 if (rc != 0)
135 CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc;
134 } 136 }
135 cFYI(1, ("invalidating remote inode since open detected it " 137 cFYI(1, ("invalidating remote inode since open detected it "
136 "changed")); 138 "changed"));
@@ -425,7 +427,9 @@ reopen_error_exit:
425 pCifsInode = CIFS_I(inode); 427 pCifsInode = CIFS_I(inode);
426 if (pCifsInode) { 428 if (pCifsInode) {
427 if (can_flush) { 429 if (can_flush) {
428 filemap_write_and_wait(inode->i_mapping); 430 rc = filemap_write_and_wait(inode->i_mapping);
431 if (rc != 0)
432 CIFS_I(inode)->write_behind_rc = rc;
429 /* temporarily disable caching while we 433 /* temporarily disable caching while we
430 go to server to get inode info */ 434 go to server to get inode info */
431 pCifsInode->clientCanCacheAll = FALSE; 435 pCifsInode->clientCanCacheAll = FALSE;
@@ -835,9 +839,9 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
835 xid = GetXid(); 839 xid = GetXid();
836 840
837 if (*poffset > file->f_path.dentry->d_inode->i_size) 841 if (*poffset > file->f_path.dentry->d_inode->i_size)
838 long_op = 2; /* writes past end of file can take a long time */ 842 long_op = CIFS_VLONG_OP; /* writes past EOF take long time */
839 else 843 else
840 long_op = 1; 844 long_op = CIFS_LONG_OP;
841 845
842 for (total_written = 0; write_size > total_written; 846 for (total_written = 0; write_size > total_written;
843 total_written += bytes_written) { 847 total_written += bytes_written) {
@@ -884,7 +888,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
884 } 888 }
885 } else 889 } else
886 *poffset += bytes_written; 890 *poffset += bytes_written;
887 long_op = FALSE; /* subsequent writes fast - 891 long_op = CIFS_STD_OP; /* subsequent writes fast -
888 15 seconds is plenty */ 892 15 seconds is plenty */
889 } 893 }
890 894
@@ -934,9 +938,9 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
934 xid = GetXid(); 938 xid = GetXid();
935 939
936 if (*poffset > file->f_path.dentry->d_inode->i_size) 940 if (*poffset > file->f_path.dentry->d_inode->i_size)
937 long_op = 2; /* writes past end of file can take a long time */ 941 long_op = CIFS_VLONG_OP; /* writes past EOF can be slow */
938 else 942 else
939 long_op = 1; 943 long_op = CIFS_LONG_OP;
940 944
941 for (total_written = 0; write_size > total_written; 945 for (total_written = 0; write_size > total_written;
942 total_written += bytes_written) { 946 total_written += bytes_written) {
@@ -1002,7 +1006,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
1002 } 1006 }
1003 } else 1007 } else
1004 *poffset += bytes_written; 1008 *poffset += bytes_written;
1005 long_op = FALSE; /* subsequent writes fast - 1009 long_op = CIFS_STD_OP; /* subsequent writes fast -
1006 15 seconds is plenty */ 1010 15 seconds is plenty */
1007 } 1011 }
1008 1012
@@ -1087,11 +1091,11 @@ refind_writable:
1087 read_unlock(&GlobalSMBSeslock); 1091 read_unlock(&GlobalSMBSeslock);
1088 return open_file; 1092 return open_file;
1089 } 1093 }
1090 1094
1091 read_unlock(&GlobalSMBSeslock); 1095 read_unlock(&GlobalSMBSeslock);
1092 /* Had to unlock since following call can block */ 1096 /* Had to unlock since following call can block */
1093 rc = cifs_reopen_file(open_file->pfile, FALSE); 1097 rc = cifs_reopen_file(open_file->pfile, FALSE);
1094 if (!rc) { 1098 if (!rc) {
1095 if (!open_file->closePend) 1099 if (!open_file->closePend)
1096 return open_file; 1100 return open_file;
1097 else { /* start over in case this was deleted */ 1101 else { /* start over in case this was deleted */
@@ -1114,7 +1118,7 @@ refind_writable:
1114 /* can not use this handle, no write 1118 /* can not use this handle, no write
1115 pending on this one after all */ 1119 pending on this one after all */
1116 atomic_dec(&open_file->wrtPending); 1120 atomic_dec(&open_file->wrtPending);
1117 1121
1118 if (open_file->closePend) /* list could have changed */ 1122 if (open_file->closePend) /* list could have changed */
1119 goto refind_writable; 1123 goto refind_writable;
1120 /* else we simply continue to the next entry. Thus 1124 /* else we simply continue to the next entry. Thus
@@ -1360,14 +1364,17 @@ retry:
1360 open_file->netfid, 1364 open_file->netfid,
1361 bytes_to_write, offset, 1365 bytes_to_write, offset,
1362 &bytes_written, iov, n_iov, 1366 &bytes_written, iov, n_iov,
1363 1); 1367 CIFS_LONG_OP);
1364 atomic_dec(&open_file->wrtPending); 1368 atomic_dec(&open_file->wrtPending);
1365 if (rc || bytes_written < bytes_to_write) { 1369 if (rc || bytes_written < bytes_to_write) {
1366 cERROR(1, ("Write2 ret %d, wrote %d", 1370 cERROR(1, ("Write2 ret %d, wrote %d",
1367 rc, bytes_written)); 1371 rc, bytes_written));
1368 /* BB what if continued retry is 1372 /* BB what if continued retry is
1369 requested via mount flags? */ 1373 requested via mount flags? */
1370 set_bit(AS_EIO, &mapping->flags); 1374 if (rc == -ENOSPC)
1375 set_bit(AS_ENOSPC, &mapping->flags);
1376 else
1377 set_bit(AS_EIO, &mapping->flags);
1371 } else { 1378 } else {
1372 cifs_stats_bytes_written(cifs_sb->tcon, 1379 cifs_stats_bytes_written(cifs_sb->tcon,
1373 bytes_written); 1380 bytes_written);
@@ -1499,9 +1506,11 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1499 cFYI(1, ("Sync file - name: %s datasync: 0x%x", 1506 cFYI(1, ("Sync file - name: %s datasync: 0x%x",
1500 dentry->d_name.name, datasync)); 1507 dentry->d_name.name, datasync));
1501 1508
1502 rc = filemap_fdatawrite(inode->i_mapping); 1509 rc = filemap_write_and_wait(inode->i_mapping);
1503 if (rc == 0) 1510 if (rc == 0) {
1511 rc = CIFS_I(inode)->write_behind_rc;
1504 CIFS_I(inode)->write_behind_rc = 0; 1512 CIFS_I(inode)->write_behind_rc = 0;
1513 }
1505 FreeXid(xid); 1514 FreeXid(xid);
1506 return rc; 1515 return rc;
1507} 1516}
@@ -1553,8 +1562,11 @@ int cifs_flush(struct file *file, fl_owner_t id)
1553 filemapfdatawrite appears easier for the time being */ 1562 filemapfdatawrite appears easier for the time being */
1554 1563
1555 rc = filemap_fdatawrite(inode->i_mapping); 1564 rc = filemap_fdatawrite(inode->i_mapping);
1556 if (!rc) /* reset wb rc if we were able to write out dirty pages */ 1565 /* reset wb rc if we were able to write out dirty pages */
1566 if (!rc) {
1567 rc = CIFS_I(inode)->write_behind_rc;
1557 CIFS_I(inode)->write_behind_rc = 0; 1568 CIFS_I(inode)->write_behind_rc = 0;
1569 }
1558 1570
1559 cFYI(1, ("Flush inode %p file %p rc %d", inode, file, rc)); 1571 cFYI(1, ("Flush inode %p file %p rc %d", inode, file, rc));
1560 1572
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 7d907e84e032..e915eb1d2e66 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1233,7 +1233,7 @@ cifs_rename_exit:
1233int cifs_revalidate(struct dentry *direntry) 1233int cifs_revalidate(struct dentry *direntry)
1234{ 1234{
1235 int xid; 1235 int xid;
1236 int rc = 0; 1236 int rc = 0, wbrc = 0;
1237 char *full_path; 1237 char *full_path;
1238 struct cifs_sb_info *cifs_sb; 1238 struct cifs_sb_info *cifs_sb;
1239 struct cifsInodeInfo *cifsInode; 1239 struct cifsInodeInfo *cifsInode;
@@ -1333,7 +1333,9 @@ int cifs_revalidate(struct dentry *direntry)
1333 if (direntry->d_inode->i_mapping) { 1333 if (direntry->d_inode->i_mapping) {
1334 /* do we need to lock inode until after invalidate completes 1334 /* do we need to lock inode until after invalidate completes
1335 below? */ 1335 below? */
1336 filemap_fdatawrite(direntry->d_inode->i_mapping); 1336 wbrc = filemap_fdatawrite(direntry->d_inode->i_mapping);
1337 if (wbrc)
1338 CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
1337 } 1339 }
1338 if (invalidate_inode) { 1340 if (invalidate_inode) {
1339 /* shrink_dcache not necessary now that cifs dentry ops 1341 /* shrink_dcache not necessary now that cifs dentry ops
@@ -1342,7 +1344,9 @@ int cifs_revalidate(struct dentry *direntry)
1342 shrink_dcache_parent(direntry); */ 1344 shrink_dcache_parent(direntry); */
1343 if (S_ISREG(direntry->d_inode->i_mode)) { 1345 if (S_ISREG(direntry->d_inode->i_mode)) {
1344 if (direntry->d_inode->i_mapping) 1346 if (direntry->d_inode->i_mapping)
1345 filemap_fdatawait(direntry->d_inode->i_mapping); 1347 wbrc = filemap_fdatawait(direntry->d_inode->i_mapping);
1348 if (wbrc)
1349 CIFS_I(direntry->d_inode)->write_behind_rc = wbrc;
1346 /* may eventually have to do this for open files too */ 1350 /* may eventually have to do this for open files too */
1347 if (list_empty(&(cifsInode->openFileList))) { 1351 if (list_empty(&(cifsInode->openFileList))) {
1348 /* changed on server - flush read ahead pages */ 1352 /* changed on server - flush read ahead pages */
@@ -1485,10 +1489,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1485 1489
1486 /* BB check if we need to refresh inode from server now ? BB */ 1490 /* BB check if we need to refresh inode from server now ? BB */
1487 1491
1488 /* need to flush data before changing file size on server */
1489 filemap_write_and_wait(direntry->d_inode->i_mapping);
1490
1491 if (attrs->ia_valid & ATTR_SIZE) { 1492 if (attrs->ia_valid & ATTR_SIZE) {
1493 /*
1494 Flush data before changing file size on server. If the
1495 flush returns error, store it to report later and continue.
1496 BB: This should be smarter. Why bother flushing pages that
1497 will be truncated anyway? Also, should we error out here if
1498 the flush returns error?
1499 */
1500 rc = filemap_write_and_wait(direntry->d_inode->i_mapping);
1501 if (rc != 0) {
1502 CIFS_I(direntry->d_inode)->write_behind_rc = rc;
1503 rc = 0;
1504 }
1505
1492 /* To avoid spurious oplock breaks from server, in the case of 1506 /* To avoid spurious oplock breaks from server, in the case of
1493 inodes that we already have open, avoid doing path based 1507 inodes that we already have open, avoid doing path based
1494 setting of file size if we can do it by handle. 1508 setting of file size if we can do it by handle.
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 899dc6078d9a..d0cb469daab7 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -29,6 +29,7 @@
29#include "ntlmssp.h" 29#include "ntlmssp.h"
30#include "nterr.h" 30#include "nterr.h"
31#include <linux/utsname.h> 31#include <linux/utsname.h>
32#include "cifs_spnego.h"
32 33
33extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, 34extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
34 unsigned char *p24); 35 unsigned char *p24);
@@ -340,11 +341,12 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
340 SESSION_SETUP_ANDX *pSMB; 341 SESSION_SETUP_ANDX *pSMB;
341 __u32 capabilities; 342 __u32 capabilities;
342 int count; 343 int count;
343 int resp_buf_type = 0; 344 int resp_buf_type;
344 struct kvec iov[2]; 345 struct kvec iov[3];
345 enum securityEnum type; 346 enum securityEnum type;
346 __u16 action; 347 __u16 action;
347 int bytes_remaining; 348 int bytes_remaining;
349 struct key *spnego_key = NULL;
348 350
349 if (ses == NULL) 351 if (ses == NULL)
350 return -EINVAL; 352 return -EINVAL;
@@ -377,24 +379,32 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
377 379
378 capabilities = cifs_ssetup_hdr(ses, pSMB); 380 capabilities = cifs_ssetup_hdr(ses, pSMB);
379 381
380 /* we will send the SMB in two pieces, 382 /* we will send the SMB in three pieces:
381 a fixed length beginning part, and a 383 a fixed length beginning part, an optional
382 second part which will include the strings 384 SPNEGO blob (which can be zero length), and a
383 and rest of bcc area, in order to avoid having 385 last part which will include the strings
384 to do a large buffer 17K allocation */ 386 and rest of bcc area. This allows us to avoid
387 a large buffer 17K allocation */
385 iov[0].iov_base = (char *)pSMB; 388 iov[0].iov_base = (char *)pSMB;
386 iov[0].iov_len = smb_buf->smb_buf_length + 4; 389 iov[0].iov_len = smb_buf->smb_buf_length + 4;
387 390
391 /* setting this here allows the code at the end of the function
392 to free the request buffer if there's an error */
393 resp_buf_type = CIFS_SMALL_BUFFER;
394
388 /* 2000 big enough to fit max user, domain, NOS name etc. */ 395 /* 2000 big enough to fit max user, domain, NOS name etc. */
389 str_area = kmalloc(2000, GFP_KERNEL); 396 str_area = kmalloc(2000, GFP_KERNEL);
390 if (str_area == NULL) { 397 if (str_area == NULL) {
391 cifs_small_buf_release(smb_buf); 398 rc = -ENOMEM;
392 return -ENOMEM; 399 goto ssetup_exit;
393 } 400 }
394 bcc_ptr = str_area; 401 bcc_ptr = str_area;
395 402
396 ses->flags &= ~CIFS_SES_LANMAN; 403 ses->flags &= ~CIFS_SES_LANMAN;
397 404
405 iov[1].iov_base = NULL;
406 iov[1].iov_len = 0;
407
398 if (type == LANMAN) { 408 if (type == LANMAN) {
399#ifdef CONFIG_CIFS_WEAK_PW_HASH 409#ifdef CONFIG_CIFS_WEAK_PW_HASH
400 char lnm_session_key[CIFS_SESS_KEY_SIZE]; 410 char lnm_session_key[CIFS_SESS_KEY_SIZE];
@@ -463,8 +473,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
463 struct ntlmv2_resp */ 473 struct ntlmv2_resp */
464 474
465 if (v2_sess_key == NULL) { 475 if (v2_sess_key == NULL) {
466 cifs_small_buf_release(smb_buf); 476 rc = -ENOMEM;
467 return -ENOMEM; 477 goto ssetup_exit;
468 } 478 }
469 479
470 pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities); 480 pSMB->req_no_secext.Capabilities = cpu_to_le32(capabilities);
@@ -499,22 +509,67 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
499 unicode_ssetup_strings(&bcc_ptr, ses, nls_cp); 509 unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
500 } else 510 } else
501 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); 511 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
502 } else /* NTLMSSP or SPNEGO */ { 512 } else if (type == Kerberos) {
513#ifdef CONFIG_CIFS_UPCALL
514 struct cifs_spnego_msg *msg;
515 spnego_key = cifs_get_spnego_key(ses);
516 if (IS_ERR(spnego_key)) {
517 rc = PTR_ERR(spnego_key);
518 spnego_key = NULL;
519 goto ssetup_exit;
520 }
521
522 msg = spnego_key->payload.data;
523 /* bail out if key is too long */
524 if (msg->sesskey_len >
525 sizeof(ses->server->mac_signing_key.data.krb5)) {
526 cERROR(1, ("Kerberos signing key too long (%u bytes)",
527 msg->sesskey_len));
528 rc = -EOVERFLOW;
529 goto ssetup_exit;
530 }
531 ses->server->mac_signing_key.len = msg->sesskey_len;
532 memcpy(ses->server->mac_signing_key.data.krb5, msg->data,
533 msg->sesskey_len);
503 pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; 534 pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
504 capabilities |= CAP_EXTENDED_SECURITY; 535 capabilities |= CAP_EXTENDED_SECURITY;
505 pSMB->req.Capabilities = cpu_to_le32(capabilities); 536 pSMB->req.Capabilities = cpu_to_le32(capabilities);
506 /* BB set password lengths */ 537 iov[1].iov_base = msg->data + msg->sesskey_len;
538 iov[1].iov_len = msg->secblob_len;
539 pSMB->req.SecurityBlobLength = cpu_to_le16(iov[1].iov_len);
540
541 if (ses->capabilities & CAP_UNICODE) {
542 /* unicode strings must be word aligned */
543 if (iov[0].iov_len % 2) {
544 *bcc_ptr = 0;
545 bcc_ptr++;
546 }
547 unicode_oslm_strings(&bcc_ptr, nls_cp);
548 unicode_domain_string(&bcc_ptr, ses, nls_cp);
549 } else
550 /* BB: is this right? */
551 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
552#else /* ! CONFIG_CIFS_UPCALL */
553 cERROR(1, ("Kerberos negotiated but upcall support disabled!"));
554 rc = -ENOSYS;
555 goto ssetup_exit;
556#endif /* CONFIG_CIFS_UPCALL */
557 } else {
558 cERROR(1, ("secType %d not supported!", type));
559 rc = -ENOSYS;
560 goto ssetup_exit;
507 } 561 }
508 562
509 count = (long) bcc_ptr - (long) str_area; 563 iov[2].iov_base = str_area;
564 iov[2].iov_len = (long) bcc_ptr - (long) str_area;
565
566 count = iov[1].iov_len + iov[2].iov_len;
510 smb_buf->smb_buf_length += count; 567 smb_buf->smb_buf_length += count;
511 568
512 BCC_LE(smb_buf) = cpu_to_le16(count); 569 BCC_LE(smb_buf) = cpu_to_le16(count);
513 570
514 iov[1].iov_base = str_area; 571 rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type,
515 iov[1].iov_len = count; 572 CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR);
516 rc = SendReceive2(xid, ses, iov, 2 /* num_iovecs */, &resp_buf_type,
517 0 /* not long op */, 1 /* log NT STATUS if any */ );
518 /* SMB request buf freed in SendReceive2 */ 573 /* SMB request buf freed in SendReceive2 */
519 574
520 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc)); 575 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc));
@@ -560,6 +615,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
560 ses, nls_cp); 615 ses, nls_cp);
561 616
562ssetup_exit: 617ssetup_exit:
618 if (spnego_key)
619 key_put(spnego_key);
563 kfree(str_area); 620 kfree(str_area);
564 if (resp_buf_type == CIFS_SMALL_BUFFER) { 621 if (resp_buf_type == CIFS_SMALL_BUFFER) {
565 cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base)); 622 cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base));
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 7ed32b3cb781..50b623ad9320 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -308,7 +308,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
308 308
309static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) 309static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
310{ 310{
311 if (long_op == -1) { 311 if (long_op == CIFS_ASYNC_OP) {
312 /* oplock breaks must not be held up */ 312 /* oplock breaks must not be held up */
313 atomic_inc(&ses->server->inFlight); 313 atomic_inc(&ses->server->inFlight);
314 } else { 314 } else {
@@ -337,7 +337,7 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
337 as they are allowed to block on server */ 337 as they are allowed to block on server */
338 338
339 /* update # of requests on the wire to server */ 339 /* update # of requests on the wire to server */
340 if (long_op < 3) 340 if (long_op != CIFS_BLOCKING_OP)
341 atomic_inc(&ses->server->inFlight); 341 atomic_inc(&ses->server->inFlight);
342 spin_unlock(&GlobalMid_Lock); 342 spin_unlock(&GlobalMid_Lock);
343 break; 343 break;
@@ -415,17 +415,48 @@ static int wait_for_response(struct cifsSesInfo *ses,
415 } 415 }
416} 416}
417 417
418
419/*
420 *
421 * Send an SMB Request. No response info (other than return code)
422 * needs to be parsed.
423 *
424 * flags indicate the type of request buffer and how long to wait
425 * and whether to log NT STATUS code (error) before mapping it to POSIX error
426 *
427 */
428int
429SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
430 struct smb_hdr *in_buf, int flags)
431{
432 int rc;
433 struct kvec iov[1];
434 int resp_buf_type;
435
436 iov[0].iov_base = (char *)in_buf;
437 iov[0].iov_len = in_buf->smb_buf_length + 4;
438 flags |= CIFS_NO_RESP;
439 rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags);
440#ifdef CONFIG_CIFS_DEBUG2
441 cFYI(1, ("SendRcvNoR flags %d rc %d", flags, rc));
442#endif
443 return rc;
444}
445
418int 446int
419SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, 447SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
420 struct kvec *iov, int n_vec, int *pRespBufType /* ret */, 448 struct kvec *iov, int n_vec, int *pRespBufType /* ret */,
421 const int long_op, const int logError) 449 const int flags)
422{ 450{
423 int rc = 0; 451 int rc = 0;
452 int long_op;
424 unsigned int receive_len; 453 unsigned int receive_len;
425 unsigned long timeout; 454 unsigned long timeout;
426 struct mid_q_entry *midQ; 455 struct mid_q_entry *midQ;
427 struct smb_hdr *in_buf = iov[0].iov_base; 456 struct smb_hdr *in_buf = iov[0].iov_base;
428 457
458 long_op = flags & CIFS_TIMEOUT_MASK;
459
429 *pRespBufType = CIFS_NO_BUFFER; /* no response buf yet */ 460 *pRespBufType = CIFS_NO_BUFFER; /* no response buf yet */
430 461
431 if ((ses == NULL) || (ses->server == NULL)) { 462 if ((ses == NULL) || (ses->server == NULL)) {
@@ -483,15 +514,22 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
483 if (rc < 0) 514 if (rc < 0)
484 goto out; 515 goto out;
485 516
486 if (long_op == -1) 517 if (long_op == CIFS_STD_OP)
487 goto out; 518 timeout = 15 * HZ;
488 else if (long_op == 2) /* writes past end of file can take loong time */ 519 else if (long_op == CIFS_VLONG_OP) /* e.g. slow writes past EOF */
489 timeout = 180 * HZ; 520 timeout = 180 * HZ;
490 else if (long_op == 1) 521 else if (long_op == CIFS_LONG_OP)
491 timeout = 45 * HZ; /* should be greater than 522 timeout = 45 * HZ; /* should be greater than
492 servers oplock break timeout (about 43 seconds) */ 523 servers oplock break timeout (about 43 seconds) */
493 else 524 else if (long_op == CIFS_ASYNC_OP)
494 timeout = 15 * HZ; 525 goto out;
526 else if (long_op == CIFS_BLOCKING_OP)
527 timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */
528 else {
529 cERROR(1, ("unknown timeout flag %d", long_op));
530 rc = -EIO;
531 goto out;
532 }
495 533
496 /* wait for 15 seconds or until woken up due to response arriving or 534 /* wait for 15 seconds or until woken up due to response arriving or
497 due to last connection to this server being unmounted */ 535 due to last connection to this server being unmounted */
@@ -566,7 +604,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
566 } 604 }
567 605
568 /* BB special case reconnect tid and uid here? */ 606 /* BB special case reconnect tid and uid here? */
569 rc = map_smb_to_linux_error(midQ->resp_buf, logError); 607 rc = map_smb_to_linux_error(midQ->resp_buf,
608 flags & CIFS_LOG_ERROR);
570 609
571 /* convert ByteCount if necessary */ 610 /* convert ByteCount if necessary */
572 if (receive_len >= sizeof(struct smb_hdr) - 4 611 if (receive_len >= sizeof(struct smb_hdr) - 4
@@ -574,8 +613,10 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
574 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) 613 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
575 BCC(midQ->resp_buf) = 614 BCC(midQ->resp_buf) =
576 le16_to_cpu(BCC_LE(midQ->resp_buf)); 615 le16_to_cpu(BCC_LE(midQ->resp_buf));
577 midQ->resp_buf = NULL; /* mark it so will not be freed 616 if ((flags & CIFS_NO_RESP) == 0)
578 by DeleteMidQEntry */ 617 midQ->resp_buf = NULL; /* mark it so buf will
618 not be freed by
619 DeleteMidQEntry */
579 } else { 620 } else {
580 rc = -EIO; 621 rc = -EIO;
581 cFYI(1, ("Bad MID state?")); 622 cFYI(1, ("Bad MID state?"));
@@ -663,17 +704,25 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
663 if (rc < 0) 704 if (rc < 0)
664 goto out; 705 goto out;
665 706
666 if (long_op == -1) 707 if (long_op == CIFS_STD_OP)
708 timeout = 15 * HZ;
709 /* wait for 15 seconds or until woken up due to response arriving or
710 due to last connection to this server being unmounted */
711 else if (long_op == CIFS_ASYNC_OP)
667 goto out; 712 goto out;
668 else if (long_op == 2) /* writes past end of file can take loong time */ 713 else if (long_op == CIFS_VLONG_OP) /* writes past EOF can be slow */
669 timeout = 180 * HZ; 714 timeout = 180 * HZ;
670 else if (long_op == 1) 715 else if (long_op == CIFS_LONG_OP)
671 timeout = 45 * HZ; /* should be greater than 716 timeout = 45 * HZ; /* should be greater than
672 servers oplock break timeout (about 43 seconds) */ 717 servers oplock break timeout (about 43 seconds) */
673 else 718 else if (long_op == CIFS_BLOCKING_OP)
674 timeout = 15 * HZ; 719 timeout = 0x7FFFFFFF; /* large but no so large as to wrap */
675 /* wait for 15 seconds or until woken up due to response arriving or 720 else {
676 due to last connection to this server being unmounted */ 721 cERROR(1, ("unknown timeout flag %d", long_op));
722 rc = -EIO;
723 goto out;
724 }
725
677 if (signal_pending(current)) { 726 if (signal_pending(current)) {
678 /* if signal pending do not hold up user for full smb timeout 727 /* if signal pending do not hold up user for full smb timeout
679 but we still give response a chance to complete */ 728 but we still give response a chance to complete */
@@ -812,7 +861,7 @@ send_lock_cancel(const unsigned int xid, struct cifsTconInfo *tcon,
812 pSMB->hdr.Mid = GetNextMid(ses->server); 861 pSMB->hdr.Mid = GetNextMid(ses->server);
813 862
814 return SendReceive(xid, ses, in_buf, out_buf, 863 return SendReceive(xid, ses, in_buf, out_buf,
815 &bytes_returned, 0); 864 &bytes_returned, CIFS_STD_OP);
816} 865}
817 866
818int 867int
@@ -844,7 +893,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
844 to the same server. We may make this configurable later or 893 to the same server. We may make this configurable later or
845 use ses->maxReq */ 894 use ses->maxReq */
846 895
847 rc = wait_for_free_request(ses, 3); 896 rc = wait_for_free_request(ses, CIFS_BLOCKING_OP);
848 if (rc) 897 if (rc)
849 return rc; 898 return rc;
850 899
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index bd26e4cbb994..e8b7c3a98a54 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1954,6 +1954,12 @@ ULONG_IOCTL(TIOCSCTTY)
1954COMPATIBLE_IOCTL(TIOCGPTN) 1954COMPATIBLE_IOCTL(TIOCGPTN)
1955COMPATIBLE_IOCTL(TIOCSPTLCK) 1955COMPATIBLE_IOCTL(TIOCSPTLCK)
1956COMPATIBLE_IOCTL(TIOCSERGETLSR) 1956COMPATIBLE_IOCTL(TIOCSERGETLSR)
1957#ifdef TCGETS2
1958COMPATIBLE_IOCTL(TCGETS2)
1959COMPATIBLE_IOCTL(TCSETS2)
1960COMPATIBLE_IOCTL(TCSETSW2)
1961COMPATIBLE_IOCTL(TCSETSF2)
1962#endif
1957/* Little f */ 1963/* Little f */
1958COMPATIBLE_IOCTL(FIOCLEX) 1964COMPATIBLE_IOCTL(FIOCLEX)
1959COMPATIBLE_IOCTL(FIONCLEX) 1965COMPATIBLE_IOCTL(FIONCLEX)
diff --git a/fs/exec.c b/fs/exec.c
index 4ccaaa4b13b2..282240afe99e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1780,6 +1780,12 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1780 but keep the previous behaviour for now. */ 1780 but keep the previous behaviour for now. */
1781 if (!ispipe && !S_ISREG(inode->i_mode)) 1781 if (!ispipe && !S_ISREG(inode->i_mode))
1782 goto close_fail; 1782 goto close_fail;
1783 /*
1784 * Dont allow local users get cute and trick others to coredump
1785 * into their pre-created files:
1786 */
1787 if (inode->i_uid != current->fsuid)
1788 goto close_fail;
1783 if (!file->f_op) 1789 if (!file->f_op)
1784 goto close_fail; 1790 goto close_fail;
1785 if (!file->f_op->write) 1791 if (!file->f_op->write)
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 7730388c4931..c87ae29c19cb 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -178,3 +178,10 @@ extern const struct inode_operations ext2_special_inode_operations;
178/* symlink.c */ 178/* symlink.c */
179extern const struct inode_operations ext2_fast_symlink_inode_operations; 179extern const struct inode_operations ext2_fast_symlink_inode_operations;
180extern const struct inode_operations ext2_symlink_inode_operations; 180extern const struct inode_operations ext2_symlink_inode_operations;
181
182static inline ext2_fsblk_t
183ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
184{
185 return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
186 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
187}
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 3763757f9fe7..80d2f5292cf9 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -132,6 +132,21 @@ static void fuse_lookup_init(struct fuse_req *req, struct inode *dir,
132 req->out.args[0].value = outarg; 132 req->out.args[0].value = outarg;
133} 133}
134 134
135static u64 fuse_get_attr_version(struct fuse_conn *fc)
136{
137 u64 curr_version;
138
139 /*
140 * The spin lock isn't actually needed on 64bit archs, but we
141 * don't yet care too much about such optimizations.
142 */
143 spin_lock(&fc->lock);
144 curr_version = fc->attr_version;
145 spin_unlock(&fc->lock);
146
147 return curr_version;
148}
149
135/* 150/*
136 * Check whether the dentry is still valid 151 * Check whether the dentry is still valid
137 * 152 *
@@ -171,9 +186,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
171 return 0; 186 return 0;
172 } 187 }
173 188
174 spin_lock(&fc->lock); 189 attr_version = fuse_get_attr_version(fc);
175 attr_version = fc->attr_version;
176 spin_unlock(&fc->lock);
177 190
178 parent = dget_parent(entry); 191 parent = dget_parent(entry);
179 fuse_lookup_init(req, parent->d_inode, entry, &outarg); 192 fuse_lookup_init(req, parent->d_inode, entry, &outarg);
@@ -264,9 +277,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
264 return ERR_PTR(PTR_ERR(forget_req)); 277 return ERR_PTR(PTR_ERR(forget_req));
265 } 278 }
266 279
267 spin_lock(&fc->lock); 280 attr_version = fuse_get_attr_version(fc);
268 attr_version = fc->attr_version;
269 spin_unlock(&fc->lock);
270 281
271 fuse_lookup_init(req, dir, entry, &outarg); 282 fuse_lookup_init(req, dir, entry, &outarg);
272 request_send(fc, req); 283 request_send(fc, req);
@@ -646,6 +657,9 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent,
646 err = req->out.h.error; 657 err = req->out.h.error;
647 fuse_put_request(fc, req); 658 fuse_put_request(fc, req);
648 if (!err) { 659 if (!err) {
660 /* ctime changes */
661 fuse_invalidate_attr(oldent->d_inode);
662
649 fuse_invalidate_attr(olddir); 663 fuse_invalidate_attr(olddir);
650 if (olddir != newdir) 664 if (olddir != newdir)
651 fuse_invalidate_attr(newdir); 665 fuse_invalidate_attr(newdir);
@@ -733,9 +747,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
733 if (IS_ERR(req)) 747 if (IS_ERR(req))
734 return PTR_ERR(req); 748 return PTR_ERR(req);
735 749
736 spin_lock(&fc->lock); 750 attr_version = fuse_get_attr_version(fc);
737 attr_version = fc->attr_version;
738 spin_unlock(&fc->lock);
739 751
740 memset(&inarg, 0, sizeof(inarg)); 752 memset(&inarg, 0, sizeof(inarg));
741 memset(&outarg, 0, sizeof(outarg)); 753 memset(&outarg, 0, sizeof(outarg));
@@ -775,6 +787,31 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
775 return err; 787 return err;
776} 788}
777 789
790int fuse_update_attributes(struct inode *inode, struct kstat *stat,
791 struct file *file, bool *refreshed)
792{
793 struct fuse_inode *fi = get_fuse_inode(inode);
794 int err;
795 bool r;
796
797 if (fi->i_time < get_jiffies_64()) {
798 r = true;
799 err = fuse_do_getattr(inode, stat, file);
800 } else {
801 r = false;
802 err = 0;
803 if (stat) {
804 generic_fillattr(inode, stat);
805 stat->mode = fi->orig_i_mode;
806 }
807 }
808
809 if (refreshed != NULL)
810 *refreshed = r;
811
812 return err;
813}
814
778/* 815/*
779 * Calling into a user-controlled filesystem gives the filesystem 816 * Calling into a user-controlled filesystem gives the filesystem
780 * daemon ptrace-like capabilities over the requester process. This 817 * daemon ptrace-like capabilities over the requester process. This
@@ -862,14 +899,9 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
862 */ 899 */
863 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) || 900 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) ||
864 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) { 901 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
865 struct fuse_inode *fi = get_fuse_inode(inode); 902 err = fuse_update_attributes(inode, NULL, NULL, &refreshed);
866 if (fi->i_time < get_jiffies_64()) { 903 if (err)
867 err = fuse_do_getattr(inode, NULL, NULL); 904 return err;
868 if (err)
869 return err;
870
871 refreshed = true;
872 }
873 } 905 }
874 906
875 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 907 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
@@ -935,7 +967,6 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
935 struct page *page; 967 struct page *page;
936 struct inode *inode = file->f_path.dentry->d_inode; 968 struct inode *inode = file->f_path.dentry->d_inode;
937 struct fuse_conn *fc = get_fuse_conn(inode); 969 struct fuse_conn *fc = get_fuse_conn(inode);
938 struct fuse_file *ff = file->private_data;
939 struct fuse_req *req; 970 struct fuse_req *req;
940 971
941 if (is_bad_inode(inode)) 972 if (is_bad_inode(inode))
@@ -952,7 +983,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
952 } 983 }
953 req->num_pages = 1; 984 req->num_pages = 1;
954 req->pages[0] = page; 985 req->pages[0] = page;
955 fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); 986 fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
956 request_send(fc, req); 987 request_send(fc, req);
957 nbytes = req->out.args[0].size; 988 nbytes = req->out.args[0].size;
958 err = req->out.h.error; 989 err = req->out.h.error;
@@ -1173,22 +1204,12 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1173 struct kstat *stat) 1204 struct kstat *stat)
1174{ 1205{
1175 struct inode *inode = entry->d_inode; 1206 struct inode *inode = entry->d_inode;
1176 struct fuse_inode *fi = get_fuse_inode(inode);
1177 struct fuse_conn *fc = get_fuse_conn(inode); 1207 struct fuse_conn *fc = get_fuse_conn(inode);
1178 int err;
1179 1208
1180 if (!fuse_allow_task(fc, current)) 1209 if (!fuse_allow_task(fc, current))
1181 return -EACCES; 1210 return -EACCES;
1182 1211
1183 if (fi->i_time < get_jiffies_64()) 1212 return fuse_update_attributes(inode, stat, NULL, NULL);
1184 err = fuse_do_getattr(inode, stat, NULL);
1185 else {
1186 err = 0;
1187 generic_fillattr(inode, stat);
1188 stat->mode = fi->orig_i_mode;
1189 }
1190
1191 return err;
1192} 1213}
1193 1214
1194static int fuse_setxattr(struct dentry *entry, const char *name, 1215static int fuse_setxattr(struct dentry *entry, const char *name,
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 535b37399009..bb05d227cf30 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -289,14 +289,16 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync)
289 return fuse_fsync_common(file, de, datasync, 0); 289 return fuse_fsync_common(file, de, datasync, 0);
290} 290}
291 291
292void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff, 292void fuse_read_fill(struct fuse_req *req, struct file *file,
293 struct inode *inode, loff_t pos, size_t count, int opcode) 293 struct inode *inode, loff_t pos, size_t count, int opcode)
294{ 294{
295 struct fuse_read_in *inarg = &req->misc.read_in; 295 struct fuse_read_in *inarg = &req->misc.read_in;
296 struct fuse_file *ff = file->private_data;
296 297
297 inarg->fh = ff->fh; 298 inarg->fh = ff->fh;
298 inarg->offset = pos; 299 inarg->offset = pos;
299 inarg->size = count; 300 inarg->size = count;
301 inarg->flags = file->f_flags;
300 req->in.h.opcode = opcode; 302 req->in.h.opcode = opcode;
301 req->in.h.nodeid = get_node_id(inode); 303 req->in.h.nodeid = get_node_id(inode);
302 req->in.numargs = 1; 304 req->in.numargs = 1;
@@ -313,9 +315,8 @@ static size_t fuse_send_read(struct fuse_req *req, struct file *file,
313 fl_owner_t owner) 315 fl_owner_t owner)
314{ 316{
315 struct fuse_conn *fc = get_fuse_conn(inode); 317 struct fuse_conn *fc = get_fuse_conn(inode);
316 struct fuse_file *ff = file->private_data;
317 318
318 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ); 319 fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
319 if (owner != NULL) { 320 if (owner != NULL) {
320 struct fuse_read_in *inarg = &req->misc.read_in; 321 struct fuse_read_in *inarg = &req->misc.read_in;
321 322
@@ -376,15 +377,16 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
376 fuse_put_request(fc, req); 377 fuse_put_request(fc, req);
377} 378}
378 379
379static void fuse_send_readpages(struct fuse_req *req, struct fuse_file *ff, 380static void fuse_send_readpages(struct fuse_req *req, struct file *file,
380 struct inode *inode) 381 struct inode *inode)
381{ 382{
382 struct fuse_conn *fc = get_fuse_conn(inode); 383 struct fuse_conn *fc = get_fuse_conn(inode);
383 loff_t pos = page_offset(req->pages[0]); 384 loff_t pos = page_offset(req->pages[0]);
384 size_t count = req->num_pages << PAGE_CACHE_SHIFT; 385 size_t count = req->num_pages << PAGE_CACHE_SHIFT;
385 req->out.page_zeroing = 1; 386 req->out.page_zeroing = 1;
386 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ); 387 fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
387 if (fc->async_read) { 388 if (fc->async_read) {
389 struct fuse_file *ff = file->private_data;
388 req->ff = fuse_file_get(ff); 390 req->ff = fuse_file_get(ff);
389 req->end = fuse_readpages_end; 391 req->end = fuse_readpages_end;
390 request_send_background(fc, req); 392 request_send_background(fc, req);
@@ -396,7 +398,7 @@ static void fuse_send_readpages(struct fuse_req *req, struct fuse_file *ff,
396 398
397struct fuse_fill_data { 399struct fuse_fill_data {
398 struct fuse_req *req; 400 struct fuse_req *req;
399 struct fuse_file *ff; 401 struct file *file;
400 struct inode *inode; 402 struct inode *inode;
401}; 403};
402 404
@@ -411,7 +413,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
411 (req->num_pages == FUSE_MAX_PAGES_PER_REQ || 413 (req->num_pages == FUSE_MAX_PAGES_PER_REQ ||
412 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read || 414 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read ||
413 req->pages[req->num_pages - 1]->index + 1 != page->index)) { 415 req->pages[req->num_pages - 1]->index + 1 != page->index)) {
414 fuse_send_readpages(req, data->ff, inode); 416 fuse_send_readpages(req, data->file, inode);
415 data->req = req = fuse_get_req(fc); 417 data->req = req = fuse_get_req(fc);
416 if (IS_ERR(req)) { 418 if (IS_ERR(req)) {
417 unlock_page(page); 419 unlock_page(page);
@@ -435,7 +437,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
435 if (is_bad_inode(inode)) 437 if (is_bad_inode(inode))
436 goto out; 438 goto out;
437 439
438 data.ff = file->private_data; 440 data.file = file;
439 data.inode = inode; 441 data.inode = inode;
440 data.req = fuse_get_req(fc); 442 data.req = fuse_get_req(fc);
441 err = PTR_ERR(data.req); 443 err = PTR_ERR(data.req);
@@ -445,7 +447,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
445 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); 447 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
446 if (!err) { 448 if (!err) {
447 if (data.req->num_pages) 449 if (data.req->num_pages)
448 fuse_send_readpages(data.req, data.ff, inode); 450 fuse_send_readpages(data.req, file, inode);
449 else 451 else
450 fuse_put_request(fc, data.req); 452 fuse_put_request(fc, data.req);
451 } 453 }
@@ -453,11 +455,31 @@ out:
453 return err; 455 return err;
454} 456}
455 457
456static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff, 458static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
459 unsigned long nr_segs, loff_t pos)
460{
461 struct inode *inode = iocb->ki_filp->f_mapping->host;
462
463 if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) {
464 int err;
465 /*
466 * If trying to read past EOF, make sure the i_size
467 * attribute is up-to-date.
468 */
469 err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL);
470 if (err)
471 return err;
472 }
473
474 return generic_file_aio_read(iocb, iov, nr_segs, pos);
475}
476
477static void fuse_write_fill(struct fuse_req *req, struct file *file,
457 struct inode *inode, loff_t pos, size_t count, 478 struct inode *inode, loff_t pos, size_t count,
458 int writepage) 479 int writepage)
459{ 480{
460 struct fuse_conn *fc = get_fuse_conn(inode); 481 struct fuse_conn *fc = get_fuse_conn(inode);
482 struct fuse_file *ff = file->private_data;
461 struct fuse_write_in *inarg = &req->misc.write.in; 483 struct fuse_write_in *inarg = &req->misc.write.in;
462 struct fuse_write_out *outarg = &req->misc.write.out; 484 struct fuse_write_out *outarg = &req->misc.write.out;
463 485
@@ -466,6 +488,7 @@ static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff,
466 inarg->offset = pos; 488 inarg->offset = pos;
467 inarg->size = count; 489 inarg->size = count;
468 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0; 490 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0;
491 inarg->flags = file->f_flags;
469 req->in.h.opcode = FUSE_WRITE; 492 req->in.h.opcode = FUSE_WRITE;
470 req->in.h.nodeid = get_node_id(inode); 493 req->in.h.nodeid = get_node_id(inode);
471 req->in.argpages = 1; 494 req->in.argpages = 1;
@@ -486,7 +509,7 @@ static size_t fuse_send_write(struct fuse_req *req, struct file *file,
486 fl_owner_t owner) 509 fl_owner_t owner)
487{ 510{
488 struct fuse_conn *fc = get_fuse_conn(inode); 511 struct fuse_conn *fc = get_fuse_conn(inode);
489 fuse_write_fill(req, file->private_data, inode, pos, count, 0); 512 fuse_write_fill(req, file, inode, pos, count, 0);
490 if (owner != NULL) { 513 if (owner != NULL) {
491 struct fuse_write_in *inarg = &req->misc.write.in; 514 struct fuse_write_in *inarg = &req->misc.write.in;
492 inarg->write_flags |= FUSE_WRITE_LOCKOWNER; 515 inarg->write_flags |= FUSE_WRITE_LOCKOWNER;
@@ -887,7 +910,7 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
887static const struct file_operations fuse_file_operations = { 910static const struct file_operations fuse_file_operations = {
888 .llseek = generic_file_llseek, 911 .llseek = generic_file_llseek,
889 .read = do_sync_read, 912 .read = do_sync_read,
890 .aio_read = generic_file_aio_read, 913 .aio_read = fuse_file_aio_read,
891 .write = do_sync_write, 914 .write = do_sync_write,
892 .aio_write = generic_file_aio_write, 915 .aio_write = generic_file_aio_write,
893 .mmap = fuse_file_mmap, 916 .mmap = fuse_file_mmap,
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 6c5461de1a5f..3ab8a3048e8b 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -447,7 +447,7 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
447/** 447/**
448 * Initialize READ or READDIR request 448 * Initialize READ or READDIR request
449 */ 449 */
450void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff, 450void fuse_read_fill(struct fuse_req *req, struct file *file,
451 struct inode *inode, loff_t pos, size_t count, int opcode); 451 struct inode *inode, loff_t pos, size_t count, int opcode);
452 452
453/** 453/**
@@ -593,3 +593,6 @@ int fuse_valid_type(int m);
593int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task); 593int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);
594 594
595u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id); 595u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
596
597int fuse_update_attributes(struct inode *inode, struct kstat *stat,
598 struct file *file, bool *refreshed);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 9a68d6970845..84f9f7dfdf5b 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -56,6 +56,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
56 fi->i_time = 0; 56 fi->i_time = 0;
57 fi->nodeid = 0; 57 fi->nodeid = 0;
58 fi->nlookup = 0; 58 fi->nlookup = 0;
59 fi->attr_version = 0;
59 INIT_LIST_HEAD(&fi->write_files); 60 INIT_LIST_HEAD(&fi->write_files);
60 fi->forget_req = fuse_request_alloc(); 61 fi->forget_req = fuse_request_alloc();
61 if (!fi->forget_req) { 62 if (!fi->forget_req) {
@@ -562,8 +563,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
562 arg->major = FUSE_KERNEL_VERSION; 563 arg->major = FUSE_KERNEL_VERSION;
563 arg->minor = FUSE_KERNEL_MINOR_VERSION; 564 arg->minor = FUSE_KERNEL_MINOR_VERSION;
564 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 565 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
565 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS | 566 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC;
566 FUSE_ATOMIC_O_TRUNC;
567 req->in.h.opcode = FUSE_INIT; 567 req->in.h.opcode = FUSE_INIT;
568 req->in.numargs = 1; 568 req->in.numargs = 1;
569 req->in.args[0].size = sizeof(*arg); 569 req->in.args[0].size = sizeof(*arg);
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 35334539d947..f697b5c74b7c 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -38,6 +38,7 @@
38#include "nfs4_fs.h" 38#include "nfs4_fs.h"
39#include "delegation.h" 39#include "delegation.h"
40#include "iostat.h" 40#include "iostat.h"
41#include "internal.h"
41 42
42/* #define NFS_DEBUG_VERBOSE 1 */ 43/* #define NFS_DEBUG_VERBOSE 1 */
43 44
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index afcab007a22b..5e8d82f6666b 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -263,17 +263,19 @@ static const struct rpc_call_ops nfs_read_direct_ops = {
263 * handled automatically by nfs_direct_read_result(). Otherwise, if 263 * handled automatically by nfs_direct_read_result(). Otherwise, if
264 * no requests have been sent, just return an error. 264 * no requests have been sent, just return an error.
265 */ 265 */
266static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t pos) 266static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
267 const struct iovec *iov,
268 loff_t pos)
267{ 269{
268 struct nfs_open_context *ctx = dreq->ctx; 270 struct nfs_open_context *ctx = dreq->ctx;
269 struct inode *inode = ctx->path.dentry->d_inode; 271 struct inode *inode = ctx->path.dentry->d_inode;
272 unsigned long user_addr = (unsigned long)iov->iov_base;
273 size_t count = iov->iov_len;
270 size_t rsize = NFS_SERVER(inode)->rsize; 274 size_t rsize = NFS_SERVER(inode)->rsize;
271 unsigned int pgbase; 275 unsigned int pgbase;
272 int result; 276 int result;
273 ssize_t started = 0; 277 ssize_t started = 0;
274 278
275 get_dreq(dreq);
276
277 do { 279 do {
278 struct nfs_read_data *data; 280 struct nfs_read_data *data;
279 size_t bytes; 281 size_t bytes;
@@ -347,15 +349,46 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo
347 count -= bytes; 349 count -= bytes;
348 } while (count != 0); 350 } while (count != 0);
349 351
352 if (started)
353 return started;
354 return result < 0 ? (ssize_t) result : -EFAULT;
355}
356
357static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
358 const struct iovec *iov,
359 unsigned long nr_segs,
360 loff_t pos)
361{
362 ssize_t result = -EINVAL;
363 size_t requested_bytes = 0;
364 unsigned long seg;
365
366 get_dreq(dreq);
367
368 for (seg = 0; seg < nr_segs; seg++) {
369 const struct iovec *vec = &iov[seg];
370 result = nfs_direct_read_schedule_segment(dreq, vec, pos);
371 if (result < 0)
372 break;
373 requested_bytes += result;
374 if ((size_t)result < vec->iov_len)
375 break;
376 pos += vec->iov_len;
377 }
378
350 if (put_dreq(dreq)) 379 if (put_dreq(dreq))
351 nfs_direct_complete(dreq); 380 nfs_direct_complete(dreq);
352 381
353 if (started) 382 if (requested_bytes != 0)
354 return 0; 383 return 0;
355 return result < 0 ? (ssize_t) result : -EFAULT; 384
385 if (result < 0)
386 return result;
387 return -EIO;
356} 388}
357 389
358static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size_t count, loff_t pos) 390static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
391 unsigned long nr_segs, loff_t pos)
359{ 392{
360 ssize_t result = 0; 393 ssize_t result = 0;
361 sigset_t oldset; 394 sigset_t oldset;
@@ -372,9 +405,8 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size
372 if (!is_sync_kiocb(iocb)) 405 if (!is_sync_kiocb(iocb))
373 dreq->iocb = iocb; 406 dreq->iocb = iocb;
374 407
375 nfs_add_stats(inode, NFSIOS_DIRECTREADBYTES, count);
376 rpc_clnt_sigmask(clnt, &oldset); 408 rpc_clnt_sigmask(clnt, &oldset);
377 result = nfs_direct_read_schedule(dreq, user_addr, count, pos); 409 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos);
378 if (!result) 410 if (!result)
379 result = nfs_direct_wait(dreq); 411 result = nfs_direct_wait(dreq);
380 rpc_clnt_sigunmask(clnt, &oldset); 412 rpc_clnt_sigunmask(clnt, &oldset);
@@ -601,17 +633,19 @@ static const struct rpc_call_ops nfs_write_direct_ops = {
601 * handled automatically by nfs_direct_write_result(). Otherwise, if 633 * handled automatically by nfs_direct_write_result(). Otherwise, if
602 * no requests have been sent, just return an error. 634 * no requests have been sent, just return an error.
603 */ 635 */
604static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t pos, int sync) 636static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
637 const struct iovec *iov,
638 loff_t pos, int sync)
605{ 639{
606 struct nfs_open_context *ctx = dreq->ctx; 640 struct nfs_open_context *ctx = dreq->ctx;
607 struct inode *inode = ctx->path.dentry->d_inode; 641 struct inode *inode = ctx->path.dentry->d_inode;
642 unsigned long user_addr = (unsigned long)iov->iov_base;
643 size_t count = iov->iov_len;
608 size_t wsize = NFS_SERVER(inode)->wsize; 644 size_t wsize = NFS_SERVER(inode)->wsize;
609 unsigned int pgbase; 645 unsigned int pgbase;
610 int result; 646 int result;
611 ssize_t started = 0; 647 ssize_t started = 0;
612 648
613 get_dreq(dreq);
614
615 do { 649 do {
616 struct nfs_write_data *data; 650 struct nfs_write_data *data;
617 size_t bytes; 651 size_t bytes;
@@ -689,15 +723,48 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
689 count -= bytes; 723 count -= bytes;
690 } while (count != 0); 724 } while (count != 0);
691 725
726 if (started)
727 return started;
728 return result < 0 ? (ssize_t) result : -EFAULT;
729}
730
731static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
732 const struct iovec *iov,
733 unsigned long nr_segs,
734 loff_t pos, int sync)
735{
736 ssize_t result = 0;
737 size_t requested_bytes = 0;
738 unsigned long seg;
739
740 get_dreq(dreq);
741
742 for (seg = 0; seg < nr_segs; seg++) {
743 const struct iovec *vec = &iov[seg];
744 result = nfs_direct_write_schedule_segment(dreq, vec,
745 pos, sync);
746 if (result < 0)
747 break;
748 requested_bytes += result;
749 if ((size_t)result < vec->iov_len)
750 break;
751 pos += vec->iov_len;
752 }
753
692 if (put_dreq(dreq)) 754 if (put_dreq(dreq))
693 nfs_direct_write_complete(dreq, inode); 755 nfs_direct_write_complete(dreq, dreq->inode);
694 756
695 if (started) 757 if (requested_bytes != 0)
696 return 0; 758 return 0;
697 return result < 0 ? (ssize_t) result : -EFAULT; 759
760 if (result < 0)
761 return result;
762 return -EIO;
698} 763}
699 764
700static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, size_t count, loff_t pos) 765static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
766 unsigned long nr_segs, loff_t pos,
767 size_t count)
701{ 768{
702 ssize_t result = 0; 769 ssize_t result = 0;
703 sigset_t oldset; 770 sigset_t oldset;
@@ -720,10 +787,8 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
720 if (!is_sync_kiocb(iocb)) 787 if (!is_sync_kiocb(iocb))
721 dreq->iocb = iocb; 788 dreq->iocb = iocb;
722 789
723 nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, count);
724
725 rpc_clnt_sigmask(clnt, &oldset); 790 rpc_clnt_sigmask(clnt, &oldset);
726 result = nfs_direct_write_schedule(dreq, user_addr, count, pos, sync); 791 result = nfs_direct_write_schedule_iovec(dreq, iov, nr_segs, pos, sync);
727 if (!result) 792 if (!result)
728 result = nfs_direct_wait(dreq); 793 result = nfs_direct_wait(dreq);
729 rpc_clnt_sigunmask(clnt, &oldset); 794 rpc_clnt_sigunmask(clnt, &oldset);
@@ -759,21 +824,16 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
759 ssize_t retval = -EINVAL; 824 ssize_t retval = -EINVAL;
760 struct file *file = iocb->ki_filp; 825 struct file *file = iocb->ki_filp;
761 struct address_space *mapping = file->f_mapping; 826 struct address_space *mapping = file->f_mapping;
762 /* XXX: temporary */ 827 size_t count;
763 const char __user *buf = iov[0].iov_base; 828
764 size_t count = iov[0].iov_len; 829 count = iov_length(iov, nr_segs);
830 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
765 831
766 dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", 832 dprintk("nfs: direct read(%s/%s, %zd@%Ld)\n",
767 file->f_path.dentry->d_parent->d_name.name, 833 file->f_path.dentry->d_parent->d_name.name,
768 file->f_path.dentry->d_name.name, 834 file->f_path.dentry->d_name.name,
769 (unsigned long) count, (long long) pos); 835 count, (long long) pos);
770
771 if (nr_segs != 1)
772 goto out;
773 836
774 retval = -EFAULT;
775 if (!access_ok(VERIFY_WRITE, buf, count))
776 goto out;
777 retval = 0; 837 retval = 0;
778 if (!count) 838 if (!count)
779 goto out; 839 goto out;
@@ -782,7 +842,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
782 if (retval) 842 if (retval)
783 goto out; 843 goto out;
784 844
785 retval = nfs_direct_read(iocb, (unsigned long) buf, count, pos); 845 retval = nfs_direct_read(iocb, iov, nr_segs, pos);
786 if (retval > 0) 846 if (retval > 0)
787 iocb->ki_pos = pos + retval; 847 iocb->ki_pos = pos + retval;
788 848
@@ -821,21 +881,21 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
821 ssize_t retval = -EINVAL; 881 ssize_t retval = -EINVAL;
822 struct file *file = iocb->ki_filp; 882 struct file *file = iocb->ki_filp;
823 struct address_space *mapping = file->f_mapping; 883 struct address_space *mapping = file->f_mapping;
824 /* XXX: temporary */ 884 size_t count;
825 const char __user *buf = iov[0].iov_base; 885
826 size_t count = iov[0].iov_len; 886 count = iov_length(iov, nr_segs);
887 nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
827 888
828 dprintk("nfs: direct write(%s/%s, %lu@%Ld)\n", 889 dfprintk(VFS, "nfs: direct write(%s/%s, %zd@%Ld)\n",
829 file->f_path.dentry->d_parent->d_name.name, 890 file->f_path.dentry->d_parent->d_name.name,
830 file->f_path.dentry->d_name.name, 891 file->f_path.dentry->d_name.name,
831 (unsigned long) count, (long long) pos); 892 count, (long long) pos);
832
833 if (nr_segs != 1)
834 goto out;
835 893
836 retval = generic_write_checks(file, &pos, &count, 0); 894 retval = generic_write_checks(file, &pos, &count, 0);
837 if (retval) 895 if (retval)
838 goto out; 896 goto out;
897 if (!count)
898 goto out; /* return 0 */
839 899
840 retval = -EINVAL; 900 retval = -EINVAL;
841 if ((ssize_t) count < 0) 901 if ((ssize_t) count < 0)
@@ -844,15 +904,11 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
844 if (!count) 904 if (!count)
845 goto out; 905 goto out;
846 906
847 retval = -EFAULT;
848 if (!access_ok(VERIFY_READ, buf, count))
849 goto out;
850
851 retval = nfs_sync_mapping(mapping); 907 retval = nfs_sync_mapping(mapping);
852 if (retval) 908 if (retval)
853 goto out; 909 goto out;
854 910
855 retval = nfs_direct_write(iocb, (unsigned long) buf, count, pos); 911 retval = nfs_direct_write(iocb, iov, nr_segs, pos, count);
856 912
857 if (retval > 0) 913 if (retval > 0)
858 iocb->ki_pos = pos + retval; 914 iocb->ki_pos = pos + retval;
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 522e5ad4d8ad..0ee43843f4ec 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -43,6 +43,25 @@
43#define NFSDBG_FACILITY NFSDBG_CLIENT 43#define NFSDBG_FACILITY NFSDBG_CLIENT
44 44
45/* 45/*
46 * Set the superblock root dentry.
47 * Note that this function frees the inode in case of error.
48 */
49static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *inode)
50{
51 /* The mntroot acts as the dummy root dentry for this superblock */
52 if (sb->s_root == NULL) {
53 sb->s_root = d_alloc_root(inode);
54 if (sb->s_root == NULL) {
55 iput(inode);
56 return -ENOMEM;
57 }
58 /* Circumvent igrab(): we know the inode is not being freed */
59 atomic_inc(&inode->i_count);
60 }
61 return 0;
62}
63
64/*
46 * get an NFS2/NFS3 root dentry from the root filehandle 65 * get an NFS2/NFS3 root dentry from the root filehandle
47 */ 66 */
48struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh) 67struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
@@ -54,33 +73,6 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
54 struct inode *inode; 73 struct inode *inode;
55 int error; 74 int error;
56 75
57 /* create a dummy root dentry with dummy inode for this superblock */
58 if (!sb->s_root) {
59 struct nfs_fh dummyfh;
60 struct dentry *root;
61 struct inode *iroot;
62
63 memset(&dummyfh, 0, sizeof(dummyfh));
64 memset(&fattr, 0, sizeof(fattr));
65 nfs_fattr_init(&fattr);
66 fattr.valid = NFS_ATTR_FATTR;
67 fattr.type = NFDIR;
68 fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
69 fattr.nlink = 2;
70
71 iroot = nfs_fhget(sb, &dummyfh, &fattr);
72 if (IS_ERR(iroot))
73 return ERR_PTR(PTR_ERR(iroot));
74
75 root = d_alloc_root(iroot);
76 if (!root) {
77 iput(iroot);
78 return ERR_PTR(-ENOMEM);
79 }
80
81 sb->s_root = root;
82 }
83
84 /* get the actual root for this mount */ 76 /* get the actual root for this mount */
85 fsinfo.fattr = &fattr; 77 fsinfo.fattr = &fattr;
86 78
@@ -96,6 +88,10 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
96 return ERR_PTR(PTR_ERR(inode)); 88 return ERR_PTR(PTR_ERR(inode));
97 } 89 }
98 90
91 error = nfs_superblock_set_dummy_root(sb, inode);
92 if (error != 0)
93 return ERR_PTR(error);
94
99 /* root dentries normally start off anonymous and get spliced in later 95 /* root dentries normally start off anonymous and get spliced in later
100 * if the dentry tree reaches them; however if the dentry already 96 * if the dentry tree reaches them; however if the dentry already
101 * exists, we'll pick it up at this point and use it as the root 97 * exists, we'll pick it up at this point and use it as the root
@@ -241,33 +237,6 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
241 237
242 dprintk("--> nfs4_get_root()\n"); 238 dprintk("--> nfs4_get_root()\n");
243 239
244 /* create a dummy root dentry with dummy inode for this superblock */
245 if (!sb->s_root) {
246 struct nfs_fh dummyfh;
247 struct dentry *root;
248 struct inode *iroot;
249
250 memset(&dummyfh, 0, sizeof(dummyfh));
251 memset(&fattr, 0, sizeof(fattr));
252 nfs_fattr_init(&fattr);
253 fattr.valid = NFS_ATTR_FATTR;
254 fattr.type = NFDIR;
255 fattr.mode = S_IFDIR | S_IRUSR | S_IWUSR;
256 fattr.nlink = 2;
257
258 iroot = nfs_fhget(sb, &dummyfh, &fattr);
259 if (IS_ERR(iroot))
260 return ERR_PTR(PTR_ERR(iroot));
261
262 root = d_alloc_root(iroot);
263 if (!root) {
264 iput(iroot);
265 return ERR_PTR(-ENOMEM);
266 }
267
268 sb->s_root = root;
269 }
270
271 /* get the info about the server and filesystem */ 240 /* get the info about the server and filesystem */
272 error = nfs4_server_capabilities(server, mntfh); 241 error = nfs4_server_capabilities(server, mntfh);
273 if (error < 0) { 242 if (error < 0) {
@@ -289,6 +258,10 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
289 return ERR_PTR(PTR_ERR(inode)); 258 return ERR_PTR(PTR_ERR(inode));
290 } 259 }
291 260
261 error = nfs_superblock_set_dummy_root(sb, inode);
262 if (error != 0)
263 return ERR_PTR(error);
264
292 /* root dentries normally start off anonymous and get spliced in later 265 /* root dentries normally start off anonymous and get spliced in later
293 * if the dentry tree reaches them; however if the dentry already 266 * if the dentry tree reaches them; however if the dentry already
294 * exists, we'll pick it up at this point and use it as the root 267 * exists, we'll pick it up at this point and use it as the root
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fa517ae9207f..2426e713b77f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1054,10 +1054,11 @@ static int nfs_validate_mount_data(void *options,
1054{ 1054{
1055 struct nfs_mount_data *data = (struct nfs_mount_data *)options; 1055 struct nfs_mount_data *data = (struct nfs_mount_data *)options;
1056 1056
1057 memset(args, 0, sizeof(*args));
1058
1057 if (data == NULL) 1059 if (data == NULL)
1058 goto out_no_data; 1060 goto out_no_data;
1059 1061
1060 memset(args, 0, sizeof(*args));
1061 args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); 1062 args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP);
1062 args->rsize = NFS_MAX_FILE_IO_SIZE; 1063 args->rsize = NFS_MAX_FILE_IO_SIZE;
1063 args->wsize = NFS_MAX_FILE_IO_SIZE; 1064 args->wsize = NFS_MAX_FILE_IO_SIZE;
@@ -1474,6 +1475,11 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1474 error = PTR_ERR(mntroot); 1475 error = PTR_ERR(mntroot);
1475 goto error_splat_super; 1476 goto error_splat_super;
1476 } 1477 }
1478 if (mntroot->d_inode->i_op != &nfs_dir_inode_operations) {
1479 dput(mntroot);
1480 error = -ESTALE;
1481 goto error_splat_super;
1482 }
1477 1483
1478 s->s_flags |= MS_ACTIVE; 1484 s->s_flags |= MS_ACTIVE;
1479 mnt->mnt_sb = s; 1485 mnt->mnt_sb = s;
@@ -1531,10 +1537,11 @@ static int nfs4_validate_mount_data(void *options,
1531 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; 1537 struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
1532 char *c; 1538 char *c;
1533 1539
1540 memset(args, 0, sizeof(*args));
1541
1534 if (data == NULL) 1542 if (data == NULL)
1535 goto out_no_data; 1543 goto out_no_data;
1536 1544
1537 memset(args, 0, sizeof(*args));
1538 args->rsize = NFS_MAX_FILE_IO_SIZE; 1545 args->rsize = NFS_MAX_FILE_IO_SIZE;
1539 args->wsize = NFS_MAX_FILE_IO_SIZE; 1546 args->wsize = NFS_MAX_FILE_IO_SIZE;
1540 args->timeo = 600; 1547 args->timeo = 600;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 89527a487ed7..51cc1bd6a116 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1436,7 +1436,8 @@ out:
1436 return ret; 1436 return ret;
1437} 1437}
1438 1438
1439int nfs_wb_page_priority(struct inode *inode, struct page *page, int how) 1439static int nfs_wb_page_priority(struct inode *inode, struct page *page,
1440 int how)
1440{ 1441{
1441 loff_t range_start = page_offset(page); 1442 loff_t range_start = page_offset(page);
1442 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1); 1443 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 556e34ccb005..56f7790cad46 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1514,7 +1514,7 @@ int ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size)
1514{ 1514{
1515 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 1515 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
1516 1516
1517 if (new_size < le16_to_cpu(di->id2.i_data.id_count)) 1517 if (new_size <= le16_to_cpu(di->id2.i_data.id_count))
1518 return 1; 1518 return 1;
1519 return 0; 1519 return 0;
1520} 1520}
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index cd046060114e..597e064bb94f 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -212,7 +212,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
212#define mlog_errno(st) do { \ 212#define mlog_errno(st) do { \
213 int _st = (st); \ 213 int _st = (st); \
214 if (_st != -ERESTARTSYS && _st != -EINTR && \ 214 if (_st != -ERESTARTSYS && _st != -EINTR && \
215 _st != AOP_TRUNCATED_PAGE) \ 215 _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC) \
216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
217} while (0) 217} while (0)
218 218
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 1957a5ed219e..9923278ea6d4 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -344,12 +344,24 @@ static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
344{ 344{
345 struct ocfs2_dentry_lock *dl = dentry->d_fsdata; 345 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
346 346
347 mlog_bug_on_msg(!dl && !(dentry->d_flags & DCACHE_DISCONNECTED), 347 if (!dl) {
348 "dentry: %.*s\n", dentry->d_name.len, 348 /*
349 dentry->d_name.name); 349 * No dentry lock is ok if we're disconnected or
350 * unhashed.
351 */
352 if (!(dentry->d_flags & DCACHE_DISCONNECTED) &&
353 !d_unhashed(dentry)) {
354 unsigned long long ino = 0ULL;
355 if (inode)
356 ino = (unsigned long long)OCFS2_I(inode)->ip_blkno;
357 mlog(ML_ERROR, "Dentry is missing cluster lock. "
358 "inode: %llu, d_flags: 0x%x, d_name: %.*s\n",
359 ino, dentry->d_flags, dentry->d_name.len,
360 dentry->d_name.name);
361 }
350 362
351 if (!dl)
352 goto out; 363 goto out;
364 }
353 365
354 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %.*s, count: %u\n", 366 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %.*s, count: %u\n",
355 dentry->d_name.len, dentry->d_name.name, 367 dentry->d_name.len, dentry->d_name.name,
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 62e4a7daa286..a54d33d95ada 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -908,7 +908,7 @@ lookup:
908 * but they might own this lockres. wait on them. */ 908 * but they might own this lockres. wait on them. */
909 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); 909 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0);
910 if (bit < O2NM_MAX_NODES) { 910 if (bit < O2NM_MAX_NODES) {
911 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to" 911 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to "
912 "recover before lock mastery can begin\n", 912 "recover before lock mastery can begin\n",
913 dlm->name, namelen, (char *)lockid, bit); 913 dlm->name, namelen, (char *)lockid, bit);
914 wait_on_recovery = 1; 914 wait_on_recovery = 1;
@@ -962,7 +962,7 @@ redo_request:
962 spin_lock(&dlm->spinlock); 962 spin_lock(&dlm->spinlock);
963 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); 963 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0);
964 if (bit < O2NM_MAX_NODES) { 964 if (bit < O2NM_MAX_NODES) {
965 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to" 965 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to "
966 "recover before lock mastery can begin\n", 966 "recover before lock mastery can begin\n",
967 dlm->name, namelen, (char *)lockid, bit); 967 dlm->name, namelen, (char *)lockid, bit);
968 wait_on_recovery = 1; 968 wait_on_recovery = 1;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index bbac7cd33e0b..b75b2e1f0e42 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -399,7 +399,7 @@ static int ocfs2_truncate_file(struct inode *inode,
399 399
400 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 400 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
401 status = ocfs2_truncate_inline(inode, di_bh, new_i_size, 401 status = ocfs2_truncate_inline(inode, di_bh, new_i_size,
402 i_size_read(inode), 0); 402 i_size_read(inode), 1);
403 if (status) 403 if (status)
404 mlog_errno(status); 404 mlog_errno(status);
405 405
@@ -1521,6 +1521,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,
1521 u32 trunc_start, trunc_len, cpos, phys_cpos, alloc_size; 1521 u32 trunc_start, trunc_len, cpos, phys_cpos, alloc_size;
1522 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1522 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1523 struct ocfs2_cached_dealloc_ctxt dealloc; 1523 struct ocfs2_cached_dealloc_ctxt dealloc;
1524 struct address_space *mapping = inode->i_mapping;
1524 1525
1525 ocfs2_init_dealloc_ctxt(&dealloc); 1526 ocfs2_init_dealloc_ctxt(&dealloc);
1526 1527
@@ -1529,10 +1530,20 @@ static int ocfs2_remove_inode_range(struct inode *inode,
1529 1530
1530 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 1531 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
1531 ret = ocfs2_truncate_inline(inode, di_bh, byte_start, 1532 ret = ocfs2_truncate_inline(inode, di_bh, byte_start,
1532 byte_start + byte_len, 1); 1533 byte_start + byte_len, 0);
1533 if (ret) 1534 if (ret) {
1534 mlog_errno(ret); 1535 mlog_errno(ret);
1535 return ret; 1536 goto out;
1537 }
1538 /*
1539 * There's no need to get fancy with the page cache
1540 * truncate of an inline-data inode. We're talking
1541 * about less than a page here, which will be cached
1542 * in the dinode buffer anyway.
1543 */
1544 unmap_mapping_range(mapping, 0, 0, 0);
1545 truncate_inode_pages(mapping, 0);
1546 goto out;
1536 } 1547 }
1537 1548
1538 trunc_start = ocfs2_clusters_for_bytes(osb->sb, byte_start); 1549 trunc_start = ocfs2_clusters_for_bytes(osb->sb, byte_start);
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 1d5e0cb0fda1..ebb2bbe30f35 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -455,8 +455,8 @@ static int ocfs2_read_locked_inode(struct inode *inode,
455 status = -EINVAL; 455 status = -EINVAL;
456 fe = (struct ocfs2_dinode *) bh->b_data; 456 fe = (struct ocfs2_dinode *) bh->b_data;
457 if (!OCFS2_IS_VALID_DINODE(fe)) { 457 if (!OCFS2_IS_VALID_DINODE(fe)) {
458 mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n", 458 mlog(0, "Invalid dinode #%llu: signature = %.*s\n",
459 (unsigned long long)le64_to_cpu(fe->i_blkno), 7, 459 (unsigned long long)args->fi_blkno, 7,
460 fe->i_signature); 460 fe->i_signature);
461 goto bail; 461 goto bail;
462 } 462 }
@@ -863,7 +863,7 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
863 status = ocfs2_try_open_lock(inode, 1); 863 status = ocfs2_try_open_lock(inode, 1);
864 if (status == -EAGAIN) { 864 if (status == -EAGAIN) {
865 status = 0; 865 status = 0;
866 mlog(0, "Skipping delete of %llu because it is in use on" 866 mlog(0, "Skipping delete of %llu because it is in use on "
867 "other nodes\n", (unsigned long long)oi->ip_blkno); 867 "other nodes\n", (unsigned long long)oi->ip_blkno);
868 goto bail; 868 goto bail;
869 } 869 }
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index d272847d5a07..58ea88b5af36 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -484,6 +484,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
484 484
485 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; 485 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
486 486
487#ifdef OCFS2_DEBUG_FS
487 if (le32_to_cpu(alloc->id1.bitmap1.i_used) != 488 if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
488 ocfs2_local_alloc_count_bits(alloc)) { 489 ocfs2_local_alloc_count_bits(alloc)) {
489 ocfs2_error(osb->sb, "local alloc inode %llu says it has " 490 ocfs2_error(osb->sb, "local alloc inode %llu says it has "
@@ -494,6 +495,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
494 status = -EIO; 495 status = -EIO;
495 goto bail; 496 goto bail;
496 } 497 }
498#endif
497 499
498 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) - 500 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
499 le32_to_cpu(alloc->id1.bitmap1.i_used); 501 le32_to_cpu(alloc->id1.bitmap1.i_used);
@@ -712,9 +714,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
712 void *bitmap; 714 void *bitmap;
713 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); 715 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
714 716
715 mlog_entry("total = %u, COUNT = %u, used = %u\n", 717 mlog_entry("total = %u, used = %u\n",
716 le32_to_cpu(alloc->id1.bitmap1.i_total), 718 le32_to_cpu(alloc->id1.bitmap1.i_total),
717 ocfs2_local_alloc_count_bits(alloc),
718 le32_to_cpu(alloc->id1.bitmap1.i_used)); 719 le32_to_cpu(alloc->id1.bitmap1.i_used));
719 720
720 if (!alloc->id1.bitmap1.i_total) { 721 if (!alloc->id1.bitmap1.i_total) {
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index be562ac3e89c..5ee775420665 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -438,14 +438,14 @@ unlock_osb:
438 } 438 }
439 439
440 if (!ret) { 440 if (!ret) {
441 if (!ocfs2_is_hard_readonly(osb))
442 ocfs2_set_journal_params(osb);
443
444 /* Only save off the new mount options in case of a successful 441 /* Only save off the new mount options in case of a successful
445 * remount. */ 442 * remount. */
446 osb->s_mount_opt = parsed_options.mount_opt; 443 osb->s_mount_opt = parsed_options.mount_opt;
447 osb->s_atime_quantum = parsed_options.atime_quantum; 444 osb->s_atime_quantum = parsed_options.atime_quantum;
448 osb->preferred_slot = parsed_options.slot; 445 osb->preferred_slot = parsed_options.slot;
446
447 if (!ocfs2_is_hard_readonly(osb))
448 ocfs2_set_journal_params(osb);
449 } 449 }
450out: 450out:
451 return ret; 451 return ret;
diff --git a/fs/proc/array.c b/fs/proc/array.c
index eba339ecba27..65c62e1bfd6f 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -374,7 +374,9 @@ static cputime_t task_stime(struct task_struct *p)
374 stime = nsec_to_clock_t(p->se.sum_exec_runtime) - 374 stime = nsec_to_clock_t(p->se.sum_exec_runtime) -
375 cputime_to_clock_t(task_utime(p)); 375 cputime_to_clock_t(task_utime(p));
376 376
377 p->prev_stime = max(p->prev_stime, clock_t_to_cputime(stime)); 377 if (stime >= 0)
378 p->prev_stime = max(p->prev_stime, clock_t_to_cputime(stime));
379
378 return p->prev_stime; 380 return p->prev_stime;
379} 381}
380#endif 382#endif
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a17c26859074..02a63ac04178 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2411,19 +2411,23 @@ out:
2411 * Find the first task with tgid >= tgid 2411 * Find the first task with tgid >= tgid
2412 * 2412 *
2413 */ 2413 */
2414static struct task_struct *next_tgid(unsigned int tgid, 2414struct tgid_iter {
2415 struct pid_namespace *ns) 2415 unsigned int tgid;
2416{
2417 struct task_struct *task; 2416 struct task_struct *task;
2417};
2418static struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter iter)
2419{
2418 struct pid *pid; 2420 struct pid *pid;
2419 2421
2422 if (iter.task)
2423 put_task_struct(iter.task);
2420 rcu_read_lock(); 2424 rcu_read_lock();
2421retry: 2425retry:
2422 task = NULL; 2426 iter.task = NULL;
2423 pid = find_ge_pid(tgid, ns); 2427 pid = find_ge_pid(iter.tgid, ns);
2424 if (pid) { 2428 if (pid) {
2425 tgid = pid_nr_ns(pid, ns) + 1; 2429 iter.tgid = pid_nr_ns(pid, ns);
2426 task = pid_task(pid, PIDTYPE_PID); 2430 iter.task = pid_task(pid, PIDTYPE_PID);
2427 /* What we to know is if the pid we have find is the 2431 /* What we to know is if the pid we have find is the
2428 * pid of a thread_group_leader. Testing for task 2432 * pid of a thread_group_leader. Testing for task
2429 * being a thread_group_leader is the obvious thing 2433 * being a thread_group_leader is the obvious thing
@@ -2436,23 +2440,25 @@ retry:
2436 * found doesn't happen to be a thread group leader. 2440 * found doesn't happen to be a thread group leader.
2437 * As we don't care in the case of readdir. 2441 * As we don't care in the case of readdir.
2438 */ 2442 */
2439 if (!task || !has_group_leader_pid(task)) 2443 if (!iter.task || !has_group_leader_pid(iter.task)) {
2444 iter.tgid += 1;
2440 goto retry; 2445 goto retry;
2441 get_task_struct(task); 2446 }
2447 get_task_struct(iter.task);
2442 } 2448 }
2443 rcu_read_unlock(); 2449 rcu_read_unlock();
2444 return task; 2450 return iter;
2445} 2451}
2446 2452
2447#define TGID_OFFSET (FIRST_PROCESS_ENTRY + ARRAY_SIZE(proc_base_stuff)) 2453#define TGID_OFFSET (FIRST_PROCESS_ENTRY + ARRAY_SIZE(proc_base_stuff))
2448 2454
2449static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir, 2455static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
2450 struct task_struct *task, int tgid) 2456 struct tgid_iter iter)
2451{ 2457{
2452 char name[PROC_NUMBUF]; 2458 char name[PROC_NUMBUF];
2453 int len = snprintf(name, sizeof(name), "%d", tgid); 2459 int len = snprintf(name, sizeof(name), "%d", iter.tgid);
2454 return proc_fill_cache(filp, dirent, filldir, name, len, 2460 return proc_fill_cache(filp, dirent, filldir, name, len,
2455 proc_pid_instantiate, task, NULL); 2461 proc_pid_instantiate, iter.task, NULL);
2456} 2462}
2457 2463
2458/* for the /proc/ directory itself, after non-process stuff has been done */ 2464/* for the /proc/ directory itself, after non-process stuff has been done */
@@ -2460,8 +2466,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2460{ 2466{
2461 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY; 2467 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
2462 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode); 2468 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
2463 struct task_struct *task; 2469 struct tgid_iter iter;
2464 int tgid;
2465 struct pid_namespace *ns; 2470 struct pid_namespace *ns;
2466 2471
2467 if (!reaper) 2472 if (!reaper)
@@ -2474,14 +2479,14 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2474 } 2479 }
2475 2480
2476 ns = filp->f_dentry->d_sb->s_fs_info; 2481 ns = filp->f_dentry->d_sb->s_fs_info;
2477 tgid = filp->f_pos - TGID_OFFSET; 2482 iter.task = NULL;
2478 for (task = next_tgid(tgid, ns); 2483 iter.tgid = filp->f_pos - TGID_OFFSET;
2479 task; 2484 for (iter = next_tgid(ns, iter);
2480 put_task_struct(task), task = next_tgid(tgid + 1, ns)) { 2485 iter.task;
2481 tgid = task_pid_nr_ns(task, ns); 2486 iter.tgid += 1, iter = next_tgid(ns, iter)) {
2482 filp->f_pos = tgid + TGID_OFFSET; 2487 filp->f_pos = iter.tgid + TGID_OFFSET;
2483 if (proc_pid_fill_cache(filp, dirent, filldir, task, tgid) < 0) { 2488 if (proc_pid_fill_cache(filp, dirent, filldir, iter) < 0) {
2484 put_task_struct(task); 2489 put_task_struct(iter.task);
2485 goto out; 2490 goto out;
2486 } 2491 }
2487 } 2492 }
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index a9806bc21ec3..39f3d6519035 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -555,41 +555,6 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
555 return 0; 555 return 0;
556} 556}
557 557
558/*
559 * Kill an inode that got unregistered..
560 */
561static void proc_kill_inodes(struct proc_dir_entry *de)
562{
563 struct list_head *p;
564 struct super_block *sb;
565
566 /*
567 * Actually it's a partial revoke().
568 */
569 spin_lock(&sb_lock);
570 list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) {
571 file_list_lock();
572 list_for_each(p, &sb->s_files) {
573 struct file *filp = list_entry(p, struct file,
574 f_u.fu_list);
575 struct dentry *dentry = filp->f_path.dentry;
576 struct inode *inode;
577 const struct file_operations *fops;
578
579 if (dentry->d_op != &proc_dentry_operations)
580 continue;
581 inode = dentry->d_inode;
582 if (PDE(inode) != de)
583 continue;
584 fops = filp->f_op;
585 filp->f_op = NULL;
586 fops_put(fops);
587 }
588 file_list_unlock();
589 }
590 spin_unlock(&sb_lock);
591}
592
593static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, 558static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
594 const char *name, 559 const char *name,
595 mode_t mode, 560 mode_t mode,
@@ -764,8 +729,6 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
764continue_removing: 729continue_removing:
765 if (S_ISDIR(de->mode)) 730 if (S_ISDIR(de->mode))
766 parent->nlink--; 731 parent->nlink--;
767 if (!S_ISREG(de->mode))
768 proc_kill_inodes(de);
769 de->nlink = 0; 732 de->nlink = 0;
770 WARN_ON(de->subdir); 733 WARN_ON(de->subdir);
771 if (!atomic_read(&de->count)) 734 if (!atomic_read(&de->count))
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 1b2b6c6bb475..1820eb2ef762 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -78,5 +78,3 @@ static inline int proc_fd(struct inode *inode)
78{ 78{
79 return PROC_I(inode)->fd; 79 return PROC_I(inode)->fd;
80} 80}
81
82extern struct file_system_type proc_fs_type;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 1f86bb860e04..ec9cb3b6c93b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb)
98 put_pid_ns(ns); 98 put_pid_ns(ns);
99} 99}
100 100
101struct file_system_type proc_fs_type = { 101static struct file_system_type proc_fs_type = {
102 .name = "proc", 102 .name = "proc",
103 .get_sb = proc_get_sb, 103 .get_sb = proc_get_sb,
104 .kill_sb = proc_kill_sb, 104 .kill_sb = proc_kill_sb,
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 27d1785b7644..4045bdcc4b33 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -119,7 +119,11 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
119 119
120 sysfs_put_active_two(attr_sd); 120 sysfs_put_active_two(attr_sd);
121 121
122 BUG_ON(count > (ssize_t)PAGE_SIZE); 122 /*
123 * The code works fine with PAGE_SIZE return but it's likely to
124 * indicate truncated result or overflow in normal use cases.
125 */
126 BUG_ON(count >= (ssize_t)PAGE_SIZE);
123 if (count >= 0) { 127 if (count >= 0) {
124 buffer->needs_read_fill = 0; 128 buffer->needs_read_fill = 0;
125 buffer->count = count; 129 buffer->count = count;
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 26d79f6db8a0..76411b1fc4fd 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -78,7 +78,6 @@ struct acpi_processor_cx {
78struct acpi_processor_power { 78struct acpi_processor_power {
79 struct cpuidle_device dev; 79 struct cpuidle_device dev;
80 struct acpi_processor_cx *state; 80 struct acpi_processor_cx *state;
81 struct acpi_processor_cx *bm_state;
82 unsigned long bm_check_timestamp; 81 unsigned long bm_check_timestamp;
83 u32 default_state; 82 u32 default_state;
84 u32 bm_activity; 83 u32 bm_activity;
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index c0d7075982c1..79054965baa6 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -33,6 +33,7 @@
33 33
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/i2c.h>
36#include <linux/spi/spi.h> 37#include <linux/spi/spi.h>
37 38
38 /* USB Device */ 39 /* USB Device */
@@ -94,7 +95,7 @@ struct at91_nand_data {
94extern void __init at91_add_device_nand(struct at91_nand_data *data); 95extern void __init at91_add_device_nand(struct at91_nand_data *data);
95 96
96 /* I2C*/ 97 /* I2C*/
97extern void __init at91_add_device_i2c(void); 98extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
98 99
99 /* SPI */ 100 /* SPI */
100extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices); 101extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
diff --git a/include/asm-arm/arch-ixp23xx/irqs.h b/include/asm-arm/arch-ixp23xx/irqs.h
index e69639585721..27c580898958 100644
--- a/include/asm-arm/arch-ixp23xx/irqs.h
+++ b/include/asm-arm/arch-ixp23xx/irqs.h
@@ -153,7 +153,7 @@
153 */ 153 */
154#define NR_IXP23XX_MACH_IRQS 32 154#define NR_IXP23XX_MACH_IRQS 32
155 155
156#define NR_IRQS NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS 156#define NR_IRQS (NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS)
157 157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq)) 158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159 159
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
index b3cf33441f6e..56d2c98e143c 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -37,7 +37,7 @@
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00 37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38 38
39#define NR_FPGA_IRQS 24 39#define NR_FPGA_IRQS 24
40#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS 40#define NR_IRQS (IH_BOARD_BASE + NR_FPGA_IRQS)
41 41
42#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
43void fpga_write(unsigned char val, int reg); 43void fpga_write(unsigned char val, int reg);
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index 6238dbf7a236..b76ee6d1f5b4 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -13,7 +13,7 @@
13 13
14#define PXA_IRQ(x) (x) 14#define PXA_IRQ(x) (x)
15 15
16#ifdef CONFIG_PXA27x 16#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */ 17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */
18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */ 18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */
19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */ 19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */
@@ -52,11 +52,27 @@
52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */ 52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */
53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */ 53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */
54 54
55#ifdef CONFIG_PXA27x 55#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */ 56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */
57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */ 57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */
58#endif 58#endif
59 59
60#ifdef CONFIG_PXA3xx
61#define IRQ_SSP4 PXA_IRQ(13) /* SSP4 service request */
62#define IRQ_CIR PXA_IRQ(34) /* Consumer IR */
63#define IRQ_TSI PXA_IRQ(36) /* Touch Screen Interface (PXA320) */
64#define IRQ_USIM2 PXA_IRQ(38) /* USIM2 Controller */
65#define IRQ_GRPHICS PXA_IRQ(39) /* Graphics Controller */
66#define IRQ_MMC2 PXA_IRQ(41) /* MMC2 Controller */
67#define IRQ_1WIRE PXA_IRQ(44) /* 1-Wire Controller */
68#define IRQ_NAND PXA_IRQ(45) /* NAND Controller */
69#define IRQ_USB2 PXA_IRQ(46) /* USB 2.0 Device Controller */
70#define IRQ_WAKEUP0 PXA_IRQ(49) /* EXT_WAKEUP0 */
71#define IRQ_WAKEUP1 PXA_IRQ(50) /* EXT_WAKEUP1 */
72#define IRQ_DMEMC PXA_IRQ(51) /* Dynamic Memory Controller */
73#define IRQ_MMC3 PXA_IRQ(55) /* MMC3 Controller (PXA310) */
74#endif
75
60#define PXA_GPIO_IRQ_BASE (64) 76#define PXA_GPIO_IRQ_BASE (64)
61#define PXA_GPIO_IRQ_NUM (128) 77#define PXA_GPIO_IRQ_NUM (128)
62 78
diff --git a/include/asm-arm/arch-pxa/mfp-pxa300.h b/include/asm-arm/arch-pxa/mfp-pxa300.h
index 822a27cd7864..a20996649889 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa300.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa300.h
@@ -179,7 +179,7 @@
179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X) 179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X)
180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X) 180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X)
181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X) 181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X)
182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS01X) 182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS02X)
183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X) 183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X)
184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X) 184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X)
185 185
diff --git a/include/asm-arm/arch-pxa/mfp-pxa320.h b/include/asm-arm/arch-pxa/mfp-pxa320.h
index 488a5bbc49e9..52deedcaf3bd 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa320.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa320.h
@@ -18,7 +18,7 @@
18#include <asm/arch/mfp.h> 18#include <asm/arch/mfp.h>
19 19
20/* GPIO */ 20/* GPIO */
21#define GPIO46_GPIO MFP_CFG(GPIO6, AF0) 21#define GPIO46_GPIO MFP_CFG(GPIO46, AF0)
22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0) 22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0)
23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0) 23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0)
24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0) 24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0)
diff --git a/include/asm-arm/arch-pxa/mfp.h b/include/asm-arm/arch-pxa/mfp.h
index ac4157af5a8e..03c508d94f0e 100644
--- a/include/asm-arm/arch-pxa/mfp.h
+++ b/include/asm-arm/arch-pxa/mfp.h
@@ -346,23 +346,31 @@ typedef uint32_t mfp_cfg_t;
346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff) 346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff)
347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff) 347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff)
348 348
349#define MFPR_DEFAULT (0x0000) 349/*
350 * MFP register defaults to
351 * drive strength fast 3mA (010'b)
352 * edge detection logic disabled
353 * alternate function 0
354 */
355#define MFPR_DEFAULT (0x0840)
350 356
351#define MFP_CFG(pin, af) \ 357#define MFP_CFG(pin, af) \
352 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af)) 358 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af))
353 359
354#define MFP_CFG_DRV(pin, af, drv) \ 360#define MFP_CFG_DRV(pin, af, drv) \
355 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 361 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_DRV_MASK) |\
356 ((MFP_##drv) << 10) | (MFP_##af)) 362 ((MFP_##drv) << 10) | (MFP_##af))
357 363
358#define MFP_CFG_LPM(pin, af, lpm) \ 364#define MFP_CFG_LPM(pin, af, lpm) \
359 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af) |\ 365 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_LPM_MASK) |\
360 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 366 (((MFP_LPM_##lpm) & 0x3) << 7) |\
361 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 367 (((MFP_LPM_##lpm) & 0x4) << 12) |\
362 (((MFP_LPM_##lpm) & 0x8) << 10)) 368 (((MFP_LPM_##lpm) & 0x8) << 10) |\
369 (MFP_##af))
363 370
364#define MFP_CFG_X(pin, af, drv, lpm) \ 371#define MFP_CFG_X(pin, af, drv, lpm) \
365 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 372 ((MFP_PIN_##pin << 16) |\
373 (MFPR_DEFAULT & ~(MFPR_DRV_MASK | MFPR_LPM_MASK)) |\
366 ((MFP_##drv) << 10) | (MFP_##af) |\ 374 ((MFP_##drv) << 10) | (MFP_##af) |\
367 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 375 (((MFP_LPM_##lpm) & 0x3) << 7) |\
368 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 376 (((MFP_LPM_##lpm) & 0x4) << 12) |\
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index bb68b598c436..6b33df6f1995 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -110,7 +110,10 @@
110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ 110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ 111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
112 112
113#define DRCMR(n) __REG2(0x40000100, (n)<<2) 113#define DRCMR(n) (*(((n) < 64) ? \
114 &__REG2(0x40000100, ((n) & 0x3f) << 2) : \
115 &__REG2(0x40001100, ((n) & 0x3f) << 2)))
116
114#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */ 117#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */
115#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */ 118#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */
116#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */ 119#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h
index c1e4db7c9710..ba1dca88d480 100644
--- a/include/asm-arm/arch-s3c2410/spi-gpio.h
+++ b/include/asm-arm/arch-s3c2410/spi-gpio.h
@@ -21,6 +21,8 @@ struct s3c2410_spigpio_info {
21 unsigned long pin_mosi; 21 unsigned long pin_mosi;
22 unsigned long pin_miso; 22 unsigned long pin_miso;
23 23
24 int bus_num;
25
24 unsigned long board_size; 26 unsigned long board_size;
25 struct spi_board_info *board_info; 27 struct spi_board_info *board_info;
26 28
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 0212e180b90e..39bdd86871cf 100644
--- a/include/asm-blackfin/bfin-global.h
+++ b/include/asm-blackfin/bfin-global.h
@@ -50,8 +50,8 @@ extern unsigned long get_sclk(void);
50extern unsigned long sclk_to_usecs(unsigned long sclk); 50extern unsigned long sclk_to_usecs(unsigned long sclk);
51extern unsigned long usecs_to_sclk(unsigned long usecs); 51extern unsigned long usecs_to_sclk(unsigned long usecs);
52 52
53extern void dump_thread(struct pt_regs *regs, struct user *dump); 53extern void dump_bfin_process(struct pt_regs *regs);
54extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr); 54extern void dump_bfin_mem(void *retaddr);
55extern void dump_bfin_trace_buffer(void); 55extern void dump_bfin_trace_buffer(void);
56 56
57extern int init_arch_irq(void); 57extern int init_arch_irq(void);
@@ -63,6 +63,7 @@ extern void bfin_dcache_init(void);
63extern int read_iloc(void); 63extern int read_iloc(void);
64extern int bfin_console_init(void); 64extern int bfin_console_init(void);
65extern asmlinkage void lower_to_irq14(void); 65extern asmlinkage void lower_to_irq14(void);
66extern asmlinkage void bfin_return_from_exception(void);
66extern void init_exception_vectors(void); 67extern void init_exception_vectors(void);
67extern void init_dma(void); 68extern void init_dma(void);
68extern void program_IAR(void); 69extern void program_IAR(void);
diff --git a/include/asm-blackfin/cplbinit.h b/include/asm-blackfin/cplbinit.h
index bec6ecdf1bdb..c4d0596e8e9f 100644
--- a/include/asm-blackfin/cplbinit.h
+++ b/include/asm-blackfin/cplbinit.h
@@ -27,6 +27,9 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30#ifndef __ASM_CPLBINIT_H__
31#define __ASM_CPLBINIT_H__
32
30#include <asm/blackfin.h> 33#include <asm/blackfin.h>
31#include <asm/cplb.h> 34#include <asm/cplb.h>
32 35
@@ -57,8 +60,8 @@ struct cplb_tab {
57 u16 size; 60 u16 size;
58}; 61};
59 62
60extern u_long icplb_table[MAX_CPLBS+1]; 63extern u_long icplb_table[];
61extern u_long dcplb_table[MAX_CPLBS+1]; 64extern u_long dcplb_table[];
62 65
63/* Till here we are discussing about the static memory management model. 66/* Till here we are discussing about the static memory management model.
64 * However, the operating envoronments commonly define more CPLB 67 * However, the operating envoronments commonly define more CPLB
@@ -69,28 +72,16 @@ extern u_long dcplb_table[MAX_CPLBS+1];
69 * This is how Page descriptor Table is implemented in uClinux/Blackfin. 72 * This is how Page descriptor Table is implemented in uClinux/Blackfin.
70 */ 73 */
71 74
72#ifdef CONFIG_CPLB_SWITCH_TAB_L1 75extern u_long ipdt_table[];
73extern u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]__attribute__((l1_data)); 76extern u_long dpdt_table[];
74extern u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]__attribute__((l1_data));
75
76#ifdef CONFIG_CPLB_INFO
77extern u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]__attribute__((l1_data));
78extern u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]__attribute__((l1_data));
79#endif /* CONFIG_CPLB_INFO */
80
81#else
82
83extern u_long ipdt_table[MAX_SWITCH_I_CPLBS+1];
84extern u_long dpdt_table[MAX_SWITCH_D_CPLBS+1];
85
86#ifdef CONFIG_CPLB_INFO 77#ifdef CONFIG_CPLB_INFO
87extern u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]; 78extern u_long ipdt_swapcount_table[];
88extern u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]; 79extern u_long dpdt_swapcount_table[];
89#endif /* CONFIG_CPLB_INFO */ 80#endif
90
91#endif /*CONFIG_CPLB_SWITCH_TAB_L1*/
92 81
93extern unsigned long reserved_mem_dcache_on; 82extern unsigned long reserved_mem_dcache_on;
94extern unsigned long reserved_mem_icache_on; 83extern unsigned long reserved_mem_icache_on;
95 84
96extern void generate_cpl_tables(void); 85extern void generate_cpl_tables(void);
86
87#endif
diff --git a/include/asm-blackfin/delay.h b/include/asm-blackfin/delay.h
index 52e7a10d7ff8..473a8113277f 100644
--- a/include/asm-blackfin/delay.h
+++ b/include/asm-blackfin/delay.h
@@ -1,29 +1,47 @@
1#ifndef _BLACKFIN_DELAY_H
2#define _BLACKFIN_DELAY_H
3
4static inline void __delay(unsigned long loops)
5{
6
7/* FIXME: Currently the assembler doesn't recognize Loop Register Clobbers,
8 uncomment this as soon those are implemented */
9/* 1/*
10 __asm__ __volatile__ ( "\t LSETUP (1f,1f) LC0= %0\n\t" 2 * delay.h - delay functions
11 "1:\t NOP;\n\t" 3 *
12 : :"a" (loops) 4 * Copyright (c) 2004-2007 Analog Devices Inc.
13 : "LT0","LB0","LC0"); 5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __ASM_DELAY_H__
10#define __ASM_DELAY_H__
14 11
15*/ 12#include <asm/mach/anomaly.h>
16 13
17 __asm__ __volatile__("[--SP] = LC0;\n\t" 14static inline void __delay(unsigned long loops)
18 "[--SP] = LT0;\n\t" 15{
19 "[--SP] = LB0;\n\t" 16 if (ANOMALY_05000312) {
20 "LSETUP (1f,1f) LC0 = %0;\n\t" 17 /* Interrupted loads to loop registers -> bad */
21 "1:\t NOP;\n\t" 18 unsigned long tmp;
22 "LB0 = [SP++];\n\t" 19 __asm__ __volatile__(
23 "LT0 = [SP++];\n\t" 20 "[--SP] = LC0;"
24 "LC0 = [SP++];\n" 21 "[--SP] = LT0;"
25 : 22 "[--SP] = LB0;"
26 :"a" (loops)); 23 "LSETUP (1f,1f) LC0 = %1;"
24 "1: NOP;"
25 /* We take advantage of the fact that LC0 is 0 at
26 * the end of the loop. Otherwise we'd need some
27 * NOPs after the CLI here.
28 */
29 "CLI %0;"
30 "LB0 = [SP++];"
31 "LT0 = [SP++];"
32 "LC0 = [SP++];"
33 "STI %0;"
34 : "=d" (tmp)
35 : "a" (loops)
36 );
37 } else
38 __asm__ __volatile__ (
39 "LSETUP(1f, 1f) LC0 = %0;"
40 "1: NOP;"
41 :
42 : "a" (loops)
43 : "LT0", "LB0", "LC0"
44 );
27} 45}
28 46
29#include <linux/param.h> /* needed for HZ */ 47#include <linux/param.h> /* needed for HZ */
@@ -41,4 +59,4 @@ static inline void udelay(unsigned long usecs)
41 __delay(usecs * loops_per_jiffy / (1000000 / HZ)); 59 __delay(usecs * loops_per_jiffy / (1000000 / HZ));
42} 60}
43 61
44#endif /* defined(_BLACKFIN_DELAY_H) */ 62#endif
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index d1d2e6be3b59..1601d62f39a5 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -122,6 +122,7 @@ extern void outsl(unsigned long port, const void *addr, unsigned long count);
122extern void insb(unsigned long port, void *addr, unsigned long count); 122extern void insb(unsigned long port, void *addr, unsigned long count);
123extern void insw(unsigned long port, void *addr, unsigned long count); 123extern void insw(unsigned long port, void *addr, unsigned long count);
124extern void insl(unsigned long port, void *addr, unsigned long count); 124extern void insl(unsigned long port, void *addr, unsigned long count);
125extern void insl_16(unsigned long port, void *addr, unsigned long count);
125 126
126extern void dma_outsb(unsigned long port, const void *addr, unsigned short count); 127extern void dma_outsb(unsigned long port, const void *addr, unsigned short count);
127extern void dma_outsw(unsigned long port, const void *addr, unsigned short count); 128extern void dma_outsw(unsigned long port, const void *addr, unsigned short count);
diff --git a/include/asm-blackfin/mach-bf527/irq.h b/include/asm-blackfin/mach-bf527/irq.h
index 304f5bcfebe4..4e2b3f2020e5 100644
--- a/include/asm-blackfin/mach-bf527/irq.h
+++ b/include/asm-blackfin/mach-bf527/irq.h
@@ -176,11 +176,7 @@
176 176
177#define GPIO_IRQ_BASE IRQ_PF0 177#define GPIO_IRQ_BASE IRQ_PF0
178 178
179#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
180#define NR_IRQS (IRQ_PH15+1) 179#define NR_IRQS (IRQ_PH15+1)
181#else
182#define NR_IRQS (SYS_IRQS+1)
183#endif
184 180
185#define IVG7 7 181#define IVG7 7
186#define IVG8 8 182#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf527/mem_map.h b/include/asm-blackfin/mach-bf527/mem_map.h
index c5aa20102b24..193082deaa4e 100644
--- a/include/asm-blackfin/mach-bf527/mem_map.h
+++ b/include/asm-blackfin/mach-bf527/mem_map.h
@@ -47,6 +47,7 @@
47/* Boot ROM Memory */ 47/* Boot ROM Memory */
48 48
49#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x8000
50 51
51/* Level 1 Memory */ 52/* Level 1 Memory */
52 53
@@ -90,9 +91,7 @@
90 91
91/* Scratch Pad Memory */ 92/* Scratch Pad Memory */
92 93
93#if defined(CONFIG_BF527) || defined(CONFIG_BF536) || defined(CONFIG_BF534)
94#define L1_SCRATCH_START 0xFFB00000 94#define L1_SCRATCH_START 0xFFB00000
95#define L1_SCRATCH_LENGTH 0x1000 95#define L1_SCRATCH_LENGTH 0x1000
96#endif
97 96
98#endif /* _MEM_MAP_527_H_ */ 97#endif /* _MEM_MAP_527_H_ */
diff --git a/include/asm-blackfin/mach-bf533/irq.h b/include/asm-blackfin/mach-bf533/irq.h
index 452fb825d891..832e6f6122da 100644
--- a/include/asm-blackfin/mach-bf533/irq.h
+++ b/include/asm-blackfin/mach-bf533/irq.h
@@ -130,11 +130,7 @@ Core Emulation **
130 130
131#define GPIO_IRQ_BASE IRQ_PF0 131#define GPIO_IRQ_BASE IRQ_PF0
132 132
133#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
134#define NR_IRQS (IRQ_PF15+1) 133#define NR_IRQS (IRQ_PF15+1)
135#else
136#define NR_IRQS SYS_IRQS
137#endif
138 134
139#define IVG7 7 135#define IVG7 7
140#define IVG8 8 136#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf533/mem_map.h b/include/asm-blackfin/mach-bf533/mem_map.h
index 94d8c4062eb7..bd30b6f3be00 100644
--- a/include/asm-blackfin/mach-bf533/mem_map.h
+++ b/include/asm-blackfin/mach-bf533/mem_map.h
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * File: include/asm-blackfin/mach-bf533/mem_map.h 2 * File: include/asm-blackfin/mach-bf533/mem_map.h
4 * Based on: 3 * Based on:
@@ -48,6 +47,7 @@
48/* Boot ROM Memory */ 47/* Boot ROM Memory */
49 48
50#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x400
51 51
52/* Level 1 Memory */ 52/* Level 1 Memory */
53 53
@@ -160,9 +160,7 @@
160 160
161/* Scratch Pad Memory */ 161/* Scratch Pad Memory */
162 162
163#if defined(CONFIG_BF533) || defined(CONFIG_BF532) || defined(CONFIG_BF531)
164#define L1_SCRATCH_START 0xFFB00000 163#define L1_SCRATCH_START 0xFFB00000
165#define L1_SCRATCH_LENGTH 0x1000 164#define L1_SCRATCH_LENGTH 0x1000
166#endif
167 165
168#endif /* _MEM_MAP_533_H_ */ 166#endif /* _MEM_MAP_533_H_ */
diff --git a/include/asm-blackfin/mach-bf537/irq.h b/include/asm-blackfin/mach-bf537/irq.h
index 36c44bc1a917..be6f2ff77f31 100644
--- a/include/asm-blackfin/mach-bf537/irq.h
+++ b/include/asm-blackfin/mach-bf537/irq.h
@@ -162,11 +162,7 @@ Core Emulation **
162 162
163#define GPIO_IRQ_BASE IRQ_PF0 163#define GPIO_IRQ_BASE IRQ_PF0
164 164
165#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
166#define NR_IRQS (IRQ_PH15+1) 165#define NR_IRQS (IRQ_PH15+1)
167#else
168#define NR_IRQS (IRQ_UART1_ERROR+1)
169#endif
170 166
171#define IVG7 7 167#define IVG7 7
172#define IVG8 8 168#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf537/mem_map.h b/include/asm-blackfin/mach-bf537/mem_map.h
index 18759e38eaae..5c6726d6f3b1 100644
--- a/include/asm-blackfin/mach-bf537/mem_map.h
+++ b/include/asm-blackfin/mach-bf537/mem_map.h
@@ -47,6 +47,7 @@
47/* Boot ROM Memory */ 47/* Boot ROM Memory */
48 48
49#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x800
50 51
51/* Level 1 Memory */ 52/* Level 1 Memory */
52 53
@@ -167,9 +168,7 @@
167 168
168/* Scratch Pad Memory */ 169/* Scratch Pad Memory */
169 170
170#if defined(CONFIG_BF537) || defined(CONFIG_BF536) || defined(CONFIG_BF534)
171#define L1_SCRATCH_START 0xFFB00000 171#define L1_SCRATCH_START 0xFFB00000
172#define L1_SCRATCH_LENGTH 0x1000 172#define L1_SCRATCH_LENGTH 0x1000
173#endif
174 173
175#endif /* _MEM_MAP_537_H_ */ 174#endif /* _MEM_MAP_537_H_ */
diff --git a/include/asm-blackfin/mach-bf548/bf548.h b/include/asm-blackfin/mach-bf548/bf548.h
index 7e6d349beb08..e748588e8930 100644
--- a/include/asm-blackfin/mach-bf548/bf548.h
+++ b/include/asm-blackfin/mach-bf548/bf548.h
@@ -106,24 +106,22 @@
106 106
107#define AMGCTLVAL (V_AMBEN | V_AMCKEN) 107#define AMGCTLVAL (V_AMBEN | V_AMCKEN)
108 108
109#ifdef CONFIG_BF542 109#if defined(CONFIG_BF542)
110#define CPU "BF542" 110# define CPU "BF542"
111#define CPUID 0x027c8000 111# define CPUID 0x027c8000
112#endif 112#elif defined(CONFIG_BF544)
113#ifdef CONFIG_BF544 113# define CPU "BF544"
114#define CPU "BF544" 114# define CPUID 0x027c8000
115#define CPUID 0x027c8000 115#elif defined(CONFIG_BF547)
116#endif 116# define CPU "BF547"
117#ifdef CONFIG_BF548 117#elif defined(CONFIG_BF548)
118#define CPU "BF548" 118# define CPU "BF548"
119#define CPUID 0x027c6000 119# define CPUID 0x027c6000
120#endif 120#elif defined(CONFIG_BF549)
121#ifdef CONFIG_BF549 121# define CPU "BF549"
122#define CPU "BF549" 122#else
123#endif 123# define CPU "UNKNOWN"
124#ifndef CPU 124# define CPUID 0x0
125#define CPU "UNKNOWN"
126#define CPUID 0x0
127#endif 125#endif
128 126
129#endif /* __MACH_BF48_H__ */ 127#endif /* __MACH_BF48_H__ */
diff --git a/include/asm-blackfin/mach-bf548/defBF544.h b/include/asm-blackfin/mach-bf548/defBF544.h
index 760307e34b9e..b8b9870e2697 100644
--- a/include/asm-blackfin/mach-bf548/defBF544.h
+++ b/include/asm-blackfin/mach-bf548/defBF544.h
@@ -645,7 +645,7 @@
645 645
646/* Bit masks for HOST_STATUS */ 646/* Bit masks for HOST_STATUS */
647 647
648#define READY 0x1 /* DMA Ready */ 648#define DMA_READY 0x1 /* DMA Ready */
649#define FIFOFULL 0x2 /* FIFO Full */ 649#define FIFOFULL 0x2 /* FIFO Full */
650#define FIFOEMPTY 0x4 /* FIFO Empty */ 650#define FIFOEMPTY 0x4 /* FIFO Empty */
651#define COMPLETE 0x8 /* DMA Complete */ 651#define COMPLETE 0x8 /* DMA Complete */
diff --git a/include/asm-blackfin/mach-bf548/defBF548.h b/include/asm-blackfin/mach-bf548/defBF548.h
index 70af33c963b0..ecbca952985c 100644
--- a/include/asm-blackfin/mach-bf548/defBF548.h
+++ b/include/asm-blackfin/mach-bf548/defBF548.h
@@ -1007,7 +1007,7 @@
1007 1007
1008/* Bit masks for HOST_STATUS */ 1008/* Bit masks for HOST_STATUS */
1009 1009
1010#define READY 0x1 /* DMA Ready */ 1010#define DMA_READY 0x1 /* DMA Ready */
1011#define FIFOFULL 0x2 /* FIFO Full */ 1011#define FIFOFULL 0x2 /* FIFO Full */
1012#define FIFOEMPTY 0x4 /* FIFO Empty */ 1012#define FIFOEMPTY 0x4 /* FIFO Empty */
1013#define COMPLETE 0x8 /* DMA Complete */ 1013#define COMPLETE 0x8 /* DMA Complete */
diff --git a/include/asm-blackfin/mach-bf548/irq.h b/include/asm-blackfin/mach-bf548/irq.h
index 3b08cf9bd6f3..9fb7bc5399a8 100644
--- a/include/asm-blackfin/mach-bf548/irq.h
+++ b/include/asm-blackfin/mach-bf548/irq.h
@@ -338,11 +338,7 @@ Events (highest priority) EMU 0
338 338
339#define GPIO_IRQ_BASE IRQ_PA0 339#define GPIO_IRQ_BASE IRQ_PA0
340 340
341#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
342#define NR_IRQS (IRQ_PJ15+1) 341#define NR_IRQS (IRQ_PJ15+1)
343#else
344#define NR_IRQS (SYS_IRQS+1)
345#endif
346 342
347/* For compatibility reasons with existing code */ 343/* For compatibility reasons with existing code */
348 344
diff --git a/include/asm-blackfin/mach-bf548/mem_map.h b/include/asm-blackfin/mach-bf548/mem_map.h
index ec1597e31831..f99f47bc3a07 100644
--- a/include/asm-blackfin/mach-bf548/mem_map.h
+++ b/include/asm-blackfin/mach-bf548/mem_map.h
@@ -47,6 +47,12 @@
47/* Boot ROM Memory */ 47/* Boot ROM Memory */
48 48
49#define BOOT_ROM_START 0xEF000000 49#define BOOT_ROM_START 0xEF000000
50#define BOOT_ROM_LENGTH 0x1000
51
52/* L1 Instruction ROM */
53
54#define L1_ROM_START 0xFFA14000
55#define L1_ROM_LENGTH 0x10000
50 56
51/* Level 1 Memory */ 57/* Level 1 Memory */
52 58
@@ -87,11 +93,19 @@
87#define BFIN_DSUPBANKS 0 93#define BFIN_DSUPBANKS 0
88#endif /*CONFIG_BFIN_DCACHE*/ 94#endif /*CONFIG_BFIN_DCACHE*/
89 95
96/* Level 2 Memory */
97#if !defined(CONFIG_BF542)
98# define L2_START 0xFEB00000
99# if defined(CONFIG_BF544)
100# define L2_LENGTH 0x10000
101# else
102# define L2_LENGTH 0x20000
103# endif
104#endif
105
90/* Scratch Pad Memory */ 106/* Scratch Pad Memory */
91 107
92#if defined(CONFIG_BF54x)
93#define L1_SCRATCH_START 0xFFB00000 108#define L1_SCRATCH_START 0xFFB00000
94#define L1_SCRATCH_LENGTH 0x1000 109#define L1_SCRATCH_LENGTH 0x1000
95#endif
96 110
97#endif/* _MEM_MAP_548_H_ */ 111#endif/* _MEM_MAP_548_H_ */
diff --git a/include/asm-blackfin/mach-bf561/bf561.h b/include/asm-blackfin/mach-bf561/bf561.h
index 17e1d5dcef02..3ef9e5f36136 100644
--- a/include/asm-blackfin/mach-bf561/bf561.h
+++ b/include/asm-blackfin/mach-bf561/bf561.h
@@ -33,25 +33,6 @@
33#define SUPPORTED_REVID 0x3 33#define SUPPORTED_REVID 0x3
34 34
35#define OFFSET_(x) ((x) & 0x0000FFFF) 35#define OFFSET_(x) ((x) & 0x0000FFFF)
36#define L1_ISRAM 0xFFA00000
37#define L1_ISRAM_END 0xFFA04000
38#define DATA_BANKA_SRAM 0xFF800000
39#define DATA_BANKA_SRAM_END 0xFF804000
40#define DATA_BANKB_SRAM 0xFF900000
41#define DATA_BANKB_SRAM_END 0xFF904000
42#define L1_DSRAMA 0xFF800000
43#define L1_DSRAMA_END 0xFF804000
44#define L1_DSRAMB 0xFF900000
45#define L1_DSRAMB_END 0xFF904000
46#define L2_SRAM 0xFEB00000
47#define L2_SRAM_END 0xFEB20000
48#define AMB_FLASH 0x20000000
49#define AMB_FLASH_END 0x21000000
50#define AMB_FLASH_LENGTH 0x01000000
51#define L1_ISRAM_LENGTH 0x4000
52#define L1_DSRAMA_LENGTH 0x4000
53#define L1_DSRAMB_LENGTH 0x4000
54#define L2_SRAM_LENGTH 0x20000
55 36
56/*some misc defines*/ 37/*some misc defines*/
57#define IMASK_IVG15 0x8000 38#define IMASK_IVG15 0x8000
diff --git a/include/asm-blackfin/mach-bf561/defBF561.h b/include/asm-blackfin/mach-bf561/defBF561.h
index 7945e8a3a841..c3c0eb13c819 100644
--- a/include/asm-blackfin/mach-bf561/defBF561.h
+++ b/include/asm-blackfin/mach-bf561/defBF561.h
@@ -55,6 +55,7 @@
55/* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */ 55/* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */
56#define SWRST SICA_SWRST 56#define SWRST SICA_SWRST
57#define SYSCR SICA_SYSCR 57#define SYSCR SICA_SYSCR
58#define DOUBLE_FAULT (DOUBLE_FAULT_B|DOUBLE_FAULT_A)
58#define RESET_DOUBLE (SWRST_DBL_FAULT_B|SWRST_DBL_FAULT_A) 59#define RESET_DOUBLE (SWRST_DBL_FAULT_B|SWRST_DBL_FAULT_A)
59#define RESET_WDOG (SWRST_WDT_B|SWRST_WDT_A) 60#define RESET_WDOG (SWRST_WDT_B|SWRST_WDT_A)
60#define RESET_SOFTWARE (SWRST_OCCURRED) 61#define RESET_SOFTWARE (SWRST_OCCURRED)
@@ -877,12 +878,14 @@
877#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */ 878#define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
878 879
879/* SWRST Mask */ 880/* SWRST Mask */
880#define SYSTEM_RESET 0x00000007 /* Initiates a system software reset */ 881#define SYSTEM_RESET 0x0007 /* Initiates a system software reset */
881#define SWRST_DBL_FAULT_B 0x00000800 /* SWRST Core B Double Fault */ 882#define DOUBLE_FAULT_A 0x0008 /* Core A Double Fault Causes Reset */
882#define SWRST_DBL_FAULT_A 0x00001000 /* SWRST Core A Double Fault */ 883#define DOUBLE_FAULT_B 0x0010 /* Core B Double Fault Causes Reset */
883#define SWRST_WDT_B 0x00002000 /* SWRST Watchdog B */ 884#define SWRST_DBL_FAULT_A 0x0800 /* SWRST Core A Double Fault */
884#define SWRST_WDT_A 0x00004000 /* SWRST Watchdog A */ 885#define SWRST_DBL_FAULT_B 0x1000 /* SWRST Core B Double Fault */
885#define SWRST_OCCURRED 0x00008000 /* SWRST Status */ 886#define SWRST_WDT_B 0x2000 /* SWRST Watchdog B */
887#define SWRST_WDT_A 0x4000 /* SWRST Watchdog A */
888#define SWRST_OCCURRED 0x8000 /* SWRST Status */
886 889
887/* ************* SYSTEM INTERRUPT CONTROLLER MASKS ***************** */ 890/* ************* SYSTEM INTERRUPT CONTROLLER MASKS ***************** */
888 891
diff --git a/include/asm-blackfin/mach-bf561/irq.h b/include/asm-blackfin/mach-bf561/irq.h
index 12789927db3d..83f0383957d2 100644
--- a/include/asm-blackfin/mach-bf561/irq.h
+++ b/include/asm-blackfin/mach-bf561/irq.h
@@ -291,11 +291,7 @@
291 291
292#define GPIO_IRQ_BASE IRQ_PF0 292#define GPIO_IRQ_BASE IRQ_PF0
293 293
294#ifdef CONFIG_IRQCHIP_DEMUX_GPIO
295#define NR_IRQS (IRQ_PF47 + 1) 294#define NR_IRQS (IRQ_PF47 + 1)
296#else
297#define NR_IRQS SYS_IRQS
298#endif
299 295
300#define IVG7 7 296#define IVG7 7
301#define IVG8 8 297#define IVG8 8
diff --git a/include/asm-blackfin/mach-bf561/mem_map.h b/include/asm-blackfin/mach-bf561/mem_map.h
index f7ac09cf2c3d..c26d8486cc4b 100644
--- a/include/asm-blackfin/mach-bf561/mem_map.h
+++ b/include/asm-blackfin/mach-bf561/mem_map.h
@@ -19,6 +19,11 @@
19#define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */ 19#define ASYNC_BANK0_BASE 0x20000000 /* Async Bank 0 */
20#define ASYNC_BANK0_SIZE 0x04000000 /* 64M */ 20#define ASYNC_BANK0_SIZE 0x04000000 /* 64M */
21 21
22/* Boot ROM Memory */
23
24#define BOOT_ROM_START 0xEF000000
25#define BOOT_ROM_LENGTH 0x800
26
22/* Level 1 Memory */ 27/* Level 1 Memory */
23 28
24#ifdef CONFIG_BFIN_ICACHE 29#ifdef CONFIG_BFIN_ICACHE
@@ -67,9 +72,7 @@
67 72
68/* Scratch Pad Memory */ 73/* Scratch Pad Memory */
69 74
70#if defined(CONFIG_BF561)
71#define L1_SCRATCH_START 0xFFB00000 75#define L1_SCRATCH_START 0xFFB00000
72#define L1_SCRATCH_LENGTH 0x1000 76#define L1_SCRATCH_LENGTH 0x1000
73#endif
74 77
75#endif /* _MEM_MAP_533_H_ */ 78#endif /* _MEM_MAP_533_H_ */
diff --git a/include/asm-blackfin/mach-common/def_LPBlackfin.h b/include/asm-blackfin/mach-common/def_LPBlackfin.h
index c1d8c4a78fcf..e8967f6124f7 100644
--- a/include/asm-blackfin/mach-common/def_LPBlackfin.h
+++ b/include/asm-blackfin/mach-common/def_LPBlackfin.h
@@ -46,7 +46,7 @@
46#endif 46#endif
47 47
48#define bfin_read8(addr) ({ \ 48#define bfin_read8(addr) ({ \
49 uint8_t __v; \ 49 uint32_t __v; \
50 __asm__ __volatile__( \ 50 __asm__ __volatile__( \
51 NOP_PAD_ANOMALY_05000198 \ 51 NOP_PAD_ANOMALY_05000198 \
52 "%0 = b[%1] (z);" \ 52 "%0 = b[%1] (z);" \
@@ -56,7 +56,7 @@
56 __v; }) 56 __v; })
57 57
58#define bfin_read16(addr) ({ \ 58#define bfin_read16(addr) ({ \
59 uint16_t __v; \ 59 uint32_t __v; \
60 __asm__ __volatile__( \ 60 __asm__ __volatile__( \
61 NOP_PAD_ANOMALY_05000198 \ 61 NOP_PAD_ANOMALY_05000198 \
62 "%0 = w[%1] (z);" \ 62 "%0 = w[%1] (z);" \
@@ -80,7 +80,7 @@
80 NOP_PAD_ANOMALY_05000198 \ 80 NOP_PAD_ANOMALY_05000198 \
81 "b[%0] = %1;" \ 81 "b[%0] = %1;" \
82 : \ 82 : \
83 : "a" (addr), "d" (val) \ 83 : "a" (addr), "d" ((uint8_t)(val)) \
84 : "memory" \ 84 : "memory" \
85 ) 85 )
86 86
@@ -89,7 +89,7 @@
89 NOP_PAD_ANOMALY_05000198 \ 89 NOP_PAD_ANOMALY_05000198 \
90 "w[%0] = %1;" \ 90 "w[%0] = %1;" \
91 : \ 91 : \
92 : "a" (addr), "d" (val) \ 92 : "a" (addr), "d" ((uint16_t)(val)) \
93 : "memory" \ 93 : "memory" \
94 ) 94 )
95 95
diff --git a/include/asm-blackfin/page_offset.h b/include/asm-blackfin/page_offset.h
index 3b671d5fd70d..cbaff24b4b25 100644
--- a/include/asm-blackfin/page_offset.h
+++ b/include/asm-blackfin/page_offset.h
@@ -1,6 +1,6 @@
1 1
2/* This handles the memory map.. */ 2/* This handles the memory map.. */
3 3
4#ifdef CONFIG_BFIN 4#ifdef CONFIG_BLACKFIN
5#define PAGE_OFFSET_RAW 0x00000000 5#define PAGE_OFFSET_RAW 0x00000000
6#endif 6#endif
diff --git a/include/asm-blackfin/string.h b/include/asm-blackfin/string.h
index e8ada91ab002..321f4d96e4ae 100644
--- a/include/asm-blackfin/string.h
+++ b/include/asm-blackfin/string.h
@@ -1,6 +1,8 @@
1#ifndef _BLACKFIN_STRING_H_ 1#ifndef _BLACKFIN_STRING_H_
2#define _BLACKFIN_STRING_H_ 2#define _BLACKFIN_STRING_H_
3 3
4#include <linux/types.h>
5
4#ifdef __KERNEL__ /* only set these up for kernel code */ 6#ifdef __KERNEL__ /* only set these up for kernel code */
5 7
6#define __HAVE_ARCH_STRCPY 8#define __HAVE_ARCH_STRCPY
diff --git a/include/asm-blackfin/traps.h b/include/asm-blackfin/traps.h
index fe365b1b7ca8..ee1cbf73a9ab 100644
--- a/include/asm-blackfin/traps.h
+++ b/include/asm-blackfin/traps.h
@@ -48,28 +48,80 @@
48 48
49#ifndef __ASSEMBLY__ 49#ifndef __ASSEMBLY__
50 50
51#define HWC_x2 "System MMR Error\nAn error occurred due to an invalid access to an System MMR location\nPossible reason: a 32-bit register is accessed with a 16-bit instruction,\nor a 16-bit register is accessed with a 32-bit instruction.\n" 51#define HWC_x2(level) \
52#define HWC_x3 "External Memory Addressing Error\n" 52 "System MMR Error\n" \
53#define HWC_x12 "Performance Monitor Overflow\n" 53 level " - An error occurred due to an invalid access to an System MMR location\n" \
54#define HWC_x18 "RAISE 5 instruction\n Software issued a RAISE 5 instruction to invoke the Hardware\n" 54 level " Possible reason: a 32-bit register is accessed with a 16-bit instruction\n" \
55#define HWC_default "Reserved\n" 55 level " or a 16-bit register is accessed with a 32-bit instruction.\n"
56 56#define HWC_x3(level) \
57#define EXC_0x03 "Application stack overflow\n - Please increase the stack size of the application using elf2flt -s option,\n and/or reduce the stack use of the application.\n" 57 "External Memory Addressing Error\n"
58#define EXC_0x10 "Single step\n - When the processor is in single step mode, every instruction\n generates an exception. Primarily used for debugging.\n" 58#define HWC_x12(level) \
59#define EXC_0x11 "Exception caused by a trace buffer full condition\n - The processor takes this exception when the trace\n buffer overflows (only when enabled by the Trace Unit Control register).\n" 59 "Performance Monitor Overflow\n"
60#define EXC_0x21 "Undefined instruction\n - May be used to emulate instructions that are not defined for\n a particular processor implementation.\n" 60#define HWC_x18(level) \
61#define EXC_0x22 "Illegal instruction combination\n - See section for multi-issue rules in the ADSP-BF53x Blackfin\n Processor Instruction Set Reference.\n" 61 "RAISE 5 instruction\n" \
62#define EXC_0x23 "Data access CPLB protection violation\n - Attempted read or write to Supervisor resource,\n or illegal data memory access. \n" 62 level " Software issued a RAISE 5 instruction to invoke the Hardware\n"
63#define EXC_0x24 "Data access misaligned address violation\n - Attempted misaligned data memory or data cache access.\n" 63#define HWC_default(level) \
64#define EXC_0x25 "Unrecoverable event\n - For example, an exception generated while processing a previous exception.\n" 64 "Reserved\n"
65#define EXC_0x26 "Data access CPLB miss\n - Used by the MMU to signal a CPLB miss on a data access.\n" 65#define EXC_0x03(level) \
66#define EXC_0x27 "Data access multiple CPLB hits\n - More than one CPLB entry matches data fetch address.\n" 66 "Application stack overflow\n" \
67#define EXC_0x28 "Program Sequencer Exception caused by an emulation watchpoint match\n - There is a watchpoint match, and one of the EMUSW\n bits in the Watchpoint Instruction Address Control register (WPIACTL) is set.\n" 67 level " - Please increase the stack size of the application using elf2flt -s option,\n" \
68#define EXC_0x2A "Instruction fetch misaligned address violation\n - Attempted misaligned instruction cache fetch. On a misaligned instruction fetch exception,\n the return address provided in RETX is the destination address which is misaligned, rather than the address of the offending instruction.\n" 68 level " and/or reduce the stack use of the application.\n"
69#define EXC_0x2B "CPLB protection violation\n - Illegal instruction fetch access (memory protection violation).\n" 69#define EXC_0x10(level) \
70#define EXC_0x2C "Instruction fetch CPLB miss\n - CPLB miss on an instruction fetch.\n" 70 "Single step\n" \
71#define EXC_0x2D "Instruction fetch multiple CPLB hits\n - More than one CPLB entry matches instruction fetch address.\n" 71 level " - When the processor is in single step mode, every instruction\n" \
72#define EXC_0x2E "Illegal use of supervisor resource\n - Attempted to use a Supervisor register or instruction from User mode.\n Supervisor resources are registers and instructions that are reserved\n for Supervisor use: Supervisor only registers, all MMRs, and Supervisor\n only instructions.\n" 72 level " generates an exception. Primarily used for debugging.\n"
73#define EXC_0x11(level) \
74 "Exception caused by a trace buffer full condition\n" \
75 level " - The processor takes this exception when the trace\n" \
76 level " buffer overflows (only when enabled by the Trace Unit Control register).\n"
77#define EXC_0x21(level) \
78 "Undefined instruction\n" \
79 level " - May be used to emulate instructions that are not defined for\n" \
80 level " a particular processor implementation.\n"
81#define EXC_0x22(level) \
82 "Illegal instruction combination\n" \
83 level " - See section for multi-issue rules in the ADSP-BF53x Blackfin\n" \
84 level " Processor Instruction Set Reference.\n"
85#define EXC_0x23(level) \
86 "Data access CPLB protection violation\n" \
87 level " - Attempted read or write to Supervisor resource,\n" \
88 level " or illegal data memory access. \n"
89#define EXC_0x24(level) \
90 "Data access misaligned address violation\n" \
91 level " - Attempted misaligned data memory or data cache access.\n"
92#define EXC_0x25(level) \
93 "Unrecoverable event\n" \
94 level " - For example, an exception generated while processing a previous exception.\n"
95#define EXC_0x26(level) \
96 "Data access CPLB miss\n" \
97 level " - Used by the MMU to signal a CPLB miss on a data access.\n"
98#define EXC_0x27(level) \
99 "Data access multiple CPLB hits\n" \
100 level " - More than one CPLB entry matches data fetch address.\n"
101#define EXC_0x28(level) \
102 "Program Sequencer Exception caused by an emulation watchpoint match\n" \
103 level " - There is a watchpoint match, and one of the EMUSW\n" \
104 level " bits in the Watchpoint Instruction Address Control register (WPIACTL) is set.\n"
105#define EXC_0x2A(level) \
106 "Instruction fetch misaligned address violation\n" \
107 level " - Attempted misaligned instruction cache fetch. On a misaligned instruction fetch\n" \
108 level " exception, the return address provided in RETX is the destination address which is\n" \
109 level " misaligned, rather than the address of the offending instruction.\n"
110#define EXC_0x2B(level) \
111 "CPLB protection violation\n" \
112 level " - Illegal instruction fetch access (memory protection violation).\n"
113#define EXC_0x2C(level) \
114 "Instruction fetch CPLB miss\n" \
115 level " - CPLB miss on an instruction fetch.\n"
116#define EXC_0x2D(level) \
117 "Instruction fetch multiple CPLB hits\n" \
118 level " - More than one CPLB entry matches instruction fetch address.\n"
119#define EXC_0x2E(level) \
120 "Illegal use of supervisor resource\n" \
121 level " - Attempted to use a Supervisor register or instruction from User mode.\n" \
122 level " Supervisor resources are registers and instructions that are reserved\n" \
123 level " for Supervisor use: Supervisor only registers, all MMRs, and Supervisor\n" \
124 level " only instructions.\n"
73 125
74#endif /* __ASSEMBLY__ */ 126#endif /* __ASSEMBLY__ */
75#endif /* _BFIN_TRAPS_H */ 127#endif /* _BFIN_TRAPS_H */
diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index cfe3692b23e5..a4a22cc35898 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -12,7 +12,7 @@
12 * then it defines them prior including asm-generic/resource.h. ) 12 * then it defines them prior including asm-generic/resource.h. )
13 */ 13 */
14 14
15#define RLIMIT_CPU 0 /* CPU time in ms */ 15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */ 16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */ 17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */ 18#define RLIMIT_STACK 3 /* max stack size */
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 49730ffbbae4..81bcd5e51789 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -94,6 +94,7 @@ ia64_acpi_release_global_lock (unsigned int *lock)
94#define acpi_noirq 0 /* ACPI always enabled on IA64 */ 94#define acpi_noirq 0 /* ACPI always enabled on IA64 */
95#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */ 95#define acpi_pci_disabled 0 /* ACPI PCI always enabled on IA64 */
96#define acpi_strict 1 /* no ACPI spec workarounds on IA64 */ 96#define acpi_strict 1 /* no ACPI spec workarounds on IA64 */
97#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
97static inline void disable_acpi(void) { } 98static inline void disable_acpi(void) { }
98 99
99const char *acpi_get_sysname (void); 100const char *acpi_get_sysname (void);
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h
index c039820dba7c..1effcd0f5e63 100644
--- a/include/asm-m32r/thread_info.h
+++ b/include/asm-m32r/thread_info.h
@@ -149,16 +149,21 @@ static inline unsigned int get_thread_fault_code(void)
149#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 149#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
150#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ 150#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
151#define TIF_IRET 4 /* return with iret */ 151#define TIF_IRET 4 /* return with iret */
152#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 152#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */
153 /* 31..28 fault code */ 153#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
154#define TIF_MEMDIE 17 154#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
155#define TIF_MEMDIE 18 /* OOM killer killed process */
156#define TIF_FREEZE 19 /* is freezing for suspend */
155 157
156#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 158#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
157#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 159#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
158#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 160#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
159#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 161#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
160#define _TIF_IRET (1<<TIF_IRET) 162#define _TIF_IRET (1<<TIF_IRET)
163#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
164#define _TIF_USEDFPU (1<<TIF_USEDFPU)
161#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 165#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
166#define _TIF_FREEZE (1<<TIF_FREEZE)
162 167
163#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 168#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
164#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 169#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index cbbd53762ea6..f467eac9ba70 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -290,10 +290,50 @@
290#define __NR_mq_getsetattr (__NR_mq_open+5) 290#define __NR_mq_getsetattr (__NR_mq_open+5)
291#define __NR_kexec_load 283 291#define __NR_kexec_load 283
292#define __NR_waitid 284 292#define __NR_waitid 284
293/* 285 is unused */
294#define __NR_add_key 286
295#define __NR_request_key 287
296#define __NR_keyctl 288
297#define __NR_ioprio_set 289
298#define __NR_ioprio_get 290
299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293
302#define __NR_migrate_pages 294
303#define __NR_openat 295
304#define __NR_mkdirat 296
305#define __NR_mknodat 297
306#define __NR_fchownat 298
307#define __NR_futimesat 299
308#define __NR_fstatat64 300
309#define __NR_unlinkat 301
310#define __NR_renameat 302
311#define __NR_linkat 303
312#define __NR_symlinkat 304
313#define __NR_readlinkat 305
314#define __NR_fchmodat 306
315#define __NR_faccessat 307
316#define __NR_pselect6 308
317#define __NR_ppoll 309
318#define __NR_unshare 310
319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312
321#define __NR_splice 313
322#define __NR_sync_file_range 314
323#define __NR_tee 315
324#define __NR_vmsplice 316
325#define __NR_move_pages 317
326#define __NR_getcpu 318
327#define __NR_epoll_pwait 319
328#define __NR_utimensat 320
329#define __NR_signalfd 321
330#define __NR_timerfd 322
331#define __NR_eventfd 323
332#define __NR_fallocate 324
293 333
294#ifdef __KERNEL__ 334#ifdef __KERNEL__
295 335
296#define NR_syscalls 285 336#define NR_syscalls 325
297 337
298#define __ARCH_WANT_IPC_PARSE_VERSION 338#define __ARCH_WANT_IPC_PARSE_VERSION
299#define __ARCH_WANT_STAT64 339#define __ARCH_WANT_STAT64
@@ -311,6 +351,30 @@
311#define __ARCH_WANT_SYS_OLDUMOUNT 351#define __ARCH_WANT_SYS_OLDUMOUNT
312#define __ARCH_WANT_SYS_RT_SIGACTION 352#define __ARCH_WANT_SYS_RT_SIGACTION
313 353
354#define __IGNORE_lchown
355#define __IGNORE_setuid
356#define __IGNORE_getuid
357#define __IGNORE_setgid
358#define __IGNORE_getgid
359#define __IGNORE_geteuid
360#define __IGNORE_getegid
361#define __IGNORE_fcntl
362#define __IGNORE_setreuid
363#define __IGNORE_setregid
364#define __IGNORE_getrlimit
365#define __IGNORE_getgroups
366#define __IGNORE_setgroups
367#define __IGNORE_select
368#define __IGNORE_mmap
369#define __IGNORE_fchown
370#define __IGNORE_setfsuid
371#define __IGNORE_setfsgid
372#define __IGNORE_setresuid
373#define __IGNORE_getresuid
374#define __IGNORE_setresgid
375#define __IGNORE_getresgid
376#define __IGNORE_chown
377
314/* 378/*
315 * "Conditional" syscalls 379 * "Conditional" syscalls
316 * 380 *
diff --git a/include/asm-mips/8253pit.h b/include/asm-mips/8253pit.h
deleted file mode 100644
index 285f78488ccb..000000000000
--- a/include/asm-mips/8253pit.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * 8253/8254 Programmable Interval Timer
3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index f6bd308f047f..5ea701fc3425 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -207,13 +207,13 @@
207#endif 207#endif
208 208
209#ifndef cpu_dcache_line_size 209#ifndef cpu_dcache_line_size
210#define cpu_dcache_line_size() current_cpu_data.dcache.linesz 210#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
211#endif 211#endif
212#ifndef cpu_icache_line_size 212#ifndef cpu_icache_line_size
213#define cpu_icache_line_size() current_cpu_data.icache.linesz 213#define cpu_icache_line_size() cpu_data[0].icache.linesz
214#endif 214#endif
215#ifndef cpu_scache_line_size 215#ifndef cpu_scache_line_size
216#define cpu_scache_line_size() current_cpu_data.scache.linesz 216#define cpu_scache_line_size() cpu_data[0].scache.linesz
217#endif 217#endif
218 218
219#endif /* __ASM_CPU_FEATURES_H */ 219#endif /* __ASM_CPU_FEATURES_H */
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index 833437d31ef1..d6a6c21f16db 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -92,6 +92,7 @@
92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) 92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
93#endif 93#endif
94#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS)) 94#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
95#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
95 96
96/* 8237 DMA controllers */ 97/* 8237 DMA controllers */
97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ 98#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 3e7e30d4f418..17f082cfea85 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -35,7 +35,7 @@
35 " .set mips0 \n" \ 35 " .set mips0 \n" \
36 " .section .fixup,\"ax\" \n" \ 36 " .section .fixup,\"ax\" \n" \
37 "4: li %0, %6 \n" \ 37 "4: li %0, %6 \n" \
38 " j 2b \n" \ 38 " j 3b \n" \
39 " .previous \n" \ 39 " .previous \n" \
40 " .section __ex_table,\"a\" \n" \ 40 " .section __ex_table,\"a\" \n" \
41 " "__UA_ADDR "\t1b, 4b \n" \ 41 " "__UA_ADDR "\t1b, 4b \n" \
@@ -61,7 +61,7 @@
61 " .set mips0 \n" \ 61 " .set mips0 \n" \
62 " .section .fixup,\"ax\" \n" \ 62 " .section .fixup,\"ax\" \n" \
63 "4: li %0, %6 \n" \ 63 "4: li %0, %6 \n" \
64 " j 2b \n" \ 64 " j 3b \n" \
65 " .previous \n" \ 65 " .previous \n" \
66 " .section __ex_table,\"a\" \n" \ 66 " .section __ex_table,\"a\" \n" \
67 " "__UA_ADDR "\t1b, 4b \n" \ 67 " "__UA_ADDR "\t1b, 4b \n" \
@@ -200,4 +200,4 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
200} 200}
201 201
202#endif 202#endif
203#endif 203#endif /* _ASM_FUTEX_H */
diff --git a/include/asm-mips/i8253.h b/include/asm-mips/i8253.h
index 032ca73f181b..5dabc870b322 100644
--- a/include/asm-mips/i8253.h
+++ b/include/asm-mips/i8253.h
@@ -12,6 +12,8 @@
12#define PIT_CH0 0x40 12#define PIT_CH0 0x40
13#define PIT_CH2 0x42 13#define PIT_CH2 0x42
14 14
15#define PIT_TICK_RATE 1193182UL
16
15extern spinlock_t i8253_lock; 17extern spinlock_t i8253_lock;
16 18
17extern void setup_pit_timer(void); 19extern void setup_pit_timer(void);
diff --git a/include/asm-mips/ip32/ip32_ints.h b/include/asm-mips/ip32/ip32_ints.h
index ab5612f90f6f..85bc5302bce0 100644
--- a/include/asm-mips/ip32/ip32_ints.h
+++ b/include/asm-mips/ip32/ip32_ints.h
@@ -22,7 +22,7 @@ enum ip32_irq_no {
22 * CPU interrupts are 0 ... 7 22 * CPU interrupts are 0 ... 7
23 */ 23 */
24 24
25 CRIME_IRQ_BASE = MIPS_CPU_IRQ_BASE, 25 CRIME_IRQ_BASE = MIPS_CPU_IRQ_BASE + 8,
26 26
27 /* 27 /*
28 * MACE 28 * MACE
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 90e4b403f531..a944eda4faf5 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -68,11 +68,15 @@ do { \
68 if (cpu_has_dsp) \ 68 if (cpu_has_dsp) \
69 __save_dsp(prev); \ 69 __save_dsp(prev); \
70 (last) = resume(prev, next, task_thread_info(next)); \ 70 (last) = resume(prev, next, task_thread_info(next)); \
71} while (0)
72
73#define finish_arch_switch(prev) \
74do { \
71 if (cpu_has_dsp) \ 75 if (cpu_has_dsp) \
72 __restore_dsp(current); \ 76 __restore_dsp(current); \
73 if (cpu_has_userlocal) \ 77 if (cpu_has_userlocal) \
74 write_c0_userlocal(task_thread_info(current)->tp_value);\ 78 write_c0_userlocal(current_thread_info()->tp_value); \
75} while(0) 79} while (0)
76 80
77static inline unsigned long __xchg_u32(volatile int * m, unsigned int val) 81static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
78{ 82{
@@ -205,8 +209,6 @@ extern void *set_except_vector(int n, void *addr);
205extern unsigned long ebase; 209extern unsigned long ebase;
206extern void per_cpu_trap_init(void); 210extern void per_cpu_trap_init(void);
207 211
208extern int stop_a_enabled;
209
210/* 212/*
211 * See include/asm-ia64/system.h; prevents deadlock on SMP 213 * See include/asm-ia64/system.h; prevents deadlock on SMP
212 * systems. 214 * systems.
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index ee1663e64da1..7717934f94c3 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -58,10 +58,22 @@ extern int (*perf_irq)(void);
58 * Initialize the calling CPU's compare interrupt as clockevent device 58 * Initialize the calling CPU's compare interrupt as clockevent device
59 */ 59 */
60#ifdef CONFIG_CEVT_R4K 60#ifdef CONFIG_CEVT_R4K
61extern void mips_clockevent_init(void); 61extern int mips_clockevent_init(void);
62extern unsigned int __weak get_c0_compare_int(void); 62extern unsigned int __weak get_c0_compare_int(void);
63#else 63#else
64static inline void mips_clockevent_init(void) 64static inline int mips_clockevent_init(void)
65{
66 return -ENXIO;
67}
68#endif
69
70/*
71 * Initialize the count register as a clocksource
72 */
73#ifdef CONFIG_CEVT_R4K
74extern void init_mips_clocksource(void);
75#else
76static inline void init_mips_clocksource(void)
65{ 77{
66} 78}
67#endif 79#endif
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
index 374d0db37e1c..17110aff26e7 100644
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -6,6 +6,10 @@
6 6
7#define PPC_MEMSTART 0 7#define PPC_MEMSTART 0
8 8
9#ifdef CONFIG_NOT_COHERENT_CACHE
10#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
11#endif
12
9#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
10/* 14/*
11 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit 15 * The basic type of a PTE - 64 bits for those CPUs with > 32 bit
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index dc318458b5fe..d8bdc79db12e 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -246,7 +246,6 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
246 return PCI_DN(busdn)->phb; 246 return PCI_DN(busdn)->phb;
247} 247}
248 248
249extern void pcibios_free_controller(struct pci_controller *phb);
250 249
251extern void isa_bridge_find_early(struct pci_controller *hose); 250extern void isa_bridge_find_early(struct pci_controller *hose);
252 251
@@ -282,9 +281,11 @@ extern void
282pci_process_bridge_OF_ranges(struct pci_controller *hose, 281pci_process_bridge_OF_ranges(struct pci_controller *hose,
283 struct device_node *dev, int primary); 282 struct device_node *dev, int primary);
284 283
285/* Allocate a new PCI host bridge structure */ 284/* Allocate & free a PCI host bridge structure */
286extern struct pci_controller * 285extern struct pci_controller *
287pcibios_alloc_controller(struct device_node *dev); 286pcibios_alloc_controller(struct device_node *dev);
287extern void pcibios_free_controller(struct pci_controller *phb);
288
288#ifdef CONFIG_PCI 289#ifdef CONFIG_PCI
289extern unsigned long pci_address_to_pio(phys_addr_t address); 290extern unsigned long pci_address_to_pio(phys_addr_t address);
290extern int pcibios_vaddr_is_ioport(void __iomem *address); 291extern int pcibios_vaddr_is_ioport(void __iomem *address);
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 8eaa7b28d9d0..87db8728e82d 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -164,7 +164,8 @@ extern int rtas_call(int token, int, int, int *, ...);
164extern void rtas_restart(char *cmd); 164extern void rtas_restart(char *cmd);
165extern void rtas_power_off(void); 165extern void rtas_power_off(void);
166extern void rtas_halt(void); 166extern void rtas_halt(void);
167extern void rtas_os_term(char *str); 167extern void rtas_panic_msg(char *str);
168extern void rtas_os_term(void);
168extern int rtas_get_sensor(int sensor, int index, int *state); 169extern int rtas_get_sensor(int sensor, int index, int *state);
169extern int rtas_get_power_level(int powerdomain, int *level); 170extern int rtas_get_power_level(int powerdomain, int *level);
170extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 171extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h
index 8a94f0eba5e9..f01393224b52 100644
--- a/include/asm-powerpc/vdso_datapage.h
+++ b/include/asm-powerpc/vdso_datapage.h
@@ -77,6 +77,10 @@ struct vdso_data {
77 /* those additional ones don't have to be located anywhere 77 /* those additional ones don't have to be located anywhere
78 * special as they were not part of the original systemcfg 78 * special as they were not part of the original systemcfg
79 */ 79 */
80 __u32 dcache_block_size; /* L1 d-cache block size */
81 __u32 icache_block_size; /* L1 i-cache block size */
82 __u32 dcache_log_block_size; /* L1 d-cache log block size */
83 __u32 icache_log_block_size; /* L1 i-cache log block size */
80 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 84 __s32 wtom_clock_sec; /* Wall to monotonic clock */
81 __s32 wtom_clock_nsec; 85 __s32 wtom_clock_nsec;
82 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 86 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
@@ -99,6 +103,10 @@ struct vdso_data {
99 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 103 __s32 wtom_clock_sec; /* Wall to monotonic clock */
100 __s32 wtom_clock_nsec; 104 __s32 wtom_clock_nsec;
101 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 105 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
106 __u32 dcache_block_size; /* L1 d-cache block size */
107 __u32 icache_block_size; /* L1 i-cache block size */
108 __u32 dcache_log_block_size; /* L1 d-cache log block size */
109 __u32 icache_log_block_size; /* L1 i-cache log block size */
102}; 110};
103 111
104#endif /* CONFIG_PPC64 */ 112#endif /* CONFIG_PPC64 */
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index d866d3385556..44bda786eef7 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -388,6 +388,11 @@ extern void (*_machine_power_off)(void);
388 388
389#define arch_align_stack(x) (x) 389#define arch_align_stack(x) (x)
390 390
391#ifdef CONFIG_TRACE_IRQFLAGS
392extern psw_t sysc_restore_trace_psw;
393extern psw_t io_restore_trace_psw;
394#endif
395
391#endif /* __KERNEL__ */ 396#endif /* __KERNEL__ */
392 397
393#endif 398#endif
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index b91246153b7e..9d528ada3c14 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -43,7 +43,7 @@ extern void __flush_purge_region(void *start, int size);
43extern void __flush_invalidate_region(void *start, int size); 43extern void __flush_invalidate_region(void *start, int size);
44#endif 44#endif
45 45
46#ifdef CONFIG_CPU_SH4 46#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
47extern void copy_to_user_page(struct vm_area_struct *vma, 47extern void copy_to_user_page(struct vm_area_struct *vma,
48 struct page *page, unsigned long vaddr, void *dst, const void *src, 48 struct page *page, unsigned long vaddr, void *dst, const void *src,
49 unsigned long len); 49 unsigned long len);
diff --git a/include/asm-x86/acpi.h b/include/asm-x86/acpi.h
index 0693689d4146..f8a89793ac8c 100644
--- a/include/asm-x86/acpi.h
+++ b/include/asm-x86/acpi.h
@@ -1,5 +1,32 @@
1#ifndef _ASM_X86_ACPI_H
2#define _ASM_X86_ACPI_H
3
1#ifdef CONFIG_X86_32 4#ifdef CONFIG_X86_32
2# include "acpi_32.h" 5# include "acpi_32.h"
3#else 6#else
4# include "acpi_64.h" 7# include "acpi_64.h"
5#endif 8#endif
9
10#include <asm/processor.h>
11
12/*
13 * Check if the CPU can handle C2 and deeper
14 */
15static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
16{
17 /*
18 * Early models (<=5) of AMD Opterons are not supposed to go into
19 * C2 state.
20 *
21 * Steppings 0x0A and later are good
22 */
23 if (boot_cpu_data.x86 == 0x0F &&
24 boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
25 boot_cpu_data.x86_model <= 0x05 &&
26 boot_cpu_data.x86_mask < 0x0A)
27 return 1;
28 else
29 return max_cstate;
30}
31
32#endif
diff --git a/include/asm-x86/apic_32.h b/include/asm-x86/apic_32.h
index 4091b33dcb10..be158b27d54b 100644
--- a/include/asm-x86/apic_32.h
+++ b/include/asm-x86/apic_32.h
@@ -120,6 +120,7 @@ extern int local_apic_timer_disabled;
120 120
121#else /* !CONFIG_X86_LOCAL_APIC */ 121#else /* !CONFIG_X86_LOCAL_APIC */
122static inline void lapic_shutdown(void) { } 122static inline void lapic_shutdown(void) { }
123#define local_apic_timer_c2_ok 1
123 124
124#endif /* !CONFIG_X86_LOCAL_APIC */ 125#endif /* !CONFIG_X86_LOCAL_APIC */
125 126
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 8ccedf7a0a5a..e3c16c981e46 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -132,6 +132,11 @@ extern unsigned long acpi_realmode_flags;
132int acpi_register_gsi (u32 gsi, int triggering, int polarity); 132int acpi_register_gsi (u32 gsi, int triggering, int polarity);
133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
134 134
135#ifdef CONFIG_X86_IO_APIC
136extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
137#else
138#define acpi_get_override_irq(bus, trigger, polarity) (-1)
139#endif
135/* 140/*
136 * This function undoes the effect of one call to acpi_register_gsi(). 141 * This function undoes the effect of one call to acpi_register_gsi().
137 * If this matches the last registration, any IRQ resources for gsi 142 * If this matches the last registration, any IRQ resources for gsi
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 16a51546db44..c4e00161a247 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -92,6 +92,7 @@ struct cpuidle_device {
92 struct kobject kobj; 92 struct kobject kobj;
93 struct completion kobj_unregister; 93 struct completion kobj_unregister;
94 void *governor_data; 94 void *governor_data;
95 struct cpuidle_state *safe_state;
95}; 96};
96 97
97DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 98DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 0f6c86c634fd..84cec2aa9f1e 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -563,11 +563,4 @@ enum {
563 ~EXT2_DIR_ROUND) 563 ~EXT2_DIR_ROUND)
564#define EXT2_MAX_REC_LEN ((1<<16)-1) 564#define EXT2_MAX_REC_LEN ((1<<16)-1)
565 565
566static inline ext2_fsblk_t
567ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
568{
569 return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
570 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
571}
572
573#endif /* _LINUX_EXT2_FS_H */ 566#endif /* _LINUX_EXT2_FS_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index d0c437028c80..5c86f1196c3a 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -16,6 +16,7 @@
16 * - add lk_flags in fuse_lk_in 16 * - add lk_flags in fuse_lk_in
17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
18 * - add blksize field to fuse_attr 18 * - add blksize field to fuse_attr
19 * - add file flags field to fuse_read_in and fuse_write_in
19 */ 20 */
20 21
21#include <asm/types.h> 22#include <asm/types.h>
@@ -280,6 +281,8 @@ struct fuse_read_in {
280 __u32 size; 281 __u32 size;
281 __u32 read_flags; 282 __u32 read_flags;
282 __u64 lock_owner; 283 __u64 lock_owner;
284 __u32 flags;
285 __u32 padding;
283}; 286};
284 287
285#define FUSE_COMPAT_WRITE_IN_SIZE 24 288#define FUSE_COMPAT_WRITE_IN_SIZE 24
@@ -290,6 +293,8 @@ struct fuse_write_in {
290 __u32 size; 293 __u32 size;
291 __u32 write_flags; 294 __u32 write_flags;
292 __u64 lock_owner; 295 __u64 lock_owner;
296 __u32 flags;
297 __u32 padding;
293}; 298};
294 299
295struct fuse_write_out { 300struct fuse_write_out {
diff --git a/include/linux/input.h b/include/linux/input.h
index b45f240a8c45..2075d6da2a31 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -530,6 +530,11 @@ struct input_absinfo {
530#define KEY_DOLLAR 0x1b2 530#define KEY_DOLLAR 0x1b2
531#define KEY_EURO 0x1b3 531#define KEY_EURO 0x1b3
532 532
533#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
534#define KEY_FRAMEFORWARD 0x1b5
535
536#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
537
533#define KEY_DEL_EOL 0x1c0 538#define KEY_DEL_EOL 0x1c0
534#define KEY_DEL_EOS 0x1c1 539#define KEY_DEL_EOS 0x1c1
535#define KEY_INS_LINE 0x1c2 540#define KEY_INS_LINE 0x1c2
diff --git a/include/linux/kd.h b/include/linux/kd.h
index c91fc0c9c495..15f2853ea58f 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -126,7 +126,7 @@ struct kbdiacrs {
126#define KDSKBDIACR 0x4B4B /* write kernel accent table */ 126#define KDSKBDIACR 0x4B4B /* write kernel accent table */
127 127
128struct kbdiacruc { 128struct kbdiacruc {
129 __u32 diacr, base, result; 129 unsigned int diacr, base, result;
130}; 130};
131struct kbdiacrsuc { 131struct kbdiacrsuc {
132 unsigned int kb_cnt; /* number of entries in following array */ 132 unsigned int kb_cnt; /* number of entries in following array */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 56a5673aebad..ef52a07c43d8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -340,6 +340,7 @@ enum {
340 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */ 340 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
341 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */ 341 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
342 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ 342 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */
343 ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */
343 344
344 /* DMA mask for user DMA control: User visible values; DO NOT 345 /* DMA mask for user DMA control: User visible values; DO NOT
345 renumber */ 346 renumber */
@@ -771,8 +772,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
771 772
772extern void sata_print_link_status(struct ata_link *link); 773extern void sata_print_link_status(struct ata_link *link);
773extern void ata_port_probe(struct ata_port *); 774extern void ata_port_probe(struct ata_port *);
774extern void __sata_phy_reset(struct ata_port *ap);
775extern void sata_phy_reset(struct ata_port *ap);
776extern void ata_bus_reset(struct ata_port *ap); 775extern void ata_bus_reset(struct ata_port *ap);
777extern int sata_set_spd(struct ata_link *link); 776extern int sata_set_spd(struct ata_link *link);
778extern int sata_link_debounce(struct ata_link *link, 777extern int sata_link_debounce(struct ata_link *link,
@@ -994,8 +993,6 @@ extern void sata_pmp_do_eh(struct ata_port *ap,
994/* 993/*
995 * EH 994 * EH
996 */ 995 */
997extern void ata_eng_timeout(struct ata_port *ap);
998
999extern void ata_port_schedule_eh(struct ata_port *ap); 996extern void ata_port_schedule_eh(struct ata_port *ap);
1000extern int ata_link_abort(struct ata_link *link); 997extern int ata_link_abort(struct ata_link *link);
1001extern int ata_port_abort(struct ata_port *ap); 998extern int ata_port_abort(struct ata_port *ap);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e82a6ebc725d..2d15d4aac094 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -422,7 +422,6 @@ extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_contr
422extern int nfs_wb_all(struct inode *inode); 422extern int nfs_wb_all(struct inode *inode);
423extern int nfs_wb_nocommit(struct inode *inode); 423extern int nfs_wb_nocommit(struct inode *inode);
424extern int nfs_wb_page(struct inode *inode, struct page* page); 424extern int nfs_wb_page(struct inode *inode, struct page* page);
425extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
426extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 425extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
427#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 426#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
428extern int nfs_commit_inode(struct inode *, int); 427extern int nfs_commit_inode(struct inode *, int);
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 664d68cb1fbd..0a0426c2867d 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -13,8 +13,8 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/mod_devicetable.h> 14#include <linux/mod_devicetable.h>
15 15
16#define PNP_MAX_PORT 8 16#define PNP_MAX_PORT 24
17#define PNP_MAX_MEM 4 17#define PNP_MAX_MEM 12
18#define PNP_MAX_IRQ 2 18#define PNP_MAX_IRQ 2
19#define PNP_MAX_DMA 2 19#define PNP_MAX_DMA 2
20#define PNP_NAME_LEN 50 20#define PNP_NAME_LEN 50
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 6d5e4a46781e..f2d0d1527721 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -133,6 +133,9 @@ struct rtc_class_ops {
133#define RTC_DEVICE_NAME_SIZE 20 133#define RTC_DEVICE_NAME_SIZE 20
134struct rtc_task; 134struct rtc_task;
135 135
136/* flags */
137#define RTC_DEV_BUSY 0
138
136struct rtc_device 139struct rtc_device
137{ 140{
138 struct device dev; 141 struct device dev;
@@ -145,7 +148,7 @@ struct rtc_device
145 struct mutex ops_lock; 148 struct mutex ops_lock;
146 149
147 struct cdev char_dev; 150 struct cdev char_dev;
148 struct mutex char_lock; 151 unsigned long flags;
149 152
150 unsigned long irq_data; 153 unsigned long irq_data;
151 spinlock_t irq_lock; 154 spinlock_t irq_lock;
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 259735044148..416e000dfe81 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -26,6 +26,16 @@
26 26
27#define SG_MAGIC 0x87654321 27#define SG_MAGIC 0x87654321
28 28
29/*
30 * We overload the LSB of the page pointer to indicate whether it's
31 * a valid sg entry, or whether it points to the start of a new scatterlist.
32 * Those low bits are there for everyone! (thanks mason :-)
33 */
34#define sg_is_chain(sg) ((sg)->page_link & 0x01)
35#define sg_is_last(sg) ((sg)->page_link & 0x02)
36#define sg_chain_ptr(sg) \
37 ((struct scatterlist *) ((sg)->page_link & ~0x03))
38
29/** 39/**
30 * sg_assign_page - Assign a given page to an SG entry 40 * sg_assign_page - Assign a given page to an SG entry
31 * @sg: SG entry 41 * @sg: SG entry
@@ -47,6 +57,7 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
47 BUG_ON((unsigned long) page & 0x03); 57 BUG_ON((unsigned long) page & 0x03);
48#ifdef CONFIG_DEBUG_SG 58#ifdef CONFIG_DEBUG_SG
49 BUG_ON(sg->sg_magic != SG_MAGIC); 59 BUG_ON(sg->sg_magic != SG_MAGIC);
60 BUG_ON(sg_is_chain(sg));
50#endif 61#endif
51 sg->page_link = page_link | (unsigned long) page; 62 sg->page_link = page_link | (unsigned long) page;
52} 63}
@@ -73,7 +84,14 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
73 sg->length = len; 84 sg->length = len;
74} 85}
75 86
76#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3)) 87static inline struct page *sg_page(struct scatterlist *sg)
88{
89#ifdef CONFIG_DEBUG_SG
90 BUG_ON(sg->sg_magic != SG_MAGIC);
91 BUG_ON(sg_is_chain(sg));
92#endif
93 return (struct page *)((sg)->page_link & ~0x3);
94}
77 95
78/** 96/**
79 * sg_set_buf - Set sg entry to point at given data 97 * sg_set_buf - Set sg entry to point at given data
@@ -88,16 +106,6 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
88 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); 106 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
89} 107}
90 108
91/*
92 * We overload the LSB of the page pointer to indicate whether it's
93 * a valid sg entry, or whether it points to the start of a new scatterlist.
94 * Those low bits are there for everyone! (thanks mason :-)
95 */
96#define sg_is_chain(sg) ((sg)->page_link & 0x01)
97#define sg_is_last(sg) ((sg)->page_link & 0x02)
98#define sg_chain_ptr(sg) \
99 ((struct scatterlist *) ((sg)->page_link & ~0x03))
100
101/** 109/**
102 * sg_next - return the next scatterlist entry in a list 110 * sg_next - return the next scatterlist entry in a list
103 * @sg: The current sg entry 111 * @sg: The current sg entry
@@ -179,6 +187,13 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
179#ifndef ARCH_HAS_SG_CHAIN 187#ifndef ARCH_HAS_SG_CHAIN
180 BUG(); 188 BUG();
181#endif 189#endif
190
191 /*
192 * offset and length are unused for chain entry. Clear them.
193 */
194 prv->offset = 0;
195 prv->length = 0;
196
182 /* 197 /*
183 * Set lowest bit to indicate a link pointer, and make sure to clear 198 * Set lowest bit to indicate a link pointer, and make sure to clear
184 * the termination bit if it happens to be set. 199 * the termination bit if it happens to be set.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ee800e7a70de..ac3d496fbd20 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -282,6 +282,10 @@ static inline void touch_all_softlockup_watchdogs(void)
282 282
283/* Attach to any functions which should be ignored in wchan output. */ 283/* Attach to any functions which should be ignored in wchan output. */
284#define __sched __attribute__((__section__(".sched.text"))) 284#define __sched __attribute__((__section__(".sched.text")))
285
286/* Linker adds these: start and end of __sched functions */
287extern char __sched_text_start[], __sched_text_end[];
288
285/* Is this address in the __sched functions? */ 289/* Is this address in the __sched functions? */
286extern int in_sched_functions(unsigned long addr); 290extern int in_sched_functions(unsigned long addr);
287 291
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 827b85bbf388..1ee2c05142f6 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -63,6 +63,8 @@ struct screen_info {
63 63
64#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ 64#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
65 65
66#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */
67
66#ifdef __KERNEL__ 68#ifdef __KERNEL__
67extern struct screen_info screen_info; 69extern struct screen_info screen_info;
68 70
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 6a5203fb9cf1..9963f81fea9a 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -437,7 +437,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
437#ifdef SUPPORT_SYSRQ 437#ifdef SUPPORT_SYSRQ
438 if (port->sysrq) { 438 if (port->sysrq) {
439 if (ch && time_before(jiffies, port->sysrq)) { 439 if (ch && time_before(jiffies, port->sysrq)) {
440 handle_sysrq(ch, port->info->tty); 440 handle_sysrq(ch, port->info ? port->info->tty : NULL);
441 port->sysrq = 0; 441 port->sysrq = 0;
442 return 1; 442 return 1;
443 } 443 }
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 91140fe8c119..bddd50bd6878 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -356,7 +356,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
356 return __alloc_skb(size, priority, 1, -1); 356 return __alloc_skb(size, priority, 1, -1);
357} 357}
358 358
359extern void kfree_skbmem(struct sk_buff *skb);
360extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 359extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
361extern struct sk_buff *skb_clone(struct sk_buff *skb, 360extern struct sk_buff *skb_clone(struct sk_buff *skb,
362 gfp_t priority); 361 gfp_t priority);
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 3347c72b848a..3912cf16361e 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -88,11 +88,6 @@ enum {
88 CTL_SLOTTABLE_TCP, 88 CTL_SLOTTABLE_TCP,
89 CTL_MIN_RESVPORT, 89 CTL_MIN_RESVPORT,
90 CTL_MAX_RESVPORT, 90 CTL_MAX_RESVPORT,
91 CTL_SLOTTABLE_RDMA,
92 CTL_RDMA_MAXINLINEREAD,
93 CTL_RDMA_MAXINLINEWRITE,
94 CTL_RDMA_WRITEPADDING,
95 CTL_RDMA_MEMREG,
96}; 91};
97 92
98#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 93#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 2c6c2c2783d8..c2a46c45c8f7 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -9,12 +9,6 @@
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12/*
13 * Socket transport setup operations
14 */
15struct rpc_xprt *xs_setup_udp(struct xprt_create *args);
16struct rpc_xprt *xs_setup_tcp(struct xprt_create *args);
17
18int init_socket_xprt(void); 12int init_socket_xprt(void);
19void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
20 14
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e99171f01b4c..4f5047df8a9e 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -70,7 +70,6 @@ enum
70 CTL_ABI=9, /* Binary emulation */ 70 CTL_ABI=9, /* Binary emulation */
71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ 71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
72 CTL_ARLAN=254, /* arlan wireless driver */ 72 CTL_ARLAN=254, /* arlan wireless driver */
73 CTL_APPLDATA=2120, /* s390 appldata */
74 CTL_S390DBF=5677, /* s390 debug */ 73 CTL_S390DBF=5677, /* s390 debug */
75 CTL_SUNRPC=7249, /* sunrpc debug */ 74 CTL_SUNRPC=7249, /* sunrpc debug */
76 CTL_PM=9899, /* frv power management */ 75 CTL_PM=9899, /* frv power management */
@@ -207,11 +206,6 @@ enum
207 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 206 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
208 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ 207 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
209 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ 208 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
210
211 /* s390 vm cmm sysctls */
212 VM_CMM_PAGES=1111,
213 VM_CMM_TIMED_PAGES=1112,
214 VM_CMM_TIMEOUT=1113,
215}; 209};
216 210
217 211
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 37ac3ff90faf..24c6a2b59511 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -137,6 +137,7 @@ struct timex {
137#define ADJ_TIMECONST 0x0020 /* pll time constant */ 137#define ADJ_TIMECONST 0x0020 /* pll time constant */
138#define ADJ_TICK 0x4000 /* tick value */ 138#define ADJ_TICK 0x4000 /* tick value */
139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
140#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
140 141
141/* xntp 3.4 compatibility names */ 142/* xntp 3.4 compatibility names */
142#define MOD_OFFSET ADJ_OFFSET 143#define MOD_OFFSET ADJ_OFFSET
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c5c8f169d3cf..416ee7617d9e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -157,6 +157,7 @@ struct usb_interface {
157 * bound to */ 157 * bound to */
158 enum usb_interface_condition condition; /* state of binding */ 158 enum usb_interface_condition condition; /* state of binding */
159 unsigned is_active:1; /* the interface is not suspended */ 159 unsigned is_active:1; /* the interface is not suspended */
160 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
160 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 161 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
161 162
162 struct device dev; /* interface specific device info */ 163 struct device dev; /* interface specific device info */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 342dd5a7e8bb..8ca5a7fbc9ec 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -102,7 +102,8 @@ struct usbdevfs_urb {
102 int start_frame; 102 int start_frame;
103 int number_of_packets; 103 int number_of_packets;
104 int error_count; 104 int error_count;
105 unsigned int signr; /* signal to be sent on error, -1 if none should be sent */ 105 unsigned int signr; /* signal to be sent on completion,
106 or 0 if none should be sent. */
106 void *usercontext; 107 void *usercontext;
107 struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 108 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
108}; 109};
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 164d13211165..d8ae48439f12 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -115,8 +115,16 @@ extern u32 ieee80211_debug_level;
115do { if (ieee80211_debug_level & (level)) \ 115do { if (ieee80211_debug_level & (level)) \
116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ 116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
117 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 117 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
118static inline bool ieee80211_ratelimit_debug(u32 level)
119{
120 return (ieee80211_debug_level & level) && net_ratelimit();
121}
118#else 122#else
119#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) 123#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
124static inline bool ieee80211_ratelimit_debug(u32 level)
125{
126 return false;
127}
120#endif /* CONFIG_IEEE80211_DEBUG */ 128#endif /* CONFIG_IEEE80211_DEBUG */
121 129
122/* escape_essid() is intended to be used in debug (and possibly error) 130/* escape_essid() is intended to be used in debug (and possibly error)
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 469216d93663..37f6cb112127 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -186,9 +186,8 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
186 if (size > PAGE_SIZE) 186 if (size > PAGE_SIZE)
187 vfree(hashinfo->ehash_locks); 187 vfree(hashinfo->ehash_locks);
188 else 188 else
189#else
190 kfree(hashinfo->ehash_locks);
191#endif 189#endif
190 kfree(hashinfo->ehash_locks);
192 hashinfo->ehash_locks = NULL; 191 hashinfo->ehash_locks = NULL;
193 } 192 }
194} 193}
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 67ea2c0c0ab7..8a7d59be8a0d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -328,40 +328,6 @@ extern int ip_vs_get_debug_level(void);
328#define FTPDATA __constant_htons(20) 328#define FTPDATA __constant_htons(20)
329 329
330/* 330/*
331 * IPVS sysctl variables under the /proc/sys/net/ipv4/vs/
332 */
333#define NET_IPV4_VS 21
334
335enum {
336 NET_IPV4_VS_DEBUG_LEVEL=1,
337 NET_IPV4_VS_AMEMTHRESH=2,
338 NET_IPV4_VS_AMDROPRATE=3,
339 NET_IPV4_VS_DROP_ENTRY=4,
340 NET_IPV4_VS_DROP_PACKET=5,
341 NET_IPV4_VS_SECURE_TCP=6,
342 NET_IPV4_VS_TO_ES=7,
343 NET_IPV4_VS_TO_SS=8,
344 NET_IPV4_VS_TO_SR=9,
345 NET_IPV4_VS_TO_FW=10,
346 NET_IPV4_VS_TO_TW=11,
347 NET_IPV4_VS_TO_CL=12,
348 NET_IPV4_VS_TO_CW=13,
349 NET_IPV4_VS_TO_LA=14,
350 NET_IPV4_VS_TO_LI=15,
351 NET_IPV4_VS_TO_SA=16,
352 NET_IPV4_VS_TO_UDP=17,
353 NET_IPV4_VS_TO_ICMP=18,
354 NET_IPV4_VS_LBLC_EXPIRE=19,
355 NET_IPV4_VS_LBLCR_EXPIRE=20,
356 NET_IPV4_VS_CACHE_BYPASS=22,
357 NET_IPV4_VS_EXPIRE_NODEST_CONN=23,
358 NET_IPV4_VS_SYNC_THRESHOLD=24,
359 NET_IPV4_VS_NAT_ICMP_SEND=25,
360 NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE=26,
361 NET_IPV4_VS_LAST
362};
363
364/*
365 * TCP State Values 331 * TCP State Values
366 */ 332 */
367enum { 333enum {
diff --git a/include/net/sock.h b/include/net/sock.h
index 567e468d7492..67e35c7e230c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1236,6 +1236,9 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1236{ 1236{
1237 struct sk_buff *skb; 1237 struct sk_buff *skb;
1238 1238
1239 /* The TCP header must be at least 32-bit aligned. */
1240 size = ALIGN(size, 4);
1241
1239 skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); 1242 skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
1240 if (skb) { 1243 if (skb) {
1241 skb->truesize += mem; 1244 skb->truesize += mem;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d695cea7730d..cb5b033e0e59 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1288,6 +1288,9 @@ static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1288 struct sock *sk) 1288 struct sock *sk)
1289{ 1289{
1290 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); 1290 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
1291
1292 if (sk->sk_send_head == skb)
1293 sk->sk_send_head = new;
1291} 1294}
1292 1295
1293static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk) 1296static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
diff --git a/include/sound/version.h b/include/sound/version.h
index a2be8ad8894b..a9781eb0da09 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.15" 2#define CONFIG_SND_VERSION "1.0.15"
3#define CONFIG_SND_DATE " (Tue Oct 23 06:09:18 2007 UTC)" 3#define CONFIG_SND_DATE " (Tue Nov 20 19:16:42 2007 UTC)"
diff --git a/init/Kconfig b/init/Kconfig
index c5b354b1409e..d35e44f4dd6b 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -438,7 +438,7 @@ menuconfig EMBEDDED
438 438
439config UID16 439config UID16
440 bool "Enable 16-bit UID system calls" if EMBEDDED 440 bool "Enable 16-bit UID system calls" if EMBEDDED
441 depends on ARM || BFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && SPARC32_COMPAT) || UML || (X86_64 && IA32_EMULATION) 441 depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && SPARC32_COMPAT) || UML || (X86_64 && IA32_EMULATION)
442 default y 442 default y
443 help 443 help
444 This enables the legacy 16-bit UID syscall wrappers. 444 This enables the legacy 16-bit UID syscall wrappers.
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 1e04cd464af9..6ca7b97114f3 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1138,8 +1138,10 @@ asmlinkage long sys_mq_getsetattr(mqd_t mqdes,
1138 omqstat.mq_flags = filp->f_flags & O_NONBLOCK; 1138 omqstat.mq_flags = filp->f_flags & O_NONBLOCK;
1139 if (u_mqstat) { 1139 if (u_mqstat) {
1140 ret = audit_mq_getsetattr(mqdes, &mqstat); 1140 ret = audit_mq_getsetattr(mqdes, &mqstat);
1141 if (ret != 0) 1141 if (ret != 0) {
1142 goto out; 1142 spin_unlock(&info->lock);
1143 goto out_fput;
1144 }
1143 if (mqstat.mq_flags & O_NONBLOCK) 1145 if (mqstat.mq_flags & O_NONBLOCK)
1144 filp->f_flags |= O_NONBLOCK; 1146 filp->f_flags |= O_NONBLOCK;
1145 else 1147 else
diff --git a/kernel/acct.c b/kernel/acct.c
index fce53d8df8a7..cf19547cc9e4 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -413,7 +413,7 @@ static u32 encode_float(u64 value)
413 * The acct_process() call is the workhorse of the process 413 * The acct_process() call is the workhorse of the process
414 * accounting system. The struct acct is built here and then written 414 * accounting system. The struct acct is built here and then written
415 * into the accounting file. This function should only be called from 415 * into the accounting file. This function should only be called from
416 * do_exit(). 416 * do_exit() or when switching to a different output file.
417 */ 417 */
418 418
419/* 419/*
diff --git a/kernel/exit.c b/kernel/exit.c
index cd0f1d4137a7..549c0558ba68 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1357,7 +1357,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1357 int __user *stat_addr, struct rusage __user *ru) 1357 int __user *stat_addr, struct rusage __user *ru)
1358{ 1358{
1359 int retval, exit_code; 1359 int retval, exit_code;
1360 struct pid_namespace *ns; 1360 pid_t pid;
1361 1361
1362 if (!p->exit_code) 1362 if (!p->exit_code)
1363 return 0; 1363 return 0;
@@ -1376,12 +1376,11 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1376 * keep holding onto the tasklist_lock while we call getrusage and 1376 * keep holding onto the tasklist_lock while we call getrusage and
1377 * possibly take page faults for user memory. 1377 * possibly take page faults for user memory.
1378 */ 1378 */
1379 ns = current->nsproxy->pid_ns; 1379 pid = task_pid_nr_ns(p, current->nsproxy->pid_ns);
1380 get_task_struct(p); 1380 get_task_struct(p);
1381 read_unlock(&tasklist_lock); 1381 read_unlock(&tasklist_lock);
1382 1382
1383 if (unlikely(noreap)) { 1383 if (unlikely(noreap)) {
1384 pid_t pid = task_pid_nr_ns(p, ns);
1385 uid_t uid = p->uid; 1384 uid_t uid = p->uid;
1386 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; 1385 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
1387 1386
@@ -1389,7 +1388,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1389 if (unlikely(!exit_code) || unlikely(p->exit_state)) 1388 if (unlikely(!exit_code) || unlikely(p->exit_state))
1390 goto bail_ref; 1389 goto bail_ref;
1391 return wait_noreap_copyout(p, pid, uid, 1390 return wait_noreap_copyout(p, pid, uid,
1392 why, (exit_code << 8) | 0x7f, 1391 why, exit_code,
1393 infop, ru); 1392 infop, ru);
1394 } 1393 }
1395 1394
@@ -1451,11 +1450,11 @@ bail_ref:
1451 if (!retval && infop) 1450 if (!retval && infop)
1452 retval = put_user(exit_code, &infop->si_status); 1451 retval = put_user(exit_code, &infop->si_status);
1453 if (!retval && infop) 1452 if (!retval && infop)
1454 retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid); 1453 retval = put_user(pid, &infop->si_pid);
1455 if (!retval && infop) 1454 if (!retval && infop)
1456 retval = put_user(p->uid, &infop->si_uid); 1455 retval = put_user(p->uid, &infop->si_uid);
1457 if (!retval) 1456 if (!retval)
1458 retval = task_pid_nr_ns(p, ns); 1457 retval = pid;
1459 put_task_struct(p); 1458 put_task_struct(p);
1460 1459
1461 BUG_ON(!retval); 1460 BUG_ON(!retval);
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 474219a41929..2fc25810509e 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -32,9 +32,14 @@
32 32
33/* These will be re-linked against their real values during the second link stage */ 33/* These will be re-linked against their real values during the second link stage */
34extern const unsigned long kallsyms_addresses[] __attribute__((weak)); 34extern const unsigned long kallsyms_addresses[] __attribute__((weak));
35extern const unsigned long kallsyms_num_syms __attribute__((weak));
36extern const u8 kallsyms_names[] __attribute__((weak)); 35extern const u8 kallsyms_names[] __attribute__((weak));
37 36
37/* tell the compiler that the count isn't in the small data section if the arch
38 * has one (eg: FRV)
39 */
40extern const unsigned long kallsyms_num_syms
41__attribute__((weak, section(".rodata")));
42
38extern const u8 kallsyms_token_table[] __attribute__((weak)); 43extern const u8 kallsyms_token_table[] __attribute__((weak));
39extern const u16 kallsyms_token_index[] __attribute__((weak)); 44extern const u16 kallsyms_token_index[] __attribute__((weak));
40 45
diff --git a/kernel/module.c b/kernel/module.c
index 3202c9950073..91fe6958b6e1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -81,7 +81,8 @@ int unregister_module_notifier(struct notifier_block * nb)
81} 81}
82EXPORT_SYMBOL(unregister_module_notifier); 82EXPORT_SYMBOL(unregister_module_notifier);
83 83
84/* We require a truly strong try_module_get() */ 84/* We require a truly strong try_module_get(): 0 means failure due to
85 ongoing or failed initialization etc. */
85static inline int strong_try_module_get(struct module *mod) 86static inline int strong_try_module_get(struct module *mod)
86{ 87{
87 if (mod && mod->state == MODULE_STATE_COMING) 88 if (mod && mod->state == MODULE_STATE_COMING)
@@ -952,7 +953,8 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
952 ret = __find_symbol(name, &owner, &crc, 953 ret = __find_symbol(name, &owner, &crc,
953 !(mod->taints & TAINT_PROPRIETARY_MODULE)); 954 !(mod->taints & TAINT_PROPRIETARY_MODULE));
954 if (ret) { 955 if (ret) {
955 /* use_module can fail due to OOM, or module unloading */ 956 /* use_module can fail due to OOM,
957 or module initialization or unloading */
956 if (!check_version(sechdrs, versindex, name, mod, crc) || 958 if (!check_version(sechdrs, versindex, name, mod, crc) ||
957 !use_module(mod, owner)) 959 !use_module(mod, owner))
958 ret = 0; 960 ret = 0;
@@ -1369,7 +1371,7 @@ dup:
1369 return ret; 1371 return ret;
1370} 1372}
1371 1373
1372/* Change all symbols so that sh_value encodes the pointer directly. */ 1374/* Change all symbols so that st_value encodes the pointer directly. */
1373static int simplify_symbols(Elf_Shdr *sechdrs, 1375static int simplify_symbols(Elf_Shdr *sechdrs,
1374 unsigned int symindex, 1376 unsigned int symindex,
1375 const char *strtab, 1377 const char *strtab,
diff --git a/kernel/sched.c b/kernel/sched.c
index 38933cafea8a..98dcdf272db3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5466,7 +5466,7 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
5466 return table; 5466 return table;
5467} 5467}
5468 5468
5469static ctl_table * sd_alloc_ctl_cpu_table(int cpu) 5469static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
5470{ 5470{
5471 struct ctl_table *entry, *table; 5471 struct ctl_table *entry, *table;
5472 struct sched_domain *sd; 5472 struct sched_domain *sd;
@@ -6708,9 +6708,6 @@ void __init sched_init_smp(void)
6708 6708
6709int in_sched_functions(unsigned long addr) 6709int in_sched_functions(unsigned long addr)
6710{ 6710{
6711 /* Linker adds these: start and end of __sched functions */
6712 extern char __sched_text_start[], __sched_text_end[];
6713
6714 return in_lock_functions(addr) || 6711 return in_lock_functions(addr) ||
6715 (addr >= (unsigned long)__sched_text_start 6712 (addr >= (unsigned long)__sched_text_start
6716 && addr < (unsigned long)__sched_text_end); 6713 && addr < (unsigned long)__sched_text_end);
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index ca198a797bfa..d30467b47ddd 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -199,7 +199,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
199 u64 now = ktime_to_ns(ktime_get()); 199 u64 now = ktime_to_ns(ktime_get());
200 int cpu; 200 int cpu;
201 201
202 SEQ_printf(m, "Sched Debug Version: v0.06-v22, %s %.*s\n", 202 SEQ_printf(m, "Sched Debug Version: v0.07, %s %.*s\n",
203 init_utsname()->release, 203 init_utsname()->release,
204 (int)strcspn(init_utsname()->version, " "), 204 (int)strcspn(init_utsname()->version, " "),
205 init_utsname()->version); 205 init_utsname()->version);
@@ -327,10 +327,12 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
327 avg_atom = -1LL; 327 avg_atom = -1LL;
328 328
329 avg_per_cpu = p->se.sum_exec_runtime; 329 avg_per_cpu = p->se.sum_exec_runtime;
330 if (p->se.nr_migrations) 330 if (p->se.nr_migrations) {
331 avg_per_cpu = div64_64(avg_per_cpu, p->se.nr_migrations); 331 avg_per_cpu = div64_64(avg_per_cpu,
332 else 332 p->se.nr_migrations);
333 } else {
333 avg_per_cpu = -1LL; 334 avg_per_cpu = -1LL;
335 }
334 336
335 __PN(avg_atom); 337 __PN(avg_atom);
336 __PN(avg_per_cpu); 338 __PN(avg_per_cpu);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index ee00da284b12..2f16e15c022c 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -22,7 +22,7 @@
22 22
23/* 23/*
24 * Targeted preemption latency for CPU-bound tasks: 24 * Targeted preemption latency for CPU-bound tasks:
25 * (default: 20ms * ilog(ncpus), units: nanoseconds) 25 * (default: 20ms * (1 + ilog(ncpus)), units: nanoseconds)
26 * 26 *
27 * NOTE: this latency value is not the same as the concept of 27 * NOTE: this latency value is not the same as the concept of
28 * 'timeslice length' - timeslices in CFS are of variable length 28 * 'timeslice length' - timeslices in CFS are of variable length
@@ -36,14 +36,14 @@ unsigned int sysctl_sched_latency = 20000000ULL;
36 36
37/* 37/*
38 * Minimal preemption granularity for CPU-bound tasks: 38 * Minimal preemption granularity for CPU-bound tasks:
39 * (default: 1 msec * ilog(ncpus), units: nanoseconds) 39 * (default: 4 msec * (1 + ilog(ncpus)), units: nanoseconds)
40 */ 40 */
41unsigned int sysctl_sched_min_granularity = 1000000ULL; 41unsigned int sysctl_sched_min_granularity = 4000000ULL;
42 42
43/* 43/*
44 * is kept at sysctl_sched_latency / sysctl_sched_min_granularity 44 * is kept at sysctl_sched_latency / sysctl_sched_min_granularity
45 */ 45 */
46static unsigned int sched_nr_latency = 20; 46static unsigned int sched_nr_latency = 5;
47 47
48/* 48/*
49 * After fork, child runs first. (default) If set to 0 then 49 * After fork, child runs first. (default) If set to 0 then
@@ -61,7 +61,7 @@ unsigned int __read_mostly sysctl_sched_compat_yield;
61 61
62/* 62/*
63 * SCHED_BATCH wake-up granularity. 63 * SCHED_BATCH wake-up granularity.
64 * (default: 10 msec * ilog(ncpus), units: nanoseconds) 64 * (default: 10 msec * (1 + ilog(ncpus)), units: nanoseconds)
65 * 65 *
66 * This option delays the preemption effects of decoupled workloads 66 * This option delays the preemption effects of decoupled workloads
67 * and reduces their over-scheduling. Synchronous workloads will still 67 * and reduces their over-scheduling. Synchronous workloads will still
@@ -71,7 +71,7 @@ unsigned int sysctl_sched_batch_wakeup_granularity = 10000000UL;
71 71
72/* 72/*
73 * SCHED_OTHER wake-up granularity. 73 * SCHED_OTHER wake-up granularity.
74 * (default: 10 msec * ilog(ncpus), units: nanoseconds) 74 * (default: 10 msec * (1 + ilog(ncpus)), units: nanoseconds)
75 * 75 *
76 * This option delays the preemption effects of decoupled workloads 76 * This option delays the preemption effects of decoupled workloads
77 * and reduces their over-scheduling. Synchronous workloads will still 77 * and reduces their over-scheduling. Synchronous workloads will still
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 630178e53bb6..5b32433e7ee5 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -52,7 +52,8 @@ static int show_schedstat(struct seq_file *seq, void *v)
52 sd->lb_nobusyq[itype], 52 sd->lb_nobusyq[itype],
53 sd->lb_nobusyg[itype]); 53 sd->lb_nobusyg[itype]);
54 } 54 }
55 seq_printf(seq, " %u %u %u %u %u %u %u %u %u %u %u %u\n", 55 seq_printf(seq,
56 " %u %u %u %u %u %u %u %u %u %u %u %u\n",
56 sd->alb_count, sd->alb_failed, sd->alb_pushed, 57 sd->alb_count, sd->alb_failed, sd->alb_pushed,
57 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed, 58 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed,
58 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed, 59 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed,
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
index 4abc6d2306f4..6972f26c65f7 100644
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -140,9 +140,6 @@ static struct trans_ctl_table trans_vm_table[] = {
140 { VM_PANIC_ON_OOM, "panic_on_oom" }, 140 { VM_PANIC_ON_OOM, "panic_on_oom" },
141 { VM_VDSO_ENABLED, "vdso_enabled" }, 141 { VM_VDSO_ENABLED, "vdso_enabled" },
142 { VM_MIN_SLAB, "min_slab_ratio" }, 142 { VM_MIN_SLAB, "min_slab_ratio" },
143 { VM_CMM_PAGES, "cmm_pages" },
144 { VM_CMM_TIMED_PAGES, "cmm_timed_pages" },
145 { VM_CMM_TIMEOUT, "cmm_timeout" },
146 143
147 {} 144 {}
148}; 145};
@@ -237,36 +234,6 @@ static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
237 {} 234 {}
238}; 235};
239 236
240
241static struct trans_ctl_table trans_net_ipv4_vs_table[] = {
242 { NET_IPV4_VS_AMEMTHRESH, "amemthresh" },
243 { NET_IPV4_VS_DEBUG_LEVEL, "debug_level" },
244 { NET_IPV4_VS_AMDROPRATE, "am_droprate" },
245 { NET_IPV4_VS_DROP_ENTRY, "drop_entry" },
246 { NET_IPV4_VS_DROP_PACKET, "drop_packet" },
247 { NET_IPV4_VS_SECURE_TCP, "secure_tcp" },
248 { NET_IPV4_VS_TO_ES, "timeout_established" },
249 { NET_IPV4_VS_TO_SS, "timeout_synsent" },
250 { NET_IPV4_VS_TO_SR, "timeout_synrecv" },
251 { NET_IPV4_VS_TO_FW, "timeout_finwait" },
252 { NET_IPV4_VS_TO_TW, "timeout_timewait" },
253 { NET_IPV4_VS_TO_CL, "timeout_close" },
254 { NET_IPV4_VS_TO_CW, "timeout_closewait" },
255 { NET_IPV4_VS_TO_LA, "timeout_lastack" },
256 { NET_IPV4_VS_TO_LI, "timeout_listen" },
257 { NET_IPV4_VS_TO_SA, "timeout_synack" },
258 { NET_IPV4_VS_TO_UDP, "timeout_udp" },
259 { NET_IPV4_VS_TO_ICMP, "timeout_icmp" },
260 { NET_IPV4_VS_CACHE_BYPASS, "cache_bypass" },
261 { NET_IPV4_VS_EXPIRE_NODEST_CONN, "expire_nodest_conn" },
262 { NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE, "expire_quiescent_template" },
263 { NET_IPV4_VS_SYNC_THRESHOLD, "sync_threshold" },
264 { NET_IPV4_VS_NAT_ICMP_SEND, "nat_icmp_send" },
265 { NET_IPV4_VS_LBLC_EXPIRE, "lblc_expiration" },
266 { NET_IPV4_VS_LBLCR_EXPIRE, "lblcr_expiration" },
267 {}
268};
269
270static struct trans_ctl_table trans_net_neigh_vars_table[] = { 237static struct trans_ctl_table trans_net_neigh_vars_table[] = {
271 { NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" }, 238 { NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" },
272 { NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" }, 239 { NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" },
@@ -341,7 +308,6 @@ static struct trans_ctl_table trans_net_ipv4_table[] = {
341 { NET_IPV4_ROUTE, "route", trans_net_ipv4_route_table }, 308 { NET_IPV4_ROUTE, "route", trans_net_ipv4_route_table },
342 /* NET_IPV4_FIB_HASH unused */ 309 /* NET_IPV4_FIB_HASH unused */
343 { NET_IPV4_NETFILTER, "netfilter", trans_net_ipv4_netfilter_table }, 310 { NET_IPV4_NETFILTER, "netfilter", trans_net_ipv4_netfilter_table },
344 { NET_IPV4_VS, "vs", trans_net_ipv4_vs_table },
345 311
346 { NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" }, 312 { NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" },
347 { NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" }, 313 { NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" },
@@ -1219,16 +1185,6 @@ static struct trans_ctl_table trans_arlan_table[] = {
1219 {} 1185 {}
1220}; 1186};
1221 1187
1222static struct trans_ctl_table trans_appldata_table[] = {
1223 { CTL_APPLDATA_TIMER, "timer" },
1224 { CTL_APPLDATA_INTERVAL, "interval" },
1225 { CTL_APPLDATA_OS, "os" },
1226 { CTL_APPLDATA_NET_SUM, "net_sum" },
1227 { CTL_APPLDATA_MEM, "mem" },
1228 {}
1229
1230};
1231
1232static struct trans_ctl_table trans_s390dbf_table[] = { 1188static struct trans_ctl_table trans_s390dbf_table[] = {
1233 { 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" }, 1189 { 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" },
1234 { 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" }, 1190 { 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" },
@@ -1273,7 +1229,6 @@ static struct trans_ctl_table trans_root_table[] = {
1273 { CTL_ABI, "abi" }, 1229 { CTL_ABI, "abi" },
1274 /* CTL_CPU not used */ 1230 /* CTL_CPU not used */
1275 { CTL_ARLAN, "arlan", trans_arlan_table }, 1231 { CTL_ARLAN, "arlan", trans_arlan_table },
1276 { CTL_APPLDATA, "appldata", trans_appldata_table },
1277 { CTL_S390DBF, "s390dbf", trans_s390dbf_table }, 1232 { CTL_S390DBF, "s390dbf", trans_s390dbf_table },
1278 { CTL_SUNRPC, "sunrpc", trans_sunrpc_table }, 1233 { CTL_SUNRPC, "sunrpc", trans_sunrpc_table },
1279 { CTL_PM, "pm", trans_pm_table }, 1234 { CTL_PM, "pm", trans_pm_table },
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 14a2ecf2b318..e64efaf957e8 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -249,10 +249,12 @@ int do_adjtimex(struct timex *txc)
249 249
250 /* Now we validate the data before disabling interrupts */ 250 /* Now we validate the data before disabling interrupts */
251 251
252 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) 252 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) {
253 /* singleshot must not be used with any other mode bits */ 253 /* singleshot must not be used with any other mode bits */
254 if (txc->modes != ADJ_OFFSET_SINGLESHOT) 254 if (txc->modes != ADJ_OFFSET_SINGLESHOT &&
255 txc->modes != ADJ_OFFSET_SS_READ)
255 return -EINVAL; 256 return -EINVAL;
257 }
256 258
257 if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET)) 259 if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET))
258 /* adjustment Offset limited to +- .512 seconds */ 260 /* adjustment Offset limited to +- .512 seconds */
@@ -372,7 +374,8 @@ int do_adjtimex(struct timex *txc)
372leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) 374leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
373 result = TIME_ERROR; 375 result = TIME_ERROR;
374 376
375 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) 377 if ((txc->modes == ADJ_OFFSET_SINGLESHOT) ||
378 (txc->modes == ADJ_OFFSET_SS_READ))
376 txc->offset = save_adjust; 379 txc->offset = save_adjust;
377 else 380 else
378 txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) * 381 txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 27a2338deb4a..cb89fa8db110 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -133,6 +133,8 @@ void tick_nohz_update_jiffies(void)
133 if (!ts->tick_stopped) 133 if (!ts->tick_stopped)
134 return; 134 return;
135 135
136 touch_softlockup_watchdog();
137
136 cpu_clear(cpu, nohz_cpu_mask); 138 cpu_clear(cpu, nohz_cpu_mask);
137 now = ktime_get(); 139 now = ktime_get();
138 140
diff --git a/kernel/user.c b/kernel/user.c
index 0f3aa0234107..8320a87f3e5a 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -337,8 +337,11 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
337 struct user_struct *new; 337 struct user_struct *new;
338 338
339 new = kmem_cache_alloc(uid_cachep, GFP_KERNEL); 339 new = kmem_cache_alloc(uid_cachep, GFP_KERNEL);
340 if (!new) 340 if (!new) {
341 uids_mutex_unlock();
341 return NULL; 342 return NULL;
343 }
344
342 new->uid = uid; 345 new->uid = uid;
343 atomic_set(&new->__count, 1); 346 atomic_set(&new->__count, 1);
344 atomic_set(&new->processes, 0); 347 atomic_set(&new->processes, 0);
@@ -355,6 +358,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
355 358
356 if (alloc_uid_keyring(new, current) < 0) { 359 if (alloc_uid_keyring(new, current) < 0) {
357 kmem_cache_free(uid_cachep, new); 360 kmem_cache_free(uid_cachep, new);
361 uids_mutex_unlock();
358 return NULL; 362 return NULL;
359 } 363 }
360 364
@@ -362,6 +366,7 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
362 key_put(new->uid_keyring); 366 key_put(new->uid_keyring);
363 key_put(new->session_keyring); 367 key_put(new->session_keyring);
364 kmem_cache_free(uid_cachep, new); 368 kmem_cache_free(uid_cachep, new);
369 uids_mutex_unlock();
365 return NULL; 370 return NULL;
366 } 371 }
367 372
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index c76c06466bfd..fe3a56c2256d 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -18,6 +18,10 @@
18static void *get_uts(ctl_table *table, int write) 18static void *get_uts(ctl_table *table, int write)
19{ 19{
20 char *which = table->data; 20 char *which = table->data;
21 struct uts_namespace *uts_ns;
22
23 uts_ns = current->nsproxy->uts_ns;
24 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
21 25
22 if (!write) 26 if (!write)
23 down_read(&uts_sem); 27 down_read(&uts_sem);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 1e5f207b9074..a60109307d32 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -359,7 +359,7 @@ config DEBUG_HIGHMEM
359config DEBUG_BUGVERBOSE 359config DEBUG_BUGVERBOSE
360 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED 360 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
361 depends on BUG 361 depends on BUG
362 depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || FRV || SUPERH || GENERIC_BUG || BFIN 362 depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || FRV || SUPERH || GENERIC_BUG || BLACKFIN
363 default !EMBEDDED 363 default !EMBEDDED
364 help 364 help
365 Say Y here to make BUG() panics output the file name and line number 365 Say Y here to make BUG() panics output the file name and line number
@@ -409,7 +409,7 @@ config DEBUG_SG
409 409
410config FRAME_POINTER 410config FRAME_POINTER
411 bool "Compile the kernel with frame pointers" 411 bool "Compile the kernel with frame pointers"
412 depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32 || SUPERH || BFIN) 412 depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32 || SUPERH || BLACKFIN)
413 default y if DEBUG_INFO && UML 413 default y if DEBUG_INFO && UML
414 help 414 help
415 If you say Y here the resulting kernel image will be slightly larger 415 If you say Y here the resulting kernel image will be slightly larger
diff --git a/lib/hexdump.c b/lib/hexdump.c
index bd5edaeaa80b..343546550dc9 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -106,7 +106,8 @@ void hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
106 while (lx < (linebuflen - 1) && lx < (ascii_column - 1)) 106 while (lx < (linebuflen - 1) && lx < (ascii_column - 1))
107 linebuf[lx++] = ' '; 107 linebuf[lx++] = ' ';
108 for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++) 108 for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++)
109 linebuf[lx++] = isprint(ptr[j]) ? ptr[j] : '.'; 109 linebuf[lx++] = (isascii(ptr[j]) && isprint(ptr[j])) ? ptr[j]
110 : '.';
110nil: 111nil:
111 linebuf[lx++] = '\0'; 112 linebuf[lx++] = '\0';
112} 113}
diff --git a/lib/kobject.c b/lib/kobject.c
index a7e3bf4d3c70..b52e9f4ef371 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -313,8 +313,8 @@ int kobject_rename(struct kobject * kobj, const char *new_name)
313 struct kobject *temp_kobj; 313 struct kobject *temp_kobj;
314 temp_kobj = kset_find_obj(kobj->kset, new_name); 314 temp_kobj = kset_find_obj(kobj->kset, new_name);
315 if (temp_kobj) { 315 if (temp_kobj) {
316 printk(KERN_WARNING "kobject '%s' can not be renamed " 316 printk(KERN_WARNING "kobject '%s' cannot be renamed "
317 "to '%s' as '%s' is already in existance.\n", 317 "to '%s' as '%s' is already in existence.\n",
318 kobject_name(kobj), new_name, new_name); 318 kobject_name(kobj), new_name, new_name);
319 kobject_put(temp_kobj); 319 kobject_put(temp_kobj);
320 return -EINVAL; 320 return -EINVAL;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 12376ae3f733..b5a58d476c1a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -305,7 +305,6 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
305{ 305{
306 int i; 306 int i;
307 307
308 VM_BUG_ON((gfp_flags & (__GFP_WAIT | __GFP_HIGHMEM)) == __GFP_HIGHMEM);
309 /* 308 /*
310 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO 309 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO
311 * and __GFP_HIGHMEM from hard or soft interrupt context. 310 * and __GFP_HIGHMEM from hard or soft interrupt context.
@@ -3266,6 +3265,16 @@ static void inline setup_usemap(struct pglist_data *pgdat,
3266#endif /* CONFIG_SPARSEMEM */ 3265#endif /* CONFIG_SPARSEMEM */
3267 3266
3268#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE 3267#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
3268
3269/* Return a sensible default order for the pageblock size. */
3270static inline int pageblock_default_order(void)
3271{
3272 if (HPAGE_SHIFT > PAGE_SHIFT)
3273 return HUGETLB_PAGE_ORDER;
3274
3275 return MAX_ORDER-1;
3276}
3277
3269/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ 3278/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */
3270static inline void __init set_pageblock_order(unsigned int order) 3279static inline void __init set_pageblock_order(unsigned int order)
3271{ 3280{
@@ -3281,7 +3290,16 @@ static inline void __init set_pageblock_order(unsigned int order)
3281} 3290}
3282#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ 3291#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
3283 3292
3284/* Defined this way to avoid accidently referencing HUGETLB_PAGE_ORDER */ 3293/*
3294 * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order()
3295 * and pageblock_default_order() are unused as pageblock_order is set
3296 * at compile-time. See include/linux/pageblock-flags.h for the values of
3297 * pageblock_order based on the kernel config
3298 */
3299static inline int pageblock_default_order(unsigned int order)
3300{
3301 return MAX_ORDER-1;
3302}
3285#define set_pageblock_order(x) do {} while (0) 3303#define set_pageblock_order(x) do {} while (0)
3286 3304
3287#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ 3305#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
@@ -3366,7 +3384,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
3366 if (!size) 3384 if (!size)
3367 continue; 3385 continue;
3368 3386
3369 set_pageblock_order(HUGETLB_PAGE_ORDER); 3387 set_pageblock_order(pageblock_default_order());
3370 setup_usemap(pgdat, zone, size); 3388 setup_usemap(pgdat, zone, size);
3371 ret = init_currently_empty_zone(zone, zone_start_pfn, 3389 ret = init_currently_empty_zone(zone, zone_start_pfn,
3372 size, MEMMAP_EARLY); 3390 size, MEMMAP_EARLY);
diff --git a/mm/rmap.c b/mm/rmap.c
index dc3be5f5b0da..dbc2ca2057a5 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -471,11 +471,12 @@ int page_mkclean(struct page *page)
471 471
472 if (page_mapped(page)) { 472 if (page_mapped(page)) {
473 struct address_space *mapping = page_mapping(page); 473 struct address_space *mapping = page_mapping(page);
474 if (mapping) 474 if (mapping) {
475 ret = page_mkclean_file(mapping, page); 475 ret = page_mkclean_file(mapping, page);
476 if (page_test_dirty(page)) { 476 if (page_test_dirty(page)) {
477 page_clear_dirty(page); 477 page_clear_dirty(page);
478 ret = 1; 478 ret = 1;
479 }
479 } 480 }
480 } 481 }
481 482
diff --git a/mm/shmem.c b/mm/shmem.c
index 253d205914ba..51b3d6ccddab 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1072,7 +1072,7 @@ shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
1072 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx); 1072 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);
1073 pvma.vm_pgoff = idx; 1073 pvma.vm_pgoff = idx;
1074 pvma.vm_end = PAGE_SIZE; 1074 pvma.vm_end = PAGE_SIZE;
1075 page = alloc_page_vma(gfp | __GFP_ZERO, &pvma, 0); 1075 page = alloc_page_vma(gfp, &pvma, 0);
1076 mpol_free(pvma.vm_policy); 1076 mpol_free(pvma.vm_policy);
1077 return page; 1077 return page;
1078} 1078}
@@ -1093,7 +1093,7 @@ shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
1093static inline struct page * 1093static inline struct page *
1094shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx) 1094shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)
1095{ 1095{
1096 return alloc_page(gfp | __GFP_ZERO); 1096 return alloc_page(gfp);
1097} 1097}
1098#endif 1098#endif
1099 1099
@@ -1306,6 +1306,7 @@ repeat:
1306 1306
1307 info->alloced++; 1307 info->alloced++;
1308 spin_unlock(&info->lock); 1308 spin_unlock(&info->lock);
1309 clear_highpage(filepage);
1309 flush_dcache_page(filepage); 1310 flush_dcache_page(filepage);
1310 SetPageUptodate(filepage); 1311 SetPageUptodate(filepage);
1311 } 1312 }
diff --git a/mm/slab.c b/mm/slab.c
index c31cd3682a0b..202465a193c1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2881,6 +2881,8 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
2881 unsigned int objnr; 2881 unsigned int objnr;
2882 struct slab *slabp; 2882 struct slab *slabp;
2883 2883
2884 BUG_ON(virt_to_cache(objp) != cachep);
2885
2884 objp -= obj_offset(cachep); 2886 objp -= obj_offset(cachep);
2885 kfree_debugcheck(objp); 2887 kfree_debugcheck(objp);
2886 page = virt_to_head_page(objp); 2888 page = virt_to_head_page(objp);
@@ -3759,8 +3761,6 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
3759{ 3761{
3760 unsigned long flags; 3762 unsigned long flags;
3761 3763
3762 BUG_ON(virt_to_cache(objp) != cachep);
3763
3764 local_irq_save(flags); 3764 local_irq_save(flags);
3765 debug_check_no_locks_freed(objp, obj_size(cachep)); 3765 debug_check_no_locks_freed(objp, obj_size(cachep));
3766 __cache_free(cachep, objp); 3766 __cache_free(cachep, objp);
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 22620f6a976b..cd75b21dd4c3 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -34,6 +34,16 @@
34 * or to back the page tables that are used to create the mapping. 34 * or to back the page tables that are used to create the mapping.
35 * Uses the main allocators if they are available, else bootmem. 35 * Uses the main allocators if they are available, else bootmem.
36 */ 36 */
37
38static void * __init_refok __earlyonly_bootmem_alloc(int node,
39 unsigned long size,
40 unsigned long align,
41 unsigned long goal)
42{
43 return __alloc_bootmem_node(NODE_DATA(node), size, align, goal);
44}
45
46
37void * __meminit vmemmap_alloc_block(unsigned long size, int node) 47void * __meminit vmemmap_alloc_block(unsigned long size, int node)
38{ 48{
39 /* If the main allocator is up use that, fallback to bootmem. */ 49 /* If the main allocator is up use that, fallback to bootmem. */
@@ -44,7 +54,7 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
44 return page_address(page); 54 return page_address(page);
45 return NULL; 55 return NULL;
46 } else 56 } else
47 return __alloc_bootmem_node(NODE_DATA(node), size, size, 57 return __earlyonly_bootmem_alloc(node, size, size,
48 __pa(MAX_DMA_ADDRESS)); 58 __pa(MAX_DMA_ADDRESS));
49} 59}
50 60
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 392d877040d3..6436d30a550e 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -187,7 +187,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
187 187
188 if (datalen != EBT_ALIGN(expected_length)) { 188 if (datalen != EBT_ALIGN(expected_length)) {
189 printk(KERN_WARNING 189 printk(KERN_WARNING
190 "ebtables: among: wrong size: %d" 190 "ebtables: among: wrong size: %d "
191 "against expected %d, rounded to %Zd\n", 191 "against expected %d, rounded to %Zd\n",
192 datalen, expected_length, 192 datalen, expected_length,
193 EBT_ALIGN(expected_length)); 193 EBT_ALIGN(expected_length));
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index de33f36947e9..285ec3ed9b37 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2463,8 +2463,6 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
2463 2463
2464 x->curlft.bytes +=skb->len; 2464 x->curlft.bytes +=skb->len;
2465 x->curlft.packets++; 2465 x->curlft.packets++;
2466 spin_unlock(&x->lock);
2467
2468error: 2466error:
2469 spin_unlock(&x->lock); 2467 spin_unlock(&x->lock);
2470 return err; 2468 return err;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 32d5826b7177..5b4ce9b4dd20 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -275,12 +275,11 @@ static void skb_release_data(struct sk_buff *skb)
275/* 275/*
276 * Free an skbuff by memory without cleaning the state. 276 * Free an skbuff by memory without cleaning the state.
277 */ 277 */
278void kfree_skbmem(struct sk_buff *skb) 278static void kfree_skbmem(struct sk_buff *skb)
279{ 279{
280 struct sk_buff *other; 280 struct sk_buff *other;
281 atomic_t *fclone_ref; 281 atomic_t *fclone_ref;
282 282
283 skb_release_data(skb);
284 switch (skb->fclone) { 283 switch (skb->fclone) {
285 case SKB_FCLONE_UNAVAILABLE: 284 case SKB_FCLONE_UNAVAILABLE:
286 kmem_cache_free(skbuff_head_cache, skb); 285 kmem_cache_free(skbuff_head_cache, skb);
@@ -307,16 +306,8 @@ void kfree_skbmem(struct sk_buff *skb)
307 } 306 }
308} 307}
309 308
310/** 309/* Free everything but the sk_buff shell. */
311 * __kfree_skb - private function 310static void skb_release_all(struct sk_buff *skb)
312 * @skb: buffer
313 *
314 * Free an sk_buff. Release anything attached to the buffer.
315 * Clean the state. This is an internal helper function. Users should
316 * always call kfree_skb
317 */
318
319void __kfree_skb(struct sk_buff *skb)
320{ 311{
321 dst_release(skb->dst); 312 dst_release(skb->dst);
322#ifdef CONFIG_XFRM 313#ifdef CONFIG_XFRM
@@ -340,7 +331,21 @@ void __kfree_skb(struct sk_buff *skb)
340 skb->tc_verd = 0; 331 skb->tc_verd = 0;
341#endif 332#endif
342#endif 333#endif
334 skb_release_data(skb);
335}
336
337/**
338 * __kfree_skb - private function
339 * @skb: buffer
340 *
341 * Free an sk_buff. Release anything attached to the buffer.
342 * Clean the state. This is an internal helper function. Users should
343 * always call kfree_skb
344 */
343 345
346void __kfree_skb(struct sk_buff *skb)
347{
348 skb_release_all(skb);
344 kfree_skbmem(skb); 349 kfree_skbmem(skb);
345} 350}
346 351
@@ -441,7 +446,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
441 */ 446 */
442struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src) 447struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src)
443{ 448{
444 skb_release_data(dst); 449 skb_release_all(dst);
445 return __skb_clone(dst, src); 450 return __skb_clone(dst, src);
446} 451}
447EXPORT_SYMBOL_GPL(skb_morph); 452EXPORT_SYMBOL_GPL(skb_morph);
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 40ad428a27f5..d26b88dbbb45 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -166,7 +166,7 @@ static u32 dccp_li_calc_first_li(struct sock *sk,
166 } 166 }
167 167
168 if (unlikely(interval == 0)) { 168 if (unlikely(interval == 0)) {
169 DCCP_WARN("%s(%p), Could not find a win_count interval > 0." 169 DCCP_WARN("%s(%p), Could not find a win_count interval > 0. "
170 "Defaulting to 1\n", dccp_role(sk), sk); 170 "Defaulting to 1\n", dccp_role(sk), sk);
171 interval = 1; 171 interval = 1;
172 } 172 }
diff --git a/net/ieee80211/ieee80211_crypt_ccmp.c b/net/ieee80211/ieee80211_crypt_ccmp.c
index c6d760d9fbbe..208bf35b5546 100644
--- a/net/ieee80211/ieee80211_crypt_ccmp.c
+++ b/net/ieee80211/ieee80211_crypt_ccmp.c
@@ -338,7 +338,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
338 pos += 8; 338 pos += 8;
339 339
340 if (ccmp_replay_check(pn, key->rx_pn)) { 340 if (ccmp_replay_check(pn, key->rx_pn)) {
341 if (net_ratelimit()) { 341 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
342 IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s " 342 IEEE80211_DEBUG_DROP("CCMP: replay detected: STA=%s "
343 "previous PN %02x%02x%02x%02x%02x%02x " 343 "previous PN %02x%02x%02x%02x%02x%02x "
344 "received PN %02x%02x%02x%02x%02x%02x\n", 344 "received PN %02x%02x%02x%02x%02x%02x\n",
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 58b22619ab15..8e146949fc6f 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -464,7 +464,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
464 pos += 8; 464 pos += 8;
465 465
466 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { 466 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) {
467 if (net_ratelimit()) { 467 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
468 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s" 468 IEEE80211_DEBUG_DROP("TKIP: replay detected: STA=%s"
469 " previous TSC %08x%04x received TSC " 469 " previous TSC %08x%04x received TSC "
470 "%08x%04x\n", print_mac(mac, hdr->addr2), 470 "%08x%04x\n", print_mac(mac, hdr->addr2),
@@ -504,7 +504,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
504 * it needs to be recalculated for the next packet. */ 504 * it needs to be recalculated for the next packet. */
505 tkey->rx_phase1_done = 0; 505 tkey->rx_phase1_done = 0;
506 } 506 }
507 if (net_ratelimit()) { 507 if (ieee80211_ratelimit_debug(IEEE80211_DL_DROP)) {
508 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA=" 508 IEEE80211_DEBUG_DROP("TKIP: ICV error detected: STA="
509 "%s\n", print_mac(mac, hdr->addr2)); 509 "%s\n", print_mac(mac, hdr->addr2));
510 } 510 }
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 36d6798947b5..b3f366a33a5c 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -111,12 +111,8 @@
111#include <net/tcp.h> 111#include <net/tcp.h>
112#include <net/sock.h> 112#include <net/sock.h>
113#include <net/arp.h> 113#include <net/arp.h>
114#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
115#include <net/ax25.h> 114#include <net/ax25.h>
116#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
117#include <net/netrom.h> 115#include <net/netrom.h>
118#endif
119#endif
120#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE) 116#if defined(CONFIG_ATM_CLIP) || defined(CONFIG_ATM_CLIP_MODULE)
121#include <net/atmclip.h> 117#include <net/atmclip.h>
122struct neigh_table *clip_tbl_hook; 118struct neigh_table *clip_tbl_hook;
@@ -731,20 +727,10 @@ static int arp_process(struct sk_buff *skb)
731 htons(dev_type) != arp->ar_hrd) 727 htons(dev_type) != arp->ar_hrd)
732 goto out; 728 goto out;
733 break; 729 break;
734#ifdef CONFIG_NET_ETHERNET
735 case ARPHRD_ETHER: 730 case ARPHRD_ETHER:
736#endif
737#ifdef CONFIG_TR
738 case ARPHRD_IEEE802_TR: 731 case ARPHRD_IEEE802_TR:
739#endif
740#ifdef CONFIG_FDDI
741 case ARPHRD_FDDI: 732 case ARPHRD_FDDI:
742#endif
743#ifdef CONFIG_NET_FC
744 case ARPHRD_IEEE802: 733 case ARPHRD_IEEE802:
745#endif
746#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_TR) || \
747 defined(CONFIG_FDDI) || defined(CONFIG_NET_FC)
748 /* 734 /*
749 * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802 735 * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802
750 * devices, according to RFC 2625) devices will accept ARP 736 * devices, according to RFC 2625) devices will accept ARP
@@ -759,21 +745,16 @@ static int arp_process(struct sk_buff *skb)
759 arp->ar_pro != htons(ETH_P_IP)) 745 arp->ar_pro != htons(ETH_P_IP))
760 goto out; 746 goto out;
761 break; 747 break;
762#endif
763#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
764 case ARPHRD_AX25: 748 case ARPHRD_AX25:
765 if (arp->ar_pro != htons(AX25_P_IP) || 749 if (arp->ar_pro != htons(AX25_P_IP) ||
766 arp->ar_hrd != htons(ARPHRD_AX25)) 750 arp->ar_hrd != htons(ARPHRD_AX25))
767 goto out; 751 goto out;
768 break; 752 break;
769#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
770 case ARPHRD_NETROM: 753 case ARPHRD_NETROM:
771 if (arp->ar_pro != htons(AX25_P_IP) || 754 if (arp->ar_pro != htons(AX25_P_IP) ||
772 arp->ar_hrd != htons(ARPHRD_NETROM)) 755 arp->ar_hrd != htons(ARPHRD_NETROM))
773 goto out; 756 goto out;
774 break; 757 break;
775#endif
776#endif
777 } 758 }
778 759
779 /* Understand only these message types */ 760 /* Understand only these message types */
@@ -828,7 +809,8 @@ static int arp_process(struct sk_buff *skb)
828 if (arp->ar_op == htons(ARPOP_REQUEST) && 809 if (arp->ar_op == htons(ARPOP_REQUEST) &&
829 inet_addr_type(tip) == RTN_LOCAL && 810 inet_addr_type(tip) == RTN_LOCAL &&
830 !arp_ignore(in_dev,dev,sip,tip)) 811 !arp_ignore(in_dev,dev,sip,tip))
831 arp_send(ARPOP_REPLY,ETH_P_ARP,tip,dev,tip,sha,dev->dev_addr,dev->dev_addr); 812 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
813 dev->dev_addr, sha);
832 goto out; 814 goto out;
833 } 815 }
834 816
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
index 20c884a57721..8fba20256f52 100644
--- a/net/ipv4/ipvs/ip_vs_core.c
+++ b/net/ipv4/ipvs/ip_vs_core.c
@@ -637,7 +637,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related)
637 verdict = NF_DROP; 637 verdict = NF_DROP;
638 638
639 if (IP_VS_FWD_METHOD(cp) != 0) { 639 if (IP_VS_FWD_METHOD(cp) != 0) {
640 IP_VS_ERR("shouldn't reach here, because the box is on the" 640 IP_VS_ERR("shouldn't reach here, because the box is on the "
641 "half connection in the tun/dr module.\n"); 641 "half connection in the tun/dr module.\n");
642 } 642 }
643 643
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index b64cf45a9ead..693d92490c11 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -1424,7 +1424,6 @@ proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
1424 1424
1425static struct ctl_table vs_vars[] = { 1425static struct ctl_table vs_vars[] = {
1426 { 1426 {
1427 .ctl_name = NET_IPV4_VS_AMEMTHRESH,
1428 .procname = "amemthresh", 1427 .procname = "amemthresh",
1429 .data = &sysctl_ip_vs_amemthresh, 1428 .data = &sysctl_ip_vs_amemthresh,
1430 .maxlen = sizeof(int), 1429 .maxlen = sizeof(int),
@@ -1433,7 +1432,6 @@ static struct ctl_table vs_vars[] = {
1433 }, 1432 },
1434#ifdef CONFIG_IP_VS_DEBUG 1433#ifdef CONFIG_IP_VS_DEBUG
1435 { 1434 {
1436 .ctl_name = NET_IPV4_VS_DEBUG_LEVEL,
1437 .procname = "debug_level", 1435 .procname = "debug_level",
1438 .data = &sysctl_ip_vs_debug_level, 1436 .data = &sysctl_ip_vs_debug_level,
1439 .maxlen = sizeof(int), 1437 .maxlen = sizeof(int),
@@ -1442,7 +1440,6 @@ static struct ctl_table vs_vars[] = {
1442 }, 1440 },
1443#endif 1441#endif
1444 { 1442 {
1445 .ctl_name = NET_IPV4_VS_AMDROPRATE,
1446 .procname = "am_droprate", 1443 .procname = "am_droprate",
1447 .data = &sysctl_ip_vs_am_droprate, 1444 .data = &sysctl_ip_vs_am_droprate,
1448 .maxlen = sizeof(int), 1445 .maxlen = sizeof(int),
@@ -1450,7 +1447,6 @@ static struct ctl_table vs_vars[] = {
1450 .proc_handler = &proc_dointvec, 1447 .proc_handler = &proc_dointvec,
1451 }, 1448 },
1452 { 1449 {
1453 .ctl_name = NET_IPV4_VS_DROP_ENTRY,
1454 .procname = "drop_entry", 1450 .procname = "drop_entry",
1455 .data = &sysctl_ip_vs_drop_entry, 1451 .data = &sysctl_ip_vs_drop_entry,
1456 .maxlen = sizeof(int), 1452 .maxlen = sizeof(int),
@@ -1458,7 +1454,6 @@ static struct ctl_table vs_vars[] = {
1458 .proc_handler = &proc_do_defense_mode, 1454 .proc_handler = &proc_do_defense_mode,
1459 }, 1455 },
1460 { 1456 {
1461 .ctl_name = NET_IPV4_VS_DROP_PACKET,
1462 .procname = "drop_packet", 1457 .procname = "drop_packet",
1463 .data = &sysctl_ip_vs_drop_packet, 1458 .data = &sysctl_ip_vs_drop_packet,
1464 .maxlen = sizeof(int), 1459 .maxlen = sizeof(int),
@@ -1466,7 +1461,6 @@ static struct ctl_table vs_vars[] = {
1466 .proc_handler = &proc_do_defense_mode, 1461 .proc_handler = &proc_do_defense_mode,
1467 }, 1462 },
1468 { 1463 {
1469 .ctl_name = NET_IPV4_VS_SECURE_TCP,
1470 .procname = "secure_tcp", 1464 .procname = "secure_tcp",
1471 .data = &sysctl_ip_vs_secure_tcp, 1465 .data = &sysctl_ip_vs_secure_tcp,
1472 .maxlen = sizeof(int), 1466 .maxlen = sizeof(int),
@@ -1475,7 +1469,6 @@ static struct ctl_table vs_vars[] = {
1475 }, 1469 },
1476#if 0 1470#if 0
1477 { 1471 {
1478 .ctl_name = NET_IPV4_VS_TO_ES,
1479 .procname = "timeout_established", 1472 .procname = "timeout_established",
1480 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED], 1473 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ESTABLISHED],
1481 .maxlen = sizeof(int), 1474 .maxlen = sizeof(int),
@@ -1483,7 +1476,6 @@ static struct ctl_table vs_vars[] = {
1483 .proc_handler = &proc_dointvec_jiffies, 1476 .proc_handler = &proc_dointvec_jiffies,
1484 }, 1477 },
1485 { 1478 {
1486 .ctl_name = NET_IPV4_VS_TO_SS,
1487 .procname = "timeout_synsent", 1479 .procname = "timeout_synsent",
1488 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT], 1480 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_SENT],
1489 .maxlen = sizeof(int), 1481 .maxlen = sizeof(int),
@@ -1491,7 +1483,6 @@ static struct ctl_table vs_vars[] = {
1491 .proc_handler = &proc_dointvec_jiffies, 1483 .proc_handler = &proc_dointvec_jiffies,
1492 }, 1484 },
1493 { 1485 {
1494 .ctl_name = NET_IPV4_VS_TO_SR,
1495 .procname = "timeout_synrecv", 1486 .procname = "timeout_synrecv",
1496 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV], 1487 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYN_RECV],
1497 .maxlen = sizeof(int), 1488 .maxlen = sizeof(int),
@@ -1499,7 +1490,6 @@ static struct ctl_table vs_vars[] = {
1499 .proc_handler = &proc_dointvec_jiffies, 1490 .proc_handler = &proc_dointvec_jiffies,
1500 }, 1491 },
1501 { 1492 {
1502 .ctl_name = NET_IPV4_VS_TO_FW,
1503 .procname = "timeout_finwait", 1493 .procname = "timeout_finwait",
1504 .data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT], 1494 .data = &vs_timeout_table_dos.timeout[IP_VS_S_FIN_WAIT],
1505 .maxlen = sizeof(int), 1495 .maxlen = sizeof(int),
@@ -1507,7 +1497,6 @@ static struct ctl_table vs_vars[] = {
1507 .proc_handler = &proc_dointvec_jiffies, 1497 .proc_handler = &proc_dointvec_jiffies,
1508 }, 1498 },
1509 { 1499 {
1510 .ctl_name = NET_IPV4_VS_TO_TW,
1511 .procname = "timeout_timewait", 1500 .procname = "timeout_timewait",
1512 .data = &vs_timeout_table_dos.timeout[IP_VS_S_TIME_WAIT], 1501 .data = &vs_timeout_table_dos.timeout[IP_VS_S_TIME_WAIT],
1513 .maxlen = sizeof(int), 1502 .maxlen = sizeof(int),
@@ -1515,7 +1504,6 @@ static struct ctl_table vs_vars[] = {
1515 .proc_handler = &proc_dointvec_jiffies, 1504 .proc_handler = &proc_dointvec_jiffies,
1516 }, 1505 },
1517 { 1506 {
1518 .ctl_name = NET_IPV4_VS_TO_CL,
1519 .procname = "timeout_close", 1507 .procname = "timeout_close",
1520 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE], 1508 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE],
1521 .maxlen = sizeof(int), 1509 .maxlen = sizeof(int),
@@ -1523,7 +1511,6 @@ static struct ctl_table vs_vars[] = {
1523 .proc_handler = &proc_dointvec_jiffies, 1511 .proc_handler = &proc_dointvec_jiffies,
1524 }, 1512 },
1525 { 1513 {
1526 .ctl_name = NET_IPV4_VS_TO_CW,
1527 .procname = "timeout_closewait", 1514 .procname = "timeout_closewait",
1528 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT], 1515 .data = &vs_timeout_table_dos.timeout[IP_VS_S_CLOSE_WAIT],
1529 .maxlen = sizeof(int), 1516 .maxlen = sizeof(int),
@@ -1531,7 +1518,6 @@ static struct ctl_table vs_vars[] = {
1531 .proc_handler = &proc_dointvec_jiffies, 1518 .proc_handler = &proc_dointvec_jiffies,
1532 }, 1519 },
1533 { 1520 {
1534 .ctl_name = NET_IPV4_VS_TO_LA,
1535 .procname = "timeout_lastack", 1521 .procname = "timeout_lastack",
1536 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK], 1522 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LAST_ACK],
1537 .maxlen = sizeof(int), 1523 .maxlen = sizeof(int),
@@ -1539,7 +1525,6 @@ static struct ctl_table vs_vars[] = {
1539 .proc_handler = &proc_dointvec_jiffies, 1525 .proc_handler = &proc_dointvec_jiffies,
1540 }, 1526 },
1541 { 1527 {
1542 .ctl_name = NET_IPV4_VS_TO_LI,
1543 .procname = "timeout_listen", 1528 .procname = "timeout_listen",
1544 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN], 1529 .data = &vs_timeout_table_dos.timeout[IP_VS_S_LISTEN],
1545 .maxlen = sizeof(int), 1530 .maxlen = sizeof(int),
@@ -1547,7 +1532,6 @@ static struct ctl_table vs_vars[] = {
1547 .proc_handler = &proc_dointvec_jiffies, 1532 .proc_handler = &proc_dointvec_jiffies,
1548 }, 1533 },
1549 { 1534 {
1550 .ctl_name = NET_IPV4_VS_TO_SA,
1551 .procname = "timeout_synack", 1535 .procname = "timeout_synack",
1552 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK], 1536 .data = &vs_timeout_table_dos.timeout[IP_VS_S_SYNACK],
1553 .maxlen = sizeof(int), 1537 .maxlen = sizeof(int),
@@ -1555,7 +1539,6 @@ static struct ctl_table vs_vars[] = {
1555 .proc_handler = &proc_dointvec_jiffies, 1539 .proc_handler = &proc_dointvec_jiffies,
1556 }, 1540 },
1557 { 1541 {
1558 .ctl_name = NET_IPV4_VS_TO_UDP,
1559 .procname = "timeout_udp", 1542 .procname = "timeout_udp",
1560 .data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP], 1543 .data = &vs_timeout_table_dos.timeout[IP_VS_S_UDP],
1561 .maxlen = sizeof(int), 1544 .maxlen = sizeof(int),
@@ -1563,7 +1546,6 @@ static struct ctl_table vs_vars[] = {
1563 .proc_handler = &proc_dointvec_jiffies, 1546 .proc_handler = &proc_dointvec_jiffies,
1564 }, 1547 },
1565 { 1548 {
1566 .ctl_name = NET_IPV4_VS_TO_ICMP,
1567 .procname = "timeout_icmp", 1549 .procname = "timeout_icmp",
1568 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ICMP], 1550 .data = &vs_timeout_table_dos.timeout[IP_VS_S_ICMP],
1569 .maxlen = sizeof(int), 1551 .maxlen = sizeof(int),
@@ -1572,7 +1554,6 @@ static struct ctl_table vs_vars[] = {
1572 }, 1554 },
1573#endif 1555#endif
1574 { 1556 {
1575 .ctl_name = NET_IPV4_VS_CACHE_BYPASS,
1576 .procname = "cache_bypass", 1557 .procname = "cache_bypass",
1577 .data = &sysctl_ip_vs_cache_bypass, 1558 .data = &sysctl_ip_vs_cache_bypass,
1578 .maxlen = sizeof(int), 1559 .maxlen = sizeof(int),
@@ -1580,7 +1561,6 @@ static struct ctl_table vs_vars[] = {
1580 .proc_handler = &proc_dointvec, 1561 .proc_handler = &proc_dointvec,
1581 }, 1562 },
1582 { 1563 {
1583 .ctl_name = NET_IPV4_VS_EXPIRE_NODEST_CONN,
1584 .procname = "expire_nodest_conn", 1564 .procname = "expire_nodest_conn",
1585 .data = &sysctl_ip_vs_expire_nodest_conn, 1565 .data = &sysctl_ip_vs_expire_nodest_conn,
1586 .maxlen = sizeof(int), 1566 .maxlen = sizeof(int),
@@ -1588,7 +1568,6 @@ static struct ctl_table vs_vars[] = {
1588 .proc_handler = &proc_dointvec, 1568 .proc_handler = &proc_dointvec,
1589 }, 1569 },
1590 { 1570 {
1591 .ctl_name = NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE,
1592 .procname = "expire_quiescent_template", 1571 .procname = "expire_quiescent_template",
1593 .data = &sysctl_ip_vs_expire_quiescent_template, 1572 .data = &sysctl_ip_vs_expire_quiescent_template,
1594 .maxlen = sizeof(int), 1573 .maxlen = sizeof(int),
@@ -1596,7 +1575,6 @@ static struct ctl_table vs_vars[] = {
1596 .proc_handler = &proc_dointvec, 1575 .proc_handler = &proc_dointvec,
1597 }, 1576 },
1598 { 1577 {
1599 .ctl_name = NET_IPV4_VS_SYNC_THRESHOLD,
1600 .procname = "sync_threshold", 1578 .procname = "sync_threshold",
1601 .data = &sysctl_ip_vs_sync_threshold, 1579 .data = &sysctl_ip_vs_sync_threshold,
1602 .maxlen = sizeof(sysctl_ip_vs_sync_threshold), 1580 .maxlen = sizeof(sysctl_ip_vs_sync_threshold),
@@ -1604,7 +1582,6 @@ static struct ctl_table vs_vars[] = {
1604 .proc_handler = &proc_do_sync_threshold, 1582 .proc_handler = &proc_do_sync_threshold,
1605 }, 1583 },
1606 { 1584 {
1607 .ctl_name = NET_IPV4_VS_NAT_ICMP_SEND,
1608 .procname = "nat_icmp_send", 1585 .procname = "nat_icmp_send",
1609 .data = &sysctl_ip_vs_nat_icmp_send, 1586 .data = &sysctl_ip_vs_nat_icmp_send,
1610 .maxlen = sizeof(int), 1587 .maxlen = sizeof(int),
@@ -1616,7 +1593,6 @@ static struct ctl_table vs_vars[] = {
1616 1593
1617static ctl_table vs_table[] = { 1594static ctl_table vs_table[] = {
1618 { 1595 {
1619 .ctl_name = NET_IPV4_VS,
1620 .procname = "vs", 1596 .procname = "vs",
1621 .mode = 0555, 1597 .mode = 0555,
1622 .child = vs_vars 1598 .child = vs_vars
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c
index 052f4ed59174..b843a11d7cf7 100644
--- a/net/ipv4/ipvs/ip_vs_lblc.c
+++ b/net/ipv4/ipvs/ip_vs_lblc.c
@@ -114,7 +114,6 @@ struct ip_vs_lblc_table {
114 114
115static ctl_table vs_vars_table[] = { 115static ctl_table vs_vars_table[] = {
116 { 116 {
117 .ctl_name = NET_IPV4_VS_LBLC_EXPIRE,
118 .procname = "lblc_expiration", 117 .procname = "lblc_expiration",
119 .data = &sysctl_ip_vs_lblc_expiration, 118 .data = &sysctl_ip_vs_lblc_expiration,
120 .maxlen = sizeof(int), 119 .maxlen = sizeof(int),
@@ -126,7 +125,6 @@ static ctl_table vs_vars_table[] = {
126 125
127static ctl_table vs_table[] = { 126static ctl_table vs_table[] = {
128 { 127 {
129 .ctl_name = NET_IPV4_VS,
130 .procname = "vs", 128 .procname = "vs",
131 .mode = 0555, 129 .mode = 0555,
132 .child = vs_vars_table 130 .child = vs_vars_table
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index 427b593c1069..e5b323a6b2f7 100644
--- a/net/ipv4/ipvs/ip_vs_lblcr.c
+++ b/net/ipv4/ipvs/ip_vs_lblcr.c
@@ -302,7 +302,6 @@ struct ip_vs_lblcr_table {
302 302
303static ctl_table vs_vars_table[] = { 303static ctl_table vs_vars_table[] = {
304 { 304 {
305 .ctl_name = NET_IPV4_VS_LBLCR_EXPIRE,
306 .procname = "lblcr_expiration", 305 .procname = "lblcr_expiration",
307 .data = &sysctl_ip_vs_lblcr_expiration, 306 .data = &sysctl_ip_vs_lblcr_expiration,
308 .maxlen = sizeof(int), 307 .maxlen = sizeof(int),
@@ -314,7 +313,6 @@ static ctl_table vs_vars_table[] = {
314 313
315static ctl_table vs_table[] = { 314static ctl_table vs_table[] = {
316 { 315 {
317 .ctl_name = NET_IPV4_VS,
318 .procname = "vs", 316 .procname = "vs",
319 .mode = 0555, 317 .mode = 0555,
320 .child = vs_vars_table 318 .child = vs_vars_table
diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c
index e844ddb82b9a..c0e11ec8f0f9 100644
--- a/net/ipv4/ipvs/ip_vs_proto.c
+++ b/net/ipv4/ipvs/ip_vs_proto.c
@@ -45,7 +45,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE];
45/* 45/*
46 * register an ipvs protocol 46 * register an ipvs protocol
47 */ 47 */
48static int register_ip_vs_protocol(struct ip_vs_protocol *pp) 48static int __used register_ip_vs_protocol(struct ip_vs_protocol *pp)
49{ 49{
50 unsigned hash = IP_VS_PROTO_HASH(pp->protocol); 50 unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
51 51
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index 5de6e57ac55c..f8678651250f 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -66,7 +66,7 @@ ipt_local_hook(unsigned int hook,
66 if (skb->len < sizeof(struct iphdr) || 66 if (skb->len < sizeof(struct iphdr) ||
67 ip_hdrlen(skb) < sizeof(struct iphdr)) { 67 ip_hdrlen(skb) < sizeof(struct iphdr)) {
68 if (net_ratelimit()) 68 if (net_ratelimit())
69 printk("iptable_raw: ignoring short SOCK_RAW" 69 printk("iptable_raw: ignoring short SOCK_RAW "
70 "packet.\n"); 70 "packet.\n");
71 return NF_ACCEPT; 71 return NF_ACCEPT;
72 } 72 }
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 70e7997ea284..86b465b176ba 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -607,13 +607,10 @@ static void nf_nat_move_storage(struct nf_conn *conntrack, void *old)
607 struct nf_conn_nat *new_nat = nf_ct_ext_find(conntrack, NF_CT_EXT_NAT); 607 struct nf_conn_nat *new_nat = nf_ct_ext_find(conntrack, NF_CT_EXT_NAT);
608 struct nf_conn_nat *old_nat = (struct nf_conn_nat *)old; 608 struct nf_conn_nat *old_nat = (struct nf_conn_nat *)old;
609 struct nf_conn *ct = old_nat->ct; 609 struct nf_conn *ct = old_nat->ct;
610 unsigned int srchash;
611 610
612 if (!(ct->status & IPS_NAT_DONE_MASK)) 611 if (!ct || !(ct->status & IPS_NAT_DONE_MASK))
613 return; 612 return;
614 613
615 srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
616
617 write_lock_bh(&nf_nat_lock); 614 write_lock_bh(&nf_nat_lock);
618 hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); 615 hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
619 new_nat->ct = ct; 616 new_nat->ct = ct;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1bff9ed349ff..c426dec6d579 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2888,18 +2888,14 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset,
2888 offset /= sizeof(u32); 2888 offset /= sizeof(u32);
2889 2889
2890 if (length > 0) { 2890 if (length > 0) {
2891 u32 *src = ((u32 *) IP_RT_ACCT_CPU(0)) + offset;
2892 u32 *dst = (u32 *) buffer; 2891 u32 *dst = (u32 *) buffer;
2893 2892
2894 /* Copy first cpu. */
2895 *start = buffer; 2893 *start = buffer;
2896 memcpy(dst, src, length); 2894 memset(dst, 0, length);
2897 2895
2898 /* Add the other cpus in, one int at a time */
2899 for_each_possible_cpu(i) { 2896 for_each_possible_cpu(i) {
2900 unsigned int j; 2897 unsigned int j;
2901 2898 u32 *src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
2902 src = ((u32 *) IP_RT_ACCT_CPU(i)) + offset;
2903 2899
2904 for (j = 0; j < length/4; j++) 2900 for (j = 0; j < length/4; j++)
2905 dst[j] += src[j]; 2901 dst[j] += src[j];
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index ffddd2b45352..bec6fe880657 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -191,7 +191,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
191 191
192 tcp_get_default_congestion_control(val); 192 tcp_get_default_congestion_control(val);
193 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); 193 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
194 if (ret == 0 && newval && newlen) 194 if (ret == 1 && newval && newlen)
195 ret = tcp_set_default_congestion_control(val); 195 ret = tcp_set_default_congestion_control(val);
196 return ret; 196 return ret;
197} 197}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e566f3c67677..652c32368ccc 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -900,8 +900,7 @@ int tcp_v4_md5_do_add(struct sock *sk, __be32 addr,
900 sizeof(*keys) * md5sig->entries4); 900 sizeof(*keys) * md5sig->entries4);
901 901
902 /* Free old key list, and reference new one */ 902 /* Free old key list, and reference new one */
903 if (md5sig->keys4) 903 kfree(md5sig->keys4);
904 kfree(md5sig->keys4);
905 md5sig->keys4 = keys; 904 md5sig->keys4 = keys;
906 md5sig->alloced4++; 905 md5sig->alloced4++;
907 } 906 }
@@ -939,10 +938,10 @@ int tcp_v4_md5_do_del(struct sock *sk, __be32 addr)
939 tp->md5sig_info->alloced4 = 0; 938 tp->md5sig_info->alloced4 = 0;
940 } else if (tp->md5sig_info->entries4 != i) { 939 } else if (tp->md5sig_info->entries4 != i) {
941 /* Need to do some manipulation */ 940 /* Need to do some manipulation */
942 memcpy(&tp->md5sig_info->keys4[i], 941 memmove(&tp->md5sig_info->keys4[i],
943 &tp->md5sig_info->keys4[i+1], 942 &tp->md5sig_info->keys4[i+1],
944 (tp->md5sig_info->entries4 - i) * 943 (tp->md5sig_info->entries4 - i) *
945 sizeof(struct tcp4_md5sig_key)); 944 sizeof(struct tcp4_md5sig_key));
946 } 945 }
947 tcp_free_md5sig_pool(); 946 tcp_free_md5sig_pool();
948 return 0; 947 return 0;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 324b4207254a..e5130a7fe181 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1295,6 +1295,7 @@ static int tcp_mtu_probe(struct sock *sk)
1295 struct sk_buff *skb, *nskb, *next; 1295 struct sk_buff *skb, *nskb, *next;
1296 int len; 1296 int len;
1297 int probe_size; 1297 int probe_size;
1298 int size_needed;
1298 unsigned int pif; 1299 unsigned int pif;
1299 int copy; 1300 int copy;
1300 int mss_now; 1301 int mss_now;
@@ -1313,27 +1314,20 @@ static int tcp_mtu_probe(struct sock *sk)
1313 /* Very simple search strategy: just double the MSS. */ 1314 /* Very simple search strategy: just double the MSS. */
1314 mss_now = tcp_current_mss(sk, 0); 1315 mss_now = tcp_current_mss(sk, 0);
1315 probe_size = 2*tp->mss_cache; 1316 probe_size = 2*tp->mss_cache;
1317 size_needed = probe_size + (tp->reordering + 1) * tp->mss_cache;
1316 if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high)) { 1318 if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high)) {
1317 /* TODO: set timer for probe_converge_event */ 1319 /* TODO: set timer for probe_converge_event */
1318 return -1; 1320 return -1;
1319 } 1321 }
1320 1322
1321 /* Have enough data in the send queue to probe? */ 1323 /* Have enough data in the send queue to probe? */
1322 len = 0; 1324 if (tp->write_seq - tp->snd_nxt < size_needed)
1323 if ((skb = tcp_send_head(sk)) == NULL)
1324 return -1;
1325 while ((len += skb->len) < probe_size && !tcp_skb_is_last(sk, skb))
1326 skb = tcp_write_queue_next(sk, skb);
1327 if (len < probe_size)
1328 return -1; 1325 return -1;
1329 1326
1330 /* Receive window check. */ 1327 if (tp->snd_wnd < size_needed)
1331 if (after(TCP_SKB_CB(skb)->seq + probe_size, tp->snd_una + tp->snd_wnd)) { 1328 return -1;
1332 if (tp->snd_wnd < probe_size) 1329 if (after(tp->snd_nxt + size_needed, tp->snd_una + tp->snd_wnd))
1333 return -1; 1330 return 0;
1334 else
1335 return 0;
1336 }
1337 1331
1338 /* Do we need to wait to drain cwnd? */ 1332 /* Do we need to wait to drain cwnd? */
1339 pif = tcp_packets_in_flight(tp); 1333 pif = tcp_packets_in_flight(tp);
@@ -1352,7 +1346,6 @@ static int tcp_mtu_probe(struct sock *sk)
1352 1346
1353 skb = tcp_send_head(sk); 1347 skb = tcp_send_head(sk);
1354 tcp_insert_write_queue_before(nskb, skb, sk); 1348 tcp_insert_write_queue_before(nskb, skb, sk);
1355 tcp_advance_send_head(sk, skb);
1356 1349
1357 TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq; 1350 TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq;
1358 TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size; 1351 TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 1bd8d818f8e9..567664eac463 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -967,7 +967,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
967 if (unlikely(score.addr_type == IPV6_ADDR_ANY || 967 if (unlikely(score.addr_type == IPV6_ADDR_ANY ||
968 score.addr_type & IPV6_ADDR_MULTICAST)) { 968 score.addr_type & IPV6_ADDR_MULTICAST)) {
969 LIMIT_NETDEBUG(KERN_DEBUG 969 LIMIT_NETDEBUG(KERN_DEBUG
970 "ADDRCONF: unspecified / multicast address" 970 "ADDRCONF: unspecified / multicast address "
971 "assigned as unicast address on %s", 971 "assigned as unicast address on %s",
972 dev->name); 972 dev->name);
973 continue; 973 continue;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3aad861975a0..93980c3b83e6 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -581,7 +581,10 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer,
581 } 581 }
582 sk->sk_route_caps &= ~NETIF_F_GSO_MASK; 582 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
583 } 583 }
584 tcp_alloc_md5sig_pool(); 584 if (tcp_alloc_md5sig_pool() == NULL) {
585 kfree(newkey);
586 return -ENOMEM;
587 }
585 if (tp->md5sig_info->alloced6 == tp->md5sig_info->entries6) { 588 if (tp->md5sig_info->alloced6 == tp->md5sig_info->entries6) {
586 keys = kmalloc((sizeof (tp->md5sig_info->keys6[0]) * 589 keys = kmalloc((sizeof (tp->md5sig_info->keys6[0]) *
587 (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC); 590 (tp->md5sig_info->entries6 + 1)), GFP_ATOMIC);
@@ -634,10 +637,6 @@ static int tcp_v6_md5_do_del(struct sock *sk, struct in6_addr *peer)
634 kfree(tp->md5sig_info->keys6); 637 kfree(tp->md5sig_info->keys6);
635 tp->md5sig_info->keys6 = NULL; 638 tp->md5sig_info->keys6 = NULL;
636 tp->md5sig_info->alloced6 = 0; 639 tp->md5sig_info->alloced6 = 0;
637
638 tcp_free_md5sig_pool();
639
640 return 0;
641 } else { 640 } else {
642 /* shrink the database */ 641 /* shrink the database */
643 if (tp->md5sig_info->entries6 != i) 642 if (tp->md5sig_info->entries6 != i)
@@ -646,6 +645,8 @@ static int tcp_v6_md5_do_del(struct sock *sk, struct in6_addr *peer)
646 (tp->md5sig_info->entries6 - i) 645 (tp->md5sig_info->entries6 - i)
647 * sizeof (tp->md5sig_info->keys6[0])); 646 * sizeof (tp->md5sig_info->keys6[0]));
648 } 647 }
648 tcp_free_md5sig_pool();
649 return 0;
649 } 650 }
650 } 651 }
651 return -ENOENT; 652 return -ENOENT;
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index dc5e34a01620..a86a5d83786b 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -928,7 +928,7 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb)
928 928
929 opcode = fp[0]; 929 opcode = fp[0];
930 if (~opcode & 0x80) { 930 if (~opcode & 0x80) {
931 IRDA_WARNING("%s: IrIAS multiframe commands or results" 931 IRDA_WARNING("%s: IrIAS multiframe commands or results "
932 "is not implemented yet!\n", __FUNCTION__); 932 "is not implemented yet!\n", __FUNCTION__);
933 return; 933 return;
934 } 934 }
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 7f9c8542e5fc..c68220773d28 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -296,6 +296,7 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
296 */ 296 */
297void irlan_eth_send_gratuitous_arp(struct net_device *dev) 297void irlan_eth_send_gratuitous_arp(struct net_device *dev)
298{ 298{
299#ifdef CONFIG_INET
299 struct in_device *in_dev; 300 struct in_device *in_dev;
300 301
301 /* 302 /*
@@ -303,7 +304,6 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev)
303 * is useful if we have changed access points on the same 304 * is useful if we have changed access points on the same
304 * subnet. 305 * subnet.
305 */ 306 */
306#ifdef CONFIG_INET
307 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); 307 IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n");
308 rcu_read_lock(); 308 rcu_read_lock();
309 in_dev = __in_dev_get_rcu(dev); 309 in_dev = __in_dev_get_rcu(dev);
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index a2f5a6ea3895..7698f6c459d6 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -97,7 +97,7 @@ struct iucv_irq_list {
97 struct iucv_irq_data data; 97 struct iucv_irq_data data;
98}; 98};
99 99
100static struct iucv_irq_data *iucv_irq_data; 100static struct iucv_irq_data *iucv_irq_data[NR_CPUS];
101static cpumask_t iucv_buffer_cpumask = CPU_MASK_NONE; 101static cpumask_t iucv_buffer_cpumask = CPU_MASK_NONE;
102static cpumask_t iucv_irq_cpumask = CPU_MASK_NONE; 102static cpumask_t iucv_irq_cpumask = CPU_MASK_NONE;
103 103
@@ -277,7 +277,7 @@ union iucv_param {
277/* 277/*
278 * Anchor for per-cpu IUCV command parameter block. 278 * Anchor for per-cpu IUCV command parameter block.
279 */ 279 */
280static union iucv_param *iucv_param; 280static union iucv_param *iucv_param[NR_CPUS];
281 281
282/** 282/**
283 * iucv_call_b2f0 283 * iucv_call_b2f0
@@ -356,7 +356,7 @@ static void iucv_allow_cpu(void *data)
356 * 0x10 - Flag to allow priority message completion interrupts 356 * 0x10 - Flag to allow priority message completion interrupts
357 * 0x08 - Flag to allow IUCV control interrupts 357 * 0x08 - Flag to allow IUCV control interrupts
358 */ 358 */
359 parm = percpu_ptr(iucv_param, smp_processor_id()); 359 parm = iucv_param[cpu];
360 memset(parm, 0, sizeof(union iucv_param)); 360 memset(parm, 0, sizeof(union iucv_param));
361 parm->set_mask.ipmask = 0xf8; 361 parm->set_mask.ipmask = 0xf8;
362 iucv_call_b2f0(IUCV_SETMASK, parm); 362 iucv_call_b2f0(IUCV_SETMASK, parm);
@@ -377,7 +377,7 @@ static void iucv_block_cpu(void *data)
377 union iucv_param *parm; 377 union iucv_param *parm;
378 378
379 /* Disable all iucv interrupts. */ 379 /* Disable all iucv interrupts. */
380 parm = percpu_ptr(iucv_param, smp_processor_id()); 380 parm = iucv_param[cpu];
381 memset(parm, 0, sizeof(union iucv_param)); 381 memset(parm, 0, sizeof(union iucv_param));
382 iucv_call_b2f0(IUCV_SETMASK, parm); 382 iucv_call_b2f0(IUCV_SETMASK, parm);
383 383
@@ -401,9 +401,9 @@ static void iucv_declare_cpu(void *data)
401 return; 401 return;
402 402
403 /* Declare interrupt buffer. */ 403 /* Declare interrupt buffer. */
404 parm = percpu_ptr(iucv_param, cpu); 404 parm = iucv_param[cpu];
405 memset(parm, 0, sizeof(union iucv_param)); 405 memset(parm, 0, sizeof(union iucv_param));
406 parm->db.ipbfadr1 = virt_to_phys(percpu_ptr(iucv_irq_data, cpu)); 406 parm->db.ipbfadr1 = virt_to_phys(iucv_irq_data[cpu]);
407 rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm); 407 rc = iucv_call_b2f0(IUCV_DECLARE_BUFFER, parm);
408 if (rc) { 408 if (rc) {
409 char *err = "Unknown"; 409 char *err = "Unknown";
@@ -458,7 +458,7 @@ static void iucv_retrieve_cpu(void *data)
458 iucv_block_cpu(NULL); 458 iucv_block_cpu(NULL);
459 459
460 /* Retrieve interrupt buffer. */ 460 /* Retrieve interrupt buffer. */
461 parm = percpu_ptr(iucv_param, cpu); 461 parm = iucv_param[cpu];
462 iucv_call_b2f0(IUCV_RETRIEVE_BUFFER, parm); 462 iucv_call_b2f0(IUCV_RETRIEVE_BUFFER, parm);
463 463
464 /* Clear indication that an iucv buffer exists for this cpu. */ 464 /* Clear indication that an iucv buffer exists for this cpu. */
@@ -558,22 +558,23 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
558 switch (action) { 558 switch (action) {
559 case CPU_UP_PREPARE: 559 case CPU_UP_PREPARE:
560 case CPU_UP_PREPARE_FROZEN: 560 case CPU_UP_PREPARE_FROZEN:
561 if (!percpu_populate(iucv_irq_data, 561 iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
562 sizeof(struct iucv_irq_data), 562 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
563 GFP_KERNEL|GFP_DMA, cpu)) 563 if (!iucv_irq_data[cpu])
564 return NOTIFY_BAD; 564 return NOTIFY_BAD;
565 if (!percpu_populate(iucv_param, sizeof(union iucv_param), 565 iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
566 GFP_KERNEL|GFP_DMA, cpu)) { 566 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
567 percpu_depopulate(iucv_irq_data, cpu); 567 if (!iucv_param[cpu])
568 return NOTIFY_BAD; 568 return NOTIFY_BAD;
569 }
570 break; 569 break;
571 case CPU_UP_CANCELED: 570 case CPU_UP_CANCELED:
572 case CPU_UP_CANCELED_FROZEN: 571 case CPU_UP_CANCELED_FROZEN:
573 case CPU_DEAD: 572 case CPU_DEAD:
574 case CPU_DEAD_FROZEN: 573 case CPU_DEAD_FROZEN:
575 percpu_depopulate(iucv_param, cpu); 574 kfree(iucv_param[cpu]);
576 percpu_depopulate(iucv_irq_data, cpu); 575 iucv_param[cpu] = NULL;
576 kfree(iucv_irq_data[cpu]);
577 iucv_irq_data[cpu] = NULL;
577 break; 578 break;
578 case CPU_ONLINE: 579 case CPU_ONLINE:
579 case CPU_ONLINE_FROZEN: 580 case CPU_ONLINE_FROZEN:
@@ -612,7 +613,7 @@ static int iucv_sever_pathid(u16 pathid, u8 userdata[16])
612{ 613{
613 union iucv_param *parm; 614 union iucv_param *parm;
614 615
615 parm = percpu_ptr(iucv_param, smp_processor_id()); 616 parm = iucv_param[smp_processor_id()];
616 memset(parm, 0, sizeof(union iucv_param)); 617 memset(parm, 0, sizeof(union iucv_param));
617 if (userdata) 618 if (userdata)
618 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser)); 619 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
@@ -755,7 +756,7 @@ int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler,
755 756
756 local_bh_disable(); 757 local_bh_disable();
757 /* Prepare parameter block. */ 758 /* Prepare parameter block. */
758 parm = percpu_ptr(iucv_param, smp_processor_id()); 759 parm = iucv_param[smp_processor_id()];
759 memset(parm, 0, sizeof(union iucv_param)); 760 memset(parm, 0, sizeof(union iucv_param));
760 parm->ctrl.ippathid = path->pathid; 761 parm->ctrl.ippathid = path->pathid;
761 parm->ctrl.ipmsglim = path->msglim; 762 parm->ctrl.ipmsglim = path->msglim;
@@ -799,7 +800,7 @@ int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler,
799 BUG_ON(in_atomic()); 800 BUG_ON(in_atomic());
800 spin_lock_bh(&iucv_table_lock); 801 spin_lock_bh(&iucv_table_lock);
801 iucv_cleanup_queue(); 802 iucv_cleanup_queue();
802 parm = percpu_ptr(iucv_param, smp_processor_id()); 803 parm = iucv_param[smp_processor_id()];
803 memset(parm, 0, sizeof(union iucv_param)); 804 memset(parm, 0, sizeof(union iucv_param));
804 parm->ctrl.ipmsglim = path->msglim; 805 parm->ctrl.ipmsglim = path->msglim;
805 parm->ctrl.ipflags1 = path->flags; 806 parm->ctrl.ipflags1 = path->flags;
@@ -854,7 +855,7 @@ int iucv_path_quiesce(struct iucv_path *path, u8 userdata[16])
854 int rc; 855 int rc;
855 856
856 local_bh_disable(); 857 local_bh_disable();
857 parm = percpu_ptr(iucv_param, smp_processor_id()); 858 parm = iucv_param[smp_processor_id()];
858 memset(parm, 0, sizeof(union iucv_param)); 859 memset(parm, 0, sizeof(union iucv_param));
859 if (userdata) 860 if (userdata)
860 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser)); 861 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
@@ -881,7 +882,7 @@ int iucv_path_resume(struct iucv_path *path, u8 userdata[16])
881 int rc; 882 int rc;
882 883
883 local_bh_disable(); 884 local_bh_disable();
884 parm = percpu_ptr(iucv_param, smp_processor_id()); 885 parm = iucv_param[smp_processor_id()];
885 memset(parm, 0, sizeof(union iucv_param)); 886 memset(parm, 0, sizeof(union iucv_param));
886 if (userdata) 887 if (userdata)
887 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser)); 888 memcpy(parm->ctrl.ipuser, userdata, sizeof(parm->ctrl.ipuser));
@@ -936,7 +937,7 @@ int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
936 int rc; 937 int rc;
937 938
938 local_bh_disable(); 939 local_bh_disable();
939 parm = percpu_ptr(iucv_param, smp_processor_id()); 940 parm = iucv_param[smp_processor_id()];
940 memset(parm, 0, sizeof(union iucv_param)); 941 memset(parm, 0, sizeof(union iucv_param));
941 parm->purge.ippathid = path->pathid; 942 parm->purge.ippathid = path->pathid;
942 parm->purge.ipmsgid = msg->id; 943 parm->purge.ipmsgid = msg->id;
@@ -1003,7 +1004,7 @@ int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
1003 } 1004 }
1004 1005
1005 local_bh_disable(); 1006 local_bh_disable();
1006 parm = percpu_ptr(iucv_param, smp_processor_id()); 1007 parm = iucv_param[smp_processor_id()];
1007 memset(parm, 0, sizeof(union iucv_param)); 1008 memset(parm, 0, sizeof(union iucv_param));
1008 parm->db.ipbfadr1 = (u32)(addr_t) buffer; 1009 parm->db.ipbfadr1 = (u32)(addr_t) buffer;
1009 parm->db.ipbfln1f = (u32) size; 1010 parm->db.ipbfln1f = (u32) size;
@@ -1040,7 +1041,7 @@ int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg)
1040 int rc; 1041 int rc;
1041 1042
1042 local_bh_disable(); 1043 local_bh_disable();
1043 parm = percpu_ptr(iucv_param, smp_processor_id()); 1044 parm = iucv_param[smp_processor_id()];
1044 memset(parm, 0, sizeof(union iucv_param)); 1045 memset(parm, 0, sizeof(union iucv_param));
1045 parm->db.ippathid = path->pathid; 1046 parm->db.ippathid = path->pathid;
1046 parm->db.ipmsgid = msg->id; 1047 parm->db.ipmsgid = msg->id;
@@ -1074,7 +1075,7 @@ int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
1074 int rc; 1075 int rc;
1075 1076
1076 local_bh_disable(); 1077 local_bh_disable();
1077 parm = percpu_ptr(iucv_param, smp_processor_id()); 1078 parm = iucv_param[smp_processor_id()];
1078 memset(parm, 0, sizeof(union iucv_param)); 1079 memset(parm, 0, sizeof(union iucv_param));
1079 if (flags & IUCV_IPRMDATA) { 1080 if (flags & IUCV_IPRMDATA) {
1080 parm->dpl.ippathid = path->pathid; 1081 parm->dpl.ippathid = path->pathid;
@@ -1118,7 +1119,7 @@ int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
1118 int rc; 1119 int rc;
1119 1120
1120 local_bh_disable(); 1121 local_bh_disable();
1121 parm = percpu_ptr(iucv_param, smp_processor_id()); 1122 parm = iucv_param[smp_processor_id()];
1122 memset(parm, 0, sizeof(union iucv_param)); 1123 memset(parm, 0, sizeof(union iucv_param));
1123 if (flags & IUCV_IPRMDATA) { 1124 if (flags & IUCV_IPRMDATA) {
1124 /* Message of 8 bytes can be placed into the parameter list. */ 1125 /* Message of 8 bytes can be placed into the parameter list. */
@@ -1172,7 +1173,7 @@ int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg,
1172 int rc; 1173 int rc;
1173 1174
1174 local_bh_disable(); 1175 local_bh_disable();
1175 parm = percpu_ptr(iucv_param, smp_processor_id()); 1176 parm = iucv_param[smp_processor_id()];
1176 memset(parm, 0, sizeof(union iucv_param)); 1177 memset(parm, 0, sizeof(union iucv_param));
1177 if (flags & IUCV_IPRMDATA) { 1178 if (flags & IUCV_IPRMDATA) {
1178 parm->dpl.ippathid = path->pathid; 1179 parm->dpl.ippathid = path->pathid;
@@ -1559,7 +1560,7 @@ static void iucv_external_interrupt(u16 code)
1559 struct iucv_irq_data *p; 1560 struct iucv_irq_data *p;
1560 struct iucv_irq_list *work; 1561 struct iucv_irq_list *work;
1561 1562
1562 p = percpu_ptr(iucv_irq_data, smp_processor_id()); 1563 p = iucv_irq_data[smp_processor_id()];
1563 if (p->ippathid >= iucv_max_pathid) { 1564 if (p->ippathid >= iucv_max_pathid) {
1564 printk(KERN_WARNING "iucv_do_int: Got interrupt with " 1565 printk(KERN_WARNING "iucv_do_int: Got interrupt with "
1565 "pathid %d > max_connections (%ld)\n", 1566 "pathid %d > max_connections (%ld)\n",
@@ -1598,6 +1599,7 @@ static void iucv_external_interrupt(u16 code)
1598static int __init iucv_init(void) 1599static int __init iucv_init(void)
1599{ 1600{
1600 int rc; 1601 int rc;
1602 int cpu;
1601 1603
1602 if (!MACHINE_IS_VM) { 1604 if (!MACHINE_IS_VM) {
1603 rc = -EPROTONOSUPPORT; 1605 rc = -EPROTONOSUPPORT;
@@ -1617,19 +1619,23 @@ static int __init iucv_init(void)
1617 rc = PTR_ERR(iucv_root); 1619 rc = PTR_ERR(iucv_root);
1618 goto out_bus; 1620 goto out_bus;
1619 } 1621 }
1620 /* Note: GFP_DMA used to get memory below 2G */ 1622
1621 iucv_irq_data = percpu_alloc(sizeof(struct iucv_irq_data), 1623 for_each_online_cpu(cpu) {
1622 GFP_KERNEL|GFP_DMA); 1624 /* Note: GFP_DMA used to get memory below 2G */
1623 if (!iucv_irq_data) { 1625 iucv_irq_data[cpu] = kmalloc_node(sizeof(struct iucv_irq_data),
1624 rc = -ENOMEM; 1626 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
1625 goto out_root; 1627 if (!iucv_irq_data[cpu]) {
1626 } 1628 rc = -ENOMEM;
1627 /* Allocate parameter blocks. */ 1629 goto out_free;
1628 iucv_param = percpu_alloc(sizeof(union iucv_param), 1630 }
1629 GFP_KERNEL|GFP_DMA); 1631
1630 if (!iucv_param) { 1632 /* Allocate parameter blocks. */
1631 rc = -ENOMEM; 1633 iucv_param[cpu] = kmalloc_node(sizeof(union iucv_param),
1632 goto out_extint; 1634 GFP_KERNEL|GFP_DMA, cpu_to_node(cpu));
1635 if (!iucv_param[cpu]) {
1636 rc = -ENOMEM;
1637 goto out_free;
1638 }
1633 } 1639 }
1634 register_hotcpu_notifier(&iucv_cpu_notifier); 1640 register_hotcpu_notifier(&iucv_cpu_notifier);
1635 ASCEBC(iucv_error_no_listener, 16); 1641 ASCEBC(iucv_error_no_listener, 16);
@@ -1638,9 +1644,13 @@ static int __init iucv_init(void)
1638 iucv_available = 1; 1644 iucv_available = 1;
1639 return 0; 1645 return 0;
1640 1646
1641out_extint: 1647out_free:
1642 percpu_free(iucv_irq_data); 1648 for_each_possible_cpu(cpu) {
1643out_root: 1649 kfree(iucv_param[cpu]);
1650 iucv_param[cpu] = NULL;
1651 kfree(iucv_irq_data[cpu]);
1652 iucv_irq_data[cpu] = NULL;
1653 }
1644 s390_root_dev_unregister(iucv_root); 1654 s390_root_dev_unregister(iucv_root);
1645out_bus: 1655out_bus:
1646 bus_unregister(&iucv_bus); 1656 bus_unregister(&iucv_bus);
@@ -1658,6 +1668,7 @@ out:
1658static void __exit iucv_exit(void) 1668static void __exit iucv_exit(void)
1659{ 1669{
1660 struct iucv_irq_list *p, *n; 1670 struct iucv_irq_list *p, *n;
1671 int cpu;
1661 1672
1662 spin_lock_irq(&iucv_queue_lock); 1673 spin_lock_irq(&iucv_queue_lock);
1663 list_for_each_entry_safe(p, n, &iucv_task_queue, list) 1674 list_for_each_entry_safe(p, n, &iucv_task_queue, list)
@@ -1666,8 +1677,12 @@ static void __exit iucv_exit(void)
1666 kfree(p); 1677 kfree(p);
1667 spin_unlock_irq(&iucv_queue_lock); 1678 spin_unlock_irq(&iucv_queue_lock);
1668 unregister_hotcpu_notifier(&iucv_cpu_notifier); 1679 unregister_hotcpu_notifier(&iucv_cpu_notifier);
1669 percpu_free(iucv_param); 1680 for_each_possible_cpu(cpu) {
1670 percpu_free(iucv_irq_data); 1681 kfree(iucv_param[cpu]);
1682 iucv_param[cpu] = NULL;
1683 kfree(iucv_irq_data[cpu]);
1684 iucv_irq_data[cpu] = NULL;
1685 }
1671 s390_root_dev_unregister(iucv_root); 1686 s390_root_dev_unregister(iucv_root);
1672 bus_unregister(&iucv_bus); 1687 bus_unregister(&iucv_bus);
1673 unregister_external_interrupt(0x4000, iucv_external_interrupt); 1688 unregister_external_interrupt(0x4000, iucv_external_interrupt);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 10c89d47f685..878039b9557d 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1015,9 +1015,7 @@ static inline struct sk_buff *pfkey_xfrm_state2msg(struct xfrm_state *x)
1015{ 1015{
1016 struct sk_buff *skb; 1016 struct sk_buff *skb;
1017 1017
1018 spin_lock_bh(&x->lock);
1019 skb = __pfkey_xfrm_state2msg(x, 1, 3); 1018 skb = __pfkey_xfrm_state2msg(x, 1, 3);
1020 spin_unlock_bh(&x->lock);
1021 1019
1022 return skb; 1020 return skb;
1023} 1021}
@@ -1552,7 +1550,7 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1552 1550
1553 out_hdr = (struct sadb_msg *) out_skb->data; 1551 out_hdr = (struct sadb_msg *) out_skb->data;
1554 out_hdr->sadb_msg_version = hdr->sadb_msg_version; 1552 out_hdr->sadb_msg_version = hdr->sadb_msg_version;
1555 out_hdr->sadb_msg_type = SADB_DUMP; 1553 out_hdr->sadb_msg_type = SADB_GET;
1556 out_hdr->sadb_msg_satype = pfkey_proto2satype(proto); 1554 out_hdr->sadb_msg_satype = pfkey_proto2satype(proto);
1557 out_hdr->sadb_msg_errno = 0; 1555 out_hdr->sadb_msg_errno = 0;
1558 out_hdr->sadb_msg_reserved = 0; 1556 out_hdr->sadb_msg_reserved = 0;
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index e0ee65a969bc..59350b8727ec 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -267,6 +267,17 @@ static int ieee80211_open(struct net_device *dev)
267 tasklet_enable(&local->tasklet); 267 tasklet_enable(&local->tasklet);
268 } 268 }
269 269
270 /*
271 * set_multicast_list will be invoked by the networking core
272 * which will check whether any increments here were done in
273 * error and sync them down to the hardware as filter flags.
274 */
275 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
276 atomic_inc(&local->iff_allmultis);
277
278 if (sdata->flags & IEEE80211_SDATA_PROMISC)
279 atomic_inc(&local->iff_promiscs);
280
270 local->open_count++; 281 local->open_count++;
271 282
272 netif_start_queue(dev); 283 netif_start_queue(dev);
@@ -284,6 +295,18 @@ static int ieee80211_stop(struct net_device *dev)
284 295
285 netif_stop_queue(dev); 296 netif_stop_queue(dev);
286 297
298 /*
299 * Don't count this interface for promisc/allmulti while it
300 * is down. dev_mc_unsync() will invoke set_multicast_list
301 * on the master interface which will sync these down to the
302 * hardware as filter flags.
303 */
304 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
305 atomic_dec(&local->iff_allmultis);
306
307 if (sdata->flags & IEEE80211_SDATA_PROMISC)
308 atomic_dec(&local->iff_promiscs);
309
287 dev_mc_unsync(local->mdev, dev); 310 dev_mc_unsync(local->mdev, dev);
288 311
289 /* down all dependent devices, that is VLANs */ 312 /* down all dependent devices, that is VLANs */
@@ -366,8 +389,8 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
366 389
367 allmulti = !!(dev->flags & IFF_ALLMULTI); 390 allmulti = !!(dev->flags & IFF_ALLMULTI);
368 promisc = !!(dev->flags & IFF_PROMISC); 391 promisc = !!(dev->flags & IFF_PROMISC);
369 sdata_allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI; 392 sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI);
370 sdata_promisc = sdata->flags & IEEE80211_SDATA_PROMISC; 393 sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC);
371 394
372 if (allmulti != sdata_allmulti) { 395 if (allmulti != sdata_allmulti) {
373 if (dev->flags & IFF_ALLMULTI) 396 if (dev->flags & IFF_ALLMULTI)
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 015b3f879aa9..16afd24d4f6b 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -2647,7 +2647,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
2647 local->sta_scanning = 0; 2647 local->sta_scanning = 0;
2648 2648
2649 if (ieee80211_hw_config(local)) 2649 if (ieee80211_hw_config(local))
2650 printk(KERN_DEBUG "%s: failed to restore operational" 2650 printk(KERN_DEBUG "%s: failed to restore operational "
2651 "channel after scan\n", dev->name); 2651 "channel after scan\n", dev->name);
2652 2652
2653 2653
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 5ebbe808d801..b8bbb960723c 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1146,7 +1146,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
1146 /* Check if the timestamp looks valid. */ 1146 /* Check if the timestamp looks valid. */
1147 if (time_after(hbinfo->sent_at, jiffies) || 1147 if (time_after(hbinfo->sent_at, jiffies) ||
1148 time_after(jiffies, hbinfo->sent_at + max_interval)) { 1148 time_after(jiffies, hbinfo->sent_at + max_interval)) {
1149 SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp" 1149 SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp "
1150 "received for transport: %p\n", 1150 "received for transport: %p\n",
1151 __FUNCTION__, link); 1151 __FUNCTION__, link);
1152 return SCTP_DISPOSITION_DISCARD; 1152 return SCTP_DISPOSITION_DISCARD;
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 53995af9ca4b..a6e57d1c2eb6 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -540,7 +540,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
540 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); 540 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
541 if (IS_ERR(p)) { 541 if (IS_ERR(p)) {
542 err = PTR_ERR(p); 542 err = PTR_ERR(p);
543 gss_msg->msg.errno = (err == -EACCES) ? -EACCES : -EAGAIN; 543 gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES;
544 goto err_release_msg; 544 goto err_release_msg;
545 } 545 }
546 gss_msg->ctx = gss_get_ctx(ctx); 546 gss_msg->ctx = gss_get_ctx(ctx);
@@ -967,7 +967,7 @@ gss_validate(struct rpc_task *task, __be32 *p)
967 if (maj_stat == GSS_S_CONTEXT_EXPIRED) 967 if (maj_stat == GSS_S_CONTEXT_EXPIRED)
968 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); 968 clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
969 if (maj_stat) { 969 if (maj_stat) {
970 dprintk("RPC: %5u gss_validate: gss_verify_mic returned" 970 dprintk("RPC: %5u gss_validate: gss_verify_mic returned "
971 "error 0x%08x\n", task->tk_pid, maj_stat); 971 "error 0x%08x\n", task->tk_pid, maj_stat);
972 goto out_bad; 972 goto out_bad;
973 } 973 }
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index 9843eacef11d..60c3dba545d7 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -147,13 +147,17 @@ gss_import_sec_context_kerberos(const void *p,
147 p = simple_get_bytes(p, end, &tmp, sizeof(tmp)); 147 p = simple_get_bytes(p, end, &tmp, sizeof(tmp));
148 if (IS_ERR(p)) 148 if (IS_ERR(p))
149 goto out_err_free_ctx; 149 goto out_err_free_ctx;
150 if (tmp != SGN_ALG_DES_MAC_MD5) 150 if (tmp != SGN_ALG_DES_MAC_MD5) {
151 p = ERR_PTR(-ENOSYS);
151 goto out_err_free_ctx; 152 goto out_err_free_ctx;
153 }
152 p = simple_get_bytes(p, end, &tmp, sizeof(tmp)); 154 p = simple_get_bytes(p, end, &tmp, sizeof(tmp));
153 if (IS_ERR(p)) 155 if (IS_ERR(p))
154 goto out_err_free_ctx; 156 goto out_err_free_ctx;
155 if (tmp != SEAL_ALG_DES) 157 if (tmp != SEAL_ALG_DES) {
158 p = ERR_PTR(-ENOSYS);
156 goto out_err_free_ctx; 159 goto out_err_free_ctx;
160 }
157 p = simple_get_bytes(p, end, &ctx->endtime, sizeof(ctx->endtime)); 161 p = simple_get_bytes(p, end, &ctx->endtime, sizeof(ctx->endtime));
158 if (IS_ERR(p)) 162 if (IS_ERR(p))
159 goto out_err_free_ctx; 163 goto out_err_free_ctx;
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index 1c6eda5077c1..dedcbd6108f4 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -83,6 +83,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
83 u32 seq_send; 83 u32 seq_send;
84 84
85 dprintk("RPC: gss_krb5_seal\n"); 85 dprintk("RPC: gss_krb5_seal\n");
86 BUG_ON(ctx == NULL);
86 87
87 now = get_seconds(); 88 now = get_seconds();
88 89
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 18f0a8dcc095..c59f3ca2b41b 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -280,7 +280,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
280 mask = POLLOUT | POLLWRNORM; 280 mask = POLLOUT | POLLWRNORM;
281 if (rpci->ops == NULL) 281 if (rpci->ops == NULL)
282 mask |= POLLERR | POLLHUP; 282 mask |= POLLERR | POLLHUP;
283 if (!list_empty(&rpci->pipe)) 283 if (filp->private_data || !list_empty(&rpci->pipe))
284 mask |= POLLIN | POLLRDNORM; 284 mask |= POLLIN | POLLRDNORM;
285 return mask; 285 return mask;
286} 286}
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 282a9a2ec90c..cd641c8634f0 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -62,7 +62,7 @@ static inline void do_xprt_reserve(struct rpc_task *);
62static void xprt_connect_status(struct rpc_task *task); 62static void xprt_connect_status(struct rpc_task *task);
63static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *); 63static int __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
64 64
65static spinlock_t xprt_list_lock = SPIN_LOCK_UNLOCKED; 65static DEFINE_SPINLOCK(xprt_list_lock);
66static LIST_HEAD(xprt_list); 66static LIST_HEAD(xprt_list);
67 67
68/* 68/*
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 1afeb3eb8e4c..6f2112dd9f78 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -89,7 +89,7 @@ static struct ctl_table_header *sunrpc_table_header;
89 89
90static ctl_table xr_tunables_table[] = { 90static ctl_table xr_tunables_table[] = {
91 { 91 {
92 .ctl_name = CTL_SLOTTABLE_RDMA, 92 .ctl_name = CTL_UNNUMBERED,
93 .procname = "rdma_slot_table_entries", 93 .procname = "rdma_slot_table_entries",
94 .data = &xprt_rdma_slot_table_entries, 94 .data = &xprt_rdma_slot_table_entries,
95 .maxlen = sizeof(unsigned int), 95 .maxlen = sizeof(unsigned int),
@@ -100,7 +100,7 @@ static ctl_table xr_tunables_table[] = {
100 .extra2 = &max_slot_table_size 100 .extra2 = &max_slot_table_size
101 }, 101 },
102 { 102 {
103 .ctl_name = CTL_RDMA_MAXINLINEREAD, 103 .ctl_name = CTL_UNNUMBERED,
104 .procname = "rdma_max_inline_read", 104 .procname = "rdma_max_inline_read",
105 .data = &xprt_rdma_max_inline_read, 105 .data = &xprt_rdma_max_inline_read,
106 .maxlen = sizeof(unsigned int), 106 .maxlen = sizeof(unsigned int),
@@ -109,7 +109,7 @@ static ctl_table xr_tunables_table[] = {
109 .strategy = &sysctl_intvec, 109 .strategy = &sysctl_intvec,
110 }, 110 },
111 { 111 {
112 .ctl_name = CTL_RDMA_MAXINLINEWRITE, 112 .ctl_name = CTL_UNNUMBERED,
113 .procname = "rdma_max_inline_write", 113 .procname = "rdma_max_inline_write",
114 .data = &xprt_rdma_max_inline_write, 114 .data = &xprt_rdma_max_inline_write,
115 .maxlen = sizeof(unsigned int), 115 .maxlen = sizeof(unsigned int),
@@ -118,7 +118,7 @@ static ctl_table xr_tunables_table[] = {
118 .strategy = &sysctl_intvec, 118 .strategy = &sysctl_intvec,
119 }, 119 },
120 { 120 {
121 .ctl_name = CTL_RDMA_WRITEPADDING, 121 .ctl_name = CTL_UNNUMBERED,
122 .procname = "rdma_inline_write_padding", 122 .procname = "rdma_inline_write_padding",
123 .data = &xprt_rdma_inline_write_padding, 123 .data = &xprt_rdma_inline_write_padding,
124 .maxlen = sizeof(unsigned int), 124 .maxlen = sizeof(unsigned int),
@@ -129,7 +129,7 @@ static ctl_table xr_tunables_table[] = {
129 .extra2 = &max_padding, 129 .extra2 = &max_padding,
130 }, 130 },
131 { 131 {
132 .ctl_name = CTL_RDMA_MEMREG, 132 .ctl_name = CTL_UNNUMBERED,
133 .procname = "rdma_memreg_strategy", 133 .procname = "rdma_memreg_strategy",
134 .data = &xprt_rdma_memreg_strategy, 134 .data = &xprt_rdma_memreg_strategy,
135 .maxlen = sizeof(unsigned int), 135 .maxlen = sizeof(unsigned int),
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 02298f529dad..2f630a512ab7 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1828,7 +1828,7 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
1828 * @args: rpc transport creation arguments 1828 * @args: rpc transport creation arguments
1829 * 1829 *
1830 */ 1830 */
1831struct rpc_xprt *xs_setup_udp(struct xprt_create *args) 1831static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1832{ 1832{
1833 struct sockaddr *addr = args->dstaddr; 1833 struct sockaddr *addr = args->dstaddr;
1834 struct rpc_xprt *xprt; 1834 struct rpc_xprt *xprt;
@@ -1894,7 +1894,7 @@ struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1894 * @args: rpc transport creation arguments 1894 * @args: rpc transport creation arguments
1895 * 1895 *
1896 */ 1896 */
1897struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) 1897static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
1898{ 1898{
1899 struct sockaddr *addr = args->dstaddr; 1899 struct sockaddr *addr = args->dstaddr;
1900 struct rpc_xprt *xprt; 1900 struct rpc_xprt *xprt;
diff --git a/net/wireless/wext.c b/net/wireless/wext.c
index 85e5f9dd0d8e..47e80cc2077c 100644
--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -1094,7 +1094,7 @@ int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
1094 rtnl_lock(); 1094 rtnl_lock();
1095 ret = wireless_process_ioctl(net, ifr, cmd); 1095 ret = wireless_process_ioctl(net, ifr, cmd);
1096 rtnl_unlock(); 1096 rtnl_unlock();
1097 if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct ifreq))) 1097 if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq)))
1098 return -EFAULT; 1098 return -EFAULT;
1099 return ret; 1099 return ret;
1100} 1100}
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 224b44e31a07..cf43c49eab37 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -552,7 +552,7 @@ int __xfrm_state_delete(struct xfrm_state *x)
552 * The xfrm_state_alloc call gives a reference, and that 552 * The xfrm_state_alloc call gives a reference, and that
553 * is what we are dropping here. 553 * is what we are dropping here.
554 */ 554 */
555 __xfrm_state_put(x); 555 xfrm_state_put(x);
556 err = 0; 556 err = 0;
557 } 557 }
558 558
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d41588d101d0..e75dbdcb08a4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -507,7 +507,6 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
507 struct xfrm_usersa_info *p, 507 struct xfrm_usersa_info *p,
508 struct sk_buff *skb) 508 struct sk_buff *skb)
509{ 509{
510 spin_lock_bh(&x->lock);
511 copy_to_user_state(x, p); 510 copy_to_user_state(x, p);
512 511
513 if (x->coaddr) 512 if (x->coaddr)
@@ -515,7 +514,6 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
515 514
516 if (x->lastused) 515 if (x->lastused)
517 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused); 516 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused);
518 spin_unlock_bh(&x->lock);
519 517
520 if (x->aalg) 518 if (x->aalg)
521 NLA_PUT(skb, XFRMA_ALG_AUTH, alg_len(x->aalg), x->aalg); 519 NLA_PUT(skb, XFRMA_ALG_AUTH, alg_len(x->aalg), x->aalg);
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cbb42580a81d..579f50fa838c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.11'; 12my $V = '0.12';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -19,8 +19,11 @@ my $chk_signoff = 1;
19my $chk_patch = 1; 19my $chk_patch = 1;
20my $tst_type = 0; 20my $tst_type = 0;
21my $emacs = 0; 21my $emacs = 0;
22my $terse = 0;
22my $file = 0; 23my $file = 0;
23my $check = 0; 24my $check = 0;
25my $summary = 1;
26my $mailback = 0;
24my $root; 27my $root;
25GetOptions( 28GetOptions(
26 'q|quiet+' => \$quiet, 29 'q|quiet+' => \$quiet,
@@ -29,10 +32,13 @@ GetOptions(
29 'patch!' => \$chk_patch, 32 'patch!' => \$chk_patch,
30 'test-type!' => \$tst_type, 33 'test-type!' => \$tst_type,
31 'emacs!' => \$emacs, 34 'emacs!' => \$emacs,
35 'terse!' => \$terse,
32 'file!' => \$file, 36 'file!' => \$file,
33 'subjective!' => \$check, 37 'subjective!' => \$check,
34 'strict!' => \$check, 38 'strict!' => \$check,
35 'root=s' => \$root, 39 'root=s' => \$root,
40 'summary!' => \$summary,
41 'mailback!' => \$mailback,
36) or exit; 42) or exit;
37 43
38my $exit = 0; 44my $exit = 0;
@@ -42,6 +48,7 @@ if ($#ARGV < 0) {
42 print "version: $V\n"; 48 print "version: $V\n";
43 print "options: -q => quiet\n"; 49 print "options: -q => quiet\n";
44 print " --no-tree => run without a kernel tree\n"; 50 print " --no-tree => run without a kernel tree\n";
51 print " --terse => one line per report\n";
45 print " --emacs => emacs compile window format\n"; 52 print " --emacs => emacs compile window format\n";
46 print " --file => check a source file\n"; 53 print " --file => check a source file\n";
47 print " --strict => enable more subjective tests\n"; 54 print " --strict => enable more subjective tests\n";
@@ -49,6 +56,11 @@ if ($#ARGV < 0) {
49 exit(1); 56 exit(1);
50} 57}
51 58
59if ($terse) {
60 $emacs = 1;
61 $quiet++;
62}
63
52if ($tree) { 64if ($tree) {
53 if (defined $root) { 65 if (defined $root) {
54 if (!top_of_kernel_tree($root)) { 66 if (!top_of_kernel_tree($root)) {
@@ -90,41 +102,6 @@ our $Attribute = qr{
90 __(?:mem|cpu|dev|)(?:initdata|init) 102 __(?:mem|cpu|dev|)(?:initdata|init)
91 }x; 103 }x;
92our $Inline = qr{inline|__always_inline|noinline}; 104our $Inline = qr{inline|__always_inline|noinline};
93our $NonptrType = qr{
94 \b
95 (?:const\s+)?
96 (?:unsigned\s+)?
97 (?:
98 void|
99 char|
100 short|
101 int|
102 long|
103 unsigned|
104 float|
105 double|
106 bool|
107 long\s+int|
108 long\s+long|
109 long\s+long\s+int|
110 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
111 struct\s+$Ident|
112 union\s+$Ident|
113 enum\s+$Ident|
114 ${Ident}_t|
115 ${Ident}_handler|
116 ${Ident}_handler_fn
117 )
118 (?:\s+$Sparse)*
119 \b
120 }x;
121
122our $Type = qr{
123 \b$NonptrType\b
124 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
125 (?:\s+$Sparse|\s+$Attribute)*
126 }x;
127our $Declare = qr{(?:$Storage\s+)?$Type};
128our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; 105our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
129our $Lval = qr{$Ident(?:$Member)*}; 106our $Lval = qr{$Ident(?:$Member)*};
130 107
@@ -136,7 +113,50 @@ our $Operators = qr{
136 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/ 113 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/
137 }x; 114 }x;
138 115
139our $Bare = ''; 116our $NonptrType;
117our $Type;
118our $Declare;
119
120our @typeList = (
121 qr{void},
122 qr{char},
123 qr{short},
124 qr{int},
125 qr{long},
126 qr{unsigned},
127 qr{float},
128 qr{double},
129 qr{bool},
130 qr{long\s+int},
131 qr{long\s+long},
132 qr{long\s+long\s+int},
133 qr{(?:__)?(?:u|s|be|le)(?:8|16|32|64)},
134 qr{struct\s+$Ident},
135 qr{union\s+$Ident},
136 qr{enum\s+$Ident},
137 qr{${Ident}_t},
138 qr{${Ident}_handler},
139 qr{${Ident}_handler_fn},
140);
141
142sub build_types {
143 my $all = "(?: \n" . join("|\n ", @typeList) . "\n)";
144 $NonptrType = qr{
145 \b
146 (?:const\s+)?
147 (?:unsigned\s+)?
148 $all
149 (?:\s+$Sparse|\s+const)*
150 \b
151 }x;
152 $Type = qr{
153 \b$NonptrType\b
154 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
155 (?:\s+$Sparse|\s+$Attribute)*
156 }x;
157 $Declare = qr{(?:$Storage\s+)?$Type};
158}
159build_types();
140 160
141$chk_signoff = 0 if ($file); 161$chk_signoff = 0 if ($file);
142 162
@@ -278,6 +298,81 @@ sub sanitise_line {
278 return $res; 298 return $res;
279} 299}
280 300
301sub ctx_statement_block {
302 my ($linenr, $remain, $off) = @_;
303 my $line = $linenr - 1;
304 my $blk = '';
305 my $soff = $off;
306 my $coff = $off - 1;
307
308 my $type = '';
309 my $level = 0;
310 my $c;
311 my $len = 0;
312 while (1) {
313 #warn "CSB: blk<$blk>\n";
314 # If we are about to drop off the end, pull in more
315 # context.
316 if ($off >= $len) {
317 for (; $remain > 0; $line++) {
318 next if ($rawlines[$line] =~ /^-/);
319 $remain--;
320 $blk .= sanitise_line($rawlines[$line]) . "\n";
321 $len = length($blk);
322 $line++;
323 last;
324 }
325 # Bail if there is no further context.
326 #warn "CSB: blk<$blk> off<$off> len<$len>\n";
327 if ($off == $len) {
328 last;
329 }
330 }
331 $c = substr($blk, $off, 1);
332
333 #warn "CSB: c<$c> type<$type> level<$level>\n";
334 # Statement ends at the ';' or a close '}' at the
335 # outermost level.
336 if ($level == 0 && $c eq ';') {
337 last;
338 }
339
340 if (($type eq '' || $type eq '(') && $c eq '(') {
341 $level++;
342 $type = '(';
343 }
344 if ($type eq '(' && $c eq ')') {
345 $level--;
346 $type = ($level != 0)? '(' : '';
347
348 if ($level == 0 && $coff < $soff) {
349 $coff = $off;
350 }
351 }
352 if (($type eq '' || $type eq '{') && $c eq '{') {
353 $level++;
354 $type = '{';
355 }
356 if ($type eq '{' && $c eq '}') {
357 $level--;
358 $type = ($level != 0)? '{' : '';
359
360 if ($level == 0) {
361 last;
362 }
363 }
364 $off++;
365 }
366
367 my $statement = substr($blk, $soff, $off - $soff + 1);
368 my $condition = substr($blk, $soff, $coff - $soff + 1);
369
370 #warn "STATEMENT<$statement>\n";
371 #warn "CONDITION<$condition>\n";
372
373 return ($statement, $condition);
374}
375
281sub ctx_block_get { 376sub ctx_block_get {
282 my ($linenr, $remain, $outer, $open, $close, $off) = @_; 377 my ($linenr, $remain, $outer, $open, $close, $off) = @_;
283 my $line; 378 my $line;
@@ -421,9 +516,6 @@ sub annotate_values {
421 my $paren = 0; 516 my $paren = 0;
422 my @paren_type; 517 my @paren_type;
423 518
424 # Include any user defined types we may have found as we went.
425 my $type_match = "(?:$Type$Bare)";
426
427 while (length($cur)) { 519 while (length($cur)) {
428 print " <$type> " if ($debug); 520 print " <$type> " if ($debug);
429 if ($cur =~ /^(\s+)/o) { 521 if ($cur =~ /^(\s+)/o) {
@@ -433,7 +525,7 @@ sub annotate_values {
433 $type = 'N'; 525 $type = 'N';
434 } 526 }
435 527
436 } elsif ($cur =~ /^($type_match)/) { 528 } elsif ($cur =~ /^($Type)/) {
437 print "DECLARE($1)\n" if ($debug); 529 print "DECLARE($1)\n" if ($debug);
438 $type = 'T'; 530 $type = 'T';
439 531
@@ -457,7 +549,7 @@ sub annotate_values {
457 } 549 }
458 $type = 'N'; 550 $type = 'N';
459 551
460 } elsif ($cur =~ /^(if|while|typeof)\b/o) { 552 } elsif ($cur =~ /^(if|while|typeof|for)\b/o) {
461 print "COND($1)\n" if ($debug); 553 print "COND($1)\n" if ($debug);
462 $paren_type[$paren] = 'N'; 554 $paren_type[$paren] = 'N';
463 $type = 'N'; 555 $type = 'N';
@@ -515,11 +607,30 @@ sub annotate_values {
515 return $res; 607 return $res;
516} 608}
517 609
610sub possible {
611 my ($possible) = @_;
612
613 #print "CHECK<$possible>\n";
614 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
615 $possible ne 'goto' && $possible ne 'return' &&
616 $possible ne 'struct' && $possible ne 'enum' &&
617 $possible ne 'case' && $possible ne 'else' &&
618 $possible ne 'typedef') {
619 #print "POSSIBLE<$possible>\n";
620 push(@typeList, $possible);
621 build_types();
622 }
623}
624
518my $prefix = ''; 625my $prefix = '';
519 626
520my @report = (); 627my @report = ();
521sub report { 628sub report {
522 push(@report, $prefix . $_[0]); 629 my $line = $prefix . $_[0];
630
631 $line = (split('\n', $line))[0] . "\n" if ($terse);
632
633 push(@report, $line);
523} 634}
524sub report_dump { 635sub report_dump {
525 @report; 636 @report;
@@ -574,9 +685,6 @@ sub process {
574 685
575 my $prev_values = 'N'; 686 my $prev_values = 'N';
576 687
577 # Possible bare types.
578 my @bare = ();
579
580 # Pre-scan the patch looking for any __setup documentation. 688 # Pre-scan the patch looking for any __setup documentation.
581 my @setup_docs = (); 689 my @setup_docs = ();
582 my $setup_docs = 0; 690 my $setup_docs = 0;
@@ -631,21 +739,35 @@ sub process {
631 $realline++; 739 $realline++;
632 $realcnt-- if ($realcnt != 0); 740 $realcnt-- if ($realcnt != 0);
633 741
634 # track any sort of multi-line comment. Obviously if 742 # Guestimate if this is a continuing comment. Run
635 # the added text or context do not include the whole 743 # the context looking for a comment "edge". If this
636 # comment we will not see it. Such is life. 744 # edge is a close comment then we must be in a comment
637 # 745 # at context start.
746 if ($linenr == $first_line) {
747 my $edge;
748 for (my $ln = $first_line; $ln < ($linenr + $realcnt); $ln++) {
749 ($edge) = ($lines[$ln - 1] =~ m@(/\*|\*/)@);
750 last if (defined $edge);
751 }
752 if (defined $edge && $edge eq '*/') {
753 $in_comment = 1;
754 }
755 }
756
638 # Guestimate if this is a continuing comment. If this 757 # Guestimate if this is a continuing comment. If this
639 # is the start of a diff block and this line starts 758 # is the start of a diff block and this line starts
640 # ' *' then it is very likely a comment. 759 # ' *' then it is very likely a comment.
641 if ($linenr == $first_line and $line =~ m@^.\s*\*@) { 760 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
642 $in_comment = 1; 761 $in_comment = 1;
643 } 762 }
644 if ($line =~ m@/\*@) { 763
645 $in_comment = 1; 764 # Find the last comment edge on _this_ line.
646 } 765 while (($line =~ m@(/\*|\*/)@g)) {
647 if ($line =~ m@\*/@) { 766 if ($1 eq '/*') {
648 $in_comment = 0; 767 $in_comment = 1;
768 } else {
769 $in_comment = 0;
770 }
649 } 771 }
650 772
651 # Measure the line length and indent. 773 # Measure the line length and indent.
@@ -687,7 +809,7 @@ sub process {
687 } 809 }
688 810
689# Check for wrappage within a valid hunk of the file 811# Check for wrappage within a valid hunk of the file
690 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |$)}) { 812 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
691 ERROR("patch seems to be corrupt (line wrapped?)\n" . 813 ERROR("patch seems to be corrupt (line wrapped?)\n" .
692 $herecurr) if (!$emitted_corrupt++); 814 $herecurr) if (!$emitted_corrupt++);
693 } 815 }
@@ -727,6 +849,11 @@ sub process {
727 WARN("line over 80 characters\n" . $herecurr); 849 WARN("line over 80 characters\n" . $herecurr);
728 } 850 }
729 851
852# check for adding lines without a newline.
853 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
854 WARN("adding a line without newline at end of file\n" . $herecurr);
855 }
856
730# check we are in a valid source file *.[hc] if not then ignore this hunk 857# check we are in a valid source file *.[hc] if not then ignore this hunk
731 next if ($realfile !~ /\.[hc]$/); 858 next if ($realfile !~ /\.[hc]$/);
732 859
@@ -752,30 +879,41 @@ sub process {
752 879
753# Check for potential 'bare' types 880# Check for potential 'bare' types
754 if ($realcnt && 881 if ($realcnt &&
755 $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ &&
756 $line !~ /$Ident:\s*$/ && 882 $line !~ /$Ident:\s*$/ &&
757 $line !~ /^.\s*$Ident\s*\(/ && 883 ($line =~ /^.\s*$Ident\s*\(\*+\s*$Ident\)\s*\(/ ||
758 # definitions in global scope can only start with types 884 $line !~ /^.\s*$Ident\s*\(/)) {
759 ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ || 885 # definitions in global scope can only start with types
760 # declarations always start with types 886 if ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/) {
761 $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) || 887 possible($1);
762 # any (foo ... *) is a pointer cast, and foo is a type 888
763 $line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) { 889 # declarations always start with types
764 my $possible = $1; 890 } elsif ($prev_values eq 'N' && $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) {
765 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ && 891 possible($1);
766 $possible ne 'goto' && $possible ne 'return' && 892
767 $possible ne 'struct' && $possible ne 'enum' && 893 # any (foo ... *) is a pointer cast, and foo is a type
768 $possible ne 'case' && $possible ne 'else' && 894 } elsif ($line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) {
769 $possible ne 'typedef') { 895 possible($1);
770 #print "POSSIBLE<$possible>\n"; 896 }
771 push(@bare, $possible); 897
772 my $bare = join("|", @bare); 898 # Check for any sort of function declaration.
773 $Bare = '|' . qr{ 899 # int foo(something bar, other baz);
774 \b(?:$bare)\b 900 # void (*store_gdt)(x86_descr_ptr *);
775 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)? 901 if ($prev_values eq 'N' && $line =~ /^(.(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/) {
776 (?:\s+$Sparse)* 902 my ($name_len) = length($1);
777 }x; 903 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, $name_len);
904 my $ctx = join("\n", @ctx);
905
906 $ctx =~ s/\n.//;
907 substr($ctx, 0, $name_len + 1) = '';
908 $ctx =~ s/\)[^\)]*$//;
909 for my $arg (split(/\s*,\s*/, $ctx)) {
910 if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/ || $arg =~ /^($Ident)$/) {
911
912 possible($1);
913 }
914 }
778 } 915 }
916
779 } 917 }
780 918
781# 919#
@@ -935,6 +1073,10 @@ sub process {
935# $clean = 0; 1073# $clean = 0;
936# } 1074# }
937 1075
1076 if ($line =~ /\bLINUX_VERSION_CODE\b/) {
1077 WARN("LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged" . $herecurr);
1078 }
1079
938# printk should use KERN_* levels. Note that follow on printk's on the 1080# printk should use KERN_* levels. Note that follow on printk's on the
939# same line do not need a level, so we use the current block context 1081# same line do not need a level, so we use the current block context
940# to try and find and validate the current printk. In summary the current 1082# to try and find and validate the current printk. In summary the current
@@ -965,6 +1107,12 @@ sub process {
965 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr); 1107 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
966 } 1108 }
967 1109
1110# open braces for enum, union and struct go on the same line.
1111 if ($line =~ /^.\s*{/ &&
1112 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
1113 ERROR("open brace '{' following $1 go on the same line\n" . $hereprev);
1114 }
1115
968# check for spaces between functions and their parentheses. 1116# check for spaces between functions and their parentheses.
969 while ($line =~ /($Ident)\s+\(/g) { 1117 while ($line =~ /($Ident)\s+\(/g) {
970 if ($1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/ && 1118 if ($1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/ &&
@@ -1172,9 +1320,27 @@ sub process {
1172 } 1320 }
1173 1321
1174# Check for illegal assignment in if conditional. 1322# Check for illegal assignment in if conditional.
1175 if ($line=~/\bif\s*\(.*[^<>!=]=[^=]/) { 1323 if ($line =~ /\bif\s*\(/) {
1176 #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/); 1324 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
1177 ERROR("do not use assignment in if condition\n" . $herecurr); 1325
1326 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
1327 ERROR("do not use assignment in if condition ($c)\n" . $herecurr);
1328 }
1329
1330 # Find out what is on the end of the line after the
1331 # conditional.
1332 substr($s, 0, length($c)) = '';
1333 $s =~ s/\n.*//g;
1334
1335 if (length($c) && $s !~ /^\s*({|;|\/\*.*\*\/)?\s*\\*\s*$/) {
1336 ERROR("trailing statements should be on next line\n" . $herecurr);
1337 }
1338 }
1339
1340# if and else should not have general statements after it
1341 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1342 $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1343 ERROR("trailing statements should be on next line\n" . $herecurr);
1178 } 1344 }
1179 1345
1180 # Check for }<nl>else {, these must be at the same 1346 # Check for }<nl>else {, these must be at the same
@@ -1205,12 +1371,6 @@ sub process {
1205 } 1371 }
1206 } 1372 }
1207 1373
1208# if and else should not have general statements after it
1209 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1210 $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1211 ERROR("trailing statements should be on next line\n" . $herecurr);
1212 }
1213
1214# multi-statement macros should be enclosed in a do while loop, grab the 1374# multi-statement macros should be enclosed in a do while loop, grab the
1215# first statement and ensure its the whole macro if its not enclosed 1375# first statement and ensure its the whole macro if its not enclosed
1216# in a known goot container 1376# in a known goot container
@@ -1233,6 +1393,10 @@ sub process {
1233 $off = length($1); 1393 $off = length($1);
1234 $ln--; 1394 $ln--;
1235 $cnt++; 1395 $cnt++;
1396 while ($lines[$ln - 1] =~ /^-/) {
1397 $ln--;
1398 $cnt++;
1399 }
1236 } 1400 }
1237 my @ctx = ctx_statement($ln, $cnt, $off); 1401 my @ctx = ctx_statement($ln, $cnt, $off);
1238 my $ctx_ln = $ln + $#ctx + 1; 1402 my $ctx_ln = $ln + $#ctx + 1;
@@ -1268,25 +1432,23 @@ sub process {
1268 if ($lines[$nr - 1] =~ /{\s*$/) { 1432 if ($lines[$nr - 1] =~ /{\s*$/) {
1269 my ($lvl, @block) = ctx_block_level($nr, $cnt); 1433 my ($lvl, @block) = ctx_block_level($nr, $cnt);
1270 1434
1271 my $stmt = join(' ', @block); 1435 my $stmt = join("\n", @block);
1272 $stmt =~ s/(^[^{]*){//; 1436 # Drop the diff line leader.
1437 $stmt =~ s/\n./\n/g;
1438 # Drop the code outside the block.
1439 $stmt =~ s/(^[^{]*){\s*//;
1273 my $before = $1; 1440 my $before = $1;
1274 $stmt =~ s/}([^}]*$)//; 1441 $stmt =~ s/\s*}([^}]*$)//;
1275 my $after = $1; 1442 my $after = $1;
1276 1443
1277 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n"; 1444 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
1278 #print "stmt<$stmt>\n\n"; 1445 #print "stmt<$stmt>\n\n";
1279 1446
1280 # Count the ;'s if there is fewer than two 1447 # Count the newlines, if there is only one
1281 # then there can only be one statement, 1448 # then the block should not have {}'s.
1282 # if there is a brace inside we cannot 1449 my @lines = ($stmt =~ /\n/g);
1283 # trivially detect if its one statement. 1450 #print "lines<" . scalar(@lines) . ">\n";
1284 # Also nested if's often require braces to 1451 if ($lvl == 0 && scalar(@lines) == 0 &&
1285 # disambiguate the else binding so shhh there.
1286 my @semi = ($stmt =~ /;/g);
1287 push(@semi, "/**/") if ($stmt =~ m@/\*@);
1288 ##print "semi<" . scalar(@semi) . ">\n";
1289 if ($lvl == 0 && scalar(@semi) < 2 &&
1290 $stmt !~ /{/ && $stmt !~ /\bif\b/ && 1452 $stmt !~ /{/ && $stmt !~ /\bif\b/ &&
1291 $before !~ /}/ && $after !~ /{/) { 1453 $before !~ /}/ && $after !~ /{/) {
1292 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n"; 1454 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n";
@@ -1372,6 +1534,11 @@ sub process {
1372 ERROR("inline keyword should sit between storage class and type\n" . $herecurr); 1534 ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
1373 } 1535 }
1374 1536
1537# Check for __inline__ and __inline, prefer inline
1538 if ($line =~ /\b(__inline__|__inline)\b/) {
1539 WARN("plain inline is preferred over $1\n" . $herecurr);
1540 }
1541
1375# check for new externs in .c files. 1542# check for new externs in .c files.
1376 if ($line =~ /^.\s*extern\s/ && ($realfile =~ /\.c$/)) { 1543 if ($line =~ /^.\s*extern\s/ && ($realfile =~ /\.c$/)) {
1377 WARN("externs should be avoided in .c files\n" . $herecurr); 1544 WARN("externs should be avoided in .c files\n" . $herecurr);
@@ -1392,21 +1559,33 @@ sub process {
1392 } 1559 }
1393 } 1560 }
1394 1561
1395 if ($chk_patch && !$is_patch) { 1562 # In mailback mode only produce a report in the negative, for
1563 # things that appear to be patches.
1564 if ($mailback && ($clean == 1 || !$is_patch)) {
1565 exit(0);
1566 }
1567
1568 # This is not a patch, and we are are in 'no-patch' mode so
1569 # just keep quiet.
1570 if (!$chk_patch && !$is_patch) {
1571 exit(0);
1572 }
1573
1574 if (!$is_patch) {
1396 ERROR("Does not appear to be a unified-diff format patch\n"); 1575 ERROR("Does not appear to be a unified-diff format patch\n");
1397 } 1576 }
1398 if ($is_patch && $chk_signoff && $signoff == 0) { 1577 if ($is_patch && $chk_signoff && $signoff == 0) {
1399 ERROR("Missing Signed-off-by: line(s)\n"); 1578 ERROR("Missing Signed-off-by: line(s)\n");
1400 } 1579 }
1401 1580
1402 if ($clean == 0 && ($chk_patch || $is_patch)) { 1581 print report_dump();
1403 print report_dump(); 1582 if ($summary) {
1404 if ($quiet < 2) { 1583 print "total: $cnt_error errors, $cnt_warn warnings, " .
1405 print "total: $cnt_error errors, $cnt_warn warnings, " . 1584 (($check)? "$cnt_chk checks, " : "") .
1406 (($check)? "$cnt_chk checks, " : "") . 1585 "$cnt_lines lines checked\n";
1407 "$cnt_lines lines checked\n"; 1586 print "\n" if ($quiet == 0);
1408 }
1409 } 1587 }
1588
1410 if ($clean == 1 && $quiet == 0) { 1589 if ($clean == 1 && $quiet == 0) {
1411 print "Your patch has no obvious style problems and is ready for submission.\n" 1590 print "Your patch has no obvious style problems and is ready for submission.\n"
1412 } 1591 }
diff --git a/security/commoncap.c b/security/commoncap.c
index 302e8d0839a9..5bc1895f3f9c 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -526,6 +526,15 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info,
526 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) 526 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
527 return 0; 527 return 0;
528 528
529 /*
530 * Running a setuid root program raises your capabilities.
531 * Killing your own setuid root processes was previously
532 * allowed.
533 * We must preserve legacy signal behavior in this case.
534 */
535 if (p->euid == 0 && p->uid == current->uid)
536 return 0;
537
529 /* sigcont is permitted within same session */ 538 /* sigcont is permitted within same session */
530 if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p))) 539 if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p)))
531 return 0; 540 return 0;
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 3306ecd49243..b57f2d5a1c9d 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -97,23 +97,27 @@ static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
97 97
98static void uart_interrupt_tx(struct snd_mpu401 *mpu) 98static void uart_interrupt_tx(struct snd_mpu401 *mpu)
99{ 99{
100 unsigned long flags;
101
100 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) && 102 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) &&
101 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) { 103 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) {
102 spin_lock(&mpu->output_lock); 104 spin_lock_irqsave(&mpu->output_lock, flags);
103 snd_mpu401_uart_output_write(mpu); 105 snd_mpu401_uart_output_write(mpu);
104 spin_unlock(&mpu->output_lock); 106 spin_unlock_irqrestore(&mpu->output_lock, flags);
105 } 107 }
106} 108}
107 109
108static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu) 110static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
109{ 111{
112 unsigned long flags;
113
110 if (mpu->info_flags & MPU401_INFO_INPUT) { 114 if (mpu->info_flags & MPU401_INFO_INPUT) {
111 spin_lock(&mpu->input_lock); 115 spin_lock_irqsave(&mpu->input_lock, flags);
112 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) 116 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
113 snd_mpu401_uart_input_read(mpu); 117 snd_mpu401_uart_input_read(mpu);
114 else 118 else
115 snd_mpu401_uart_clear_rx(mpu); 119 snd_mpu401_uart_clear_rx(mpu);
116 spin_unlock(&mpu->input_lock); 120 spin_unlock_irqrestore(&mpu->input_lock, flags);
117 } 121 }
118 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ)) 122 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ))
119 /* ok. for better Tx performance try do some output 123 /* ok. for better Tx performance try do some output
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index e065b2a6444a..1b832870cc84 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -668,7 +668,7 @@ static int __devinit snd_portman_probe_port(struct parport *p)
668 parport_release(pardev); 668 parport_release(pardev);
669 parport_unregister_device(pardev); 669 parport_unregister_device(pardev);
670 670
671 return res; 671 return res ? -EIO : 0;
672} 672}
673 673
674static void __devinit snd_portman_attach(struct parport *p) 674static void __devinit snd_portman_attach(struct parport *p)
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index be519a17dfa5..3f9b5c560036 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -86,7 +86,7 @@ static int snd_ca0106_shared_spdif_get(struct snd_kcontrol *kcontrol,
86{ 86{
87 struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol); 87 struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
88 88
89 ucontrol->value.enumerated.item[0] = emu->spdif_enable; 89 ucontrol->value.integer.value[0] = emu->spdif_enable;
90 return 0; 90 return 0;
91} 91}
92 92
@@ -98,11 +98,11 @@ static int snd_ca0106_shared_spdif_put(struct snd_kcontrol *kcontrol,
98 int change = 0; 98 int change = 0;
99 u32 mask; 99 u32 mask;
100 100
101 val = ucontrol->value.enumerated.item[0] ; 101 val = !!ucontrol->value.integer.value[0];
102 change = (emu->spdif_enable != val); 102 change = (emu->spdif_enable != val);
103 if (change) { 103 if (change) {
104 emu->spdif_enable = val; 104 emu->spdif_enable = val;
105 if (val == 1) { 105 if (val) {
106 /* Digital */ 106 /* Digital */
107 snd_ca0106_ptr_write(emu, SPDIF_SELECT1, 0, 0xf); 107 snd_ca0106_ptr_write(emu, SPDIF_SELECT1, 0, 0xf);
108 snd_ca0106_ptr_write(emu, SPDIF_SELECT2, 0, 0x0b000000); 108 snd_ca0106_ptr_write(emu, SPDIF_SELECT2, 0, 0x0b000000);
@@ -159,6 +159,8 @@ static int snd_ca0106_capture_source_put(struct snd_kcontrol *kcontrol,
159 u32 source; 159 u32 source;
160 160
161 val = ucontrol->value.enumerated.item[0] ; 161 val = ucontrol->value.enumerated.item[0] ;
162 if (val >= 6)
163 return -EINVAL;
162 change = (emu->capture_source != val); 164 change = (emu->capture_source != val);
163 if (change) { 165 if (change) {
164 emu->capture_source = val; 166 emu->capture_source = val;
@@ -207,6 +209,8 @@ static int snd_ca0106_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
207 * for the particular source. 209 * for the particular source.
208 */ 210 */
209 source_id = ucontrol->value.enumerated.item[0] ; 211 source_id = ucontrol->value.enumerated.item[0] ;
212 if (source_id >= 4)
213 return -EINVAL;
210 change = (emu->i2c_capture_source != source_id); 214 change = (emu->i2c_capture_source != source_id);
211 if (change) { 215 if (change) {
212 snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */ 216 snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */
@@ -271,6 +275,8 @@ static int snd_ca0106_capture_mic_line_in_put(struct snd_kcontrol *kcontrol,
271 u32 tmp; 275 u32 tmp;
272 276
273 val = ucontrol->value.enumerated.item[0] ; 277 val = ucontrol->value.enumerated.item[0] ;
278 if (val > 1)
279 return -EINVAL;
274 change = (emu->capture_mic_line_in != val); 280 change = (emu->capture_mic_line_in != val);
275 if (change) { 281 if (change) {
276 emu->capture_mic_line_in = val; 282 emu->capture_mic_line_in = val;
@@ -443,7 +449,7 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
443 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ 449 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
444 ngain = ucontrol->value.integer.value[0]; 450 ngain = ucontrol->value.integer.value[0];
445 if (ngain > 0xff) 451 if (ngain > 0xff)
446 return 0; 452 return -EINVAL;
447 if (ogain != ngain) { 453 if (ogain != ngain) {
448 if (emu->i2c_capture_source == source_id) 454 if (emu->i2c_capture_source == source_id)
449 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); 455 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
@@ -453,7 +459,7 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
453 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ 459 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
454 ngain = ucontrol->value.integer.value[1]; 460 ngain = ucontrol->value.integer.value[1];
455 if (ngain > 0xff) 461 if (ngain > 0xff)
456 return 0; 462 return -EINVAL;
457 if (ogain != ngain) { 463 if (ogain != ngain) {
458 if (emu->i2c_capture_source == source_id) 464 if (emu->i2c_capture_source == source_id)
459 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); 465 snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
@@ -497,7 +503,7 @@ static int spi_mute_put(struct snd_kcontrol *kcontrol,
497 } 503 }
498 504
499 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]); 505 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]);
500 return ret ? -1 : 1; 506 return ret ? -EINVAL : 1;
501} 507}
502 508
503#define CA_VOLUME(xname,chid,reg) \ 509#define CA_VOLUME(xname,chid,reg) \
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index ae80f51d8c4f..61f2718ae359 100644
--- a/sound/pci/ca0106/ca0106_proc.c
+++ b/sound/pci/ca0106/ca0106_proc.c
@@ -445,13 +445,11 @@ int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu)
445 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1); 445 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1);
446 entry->c.text.write = snd_ca0106_proc_reg_write; 446 entry->c.text.write = snd_ca0106_proc_reg_write;
447 entry->mode |= S_IWUSR; 447 entry->mode |= S_IWUSR;
448// entry->private_data = emu;
449 } 448 }
450 if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) { 449 if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) {
451 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_i2c_write);
452 entry->c.text.write = snd_ca0106_proc_i2c_write; 450 entry->c.text.write = snd_ca0106_proc_i2c_write;
451 entry->private_data = emu;
453 entry->mode |= S_IWUSR; 452 entry->mode |= S_IWUSR;
454// entry->private_data = emu;
455 } 453 }
456 if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) 454 if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry))
457 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2); 455 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 6832649879ce..1fa5f004e858 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -246,10 +246,9 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */ 246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */
247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */ 247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */
248#define CM_ENCENTER 0x00000080 248#define CM_ENCENTER 0x00000080
249#define CM_FLINKON 0x00000080 /* force modem link detection on, model 037 */ 249#define CM_FLINKON 0x00000040 /* force modem link detection on, model 037 */
250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */ 250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */
251#define CM_FLINKOFF 0x00000040 /* force modem link detection off, model 037 */ 251#define CM_FLINKOFF 0x00000020 /* force modem link detection off, model 037 */
252#define CM_UNKNOWN_18_5 0x00000020 /* ? */
253#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */ 252#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */
254#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */ 253#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */
255#define CM_UPDDMA_2048 0x00000000 254#define CM_UPDDMA_2048 0x00000000
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index 54a2034d8edd..ccacd7b890e8 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -58,6 +58,9 @@ static int snd_emu10k1_spdif_get(struct snd_kcontrol *kcontrol,
58 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 58 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
59 unsigned long flags; 59 unsigned long flags;
60 60
61 /* Limit: emu->spdif_bits */
62 if (idx >= 3)
63 return -EINVAL;
61 spin_lock_irqsave(&emu->reg_lock, flags); 64 spin_lock_irqsave(&emu->reg_lock, flags);
62 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff; 65 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff;
63 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff; 66 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff;
@@ -272,9 +275,12 @@ static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
272 struct snd_ctl_elem_value *ucontrol) 275 struct snd_ctl_elem_value *ucontrol)
273{ 276{
274 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 277 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
275 int channel; 278 unsigned int channel;
276 279
277 channel = (kcontrol->private_value) & 0xff; 280 channel = (kcontrol->private_value) & 0xff;
281 /* Limit: emu1010_output_dst, emu->emu1010.output_source */
282 if (channel >= 24)
283 return -EINVAL;
278 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; 284 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
279 return 0; 285 return 0;
280} 286}
@@ -285,11 +291,17 @@ static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,
285 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 291 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
286 int change = 0; 292 int change = 0;
287 unsigned int val; 293 unsigned int val;
288 int channel; 294 unsigned int channel;
289 295
296 val = ucontrol->value.enumerated.item[0];
297 if (val >= 53)
298 return -EINVAL;
290 channel = (kcontrol->private_value) & 0xff; 299 channel = (kcontrol->private_value) & 0xff;
291 if (emu->emu1010.output_source[channel] != ucontrol->value.enumerated.item[0]) { 300 /* Limit: emu1010_output_dst, emu->emu1010.output_source */
292 val = emu->emu1010.output_source[channel] = ucontrol->value.enumerated.item[0]; 301 if (channel >= 24)
302 return -EINVAL;
303 if (emu->emu1010.output_source[channel] != val) {
304 emu->emu1010.output_source[channel] = val;
293 change = 1; 305 change = 1;
294 snd_emu1010_fpga_link_dst_src_write(emu, 306 snd_emu1010_fpga_link_dst_src_write(emu,
295 emu1010_output_dst[channel], emu1010_src_regs[val]); 307 emu1010_output_dst[channel], emu1010_src_regs[val]);
@@ -301,9 +313,12 @@ static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol,
301 struct snd_ctl_elem_value *ucontrol) 313 struct snd_ctl_elem_value *ucontrol)
302{ 314{
303 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 315 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
304 int channel; 316 unsigned int channel;
305 317
306 channel = (kcontrol->private_value) & 0xff; 318 channel = (kcontrol->private_value) & 0xff;
319 /* Limit: emu1010_input_dst, emu->emu1010.input_source */
320 if (channel >= 22)
321 return -EINVAL;
307 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel]; 322 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel];
308 return 0; 323 return 0;
309} 324}
@@ -314,11 +329,17 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
314 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 329 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
315 int change = 0; 330 int change = 0;
316 unsigned int val; 331 unsigned int val;
317 int channel; 332 unsigned int channel;
318 333
334 val = ucontrol->value.enumerated.item[0];
335 if (val >= 53)
336 return -EINVAL;
319 channel = (kcontrol->private_value) & 0xff; 337 channel = (kcontrol->private_value) & 0xff;
320 if (emu->emu1010.input_source[channel] != ucontrol->value.enumerated.item[0]) { 338 /* Limit: emu1010_input_dst, emu->emu1010.input_source */
321 val = emu->emu1010.input_source[channel] = ucontrol->value.enumerated.item[0]; 339 if (channel >= 22)
340 return -EINVAL;
341 if (emu->emu1010.input_source[channel] != val) {
342 emu->emu1010.input_source[channel] = val;
322 change = 1; 343 change = 1;
323 snd_emu1010_fpga_link_dst_src_write(emu, 344 snd_emu1010_fpga_link_dst_src_write(emu,
324 emu1010_input_dst[channel], emu1010_src_regs[val]); 345 emu1010_input_dst[channel], emu1010_src_regs[val]);
@@ -533,6 +554,9 @@ static int snd_emu1010_internal_clock_put(struct snd_kcontrol *kcontrol,
533 int change = 0; 554 int change = 0;
534 555
535 val = ucontrol->value.enumerated.item[0] ; 556 val = ucontrol->value.enumerated.item[0] ;
557 /* Limit: uinfo->value.enumerated.items = 4; */
558 if (val >= 4)
559 return -EINVAL;
536 change = (emu->emu1010.internal_clock != val); 560 change = (emu->emu1010.internal_clock != val);
537 if (change) { 561 if (change) {
538 emu->emu1010.internal_clock = val; 562 emu->emu1010.internal_clock = val;
@@ -669,7 +693,11 @@ static int snd_audigy_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
669 * update the capture volume from the cached value 693 * update the capture volume from the cached value
670 * for the particular source. 694 * for the particular source.
671 */ 695 */
672 source_id = ucontrol->value.enumerated.item[0]; /* Use 2 and 3 */ 696 source_id = ucontrol->value.enumerated.item[0];
697 /* Limit: uinfo->value.enumerated.items = 2; */
698 /* emu->i2c_capture_volume */
699 if (source_id >= 2)
700 return -EINVAL;
673 change = (emu->i2c_capture_source != source_id); 701 change = (emu->i2c_capture_source != source_id);
674 if (change) { 702 if (change) {
675 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */ 703 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */
@@ -720,9 +748,13 @@ static int snd_audigy_i2c_volume_get(struct snd_kcontrol *kcontrol,
720 struct snd_ctl_elem_value *ucontrol) 748 struct snd_ctl_elem_value *ucontrol)
721{ 749{
722 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 750 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
723 int source_id; 751 unsigned int source_id;
724 752
725 source_id = kcontrol->private_value; 753 source_id = kcontrol->private_value;
754 /* Limit: emu->i2c_capture_volume */
755 /* capture_source: uinfo->value.enumerated.items = 2 */
756 if (source_id >= 2)
757 return -EINVAL;
726 758
727 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; 759 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0];
728 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; 760 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1];
@@ -735,10 +767,14 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
735 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); 767 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
736 unsigned int ogain; 768 unsigned int ogain;
737 unsigned int ngain; 769 unsigned int ngain;
738 int source_id; 770 unsigned int source_id;
739 int change = 0; 771 int change = 0;
740 772
741 source_id = kcontrol->private_value; 773 source_id = kcontrol->private_value;
774 /* Limit: emu->i2c_capture_volume */
775 /* capture_source: uinfo->value.enumerated.items = 2 */
776 if (source_id >= 2)
777 return -EINVAL;
742 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ 778 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
743 ngain = ucontrol->value.integer.value[0]; 779 ngain = ucontrol->value.integer.value[0];
744 if (ngain > 0xff) 780 if (ngain > 0xff)
@@ -746,7 +782,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
746 if (ogain != ngain) { 782 if (ogain != ngain) {
747 if (emu->i2c_capture_source == source_id) 783 if (emu->i2c_capture_source == source_id)
748 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); 784 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
749 emu->i2c_capture_volume[source_id][0] = ucontrol->value.integer.value[0]; 785 emu->i2c_capture_volume[source_id][0] = ngain;
750 change = 1; 786 change = 1;
751 } 787 }
752 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ 788 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
@@ -756,7 +792,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
756 if (ogain != ngain) { 792 if (ogain != ngain) {
757 if (emu->i2c_capture_source == source_id) 793 if (emu->i2c_capture_source == source_id)
758 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); 794 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
759 emu->i2c_capture_volume[source_id][1] = ucontrol->value.integer.value[1]; 795 emu->i2c_capture_volume[source_id][1] = ngain;
760 change = 1; 796 change = 1;
761 } 797 }
762 798
@@ -877,6 +913,9 @@ static int snd_emu10k1_spdif_put(struct snd_kcontrol *kcontrol,
877 unsigned int val; 913 unsigned int val;
878 unsigned long flags; 914 unsigned long flags;
879 915
916 /* Limit: emu->spdif_bits */
917 if (idx >= 3)
918 return -EINVAL;
880 val = (ucontrol->value.iec958.status[0] << 0) | 919 val = (ucontrol->value.iec958.status[0] << 0) |
881 (ucontrol->value.iec958.status[1] << 8) | 920 (ucontrol->value.iec958.status[1] << 8) |
882 (ucontrol->value.iec958.status[2] << 16) | 921 (ucontrol->value.iec958.status[2] << 16) |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index d619a3842cdd..9fd3135f3118 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -742,6 +742,8 @@ static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
742 u32 source; 742 u32 source;
743 743
744 val = ucontrol->value.enumerated.item[0] ; 744 val = ucontrol->value.enumerated.item[0] ;
745 if (val > 7)
746 return -EINVAL;
745 change = (emu->p16v_capture_source != val); 747 change = (emu->p16v_capture_source != val);
746 if (change) { 748 if (change) {
747 emu->p16v_capture_source = val; 749 emu->p16v_capture_source = val;
@@ -784,6 +786,8 @@ static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
784 u32 tmp; 786 u32 tmp;
785 787
786 val = ucontrol->value.enumerated.item[0] ; 788 val = ucontrol->value.enumerated.item[0] ;
789 if (val > 3)
790 return -EINVAL;
787 change = (emu->p16v_capture_channel != val); 791 change = (emu->p16v_capture_channel != val);
788 if (change) { 792 if (change) {
789 emu->p16v_capture_channel = val; 793 emu->p16v_capture_channel = val;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ad4cb38109fc..8cbe3bf1e317 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1625,19 +1625,26 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
1625 1625
1626 nid = codec->start_nid; 1626 nid = codec->start_nid;
1627 for (i = 0; i < codec->num_nodes; i++, nid++) { 1627 for (i = 0; i < codec->num_nodes; i++, nid++) {
1628 if (get_wcaps(codec, nid) & AC_WCAP_POWER) { 1628 unsigned int wcaps = get_wcaps(codec, nid);
1629 unsigned int pincap; 1629 if (wcaps & AC_WCAP_POWER) {
1630 /* 1630 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
1631 * don't power down the widget if it controls eapd 1631 AC_WCAP_TYPE_SHIFT;
1632 * and EAPD_BTLENABLE is set. 1632 if (wid_type == AC_WID_PIN) {
1633 */ 1633 unsigned int pincap;
1634 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 1634 /*
1635 if (pincap & AC_PINCAP_EAPD) { 1635 * don't power down the widget if it controls
1636 int eapd = snd_hda_codec_read(codec, nid, 1636 * eapd and EAPD_BTLENABLE is set.
1637 0, AC_VERB_GET_EAPD_BTLENABLE, 0); 1637 */
1638 eapd &= 0x02; 1638 pincap = snd_hda_param_read(codec, nid,
1639 if (power_state == AC_PWRST_D3 && eapd) 1639 AC_PAR_PIN_CAP);
1640 continue; 1640 if (pincap & AC_PINCAP_EAPD) {
1641 int eapd = snd_hda_codec_read(codec,
1642 nid, 0,
1643 AC_VERB_GET_EAPD_BTLENABLE, 0);
1644 eapd &= 0x02;
1645 if (power_state == AC_PWRST_D3 && eapd)
1646 continue;
1647 }
1641 } 1648 }
1642 snd_hda_codec_write(codec, nid, 0, 1649 snd_hda_codec_write(codec, nid, 0,
1643 AC_VERB_SET_POWER_STATE, 1650 AC_VERB_SET_POWER_STATE,
@@ -2485,13 +2492,14 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2485 /* front */ 2492 /* front */
2486 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 2493 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag,
2487 0, format); 2494 0, format);
2488 if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT]) 2495 if (!mout->no_share_stream &&
2496 mout->hp_nid && mout->hp_nid != nids[HDA_FRONT])
2489 /* headphone out will just decode front left/right (stereo) */ 2497 /* headphone out will just decode front left/right (stereo) */
2490 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, 2498 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag,
2491 0, format); 2499 0, format);
2492 /* extra outputs copied from front */ 2500 /* extra outputs copied from front */
2493 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) 2501 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++)
2494 if (mout->extra_out_nid[i]) 2502 if (!mout->no_share_stream && mout->extra_out_nid[i])
2495 snd_hda_codec_setup_stream(codec, 2503 snd_hda_codec_setup_stream(codec,
2496 mout->extra_out_nid[i], 2504 mout->extra_out_nid[i],
2497 stream_tag, 0, format); 2505 stream_tag, 0, format);
@@ -2501,7 +2509,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2501 if (chs >= (i + 1) * 2) /* independent out */ 2509 if (chs >= (i + 1) * 2) /* independent out */
2502 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 2510 snd_hda_codec_setup_stream(codec, nids[i], stream_tag,
2503 i * 2, format); 2511 i * 2, format);
2504 else /* copy front */ 2512 else if (!mout->no_share_stream) /* copy front */
2505 snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 2513 snd_hda_codec_setup_stream(codec, nids[i], stream_tag,
2506 0, format); 2514 0, format);
2507 } 2515 }
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 20c5e6250374..8c56c9cb0d09 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -220,6 +220,7 @@ struct hda_multi_out {
220 hda_nid_t dig_out_nid; /* digital out audio widget */ 220 hda_nid_t dig_out_nid; /* digital out audio widget */
221 int max_channels; /* currently supported analog channels */ 221 int max_channels; /* currently supported analog channels */
222 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ 222 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
223 int no_share_stream; /* don't share a stream with multiple pins */
223}; 224};
224 225
225int snd_hda_multi_out_dig_open(struct hda_codec *codec, 226int snd_hda_multi_out_dig_open(struct hda_codec *codec,
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 0ee8ae4d4410..196ad3c9405d 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -957,6 +957,14 @@ static int patch_ad1986a(struct hda_codec *codec)
957 break; 957 break;
958 } 958 }
959 959
960 /* AD1986A has a hardware problem that it can't share a stream
961 * with multiple output pins. The copy of front to surrounds
962 * causes noisy or silent outputs at a certain timing, e.g.
963 * changing the volume.
964 * So, let's disable the shared stream.
965 */
966 spec->multiout.no_share_stream = 1;
967
960 return 0; 968 return 0;
961} 969}
962 970
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f9b2c435a130..04012237096c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -111,7 +111,6 @@ struct sigmatel_spec {
111 unsigned int alt_switch: 1; 111 unsigned int alt_switch: 1;
112 unsigned int hp_detect: 1; 112 unsigned int hp_detect: 1;
113 unsigned int gpio_mute: 1; 113 unsigned int gpio_mute: 1;
114 unsigned int no_vol_knob :1;
115 114
116 unsigned int gpio_mask, gpio_data; 115 unsigned int gpio_mask, gpio_data;
117 116
@@ -342,42 +341,6 @@ static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
342 return 1; 341 return 1;
343} 342}
344 343
345static int stac92xx_volknob_info(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_info *uinfo)
347{
348 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
349 uinfo->count = 1;
350 uinfo->value.integer.min = 0;
351 uinfo->value.integer.max = 127;
352 return 0;
353}
354
355static int stac92xx_volknob_get(struct snd_kcontrol *kcontrol,
356 struct snd_ctl_elem_value *ucontrol)
357{
358 ucontrol->value.integer.value[0] = kcontrol->private_value & 0xff;
359 return 0;
360}
361
362static int stac92xx_volknob_put(struct snd_kcontrol *kcontrol,
363 struct snd_ctl_elem_value *ucontrol)
364{
365 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
366 unsigned int val = kcontrol->private_value & 0xff;
367
368 if (val == ucontrol->value.integer.value[0])
369 return 0;
370
371 val = ucontrol->value.integer.value[0];
372 kcontrol->private_value &= ~0xff;
373 kcontrol->private_value |= val;
374
375 snd_hda_codec_write_cache(codec, kcontrol->private_value >> 16, 0,
376 AC_VERB_SET_VOLUME_KNOB_CONTROL, val | 0x80);
377 return 1;
378}
379
380
381static struct hda_verb stac9200_core_init[] = { 344static struct hda_verb stac9200_core_init[] = {
382 /* set dac0mux for dac converter */ 345 /* set dac0mux for dac converter */
383 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 346 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -446,18 +409,6 @@ static struct hda_verb stac9205_core_init[] = {
446 .private_value = verb_read | (verb_write << 16), \ 409 .private_value = verb_read | (verb_write << 16), \
447 } 410 }
448 411
449#define STAC_VOLKNOB(knob_nid) \
450 { \
451 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
452 .name = "Master Playback Volume", \
453 .count = 1, \
454 .info = stac92xx_volknob_info, \
455 .get = stac92xx_volknob_get, \
456 .put = stac92xx_volknob_put, \
457 .private_value = 127 | (knob_nid << 16), \
458 }
459
460
461static struct snd_kcontrol_new stac9200_mixer[] = { 412static struct snd_kcontrol_new stac9200_mixer[] = {
462 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 413 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
463 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), 414 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
@@ -487,7 +438,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
487 }, 438 },
488 STAC_INPUT_SOURCE(2), 439 STAC_INPUT_SOURCE(2),
489 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), 440 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
490 STAC_VOLKNOB(0x24),
491 441
492 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), 442 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
493 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), 443 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
@@ -503,7 +453,6 @@ static struct snd_kcontrol_new stac9205_mixer[] = {
503/* This needs to be generated dynamically based on sequence */ 453/* This needs to be generated dynamically based on sequence */
504static struct snd_kcontrol_new stac922x_mixer[] = { 454static struct snd_kcontrol_new stac922x_mixer[] = {
505 STAC_INPUT_SOURCE(2), 455 STAC_INPUT_SOURCE(2),
506 STAC_VOLKNOB(0x16),
507 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), 456 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
508 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), 457 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
509 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT), 458 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
@@ -517,7 +466,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = {
517 466
518static struct snd_kcontrol_new stac927x_mixer[] = { 467static struct snd_kcontrol_new stac927x_mixer[] = {
519 STAC_INPUT_SOURCE(3), 468 STAC_INPUT_SOURCE(3),
520 STAC_VOLKNOB(0x24),
521 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), 469 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
522 470
523 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), 471 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
@@ -1931,8 +1879,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
1931 } 1879 }
1932 if (spec->multiout.hp_nid) { 1880 if (spec->multiout.hp_nid) {
1933 const char *pfx; 1881 const char *pfx;
1934 if (old_num_dacs == spec->multiout.num_dacs && 1882 if (old_num_dacs == spec->multiout.num_dacs)
1935 spec->no_vol_knob)
1936 pfx = "Master"; 1883 pfx = "Master";
1937 else 1884 else
1938 pfx = "Headphone"; 1885 pfx = "Headphone";
@@ -2489,7 +2436,6 @@ static int patch_stac9200(struct hda_codec *codec)
2489 codec->spec = spec; 2436 codec->spec = spec;
2490 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 2437 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
2491 spec->pin_nids = stac9200_pin_nids; 2438 spec->pin_nids = stac9200_pin_nids;
2492 spec->no_vol_knob = 1;
2493 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, 2439 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
2494 stac9200_models, 2440 stac9200_models,
2495 stac9200_cfg_tbl); 2441 stac9200_cfg_tbl);
@@ -2544,7 +2490,6 @@ static int patch_stac925x(struct hda_codec *codec)
2544 codec->spec = spec; 2490 codec->spec = spec;
2545 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 2491 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
2546 spec->pin_nids = stac925x_pin_nids; 2492 spec->pin_nids = stac925x_pin_nids;
2547 spec->no_vol_knob = 1;
2548 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 2493 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
2549 stac925x_models, 2494 stac925x_models,
2550 stac925x_cfg_tbl); 2495 stac925x_cfg_tbl);
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 5d601ad6da70..abac62866da8 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -725,7 +725,8 @@ static int cs4270_probe(struct platform_device *pdev)
725 codec->owner = THIS_MODULE; 725 codec->owner = THIS_MODULE;
726 codec->dai = &cs4270_dai; 726 codec->dai = &cs4270_dai;
727 codec->num_dai = 1; 727 codec->num_dai = 1;
728 codec->private_data = codec + ALIGN(sizeof(struct snd_soc_codec), 4); 728 codec->private_data = (void *) codec +
729 ALIGN(sizeof(struct snd_soc_codec), 4);
729 730
730 socdev->codec = codec; 731 socdev->codec = codec;
731 732
diff --git a/sound/soc/s3c24xx/s3c2443-ac97.c b/sound/soc/s3c24xx/s3c2443-ac97.c
index 75acf7ef5528..758a2637e7ac 100644
--- a/sound/soc/s3c24xx/s3c2443-ac97.c
+++ b/sound/soc/s3c24xx/s3c2443-ac97.c
@@ -32,7 +32,7 @@
32 32
33#include <asm/hardware.h> 33#include <asm/hardware.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/arch/regs-ac97.h> 35#include <asm/plat-s3c/regs-ac97.h>
36#include <asm/arch/regs-gpio.h> 36#include <asm/arch/regs-gpio.h>
37#include <asm/arch/regs-clock.h> 37#include <asm/arch/regs-clock.h>
38#include <asm/arch/audio.h> 38#include <asm/arch/audio.h>