aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-01-13 03:58:37 -0500
committerIngo Molnar <mingo@elte.hu>2010-01-13 04:08:50 -0500
commit61405fea92c42d072d9b8bd189689f1502a838af (patch)
tree013ea3e7ed71f4114004d5852d40b6e89e128f76
parent9c443dfdd31eddea6cbe6ee0ca469fbcc4e1dc3b (diff)
parent1703f2c321a8a531c393e137a82602e16c6061cb (diff)
Merge branch 'perf/urgent' into perf/core
Merge reason: queue up dependent patch, update to -rc4 Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--.gitignore8
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb18
-rw-r--r--Documentation/DocBook/mtdnand.tmpl12
-rw-r--r--Documentation/IO-mapping.txt2
-rw-r--r--Documentation/PCI/PCI-DMA-mapping.txt (renamed from Documentation/DMA-mapping.txt)0
-rw-r--r--Documentation/block/00-INDEX2
-rw-r--r--Documentation/block/as-iosched.txt172
-rw-r--r--Documentation/block/biodoc.txt2
-rw-r--r--Documentation/cpu-hotplug.txt49
-rw-r--r--Documentation/dontdiff1
-rw-r--r--Documentation/driver-model/driver.txt4
-rw-r--r--Documentation/filesystems/ext4.txt2
-rw-r--r--Documentation/filesystems/nilfs2.txt2
-rw-r--r--Documentation/filesystems/proc.txt2
-rw-r--r--Documentation/filesystems/sysfs.txt12
-rw-r--r--Documentation/hwmon/amc6821102
-rw-r--r--Documentation/hwmon/k10temp65
-rw-r--r--Documentation/ioctl/ioctl-number.txt203
-rw-r--r--Documentation/kbuild/kbuild.txt14
-rw-r--r--Documentation/kbuild/kconfig.txt8
-rw-r--r--Documentation/kernel-doc-nano-HOWTO.txt12
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Documentation/kvm/api.txt10
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt58
-rw-r--r--Documentation/networking/3c509.txt12
-rw-r--r--Documentation/power/runtime_pm.txt223
-rw-r--r--Documentation/powerpc/dts-bindings/fsl/mpic.txt42
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt1
-rw-r--r--Documentation/sound/alsa/Procfile.txt2
-rw-r--r--Documentation/stable_kernel_rules.txt24
-rw-r--r--Documentation/trace/events-kmem.txt14
-rw-r--r--Documentation/trace/ftrace-design.txt14
-rw-r--r--Documentation/trace/mmiotrace.txt15
-rw-r--r--Documentation/trace/ring-buffer-design.txt56
-rw-r--r--Documentation/trace/tracepoint-analysis.txt60
-rw-r--r--Documentation/usb/power-management.txt41
-rw-r--r--Documentation/vgaarbiter.txt2
-rw-r--r--Kbuild4
-rw-r--r--MAINTAINERS63
-rw-r--r--Makefile107
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/boot/bootp.c2
-rw-r--r--arch/alpha/boot/bootpz.c2
-rw-r--r--arch/alpha/boot/main.c2
-rw-r--r--arch/alpha/include/asm/asm-offsets.h1
-rw-r--r--arch/alpha/include/asm/bug.h3
-rw-r--r--arch/alpha/include/asm/fcntl.h2
-rw-r--r--arch/alpha/include/asm/perf_event.h9
-rw-r--r--arch/alpha/include/asm/unistd.h17
-rw-r--r--arch/alpha/kernel/systbls.S16
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/Makefile14
-rw-r--r--arch/arm/boot/compressed/Makefile34
-rw-r--r--arch/arm/boot/compressed/misc.c116
-rw-r--r--arch/arm/boot/compressed/piggy.gzip.S6
-rw-r--r--arch/arm/boot/compressed/piggy.lzo.S (renamed from arch/arm/boot/compressed/piggy.S)2
-rw-r--r--arch/arm/common/dmabounce.c12
-rw-r--r--arch/arm/configs/acs5k_defconfig1
-rw-r--r--arch/arm/configs/acs5k_tiny_defconfig1
-rw-r--r--arch/arm/configs/afeb9260_defconfig1
-rw-r--r--arch/arm/configs/am200epdkit_defconfig1
-rw-r--r--arch/arm/configs/am3517_evm_defconfig1
-rw-r--r--arch/arm/configs/ams_delta_defconfig1
-rw-r--r--arch/arm/configs/assabet_defconfig1
-rw-r--r--arch/arm/configs/at91cap9adk_defconfig1
-rw-r--r--arch/arm/configs/at91rm9200dk_defconfig1
-rw-r--r--arch/arm/configs/at91rm9200ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9260ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9261ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9263ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9g20ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9rlek_defconfig1
-rw-r--r--arch/arm/configs/ateb9200_defconfig1
-rw-r--r--arch/arm/configs/badge4_defconfig1
-rw-r--r--arch/arm/configs/bcmring_defconfig1
-rw-r--r--arch/arm/configs/cam60_defconfig1
-rw-r--r--arch/arm/configs/carmeva_defconfig1
-rw-r--r--arch/arm/configs/cerfcube_defconfig1
-rw-r--r--arch/arm/configs/cm_t35_defconfig1
-rw-r--r--arch/arm/configs/cm_x2xx_defconfig1
-rw-r--r--arch/arm/configs/cm_x300_defconfig1
-rw-r--r--arch/arm/configs/colibri_pxa270_defconfig1
-rw-r--r--arch/arm/configs/colibri_pxa300_defconfig1
-rw-r--r--arch/arm/configs/collie_defconfig1
-rw-r--r--arch/arm/configs/corgi_defconfig1
-rw-r--r--arch/arm/configs/cpu9260_defconfig1
-rw-r--r--arch/arm/configs/cpu9g20_defconfig1
-rw-r--r--arch/arm/configs/cpuat91_defconfig1
-rw-r--r--arch/arm/configs/csb337_defconfig1
-rw-r--r--arch/arm/configs/csb637_defconfig1
-rw-r--r--arch/arm/configs/da8xx_omapl_defconfig1
-rw-r--r--arch/arm/configs/davinci_all_defconfig1
-rw-r--r--arch/arm/configs/dove_defconfig1
-rw-r--r--arch/arm/configs/ebsa110_defconfig1
-rw-r--r--arch/arm/configs/ecbat91_defconfig1
-rw-r--r--arch/arm/configs/edb7211_defconfig1
-rw-r--r--arch/arm/configs/em_x270_defconfig1
-rw-r--r--arch/arm/configs/ep93xx_defconfig1
-rw-r--r--arch/arm/configs/eseries_pxa_defconfig1
-rw-r--r--arch/arm/configs/ezx_defconfig1
-rw-r--r--arch/arm/configs/footbridge_defconfig1
-rw-r--r--arch/arm/configs/fortunet_defconfig1
-rw-r--r--arch/arm/configs/h3600_defconfig1
-rw-r--r--arch/arm/configs/h5000_defconfig1
-rw-r--r--arch/arm/configs/h7201_defconfig1
-rw-r--r--arch/arm/configs/h7202_defconfig1
-rw-r--r--arch/arm/configs/hackkit_defconfig1
-rw-r--r--arch/arm/configs/htcherald_defconfig1
-rw-r--r--arch/arm/configs/igep0020_defconfig1
-rw-r--r--arch/arm/configs/integrator_defconfig1
-rw-r--r--arch/arm/configs/iop13xx_defconfig1
-rw-r--r--arch/arm/configs/iop32x_defconfig1
-rw-r--r--arch/arm/configs/iop33x_defconfig1
-rw-r--r--arch/arm/configs/ixp2000_defconfig1
-rw-r--r--arch/arm/configs/ixp23xx_defconfig1
-rw-r--r--arch/arm/configs/ixp4xx_defconfig1
-rw-r--r--arch/arm/configs/jornada720_defconfig1
-rw-r--r--arch/arm/configs/kafa_defconfig1
-rw-r--r--arch/arm/configs/kb9202_defconfig1
-rw-r--r--arch/arm/configs/kirkwood_defconfig1
-rw-r--r--arch/arm/configs/ks8695_defconfig1
-rw-r--r--arch/arm/configs/lart_defconfig1
-rw-r--r--arch/arm/configs/loki_defconfig1
-rw-r--r--arch/arm/configs/lpd270_defconfig1
-rw-r--r--arch/arm/configs/lpd7a400_defconfig1
-rw-r--r--arch/arm/configs/lpd7a404_defconfig1
-rw-r--r--arch/arm/configs/lubbock_defconfig1
-rw-r--r--arch/arm/configs/lusl7200_defconfig1
-rw-r--r--arch/arm/configs/magician_defconfig1
-rw-r--r--arch/arm/configs/mainstone_defconfig1
-rw-r--r--arch/arm/configs/mini2440_defconfig1
-rw-r--r--arch/arm/configs/msm_defconfig1
-rw-r--r--arch/arm/configs/mv78xx0_defconfig1
-rw-r--r--arch/arm/configs/mx1_defconfig1
-rw-r--r--arch/arm/configs/mx1ads_defconfig1
-rw-r--r--arch/arm/configs/mx21_defconfig1
-rw-r--r--arch/arm/configs/mx27_defconfig1
-rw-r--r--arch/arm/configs/mx31pdk_defconfig1
-rw-r--r--arch/arm/configs/mx3_defconfig1
-rw-r--r--arch/arm/configs/n770_defconfig1
-rw-r--r--arch/arm/configs/n8x0_defconfig1
-rw-r--r--arch/arm/configs/neocore926_defconfig1
-rw-r--r--arch/arm/configs/neponset_defconfig1
-rw-r--r--arch/arm/configs/netwinder_defconfig1
-rw-r--r--arch/arm/configs/netx_defconfig1
-rw-r--r--arch/arm/configs/nhk8815_defconfig1
-rw-r--r--arch/arm/configs/nuc910_defconfig1
-rw-r--r--arch/arm/configs/nuc950_defconfig1
-rw-r--r--arch/arm/configs/nuc960_defconfig1
-rw-r--r--arch/arm/configs/omap3_beagle_defconfig1
-rw-r--r--arch/arm/configs/omap3_defconfig1
-rw-r--r--arch/arm/configs/omap3_evm_defconfig1
-rw-r--r--arch/arm/configs/omap3_pandora_defconfig1
-rw-r--r--arch/arm/configs/omap3_touchbook_defconfig1
-rw-r--r--arch/arm/configs/omap_2430sdp_defconfig1
-rw-r--r--arch/arm/configs/omap_3430sdp_defconfig1
-rw-r--r--arch/arm/configs/omap_3630sdp_defconfig1
-rw-r--r--arch/arm/configs/omap_4430sdp_defconfig1
-rw-r--r--arch/arm/configs/omap_apollon_2420_defconfig1
-rw-r--r--arch/arm/configs/omap_generic_1510_defconfig1
-rw-r--r--arch/arm/configs/omap_generic_1610_defconfig1
-rw-r--r--arch/arm/configs/omap_generic_1710_defconfig1
-rw-r--r--arch/arm/configs/omap_generic_2420_defconfig1
-rw-r--r--arch/arm/configs/omap_h2_1610_defconfig1
-rw-r--r--arch/arm/configs/omap_h4_2420_defconfig1
-rw-r--r--arch/arm/configs/omap_innovator_1510_defconfig1
-rw-r--r--arch/arm/configs/omap_innovator_1610_defconfig1
-rw-r--r--arch/arm/configs/omap_ldp_defconfig1
-rw-r--r--arch/arm/configs/omap_osk_5912_defconfig1
-rw-r--r--arch/arm/configs/omap_perseus2_730_defconfig1
-rw-r--r--arch/arm/configs/omap_zoom2_defconfig1
-rw-r--r--arch/arm/configs/omap_zoom3_defconfig1
-rw-r--r--arch/arm/configs/onearm_defconfig1
-rw-r--r--arch/arm/configs/orion5x_defconfig1
-rw-r--r--arch/arm/configs/overo_defconfig1
-rw-r--r--arch/arm/configs/palmte_defconfig1
-rw-r--r--arch/arm/configs/palmtt_defconfig1
-rw-r--r--arch/arm/configs/palmz71_defconfig1
-rw-r--r--arch/arm/configs/palmz72_defconfig1
-rw-r--r--arch/arm/configs/pcm027_defconfig1
-rw-r--r--arch/arm/configs/picotux200_defconfig1
-rw-r--r--arch/arm/configs/pleb_defconfig1
-rw-r--r--arch/arm/configs/pnx4008_defconfig1
-rw-r--r--arch/arm/configs/pxa168_defconfig1
-rw-r--r--arch/arm/configs/pxa255-idp_defconfig1
-rw-r--r--arch/arm/configs/pxa3xx_defconfig1
-rw-r--r--arch/arm/configs/pxa910_defconfig1
-rw-r--r--arch/arm/configs/qil-a9260_defconfig1
-rw-r--r--arch/arm/configs/realview-smp_defconfig1
-rw-r--r--arch/arm/configs/realview_defconfig1
-rw-r--r--arch/arm/configs/rpc_defconfig1
-rw-r--r--arch/arm/configs/rx51_defconfig1
-rw-r--r--arch/arm/configs/s3c2410_defconfig1
-rw-r--r--arch/arm/configs/s3c6400_defconfig1
-rw-r--r--arch/arm/configs/s5pc100_defconfig1
-rw-r--r--arch/arm/configs/sam9_l9260_defconfig1
-rw-r--r--arch/arm/configs/shannon_defconfig1
-rw-r--r--arch/arm/configs/shark_defconfig1
-rw-r--r--arch/arm/configs/simpad_defconfig1
-rw-r--r--arch/arm/configs/spitz_defconfig1
-rw-r--r--arch/arm/configs/stmp378x_defconfig1
-rw-r--r--arch/arm/configs/stmp37xx_defconfig1
-rw-r--r--arch/arm/configs/sx1_defconfig1
-rw-r--r--arch/arm/configs/tct_hammer_defconfig1
-rw-r--r--arch/arm/configs/trizeps4_defconfig1
-rw-r--r--arch/arm/configs/u300_defconfig82
-rw-r--r--arch/arm/configs/u8500_defconfig1
-rw-r--r--arch/arm/configs/usb-a9260_defconfig1
-rw-r--r--arch/arm/configs/usb-a9263_defconfig1
-rw-r--r--arch/arm/configs/versatile_defconfig1
-rw-r--r--arch/arm/configs/viper_defconfig1
-rw-r--r--arch/arm/configs/xcep_defconfig1
-rw-r--r--arch/arm/configs/yl9200_defconfig1
-rw-r--r--arch/arm/configs/zeus_defconfig1
-rw-r--r--arch/arm/include/asm/asm-offsets.h1
-rw-r--r--arch/arm/include/asm/cacheflush.h17
-rw-r--r--arch/arm/include/asm/cpu.h1
-rw-r--r--arch/arm/include/asm/dma.h4
-rw-r--r--arch/arm/include/asm/mach-types.h1
-rw-r--r--arch/arm/include/asm/proc-fns.h374
-rw-r--r--arch/arm/include/asm/ptrace.h6
-rw-r--r--arch/arm/include/asm/thread_notify.h2
-rw-r--r--arch/arm/include/asm/unistd.h1
-rw-r--r--arch/arm/kernel/crunch.c2
-rw-r--r--arch/arm/kernel/dma-isa.c4
-rw-r--r--arch/arm/kernel/entry-armv.S4
-rw-r--r--arch/arm/kernel/process.c15
-rw-r--r--arch/arm/kernel/xscale-cp0.c2
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c11
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c1
-rw-r--r--arch/arm/mach-davinci/cp_intc.c11
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c9
-rw-r--r--arch/arm/mach-davinci/dm365.c1
-rw-r--r--arch/arm/mach-footbridge/Makefile4
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c2
-rw-r--r--arch/arm/mach-footbridge/isa-rtc.c57
-rw-r--r--arch/arm/mach-footbridge/isa-timer.c2
-rw-r--r--arch/arm/mach-footbridge/isa.c18
-rw-r--r--arch/arm/mach-footbridge/time.c164
-rw-r--r--arch/arm/mach-kirkwood/Kconfig6
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c325
-rw-r--r--arch/arm/mach-lh7a40x/clocks.c2
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c2
-rw-r--r--arch/arm/mach-mx2/mxt_td60.c24
-rw-r--r--arch/arm/mach-mx25/clock.c2
-rw-r--r--arch/arm/mach-mx25/devices.c19
-rw-r--r--arch/arm/mach-mx25/devices.h1
-rw-r--r--arch/arm/mach-mx25/mx25pdk.c46
-rw-r--r--arch/arm/mach-mx3/Kconfig3
-rw-r--r--arch/arm/mach-mx3/mm.c5
-rw-r--r--arch/arm/mach-mx3/mx31ads.c5
-rw-r--r--arch/arm/mach-mx3/mx31lite.c9
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c2
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c2
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c7
-rw-r--r--arch/arm/mach-mx3/mx31pdk.c5
-rw-r--r--arch/arm/mach-mx3/pcm037.c32
-rw-r--r--arch/arm/mach-omap1/clock_data.c10
-rw-r--r--arch/arm/mach-omap1/devices.c35
-rw-r--r--arch/arm/mach-omap1/mux.c8
-rw-r--r--arch/arm/mach-omap2/Kconfig2
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c2
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c2
-rwxr-xr-xarch/arm/mach-omap2/board-zoom-peripherals.c10
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c57
-rw-r--r--arch/arm/mach-omap2/clock34xx.c1
-rw-r--r--arch/arm/mach-omap2/clock34xx_data.c6
-rw-r--r--arch/arm/mach-omap2/clockdomain.c4
-rw-r--r--arch/arm/mach-omap2/io.c19
-rw-r--r--arch/arm/mach-omap2/mux.c6
-rw-r--r--arch/arm/mach-omap2/opp2420_data.c38
-rw-r--r--arch/arm/mach-omap2/opp2430_data.c30
-rw-r--r--arch/arm/mach-omap2/pm34xx.c4
-rw-r--r--arch/arm/mach-omap2/serial.c19
-rw-r--r--arch/arm/mach-pxa/Kconfig5
-rw-r--r--arch/arm/mach-pxa/devices.c2
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h9
-rw-r--r--arch/arm/mach-pxa/include/mach/zylonite.h7
-rw-r--r--arch/arm/mach-pxa/littleton.c6
-rw-r--r--arch/arm/mach-pxa/magician.c2
-rw-r--r--arch/arm/mach-pxa/palmld.c2
-rw-r--r--arch/arm/mach-pxa/palmt5.c2
-rw-r--r--arch/arm/mach-pxa/palmtc.c2
-rw-r--r--arch/arm/mach-pxa/palmte2.c2
-rw-r--r--arch/arm/mach-pxa/palmtreo.c2
-rw-r--r--arch/arm/mach-pxa/palmtx.c2
-rw-r--r--arch/arm/mach-pxa/palmz72.c2
-rw-r--r--arch/arm/mach-pxa/poodle.c2
-rw-r--r--arch/arm/mach-pxa/spitz.c4
-rw-r--r--arch/arm/mach-pxa/viper.c2
-rw-r--r--arch/arm/mach-pxa/zeus.c36
-rw-r--r--arch/arm/mach-pxa/zylonite.c87
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c12
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c4
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h4
-rw-r--r--arch/arm/mach-realview/include/mach/platform.h2
-rw-r--r--arch/arm/mach-realview/realview_eb.c15
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c10
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c11
-rw-r--r--arch/arm/mach-realview/realview_pba8.c15
-rw-r--r--arch/arm/mach-realview/realview_pbx.c15
-rw-r--r--arch/arm/mach-s3c2410/include/mach/spi.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/ts.h21
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c3
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c8
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c2
-rw-r--r--arch/arm/mach-w90x900/cpu.c1
-rw-r--r--arch/arm/mach-w90x900/dev.c2
-rw-r--r--arch/arm/mach-w90x900/include/mach/system.h15
-rw-r--r--arch/arm/mach-w90x900/include/mach/uncompress.h10
-rw-r--r--arch/arm/mach-w90x900/time.c64
-rw-r--r--arch/arm/mm/Kconfig4
-rw-r--r--arch/arm/mm/Makefile12
-rw-r--r--arch/arm/mm/cache-fa.S11
-rw-r--r--arch/arm/mm/cache-l2x0.c93
-rw-r--r--arch/arm/mm/cache-v3.S9
-rw-r--r--arch/arm/mm/cache-v4.S9
-rw-r--r--arch/arm/mm/cache-v4wb.S11
-rw-r--r--arch/arm/mm/cache-v4wt.S11
-rw-r--r--arch/arm/mm/cache-v6.S11
-rw-r--r--arch/arm/mm/cache-v7.S13
-rw-r--r--arch/arm/mm/cache-xsc3l2.c11
-rw-r--r--arch/arm/mm/copypage-v6.c2
-rw-r--r--arch/arm/mm/fault-armv.c5
-rw-r--r--arch/arm/mm/flush.c4
-rw-r--r--arch/arm/mm/highmem.c2
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/mmu.c3
-rw-r--r--arch/arm/mm/nommu.c2
-rw-r--r--arch/arm/mm/proc-arm1020.S11
-rw-r--r--arch/arm/mm/proc-arm1020e.S11
-rw-r--r--arch/arm/mm/proc-arm1022.S11
-rw-r--r--arch/arm/mm/proc-arm1026.S11
-rw-r--r--arch/arm/mm/proc-arm920.S11
-rw-r--r--arch/arm/mm/proc-arm922.S11
-rw-r--r--arch/arm/mm/proc-arm925.S11
-rw-r--r--arch/arm/mm/proc-arm926.S11
-rw-r--r--arch/arm/mm/proc-arm940.S9
-rw-r--r--arch/arm/mm/proc-arm946.S11
-rw-r--r--arch/arm/mm/proc-feroceon.S15
-rw-r--r--arch/arm/mm/proc-mohawk.S11
-rw-r--r--arch/arm/mm/proc-syms.c3
-rw-r--r--arch/arm/mm/proc-v6.S5
-rw-r--r--arch/arm/mm/proc-xsc3.S18
-rw-r--r--arch/arm/mm/proc-xscale.S13
-rw-r--r--arch/arm/mm/tlb-v7.S1
-rw-r--r--arch/arm/nwfpe/Makefile4
-rw-r--r--arch/arm/oprofile/op_model_v7.c8
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx25.h58
-rw-r--r--arch/arm/plat-mxc/include/mach/mx25.h4
-rw-r--r--arch/arm/plat-omap/clock.c16
-rw-r--r--arch/arm/plat-omap/cpu-omap.c1
-rw-r--r--arch/arm/plat-omap/gpio.c63
-rw-r--r--arch/arm/plat-omap/include/plat/board.h1
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h2
-rw-r--r--arch/arm/plat-omap/include/plat/control.h2
-rw-r--r--arch/arm/plat-omap/include/plat/io.h36
-rw-r--r--arch/arm/plat-omap/include/plat/mux.h8
-rw-r--r--arch/arm/plat-omap/include/plat/omap7xx.h3
-rw-r--r--arch/arm/plat-omap/io.c12
-rw-r--r--arch/arm/plat-omap/iommu.c2
-rw-r--r--arch/arm/plat-omap/mcbsp.c20
-rw-r--r--arch/arm/plat-pxa/pwm.c8
-rw-r--r--arch/arm/plat-s3c/dev-nand.c4
-rw-r--r--arch/arm/plat-s3c/include/plat/devs.h1
-rw-r--r--arch/arm/plat-s3c24xx/devs.c18
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.c1
-rw-r--r--arch/arm/plat-s3c64xx/s3c6400-clock.c10
-rw-r--r--arch/arm/tools/Makefile2
-rw-r--r--arch/arm/tools/gen-mach-types2
-rw-r--r--arch/arm/tools/mach-types44
-rw-r--r--arch/arm/vfp/vfpmodule.c19
-rw-r--r--arch/avr32/include/asm/asm-offsets.h1
-rw-r--r--arch/blackfin/include/asm/asm-offsets.h1
-rw-r--r--arch/blackfin/include/asm/page.h5
-rw-r--r--arch/blackfin/kernel/kgdb.c207
-rw-r--r--arch/blackfin/mm/Makefile2
-rw-r--r--arch/blackfin/mm/maccess.c97
-rw-r--r--arch/cris/arch-v32/kernel/head.S1
-rw-r--r--arch/cris/include/asm/asm-offsets.h1
-rw-r--r--arch/cris/kernel/asm-offsets.c1
-rw-r--r--arch/cris/kernel/vmlinux.lds.S1
-rw-r--r--arch/frv/include/asm/asm-offsets.h1
-rw-r--r--arch/frv/include/asm/page.h2
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/h8300/include/asm/asm-offsets.h1
-rw-r--r--arch/ia64/Makefile2
-rw-r--r--arch/ia64/include/asm/acpi.h6
-rw-r--r--arch/ia64/include/asm/asm-offsets.h1
-rw-r--r--arch/ia64/include/asm/ftrace.h1
-rw-r--r--arch/ia64/include/asm/irq.h2
-rw-r--r--arch/ia64/include/asm/kprobes.h5
-rw-r--r--arch/ia64/include/asm/tlb.h2
-rw-r--r--arch/ia64/include/asm/topology.h4
-rw-r--r--arch/ia64/include/asm/types.h5
-rw-r--r--arch/ia64/kernel/Makefile11
-rw-r--r--arch/ia64/kernel/acpi-processor.c85
-rw-r--r--arch/ia64/kernel/mca.c5
-rw-r--r--arch/ia64/kernel/perfmon.c2
-rw-r--r--arch/ia64/kvm/asm-offsets.c1
-rw-r--r--arch/ia64/kvm/vcpu.h9
-rw-r--r--arch/ia64/kvm/vmm.c4
-rw-r--r--arch/ia64/kvm/vtlb.c2
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/mm/tlb.c32
-rw-r--r--arch/m68k/include/asm/asm-offsets.h1
-rw-r--r--arch/m68k/include/asm/io_no.h14
-rw-r--r--arch/m68k/include/asm/page_no.h4
-rw-r--r--arch/m68k/include/asm/virtconvert.h4
-rw-r--r--arch/m68k/kernel/head.S2
-rw-r--r--arch/microblaze/include/asm/asm-offsets.h1
-rw-r--r--arch/mips/Kconfig119
-rw-r--r--arch/mips/Kconfig.debug59
-rw-r--r--arch/mips/Makefile57
-rw-r--r--arch/mips/alchemy/common/dbdma.c4
-rw-r--r--arch/mips/ar7/platform.c2
-rw-r--r--arch/mips/ar7/prom.c15
-rw-r--r--arch/mips/basler/excite/Kconfig9
-rw-r--r--arch/mips/basler/excite/Makefile8
-rw-r--r--arch/mips/basler/excite/excite_device.c403
-rw-r--r--arch/mips/basler/excite/excite_iodev.c178
-rw-r--r--arch/mips/basler/excite/excite_iodev.h10
-rw-r--r--arch/mips/basler/excite/excite_irq.c122
-rw-r--r--arch/mips/basler/excite/excite_procfs.c92
-rw-r--r--arch/mips/basler/excite/excite_prom.c144
-rw-r--r--arch/mips/basler/excite/excite_setup.c302
-rw-r--r--arch/mips/bcm47xx/prom.c10
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c33
-rw-r--r--arch/mips/bcm63xx/prom.c3
-rw-r--r--arch/mips/boot/.gitignore1
-rw-r--r--arch/mips/boot/Makefile10
-rw-r--r--arch/mips/boot/addinitrd.c131
-rw-r--r--arch/mips/boot/compressed/Makefile97
-rw-r--r--arch/mips/boot/compressed/dbg.c37
-rw-r--r--arch/mips/boot/compressed/decompress.c116
-rw-r--r--arch/mips/boot/compressed/dummy.c4
-rw-r--r--arch/mips/boot/compressed/head.S56
-rw-r--r--arch/mips/boot/compressed/ld.script67
-rw-r--r--arch/mips/boot/compressed/uart-16550.c43
-rw-r--r--arch/mips/cavium-octeon/Makefile2
-rw-r--r--arch/mips/cavium-octeon/cpu.c52
-rw-r--r--arch/mips/cavium-octeon/csrc-octeon.c32
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c88
-rw-r--r--arch/mips/cobalt/setup.c24
-rw-r--r--arch/mips/configs/ar7_defconfig4
-rw-r--r--arch/mips/configs/bcm47xx_defconfig3
-rw-r--r--arch/mips/configs/bcm63xx_defconfig3
-rw-r--r--arch/mips/configs/bigsur_defconfig3
-rw-r--r--arch/mips/configs/capcella_defconfig3
-rw-r--r--arch/mips/configs/cavium-octeon_defconfig4
-rw-r--r--arch/mips/configs/cobalt_defconfig3
-rw-r--r--arch/mips/configs/db1000_defconfig3
-rw-r--r--arch/mips/configs/db1100_defconfig3
-rw-r--r--arch/mips/configs/db1200_defconfig3
-rw-r--r--arch/mips/configs/db1500_defconfig3
-rw-r--r--arch/mips/configs/db1550_defconfig3
-rw-r--r--arch/mips/configs/decstation_defconfig3
-rw-r--r--arch/mips/configs/e55_defconfig3
-rw-r--r--arch/mips/configs/excite_defconfig1335
-rw-r--r--arch/mips/configs/fuloong2e_defconfig96
-rw-r--r--arch/mips/configs/ip22_defconfig3
-rw-r--r--arch/mips/configs/ip27_defconfig3
-rw-r--r--arch/mips/configs/ip28_defconfig3
-rw-r--r--arch/mips/configs/ip32_defconfig3
-rw-r--r--arch/mips/configs/jazz_defconfig3
-rw-r--r--arch/mips/configs/jmr3927_defconfig3
-rw-r--r--arch/mips/configs/lasat_defconfig3
-rw-r--r--arch/mips/configs/lemote2f_defconfig1835
-rw-r--r--arch/mips/configs/malta_defconfig3
-rw-r--r--arch/mips/configs/markeins_defconfig3
-rw-r--r--arch/mips/configs/mipssim_defconfig3
-rw-r--r--arch/mips/configs/mpc30x_defconfig3
-rw-r--r--arch/mips/configs/msp71xx_defconfig3
-rw-r--r--arch/mips/configs/mtx1_defconfig3
-rw-r--r--arch/mips/configs/pb1100_defconfig3
-rw-r--r--arch/mips/configs/pb1500_defconfig3
-rw-r--r--arch/mips/configs/pb1550_defconfig3
-rw-r--r--arch/mips/configs/pnx8335-stb225_defconfig3
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig3
-rw-r--r--arch/mips/configs/pnx8550-stb810_defconfig3
-rw-r--r--arch/mips/configs/powertv_defconfig1550
-rw-r--r--arch/mips/configs/rb532_defconfig3
-rw-r--r--arch/mips/configs/rbtx49xx_defconfig4
-rw-r--r--arch/mips/configs/rm200_defconfig3
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig3
-rw-r--r--arch/mips/configs/tb0219_defconfig3
-rw-r--r--arch/mips/configs/tb0226_defconfig3
-rw-r--r--arch/mips/configs/tb0287_defconfig3
-rw-r--r--arch/mips/configs/workpad_defconfig3
-rw-r--r--arch/mips/configs/wrppmc_defconfig3
-rw-r--r--arch/mips/configs/yosemite_defconfig3
-rw-r--r--arch/mips/fw/arc/cmdline.c5
-rw-r--r--arch/mips/include/asm/asm-offsets.h1
-rw-r--r--arch/mips/include/asm/bootinfo.h8
-rw-r--r--arch/mips/include/asm/clock.h64
-rw-r--r--arch/mips/include/asm/cop2.h23
-rw-r--r--arch/mips/include/asm/cpu.h2
-rw-r--r--arch/mips/include/asm/fcntl.h2
-rw-r--r--arch/mips/include/asm/fpu.h8
-rw-r--r--arch/mips/include/asm/fpu_emulator.h24
-rw-r--r--arch/mips/include/asm/ftrace.h91
-rw-r--r--arch/mips/include/asm/irq.h29
-rw-r--r--arch/mips/include/asm/mach-excite/cpu-feature-overrides.h48
-rw-r--r--arch/mips/include/asm/mach-excite/excite.h154
-rw-r--r--arch/mips/include/asm/mach-excite/excite_fpga.h80
-rw-r--r--arch/mips/include/asm/mach-excite/excite_nandflash.h7
-rw-r--r--arch/mips/include/asm/mach-excite/rm9k_eth.h23
-rw-r--r--arch/mips/include/asm/mach-excite/rm9k_wdt.h12
-rw-r--r--arch/mips/include/asm/mach-excite/rm9k_xicap.h16
-rw-r--r--arch/mips/include/asm/mach-ip27/topology.h4
-rw-r--r--arch/mips/include/asm/mach-loongson/cs5536/cs5536.h305
-rw-r--r--arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h35
-rw-r--r--arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h153
-rw-r--r--arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h31
-rw-r--r--arch/mips/include/asm/mach-loongson/dma-coherence.h4
-rw-r--r--arch/mips/include/asm/mach-loongson/loongson.h290
-rw-r--r--arch/mips/include/asm/mach-loongson/machine.h9
-rw-r--r--arch/mips/include/asm/mach-loongson/mem.h27
-rw-r--r--arch/mips/include/asm/mach-loongson/pci.h34
-rw-r--r--arch/mips/include/asm/mach-powertv/asic.h107
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_regs.h155
-rw-r--r--arch/mips/include/asm/mach-powertv/dma-coherence.h119
-rw-r--r--arch/mips/include/asm/mach-powertv/interrupts.h254
-rw-r--r--arch/mips/include/asm/mach-powertv/ioremap.h90
-rw-r--r--arch/mips/include/asm/mach-powertv/irq.h25
-rw-r--r--arch/mips/include/asm/mach-powertv/powertv-clock.h29
-rw-r--r--arch/mips/include/asm/mach-powertv/war.h (renamed from arch/mips/include/asm/mach-excite/war.h)19
-rw-r--r--arch/mips/include/asm/mips-boards/bonito64.h5
-rw-r--r--arch/mips/include/asm/mmu_context.h29
-rw-r--r--arch/mips/include/asm/octeon/cvmx-agl-defs.h1194
-rw-r--r--arch/mips/include/asm/octeon/cvmx-mixx-defs.h248
-rw-r--r--arch/mips/include/asm/octeon/cvmx-smix-defs.h178
-rw-r--r--arch/mips/include/asm/octeon/octeon.h1
-rw-r--r--arch/mips/include/asm/pgtable.h13
-rw-r--r--arch/mips/include/asm/sgialib.h3
-rw-r--r--arch/mips/include/asm/stackframe.h40
-rw-r--r--arch/mips/kernel/Makefile14
-rw-r--r--arch/mips/kernel/cpu-probe.c2
-rw-r--r--arch/mips/kernel/cpufreq/Kconfig41
-rw-r--r--arch/mips/kernel/cpufreq/Makefile5
-rw-r--r--arch/mips/kernel/cpufreq/loongson2_clock.c166
-rw-r--r--arch/mips/kernel/cpufreq/loongson2_cpufreq.c227
-rw-r--r--arch/mips/kernel/csrc-powertv.c180
-rw-r--r--arch/mips/kernel/ftrace.c275
-rw-r--r--arch/mips/kernel/irq.c30
-rw-r--r--arch/mips/kernel/mcount.S189
-rw-r--r--arch/mips/kernel/mips_ksyms.c5
-rw-r--r--arch/mips/kernel/setup.c44
-rw-r--r--arch/mips/kernel/signal.c46
-rw-r--r--arch/mips/kernel/signal32.c24
-rw-r--r--arch/mips/kernel/smp.c3
-rw-r--r--arch/mips/kernel/smtc.c21
-rw-r--r--arch/mips/kernel/traps.c136
-rw-r--r--arch/mips/kernel/unaligned.c25
-rw-r--r--arch/mips/kernel/vmlinux.lds.S1
-rw-r--r--arch/mips/lasat/picvue_proc.c113
-rw-r--r--arch/mips/lasat/prom.c4
-rw-r--r--arch/mips/lasat/sysctl.c2
-rw-r--r--arch/mips/loongson/Kconfig108
-rw-r--r--arch/mips/loongson/Makefile6
-rw-r--r--arch/mips/loongson/common/Makefile18
-rw-r--r--arch/mips/loongson/common/bonito-irq.c13
-rw-r--r--arch/mips/loongson/common/cmdline.c4
-rw-r--r--arch/mips/loongson/common/cs5536/Makefile13
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_acc.c140
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_ehci.c158
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_ide.c179
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_isa.c316
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_mfgpt.c217
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_ohci.c147
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_pci.c87
-rw-r--r--arch/mips/loongson/common/early_printk.c17
-rw-r--r--arch/mips/loongson/common/env.c3
-rw-r--r--arch/mips/loongson/common/init.c19
-rw-r--r--arch/mips/loongson/common/irq.c12
-rw-r--r--arch/mips/loongson/common/machtype.c25
-rw-r--r--arch/mips/loongson/common/mem.c91
-rw-r--r--arch/mips/loongson/common/pci.c20
-rw-r--r--arch/mips/loongson/common/platform.c30
-rw-r--r--arch/mips/loongson/common/pm.c161
-rw-r--r--arch/mips/loongson/common/reset.c2
-rw-r--r--arch/mips/loongson/common/serial.c76
-rw-r--r--arch/mips/loongson/common/time.c3
-rw-r--r--arch/mips/loongson/common/uart_base.c45
-rw-r--r--arch/mips/loongson/fuloong-2e/irq.c4
-rw-r--r--arch/mips/loongson/fuloong-2e/reset.c4
-rw-r--r--arch/mips/loongson/lemote-2f/Makefile11
-rw-r--r--arch/mips/loongson/lemote-2f/ec_kb3310b.c130
-rw-r--r--arch/mips/loongson/lemote-2f/ec_kb3310b.h188
-rw-r--r--arch/mips/loongson/lemote-2f/irq.c134
-rw-r--r--arch/mips/loongson/lemote-2f/pm.c149
-rw-r--r--arch/mips/loongson/lemote-2f/reset.c159
-rw-r--r--arch/mips/math-emu/cp1emu.c102
-rw-r--r--arch/mips/math-emu/dsemul.c4
-rw-r--r--arch/mips/mipssim/Makefile3
-rw-r--r--arch/mips/mipssim/sim_setup.c5
-rw-r--r--arch/mips/mm/cerr-sb1.c7
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--arch/mips/mm/tlbex.c36
-rw-r--r--arch/mips/mm/uasm.c16
-rw-r--r--arch/mips/mm/uasm.h7
-rw-r--r--arch/mips/mti-malta/malta-init.c1
-rw-r--r--arch/mips/mti-malta/malta-memory.c2
-rw-r--r--arch/mips/nxp/pnx833x/common/interrupts.c4
-rw-r--r--arch/mips/oprofile/op_model_loongson2.c5
-rw-r--r--arch/mips/pci/Makefile4
-rw-r--r--arch/mips/pci/fixup-excite.c36
-rw-r--r--arch/mips/pci/fixup-fuloong2e.c5
-rw-r--r--arch/mips/pci/fixup-lemote2f.c160
-rw-r--r--arch/mips/pci/ops-bonito64.c7
-rw-r--r--arch/mips/pci/ops-loongson2.c208
-rw-r--r--arch/mips/pci/pci-excite.c149
-rw-r--r--arch/mips/powertv/Kconfig21
-rw-r--r--arch/mips/powertv/Makefile28
-rw-r--r--arch/mips/powertv/asic/Kconfig28
-rw-r--r--arch/mips/powertv/asic/Makefile23
-rw-r--r--arch/mips/powertv/asic/asic-calliope.c98
-rw-r--r--arch/mips/powertv/asic/asic-cronus.c98
-rw-r--r--arch/mips/powertv/asic/asic-zeus.c98
-rw-r--r--arch/mips/powertv/asic/asic_devices.c787
-rw-r--r--arch/mips/powertv/asic/asic_int.c125
-rw-r--r--arch/mips/powertv/asic/irq_asic.c116
-rw-r--r--arch/mips/powertv/asic/prealloc-calliope.c620
-rw-r--r--arch/mips/powertv/asic/prealloc-cronus.c608
-rw-r--r--arch/mips/powertv/asic/prealloc-cronuslite.c290
-rw-r--r--arch/mips/powertv/asic/prealloc-zeus.c459
-rw-r--r--arch/mips/powertv/init.c129
-rw-r--r--arch/mips/powertv/init.h26
-rw-r--r--arch/mips/powertv/memory.c181
-rw-r--r--arch/mips/powertv/pci/Makefile21
-rw-r--r--arch/mips/powertv/pci/fixup-powertv.c36
-rw-r--r--arch/mips/powertv/pci/powertv-pci.h31
-rw-r--r--arch/mips/powertv/powertv-clock.h26
-rw-r--r--arch/mips/powertv/powertv_setup.c330
-rw-r--r--arch/mips/powertv/reset.c47
-rw-r--r--arch/mips/powertv/reset.h26
-rw-r--r--arch/mips/powertv/time.c (renamed from arch/mips/mipssim/sim_cmdline.c)20
-rw-r--r--arch/mips/rb532/prom.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-eisa.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c3
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-time.c3
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c2
-rw-r--r--arch/mips/sibyte/common/cfe.c4
-rw-r--r--arch/mips/sni/a20r.c2
-rw-r--r--arch/mips/sni/pcimt.c2
-rw-r--r--arch/mips/sni/pcit.c2
-rw-r--r--arch/mips/sni/rm200.c2
-rw-r--r--arch/mips/sni/setup.c2
-rw-r--r--arch/mips/txx9/generic/setup.c23
-rw-r--r--arch/mips/vr41xx/common/init.c6
-rw-r--r--arch/mn10300/Makefile2
-rw-r--r--arch/mn10300/configs/asb2303_defconfig107
-rw-r--r--arch/mn10300/include/asm/asm-offsets.h1
-rw-r--r--arch/mn10300/include/asm/bitops.h4
-rw-r--r--arch/mn10300/include/asm/div64.h2
-rw-r--r--arch/mn10300/include/asm/system.h1
-rw-r--r--arch/mn10300/include/asm/tlbflush.h2
-rw-r--r--arch/mn10300/include/asm/uaccess.h4
-rw-r--r--arch/mn10300/include/asm/unistd.h3
-rw-r--r--arch/mn10300/kernel/entry.S1
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c3
-rw-r--r--arch/mn10300/kernel/signal.c2
-rw-r--r--arch/mn10300/lib/checksum.c1
-rw-r--r--arch/mn10300/lib/delay.c3
-rw-r--r--arch/mn10300/lib/usercopy.c6
-rw-r--r--arch/mn10300/mm/dma-alloc.c17
-rw-r--r--arch/mn10300/mm/init.c3
-rw-r--r--arch/mn10300/mm/misalignment.c4
-rw-r--r--arch/mn10300/unit-asb2305/include/unit/serial.h2
-rw-r--r--arch/mn10300/unit-asb2305/include/unit/timex.h2
-rw-r--r--arch/mn10300/unit-asb2305/leds.c4
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c39
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.h1
-rw-r--r--arch/mn10300/unit-asb2305/pci.c62
-rw-r--r--arch/mn10300/unit-asb2305/unit-init.c5
-rw-r--r--arch/parisc/include/asm/asm-offsets.h1
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--arch/powerpc/boot/dts/katmai.dts52
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts27
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts82
-rw-r--r--arch/powerpc/boot/dts/warp.dts2
-rw-r--r--arch/powerpc/boot/ugecon.c2
-rw-r--r--arch/powerpc/configs/g5_defconfig6
-rw-r--r--arch/powerpc/configs/iseries_defconfig4
-rw-r--r--arch/powerpc/configs/ppc64_defconfig14
-rw-r--r--arch/powerpc/configs/ppc64e_defconfig4
-rw-r--r--arch/powerpc/configs/pseries_defconfig14
-rw-r--r--arch/powerpc/include/asm/asm-offsets.h1
-rw-r--r--arch/powerpc/include/asm/bug.h2
-rw-r--r--arch/powerpc/include/asm/gpio.h5
-rw-r--r--arch/powerpc/kernel/align.c63
-rw-r--r--arch/powerpc/kernel/pci-common.c13
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu.c22
-rw-r--r--arch/powerpc/mm/hash_utils_64.c12
-rw-r--r--arch/powerpc/mm/mmu_context_nohash.c2
-rw-r--r--arch/powerpc/mm/pgtable_32.c2
-rw-r--r--arch/powerpc/platforms/52xx/efika.c2
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c52
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/amigaone/setup.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/Makefile6
-rw-r--r--arch/powerpc/platforms/chrp/setup.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/flipper-pic.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/hlwd-pic.c10
-rw-r--r--arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c2
-rw-r--r--arch/powerpc/platforms/iseries/mf.c147
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c2
-rw-r--r--arch/powerpc/platforms/powermac/bootx_init.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c254
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c6
-rw-r--r--arch/powerpc/platforms/pseries/smp.c4
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.c28
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c8
-rw-r--r--arch/powerpc/sysdev/mpc8xxx_gpio.c21
-rw-r--r--arch/powerpc/sysdev/mpic.c19
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c11
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c46
-rw-r--r--arch/s390/crypto/aes_s390.c2
-rw-r--r--arch/s390/defconfig86
-rw-r--r--arch/s390/hypfs/hypfs_diag.c4
-rw-r--r--arch/s390/hypfs/hypfs_vm.c2
-rw-r--r--arch/s390/include/asm/asm-offsets.h1
-rw-r--r--arch/s390/include/asm/param.h28
-rw-r--r--arch/s390/include/asm/unistd.h3
-rw-r--r--arch/s390/kernel/compat_wrapper.S9
-rw-r--r--arch/s390/kernel/ipl.c6
-rw-r--r--arch/s390/kernel/ptrace.c2
-rw-r--r--arch/s390/kernel/syscalls.S1
-rw-r--r--arch/s390/kernel/traps.c6
-rw-r--r--arch/score/include/asm/asm-offsets.h1
-rw-r--r--arch/score/include/asm/cacheflush.h4
-rw-r--r--arch/score/include/asm/delay.h2
-rw-r--r--arch/score/include/asm/page.h2
-rw-r--r--arch/score/kernel/setup.c1
-rw-r--r--arch/score/mm/cache.c26
-rw-r--r--arch/score/mm/init.c7
-rw-r--r--arch/sh/Kconfig16
-rw-r--r--arch/sh/Makefile10
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c4
-rw-r--r--arch/sh/configs/ap325rxa_defconfig87
-rw-r--r--arch/sh/configs/cayman_defconfig168
-rw-r--r--arch/sh/configs/dreamcast_defconfig78
-rw-r--r--arch/sh/configs/ecovec24-romimage_defconfig76
-rw-r--r--arch/sh/configs/ecovec24_defconfig89
-rw-r--r--arch/sh/configs/edosk7705_defconfig49
-rw-r--r--arch/sh/configs/edosk7760_defconfig70
-rw-r--r--arch/sh/configs/espt_defconfig77
-rw-r--r--arch/sh/configs/hp6xx_defconfig70
-rw-r--r--arch/sh/configs/kfr2r09-romimage_defconfig58
-rw-r--r--arch/sh/configs/kfr2r09_defconfig71
-rw-r--r--arch/sh/configs/landisk_defconfig85
-rw-r--r--arch/sh/configs/lboxre2_defconfig89
-rw-r--r--arch/sh/configs/magicpanelr2_defconfig69
-rw-r--r--arch/sh/configs/microdev_defconfig71
-rw-r--r--arch/sh/configs/migor_defconfig92
-rw-r--r--arch/sh/configs/polaris_defconfig77
-rw-r--r--arch/sh/configs/r7780mp_defconfig99
-rw-r--r--arch/sh/configs/r7785rp_defconfig98
-rw-r--r--arch/sh/configs/rsk7201_defconfig59
-rw-r--r--arch/sh/configs/rsk7203_defconfig71
-rw-r--r--arch/sh/configs/rts7751r2d1_defconfig95
-rw-r--r--arch/sh/configs/rts7751r2dplus_defconfig95
-rw-r--r--arch/sh/configs/sdk7780_defconfig88
-rw-r--r--arch/sh/configs/se7206_defconfig66
-rw-r--r--arch/sh/configs/se7343_defconfig72
-rw-r--r--arch/sh/configs/se7619_defconfig58
-rw-r--r--arch/sh/configs/se7705_defconfig71
-rw-r--r--arch/sh/configs/se7712_defconfig61
-rw-r--r--arch/sh/configs/se7721_defconfig62
-rw-r--r--arch/sh/configs/se7722_defconfig69
-rw-r--r--arch/sh/configs/se7724_defconfig100
-rw-r--r--arch/sh/configs/se7750_defconfig70
-rw-r--r--arch/sh/configs/se7751_defconfig70
-rw-r--r--arch/sh/configs/se7780_defconfig79
-rw-r--r--arch/sh/configs/sh03_defconfig80
-rw-r--r--arch/sh/configs/sh7710voipgw_defconfig66
-rw-r--r--arch/sh/configs/sh7724_generic_defconfig80
-rw-r--r--arch/sh/configs/sh7763rdp_defconfig74
-rw-r--r--arch/sh/configs/sh7770_generic_defconfig79
-rw-r--r--arch/sh/configs/sh7785lcr_32bit_defconfig83
-rw-r--r--arch/sh/configs/sh7785lcr_defconfig83
-rw-r--r--arch/sh/configs/shmin_defconfig64
-rw-r--r--arch/sh/configs/shx3_defconfig93
-rw-r--r--arch/sh/configs/snapgear_defconfig79
-rw-r--r--arch/sh/configs/systemh_defconfig64
-rw-r--r--arch/sh/configs/titan_defconfig87
-rw-r--r--arch/sh/configs/ul2_defconfig86
-rw-r--r--arch/sh/configs/urquell_defconfig99
-rw-r--r--arch/sh/drivers/pci/fixups-rts7751r2d.c2
-rw-r--r--arch/sh/include/asm/.gitignore1
-rw-r--r--arch/sh/include/asm/asm-offsets.h1
-rw-r--r--arch/sh/include/asm/dma.h6
-rw-r--r--arch/sh/include/asm/machvec.h2
-rw-r--r--arch/sh/include/asm/timex.h10
-rw-r--r--arch/sh/include/cpu-sh4/cpu/dma-sh4a.h8
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c15
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c14
-rw-r--r--arch/sh/kernel/idle.c2
-rw-r--r--arch/sh/mm/Kconfig7
-rw-r--r--arch/sh/mm/cache.c8
-rw-r--r--arch/sh/tools/Makefile4
-rw-r--r--arch/sh/tools/gen-mach-types2
-rw-r--r--arch/sparc/include/asm/asm-offsets.h1
-rw-r--r--arch/sparc/include/asm/fcntl.h2
-rw-r--r--arch/sparc/kernel/nmi.c3
-rw-r--r--arch/sparc/kernel/perf_event.c11
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/include/asm/asm-offsets.h1
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/Kconfig.cpu2
-rw-r--r--arch/x86/boot/compressed/Makefile6
-rw-r--r--arch/x86/boot/compressed/misc.c4
-rw-r--r--arch/x86/boot/header.S2
-rw-r--r--arch/x86/boot/version.c4
-rw-r--r--arch/x86/include/asm/acpi.h26
-rw-r--r--arch/x86/include/asm/asm-offsets.h1
-rw-r--r--arch/x86/include/asm/cpufeature.h1
-rw-r--r--arch/x86/include/asm/hw_irq.h3
-rw-r--r--arch/x86/include/asm/kvm.h4
-rw-r--r--arch/x86/include/asm/msr-index.h2
-rw-r--r--arch/x86/include/asm/msr.h16
-rw-r--r--arch/x86/include/asm/processor.h2
-rw-r--r--arch/x86/include/asm/uaccess_32.h5
-rw-r--r--arch/x86/include/asm/uaccess_64.h5
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h86
-rw-r--r--arch/x86/kernel/acpi/Makefile2
-rw-r--r--arch/x86/kernel/acpi/processor.c101
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
-rw-r--r--arch/x86/kernel/amd_iommu_init.c10
-rw-r--r--arch/x86/kernel/apic/apic.c26
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c5
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c5
-rw-r--r--arch/x86/kernel/apic/io_apic.c39
-rw-r--r--arch/x86/kernel/apic/probe_64.c15
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c5
-rw-r--r--arch/x86/kernel/apic/x2apic_phys.c5
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c17
-rw-r--r--arch/x86/kernel/cpu/amd.c53
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c2
-rw-r--r--arch/x86/kernel/cpu/intel.c1
-rw-r--r--arch/x86/kernel/cpu/perf_event.c2
-rw-r--r--arch/x86/kernel/cpuid.c5
-rw-r--r--arch/x86/kernel/dumpstack.c14
-rw-r--r--arch/x86/kernel/e820.c6
-rw-r--r--arch/x86/kernel/microcode_core.c2
-rw-r--r--arch/x86/kernel/msr.c4
-rw-r--r--arch/x86/kernel/process.c4
-rw-r--r--arch/x86/kernel/process_32.c14
-rw-r--r--arch/x86/kernel/process_64.c24
-rw-r--r--arch/x86/kernel/ptrace.c16
-rw-r--r--arch/x86/kernel/tsc.c1
-rw-r--r--arch/x86/kernel/uv_irq.c3
-rw-r--r--arch/x86/kvm/lapic.c1
-rw-r--r--arch/x86/kvm/paging_tmpl.h18
-rw-r--r--arch/x86/kvm/x86.c12
-rw-r--r--arch/x86/lib/Makefile4
-rw-r--r--arch/x86/lib/msr-smp.c204
-rw-r--r--arch/x86/lib/msr.c213
-rw-r--r--arch/x86/mm/init_32.c3
-rw-r--r--arch/x86/mm/kmemcheck/error.c19
-rw-r--r--arch/x86/mm/srat_32.c2
-rw-r--r--arch/x86/mm/srat_64.c4
-rw-r--r--arch/x86/pci/bus_numa.c2
-rw-r--r--arch/x86/pci/intel_bus.c4
-rw-r--r--arch/x86/tools/chkobjdump.awk16
-rw-r--r--arch/x86/tools/gen-insn-attr-x86.awk10
-rw-r--r--arch/xtensa/include/asm/asm-offsets.h1
-rw-r--r--block/blk-barrier.c2
-rw-r--r--block/blk-settings.c121
-rw-r--r--block/cfq-iosched.c67
-rw-r--r--crypto/async_tx/raid6test.c7
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/accessibility/braille/braille_console.c1
-rw-r--r--drivers/acpi/Makefile1
-rw-r--r--drivers/acpi/blacklist.c14
-rw-r--r--drivers/acpi/bus.c28
-rw-r--r--drivers/acpi/ec.c10
-rw-r--r--drivers/acpi/internal.h1
-rw-r--r--drivers/acpi/processor_core.c71
-rw-r--r--drivers/acpi/processor_pdc.c165
-rw-r--r--drivers/acpi/sleep.c29
-rw-r--r--drivers/acpi/video.c8
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/ata/ata_piix.c2
-rw-r--r--drivers/ata/libata-core.c38
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/libata-sff.c2
-rw-r--r--drivers/ata/pata_bf54x.c19
-rw-r--r--drivers/ata/pata_cmd64x.c118
-rw-r--r--drivers/ata/pata_hpt3x2n.c64
-rw-r--r--drivers/ata/pata_octeon_cf.c2
-rw-r--r--drivers/ata/sata_mv.c144
-rw-r--r--drivers/ata/sata_promise.c2
-rw-r--r--drivers/base/bus.c2
-rw-r--r--drivers/base/core.c16
-rw-r--r--drivers/base/devtmpfs.c19
-rw-r--r--drivers/base/driver.c4
-rw-r--r--drivers/base/memory.c19
-rw-r--r--drivers/base/platform.c1
-rw-r--r--drivers/base/power/main.c129
-rw-r--r--drivers/base/power/runtime.c45
-rw-r--r--drivers/block/DAC960.c2
-rw-r--r--drivers/block/aoe/aoecmd.c17
-rw-r--r--drivers/block/drbd/drbd_int.h2
-rw-r--r--drivers/block/drbd/drbd_main.c5
-rw-r--r--drivers/block/drbd/drbd_proc.c2
-rw-r--r--drivers/block/drbd/drbd_receiver.c1
-rw-r--r--drivers/block/drbd/drbd_worker.c2
-rw-r--r--drivers/block/mg_disk.c2
-rw-r--r--drivers/bluetooth/btusb.c1
-rw-r--r--drivers/char/agp/amd64-agp.c9
-rw-r--r--drivers/char/agp/backend.c13
-rw-r--r--drivers/char/agp/hp-agp.c6
-rw-r--r--drivers/char/hw_random/core.c5
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/char/nozomi.c48
-rw-r--r--drivers/char/nwflash.c1
-rw-r--r--drivers/char/sonypi.c60
-rw-r--r--drivers/char/toshiba.c12
-rw-r--r--drivers/cpuidle/governors/menu.c12
-rw-r--r--drivers/dma/at_hdmac.c4
-rw-r--r--drivers/dma/coh901318.c2
-rw-r--r--drivers/dma/dw_dmac.c2
-rw-r--r--drivers/dma/ioat/dma.c2
-rw-r--r--drivers/dma/ioat/dma.h18
-rw-r--r--drivers/dma/ioat/dma_v2.c69
-rw-r--r--drivers/dma/ioat/dma_v2.h2
-rw-r--r--drivers/dma/ioat/dma_v3.c60
-rw-r--r--drivers/dma/ioat/registers.h1
-rw-r--r--drivers/dma/shdma.c324
-rw-r--r--drivers/dma/shdma.h9
-rw-r--r--drivers/edac/amd64_edac.c45
-rw-r--r--drivers/edac/edac_pci_sysfs.c2
-rw-r--r--drivers/firewire/Kconfig44
-rw-r--r--drivers/firewire/core-cdev.c27
-rw-r--r--drivers/firewire/core-transaction.c118
-rw-r--r--drivers/firewire/ohci.c4
-rw-r--r--drivers/gpio/Kconfig9
-rw-r--r--drivers/gpio/Makefile1
-rw-r--r--drivers/gpio/adp5588-gpio.c266
-rw-r--r--drivers/gpio/gpiolib.c2
-rw-r--r--drivers/gpu/drm/ati_pcigart.c10
-rw-r--r--drivers/gpu/drm/drm_bufs.c4
-rw-r--r--drivers/gpu/drm/drm_crtc.c1
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c26
-rw-r--r--drivers/gpu/drm/drm_drv.c13
-rw-r--r--drivers/gpu/drm/drm_edid.c16
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c11
-rw-r--r--drivers/gpu/drm/drm_ioc32.c89
-rw-r--r--drivers/gpu/drm/drm_irq.c5
-rw-r--r--drivers/gpu/drm/drm_mm.c4
-rw-r--r--drivers/gpu/drm/drm_modes.c90
-rw-r--r--drivers/gpu/drm/drm_pci.c8
-rw-r--r--drivers/gpu/drm/i2c/ch7006_drv.c5
-rw-r--r--drivers/gpu/drm/i2c/ch7006_mode.c5
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c2
-rw-r--r--drivers/gpu/drm/i810/i810_drv.c2
-rw-r--r--drivers/gpu/drm/i830/i830_dma.c2
-rw-r--r--drivers/gpu/drm/i830/i830_drv.c2
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c31
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c28
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c174
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h123
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c251
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c46
-rw-r--r--drivers/gpu/drm/i915/i915_ioc32.c23
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c32
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h11
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c12
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c414
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c6
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c5
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c83
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c3
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c2
-rw-r--r--drivers/gpu/drm/mga/mga_drv.c2
-rw-r--r--drivers/gpu/drm/mga/mga_ioc32.c13
-rw-r--r--drivers/gpu/drm/nouveau/Kconfig5
-rw-r--r--drivers/gpu/drm/nouveau/Makefile5
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c621
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c260
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_channel.c47
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.c34
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.h10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dp.c28
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h99
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c41
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c33
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_grctx.c161
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_grctx.h133
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_ioc32.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_irq.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c87
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_object.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_reg.h16
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c174
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_ttm.c30
-rw-r--r--drivers/gpu/drm/nouveau/nv04_crtc.c10
-rw-r--r--drivers/gpu/drm/nouveau/nv04_dac.c43
-rw-r--r--drivers/gpu/drm/nouveau/nv04_dfp.c8
-rw-r--r--drivers/gpu/drm/nouveau/nv04_display.c11
-rw-r--r--drivers/gpu/drm/nouveau/nv04_fbcon.c41
-rw-r--r--drivers/gpu/drm/nouveau/nv04_fifo.c34
-rw-r--r--drivers/gpu/drm/nouveau/nv04_graph.c161
-rw-r--r--drivers/gpu/drm/nouveau/nv10_fb.c32
-rw-r--r--drivers/gpu/drm/nouveau/nv10_graph.c225
-rw-r--r--drivers/gpu/drm/nouveau/nv17_tv.c119
-rw-r--r--drivers/gpu/drm/nouveau/nv20_graph.c61
-rw-r--r--drivers/gpu/drm/nouveau/nv40_fb.c53
-rw-r--r--drivers/gpu/drm/nouveau/nv40_graph.c310
-rw-r--r--drivers/gpu/drm/nouveau/nv40_grctx.c678
-rw-r--r--drivers/gpu/drm/nouveau/nv50_crtc.c22
-rw-r--r--drivers/gpu/drm/nouveau/nv50_cursor.c8
-rw-r--r--drivers/gpu/drm/nouveau/nv50_dac.c20
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c37
-rw-r--r--drivers/gpu/drm/nouveau/nv50_fbcon.c23
-rw-r--r--drivers/gpu/drm/nouveau/nv50_fifo.c8
-rw-r--r--drivers/gpu/drm/nouveau/nv50_graph.c10
-rw-r--r--drivers/gpu/drm/nouveau/nv50_sor.c16
-rw-r--r--drivers/gpu/drm/r128/r128_drv.c2
-rw-r--r--drivers/gpu/drm/r128/r128_ioc32.c16
-rw-r--r--drivers/gpu/drm/radeon/Makefile5
-rw-r--r--drivers/gpu/drm/radeon/ObjectID.h801
-rw-r--r--drivers/gpu/drm/radeon/atom.c12
-rw-r--r--drivers/gpu/drm/radeon/atom.h1
-rw-r--r--drivers/gpu/drm/radeon/atombios.h199
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c6
-rw-r--r--drivers/gpu/drm/radeon/mkregtable.c4
-rw-r--r--drivers/gpu/drm/radeon/r100.c27
-rw-r--r--drivers/gpu/drm/radeon/r100_track.h4
-rw-r--r--drivers/gpu/drm/radeon/r300.c47
-rw-r--r--drivers/gpu/drm/radeon/r300_cmdbuf.c6
-rw-r--r--drivers/gpu/drm/radeon/r300_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/r420.c41
-rw-r--r--drivers/gpu/drm/radeon/r520.c1
-rw-r--r--drivers/gpu/drm/radeon/r600.c21
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c4
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon.h13
-rw-r--r--drivers/gpu/drm/radeon/radeon_agp.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h19
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c148
-rw-r--r--drivers/gpu/drm/radeon/radeon_clocks.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c73
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c41
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c86
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c14
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c32
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ioc32.c38
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_crtc.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_tv.c14
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h32
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_test.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c4
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/r420795
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/rs60068
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/rv5156
-rw-r--r--drivers/gpu/drm/radeon/rs400.c2
-rw-r--r--drivers/gpu/drm/radeon/rs600.c12
-rw-r--r--drivers/gpu/drm/radeon/rs690.c2
-rw-r--r--drivers/gpu/drm/radeon/rv515.c1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c3
-rw-r--r--drivers/gpu/drm/savage/savage_drv.c2
-rw-r--r--drivers/gpu/drm/sis/sis_drv.c2
-rw-r--r--drivers/gpu/drm/tdfx/tdfx_drv.c2
-rw-r--r--drivers/gpu/drm/via/via_drv.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c47
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c157
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_irq.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c8
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c149
-rw-r--r--drivers/hid/hid-lg.h2
-rw-r--r--drivers/hwmon/Kconfig49
-rw-r--r--drivers/hwmon/Makefile4
-rw-r--r--drivers/hwmon/adt7462.c2
-rw-r--r--drivers/hwmon/amc6821.c1116
-rw-r--r--drivers/hwmon/asus_atk0110.c289
-rw-r--r--drivers/hwmon/coretemp.c16
-rw-r--r--drivers/hwmon/k10temp.c223
-rw-r--r--drivers/hwmon/k8temp.c2
-rw-r--r--drivers/hwmon/lis3lv02d_i2c.c183
-rw-r--r--drivers/hwmon/sht15.c6
-rw-r--r--drivers/hwmon/sis5595.c2
-rw-r--r--drivers/hwmon/smsc47m1.c153
-rw-r--r--drivers/hwmon/via-cputemp.c356
-rw-r--r--drivers/hwmon/via686a.c2
-rw-r--r--drivers/hwmon/vt8231.c2
-rw-r--r--drivers/hwmon/w83627hf.c2
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c6
-rw-r--r--drivers/i2c/busses/i2c-omap.c13
-rw-r--r--drivers/idle/i7300_idle.c15
-rw-r--r--drivers/ieee1394/Kconfig59
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.h9
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_resource.c75
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c2
-rw-r--r--drivers/infiniband/hw/mlx4/srq.c6
-rw-r--r--drivers/input/ff-memless.c48
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c29
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c29
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
-rw-r--r--drivers/input/keyboard/atkbd.c5
-rw-r--r--drivers/input/keyboard/matrix_keypad.c29
-rw-r--r--drivers/input/keyboard/twl4030_keypad.c11
-rw-r--r--drivers/input/misc/twl4030-pwrbutton.c14
-rw-r--r--drivers/input/misc/wistron_btns.c2
-rw-r--r--drivers/input/mouse/Kconfig2
-rw-r--r--drivers/input/mouse/hgpk.c1
-rw-r--r--drivers/input/mouse/lifebook.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c5
-rw-r--r--drivers/input/serio/serio.c11
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c2
-rw-r--r--drivers/isdn/mISDN/l1oip_core.c2
-rw-r--r--drivers/leds/Kconfig33
-rw-r--r--drivers/leds/Makefile4
-rw-r--r--drivers/leds/leds-adp5520.c230
-rw-r--r--drivers/leds/leds-alix2.c115
-rw-r--r--drivers/leds/leds-cobalt-qube.c4
-rw-r--r--drivers/leds/leds-cobalt-raq.c2
-rw-r--r--drivers/leds/leds-lt3593.c217
-rw-r--r--drivers/leds/leds-pwm.c5
-rw-r--r--drivers/leds/leds-regulator.c242
-rw-r--r--drivers/leds/leds-ss4200.c556
-rw-r--r--drivers/lguest/segments.c4
-rw-r--r--drivers/md/md.c42
-rw-r--r--drivers/media/dvb/firewire/firedtv-fw.c12
-rw-r--r--drivers/media/video/cx23885/cx23888-ir.c44
-rw-r--r--drivers/media/video/meye.c60
-rw-r--r--drivers/media/video/meye.h4
-rw-r--r--drivers/message/fusion/mptbase.c6
-rw-r--r--drivers/message/i2o/i2o_config.c13
-rw-r--r--drivers/mfd/twl4030-irq.c4
-rw-r--r--drivers/misc/Kconfig1
-rw-r--r--drivers/misc/enclosure.c1
-rw-r--r--drivers/mmc/card/block.c8
-rw-r--r--drivers/mmc/card/queue.c18
-rw-r--r--drivers/mmc/core/mmc.c2
-rw-r--r--drivers/mmc/core/sdio.c5
-rw-r--r--drivers/mmc/core/sdio_bus.c7
-rw-r--r--drivers/mmc/host/Kconfig37
-rw-r--r--drivers/mmc/host/Makefile6
-rw-r--r--drivers/mmc/host/sdhci-of-core.c (renamed from drivers/mmc/host/sdhci-of.c)143
-rw-r--r--drivers/mmc/host/sdhci-of-esdhc.c143
-rw-r--r--drivers/mmc/host/sdhci-of-hlwd.c65
-rw-r--r--drivers/mmc/host/sdhci-of.h42
-rw-r--r--drivers/mmc/host/sdhci.h4
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c13
-rw-r--r--drivers/mtd/nand/Kconfig8
-rw-r--r--drivers/mtd/nand/Makefile1
-rw-r--r--drivers/mtd/nand/excite_nandflash.c248
-rw-r--r--drivers/net/3c507.c4
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/Makefile2
-rw-r--r--drivers/net/arm/Kconfig1
-rw-r--r--drivers/net/atarilance.c2
-rw-r--r--drivers/net/atlx/atl2.c7
-rw-r--r--drivers/net/benet/be.h1
-rw-r--r--drivers/net/benet/be_cmds.c36
-rw-r--r--drivers/net/benet/be_cmds.h16
-rw-r--r--drivers/net/benet/be_ethtool.c77
-rw-r--r--drivers/net/bnx2.c12
-rw-r--r--drivers/net/bnx2x_main.c2
-rw-r--r--drivers/net/bonding/bond_3ad.c2
-rw-r--r--drivers/net/can/at91_can.c2
-rw-r--r--drivers/net/can/mcp251x.c2
-rw-r--r--drivers/net/cs89x0.c3
-rw-r--r--drivers/net/davinci_emac.c6
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000e/82571.c8
-rw-r--r--drivers/net/e1000e/es2lan.c2
-rw-r--r--drivers/net/e1000e/hw.h1
-rw-r--r--drivers/net/e1000e/ich8lan.c2
-rw-r--r--drivers/net/e1000e/lib.c54
-rw-r--r--drivers/net/e1000e/netdev.c30
-rw-r--r--drivers/net/fsl_pq_mdio.c30
-rw-r--r--drivers/net/gianfar.c63
-rw-r--r--drivers/net/gianfar.h18
-rw-r--r--drivers/net/hamradio/bpqether.c4
-rw-r--r--drivers/net/ibmlana.c3
-rw-r--r--drivers/net/igb/e1000_82575.c4
-rw-r--r--drivers/net/igb/e1000_phy.c9
-rw-r--r--drivers/net/igb/igb_ethtool.c2
-rw-r--r--drivers/net/igb/igb_main.c9
-rw-r--r--drivers/net/igbvf/netdev.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c14
-rw-r--r--drivers/net/ll_temac_main.c2
-rw-r--r--drivers/net/mlx4/main.c2
-rw-r--r--drivers/net/mv643xx_eth.c6
-rw-r--r--drivers/net/netxen/netxen_nic.h4
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c193
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c6
-rw-r--r--drivers/net/netxen/netxen_nic_init.c4
-rw-r--r--drivers/net/netxen/netxen_nic_main.c67
-rw-r--r--drivers/net/niu.c2
-rw-r--r--drivers/net/octeon/Kconfig10
-rw-r--r--drivers/net/octeon/Makefile2
-rw-r--r--drivers/net/octeon/octeon_mgmt.c1176
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c4
-rw-r--r--drivers/net/pcnet32.c3
-rw-r--r--drivers/net/phy/Kconfig11
-rw-r--r--drivers/net/phy/Makefile1
-rw-r--r--drivers/net/phy/broadcom.c7
-rw-r--r--drivers/net/phy/mdio-octeon.c180
-rw-r--r--drivers/net/phy/mdio_bus.c72
-rw-r--r--drivers/net/phy/phy_device.c30
-rw-r--r--drivers/net/rrunner.c2
-rw-r--r--drivers/net/sfc/efx.c6
-rw-r--r--drivers/net/sfc/falcon.c1
-rw-r--r--drivers/net/sfc/falcon_xmac.c38
-rw-r--r--drivers/net/sfc/mcdi_phy.c93
-rw-r--r--drivers/net/sfc/net_driver.h1
-rw-r--r--drivers/net/sfc/nic.c2
-rw-r--r--drivers/net/sfc/qt202x_phy.c238
-rw-r--r--drivers/net/sfc/siena.c1
-rw-r--r--drivers/net/sfc/tenxpress.c138
-rw-r--r--drivers/net/sfc/tx.c4
-rw-r--r--drivers/net/sh_eth.c2
-rw-r--r--drivers/net/sky2.c4
-rw-r--r--drivers/net/tulip/Kconfig4
-rw-r--r--drivers/net/tulip/dmfe.c21
-rw-r--r--drivers/net/tulip/tulip_core.c32
-rw-r--r--drivers/net/tun.c6
-rw-r--r--drivers/net/ucc_geth.c45
-rw-r--r--drivers/net/ucc_geth.h13
-rw-r--r--drivers/net/usb/hso.c105
-rw-r--r--drivers/net/usb/rtl8150.c4
-rw-r--r--drivers/net/via-rhine.c41
-rw-r--r--drivers/net/via-velocity.c8
-rw-r--r--drivers/net/vxge/vxge-main.c8
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c18
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c20
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c42
-rw-r--r--drivers/net/wireless/b43/dma.c197
-rw-r--r--drivers/net/wireless/b43/dma.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000-hw.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-csr.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c37
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c56
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c68
-rw-r--r--drivers/net/wireless/iwmc3200wifi/iwm.h4
-rw-r--r--drivers/net/wireless/iwmc3200wifi/netdev.c2
-rw-r--r--drivers/net/wireless/iwmc3200wifi/rx.c2
-rw-r--r--drivers/net/wireless/libertas/cmd.c4
-rw-r--r--drivers/net/wireless/libertas/dev.h4
-rw-r--r--drivers/net/wireless/libertas/main.c21
-rw-r--r--drivers/net/wireless/libertas/mesh.c4
-rw-r--r--drivers/net/wireless/libertas/scan.c22
-rw-r--r--drivers/net/wireless/libertas/wext.c2
-rw-r--r--drivers/net/wireless/libertas_tf/main.c1
-rw-r--r--drivers/net/wireless/orinoco/wext.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2800.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c17
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c5
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180_dev.c1
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_boot.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c140
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h3
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c3
-rw-r--r--drivers/pci/hotplug/shpchp.h2
-rw-r--r--drivers/pci/intel-iommu.c6
-rw-r--r--drivers/pci/intr_remapping.c2
-rw-r--r--drivers/pci/pci-acpi.c10
-rw-r--r--drivers/pci/pci-sysfs.c6
-rw-r--r--drivers/pci/pci.c34
-rw-r--r--drivers/pci/pci.h8
-rw-r--r--drivers/pci/pcie/aer/Kconfig.debug4
-rw-r--r--drivers/pci/pcie/aer/aer_inject.c34
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c2
-rw-r--r--drivers/pci/pcie/aer/aerdrv_acpi.c2
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c6
-rw-r--r--drivers/pci/pcie/aer/aerdrv_errprint.c4
-rw-r--r--drivers/pci/pcie/aspm.c4
-rw-r--r--drivers/pci/pcie/portdrv_core.c16
-rw-r--r--drivers/pci/pcie/portdrv_pci.c19
-rw-r--r--drivers/pci/quirks.c74
-rw-r--r--drivers/pci/search.c6
-rw-r--r--drivers/pcmcia/cardbus.c2
-rw-r--r--drivers/pcmcia/pxa2xx_base.c6
-rw-r--r--drivers/platform/x86/Kconfig40
-rw-r--r--drivers/platform/x86/Makefile1
-rw-r--r--drivers/platform/x86/acer-wmi.c3
-rw-r--r--drivers/platform/x86/acerhdf.c68
-rw-r--r--drivers/platform/x86/asus_acpi.c321
-rw-r--r--drivers/platform/x86/classmate-laptop.c609
-rw-r--r--drivers/platform/x86/compal-laptop.c1
-rw-r--r--drivers/platform/x86/dell-wmi.c52
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c38
-rw-r--r--drivers/platform/x86/hp-wmi.c18
-rw-r--r--drivers/platform/x86/msi-wmi.c19
-rw-r--r--drivers/platform/x86/sony-laptop.c150
-rw-r--r--drivers/platform/x86/tc1100-wmi.c115
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c59
-rw-r--r--drivers/platform/x86/toshiba_acpi.c259
-rw-r--r--drivers/platform/x86/wmi.c40
-rw-r--r--drivers/power/pmu_battery.c2
-rw-r--r--drivers/regulator/88pm8607.c685
-rw-r--r--drivers/regulator/Kconfig13
-rw-r--r--drivers/regulator/Makefile4
-rw-r--r--drivers/regulator/ab3100.c33
-rw-r--r--drivers/regulator/core.c248
-rw-r--r--drivers/regulator/da903x.c2
-rw-r--r--drivers/regulator/lp3971.c4
-rw-r--r--drivers/regulator/max8660.c510
-rw-r--r--drivers/regulator/mc13783-regulator.c245
-rw-r--r--drivers/regulator/mc13783.c410
-rw-r--r--drivers/regulator/twl-regulator.c147
-rw-r--r--drivers/regulator/wm831x-dcdc.c207
-rw-r--r--drivers/regulator/wm831x-ldo.c2
-rw-r--r--drivers/rtc/rtc-cmos.c12
-rw-r--r--drivers/rtc/rtc-ds1305.c2
-rw-r--r--drivers/rtc/rtc-ds1307.c2
-rw-r--r--drivers/rtc/rtc-ds1374.c2
-rw-r--r--drivers/s390/block/dasd_alias.c2
-rw-r--r--drivers/s390/block/dasd_diag.c42
-rw-r--r--drivers/s390/char/fs3270.c2
-rw-r--r--drivers/s390/char/tape_34xx.c1
-rw-r--r--drivers/s390/char/tape_3590.c3
-rw-r--r--drivers/s390/char/tape_block.c1
-rw-r--r--drivers/s390/char/tape_char.c3
-rw-r--r--drivers/s390/char/tape_class.c4
-rw-r--r--drivers/s390/char/tape_core.c2
-rw-r--r--drivers/s390/char/tape_proc.c3
-rw-r--r--drivers/s390/char/tape_std.c3
-rw-r--r--drivers/s390/cio/Makefile2
-rw-r--r--drivers/s390/cio/ccwreq.c3
-rw-r--r--drivers/s390/cio/device.c1
-rw-r--r--drivers/s390/cio/device_pgid.c29
-rw-r--r--drivers/s390/cio/fcx.c4
-rw-r--r--drivers/s390/cio/io_sch.h1
-rw-r--r--drivers/s390/cio/qdio.h36
-rw-r--r--drivers/s390/cio/qdio_debug.c114
-rw-r--r--drivers/s390/cio/qdio_main.c72
-rw-r--r--drivers/s390/cio/qdio_perf.c147
-rw-r--r--drivers/s390/cio/qdio_perf.h61
-rw-r--r--drivers/s390/cio/qdio_setup.c10
-rw-r--r--drivers/s390/cio/qdio_thinint.c8
-rw-r--r--drivers/s390/net/claw.c2
-rw-r--r--drivers/sbus/char/bbc_envctrl.c64
-rw-r--r--drivers/scsi/3w-9xxx.c11
-rw-r--r--drivers/scsi/Kconfig10
-rw-r--r--drivers/scsi/Makefile1
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c12
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h1
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c51
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c16
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c2
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_offload.c58
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_pdu.c4
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c2
-rw-r--r--drivers/scsi/fcoe/fcoe.c137
-rw-r--r--drivers/scsi/hpsa.c3531
-rw-r--r--drivers/scsi/hpsa.h273
-rw-r--r--drivers/scsi/hpsa_cmd.h326
-rw-r--r--drivers/scsi/ipr.c1
-rw-r--r--drivers/scsi/libfc/fc_fcp.c65
-rw-r--r--drivers/scsi/libfc/fc_lport.c7
-rw-r--r--drivers/scsi/libfc/fc_rport.c1
-rw-r--r--drivers/scsi/libiscsi.c22
-rw-r--r--drivers/scsi/libiscsi_tcp.c36
-rw-r--r--drivers/scsi/libsrp.c17
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c4
-rwxr-xr-xdrivers/scsi/lpfc/lpfc_hbadisc.c25
-rwxr-xr-x[-rw-r--r--]drivers/scsi/lpfc/lpfc_hw4.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c30
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c48
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c4
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c16
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c5
-rw-r--r--drivers/scsi/mvsas/mv_init.c1
-rw-r--r--drivers/scsi/osd/osd_initiator.c88
-rw-r--r--drivers/scsi/pm8001/pm8001_ctl.h10
-rw-r--r--drivers/scsi/pm8001/pm8001_hwi.c149
-rw-r--r--drivers/scsi/pm8001/pm8001_hwi.h3
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c19
-rw-r--r--drivers/scsi/pm8001/pm8001_sas.c57
-rw-r--r--drivers/scsi/pm8001/pm8001_sas.h32
-rw-r--r--drivers/scsi/pmcraid.c42
-rw-r--r--drivers/scsi/pmcraid.h5
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c32
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.h9
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h7
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h3
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c34
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c112
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c64
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c165
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/scsi/scsi_lib.c1
-rw-r--r--drivers/scsi/scsi_transport_fc.c17
-rw-r--r--drivers/scsi/sd.c107
-rw-r--r--drivers/scsi/sd.h2
-rw-r--r--drivers/scsi/st.c23
-rw-r--r--drivers/scsi/st.h1
-rw-r--r--drivers/scsi/stex.c5
-rw-r--r--drivers/serial/21285.c4
-rw-r--r--drivers/serial/serial_cs.c15
-rw-r--r--drivers/serial/sh-sci.c20
-rw-r--r--drivers/serial/sh-sci.h118
-rw-r--r--drivers/spi/Kconfig28
-rw-r--r--drivers/spi/Makefile10
-rw-r--r--drivers/spi/atmel_spi.c6
-rw-r--r--drivers/spi/dw_spi.c944
-rw-r--r--drivers/spi/dw_spi_pci.c169
-rw-r--r--drivers/spi/spi_bfin5xx.c2
-rw-r--r--drivers/spi/spi_mpc8xxx.c2
-rw-r--r--drivers/spi/spi_s3c24xx.c244
-rw-r--r--drivers/spi/spi_s3c24xx_fiq.S116
-rw-r--r--drivers/spi/spi_s3c24xx_fiq.h26
-rw-r--r--drivers/spi/spi_s3c64xx.c1196
-rw-r--r--drivers/spi/spi_sh_sci.c2
-rw-r--r--drivers/spi/spi_txx9.c6
-rw-r--r--drivers/spi/spidev.c18
-rw-r--r--drivers/staging/Kconfig4
-rw-r--r--drivers/staging/Makefile2
-rw-r--r--drivers/staging/batman-adv/Kconfig1
-rw-r--r--drivers/staging/batman-adv/send.c4
-rw-r--r--drivers/staging/comedi/comedi.h2
-rw-r--r--drivers/staging/comedi/drivers/jr3_pci.c7
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c5
-rw-r--r--drivers/staging/dst/Kconfig67
-rw-r--r--drivers/staging/dst/Makefile3
-rw-r--r--drivers/staging/dst/crypto.c733
-rw-r--r--drivers/staging/dst/dcore.c968
-rw-r--r--drivers/staging/dst/export.c660
-rw-r--r--drivers/staging/dst/state.c844
-rw-r--r--drivers/staging/dst/thread_pool.c348
-rw-r--r--drivers/staging/dst/trans.c337
-rw-r--r--drivers/staging/iio/ring_sw.h1
-rw-r--r--drivers/staging/octeon/Kconfig3
-rw-r--r--drivers/staging/octeon/ethernet-mdio.c204
-rw-r--r--drivers/staging/octeon/ethernet-mdio.h2
-rw-r--r--drivers/staging/octeon/ethernet-proc.c112
-rw-r--r--drivers/staging/octeon/ethernet-rgmii.c52
-rw-r--r--drivers/staging/octeon/ethernet-sgmii.c2
-rw-r--r--drivers/staging/octeon/ethernet-xaui.c2
-rw-r--r--drivers/staging/octeon/ethernet.c23
-rw-r--r--drivers/staging/octeon/octeon-ethernet.h6
-rw-r--r--drivers/staging/panel/Kconfig2
-rw-r--r--drivers/staging/panel/panel.c4
-rw-r--r--drivers/staging/pohmelfs/dir.c2
-rw-r--r--drivers/staging/ramzswap/TODO1
-rw-r--r--drivers/staging/ramzswap/ramzswap_drv.c28
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211.h10
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c2
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c14
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c2
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c10
-rw-r--r--drivers/staging/rtl8187se/r8180_wx.c2
-rw-r--r--drivers/staging/rtl8192e/ieee80211.h12
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211.h12
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_module.c10
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c24
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/rtl819x_BAProc.c6
-rw-r--r--drivers/staging/rtl8192e/r8192E_core.c14
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211.h8
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c6
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c16
-rw-r--r--drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c2
-rw-r--r--drivers/staging/rtl8192su/r8192U_core.c10
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c6
-rw-r--r--drivers/staging/sm7xx/Kconfig15
-rw-r--r--drivers/staging/sm7xx/Makefile3
-rw-r--r--drivers/staging/sm7xx/TODO10
-rw-r--r--drivers/staging/sm7xx/smtc2d.c979
-rw-r--r--drivers/staging/sm7xx/smtc2d.h530
-rw-r--r--drivers/staging/sm7xx/smtcfb.c1253
-rw-r--r--drivers/staging/sm7xx/smtcfb.h793
-rw-r--r--drivers/staging/vt6655/Kconfig2
-rw-r--r--drivers/staging/vt6656/Kconfig2
-rw-r--r--drivers/staging/wlan-ng/prism2fw.c2
-rw-r--r--drivers/usb/Makefile2
-rw-r--r--drivers/usb/core/hcd.c4
-rw-r--r--drivers/usb/core/hub.c58
-rw-r--r--drivers/usb/core/sysfs.c6
-rw-r--r--drivers/usb/core/usb.c6
-rw-r--r--drivers/usb/early/ehci-dbgp.c2
-rw-r--r--drivers/usb/gadget/audio.c1
-rw-r--r--drivers/usb/gadget/f_audio.c15
-rw-r--r--drivers/usb/gadget/u_audio.c12
-rw-r--r--drivers/usb/gadget/u_audio.h2
-rw-r--r--drivers/usb/host/ehci-omap.c2
-rw-r--r--drivers/usb/host/fhci-sched.c10
-rw-r--r--drivers/usb/host/fhci-tds.c35
-rw-r--r--drivers/usb/host/fhci.h16
-rw-r--r--drivers/usb/misc/appledisplay.c5
-rw-r--r--drivers/usb/misc/emi62.c2
-rw-r--r--drivers/usb/musb/blackfin.c134
-rw-r--r--drivers/usb/musb/blackfin.h2
-rw-r--r--drivers/usb/musb/cppi_dma.c6
-rw-r--r--drivers/usb/musb/davinci.c2
-rw-r--r--drivers/usb/musb/musb_core.c14
-rw-r--r--drivers/usb/musb/musb_gadget.c13
-rw-r--r--drivers/usb/musb/musb_gadget_ep0.c14
-rw-r--r--drivers/usb/otg/isp1301_omap.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.h959
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h986
-rw-r--r--drivers/usb/serial/generic.c12
-rw-r--r--drivers/usb/serial/mos7840.c7
-rw-r--r--drivers/usb/serial/option.c5
-rw-r--r--drivers/usb/serial/usb-serial.c7
-rw-r--r--drivers/video/atafb.c3
-rw-r--r--drivers/video/backlight/adp5520_bl.c2
-rw-r--r--drivers/video/backlight/adx_bl.c2
-rw-r--r--drivers/video/backlight/atmel-pwm-bl.c2
-rw-r--r--drivers/video/backlight/backlight.c2
-rw-r--r--drivers/video/backlight/corgi_lcd.c2
-rw-r--r--drivers/video/backlight/cr_bllcd.c4
-rw-r--r--drivers/video/backlight/da903x_bl.c2
-rw-r--r--drivers/video/backlight/generic_bl.c2
-rw-r--r--drivers/video/backlight/hp680_bl.c2
-rw-r--r--drivers/video/backlight/jornada720_bl.c2
-rw-r--r--drivers/video/backlight/kb3886_bl.c2
-rw-r--r--drivers/video/backlight/locomolcd.c2
-rw-r--r--drivers/video/backlight/mbp_nvidia_bl.c20
-rw-r--r--drivers/video/backlight/omap1_bl.c4
-rw-r--r--drivers/video/backlight/progear_bl.c2
-rw-r--r--drivers/video/backlight/pwm_bl.c11
-rw-r--r--drivers/video/backlight/tosa_bl.c2
-rw-r--r--drivers/video/backlight/wm831x_bl.c2
-rw-r--r--drivers/video/cyber2000fb.c12
-rw-r--r--drivers/video/omap/dispc.c18
-rw-r--r--drivers/video/omap/lcd_htcherald.c4
-rw-r--r--drivers/video/omap/lcd_ldp.c4
-rw-r--r--drivers/video/omap/lcd_omap2evm.c10
-rw-r--r--drivers/video/omap/lcd_omap3beagle.c2
-rw-r--r--drivers/video/omap/lcd_omap3evm.c10
-rw-r--r--drivers/video/omap/lcd_overo.c2
-rw-r--r--drivers/video/omap/omapfb.h2
-rw-r--r--drivers/video/omap/omapfb_main.c25
-rw-r--r--drivers/video/omap/rfbi.c4
-rw-r--r--drivers/video/omap2/dss/Kconfig7
-rw-r--r--drivers/video/omap2/dss/core.c10
-rw-r--r--drivers/video/omap2/dss/dispc.c74
-rw-r--r--drivers/video/omap2/dss/dsi.c159
-rw-r--r--drivers/video/omap2/dss/dss.c6
-rw-r--r--drivers/video/omap2/dss/dss.h14
-rw-r--r--drivers/video/omap2/dss/rfbi.c30
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c6
-rw-r--r--drivers/video/pxafb.c4
-rw-r--r--drivers/video/via/viafbdev.c4
-rw-r--r--drivers/watchdog/Kconfig12
-rw-r--r--drivers/watchdog/Makefile1
-rw-r--r--drivers/watchdog/adx_wdt.c4
-rw-r--r--drivers/watchdog/at32ap700x_wdt.c2
-rw-r--r--drivers/watchdog/davinci_wdt.c2
-rw-r--r--drivers/watchdog/geodewdt.c40
-rw-r--r--drivers/watchdog/iTCO_wdt.c4
-rw-r--r--drivers/watchdog/mpcore_wdt.c2
-rw-r--r--drivers/watchdog/mv64x60_wdt.c2
-rw-r--r--drivers/watchdog/omap_wdt.c9
-rw-r--r--drivers/watchdog/pnx4008_wdt.c2
-rw-r--r--drivers/watchdog/rm9k_wdt.c419
-rw-r--r--drivers/watchdog/s3c2410_wdt.c2
-rw-r--r--drivers/watchdog/txx9wdt.c6
-rw-r--r--firmware/Makefile3
-rw-r--r--firmware/WHENCE1
-rw-r--r--firmware/cis/PE520.cis.ihex9
-rw-r--r--fs/Kconfig4
-rw-r--r--fs/anon_inodes.c21
-rw-r--r--fs/binfmt_aout.c13
-rw-r--r--fs/binfmt_elf.c24
-rw-r--r--fs/binfmt_elf_fdpic.c46
-rw-r--r--fs/binfmt_flat.c6
-rw-r--r--fs/binfmt_som.c2
-rw-r--r--fs/btrfs/Kconfig1
-rw-r--r--fs/btrfs/acl.c23
-rw-r--r--fs/btrfs/btrfs_inode.h5
-rw-r--r--fs/btrfs/ctree.c229
-rw-r--r--fs/btrfs/ctree.h40
-rw-r--r--fs/btrfs/dir-item.c19
-rw-r--r--fs/btrfs/disk-io.c27
-rw-r--r--fs/btrfs/extent-tree.c72
-rw-r--r--fs/btrfs/file.c669
-rw-r--r--fs/btrfs/inode.c567
-rw-r--r--fs/btrfs/ioctl.c34
-rw-r--r--fs/btrfs/ordered-data.c115
-rw-r--r--fs/btrfs/ordered-data.h5
-rw-r--r--fs/btrfs/relocation.c38
-rw-r--r--fs/btrfs/super.c15
-rw-r--r--fs/btrfs/transaction.c44
-rw-r--r--fs/btrfs/transaction.h6
-rw-r--r--fs/btrfs/tree-log.c86
-rw-r--r--fs/btrfs/volumes.c2
-rw-r--r--fs/btrfs/xattr.c80
-rw-r--r--fs/btrfs/xattr.h9
-rw-r--r--fs/cifs/CHANGES4
-rw-r--r--fs/cifs/cifsfs.c3
-rw-r--r--fs/cifs/connect.c13
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/direct-io.c2
-rw-r--r--fs/ecryptfs/dentry.c2
-rw-r--r--fs/ecryptfs/inode.c6
-rw-r--r--fs/ecryptfs/main.c2
-rw-r--r--fs/eventfd.c2
-rw-r--r--fs/eventpoll.c2
-rw-r--r--fs/exec.c40
-rw-r--r--fs/exofs/inode.c17
-rw-r--r--fs/exofs/pnfs.h10
-rw-r--r--fs/ext3/inode.c8
-rw-r--r--fs/ext3/namei.c28
-rw-r--r--fs/ext3/resize.c35
-rw-r--r--fs/ext3/super.c19
-rw-r--r--fs/ext4/Kconfig2
-rw-r--r--fs/ext4/block_validity.c1
-rw-r--r--fs/ext4/ext4.h8
-rw-r--r--fs/ext4/ext4_extents.h3
-rw-r--r--fs/ext4/extents.c77
-rw-r--r--fs/ext4/fsync.c16
-rw-r--r--fs/ext4/inode.c235
-rw-r--r--fs/ext4/mballoc.c6
-rw-r--r--fs/ext4/mballoc.h1
-rw-r--r--fs/ext4/super.c12
-rw-r--r--fs/ext4/xattr.c2
-rw-r--r--fs/file_table.c4
-rw-r--r--fs/fs-writeback.c18
-rw-r--r--fs/gfs2/Kconfig1
-rw-r--r--fs/gfs2/file.c38
-rw-r--r--fs/gfs2/inode.c2
-rw-r--r--fs/gfs2/meta_io.c2
-rw-r--r--fs/gfs2/ops_inode.c6
-rw-r--r--fs/gfs2/xattr.c21
-rw-r--r--fs/inode.c26
-rw-r--r--fs/internal.h7
-rw-r--r--fs/jbd/Kconfig1
-rw-r--r--fs/jbd/journal.c2
-rw-r--r--fs/jbd2/Kconfig1
-rw-r--r--fs/jbd2/checkpoint.c15
-rw-r--r--fs/jbd2/commit.c19
-rw-r--r--fs/jbd2/journal.c5
-rw-r--r--fs/jfs/jfs_txnmgr.c2
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/namei.c11
-rw-r--r--fs/namespace.c3
-rw-r--r--fs/nfs/dir.c1
-rw-r--r--fs/nfs/super.c8
-rw-r--r--fs/nfsd/nfsfh.c2
-rw-r--r--fs/nfsd/vfs.c5
-rw-r--r--fs/nilfs2/Kconfig1
-rw-r--r--fs/nilfs2/bmap.c4
-rw-r--r--fs/nilfs2/cpfile.c31
-rw-r--r--fs/nilfs2/direct.c17
-rw-r--r--fs/nilfs2/ioctl.c2
-rw-r--r--fs/ntfs/inode.c6
-rw-r--r--fs/ocfs2/Kconfig10
-rw-r--r--fs/ocfs2/Makefile7
-rw-r--r--fs/ocfs2/acl.c4
-rw-r--r--fs/ocfs2/acl.h22
-rw-r--r--fs/ocfs2/alloc.c10
-rw-r--r--fs/ocfs2/alloc.h5
-rw-r--r--fs/ocfs2/cluster/heartbeat.c6
-rw-r--r--fs/ocfs2/cluster/nodemanager.c51
-rw-r--r--fs/ocfs2/cluster/nodemanager.h7
-rw-r--r--fs/ocfs2/cluster/quorum.c16
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c18
-rw-r--r--fs/ocfs2/extent_map.c25
-rw-r--r--fs/ocfs2/file.c21
-rw-r--r--fs/ocfs2/namei.c6
-rw-r--r--fs/ocfs2/ocfs2.h8
-rw-r--r--fs/ocfs2/ocfs2_fs.h2
-rw-r--r--fs/ocfs2/refcounttree.c150
-rw-r--r--fs/ocfs2/stack_user.c2
-rw-r--r--fs/ocfs2/super.c95
-rw-r--r--fs/ocfs2/symlink.c2
-rw-r--r--fs/ocfs2/xattr.c6
-rw-r--r--fs/ocfs2/xattr.h2
-rw-r--r--fs/open.c13
-rw-r--r--fs/pipe.c18
-rw-r--r--fs/proc/array.c108
-rw-r--r--fs/proc/task_mmu.c3
-rw-r--r--fs/quota/dquot.c291
-rw-r--r--fs/quota/quota_v2.c9
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/reiserfs/Kconfig1
-rw-r--r--fs/reiserfs/bitmap.c3
-rw-r--r--fs/reiserfs/inode.c42
-rw-r--r--fs/reiserfs/ioctl.c3
-rw-r--r--fs/reiserfs/journal.c18
-rw-r--r--fs/reiserfs/lock.c9
-rw-r--r--fs/reiserfs/namei.c7
-rw-r--r--fs/reiserfs/xattr.c38
-rw-r--r--fs/reiserfs/xattr_acl.c2
-rw-r--r--fs/signalfd.c2
-rw-r--r--fs/stack.c71
-rw-r--r--fs/stat.c10
-rw-r--r--fs/super.c3
-rw-r--r--fs/sync.c59
-rw-r--r--fs/sysfs/bin.c6
-rw-r--r--fs/sysfs/dir.c14
-rw-r--r--fs/sysfs/sysfs.h15
-rw-r--r--fs/timerfd.c2
-rw-r--r--fs/ubifs/file.c2
-rw-r--r--fs/ubifs/gc.c96
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.h1145
-rw-r--r--fs/xfs/xfs_alloc.c44
-rw-r--r--fs/xfs/xfs_iget.c4
-rw-r--r--fs/xfs/xfs_inode.c10
-rw-r--r--fs/xfs/xfs_vnodeops.c93
-rw-r--r--include/acpi/processor.h8
-rw-r--r--include/asm-generic/fcntl.h2
-rw-r--r--include/drm/drmP.h7
-rw-r--r--include/drm/drm_mode.h1
-rw-r--r--include/drm/i915_drm.h54
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/backlight.h12
-rw-r--r--include/linux/binfmts.h10
-rw-r--r--include/linux/blkdev.h17
-rw-r--r--include/linux/decompress/mm.h4
-rw-r--r--include/linux/decompress/unlzo.h10
-rw-r--r--include/linux/device.h12
-rw-r--r--include/linux/dst.h587
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/enclosure.h2
-rw-r--r--include/linux/ext3_fs_sb.h2
-rw-r--r--include/linux/ext3_jbd.h7
-rw-r--r--include/linux/fiemap.h2
-rw-r--r--include/linux/firewire-cdev.h3
-rw-r--r--include/linux/firewire.h4
-rw-r--r--include/linux/fs.h46
-rw-r--r--include/linux/fs_stack.h6
-rw-r--r--include/linux/highmem.h2
-rw-r--r--include/linux/i2c/adp5588.h12
-rw-r--r--include/linux/ieee80211.h2
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init_task.h8
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/kfifo.h554
-rw-r--r--include/linux/kgdb.h7
-rw-r--r--include/linux/kmemcheck.h110
-rw-r--r--include/linux/kmemleak.h6
-rw-r--r--include/linux/leds-lp3944.h3
-rw-r--r--include/linux/leds-pca9532.h2
-rw-r--r--include/linux/leds-regulator.h46
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/list_sort.h11
-rw-r--r--include/linux/memory.h27
-rw-r--r--include/linux/mfd/wm831x/pdata.h17
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/mm_types.h2
-rw-r--r--include/linux/mmdebug.h2
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mnt_namespace.h1
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/pci.h4
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/poison.h16
-rw-r--r--include/linux/pwm_backlight.h2
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/rcutiny.h5
-rw-r--r--include/linux/rcutree.h11
-rw-r--r--include/linux/regulator/consumer.h2
-rw-r--r--include/linux/regulator/machine.h6
-rw-r--r--include/linux/regulator/max8660.h57
-rw-r--r--include/linux/reiserfs_fs.h26
-rw-r--r--include/linux/resource.h8
-rw-r--r--include/linux/sched.h37
-rw-r--r--include/linux/security.h7
-rw-r--r--include/linux/sonypi.h1
-rw-r--r--include/linux/spi/dw_spi.h212
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/sysfs.h9
-rw-r--r--include/linux/uaccess.h4
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/vermagic.h2
-rw-r--r--include/linux/vt.h4
-rw-r--r--include/linux/writeback.h4
-rw-r--r--include/net/ip.h16
-rw-r--r--include/net/mac80211.h8
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/libiscsi_tcp.h2
-rw-r--r--include/scsi/libsrp.h3
-rw-r--r--include/scsi/osd_initiator.h5
-rw-r--r--include/trace/ftrace.h7
-rw-r--r--init/Kconfig18
-rw-r--r--init/Makefile8
-rw-r--r--init/initramfs.c10
-rw-r--r--init/main.c7
-rw-r--r--init/version.c4
-rw-r--r--kernel/audit_tree.c13
-rw-r--r--kernel/auditsc.c1
-rw-r--r--kernel/bounds.c2
-rw-r--r--kernel/cgroup.c1
-rw-r--r--kernel/cpu.c24
-rw-r--r--kernel/exit.c36
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/hw_breakpoint.c10
-rw-r--r--kernel/kexec.c2
-rw-r--r--kernel/kfifo.c361
-rw-r--r--kernel/kmod.c12
-rw-r--r--kernel/kprobes.c2
-rw-r--r--kernel/kthread.c23
-rw-r--r--kernel/module.c30
-rw-r--r--kernel/perf_event.c9
-rw-r--r--kernel/printk.c4
-rw-r--r--kernel/resource.c32
-rw-r--r--kernel/sched.c307
-rw-r--r--kernel/sched_clock.c23
-rw-r--r--kernel/sched_fair.c53
-rw-r--r--kernel/sched_rt.c4
-rw-r--r--kernel/signal.c28
-rw-r--r--kernel/sys.c2
-rw-r--r--kernel/sysctl.c4
-rw-r--r--kernel/sysctl_binary.c31
-rw-r--r--kernel/time.c1
-rw-r--r--kernel/time/clockevents.c18
-rw-r--r--kernel/time/timekeeping.c27
-rw-r--r--kernel/time/timer_list.c4
-rw-r--r--kernel/timer.c2
-rw-r--r--kernel/trace/Kconfig112
-rw-r--r--kernel/trace/trace.c4
-rw-r--r--kernel/trace/trace_export.c7
-rw-r--r--kernel/trace/trace_kprobe.c7
-rw-r--r--kernel/trace/trace_ksym.c140
-rw-r--r--lib/Kconfig4
-rw-r--r--lib/Kconfig.debug1
-rw-r--r--lib/Makefile3
-rw-r--r--lib/decompress.c5
-rw-r--r--lib/decompress_bunzip2.c10
-rw-r--r--lib/decompress_unlzo.c209
-rw-r--r--lib/dma-debug.c15
-rw-r--r--lib/list_sort.c102
-rw-r--r--lib/lzo/lzo1x_decompress.c9
-rw-r--r--lib/rational.c1
-rw-r--r--lib/string.c6
-rw-r--r--lib/vsprintf.c15
-rw-r--r--lib/zlib_inflate/inffast.c55
-rw-r--r--mm/Kconfig3
-rw-r--r--mm/hugetlb.c2
-rw-r--r--mm/kmemleak.c188
-rw-r--r--mm/maccess.c11
-rw-r--r--mm/memory-failure.c9
-rw-r--r--mm/mmap.c40
-rw-r--r--mm/nommu.c42
-rw-r--r--mm/page_alloc.c72
-rw-r--r--mm/percpu.c4
-rw-r--r--mm/readahead.c12
-rw-r--r--mm/slab.c16
-rw-r--r--mm/util.c44
-rw-r--r--net/bluetooth/hidp/core.c2
-rw-r--r--net/bluetooth/l2cap.c5
-rw-r--r--net/bridge/netfilter/ebtables.c6
-rw-r--r--net/core/pktgen.c9
-rw-r--r--net/core/sock.c4
-rw-r--r--net/dccp/probe.c20
-rw-r--r--net/ipv4/devinet.c1
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/reassembly.c3
-rw-r--r--net/ipv6/route.c1
-rw-r--r--net/mac80211/ht.c25
-rw-r--r--net/mac80211/ibss.c4
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/mlme.c8
-rw-r--r--net/mac80211/tx.c4
-rw-r--r--net/mac80211/util.c12
-rw-r--r--net/netfilter/ipvs/Kconfig3
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c14
-rw-r--r--net/netfilter/ipvs/ip_vs_wrr.c15
-rw-r--r--net/netfilter/nf_conntrack_ftp.c18
-rw-r--r--net/packet/af_packet.c19
-rw-r--r--net/rose/rose_loopback.c2
-rw-r--r--net/sctp/socket.c3
-rw-r--r--net/socket.c19
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c17
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_mech.c4
-rw-r--r--net/sunrpc/auth_gss/gss_mech_switch.c2
-rw-r--r--net/sunrpc/svc_xprt.c3
-rw-r--r--net/wireless/mlme.c13
-rw-r--r--net/wireless/scan.c13
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--scripts/Kbuild.include6
-rw-r--r--scripts/Makefile.build1
-rw-r--r--scripts/Makefile.lib7
-rw-r--r--scripts/Makefile.modbuiltin55
-rw-r--r--scripts/basic/fixdep.c10
-rwxr-xr-xscripts/checkpatch.pl2
-rw-r--r--scripts/genksyms/keywords.c_shipped191
-rw-r--r--scripts/genksyms/keywords.gperf2
-rwxr-xr-xscripts/get_maintainer.pl84
-rwxr-xr-xscripts/headers.sh2
-rw-r--r--scripts/kconfig/Makefile1
-rw-r--r--scripts/kconfig/confdata.c24
-rwxr-xr-xscripts/mkcompile_h2
-rw-r--r--scripts/mod/modpost.c2
-rw-r--r--scripts/package/Makefile20
-rw-r--r--scripts/package/buildtar6
-rwxr-xr-xscripts/recordmcount.pl58
-rwxr-xr-xscripts/tags.sh8
-rw-r--r--scripts/unifdef.c341
-rw-r--r--security/Makefile3
-rw-r--r--security/keys/keyctl.c12
-rw-r--r--security/min_addr.c2
-rw-r--r--security/selinux/hooks.c2
-rw-r--r--security/tomoyo/file.c1
-rw-r--r--sound/arm/aaci.c180
-rw-r--r--sound/arm/aaci.h2
-rw-r--r--sound/core/Kconfig1
-rw-r--r--sound/core/pcm_lib.c4
-rw-r--r--sound/core/pcm_native.c8
-rw-r--r--sound/core/pcm_timer.c17
-rw-r--r--sound/isa/msnd/msnd_midi.c2
-rw-r--r--sound/isa/sb/emu8000.c11
-rw-r--r--sound/mips/sgio2audio.c2
-rw-r--r--sound/oss/dev_table.c16
-rw-r--r--sound/oss/pss.c6
-rw-r--r--sound/oss/sound_config.h2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/ac97/ac97_codec.c10
-rw-r--r--sound/pci/ac97/ac97_id.h2
-rw-r--r--sound/pci/ac97/ac97_patch.c1
-rw-r--r--sound/pci/atiixp.c1
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c20
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_intel.c22
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_cirrus.c22
-rw-r--r--sound/pci/hda/patch_conexant.c43
-rw-r--r--sound/pci/hda/patch_realtek.c389
-rw-r--r--sound/pci/hda/patch_sigmatel.c40
-rw-r--r--sound/pci/riptide/riptide.c2
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c2
-rw-r--r--sound/soc/codecs/ac97.c6
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/stac9766.c18
-rw-r--r--sound/soc/codecs/wm8350.c2
-rw-r--r--sound/soc/codecs/wm8510.c14
-rw-r--r--sound/soc/codecs/wm8940.c14
-rw-r--r--sound/soc/codecs/wm8974.c16
-rw-r--r--sound/soc/codecs/wm9712.c3
-rw-r--r--sound/soc/imx/mx27vis_wm8974.c3
-rw-r--r--sound/soc/omap/sdp3430.c6
-rw-r--r--sound/soc/sh/fsi-ak4642.c30
-rw-r--r--sound/soc/sh/fsi.c2
-rw-r--r--sound/usb/usbaudio.c4
-rw-r--r--tools/perf/Makefile44
-rw-r--r--tools/perf/builtin-kmem.c4
-rw-r--r--tools/perf/design.txt8
-rw-r--r--usr/Kconfig26
-rw-r--r--usr/gen_init_cpio.c5
-rw-r--r--virt/kvm/assigned-dev.c6
-rw-r--r--virt/kvm/kvm_main.c9
1999 files changed, 63185 insertions, 26254 deletions
diff --git a/.gitignore b/.gitignore
index 946c7ec5c922..de6344e15706 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@
22*.lst 22*.lst
23*.symtypes 23*.symtypes
24*.order 24*.order
25modules.builtin
25*.elf 26*.elf
26*.bin 27*.bin
27*.gz 28*.gz
@@ -36,6 +37,7 @@
36tags 37tags
37TAGS 38TAGS
38vmlinux 39vmlinux
40vmlinuz
39System.map 41System.map
40Module.markers 42Module.markers
41Module.symvers 43Module.symvers
@@ -45,14 +47,8 @@ Module.symvers
45# 47#
46# Generated include files 48# Generated include files
47# 49#
48include/asm
49include/asm-*/asm-offsets.h
50include/config 50include/config
51include/linux/autoconf.h
52include/linux/compile.h
53include/linux/version.h 51include/linux/version.h
54include/linux/utsrelease.h
55include/linux/bounds.h
56include/generated 52include/generated
57 53
58# stgit generated dirs 54# stgit generated dirs
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index deb6b489e4e5..a07c0f366f91 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -21,25 +21,27 @@ Contact: Alan Stern <stern@rowland.harvard.edu>
21Description: 21Description:
22 Each USB device directory will contain a file named 22 Each USB device directory will contain a file named
23 power/level. This file holds a power-level setting for 23 power/level. This file holds a power-level setting for
24 the device, one of "on", "auto", or "suspend". 24 the device, either "on" or "auto".
25 25
26 "on" means that the device is not allowed to autosuspend, 26 "on" means that the device is not allowed to autosuspend,
27 although normal suspends for system sleep will still 27 although normal suspends for system sleep will still
28 be honored. "auto" means the device will autosuspend 28 be honored. "auto" means the device will autosuspend
29 and autoresume in the usual manner, according to the 29 and autoresume in the usual manner, according to the
30 capabilities of its driver. "suspend" means the device 30 capabilities of its driver.
31 is forced into a suspended state and it will not autoresume
32 in response to I/O requests. However remote-wakeup requests
33 from the device may still be enabled (the remote-wakeup
34 setting is controlled separately by the power/wakeup
35 attribute).
36 31
37 During normal use, devices should be left in the "auto" 32 During normal use, devices should be left in the "auto"
38 level. The other levels are meant for administrative uses. 33 level. The "on" level is meant for administrative uses.
39 If you want to suspend a device immediately but leave it 34 If you want to suspend a device immediately but leave it
40 free to wake up in response to I/O requests, you should 35 free to wake up in response to I/O requests, you should
41 write "0" to power/autosuspend. 36 write "0" to power/autosuspend.
42 37
38 Device not capable of proper suspend and resume should be
39 left in the "on" level. Although the USB spec requires
40 devices to support suspend/resume, many of them do not.
41 In fact so many don't that by default, the USB core
42 initializes all non-hub devices in the "on" level. Some
43 drivers may change this setting when they are bound.
44
43What: /sys/bus/usb/devices/.../power/persist 45What: /sys/bus/usb/devices/.../power/persist
44Date: May 2007 46Date: May 2007
45KernelVersion: 2.6.23 47KernelVersion: 2.6.23
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl
index f508a8a27fea..5e7d84b48505 100644
--- a/Documentation/DocBook/mtdnand.tmpl
+++ b/Documentation/DocBook/mtdnand.tmpl
@@ -174,7 +174,7 @@
174 </para> 174 </para>
175 <programlisting> 175 <programlisting>
176static struct mtd_info *board_mtd; 176static struct mtd_info *board_mtd;
177static unsigned long baseaddr; 177static void __iomem *baseaddr;
178 </programlisting> 178 </programlisting>
179 <para> 179 <para>
180 Static example 180 Static example
@@ -182,7 +182,7 @@ static unsigned long baseaddr;
182 <programlisting> 182 <programlisting>
183static struct mtd_info board_mtd; 183static struct mtd_info board_mtd;
184static struct nand_chip board_chip; 184static struct nand_chip board_chip;
185static unsigned long baseaddr; 185static void __iomem *baseaddr;
186 </programlisting> 186 </programlisting>
187 </sect1> 187 </sect1>
188 <sect1 id="Partition_defines"> 188 <sect1 id="Partition_defines">
@@ -283,8 +283,8 @@ int __init board_init (void)
283 } 283 }
284 284
285 /* map physical address */ 285 /* map physical address */
286 baseaddr = (unsigned long)ioremap(CHIP_PHYSICAL_ADDRESS, 1024); 286 baseaddr = ioremap(CHIP_PHYSICAL_ADDRESS, 1024);
287 if(!baseaddr){ 287 if (!baseaddr) {
288 printk("Ioremap to access NAND chip failed\n"); 288 printk("Ioremap to access NAND chip failed\n");
289 err = -EIO; 289 err = -EIO;
290 goto out_mtd; 290 goto out_mtd;
@@ -316,7 +316,7 @@ int __init board_init (void)
316 goto out; 316 goto out;
317 317
318out_ior: 318out_ior:
319 iounmap((void *)baseaddr); 319 iounmap(baseaddr);
320out_mtd: 320out_mtd:
321 kfree (board_mtd); 321 kfree (board_mtd);
322out: 322out:
@@ -341,7 +341,7 @@ static void __exit board_cleanup (void)
341 nand_release (board_mtd); 341 nand_release (board_mtd);
342 342
343 /* unmap physical address */ 343 /* unmap physical address */
344 iounmap((void *)baseaddr); 344 iounmap(baseaddr);
345 345
346 /* Free the MTD device structure */ 346 /* Free the MTD device structure */
347 kfree (board_mtd); 347 kfree (board_mtd);
diff --git a/Documentation/IO-mapping.txt b/Documentation/IO-mapping.txt
index 78a440695e11..1b5aa10df845 100644
--- a/Documentation/IO-mapping.txt
+++ b/Documentation/IO-mapping.txt
@@ -157,7 +157,7 @@ For such memory, you can do things like
157 * access only the 640k-1MB area, so anything else 157 * access only the 640k-1MB area, so anything else
158 * has to be remapped. 158 * has to be remapped.
159 */ 159 */
160 char * baseptr = ioremap(0xFC000000, 1024*1024); 160 void __iomem *baseptr = ioremap(0xFC000000, 1024*1024);
161 161
162 /* write a 'A' to the offset 10 of the area */ 162 /* write a 'A' to the offset 10 of the area */
163 writeb('A',baseptr+10); 163 writeb('A',baseptr+10);
diff --git a/Documentation/DMA-mapping.txt b/Documentation/PCI/PCI-DMA-mapping.txt
index ecad88d9fe59..ecad88d9fe59 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/PCI/PCI-DMA-mapping.txt
diff --git a/Documentation/block/00-INDEX b/Documentation/block/00-INDEX
index 961a0513f8c3..a406286f6f3e 100644
--- a/Documentation/block/00-INDEX
+++ b/Documentation/block/00-INDEX
@@ -1,7 +1,5 @@
100-INDEX 100-INDEX
2 - This file 2 - This file
3as-iosched.txt
4 - Anticipatory IO scheduler
5barrier.txt 3barrier.txt
6 - I/O Barriers 4 - I/O Barriers
7biodoc.txt 5biodoc.txt
diff --git a/Documentation/block/as-iosched.txt b/Documentation/block/as-iosched.txt
deleted file mode 100644
index 738b72be128e..000000000000
--- a/Documentation/block/as-iosched.txt
+++ /dev/null
@@ -1,172 +0,0 @@
1Anticipatory IO scheduler
2-------------------------
3Nick Piggin <piggin@cyberone.com.au> 13 Sep 2003
4
5Attention! Database servers, especially those using "TCQ" disks should
6investigate performance with the 'deadline' IO scheduler. Any system with high
7disk performance requirements should do so, in fact.
8
9If you see unusual performance characteristics of your disk systems, or you
10see big performance regressions versus the deadline scheduler, please email
11me. Database users don't bother unless you're willing to test a lot of patches
12from me ;) its a known issue.
13
14Also, users with hardware RAID controllers, doing striping, may find
15highly variable performance results with using the as-iosched. The
16as-iosched anticipatory implementation is based on the notion that a disk
17device has only one physical seeking head. A striped RAID controller
18actually has a head for each physical device in the logical RAID device.
19
20However, setting the antic_expire (see tunable parameters below) produces
21very similar behavior to the deadline IO scheduler.
22
23Selecting IO schedulers
24-----------------------
25Refer to Documentation/block/switching-sched.txt for information on
26selecting an io scheduler on a per-device basis.
27
28Anticipatory IO scheduler Policies
29----------------------------------
30The as-iosched implementation implements several layers of policies
31to determine when an IO request is dispatched to the disk controller.
32Here are the policies outlined, in order of application.
33
341. one-way Elevator algorithm.
35
36The elevator algorithm is similar to that used in deadline scheduler, with
37the addition that it allows limited backward movement of the elevator
38(i.e. seeks backwards). A seek backwards can occur when choosing between
39two IO requests where one is behind the elevator's current position, and
40the other is in front of the elevator's position. If the seek distance to
41the request in back of the elevator is less than half the seek distance to
42the request in front of the elevator, then the request in back can be chosen.
43Backward seeks are also limited to a maximum of MAXBACK (1024*1024) sectors.
44This favors forward movement of the elevator, while allowing opportunistic
45"short" backward seeks.
46
472. FIFO expiration times for reads and for writes.
48
49This is again very similar to the deadline IO scheduler. The expiration
50times for requests on these lists is tunable using the parameters read_expire
51and write_expire discussed below. When a read or a write expires in this way,
52the IO scheduler will interrupt its current elevator sweep or read anticipation
53to service the expired request.
54
553. Read and write request batching
56
57A batch is a collection of read requests or a collection of write
58requests. The as scheduler alternates dispatching read and write batches
59to the driver. In the case a read batch, the scheduler submits read
60requests to the driver as long as there are read requests to submit, and
61the read batch time limit has not been exceeded (read_batch_expire).
62The read batch time limit begins counting down only when there are
63competing write requests pending.
64
65In the case of a write batch, the scheduler submits write requests to
66the driver as long as there are write requests available, and the
67write batch time limit has not been exceeded (write_batch_expire).
68However, the length of write batches will be gradually shortened
69when read batches frequently exceed their time limit.
70
71When changing between batch types, the scheduler waits for all requests
72from the previous batch to complete before scheduling requests for the
73next batch.
74
75The read and write fifo expiration times described in policy 2 above
76are checked only when in scheduling IO of a batch for the corresponding
77(read/write) type. So for example, the read FIFO timeout values are
78tested only during read batches. Likewise, the write FIFO timeout
79values are tested only during write batches. For this reason,
80it is generally not recommended for the read batch time
81to be longer than the write expiration time, nor for the write batch
82time to exceed the read expiration time (see tunable parameters below).
83
84When the IO scheduler changes from a read to a write batch,
85it begins the elevator from the request that is on the head of the
86write expiration FIFO. Likewise, when changing from a write batch to
87a read batch, scheduler begins the elevator from the first entry
88on the read expiration FIFO.
89
904. Read anticipation.
91
92Read anticipation occurs only when scheduling a read batch.
93This implementation of read anticipation allows only one read request
94to be dispatched to the disk controller at a time. In
95contrast, many write requests may be dispatched to the disk controller
96at a time during a write batch. It is this characteristic that can make
97the anticipatory scheduler perform anomalously with controllers supporting
98TCQ, or with hardware striped RAID devices. Setting the antic_expire
99queue parameter (see below) to zero disables this behavior, and the
100anticipatory scheduler behaves essentially like the deadline scheduler.
101
102When read anticipation is enabled (antic_expire is not zero), reads
103are dispatched to the disk controller one at a time.
104At the end of each read request, the IO scheduler examines its next
105candidate read request from its sorted read list. If that next request
106is from the same process as the request that just completed,
107or if the next request in the queue is "very close" to the
108just completed request, it is dispatched immediately. Otherwise,
109statistics (average think time, average seek distance) on the process
110that submitted the just completed request are examined. If it seems
111likely that that process will submit another request soon, and that
112request is likely to be near the just completed request, then the IO
113scheduler will stop dispatching more read requests for up to (antic_expire)
114milliseconds, hoping that process will submit a new request near the one
115that just completed. If such a request is made, then it is dispatched
116immediately. If the antic_expire wait time expires, then the IO scheduler
117will dispatch the next read request from the sorted read queue.
118
119To decide whether an anticipatory wait is worthwhile, the scheduler
120maintains statistics for each process that can be used to compute
121mean "think time" (the time between read requests), and mean seek
122distance for that process. One observation is that these statistics
123are associated with each process, but those statistics are not associated
124with a specific IO device. So for example, if a process is doing IO
125on several file systems on separate devices, the statistics will be
126a combination of IO behavior from all those devices.
127
128
129Tuning the anticipatory IO scheduler
130------------------------------------
131When using 'as', the anticipatory IO scheduler there are 5 parameters under
132/sys/block/*/queue/iosched/. All are units of milliseconds.
133
134The parameters are:
135* read_expire
136 Controls how long until a read request becomes "expired". It also controls the
137 interval between which expired requests are served, so set to 50, a request
138 might take anywhere < 100ms to be serviced _if_ it is the next on the
139 expired list. Obviously request expiration strategies won't make the disk
140 go faster. The result basically equates to the timeslice a single reader
141 gets in the presence of other IO. 100*((seek time / read_expire) + 1) is
142 very roughly the % streaming read efficiency your disk should get with
143 multiple readers.
144
145* read_batch_expire
146 Controls how much time a batch of reads is given before pending writes are
147 served. A higher value is more efficient. This might be set below read_expire
148 if writes are to be given higher priority than reads, but reads are to be
149 as efficient as possible when there are no writes. Generally though, it
150 should be some multiple of read_expire.
151
152* write_expire, and
153* write_batch_expire are equivalent to the above, for writes.
154
155* antic_expire
156 Controls the maximum amount of time we can anticipate a good read (one
157 with a short seek distance from the most recently completed request) before
158 giving up. Many other factors may cause anticipation to be stopped early,
159 or some processes will not be "anticipated" at all. Should be a bit higher
160 for big seek time devices though not a linear correspondence - most
161 processes have only a few ms thinktime.
162
163In addition to the tunables above there is a read-only file named est_time
164which, when read, will show:
165
166 - The probability of a task exiting without a cooperating task
167 submitting an anticipated IO.
168
169 - The current mean think time.
170
171 - The seek distance used to determine if an incoming IO is better.
172
diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt
index 8d2158a1c6aa..6fab97ea7e6b 100644
--- a/Documentation/block/biodoc.txt
+++ b/Documentation/block/biodoc.txt
@@ -186,7 +186,7 @@ a virtual address mapping (unlike the earlier scheme of virtual address
186do not have a corresponding kernel virtual address space mapping) and 186do not have a corresponding kernel virtual address space mapping) and
187low-memory pages. 187low-memory pages.
188 188
189Note: Please refer to Documentation/DMA-mapping.txt for a discussion 189Note: Please refer to Documentation/PCI/PCI-DMA-mapping.txt for a discussion
190on PCI high mem DMA aspects and mapping of scatter gather lists, and support 190on PCI high mem DMA aspects and mapping of scatter gather lists, and support
191for 64 bit PCI. 191for 64 bit PCI.
192 192
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 4d4a644b505e..a99d7031cdf9 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -315,41 +315,26 @@ A: The following are what is required for CPU hotplug infrastructure to work
315 315
316Q: I need to ensure that a particular cpu is not removed when there is some 316Q: I need to ensure that a particular cpu is not removed when there is some
317 work specific to this cpu is in progress. 317 work specific to this cpu is in progress.
318A: First switch the current thread context to preferred cpu 318A: There are two ways. If your code can be run in interrupt context, use
319 smp_call_function_single(), otherwise use work_on_cpu(). Note that
320 work_on_cpu() is slow, and can fail due to out of memory:
319 321
320 int my_func_on_cpu(int cpu) 322 int my_func_on_cpu(int cpu)
321 { 323 {
322 cpumask_t saved_mask, new_mask = CPU_MASK_NONE; 324 int err;
323 int curr_cpu, err = 0; 325 get_online_cpus();
324 326 if (!cpu_online(cpu))
325 saved_mask = current->cpus_allowed; 327 err = -EINVAL;
326 cpu_set(cpu, new_mask); 328 else
327 err = set_cpus_allowed(current, new_mask); 329#if NEEDS_BLOCKING
328 330 err = work_on_cpu(cpu, __my_func_on_cpu, NULL);
329 if (err) 331#else
330 return err; 332 smp_call_function_single(cpu, __my_func_on_cpu, &err,
331 333 true);
332 /* 334#endif
333 * If we got scheduled out just after the return from 335 put_online_cpus();
334 * set_cpus_allowed() before running the work, this ensures 336 return err;
335 * we stay locked. 337 }
336 */
337 curr_cpu = get_cpu();
338
339 if (curr_cpu != cpu) {
340 err = -EAGAIN;
341 goto ret;
342 } else {
343 /*
344 * Do work : But cant sleep, since get_cpu() disables preempt
345 */
346 }
347 ret:
348 put_cpu();
349 set_cpus_allowed(current, saved_mask);
350 return err;
351 }
352
353 338
354Q: How do we determine how many CPUs are available for hotplug. 339Q: How do we determine how many CPUs are available for hotplug.
355A: There is no clear spec defined way from ACPI that can give us that 340A: There is no clear spec defined way from ACPI that can give us that
diff --git a/Documentation/dontdiff b/Documentation/dontdiff
index e151b2a36267..3ad6acead949 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -103,6 +103,7 @@ gconf
103gen-devlist 103gen-devlist
104gen_crc32table 104gen_crc32table
105gen_init_cpio 105gen_init_cpio
106generated
106genheaders 107genheaders
107genksyms 108genksyms
108*_gray256.c 109*_gray256.c
diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.txt
index 60120fb3b961..d2cd6fb8ba9e 100644
--- a/Documentation/driver-model/driver.txt
+++ b/Documentation/driver-model/driver.txt
@@ -226,5 +226,5 @@ struct driver_attribute driver_attr_debug;
226This can then be used to add and remove the attribute from the 226This can then be used to add and remove the attribute from the
227driver's directory using: 227driver's directory using:
228 228
229int driver_create_file(struct device_driver *, struct driver_attribute *); 229int driver_create_file(struct device_driver *, const struct driver_attribute *);
230void driver_remove_file(struct device_driver *, struct driver_attribute *); 230void driver_remove_file(struct device_driver *, const struct driver_attribute *);
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index af6885c3c821..e1def1786e50 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -196,7 +196,7 @@ nobarrier This also requires an IO stack which can support
196 also be used to enable or disable barriers, for 196 also be used to enable or disable barriers, for
197 consistency with other ext4 mount options. 197 consistency with other ext4 mount options.
198 198
199inode_readahead=n This tuning parameter controls the maximum 199inode_readahead_blks=n This tuning parameter controls the maximum
200 number of inode table blocks that ext4's inode 200 number of inode table blocks that ext4's inode
201 table readahead algorithm will pre-read into 201 table readahead algorithm will pre-read into
202 the buffer cache. The default value is 32 blocks. 202 the buffer cache. The default value is 32 blocks.
diff --git a/Documentation/filesystems/nilfs2.txt b/Documentation/filesystems/nilfs2.txt
index 4949fcaa6b6a..839efd8a8a8c 100644
--- a/Documentation/filesystems/nilfs2.txt
+++ b/Documentation/filesystems/nilfs2.txt
@@ -28,7 +28,7 @@ described in the man pages included in the package.
28Project web page: http://www.nilfs.org/en/ 28Project web page: http://www.nilfs.org/en/
29Download page: http://www.nilfs.org/en/download.html 29Download page: http://www.nilfs.org/en/download.html
30Git tree web page: http://www.nilfs.org/git/ 30Git tree web page: http://www.nilfs.org/git/
31NILFS mailing lists: http://www.nilfs.org/mailman/listinfo/users 31List info: http://vger.kernel.org/vger-lists.html#linux-nilfs
32 32
33Caveats 33Caveats
34======= 34=======
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 220cc6376ef8..0d07513a67a6 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -177,7 +177,6 @@ read the file /proc/PID/status:
177 CapBnd: ffffffffffffffff 177 CapBnd: ffffffffffffffff
178 voluntary_ctxt_switches: 0 178 voluntary_ctxt_switches: 0
179 nonvoluntary_ctxt_switches: 1 179 nonvoluntary_ctxt_switches: 1
180 Stack usage: 12 kB
181 180
182This shows you nearly the same information you would get if you viewed it with 181This shows you nearly the same information you would get if you viewed it with
183the ps command. In fact, ps uses the proc file system to obtain its 182the ps command. In fact, ps uses the proc file system to obtain its
@@ -231,7 +230,6 @@ Table 1-2: Contents of the statm files (as of 2.6.30-rc7)
231 Mems_allowed_list Same as previous, but in "list format" 230 Mems_allowed_list Same as previous, but in "list format"
232 voluntary_ctxt_switches number of voluntary context switches 231 voluntary_ctxt_switches number of voluntary context switches
233 nonvoluntary_ctxt_switches number of non voluntary context switches 232 nonvoluntary_ctxt_switches number of non voluntary context switches
234 Stack usage: stack usage high water mark (round up to page size)
235.............................................................................. 233..............................................................................
236 234
237Table 1-3: Contents of the statm files (as of 2.6.8-rc3) 235Table 1-3: Contents of the statm files (as of 2.6.8-rc3)
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index b245d524d568..931c806642c5 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -91,8 +91,8 @@ struct device_attribute {
91 const char *buf, size_t count); 91 const char *buf, size_t count);
92}; 92};
93 93
94int device_create_file(struct device *, struct device_attribute *); 94int device_create_file(struct device *, const struct device_attribute *);
95void device_remove_file(struct device *, struct device_attribute *); 95void device_remove_file(struct device *, const struct device_attribute *);
96 96
97It also defines this helper for defining device attributes: 97It also defines this helper for defining device attributes:
98 98
@@ -316,8 +316,8 @@ DEVICE_ATTR(_name, _mode, _show, _store);
316 316
317Creation/Removal: 317Creation/Removal:
318 318
319int device_create_file(struct device *device, struct device_attribute * attr); 319int device_create_file(struct device *dev, const struct device_attribute * attr);
320void device_remove_file(struct device * dev, struct device_attribute * attr); 320void device_remove_file(struct device *dev, const struct device_attribute * attr);
321 321
322 322
323- bus drivers (include/linux/device.h) 323- bus drivers (include/linux/device.h)
@@ -358,7 +358,7 @@ DRIVER_ATTR(_name, _mode, _show, _store)
358 358
359Creation/Removal: 359Creation/Removal:
360 360
361int driver_create_file(struct device_driver *, struct driver_attribute *); 361int driver_create_file(struct device_driver *, const struct driver_attribute *);
362void driver_remove_file(struct device_driver *, struct driver_attribute *); 362void driver_remove_file(struct device_driver *, const struct driver_attribute *);
363 363
364 364
diff --git a/Documentation/hwmon/amc6821 b/Documentation/hwmon/amc6821
new file mode 100644
index 000000000000..ced8359c50f8
--- /dev/null
+++ b/Documentation/hwmon/amc6821
@@ -0,0 +1,102 @@
1Kernel driver amc6821
2=====================
3
4Supported chips:
5 Texas Instruments AMC6821
6 Prefix: 'amc6821'
7 Addresses scanned: 0x18, 0x19, 0x1a, 0x2c, 0x2d, 0x2e, 0x4c, 0x4d, 0x4e
8 Datasheet: http://focus.ti.com/docs/prod/folders/print/amc6821.html
9
10Authors:
11 Tomaz Mertelj <tomaz.mertelj@guest.arnes.si>
12
13
14Description
15-----------
16
17This driver implements support for the Texas Instruments amc6821 chip.
18The chip has one on-chip and one remote temperature sensor and one pwm fan
19regulator.
20The pwm can be controlled either from software or automatically.
21
22The driver provides the following sensor accesses in sysfs:
23
24temp1_input ro on-chip temperature
25temp1_min rw "
26temp1_max rw "
27temp1_crit rw "
28temp1_min_alarm ro "
29temp1_max_alarm ro "
30temp1_crit_alarm ro "
31
32temp2_input ro remote temperature
33temp2_min rw "
34temp2_max rw "
35temp2_crit rw "
36temp2_min_alarm ro "
37temp2_max_alarm ro "
38temp2_crit_alarm ro "
39temp2_fault ro "
40
41fan1_input ro tachometer speed
42fan1_min rw "
43fan1_max rw "
44fan1_fault ro "
45fan1_div rw Fan divisor can be either 2 or 4.
46
47pwm1 rw pwm1
48pwm1_enable rw regulator mode, 1=open loop, 2=fan controlled
49 by remote temperature, 3=fan controlled by
50 combination of the on-chip temperature and
51 remote-sensor temperature,
52pwm1_auto_channels_temp ro 1 if pwm_enable==2, 3 if pwm_enable==3
53pwm1_auto_point1_pwm ro Hardwired to 0, shared for both
54 temperature channels.
55pwm1_auto_point2_pwm rw This value is shared for both temperature
56 channels.
57pwm1_auto_point3_pwm rw Hardwired to 255, shared for both
58 temperature channels.
59
60temp1_auto_point1_temp ro Hardwired to temp2_auto_point1_temp
61 which is rw. Below this temperature fan stops.
62temp1_auto_point2_temp rw The low-temperature limit of the proportional
63 range. Below this temperature
64 pwm1 = pwm1_auto_point2_pwm. It can go from
65 0 degree C to 124 degree C in steps of
66 4 degree C. Read it out after writing to get
67 the actual value.
68temp1_auto_point3_temp rw Above this temperature fan runs at maximum
69 speed. It can go from temp1_auto_point2_temp.
70 It can only have certain discrete values
71 which depend on temp1_auto_point2_temp and
72 pwm1_auto_point2_pwm. Read it out after
73 writing to get the actual value.
74
75temp2_auto_point1_temp rw Must be between 0 degree C and 63 degree C and
76 it defines the passive cooling temperature.
77 Below this temperature the fan stops in
78 the closed loop mode.
79temp2_auto_point2_temp rw The low-temperature limit of the proportional
80 range. Below this temperature
81 pwm1 = pwm1_auto_point2_pwm. It can go from
82 0 degree C to 124 degree C in steps
83 of 4 degree C.
84
85temp2_auto_point3_temp rw Above this temperature fan runs at maximum
86 speed. It can only have certain discrete
87 values which depend on temp2_auto_point2_temp
88 and pwm1_auto_point2_pwm. Read it out after
89 writing to get actual value.
90
91
92Module parameters
93-----------------
94
95If your board has a BIOS that initializes the amc6821 correctly, you should
96load the module with: init=0.
97
98If your board BIOS doesn't initialize the chip, or you want
99different settings, you can set the following parameters:
100init=1,
101pwminv: 0 default pwm output, 1 inverts pwm output.
102
diff --git a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp
new file mode 100644
index 000000000000..6526eee525a6
--- /dev/null
+++ b/Documentation/hwmon/k10temp
@@ -0,0 +1,65 @@
1Kernel driver k10temp
2=====================
3
4Supported chips:
5* AMD Family 10h processors:
6 Socket F: Quad-Core/Six-Core/Embedded Opteron (but see below)
7 Socket AM2+: Quad-Core Opteron, Phenom (II) X3/X4, Athlon X2 (but see below)
8 Socket AM3: Quad-Core Opteron, Athlon/Phenom II X2/X3/X4, Sempron II
9 Socket S1G3: Athlon II, Sempron, Turion II
10* AMD Family 11h processors:
11 Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra)
12
13 Prefix: 'k10temp'
14 Addresses scanned: PCI space
15 Datasheets:
16 BIOS and Kernel Developer's Guide (BKDG) For AMD Family 10h Processors:
17 http://support.amd.com/us/Processor_TechDocs/31116.pdf
18 BIOS and Kernel Developer's Guide (BKDG) for AMD Family 11h Processors:
19 http://support.amd.com/us/Processor_TechDocs/41256.pdf
20 Revision Guide for AMD Family 10h Processors:
21 http://support.amd.com/us/Processor_TechDocs/41322.pdf
22 Revision Guide for AMD Family 11h Processors:
23 http://support.amd.com/us/Processor_TechDocs/41788.pdf
24 AMD Family 11h Processor Power and Thermal Data Sheet for Notebooks:
25 http://support.amd.com/us/Processor_TechDocs/43373.pdf
26 AMD Family 10h Server and Workstation Processor Power and Thermal Data Sheet:
27 http://support.amd.com/us/Processor_TechDocs/43374.pdf
28 AMD Family 10h Desktop Processor Power and Thermal Data Sheet:
29 http://support.amd.com/us/Processor_TechDocs/43375.pdf
30
31Author: Clemens Ladisch <clemens@ladisch.de>
32
33Description
34-----------
35
36This driver permits reading of the internal temperature sensor of AMD
37Family 10h and 11h processors.
38
39All these processors have a sensor, but on those for Socket F or AM2+,
40the sensor may return inconsistent values (erratum 319). The driver
41will refuse to load on these revisions unless you specify the "force=1"
42module parameter.
43
44Due to technical reasons, the driver can detect only the mainboard's
45socket type, not the processor's actual capabilities. Therefore, if you
46are using an AM3 processor on an AM2+ mainboard, you can safely use the
47"force=1" parameter.
48
49There is one temperature measurement value, available as temp1_input in
50sysfs. It is measured in degrees Celsius with a resolution of 1/8th degree.
51Please note that it is defined as a relative value; to quote the AMD manual:
52
53 Tctl is the processor temperature control value, used by the platform to
54 control cooling systems. Tctl is a non-physical temperature on an
55 arbitrary scale measured in degrees. It does _not_ represent an actual
56 physical temperature like die or case temperature. Instead, it specifies
57 the processor temperature relative to the point at which the system must
58 supply the maximum cooling for the processor's specified maximum case
59 temperature and maximum thermal power dissipation.
60
61The maximum value for Tctl is available in the file temp1_max.
62
63If the BIOS has enabled hardware temperature control, the threshold at
64which the processor will throttle itself to avoid damage is available in
65temp1_crit and temp1_crit_hyst.
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 947374977ca5..35cf64d4436d 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -56,10 +56,11 @@ Following this convention is good because:
56(5) When following the convention, the driver code can use generic 56(5) When following the convention, the driver code can use generic
57 code to copy the parameters between user and kernel space. 57 code to copy the parameters between user and kernel space.
58 58
59This table lists ioctls visible from user land for Linux/i386. It contains 59This table lists ioctls visible from user land for Linux/x86. It contains
60most drivers up to 2.3.14, but I know I am missing some. 60most drivers up to 2.6.31, but I know I am missing some. There has been
61no attempt to list non-X86 architectures or ioctls from drivers/staging/.
61 62
62Code Seq# Include File Comments 63Code Seq#(hex) Include File Comments
63======================================================== 64========================================================
640x00 00-1F linux/fs.h conflict! 650x00 00-1F linux/fs.h conflict!
650x00 00-1F scsi/scsi_ioctl.h conflict! 660x00 00-1F scsi/scsi_ioctl.h conflict!
@@ -69,119 +70,228 @@ Code Seq# Include File Comments
690x03 all linux/hdreg.h 700x03 all linux/hdreg.h
700x04 D2-DC linux/umsdos_fs.h Dead since 2.6.11, but don't reuse these. 710x04 D2-DC linux/umsdos_fs.h Dead since 2.6.11, but don't reuse these.
710x06 all linux/lp.h 720x06 all linux/lp.h
720x09 all linux/md.h 730x09 all linux/raid/md_u.h
740x10 00-0F drivers/char/s390/vmcp.h
730x12 all linux/fs.h 750x12 all linux/fs.h
74 linux/blkpg.h 76 linux/blkpg.h
750x1b all InfiniBand Subsystem <http://www.openib.org/> 770x1b all InfiniBand Subsystem <http://www.openib.org/>
760x20 all drivers/cdrom/cm206.h 780x20 all drivers/cdrom/cm206.h
770x22 all scsi/sg.h 790x22 all scsi/sg.h
78'#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem 80'#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem
81'$' 00-0F linux/perf_counter.h, linux/perf_event.h
79'1' 00-1F <linux/timepps.h> PPS kit from Ulrich Windl 82'1' 00-1F <linux/timepps.h> PPS kit from Ulrich Windl
80 <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/> 83 <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/>
84'2' 01-04 linux/i2o.h
85'3' 00-0F drivers/s390/char/raw3270.h conflict!
86'3' 00-1F linux/suspend_ioctls.h conflict!
87 and kernel/power/user.c
81'8' all SNP8023 advanced NIC card 88'8' all SNP8023 advanced NIC card
82 <mailto:mcr@solidum.com> 89 <mailto:mcr@solidum.com>
83'A' 00-1F linux/apm_bios.h 90'@' 00-0F linux/radeonfb.h conflict!
91'@' 00-0F drivers/video/aty/aty128fb.c conflict!
92'A' 00-1F linux/apm_bios.h conflict!
93'A' 00-0F linux/agpgart.h conflict!
94 and drivers/char/agp/compat_ioctl.h
95'A' 00-7F sound/asound.h conflict!
96'B' 00-1F linux/cciss_ioctl.h conflict!
97'B' 00-0F include/linux/pmu.h conflict!
84'B' C0-FF advanced bbus 98'B' C0-FF advanced bbus
85 <mailto:maassen@uni-freiburg.de> 99 <mailto:maassen@uni-freiburg.de>
86'C' all linux/soundcard.h 100'C' all linux/soundcard.h conflict!
101'C' 01-2F linux/capi.h conflict!
102'C' F0-FF drivers/net/wan/cosa.h conflict!
87'D' all arch/s390/include/asm/dasd.h 103'D' all arch/s390/include/asm/dasd.h
88'E' all linux/input.h 104'D' 40-5F drivers/scsi/dpt/dtpi_ioctl.h
89'F' all linux/fb.h 105'D' 05 drivers/scsi/pmcraid.h
90'H' all linux/hiddev.h 106'E' all linux/input.h conflict!
91'I' all linux/isdn.h 107'E' 00-0F xen/evtchn.h conflict!
108'F' all linux/fb.h conflict!
109'F' 01-02 drivers/scsi/pmcraid.h conflict!
110'F' 20 drivers/video/fsl-diu-fb.h conflict!
111'F' 20 drivers/video/intelfb/intelfb.h conflict!
112'F' 20 linux/ivtvfb.h conflict!
113'F' 20 linux/matroxfb.h conflict!
114'F' 20 drivers/video/aty/atyfb_base.c conflict!
115'F' 00-0F video/da8xx-fb.h conflict!
116'F' 80-8F linux/arcfb.h conflict!
117'F' DD video/sstfb.h conflict!
118'G' 00-3F drivers/misc/sgi-gru/grulib.h conflict!
119'G' 00-0F linux/gigaset_dev.h conflict!
120'H' 00-7F linux/hiddev.h conflict!
121'H' 00-0F linux/hidraw.h conflict!
122'H' 00-0F sound/asound.h conflict!
123'H' 20-40 sound/asound_fm.h conflict!
124'H' 80-8F sound/sfnt_info.h conflict!
125'H' 10-8F sound/emu10k1.h conflict!
126'H' 10-1F sound/sb16_csp.h conflict!
127'H' 10-1F sound/hda_hwdep.h conflict!
128'H' 40-4F sound/hdspm.h conflict!
129'H' 40-4F sound/hdsp.h conflict!
130'H' 90 sound/usb/usx2y/usb_stream.h
131'H' C0-F0 net/bluetooth/hci.h conflict!
132'H' C0-DF net/bluetooth/hidp/hidp.h conflict!
133'H' C0-DF net/bluetooth/cmtp/cmtp.h conflict!
134'H' C0-DF net/bluetooth/bnep/bnep.h conflict!
135'I' all linux/isdn.h conflict!
136'I' 00-0F drivers/isdn/divert/isdn_divert.h conflict!
137'I' 40-4F linux/mISDNif.h conflict!
92'J' 00-1F drivers/scsi/gdth_ioctl.h 138'J' 00-1F drivers/scsi/gdth_ioctl.h
93'K' all linux/kd.h 139'K' all linux/kd.h
94'L' 00-1F linux/loop.h 140'L' 00-1F linux/loop.h conflict!
95'L' 20-2F driver/usb/misc/vstusb.h 141'L' 10-1F drivers/scsi/mpt2sas/mpt2sas_ctl.h conflict!
142'L' 20-2F linux/usb/vstusb.h
96'L' E0-FF linux/ppdd.h encrypted disk device driver 143'L' E0-FF linux/ppdd.h encrypted disk device driver
97 <http://linux01.gwdg.de/~alatham/ppdd.html> 144 <http://linux01.gwdg.de/~alatham/ppdd.html>
98'M' all linux/soundcard.h 145'M' all linux/soundcard.h conflict!
146'M' 01-16 mtd/mtd-abi.h conflict!
147 and drivers/mtd/mtdchar.c
148'M' 01-03 drivers/scsi/megaraid/megaraid_sas.h
149'M' 00-0F drivers/video/fsl-diu-fb.h conflict!
99'N' 00-1F drivers/usb/scanner.h 150'N' 00-1F drivers/usb/scanner.h
100'O' 00-02 include/mtd/ubi-user.h UBI 151'O' 00-06 mtd/ubi-user.h UBI
101'P' all linux/soundcard.h 152'P' all linux/soundcard.h conflict!
153'P' 60-6F sound/sscape_ioctl.h conflict!
154'P' 00-0F drivers/usb/class/usblp.c conflict!
102'Q' all linux/soundcard.h 155'Q' all linux/soundcard.h
103'R' 00-1F linux/random.h 156'R' 00-1F linux/random.h conflict!
157'R' 01 linux/rfkill.h conflict!
158'R' 01-0F media/rds.h conflict!
159'R' C0-DF net/bluetooth/rfcomm.h
104'S' all linux/cdrom.h conflict! 160'S' all linux/cdrom.h conflict!
105'S' 80-81 scsi/scsi_ioctl.h conflict! 161'S' 80-81 scsi/scsi_ioctl.h conflict!
106'S' 82-FF scsi/scsi.h conflict! 162'S' 82-FF scsi/scsi.h conflict!
163'S' 00-7F sound/asequencer.h conflict!
107'T' all linux/soundcard.h conflict! 164'T' all linux/soundcard.h conflict!
165'T' 00-AF sound/asound.h conflict!
108'T' all arch/x86/include/asm/ioctls.h conflict! 166'T' all arch/x86/include/asm/ioctls.h conflict!
109'U' 00-EF linux/drivers/usb/usb.h 167'T' C0-DF linux/if_tun.h conflict!
110'V' all linux/vt.h 168'U' all sound/asound.h conflict!
169'U' 00-0F drivers/media/video/uvc/uvcvideo.h conflict!
170'U' 00-CF linux/uinput.h conflict!
171'U' 00-EF linux/usbdevice_fs.h
172'U' C0-CF drivers/bluetooth/hci_uart.h
173'V' all linux/vt.h conflict!
174'V' all linux/videodev2.h conflict!
175'V' C0 linux/ivtvfb.h conflict!
176'V' C0 linux/ivtv.h conflict!
177'V' C0 media/davinci/vpfe_capture.h conflict!
178'V' C0 media/si4713.h conflict!
179'V' C0-CF drivers/media/video/mxb.h conflict!
111'W' 00-1F linux/watchdog.h conflict! 180'W' 00-1F linux/watchdog.h conflict!
112'W' 00-1F linux/wanrouter.h conflict! 181'W' 00-1F linux/wanrouter.h conflict!
113'X' all linux/xfs_fs.h 182'W' 00-3F sound/asound.h conflict!
183'X' all fs/xfs/xfs_fs.h conflict!
184 and fs/xfs/linux-2.6/xfs_ioctl32.h
185 and include/linux/falloc.h
186 and linux/fs.h
187'X' all fs/ocfs2/ocfs_fs.h conflict!
188'X' 01 linux/pktcdvd.h conflict!
114'Y' all linux/cyclades.h 189'Y' all linux/cyclades.h
115'[' 00-07 linux/usb/usbtmc.h USB Test and Measurement Devices 190'Z' 14-15 drivers/message/fusion/mptctl.h
191'[' 00-07 linux/usb/tmc.h USB Test and Measurement Devices
116 <mailto:gregkh@suse.de> 192 <mailto:gregkh@suse.de>
117'a' all ATM on linux 193'a' all linux/atm*.h, linux/sonet.h ATM on linux
118 <http://lrcwww.epfl.ch/linux-atm/magic.html> 194 <http://lrcwww.epfl.ch/linux-atm/magic.html>
119'b' 00-FF bit3 vme host bridge 195'b' 00-FF conflict! bit3 vme host bridge
120 <mailto:natalia@nikhefk.nikhef.nl> 196 <mailto:natalia@nikhefk.nikhef.nl>
197'b' 00-0F media/bt819.h conflict!
198'c' all linux/cm4000_cs.h conflict!
121'c' 00-7F linux/comstats.h conflict! 199'c' 00-7F linux/comstats.h conflict!
122'c' 00-7F linux/coda.h conflict! 200'c' 00-7F linux/coda.h conflict!
123'c' 80-9F arch/s390/include/asm/chsc.h 201'c' 00-1F linux/chio.h conflict!
124'c' A0-AF arch/x86/include/asm/msr.h 202'c' 80-9F arch/s390/include/asm/chsc.h conflict!
203'c' A0-AF arch/x86/include/asm/msr.h conflict!
125'd' 00-FF linux/char/drm/drm/h conflict! 204'd' 00-FF linux/char/drm/drm/h conflict!
205'd' 02-40 pcmcia/ds.h conflict!
206'd' 10-3F drivers/media/video/dabusb.h conflict!
207'd' C0-CF drivers/media/video/saa7191.h conflict!
126'd' F0-FF linux/digi1.h 208'd' F0-FF linux/digi1.h
127'e' all linux/digi1.h conflict! 209'e' all linux/digi1.h conflict!
128'e' 00-1F net/irda/irtty.h conflict! 210'e' 00-1F drivers/net/irda/irtty-sir.h conflict!
129'f' 00-1F linux/ext2_fs.h 211'f' 00-1F linux/ext2_fs.h conflict!
130'h' 00-7F Charon filesystem 212'f' 00-1F linux/ext3_fs.h conflict!
213'f' 00-0F fs/jfs/jfs_dinode.h conflict!
214'f' 00-0F fs/ext4/ext4.h conflict!
215'f' 00-0F linux/fs.h conflict!
216'f' 00-0F fs/ocfs2/ocfs2_fs.h conflict!
217'g' 00-0F linux/usb/gadgetfs.h
218'g' 20-2F linux/usb/g_printer.h
219'h' 00-7F conflict! Charon filesystem
131 <mailto:zapman@interlan.net> 220 <mailto:zapman@interlan.net>
132'i' 00-3F linux/i2o.h 221'h' 00-1F linux/hpet.h conflict!
222'i' 00-3F linux/i2o-dev.h conflict!
223'i' 0B-1F linux/ipmi.h conflict!
224'i' 80-8F linux/i8k.h
133'j' 00-3F linux/joystick.h 225'j' 00-3F linux/joystick.h
226'k' 00-0F linux/spi/spidev.h conflict!
227'k' 00-05 video/kyro.h conflict!
134'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system 228'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system
135 <http://mikonos.dia.unisa.it/tcfs> 229 <http://mikonos.dia.unisa.it/tcfs>
136'l' 40-7F linux/udf_fs_i.h in development: 230'l' 40-7F linux/udf_fs_i.h in development:
137 <http://sourceforge.net/projects/linux-udf/> 231 <http://sourceforge.net/projects/linux-udf/>
138'm' 00-09 linux/mmtimer.h 232'm' 00-09 linux/mmtimer.h conflict!
139'm' all linux/mtio.h conflict! 233'm' all linux/mtio.h conflict!
140'm' all linux/soundcard.h conflict! 234'm' all linux/soundcard.h conflict!
141'm' all linux/synclink.h conflict! 235'm' all linux/synclink.h conflict!
236'm' 00-19 drivers/message/fusion/mptctl.h conflict!
237'm' 00 drivers/scsi/megaraid/megaraid_ioctl.h conflict!
142'm' 00-1F net/irda/irmod.h conflict! 238'm' 00-1F net/irda/irmod.h conflict!
143'n' 00-7F linux/ncp_fs.h 239'n' 00-7F linux/ncp_fs.h and fs/ncpfs/ioctl.c
144'n' 80-8F linux/nilfs2_fs.h NILFS2 240'n' 80-8F linux/nilfs2_fs.h NILFS2
145'n' E0-FF video/matrox.h matroxfb 241'n' E0-FF linux/matroxfb.h matroxfb
146'o' 00-1F fs/ocfs2/ocfs2_fs.h OCFS2 242'o' 00-1F fs/ocfs2/ocfs2_fs.h OCFS2
147'o' 00-03 include/mtd/ubi-user.h conflict! (OCFS2 and UBI overlaps) 243'o' 00-03 mtd/ubi-user.h conflict! (OCFS2 and UBI overlaps)
148'o' 40-41 include/mtd/ubi-user.h UBI 244'o' 40-41 mtd/ubi-user.h UBI
149'o' 01-A1 include/linux/dvb/*.h DVB 245'o' 01-A1 linux/dvb/*.h DVB
150'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this) 246'p' 00-0F linux/phantom.h conflict! (OpenHaptics needs this)
247'p' 00-1F linux/rtc.h conflict!
151'p' 00-3F linux/mc146818rtc.h conflict! 248'p' 00-3F linux/mc146818rtc.h conflict!
152'p' 40-7F linux/nvram.h 249'p' 40-7F linux/nvram.h
153'p' 80-9F user-space parport 250'p' 80-9F linux/ppdev.h user-space parport
154 <mailto:tim@cyberelk.net> 251 <mailto:tim@cyberelk.net>
155'p' a1-a4 linux/pps.h LinuxPPS 252'p' A1-A4 linux/pps.h LinuxPPS
156 <mailto:giometti@linux.it> 253 <mailto:giometti@linux.it>
157'q' 00-1F linux/serio.h 254'q' 00-1F linux/serio.h
158'q' 80-FF Internet PhoneJACK, Internet LineJACK 255'q' 80-FF linux/telephony.h Internet PhoneJACK, Internet LineJACK
159 <http://www.quicknet.net> 256 linux/ixjuser.h <http://www.quicknet.net>
160'r' 00-1F linux/msdos_fs.h 257'r' 00-1F linux/msdos_fs.h and fs/fat/dir.c
161's' all linux/cdk.h 258's' all linux/cdk.h
162't' 00-7F linux/if_ppp.h 259't' 00-7F linux/if_ppp.h
163't' 80-8F linux/isdn_ppp.h 260't' 80-8F linux/isdn_ppp.h
261't' 90 linux/toshiba.h
164'u' 00-1F linux/smb_fs.h 262'u' 00-1F linux/smb_fs.h
165'v' 00-1F linux/ext2_fs.h conflict!
166'v' all linux/videodev.h conflict! 263'v' all linux/videodev.h conflict!
264'v' 00-1F linux/ext2_fs.h conflict!
265'v' 00-1F linux/fs.h conflict!
266'v' 00-0F linux/sonypi.h conflict!
267'v' C0-CF drivers/media/video/ov511.h conflict!
268'v' C0-DF media/pwc-ioctl.h conflict!
269'v' C0-FF linux/meye.h conflict!
270'v' C0-CF drivers/media/video/zoran/zoran.h conflict!
271'v' D0-DF drivers/media/video/cpia2/cpia2dev.h conflict!
167'w' all CERN SCI driver 272'w' all CERN SCI driver
168'y' 00-1F packet based user level communications 273'y' 00-1F packet based user level communications
169 <mailto:zapman@interlan.net> 274 <mailto:zapman@interlan.net>
170'z' 00-3F CAN bus card 275'z' 00-3F CAN bus card conflict!
171 <mailto:hdstich@connectu.ulm.circular.de> 276 <mailto:hdstich@connectu.ulm.circular.de>
172'z' 40-7F CAN bus card 277'z' 40-7F CAN bus card conflict!
173 <mailto:oe@port.de> 278 <mailto:oe@port.de>
279'z' 10-4F drivers/s390/crypto/zcrypt_api.h conflict!
1740x80 00-1F linux/fb.h 2800x80 00-1F linux/fb.h
1750x81 00-1F linux/videotext.h 2810x81 00-1F linux/videotext.h
2820x88 00-3F media/ovcamchip.h
1760x89 00-06 arch/x86/include/asm/sockios.h 2830x89 00-06 arch/x86/include/asm/sockios.h
1770x89 0B-DF linux/sockios.h 2840x89 0B-DF linux/sockios.h
1780x89 E0-EF linux/sockios.h SIOCPROTOPRIVATE range 2850x89 E0-EF linux/sockios.h SIOCPROTOPRIVATE range
2860x89 E0-EF linux/dn.h PROTOPRIVATE range
1790x89 F0-FF linux/sockios.h SIOCDEVPRIVATE range 2870x89 F0-FF linux/sockios.h SIOCDEVPRIVATE range
1800x8B all linux/wireless.h 2880x8B all linux/wireless.h
1810x8C 00-3F WiNRADiO driver 2890x8C 00-3F WiNRADiO driver
182 <http://www.proximity.com.au/~brian/winradio/> 290 <http://www.proximity.com.au/~brian/winradio/>
1830x90 00 drivers/cdrom/sbpcd.h 2910x90 00 drivers/cdrom/sbpcd.h
2920x92 00-0F drivers/usb/mon/mon_bin.c
1840x93 60-7F linux/auto_fs.h 2930x93 60-7F linux/auto_fs.h
2940x94 all fs/btrfs/ioctl.h
1850x99 00-0F 537-Addinboard driver 2950x99 00-0F 537-Addinboard driver
186 <mailto:buk@buks.ipn.de> 296 <mailto:buk@buks.ipn.de>
1870xA0 all linux/sdp/sdp.h Industrial Device Project 2970xA0 all linux/sdp/sdp.h Industrial Device Project
@@ -192,17 +302,22 @@ Code Seq# Include File Comments
1920xAB 00-1F linux/nbd.h 3020xAB 00-1F linux/nbd.h
1930xAC 00-1F linux/raw.h 3030xAC 00-1F linux/raw.h
1940xAD 00 Netfilter device in development: 3040xAD 00 Netfilter device in development:
195 <mailto:rusty@rustcorp.com.au> 305 <mailto:rusty@rustcorp.com.au>
1960xAE all linux/kvm.h Kernel-based Virtual Machine 3060xAE all linux/kvm.h Kernel-based Virtual Machine
197 <mailto:kvm@vger.kernel.org> 307 <mailto:kvm@vger.kernel.org>
1980xB0 all RATIO devices in development: 3080xB0 all RATIO devices in development:
199 <mailto:vgo@ratio.de> 309 <mailto:vgo@ratio.de>
2000xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca> 3100xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca>
3110xC0 00-0F linux/usb/iowarrior.h
2010xCB 00-1F CBM serial IEC bus in development: 3120xCB 00-1F CBM serial IEC bus in development:
202 <mailto:michael.klein@puffin.lb.shuttle.de> 313 <mailto:michael.klein@puffin.lb.shuttle.de>
3140xCD 01 linux/reiserfs_fs.h
3150xCF 02 fs/cifs/ioctl.c
3160xDB 00-0F drivers/char/mwave/mwavepub.h
2030xDD 00-3F ZFCP device driver see drivers/s390/scsi/ 3170xDD 00-3F ZFCP device driver see drivers/s390/scsi/
204 <mailto:aherrman@de.ibm.com> 318 <mailto:aherrman@de.ibm.com>
2050xF3 00-3F video/sisfb.h sisfb (in development) 3190xF3 00-3F drivers/usb/misc/sisusbvga/sisusb.h sisfb (in development)
206 <mailto:thomas@winischhofer.net> 320 <mailto:thomas@winischhofer.net>
2070xF4 00-1F video/mbxfb.h mbxfb 3210xF4 00-1F video/mbxfb.h mbxfb
208 <mailto:raph@8d.com> 322 <mailto:raph@8d.com>
3230xFD all linux/dm-ioctl.h
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index bb3bf38f03da..6f8c1cabbc5d 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -1,3 +1,17 @@
1Output files
2
3modules.order
4--------------------------------------------------
5This file records the order in which modules appear in Makefiles. This
6is used by modprobe to deterministically resolve aliases that match
7multiple modules.
8
9modules.builtin
10--------------------------------------------------
11This file lists all modules that are built into the kernel. This is used
12by modprobe to not fail when trying to load something builtin.
13
14
1Environment variables 15Environment variables
2 16
3KCPPFLAGS 17KCPPFLAGS
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt
index 849b5e56d06f..49efae703979 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.txt
@@ -103,10 +103,16 @@ KCONFIG_AUTOCONFIG
103This environment variable can be set to specify the path & name of the 103This environment variable can be set to specify the path & name of the
104"auto.conf" file. Its default value is "include/config/auto.conf". 104"auto.conf" file. Its default value is "include/config/auto.conf".
105 105
106KCONFIG_TRISTATE
107--------------------------------------------------
108This environment variable can be set to specify the path & name of the
109"tristate.conf" file. Its default value is "include/config/tristate.conf".
110
106KCONFIG_AUTOHEADER 111KCONFIG_AUTOHEADER
107-------------------------------------------------- 112--------------------------------------------------
108This environment variable can be set to specify the path & name of the 113This environment variable can be set to specify the path & name of the
109"autoconf.h" (header) file. Its default value is "include/linux/autoconf.h". 114"autoconf.h" (header) file.
115Its default value is "include/generated/autoconf.h".
110 116
111 117
112====================================================================== 118======================================================================
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
index 348b9e5e28fc..27a52b35d55b 100644
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ b/Documentation/kernel-doc-nano-HOWTO.txt
@@ -214,11 +214,13 @@ The format of the block comment is like this:
214 * (section header: (section description)? )* 214 * (section header: (section description)? )*
215(*)?*/ 215(*)?*/
216 216
217The short function description ***cannot be multiline***, but the other 217All "description" text can span multiple lines, although the
218descriptions can be (and they can contain blank lines). If you continue 218function_name & its short description are traditionally on a single line.
219that initial short description onto a second line, that second line will 219Description text may also contain blank lines (i.e., lines that contain
220appear further down at the beginning of the description section, which is 220only a "*").
221almost certainly not what you had in mind. 221
222"section header:" names must be unique per function (or struct,
223union, typedef, enum).
222 224
223Avoid putting a spurious blank line after the function name, or else the 225Avoid putting a spurious blank line after the function name, or else the
224description will be repeated! 226description will be repeated!
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 5ba4d9dff113..736d45602886 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -240,7 +240,7 @@ and is between 256 and 4096 characters. It is defined in the file
240 240
241 acpi_sleep= [HW,ACPI] Sleep options 241 acpi_sleep= [HW,ACPI] Sleep options
242 Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, 242 Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
243 old_ordering, s4_nonvs } 243 old_ordering, s4_nonvs, sci_force_enable }
244 See Documentation/power/video.txt for information on 244 See Documentation/power/video.txt for information on
245 s3_bios and s3_mode. 245 s3_bios and s3_mode.
246 s3_beep is for debugging; it makes the PC's speaker beep 246 s3_beep is for debugging; it makes the PC's speaker beep
@@ -253,6 +253,9 @@ and is between 256 and 4096 characters. It is defined in the file
253 of _PTS is used by default). 253 of _PTS is used by default).
254 s4_nonvs prevents the kernel from saving/restoring the 254 s4_nonvs prevents the kernel from saving/restoring the
255 ACPI NVS memory during hibernation. 255 ACPI NVS memory during hibernation.
256 sci_force_enable causes the kernel to set SCI_EN directly
257 on resume from S1/S3 (which is against the ACPI spec,
258 but some broken systems don't work without it).
256 259
257 acpi_use_timer_override [HW,ACPI] 260 acpi_use_timer_override [HW,ACPI]
258 Use timer override. For some broken Nvidia NF5 boards 261 Use timer override. For some broken Nvidia NF5 boards
diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt
index e1a114161027..2811e452f756 100644
--- a/Documentation/kvm/api.txt
+++ b/Documentation/kvm/api.txt
@@ -685,7 +685,7 @@ struct kvm_vcpu_events {
685 __u8 pad; 685 __u8 pad;
686 } nmi; 686 } nmi;
687 __u32 sipi_vector; 687 __u32 sipi_vector;
688 __u32 flags; /* must be zero */ 688 __u32 flags;
689}; 689};
690 690
6914.30 KVM_SET_VCPU_EVENTS 6914.30 KVM_SET_VCPU_EVENTS
@@ -701,6 +701,14 @@ vcpu.
701 701
702See KVM_GET_VCPU_EVENTS for the data structure. 702See KVM_GET_VCPU_EVENTS for the data structure.
703 703
704Fields that may be modified asynchronously by running VCPUs can be excluded
705from the update. These fields are nmi.pending and sipi_vector. Keep the
706corresponding bits in the flags field cleared to suppress overwriting the
707current in-kernel state. The bits are:
708
709KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel
710KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector
711
704 712
7055. The kvm_run structure 7135. The kvm_run structure
706 714
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index 169091f75e6d..75afa1229fd7 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -1092,8 +1092,8 @@ WARNING:
1092 its level up and down at every change. 1092 its level up and down at every change.
1093 1093
1094 1094
1095Volume control 1095Volume control (Console Audio control)
1096-------------- 1096--------------------------------------
1097 1097
1098procfs: /proc/acpi/ibm/volume 1098procfs: /proc/acpi/ibm/volume
1099ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC" 1099ALSA: "ThinkPad Console Audio Control", default ID: "ThinkPadEC"
@@ -1110,9 +1110,53 @@ the desktop environment to just provide on-screen-display feedback.
1110Software volume control should be done only in the main AC97/HDA 1110Software volume control should be done only in the main AC97/HDA
1111mixer. 1111mixer.
1112 1112
1113This feature allows volume control on ThinkPad models with a digital 1113
1114volume knob (when available, not all models have it), as well as 1114About the ThinkPad Console Audio control:
1115mute/unmute control. The available commands are: 1115
1116ThinkPads have a built-in amplifier and muting circuit that drives the
1117console headphone and speakers. This circuit is after the main AC97
1118or HDA mixer in the audio path, and under exclusive control of the
1119firmware.
1120
1121ThinkPads have three special hotkeys to interact with the console
1122audio control: volume up, volume down and mute.
1123
1124It is worth noting that the normal way the mute function works (on
1125ThinkPads that do not have a "mute LED") is:
1126
11271. Press mute to mute. It will *always* mute, you can press it as
1128 many times as you want, and the sound will remain mute.
1129
11302. Press either volume key to unmute the ThinkPad (it will _not_
1131 change the volume, it will just unmute).
1132
1133This is a very superior design when compared to the cheap software-only
1134mute-toggle solution found on normal consumer laptops: you can be
1135absolutely sure the ThinkPad will not make noise if you press the mute
1136button, no matter the previous state.
1137
1138The IBM ThinkPads, and the earlier Lenovo ThinkPads have variable-gain
1139amplifiers driving the speakers and headphone output, and the firmware
1140also handles volume control for the headphone and speakers on these
1141ThinkPads without any help from the operating system (this volume
1142control stage exists after the main AC97 or HDA mixer in the audio
1143path).
1144
1145The newer Lenovo models only have firmware mute control, and depend on
1146the main HDA mixer to do volume control (which is done by the operating
1147system). In this case, the volume keys are filtered out for unmute
1148key press (there are some firmware bugs in this area) and delivered as
1149normal key presses to the operating system (thinkpad-acpi is not
1150involved).
1151
1152
1153The ThinkPad-ACPI volume control:
1154
1155The preferred way to interact with the Console Audio control is the
1156ALSA interface.
1157
1158The legacy procfs interface allows one to read the current state,
1159and if volume control is enabled, accepts the following commands:
1116 1160
1117 echo up >/proc/acpi/ibm/volume 1161 echo up >/proc/acpi/ibm/volume
1118 echo down >/proc/acpi/ibm/volume 1162 echo down >/proc/acpi/ibm/volume
@@ -1121,12 +1165,10 @@ mute/unmute control. The available commands are:
1121 echo 'level <level>' >/proc/acpi/ibm/volume 1165 echo 'level <level>' >/proc/acpi/ibm/volume
1122 1166
1123The <level> number range is 0 to 14 although not all of them may be 1167The <level> number range is 0 to 14 although not all of them may be
1124distinct. The unmute the volume after the mute command, use either the 1168distinct. To unmute the volume after the mute command, use either the
1125up or down command (the level command will not unmute the volume), or 1169up or down command (the level command will not unmute the volume), or
1126the unmute command. 1170the unmute command.
1127 1171
1128The current volume level and mute state is shown in the file.
1129
1130You can use the volume_capabilities parameter to tell the driver 1172You can use the volume_capabilities parameter to tell the driver
1131whether your thinkpad has volume control or mute-only control: 1173whether your thinkpad has volume control or mute-only control:
1132volume_capabilities=1 for mixers with mute and volume control, 1174volume_capabilities=1 for mixers with mute and volume control,
diff --git a/Documentation/networking/3c509.txt b/Documentation/networking/3c509.txt
index 0643e3b7168c..3c45d5dcd63b 100644
--- a/Documentation/networking/3c509.txt
+++ b/Documentation/networking/3c509.txt
@@ -48,11 +48,11 @@ for LILO parameters for doing this:
48This configures the first found 3c509 card for IRQ 10, base I/O 0x310, and 48This configures the first found 3c509 card for IRQ 10, base I/O 0x310, and
49transceiver type 3 (10base2). The flag "0x3c509" must be set to avoid conflicts 49transceiver type 3 (10base2). The flag "0x3c509" must be set to avoid conflicts
50with other card types when overriding the I/O address. When the driver is 50with other card types when overriding the I/O address. When the driver is
51loaded as a module, only the IRQ and transceiver setting may be overridden. 51loaded as a module, only the IRQ may be overridden. For example,
52For example, setting two cards to 10base2/IRQ10 and AUI/IRQ11 is done by using 52setting two cards to IRQ10 and IRQ11 is done by using the irq module
53the xcvr and irq module options: 53option:
54 54
55 options 3c509 xcvr=3,1 irq=10,11 55 options 3c509 irq=10,11
56 56
57 57
58(2) Full-duplex mode 58(2) Full-duplex mode
@@ -77,6 +77,8 @@ operation.
77itself full-duplex capable. This is almost certainly one of two things: a full- 77itself full-duplex capable. This is almost certainly one of two things: a full-
78duplex-capable Ethernet switch (*not* a hub), or a full-duplex-capable NIC on 78duplex-capable Ethernet switch (*not* a hub), or a full-duplex-capable NIC on
79another system that's connected directly to the 3c509B via a crossover cable. 79another system that's connected directly to the 3c509B via a crossover cable.
80
81Full-duplex mode can be enabled using 'ethtool'.
80 82
81/////Extremely important caution concerning full-duplex mode///// 83/////Extremely important caution concerning full-duplex mode/////
82Understand that the 3c509B's hardware's full-duplex support is much more 84Understand that the 3c509B's hardware's full-duplex support is much more
@@ -113,6 +115,8 @@ This insured that merely upgrading the driver from an earlier version would
113never automatically enable full-duplex mode in an existing installation; 115never automatically enable full-duplex mode in an existing installation;
114it must always be explicitly enabled via one of these code in order to be 116it must always be explicitly enabled via one of these code in order to be
115activated. 117activated.
118
119The transceiver type can be changed using 'ethtool'.
116 120
117 121
118(4a) Interpretation of error messages and common problems 122(4a) Interpretation of error messages and common problems
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index 4a3109b28847..356fd86f4ea8 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -42,80 +42,81 @@ struct dev_pm_ops {
42 ... 42 ...
43}; 43};
44 44
45The ->runtime_suspend() callback is executed by the PM core for the bus type of 45The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks are
46the device being suspended. The bus type's callback is then _entirely_ 46executed by the PM core for either the bus type, or device type (if the bus
47_responsible_ for handling the device as appropriate, which may, but need not 47type's callback is not defined), or device class (if the bus type's and device
48include executing the device driver's own ->runtime_suspend() callback (from the 48type's callbacks are not defined) of given device. The bus type, device type
49and device class callbacks are referred to as subsystem-level callbacks in what
50follows.
51
52The subsystem-level suspend callback is _entirely_ _responsible_ for handling
53the suspend of the device as appropriate, which may, but need not include
54executing the device driver's own ->runtime_suspend() callback (from the
49PM core's point of view it is not necessary to implement a ->runtime_suspend() 55PM core's point of view it is not necessary to implement a ->runtime_suspend()
50callback in a device driver as long as the bus type's ->runtime_suspend() knows 56callback in a device driver as long as the subsystem-level suspend callback
51what to do to handle the device). 57knows what to do to handle the device).
52 58
53 * Once the bus type's ->runtime_suspend() callback has completed successfully 59 * Once the subsystem-level suspend callback has completed successfully
54 for given device, the PM core regards the device as suspended, which need 60 for given device, the PM core regards the device as suspended, which need
55 not mean that the device has been put into a low power state. It is 61 not mean that the device has been put into a low power state. It is
56 supposed to mean, however, that the device will not process data and will 62 supposed to mean, however, that the device will not process data and will
57 not communicate with the CPU(s) and RAM until its bus type's 63 not communicate with the CPU(s) and RAM until the subsystem-level resume
58 ->runtime_resume() callback is executed for it. The run-time PM status of 64 callback is executed for it. The run-time PM status of a device after
59 a device after successful execution of its bus type's ->runtime_suspend() 65 successful execution of the subsystem-level suspend callback is 'suspended'.
60 callback is 'suspended'. 66
61 67 * If the subsystem-level suspend callback returns -EBUSY or -EAGAIN,
62 * If the bus type's ->runtime_suspend() callback returns -EBUSY or -EAGAIN, 68 the device's run-time PM status is 'active', which means that the device
63 the device's run-time PM status is supposed to be 'active', which means that 69 _must_ be fully operational afterwards.
64 the device _must_ be fully operational afterwards. 70
65 71 * If the subsystem-level suspend callback returns an error code different
66 * If the bus type's ->runtime_suspend() callback returns an error code 72 from -EBUSY or -EAGAIN, the PM core regards this as a fatal error and will
67 different from -EBUSY or -EAGAIN, the PM core regards this as a fatal 73 refuse to run the helper functions described in Section 4 for the device,
68 error and will refuse to run the helper functions described in Section 4 74 until the status of it is directly set either to 'active', or to 'suspended'
69 for the device, until the status of it is directly set either to 'active' 75 (the PM core provides special helper functions for this purpose).
70 or to 'suspended' (the PM core provides special helper functions for this 76
71 purpose). 77In particular, if the driver requires remote wake-up capability (i.e. hardware
72 78mechanism allowing the device to request a change of its power state, such as
73In particular, if the driver requires remote wakeup capability for proper 79PCI PME) for proper functioning and device_run_wake() returns 'false' for the
74functioning and device_run_wake() returns 'false' for the device, then 80device, then ->runtime_suspend() should return -EBUSY. On the other hand, if
75->runtime_suspend() should return -EBUSY. On the other hand, if 81device_run_wake() returns 'true' for the device and the device is put into a low
76device_run_wake() returns 'true' for the device and the device is put 82power state during the execution of the subsystem-level suspend callback, it is
77into a low power state during the execution of its bus type's 83expected that remote wake-up will be enabled for the device. Generally, remote
78->runtime_suspend(), it is expected that remote wake-up (i.e. hardware mechanism 84wake-up should be enabled for all input devices put into a low power state at
79allowing the device to request a change of its power state, such as PCI PME) 85run time.
80will be enabled for the device. Generally, remote wake-up should be enabled 86
81for all input devices put into a low power state at run time. 87The subsystem-level resume callback is _entirely_ _responsible_ for handling the
82 88resume of the device as appropriate, which may, but need not include executing
83The ->runtime_resume() callback is executed by the PM core for the bus type of 89the device driver's own ->runtime_resume() callback (from the PM core's point of
84the device being woken up. The bus type's callback is then _entirely_ 90view it is not necessary to implement a ->runtime_resume() callback in a device
85_responsible_ for handling the device as appropriate, which may, but need not 91driver as long as the subsystem-level resume callback knows what to do to handle
86include executing the device driver's own ->runtime_resume() callback (from the 92the device).
87PM core's point of view it is not necessary to implement a ->runtime_resume() 93
88callback in a device driver as long as the bus type's ->runtime_resume() knows 94 * Once the subsystem-level resume callback has completed successfully, the PM
89what to do to handle the device). 95 core regards the device as fully operational, which means that the device
90 96 _must_ be able to complete I/O operations as needed. The run-time PM status
91 * Once the bus type's ->runtime_resume() callback has completed successfully, 97 of the device is then 'active'.
92 the PM core regards the device as fully operational, which means that the 98
93 device _must_ be able to complete I/O operations as needed. The run-time 99 * If the subsystem-level resume callback returns an error code, the PM core
94 PM status of the device is then 'active'. 100 regards this as a fatal error and will refuse to run the helper functions
95 101 described in Section 4 for the device, until its status is directly set
96 * If the bus type's ->runtime_resume() callback returns an error code, the PM 102 either to 'active' or to 'suspended' (the PM core provides special helper
97 core regards this as a fatal error and will refuse to run the helper 103 functions for this purpose).
98 functions described in Section 4 for the device, until its status is 104
99 directly set either to 'active' or to 'suspended' (the PM core provides 105The subsystem-level idle callback is executed by the PM core whenever the device
100 special helper functions for this purpose). 106appears to be idle, which is indicated to the PM core by two counters, the
101 107device's usage counter and the counter of 'active' children of the device.
102The ->runtime_idle() callback is executed by the PM core for the bus type of
103given device whenever the device appears to be idle, which is indicated to the
104PM core by two counters, the device's usage counter and the counter of 'active'
105children of the device.
106 108
107 * If any of these counters is decreased using a helper function provided by 109 * If any of these counters is decreased using a helper function provided by
108 the PM core and it turns out to be equal to zero, the other counter is 110 the PM core and it turns out to be equal to zero, the other counter is
109 checked. If that counter also is equal to zero, the PM core executes the 111 checked. If that counter also is equal to zero, the PM core executes the
110 device bus type's ->runtime_idle() callback (with the device as an 112 subsystem-level idle callback with the device as an argument.
111 argument).
112 113
113The action performed by a bus type's ->runtime_idle() callback is totally 114The action performed by a subsystem-level idle callback is totally dependent on
114dependent on the bus type in question, but the expected and recommended action 115the subsystem in question, but the expected and recommended action is to check
115is to check if the device can be suspended (i.e. if all of the conditions 116if the device can be suspended (i.e. if all of the conditions necessary for
116necessary for suspending the device are satisfied) and to queue up a suspend 117suspending the device are satisfied) and to queue up a suspend request for the
117request for the device in that case. The value returned by this callback is 118device in that case. The value returned by this callback is ignored by the PM
118ignored by the PM core. 119core.
119 120
120The helper functions provided by the PM core, described in Section 4, guarantee 121The helper functions provided by the PM core, described in Section 4, guarantee
121that the following constraints are met with respect to the bus type's run-time 122that the following constraints are met with respect to the bus type's run-time
@@ -238,41 +239,41 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
238 removing the device from device hierarchy 239 removing the device from device hierarchy
239 240
240 int pm_runtime_idle(struct device *dev); 241 int pm_runtime_idle(struct device *dev);
241 - execute ->runtime_idle() for the device's bus type; returns 0 on success 242 - execute the subsystem-level idle callback for the device; returns 0 on
242 or error code on failure, where -EINPROGRESS means that ->runtime_idle() 243 success or error code on failure, where -EINPROGRESS means that
243 is already being executed 244 ->runtime_idle() is already being executed
244 245
245 int pm_runtime_suspend(struct device *dev); 246 int pm_runtime_suspend(struct device *dev);
246 - execute ->runtime_suspend() for the device's bus type; returns 0 on 247 - execute the subsystem-level suspend callback for the device; returns 0 on
247 success, 1 if the device's run-time PM status was already 'suspended', or 248 success, 1 if the device's run-time PM status was already 'suspended', or
248 error code on failure, where -EAGAIN or -EBUSY means it is safe to attempt 249 error code on failure, where -EAGAIN or -EBUSY means it is safe to attempt
249 to suspend the device again in future 250 to suspend the device again in future
250 251
251 int pm_runtime_resume(struct device *dev); 252 int pm_runtime_resume(struct device *dev);
252 - execute ->runtime_resume() for the device's bus type; returns 0 on 253 - execute the subsystem-leve resume callback for the device; returns 0 on
253 success, 1 if the device's run-time PM status was already 'active' or 254 success, 1 if the device's run-time PM status was already 'active' or
254 error code on failure, where -EAGAIN means it may be safe to attempt to 255 error code on failure, where -EAGAIN means it may be safe to attempt to
255 resume the device again in future, but 'power.runtime_error' should be 256 resume the device again in future, but 'power.runtime_error' should be
256 checked additionally 257 checked additionally
257 258
258 int pm_request_idle(struct device *dev); 259 int pm_request_idle(struct device *dev);
259 - submit a request to execute ->runtime_idle() for the device's bus type 260 - submit a request to execute the subsystem-level idle callback for the
260 (the request is represented by a work item in pm_wq); returns 0 on success 261 device (the request is represented by a work item in pm_wq); returns 0 on
261 or error code if the request has not been queued up 262 success or error code if the request has not been queued up
262 263
263 int pm_schedule_suspend(struct device *dev, unsigned int delay); 264 int pm_schedule_suspend(struct device *dev, unsigned int delay);
264 - schedule the execution of ->runtime_suspend() for the device's bus type 265 - schedule the execution of the subsystem-level suspend callback for the
265 in future, where 'delay' is the time to wait before queuing up a suspend 266 device in future, where 'delay' is the time to wait before queuing up a
266 work item in pm_wq, in milliseconds (if 'delay' is zero, the work item is 267 suspend work item in pm_wq, in milliseconds (if 'delay' is zero, the work
267 queued up immediately); returns 0 on success, 1 if the device's PM 268 item is queued up immediately); returns 0 on success, 1 if the device's PM
268 run-time status was already 'suspended', or error code if the request 269 run-time status was already 'suspended', or error code if the request
269 hasn't been scheduled (or queued up if 'delay' is 0); if the execution of 270 hasn't been scheduled (or queued up if 'delay' is 0); if the execution of
270 ->runtime_suspend() is already scheduled and not yet expired, the new 271 ->runtime_suspend() is already scheduled and not yet expired, the new
271 value of 'delay' will be used as the time to wait 272 value of 'delay' will be used as the time to wait
272 273
273 int pm_request_resume(struct device *dev); 274 int pm_request_resume(struct device *dev);
274 - submit a request to execute ->runtime_resume() for the device's bus type 275 - submit a request to execute the subsystem-level resume callback for the
275 (the request is represented by a work item in pm_wq); returns 0 on 276 device (the request is represented by a work item in pm_wq); returns 0 on
276 success, 1 if the device's run-time PM status was already 'active', or 277 success, 1 if the device's run-time PM status was already 'active', or
277 error code if the request hasn't been queued up 278 error code if the request hasn't been queued up
278 279
@@ -303,12 +304,12 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
303 run-time PM callbacks described in Section 2 304 run-time PM callbacks described in Section 2
304 305
305 int pm_runtime_disable(struct device *dev); 306 int pm_runtime_disable(struct device *dev);
306 - prevent the run-time PM helper functions from running the device bus 307 - prevent the run-time PM helper functions from running subsystem-level
307 type's run-time PM callbacks, make sure that all of the pending run-time 308 run-time PM callbacks for the device, make sure that all of the pending
308 PM operations on the device are either completed or canceled; returns 309 run-time PM operations on the device are either completed or canceled;
309 1 if there was a resume request pending and it was necessary to execute 310 returns 1 if there was a resume request pending and it was necessary to
310 ->runtime_resume() for the device's bus type to satisfy that request, 311 execute the subsystem-level resume callback for the device to satisfy that
311 otherwise 0 is returned 312 request, otherwise 0 is returned
312 313
313 void pm_suspend_ignore_children(struct device *dev, bool enable); 314 void pm_suspend_ignore_children(struct device *dev, bool enable);
314 - set/unset the power.ignore_children flag of the device 315 - set/unset the power.ignore_children flag of the device
@@ -378,5 +379,55 @@ pm_runtime_suspend() or pm_runtime_idle() or their asynchronous counterparts,
378they will fail returning -EAGAIN, because the device's usage counter is 379they will fail returning -EAGAIN, because the device's usage counter is
379incremented by the core before executing ->probe() and ->remove(). Still, it 380incremented by the core before executing ->probe() and ->remove(). Still, it
380may be desirable to suspend the device as soon as ->probe() or ->remove() has 381may be desirable to suspend the device as soon as ->probe() or ->remove() has
381finished, so the PM core uses pm_runtime_idle_sync() to invoke the device bus 382finished, so the PM core uses pm_runtime_idle_sync() to invoke the
382type's ->runtime_idle() callback at that time. 383subsystem-level idle callback for the device at that time.
384
3856. Run-time PM and System Sleep
386
387Run-time PM and system sleep (i.e., system suspend and hibernation, also known
388as suspend-to-RAM and suspend-to-disk) interact with each other in a couple of
389ways. If a device is active when a system sleep starts, everything is
390straightforward. But what should happen if the device is already suspended?
391
392The device may have different wake-up settings for run-time PM and system sleep.
393For example, remote wake-up may be enabled for run-time suspend but disallowed
394for system sleep (device_may_wakeup(dev) returns 'false'). When this happens,
395the subsystem-level system suspend callback is responsible for changing the
396device's wake-up setting (it may leave that to the device driver's system
397suspend routine). It may be necessary to resume the device and suspend it again
398in order to do so. The same is true if the driver uses different power levels
399or other settings for run-time suspend and system sleep.
400
401During system resume, devices generally should be brought back to full power,
402even if they were suspended before the system sleep began. There are several
403reasons for this, including:
404
405 * The device might need to switch power levels, wake-up settings, etc.
406
407 * Remote wake-up events might have been lost by the firmware.
408
409 * The device's children may need the device to be at full power in order
410 to resume themselves.
411
412 * The driver's idea of the device state may not agree with the device's
413 physical state. This can happen during resume from hibernation.
414
415 * The device might need to be reset.
416
417 * Even though the device was suspended, if its usage counter was > 0 then most
418 likely it would need a run-time resume in the near future anyway.
419
420 * Always going back to full power is simplest.
421
422If the device was suspended before the sleep began, then its run-time PM status
423will have to be updated to reflect the actual post-system sleep status. The way
424to do this is:
425
426 pm_runtime_disable(dev);
427 pm_runtime_set_active(dev);
428 pm_runtime_enable(dev);
429
430The PM core always increments the run-time usage counter before calling the
431->prepare() callback and decrements it after calling the ->complete() callback.
432Hence disabling run-time PM temporarily like this will not cause any run-time
433suspend callbacks to be lost.
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpic.txt b/Documentation/powerpc/dts-bindings/fsl/mpic.txt
new file mode 100644
index 000000000000..71e39cf3215b
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/fsl/mpic.txt
@@ -0,0 +1,42 @@
1* OpenPIC and its interrupt numbers on Freescale's e500/e600 cores
2
3The OpenPIC specification does not specify which interrupt source has to
4become which interrupt number. This is up to the software implementation
5of the interrupt controller. The only requirement is that every
6interrupt source has to have an unique interrupt number / vector number.
7To accomplish this the current implementation assigns the number zero to
8the first source, the number one to the second source and so on until
9all interrupt sources have their unique number.
10Usually the assigned vector number equals the interrupt number mentioned
11in the documentation for a given core / CPU. This is however not true
12for the e500 cores (MPC85XX CPUs) where the documentation distinguishes
13between internal and external interrupt sources and starts counting at
14zero for both of them.
15
16So what to write for external interrupt source X or internal interrupt
17source Y into the device tree? Here is an example:
18
19The memory map for the interrupt controller in the MPC8544[0] shows,
20that the first interrupt source starts at 0x5_0000 (PIC Register Address
21Map-Interrupt Source Configuration Registers). This source becomes the
22number zero therefore:
23 External interrupt 0 = interrupt number 0
24 External interrupt 1 = interrupt number 1
25 External interrupt 2 = interrupt number 2
26 ...
27Every interrupt number allocates 0x20 bytes register space. So to get
28its number it is sufficient to shift the lower 16bits to right by five.
29So for the external interrupt 10 we have:
30 0x0140 >> 5 = 10
31
32After the external sources, the internal sources follow. The in core I2C
33controller on the MPC8544 for instance has the internal source number
3427. Oo obtain its interrupt number we take the lower 16bits of its memory
35address (0x5_0560) and shift it right:
36 0x0560 >> 5 = 43
37
38Therefore the I2C device node for the MPC8544 CPU has to have the
39interrupt number 43 specified in the device tree.
40
41[0] MPC8544E PowerQUICCTM III, Integrated Host Processor Family Reference Manual
42 MPC8544ERM Rev. 1 10/2007
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index e93affff3af8..e72cee9e2a71 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -403,4 +403,5 @@ STAC9872
403Cirrus Logic CS4206/4207 403Cirrus Logic CS4206/4207
404======================== 404========================
405 mbp55 MacBook Pro 5,5 405 mbp55 MacBook Pro 5,5
406 imac27 IMac 27 Inch
406 auto BIOS setup (default) 407 auto BIOS setup (default)
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt
index 719a819f8cc2..07301de12cc4 100644
--- a/Documentation/sound/alsa/Procfile.txt
+++ b/Documentation/sound/alsa/Procfile.txt
@@ -95,7 +95,7 @@ card*/pcm*/xrun_debug
95 It takes an integer value, can be changed by writing to this 95 It takes an integer value, can be changed by writing to this
96 file, such as 96 file, such as
97 97
98 # cat 5 > /proc/asound/card0/pcm0p/xrun_debug 98 # echo 5 > /proc/asound/card0/pcm0p/xrun_debug
99 99
100 The value consists of the following bit flags: 100 The value consists of the following bit flags:
101 bit 0 = Enable XRUN/jiffies debug messages 101 bit 0 = Enable XRUN/jiffies debug messages
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index a452227361b1..5effa5bd993b 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -26,13 +26,33 @@ Procedure for submitting patches to the -stable tree:
26 26
27 - Send the patch, after verifying that it follows the above rules, to 27 - Send the patch, after verifying that it follows the above rules, to
28 stable@kernel.org. 28 stable@kernel.org.
29 - To have the patch automatically included in the stable tree, add the
30 the tag
31 Cc: stable@kernel.org
32 in the sign-off area. Once the patch is merged it will be applied to
33 the stable tree without anything else needing to be done by the author
34 or subsystem maintainer.
35 - If the patch requires other patches as prerequisites which can be
36 cherry-picked than this can be specified in the following format in
37 the sign-off area:
38
39 Cc: <stable@kernel.org> # .32.x: a1f84a3: sched: Check for idle
40 Cc: <stable@kernel.org> # .32.x: 1b9508f: sched: Rate-limit newidle
41 Cc: <stable@kernel.org> # .32.x: fd21073: sched: Fix affinity logic
42 Cc: <stable@kernel.org> # .32.x
43 Signed-off-by: Ingo Molnar <mingo@elte.hu>
44
45 The tag sequence has the meaning of:
46 git cherry-pick a1f84a3
47 git cherry-pick 1b9508f
48 git cherry-pick fd21073
49 git cherry-pick <this commit>
50
29 - The sender will receive an ACK when the patch has been accepted into the 51 - The sender will receive an ACK when the patch has been accepted into the
30 queue, or a NAK if the patch is rejected. This response might take a few 52 queue, or a NAK if the patch is rejected. This response might take a few
31 days, according to the developer's schedules. 53 days, according to the developer's schedules.
32 - If accepted, the patch will be added to the -stable queue, for review by 54 - If accepted, the patch will be added to the -stable queue, for review by
33 other developers and by the relevant subsystem maintainer. 55 other developers and by the relevant subsystem maintainer.
34 - If the stable@kernel.org address is added to a patch, when it goes into
35 Linus's tree it will automatically be emailed to the stable team.
36 - Security patches should not be sent to this alias, but instead to the 56 - Security patches should not be sent to this alias, but instead to the
37 documented security@kernel.org address. 57 documented security@kernel.org address.
38 58
diff --git a/Documentation/trace/events-kmem.txt b/Documentation/trace/events-kmem.txt
index 6ef2a8652e17..aa82ee4a5a87 100644
--- a/Documentation/trace/events-kmem.txt
+++ b/Documentation/trace/events-kmem.txt
@@ -1,7 +1,7 @@
1 Subsystem Trace Points: kmem 1 Subsystem Trace Points: kmem
2 2
3The tracing system kmem captures events related to object and page allocation 3The kmem tracing system captures events related to object and page allocation
4within the kernel. Broadly speaking there are four major subheadings. 4within the kernel. Broadly speaking there are five major subheadings.
5 5
6 o Slab allocation of small objects of unknown type (kmalloc) 6 o Slab allocation of small objects of unknown type (kmalloc)
7 o Slab allocation of small objects of known type 7 o Slab allocation of small objects of known type
@@ -9,7 +9,7 @@ within the kernel. Broadly speaking there are four major subheadings.
9 o Per-CPU Allocator Activity 9 o Per-CPU Allocator Activity
10 o External Fragmentation 10 o External Fragmentation
11 11
12This document will describe what each of the tracepoints are and why they 12This document describes what each of the tracepoints is and why they
13might be useful. 13might be useful.
14 14
151. Slab allocation of small objects of unknown type 151. Slab allocation of small objects of unknown type
@@ -34,7 +34,7 @@ kmem_cache_free call_site=%lx ptr=%p
34These events are similar in usage to the kmalloc-related events except that 34These events are similar in usage to the kmalloc-related events except that
35it is likely easier to pin the event down to a specific cache. At the time 35it is likely easier to pin the event down to a specific cache. At the time
36of writing, no information is available on what slab is being allocated from, 36of writing, no information is available on what slab is being allocated from,
37but the call_site can usually be used to extrapolate that information 37but the call_site can usually be used to extrapolate that information.
38 38
393. Page allocation 393. Page allocation
40================== 40==================
@@ -80,9 +80,9 @@ event indicating whether it is for a percpu_refill or not.
80When the per-CPU list is too full, a number of pages are freed, each one 80When the per-CPU list is too full, a number of pages are freed, each one
81which triggers a mm_page_pcpu_drain event. 81which triggers a mm_page_pcpu_drain event.
82 82
83The individual nature of the events are so that pages can be tracked 83The individual nature of the events is so that pages can be tracked
84between allocation and freeing. A number of drain or refill pages that occur 84between allocation and freeing. A number of drain or refill pages that occur
85consecutively imply the zone->lock being taken once. Large amounts of PCP 85consecutively imply the zone->lock being taken once. Large amounts of per-CPU
86refills and drains could imply an imbalance between CPUs where too much work 86refills and drains could imply an imbalance between CPUs where too much work
87is being concentrated in one place. It could also indicate that the per-CPU 87is being concentrated in one place. It could also indicate that the per-CPU
88lists should be a larger size. Finally, large amounts of refills on one CPU 88lists should be a larger size. Finally, large amounts of refills on one CPU
@@ -102,6 +102,6 @@ is important.
102 102
103Large numbers of this event implies that memory is fragmenting and 103Large numbers of this event implies that memory is fragmenting and
104high-order allocations will start failing at some time in the future. One 104high-order allocations will start failing at some time in the future. One
105means of reducing the occurange of this event is to increase the size of 105means of reducing the occurrence of this event is to increase the size of
106min_free_kbytes in increments of 3*pageblock_size*nr_online_nodes where 106min_free_kbytes in increments of 3*pageblock_size*nr_online_nodes where
107pageblock_size is usually the size of the default hugepage size. 107pageblock_size is usually the size of the default hugepage size.
diff --git a/Documentation/trace/ftrace-design.txt b/Documentation/trace/ftrace-design.txt
index 641a1ef2a7ff..239f14b2b55a 100644
--- a/Documentation/trace/ftrace-design.txt
+++ b/Documentation/trace/ftrace-design.txt
@@ -53,14 +53,14 @@ size of the mcount call that is embedded in the function).
53For example, if the function foo() calls bar(), when the bar() function calls 53For example, if the function foo() calls bar(), when the bar() function calls
54mcount(), the arguments mcount() will pass to the tracer are: 54mcount(), the arguments mcount() will pass to the tracer are:
55 "frompc" - the address bar() will use to return to foo() 55 "frompc" - the address bar() will use to return to foo()
56 "selfpc" - the address bar() (with _mcount() size adjustment) 56 "selfpc" - the address bar() (with mcount() size adjustment)
57 57
58Also keep in mind that this mcount function will be called *a lot*, so 58Also keep in mind that this mcount function will be called *a lot*, so
59optimizing for the default case of no tracer will help the smooth running of 59optimizing for the default case of no tracer will help the smooth running of
60your system when tracing is disabled. So the start of the mcount function is 60your system when tracing is disabled. So the start of the mcount function is
61typically the bare min with checking things before returning. That also means 61typically the bare minimum with checking things before returning. That also
62the code flow should usually kept linear (i.e. no branching in the nop case). 62means the code flow should usually be kept linear (i.e. no branching in the nop
63This is of course an optimization and not a hard requirement. 63case). This is of course an optimization and not a hard requirement.
64 64
65Here is some pseudo code that should help (these functions should actually be 65Here is some pseudo code that should help (these functions should actually be
66implemented in assembly): 66implemented in assembly):
@@ -131,10 +131,10 @@ some functions to save (hijack) and restore the return address.
131 131
132The mcount function should check the function pointers ftrace_graph_return 132The mcount function should check the function pointers ftrace_graph_return
133(compare to ftrace_stub) and ftrace_graph_entry (compare to 133(compare to ftrace_stub) and ftrace_graph_entry (compare to
134ftrace_graph_entry_stub). If either of those are not set to the relevant stub 134ftrace_graph_entry_stub). If either of those is not set to the relevant stub
135function, call the arch-specific function ftrace_graph_caller which in turn 135function, call the arch-specific function ftrace_graph_caller which in turn
136calls the arch-specific function prepare_ftrace_return. Neither of these 136calls the arch-specific function prepare_ftrace_return. Neither of these
137function names are strictly required, but you should use them anyways to stay 137function names is strictly required, but you should use them anyway to stay
138consistent across the architecture ports -- easier to compare & contrast 138consistent across the architecture ports -- easier to compare & contrast
139things. 139things.
140 140
@@ -144,7 +144,7 @@ but the first argument should be a pointer to the "frompc". Typically this is
144located on the stack. This allows the function to hijack the return address 144located on the stack. This allows the function to hijack the return address
145temporarily to have it point to the arch-specific function return_to_handler. 145temporarily to have it point to the arch-specific function return_to_handler.
146That function will simply call the common ftrace_return_to_handler function and 146That function will simply call the common ftrace_return_to_handler function and
147that will return the original return address with which, you can return to the 147that will return the original return address with which you can return to the
148original call site. 148original call site.
149 149
150Here is the updated mcount pseudo code: 150Here is the updated mcount pseudo code:
diff --git a/Documentation/trace/mmiotrace.txt b/Documentation/trace/mmiotrace.txt
index 162effbfbdec..664e7386d89e 100644
--- a/Documentation/trace/mmiotrace.txt
+++ b/Documentation/trace/mmiotrace.txt
@@ -44,7 +44,8 @@ Check for lost events.
44Usage 44Usage
45----- 45-----
46 46
47Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) 47Make sure debugfs is mounted to /sys/kernel/debug.
48If not (requires root privileges):
48$ mount -t debugfs debugfs /sys/kernel/debug 49$ mount -t debugfs debugfs /sys/kernel/debug
49 50
50Check that the driver you are about to trace is not loaded. 51Check that the driver you are about to trace is not loaded.
@@ -91,7 +92,7 @@ $ dmesg > dmesg.txt
91$ tar zcf pciid-nick-mmiotrace.tar.gz mydump.txt lspci.txt dmesg.txt 92$ tar zcf pciid-nick-mmiotrace.tar.gz mydump.txt lspci.txt dmesg.txt
92and then send the .tar.gz file. The trace compresses considerably. Replace 93and then send the .tar.gz file. The trace compresses considerably. Replace
93"pciid" and "nick" with the PCI ID or model name of your piece of hardware 94"pciid" and "nick" with the PCI ID or model name of your piece of hardware
94under investigation and your nick name. 95under investigation and your nickname.
95 96
96 97
97How Mmiotrace Works 98How Mmiotrace Works
@@ -100,7 +101,7 @@ How Mmiotrace Works
100Access to hardware IO-memory is gained by mapping addresses from PCI bus by 101Access to hardware IO-memory is gained by mapping addresses from PCI bus by
101calling one of the ioremap_*() functions. Mmiotrace is hooked into the 102calling one of the ioremap_*() functions. Mmiotrace is hooked into the
102__ioremap() function and gets called whenever a mapping is created. Mapping is 103__ioremap() function and gets called whenever a mapping is created. Mapping is
103an event that is recorded into the trace log. Note, that ISA range mappings 104an event that is recorded into the trace log. Note that ISA range mappings
104are not caught, since the mapping always exists and is returned directly. 105are not caught, since the mapping always exists and is returned directly.
105 106
106MMIO accesses are recorded via page faults. Just before __ioremap() returns, 107MMIO accesses are recorded via page faults. Just before __ioremap() returns,
@@ -122,11 +123,11 @@ Trace Log Format
122---------------- 123----------------
123 124
124The raw log is text and easily filtered with e.g. grep and awk. One record is 125The raw log is text and easily filtered with e.g. grep and awk. One record is
125one line in the log. A record starts with a keyword, followed by keyword 126one line in the log. A record starts with a keyword, followed by keyword-
126dependant arguments. Arguments are separated by a space, or continue until the 127dependent arguments. Arguments are separated by a space, or continue until the
127end of line. The format for version 20070824 is as follows: 128end of line. The format for version 20070824 is as follows:
128 129
129Explanation Keyword Space separated arguments 130Explanation Keyword Space-separated arguments
130--------------------------------------------------------------------------- 131---------------------------------------------------------------------------
131 132
132read event R width, timestamp, map id, physical, value, PC, PID 133read event R width, timestamp, map id, physical, value, PC, PID
@@ -136,7 +137,7 @@ iounmap event UNMAP timestamp, map id, PC, PID
136marker MARK timestamp, text 137marker MARK timestamp, text
137version VERSION the string "20070824" 138version VERSION the string "20070824"
138info for reader LSPCI one line from lspci -v 139info for reader LSPCI one line from lspci -v
139PCI address map PCIDEV space separated /proc/bus/pci/devices data 140PCI address map PCIDEV space-separated /proc/bus/pci/devices data
140unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID 141unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID
141 142
142Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual 143Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual
diff --git a/Documentation/trace/ring-buffer-design.txt b/Documentation/trace/ring-buffer-design.txt
index 5b1d23d604c5..d299ff31df57 100644
--- a/Documentation/trace/ring-buffer-design.txt
+++ b/Documentation/trace/ring-buffer-design.txt
@@ -33,9 +33,9 @@ head_page - a pointer to the page that the reader will use next
33 33
34tail_page - a pointer to the page that will be written to next 34tail_page - a pointer to the page that will be written to next
35 35
36commit_page - a pointer to the page with the last finished non nested write. 36commit_page - a pointer to the page with the last finished non-nested write.
37 37
38cmpxchg - hardware assisted atomic transaction that performs the following: 38cmpxchg - hardware-assisted atomic transaction that performs the following:
39 39
40 A = B iff previous A == C 40 A = B iff previous A == C
41 41
@@ -52,15 +52,15 @@ The Generic Ring Buffer
52The ring buffer can be used in either an overwrite mode or in 52The ring buffer can be used in either an overwrite mode or in
53producer/consumer mode. 53producer/consumer mode.
54 54
55Producer/consumer mode is where the producer were to fill up the 55Producer/consumer mode is where if the producer were to fill up the
56buffer before the consumer could free up anything, the producer 56buffer before the consumer could free up anything, the producer
57will stop writing to the buffer. This will lose most recent events. 57will stop writing to the buffer. This will lose most recent events.
58 58
59Overwrite mode is where the produce were to fill up the buffer 59Overwrite mode is where if the producer were to fill up the buffer
60before the consumer could free up anything, the producer will 60before the consumer could free up anything, the producer will
61overwrite the older data. This will lose the oldest events. 61overwrite the older data. This will lose the oldest events.
62 62
63No two writers can write at the same time (on the same per cpu buffer), 63No two writers can write at the same time (on the same per-cpu buffer),
64but a writer may interrupt another writer, but it must finish writing 64but a writer may interrupt another writer, but it must finish writing
65before the previous writer may continue. This is very important to the 65before the previous writer may continue. This is very important to the
66algorithm. The writers act like a "stack". The way interrupts works 66algorithm. The writers act like a "stack". The way interrupts works
@@ -79,16 +79,16 @@ the interrupt doing a write as well.
79 79
80Readers can happen at any time. But no two readers may run at the 80Readers can happen at any time. But no two readers may run at the
81same time, nor can a reader preempt/interrupt another reader. A reader 81same time, nor can a reader preempt/interrupt another reader. A reader
82can not preempt/interrupt a writer, but it may read/consume from the 82cannot preempt/interrupt a writer, but it may read/consume from the
83buffer at the same time as a writer is writing, but the reader must be 83buffer at the same time as a writer is writing, but the reader must be
84on another processor to do so. A reader may read on its own processor 84on another processor to do so. A reader may read on its own processor
85and can be preempted by a writer. 85and can be preempted by a writer.
86 86
87A writer can preempt a reader, but a reader can not preempt a writer. 87A writer can preempt a reader, but a reader cannot preempt a writer.
88But a reader can read the buffer at the same time (on another processor) 88But a reader can read the buffer at the same time (on another processor)
89as a writer. 89as a writer.
90 90
91The ring buffer is made up of a list of pages held together by a link list. 91The ring buffer is made up of a list of pages held together by a linked list.
92 92
93At initialization a reader page is allocated for the reader that is not 93At initialization a reader page is allocated for the reader that is not
94part of the ring buffer. 94part of the ring buffer.
@@ -102,7 +102,7 @@ the head page.
102 102
103The reader has its own page to use. At start up time, this page is 103The reader has its own page to use. At start up time, this page is
104allocated but is not attached to the list. When the reader wants 104allocated but is not attached to the list. When the reader wants
105to read from the buffer, if its page is empty (like it is on start up) 105to read from the buffer, if its page is empty (like it is on start-up),
106it will swap its page with the head_page. The old reader page will 106it will swap its page with the head_page. The old reader page will
107become part of the ring buffer and the head_page will be removed. 107become part of the ring buffer and the head_page will be removed.
108The page after the inserted page (old reader_page) will become the 108The page after the inserted page (old reader_page) will become the
@@ -206,7 +206,7 @@ The main pointers:
206 206
207 commit page - the page that last finished a write. 207 commit page - the page that last finished a write.
208 208
209The commit page only is updated by the outer most writer in the 209The commit page only is updated by the outermost writer in the
210writer stack. A writer that preempts another writer will not move the 210writer stack. A writer that preempts another writer will not move the
211commit page. 211commit page.
212 212
@@ -281,7 +281,7 @@ with the previous write.
281The commit pointer points to the last write location that was 281The commit pointer points to the last write location that was
282committed without preempting another write. When a write that 282committed without preempting another write. When a write that
283preempted another write is committed, it only becomes a pending commit 283preempted another write is committed, it only becomes a pending commit
284and will not be a full commit till all writes have been committed. 284and will not be a full commit until all writes have been committed.
285 285
286The commit page points to the page that has the last full commit. 286The commit page points to the page that has the last full commit.
287The tail page points to the page with the last write (before 287The tail page points to the page with the last write (before
@@ -292,7 +292,7 @@ be several pages ahead. If the tail page catches up to the commit
292page then no more writes may take place (regardless of the mode 292page then no more writes may take place (regardless of the mode
293of the ring buffer: overwrite and produce/consumer). 293of the ring buffer: overwrite and produce/consumer).
294 294
295The order of pages are: 295The order of pages is:
296 296
297 head page 297 head page
298 commit page 298 commit page
@@ -311,7 +311,7 @@ Possible scenario:
311There is a special case that the head page is after either the commit page 311There is a special case that the head page is after either the commit page
312and possibly the tail page. That is when the commit (and tail) page has been 312and possibly the tail page. That is when the commit (and tail) page has been
313swapped with the reader page. This is because the head page is always 313swapped with the reader page. This is because the head page is always
314part of the ring buffer, but the reader page is not. When ever there 314part of the ring buffer, but the reader page is not. Whenever there
315has been less than a full page that has been committed inside the ring buffer, 315has been less than a full page that has been committed inside the ring buffer,
316and a reader swaps out a page, it will be swapping out the commit page. 316and a reader swaps out a page, it will be swapping out the commit page.
317 317
@@ -338,7 +338,7 @@ and a reader swaps out a page, it will be swapping out the commit page.
338In this case, the head page will not move when the tail and commit 338In this case, the head page will not move when the tail and commit
339move back into the ring buffer. 339move back into the ring buffer.
340 340
341The reader can not swap a page into the ring buffer if the commit page 341The reader cannot swap a page into the ring buffer if the commit page
342is still on that page. If the read meets the last commit (real commit 342is still on that page. If the read meets the last commit (real commit
343not pending or reserved), then there is nothing more to read. 343not pending or reserved), then there is nothing more to read.
344The buffer is considered empty until another full commit finishes. 344The buffer is considered empty until another full commit finishes.
@@ -395,7 +395,7 @@ The main idea behind the lockless algorithm is to combine the moving
395of the head_page pointer with the swapping of pages with the reader. 395of the head_page pointer with the swapping of pages with the reader.
396State flags are placed inside the pointer to the page. To do this, 396State flags are placed inside the pointer to the page. To do this,
397each page must be aligned in memory by 4 bytes. This will allow the 2 397each page must be aligned in memory by 4 bytes. This will allow the 2
398least significant bits of the address to be used as flags. Since 398least significant bits of the address to be used as flags, since
399they will always be zero for the address. To get the address, 399they will always be zero for the address. To get the address,
400simply mask out the flags. 400simply mask out the flags.
401 401
@@ -460,7 +460,7 @@ When the reader tries to swap the page with the ring buffer, it
460will also use cmpxchg. If the flag bit in the pointer to the 460will also use cmpxchg. If the flag bit in the pointer to the
461head page does not have the HEADER flag set, the compare will fail 461head page does not have the HEADER flag set, the compare will fail
462and the reader will need to look for the new head page and try again. 462and the reader will need to look for the new head page and try again.
463Note, the flag UPDATE and HEADER are never set at the same time. 463Note, the flags UPDATE and HEADER are never set at the same time.
464 464
465The reader swaps the reader page as follows: 465The reader swaps the reader page as follows:
466 466
@@ -539,7 +539,7 @@ updated to the reader page.
539 | +-----------------------------+ | 539 | +-----------------------------+ |
540 +------------------------------------+ 540 +------------------------------------+
541 541
542Another important point. The page that the reader page points back to 542Another important point: The page that the reader page points back to
543by its previous pointer (the one that now points to the new head page) 543by its previous pointer (the one that now points to the new head page)
544never points back to the reader page. That is because the reader page is 544never points back to the reader page. That is because the reader page is
545not part of the ring buffer. Traversing the ring buffer via the next pointers 545not part of the ring buffer. Traversing the ring buffer via the next pointers
@@ -572,7 +572,7 @@ not be able to swap the head page from the buffer, nor will it be able to
572move the head page, until the writer is finished with the move. 572move the head page, until the writer is finished with the move.
573 573
574This eliminates any races that the reader can have on the writer. The reader 574This eliminates any races that the reader can have on the writer. The reader
575must spin, and this is why the reader can not preempt the writer. 575must spin, and this is why the reader cannot preempt the writer.
576 576
577 tail page 577 tail page
578 | 578 |
@@ -659,9 +659,9 @@ before pushing the head page. If it is, then it can be assumed that the
659tail page wrapped the buffer, and we must drop new writes. 659tail page wrapped the buffer, and we must drop new writes.
660 660
661This is not a race condition, because the commit page can only be moved 661This is not a race condition, because the commit page can only be moved
662by the outter most writer (the writer that was preempted). 662by the outermost writer (the writer that was preempted).
663This means that the commit will not move while a writer is moving the 663This means that the commit will not move while a writer is moving the
664tail page. The reader can not swap the reader page if it is also being 664tail page. The reader cannot swap the reader page if it is also being
665used as the commit page. The reader can simply check that the commit 665used as the commit page. The reader can simply check that the commit
666is off the reader page. Once the commit page leaves the reader page 666is off the reader page. Once the commit page leaves the reader page
667it will never go back on it unless a reader does another swap with the 667it will never go back on it unless a reader does another swap with the
@@ -733,7 +733,7 @@ The write converts the head page pointer to UPDATE.
733--->| |<---| |<---| |<---| |<--- 733--->| |<---| |<---| |<---| |<---
734 +---+ +---+ +---+ +---+ 734 +---+ +---+ +---+ +---+
735 735
736But if a nested writer preempts here. It will see that the next 736But if a nested writer preempts here, it will see that the next
737page is a head page, but it is also nested. It will detect that 737page is a head page, but it is also nested. It will detect that
738it is nested and will save that information. The detection is the 738it is nested and will save that information. The detection is the
739fact that it sees the UPDATE flag instead of a HEADER or NORMAL 739fact that it sees the UPDATE flag instead of a HEADER or NORMAL
@@ -761,7 +761,7 @@ to NORMAL.
761--->| |<---| |<---| |<---| |<--- 761--->| |<---| |<---| |<---| |<---
762 +---+ +---+ +---+ +---+ 762 +---+ +---+ +---+ +---+
763 763
764After the nested writer finishes, the outer most writer will convert 764After the nested writer finishes, the outermost writer will convert
765the UPDATE pointer to NORMAL. 765the UPDATE pointer to NORMAL.
766 766
767 767
@@ -812,7 +812,7 @@ head page.
812 +---+ +---+ +---+ +---+ 812 +---+ +---+ +---+ +---+
813 813
814The nested writer moves the tail page forward. But does not set the old 814The nested writer moves the tail page forward. But does not set the old
815update page to NORMAL because it is not the outer most writer. 815update page to NORMAL because it is not the outermost writer.
816 816
817 tail page 817 tail page
818 | 818 |
@@ -892,7 +892,7 @@ It will return to the first writer.
892--->| |<---| |<---| |<---| |<--- 892--->| |<---| |<---| |<---| |<---
893 +---+ +---+ +---+ +---+ 893 +---+ +---+ +---+ +---+
894 894
895The first writer can not know atomically test if the tail page moved 895The first writer cannot know atomically if the tail page moved
896while it updates the HEAD page. It will then update the head page to 896while it updates the HEAD page. It will then update the head page to
897what it thinks is the new head page. 897what it thinks is the new head page.
898 898
@@ -923,9 +923,9 @@ if the tail page is either where it use to be or on the next page:
923--->| |<---| |<---| |<---| |<--- 923--->| |<---| |<---| |<---| |<---
924 +---+ +---+ +---+ +---+ 924 +---+ +---+ +---+ +---+
925 925
926If tail page != A and tail page does not equal B, then it must reset the 926If tail page != A and tail page != B, then it must reset the pointer
927pointer back to NORMAL. The fact that it only needs to worry about 927back to NORMAL. The fact that it only needs to worry about nested
928nested writers, it only needs to check this after setting the HEAD page. 928writers means that it only needs to check this after setting the HEAD page.
929 929
930 930
931(first writer) 931(first writer)
@@ -939,7 +939,7 @@ nested writers, it only needs to check this after setting the HEAD page.
939 +---+ +---+ +---+ +---+ 939 +---+ +---+ +---+ +---+
940 940
941Now the writer can update the head page. This is also why the head page must 941Now the writer can update the head page. This is also why the head page must
942remain in UPDATE and only reset by the outer most writer. This prevents 942remain in UPDATE and only reset by the outermost writer. This prevents
943the reader from seeing the incorrect head page. 943the reader from seeing the incorrect head page.
944 944
945 945
diff --git a/Documentation/trace/tracepoint-analysis.txt b/Documentation/trace/tracepoint-analysis.txt
index 5eb4e487e667..87bee3c129ba 100644
--- a/Documentation/trace/tracepoint-analysis.txt
+++ b/Documentation/trace/tracepoint-analysis.txt
@@ -10,8 +10,8 @@ Tracepoints (see Documentation/trace/tracepoints.txt) can be used without
10creating custom kernel modules to register probe functions using the event 10creating custom kernel modules to register probe functions using the event
11tracing infrastructure. 11tracing infrastructure.
12 12
13Simplistically, tracepoints will represent an important event that when can 13Simplistically, tracepoints represent important events that can be
14be taken in conjunction with other tracepoints to build a "Big Picture" of 14taken in conjunction with other tracepoints to build a "Big Picture" of
15what is going on within the system. There are a large number of methods for 15what is going on within the system. There are a large number of methods for
16gathering and interpreting these events. Lacking any current Best Practises, 16gathering and interpreting these events. Lacking any current Best Practises,
17this document describes some of the methods that can be used. 17this document describes some of the methods that can be used.
@@ -33,12 +33,12 @@ calling
33 33
34will give a fair indication of the number of events available. 34will give a fair indication of the number of events available.
35 35
362.2 PCL 362.2 PCL (Performance Counters for Linux)
37------- 37-------
38 38
39Discovery and enumeration of all counters and events, including tracepoints 39Discovery and enumeration of all counters and events, including tracepoints,
40are available with the perf tool. Getting a list of available events is a 40are available with the perf tool. Getting a list of available events is a
41simple case of 41simple case of:
42 42
43 $ perf list 2>&1 | grep Tracepoint 43 $ perf list 2>&1 | grep Tracepoint
44 ext4:ext4_free_inode [Tracepoint event] 44 ext4:ext4_free_inode [Tracepoint event]
@@ -49,19 +49,19 @@ simple case of
49 [ .... remaining output snipped .... ] 49 [ .... remaining output snipped .... ]
50 50
51 51
522. Enabling Events 523. Enabling Events
53================== 53==================
54 54
552.1 System-Wide Event Enabling 553.1 System-Wide Event Enabling
56------------------------------ 56------------------------------
57 57
58See Documentation/trace/events.txt for a proper description on how events 58See Documentation/trace/events.txt for a proper description on how events
59can be enabled system-wide. A short example of enabling all events related 59can be enabled system-wide. A short example of enabling all events related
60to page allocation would look something like 60to page allocation would look something like:
61 61
62 $ for i in `find /sys/kernel/debug/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done 62 $ for i in `find /sys/kernel/debug/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done
63 63
642.2 System-Wide Event Enabling with SystemTap 643.2 System-Wide Event Enabling with SystemTap
65--------------------------------------------- 65---------------------------------------------
66 66
67In SystemTap, tracepoints are accessible using the kernel.trace() function 67In SystemTap, tracepoints are accessible using the kernel.trace() function
@@ -86,7 +86,7 @@ were allocating the pages.
86 print_count() 86 print_count()
87 } 87 }
88 88
892.3 System-Wide Event Enabling with PCL 893.3 System-Wide Event Enabling with PCL
90--------------------------------------- 90---------------------------------------
91 91
92By specifying the -a switch and analysing sleep, the system-wide events 92By specifying the -a switch and analysing sleep, the system-wide events
@@ -107,16 +107,16 @@ for a duration of time can be examined.
107Similarly, one could execute a shell and exit it as desired to get a report 107Similarly, one could execute a shell and exit it as desired to get a report
108at that point. 108at that point.
109 109
1102.4 Local Event Enabling 1103.4 Local Event Enabling
111------------------------ 111------------------------
112 112
113Documentation/trace/ftrace.txt describes how to enable events on a per-thread 113Documentation/trace/ftrace.txt describes how to enable events on a per-thread
114basis using set_ftrace_pid. 114basis using set_ftrace_pid.
115 115
1162.5 Local Event Enablement with PCL 1163.5 Local Event Enablement with PCL
117----------------------------------- 117-----------------------------------
118 118
119Events can be activate and tracked for the duration of a process on a local 119Events can be activated and tracked for the duration of a process on a local
120basis using PCL such as follows. 120basis using PCL such as follows.
121 121
122 $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ 122 $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \
@@ -131,18 +131,18 @@ basis using PCL such as follows.
131 131
132 0.973913387 seconds time elapsed 132 0.973913387 seconds time elapsed
133 133
1343. Event Filtering 1344. Event Filtering
135================== 135==================
136 136
137Documentation/trace/ftrace.txt covers in-depth how to filter events in 137Documentation/trace/ftrace.txt covers in-depth how to filter events in
138ftrace. Obviously using grep and awk of trace_pipe is an option as well 138ftrace. Obviously using grep and awk of trace_pipe is an option as well
139as any script reading trace_pipe. 139as any script reading trace_pipe.
140 140
1414. Analysing Event Variances with PCL 1415. Analysing Event Variances with PCL
142===================================== 142=====================================
143 143
144Any workload can exhibit variances between runs and it can be important 144Any workload can exhibit variances between runs and it can be important
145to know what the standard deviation in. By and large, this is left to the 145to know what the standard deviation is. By and large, this is left to the
146performance analyst to do it by hand. In the event that the discrete event 146performance analyst to do it by hand. In the event that the discrete event
147occurrences are useful to the performance analyst, then perf can be used. 147occurrences are useful to the performance analyst, then perf can be used.
148 148
@@ -166,7 +166,7 @@ In the event that some higher-level event is required that depends on some
166aggregation of discrete events, then a script would need to be developed. 166aggregation of discrete events, then a script would need to be developed.
167 167
168Using --repeat, it is also possible to view how events are fluctuating over 168Using --repeat, it is also possible to view how events are fluctuating over
169time on a system wide basis using -a and sleep. 169time on a system-wide basis using -a and sleep.
170 170
171 $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ 171 $ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \
172 -e kmem:mm_pagevec_free \ 172 -e kmem:mm_pagevec_free \
@@ -180,7 +180,7 @@ time on a system wide basis using -a and sleep.
180 180
181 1.002251757 seconds time elapsed ( +- 0.005% ) 181 1.002251757 seconds time elapsed ( +- 0.005% )
182 182
1835. Higher-Level Analysis with Helper Scripts 1836. Higher-Level Analysis with Helper Scripts
184============================================ 184============================================
185 185
186When events are enabled the events that are triggering can be read from 186When events are enabled the events that are triggering can be read from
@@ -190,11 +190,11 @@ be gathered on-line as appropriate. Examples of post-processing might include
190 190
191 o Reading information from /proc for the PID that triggered the event 191 o Reading information from /proc for the PID that triggered the event
192 o Deriving a higher-level event from a series of lower-level events. 192 o Deriving a higher-level event from a series of lower-level events.
193 o Calculate latencies between two events 193 o Calculating latencies between two events
194 194
195Documentation/trace/postprocess/trace-pagealloc-postprocess.pl is an example 195Documentation/trace/postprocess/trace-pagealloc-postprocess.pl is an example
196script that can read trace_pipe from STDIN or a copy of a trace. When used 196script that can read trace_pipe from STDIN or a copy of a trace. When used
197on-line, it can be interrupted once to generate a report without existing 197on-line, it can be interrupted once to generate a report without exiting
198and twice to exit. 198and twice to exit.
199 199
200Simplistically, the script just reads STDIN and counts up events but it 200Simplistically, the script just reads STDIN and counts up events but it
@@ -212,12 +212,12 @@ also can do more such as
212 processes, the parent process responsible for creating all the helpers 212 processes, the parent process responsible for creating all the helpers
213 can be identified 213 can be identified
214 214
2156. Lower-Level Analysis with PCL 2157. Lower-Level Analysis with PCL
216================================ 216================================
217 217
218There may also be a requirement to identify what functions with a program 218There may also be a requirement to identify what functions within a program
219were generating events within the kernel. To begin this sort of analysis, the 219were generating events within the kernel. To begin this sort of analysis, the
220data must be recorded. At the time of writing, this required root 220data must be recorded. At the time of writing, this required root:
221 221
222 $ perf record -c 1 \ 222 $ perf record -c 1 \
223 -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ 223 -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \
@@ -253,11 +253,11 @@ perf report.
253 # (For more details, try: perf report --sort comm,dso,symbol) 253 # (For more details, try: perf report --sort comm,dso,symbol)
254 # 254 #
255 255
256According to this, the vast majority of events occured triggered on events 256According to this, the vast majority of events triggered on events
257within the VDSO. With simple binaries, this will often be the case so lets 257within the VDSO. With simple binaries, this will often be the case so let's
258take a slightly different example. In the course of writing this, it was 258take a slightly different example. In the course of writing this, it was
259noticed that X was generating an insane amount of page allocations so lets look 259noticed that X was generating an insane amount of page allocations so let's look
260at it 260at it:
261 261
262 $ perf record -c 1 -f \ 262 $ perf record -c 1 -f \
263 -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \ 263 -e kmem:mm_page_alloc -e kmem:mm_page_free_direct \
@@ -280,8 +280,8 @@ This was interrupted after a few seconds and
280 # (For more details, try: perf report --sort comm,dso,symbol) 280 # (For more details, try: perf report --sort comm,dso,symbol)
281 # 281 #
282 282
283So, almost half of the events are occuring in a library. To get an idea which 283So, almost half of the events are occurring in a library. To get an idea which
284symbol. 284symbol:
285 285
286 $ perf report --sort comm,dso,symbol 286 $ perf report --sort comm,dso,symbol
287 # Samples: 27666 287 # Samples: 27666
@@ -297,7 +297,7 @@ symbol.
297 0.01% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] get_fast_path 297 0.01% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] get_fast_path
298 0.00% Xorg [kernel] [k] ftrace_trace_userstack 298 0.00% Xorg [kernel] [k] ftrace_trace_userstack
299 299
300To see where within the function pixmanFillsse2 things are going wrong 300To see where within the function pixmanFillsse2 things are going wrong:
301 301
302 $ perf annotate pixmanFillsse2 302 $ perf annotate pixmanFillsse2
303 [ ... ] 303 [ ... ]
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt
index c7c1dc2f8017..3bf6818c8cf5 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/usb/power-management.txt
@@ -71,12 +71,10 @@ being accessed through sysfs, then it definitely is idle.
71 Forms of dynamic PM 71 Forms of dynamic PM
72 ------------------- 72 -------------------
73 73
74Dynamic suspends can occur in two ways: manual and automatic. 74Dynamic suspends occur when the kernel decides to suspend an idle
75"Manual" means that the user has told the kernel to suspend a device, 75device. This is called "autosuspend" for short. In general, a device
76whereas "automatic" means that the kernel has decided all by itself to 76won't be autosuspended unless it has been idle for some minimum period
77suspend a device. Automatic suspend is called "autosuspend" for 77of time, the so-called idle-delay time.
78short. In general, a device won't be autosuspended unless it has been
79idle for some minimum period of time, the so-called idle-delay time.
80 78
81Of course, nothing the kernel does on its own initiative should 79Of course, nothing the kernel does on its own initiative should
82prevent the computer or its devices from working properly. If a 80prevent the computer or its devices from working properly. If a
@@ -96,10 +94,11 @@ idle.
96We can categorize power management events in two broad classes: 94We can categorize power management events in two broad classes:
97external and internal. External events are those triggered by some 95external and internal. External events are those triggered by some
98agent outside the USB stack: system suspend/resume (triggered by 96agent outside the USB stack: system suspend/resume (triggered by
99userspace), manual dynamic suspend/resume (also triggered by 97userspace), manual dynamic resume (also triggered by userspace), and
100userspace), and remote wakeup (triggered by the device). Internal 98remote wakeup (triggered by the device). Internal events are those
101events are those triggered within the USB stack: autosuspend and 99triggered within the USB stack: autosuspend and autoresume. Note that
102autoresume. 100all dynamic suspend events are internal; external agents are not
101allowed to issue dynamic suspends.
103 102
104 103
105 The user interface for dynamic PM 104 The user interface for dynamic PM
@@ -145,9 +144,9 @@ relevant attribute files are: wakeup, level, and autosuspend.
145 number of seconds the device should remain idle before 144 number of seconds the device should remain idle before
146 the kernel will autosuspend it (the idle-delay time). 145 the kernel will autosuspend it (the idle-delay time).
147 The default is 2. 0 means to autosuspend as soon as 146 The default is 2. 0 means to autosuspend as soon as
148 the device becomes idle, and -1 means never to 147 the device becomes idle, and negative values mean
149 autosuspend. You can write a number to the file to 148 never to autosuspend. You can write a number to the
150 change the autosuspend idle-delay time. 149 file to change the autosuspend idle-delay time.
151 150
152Writing "-1" to power/autosuspend and writing "on" to power/level do 151Writing "-1" to power/autosuspend and writing "on" to power/level do
153essentially the same thing -- they both prevent the device from being 152essentially the same thing -- they both prevent the device from being
@@ -377,9 +376,9 @@ the device hasn't been idle for long enough, a delayed workqueue
377routine is automatically set up to carry out the operation when the 376routine is automatically set up to carry out the operation when the
378autosuspend idle-delay has expired. 377autosuspend idle-delay has expired.
379 378
380Autoresume attempts also can fail. This will happen if power/level is 379Autoresume attempts also can fail, although failure would mean that
381set to "suspend" or if the device doesn't manage to resume properly. 380the device is no longer present or operating properly. Unlike
382Unlike autosuspend, there's no delay for an autoresume. 381autosuspend, there's no delay for an autoresume.
383 382
384 383
385 Other parts of the driver interface 384 Other parts of the driver interface
@@ -527,13 +526,3 @@ succeed, it may still remain active and thus cause the system to
527resume as soon as the system suspend is complete. Or the remote 526resume as soon as the system suspend is complete. Or the remote
528wakeup may fail and get lost. Which outcome occurs depends on timing 527wakeup may fail and get lost. Which outcome occurs depends on timing
529and on the hardware and firmware design. 528and on the hardware and firmware design.
530
531More interestingly, a device might undergo a manual resume or
532autoresume during system suspend. With current kernels this shouldn't
533happen, because manual resumes must be initiated by userspace and
534autoresumes happen in response to I/O requests, but all user processes
535and I/O should be quiescent during a system suspend -- thanks to the
536freezer. However there are plans to do away with the freezer, which
537would mean these things would become possible. If and when this comes
538about, the USB core will carefully arrange matters so that either type
539of resume will block until the entire system has resumed.
diff --git a/Documentation/vgaarbiter.txt b/Documentation/vgaarbiter.txt
index 987f9b0a5ece..43a9b0694fdd 100644
--- a/Documentation/vgaarbiter.txt
+++ b/Documentation/vgaarbiter.txt
@@ -103,7 +103,7 @@ I.2 libpciaccess
103---------------- 103----------------
104 104
105To use the vga arbiter char device it was implemented an API inside the 105To use the vga arbiter char device it was implemented an API inside the
106libpciaccess library. One fieldd was added to struct pci_device (each device 106libpciaccess library. One field was added to struct pci_device (each device
107on the system): 107on the system):
108 108
109 /* the type of resource decoded by the device */ 109 /* the type of resource decoded by the device */
diff --git a/Kbuild b/Kbuild
index f056b4feee51..e3737ad72b5a 100644
--- a/Kbuild
+++ b/Kbuild
@@ -8,7 +8,7 @@
8##### 8#####
9# 1) Generate bounds.h 9# 1) Generate bounds.h
10 10
11bounds-file := include/linux/bounds.h 11bounds-file := include/generated/bounds.h
12 12
13always := $(bounds-file) 13always := $(bounds-file)
14targets := $(bounds-file) kernel/bounds.s 14targets := $(bounds-file) kernel/bounds.s
@@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
43# 2) Generate asm-offsets.h 43# 2) Generate asm-offsets.h
44# 44#
45 45
46offsets-file := include/asm/asm-offsets.h 46offsets-file := include/generated/asm-offsets.h
47 47
48always += $(offsets-file) 48always += $(offsets-file)
49targets += $(offsets-file) 49targets += $(offsets-file)
diff --git a/MAINTAINERS b/MAINTAINERS
index 0699782f8c5b..c8f47bf154f4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1402,6 +1402,8 @@ L: linux-usb@vger.kernel.org
1402S: Supported 1402S: Supported
1403F: Documentation/usb/WUSB-Design-overview.txt 1403F: Documentation/usb/WUSB-Design-overview.txt
1404F: Documentation/usb/wusb-cbaf 1404F: Documentation/usb/wusb-cbaf
1405F: drivers/usb/host/hwa-hc.c
1406F: drivers/usb/host/whci/
1405F: drivers/usb/wusbcore/ 1407F: drivers/usb/wusbcore/
1406F: include/linux/usb/wusb* 1408F: include/linux/usb/wusb*
1407 1409
@@ -1470,6 +1472,12 @@ L: linux-scsi@vger.kernel.org
1470S: Supported 1472S: Supported
1471F: drivers/scsi/fnic/ 1473F: drivers/scsi/fnic/
1472 1474
1475CMPC ACPI DRIVER
1476M: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
1477M: Daniel Oliveira Nascimento <don@syst.com.br>
1478S: Supported
1479F: drivers/platform/x86/classmate-laptop.c
1480
1473CODA FILE SYSTEM 1481CODA FILE SYSTEM
1474M: Jan Harkes <jaharkes@cs.cmu.edu> 1482M: Jan Harkes <jaharkes@cs.cmu.edu>
1475M: coda@cs.cmu.edu 1483M: coda@cs.cmu.edu
@@ -2161,10 +2169,9 @@ F: drivers/hwmon/f75375s.c
2161F: include/linux/f75375s.h 2169F: include/linux/f75375s.h
2162 2170
2163FIREWIRE SUBSYSTEM 2171FIREWIRE SUBSYSTEM
2164M: Kristian Hoegsberg <krh@redhat.com>
2165M: Stefan Richter <stefanr@s5r6.in-berlin.de> 2172M: Stefan Richter <stefanr@s5r6.in-berlin.de>
2166L: linux1394-devel@lists.sourceforge.net 2173L: linux1394-devel@lists.sourceforge.net
2167W: http://www.linux1394.org/ 2174W: http://ieee1394.wiki.kernel.org/
2168T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git 2175T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
2169S: Maintained 2176S: Maintained
2170F: drivers/firewire/ 2177F: drivers/firewire/
@@ -2697,22 +2704,14 @@ S: Supported
2697F: drivers/idle/i7300_idle.c 2704F: drivers/idle/i7300_idle.c
2698 2705
2699IEEE 1394 SUBSYSTEM 2706IEEE 1394 SUBSYSTEM
2700M: Ben Collins <ben.collins@ubuntu.com>
2701M: Stefan Richter <stefanr@s5r6.in-berlin.de> 2707M: Stefan Richter <stefanr@s5r6.in-berlin.de>
2702L: linux1394-devel@lists.sourceforge.net 2708L: linux1394-devel@lists.sourceforge.net
2703W: http://www.linux1394.org/ 2709W: http://ieee1394.wiki.kernel.org/
2704T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git 2710T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
2705S: Maintained 2711S: Obsolete
2706F: Documentation/debugging-via-ohci1394.txt 2712F: Documentation/debugging-via-ohci1394.txt
2707F: drivers/ieee1394/ 2713F: drivers/ieee1394/
2708 2714
2709IEEE 1394 RAW I/O DRIVER
2710M: Dan Dennedy <dan@dennedy.org>
2711M: Stefan Richter <stefanr@s5r6.in-berlin.de>
2712L: linux1394-devel@lists.sourceforge.net
2713S: Maintained
2714F: drivers/ieee1394/raw1394*
2715
2716IEEE 802.15.4 SUBSYSTEM 2715IEEE 802.15.4 SUBSYSTEM
2717M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 2716M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2718M: Sergey Lapin <slapin@ossfans.org> 2717M: Sergey Lapin <slapin@ossfans.org>
@@ -3644,6 +3643,11 @@ W: http://0pointer.de/lennart/tchibo.html
3644S: Maintained 3643S: Maintained
3645F: drivers/platform/x86/msi-laptop.c 3644F: drivers/platform/x86/msi-laptop.c
3646 3645
3646MSI WMI SUPPORT
3647M: Anisse Astier <anisse@astier.eu>
3648S: Supported
3649F: drivers/platform/x86/msi-wmi.c
3650
3647MULTIFUNCTION DEVICES (MFD) 3651MULTIFUNCTION DEVICES (MFD)
3648M: Samuel Ortiz <sameo@linux.intel.com> 3652M: Samuel Ortiz <sameo@linux.intel.com>
3649T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git 3653T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git
@@ -3677,7 +3681,7 @@ F: include/linux/isicom.h
3677MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER 3681MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
3678M: Felipe Balbi <felipe.balbi@nokia.com> 3682M: Felipe Balbi <felipe.balbi@nokia.com>
3679L: linux-usb@vger.kernel.org 3683L: linux-usb@vger.kernel.org
3680T: git git://gitorious.org/musb/mainline.git 3684T: git git://gitorious.org/usb/usb.git
3681S: Maintained 3685S: Maintained
3682F: drivers/usb/musb/ 3686F: drivers/usb/musb/
3683 3687
@@ -3869,7 +3873,7 @@ F: drivers/net/ni5010.*
3869 3873
3870NILFS2 FILESYSTEM 3874NILFS2 FILESYSTEM
3871M: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp> 3875M: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
3872L: users@nilfs.org 3876L: linux-nilfs@vger.kernel.org
3873W: http://www.nilfs.org/en/ 3877W: http://www.nilfs.org/en/
3874S: Supported 3878S: Supported
3875F: Documentation/filesystems/nilfs2.txt 3879F: Documentation/filesystems/nilfs2.txt
@@ -3936,29 +3940,20 @@ S: Maintained
3936F: sound/soc/omap/ 3940F: sound/soc/omap/
3937 3941
3938OMAP FRAMEBUFFER SUPPORT 3942OMAP FRAMEBUFFER SUPPORT
3939M: Imre Deak <imre.deak@nokia.com> 3943M: Tomi Valkeinen <tomi.valkeinen@nokia.com>
3940L: linux-fbdev@vger.kernel.org 3944L: linux-fbdev@vger.kernel.org
3941L: linux-omap@vger.kernel.org 3945L: linux-omap@vger.kernel.org
3942S: Maintained 3946S: Maintained
3943F: drivers/video/omap/ 3947F: drivers/video/omap/
3944 3948
3945OMAP DISPLAY SUBSYSTEM SUPPORT (DSS2) 3949OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2)
3946M: Tomi Valkeinen <tomi.valkeinen@nokia.com> 3950M: Tomi Valkeinen <tomi.valkeinen@nokia.com>
3947L: linux-omap@vger.kernel.org 3951L: linux-omap@vger.kernel.org
3948L: linux-fbdev@vger.kernel.org (moderated for non-subscribers) 3952L: linux-fbdev@vger.kernel.org
3949S: Maintained 3953S: Maintained
3950F: drivers/video/omap2/dss/ 3954F: drivers/video/omap2/
3951F: drivers/video/omap2/vrfb.c
3952F: drivers/video/omap2/vram.c
3953F: Documentation/arm/OMAP/DSS 3955F: Documentation/arm/OMAP/DSS
3954 3956
3955OMAP FRAMEBUFFER SUPPORT (FOR DSS2)
3956M: Tomi Valkeinen <tomi.valkeinen@nokia.com>
3957L: linux-omap@vger.kernel.org
3958L: linux-fbdev@vger.kernel.org (moderated for non-subscribers)
3959S: Maintained
3960F: drivers/video/omap2/omapfb/
3961
3962OMAP MMC SUPPORT 3957OMAP MMC SUPPORT
3963M: Jarkko Lavinen <jarkko.lavinen@nokia.com> 3958M: Jarkko Lavinen <jarkko.lavinen@nokia.com>
3964L: linux-omap@vger.kernel.org 3959L: linux-omap@vger.kernel.org
@@ -5430,10 +5425,19 @@ ULTRA-WIDEBAND (UWB) SUBSYSTEM:
5430M: David Vrabel <david.vrabel@csr.com> 5425M: David Vrabel <david.vrabel@csr.com>
5431L: linux-usb@vger.kernel.org 5426L: linux-usb@vger.kernel.org
5432S: Supported 5427S: Supported
5433F: drivers/uwb/* 5428F: drivers/uwb/
5429X: drivers/uwb/wlp/
5430X: drivers/uwb/i1480/i1480u-wlp/
5431X: drivers/uwb/i1480/i1480-wlp.h
5434F: include/linux/uwb.h 5432F: include/linux/uwb.h
5435F: include/linux/uwb/ 5433F: include/linux/uwb/
5436 5434
5435UNIFDEF
5436M: Tony Finch <dot@dotat.at>
5437W: http://dotat.at/prog/unifdef
5438S: Maintained
5439F: scripts/unifdef.c
5440
5437UNIFORM CDROM DRIVER 5441UNIFORM CDROM DRIVER
5438M: Jens Axboe <axboe@kernel.dk> 5442M: Jens Axboe <axboe@kernel.dk>
5439W: http://www.kernel.dk 5443W: http://www.kernel.dk
@@ -5937,9 +5941,12 @@ W: http://linuxwimax.org
5937 5941
5938WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM 5942WIMEDIA LLC PROTOCOL (WLP) SUBSYSTEM
5939M: David Vrabel <david.vrabel@csr.com> 5943M: David Vrabel <david.vrabel@csr.com>
5944L: netdev@vger.kernel.org
5940S: Maintained 5945S: Maintained
5941F: include/linux/wlp.h 5946F: include/linux/wlp.h
5942F: drivers/uwb/wlp/ 5947F: drivers/uwb/wlp/
5948F: drivers/uwb/i1480/i1480u-wlp/
5949F: drivers/uwb/i1480/i1480-wlp.h
5943 5950
5944WISTRON LAPTOP BUTTON DRIVER 5951WISTRON LAPTOP BUTTON DRIVER
5945M: Miloslav Trmac <mitr@volny.cz> 5952M: Miloslav Trmac <mitr@volny.cz>
diff --git a/Makefile b/Makefile
index 33d4732a6c4a..9f64552f09d6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 32 3SUBLEVEL = 33
4EXTRAVERSION = 4EXTRAVERSION = -rc4
5NAME = Man-Eating Seals of Antiquity 5NAME = Man-Eating Seals of Antiquity
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -16,6 +16,13 @@ NAME = Man-Eating Seals of Antiquity
16# o print "Entering directory ..."; 16# o print "Entering directory ...";
17MAKEFLAGS += -rR --no-print-directory 17MAKEFLAGS += -rR --no-print-directory
18 18
19# Avoid funny character set dependencies
20unexport LC_ALL
21LC_CTYPE=C
22LC_COLLATE=C
23LC_NUMERIC=C
24export LC_CTYPE LC_COLLATE LC_NUMERIC
25
19# We are using a recursive build, so we need to do a little thinking 26# We are using a recursive build, so we need to do a little thinking
20# to get the ordering right. 27# to get the ordering right.
21# 28#
@@ -334,10 +341,9 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
334 341
335# Use LINUXINCLUDE when you must reference the include/ directory. 342# Use LINUXINCLUDE when you must reference the include/ directory.
336# Needed to be compatible with the O= option 343# Needed to be compatible with the O= option
337LINUXINCLUDE := -Iinclude \ 344LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \
338 $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ 345 $(if $(KBUILD_SRC), -I$(srctree)/include) \
339 -I$(srctree)/arch/$(hdr-arch)/include \ 346 -include include/generated/autoconf.h
340 -include include/linux/autoconf.h
341 347
342KBUILD_CPPFLAGS := -D__KERNEL__ 348KBUILD_CPPFLAGS := -D__KERNEL__
343 349
@@ -465,7 +471,7 @@ ifeq ($(KBUILD_EXTMOD),)
465# Carefully list dependencies so we do not try to build scripts twice 471# Carefully list dependencies so we do not try to build scripts twice
466# in parallel 472# in parallel
467PHONY += scripts 473PHONY += scripts
468scripts: scripts_basic include/config/auto.conf 474scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
469 $(Q)$(MAKE) $(build)=$(@) 475 $(Q)$(MAKE) $(build)=$(@)
470 476
471# Objects we will link into vmlinux / subdirs we need to visit 477# Objects we will link into vmlinux / subdirs we need to visit
@@ -492,18 +498,18 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
492# with it and forgot to run make oldconfig. 498# with it and forgot to run make oldconfig.
493# if auto.conf.cmd is missing then we are probably in a cleaned tree so 499# if auto.conf.cmd is missing then we are probably in a cleaned tree so
494# we execute the config step to be sure to catch updated Kconfig files 500# we execute the config step to be sure to catch updated Kconfig files
495include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd 501include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
496 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig 502 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
497else 503else
498# external modules needs include/linux/autoconf.h and include/config/auto.conf 504# external modules needs include/generated/autoconf.h and include/config/auto.conf
499# but do not care if they are up-to-date. Use auto.conf to trigger the test 505# but do not care if they are up-to-date. Use auto.conf to trigger the test
500PHONY += include/config/auto.conf 506PHONY += include/config/auto.conf
501 507
502include/config/auto.conf: 508include/config/auto.conf:
503 $(Q)test -e include/linux/autoconf.h -a -e $@ || ( \ 509 $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
504 echo; \ 510 echo; \
505 echo " ERROR: Kernel configuration is invalid."; \ 511 echo " ERROR: Kernel configuration is invalid."; \
506 echo " include/linux/autoconf.h or $@ are missing."; \ 512 echo " include/generated/autoconf.h or $@ are missing.";\
507 echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ 513 echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
508 echo; \ 514 echo; \
509 /bin/false) 515 /bin/false)
@@ -877,6 +883,9 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
877PHONY += $(vmlinux-dirs) 883PHONY += $(vmlinux-dirs)
878$(vmlinux-dirs): prepare scripts 884$(vmlinux-dirs): prepare scripts
879 $(Q)$(MAKE) $(build)=$@ 885 $(Q)$(MAKE) $(build)=$@
886ifdef CONFIG_MODULES
887 $(Q)$(MAKE) $(modbuiltin)=$@
888endif
880 889
881# Build the kernel release string 890# Build the kernel release string
882# 891#
@@ -955,7 +964,6 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
955# prepare3 is used to check if we are building in a separate output directory, 964# prepare3 is used to check if we are building in a separate output directory,
956# and if so do: 965# and if so do:
957# 1) Check that make has not been executed in the kernel src $(srctree) 966# 1) Check that make has not been executed in the kernel src $(srctree)
958# 2) Create the include2 directory, used for the second asm symlink
959prepare3: include/config/kernel.release 967prepare3: include/config/kernel.release
960ifneq ($(KBUILD_SRC),) 968ifneq ($(KBUILD_SRC),)
961 @$(kecho) ' Using $(srctree) as source for kernel' 969 @$(kecho) ' Using $(srctree) as source for kernel'
@@ -964,17 +972,13 @@ ifneq ($(KBUILD_SRC),)
964 echo " in the '$(srctree)' directory.";\ 972 echo " in the '$(srctree)' directory.";\
965 /bin/false; \ 973 /bin/false; \
966 fi; 974 fi;
967 $(Q)if [ ! -d include2 ]; then \
968 mkdir -p include2; \
969 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
970 fi
971endif 975endif
972 976
973# prepare2 creates a makefile if using a separate output directory 977# prepare2 creates a makefile if using a separate output directory
974prepare2: prepare3 outputmakefile 978prepare2: prepare3 outputmakefile
975 979
976prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ 980prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
977 include/asm include/config/auto.conf 981 include/config/auto.conf
978 $(cmd_crmodverdir) 982 $(cmd_crmodverdir)
979 983
980archprepare: prepare1 scripts_basic 984archprepare: prepare1 scripts_basic
@@ -986,42 +990,6 @@ prepare0: archprepare FORCE
986# All the preparing.. 990# All the preparing..
987prepare: prepare0 991prepare: prepare0
988 992
989# The asm symlink changes when $(ARCH) changes.
990# Detect this and ask user to run make mrproper
991# If asm is a stale symlink (point to dir that does not exist) remove it
992define check-symlink
993 set -e; \
994 if [ -L include/asm ]; then \
995 asmlink=`readlink include/asm | cut -d '-' -f 2`; \
996 if [ "$$asmlink" != "$(SRCARCH)" ]; then \
997 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
998 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
999 exit 1; \
1000 fi; \
1001 test -e $$asmlink || rm include/asm; \
1002 elif [ -d include/asm ]; then \
1003 echo "ERROR: $@ is a directory but a symlink was expected";\
1004 exit 1; \
1005 fi
1006endef
1007
1008# We create the target directory of the symlink if it does
1009# not exist so the test in check-symlink works and we have a
1010# directory for generated filesas used by some architectures.
1011define create-symlink
1012 if [ ! -L include/asm ]; then \
1013 $(kecho) ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
1014 if [ ! -d include/asm-$(SRCARCH) ]; then \
1015 mkdir -p include/asm-$(SRCARCH); \
1016 fi; \
1017 ln -fsn asm-$(SRCARCH) $@; \
1018 fi
1019endef
1020
1021include/asm: FORCE
1022 $(Q)$(check-symlink)
1023 $(Q)$(create-symlink)
1024
1025# Generate some files 993# Generate some files
1026# --------------------------------------------------------------------------- 994# ---------------------------------------------------------------------------
1027 995
@@ -1046,7 +1014,7 @@ endef
1046include/linux/version.h: $(srctree)/Makefile FORCE 1014include/linux/version.h: $(srctree)/Makefile FORCE
1047 $(call filechk,version.h) 1015 $(call filechk,version.h)
1048 1016
1049include/linux/utsrelease.h: include/config/kernel.release FORCE 1017include/generated/utsrelease.h: include/config/kernel.release FORCE
1050 $(call filechk,utsrelease.h) 1018 $(call filechk,utsrelease.h)
1051 1019
1052PHONY += headerdep 1020PHONY += headerdep
@@ -1076,11 +1044,6 @@ firmware_install: FORCE
1076export INSTALL_HDR_PATH = $(objtree)/usr 1044export INSTALL_HDR_PATH = $(objtree)/usr
1077 1045
1078hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj 1046hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
1079# Find out where the Kbuild file is located to support
1080# arch/$(ARCH)/include/asm
1081hdr-dir = $(strip \
1082 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
1083 arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
1084 1047
1085# If we do an all arch process set dst to asm-$(hdr-arch) 1048# If we do an all arch process set dst to asm-$(hdr-arch)
1086hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) 1049hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
@@ -1095,10 +1058,10 @@ headers_install_all:
1095 1058
1096PHONY += headers_install 1059PHONY += headers_install
1097headers_install: __headers 1060headers_install: __headers
1098 $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \ 1061 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \
1099 $(error Headers not exportable for the $(SRCARCH) architecture)) 1062 $(error Headers not exportable for the $(SRCARCH) architecture))
1100 $(Q)$(MAKE) $(hdr-inst)=include 1063 $(Q)$(MAKE) $(hdr-inst)=include
1101 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) 1064 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst)
1102 1065
1103PHONY += headers_check_all 1066PHONY += headers_check_all
1104headers_check_all: headers_install_all 1067headers_check_all: headers_install_all
@@ -1107,7 +1070,7 @@ headers_check_all: headers_install_all
1107PHONY += headers_check 1070PHONY += headers_check
1108headers_check: headers_install 1071headers_check: headers_install
1109 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 1072 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
1110 $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1 1073 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1
1111 1074
1112# --------------------------------------------------------------------------- 1075# ---------------------------------------------------------------------------
1113# Modules 1076# Modules
@@ -1127,6 +1090,7 @@ all: modules
1127PHONY += modules 1090PHONY += modules
1128modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) 1091modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
1129 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order 1092 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
1093 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.builtin) > $(objtree)/modules.builtin
1130 @$(kecho) ' Building modules, stage 2.'; 1094 @$(kecho) ' Building modules, stage 2.';
1131 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1095 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1132 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild 1096 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
@@ -1156,6 +1120,7 @@ _modinst_:
1156 ln -s $(objtree) $(MODLIB)/build ; \ 1120 ln -s $(objtree) $(MODLIB)/build ; \
1157 fi 1121 fi
1158 @cp -f $(objtree)/modules.order $(MODLIB)/ 1122 @cp -f $(objtree)/modules.order $(MODLIB)/
1123 @cp -f $(objtree)/modules.builtin $(MODLIB)/
1159 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1124 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1160 1125
1161# This depmod is only for convenience to give the initial 1126# This depmod is only for convenience to give the initial
@@ -1194,12 +1159,10 @@ CLEAN_FILES += vmlinux System.map \
1194 .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map 1159 .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
1195 1160
1196# Directories & files removed with 'make mrproper' 1161# Directories & files removed with 'make mrproper'
1197MRPROPER_DIRS += include/config include2 usr/include include/generated 1162MRPROPER_DIRS += include/config usr/include include/generated
1198MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 1163MRPROPER_FILES += .config .config.old .version .old_version \
1199 include/linux/autoconf.h include/linux/version.h \ 1164 include/linux/version.h \
1200 include/linux/utsrelease.h \ 1165 Module.symvers tags TAGS cscope*
1201 include/linux/bounds.h include/asm*/asm-offsets.h \
1202 Module.symvers Module.markers tags TAGS cscope*
1203 1166
1204# clean - Delete most, but leave enough to build external modules 1167# clean - Delete most, but leave enough to build external modules
1205# 1168#
@@ -1218,7 +1181,7 @@ clean: archclean $(clean-dirs)
1218 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1181 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1219 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1182 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1220 -o -name '*.symtypes' -o -name 'modules.order' \ 1183 -o -name '*.symtypes' -o -name 'modules.order' \
1221 -o -name 'Module.markers' -o -name '.tmp_*.o.*' \ 1184 -o -name modules.builtin -o -name '.tmp_*.o.*' \
1222 -o -name '*.gcno' \) -type f -print | xargs rm -f 1185 -o -name '*.gcno' \) -type f -print | xargs rm -f
1223 1186
1224# mrproper - Delete all generated files, including .config 1187# mrproper - Delete all generated files, including .config
@@ -1416,8 +1379,8 @@ $(clean-dirs):
1416 1379
1417clean: rm-dirs := $(MODVERDIR) 1380clean: rm-dirs := $(MODVERDIR)
1418clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \ 1381clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \
1419 $(KBUILD_EXTMOD)/Module.markers \ 1382 $(KBUILD_EXTMOD)/modules.order \
1420 $(KBUILD_EXTMOD)/modules.order 1383 $(KBUILD_EXTMOD)/modules.builtin
1421clean: $(clean-dirs) 1384clean: $(clean-dirs)
1422 $(call cmd,rmdirs) 1385 $(call cmd,rmdirs)
1423 $(call cmd,rmfiles) 1386 $(call cmd,rmfiles)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 443448154f32..bd7261ea8f94 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -9,6 +9,7 @@ config ALPHA
9 select HAVE_IDE 9 select HAVE_IDE
10 select HAVE_OPROFILE 10 select HAVE_OPROFILE
11 select HAVE_SYSCALL_WRAPPERS 11 select HAVE_SYSCALL_WRAPPERS
12 select HAVE_PERF_EVENTS
12 help 13 help
13 The Alpha is a 64-bit general-purpose processor designed and 14 The Alpha is a 64-bit general-purpose processor designed and
14 marketed by the Digital Equipment Corporation of blessed memory, 15 marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/alpha/boot/bootp.c b/arch/alpha/boot/bootp.c
index 3af21c789339..3c8d1b25c661 100644
--- a/arch/alpha/boot/bootp.c
+++ b/arch/alpha/boot/bootp.c
@@ -9,7 +9,7 @@
9 */ 9 */
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/utsrelease.h> 12#include <generated/utsrelease.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14 14
15#include <asm/system.h> 15#include <asm/system.h>
diff --git a/arch/alpha/boot/bootpz.c b/arch/alpha/boot/bootpz.c
index 1036b515e20c..ade3f129dc27 100644
--- a/arch/alpha/boot/bootpz.c
+++ b/arch/alpha/boot/bootpz.c
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/utsrelease.h> 14#include <generated/utsrelease.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/system.h> 17#include <asm/system.h>
diff --git a/arch/alpha/boot/main.c b/arch/alpha/boot/main.c
index 89f3be071ae5..644b7db55438 100644
--- a/arch/alpha/boot/main.c
+++ b/arch/alpha/boot/main.c
@@ -7,7 +7,7 @@
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/utsrelease.h> 10#include <generated/utsrelease.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12 12
13#include <asm/system.h> 13#include <asm/system.h>
diff --git a/arch/alpha/include/asm/asm-offsets.h b/arch/alpha/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/alpha/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/alpha/include/asm/bug.h b/arch/alpha/include/asm/bug.h
index 1720c8ad86fe..f091682e3cc8 100644
--- a/arch/alpha/include/asm/bug.h
+++ b/arch/alpha/include/asm/bug.h
@@ -13,7 +13,8 @@
13 "call_pal %0 # bugchk\n\t" \ 13 "call_pal %0 # bugchk\n\t" \
14 ".long %1\n\t.8byte %2" \ 14 ".long %1\n\t.8byte %2" \
15 : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \ 15 : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__)); \
16 for ( ; ; ); } while (0) 16 unreachable(); \
17 } while (0)
17 18
18#define HAVE_ARCH_BUG 19#define HAVE_ARCH_BUG
19#endif 20#endif
diff --git a/arch/alpha/include/asm/fcntl.h b/arch/alpha/include/asm/fcntl.h
index 21b1117a0c61..70145cbb21cb 100644
--- a/arch/alpha/include/asm/fcntl.h
+++ b/arch/alpha/include/asm/fcntl.h
@@ -16,7 +16,7 @@
16#define O_NOATIME 04000000 16#define O_NOATIME 04000000
17#define O_CLOEXEC 010000000 /* set close_on_exec */ 17#define O_CLOEXEC 010000000 /* set close_on_exec */
18/* 18/*
19 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using 19 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
20 * the O_SYNC flag. We continue to use the existing numerical value 20 * the O_SYNC flag. We continue to use the existing numerical value
21 * for O_DSYNC semantics now, but using the correct symbolic name for it. 21 * for O_DSYNC semantics now, but using the correct symbolic name for it.
22 * This new value is used to request true Posix O_SYNC semantics. It is 22 * This new value is used to request true Posix O_SYNC semantics. It is
diff --git a/arch/alpha/include/asm/perf_event.h b/arch/alpha/include/asm/perf_event.h
new file mode 100644
index 000000000000..3bef8522017c
--- /dev/null
+++ b/arch/alpha/include/asm/perf_event.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_ALPHA_PERF_EVENT_H
2#define __ASM_ALPHA_PERF_EVENT_H
3
4/* Alpha only supports software events through this interface. */
5static inline void set_perf_event_pending(void) { }
6
7#define PERF_EVENT_INDEX_OFFSET 0
8
9#endif /* __ASM_ALPHA_PERF_EVENT_H */
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 7f23665122df..804e5311c841 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -247,6 +247,7 @@
247#define __IGNORE_pause 247#define __IGNORE_pause
248#define __IGNORE_time 248#define __IGNORE_time
249#define __IGNORE_utime 249#define __IGNORE_utime
250#define __IGNORE_umount2
250 251
251/* 252/*
252 * Linux-specific system calls begin at 300 253 * Linux-specific system calls begin at 300
@@ -434,10 +435,24 @@
434#define __NR_timerfd 477 435#define __NR_timerfd 477
435#define __NR_eventfd 478 436#define __NR_eventfd 478
436#define __NR_recvmmsg 479 437#define __NR_recvmmsg 479
438#define __NR_fallocate 480
439#define __NR_timerfd_create 481
440#define __NR_timerfd_settime 482
441#define __NR_timerfd_gettime 483
442#define __NR_signalfd4 484
443#define __NR_eventfd2 485
444#define __NR_epoll_create1 486
445#define __NR_dup3 487
446#define __NR_pipe2 488
447#define __NR_inotify_init1 489
448#define __NR_preadv 490
449#define __NR_pwritev 491
450#define __NR_rt_tgsigqueueinfo 492
451#define __NR_perf_event_open 493
437 452
438#ifdef __KERNEL__ 453#ifdef __KERNEL__
439 454
440#define NR_SYSCALLS 480 455#define NR_SYSCALLS 494
441 456
442#define __ARCH_WANT_IPC_PARSE_VERSION 457#define __ARCH_WANT_IPC_PARSE_VERSION
443#define __ARCH_WANT_OLD_READDIR 458#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index cda6b8b3d573..09acb786e72b 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -495,9 +495,23 @@ sys_call_table:
495 .quad sys_epoll_pwait 495 .quad sys_epoll_pwait
496 .quad sys_utimensat /* 475 */ 496 .quad sys_utimensat /* 475 */
497 .quad sys_signalfd 497 .quad sys_signalfd
498 .quad sys_ni_syscall 498 .quad sys_ni_syscall /* sys_timerfd */
499 .quad sys_eventfd 499 .quad sys_eventfd
500 .quad sys_recvmmsg 500 .quad sys_recvmmsg
501 .quad sys_fallocate /* 480 */
502 .quad sys_timerfd_create
503 .quad sys_timerfd_settime
504 .quad sys_timerfd_gettime
505 .quad sys_signalfd4
506 .quad sys_eventfd2 /* 485 */
507 .quad sys_epoll_create1
508 .quad sys_dup3
509 .quad sys_pipe2
510 .quad sys_inotify_init1
511 .quad sys_preadv /* 490 */
512 .quad sys_pwritev
513 .quad sys_rt_tgsigqueueinfo
514 .quad sys_perf_event_open
501 515
502 .size sys_call_table, . - sys_call_table 516 .size sys_call_table, . - sys_call_table
503 .type sys_call_table, @object 517 .type sys_call_table, @object
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 233a222752c0..c2238cd474c7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -18,6 +18,8 @@ config ARM
18 select HAVE_KRETPROBES if (HAVE_KPROBES) 18 select HAVE_KRETPROBES if (HAVE_KPROBES)
19 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) 19 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
20 select HAVE_GENERIC_DMA_COHERENT 20 select HAVE_GENERIC_DMA_COHERENT
21 select HAVE_KERNEL_GZIP
22 select HAVE_KERNEL_LZO
21 help 23 help
22 The ARM series is a line of low-power-consumption RISC chip designs 24 The ARM series is a line of low-power-consumption RISC chip designs
23 licensed by ARM Ltd and targeted at embedded applications and 25 licensed by ARM Ltd and targeted at embedded applications and
@@ -688,6 +690,7 @@ config ARCH_DAVINCI
688 select HAVE_IDE 690 select HAVE_IDE
689 select COMMON_CLKDEV 691 select COMMON_CLKDEV
690 select GENERIC_ALLOCATOR 692 select GENERIC_ALLOCATOR
693 select ARCH_HAS_HOLES_MEMORYMODEL
691 help 694 help
692 Support for TI's DaVinci platform. 695 Support for TI's DaVinci platform.
693 696
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index fa0cdab2e1d3..e9da08483b3c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -242,15 +242,8 @@ all: $(KBUILD_IMAGE)
242 242
243boot := arch/arm/boot 243boot := arch/arm/boot
244 244
245# Update machine arch and proc symlinks if something which affects 245archprepare:
246# them changed. We use .arch to indicate when they were updated 246 $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h
247# last, otherwise make uses the target directory mtime.
248
249archprepare: maketools
250
251PHONY += maketools FORCE
252maketools: include/linux/version.h FORCE
253 $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h
254 247
255# Convert bzImage to zImage 248# Convert bzImage to zImage
256bzImage: zImage 249bzImage: zImage
@@ -261,9 +254,6 @@ zImage Image xipImage bootpImage uImage: vmlinux
261zinstall install: vmlinux 254zinstall install: vmlinux
262 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 255 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
263 256
264CLEAN_FILES += include/asm-arm/mach-types.h \
265 include/asm-arm/arch include/asm-arm/.arch
266
267# We use MRPROPER_FILES and CLEAN_FILES now 257# We use MRPROPER_FILES and CLEAN_FILES now
268archclean: 258archclean:
269 $(Q)$(MAKE) $(clean)=$(boot) 259 $(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index ce39dc540085..2d4d88ba73bf 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -63,8 +63,12 @@ endif
63 63
64SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 64SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
65 65
66targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ 66suffix_$(CONFIG_KERNEL_GZIP) = gzip
67 head.o misc.o $(OBJS) 67suffix_$(CONFIG_KERNEL_LZO) = lzo
68
69targets := vmlinux vmlinux.lds \
70 piggy.$(suffix_y) piggy.$(suffix_y).o \
71 font.o font.c head.o misc.o $(OBJS)
68 72
69ifeq ($(CONFIG_FUNCTION_TRACER),y) 73ifeq ($(CONFIG_FUNCTION_TRACER),y)
70ORIG_CFLAGS := $(KBUILD_CFLAGS) 74ORIG_CFLAGS := $(KBUILD_CFLAGS)
@@ -87,22 +91,34 @@ endif
87ifneq ($(PARAMS_PHYS),) 91ifneq ($(PARAMS_PHYS),)
88LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) 92LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS)
89endif 93endif
90LDFLAGS_vmlinux += -p --no-undefined -X \ 94# ?
91 $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T 95LDFLAGS_vmlinux += -p
96# Report unresolved symbol references
97LDFLAGS_vmlinux += --no-undefined
98# Delete all temporary local symbols
99LDFLAGS_vmlinux += -X
100# Next argument is a linker script
101LDFLAGS_vmlinux += -T
102
103# For __aeabi_uidivmod
104lib1funcs = $(obj)/lib1funcs.o
105
106$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
107 $(call cmd,shipped)
92 108
93# Don't allow any static data in misc.o, which 109# Don't allow any static data in misc.o, which
94# would otherwise mess up our GOT table 110# would otherwise mess up our GOT table
95CFLAGS_misc.o := -Dstatic= 111CFLAGS_misc.o := -Dstatic=
96 112
97$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \ 113$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
98 $(addprefix $(obj)/, $(OBJS)) FORCE 114 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
99 $(call if_changed,ld) 115 $(call if_changed,ld)
100 @: 116 @:
101 117
102$(obj)/piggy.gz: $(obj)/../Image FORCE 118$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
103 $(call if_changed,gzip) 119 $(call if_changed,$(suffix_y))
104 120
105$(obj)/piggy.o: $(obj)/piggy.gz FORCE 121$(obj)/piggy.$(suffix_y).o: $(obj)/piggy.$(suffix_y) FORCE
106 122
107CFLAGS_font.o := -Dstatic= 123CFLAGS_font.o := -Dstatic=
108 124
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 17153b54613b..7e0fe4d42c7b 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -18,10 +18,15 @@
18 18
19unsigned int __machine_arch_type; 19unsigned int __machine_arch_type;
20 20
21#define _LINUX_STRING_H_
22
21#include <linux/compiler.h> /* for inline */ 23#include <linux/compiler.h> /* for inline */
22#include <linux/types.h> /* for size_t */ 24#include <linux/types.h> /* for size_t */
23#include <linux/stddef.h> /* for NULL */ 25#include <linux/stddef.h> /* for NULL */
24#include <asm/string.h> 26#include <asm/string.h>
27#include <linux/linkage.h>
28
29#include <asm/unaligned.h>
25 30
26#ifdef STANDALONE_DEBUG 31#ifdef STANDALONE_DEBUG
27#define putstr printf 32#define putstr printf
@@ -188,34 +193,8 @@ static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src,
188/* 193/*
189 * gzip delarations 194 * gzip delarations
190 */ 195 */
191#define OF(args) args
192#define STATIC static 196#define STATIC static
193 197
194typedef unsigned char uch;
195typedef unsigned short ush;
196typedef unsigned long ulg;
197
198#define WSIZE 0x8000 /* Window size must be at least 32k, */
199 /* and a power of two */
200
201static uch *inbuf; /* input buffer */
202static uch window[WSIZE]; /* Sliding window buffer */
203
204static unsigned insize; /* valid bytes in inbuf */
205static unsigned inptr; /* index of next byte to be processed in inbuf */
206static unsigned outcnt; /* bytes in output buffer */
207
208/* gzip flag byte */
209#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
210#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
211#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
212#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
213#define COMMENT 0x10 /* bit 4 set: file comment present */
214#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
215#define RESERVED 0xC0 /* bit 6,7: reserved */
216
217#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
218
219/* Diagnostic functions */ 198/* Diagnostic functions */
220#ifdef DEBUG 199#ifdef DEBUG
221# define Assert(cond,msg) {if(!(cond)) error(msg);} 200# define Assert(cond,msg) {if(!(cond)) error(msg);}
@@ -233,24 +212,20 @@ static unsigned outcnt; /* bytes in output buffer */
233# define Tracecv(c,x) 212# define Tracecv(c,x)
234#endif 213#endif
235 214
236static int fill_inbuf(void);
237static void flush_window(void);
238static void error(char *m); 215static void error(char *m);
239 216
240extern char input_data[]; 217extern char input_data[];
241extern char input_data_end[]; 218extern char input_data_end[];
242 219
243static uch *output_data; 220static unsigned char *output_data;
244static ulg output_ptr; 221static unsigned long output_ptr;
245static ulg bytes_out;
246 222
247static void error(char *m); 223static void error(char *m);
248 224
249static void putstr(const char *); 225static void putstr(const char *);
250 226
251extern int end; 227static unsigned long free_mem_ptr;
252static ulg free_mem_ptr; 228static unsigned long free_mem_end_ptr;
253static ulg free_mem_end_ptr;
254 229
255#ifdef STANDALONE_DEBUG 230#ifdef STANDALONE_DEBUG
256#define NO_INFLATE_MALLOC 231#define NO_INFLATE_MALLOC
@@ -258,46 +233,13 @@ static ulg free_mem_end_ptr;
258 233
259#define ARCH_HAS_DECOMP_WDOG 234#define ARCH_HAS_DECOMP_WDOG
260 235
261#include "../../../../lib/inflate.c" 236#ifdef CONFIG_KERNEL_GZIP
262 237#include "../../../../lib/decompress_inflate.c"
263/* =========================================================================== 238#endif
264 * Fill the input buffer. This is called only when the buffer is empty
265 * and at least one byte is really needed.
266 */
267int fill_inbuf(void)
268{
269 if (insize != 0)
270 error("ran out of input data");
271
272 inbuf = input_data;
273 insize = &input_data_end[0] - &input_data[0];
274
275 inptr = 1;
276 return inbuf[0];
277}
278 239
279/* =========================================================================== 240#ifdef CONFIG_KERNEL_LZO
280 * Write the output window window[0..outcnt-1] and update crc and bytes_out. 241#include "../../../../lib/decompress_unlzo.c"
281 * (Used for the decompressed data only.) 242#endif
282 */
283void flush_window(void)
284{
285 ulg c = crc;
286 unsigned n;
287 uch *in, *out, ch;
288
289 in = window;
290 out = &output_data[output_ptr];
291 for (n = 0; n < outcnt; n++) {
292 ch = *out++ = *in++;
293 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
294 }
295 crc = c;
296 bytes_out += (ulg)outcnt;
297 output_ptr += (ulg)outcnt;
298 outcnt = 0;
299 putstr(".");
300}
301 243
302#ifndef arch_error 244#ifndef arch_error
303#define arch_error(x) 245#define arch_error(x)
@@ -314,22 +256,33 @@ static void error(char *x)
314 while(1); /* Halt */ 256 while(1); /* Halt */
315} 257}
316 258
259asmlinkage void __div0(void)
260{
261 error("Attempting division by 0!");
262}
263
317#ifndef STANDALONE_DEBUG 264#ifndef STANDALONE_DEBUG
318 265
319ulg 266unsigned long
320decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, 267decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
321 int arch_id) 268 unsigned long free_mem_ptr_end_p,
269 int arch_id)
322{ 270{
323 output_data = (uch *)output_start; /* Points to kernel start */ 271 unsigned char *tmp;
272
273 output_data = (unsigned char *)output_start;
324 free_mem_ptr = free_mem_ptr_p; 274 free_mem_ptr = free_mem_ptr_p;
325 free_mem_end_ptr = free_mem_ptr_end_p; 275 free_mem_end_ptr = free_mem_ptr_end_p;
326 __machine_arch_type = arch_id; 276 __machine_arch_type = arch_id;
327 277
328 arch_decomp_setup(); 278 arch_decomp_setup();
329 279
330 makecrc(); 280 tmp = (unsigned char *) (((unsigned long)input_data_end) - 4);
281 output_ptr = get_unaligned_le32(tmp);
282
331 putstr("Uncompressing Linux..."); 283 putstr("Uncompressing Linux...");
332 gunzip(); 284 decompress(input_data, input_data_end - input_data,
285 NULL, NULL, output_data, NULL, error);
333 putstr(" done, booting the kernel.\n"); 286 putstr(" done, booting the kernel.\n");
334 return output_ptr; 287 return output_ptr;
335} 288}
@@ -341,11 +294,10 @@ int main()
341{ 294{
342 output_data = output_buffer; 295 output_data = output_buffer;
343 296
344 makecrc();
345 putstr("Uncompressing Linux..."); 297 putstr("Uncompressing Linux...");
346 gunzip(); 298 decompress(input_data, input_data_end - input_data,
299 NULL, NULL, output_data, NULL, error);
347 putstr("done.\n"); 300 putstr("done.\n");
348 return 0; 301 return 0;
349} 302}
350#endif 303#endif
351
diff --git a/arch/arm/boot/compressed/piggy.gzip.S b/arch/arm/boot/compressed/piggy.gzip.S
new file mode 100644
index 000000000000..a68adf91a165
--- /dev/null
+++ b/arch/arm/boot/compressed/piggy.gzip.S
@@ -0,0 +1,6 @@
1 .section .piggydata,#alloc
2 .globl input_data
3input_data:
4 .incbin "arch/arm/boot/compressed/piggy.gzip"
5 .globl input_data_end
6input_data_end:
diff --git a/arch/arm/boot/compressed/piggy.S b/arch/arm/boot/compressed/piggy.lzo.S
index 54c951800ebd..a425ad95959a 100644
--- a/arch/arm/boot/compressed/piggy.S
+++ b/arch/arm/boot/compressed/piggy.lzo.S
@@ -1,6 +1,6 @@
1 .section .piggydata,#alloc 1 .section .piggydata,#alloc
2 .globl input_data 2 .globl input_data
3input_data: 3input_data:
4 .incbin "arch/arm/boot/compressed/piggy.gz" 4 .incbin "arch/arm/boot/compressed/piggy.lzo"
5 .globl input_data_end 5 .globl input_data_end
6input_data_end: 6input_data_end:
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 5a375e5fef21..cc32c1e54a59 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -308,15 +308,11 @@ static inline void unmap_single(struct device *dev, dma_addr_t dma_addr,
308 memcpy(ptr, buf->safe, size); 308 memcpy(ptr, buf->safe, size);
309 309
310 /* 310 /*
311 * DMA buffers must have the same cache properties 311 * Since we may have written to a page cache page,
312 * as if they were really used for DMA - which means 312 * we need to ensure that the data will be coherent
313 * data must be written back to RAM. Note that 313 * with user mappings.
314 * we don't use dmac_flush_range() here for the
315 * bidirectional case because we know the cache
316 * lines will be coherent with the data written.
317 */ 314 */
318 dmac_clean_range(ptr, ptr + size); 315 __cpuc_flush_dcache_area(ptr, size);
319 outer_clean_range(__pa(ptr), __pa(ptr) + size);
320 } 316 }
321 free_safe_buffer(dev->archdata.dmabounce, buf); 317 free_safe_buffer(dev->archdata.dmabounce, buf);
322 } 318 }
diff --git a/arch/arm/configs/acs5k_defconfig b/arch/arm/configs/acs5k_defconfig
index 1cab4e79d368..6e32a85641a7 100644
--- a/arch/arm/configs/acs5k_defconfig
+++ b/arch/arm/configs/acs5k_defconfig
@@ -187,7 +187,6 @@ CONFIG_MACH_ACS5K=y
187# 187#
188# Processor Type 188# Processor Type
189# 189#
190CONFIG_CPU_32=y
191CONFIG_CPU_ARM922T=y 190CONFIG_CPU_ARM922T=y
192CONFIG_CPU_32v4T=y 191CONFIG_CPU_32v4T=y
193CONFIG_CPU_ABRT_EV4T=y 192CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/acs5k_tiny_defconfig b/arch/arm/configs/acs5k_tiny_defconfig
index 8e3d084afd78..b34b1eabac3b 100644
--- a/arch/arm/configs/acs5k_tiny_defconfig
+++ b/arch/arm/configs/acs5k_tiny_defconfig
@@ -186,7 +186,6 @@ CONFIG_MACH_ACS5K=y
186# 186#
187# Processor Type 187# Processor Type
188# 188#
189CONFIG_CPU_32=y
190CONFIG_CPU_ARM922T=y 189CONFIG_CPU_ARM922T=y
191CONFIG_CPU_32v4T=y 190CONFIG_CPU_32v4T=y
192CONFIG_CPU_ABRT_EV4T=y 191CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/afeb9260_defconfig b/arch/arm/configs/afeb9260_defconfig
index f7a272cb3da0..64fe7f10c12a 100644
--- a/arch/arm/configs/afeb9260_defconfig
+++ b/arch/arm/configs/afeb9260_defconfig
@@ -227,7 +227,6 @@ CONFIG_AT91_EARLY_DBGU=y
227# 227#
228# Processor Type 228# Processor Type
229# 229#
230CONFIG_CPU_32=y
231CONFIG_CPU_ARM926T=y 230CONFIG_CPU_ARM926T=y
232CONFIG_CPU_32v5=y 231CONFIG_CPU_32v5=y
233CONFIG_CPU_ABRT_EV5TJ=y 232CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/am200epdkit_defconfig b/arch/arm/configs/am200epdkit_defconfig
index 5e68420f4680..30927cac6a9a 100644
--- a/arch/arm/configs/am200epdkit_defconfig
+++ b/arch/arm/configs/am200epdkit_defconfig
@@ -189,7 +189,6 @@ CONFIG_PXA25x=y
189# 189#
190# Processor Type 190# Processor Type
191# 191#
192CONFIG_CPU_32=y
193CONFIG_CPU_XSCALE=y 192CONFIG_CPU_XSCALE=y
194CONFIG_CPU_32v5=y 193CONFIG_CPU_32v5=y
195CONFIG_CPU_ABRT_EV5T=y 194CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/am3517_evm_defconfig b/arch/arm/configs/am3517_evm_defconfig
index ad54e92dd436..abe9966781ce 100644
--- a/arch/arm/configs/am3517_evm_defconfig
+++ b/arch/arm/configs/am3517_evm_defconfig
@@ -233,7 +233,6 @@ CONFIG_MACH_OMAP3517EVM=y
233# 233#
234# Processor Type 234# Processor Type
235# 235#
236CONFIG_CPU_32=y
237CONFIG_CPU_32v6K=y 236CONFIG_CPU_32v6K=y
238CONFIG_CPU_V7=y 237CONFIG_CPU_V7=y
239CONFIG_CPU_32v7=y 238CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/ams_delta_defconfig b/arch/arm/configs/ams_delta_defconfig
index e8f7380b67d6..3b3a3775bbf4 100644
--- a/arch/arm/configs/ams_delta_defconfig
+++ b/arch/arm/configs/ams_delta_defconfig
@@ -210,7 +210,6 @@ CONFIG_OMAP_ARM_150MHZ=y
210# 210#
211# Processor Type 211# Processor Type
212# 212#
213CONFIG_CPU_32=y
214CONFIG_CPU_ARM925T=y 213CONFIG_CPU_ARM925T=y
215CONFIG_CPU_32v4T=y 214CONFIG_CPU_32v4T=y
216CONFIG_CPU_ABRT_EV4T=y 215CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/assabet_defconfig b/arch/arm/configs/assabet_defconfig
index c66dd399e426..daa75bc98d46 100644
--- a/arch/arm/configs/assabet_defconfig
+++ b/arch/arm/configs/assabet_defconfig
@@ -101,7 +101,6 @@ CONFIG_SA1100_ASSABET=y
101# 101#
102# Processor Type 102# Processor Type
103# 103#
104CONFIG_CPU_32=y
105CONFIG_CPU_SA1100=y 104CONFIG_CPU_SA1100=y
106CONFIG_CPU_32v4=y 105CONFIG_CPU_32v4=y
107CONFIG_CPU_ABRT_EV4=y 106CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/at91cap9adk_defconfig b/arch/arm/configs/at91cap9adk_defconfig
index bc6bd9f6174d..b1ab50bee461 100644
--- a/arch/arm/configs/at91cap9adk_defconfig
+++ b/arch/arm/configs/at91cap9adk_defconfig
@@ -181,7 +181,6 @@ CONFIG_AT91_TIMER_HZ=100
181# 181#
182# Processor Type 182# Processor Type
183# 183#
184CONFIG_CPU_32=y
185CONFIG_CPU_ARM926T=y 184CONFIG_CPU_ARM926T=y
186CONFIG_CPU_32v5=y 185CONFIG_CPU_32v5=y
187CONFIG_CPU_ABRT_EV5TJ=y 186CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/at91rm9200dk_defconfig b/arch/arm/configs/at91rm9200dk_defconfig
index c97e1022ada1..1fffec86a113 100644
--- a/arch/arm/configs/at91rm9200dk_defconfig
+++ b/arch/arm/configs/at91rm9200dk_defconfig
@@ -130,7 +130,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
130# 130#
131# Processor Type 131# Processor Type
132# 132#
133CONFIG_CPU_32=y
134CONFIG_CPU_ARM920T=y 133CONFIG_CPU_ARM920T=y
135CONFIG_CPU_32v4=y 134CONFIG_CPU_32v4=y
136CONFIG_CPU_ABRT_EV4T=y 135CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
index 9f7a99ace514..c846a795d1d5 100644
--- a/arch/arm/configs/at91rm9200ek_defconfig
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -129,7 +129,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
129# 129#
130# Processor Type 130# Processor Type
131# 131#
132CONFIG_CPU_32=y
133CONFIG_CPU_ARM920T=y 132CONFIG_CPU_ARM920T=y
134CONFIG_CPU_32v4=y 133CONFIG_CPU_32v4=y
135CONFIG_CPU_ABRT_EV4T=y 134CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index 98e2f3de4bc5..472ea11eedf1 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -188,7 +188,6 @@ CONFIG_AT91_TIMER_HZ=100
188# 188#
189# Processor Type 189# Processor Type
190# 190#
191CONFIG_CPU_32=y
192CONFIG_CPU_ARM926T=y 191CONFIG_CPU_ARM926T=y
193CONFIG_CPU_32v5=y 192CONFIG_CPU_32v5=y
194CONFIG_CPU_ABRT_EV5TJ=y 193CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 149456142392..4ecde429cf15 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -181,7 +181,6 @@ CONFIG_AT91_TIMER_HZ=100
181# 181#
182# Processor Type 182# Processor Type
183# 183#
184CONFIG_CPU_32=y
185CONFIG_CPU_ARM926T=y 184CONFIG_CPU_ARM926T=y
186CONFIG_CPU_32v5=y 185CONFIG_CPU_32v5=y
187CONFIG_CPU_ABRT_EV5TJ=y 186CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index 21599f3c6275..9b792b60c7ff 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -181,7 +181,6 @@ CONFIG_AT91_TIMER_HZ=100
181# 181#
182# Processor Type 182# Processor Type
183# 183#
184CONFIG_CPU_32=y
185CONFIG_CPU_ARM926T=y 184CONFIG_CPU_ARM926T=y
186CONFIG_CPU_32v5=y 185CONFIG_CPU_32v5=y
187CONFIG_CPU_ABRT_EV5TJ=y 186CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index 7e018a04c31b..64ce106d53eb 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -187,7 +187,6 @@ CONFIG_AT91_EARLY_DBGU=y
187# 187#
188# Processor Type 188# Processor Type
189# 189#
190CONFIG_CPU_32=y
191CONFIG_CPU_ARM926T=y 190CONFIG_CPU_ARM926T=y
192CONFIG_CPU_32v5=y 191CONFIG_CPU_32v5=y
193CONFIG_CPU_ABRT_EV5TJ=y 192CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rlek_defconfig
index e2df81a3e804..90e48bfda16f 100644
--- a/arch/arm/configs/at91sam9rlek_defconfig
+++ b/arch/arm/configs/at91sam9rlek_defconfig
@@ -179,7 +179,6 @@ CONFIG_AT91_TIMER_HZ=100
179# 179#
180# Processor Type 180# Processor Type
181# 181#
182CONFIG_CPU_32=y
183CONFIG_CPU_ARM926T=y 182CONFIG_CPU_ARM926T=y
184CONFIG_CPU_32v5=y 183CONFIG_CPU_32v5=y
185CONFIG_CPU_ABRT_EV5TJ=y 184CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/ateb9200_defconfig b/arch/arm/configs/ateb9200_defconfig
index a19e824cf7f8..6315534976cf 100644
--- a/arch/arm/configs/ateb9200_defconfig
+++ b/arch/arm/configs/ateb9200_defconfig
@@ -132,7 +132,6 @@ CONFIG_MACH_ATEB9200=y
132# 132#
133# Processor Type 133# Processor Type
134# 134#
135CONFIG_CPU_32=y
136CONFIG_CPU_ARM920T=y 135CONFIG_CPU_ARM920T=y
137CONFIG_CPU_32v4=y 136CONFIG_CPU_32v4=y
138CONFIG_CPU_ABRT_EV4T=y 137CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/badge4_defconfig b/arch/arm/configs/badge4_defconfig
index f264846218a2..b175b6b8feb4 100644
--- a/arch/arm/configs/badge4_defconfig
+++ b/arch/arm/configs/badge4_defconfig
@@ -103,7 +103,6 @@ CONFIG_SA1100_BADGE4=y
103# 103#
104# Processor Type 104# Processor Type
105# 105#
106CONFIG_CPU_32=y
107CONFIG_CPU_SA1100=y 106CONFIG_CPU_SA1100=y
108CONFIG_CPU_32v4=y 107CONFIG_CPU_32v4=y
109CONFIG_CPU_ABRT_EV4=y 108CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/bcmring_defconfig b/arch/arm/configs/bcmring_defconfig
index bcc0bac551a5..1e12167c89b7 100644
--- a/arch/arm/configs/bcmring_defconfig
+++ b/arch/arm/configs/bcmring_defconfig
@@ -181,7 +181,6 @@ CONFIG_BCM_ZRELADDR=0x8000
181# 181#
182# Processor Type 182# Processor Type
183# 183#
184CONFIG_CPU_32=y
185CONFIG_CPU_V6=y 184CONFIG_CPU_V6=y
186CONFIG_CPU_32v6K=y 185CONFIG_CPU_32v6K=y
187CONFIG_CPU_32v6=y 186CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/cam60_defconfig b/arch/arm/configs/cam60_defconfig
index 8448108347cf..eef33de3ca12 100644
--- a/arch/arm/configs/cam60_defconfig
+++ b/arch/arm/configs/cam60_defconfig
@@ -196,7 +196,6 @@ CONFIG_AT91_EARLY_DBGU=y
196# 196#
197# Processor Type 197# Processor Type
198# 198#
199CONFIG_CPU_32=y
200CONFIG_CPU_ARM926T=y 199CONFIG_CPU_ARM926T=y
201CONFIG_CPU_32v5=y 200CONFIG_CPU_32v5=y
202CONFIG_CPU_ABRT_EV5TJ=y 201CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/carmeva_defconfig b/arch/arm/configs/carmeva_defconfig
index d392833b31fb..b6a706306781 100644
--- a/arch/arm/configs/carmeva_defconfig
+++ b/arch/arm/configs/carmeva_defconfig
@@ -97,7 +97,6 @@ CONFIG_MACH_CARMEVA=y
97# 97#
98# Processor Type 98# Processor Type
99# 99#
100CONFIG_CPU_32=y
101CONFIG_CPU_ARM920T=y 100CONFIG_CPU_ARM920T=y
102CONFIG_CPU_32v4=y 101CONFIG_CPU_32v4=y
103CONFIG_CPU_ABRT_EV4T=y 102CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/cerfcube_defconfig b/arch/arm/configs/cerfcube_defconfig
index 2b4c0668b1b4..d662cab9cc21 100644
--- a/arch/arm/configs/cerfcube_defconfig
+++ b/arch/arm/configs/cerfcube_defconfig
@@ -105,7 +105,6 @@ CONFIG_SA1100_CERF_FLASH_16MB=y
105# 105#
106# Processor Type 106# Processor Type
107# 107#
108CONFIG_CPU_32=y
109CONFIG_CPU_SA1100=y 108CONFIG_CPU_SA1100=y
110CONFIG_CPU_32v4=y 109CONFIG_CPU_32v4=y
111CONFIG_CPU_ABRT_EV4=y 110CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/cm_t35_defconfig b/arch/arm/configs/cm_t35_defconfig
index e42c5c873eb2..893cd267e075 100644
--- a/arch/arm/configs/cm_t35_defconfig
+++ b/arch/arm/configs/cm_t35_defconfig
@@ -236,7 +236,6 @@ CONFIG_MACH_CM_T35=y
236# 236#
237# Processor Type 237# Processor Type
238# 238#
239CONFIG_CPU_32=y
240CONFIG_CPU_32v6K=y 239CONFIG_CPU_32v6K=y
241CONFIG_CPU_V7=y 240CONFIG_CPU_V7=y
242CONFIG_CPU_32v7=y 241CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/cm_x2xx_defconfig b/arch/arm/configs/cm_x2xx_defconfig
index 797b790cba78..47d22d09e70e 100644
--- a/arch/arm/configs/cm_x2xx_defconfig
+++ b/arch/arm/configs/cm_x2xx_defconfig
@@ -205,7 +205,6 @@ CONFIG_PXA_SSP=y
205# 205#
206# Processor Type 206# Processor Type
207# 207#
208CONFIG_CPU_32=y
209CONFIG_CPU_XSCALE=y 208CONFIG_CPU_XSCALE=y
210CONFIG_CPU_32v5=y 209CONFIG_CPU_32v5=y
211CONFIG_CPU_ABRT_EV5T=y 210CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/cm_x300_defconfig b/arch/arm/configs/cm_x300_defconfig
index a0170867130e..a334069c7904 100644
--- a/arch/arm/configs/cm_x300_defconfig
+++ b/arch/arm/configs/cm_x300_defconfig
@@ -247,7 +247,6 @@ CONFIG_PLAT_PXA=y
247# 247#
248# Processor Type 248# Processor Type
249# 249#
250CONFIG_CPU_32=y
251CONFIG_CPU_XSC3=y 250CONFIG_CPU_XSC3=y
252CONFIG_CPU_32v5=y 251CONFIG_CPU_32v5=y
253CONFIG_CPU_ABRT_EV5T=y 252CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/colibri_pxa270_defconfig b/arch/arm/configs/colibri_pxa270_defconfig
index 4cf3bde1c522..c962870b3f85 100644
--- a/arch/arm/configs/colibri_pxa270_defconfig
+++ b/arch/arm/configs/colibri_pxa270_defconfig
@@ -204,7 +204,6 @@ CONFIG_PXA27x=y
204# 204#
205# Processor Type 205# Processor Type
206# 206#
207CONFIG_CPU_32=y
208CONFIG_CPU_XSCALE=y 207CONFIG_CPU_XSCALE=y
209CONFIG_CPU_32v5=y 208CONFIG_CPU_32v5=y
210CONFIG_CPU_ABRT_EV5T=y 209CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/colibri_pxa300_defconfig b/arch/arm/configs/colibri_pxa300_defconfig
index 4774a36fa740..11fdb5afdec7 100644
--- a/arch/arm/configs/colibri_pxa300_defconfig
+++ b/arch/arm/configs/colibri_pxa300_defconfig
@@ -212,7 +212,6 @@ CONFIG_PXA3xx=y
212# 212#
213# Processor Type 213# Processor Type
214# 214#
215CONFIG_CPU_32=y
216CONFIG_CPU_XSC3=y 215CONFIG_CPU_XSC3=y
217CONFIG_CPU_32v5=y 216CONFIG_CPU_32v5=y
218CONFIG_CPU_ABRT_EV5T=y 217CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index 1aa62249031b..26e458d82634 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -125,7 +125,6 @@ CONFIG_SA1100_COLLIE=y
125# 125#
126# Processor Type 126# Processor Type
127# 127#
128CONFIG_CPU_32=y
129CONFIG_CPU_SA1100=y 128CONFIG_CPU_SA1100=y
130CONFIG_CPU_32v4=y 129CONFIG_CPU_32v4=y
131CONFIG_CPU_ABRT_EV4=y 130CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index d6cd165e9310..5e4069f42754 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -214,7 +214,6 @@ CONFIG_PXA_HAVE_BOARD_IRQS=y
214# 214#
215# Processor Type 215# Processor Type
216# 216#
217CONFIG_CPU_32=y
218CONFIG_CPU_XSCALE=y 217CONFIG_CPU_XSCALE=y
219CONFIG_CPU_32v5=y 218CONFIG_CPU_32v5=y
220CONFIG_CPU_ABRT_EV5T=y 219CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/cpu9260_defconfig b/arch/arm/configs/cpu9260_defconfig
index 601e7f3d5e97..c9137aaf23a9 100644
--- a/arch/arm/configs/cpu9260_defconfig
+++ b/arch/arm/configs/cpu9260_defconfig
@@ -229,7 +229,6 @@ CONFIG_AT91_EARLY_DBGU=y
229# 229#
230# Processor Type 230# Processor Type
231# 231#
232CONFIG_CPU_32=y
233CONFIG_CPU_ARM926T=y 232CONFIG_CPU_ARM926T=y
234CONFIG_CPU_32v5=y 233CONFIG_CPU_32v5=y
235CONFIG_CPU_ABRT_EV5TJ=y 234CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/cpu9g20_defconfig b/arch/arm/configs/cpu9g20_defconfig
index b5b9cbbc6977..d2344799171a 100644
--- a/arch/arm/configs/cpu9g20_defconfig
+++ b/arch/arm/configs/cpu9g20_defconfig
@@ -219,7 +219,6 @@ CONFIG_AT91_EARLY_DBGU=y
219# 219#
220# Processor Type 220# Processor Type
221# 221#
222CONFIG_CPU_32=y
223CONFIG_CPU_ARM926T=y 222CONFIG_CPU_ARM926T=y
224CONFIG_CPU_32v5=y 223CONFIG_CPU_32v5=y
225CONFIG_CPU_ABRT_EV5TJ=y 224CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/cpuat91_defconfig b/arch/arm/configs/cpuat91_defconfig
index 4901827253fb..1f8dda6e37c3 100644
--- a/arch/arm/configs/cpuat91_defconfig
+++ b/arch/arm/configs/cpuat91_defconfig
@@ -230,7 +230,6 @@ CONFIG_AT91_EARLY_DBGU=y
230# 230#
231# Processor Type 231# Processor Type
232# 232#
233CONFIG_CPU_32=y
234CONFIG_CPU_ARM920T=y 233CONFIG_CPU_ARM920T=y
235CONFIG_CPU_32v4T=y 234CONFIG_CPU_32v4T=y
236CONFIG_CPU_ABRT_EV4T=y 235CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/csb337_defconfig b/arch/arm/configs/csb337_defconfig
index 29f68c2effe6..f095040dab07 100644
--- a/arch/arm/configs/csb337_defconfig
+++ b/arch/arm/configs/csb337_defconfig
@@ -193,7 +193,6 @@ CONFIG_AT91_TIMER_HZ=128
193# 193#
194# Processor Type 194# Processor Type
195# 195#
196CONFIG_CPU_32=y
197CONFIG_CPU_ARM920T=y 196CONFIG_CPU_ARM920T=y
198CONFIG_CPU_32v4T=y 197CONFIG_CPU_32v4T=y
199CONFIG_CPU_ABRT_EV4T=y 198CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/csb637_defconfig b/arch/arm/configs/csb637_defconfig
index f7b60ceed6c7..507154016fc8 100644
--- a/arch/arm/configs/csb637_defconfig
+++ b/arch/arm/configs/csb637_defconfig
@@ -215,7 +215,6 @@ CONFIG_AT91_EARLY_DBGU=y
215# 215#
216# Processor Type 216# Processor Type
217# 217#
218CONFIG_CPU_32=y
219CONFIG_CPU_ARM920T=y 218CONFIG_CPU_ARM920T=y
220CONFIG_CPU_32v4T=y 219CONFIG_CPU_32v4T=y
221CONFIG_CPU_ABRT_EV4T=y 220CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig
index 50bd25a10f0d..e14c99c2b574 100644
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ b/arch/arm/configs/da8xx_omapl_defconfig
@@ -225,7 +225,6 @@ CONFIG_DAVINCI_RESET_CLOCKS=y
225# 225#
226# Processor Type 226# Processor Type
227# 227#
228CONFIG_CPU_32=y
229CONFIG_CPU_ARM926T=y 228CONFIG_CPU_ARM926T=y
230CONFIG_CPU_32v5=y 229CONFIG_CPU_32v5=y
231CONFIG_CPU_ABRT_EV5TJ=y 230CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index bd656e8e6e4c..625035fd0a6c 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -223,7 +223,6 @@ CONFIG_DAVINCI_RESET_CLOCKS=y
223# 223#
224# Processor Type 224# Processor Type
225# 225#
226CONFIG_CPU_32=y
227CONFIG_CPU_ARM926T=y 226CONFIG_CPU_ARM926T=y
228CONFIG_CPU_32v5=y 227CONFIG_CPU_32v5=y
229CONFIG_CPU_ABRT_EV5TJ=y 228CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index b3a491675d59..b7b2ab088dd9 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -186,7 +186,6 @@ CONFIG_PLAT_ORION=y
186# 186#
187# Processor Type 187# Processor Type
188# 188#
189CONFIG_CPU_32=y
190CONFIG_CPU_V6=y 189CONFIG_CPU_V6=y
191CONFIG_CPU_32v6K=y 190CONFIG_CPU_32v6K=y
192CONFIG_CPU_32v6=y 191CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig
index afcfff6140f2..d5e827969118 100644
--- a/arch/arm/configs/ebsa110_defconfig
+++ b/arch/arm/configs/ebsa110_defconfig
@@ -83,7 +83,6 @@ CONFIG_ARCH_EBSA110=y
83# 83#
84# Processor Type 84# Processor Type
85# 85#
86CONFIG_CPU_32=y
87CONFIG_CPU_SA110=y 86CONFIG_CPU_SA110=y
88CONFIG_CPU_32v4=y 87CONFIG_CPU_32v4=y
89CONFIG_CPU_ABRT_EV4=y 88CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/ecbat91_defconfig b/arch/arm/configs/ecbat91_defconfig
index ca520733bdb0..25dd53b7cefd 100644
--- a/arch/arm/configs/ecbat91_defconfig
+++ b/arch/arm/configs/ecbat91_defconfig
@@ -186,7 +186,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
186# 186#
187# Processor Type 187# Processor Type
188# 188#
189CONFIG_CPU_32=y
190CONFIG_CPU_ARM920T=y 189CONFIG_CPU_ARM920T=y
191CONFIG_CPU_32v4T=y 190CONFIG_CPU_32v4T=y
192CONFIG_CPU_ABRT_EV4T=y 191CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/edb7211_defconfig b/arch/arm/configs/edb7211_defconfig
index 6ba7355ff85b..e3a6cd32669d 100644
--- a/arch/arm/configs/edb7211_defconfig
+++ b/arch/arm/configs/edb7211_defconfig
@@ -90,7 +90,6 @@ CONFIG_ARCH_EP7211=y
90# 90#
91# Processor Type 91# Processor Type
92# 92#
93CONFIG_CPU_32=y
94CONFIG_CPU_ARM720T=y 93CONFIG_CPU_ARM720T=y
95CONFIG_CPU_32v4=y 94CONFIG_CPU_32v4=y
96CONFIG_CPU_ABRT_LV4T=y 95CONFIG_CPU_ABRT_LV4T=y
diff --git a/arch/arm/configs/em_x270_defconfig b/arch/arm/configs/em_x270_defconfig
index e9955b786c80..2bee932439f6 100644
--- a/arch/arm/configs/em_x270_defconfig
+++ b/arch/arm/configs/em_x270_defconfig
@@ -202,7 +202,6 @@ CONFIG_PXA_SSP=y
202# 202#
203# Processor Type 203# Processor Type
204# 204#
205CONFIG_CPU_32=y
206CONFIG_CPU_XSCALE=y 205CONFIG_CPU_XSCALE=y
207CONFIG_CPU_32v5=y 206CONFIG_CPU_32v5=y
208CONFIG_CPU_ABRT_EV5T=y 207CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 3fb083b81b0a..35d735ede9b8 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -198,7 +198,6 @@ CONFIG_EP93XX_EARLY_UART1=y
198# 198#
199# Processor Type 199# Processor Type
200# 200#
201CONFIG_CPU_32=y
202CONFIG_CPU_ARM920T=y 201CONFIG_CPU_ARM920T=y
203CONFIG_CPU_32v4T=y 202CONFIG_CPU_32v4T=y
204CONFIG_CPU_ABRT_EV4T=y 203CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/eseries_pxa_defconfig b/arch/arm/configs/eseries_pxa_defconfig
index b6c5cbbf4c85..74baf5709290 100644
--- a/arch/arm/configs/eseries_pxa_defconfig
+++ b/arch/arm/configs/eseries_pxa_defconfig
@@ -203,7 +203,6 @@ CONFIG_PXA_HAVE_BOARD_IRQS=y
203# 203#
204# Processor Type 204# Processor Type
205# 205#
206CONFIG_CPU_32=y
207CONFIG_CPU_XSCALE=y 206CONFIG_CPU_XSCALE=y
208CONFIG_CPU_32v5=y 207CONFIG_CPU_32v5=y
209CONFIG_CPU_ABRT_EV5T=y 208CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/ezx_defconfig b/arch/arm/configs/ezx_defconfig
index 492f29aba332..9e9057c5a2a3 100644
--- a/arch/arm/configs/ezx_defconfig
+++ b/arch/arm/configs/ezx_defconfig
@@ -240,7 +240,6 @@ CONFIG_PLAT_PXA=y
240# 240#
241# Processor Type 241# Processor Type
242# 242#
243CONFIG_CPU_32=y
244CONFIG_CPU_XSCALE=y 243CONFIG_CPU_XSCALE=y
245CONFIG_CPU_32v5=y 244CONFIG_CPU_32v5=y
246CONFIG_CPU_ABRT_EV5T=y 245CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/footbridge_defconfig b/arch/arm/configs/footbridge_defconfig
index 6ace512fa101..04d97937afe2 100644
--- a/arch/arm/configs/footbridge_defconfig
+++ b/arch/arm/configs/footbridge_defconfig
@@ -95,7 +95,6 @@ CONFIG_ARCH_EBSA285=y
95# 95#
96# Processor Type 96# Processor Type
97# 97#
98CONFIG_CPU_32=y
99CONFIG_CPU_SA110=y 98CONFIG_CPU_SA110=y
100CONFIG_CPU_32v4=y 99CONFIG_CPU_32v4=y
101CONFIG_CPU_ABRT_EV4=y 100CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/fortunet_defconfig b/arch/arm/configs/fortunet_defconfig
index 65dc73a88c43..d58142bf6fa1 100644
--- a/arch/arm/configs/fortunet_defconfig
+++ b/arch/arm/configs/fortunet_defconfig
@@ -88,7 +88,6 @@ CONFIG_ARCH_FORTUNET=y
88# 88#
89# Processor Type 89# Processor Type
90# 90#
91CONFIG_CPU_32=y
92CONFIG_CPU_ARM720T=y 91CONFIG_CPU_ARM720T=y
93CONFIG_CPU_32v4=y 92CONFIG_CPU_32v4=y
94CONFIG_CPU_ABRT_LV4T=y 93CONFIG_CPU_ABRT_LV4T=y
diff --git a/arch/arm/configs/h3600_defconfig b/arch/arm/configs/h3600_defconfig
index efa78e144e5c..a8ad8fbe1188 100644
--- a/arch/arm/configs/h3600_defconfig
+++ b/arch/arm/configs/h3600_defconfig
@@ -205,7 +205,6 @@ CONFIG_SA1100_H3600=y
205# 205#
206# Processor Type 206# Processor Type
207# 207#
208CONFIG_CPU_32=y
209CONFIG_CPU_SA1100=y 208CONFIG_CPU_SA1100=y
210CONFIG_CPU_32v4=y 209CONFIG_CPU_32v4=y
211CONFIG_CPU_ABRT_EV4=y 210CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/h5000_defconfig b/arch/arm/configs/h5000_defconfig
index 649baa370495..5bb73728fad6 100644
--- a/arch/arm/configs/h5000_defconfig
+++ b/arch/arm/configs/h5000_defconfig
@@ -206,7 +206,6 @@ CONFIG_PXA25x=y
206# 206#
207# Processor Type 207# Processor Type
208# 208#
209CONFIG_CPU_32=y
210CONFIG_CPU_XSCALE=y 209CONFIG_CPU_XSCALE=y
211CONFIG_CPU_32v5=y 210CONFIG_CPU_32v5=y
212CONFIG_CPU_ABRT_EV5T=y 211CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/h7201_defconfig b/arch/arm/configs/h7201_defconfig
index 116920aecef7..09a6c6a27bdc 100644
--- a/arch/arm/configs/h7201_defconfig
+++ b/arch/arm/configs/h7201_defconfig
@@ -87,7 +87,6 @@ CONFIG_CPU_H7201=y
87# 87#
88# Processor Type 88# Processor Type
89# 89#
90CONFIG_CPU_32=y
91CONFIG_CPU_ARM720T=y 90CONFIG_CPU_ARM720T=y
92CONFIG_CPU_32v4=y 91CONFIG_CPU_32v4=y
93CONFIG_CPU_ABRT_LV4T=y 92CONFIG_CPU_ABRT_LV4T=y
diff --git a/arch/arm/configs/h7202_defconfig b/arch/arm/configs/h7202_defconfig
index 0e739af52713..fedc52bd22b3 100644
--- a/arch/arm/configs/h7202_defconfig
+++ b/arch/arm/configs/h7202_defconfig
@@ -91,7 +91,6 @@ CONFIG_CPU_H7202=y
91# 91#
92# Processor Type 92# Processor Type
93# 93#
94CONFIG_CPU_32=y
95CONFIG_CPU_ARM720T=y 94CONFIG_CPU_ARM720T=y
96CONFIG_CPU_32v4=y 95CONFIG_CPU_32v4=y
97CONFIG_CPU_ABRT_LV4T=y 96CONFIG_CPU_ABRT_LV4T=y
diff --git a/arch/arm/configs/hackkit_defconfig b/arch/arm/configs/hackkit_defconfig
index db0708d5cbea..2da1acf41f4b 100644
--- a/arch/arm/configs/hackkit_defconfig
+++ b/arch/arm/configs/hackkit_defconfig
@@ -103,7 +103,6 @@ CONFIG_SA1100_HACKKIT=y
103# 103#
104# Processor Type 104# Processor Type
105# 105#
106CONFIG_CPU_32=y
107CONFIG_CPU_SA1100=y 106CONFIG_CPU_SA1100=y
108CONFIG_CPU_32v4=y 107CONFIG_CPU_32v4=y
109CONFIG_CPU_ABRT_EV4=y 108CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/htcherald_defconfig b/arch/arm/configs/htcherald_defconfig
index 1b39691b816f..e0ef0d121aac 100644
--- a/arch/arm/configs/htcherald_defconfig
+++ b/arch/arm/configs/htcherald_defconfig
@@ -241,7 +241,6 @@ CONFIG_OMAP_ARM_195MHZ=y
241# 241#
242# Processor Type 242# Processor Type
243# 243#
244CONFIG_CPU_32=y
245CONFIG_CPU_ARM925T=y 244CONFIG_CPU_ARM925T=y
246CONFIG_CPU_ARM926T=y 245CONFIG_CPU_ARM926T=y
247CONFIG_CPU_32v4T=y 246CONFIG_CPU_32v4T=y
diff --git a/arch/arm/configs/igep0020_defconfig b/arch/arm/configs/igep0020_defconfig
index c97f8d0ded48..a192248c6dd6 100644
--- a/arch/arm/configs/igep0020_defconfig
+++ b/arch/arm/configs/igep0020_defconfig
@@ -238,7 +238,6 @@ CONFIG_MACH_IGEP0020=y
238# 238#
239# Processor Type 239# Processor Type
240# 240#
241CONFIG_CPU_32=y
242CONFIG_CPU_32v6K=y 241CONFIG_CPU_32v6K=y
243CONFIG_CPU_V7=y 242CONFIG_CPU_V7=y
244CONFIG_CPU_32v7=y 243CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index 3ce96e60b409..6b0d04395639 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -92,7 +92,6 @@ CONFIG_ARCH_INTEGRATOR_AP=y
92# 92#
93# Processor Type 93# Processor Type
94# 94#
95CONFIG_CPU_32=y
96CONFIG_CPU_ARM720T=y 95CONFIG_CPU_ARM720T=y
97CONFIG_CPU_ARM920T=y 96CONFIG_CPU_ARM920T=y
98# CONFIG_CPU_ARM922T is not set 97# CONFIG_CPU_ARM922T is not set
diff --git a/arch/arm/configs/iop13xx_defconfig b/arch/arm/configs/iop13xx_defconfig
index 89c17761726b..3c040cc9f3b6 100644
--- a/arch/arm/configs/iop13xx_defconfig
+++ b/arch/arm/configs/iop13xx_defconfig
@@ -163,7 +163,6 @@ CONFIG_PLAT_IOP=y
163# 163#
164# Processor Type 164# Processor Type
165# 165#
166CONFIG_CPU_32=y
167CONFIG_CPU_XSC3=y 166CONFIG_CPU_XSC3=y
168CONFIG_CPU_32v5=y 167CONFIG_CPU_32v5=y
169CONFIG_CPU_ABRT_EV5T=y 168CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/iop32x_defconfig b/arch/arm/configs/iop32x_defconfig
index d70177b38f5f..62a854996be1 100644
--- a/arch/arm/configs/iop32x_defconfig
+++ b/arch/arm/configs/iop32x_defconfig
@@ -168,7 +168,6 @@ CONFIG_PLAT_IOP=y
168# 168#
169# Processor Type 169# Processor Type
170# 170#
171CONFIG_CPU_32=y
172CONFIG_CPU_XSCALE=y 171CONFIG_CPU_XSCALE=y
173CONFIG_CPU_32v5=y 172CONFIG_CPU_32v5=y
174CONFIG_CPU_ABRT_EV5T=y 173CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/iop33x_defconfig b/arch/arm/configs/iop33x_defconfig
index ed2d59d01829..0bc23ece4c2f 100644
--- a/arch/arm/configs/iop33x_defconfig
+++ b/arch/arm/configs/iop33x_defconfig
@@ -198,7 +198,6 @@ CONFIG_PLAT_IOP=y
198# 198#
199# Processor Type 199# Processor Type
200# 200#
201CONFIG_CPU_32=y
202CONFIG_CPU_XSCALE=y 201CONFIG_CPU_XSCALE=y
203CONFIG_CPU_32v5=y 202CONFIG_CPU_32v5=y
204CONFIG_CPU_ABRT_EV5T=y 203CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig
index 57526c15e854..8b5b5764a228 100644
--- a/arch/arm/configs/ixp2000_defconfig
+++ b/arch/arm/configs/ixp2000_defconfig
@@ -151,7 +151,6 @@ CONFIG_ARCH_IXDP2X01=y
151# 151#
152# Processor Type 152# Processor Type
153# 153#
154CONFIG_CPU_32=y
155CONFIG_CPU_XSCALE=y 154CONFIG_CPU_XSCALE=y
156CONFIG_CPU_32v5=y 155CONFIG_CPU_32v5=y
157CONFIG_CPU_ABRT_EV5T=y 156CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
index ef97561ed75b..59c11c93180f 100644
--- a/arch/arm/configs/ixp23xx_defconfig
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -145,7 +145,6 @@ CONFIG_MACH_ROADRUNNER=y
145# 145#
146# Processor Type 146# Processor Type
147# 147#
148CONFIG_CPU_32=y
149CONFIG_CPU_XSC3=y 148CONFIG_CPU_XSC3=y
150CONFIG_CPU_32v5=y 149CONFIG_CPU_32v5=y
151CONFIG_CPU_ABRT_EV5T=y 150CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index 95cd8dfb5f1e..a907ad50ad33 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -189,7 +189,6 @@ CONFIG_IXP4XX_NPE=y
189# 189#
190# Processor Type 190# Processor Type
191# 191#
192CONFIG_CPU_32=y
193CONFIG_CPU_XSCALE=y 192CONFIG_CPU_XSCALE=y
194CONFIG_CPU_32v5=y 193CONFIG_CPU_32v5=y
195CONFIG_CPU_ABRT_EV5T=y 194CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/jornada720_defconfig b/arch/arm/configs/jornada720_defconfig
index df9bfbea8612..d1f1646e23c5 100644
--- a/arch/arm/configs/jornada720_defconfig
+++ b/arch/arm/configs/jornada720_defconfig
@@ -202,7 +202,6 @@ CONFIG_SA1100_SSP=y
202# 202#
203# Processor Type 203# Processor Type
204# 204#
205CONFIG_CPU_32=y
206CONFIG_CPU_SA1100=y 205CONFIG_CPU_SA1100=y
207CONFIG_CPU_32v4=y 206CONFIG_CPU_32v4=y
208CONFIG_CPU_ABRT_EV4=y 207CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/kafa_defconfig b/arch/arm/configs/kafa_defconfig
index 9f92fc527f59..f661e765d9ba 100644
--- a/arch/arm/configs/kafa_defconfig
+++ b/arch/arm/configs/kafa_defconfig
@@ -132,7 +132,6 @@ CONFIG_MACH_KAFA=y
132# 132#
133# Processor Type 133# Processor Type
134# 134#
135CONFIG_CPU_32=y
136CONFIG_CPU_ARM920T=y 135CONFIG_CPU_ARM920T=y
137CONFIG_CPU_32v4=y 136CONFIG_CPU_32v4=y
138CONFIG_CPU_ABRT_EV4T=y 137CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/kb9202_defconfig b/arch/arm/configs/kb9202_defconfig
index 605a8462f172..668ba59946d9 100644
--- a/arch/arm/configs/kb9202_defconfig
+++ b/arch/arm/configs/kb9202_defconfig
@@ -230,7 +230,6 @@ CONFIG_AT91_EARLY_DBGU=y
230# 230#
231# Processor Type 231# Processor Type
232# 232#
233CONFIG_CPU_32=y
234CONFIG_CPU_ARM920T=y 233CONFIG_CPU_ARM920T=y
235CONFIG_CPU_32v4T=y 234CONFIG_CPU_32v4T=y
236CONFIG_CPU_ABRT_EV4T=y 235CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index bcfade33bca9..5fc44c94b0ad 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -201,7 +201,6 @@ CONFIG_PLAT_ORION=y
201# 201#
202# Processor Type 202# Processor Type
203# 203#
204CONFIG_CPU_32=y
205CONFIG_CPU_FEROCEON=y 204CONFIG_CPU_FEROCEON=y
206# CONFIG_CPU_FEROCEON_OLD_ID is not set 205# CONFIG_CPU_FEROCEON_OLD_ID is not set
207CONFIG_CPU_32v5=y 206CONFIG_CPU_32v5=y
diff --git a/arch/arm/configs/ks8695_defconfig b/arch/arm/configs/ks8695_defconfig
index d25c41bab06c..e6f2276904f2 100644
--- a/arch/arm/configs/ks8695_defconfig
+++ b/arch/arm/configs/ks8695_defconfig
@@ -186,7 +186,6 @@ CONFIG_MACH_DSM320=y
186# 186#
187# Processor Type 187# Processor Type
188# 188#
189CONFIG_CPU_32=y
190CONFIG_CPU_ARM922T=y 189CONFIG_CPU_ARM922T=y
191CONFIG_CPU_32v4T=y 190CONFIG_CPU_32v4T=y
192CONFIG_CPU_ABRT_EV4T=y 191CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/lart_defconfig b/arch/arm/configs/lart_defconfig
index 56ae56899d2e..af7595176939 100644
--- a/arch/arm/configs/lart_defconfig
+++ b/arch/arm/configs/lart_defconfig
@@ -99,7 +99,6 @@ CONFIG_SA1100_LART=y
99# 99#
100# Processor Type 100# Processor Type
101# 101#
102CONFIG_CPU_32=y
103CONFIG_CPU_SA1100=y 102CONFIG_CPU_SA1100=y
104CONFIG_CPU_32v4=y 103CONFIG_CPU_32v4=y
105CONFIG_CPU_ABRT_EV4=y 104CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/loki_defconfig b/arch/arm/configs/loki_defconfig
index b720fcffbcd4..6df7b147161c 100644
--- a/arch/arm/configs/loki_defconfig
+++ b/arch/arm/configs/loki_defconfig
@@ -174,7 +174,6 @@ CONFIG_PLAT_ORION=y
174# 174#
175# Processor Type 175# Processor Type
176# 176#
177CONFIG_CPU_32=y
178CONFIG_CPU_FEROCEON=y 177CONFIG_CPU_FEROCEON=y
179# CONFIG_CPU_FEROCEON_OLD_ID is not set 178# CONFIG_CPU_FEROCEON_OLD_ID is not set
180CONFIG_CPU_32v5=y 179CONFIG_CPU_32v5=y
diff --git a/arch/arm/configs/lpd270_defconfig b/arch/arm/configs/lpd270_defconfig
index 1a38d8e3fe66..aeb768615347 100644
--- a/arch/arm/configs/lpd270_defconfig
+++ b/arch/arm/configs/lpd270_defconfig
@@ -143,7 +143,6 @@ CONFIG_PXA27x=y
143# 143#
144# Processor Type 144# Processor Type
145# 145#
146CONFIG_CPU_32=y
147CONFIG_CPU_XSCALE=y 146CONFIG_CPU_XSCALE=y
148CONFIG_CPU_32v5=y 147CONFIG_CPU_32v5=y
149CONFIG_CPU_ABRT_EV5T=y 148CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/lpd7a400_defconfig b/arch/arm/configs/lpd7a400_defconfig
index f8ac29d5c654..6116feea2e12 100644
--- a/arch/arm/configs/lpd7a400_defconfig
+++ b/arch/arm/configs/lpd7a400_defconfig
@@ -95,7 +95,6 @@ CONFIG_LPD7A40X_CPLD_SSP=y
95# 95#
96# Processor Type 96# Processor Type
97# 97#
98CONFIG_CPU_32=y
99CONFIG_CPU_ARM922T=y 98CONFIG_CPU_ARM922T=y
100CONFIG_CPU_32v4=y 99CONFIG_CPU_32v4=y
101CONFIG_CPU_ABRT_EV4T=y 100CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig
index 7a2e932da1c6..142cccdd971e 100644
--- a/arch/arm/configs/lpd7a404_defconfig
+++ b/arch/arm/configs/lpd7a404_defconfig
@@ -117,7 +117,6 @@ CONFIG_ARCH_LH7A404=y
117# 117#
118# Processor Type 118# Processor Type
119# 119#
120CONFIG_CPU_32=y
121CONFIG_CPU_ARM922T=y 120CONFIG_CPU_ARM922T=y
122CONFIG_CPU_32v4=y 121CONFIG_CPU_32v4=y
123CONFIG_CPU_ABRT_EV4T=y 122CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/lubbock_defconfig b/arch/arm/configs/lubbock_defconfig
index e544bfbbde5d..75c6293376bb 100644
--- a/arch/arm/configs/lubbock_defconfig
+++ b/arch/arm/configs/lubbock_defconfig
@@ -92,7 +92,6 @@ CONFIG_PXA25x=y
92# 92#
93# Processor Type 93# Processor Type
94# 94#
95CONFIG_CPU_32=y
96CONFIG_CPU_XSCALE=y 95CONFIG_CPU_XSCALE=y
97CONFIG_CPU_32v5=y 96CONFIG_CPU_32v5=y
98CONFIG_CPU_ABRT_EV5T=y 97CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/lusl7200_defconfig b/arch/arm/configs/lusl7200_defconfig
index 42f6a77bc3c0..c1a1fb049a7c 100644
--- a/arch/arm/configs/lusl7200_defconfig
+++ b/arch/arm/configs/lusl7200_defconfig
@@ -82,7 +82,6 @@ CONFIG_ARCH_L7200=y
82# 82#
83# Processor Type 83# Processor Type
84# 84#
85CONFIG_CPU_32=y
86CONFIG_CPU_ARM720T=y 85CONFIG_CPU_ARM720T=y
87CONFIG_CPU_32v4=y 86CONFIG_CPU_32v4=y
88CONFIG_CPU_ABRT_LV4T=y 87CONFIG_CPU_ABRT_LV4T=y
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig
index 957fd5fa27ca..8e9a7232bc42 100644
--- a/arch/arm/configs/magician_defconfig
+++ b/arch/arm/configs/magician_defconfig
@@ -204,7 +204,6 @@ CONFIG_PXA_HAVE_BOARD_IRQS=y
204# 204#
205# Processor Type 205# Processor Type
206# 206#
207CONFIG_CPU_32=y
208CONFIG_CPU_XSCALE=y 207CONFIG_CPU_XSCALE=y
209CONFIG_CPU_32v5=y 208CONFIG_CPU_32v5=y
210CONFIG_CPU_ABRT_EV5T=y 209CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/mainstone_defconfig b/arch/arm/configs/mainstone_defconfig
index cc8c95b99292..1cddb6178496 100644
--- a/arch/arm/configs/mainstone_defconfig
+++ b/arch/arm/configs/mainstone_defconfig
@@ -93,7 +93,6 @@ CONFIG_IWMMXT=y
93# 93#
94# Processor Type 94# Processor Type
95# 95#
96CONFIG_CPU_32=y
97CONFIG_CPU_XSCALE=y 96CONFIG_CPU_XSCALE=y
98CONFIG_CPU_32v5=y 97CONFIG_CPU_32v5=y
99CONFIG_CPU_ABRT_EV5T=y 98CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig
index e49ed40f3be7..d2a90eb844a9 100644
--- a/arch/arm/configs/mini2440_defconfig
+++ b/arch/arm/configs/mini2440_defconfig
@@ -256,7 +256,6 @@ CONFIG_MACH_MINI2440=y
256# 256#
257# Processor Type 257# Processor Type
258# 258#
259CONFIG_CPU_32=y
260CONFIG_CPU_ARM920T=y 259CONFIG_CPU_ARM920T=y
261CONFIG_CPU_32v4T=y 260CONFIG_CPU_32v4T=y
262CONFIG_CPU_ABRT_EV4T=y 261CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index cc3b06ee24f9..fe25e3b9a45a 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -155,7 +155,6 @@ CONFIG_MSM_SMD=y
155# 155#
156# Processor Type 156# Processor Type
157# 157#
158CONFIG_CPU_32=y
159CONFIG_CPU_V6=y 158CONFIG_CPU_V6=y
160# CONFIG_CPU_32v6K is not set 159# CONFIG_CPU_32v6K is not set
161CONFIG_CPU_32v6=y 160CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/mv78xx0_defconfig b/arch/arm/configs/mv78xx0_defconfig
index 398274b0771a..6afa2c108eaa 100644
--- a/arch/arm/configs/mv78xx0_defconfig
+++ b/arch/arm/configs/mv78xx0_defconfig
@@ -181,7 +181,6 @@ CONFIG_PLAT_ORION=y
181# 181#
182# Processor Type 182# Processor Type
183# 183#
184CONFIG_CPU_32=y
185CONFIG_CPU_FEROCEON=y 184CONFIG_CPU_FEROCEON=y
186CONFIG_CPU_FEROCEON_OLD_ID=y 185CONFIG_CPU_FEROCEON_OLD_ID=y
187CONFIG_CPU_32v5=y 186CONFIG_CPU_32v5=y
diff --git a/arch/arm/configs/mx1_defconfig b/arch/arm/configs/mx1_defconfig
index 0200d67e30ba..f5750703b707 100644
--- a/arch/arm/configs/mx1_defconfig
+++ b/arch/arm/configs/mx1_defconfig
@@ -190,7 +190,6 @@ CONFIG_MXC_IRQ_PRIOR=y
190# 190#
191# Processor Type 191# Processor Type
192# 192#
193CONFIG_CPU_32=y
194CONFIG_CPU_ARM920T=y 193CONFIG_CPU_ARM920T=y
195CONFIG_CPU_32v4T=y 194CONFIG_CPU_32v4T=y
196CONFIG_CPU_ABRT_EV4T=y 195CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/mx1ads_defconfig b/arch/arm/configs/mx1ads_defconfig
index 577d7e1b5d42..3cabbb6d9276 100644
--- a/arch/arm/configs/mx1ads_defconfig
+++ b/arch/arm/configs/mx1ads_defconfig
@@ -88,7 +88,6 @@ CONFIG_ARCH_MX1ADS=y
88# 88#
89# Processor Type 89# Processor Type
90# 90#
91CONFIG_CPU_32=y
92CONFIG_CPU_ARM920T=y 91CONFIG_CPU_ARM920T=y
93CONFIG_CPU_32v4=y 92CONFIG_CPU_32v4=y
94CONFIG_CPU_ABRT_EV4T=y 93CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/mx21_defconfig b/arch/arm/configs/mx21_defconfig
index 4b04290d8e81..1ecd6276e0f1 100644
--- a/arch/arm/configs/mx21_defconfig
+++ b/arch/arm/configs/mx21_defconfig
@@ -185,7 +185,6 @@ CONFIG_MXC_PWM=y
185# 185#
186# Processor Type 186# Processor Type
187# 187#
188CONFIG_CPU_32=y
189CONFIG_CPU_ARM926T=y 188CONFIG_CPU_ARM926T=y
190CONFIG_CPU_32v5=y 189CONFIG_CPU_32v5=y
191CONFIG_CPU_ABRT_EV5TJ=y 190CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/mx27_defconfig b/arch/arm/configs/mx27_defconfig
index 75263a83741c..edfdd6faf800 100644
--- a/arch/arm/configs/mx27_defconfig
+++ b/arch/arm/configs/mx27_defconfig
@@ -207,7 +207,6 @@ CONFIG_MXC_PWM=y
207# 207#
208# Processor Type 208# Processor Type
209# 209#
210CONFIG_CPU_32=y
211CONFIG_CPU_ARM926T=y 210CONFIG_CPU_ARM926T=y
212CONFIG_CPU_32v5=y 211CONFIG_CPU_32v5=y
213CONFIG_CPU_ABRT_EV5TJ=y 212CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/mx31pdk_defconfig b/arch/arm/configs/mx31pdk_defconfig
index 95ffc0db95a0..d40953798d9e 100644
--- a/arch/arm/configs/mx31pdk_defconfig
+++ b/arch/arm/configs/mx31pdk_defconfig
@@ -173,7 +173,6 @@ CONFIG_MACH_MX31_3DS=y
173# 173#
174# Processor Type 174# Processor Type
175# 175#
176CONFIG_CPU_32=y
177CONFIG_CPU_V6=y 176CONFIG_CPU_V6=y
178# CONFIG_CPU_32v6K is not set 177# CONFIG_CPU_32v6K is not set
179CONFIG_CPU_32v6=y 178CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/mx3_defconfig b/arch/arm/configs/mx3_defconfig
index 7734ccab2119..8a06bc64fe59 100644
--- a/arch/arm/configs/mx3_defconfig
+++ b/arch/arm/configs/mx3_defconfig
@@ -218,7 +218,6 @@ CONFIG_ARCH_MXC_IOMUX_V3=y
218# 218#
219# Processor Type 219# Processor Type
220# 220#
221CONFIG_CPU_32=y
222CONFIG_CPU_V6=y 221CONFIG_CPU_V6=y
223# CONFIG_CPU_32v6K is not set 222# CONFIG_CPU_32v6K is not set
224CONFIG_CPU_32v6=y 223CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/n770_defconfig b/arch/arm/configs/n770_defconfig
index a1657b73683f..75cae18fbcb6 100644
--- a/arch/arm/configs/n770_defconfig
+++ b/arch/arm/configs/n770_defconfig
@@ -210,7 +210,6 @@ CONFIG_OMAP_ARM_216MHZ=y
210# 210#
211# Processor Type 211# Processor Type
212# 212#
213CONFIG_CPU_32=y
214CONFIG_CPU_ARM926T=y 213CONFIG_CPU_ARM926T=y
215CONFIG_CPU_32v5=y 214CONFIG_CPU_32v5=y
216CONFIG_CPU_ABRT_EV5TJ=y 215CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/n8x0_defconfig b/arch/arm/configs/n8x0_defconfig
index 264f52b5c52d..e6f667c5e58a 100644
--- a/arch/arm/configs/n8x0_defconfig
+++ b/arch/arm/configs/n8x0_defconfig
@@ -232,7 +232,6 @@ CONFIG_MACH_NOKIA_N8X0=y
232# 232#
233# Processor Type 233# Processor Type
234# 234#
235CONFIG_CPU_32=y
236CONFIG_CPU_V6=y 235CONFIG_CPU_V6=y
237# CONFIG_CPU_32v6K is not set 236# CONFIG_CPU_32v6K is not set
238CONFIG_CPU_32v6=y 237CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/neocore926_defconfig b/arch/arm/configs/neocore926_defconfig
index e0e4e98b5aa2..d165c757e44c 100644
--- a/arch/arm/configs/neocore926_defconfig
+++ b/arch/arm/configs/neocore926_defconfig
@@ -218,7 +218,6 @@ CONFIG_AT91_EARLY_DBGU=y
218# 218#
219# Processor Type 219# Processor Type
220# 220#
221CONFIG_CPU_32=y
222CONFIG_CPU_ARM926T=y 221CONFIG_CPU_ARM926T=y
223CONFIG_CPU_32v5=y 222CONFIG_CPU_32v5=y
224CONFIG_CPU_ABRT_EV5TJ=y 223CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/neponset_defconfig b/arch/arm/configs/neponset_defconfig
index 36cd62edd05c..171265ed02ef 100644
--- a/arch/arm/configs/neponset_defconfig
+++ b/arch/arm/configs/neponset_defconfig
@@ -103,7 +103,6 @@ CONFIG_ASSABET_NEPONSET=y
103# 103#
104# Processor Type 104# Processor Type
105# 105#
106CONFIG_CPU_32=y
107CONFIG_CPU_SA1100=y 106CONFIG_CPU_SA1100=y
108CONFIG_CPU_32v4=y 107CONFIG_CPU_32v4=y
109CONFIG_CPU_ABRT_EV4=y 108CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/netwinder_defconfig b/arch/arm/configs/netwinder_defconfig
index c1a63a35c58d..78f58a99c5a3 100644
--- a/arch/arm/configs/netwinder_defconfig
+++ b/arch/arm/configs/netwinder_defconfig
@@ -89,7 +89,6 @@ CONFIG_FOOTBRIDGE_HOST=y
89# 89#
90# Processor Type 90# Processor Type
91# 91#
92CONFIG_CPU_32=y
93CONFIG_CPU_SA110=y 92CONFIG_CPU_SA110=y
94CONFIG_CPU_32v4=y 93CONFIG_CPU_32v4=y
95CONFIG_CPU_ABRT_EV4=y 94CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/netx_defconfig b/arch/arm/configs/netx_defconfig
index 61d0fc5b2417..2a97e361ec7b 100644
--- a/arch/arm/configs/netx_defconfig
+++ b/arch/arm/configs/netx_defconfig
@@ -122,7 +122,6 @@ CONFIG_MACH_NXEB500HMI=y
122# 122#
123# Processor Type 123# Processor Type
124# 124#
125CONFIG_CPU_32=y
126CONFIG_CPU_ARM926T=y 125CONFIG_CPU_ARM926T=y
127CONFIG_CPU_32v5=y 126CONFIG_CPU_32v5=y
128CONFIG_CPU_ABRT_EV5TJ=y 127CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 600cb270f2bf..92d90862f5ed 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -191,7 +191,6 @@ CONFIG_I2C_BITBANG_8815NHK=y
191# 191#
192# Processor Type 192# Processor Type
193# 193#
194CONFIG_CPU_32=y
195CONFIG_CPU_ARM926T=y 194CONFIG_CPU_ARM926T=y
196CONFIG_CPU_32v5=y 195CONFIG_CPU_32v5=y
197CONFIG_CPU_ABRT_EV5TJ=y 196CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/nuc910_defconfig b/arch/arm/configs/nuc910_defconfig
index 5245655a0ad3..f80848a929ae 100644
--- a/arch/arm/configs/nuc910_defconfig
+++ b/arch/arm/configs/nuc910_defconfig
@@ -180,7 +180,6 @@ CONFIG_MACH_W90P910EVB=y
180# 180#
181# Processor Type 181# Processor Type
182# 182#
183CONFIG_CPU_32=y
184CONFIG_CPU_ARM926T=y 183CONFIG_CPU_ARM926T=y
185CONFIG_CPU_32v5=y 184CONFIG_CPU_32v5=y
186CONFIG_CPU_ABRT_EV5TJ=y 185CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/nuc950_defconfig b/arch/arm/configs/nuc950_defconfig
index df1de9b45ca4..97300ec478dd 100644
--- a/arch/arm/configs/nuc950_defconfig
+++ b/arch/arm/configs/nuc950_defconfig
@@ -201,7 +201,6 @@ CONFIG_MACH_W90P950EVB=y
201# 201#
202# Processor Type 202# Processor Type
203# 203#
204CONFIG_CPU_32=y
205CONFIG_CPU_ARM926T=y 204CONFIG_CPU_ARM926T=y
206CONFIG_CPU_32v5=y 205CONFIG_CPU_32v5=y
207CONFIG_CPU_ABRT_EV5TJ=y 206CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/nuc960_defconfig b/arch/arm/configs/nuc960_defconfig
index 4b2cd9eae9bc..aa7e128f5d79 100644
--- a/arch/arm/configs/nuc960_defconfig
+++ b/arch/arm/configs/nuc960_defconfig
@@ -201,7 +201,6 @@ CONFIG_MACH_W90N960EVB=y
201# 201#
202# Processor Type 202# Processor Type
203# 203#
204CONFIG_CPU_32=y
205CONFIG_CPU_ARM926T=y 204CONFIG_CPU_ARM926T=y
206CONFIG_CPU_32v5=y 205CONFIG_CPU_32v5=y
207CONFIG_CPU_ABRT_EV5TJ=y 206CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap3_beagle_defconfig b/arch/arm/configs/omap3_beagle_defconfig
index 9cfae374e041..c7999f5b1c9a 100644
--- a/arch/arm/configs/omap3_beagle_defconfig
+++ b/arch/arm/configs/omap3_beagle_defconfig
@@ -213,7 +213,6 @@ CONFIG_MACH_OMAP3_BEAGLE=y
213# 213#
214# Processor Type 214# Processor Type
215# 215#
216CONFIG_CPU_32=y
217CONFIG_CPU_32v6K=y 216CONFIG_CPU_32v6K=y
218CONFIG_CPU_V7=y 217CONFIG_CPU_V7=y
219CONFIG_CPU_32v7=y 218CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap3_defconfig b/arch/arm/configs/omap3_defconfig
index 2af28eab9060..367be98a6aef 100644
--- a/arch/arm/configs/omap3_defconfig
+++ b/arch/arm/configs/omap3_defconfig
@@ -245,7 +245,6 @@ CONFIG_MACH_OMAP_3630SDP=y
245# 245#
246# Processor Type 246# Processor Type
247# 247#
248CONFIG_CPU_32=y
249CONFIG_CPU_32v6K=y 248CONFIG_CPU_32v6K=y
250CONFIG_CPU_V7=y 249CONFIG_CPU_V7=y
251CONFIG_CPU_32v7=y 250CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap3_evm_defconfig b/arch/arm/configs/omap3_evm_defconfig
index e190fc8b9a7c..86cc4bea616b 100644
--- a/arch/arm/configs/omap3_evm_defconfig
+++ b/arch/arm/configs/omap3_evm_defconfig
@@ -220,7 +220,6 @@ CONFIG_MACH_OMAP3EVM=y
220# 220#
221# Processor Type 221# Processor Type
222# 222#
223CONFIG_CPU_32=y
224CONFIG_CPU_32v6K=y 223CONFIG_CPU_32v6K=y
225CONFIG_CPU_V7=y 224CONFIG_CPU_V7=y
226CONFIG_CPU_32v7=y 225CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap3_pandora_defconfig b/arch/arm/configs/omap3_pandora_defconfig
index b7a8d9fa49db..f74eb9a1d191 100644
--- a/arch/arm/configs/omap3_pandora_defconfig
+++ b/arch/arm/configs/omap3_pandora_defconfig
@@ -211,7 +211,6 @@ CONFIG_MACH_OMAP3_PANDORA=y
211# 211#
212# Processor Type 212# Processor Type
213# 213#
214CONFIG_CPU_32=y
215CONFIG_CPU_32v6K=y 214CONFIG_CPU_32v6K=y
216CONFIG_CPU_V7=y 215CONFIG_CPU_V7=y
217CONFIG_CPU_32v7=y 216CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap3_touchbook_defconfig b/arch/arm/configs/omap3_touchbook_defconfig
index 7c8515e65c02..74fe6be9c5ec 100644
--- a/arch/arm/configs/omap3_touchbook_defconfig
+++ b/arch/arm/configs/omap3_touchbook_defconfig
@@ -246,7 +246,6 @@ CONFIG_MACH_OMAP3_TOUCHBOOK=y
246# 246#
247# Processor Type 247# Processor Type
248# 248#
249CONFIG_CPU_32=y
250CONFIG_CPU_32v6K=y 249CONFIG_CPU_32v6K=y
251CONFIG_CPU_V7=y 250CONFIG_CPU_V7=y
252CONFIG_CPU_32v7=y 251CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap_2430sdp_defconfig b/arch/arm/configs/omap_2430sdp_defconfig
index 640e9afc4630..45b4ebae3056 100644
--- a/arch/arm/configs/omap_2430sdp_defconfig
+++ b/arch/arm/configs/omap_2430sdp_defconfig
@@ -197,7 +197,6 @@ CONFIG_MACH_OMAP_2430SDP=y
197# 197#
198# Processor Type 198# Processor Type
199# 199#
200CONFIG_CPU_32=y
201CONFIG_CPU_V6=y 200CONFIG_CPU_V6=y
202# CONFIG_CPU_32v6K is not set 201# CONFIG_CPU_32v6K is not set
203CONFIG_CPU_32v6=y 202CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/omap_3430sdp_defconfig b/arch/arm/configs/omap_3430sdp_defconfig
index 592457cfbbe5..bb2917e5cb47 100644
--- a/arch/arm/configs/omap_3430sdp_defconfig
+++ b/arch/arm/configs/omap_3430sdp_defconfig
@@ -232,7 +232,6 @@ CONFIG_MACH_OMAP_3430SDP=y
232# 232#
233# Processor Type 233# Processor Type
234# 234#
235CONFIG_CPU_32=y
236CONFIG_CPU_32v6K=y 235CONFIG_CPU_32v6K=y
237CONFIG_CPU_V7=y 236CONFIG_CPU_V7=y
238CONFIG_CPU_32v7=y 237CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap_3630sdp_defconfig b/arch/arm/configs/omap_3630sdp_defconfig
index e836c8a00148..d25c3d4424ca 100644
--- a/arch/arm/configs/omap_3630sdp_defconfig
+++ b/arch/arm/configs/omap_3630sdp_defconfig
@@ -236,7 +236,6 @@ CONFIG_MACH_OMAP_3630SDP=y
236# 236#
237# Processor Type 237# Processor Type
238# 238#
239CONFIG_CPU_32=y
240CONFIG_CPU_32v6K=y 239CONFIG_CPU_32v6K=y
241CONFIG_CPU_V7=y 240CONFIG_CPU_V7=y
242CONFIG_CPU_32v7=y 241CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap_4430sdp_defconfig b/arch/arm/configs/omap_4430sdp_defconfig
index 2319113c86bf..3de640ac294b 100644
--- a/arch/arm/configs/omap_4430sdp_defconfig
+++ b/arch/arm/configs/omap_4430sdp_defconfig
@@ -220,7 +220,6 @@ CONFIG_MACH_OMAP_4430SDP=y
220# 220#
221# Processor Type 221# Processor Type
222# 222#
223CONFIG_CPU_32=y
224CONFIG_CPU_32v6K=y 223CONFIG_CPU_32v6K=y
225CONFIG_CPU_V7=y 224CONFIG_CPU_V7=y
226CONFIG_CPU_32v7=y 225CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap_apollon_2420_defconfig b/arch/arm/configs/omap_apollon_2420_defconfig
index ac7adf34c54a..cc86342896a0 100644
--- a/arch/arm/configs/omap_apollon_2420_defconfig
+++ b/arch/arm/configs/omap_apollon_2420_defconfig
@@ -196,7 +196,6 @@ CONFIG_MACH_OMAP_APOLLON=y
196# 196#
197# Processor Type 197# Processor Type
198# 198#
199CONFIG_CPU_32=y
200CONFIG_CPU_V6=y 199CONFIG_CPU_V6=y
201# CONFIG_CPU_32v6K is not set 200# CONFIG_CPU_32v6K is not set
202CONFIG_CPU_32v6=y 201CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/omap_generic_1510_defconfig b/arch/arm/configs/omap_generic_1510_defconfig
index ccdc661b5856..61744e507e47 100644
--- a/arch/arm/configs/omap_generic_1510_defconfig
+++ b/arch/arm/configs/omap_generic_1510_defconfig
@@ -205,7 +205,6 @@ CONFIG_OMAP_ARM_168MHZ=y
205# 205#
206# Processor Type 206# Processor Type
207# 207#
208CONFIG_CPU_32=y
209CONFIG_CPU_ARM925T=y 208CONFIG_CPU_ARM925T=y
210CONFIG_CPU_32v4T=y 209CONFIG_CPU_32v4T=y
211CONFIG_CPU_ABRT_EV4T=y 210CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/omap_generic_1610_defconfig b/arch/arm/configs/omap_generic_1610_defconfig
index 0c42c8955047..d773857ed0cd 100644
--- a/arch/arm/configs/omap_generic_1610_defconfig
+++ b/arch/arm/configs/omap_generic_1610_defconfig
@@ -207,7 +207,6 @@ CONFIG_OMAP_ARM_192MHZ=y
207# 207#
208# Processor Type 208# Processor Type
209# 209#
210CONFIG_CPU_32=y
211CONFIG_CPU_ARM926T=y 210CONFIG_CPU_ARM926T=y
212CONFIG_CPU_32v5=y 211CONFIG_CPU_32v5=y
213CONFIG_CPU_ABRT_EV5TJ=y 212CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap_generic_1710_defconfig b/arch/arm/configs/omap_generic_1710_defconfig
index 0a00a708a4fc..6ec487e6e027 100644
--- a/arch/arm/configs/omap_generic_1710_defconfig
+++ b/arch/arm/configs/omap_generic_1710_defconfig
@@ -201,7 +201,6 @@ CONFIG_OMAP_ARM_192MHZ=y
201# 201#
202# Processor Type 202# Processor Type
203# 203#
204CONFIG_CPU_32=y
205CONFIG_CPU_ARM926T=y 204CONFIG_CPU_ARM926T=y
206CONFIG_CPU_32v5=y 205CONFIG_CPU_32v5=y
207CONFIG_CPU_ABRT_EV5TJ=y 206CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap_generic_2420_defconfig b/arch/arm/configs/omap_generic_2420_defconfig
index cf4073b47aaa..7218b96c0b76 100644
--- a/arch/arm/configs/omap_generic_2420_defconfig
+++ b/arch/arm/configs/omap_generic_2420_defconfig
@@ -191,7 +191,6 @@ CONFIG_ARCH_OMAP2420=y
191# 191#
192# Processor Type 192# Processor Type
193# 193#
194CONFIG_CPU_32=y
195CONFIG_CPU_V6=y 194CONFIG_CPU_V6=y
196# CONFIG_CPU_32v6K is not set 195# CONFIG_CPU_32v6K is not set
197CONFIG_CPU_32v6=y 196CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/omap_h2_1610_defconfig b/arch/arm/configs/omap_h2_1610_defconfig
index 74dbdc644d32..523189586a4b 100644
--- a/arch/arm/configs/omap_h2_1610_defconfig
+++ b/arch/arm/configs/omap_h2_1610_defconfig
@@ -231,7 +231,6 @@ CONFIG_OMAP_ARM_60MHZ=y
231# 231#
232# Processor Type 232# Processor Type
233# 233#
234CONFIG_CPU_32=y
235CONFIG_CPU_ARM926T=y 234CONFIG_CPU_ARM926T=y
236CONFIG_CPU_32v5=y 235CONFIG_CPU_32v5=y
237CONFIG_CPU_ABRT_EV5TJ=y 236CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap_h4_2420_defconfig b/arch/arm/configs/omap_h4_2420_defconfig
index a4aab8e4c29b..b12b406c1960 100644
--- a/arch/arm/configs/omap_h4_2420_defconfig
+++ b/arch/arm/configs/omap_h4_2420_defconfig
@@ -201,7 +201,6 @@ CONFIG_MACH_OMAP_H4=y
201# 201#
202# Processor Type 202# Processor Type
203# 203#
204CONFIG_CPU_32=y
205CONFIG_CPU_V6=y 204CONFIG_CPU_V6=y
206# CONFIG_CPU_32v6K is not set 205# CONFIG_CPU_32v6K is not set
207CONFIG_CPU_32v6=y 206CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/omap_innovator_1510_defconfig b/arch/arm/configs/omap_innovator_1510_defconfig
index 0cfe363e3365..e9c140821256 100644
--- a/arch/arm/configs/omap_innovator_1510_defconfig
+++ b/arch/arm/configs/omap_innovator_1510_defconfig
@@ -205,7 +205,6 @@ CONFIG_OMAP_ARM_168MHZ=y
205# 205#
206# Processor Type 206# Processor Type
207# 207#
208CONFIG_CPU_32=y
209CONFIG_CPU_ARM925T=y 208CONFIG_CPU_ARM925T=y
210CONFIG_CPU_32v4T=y 209CONFIG_CPU_32v4T=y
211CONFIG_CPU_ABRT_EV4T=y 210CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/omap_innovator_1610_defconfig b/arch/arm/configs/omap_innovator_1610_defconfig
index 95d9f2be53e0..fea9319ed7fd 100644
--- a/arch/arm/configs/omap_innovator_1610_defconfig
+++ b/arch/arm/configs/omap_innovator_1610_defconfig
@@ -206,7 +206,6 @@ CONFIG_OMAP_ARM_192MHZ=y
206# 206#
207# Processor Type 207# Processor Type
208# 208#
209CONFIG_CPU_32=y
210CONFIG_CPU_ARM926T=y 209CONFIG_CPU_ARM926T=y
211CONFIG_CPU_32v5=y 210CONFIG_CPU_32v5=y
212CONFIG_CPU_ABRT_EV5TJ=y 211CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
index 9139532c3be7..0efb4b044fff 100644
--- a/arch/arm/configs/omap_ldp_defconfig
+++ b/arch/arm/configs/omap_ldp_defconfig
@@ -214,7 +214,6 @@ CONFIG_MACH_OMAP_LDP=y
214# 214#
215# Processor Type 215# Processor Type
216# 216#
217CONFIG_CPU_32=y
218CONFIG_CPU_32v6K=y 217CONFIG_CPU_32v6K=y
219CONFIG_CPU_V7=y 218CONFIG_CPU_V7=y
220CONFIG_CPU_32v7=y 219CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap_osk_5912_defconfig b/arch/arm/configs/omap_osk_5912_defconfig
index 6b3b5c610da0..556fcca1b1db 100644
--- a/arch/arm/configs/omap_osk_5912_defconfig
+++ b/arch/arm/configs/omap_osk_5912_defconfig
@@ -212,7 +212,6 @@ CONFIG_OMAP_ARM_192MHZ=y
212# 212#
213# Processor Type 213# Processor Type
214# 214#
215CONFIG_CPU_32=y
216CONFIG_CPU_ARM926T=y 215CONFIG_CPU_ARM926T=y
217CONFIG_CPU_32v5=y 216CONFIG_CPU_32v5=y
218CONFIG_CPU_ABRT_EV5TJ=y 217CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap_perseus2_730_defconfig b/arch/arm/configs/omap_perseus2_730_defconfig
index b94800c0e000..9a15d5da57f9 100644
--- a/arch/arm/configs/omap_perseus2_730_defconfig
+++ b/arch/arm/configs/omap_perseus2_730_defconfig
@@ -199,7 +199,6 @@ CONFIG_OMAP_ARM_182MHZ=y
199# 199#
200# Processor Type 200# Processor Type
201# 201#
202CONFIG_CPU_32=y
203CONFIG_CPU_ARM926T=y 202CONFIG_CPU_ARM926T=y
204CONFIG_CPU_32v5=y 203CONFIG_CPU_32v5=y
205CONFIG_CPU_ABRT_EV5TJ=y 204CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/omap_zoom2_defconfig b/arch/arm/configs/omap_zoom2_defconfig
index 4b00a4306812..a82e81332a03 100644
--- a/arch/arm/configs/omap_zoom2_defconfig
+++ b/arch/arm/configs/omap_zoom2_defconfig
@@ -222,7 +222,6 @@ CONFIG_MACH_OMAP_ZOOM2=y
222# 222#
223# Processor Type 223# Processor Type
224# 224#
225CONFIG_CPU_32=y
226CONFIG_CPU_32v6K=y 225CONFIG_CPU_32v6K=y
227CONFIG_CPU_V7=y 226CONFIG_CPU_V7=y
228CONFIG_CPU_32v7=y 227CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/omap_zoom3_defconfig b/arch/arm/configs/omap_zoom3_defconfig
index 0d7e37a3651b..a3e3c8274c9b 100644
--- a/arch/arm/configs/omap_zoom3_defconfig
+++ b/arch/arm/configs/omap_zoom3_defconfig
@@ -236,7 +236,6 @@ CONFIG_MACH_OMAP_ZOOM3=y
236# 236#
237# Processor Type 237# Processor Type
238# 238#
239CONFIG_CPU_32=y
240CONFIG_CPU_32v6K=y 239CONFIG_CPU_32v6K=y
241CONFIG_CPU_V7=y 240CONFIG_CPU_V7=y
242CONFIG_CPU_32v7=y 241CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/onearm_defconfig b/arch/arm/configs/onearm_defconfig
index f8701fadb600..19b91dedc7fe 100644
--- a/arch/arm/configs/onearm_defconfig
+++ b/arch/arm/configs/onearm_defconfig
@@ -161,7 +161,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
161# 161#
162# Processor Type 162# Processor Type
163# 163#
164CONFIG_CPU_32=y
165CONFIG_CPU_ARM920T=y 164CONFIG_CPU_ARM920T=y
166CONFIG_CPU_32v4T=y 165CONFIG_CPU_32v4T=y
167CONFIG_CPU_ABRT_EV4T=y 166CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig
index 5383cd0dff54..85b05d3e279b 100644
--- a/arch/arm/configs/orion5x_defconfig
+++ b/arch/arm/configs/orion5x_defconfig
@@ -210,7 +210,6 @@ CONFIG_PLAT_ORION=y
210# 210#
211# Processor Type 211# Processor Type
212# 212#
213CONFIG_CPU_32=y
214CONFIG_CPU_FEROCEON=y 213CONFIG_CPU_FEROCEON=y
215CONFIG_CPU_FEROCEON_OLD_ID=y 214CONFIG_CPU_FEROCEON_OLD_ID=y
216CONFIG_CPU_32v5=y 215CONFIG_CPU_32v5=y
diff --git a/arch/arm/configs/overo_defconfig b/arch/arm/configs/overo_defconfig
index b3ea2c4c0f91..bf06d3660a30 100644
--- a/arch/arm/configs/overo_defconfig
+++ b/arch/arm/configs/overo_defconfig
@@ -217,7 +217,6 @@ CONFIG_MACH_OVERO=y
217# 217#
218# Processor Type 218# Processor Type
219# 219#
220CONFIG_CPU_32=y
221CONFIG_CPU_32v6K=y 220CONFIG_CPU_32v6K=y
222CONFIG_CPU_V7=y 221CONFIG_CPU_V7=y
223CONFIG_CPU_32v7=y 222CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/palmte_defconfig b/arch/arm/configs/palmte_defconfig
index 40fc6a778e00..feffaa2deae2 100644
--- a/arch/arm/configs/palmte_defconfig
+++ b/arch/arm/configs/palmte_defconfig
@@ -196,7 +196,6 @@ CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
196# 196#
197# Processor Type 197# Processor Type
198# 198#
199CONFIG_CPU_32=y
200CONFIG_CPU_ARM925T=y 199CONFIG_CPU_ARM925T=y
201CONFIG_CPU_32v4T=y 200CONFIG_CPU_32v4T=y
202CONFIG_CPU_ABRT_EV4T=y 201CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/palmtt_defconfig b/arch/arm/configs/palmtt_defconfig
index e54ced41217e..55d5b7dfb7a6 100644
--- a/arch/arm/configs/palmtt_defconfig
+++ b/arch/arm/configs/palmtt_defconfig
@@ -176,7 +176,6 @@ CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
176# 176#
177# Processor Type 177# Processor Type
178# 178#
179CONFIG_CPU_32=y
180CONFIG_CPU_ARM925T=y 179CONFIG_CPU_ARM925T=y
181CONFIG_CPU_32v4T=y 180CONFIG_CPU_32v4T=y
182CONFIG_CPU_ABRT_EV4T=y 181CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/palmz71_defconfig b/arch/arm/configs/palmz71_defconfig
index 08e14068fff7..6efc7465a76c 100644
--- a/arch/arm/configs/palmz71_defconfig
+++ b/arch/arm/configs/palmz71_defconfig
@@ -200,7 +200,6 @@ CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
200# 200#
201# Processor Type 201# Processor Type
202# 202#
203CONFIG_CPU_32=y
204CONFIG_CPU_ARM925T=y 203CONFIG_CPU_ARM925T=y
205CONFIG_CPU_32v4T=y 204CONFIG_CPU_32v4T=y
206CONFIG_CPU_ABRT_EV4T=y 205CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/palmz72_defconfig b/arch/arm/configs/palmz72_defconfig
index a0dc37c05dea..6d162b137ce8 100644
--- a/arch/arm/configs/palmz72_defconfig
+++ b/arch/arm/configs/palmz72_defconfig
@@ -209,7 +209,6 @@ CONFIG_PXA_PWM=y
209# 209#
210# Processor Type 210# Processor Type
211# 211#
212CONFIG_CPU_32=y
213CONFIG_CPU_XSCALE=y 212CONFIG_CPU_XSCALE=y
214CONFIG_CPU_32v5=y 213CONFIG_CPU_32v5=y
215CONFIG_CPU_ABRT_EV5T=y 214CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/pcm027_defconfig b/arch/arm/configs/pcm027_defconfig
index 05ad96a43b1d..fa153f2711bb 100644
--- a/arch/arm/configs/pcm027_defconfig
+++ b/arch/arm/configs/pcm027_defconfig
@@ -168,7 +168,6 @@ CONFIG_PXA27x=y
168# 168#
169# Processor Type 169# Processor Type
170# 170#
171CONFIG_CPU_32=y
172CONFIG_CPU_XSCALE=y 171CONFIG_CPU_XSCALE=y
173CONFIG_CPU_32v5=y 172CONFIG_CPU_32v5=y
174CONFIG_CPU_ABRT_EV5T=y 173CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/picotux200_defconfig b/arch/arm/configs/picotux200_defconfig
index 9018f0f298aa..6e7155c122a4 100644
--- a/arch/arm/configs/picotux200_defconfig
+++ b/arch/arm/configs/picotux200_defconfig
@@ -168,7 +168,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
168# 168#
169# Processor Type 169# Processor Type
170# 170#
171CONFIG_CPU_32=y
172CONFIG_CPU_ARM920T=y 171CONFIG_CPU_ARM920T=y
173CONFIG_CPU_32v4T=y 172CONFIG_CPU_32v4T=y
174CONFIG_CPU_ABRT_EV4T=y 173CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/pleb_defconfig b/arch/arm/configs/pleb_defconfig
index f2d2dda25949..dbfabb5eede8 100644
--- a/arch/arm/configs/pleb_defconfig
+++ b/arch/arm/configs/pleb_defconfig
@@ -100,7 +100,6 @@ CONFIG_SA1100_PLEB=y
100# 100#
101# Processor Type 101# Processor Type
102# 102#
103CONFIG_CPU_32=y
104CONFIG_CPU_SA1100=y 103CONFIG_CPU_SA1100=y
105CONFIG_CPU_32v4=y 104CONFIG_CPU_32v4=y
106CONFIG_CPU_ABRT_EV4=y 105CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/pnx4008_defconfig b/arch/arm/configs/pnx4008_defconfig
index 67b5f1e15f4a..2f7b9ce7dad3 100644
--- a/arch/arm/configs/pnx4008_defconfig
+++ b/arch/arm/configs/pnx4008_defconfig
@@ -121,7 +121,6 @@ CONFIG_ARCH_PNX4008=y
121# 121#
122# Processor Type 122# Processor Type
123# 123#
124CONFIG_CPU_32=y
125CONFIG_CPU_ARM926T=y 124CONFIG_CPU_ARM926T=y
126CONFIG_CPU_32v5=y 125CONFIG_CPU_32v5=y
127CONFIG_CPU_ABRT_EV5TJ=y 126CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/pxa168_defconfig b/arch/arm/configs/pxa168_defconfig
index db5faeaec96c..791b8c39aefc 100644
--- a/arch/arm/configs/pxa168_defconfig
+++ b/arch/arm/configs/pxa168_defconfig
@@ -184,7 +184,6 @@ CONFIG_PLAT_PXA=y
184# 184#
185# Processor Type 185# Processor Type
186# 186#
187CONFIG_CPU_32=y
188CONFIG_CPU_MOHAWK=y 187CONFIG_CPU_MOHAWK=y
189CONFIG_CPU_32v5=y 188CONFIG_CPU_32v5=y
190CONFIG_CPU_ABRT_EV5T=y 189CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/pxa255-idp_defconfig b/arch/arm/configs/pxa255-idp_defconfig
index 46e5089df0ae..3365c5d77cad 100644
--- a/arch/arm/configs/pxa255-idp_defconfig
+++ b/arch/arm/configs/pxa255-idp_defconfig
@@ -92,7 +92,6 @@ CONFIG_PXA25x=y
92# 92#
93# Processor Type 93# Processor Type
94# 94#
95CONFIG_CPU_32=y
96CONFIG_CPU_XSCALE=y 95CONFIG_CPU_XSCALE=y
97CONFIG_CPU_32v5=y 96CONFIG_CPU_32v5=y
98CONFIG_CPU_ABRT_EV5T=y 97CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/pxa3xx_defconfig b/arch/arm/configs/pxa3xx_defconfig
index 733b851e5b7e..82ca6c80d6af 100644
--- a/arch/arm/configs/pxa3xx_defconfig
+++ b/arch/arm/configs/pxa3xx_defconfig
@@ -240,7 +240,6 @@ CONFIG_PLAT_PXA=y
240# 240#
241# Processor Type 241# Processor Type
242# 242#
243CONFIG_CPU_32=y
244CONFIG_CPU_XSC3=y 243CONFIG_CPU_XSC3=y
245CONFIG_CPU_32v5=y 244CONFIG_CPU_32v5=y
246CONFIG_CPU_ABRT_EV5T=y 245CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/pxa910_defconfig b/arch/arm/configs/pxa910_defconfig
index 8c7e299f1d66..94e20fe6dbde 100644
--- a/arch/arm/configs/pxa910_defconfig
+++ b/arch/arm/configs/pxa910_defconfig
@@ -184,7 +184,6 @@ CONFIG_PLAT_PXA=y
184# 184#
185# Processor Type 185# Processor Type
186# 186#
187CONFIG_CPU_32=y
188CONFIG_CPU_MOHAWK=y 187CONFIG_CPU_MOHAWK=y
189CONFIG_CPU_32v5=y 188CONFIG_CPU_32v5=y
190CONFIG_CPU_ABRT_EV5T=y 189CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
index 9b32d0eb89ba..12d0d64e3216 100644
--- a/arch/arm/configs/qil-a9260_defconfig
+++ b/arch/arm/configs/qil-a9260_defconfig
@@ -195,7 +195,6 @@ CONFIG_AT91_EARLY_USART0=y
195# 195#
196# Processor Type 196# Processor Type
197# 197#
198CONFIG_CPU_32=y
199CONFIG_CPU_ARM926T=y 198CONFIG_CPU_ARM926T=y
200CONFIG_CPU_32v5=y 199CONFIG_CPU_32v5=y
201CONFIG_CPU_ABRT_EV5TJ=y 200CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index 21db4b3ec8ff..123701754d42 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -186,7 +186,6 @@ CONFIG_REALVIEW_HIGH_PHYS_OFFSET=y
186# 186#
187# Processor Type 187# Processor Type
188# 188#
189CONFIG_CPU_32=y
190# CONFIG_CPU_ARM926T is not set 189# CONFIG_CPU_ARM926T is not set
191CONFIG_CPU_V6=y 190CONFIG_CPU_V6=y
192CONFIG_CPU_32v6K=y 191CONFIG_CPU_32v6K=y
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index 9a75c30b910d..a509a5e59d2c 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -184,7 +184,6 @@ CONFIG_MACH_REALVIEW_PB1176=y
184# 184#
185# Processor Type 185# Processor Type
186# 186#
187CONFIG_CPU_32=y
188# CONFIG_CPU_ARM926T is not set 187# CONFIG_CPU_ARM926T is not set
189CONFIG_CPU_V6=y 188CONFIG_CPU_V6=y
190# CONFIG_CPU_32v6K is not set 189# CONFIG_CPU_32v6K is not set
diff --git a/arch/arm/configs/rpc_defconfig b/arch/arm/configs/rpc_defconfig
index a29d61fe4c6a..e9124a000393 100644
--- a/arch/arm/configs/rpc_defconfig
+++ b/arch/arm/configs/rpc_defconfig
@@ -150,7 +150,6 @@ CONFIG_ARCH_ACORN=y
150# 150#
151# Processor Type 151# Processor Type
152# 152#
153CONFIG_CPU_32=y
154CONFIG_CPU_ARM610=y 153CONFIG_CPU_ARM610=y
155CONFIG_CPU_ARM710=y 154CONFIG_CPU_ARM710=y
156CONFIG_CPU_SA110=y 155CONFIG_CPU_SA110=y
diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig
index 155973426025..b6eeebb31761 100644
--- a/arch/arm/configs/rx51_defconfig
+++ b/arch/arm/configs/rx51_defconfig
@@ -212,7 +212,6 @@ CONFIG_MACH_NOKIA_RX51=y
212# 212#
213# Processor Type 213# Processor Type
214# 214#
215CONFIG_CPU_32=y
216CONFIG_CPU_32v6K=y 215CONFIG_CPU_32v6K=y
217CONFIG_CPU_V7=y 216CONFIG_CPU_V7=y
218CONFIG_CPU_32v7=y 217CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index b49810461e41..2f10dae02796 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -277,7 +277,6 @@ CONFIG_MACH_SMDK2443=y
277# 277#
278# Processor Type 278# Processor Type
279# 279#
280CONFIG_CPU_32=y
281CONFIG_CPU_ARM920T=y 280CONFIG_CPU_ARM920T=y
282CONFIG_CPU_ARM926T=y 281CONFIG_CPU_ARM926T=y
283CONFIG_CPU_32v4T=y 282CONFIG_CPU_32v4T=y
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig
index 32860609e057..f56e50fab79b 100644
--- a/arch/arm/configs/s3c6400_defconfig
+++ b/arch/arm/configs/s3c6400_defconfig
@@ -192,7 +192,6 @@ CONFIG_SMDK6410_SD_CH0=y
192# 192#
193# Processor Type 193# Processor Type
194# 194#
195CONFIG_CPU_32=y
196CONFIG_CPU_V6=y 195CONFIG_CPU_V6=y
197CONFIG_CPU_32v6K=y 196CONFIG_CPU_32v6K=y
198CONFIG_CPU_32v6=y 197CONFIG_CPU_32v6=y
diff --git a/arch/arm/configs/s5pc100_defconfig b/arch/arm/configs/s5pc100_defconfig
index b0d7d3d3a5e3..dc108afc060c 100644
--- a/arch/arm/configs/s5pc100_defconfig
+++ b/arch/arm/configs/s5pc100_defconfig
@@ -202,7 +202,6 @@ CONFIG_MACH_SMDKC100=y
202# 202#
203# Processor Type 203# Processor Type
204# 204#
205CONFIG_CPU_32=y
206CONFIG_CPU_32v6K=y 205CONFIG_CPU_32v6K=y
207CONFIG_CPU_V7=y 206CONFIG_CPU_V7=y
208CONFIG_CPU_32v7=y 207CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/sam9_l9260_defconfig b/arch/arm/configs/sam9_l9260_defconfig
index 1174e2764875..81b290ad5d25 100644
--- a/arch/arm/configs/sam9_l9260_defconfig
+++ b/arch/arm/configs/sam9_l9260_defconfig
@@ -175,7 +175,6 @@ CONFIG_MTD_AT91_DATAFLASH_CARD=y
175# 175#
176# Processor Type 176# Processor Type
177# 177#
178CONFIG_CPU_32=y
179CONFIG_CPU_ARM926T=y 178CONFIG_CPU_ARM926T=y
180CONFIG_CPU_32v5=y 179CONFIG_CPU_32v5=y
181CONFIG_CPU_ABRT_EV5TJ=y 180CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/shannon_defconfig b/arch/arm/configs/shannon_defconfig
index 984f7096a533..7c49bc352462 100644
--- a/arch/arm/configs/shannon_defconfig
+++ b/arch/arm/configs/shannon_defconfig
@@ -99,7 +99,6 @@ CONFIG_SA1100_SHANNON=y
99# 99#
100# Processor Type 100# Processor Type
101# 101#
102CONFIG_CPU_32=y
103CONFIG_CPU_SA1100=y 102CONFIG_CPU_SA1100=y
104CONFIG_CPU_32v4=y 103CONFIG_CPU_32v4=y
105CONFIG_CPU_ABRT_EV4=y 104CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/shark_defconfig b/arch/arm/configs/shark_defconfig
index 90235bf7a1de..46de1247d127 100644
--- a/arch/arm/configs/shark_defconfig
+++ b/arch/arm/configs/shark_defconfig
@@ -173,7 +173,6 @@ CONFIG_ARCH_SHARK=y
173# 173#
174# Processor Type 174# Processor Type
175# 175#
176CONFIG_CPU_32=y
177CONFIG_CPU_SA110=y 176CONFIG_CPU_SA110=y
178CONFIG_CPU_32v4=y 177CONFIG_CPU_32v4=y
179CONFIG_CPU_ABRT_EV4=y 178CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/simpad_defconfig b/arch/arm/configs/simpad_defconfig
index 685d2b513206..ee25e6344151 100644
--- a/arch/arm/configs/simpad_defconfig
+++ b/arch/arm/configs/simpad_defconfig
@@ -101,7 +101,6 @@ CONFIG_SA1100_SIMPAD=y
101# 101#
102# Processor Type 102# Processor Type
103# 103#
104CONFIG_CPU_32=y
105CONFIG_CPU_SA1100=y 104CONFIG_CPU_SA1100=y
106CONFIG_CPU_32v4=y 105CONFIG_CPU_32v4=y
107CONFIG_CPU_ABRT_EV4=y 106CONFIG_CPU_ABRT_EV4=y
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index 745c68ffb885..7d894894194f 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -212,7 +212,6 @@ CONFIG_PXA_SSP=y
212# 212#
213# Processor Type 213# Processor Type
214# 214#
215CONFIG_CPU_32=y
216CONFIG_CPU_XSCALE=y 215CONFIG_CPU_XSCALE=y
217CONFIG_CPU_32v5=y 216CONFIG_CPU_32v5=y
218CONFIG_CPU_ABRT_EV5T=y 217CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/stmp378x_defconfig b/arch/arm/configs/stmp378x_defconfig
index 44461f197a17..b1a3a97d46ee 100644
--- a/arch/arm/configs/stmp378x_defconfig
+++ b/arch/arm/configs/stmp378x_defconfig
@@ -193,7 +193,6 @@ CONFIG_MACH_STMP378X=y
193# 193#
194# Processor Type 194# Processor Type
195# 195#
196CONFIG_CPU_32=y
197CONFIG_CPU_ARM926T=y 196CONFIG_CPU_ARM926T=y
198CONFIG_CPU_32v5=y 197CONFIG_CPU_32v5=y
199CONFIG_CPU_ABRT_EV5TJ=y 198CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/stmp37xx_defconfig b/arch/arm/configs/stmp37xx_defconfig
index 401279d531d5..a3751c9e1416 100644
--- a/arch/arm/configs/stmp37xx_defconfig
+++ b/arch/arm/configs/stmp37xx_defconfig
@@ -182,7 +182,6 @@ CONFIG_MACH_STMP37XX=y
182# 182#
183# Processor Type 183# Processor Type
184# 184#
185CONFIG_CPU_32=y
186CONFIG_CPU_ARM926T=y 185CONFIG_CPU_ARM926T=y
187CONFIG_CPU_32v5=y 186CONFIG_CPU_32v5=y
188CONFIG_CPU_ABRT_EV5TJ=y 187CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/sx1_defconfig b/arch/arm/configs/sx1_defconfig
index 25b007ff8bab..8a9e7e6bd03b 100644
--- a/arch/arm/configs/sx1_defconfig
+++ b/arch/arm/configs/sx1_defconfig
@@ -210,7 +210,6 @@ CONFIG_OMAP_ARM_168MHZ=y
210# 210#
211# Processor Type 211# Processor Type
212# 212#
213CONFIG_CPU_32=y
214CONFIG_CPU_ARM925T=y 213CONFIG_CPU_ARM925T=y
215CONFIG_CPU_32v4T=y 214CONFIG_CPU_32v4T=y
216CONFIG_CPU_ABRT_EV4T=y 215CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/tct_hammer_defconfig b/arch/arm/configs/tct_hammer_defconfig
index 9d32faef05f6..dccf14b4ee02 100644
--- a/arch/arm/configs/tct_hammer_defconfig
+++ b/arch/arm/configs/tct_hammer_defconfig
@@ -215,7 +215,6 @@ CONFIG_MACH_TCT_HAMMER=y
215# 215#
216# Processor Type 216# Processor Type
217# 217#
218CONFIG_CPU_32=y
219CONFIG_CPU_ARM920T=y 218CONFIG_CPU_ARM920T=y
220CONFIG_CPU_32v4T=y 219CONFIG_CPU_32v4T=y
221CONFIG_CPU_ABRT_EV4T=y 220CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/trizeps4_defconfig b/arch/arm/configs/trizeps4_defconfig
index b6f838197816..1e8f5a211856 100644
--- a/arch/arm/configs/trizeps4_defconfig
+++ b/arch/arm/configs/trizeps4_defconfig
@@ -156,7 +156,6 @@ CONFIG_PXA27x=y
156# 156#
157# Processor Type 157# Processor Type
158# 158#
159CONFIG_CPU_32=y
160CONFIG_CPU_XSCALE=y 159CONFIG_CPU_XSCALE=y
161CONFIG_CPU_32v5=y 160CONFIG_CPU_32v5=y
162CONFIG_CPU_ABRT_EV5T=y 161CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig
index 953ba0297fc4..9155196e623b 100644
--- a/arch/arm/configs/u300_defconfig
+++ b/arch/arm/configs/u300_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.32-rc5 3# Linux kernel version: 2.6.33-rc2
4# Sat Oct 17 23:32:24 2009 4# Wed Jan 6 00:01:36 2010
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -46,6 +46,7 @@ CONFIG_SYSVIPC_SYSCTL=y
46# 46#
47CONFIG_TREE_RCU=y 47CONFIG_TREE_RCU=y
48# CONFIG_TREE_PREEMPT_RCU is not set 48# CONFIG_TREE_PREEMPT_RCU is not set
49# CONFIG_TINY_RCU is not set
49# CONFIG_RCU_TRACE is not set 50# CONFIG_RCU_TRACE is not set
50CONFIG_RCU_FANOUT=32 51CONFIG_RCU_FANOUT=32
51# CONFIG_RCU_FANOUT_EXACT is not set 52# CONFIG_RCU_FANOUT_EXACT is not set
@@ -119,14 +120,41 @@ CONFIG_BLOCK=y
119# IO Schedulers 120# IO Schedulers
120# 121#
121CONFIG_IOSCHED_NOOP=y 122CONFIG_IOSCHED_NOOP=y
122# CONFIG_IOSCHED_AS is not set
123CONFIG_IOSCHED_DEADLINE=y 123CONFIG_IOSCHED_DEADLINE=y
124# CONFIG_IOSCHED_CFQ is not set 124# CONFIG_IOSCHED_CFQ is not set
125# CONFIG_DEFAULT_AS is not set
126CONFIG_DEFAULT_DEADLINE=y 125CONFIG_DEFAULT_DEADLINE=y
127# CONFIG_DEFAULT_CFQ is not set 126# CONFIG_DEFAULT_CFQ is not set
128# CONFIG_DEFAULT_NOOP is not set 127# CONFIG_DEFAULT_NOOP is not set
129CONFIG_DEFAULT_IOSCHED="deadline" 128CONFIG_DEFAULT_IOSCHED="deadline"
129# CONFIG_INLINE_SPIN_TRYLOCK is not set
130# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
131# CONFIG_INLINE_SPIN_LOCK is not set
132# CONFIG_INLINE_SPIN_LOCK_BH is not set
133# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
134# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
135# CONFIG_INLINE_SPIN_UNLOCK is not set
136# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
137# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
138# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
139# CONFIG_INLINE_READ_TRYLOCK is not set
140# CONFIG_INLINE_READ_LOCK is not set
141# CONFIG_INLINE_READ_LOCK_BH is not set
142# CONFIG_INLINE_READ_LOCK_IRQ is not set
143# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
144# CONFIG_INLINE_READ_UNLOCK is not set
145# CONFIG_INLINE_READ_UNLOCK_BH is not set
146# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
147# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
148# CONFIG_INLINE_WRITE_TRYLOCK is not set
149# CONFIG_INLINE_WRITE_LOCK is not set
150# CONFIG_INLINE_WRITE_LOCK_BH is not set
151# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
152# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
153# CONFIG_INLINE_WRITE_UNLOCK is not set
154# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
155# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
156# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
157# CONFIG_MUTEX_SPIN_ON_OWNER is not set
130# CONFIG_FREEZER is not set 158# CONFIG_FREEZER is not set
131 159
132# 160#
@@ -155,6 +183,7 @@ CONFIG_MMU=y
155# CONFIG_ARCH_IXP2000 is not set 183# CONFIG_ARCH_IXP2000 is not set
156# CONFIG_ARCH_IXP4XX is not set 184# CONFIG_ARCH_IXP4XX is not set
157# CONFIG_ARCH_L7200 is not set 185# CONFIG_ARCH_L7200 is not set
186# CONFIG_ARCH_DOVE is not set
158# CONFIG_ARCH_KIRKWOOD is not set 187# CONFIG_ARCH_KIRKWOOD is not set
159# CONFIG_ARCH_LOKI is not set 188# CONFIG_ARCH_LOKI is not set
160# CONFIG_ARCH_MV78XX0 is not set 189# CONFIG_ARCH_MV78XX0 is not set
@@ -177,6 +206,7 @@ CONFIG_ARCH_U300=y
177# CONFIG_ARCH_DAVINCI is not set 206# CONFIG_ARCH_DAVINCI is not set
178# CONFIG_ARCH_OMAP is not set 207# CONFIG_ARCH_OMAP is not set
179# CONFIG_ARCH_BCMRING is not set 208# CONFIG_ARCH_BCMRING is not set
209# CONFIG_ARCH_U8500 is not set
180 210
181# 211#
182# ST-Ericsson AB U300/U330/U335/U365 Platform 212# ST-Ericsson AB U300/U330/U335/U365 Platform
@@ -207,7 +237,6 @@ CONFIG_MACH_U300_SPIDUMMY=y
207# 237#
208# Processor Type 238# Processor Type
209# 239#
210CONFIG_CPU_32=y
211CONFIG_CPU_ARM926T=y 240CONFIG_CPU_ARM926T=y
212CONFIG_CPU_32v5=y 241CONFIG_CPU_32v5=y
213CONFIG_CPU_ABRT_EV5TJ=y 242CONFIG_CPU_ABRT_EV5TJ=y
@@ -266,12 +295,10 @@ CONFIG_FLATMEM_MANUAL=y
266CONFIG_FLATMEM=y 295CONFIG_FLATMEM=y
267CONFIG_FLAT_NODE_MEM_MAP=y 296CONFIG_FLAT_NODE_MEM_MAP=y
268CONFIG_PAGEFLAGS_EXTENDED=y 297CONFIG_PAGEFLAGS_EXTENDED=y
269CONFIG_SPLIT_PTLOCK_CPUS=4096 298CONFIG_SPLIT_PTLOCK_CPUS=999999
270# CONFIG_PHYS_ADDR_T_64BIT is not set 299# CONFIG_PHYS_ADDR_T_64BIT is not set
271CONFIG_ZONE_DMA_FLAG=0 300CONFIG_ZONE_DMA_FLAG=0
272CONFIG_VIRT_TO_BUS=y 301CONFIG_VIRT_TO_BUS=y
273CONFIG_HAVE_MLOCK=y
274CONFIG_HAVE_MLOCKED_PAGE_BIT=y
275# CONFIG_KSM is not set 302# CONFIG_KSM is not set
276CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 303CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
277CONFIG_ALIGNMENT_TRAP=y 304CONFIG_ALIGNMENT_TRAP=y
@@ -500,14 +527,21 @@ CONFIG_MTD_NAND_IDS=y
500CONFIG_BLK_DEV=y 527CONFIG_BLK_DEV=y
501# CONFIG_BLK_DEV_COW_COMMON is not set 528# CONFIG_BLK_DEV_COW_COMMON is not set
502# CONFIG_BLK_DEV_LOOP is not set 529# CONFIG_BLK_DEV_LOOP is not set
530
531#
532# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
533#
503# CONFIG_BLK_DEV_NBD is not set 534# CONFIG_BLK_DEV_NBD is not set
504# CONFIG_BLK_DEV_RAM is not set 535# CONFIG_BLK_DEV_RAM is not set
505# CONFIG_CDROM_PKTCDVD is not set 536# CONFIG_CDROM_PKTCDVD is not set
506# CONFIG_ATA_OVER_ETH is not set 537# CONFIG_ATA_OVER_ETH is not set
507CONFIG_MISC_DEVICES=y 538CONFIG_MISC_DEVICES=y
539# CONFIG_AD525X_DPOT is not set
508# CONFIG_ICS932S401 is not set 540# CONFIG_ICS932S401 is not set
509# CONFIG_ENCLOSURE_SERVICES is not set 541# CONFIG_ENCLOSURE_SERVICES is not set
510# CONFIG_ISL29003 is not set 542# CONFIG_ISL29003 is not set
543# CONFIG_DS1682 is not set
544# CONFIG_TI_DAC7512 is not set
511# CONFIG_C2PORT is not set 545# CONFIG_C2PORT is not set
512 546
513# 547#
@@ -518,6 +552,7 @@ CONFIG_MISC_DEVICES=y
518# CONFIG_EEPROM_LEGACY is not set 552# CONFIG_EEPROM_LEGACY is not set
519# CONFIG_EEPROM_MAX6875 is not set 553# CONFIG_EEPROM_MAX6875 is not set
520# CONFIG_EEPROM_93CX6 is not set 554# CONFIG_EEPROM_93CX6 is not set
555# CONFIG_IWMC3200TOP is not set
521CONFIG_HAVE_IDE=y 556CONFIG_HAVE_IDE=y
522# CONFIG_IDE is not set 557# CONFIG_IDE is not set
523 558
@@ -540,6 +575,7 @@ CONFIG_HAVE_IDE=y
540CONFIG_INPUT=y 575CONFIG_INPUT=y
541# CONFIG_INPUT_FF_MEMLESS is not set 576# CONFIG_INPUT_FF_MEMLESS is not set
542# CONFIG_INPUT_POLLDEV is not set 577# CONFIG_INPUT_POLLDEV is not set
578# CONFIG_INPUT_SPARSEKMAP is not set
543 579
544# 580#
545# Userland interfaces 581# Userland interfaces
@@ -646,7 +682,6 @@ CONFIG_I2C_STU300=y
646# 682#
647# Miscellaneous I2C Chip support 683# Miscellaneous I2C Chip support
648# 684#
649# CONFIG_DS1682 is not set
650# CONFIG_SENSORS_TSL2550 is not set 685# CONFIG_SENSORS_TSL2550 is not set
651# CONFIG_I2C_DEBUG_CORE is not set 686# CONFIG_I2C_DEBUG_CORE is not set
652# CONFIG_I2C_DEBUG_ALGO is not set 687# CONFIG_I2C_DEBUG_ALGO is not set
@@ -662,6 +697,8 @@ CONFIG_SPI_MASTER=y
662# CONFIG_SPI_BITBANG is not set 697# CONFIG_SPI_BITBANG is not set
663# CONFIG_SPI_GPIO is not set 698# CONFIG_SPI_GPIO is not set
664CONFIG_SPI_PL022=y 699CONFIG_SPI_PL022=y
700# CONFIG_SPI_XILINX is not set
701# CONFIG_SPI_DESIGNWARE is not set
665 702
666# 703#
667# SPI Protocol Masters 704# SPI Protocol Masters
@@ -709,6 +746,7 @@ CONFIG_SSB_POSSIBLE=y
709# CONFIG_MFD_T7L66XB is not set 746# CONFIG_MFD_T7L66XB is not set
710# CONFIG_MFD_TC6387XB is not set 747# CONFIG_MFD_TC6387XB is not set
711# CONFIG_PMIC_DA903X is not set 748# CONFIG_PMIC_DA903X is not set
749# CONFIG_PMIC_ADP5520 is not set
712# CONFIG_MFD_WM8400 is not set 750# CONFIG_MFD_WM8400 is not set
713# CONFIG_MFD_WM831X is not set 751# CONFIG_MFD_WM831X is not set
714# CONFIG_MFD_WM8350_I2C is not set 752# CONFIG_MFD_WM8350_I2C is not set
@@ -717,6 +755,8 @@ CONFIG_SSB_POSSIBLE=y
717CONFIG_AB3100_CORE=y 755CONFIG_AB3100_CORE=y
718CONFIG_AB3100_OTP=y 756CONFIG_AB3100_OTP=y
719# CONFIG_EZX_PCAP is not set 757# CONFIG_EZX_PCAP is not set
758# CONFIG_MFD_88PM8607 is not set
759# CONFIG_AB4500_CORE is not set
720CONFIG_REGULATOR=y 760CONFIG_REGULATOR=y
721# CONFIG_REGULATOR_DEBUG is not set 761# CONFIG_REGULATOR_DEBUG is not set
722# CONFIG_REGULATOR_FIXED_VOLTAGE is not set 762# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
@@ -724,6 +764,7 @@ CONFIG_REGULATOR=y
724# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set 764# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
725# CONFIG_REGULATOR_BQ24022 is not set 765# CONFIG_REGULATOR_BQ24022 is not set
726# CONFIG_REGULATOR_MAX1586 is not set 766# CONFIG_REGULATOR_MAX1586 is not set
767# CONFIG_REGULATOR_MAX8660 is not set
727# CONFIG_REGULATOR_LP3971 is not set 768# CONFIG_REGULATOR_LP3971 is not set
728CONFIG_REGULATOR_AB3100=y 769CONFIG_REGULATOR_AB3100=y
729# CONFIG_REGULATOR_TPS65023 is not set 770# CONFIG_REGULATOR_TPS65023 is not set
@@ -841,7 +882,9 @@ CONFIG_LEDS_CLASS=y
841# CONFIG_LEDS_LP3944 is not set 882# CONFIG_LEDS_LP3944 is not set
842# CONFIG_LEDS_PCA955X is not set 883# CONFIG_LEDS_PCA955X is not set
843# CONFIG_LEDS_DAC124S085 is not set 884# CONFIG_LEDS_DAC124S085 is not set
885# CONFIG_LEDS_REGULATOR is not set
844# CONFIG_LEDS_BD2802 is not set 886# CONFIG_LEDS_BD2802 is not set
887# CONFIG_LEDS_LT3593 is not set
845 888
846# 889#
847# LED Triggers 890# LED Triggers
@@ -883,6 +926,7 @@ CONFIG_RTC_INTF_DEV=y
883# CONFIG_RTC_DRV_PCF8563 is not set 926# CONFIG_RTC_DRV_PCF8563 is not set
884# CONFIG_RTC_DRV_PCF8583 is not set 927# CONFIG_RTC_DRV_PCF8583 is not set
885# CONFIG_RTC_DRV_M41T80 is not set 928# CONFIG_RTC_DRV_M41T80 is not set
929# CONFIG_RTC_DRV_BQ32K is not set
886# CONFIG_RTC_DRV_S35390A is not set 930# CONFIG_RTC_DRV_S35390A is not set
887# CONFIG_RTC_DRV_FM3130 is not set 931# CONFIG_RTC_DRV_FM3130 is not set
888# CONFIG_RTC_DRV_RX8581 is not set 932# CONFIG_RTC_DRV_RX8581 is not set
@@ -912,7 +956,9 @@ CONFIG_RTC_INTF_DEV=y
912# CONFIG_RTC_DRV_M48T86 is not set 956# CONFIG_RTC_DRV_M48T86 is not set
913# CONFIG_RTC_DRV_M48T35 is not set 957# CONFIG_RTC_DRV_M48T35 is not set
914# CONFIG_RTC_DRV_M48T59 is not set 958# CONFIG_RTC_DRV_M48T59 is not set
959# CONFIG_RTC_DRV_MSM6242 is not set
915# CONFIG_RTC_DRV_BQ4802 is not set 960# CONFIG_RTC_DRV_BQ4802 is not set
961# CONFIG_RTC_DRV_RP5C01 is not set
916# CONFIG_RTC_DRV_V3020 is not set 962# CONFIG_RTC_DRV_V3020 is not set
917CONFIG_RTC_DRV_AB3100=y 963CONFIG_RTC_DRV_AB3100=y
918 964
@@ -927,6 +973,15 @@ CONFIG_DMADEVICES=y
927# 973#
928# DMA Devices 974# DMA Devices
929# 975#
976CONFIG_COH901318=y
977CONFIG_DMA_ENGINE=y
978
979#
980# DMA Clients
981#
982# CONFIG_NET_DMA is not set
983# CONFIG_ASYNC_TX_DMA is not set
984# CONFIG_DMATEST is not set
930# CONFIG_AUXDISPLAY is not set 985# CONFIG_AUXDISPLAY is not set
931# CONFIG_UIO is not set 986# CONFIG_UIO is not set
932 987
@@ -1019,7 +1074,7 @@ CONFIG_MISC_FILESYSTEMS=y
1019CONFIG_MSDOS_PARTITION=y 1074CONFIG_MSDOS_PARTITION=y
1020CONFIG_NLS=y 1075CONFIG_NLS=y
1021CONFIG_NLS_DEFAULT="iso8859-1" 1076CONFIG_NLS_DEFAULT="iso8859-1"
1022# CONFIG_NLS_CODEPAGE_437 is not set 1077CONFIG_NLS_CODEPAGE_437=y
1023# CONFIG_NLS_CODEPAGE_737 is not set 1078# CONFIG_NLS_CODEPAGE_737 is not set
1024# CONFIG_NLS_CODEPAGE_775 is not set 1079# CONFIG_NLS_CODEPAGE_775 is not set
1025# CONFIG_NLS_CODEPAGE_850 is not set 1080# CONFIG_NLS_CODEPAGE_850 is not set
@@ -1136,6 +1191,7 @@ CONFIG_ARM_UNWIND=y
1136# CONFIG_DEBUG_ERRORS is not set 1191# CONFIG_DEBUG_ERRORS is not set
1137# CONFIG_DEBUG_STACK_USAGE is not set 1192# CONFIG_DEBUG_STACK_USAGE is not set
1138# CONFIG_DEBUG_LL is not set 1193# CONFIG_DEBUG_LL is not set
1194# CONFIG_OC_ETM is not set
1139 1195
1140# 1196#
1141# Security options 1197# Security options
@@ -1143,7 +1199,11 @@ CONFIG_ARM_UNWIND=y
1143# CONFIG_KEYS is not set 1199# CONFIG_KEYS is not set
1144# CONFIG_SECURITY is not set 1200# CONFIG_SECURITY is not set
1145# CONFIG_SECURITYFS is not set 1201# CONFIG_SECURITYFS is not set
1146# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1202# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1203# CONFIG_DEFAULT_SECURITY_SMACK is not set
1204# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1205CONFIG_DEFAULT_SECURITY_DAC=y
1206CONFIG_DEFAULT_SECURITY=""
1147# CONFIG_CRYPTO is not set 1207# CONFIG_CRYPTO is not set
1148# CONFIG_BINARY_PRINTF is not set 1208# CONFIG_BINARY_PRINTF is not set
1149 1209
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 15fde22ce3f3..727aff9fe347 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -201,7 +201,6 @@ CONFIG_MACH_U8500_MOP=y
201# 201#
202# Processor Type 202# Processor Type
203# 203#
204CONFIG_CPU_32=y
205CONFIG_CPU_32v6K=y 204CONFIG_CPU_32v6K=y
206CONFIG_CPU_V7=y 205CONFIG_CPU_V7=y
207CONFIG_CPU_32v7=y 206CONFIG_CPU_32v7=y
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig
index fd7774033d64..87b700e2db84 100644
--- a/arch/arm/configs/usb-a9260_defconfig
+++ b/arch/arm/configs/usb-a9260_defconfig
@@ -195,7 +195,6 @@ CONFIG_AT91_EARLY_DBGU=y
195# 195#
196# Processor Type 196# Processor Type
197# 197#
198CONFIG_CPU_32=y
199CONFIG_CPU_ARM926T=y 198CONFIG_CPU_ARM926T=y
200CONFIG_CPU_32v5=y 199CONFIG_CPU_32v5=y
201CONFIG_CPU_ABRT_EV5TJ=y 200CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/usb-a9263_defconfig b/arch/arm/configs/usb-a9263_defconfig
index e7c19dd92557..7f018edd2480 100644
--- a/arch/arm/configs/usb-a9263_defconfig
+++ b/arch/arm/configs/usb-a9263_defconfig
@@ -187,7 +187,6 @@ CONFIG_AT91_EARLY_DBGU=y
187# 187#
188# Processor Type 188# Processor Type
189# 189#
190CONFIG_CPU_32=y
191CONFIG_CPU_ARM926T=y 190CONFIG_CPU_ARM926T=y
192CONFIG_CPU_32v5=y 191CONFIG_CPU_32v5=y
193CONFIG_CPU_ABRT_EV5TJ=y 192CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index b11c5da3996c..a1af0b972c0d 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -117,7 +117,6 @@ CONFIG_MACH_VERSATILE_AB=y
117# 117#
118# Processor Type 118# Processor Type
119# 119#
120CONFIG_CPU_32=y
121CONFIG_CPU_ARM926T=y 120CONFIG_CPU_ARM926T=y
122CONFIG_CPU_32v5=y 121CONFIG_CPU_32v5=y
123CONFIG_CPU_ABRT_EV5TJ=y 122CONFIG_CPU_ABRT_EV5TJ=y
diff --git a/arch/arm/configs/viper_defconfig b/arch/arm/configs/viper_defconfig
index 6ab5dd5868de..909887ae524c 100644
--- a/arch/arm/configs/viper_defconfig
+++ b/arch/arm/configs/viper_defconfig
@@ -204,7 +204,6 @@ CONFIG_PXA_HAVE_ISA_IRQS=y
204# 204#
205# Processor Type 205# Processor Type
206# 206#
207CONFIG_CPU_32=y
208CONFIG_CPU_XSCALE=y 207CONFIG_CPU_XSCALE=y
209CONFIG_CPU_32v5=y 208CONFIG_CPU_32v5=y
210CONFIG_CPU_ABRT_EV5T=y 209CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/xcep_defconfig b/arch/arm/configs/xcep_defconfig
index 33bb7250946b..84a72ac222cf 100644
--- a/arch/arm/configs/xcep_defconfig
+++ b/arch/arm/configs/xcep_defconfig
@@ -208,7 +208,6 @@ CONFIG_PLAT_PXA=y
208# 208#
209# Processor Type 209# Processor Type
210# 210#
211CONFIG_CPU_32=y
212CONFIG_CPU_XSCALE=y 211CONFIG_CPU_XSCALE=y
213CONFIG_CPU_32v5=y 212CONFIG_CPU_32v5=y
214CONFIG_CPU_ABRT_EV5T=y 213CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/configs/yl9200_defconfig b/arch/arm/configs/yl9200_defconfig
index 9192e5977674..3b627aadeb54 100644
--- a/arch/arm/configs/yl9200_defconfig
+++ b/arch/arm/configs/yl9200_defconfig
@@ -183,7 +183,6 @@ CONFIG_MACH_YL9200=y
183# 183#
184# Processor Type 184# Processor Type
185# 185#
186CONFIG_CPU_32=y
187CONFIG_CPU_ARM920T=y 186CONFIG_CPU_ARM920T=y
188CONFIG_CPU_32v4T=y 187CONFIG_CPU_32v4T=y
189CONFIG_CPU_ABRT_EV4T=y 188CONFIG_CPU_ABRT_EV4T=y
diff --git a/arch/arm/configs/zeus_defconfig b/arch/arm/configs/zeus_defconfig
index 823b11e7091a..fca5ff68ea67 100644
--- a/arch/arm/configs/zeus_defconfig
+++ b/arch/arm/configs/zeus_defconfig
@@ -271,7 +271,6 @@ CONFIG_PLAT_PXA=y
271# 271#
272# Processor Type 272# Processor Type
273# 273#
274CONFIG_CPU_32=y
275CONFIG_CPU_XSCALE=y 274CONFIG_CPU_XSCALE=y
276CONFIG_CPU_32v5=y 275CONFIG_CPU_32v5=y
277CONFIG_CPU_ABRT_EV5T=y 276CONFIG_CPU_ABRT_EV5T=y
diff --git a/arch/arm/include/asm/asm-offsets.h b/arch/arm/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/arm/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 73eceb87e588..730aefcfbee3 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -211,7 +211,7 @@ struct cpu_cache_fns {
211 211
212 void (*coherent_kern_range)(unsigned long, unsigned long); 212 void (*coherent_kern_range)(unsigned long, unsigned long);
213 void (*coherent_user_range)(unsigned long, unsigned long); 213 void (*coherent_user_range)(unsigned long, unsigned long);
214 void (*flush_kern_dcache_page)(void *); 214 void (*flush_kern_dcache_area)(void *, size_t);
215 215
216 void (*dma_inv_range)(const void *, const void *); 216 void (*dma_inv_range)(const void *, const void *);
217 void (*dma_clean_range)(const void *, const void *); 217 void (*dma_clean_range)(const void *, const void *);
@@ -236,7 +236,7 @@ extern struct cpu_cache_fns cpu_cache;
236#define __cpuc_flush_user_range cpu_cache.flush_user_range 236#define __cpuc_flush_user_range cpu_cache.flush_user_range
237#define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range 237#define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range
238#define __cpuc_coherent_user_range cpu_cache.coherent_user_range 238#define __cpuc_coherent_user_range cpu_cache.coherent_user_range
239#define __cpuc_flush_dcache_page cpu_cache.flush_kern_dcache_page 239#define __cpuc_flush_dcache_area cpu_cache.flush_kern_dcache_area
240 240
241/* 241/*
242 * These are private to the dma-mapping API. Do not use directly. 242 * These are private to the dma-mapping API. Do not use directly.
@@ -255,14 +255,14 @@ extern struct cpu_cache_fns cpu_cache;
255#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range) 255#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
256#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range) 256#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
257#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range) 257#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
258#define __cpuc_flush_dcache_page __glue(_CACHE,_flush_kern_dcache_page) 258#define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
259 259
260extern void __cpuc_flush_kern_all(void); 260extern void __cpuc_flush_kern_all(void);
261extern void __cpuc_flush_user_all(void); 261extern void __cpuc_flush_user_all(void);
262extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int); 262extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int);
263extern void __cpuc_coherent_kern_range(unsigned long, unsigned long); 263extern void __cpuc_coherent_kern_range(unsigned long, unsigned long);
264extern void __cpuc_coherent_user_range(unsigned long, unsigned long); 264extern void __cpuc_coherent_user_range(unsigned long, unsigned long);
265extern void __cpuc_flush_dcache_page(void *); 265extern void __cpuc_flush_dcache_area(void *, size_t);
266 266
267/* 267/*
268 * These are private to the dma-mapping API. Do not use directly. 268 * These are private to the dma-mapping API. Do not use directly.
@@ -448,7 +448,7 @@ static inline void flush_kernel_dcache_page(struct page *page)
448{ 448{
449 /* highmem pages are always flushed upon kunmap already */ 449 /* highmem pages are always flushed upon kunmap already */
450 if ((cache_is_vivt() || cache_is_vipt_aliasing()) && !PageHighMem(page)) 450 if ((cache_is_vivt() || cache_is_vipt_aliasing()) && !PageHighMem(page))
451 __cpuc_flush_dcache_page(page_address(page)); 451 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
452} 452}
453 453
454#define flush_dcache_mmap_lock(mapping) \ 454#define flush_dcache_mmap_lock(mapping) \
@@ -465,13 +465,6 @@ static inline void flush_kernel_dcache_page(struct page *page)
465 */ 465 */
466#define flush_icache_page(vma,page) do { } while (0) 466#define flush_icache_page(vma,page) do { } while (0)
467 467
468static inline void flush_ioremap_region(unsigned long phys, void __iomem *virt,
469 unsigned offset, size_t size)
470{
471 const void *start = (void __force *)virt + offset;
472 dmac_inv_range(start, start + size);
473}
474
475/* 468/*
476 * flush_cache_vmap() is used when creating mappings (eg, via vmap, 469 * flush_cache_vmap() is used when creating mappings (eg, via vmap,
477 * vmalloc, ioremap etc) in kernel space for pages. On non-VIPT 470 * vmalloc, ioremap etc) in kernel space for pages. On non-VIPT
diff --git a/arch/arm/include/asm/cpu.h b/arch/arm/include/asm/cpu.h
index 634b2d7c612a..793968173bef 100644
--- a/arch/arm/include/asm/cpu.h
+++ b/arch/arm/include/asm/cpu.h
@@ -11,6 +11,7 @@
11#define __ASM_ARM_CPU_H 11#define __ASM_ARM_CPU_H
12 12
13#include <linux/percpu.h> 13#include <linux/percpu.h>
14#include <linux/cpu.h>
14 15
15struct cpuinfo_arm { 16struct cpuinfo_arm {
16 struct cpu cpu; 17 struct cpu cpu;
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 7edf3536df24..ca51143f97f1 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -138,12 +138,12 @@ extern int get_dma_residue(unsigned int chan);
138#define NO_DMA 255 138#define NO_DMA 255
139#endif 139#endif
140 140
141#endif /* CONFIG_ISA_DMA_API */
142
141#ifdef CONFIG_PCI 143#ifdef CONFIG_PCI
142extern int isa_dma_bridge_buggy; 144extern int isa_dma_bridge_buggy;
143#else 145#else
144#define isa_dma_bridge_buggy (0) 146#define isa_dma_bridge_buggy (0)
145#endif 147#endif
146 148
147#endif /* CONFIG_ISA_DMA_API */
148
149#endif /* __ASM_ARM_DMA_H */ 149#endif /* __ASM_ARM_DMA_H */
diff --git a/arch/arm/include/asm/mach-types.h b/arch/arm/include/asm/mach-types.h
new file mode 100644
index 000000000000..948178cc6ba8
--- /dev/null
+++ b/arch/arm/include/asm/mach-types.h
@@ -0,0 +1 @@
#include <generated/mach-types.h>
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
index 3976412685f8..8fdae9bc9abb 100644
--- a/arch/arm/include/asm/proc-fns.h
+++ b/arch/arm/include/asm/proc-fns.h
@@ -24,206 +24,228 @@
24 * CPU_NAME - the prefix for CPU related functions 24 * CPU_NAME - the prefix for CPU related functions
25 */ 25 */
26 26
27#ifdef CONFIG_CPU_32 27#ifdef CONFIG_CPU_ARM610
28# ifdef CONFIG_CPU_ARM610 28# ifdef CPU_NAME
29# ifdef CPU_NAME 29# undef MULTI_CPU
30# undef MULTI_CPU 30# define MULTI_CPU
31# define MULTI_CPU 31# else
32# else 32# define CPU_NAME cpu_arm6
33# define CPU_NAME cpu_arm6
34# endif
35# endif 33# endif
36# ifdef CONFIG_CPU_ARM7TDMI 34#endif
37# ifdef CPU_NAME 35
38# undef MULTI_CPU 36#ifdef CONFIG_CPU_ARM7TDMI
39# define MULTI_CPU 37# ifdef CPU_NAME
40# else 38# undef MULTI_CPU
41# define CPU_NAME cpu_arm7tdmi 39# define MULTI_CPU
42# endif 40# else
41# define CPU_NAME cpu_arm7tdmi
43# endif 42# endif
44# ifdef CONFIG_CPU_ARM710 43#endif
45# ifdef CPU_NAME 44
46# undef MULTI_CPU 45#ifdef CONFIG_CPU_ARM710
47# define MULTI_CPU 46# ifdef CPU_NAME
48# else 47# undef MULTI_CPU
49# define CPU_NAME cpu_arm7 48# define MULTI_CPU
50# endif 49# else
50# define CPU_NAME cpu_arm7
51# endif 51# endif
52# ifdef CONFIG_CPU_ARM720T 52#endif
53# ifdef CPU_NAME 53
54# undef MULTI_CPU 54#ifdef CONFIG_CPU_ARM720T
55# define MULTI_CPU 55# ifdef CPU_NAME
56# else 56# undef MULTI_CPU
57# define CPU_NAME cpu_arm720 57# define MULTI_CPU
58# endif 58# else
59# define CPU_NAME cpu_arm720
59# endif 60# endif
60# ifdef CONFIG_CPU_ARM740T 61#endif
61# ifdef CPU_NAME 62
62# undef MULTI_CPU 63#ifdef CONFIG_CPU_ARM740T
63# define MULTI_CPU 64# ifdef CPU_NAME
64# else 65# undef MULTI_CPU
65# define CPU_NAME cpu_arm740 66# define MULTI_CPU
66# endif 67# else
68# define CPU_NAME cpu_arm740
67# endif 69# endif
68# ifdef CONFIG_CPU_ARM9TDMI 70#endif
69# ifdef CPU_NAME 71
70# undef MULTI_CPU 72#ifdef CONFIG_CPU_ARM9TDMI
71# define MULTI_CPU 73# ifdef CPU_NAME
72# else 74# undef MULTI_CPU
73# define CPU_NAME cpu_arm9tdmi 75# define MULTI_CPU
74# endif 76# else
77# define CPU_NAME cpu_arm9tdmi
75# endif 78# endif
76# ifdef CONFIG_CPU_ARM920T 79#endif
77# ifdef CPU_NAME 80
78# undef MULTI_CPU 81#ifdef CONFIG_CPU_ARM920T
79# define MULTI_CPU 82# ifdef CPU_NAME
80# else 83# undef MULTI_CPU
81# define CPU_NAME cpu_arm920 84# define MULTI_CPU
82# endif 85# else
86# define CPU_NAME cpu_arm920
83# endif 87# endif
84# ifdef CONFIG_CPU_ARM922T 88#endif
85# ifdef CPU_NAME 89
86# undef MULTI_CPU 90#ifdef CONFIG_CPU_ARM922T
87# define MULTI_CPU 91# ifdef CPU_NAME
88# else 92# undef MULTI_CPU
89# define CPU_NAME cpu_arm922 93# define MULTI_CPU
90# endif 94# else
95# define CPU_NAME cpu_arm922
91# endif 96# endif
92# ifdef CONFIG_CPU_FA526 97#endif
93# ifdef CPU_NAME 98
94# undef MULTI_CPU 99#ifdef CONFIG_CPU_FA526
95# define MULTI_CPU 100# ifdef CPU_NAME
96# else 101# undef MULTI_CPU
97# define CPU_NAME cpu_fa526 102# define MULTI_CPU
98# endif 103# else
104# define CPU_NAME cpu_fa526
99# endif 105# endif
100# ifdef CONFIG_CPU_ARM925T 106#endif
101# ifdef CPU_NAME 107
102# undef MULTI_CPU 108#ifdef CONFIG_CPU_ARM925T
103# define MULTI_CPU 109# ifdef CPU_NAME
104# else 110# undef MULTI_CPU
105# define CPU_NAME cpu_arm925 111# define MULTI_CPU
106# endif 112# else
113# define CPU_NAME cpu_arm925
107# endif 114# endif
108# ifdef CONFIG_CPU_ARM926T 115#endif
109# ifdef CPU_NAME 116
110# undef MULTI_CPU 117#ifdef CONFIG_CPU_ARM926T
111# define MULTI_CPU 118# ifdef CPU_NAME
112# else 119# undef MULTI_CPU
113# define CPU_NAME cpu_arm926 120# define MULTI_CPU
114# endif 121# else
122# define CPU_NAME cpu_arm926
115# endif 123# endif
116# ifdef CONFIG_CPU_ARM940T 124#endif
117# ifdef CPU_NAME 125
118# undef MULTI_CPU 126#ifdef CONFIG_CPU_ARM940T
119# define MULTI_CPU 127# ifdef CPU_NAME
120# else 128# undef MULTI_CPU
121# define CPU_NAME cpu_arm940 129# define MULTI_CPU
122# endif 130# else
131# define CPU_NAME cpu_arm940
123# endif 132# endif
124# ifdef CONFIG_CPU_ARM946E 133#endif
125# ifdef CPU_NAME 134
126# undef MULTI_CPU 135#ifdef CONFIG_CPU_ARM946E
127# define MULTI_CPU 136# ifdef CPU_NAME
128# else 137# undef MULTI_CPU
129# define CPU_NAME cpu_arm946 138# define MULTI_CPU
130# endif 139# else
140# define CPU_NAME cpu_arm946
131# endif 141# endif
132# ifdef CONFIG_CPU_SA110 142#endif
133# ifdef CPU_NAME 143
134# undef MULTI_CPU 144#ifdef CONFIG_CPU_SA110
135# define MULTI_CPU 145# ifdef CPU_NAME
136# else 146# undef MULTI_CPU
137# define CPU_NAME cpu_sa110 147# define MULTI_CPU
138# endif 148# else
149# define CPU_NAME cpu_sa110
139# endif 150# endif
140# ifdef CONFIG_CPU_SA1100 151#endif
141# ifdef CPU_NAME 152
142# undef MULTI_CPU 153#ifdef CONFIG_CPU_SA1100
143# define MULTI_CPU 154# ifdef CPU_NAME
144# else 155# undef MULTI_CPU
145# define CPU_NAME cpu_sa1100 156# define MULTI_CPU
146# endif 157# else
158# define CPU_NAME cpu_sa1100
147# endif 159# endif
148# ifdef CONFIG_CPU_ARM1020 160#endif
149# ifdef CPU_NAME 161
150# undef MULTI_CPU 162#ifdef CONFIG_CPU_ARM1020
151# define MULTI_CPU 163# ifdef CPU_NAME
152# else 164# undef MULTI_CPU
153# define CPU_NAME cpu_arm1020 165# define MULTI_CPU
154# endif 166# else
167# define CPU_NAME cpu_arm1020
155# endif 168# endif
156# ifdef CONFIG_CPU_ARM1020E 169#endif
157# ifdef CPU_NAME 170
158# undef MULTI_CPU 171#ifdef CONFIG_CPU_ARM1020E
159# define MULTI_CPU 172# ifdef CPU_NAME
160# else 173# undef MULTI_CPU
161# define CPU_NAME cpu_arm1020e 174# define MULTI_CPU
162# endif 175# else
176# define CPU_NAME cpu_arm1020e
163# endif 177# endif
164# ifdef CONFIG_CPU_ARM1022 178#endif
165# ifdef CPU_NAME 179
166# undef MULTI_CPU 180#ifdef CONFIG_CPU_ARM1022
167# define MULTI_CPU 181# ifdef CPU_NAME
168# else 182# undef MULTI_CPU
169# define CPU_NAME cpu_arm1022 183# define MULTI_CPU
170# endif 184# else
185# define CPU_NAME cpu_arm1022
171# endif 186# endif
172# ifdef CONFIG_CPU_ARM1026 187#endif
173# ifdef CPU_NAME 188
174# undef MULTI_CPU 189#ifdef CONFIG_CPU_ARM1026
175# define MULTI_CPU 190# ifdef CPU_NAME
176# else 191# undef MULTI_CPU
177# define CPU_NAME cpu_arm1026 192# define MULTI_CPU
178# endif 193# else
194# define CPU_NAME cpu_arm1026
179# endif 195# endif
180# ifdef CONFIG_CPU_XSCALE 196#endif
181# ifdef CPU_NAME 197
182# undef MULTI_CPU 198#ifdef CONFIG_CPU_XSCALE
183# define MULTI_CPU 199# ifdef CPU_NAME
184# else 200# undef MULTI_CPU
185# define CPU_NAME cpu_xscale 201# define MULTI_CPU
186# endif 202# else
203# define CPU_NAME cpu_xscale
187# endif 204# endif
188# ifdef CONFIG_CPU_XSC3 205#endif
189# ifdef CPU_NAME 206
190# undef MULTI_CPU 207#ifdef CONFIG_CPU_XSC3
191# define MULTI_CPU 208# ifdef CPU_NAME
192# else 209# undef MULTI_CPU
193# define CPU_NAME cpu_xsc3 210# define MULTI_CPU
194# endif 211# else
212# define CPU_NAME cpu_xsc3
195# endif 213# endif
196# ifdef CONFIG_CPU_MOHAWK 214#endif
197# ifdef CPU_NAME 215
198# undef MULTI_CPU 216#ifdef CONFIG_CPU_MOHAWK
199# define MULTI_CPU 217# ifdef CPU_NAME
200# else 218# undef MULTI_CPU
201# define CPU_NAME cpu_mohawk 219# define MULTI_CPU
202# endif 220# else
221# define CPU_NAME cpu_mohawk
203# endif 222# endif
204# ifdef CONFIG_CPU_FEROCEON 223#endif
205# ifdef CPU_NAME 224
206# undef MULTI_CPU 225#ifdef CONFIG_CPU_FEROCEON
207# define MULTI_CPU 226# ifdef CPU_NAME
208# else 227# undef MULTI_CPU
209# define CPU_NAME cpu_feroceon 228# define MULTI_CPU
210# endif 229# else
230# define CPU_NAME cpu_feroceon
211# endif 231# endif
212# ifdef CONFIG_CPU_V6 232#endif
213# ifdef CPU_NAME 233
214# undef MULTI_CPU 234#ifdef CONFIG_CPU_V6
215# define MULTI_CPU 235# ifdef CPU_NAME
216# else 236# undef MULTI_CPU
217# define CPU_NAME cpu_v6 237# define MULTI_CPU
218# endif 238# else
239# define CPU_NAME cpu_v6
219# endif 240# endif
220# ifdef CONFIG_CPU_V7 241#endif
221# ifdef CPU_NAME 242
222# undef MULTI_CPU 243#ifdef CONFIG_CPU_V7
223# define MULTI_CPU 244# ifdef CPU_NAME
224# else 245# undef MULTI_CPU
225# define CPU_NAME cpu_v7 246# define MULTI_CPU
226# endif 247# else
248# define CPU_NAME cpu_v7
227# endif 249# endif
228#endif 250#endif
229 251
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index bbecccda76d0..eec6e897ceb2 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -97,9 +97,15 @@
97 * stack during a system call. Note that sizeof(struct pt_regs) 97 * stack during a system call. Note that sizeof(struct pt_regs)
98 * has to be a multiple of 8. 98 * has to be a multiple of 8.
99 */ 99 */
100#ifndef __KERNEL__
100struct pt_regs { 101struct pt_regs {
101 long uregs[18]; 102 long uregs[18];
102}; 103};
104#else /* __KERNEL__ */
105struct pt_regs {
106 unsigned long uregs[18];
107};
108#endif /* __KERNEL__ */
103 109
104#define ARM_cpsr uregs[16] 110#define ARM_cpsr uregs[16]
105#define ARM_pc uregs[15] 111#define ARM_pc uregs[15]
diff --git a/arch/arm/include/asm/thread_notify.h b/arch/arm/include/asm/thread_notify.h
index f27379d7f72a..c4391ba20350 100644
--- a/arch/arm/include/asm/thread_notify.h
+++ b/arch/arm/include/asm/thread_notify.h
@@ -41,7 +41,7 @@ static inline void thread_notify(unsigned long rc, struct thread_info *thread)
41 * These are the reason codes for the thread notifier. 41 * These are the reason codes for the thread notifier.
42 */ 42 */
43#define THREAD_NOTIFY_FLUSH 0 43#define THREAD_NOTIFY_FLUSH 0
44#define THREAD_NOTIFY_RELEASE 1 44#define THREAD_NOTIFY_EXIT 1
45#define THREAD_NOTIFY_SWITCH 2 45#define THREAD_NOTIFY_SWITCH 2
46 46
47#endif 47#endif
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 4e506d09e5f9..cf9cdaa2d4d4 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -391,6 +391,7 @@
391#define __NR_pwritev (__NR_SYSCALL_BASE+362) 391#define __NR_pwritev (__NR_SYSCALL_BASE+362)
392#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363) 392#define __NR_rt_tgsigqueueinfo (__NR_SYSCALL_BASE+363)
393#define __NR_perf_event_open (__NR_SYSCALL_BASE+364) 393#define __NR_perf_event_open (__NR_SYSCALL_BASE+364)
394#define __NR_recvmmsg (__NR_SYSCALL_BASE+365)
394 395
395/* 396/*
396 * The following SWIs are ARM private. 397 * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/crunch.c b/arch/arm/kernel/crunch.c
index 769abe15cf91..25ef223ba7f3 100644
--- a/arch/arm/kernel/crunch.c
+++ b/arch/arm/kernel/crunch.c
@@ -51,7 +51,7 @@ static int crunch_do(struct notifier_block *self, unsigned long cmd, void *t)
51 * initialised state information on the first fault. 51 * initialised state information on the first fault.
52 */ 52 */
53 53
54 case THREAD_NOTIFY_RELEASE: 54 case THREAD_NOTIFY_EXIT:
55 crunch_task_release(thread); 55 crunch_task_release(thread);
56 break; 56 break;
57 57
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index 0e88e46fc732..360bb6d701f5 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -207,8 +207,6 @@ void __init isa_init_dma(void)
207 outb(0x32, 0x4d6); 207 outb(0x32, 0x4d6);
208 outb(0x33, 0x4d6); 208 outb(0x33, 0x4d6);
209 209
210 request_dma(DMA_ISA_CASCADE, "cascade");
211
212 for (i = 0; i < ARRAY_SIZE(dma_resources); i++) 210 for (i = 0; i < ARRAY_SIZE(dma_resources); i++)
213 request_resource(&ioport_resource, dma_resources + i); 211 request_resource(&ioport_resource, dma_resources + i);
214 212
@@ -218,5 +216,7 @@ void __init isa_init_dma(void)
218 printk(KERN_ERR "ISADMA%u: unable to register: %d\n", 216 printk(KERN_ERR "ISADMA%u: unable to register: %d\n",
219 chan, ret); 217 chan, ret);
220 } 218 }
219
220 request_dma(DMA_ISA_CASCADE, "cascade");
221 } 221 }
222} 222}
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d2903e3bc861..6c5cf369183b 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -957,9 +957,7 @@ kuser_cmpxchg_fixup:
957 957
958#else 958#else
959 959
960#ifdef CONFIG_SMP 960 smp_dmb
961 mcr p15, 0, r0, c7, c10, 5 @ dmb
962#endif
9631: ldrex r3, [r2] 9611: ldrex r3, [r2]
964 subs r3, r3, r0 962 subs r3, r3, r0
965 strexeq r3, r1, [r2] 963 strexeq r3, r1, [r2]
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 0d96d0171c05..ba2adefa53f7 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -212,7 +212,8 @@ void __show_regs(struct pt_regs *regs)
212 char buf[64]; 212 char buf[64];
213 213
214 printk("CPU: %d %s (%s %.*s)\n", 214 printk("CPU: %d %s (%s %.*s)\n",
215 smp_processor_id(), print_tainted(), init_utsname()->release, 215 raw_smp_processor_id(), print_tainted(),
216 init_utsname()->release,
216 (int)strcspn(init_utsname()->version, " "), 217 (int)strcspn(init_utsname()->version, " "),
217 init_utsname()->version); 218 init_utsname()->version);
218 print_symbol("PC is at %s\n", instruction_pointer(regs)); 219 print_symbol("PC is at %s\n", instruction_pointer(regs));
@@ -274,17 +275,18 @@ void show_regs(struct pt_regs * regs)
274 __backtrace(); 275 __backtrace();
275} 276}
276 277
278ATOMIC_NOTIFIER_HEAD(thread_notify_head);
279
280EXPORT_SYMBOL_GPL(thread_notify_head);
281
277/* 282/*
278 * Free current thread data structures etc.. 283 * Free current thread data structures etc..
279 */ 284 */
280void exit_thread(void) 285void exit_thread(void)
281{ 286{
287 thread_notify(THREAD_NOTIFY_EXIT, current_thread_info());
282} 288}
283 289
284ATOMIC_NOTIFIER_HEAD(thread_notify_head);
285
286EXPORT_SYMBOL_GPL(thread_notify_head);
287
288void flush_thread(void) 290void flush_thread(void)
289{ 291{
290 struct thread_info *thread = current_thread_info(); 292 struct thread_info *thread = current_thread_info();
@@ -299,9 +301,6 @@ void flush_thread(void)
299 301
300void release_thread(struct task_struct *dead_task) 302void release_thread(struct task_struct *dead_task)
301{ 303{
302 struct thread_info *thread = task_thread_info(dead_task);
303
304 thread_notify(THREAD_NOTIFY_RELEASE, thread);
305} 304}
306 305
307asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 306asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
diff --git a/arch/arm/kernel/xscale-cp0.c b/arch/arm/kernel/xscale-cp0.c
index 17127db906fa..1796157e3dd5 100644
--- a/arch/arm/kernel/xscale-cp0.c
+++ b/arch/arm/kernel/xscale-cp0.c
@@ -70,7 +70,7 @@ static int iwmmxt_do(struct notifier_block *self, unsigned long cmd, void *t)
70 * initialised state information on the first fault. 70 * initialised state information on the first fault.
71 */ 71 */
72 72
73 case THREAD_NOTIFY_RELEASE: 73 case THREAD_NOTIFY_EXIT:
74 iwmmxt_task_release(thread); 74 iwmmxt_task_release(thread);
75 break; 75 break;
76 76
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index a9b650dcc172..077ecf4fecda 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -236,6 +236,7 @@ static struct vpfe_subdev_info vpfe_sub_devs[] = {
236 236
237static struct vpfe_config vpfe_cfg = { 237static struct vpfe_config vpfe_cfg = {
238 .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), 238 .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
239 .i2c_adapter_id = 1,
239 .sub_devs = vpfe_sub_devs, 240 .sub_devs = vpfe_sub_devs,
240 .card_name = "DM355 EVM", 241 .card_name = "DM355 EVM",
241 .ccdc = "DM355 CCDC", 242 .ccdc = "DM355 CCDC",
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 289fe1b7d25a..b476395d2cd4 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -192,7 +192,11 @@ static struct davinci_i2c_platform_data i2c_pdata = {
192 .bus_delay = 0 /* usec */, 192 .bus_delay = 0 /* usec */,
193}; 193};
194 194
195#ifdef CONFIG_KEYBOARD_DAVINCI 195static int dm365evm_keyscan_enable(struct device *dev)
196{
197 return davinci_cfg_reg(DM365_KEYSCAN);
198}
199
196static unsigned short dm365evm_keymap[] = { 200static unsigned short dm365evm_keymap[] = {
197 KEY_KP2, 201 KEY_KP2,
198 KEY_LEFT, 202 KEY_LEFT,
@@ -214,6 +218,7 @@ static unsigned short dm365evm_keymap[] = {
214}; 218};
215 219
216static struct davinci_ks_platform_data dm365evm_ks_data = { 220static struct davinci_ks_platform_data dm365evm_ks_data = {
221 .device_enable = dm365evm_keyscan_enable,
217 .keymap = dm365evm_keymap, 222 .keymap = dm365evm_keymap,
218 .keymapsize = ARRAY_SIZE(dm365evm_keymap), 223 .keymapsize = ARRAY_SIZE(dm365evm_keymap),
219 .rep = 1, 224 .rep = 1,
@@ -222,7 +227,6 @@ static struct davinci_ks_platform_data dm365evm_ks_data = {
222 .interval = 0x2, 227 .interval = 0x2,
223 .matrix_type = DAVINCI_KEYSCAN_MATRIX_4X4, 228 .matrix_type = DAVINCI_KEYSCAN_MATRIX_4X4,
224}; 229};
225#endif
226 230
227static int cpld_mmc_get_cd(int module) 231static int cpld_mmc_get_cd(int module)
228{ 232{
@@ -511,10 +515,7 @@ static __init void dm365_evm_init(void)
511 515
512 dm365_init_asp(&dm365_evm_snd_data); 516 dm365_init_asp(&dm365_evm_snd_data);
513 dm365_init_rtc(); 517 dm365_init_rtc();
514
515#ifdef CONFIG_KEYBOARD_DAVINCI
516 dm365_init_ks(&dm365evm_ks_data); 518 dm365_init_ks(&dm365evm_ks_data);
517#endif
518} 519}
519 520
520static __init void dm365_evm_irq_init(void) 521static __init void dm365_evm_irq_init(void)
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index fd0398bc6db3..e9612cf727b7 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -247,6 +247,7 @@ static struct vpfe_subdev_info vpfe_sub_devs[] = {
247 247
248static struct vpfe_config vpfe_cfg = { 248static struct vpfe_config vpfe_cfg = {
249 .num_subdevs = ARRAY_SIZE(vpfe_sub_devs), 249 .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
250 .i2c_adapter_id = 1,
250 .sub_devs = vpfe_sub_devs, 251 .sub_devs = vpfe_sub_devs,
251 .card_name = "DM6446 EVM", 252 .card_name = "DM6446 EVM",
252 .ccdc = "DM6446 CCDC", 253 .ccdc = "DM6446 CCDC",
diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
index 52b287cf3a42..37311d1830eb 100644
--- a/arch/arm/mach-davinci/cp_intc.c
+++ b/arch/arm/mach-davinci/cp_intc.c
@@ -81,12 +81,23 @@ static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type)
81 return 0; 81 return 0;
82} 82}
83 83
84/*
85 * Faking this allows us to to work with suspend functions of
86 * generic drivers which call {enable|disable}_irq_wake for
87 * wake up interrupt sources (eg RTC on DA850).
88 */
89static int cp_intc_set_wake(unsigned int irq, unsigned int on)
90{
91 return 0;
92}
93
84static struct irq_chip cp_intc_irq_chip = { 94static struct irq_chip cp_intc_irq_chip = {
85 .name = "cp_intc", 95 .name = "cp_intc",
86 .ack = cp_intc_ack_irq, 96 .ack = cp_intc_ack_irq,
87 .mask = cp_intc_mask_irq, 97 .mask = cp_intc_mask_irq,
88 .unmask = cp_intc_unmask_irq, 98 .unmask = cp_intc_unmask_irq,
89 .set_type = cp_intc_set_irq_type, 99 .set_type = cp_intc_set_irq_type,
100 .set_wake = cp_intc_set_wake,
90}; 101};
91 102
92void __init cp_intc_init(void __iomem *base, unsigned short num_irq, 103void __init cp_intc_init(void __iomem *base, unsigned short num_irq,
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index dd2d32c4ce86..a5105f03fd86 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -481,11 +481,18 @@ static struct platform_device da8xx_rtc_device = {
481 481
482int da8xx_register_rtc(void) 482int da8xx_register_rtc(void)
483{ 483{
484 int ret;
485
484 /* Unlock the rtc's registers */ 486 /* Unlock the rtc's registers */
485 __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c)); 487 __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c));
486 __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70)); 488 __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70));
487 489
488 return platform_device_register(&da8xx_rtc_device); 490 ret = platform_device_register(&da8xx_rtc_device);
491 if (!ret)
492 /* Atleast on DA850, RTC is a wakeup source */
493 device_init_wakeup(&da8xx_rtc_device.dev, true);
494
495 return ret;
489} 496}
490 497
491static struct resource da8xx_cpuidle_resources[] = { 498static struct resource da8xx_cpuidle_resources[] = {
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 2ec619ec1657..f53735cb922e 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -993,7 +993,6 @@ void __init dm365_init_asp(struct snd_platform_data *pdata)
993 993
994void __init dm365_init_ks(struct davinci_ks_platform_data *pdata) 994void __init dm365_init_ks(struct davinci_ks_platform_data *pdata)
995{ 995{
996 davinci_cfg_reg(DM365_KEYSCAN);
997 dm365_ks_device.dev.platform_data = pdata; 996 dm365_ks_device.dev.platform_data = pdata;
998 platform_device_register(&dm365_ks_device); 997 platform_device_register(&dm365_ks_device);
999} 998}
diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile
index 32f8609e4f85..3afb1b25946f 100644
--- a/arch/arm/mach-footbridge/Makefile
+++ b/arch/arm/mach-footbridge/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := common.o dc21285.o dma.o isa-irq.o time.o 7obj-y := common.o dc21285.o dma.o isa-irq.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
@@ -25,4 +25,4 @@ obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
25obj-$(CONFIG_PCI) +=$(pci-y) 25obj-$(CONFIG_PCI) +=$(pci-y)
26obj-$(CONFIG_LEDS) +=$(leds-y) 26obj-$(CONFIG_LEDS) +=$(leds-y)
27 27
28obj-$(CONFIG_ISA) += isa.o 28obj-$(CONFIG_ISA) += isa.o isa-rtc.o
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index da35bc5c5ccc..bc5e83fb5819 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -56,8 +56,6 @@ static void __init footbridge_timer_init(void)
56 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; 56 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16;
57 57
58 setup_irq(IRQ_TIMER1, &footbridge_timer_irq); 58 setup_irq(IRQ_TIMER1, &footbridge_timer_irq);
59
60 isa_rtc_init();
61} 59}
62 60
63struct sys_timer footbridge_timer = { 61struct sys_timer footbridge_timer = {
diff --git a/arch/arm/mach-footbridge/isa-rtc.c b/arch/arm/mach-footbridge/isa-rtc.c
new file mode 100644
index 000000000000..07fde4051f78
--- /dev/null
+++ b/arch/arm/mach-footbridge/isa-rtc.c
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-footbridge/isa-rtc.c
3 *
4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell
6 *
7 * CATS has a real-time clock, though the evaluation board doesn't.
8 *
9 * Changelog:
10 * 21-Mar-1998 RMK Created
11 * 27-Aug-1998 PJB CATS support
12 * 28-Dec-1998 APH Made leds optional
13 * 20-Jan-1999 RMK Started merge of EBSA285, CATS and NetWinder
14 * 16-Mar-1999 RMK More support for EBSA285-like machines with RTCs in
15 */
16
17#define RTC_PORT(x) (0x70+(x))
18#define RTC_ALWAYS_BCD 0
19
20#include <linux/init.h>
21#include <linux/mc146818rtc.h>
22#include <linux/bcd.h>
23#include <linux/io.h>
24
25#include "common.h"
26
27void __init isa_rtc_init(void)
28{
29 int reg_d, reg_b;
30
31 /*
32 * Probe for the RTC.
33 */
34 reg_d = CMOS_READ(RTC_REG_D);
35
36 /*
37 * make sure the divider is set
38 */
39 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_REG_A);
40
41 /*
42 * Set control reg B
43 * (24 hour mode, update enabled)
44 */
45 reg_b = CMOS_READ(RTC_REG_B) & 0x7f;
46 reg_b |= 2;
47 CMOS_WRITE(reg_b, RTC_REG_B);
48
49 if ((CMOS_READ(RTC_REG_A) & 0x7f) == RTC_REF_CLCK_32KHZ &&
50 CMOS_READ(RTC_REG_B) == reg_b) {
51 /*
52 * We have a RTC. Check the battery
53 */
54 if ((reg_d & 0x80) == 0)
55 printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n");
56 }
57}
diff --git a/arch/arm/mach-footbridge/isa-timer.c b/arch/arm/mach-footbridge/isa-timer.c
index 0c8390082fa8..f488fa2082d7 100644
--- a/arch/arm/mach-footbridge/isa-timer.c
+++ b/arch/arm/mach-footbridge/isa-timer.c
@@ -76,8 +76,6 @@ static struct irqaction isa_timer_irq = {
76 76
77static void __init isa_timer_init(void) 77static void __init isa_timer_init(void)
78{ 78{
79 isa_rtc_init();
80
81 /* enable PIT timer */ 79 /* enable PIT timer */
82 /* set for periodic (4) and LSB/MSB write (0x30) */ 80 /* set for periodic (4) and LSB/MSB write (0x30) */
83 outb(0x34, 0x43); 81 outb(0x34, 0x43);
diff --git a/arch/arm/mach-footbridge/isa.c b/arch/arm/mach-footbridge/isa.c
index 725a219d0ed5..4d9276c27d6f 100644
--- a/arch/arm/mach-footbridge/isa.c
+++ b/arch/arm/mach-footbridge/isa.c
@@ -11,6 +11,9 @@
11#include <linux/serial_8250.h> 11#include <linux/serial_8250.h>
12 12
13#include <asm/irq.h> 13#include <asm/irq.h>
14#include <asm/hardware/dec21285.h>
15
16#include "common.h"
14 17
15static struct resource rtc_resources[] = { 18static struct resource rtc_resources[] = {
16 [0] = { 19 [0] = {
@@ -77,11 +80,18 @@ static struct platform_device serial_device = {
77 80
78static int __init footbridge_isa_init(void) 81static int __init footbridge_isa_init(void)
79{ 82{
80 int err; 83 int err = 0;
81 84
82 err = platform_device_register(&rtc_device); 85 if (!footbridge_cfn_mode())
83 if (err) 86 return 0;
84 printk(KERN_ERR "Unable to register RTC device: %d\n", err); 87
88 /* Personal server doesn't have RTC */
89 if (!machine_is_personal_server()) {
90 isa_rtc_init();
91 err = platform_device_register(&rtc_device);
92 if (err)
93 printk(KERN_ERR "Unable to register RTC device: %d\n", err);
94 }
85 err = platform_device_register(&serial_device); 95 err = platform_device_register(&serial_device);
86 if (err) 96 if (err)
87 printk(KERN_ERR "Unable to register serial device: %d\n", err); 97 printk(KERN_ERR "Unable to register serial device: %d\n", err);
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
deleted file mode 100644
index cd1b54ff9fe2..000000000000
--- a/arch/arm/mach-footbridge/time.c
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/time.h
3 *
4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell
6 *
7 * CATS has a real-time clock, though the evaluation board doesn't.
8 *
9 * Changelog:
10 * 21-Mar-1998 RMK Created
11 * 27-Aug-1998 PJB CATS support
12 * 28-Dec-1998 APH Made leds optional
13 * 20-Jan-1999 RMK Started merge of EBSA285, CATS and NetWinder
14 * 16-Mar-1999 RMK More support for EBSA285-like machines with RTCs in
15 */
16
17#define RTC_PORT(x) (rtc_base+(x))
18#define RTC_ALWAYS_BCD 0
19
20#include <linux/timex.h>
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/mc146818rtc.h>
24#include <linux/bcd.h>
25#include <linux/io.h>
26
27#include <mach/hardware.h>
28
29#include <asm/mach/time.h>
30#include "common.h"
31
32static int rtc_base;
33
34static unsigned long __init get_isa_cmos_time(void)
35{
36 unsigned int year, mon, day, hour, min, sec;
37
38 // check to see if the RTC makes sense.....
39 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0)
40 return mktime(1970, 1, 1, 0, 0, 0);
41
42 do {
43 sec = CMOS_READ(RTC_SECONDS);
44 min = CMOS_READ(RTC_MINUTES);
45 hour = CMOS_READ(RTC_HOURS);
46 day = CMOS_READ(RTC_DAY_OF_MONTH);
47 mon = CMOS_READ(RTC_MONTH);
48 year = CMOS_READ(RTC_YEAR);
49 } while (sec != CMOS_READ(RTC_SECONDS));
50
51 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
52 sec = bcd2bin(sec);
53 min = bcd2bin(min);
54 hour = bcd2bin(hour);
55 day = bcd2bin(day);
56 mon = bcd2bin(mon);
57 year = bcd2bin(year);
58 }
59 if ((year += 1900) < 1970)
60 year += 100;
61 return mktime(year, mon, day, hour, min, sec);
62}
63
64static int set_isa_cmos_time(void)
65{
66 int retval = 0;
67 int real_seconds, real_minutes, cmos_minutes;
68 unsigned char save_control, save_freq_select;
69 unsigned long nowtime = xtime.tv_sec;
70
71 save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */
72 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
73
74 save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */
75 CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
76
77 cmos_minutes = CMOS_READ(RTC_MINUTES);
78 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
79 cmos_minutes = bcd2bin(cmos_minutes);
80
81 /*
82 * since we're only adjusting minutes and seconds,
83 * don't interfere with hour overflow. This avoids
84 * messing with unknown time zones but requires your
85 * RTC not to be off by more than 15 minutes
86 */
87 real_seconds = nowtime % 60;
88 real_minutes = nowtime / 60;
89 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
90 real_minutes += 30; /* correct for half hour time zone */
91 real_minutes %= 60;
92
93 if (abs(real_minutes - cmos_minutes) < 30) {
94 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
95 real_seconds = bin2bcd(real_seconds);
96 real_minutes = bin2bcd(real_minutes);
97 }
98 CMOS_WRITE(real_seconds,RTC_SECONDS);
99 CMOS_WRITE(real_minutes,RTC_MINUTES);
100 } else
101 retval = -1;
102
103 /* The following flags have to be released exactly in this order,
104 * otherwise the DS12887 (popular MC146818A clone with integrated
105 * battery and quartz) will not reset the oscillator and will not
106 * update precisely 500 ms later. You won't find this mentioned in
107 * the Dallas Semiconductor data sheets, but who believes data
108 * sheets anyway ... -- Markus Kuhn
109 */
110 CMOS_WRITE(save_control, RTC_CONTROL);
111 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
112
113 return retval;
114}
115
116void __init isa_rtc_init(void)
117{
118 if (machine_is_personal_server())
119 /*
120 * Add-in 21285s shouldn't access the RTC
121 */
122 rtc_base = 0;
123 else
124 rtc_base = 0x70;
125
126 if (rtc_base) {
127 int reg_d, reg_b;
128
129 /*
130 * Probe for the RTC.
131 */
132 reg_d = CMOS_READ(RTC_REG_D);
133
134 /*
135 * make sure the divider is set
136 */
137 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_REG_A);
138
139 /*
140 * Set control reg B
141 * (24 hour mode, update enabled)
142 */
143 reg_b = CMOS_READ(RTC_REG_B) & 0x7f;
144 reg_b |= 2;
145 CMOS_WRITE(reg_b, RTC_REG_B);
146
147 if ((CMOS_READ(RTC_REG_A) & 0x7f) == RTC_REF_CLCK_32KHZ &&
148 CMOS_READ(RTC_REG_B) == reg_b) {
149 struct timespec tv;
150
151 /*
152 * We have a RTC. Check the battery
153 */
154 if ((reg_d & 0x80) == 0)
155 printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n");
156
157 tv.tv_nsec = 0;
158 tv.tv_sec = get_isa_cmos_time();
159 do_settimeofday(&tv);
160 set_rtc = set_isa_cmos_time;
161 } else
162 rtc_base = 0;
163 }
164}
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 8bf09ae5b347..f6c6196a51fa 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -52,6 +52,12 @@ config MACH_OPENRD_BASE
52 Say 'Y' here if you want your kernel to support the 52 Say 'Y' here if you want your kernel to support the
53 Marvell OpenRD Base Board. 53 Marvell OpenRD Base Board.
54 54
55config MACH_NETSPACE_V2
56 bool "LaCie Network Space v2 NAS Board"
57 help
58 Say 'Y' here if you want your kernel to support the
59 LaCie Network Space v2 NAS.
60
55endmenu 61endmenu
56 62
57endif 63endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 9f2f67b2b63d..d4d7f53b0fb9 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -8,5 +8,6 @@ obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
8obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o 8obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
9obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o 9obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
10obj-$(CONFIG_MACH_OPENRD_BASE) += openrd_base-setup.o 10obj-$(CONFIG_MACH_OPENRD_BASE) += openrd_base-setup.o
11obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o
11 12
12obj-$(CONFIG_CPU_IDLE) += cpuidle.o 13obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
new file mode 100644
index 000000000000..9a064065bebe
--- /dev/null
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -0,0 +1,325 @@
1/*
2 * arch/arm/mach-kirkwood/netspace_v2-setup.c
3 *
4 * LaCie Network Space v2 board setup
5 *
6 * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com>
7 * Copyright (C) 2009 Benoît Canet <benoit.canet@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/platform_device.h>
27#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h>
29#include <linux/spi/spi.h>
30#include <linux/ata_platform.h>
31#include <linux/mv643xx_eth.h>
32#include <linux/i2c.h>
33#include <linux/i2c/at24.h>
34#include <linux/input.h>
35#include <linux/gpio.h>
36#include <linux/gpio_keys.h>
37#include <linux/leds.h>
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41#include <mach/kirkwood.h>
42#include <plat/time.h>
43#include "common.h"
44#include "mpp.h"
45
46/*****************************************************************************
47 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
48 ****************************************************************************/
49
50static struct mtd_partition netspace_v2_flash_parts[] = {
51 {
52 .name = "u-boot",
53 .size = MTDPART_SIZ_FULL,
54 .offset = 0,
55 .mask_flags = MTD_WRITEABLE, /* force read-only */
56 },
57};
58
59static const struct flash_platform_data netspace_v2_flash = {
60 .type = "mx25l4005a",
61 .name = "spi_flash",
62 .parts = netspace_v2_flash_parts,
63 .nr_parts = ARRAY_SIZE(netspace_v2_flash_parts),
64};
65
66static struct spi_board_info __initdata netspace_v2_spi_slave_info[] = {
67 {
68 .modalias = "m25p80",
69 .platform_data = &netspace_v2_flash,
70 .irq = -1,
71 .max_speed_hz = 20000000,
72 .bus_num = 0,
73 .chip_select = 0,
74 },
75};
76
77/*****************************************************************************
78 * Ethernet
79 ****************************************************************************/
80
81static struct mv643xx_eth_platform_data netspace_v2_ge00_data = {
82 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
83};
84
85/*****************************************************************************
86 * I2C devices
87 ****************************************************************************/
88
89static struct at24_platform_data at24c04 = {
90 .byte_len = SZ_4K / 8,
91 .page_size = 16,
92};
93
94/*
95 * i2c addr | chip | description
96 * 0x50 | HT24LC04 | eeprom (512B)
97 */
98
99static struct i2c_board_info __initdata netspace_v2_i2c_info[] = {
100 {
101 I2C_BOARD_INFO("24c04", 0x50),
102 .platform_data = &at24c04,
103 }
104};
105
106/*****************************************************************************
107 * SATA
108 ****************************************************************************/
109
110static struct mv_sata_platform_data netspace_v2_sata_data = {
111 .n_ports = 2,
112};
113
114#define NETSPACE_V2_GPIO_SATA0_POWER 16
115#define NETSPACE_V2_GPIO_SATA1_POWER 17
116
117static void __init netspace_v2_sata_power_init(void)
118{
119 int err;
120
121 err = gpio_request(NETSPACE_V2_GPIO_SATA0_POWER, "SATA0 power");
122 if (err == 0) {
123 err = gpio_direction_output(NETSPACE_V2_GPIO_SATA0_POWER, 1);
124 if (err)
125 gpio_free(NETSPACE_V2_GPIO_SATA0_POWER);
126 }
127 if (err)
128 pr_err("netspace_v2: failed to setup SATA0 power\n");
129}
130
131/*****************************************************************************
132 * GPIO keys
133 ****************************************************************************/
134
135#define NETSPACE_V2_PUSH_BUTTON 32
136
137static struct gpio_keys_button netspace_v2_buttons[] = {
138 [0] = {
139 .code = KEY_POWER,
140 .gpio = NETSPACE_V2_PUSH_BUTTON,
141 .desc = "Power push button",
142 .active_low = 0,
143 },
144};
145
146static struct gpio_keys_platform_data netspace_v2_button_data = {
147 .buttons = netspace_v2_buttons,
148 .nbuttons = ARRAY_SIZE(netspace_v2_buttons),
149};
150
151static struct platform_device netspace_v2_gpio_buttons = {
152 .name = "gpio-keys",
153 .id = -1,
154 .dev = {
155 .platform_data = &netspace_v2_button_data,
156 },
157};
158
159/*****************************************************************************
160 * GPIO LEDs
161 ****************************************************************************/
162
163/*
164 * The blue front LED is wired to a CPLD and can blink in relation with the
165 * SATA activity.
166 *
167 * The following array detail the different LED registers and the combination
168 * of their possible values:
169 *
170 * cmd_led | slow_led | /SATA active | LED state
171 * | | |
172 * 1 | 0 | x | off
173 * - | 1 | x | on
174 * 0 | 0 | 1 | on
175 * 0 | 0 | 0 | blink (rate 300ms)
176 */
177
178#define NETSPACE_V2_GPIO_RED_LED 12
179#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
180#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
181
182
183static struct gpio_led netspace_v2_gpio_led_pins[] = {
184 {
185 .name = "ns_v2:red:fail",
186 .gpio = NETSPACE_V2_GPIO_RED_LED,
187 },
188};
189
190static struct gpio_led_platform_data netspace_v2_gpio_leds_data = {
191 .num_leds = ARRAY_SIZE(netspace_v2_gpio_led_pins),
192 .leds = netspace_v2_gpio_led_pins,
193};
194
195static struct platform_device netspace_v2_gpio_leds = {
196 .name = "leds-gpio",
197 .id = -1,
198 .dev = {
199 .platform_data = &netspace_v2_gpio_leds_data,
200 },
201};
202
203static void __init netspace_v2_gpio_leds_init(void)
204{
205 platform_device_register(&netspace_v2_gpio_leds);
206
207 /*
208 * Configure the front blue LED to blink in relation with the SATA
209 * activity.
210 */
211 if (gpio_request(NETSPACE_V2_GPIO_BLUE_LED_SLOW,
212 "SATA blue LED slow") != 0)
213 return;
214 if (gpio_direction_output(NETSPACE_V2_GPIO_BLUE_LED_SLOW, 0) != 0)
215 goto err_free_1;
216 if (gpio_request(NETSPACE_V2_GPIO_BLUE_LED_CMD,
217 "SATA blue LED command") != 0)
218 goto err_free_1;
219 if (gpio_direction_output(NETSPACE_V2_GPIO_BLUE_LED_CMD, 0) != 0)
220 goto err_free_2;
221
222 return;
223
224err_free_2:
225 gpio_free(NETSPACE_V2_GPIO_BLUE_LED_CMD);
226err_free_1:
227 gpio_free(NETSPACE_V2_GPIO_BLUE_LED_SLOW);
228 pr_err("netspace_v2: failed to configure SATA blue LED\n");
229}
230
231/*****************************************************************************
232 * Timer
233 ****************************************************************************/
234
235static void netspace_v2_timer_init(void)
236{
237 kirkwood_tclk = 166666667;
238 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
239}
240
241struct sys_timer netspace_v2_timer = {
242 .init = netspace_v2_timer_init,
243};
244
245/*****************************************************************************
246 * General Setup
247 ****************************************************************************/
248
249static unsigned int netspace_v2_mpp_config[] __initdata = {
250 MPP0_SPI_SCn,
251 MPP1_SPI_MOSI,
252 MPP2_SPI_SCK,
253 MPP3_SPI_MISO,
254 MPP4_NF_IO6,
255 MPP5_NF_IO7,
256 MPP6_SYSRST_OUTn,
257 MPP8_TW_SDA,
258 MPP9_TW_SCK,
259 MPP10_UART0_TXD,
260 MPP11_UART0_RXD,
261 MPP12_GPO, /* Red led */
262 MPP14_GPIO, /* USB fuse */
263 MPP16_GPIO, /* SATA 0 power */
264 MPP18_NF_IO0,
265 MPP19_NF_IO1,
266 MPP20_SATA1_ACTn,
267 MPP21_SATA0_ACTn,
268 MPP24_GPIO, /* USB mode select */
269 MPP25_GPIO, /* Fan rotation fail */
270 MPP26_GPIO, /* USB device vbus */
271 MPP28_GPIO, /* USB enable host vbus */
272 MPP29_GPIO, /* Blue led (slow register) */
273 MPP30_GPIO, /* Blue led (command register) */
274 MPP31_GPIO, /* Board power off */
275 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
276 0
277};
278
279#define NETSPACE_V2_GPIO_POWER_OFF 31
280
281static void netspace_v2_power_off(void)
282{
283 gpio_set_value(NETSPACE_V2_GPIO_POWER_OFF, 1);
284}
285
286static void __init netspace_v2_init(void)
287{
288 /*
289 * Basic setup. Needs to be called early.
290 */
291 kirkwood_init();
292 kirkwood_mpp_conf(netspace_v2_mpp_config);
293
294 netspace_v2_sata_power_init();
295
296 kirkwood_ehci_init();
297 kirkwood_ge00_init(&netspace_v2_ge00_data);
298 kirkwood_sata_init(&netspace_v2_sata_data);
299 kirkwood_uart0_init();
300 spi_register_board_info(netspace_v2_spi_slave_info,
301 ARRAY_SIZE(netspace_v2_spi_slave_info));
302 kirkwood_spi_init();
303 kirkwood_i2c_init();
304 i2c_register_board_info(0, netspace_v2_i2c_info,
305 ARRAY_SIZE(netspace_v2_i2c_info));
306
307 netspace_v2_gpio_leds_init();
308 platform_device_register(&netspace_v2_gpio_buttons);
309
310 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&
311 gpio_direction_output(NETSPACE_V2_GPIO_POWER_OFF, 0) == 0)
312 pm_power_off = netspace_v2_power_off;
313 else
314 pr_err("netspace_v2: failed to configure power-off GPIO\n");
315}
316
317MACHINE_START(NETSPACE_V2, "LaCie Network Space v2")
318 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
319 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
320 .boot_params = 0x00000100,
321 .init_machine = netspace_v2_init,
322 .map_io = kirkwood_map_io,
323 .init_irq = kirkwood_init_irq,
324 .timer = &netspace_v2_timer,
325MACHINE_END
diff --git a/arch/arm/mach-lh7a40x/clocks.c b/arch/arm/mach-lh7a40x/clocks.c
index fcaf876f19b6..0651f96653f9 100644
--- a/arch/arm/mach-lh7a40x/clocks.c
+++ b/arch/arm/mach-lh7a40x/clocks.c
@@ -10,6 +10,8 @@
10#include <mach/hardware.h> 10#include <mach/hardware.h>
11#include <mach/clocks.h> 11#include <mach/clocks.h>
12#include <linux/err.h> 12#include <linux/err.h>
13#include <linux/device.h>
14#include <linux/string.h>
13 15
14struct module; 16struct module;
15 17
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 8f49b2b12608..b22dec4abf78 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -24,8 +24,6 @@
24 24
25#include "common.h" 25#include "common.h"
26 26
27#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
28
29static unsigned long ttc_dkb_pin_config[] __initdata = { 27static unsigned long ttc_dkb_pin_config[] __initdata = {
30 /* UART2 */ 28 /* UART2 */
31 GPIO47_UART2_RXD, 29 GPIO47_UART2_RXD,
diff --git a/arch/arm/mach-mx2/mxt_td60.c b/arch/arm/mach-mx2/mxt_td60.c
index 03dbbdc98955..8bcc1a5b8829 100644
--- a/arch/arm/mach-mx2/mxt_td60.c
+++ b/arch/arm/mach-mx2/mxt_td60.c
@@ -58,21 +58,6 @@ static unsigned int mxt_td60_pins[] __initdata = {
58 PE9_PF_UART3_RXD, 58 PE9_PF_UART3_RXD,
59 PE10_PF_UART3_CTS, 59 PE10_PF_UART3_CTS,
60 PE11_PF_UART3_RTS, 60 PE11_PF_UART3_RTS,
61 /* UART3 */
62 PB26_AF_UART4_RTS,
63 PB28_AF_UART4_TXD,
64 PB29_AF_UART4_CTS,
65 PB31_AF_UART4_RXD,
66 /* UART4 */
67 PB18_AF_UART5_TXD,
68 PB19_AF_UART5_RXD,
69 PB20_AF_UART5_CTS,
70 PB21_AF_UART5_RTS,
71 /* UART5 */
72 PB10_AF_UART6_TXD,
73 PB12_AF_UART6_CTS,
74 PB11_AF_UART6_RXD,
75 PB13_AF_UART6_RTS,
76 /* FEC */ 61 /* FEC */
77 PD0_AIN_FEC_TXD0, 62 PD0_AIN_FEC_TXD0,
78 PD1_AIN_FEC_TXD1, 63 PD1_AIN_FEC_TXD1,
@@ -261,12 +246,6 @@ static struct imxuart_platform_data uart_pdata[] = {
261 .flags = IMXUART_HAVE_RTSCTS, 246 .flags = IMXUART_HAVE_RTSCTS,
262 }, { 247 }, {
263 .flags = IMXUART_HAVE_RTSCTS, 248 .flags = IMXUART_HAVE_RTSCTS,
264 }, {
265 .flags = IMXUART_HAVE_RTSCTS,
266 }, {
267 .flags = IMXUART_HAVE_RTSCTS,
268 }, {
269 .flags = IMXUART_HAVE_RTSCTS,
270 }, 249 },
271}; 250};
272 251
@@ -278,9 +257,6 @@ static void __init mxt_td60_board_init(void)
278 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); 257 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
279 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); 258 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
280 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); 259 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
281 mxc_register_device(&mxc_uart_device3, &uart_pdata[3]);
282 mxc_register_device(&mxc_uart_device4, &uart_pdata[4]);
283 mxc_register_device(&mxc_uart_device5, &uart_pdata[5]);
284 mxc_register_device(&mxc_nand_device, &mxt_td60_nand_board_info); 260 mxc_register_device(&mxc_nand_device, &mxt_td60_nand_board_info);
285 261
286 i2c_register_board_info(0, mxt_td60_i2c_devices, 262 i2c_register_board_info(0, mxt_td60_i2c_devices,
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
index ef26951a5275..6e838b857712 100644
--- a/arch/arm/mach-mx25/clock.c
+++ b/arch/arm/mach-mx25/clock.c
@@ -173,6 +173,7 @@ DEFINE_CLOCK(pwm4_clk, 0, CCM_CGCR2, 2, get_rate_ipg, NULL);
173DEFINE_CLOCK(kpp_clk, 0, CCM_CGCR1, 28, get_rate_ipg, NULL); 173DEFINE_CLOCK(kpp_clk, 0, CCM_CGCR1, 28, get_rate_ipg, NULL);
174DEFINE_CLOCK(tsc_clk, 0, CCM_CGCR2, 13, get_rate_ipg, NULL); 174DEFINE_CLOCK(tsc_clk, 0, CCM_CGCR2, 13, get_rate_ipg, NULL);
175DEFINE_CLOCK(i2c_clk, 0, CCM_CGCR0, 6, get_rate_i2c, NULL); 175DEFINE_CLOCK(i2c_clk, 0, CCM_CGCR0, 6, get_rate_i2c, NULL);
176DEFINE_CLOCK(fec_clk, 0, CCM_CGCR0, 23, get_rate_ipg, NULL);
176 177
177#define _REGISTER_CLOCK(d, n, c) \ 178#define _REGISTER_CLOCK(d, n, c) \
178 { \ 179 { \
@@ -204,6 +205,7 @@ static struct clk_lookup lookups[] = {
204 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 205 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
205 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) 206 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
206 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk) 207 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
208 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
207}; 209};
208 210
209int __init mx25_clocks_init(unsigned long fref) 211int __init mx25_clocks_init(unsigned long fref)
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index 63511de3a559..9fdeea1c083b 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -419,3 +419,22 @@ int __init mxc_register_gpios(void)
419 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); 419 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
420} 420}
421 421
422static struct resource mx25_fec_resources[] = {
423 {
424 .start = MX25_FEC_BASE_ADDR,
425 .end = MX25_FEC_BASE_ADDR + 0xfff,
426 .flags = IORESOURCE_MEM,
427 },
428 {
429 .start = MX25_INT_FEC,
430 .end = MX25_INT_FEC,
431 .flags = IORESOURCE_IRQ,
432 },
433};
434
435struct platform_device mx25_fec_device = {
436 .name = "fec",
437 .id = 0,
438 .num_resources = ARRAY_SIZE(mx25_fec_resources),
439 .resource = mx25_fec_resources,
440};
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h
index fe6bf88ad1dd..fe5420fcd11f 100644
--- a/arch/arm/mach-mx25/devices.h
+++ b/arch/arm/mach-mx25/devices.h
@@ -17,3 +17,4 @@ extern struct platform_device mxc_keypad_device;
17extern struct platform_device mxc_i2c_device0; 17extern struct platform_device mxc_i2c_device0;
18extern struct platform_device mxc_i2c_device1; 18extern struct platform_device mxc_i2c_device1;
19extern struct platform_device mxc_i2c_device2; 19extern struct platform_device mxc_i2c_device2;
20extern struct platform_device mx25_fec_device;
diff --git a/arch/arm/mach-mx25/mx25pdk.c b/arch/arm/mach-mx25/mx25pdk.c
index d23ae571c03f..921bc99ea231 100644
--- a/arch/arm/mach-mx25/mx25pdk.c
+++ b/arch/arm/mach-mx25/mx25pdk.c
@@ -18,10 +18,11 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/delay.h>
21#include <linux/clk.h> 22#include <linux/clk.h>
22#include <linux/irq.h> 23#include <linux/irq.h>
23#include <linux/gpio.h> 24#include <linux/gpio.h>
24#include <linux/smsc911x.h> 25#include <linux/fec.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
@@ -35,16 +36,57 @@
35#include <mach/mx25.h> 36#include <mach/mx25.h>
36#include <mach/mxc_nand.h> 37#include <mach/mxc_nand.h>
37#include "devices.h" 38#include "devices.h"
38#include <mach/iomux-v3.h> 39#include <mach/iomux.h>
39 40
40static struct imxuart_platform_data uart_pdata = { 41static struct imxuart_platform_data uart_pdata = {
41 .flags = IMXUART_HAVE_RTSCTS, 42 .flags = IMXUART_HAVE_RTSCTS,
42}; 43};
43 44
45static struct pad_desc mx25pdk_pads[] = {
46 MX25_PAD_FEC_MDC__FEC_MDC,
47 MX25_PAD_FEC_MDIO__FEC_MDIO,
48 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
49 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
50 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
51 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
52 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
53 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
54 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
55 MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
56 MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
57};
58
59static struct fec_platform_data mx25_fec_pdata = {
60 .phy = PHY_INTERFACE_MODE_RMII,
61};
62
63#define FEC_ENABLE_GPIO 35
64#define FEC_RESET_B_GPIO 104
65
66static void __init mx25pdk_fec_reset(void)
67{
68 gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
69 gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
70
71 gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
72 gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
73 udelay(2);
74
75 /* turn on PHY power and lift reset */
76 gpio_set_value(FEC_ENABLE_GPIO, 1);
77 gpio_set_value(FEC_RESET_B_GPIO, 1);
78}
79
44static void __init mx25pdk_init(void) 80static void __init mx25pdk_init(void)
45{ 81{
82 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
83 ARRAY_SIZE(mx25pdk_pads));
84
46 mxc_register_device(&mxc_uart_device0, &uart_pdata); 85 mxc_register_device(&mxc_uart_device0, &uart_pdata);
47 mxc_register_device(&mxc_usbh2, NULL); 86 mxc_register_device(&mxc_usbh2, NULL);
87
88 mx25pdk_fec_reset();
89 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
48} 90}
49 91
50static void __init mx25pdk_timer_init(void) 92static void __init mx25pdk_timer_init(void)
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index ea8ed109a7c2..28294416b0af 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -49,6 +49,7 @@ config MACH_PCM037_EET
49config MACH_MX31LITE 49config MACH_MX31LITE
50 bool "Support MX31 LITEKIT (LogicPD)" 50 bool "Support MX31 LITEKIT (LogicPD)"
51 select ARCH_MX31 51 select ARCH_MX31
52 select MXC_ULPI if USB_ULPI
52 help 53 help
53 Include support for MX31 LITEKIT platform. This includes specific 54 Include support for MX31 LITEKIT platform. This includes specific
54 configurations for the board and its peripherals. 55 configurations for the board and its peripherals.
@@ -63,7 +64,7 @@ config MACH_MX31_3DS
63config MACH_MX31MOBOARD 64config MACH_MX31MOBOARD
64 bool "Support mx31moboard platforms (EPFL Mobots group)" 65 bool "Support mx31moboard platforms (EPFL Mobots group)"
65 select ARCH_MX31 66 select ARCH_MX31
66 select MXC_ULPI 67 select MXC_ULPI if USB_ULPI
67 help 68 help
68 Include support for mx31moboard platform. This includes specific 69 Include support for mx31moboard platform. This includes specific
69 configurations for the board and its peripherals. 70 configurations for the board and its peripherals.
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c
index bedf5b8d976a..6858a4f9806c 100644
--- a/arch/arm/mach-mx3/mm.c
+++ b/arch/arm/mach-mx3/mm.c
@@ -65,6 +65,11 @@ static struct map_desc mxc_io_desc[] __initdata = {
65 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR), 65 .pfn = __phys_to_pfn(AIPS2_BASE_ADDR),
66 .length = AIPS2_SIZE, 66 .length = AIPS2_SIZE,
67 .type = MT_DEVICE_NONSHARED 67 .type = MT_DEVICE_NONSHARED
68 }, {
69 .virtual = SPBA0_BASE_ADDR_VIRT,
70 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
71 .length = SPBA0_SIZE,
72 .type = MT_DEVICE_NONSHARED
68 }, 73 },
69}; 74};
70 75
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index 0497c152be18..3e7bafa2ddbb 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -494,11 +494,6 @@ static void mxc_init_i2c(void)
494 */ 494 */
495static struct map_desc mx31ads_io_desc[] __initdata = { 495static struct map_desc mx31ads_io_desc[] __initdata = {
496 { 496 {
497 .virtual = SPBA0_BASE_ADDR_VIRT,
498 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
499 .length = SPBA0_SIZE,
500 .type = MT_DEVICE_NONSHARED
501 }, {
502 .virtual = CS4_BASE_ADDR_VIRT, 497 .virtual = CS4_BASE_ADDR_VIRT,
503 .pfn = __phys_to_pfn(CS4_BASE_ADDR), 498 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
504 .length = CS4_SIZE / 2, 499 .length = CS4_SIZE / 2,
diff --git a/arch/arm/mach-mx3/mx31lite.c b/arch/arm/mach-mx3/mx31lite.c
index def6b6736594..789b20d1730f 100644
--- a/arch/arm/mach-mx3/mx31lite.c
+++ b/arch/arm/mach-mx3/mx31lite.c
@@ -135,6 +135,7 @@ static struct spi_board_info mc13783_spi_dev __initdata = {
135 * USB 135 * USB
136 */ 136 */
137 137
138#if defined(CONFIG_USB_ULPI)
138#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ 139#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
139 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) 140 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
140 141
@@ -180,6 +181,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
180 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, 181 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
181 .flags = MXC_EHCI_POWER_PINS_ENABLED, 182 .flags = MXC_EHCI_POWER_PINS_ENABLED,
182}; 183};
184#endif
183 185
184/* 186/*
185 * NOR flash 187 * NOR flash
@@ -212,11 +214,6 @@ static struct platform_device physmap_flash_device = {
212 */ 214 */
213static struct map_desc mx31lite_io_desc[] __initdata = { 215static struct map_desc mx31lite_io_desc[] __initdata = {
214 { 216 {
215 .virtual = SPBA0_BASE_ADDR_VIRT,
216 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
217 .length = SPBA0_SIZE,
218 .type = MT_DEVICE_NONSHARED
219 }, {
220 .virtual = CS4_BASE_ADDR_VIRT, 217 .virtual = CS4_BASE_ADDR_VIRT,
221 .pfn = __phys_to_pfn(CS4_BASE_ADDR), 218 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
222 .length = CS4_SIZE, 219 .length = CS4_SIZE,
@@ -261,11 +258,13 @@ static void __init mxc_board_init(void)
261 mxc_register_device(&mxc_spi_device1, &spi1_pdata); 258 mxc_register_device(&mxc_spi_device1, &spi1_pdata);
262 spi_register_board_info(&mc13783_spi_dev, 1); 259 spi_register_board_info(&mc13783_spi_dev, 1);
263 260
261#if defined(CONFIG_USB_ULPI)
264 /* USB */ 262 /* USB */
265 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 263 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
266 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); 264 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
267 265
268 mxc_register_device(&mxc_usbh2, &usbh2_pdata); 266 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
267#endif
269 268
270 /* SMSC9117 IRQ pin */ 269 /* SMSC9117 IRQ pin */
271 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); 270 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 8fc624f141cb..438428eaf769 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -179,7 +179,7 @@ static int __init devboard_usbh1_init(void)
179 179
180 usbh1_pdata.otg = otg; 180 usbh1_pdata.otg = otg;
181 181
182 return mxc_register_device(&mx31_usbh1, &usbh1_pdata); 182 return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
183} 183}
184 184
185/* 185/*
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 85184a35e674..1f44b9ccbb0f 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -294,7 +294,7 @@ static int __init marxbot_usbh1_init(void)
294 294
295 usbh1_pdata.otg = otg; 295 usbh1_pdata.otg = otg;
296 296
297 return mxc_register_device(&mx31_usbh1, &usbh1_pdata); 297 return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
298} 298}
299 299
300/* 300/*
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index b70529145936..cfd605d078ec 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -346,6 +346,8 @@ static struct fsl_usb2_platform_data usb_pdata = {
346 .phy_mode = FSL_USB2_PHY_ULPI, 346 .phy_mode = FSL_USB2_PHY_ULPI,
347}; 347};
348 348
349#if defined(CONFIG_USB_ULPI)
350
349#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) 351#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
350 352
351static int moboard_usbh2_hw_init(struct platform_device *pdev) 353static int moboard_usbh2_hw_init(struct platform_device *pdev)
@@ -392,8 +394,11 @@ static int __init moboard_usbh2_init(void)
392 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 394 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
393 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT); 395 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
394 396
395 return mxc_register_device(&mx31_usbh2, &usbh2_pdata); 397 return mxc_register_device(&mxc_usbh2, &usbh2_pdata);
396} 398}
399#else
400static inline int moboard_usbh2_init(void) { return 0; }
401#endif
397 402
398 403
399static struct gpio_led mx31moboard_leds[] = { 404static struct gpio_led mx31moboard_leds[] = {
diff --git a/arch/arm/mach-mx3/mx31pdk.c b/arch/arm/mach-mx3/mx31pdk.c
index 0f7a2f06bc2d..18715f1aa7eb 100644
--- a/arch/arm/mach-mx3/mx31pdk.c
+++ b/arch/arm/mach-mx3/mx31pdk.c
@@ -211,11 +211,6 @@ static int __init mx31pdk_init_expio(void)
211 */ 211 */
212static struct map_desc mx31pdk_io_desc[] __initdata = { 212static struct map_desc mx31pdk_io_desc[] __initdata = {
213 { 213 {
214 .virtual = SPBA0_BASE_ADDR_VIRT,
215 .pfn = __phys_to_pfn(SPBA0_BASE_ADDR),
216 .length = SPBA0_SIZE,
217 .type = MT_DEVICE_NONSHARED,
218 }, {
219 .virtual = CS5_BASE_ADDR_VIRT, 214 .virtual = CS5_BASE_ADDR_VIRT,
220 .pfn = __phys_to_pfn(CS5_BASE_ADDR), 215 .pfn = __phys_to_pfn(CS5_BASE_ADDR),
221 .length = CS5_SIZE, 216 .length = CS5_SIZE,
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 6cbaabedf386..5be396917c99 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -322,16 +322,25 @@ static int pcm037_camera_power(struct device *dev, int on)
322 return 0; 322 return 0;
323} 323}
324 324
325static struct i2c_board_info pcm037_i2c_2_devices[] = { 325static struct i2c_board_info pcm037_i2c_camera[] = {
326 { 326 {
327 I2C_BOARD_INFO("mt9t031", 0x5d), 327 I2C_BOARD_INFO("mt9t031", 0x5d),
328 }, {
329 I2C_BOARD_INFO("mt9v022", 0x48),
328 }, 330 },
329}; 331};
330 332
331static struct soc_camera_link iclink = { 333static struct soc_camera_link iclink_mt9v022 = {
334 .bus_id = 0, /* Must match with the camera ID */
335 .board_info = &pcm037_i2c_camera[1],
336 .i2c_adapter_id = 2,
337 .module_name = "mt9v022",
338};
339
340static struct soc_camera_link iclink_mt9t031 = {
332 .bus_id = 0, /* Must match with the camera ID */ 341 .bus_id = 0, /* Must match with the camera ID */
333 .power = pcm037_camera_power, 342 .power = pcm037_camera_power,
334 .board_info = &pcm037_i2c_2_devices[0], 343 .board_info = &pcm037_i2c_camera[0],
335 .i2c_adapter_id = 2, 344 .i2c_adapter_id = 2,
336 .module_name = "mt9t031", 345 .module_name = "mt9t031",
337}; 346};
@@ -345,11 +354,19 @@ static struct i2c_board_info pcm037_i2c_devices[] = {
345 } 354 }
346}; 355};
347 356
348static struct platform_device pcm037_camera = { 357static struct platform_device pcm037_mt9t031 = {
349 .name = "soc-camera-pdrv", 358 .name = "soc-camera-pdrv",
350 .id = 0, 359 .id = 0,
351 .dev = { 360 .dev = {
352 .platform_data = &iclink, 361 .platform_data = &iclink_mt9t031,
362 },
363};
364
365static struct platform_device pcm037_mt9v022 = {
366 .name = "soc-camera-pdrv",
367 .id = 1,
368 .dev = {
369 .platform_data = &iclink_mt9v022,
353 }, 370 },
354}; 371};
355 372
@@ -449,7 +466,8 @@ static int __init pcm037_camera_alloc_dma(const size_t buf_size)
449static struct platform_device *devices[] __initdata = { 466static struct platform_device *devices[] __initdata = {
450 &pcm037_flash, 467 &pcm037_flash,
451 &pcm037_sram_device, 468 &pcm037_sram_device,
452 &pcm037_camera, 469 &pcm037_mt9t031,
470 &pcm037_mt9v022,
453}; 471};
454 472
455static struct ipu_platform_data mx3_ipu_data = { 473static struct ipu_platform_data mx3_ipu_data = {
@@ -599,7 +617,7 @@ static void __init mxc_board_init(void)
599 if (!ret) 617 if (!ret)
600 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); 618 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1);
601 else 619 else
602 iclink.power = NULL; 620 iclink_mt9t031.power = NULL;
603 621
604 if (!pcm037_camera_alloc_dma(4 * 1024 * 1024)) 622 if (!pcm037_camera_alloc_dma(4 * 1024 * 1024))
605 mxc_register_device(&mx3_camera, &camera_pdata); 623 mxc_register_device(&mx3_camera, &camera_pdata);
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index ab995a9c606c..65e7b5b85d83 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -599,7 +599,7 @@ static struct clk i2c_ick = {
599static struct omap_clk omap_clks[] = { 599static struct omap_clk omap_clks[] = {
600 /* non-ULPD clocks */ 600 /* non-ULPD clocks */
601 CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX), 601 CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX),
602 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310), 602 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310 | CK_7XX),
603 /* CK_GEN1 clocks */ 603 /* CK_GEN1 clocks */
604 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX), 604 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
605 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX), 605 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
@@ -627,7 +627,7 @@ static struct omap_clk omap_clks[] = {
627 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX), 627 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
628 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310), 628 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
629 CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX), 629 CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
630 CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310), 630 CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
631 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310), 631 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
632 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX), 632 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
633 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX), 633 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
@@ -658,6 +658,10 @@ static struct omap_clk omap_clks[] = {
658 CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX), 658 CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX),
659 CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX), 659 CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
660 CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX), 660 CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX),
661 CLK("omap1_spi100k.1", "fck", &dummy_ck, CK_7XX),
662 CLK("omap1_spi100k.1", "ick", &dummy_ck, CK_7XX),
663 CLK("omap1_spi100k.2", "fck", &dummy_ck, CK_7XX),
664 CLK("omap1_spi100k.2", "ick", &dummy_ck, CK_7XX),
661 CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), 665 CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
662 CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX), 666 CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
663 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310), 667 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
@@ -674,7 +678,7 @@ static struct omap_clk omap_clks[] = {
674 * init 678 * init
675 */ 679 */
676 680
677static struct clk_functions omap1_clk_functions __initdata = { 681static struct clk_functions omap1_clk_functions = {
678 .clk_enable = omap1_clk_enable, 682 .clk_enable = omap1_clk_enable,
679 .clk_disable = omap1_clk_disable, 683 .clk_disable = omap1_clk_disable,
680 .clk_round_rate = omap1_clk_round_rate, 684 .clk_round_rate = omap1_clk_round_rate,
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 23ded2d49600..a2d07aa75c9e 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/spi/spi.h>
17 18
18#include <mach/hardware.h> 19#include <mach/hardware.h>
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
@@ -23,6 +24,7 @@
23#include <plat/mux.h> 24#include <plat/mux.h>
24#include <mach/gpio.h> 25#include <mach/gpio.h>
25#include <plat/mmc.h> 26#include <plat/mmc.h>
27#include <plat/omap7xx.h>
26 28
27/*-------------------------------------------------------------------------*/ 29/*-------------------------------------------------------------------------*/
28 30
@@ -196,6 +198,38 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
196 198
197/*-------------------------------------------------------------------------*/ 199/*-------------------------------------------------------------------------*/
198 200
201/* OMAP7xx SPI support */
202#if defined(CONFIG_SPI_OMAP_100K) || defined(CONFIG_SPI_OMAP_100K_MODULE)
203
204struct platform_device omap_spi1 = {
205 .name = "omap1_spi100k",
206 .id = 1,
207};
208
209struct platform_device omap_spi2 = {
210 .name = "omap1_spi100k",
211 .id = 2,
212};
213
214static void omap_init_spi100k(void)
215{
216 omap_spi1.dev.platform_data = ioremap(OMAP7XX_SPI1_BASE, 0x7ff);
217 if (omap_spi1.dev.platform_data)
218 platform_device_register(&omap_spi1);
219
220 omap_spi2.dev.platform_data = ioremap(OMAP7XX_SPI2_BASE, 0x7ff);
221 if (omap_spi2.dev.platform_data)
222 platform_device_register(&omap_spi2);
223}
224
225#else
226static inline void omap_init_spi100k(void)
227{
228}
229#endif
230
231/*-------------------------------------------------------------------------*/
232
199#if defined(CONFIG_OMAP_STI) 233#if defined(CONFIG_OMAP_STI)
200 234
201#define OMAP1_STI_BASE 0xfffea000 235#define OMAP1_STI_BASE 0xfffea000
@@ -263,6 +297,7 @@ static int __init omap1_init_devices(void)
263 297
264 omap_init_mbox(); 298 omap_init_mbox();
265 omap_init_rtc(); 299 omap_init_rtc();
300 omap_init_spi100k();
266 omap_init_sti(); 301 omap_init_sti();
267 302
268 return 0; 303 return 0;
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 07212cc621ae..84341377232d 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -62,6 +62,14 @@ MUX_CFG_7XX("MMC_7XX_DAT0", 2, 17, 0, 16, 1, 0)
62/* I2C interface */ 62/* I2C interface */
63MUX_CFG_7XX("I2C_7XX_SCL", 5, 1, 0, 0, 1, 0) 63MUX_CFG_7XX("I2C_7XX_SCL", 5, 1, 0, 0, 1, 0)
64MUX_CFG_7XX("I2C_7XX_SDA", 5, 5, 0, 0, 1, 0) 64MUX_CFG_7XX("I2C_7XX_SDA", 5, 5, 0, 0, 1, 0)
65
66/* SPI pins */
67MUX_CFG_7XX("SPI_7XX_1", 6, 5, 4, 4, 1, 0)
68MUX_CFG_7XX("SPI_7XX_2", 6, 9, 4, 8, 1, 0)
69MUX_CFG_7XX("SPI_7XX_3", 6, 13, 4, 12, 1, 0)
70MUX_CFG_7XX("SPI_7XX_4", 6, 17, 4, 16, 1, 0)
71MUX_CFG_7XX("SPI_7XX_5", 8, 25, 0, 24, 0, 0)
72MUX_CFG_7XX("SPI_7XX_6", 9, 5, 0, 4, 0, 0)
65}; 73};
66#define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins) 74#define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins)
67#else 75#else
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 76c11ee113e9..606bf04f51b6 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -18,6 +18,7 @@ config ARCH_OMAP2430
18config ARCH_OMAP34XX 18config ARCH_OMAP34XX
19 bool "OMAP34xx Based System" 19 bool "OMAP34xx Based System"
20 depends on ARCH_OMAP3 20 depends on ARCH_OMAP3
21 select USB_ARCH_HAS_EHCI
21 22
22config ARCH_OMAP3430 23config ARCH_OMAP3430
23 bool "OMAP3430 support" 24 bool "OMAP3430 support"
@@ -79,6 +80,7 @@ config MACH_OVERO
79config MACH_OMAP3EVM 80config MACH_OMAP3EVM
80 bool "OMAP 3530 EVM board" 81 bool "OMAP 3530 EVM board"
81 depends on ARCH_OMAP3 && ARCH_OMAP34XX 82 depends on ARCH_OMAP3 && ARCH_OMAP34XX
83 select OMAP_PACKAGE_CBB
82 84
83config MACH_OMAP3517EVM 85config MACH_OMAP3517EVM
84 bool "OMAP3517/ AM3517 EVM board" 86 bool "OMAP3517/ AM3517 EVM board"
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 1591aae64500..2626a9f8a73a 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -29,7 +29,7 @@
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30 30
31#include <linux/i2c/at24.h> 31#include <linux/i2c/at24.h>
32#include <linux/i2c/twl4030.h> 32#include <linux/i2c/twl.h>
33#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
34 34
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 44239e3ec02e..117b8fd7e3a6 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -19,7 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20 20
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/i2c/twl4030.h> 22#include <linux/i2c/twl.h>
23 23
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 18913e96e34d..34de17851572 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -26,7 +26,7 @@
26 26
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 28#include <linux/spi/ads7846.h>
29#include <linux/i2c/twl4030.h> 29#include <linux/i2c/twl.h>
30#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
31#include <linux/smsc911x.h> 31#include <linux/smsc911x.h>
32 32
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index c9e5ebb4d91d..fe3d22cb2457 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -34,7 +34,7 @@
34#include <linux/spi/ads7846.h> 34#include <linux/spi/ads7846.h>
35 35
36#include <linux/regulator/machine.h> 36#include <linux/regulator/machine.h>
37#include <linux/i2c/twl4030.h> 37#include <linux/i2c/twl.h>
38 38
39#include <mach/hardware.h> 39#include <mach/hardware.h>
40#include <asm/mach-types.h> 40#include <asm/mach-types.h>
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 17f3c91231db..acafdbc8aa16 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -16,7 +16,7 @@
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/spi/wl12xx.h> 17#include <linux/spi/wl12xx.h>
18#include <linux/i2c.h> 18#include <linux/i2c.h>
19#include <linux/i2c/twl4030.h> 19#include <linux/i2c/twl.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/regulator/machine.h> 22#include <linux/regulator/machine.h>
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 258794db488f..1e3dfb652acc 100755
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -14,7 +14,7 @@
14#include <linux/input.h> 14#include <linux/input.h>
15#include <linux/input/matrix_keypad.h> 15#include <linux/input/matrix_keypad.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/i2c/twl4030.h> 17#include <linux/i2c/twl.h>
18#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
19 19
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
@@ -63,21 +63,21 @@ static int board_keymap[] = {
63 KEY(5, 1, KEY_H), 63 KEY(5, 1, KEY_H),
64 KEY(5, 2, KEY_J), 64 KEY(5, 2, KEY_J),
65 KEY(5, 3, KEY_F3), 65 KEY(5, 3, KEY_F3),
66 KEY(5, 4, KEY_UNKNOWN),
66 KEY(5, 5, KEY_VOLUMEDOWN), 67 KEY(5, 5, KEY_VOLUMEDOWN),
67 KEY(5, 6, KEY_M), 68 KEY(5, 6, KEY_M),
68 KEY(5, 7, KEY_ENTER), 69 KEY(5, 7, KEY_RIGHT),
69 KEY(6, 0, KEY_Q), 70 KEY(6, 0, KEY_Q),
70 KEY(6, 1, KEY_A), 71 KEY(6, 1, KEY_A),
71 KEY(6, 2, KEY_N), 72 KEY(6, 2, KEY_N),
72 KEY(6, 3, KEY_BACKSPACE), 73 KEY(6, 3, KEY_BACKSPACE),
73 KEY(6, 6, KEY_P), 74 KEY(6, 6, KEY_P),
74 KEY(6, 7, KEY_SELECT), 75 KEY(6, 7, KEY_UP),
75 KEY(7, 0, KEY_PROG1), /*MACRO 1 <User defined> */ 76 KEY(7, 0, KEY_PROG1), /*MACRO 1 <User defined> */
76 KEY(7, 1, KEY_PROG2), /*MACRO 2 <User defined> */ 77 KEY(7, 1, KEY_PROG2), /*MACRO 2 <User defined> */
77 KEY(7, 2, KEY_PROG3), /*MACRO 3 <User defined> */ 78 KEY(7, 2, KEY_PROG3), /*MACRO 3 <User defined> */
78 KEY(7, 3, KEY_PROG4), /*MACRO 4 <User defined> */ 79 KEY(7, 3, KEY_PROG4), /*MACRO 4 <User defined> */
79 KEY(7, 5, KEY_RIGHT), 80 KEY(7, 6, KEY_SELECT),
80 KEY(7, 6, KEY_UP),
81 KEY(7, 7, KEY_DOWN) 81 KEY(7, 7, KEY_DOWN)
82}; 82};
83 83
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index d0e3fb7f9298..5420356eb407 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -449,40 +449,78 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
449#ifdef CONFIG_CPU_FREQ 449#ifdef CONFIG_CPU_FREQ
450/* 450/*
451 * Walk PRCM rate table and fillout cpufreq freq_table 451 * Walk PRCM rate table and fillout cpufreq freq_table
452 * XXX This should be replaced by an OPP layer in the near future
452 */ 453 */
453static struct cpufreq_frequency_table freq_table[ARRAY_SIZE(rate_table)]; 454static struct cpufreq_frequency_table *freq_table;
454 455
455void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) 456void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
456{ 457{
457 struct prcm_config *prcm; 458 const struct prcm_config *prcm;
459 long sys_ck_rate;
458 int i = 0; 460 int i = 0;
461 int tbl_sz = 0;
462
463 sys_ck_rate = clk_get_rate(sclk);
459 464
460 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 465 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
461 if (!(prcm->flags & cpu_mask)) 466 if (!(prcm->flags & cpu_mask))
462 continue; 467 continue;
463 if (prcm->xtal_speed != sys_ck.rate) 468 if (prcm->xtal_speed != sys_ck_rate)
464 continue; 469 continue;
465 470
466 /* don't put bypass rates in table */ 471 /* don't put bypass rates in table */
467 if (prcm->dpll_speed == prcm->xtal_speed) 472 if (prcm->dpll_speed == prcm->xtal_speed)
468 continue; 473 continue;
469 474
470 freq_table[i].index = i; 475 tbl_sz++;
471 freq_table[i].frequency = prcm->mpu_speed / 1000;
472 i++;
473 } 476 }
474 477
475 if (i == 0) { 478 /*
476 printk(KERN_WARNING "%s: failed to initialize frequency " 479 * XXX Ensure that we're doing what CPUFreq expects for this error
477 "table\n", __func__); 480 * case and the following one
481 */
482 if (tbl_sz == 0) {
483 pr_warning("%s: no matching entries in rate_table\n",
484 __func__);
485 return;
486 }
487
488 /* Include the CPUFREQ_TABLE_END terminator entry */
489 tbl_sz++;
490
491 freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * tbl_sz,
492 GFP_ATOMIC);
493 if (!freq_table) {
494 pr_err("%s: could not kzalloc frequency table\n", __func__);
478 return; 495 return;
479 } 496 }
480 497
498 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
499 if (!(prcm->flags & cpu_mask))
500 continue;
501 if (prcm->xtal_speed != sys_ck_rate)
502 continue;
503
504 /* don't put bypass rates in table */
505 if (prcm->dpll_speed == prcm->xtal_speed)
506 continue;
507
508 freq_table[i].index = i;
509 freq_table[i].frequency = prcm->mpu_speed / 1000;
510 i++;
511 }
512
481 freq_table[i].index = i; 513 freq_table[i].index = i;
482 freq_table[i].frequency = CPUFREQ_TABLE_END; 514 freq_table[i].frequency = CPUFREQ_TABLE_END;
483 515
484 *table = &freq_table[0]; 516 *table = &freq_table[0];
485} 517}
518
519void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
520{
521 kfree(freq_table);
522}
523
486#endif 524#endif
487 525
488struct clk_functions omap2_clk_functions = { 526struct clk_functions omap2_clk_functions = {
@@ -494,6 +532,7 @@ struct clk_functions omap2_clk_functions = {
494 .clk_disable_unused = omap2_clk_disable_unused, 532 .clk_disable_unused = omap2_clk_disable_unused,
495#ifdef CONFIG_CPU_FREQ 533#ifdef CONFIG_CPU_FREQ
496 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, 534 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
535 .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,
497#endif 536#endif
498}; 537};
499 538
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index ded32364f32b..d4217b93e10b 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -34,7 +34,6 @@
34#include <asm/div64.h> 34#include <asm/div64.h>
35#include <asm/clkdev.h> 35#include <asm/clkdev.h>
36 36
37#include <plat/sdrc.h>
38#include "clock.h" 37#include "clock.h"
39#include "clock34xx.h" 38#include "clock34xx.h"
40#include "sdrc.h" 39#include "sdrc.h"
diff --git a/arch/arm/mach-omap2/clock34xx_data.c b/arch/arm/mach-omap2/clock34xx_data.c
index 8bdcc9cc7f9a..c6031d74d6f6 100644
--- a/arch/arm/mach-omap2/clock34xx_data.c
+++ b/arch/arm/mach-omap2/clock34xx_data.c
@@ -776,6 +776,8 @@ static struct clk dpll4_m5_ck = {
776 .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, 776 .clksel_mask = OMAP3430_CLKSEL_CAM_MASK,
777 .clksel = div16_dpll4_clksel, 777 .clksel = div16_dpll4_clksel,
778 .clkdm_name = "dpll4_clkdm", 778 .clkdm_name = "dpll4_clkdm",
779 .set_rate = &omap2_clksel_set_rate,
780 .round_rate = &omap2_clksel_round_rate,
779 .recalc = &omap2_clksel_recalc, 781 .recalc = &omap2_clksel_recalc,
780}; 782};
781 783
@@ -1500,6 +1502,7 @@ static struct clk uart2_fck = {
1500 .parent = &core_48m_fck, 1502 .parent = &core_48m_fck,
1501 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1503 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1502 .enable_bit = OMAP3430_EN_UART2_SHIFT, 1504 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1505 .clkdm_name = "core_l4_clkdm",
1503 .recalc = &followparent_recalc, 1506 .recalc = &followparent_recalc,
1504}; 1507};
1505 1508
@@ -1509,6 +1512,7 @@ static struct clk uart1_fck = {
1509 .parent = &core_48m_fck, 1512 .parent = &core_48m_fck,
1510 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1511 .enable_bit = OMAP3430_EN_UART1_SHIFT, 1514 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1515 .clkdm_name = "core_l4_clkdm",
1512 .recalc = &followparent_recalc, 1516 .recalc = &followparent_recalc,
1513}; 1517};
1514 1518
@@ -2745,7 +2749,7 @@ static struct clk mcbsp4_ick = {
2745}; 2749};
2746 2750
2747static const struct clksel mcbsp_234_clksel[] = { 2751static const struct clksel mcbsp_234_clksel[] = {
2748 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates }, 2752 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2749 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, 2753 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2750 { .parent = NULL } 2754 { .parent = NULL }
2751}; 2755};
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 1a45ed1e8ba1..dd285f001467 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -559,7 +559,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
559 * downstream clocks for debugging purposes? 559 * downstream clocks for debugging purposes?
560 */ 560 */
561 561
562 if (!clkdm || !clk) 562 if (!clkdm || !clk || !clkdm->clktrctrl_mask)
563 return -EINVAL; 563 return -EINVAL;
564 564
565 if (atomic_inc_return(&clkdm->usecount) > 1) 565 if (atomic_inc_return(&clkdm->usecount) > 1)
@@ -610,7 +610,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
610 * downstream clocks for debugging purposes? 610 * downstream clocks for debugging purposes?
611 */ 611 */
612 612
613 if (!clkdm || !clk) 613 if (!clkdm || !clk || !clkdm->clktrctrl_mask)
614 return -EINVAL; 614 return -EINVAL;
615 615
616#ifdef DEBUG 616#ifdef DEBUG
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index a8749e8017b9..5a7996402c53 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -33,7 +33,6 @@
33#include <plat/sdrc.h> 33#include <plat/sdrc.h>
34#include <plat/gpmc.h> 34#include <plat/gpmc.h>
35#include <plat/serial.h> 35#include <plat/serial.h>
36#include <plat/mux.h>
37#include <plat/vram.h> 36#include <plat/vram.h>
38 37
39#include "clock.h" 38#include "clock.h"
@@ -73,21 +72,21 @@ static struct map_desc omap24xx_io_desc[] __initdata = {
73#ifdef CONFIG_ARCH_OMAP2420 72#ifdef CONFIG_ARCH_OMAP2420
74static struct map_desc omap242x_io_desc[] __initdata = { 73static struct map_desc omap242x_io_desc[] __initdata = {
75 { 74 {
76 .virtual = DSP_MEM_24XX_VIRT, 75 .virtual = DSP_MEM_2420_VIRT,
77 .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS), 76 .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS),
78 .length = DSP_MEM_24XX_SIZE, 77 .length = DSP_MEM_2420_SIZE,
79 .type = MT_DEVICE 78 .type = MT_DEVICE
80 }, 79 },
81 { 80 {
82 .virtual = DSP_IPI_24XX_VIRT, 81 .virtual = DSP_IPI_2420_VIRT,
83 .pfn = __phys_to_pfn(DSP_IPI_24XX_PHYS), 82 .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS),
84 .length = DSP_IPI_24XX_SIZE, 83 .length = DSP_IPI_2420_SIZE,
85 .type = MT_DEVICE 84 .type = MT_DEVICE
86 }, 85 },
87 { 86 {
88 .virtual = DSP_MMU_24XX_VIRT, 87 .virtual = DSP_MMU_2420_VIRT,
89 .pfn = __phys_to_pfn(DSP_MMU_24XX_PHYS), 88 .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS),
90 .length = DSP_MMU_24XX_SIZE, 89 .length = DSP_MMU_2420_SIZE,
91 .type = MT_DEVICE 90 .type = MT_DEVICE
92 }, 91 },
93}; 92};
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index e071b3fd1878..459ef23ab8a8 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -994,8 +994,10 @@ int __init omap_mux_init(u32 mux_pbase, u32 mux_size,
994 } 994 }
995 995
996#ifdef CONFIG_OMAP_MUX 996#ifdef CONFIG_OMAP_MUX
997 omap_mux_package_fixup(package_subset, superset); 997 if (package_subset)
998 omap_mux_package_init_balls(package_balls, superset); 998 omap_mux_package_fixup(package_subset, superset);
999 if (package_balls)
1000 omap_mux_package_init_balls(package_balls, superset);
999 omap_mux_set_cmdline_signals(); 1001 omap_mux_set_cmdline_signals();
1000 omap_mux_set_board_signals(board_mux); 1002 omap_mux_set_board_signals(board_mux);
1001#endif 1003#endif
diff --git a/arch/arm/mach-omap2/opp2420_data.c b/arch/arm/mach-omap2/opp2420_data.c
index 126a9396b3a8..e6dda694fd5c 100644
--- a/arch/arm/mach-omap2/opp2420_data.c
+++ b/arch/arm/mach-omap2/opp2420_data.c
@@ -9,45 +9,47 @@
9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'. 9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
10 * These configurations are characterized by voltage and speed for clocks. 10 * These configurations are characterized by voltage and speed for clocks.
11 * The device is only validated for certain combinations. One way to express 11 * The device is only validated for certain combinations. One way to express
12 * these combinations is via the 'ratio's' which the clocks operate with 12 * these combinations is via the 'ratios' which the clocks operate with
13 * respect to each other. These ratio sets are for a given voltage/DPLL 13 * respect to each other. These ratio sets are for a given voltage/DPLL
14 * setting. All configurations can be described by a DPLL setting and a ratio 14 * setting. All configurations can be described by a DPLL setting and a ratio.
15 * There are 3 ratio sets for the 2430 and X ratio sets for 2420.
16 *
17 * 2430 differs from 2420 in that there are no more phase synchronizers used.
18 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs
19 * 2430 (iva2.1, NOdsp, mdm)
20 * 15 *
21 * XXX Missing voltage data. 16 * XXX Missing voltage data.
17 * XXX Missing 19.2MHz sys_clk rate sets (needed for N800/N810)
22 * 18 *
23 * THe format described in this file is deprecated. Once a reasonable 19 * THe format described in this file is deprecated. Once a reasonable
24 * OPP API exists, the data in this file should be converted to use it. 20 * OPP API exists, the data in this file should be converted to use it.
25 * 21 *
26 * This is technically part of the OMAP2xxx clock code. 22 * This is technically part of the OMAP2xxx clock code.
23 *
24 * Considerable work is still needed to fully support dynamic frequency
25 * changes on OMAP2xxx-series chips. Readers interested in such a
26 * project are encouraged to review the Maemo Diablo RX-34 and RX-44
27 * kernel source at:
28 * http://repository.maemo.org/pool/diablo/free/k/kernel-source-diablo/
27 */ 29 */
28 30
29#include "opp2xxx.h" 31#include "opp2xxx.h"
30#include "sdrc.h" 32#include "sdrc.h"
31#include "clock.h" 33#include "clock.h"
32 34
33/*------------------------------------------------------------------------- 35/*
34 * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. 36 * Key dividers which make up a PRCM set. Ratios for a PRCM are mandated.
35 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, 37 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,
36 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, 38 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL,
37 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM 39 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM
38 * 40 *
39 * Filling in table based on H4 boards and 2430-SDPs variants available. 41 * Filling in table based on H4 boards available. There are quite a
40 * There are quite a few more rates combinations which could be defined. 42 * few more rate combinations which could be defined.
41 * 43 *
42 * When multiple values are defined the start up will try and choose the 44 * When multiple values are defined the start up will try and choose
43 * fastest one. If a 'fast' value is defined, then automatically, the /2 45 * the fastest one. If a 'fast' value is defined, then automatically,
44 * one should be included as it can be used. Generally having more that 46 * the /2 one should be included as it can be used. Generally having
45 * one fast set does not make sense, as static timings need to be changed 47 * more than one fast set does not make sense, as static timings need
46 * to change the set. The exception is the bypass setting which is 48 * to be changed to change the set. The exception is the bypass
47 * availble for low power bypass. 49 * setting which is available for low power bypass.
48 * 50 *
49 * Note: This table needs to be sorted, fastest to slowest. 51 * Note: This table needs to be sorted, fastest to slowest.
50 *-------------------------------------------------------------------------*/ 52 **/
51const struct prcm_config omap2420_rate_table[] = { 53const struct prcm_config omap2420_rate_table[] = {
52 /* PRCM I - FAST */ 54 /* PRCM I - FAST */
53 {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */ 55 {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */
diff --git a/arch/arm/mach-omap2/opp2430_data.c b/arch/arm/mach-omap2/opp2430_data.c
index edb81672c844..1b9596ae201e 100644
--- a/arch/arm/mach-omap2/opp2430_data.c
+++ b/arch/arm/mach-omap2/opp2430_data.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * opp2420_data.c - old-style "OPP" table for OMAP2420 2 * opp2430_data.c - old-style "OPP" table for OMAP2430
3 * 3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation 5 * Copyright (C) 2004-2009 Nokia Corporation
@@ -9,16 +9,16 @@
9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'. 9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
10 * These configurations are characterized by voltage and speed for clocks. 10 * These configurations are characterized by voltage and speed for clocks.
11 * The device is only validated for certain combinations. One way to express 11 * The device is only validated for certain combinations. One way to express
12 * these combinations is via the 'ratio's' which the clocks operate with 12 * these combinations is via the 'ratios' which the clocks operate with
13 * respect to each other. These ratio sets are for a given voltage/DPLL 13 * respect to each other. These ratio sets are for a given voltage/DPLL
14 * setting. All configurations can be described by a DPLL setting and a ratio 14 * setting. All configurations can be described by a DPLL setting and a ratio.
15 * There are 3 ratio sets for the 2430 and X ratio sets for 2420.
16 * 15 *
17 * 2430 differs from 2420 in that there are no more phase synchronizers used. 16 * 2430 differs from 2420 in that there are no more phase synchronizers used.
18 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs 17 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs
19 * 2430 (iva2.1, NOdsp, mdm) 18 * 2430 (iva2.1, NOdsp, mdm)
20 * 19 *
21 * XXX Missing voltage data. 20 * XXX Missing voltage data.
21 * XXX Missing 19.2MHz sys_clk rate sets.
22 * 22 *
23 * THe format described in this file is deprecated. Once a reasonable 23 * THe format described in this file is deprecated. Once a reasonable
24 * OPP API exists, the data in this file should be converted to use it. 24 * OPP API exists, the data in this file should be converted to use it.
@@ -30,24 +30,24 @@
30#include "sdrc.h" 30#include "sdrc.h"
31#include "clock.h" 31#include "clock.h"
32 32
33/*------------------------------------------------------------------------- 33/*
34 * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. 34 * Key dividers which make up a PRCM set. Ratios for a PRCM are mandated.
35 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU, 35 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,
36 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL, 36 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL,
37 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM 37 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM
38 * 38 *
39 * Filling in table based on H4 boards and 2430-SDPs variants available. 39 * Filling in table based on 2430-SDPs variants available. There are
40 * There are quite a few more rates combinations which could be defined. 40 * quite a few more rate combinations which could be defined.
41 * 41 *
42 * When multiple values are defined the start up will try and choose the 42 * When multiple values are defined the start up will try and choose
43 * fastest one. If a 'fast' value is defined, then automatically, the /2 43 * the fastest one. If a 'fast' value is defined, then automatically,
44 * one should be included as it can be used. Generally having more that 44 * the /2 one should be included as it can be used. Generally having
45 * one fast set does not make sense, as static timings need to be changed 45 * more than one fast set does not make sense, as static timings need
46 * to change the set. The exception is the bypass setting which is 46 * to be changed to change the set. The exception is the bypass
47 * availble for low power bypass. 47 * setting which is available for low power bypass.
48 * 48 *
49 * Note: This table needs to be sorted, fastest to slowest. 49 * Note: This table needs to be sorted, fastest to slowest.
50 *-------------------------------------------------------------------------*/ 50 */
51const struct prcm_config omap2430_rate_table[] = { 51const struct prcm_config omap2430_rate_table[] = {
52 /* PRCM #4 - ratio2 (ES2.1) - FAST */ 52 /* PRCM #4 - ratio2 (ES2.1) - FAST */
53 {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */ 53 {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 81ed252a0f8a..c6cc809afb79 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -124,8 +124,8 @@ static void omap3_core_save_context(void)
124 control_padconf_off |= START_PADCONF_SAVE; 124 control_padconf_off |= START_PADCONF_SAVE;
125 omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF); 125 omap_ctrl_writel(control_padconf_off, OMAP343X_CONTROL_PADCONF_OFF);
126 /* wait for the save to complete */ 126 /* wait for the save to complete */
127 while (!omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS) 127 while (!(omap_ctrl_readl(OMAP343X_CONTROL_GENERAL_PURPOSE_STATUS)
128 & PADCONF_SAVE_DONE) 128 & PADCONF_SAVE_DONE))
129 ; 129 ;
130 /* Save the Interrupt controller context */ 130 /* Save the Interrupt controller context */
131 omap_intc_save_context(); 131 omap_intc_save_context();
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 39b797bc14d6..8c964bec8159 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -125,6 +125,13 @@ static struct plat_serial8250_port serial_platform_data3[] = {
125 } 125 }
126}; 126};
127#endif 127#endif
128static inline unsigned int __serial_read_reg(struct uart_port *up,
129 int offset)
130{
131 offset <<= up->regshift;
132 return (unsigned int)__raw_readb(up->membase + offset);
133}
134
128static inline unsigned int serial_read_reg(struct plat_serial8250_port *up, 135static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
129 int offset) 136 int offset)
130{ 137{
@@ -583,11 +590,12 @@ static unsigned int serial_in_override(struct uart_port *up, int offset)
583{ 590{
584 if (UART_RX == offset) { 591 if (UART_RX == offset) {
585 unsigned int lsr; 592 unsigned int lsr;
586 lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR); 593 lsr = __serial_read_reg(up, UART_LSR);
587 if (!(lsr & UART_LSR_DR)) 594 if (!(lsr & UART_LSR_DR))
588 return -EPERM; 595 return -EPERM;
589 } 596 }
590 return serial_read_reg(omap_uart[up->line].p, offset); 597
598 return __serial_read_reg(up, offset);
591} 599}
592 600
593void __init omap_serial_early_init(void) 601void __init omap_serial_early_init(void)
@@ -640,12 +648,9 @@ void __init omap_serial_early_init(void)
640 uart->num = i; 648 uart->num = i;
641 p->private_data = uart; 649 p->private_data = uart;
642 uart->p = p; 650 uart->p = p;
643 list_add_tail(&uart->node, &uart_list);
644 651
645 if (cpu_is_omap44xx()) 652 if (cpu_is_omap44xx())
646 p->irq += 32; 653 p->irq += 32;
647
648 omap_uart_enable_clocks(uart);
649 } 654 }
650} 655}
651 656
@@ -673,9 +678,13 @@ void __init omap_serial_init_port(int port)
673 pdev = &uart->pdev; 678 pdev = &uart->pdev;
674 dev = &pdev->dev; 679 dev = &pdev->dev;
675 680
681 omap_uart_enable_clocks(uart);
682
676 omap_uart_reset(uart); 683 omap_uart_reset(uart);
677 omap_uart_idle_init(uart); 684 omap_uart_idle_init(uart);
678 685
686 list_add_tail(&uart->node, &uart_list);
687
679 if (WARN_ON(platform_device_register(pdev))) 688 if (WARN_ON(platform_device_register(pdev)))
680 return; 689 return;
681 690
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index e6d8e10ae5d1..dee92182749b 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -37,6 +37,8 @@ config MACH_ZYLONITE320
37config MACH_LITTLETON 37config MACH_LITTLETON
38 bool "PXA3xx Form Factor Platform (aka Littleton)" 38 bool "PXA3xx Form Factor Platform (aka Littleton)"
39 select PXA3xx 39 select PXA3xx
40 select CPU_PXA300
41 select CPU_PXA310
40 select PXA_SSP 42 select PXA_SSP
41 43
42config MACH_TAVOREVB 44config MACH_TAVOREVB
@@ -110,6 +112,8 @@ config MACH_CM_X300
110 bool "CompuLab CM-X300 modules" 112 bool "CompuLab CM-X300 modules"
111 select PXA3xx 113 select PXA3xx
112 select CPU_PXA300 114 select CPU_PXA300
115 select CPU_PXA310
116 select HAVE_PWM
113 117
114config ARCH_GUMSTIX 118config ARCH_GUMSTIX
115 bool "Gumstix XScale 255 boards" 119 bool "Gumstix XScale 255 boards"
@@ -240,7 +244,6 @@ config MACH_COLIBRI300
240 select PXA3xx 244 select PXA3xx
241 select CPU_PXA300 245 select CPU_PXA300
242 select CPU_PXA310 246 select CPU_PXA310
243 select HAVE_PWM
244 247
245config MACH_COLIBRI320 248config MACH_COLIBRI320
246 bool "Toradex Colibri PXA320" 249 bool "Toradex Colibri PXA320"
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 3395463bb5a6..8e10db148f1b 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -4,7 +4,6 @@
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
6 6
7#include <mach/hardware.h>
8#include <mach/udc.h> 7#include <mach/udc.h>
9#include <mach/pxafb.h> 8#include <mach/pxafb.h>
10#include <mach/mmc.h> 9#include <mach/mmc.h>
@@ -14,6 +13,7 @@
14#include <mach/pxa2xx_spi.h> 13#include <mach/pxa2xx_spi.h>
15#include <mach/camera.h> 14#include <mach/camera.h>
16#include <mach/audio.h> 15#include <mach/audio.h>
16#include <mach/hardware.h>
17#include <plat/i2c.h> 17#include <plat/i2c.h>
18#include <plat/pxa3xx_nand.h> 18#include <plat/pxa3xx_nand.h>
19 19
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index 50f1297bf5ac..e741bf1bfb2d 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -250,20 +250,17 @@
250 250
251#define cpu_is_pxa930() \ 251#define cpu_is_pxa930() \
252 ({ \ 252 ({ \
253 unsigned int id = read_cpuid(CPUID_ID); \ 253 __cpu_is_pxa930(read_cpuid_id()); \
254 __cpu_is_pxa930(id); \
255 }) 254 })
256 255
257#define cpu_is_pxa935() \ 256#define cpu_is_pxa935() \
258 ({ \ 257 ({ \
259 unsigned int id = read_cpuid(CPUID_ID); \ 258 __cpu_is_pxa935(read_cpuid_id()); \
260 __cpu_is_pxa935(id); \
261 }) 259 })
262 260
263#define cpu_is_pxa950() \ 261#define cpu_is_pxa950() \
264 ({ \ 262 ({ \
265 unsigned int id = read_cpuid(CPUID_ID); \ 263 __cpu_is_pxa950(read_cpuid_id()); \
266 __cpu_is_pxa950(id); \
267 }) 264 })
268 265
269 266
diff --git a/arch/arm/mach-pxa/include/mach/zylonite.h b/arch/arm/mach-pxa/include/mach/zylonite.h
index bf6785adccf4..9edf645368d6 100644
--- a/arch/arm/mach-pxa/include/mach/zylonite.h
+++ b/arch/arm/mach-pxa/include/mach/zylonite.h
@@ -8,13 +8,6 @@
8/* the following variables are processor specific and initialized 8/* the following variables are processor specific and initialized
9 * by the corresponding zylonite_pxa3xx_init() 9 * by the corresponding zylonite_pxa3xx_init()
10 */ 10 */
11struct platform_mmc_slot {
12 int gpio_cd;
13 int gpio_wp;
14};
15
16extern struct platform_mmc_slot zylonite_mmc_slot[];
17
18extern int gpio_eth_irq; 11extern int gpio_eth_irq;
19extern int gpio_debug_led1; 12extern int gpio_debug_led1;
20extern int gpio_debug_led2; 13extern int gpio_debug_led2;
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index f28c1715b910..fa527b258d61 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -110,6 +110,12 @@ static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
110 GPIO7_MMC1_CLK, 110 GPIO7_MMC1_CLK,
111 GPIO8_MMC1_CMD, 111 GPIO8_MMC1_CMD,
112 GPIO15_GPIO, /* card detect */ 112 GPIO15_GPIO, /* card detect */
113
114 /* UART3 */
115 GPIO107_UART3_CTS,
116 GPIO108_UART3_RTS,
117 GPIO109_UART3_TXD,
118 GPIO110_UART3_RXD,
113}; 119};
114 120
115static struct resource smc91x_resources[] = { 121static struct resource smc91x_resources[] = {
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8a38d604dc77..189f330719a2 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -381,7 +381,7 @@ err:
381 return ret; 381 return ret;
382} 382}
383 383
384static int magician_backlight_notify(int brightness) 384static int magician_backlight_notify(struct device *dev, int brightness)
385{ 385{
386 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness); 386 gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
387 if (brightness >= 200) { 387 if (brightness >= 200) {
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 59140217890a..e100af78b166 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -270,7 +270,7 @@ err:
270 return ret; 270 return ret;
271} 271}
272 272
273static int palmld_backlight_notify(int brightness) 273static int palmld_backlight_notify(struct device *dev, int brightness)
274{ 274{
275 gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness); 275 gpio_set_value(GPIO_NR_PALMLD_BL_POWER, brightness);
276 gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness); 276 gpio_set_value(GPIO_NR_PALMLD_LCD_POWER, brightness);
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 7f89ca20f13a..8fe3ec27568f 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -209,7 +209,7 @@ err:
209 return ret; 209 return ret;
210} 210}
211 211
212static int palmt5_backlight_notify(int brightness) 212static int palmt5_backlight_notify(struct device *dev, int brightness)
213{ 213{
214 gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness); 214 gpio_set_value(GPIO_NR_PALMT5_BL_POWER, brightness);
215 gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness); 215 gpio_set_value(GPIO_NR_PALMT5_LCD_POWER, brightness);
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c
index 308417592007..b992f07ece21 100644
--- a/arch/arm/mach-pxa/palmtc.c
+++ b/arch/arm/mach-pxa/palmtc.c
@@ -185,7 +185,7 @@ err:
185 return ret; 185 return ret;
186} 186}
187 187
188static int palmtc_backlight_notify(int brightness) 188static int palmtc_backlight_notify(struct device *dev, int brightness)
189{ 189{
190 /* backlight is on when GPIO16 AF0 is high */ 190 /* backlight is on when GPIO16 AF0 is high */
191 gpio_set_value(GPIO_NR_PALMTC_BL_POWER, brightness); 191 gpio_set_value(GPIO_NR_PALMTC_BL_POWER, brightness);
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c
index 265d62bae7de..dc728d6ab94e 100644
--- a/arch/arm/mach-pxa/palmte2.c
+++ b/arch/arm/mach-pxa/palmte2.c
@@ -181,7 +181,7 @@ err:
181 return ret; 181 return ret;
182} 182}
183 183
184static int palmte2_backlight_notify(int brightness) 184static int palmte2_backlight_notify(struct device *dev, int brightness)
185{ 185{
186 gpio_set_value(GPIO_NR_PALMTE2_BL_POWER, brightness); 186 gpio_set_value(GPIO_NR_PALMTE2_BL_POWER, brightness);
187 gpio_set_value(GPIO_NR_PALMTE2_LCD_POWER, brightness); 187 gpio_set_value(GPIO_NR_PALMTE2_LCD_POWER, brightness);
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 606eb7e8a17e..b433bb496711 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -375,7 +375,7 @@ err:
375 return ret; 375 return ret;
376} 376}
377 377
378static int treo_backlight_notify(int brightness) 378static int treo_backlight_notify(struct device *dev, int brightness)
379{ 379{
380 gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness); 380 gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
381 return TREO_MAX_INTENSITY - brightness; 381 return TREO_MAX_INTENSITY - brightness;
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 7bf18c2f002f..b37a025c0b7b 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -269,7 +269,7 @@ err:
269 return ret; 269 return ret;
270} 270}
271 271
272static int palmtx_backlight_notify(int brightness) 272static int palmtx_backlight_notify(struct device *dev, int brightness)
273{ 273{
274 gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness); 274 gpio_set_value(GPIO_NR_PALMTX_BL_POWER, brightness);
275 gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness); 275 gpio_set_value(GPIO_NR_PALMTX_LCD_POWER, brightness);
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index d787ac7cfdd8..1c5d68a94511 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -196,7 +196,7 @@ err:
196 return ret; 196 return ret;
197} 197}
198 198
199static int palmz72_backlight_notify(int brightness) 199static int palmz72_backlight_notify(struct device *dev, int brightness)
200{ 200{
201 gpio_set_value(GPIO_NR_PALMZ72_BL_POWER, brightness); 201 gpio_set_value(GPIO_NR_PALMZ72_BL_POWER, brightness);
202 gpio_set_value(GPIO_NR_PALMZ72_LCD_POWER, brightness); 202 gpio_set_value(GPIO_NR_PALMZ72_LCD_POWER, brightness);
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index e5eeb3a62d01..c2b938a4d5c9 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -293,7 +293,7 @@ static struct pxamci_platform_data poodle_mci_platform_data = {
293 .init = poodle_mci_init, 293 .init = poodle_mci_init,
294 .setpower = poodle_mci_setpower, 294 .setpower = poodle_mci_setpower,
295 .exit = poodle_mci_exit, 295 .exit = poodle_mci_exit,
296 .gpio_card_detect = POODLE_IRQ_GPIO_nSD_DETECT, 296 .gpio_card_detect = POODLE_GPIO_nSD_DETECT,
297 .gpio_card_ro = POODLE_GPIO_nSD_WP, 297 .gpio_card_ro = POODLE_GPIO_nSD_WP,
298 .gpio_power = -1, 298 .gpio_power = -1,
299}; 299};
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 4b50f144fa48..28352c0b8c34 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -389,13 +389,13 @@ static struct gpio_keys_button spitz_gpio_keys[] = {
389 .type = EV_SW, 389 .type = EV_SW,
390 .code = 0, 390 .code = 0,
391 .gpio = SPITZ_GPIO_SWA, 391 .gpio = SPITZ_GPIO_SWA,
392 .desc = "Display Down", 392 .desc = "Display Down",
393 }, 393 },
394 { 394 {
395 .type = EV_SW, 395 .type = EV_SW,
396 .code = 1, 396 .code = 1,
397 .gpio = SPITZ_GPIO_SWB, 397 .gpio = SPITZ_GPIO_SWB,
398 .desc = "Lid Closed", 398 .desc = "Lid Closed",
399 }, 399 },
400}; 400};
401 401
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 5352b4e5a7dd..89f258c9e126 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -379,7 +379,7 @@ err_request_bckl:
379 return ret; 379 return ret;
380} 380}
381 381
382static int viper_backlight_notify(int brightness) 382static int viper_backlight_notify(struct device *dev, int brightness)
383{ 383{
384 gpio_set_value(VIPER_LCD_EN_GPIO, !!brightness); 384 gpio_set_value(VIPER_LCD_EN_GPIO, !!brightness);
385 gpio_set_value(VIPER_BCKLIGHT_EN_GPIO, !!brightness); 385 gpio_set_value(VIPER_BCKLIGHT_EN_GPIO, !!brightness);
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 5b986a8bd9e6..75f2a37f945d 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -25,6 +25,7 @@
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/i2c/pca953x.h> 27#include <linux/i2c/pca953x.h>
28#include <linux/apm-emulation.h>
28 29
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
@@ -626,8 +627,27 @@ static void zeus_power_off(void)
626 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP); 627 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP);
627} 628}
628 629
629int zeus_get_pcb_info(struct i2c_client *client, unsigned gpio, 630#ifdef CONFIG_APM_EMULATION
630 unsigned ngpio, void *context) 631static void zeus_get_power_status(struct apm_power_info *info)
632{
633 /* Power supply is always present */
634 info->ac_line_status = APM_AC_ONLINE;
635 info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT;
636 info->battery_flag = APM_BATTERY_FLAG_NOT_PRESENT;
637}
638
639static inline void zeus_setup_apm(void)
640{
641 apm_get_power_status = zeus_get_power_status;
642}
643#else
644static inline void zeus_setup_apm(void)
645{
646}
647#endif
648
649static int zeus_get_pcb_info(struct i2c_client *client, unsigned gpio,
650 unsigned ngpio, void *context)
631{ 651{
632 int i; 652 int i;
633 u8 pcb_info = 0; 653 u8 pcb_info = 0;
@@ -726,9 +746,18 @@ static mfp_cfg_t zeus_pin_config[] __initdata = {
726 GPIO99_GPIO, /* CF RDY */ 746 GPIO99_GPIO, /* CF RDY */
727}; 747};
728 748
749/*
750 * DM9k MSCx settings: SRAM, 16 bits
751 * 17 cycles delay first access
752 * 5 cycles delay next access
753 * 13 cycles recovery time
754 * faster device
755 */
756#define DM9K_MSC_VALUE 0xe4c9
757
729static void __init zeus_init(void) 758static void __init zeus_init(void)
730{ 759{
731 u16 dm9000_msc = 0xe279; 760 u16 dm9000_msc = DM9K_MSC_VALUE;
732 761
733 system_rev = __raw_readw(ZEUS_CPLD_VERSION); 762 system_rev = __raw_readw(ZEUS_CPLD_VERSION);
734 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f)); 763 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f));
@@ -738,6 +767,7 @@ static void __init zeus_init(void)
738 MSC1 = (MSC1 & 0xffff0000) | dm9000_msc; 767 MSC1 = (MSC1 & 0xffff0000) | dm9000_msc;
739 768
740 pm_power_off = zeus_power_off; 769 pm_power_off = zeus_power_off;
770 zeus_setup_apm();
741 771
742 pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config)); 772 pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
743 773
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index b66e9e2d06e7..2b4043c04d0c 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -36,9 +36,6 @@
36#include "devices.h" 36#include "devices.h"
37#include "generic.h" 37#include "generic.h"
38 38
39#define MAX_SLOTS 3
40struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
41
42int gpio_eth_irq; 39int gpio_eth_irq;
43int gpio_debug_led1; 40int gpio_debug_led1;
44int gpio_debug_led2; 41int gpio_debug_led2;
@@ -220,84 +217,28 @@ static inline void zylonite_init_lcd(void) {}
220#endif 217#endif
221 218
222#if defined(CONFIG_MMC) 219#if defined(CONFIG_MMC)
223static int zylonite_mci_ro(struct device *dev)
224{
225 struct platform_device *pdev = to_platform_device(dev);
226
227 return gpio_get_value(zylonite_mmc_slot[pdev->id].gpio_wp);
228}
229
230static int zylonite_mci_init(struct device *dev,
231 irq_handler_t zylonite_detect_int,
232 void *data)
233{
234 struct platform_device *pdev = to_platform_device(dev);
235 int err, cd_irq, gpio_cd, gpio_wp;
236
237 cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd);
238 gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd;
239 gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp;
240
241 /*
242 * setup GPIO for Zylonite MMC controller
243 */
244 err = gpio_request(gpio_cd, "mmc card detect");
245 if (err)
246 goto err_request_cd;
247 gpio_direction_input(gpio_cd);
248
249 err = gpio_request(gpio_wp, "mmc write protect");
250 if (err)
251 goto err_request_wp;
252 gpio_direction_input(gpio_wp);
253
254 err = request_irq(cd_irq, zylonite_detect_int,
255 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
256 "MMC card detect", data);
257 if (err) {
258 printk(KERN_ERR "%s: MMC/SD/SDIO: "
259 "can't request card detect IRQ\n", __func__);
260 goto err_request_irq;
261 }
262
263 return 0;
264
265err_request_irq:
266 gpio_free(gpio_wp);
267err_request_wp:
268 gpio_free(gpio_cd);
269err_request_cd:
270 return err;
271}
272
273static void zylonite_mci_exit(struct device *dev, void *data)
274{
275 struct platform_device *pdev = to_platform_device(dev);
276 int cd_irq, gpio_cd, gpio_wp;
277
278 cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd);
279 gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd;
280 gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp;
281
282 free_irq(cd_irq, data);
283 gpio_free(gpio_cd);
284 gpio_free(gpio_wp);
285}
286
287static struct pxamci_platform_data zylonite_mci_platform_data = { 220static struct pxamci_platform_data zylonite_mci_platform_data = {
288 .detect_delay = 20, 221 .detect_delay = 20,
289 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 222 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
290 .init = zylonite_mci_init, 223 .gpio_card_detect = EXT_GPIO(0),
291 .exit = zylonite_mci_exit, 224 .gpio_card_ro = EXT_GPIO(2),
292 .get_ro = zylonite_mci_ro,
293 .gpio_card_detect = -1,
294 .gpio_card_ro = -1,
295 .gpio_power = -1, 225 .gpio_power = -1,
296}; 226};
297 227
298static struct pxamci_platform_data zylonite_mci2_platform_data = { 228static struct pxamci_platform_data zylonite_mci2_platform_data = {
299 .detect_delay = 20, 229 .detect_delay = 20,
300 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 230 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
231 .gpio_card_detect = EXT_GPIO(1),
232 .gpio_card_ro = EXT_GPIO(3),
233 .gpio_power = -1,
234};
235
236static struct pxamci_platform_data zylonite_mci3_platform_data = {
237 .detect_delay = 20,
238 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
239 .gpio_card_detect = EXT_GPIO(30),
240 .gpio_card_ro = EXT_GPIO(31),
241 .gpio_power = -1,
301}; 242};
302 243
303static void __init zylonite_init_mmc(void) 244static void __init zylonite_init_mmc(void)
@@ -305,7 +246,7 @@ static void __init zylonite_init_mmc(void)
305 pxa_set_mci_info(&zylonite_mci_platform_data); 246 pxa_set_mci_info(&zylonite_mci_platform_data);
306 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data); 247 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
307 if (cpu_is_pxa310()) 248 if (cpu_is_pxa310())
308 pxa3xx_set_mci3_info(&zylonite_mci_platform_data); 249 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
309} 250}
310#else 251#else
311static inline void zylonite_init_mmc(void) {} 252static inline void zylonite_init_mmc(void) {}
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 84095440a878..3aa73b3e33f2 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -129,8 +129,8 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
129 GPIO22_I2C_SDA, 129 GPIO22_I2C_SDA,
130 130
131 /* GPIO */ 131 /* GPIO */
132 GPIO18_GPIO, /* GPIO Expander #0 INT_N */ 132 GPIO18_GPIO | MFP_PULL_HIGH, /* GPIO Expander #0 INT_N */
133 GPIO19_GPIO, /* GPIO Expander #1 INT_N */ 133 GPIO19_GPIO | MFP_PULL_HIGH, /* GPIO Expander #1 INT_N */
134}; 134};
135 135
136static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { 136static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
@@ -258,10 +258,6 @@ void __init zylonite_pxa300_init(void)
258 /* detect LCD panel */ 258 /* detect LCD panel */
259 zylonite_detect_lcd_panel(); 259 zylonite_detect_lcd_panel();
260 260
261 /* MMC card detect & write protect for controller 0 */
262 zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
263 zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
264
265 /* WM9713 IRQ */ 261 /* WM9713 IRQ */
266 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); 262 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26);
267 263
@@ -276,10 +272,6 @@ void __init zylonite_pxa300_init(void)
276 if (cpu_is_pxa310()) { 272 if (cpu_is_pxa310()) {
277 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg)); 273 pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg));
278 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102); 274 gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102);
279
280 /* MMC card detect & write protect for controller 2 */
281 zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
282 zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
283 } 275 }
284 276
285 /* GPIOs for Debug LEDs */ 277 /* GPIOs for Debug LEDs */
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 60d08f23f5e4..9942bac4cf7d 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -209,10 +209,6 @@ void __init zylonite_pxa320_init(void)
209 gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2); 209 gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
210 gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2); 210 gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
211 211
212 /* MMC card detect & write protect for controller 0 */
213 zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1);
214 zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5);
215
216 /* WM9713 IRQ */ 212 /* WM9713 IRQ */
217 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15); 213 wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15);
218 } 214 }
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 34b80b7d40b8..2f5ccb298858 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -74,8 +74,8 @@
74#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */ 74#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */
75 75
76/* 76/*
77 * Control register SYS_RESETCTL is set to 1 to force a soft reset 77 * Control register SYS_RESETCTL Bit 8 is set to 1 to force a soft reset
78 */ 78 */
79#define REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL 0x0100 79#define REALVIEW_PB1176_SYS_SOFT_RESET 0x0100
80 80
81#endif /* __ASM_ARCH_BOARD_PB1176_H */ 81#endif /* __ASM_ARCH_BOARD_PB1176_H */
diff --git a/arch/arm/mach-realview/include/mach/platform.h b/arch/arm/mach-realview/include/mach/platform.h
index 4f46bf71e752..86c0c4435a46 100644
--- a/arch/arm/mach-realview/include/mach/platform.h
+++ b/arch/arm/mach-realview/include/mach/platform.h
@@ -140,7 +140,7 @@
140 * SYS_CLD, SYS_BOOTCS 140 * SYS_CLD, SYS_BOOTCS
141 */ 141 */
142#define REALVIEW_SYS_LOCK_LOCKED (1 << 16) 142#define REALVIEW_SYS_LOCK_LOCKED (1 << 16)
143#define REALVIEW_SYS_LOCKVAL_MASK 0xA05F /* Enable write access */ 143#define REALVIEW_SYS_LOCK_VAL 0xA05F /* Enable write access */
144 144
145/* 145/*
146 * REALVIEW_SYS_FLASH 146 * REALVIEW_SYS_FLASH
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 917f8ca3abff..7d857d300558 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -381,6 +381,20 @@ static struct sys_timer realview_eb_timer = {
381 .init = realview_eb_timer_init, 381 .init = realview_eb_timer_init,
382}; 382};
383 383
384static void realview_eb_reset(char mode)
385{
386 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
387 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
388
389 /*
390 * To reset, we hit the on-board reset register
391 * in the system FPGA
392 */
393 __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
394 if (core_tile_eb11mp())
395 __raw_writel(0x0008, reset_ctrl);
396}
397
384static void __init realview_eb_init(void) 398static void __init realview_eb_init(void)
385{ 399{
386 int i; 400 int i;
@@ -408,6 +422,7 @@ static void __init realview_eb_init(void)
408#ifdef CONFIG_LEDS 422#ifdef CONFIG_LEDS
409 leds_event = realview_leds_event; 423 leds_event = realview_leds_event;
410#endif 424#endif
425 realview_reset = realview_eb_reset;
411} 426}
412 427
413MACHINE_START(REALVIEW_EB, "ARM-RealView EB") 428MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 7fb726d5f8b9..44392e51dd50 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -292,12 +292,10 @@ static struct sys_timer realview_pb1176_timer = {
292 292
293static void realview_pb1176_reset(char mode) 293static void realview_pb1176_reset(char mode)
294{ 294{
295 void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) + 295 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
296 REALVIEW_SYS_RESETCTL_OFFSET; 296 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
297 void __iomem *rst_hdr_ctrl = __io_address(REALVIEW_SYS_BASE) + 297 __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
298 REALVIEW_SYS_LOCK_OFFSET; 298 __raw_writel(REALVIEW_PB1176_SYS_SOFT_RESET, reset_ctrl);
299 __raw_writel(REALVIEW_SYS_LOCKVAL_MASK, rst_hdr_ctrl);
300 __raw_writel(REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL, hdr_ctrl);
301} 299}
302 300
303static void realview_pb1176_fixup(struct machine_desc *mdesc, 301static void realview_pb1176_fixup(struct machine_desc *mdesc,
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 9bbbfc05f225..3e02731af959 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -301,17 +301,16 @@ static struct sys_timer realview_pb11mp_timer = {
301 301
302static void realview_pb11mp_reset(char mode) 302static void realview_pb11mp_reset(char mode)
303{ 303{
304 void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) + 304 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
305 REALVIEW_SYS_RESETCTL_OFFSET; 305 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
306 unsigned int val;
307 306
308 /* 307 /*
309 * To reset, we hit the on-board reset register 308 * To reset, we hit the on-board reset register
310 * in the system FPGA 309 * in the system FPGA
311 */ 310 */
312 val = __raw_readl(hdr_ctrl); 311 __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
313 val |= REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR; 312 __raw_writel(0x0000, reset_ctrl);
314 __raw_writel(val, hdr_ctrl); 313 __raw_writel(0x0004, reset_ctrl);
315} 314}
316 315
317static void __init realview_pb11mp_init(void) 316static void __init realview_pb11mp_init(void)
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index fe861e96c566..fe4e25c4201a 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -272,6 +272,20 @@ static struct sys_timer realview_pba8_timer = {
272 .init = realview_pba8_timer_init, 272 .init = realview_pba8_timer_init,
273}; 273};
274 274
275static void realview_pba8_reset(char mode)
276{
277 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
278 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
279
280 /*
281 * To reset, we hit the on-board reset register
282 * in the system FPGA
283 */
284 __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
285 __raw_writel(0x0000, reset_ctrl);
286 __raw_writel(0x0004, reset_ctrl);
287}
288
275static void __init realview_pba8_init(void) 289static void __init realview_pba8_init(void)
276{ 290{
277 int i; 291 int i;
@@ -291,6 +305,7 @@ static void __init realview_pba8_init(void)
291#ifdef CONFIG_LEDS 305#ifdef CONFIG_LEDS
292 leds_event = realview_leds_event; 306 leds_event = realview_leds_event;
293#endif 307#endif
308 realview_reset = realview_pba8_reset;
294} 309}
295 310
296MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") 311MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index ec39488e2b42..a21a4b395f73 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -324,6 +324,20 @@ static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags,
324#endif 324#endif
325} 325}
326 326
327static void realview_pbx_reset(char mode)
328{
329 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
330 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
331
332 /*
333 * To reset, we hit the on-board reset register
334 * in the system FPGA
335 */
336 __raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
337 __raw_writel(0x0000, reset_ctrl);
338 __raw_writel(0x0004, reset_ctrl);
339}
340
327static void __init realview_pbx_init(void) 341static void __init realview_pbx_init(void)
328{ 342{
329 int i; 343 int i;
@@ -358,6 +372,7 @@ static void __init realview_pbx_init(void)
358#ifdef CONFIG_LEDS 372#ifdef CONFIG_LEDS
359 leds_event = realview_leds_event; 373 leds_event = realview_leds_event;
360#endif 374#endif
375 realview_reset = realview_pbx_reset;
361} 376}
362 377
363MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") 378MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
diff --git a/arch/arm/mach-s3c2410/include/mach/spi.h b/arch/arm/mach-s3c2410/include/mach/spi.h
index 193b39d654ed..4d9588373aa5 100644
--- a/arch/arm/mach-s3c2410/include/mach/spi.h
+++ b/arch/arm/mach-s3c2410/include/mach/spi.h
@@ -18,6 +18,8 @@ struct s3c2410_spi_info {
18 unsigned int num_cs; /* total chipselects */ 18 unsigned int num_cs; /* total chipselects */
19 int bus_num; /* bus number to use. */ 19 int bus_num; /* bus number to use. */
20 20
21 unsigned int use_fiq:1; /* use fiq */
22
21 void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable); 23 void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable);
22 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); 24 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
23}; 25};
diff --git a/arch/arm/mach-s3c2410/include/mach/ts.h b/arch/arm/mach-s3c2410/include/mach/ts.h
new file mode 100644
index 000000000000..dc361700d695
--- /dev/null
+++ b/arch/arm/mach-s3c2410/include/mach/ts.h
@@ -0,0 +1,21 @@
1/* linux/include/asm/arch-s3c2410/ts.h
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8*/
9
10#ifndef __ASM_ARM_TS_H
11#define __ASM_ARM_TS_H
12
13struct s3c2410_ts_mach_info {
14 int delay;
15 int presc;
16 int oversampling_shift;
17};
18
19extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
20
21#endif /* __ASM_ARM_TS_H */
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 4c79ac8a6c33..97162fdd0590 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -279,6 +279,7 @@ static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
279 .name = "SmartMedia", 279 .name = "SmartMedia",
280 .nr_chips = 1, 280 .nr_chips = 1,
281 .nr_map = smartmedia_map, 281 .nr_map = smartmedia_map,
282 .options = NAND_SCAN_SILENT_NODEV,
282 .nr_partitions = ARRAY_SIZE(bast_default_nand_part), 283 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
283 .partitions = bast_default_nand_part, 284 .partitions = bast_default_nand_part,
284 }, 285 },
@@ -293,6 +294,7 @@ static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
293 .name = "chip1", 294 .name = "chip1",
294 .nr_chips = 1, 295 .nr_chips = 1,
295 .nr_map = chip1_map, 296 .nr_map = chip1_map,
297 .options = NAND_SCAN_SILENT_NODEV,
296 .nr_partitions = ARRAY_SIZE(bast_default_nand_part), 298 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
297 .partitions = bast_default_nand_part, 299 .partitions = bast_default_nand_part,
298 }, 300 },
@@ -300,6 +302,7 @@ static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
300 .name = "chip2", 302 .name = "chip2",
301 .nr_chips = 1, 303 .nr_chips = 1,
302 .nr_map = chip2_map, 304 .nr_map = chip2_map,
305 .options = NAND_SCAN_SILENT_NODEV,
303 .nr_partitions = ARRAY_SIZE(bast_default_nand_part), 306 .nr_partitions = ARRAY_SIZE(bast_default_nand_part),
304 .partitions = bast_default_nand_part, 307 .partitions = bast_default_nand_part,
305 } 308 }
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 49053254c98d..1e34abe1a19e 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -46,6 +46,7 @@
46#include <mach/h1940.h> 46#include <mach/h1940.h>
47#include <mach/h1940-latch.h> 47#include <mach/h1940-latch.h>
48#include <mach/fb.h> 48#include <mach/fb.h>
49#include <mach/ts.h>
49#include <plat/udc.h> 50#include <plat/udc.h>
50#include <plat/iic.h> 51#include <plat/iic.h>
51 52
@@ -140,6 +141,11 @@ static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
140 .vbus_pin_inverted = 1, 141 .vbus_pin_inverted = 1,
141}; 142};
142 143
144static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
145 .delay = 10000,
146 .presc = 49,
147 .oversampling_shift = 2,
148};
143 149
144/** 150/**
145 * Set lcd on or off 151 * Set lcd on or off
@@ -265,6 +271,7 @@ static struct platform_device h1940_lcd_powerdev = {
265}; 271};
266 272
267static struct platform_device *h1940_devices[] __initdata = { 273static struct platform_device *h1940_devices[] __initdata = {
274 &s3c_device_ts,
268 &s3c_device_usb, 275 &s3c_device_usb,
269 &s3c_device_lcd, 276 &s3c_device_lcd,
270 &s3c_device_wdt, 277 &s3c_device_wdt,
@@ -305,6 +312,7 @@ static void __init h1940_init(void)
305 312
306 s3c24xx_fb_set_platdata(&h1940_fb_info); 313 s3c24xx_fb_set_platdata(&h1940_fb_info);
307 s3c24xx_udc_set_platdata(&h1940_udc_cfg); 314 s3c24xx_udc_set_platdata(&h1940_udc_cfg);
315 s3c24xx_ts_set_platdata(&h1940_ts_cfg);
308 s3c_i2c0_set_platdata(NULL); 316 s3c_i2c0_set_platdata(NULL);
309 317
310 s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg; 318 s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg;
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 015dfb2a80da..f35371db33f5 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -208,6 +208,7 @@ static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
208 .name = "External", 208 .name = "External",
209 .nr_chips = 1, 209 .nr_chips = 1,
210 .nr_map = external_map, 210 .nr_map = external_map,
211 .options = NAND_SCAN_SILENT_NODEV,
211 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), 212 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
212 .partitions = osiris_default_nand_part, 213 .partitions = osiris_default_nand_part,
213 }, 214 },
@@ -222,6 +223,7 @@ static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
222 .name = "chip1", 223 .name = "chip1",
223 .nr_chips = 1, 224 .nr_chips = 1,
224 .nr_map = chip1_map, 225 .nr_map = chip1_map,
226 .options = NAND_SCAN_SILENT_NODEV,
225 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), 227 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
226 .partitions = osiris_default_nand_part, 228 .partitions = osiris_default_nand_part,
227 }, 229 },
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 921cef991bf0..20dc0c96214d 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -96,6 +96,7 @@ static struct clk_lookup nuc900_clkregs[] = {
96 96
97struct plat_serial8250_port nuc900_uart_data[] = { 97struct plat_serial8250_port nuc900_uart_data[] = {
98 NUC900_8250PORT(UART0), 98 NUC900_8250PORT(UART0),
99 {},
99}; 100};
100 101
101struct platform_device nuc900_serial_device = { 102struct platform_device nuc900_serial_device = {
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index 51f17b753348..ec711f4b4019 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -197,7 +197,7 @@ static struct platform_device nuc900_device_emc = {
197 197
198/* SPI device */ 198/* SPI device */
199 199
200static struct w90p910_spi_info nuc900_spiflash_data = { 200static struct nuc900_spi_info nuc900_spiflash_data = {
201 .num_cs = 1, 201 .num_cs = 1,
202 .lsb = 0, 202 .lsb = 0,
203 .txneg = 1, 203 .txneg = 1,
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h
index 940640066857..ce228bdc66dd 100644
--- a/arch/arm/mach-w90x900/include/mach/system.h
+++ b/arch/arm/mach-w90x900/include/mach/system.h
@@ -15,7 +15,15 @@
15 * 15 *
16 */ 16 */
17 17
18#include <linux/io.h>
18#include <asm/proc-fns.h> 19#include <asm/proc-fns.h>
20#include <mach/map.h>
21#include <mach/regs-timer.h>
22
23#define WTCR (TMR_BA + 0x1C)
24#define WTCLK (1 << 10)
25#define WTE (1 << 7)
26#define WTRE (1 << 1)
19 27
20static void arch_idle(void) 28static void arch_idle(void)
21{ 29{
@@ -23,6 +31,11 @@ static void arch_idle(void)
23 31
24static void arch_reset(char mode, const char *cmd) 32static void arch_reset(char mode, const char *cmd)
25{ 33{
26 cpu_reset(0); 34 if (mode == 's') {
35 /* Jump into ROM at address 0 */
36 cpu_reset(0);
37 } else {
38 __raw_writel(WTE | WTRE | WTCLK, WTCR);
39 }
27} 40}
28 41
diff --git a/arch/arm/mach-w90x900/include/mach/uncompress.h b/arch/arm/mach-w90x900/include/mach/uncompress.h
index 050d9fe5ae1b..56f1a74d7016 100644
--- a/arch/arm/mach-w90x900/include/mach/uncompress.h
+++ b/arch/arm/mach-w90x900/include/mach/uncompress.h
@@ -22,11 +22,21 @@
22 22
23#include <mach/regs-serial.h> 23#include <mach/regs-serial.h>
24#include <mach/map.h> 24#include <mach/map.h>
25#include <linux/serial_reg.h>
25 26
26#define arch_decomp_wdog() 27#define arch_decomp_wdog()
27 28
29#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
30static volatile u32 * uart_base = (u32 *)UART0_PA;
31
28static void putc(int ch) 32static void putc(int ch)
29{ 33{
34 /* Check THRE and TEMT bits before we transmit the character.
35 */
36 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
37 barrier();
38
39 *uart_base = ch;
30} 40}
31 41
32static inline void flush(void) 42static inline void flush(void)
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index 4128af870b41..b80f769bc135 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -42,7 +42,10 @@
42#define TICKS_PER_SEC 100 42#define TICKS_PER_SEC 100
43#define PRESCALE 0x63 /* Divider = prescale + 1 */ 43#define PRESCALE 0x63 /* Divider = prescale + 1 */
44 44
45unsigned int timer0_load; 45#define TDR_SHIFT 24
46#define TDR_MASK ((1 << TDR_SHIFT) - 1)
47
48static unsigned int timer0_load;
46 49
47static void nuc900_clockevent_setmode(enum clock_event_mode mode, 50static void nuc900_clockevent_setmode(enum clock_event_mode mode,
48 struct clock_event_device *clk) 51 struct clock_event_device *clk)
@@ -88,7 +91,7 @@ static int nuc900_clockevent_setnextevent(unsigned long evt,
88static struct clock_event_device nuc900_clockevent_device = { 91static struct clock_event_device nuc900_clockevent_device = {
89 .name = "nuc900-timer0", 92 .name = "nuc900-timer0",
90 .shift = 32, 93 .shift = 32,
91 .features = CLOCK_EVT_MODE_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 94 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
92 .set_mode = nuc900_clockevent_setmode, 95 .set_mode = nuc900_clockevent_setmode,
93 .set_next_event = nuc900_clockevent_setnextevent, 96 .set_next_event = nuc900_clockevent_setnextevent,
94 .rating = 300, 97 .rating = 300,
@@ -112,8 +115,23 @@ static struct irqaction nuc900_timer0_irq = {
112 .handler = nuc900_timer0_interrupt, 115 .handler = nuc900_timer0_interrupt,
113}; 116};
114 117
115static void __init nuc900_clockevents_init(unsigned int rate) 118static void __init nuc900_clockevents_init(void)
116{ 119{
120 unsigned int rate;
121 struct clk *clk = clk_get(NULL, "timer0");
122
123 BUG_ON(IS_ERR(clk));
124
125 __raw_writel(0x00, REG_TCSR0);
126
127 clk_enable(clk);
128 rate = clk_get_rate(clk) / (PRESCALE + 1);
129
130 timer0_load = (rate / TICKS_PER_SEC);
131
132 __raw_writel(RESETINT, REG_TISR);
133 setup_irq(IRQ_TIMER0, &nuc900_timer0_irq);
134
117 nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC, 135 nuc900_clockevent_device.mult = div_sc(rate, NSEC_PER_SEC,
118 nuc900_clockevent_device.shift); 136 nuc900_clockevent_device.shift);
119 nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff, 137 nuc900_clockevent_device.max_delta_ns = clockevent_delta2ns(0xffffffff,
@@ -127,26 +145,35 @@ static void __init nuc900_clockevents_init(unsigned int rate)
127 145
128static cycle_t nuc900_get_cycles(struct clocksource *cs) 146static cycle_t nuc900_get_cycles(struct clocksource *cs)
129{ 147{
130 return ~__raw_readl(REG_TDR1); 148 return (~__raw_readl(REG_TDR1)) & TDR_MASK;
131} 149}
132 150
133static struct clocksource clocksource_nuc900 = { 151static struct clocksource clocksource_nuc900 = {
134 .name = "nuc900-timer1", 152 .name = "nuc900-timer1",
135 .rating = 200, 153 .rating = 200,
136 .read = nuc900_get_cycles, 154 .read = nuc900_get_cycles,
137 .mask = CLOCKSOURCE_MASK(32), 155 .mask = CLOCKSOURCE_MASK(TDR_SHIFT),
138 .shift = 20, 156 .shift = 10,
139 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 157 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
140}; 158};
141 159
142static void __init nuc900_clocksource_init(unsigned int rate) 160static void __init nuc900_clocksource_init(void)
143{ 161{
144 unsigned int val; 162 unsigned int val;
163 unsigned int rate;
164 struct clk *clk = clk_get(NULL, "timer1");
165
166 BUG_ON(IS_ERR(clk));
167
168 __raw_writel(0x00, REG_TCSR1);
169
170 clk_enable(clk);
171 rate = clk_get_rate(clk) / (PRESCALE + 1);
145 172
146 __raw_writel(0xffffffff, REG_TICR1); 173 __raw_writel(0xffffffff, REG_TICR1);
147 174
148 val = __raw_readl(REG_TCSR1); 175 val = __raw_readl(REG_TCSR1);
149 val |= (COUNTEN | PERIOD); 176 val |= (COUNTEN | PERIOD | PRESCALE);
150 __raw_writel(val, REG_TCSR1); 177 __raw_writel(val, REG_TCSR1);
151 178
152 clocksource_nuc900.mult = 179 clocksource_nuc900.mult =
@@ -156,25 +183,8 @@ static void __init nuc900_clocksource_init(unsigned int rate)
156 183
157static void __init nuc900_timer_init(void) 184static void __init nuc900_timer_init(void)
158{ 185{
159 struct clk *ck_ext = clk_get(NULL, "ext"); 186 nuc900_clocksource_init();
160 unsigned int rate; 187 nuc900_clockevents_init();
161
162 BUG_ON(IS_ERR(ck_ext));
163
164 rate = clk_get_rate(ck_ext);
165 clk_put(ck_ext);
166 rate = rate / (PRESCALE + 0x01);
167
168 /* set a known state */
169 __raw_writel(0x00, REG_TCSR0);
170 __raw_writel(0x00, REG_TCSR1);
171 __raw_writel(RESETINT, REG_TISR);
172 timer0_load = (rate / TICKS_PER_SEC);
173
174 setup_irq(IRQ_TIMER0, &nuc900_timer0_irq);
175
176 nuc900_clocksource_init(rate);
177 nuc900_clockevents_init(rate);
178} 188}
179 189
180struct sys_timer nuc900_timer = { 190struct sys_timer nuc900_timer = {
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index dd4698c67cc3..baf638487a2d 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -1,9 +1,5 @@
1comment "Processor Type" 1comment "Processor Type"
2 2
3config CPU_32
4 bool
5 default y
6
7# Select CPU types depending on the architecture selected. This selects 3# Select CPU types depending on the architecture selected. This selects
8# which CPUs we support in the kernel image, and the compiler instruction 4# which CPUs we support in the kernel image, and the compiler instruction
9# optimiser behaviour. 5# optimiser behaviour.
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 827e238e5d4a..e8d34a80851c 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -27,6 +27,9 @@ obj-$(CONFIG_CPU_ABRT_EV5TJ) += abort-ev5tj.o
27obj-$(CONFIG_CPU_ABRT_EV6) += abort-ev6.o 27obj-$(CONFIG_CPU_ABRT_EV6) += abort-ev6.o
28obj-$(CONFIG_CPU_ABRT_EV7) += abort-ev7.o 28obj-$(CONFIG_CPU_ABRT_EV7) += abort-ev7.o
29 29
30AFLAGS_abort-ev6.o :=-Wa,-march=armv6k
31AFLAGS_abort-ev7.o :=-Wa,-march=armv7-a
32
30obj-$(CONFIG_CPU_PABRT_LEGACY) += pabort-legacy.o 33obj-$(CONFIG_CPU_PABRT_LEGACY) += pabort-legacy.o
31obj-$(CONFIG_CPU_PABRT_V6) += pabort-v6.o 34obj-$(CONFIG_CPU_PABRT_V6) += pabort-v6.o
32obj-$(CONFIG_CPU_PABRT_V7) += pabort-v7.o 35obj-$(CONFIG_CPU_PABRT_V7) += pabort-v7.o
@@ -39,6 +42,9 @@ obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o
39obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o 42obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o
40obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o 43obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o
41 44
45AFLAGS_cache-v6.o :=-Wa,-march=armv6
46AFLAGS_cache-v7.o :=-Wa,-march=armv7-a
47
42obj-$(CONFIG_CPU_COPY_V3) += copypage-v3.o 48obj-$(CONFIG_CPU_COPY_V3) += copypage-v3.o
43obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o 49obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o
44obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o 50obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
@@ -58,6 +64,9 @@ obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o
58obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o 64obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o
59obj-$(CONFIG_CPU_TLB_FA) += tlb-fa.o 65obj-$(CONFIG_CPU_TLB_FA) += tlb-fa.o
60 66
67AFLAGS_tlb-v6.o :=-Wa,-march=armv6
68AFLAGS_tlb-v7.o :=-Wa,-march=armv7-a
69
61obj-$(CONFIG_CPU_ARM610) += proc-arm6_7.o 70obj-$(CONFIG_CPU_ARM610) += proc-arm6_7.o
62obj-$(CONFIG_CPU_ARM710) += proc-arm6_7.o 71obj-$(CONFIG_CPU_ARM710) += proc-arm6_7.o
63obj-$(CONFIG_CPU_ARM7TDMI) += proc-arm7tdmi.o 72obj-$(CONFIG_CPU_ARM7TDMI) += proc-arm7tdmi.o
@@ -84,6 +93,9 @@ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o
84obj-$(CONFIG_CPU_V6) += proc-v6.o 93obj-$(CONFIG_CPU_V6) += proc-v6.o
85obj-$(CONFIG_CPU_V7) += proc-v7.o 94obj-$(CONFIG_CPU_V7) += proc-v7.o
86 95
96AFLAGS_proc-v6.o :=-Wa,-march=armv6
97AFLAGS_proc-v7.o :=-Wa,-march=armv7-a
98
87obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o 99obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o
88obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 100obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
89obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o 101obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o
diff --git a/arch/arm/mm/cache-fa.S b/arch/arm/mm/cache-fa.S
index b63a8f7b95cf..a89444a3c016 100644
--- a/arch/arm/mm/cache-fa.S
+++ b/arch/arm/mm/cache-fa.S
@@ -127,15 +127,16 @@ ENTRY(fa_coherent_user_range)
127 mov pc, lr 127 mov pc, lr
128 128
129/* 129/*
130 * flush_kern_dcache_page(kaddr) 130 * flush_kern_dcache_area(void *addr, size_t size)
131 * 131 *
132 * Ensure that the data held in the page kaddr is written back 132 * Ensure that the data held in the page kaddr is written back
133 * to the page in question. 133 * to the page in question.
134 * 134 *
135 * - kaddr - kernel address (guaranteed to be page aligned) 135 * - addr - kernel address
136 * - size - size of region
136 */ 137 */
137ENTRY(fa_flush_kern_dcache_page) 138ENTRY(fa_flush_kern_dcache_area)
138 add r1, r0, #PAGE_SZ 139 add r1, r0, r1
1391: mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line 1401: mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
140 add r0, r0, #CACHE_DLINESIZE 141 add r0, r0, #CACHE_DLINESIZE
141 cmp r0, r1 142 cmp r0, r1
@@ -213,7 +214,7 @@ ENTRY(fa_cache_fns)
213 .long fa_flush_user_cache_range 214 .long fa_flush_user_cache_range
214 .long fa_coherent_kern_range 215 .long fa_coherent_kern_range
215 .long fa_coherent_user_range 216 .long fa_coherent_user_range
216 .long fa_flush_kern_dcache_page 217 .long fa_flush_kern_dcache_area
217 .long fa_dma_inv_range 218 .long fa_dma_inv_range
218 .long fa_dma_clean_range 219 .long fa_dma_clean_range
219 .long fa_dma_flush_range 220 .long fa_dma_flush_range
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 747f9a9021bb..cb8fc6573b1b 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -28,69 +28,120 @@
28static void __iomem *l2x0_base; 28static void __iomem *l2x0_base;
29static DEFINE_SPINLOCK(l2x0_lock); 29static DEFINE_SPINLOCK(l2x0_lock);
30 30
31static inline void sync_writel(unsigned long val, unsigned long reg, 31static inline void cache_wait(void __iomem *reg, unsigned long mask)
32 unsigned long complete_mask)
33{ 32{
34 unsigned long flags;
35
36 spin_lock_irqsave(&l2x0_lock, flags);
37 writel(val, l2x0_base + reg);
38 /* wait for the operation to complete */ 33 /* wait for the operation to complete */
39 while (readl(l2x0_base + reg) & complete_mask) 34 while (readl(reg) & mask)
40 ; 35 ;
41 spin_unlock_irqrestore(&l2x0_lock, flags);
42} 36}
43 37
44static inline void cache_sync(void) 38static inline void cache_sync(void)
45{ 39{
46 sync_writel(0, L2X0_CACHE_SYNC, 1); 40 void __iomem *base = l2x0_base;
41 writel(0, base + L2X0_CACHE_SYNC);
42 cache_wait(base + L2X0_CACHE_SYNC, 1);
47} 43}
48 44
49static inline void l2x0_inv_all(void) 45static inline void l2x0_inv_all(void)
50{ 46{
47 unsigned long flags;
48
51 /* invalidate all ways */ 49 /* invalidate all ways */
52 sync_writel(0xff, L2X0_INV_WAY, 0xff); 50 spin_lock_irqsave(&l2x0_lock, flags);
51 writel(0xff, l2x0_base + L2X0_INV_WAY);
52 cache_wait(l2x0_base + L2X0_INV_WAY, 0xff);
53 cache_sync(); 53 cache_sync();
54 spin_unlock_irqrestore(&l2x0_lock, flags);
54} 55}
55 56
56static void l2x0_inv_range(unsigned long start, unsigned long end) 57static void l2x0_inv_range(unsigned long start, unsigned long end)
57{ 58{
58 unsigned long addr; 59 void __iomem *base = l2x0_base;
60 unsigned long flags;
59 61
62 spin_lock_irqsave(&l2x0_lock, flags);
60 if (start & (CACHE_LINE_SIZE - 1)) { 63 if (start & (CACHE_LINE_SIZE - 1)) {
61 start &= ~(CACHE_LINE_SIZE - 1); 64 start &= ~(CACHE_LINE_SIZE - 1);
62 sync_writel(start, L2X0_CLEAN_INV_LINE_PA, 1); 65 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
66 writel(start, base + L2X0_CLEAN_INV_LINE_PA);
63 start += CACHE_LINE_SIZE; 67 start += CACHE_LINE_SIZE;
64 } 68 }
65 69
66 if (end & (CACHE_LINE_SIZE - 1)) { 70 if (end & (CACHE_LINE_SIZE - 1)) {
67 end &= ~(CACHE_LINE_SIZE - 1); 71 end &= ~(CACHE_LINE_SIZE - 1);
68 sync_writel(end, L2X0_CLEAN_INV_LINE_PA, 1); 72 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
73 writel(end, base + L2X0_CLEAN_INV_LINE_PA);
69 } 74 }
70 75
71 for (addr = start; addr < end; addr += CACHE_LINE_SIZE) 76 while (start < end) {
72 sync_writel(addr, L2X0_INV_LINE_PA, 1); 77 unsigned long blk_end = start + min(end - start, 4096UL);
78
79 while (start < blk_end) {
80 cache_wait(base + L2X0_INV_LINE_PA, 1);
81 writel(start, base + L2X0_INV_LINE_PA);
82 start += CACHE_LINE_SIZE;
83 }
84
85 if (blk_end < end) {
86 spin_unlock_irqrestore(&l2x0_lock, flags);
87 spin_lock_irqsave(&l2x0_lock, flags);
88 }
89 }
90 cache_wait(base + L2X0_INV_LINE_PA, 1);
73 cache_sync(); 91 cache_sync();
92 spin_unlock_irqrestore(&l2x0_lock, flags);
74} 93}
75 94
76static void l2x0_clean_range(unsigned long start, unsigned long end) 95static void l2x0_clean_range(unsigned long start, unsigned long end)
77{ 96{
78 unsigned long addr; 97 void __iomem *base = l2x0_base;
98 unsigned long flags;
79 99
100 spin_lock_irqsave(&l2x0_lock, flags);
80 start &= ~(CACHE_LINE_SIZE - 1); 101 start &= ~(CACHE_LINE_SIZE - 1);
81 for (addr = start; addr < end; addr += CACHE_LINE_SIZE) 102 while (start < end) {
82 sync_writel(addr, L2X0_CLEAN_LINE_PA, 1); 103 unsigned long blk_end = start + min(end - start, 4096UL);
104
105 while (start < blk_end) {
106 cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
107 writel(start, base + L2X0_CLEAN_LINE_PA);
108 start += CACHE_LINE_SIZE;
109 }
110
111 if (blk_end < end) {
112 spin_unlock_irqrestore(&l2x0_lock, flags);
113 spin_lock_irqsave(&l2x0_lock, flags);
114 }
115 }
116 cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
83 cache_sync(); 117 cache_sync();
118 spin_unlock_irqrestore(&l2x0_lock, flags);
84} 119}
85 120
86static void l2x0_flush_range(unsigned long start, unsigned long end) 121static void l2x0_flush_range(unsigned long start, unsigned long end)
87{ 122{
88 unsigned long addr; 123 void __iomem *base = l2x0_base;
124 unsigned long flags;
89 125
126 spin_lock_irqsave(&l2x0_lock, flags);
90 start &= ~(CACHE_LINE_SIZE - 1); 127 start &= ~(CACHE_LINE_SIZE - 1);
91 for (addr = start; addr < end; addr += CACHE_LINE_SIZE) 128 while (start < end) {
92 sync_writel(addr, L2X0_CLEAN_INV_LINE_PA, 1); 129 unsigned long blk_end = start + min(end - start, 4096UL);
130
131 while (start < blk_end) {
132 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
133 writel(start, base + L2X0_CLEAN_INV_LINE_PA);
134 start += CACHE_LINE_SIZE;
135 }
136
137 if (blk_end < end) {
138 spin_unlock_irqrestore(&l2x0_lock, flags);
139 spin_lock_irqsave(&l2x0_lock, flags);
140 }
141 }
142 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
93 cache_sync(); 143 cache_sync();
144 spin_unlock_irqrestore(&l2x0_lock, flags);
94} 145}
95 146
96void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) 147void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
diff --git a/arch/arm/mm/cache-v3.S b/arch/arm/mm/cache-v3.S
index 8a4abebc478a..2a482731ea36 100644
--- a/arch/arm/mm/cache-v3.S
+++ b/arch/arm/mm/cache-v3.S
@@ -72,14 +72,15 @@ ENTRY(v3_coherent_user_range)
72 mov pc, lr 72 mov pc, lr
73 73
74/* 74/*
75 * flush_kern_dcache_page(void *page) 75 * flush_kern_dcache_area(void *page, size_t size)
76 * 76 *
77 * Ensure no D cache aliasing occurs, either with itself or 77 * Ensure no D cache aliasing occurs, either with itself or
78 * the I cache 78 * the I cache
79 * 79 *
80 * - addr - page aligned address 80 * - addr - kernel address
81 * - size - region size
81 */ 82 */
82ENTRY(v3_flush_kern_dcache_page) 83ENTRY(v3_flush_kern_dcache_area)
83 /* FALLTHROUGH */ 84 /* FALLTHROUGH */
84 85
85/* 86/*
@@ -129,7 +130,7 @@ ENTRY(v3_cache_fns)
129 .long v3_flush_user_cache_range 130 .long v3_flush_user_cache_range
130 .long v3_coherent_kern_range 131 .long v3_coherent_kern_range
131 .long v3_coherent_user_range 132 .long v3_coherent_user_range
132 .long v3_flush_kern_dcache_page 133 .long v3_flush_kern_dcache_area
133 .long v3_dma_inv_range 134 .long v3_dma_inv_range
134 .long v3_dma_clean_range 135 .long v3_dma_clean_range
135 .long v3_dma_flush_range 136 .long v3_dma_flush_range
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index 3668611cb400..5c7da3e372e9 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -82,14 +82,15 @@ ENTRY(v4_coherent_user_range)
82 mov pc, lr 82 mov pc, lr
83 83
84/* 84/*
85 * flush_kern_dcache_page(void *page) 85 * flush_kern_dcache_area(void *addr, size_t size)
86 * 86 *
87 * Ensure no D cache aliasing occurs, either with itself or 87 * Ensure no D cache aliasing occurs, either with itself or
88 * the I cache 88 * the I cache
89 * 89 *
90 * - addr - page aligned address 90 * - addr - kernel address
91 * - size - region size
91 */ 92 */
92ENTRY(v4_flush_kern_dcache_page) 93ENTRY(v4_flush_kern_dcache_area)
93 /* FALLTHROUGH */ 94 /* FALLTHROUGH */
94 95
95/* 96/*
@@ -141,7 +142,7 @@ ENTRY(v4_cache_fns)
141 .long v4_flush_user_cache_range 142 .long v4_flush_user_cache_range
142 .long v4_coherent_kern_range 143 .long v4_coherent_kern_range
143 .long v4_coherent_user_range 144 .long v4_coherent_user_range
144 .long v4_flush_kern_dcache_page 145 .long v4_flush_kern_dcache_area
145 .long v4_dma_inv_range 146 .long v4_dma_inv_range
146 .long v4_dma_clean_range 147 .long v4_dma_clean_range
147 .long v4_dma_flush_range 148 .long v4_dma_flush_range
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S
index 2ebc1b3bf856..3dbedf1ec0e7 100644
--- a/arch/arm/mm/cache-v4wb.S
+++ b/arch/arm/mm/cache-v4wb.S
@@ -114,15 +114,16 @@ ENTRY(v4wb_flush_user_cache_range)
114 mov pc, lr 114 mov pc, lr
115 115
116/* 116/*
117 * flush_kern_dcache_page(void *page) 117 * flush_kern_dcache_area(void *addr, size_t size)
118 * 118 *
119 * Ensure no D cache aliasing occurs, either with itself or 119 * Ensure no D cache aliasing occurs, either with itself or
120 * the I cache 120 * the I cache
121 * 121 *
122 * - addr - page aligned address 122 * - addr - kernel address
123 * - size - region size
123 */ 124 */
124ENTRY(v4wb_flush_kern_dcache_page) 125ENTRY(v4wb_flush_kern_dcache_area)
125 add r1, r0, #PAGE_SZ 126 add r1, r0, r1
126 /* fall through */ 127 /* fall through */
127 128
128/* 129/*
@@ -224,7 +225,7 @@ ENTRY(v4wb_cache_fns)
224 .long v4wb_flush_user_cache_range 225 .long v4wb_flush_user_cache_range
225 .long v4wb_coherent_kern_range 226 .long v4wb_coherent_kern_range
226 .long v4wb_coherent_user_range 227 .long v4wb_coherent_user_range
227 .long v4wb_flush_kern_dcache_page 228 .long v4wb_flush_kern_dcache_area
228 .long v4wb_dma_inv_range 229 .long v4wb_dma_inv_range
229 .long v4wb_dma_clean_range 230 .long v4wb_dma_clean_range
230 .long v4wb_dma_flush_range 231 .long v4wb_dma_flush_range
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index c54fa2cc40e6..b3b7410270b4 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -117,17 +117,18 @@ ENTRY(v4wt_coherent_user_range)
117 mov pc, lr 117 mov pc, lr
118 118
119/* 119/*
120 * flush_kern_dcache_page(void *page) 120 * flush_kern_dcache_area(void *addr, size_t size)
121 * 121 *
122 * Ensure no D cache aliasing occurs, either with itself or 122 * Ensure no D cache aliasing occurs, either with itself or
123 * the I cache 123 * the I cache
124 * 124 *
125 * - addr - page aligned address 125 * - addr - kernel address
126 * - size - region size
126 */ 127 */
127ENTRY(v4wt_flush_kern_dcache_page) 128ENTRY(v4wt_flush_kern_dcache_area)
128 mov r2, #0 129 mov r2, #0
129 mcr p15, 0, r2, c7, c5, 0 @ invalidate I cache 130 mcr p15, 0, r2, c7, c5, 0 @ invalidate I cache
130 add r1, r0, #PAGE_SZ 131 add r1, r0, r1
131 /* fallthrough */ 132 /* fallthrough */
132 133
133/* 134/*
@@ -180,7 +181,7 @@ ENTRY(v4wt_cache_fns)
180 .long v4wt_flush_user_cache_range 181 .long v4wt_flush_user_cache_range
181 .long v4wt_coherent_kern_range 182 .long v4wt_coherent_kern_range
182 .long v4wt_coherent_user_range 183 .long v4wt_coherent_user_range
183 .long v4wt_flush_kern_dcache_page 184 .long v4wt_flush_kern_dcache_area
184 .long v4wt_dma_inv_range 185 .long v4wt_dma_inv_range
185 .long v4wt_dma_clean_range 186 .long v4wt_dma_clean_range
186 .long v4wt_dma_flush_range 187 .long v4wt_dma_flush_range
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 295e25dd6381..4ba0a24ce6f5 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -159,15 +159,16 @@ ENDPROC(v6_coherent_user_range)
159ENDPROC(v6_coherent_kern_range) 159ENDPROC(v6_coherent_kern_range)
160 160
161/* 161/*
162 * v6_flush_kern_dcache_page(kaddr) 162 * v6_flush_kern_dcache_area(void *addr, size_t size)
163 * 163 *
164 * Ensure that the data held in the page kaddr is written back 164 * Ensure that the data held in the page kaddr is written back
165 * to the page in question. 165 * to the page in question.
166 * 166 *
167 * - kaddr - kernel address (guaranteed to be page aligned) 167 * - addr - kernel address
168 * - size - region size
168 */ 169 */
169ENTRY(v6_flush_kern_dcache_page) 170ENTRY(v6_flush_kern_dcache_area)
170 add r1, r0, #PAGE_SZ 171 add r1, r0, r1
1711: 1721:
172#ifdef HARVARD_CACHE 173#ifdef HARVARD_CACHE
173 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line 174 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
@@ -271,7 +272,7 @@ ENTRY(v6_cache_fns)
271 .long v6_flush_user_cache_range 272 .long v6_flush_user_cache_range
272 .long v6_coherent_kern_range 273 .long v6_coherent_kern_range
273 .long v6_coherent_user_range 274 .long v6_coherent_user_range
274 .long v6_flush_kern_dcache_page 275 .long v6_flush_kern_dcache_area
275 .long v6_dma_inv_range 276 .long v6_dma_inv_range
276 .long v6_dma_clean_range 277 .long v6_dma_clean_range
277 .long v6_dma_flush_range 278 .long v6_dma_flush_range
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index e1bd9759617f..9073db849fb4 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -186,16 +186,17 @@ ENDPROC(v7_coherent_kern_range)
186ENDPROC(v7_coherent_user_range) 186ENDPROC(v7_coherent_user_range)
187 187
188/* 188/*
189 * v7_flush_kern_dcache_page(kaddr) 189 * v7_flush_kern_dcache_area(void *addr, size_t size)
190 * 190 *
191 * Ensure that the data held in the page kaddr is written back 191 * Ensure that the data held in the page kaddr is written back
192 * to the page in question. 192 * to the page in question.
193 * 193 *
194 * - kaddr - kernel address (guaranteed to be page aligned) 194 * - addr - kernel address
195 * - size - region size
195 */ 196 */
196ENTRY(v7_flush_kern_dcache_page) 197ENTRY(v7_flush_kern_dcache_area)
197 dcache_line_size r2, r3 198 dcache_line_size r2, r3
198 add r1, r0, #PAGE_SZ 199 add r1, r0, r1
1991: 2001:
200 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line 201 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line
201 add r0, r0, r2 202 add r0, r0, r2
@@ -203,7 +204,7 @@ ENTRY(v7_flush_kern_dcache_page)
203 blo 1b 204 blo 1b
204 dsb 205 dsb
205 mov pc, lr 206 mov pc, lr
206ENDPROC(v7_flush_kern_dcache_page) 207ENDPROC(v7_flush_kern_dcache_area)
207 208
208/* 209/*
209 * v7_dma_inv_range(start,end) 210 * v7_dma_inv_range(start,end)
@@ -279,7 +280,7 @@ ENTRY(v7_cache_fns)
279 .long v7_flush_user_cache_range 280 .long v7_flush_user_cache_range
280 .long v7_coherent_kern_range 281 .long v7_coherent_kern_range
281 .long v7_coherent_user_range 282 .long v7_coherent_user_range
282 .long v7_flush_kern_dcache_page 283 .long v7_flush_kern_dcache_area
283 .long v7_dma_inv_range 284 .long v7_dma_inv_range
284 .long v7_dma_clean_range 285 .long v7_dma_clean_range
285 .long v7_dma_flush_range 286 .long v7_dma_flush_range
diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
index 5d180cb0bd94..c3154928bccd 100644
--- a/arch/arm/mm/cache-xsc3l2.c
+++ b/arch/arm/mm/cache-xsc3l2.c
@@ -221,15 +221,14 @@ static int __init xsc3_l2_init(void)
221 if (!cpu_is_xsc3() || !xsc3_l2_present()) 221 if (!cpu_is_xsc3() || !xsc3_l2_present())
222 return 0; 222 return 0;
223 223
224 if (!(get_cr() & CR_L2)) { 224 if (get_cr() & CR_L2) {
225 pr_info("XScale3 L2 cache enabled.\n"); 225 pr_info("XScale3 L2 cache enabled.\n");
226 adjust_cr(CR_L2, CR_L2);
227 xsc3_l2_inv_all(); 226 xsc3_l2_inv_all();
228 }
229 227
230 outer_cache.inv_range = xsc3_l2_inv_range; 228 outer_cache.inv_range = xsc3_l2_inv_range;
231 outer_cache.clean_range = xsc3_l2_clean_range; 229 outer_cache.clean_range = xsc3_l2_clean_range;
232 outer_cache.flush_range = xsc3_l2_flush_range; 230 outer_cache.flush_range = xsc3_l2_flush_range;
231 }
233 232
234 return 0; 233 return 0;
235} 234}
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c
index 841f355319bf..0fa1319273de 100644
--- a/arch/arm/mm/copypage-v6.c
+++ b/arch/arm/mm/copypage-v6.c
@@ -48,7 +48,7 @@ static void v6_copy_user_highpage_nonaliasing(struct page *to,
48 */ 48 */
49 if (page_address(to) != NULL) 49 if (page_address(to) != NULL)
50#endif 50#endif
51 __cpuc_flush_dcache_page(kto); 51 __cpuc_flush_dcache_area(kto, PAGE_SIZE);
52 kunmap_atomic(kto, KM_USER1); 52 kunmap_atomic(kto, KM_USER1);
53 kunmap_atomic(kfrom, KM_USER0); 53 kunmap_atomic(kfrom, KM_USER0);
54} 54}
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index 729602291958..56ee15321b00 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -207,9 +207,8 @@ void __init check_writebuffer_bugs(void)
207 page = alloc_page(GFP_KERNEL); 207 page = alloc_page(GFP_KERNEL);
208 if (page) { 208 if (page) {
209 unsigned long *p1, *p2; 209 unsigned long *p1, *p2;
210 pgprot_t prot = __pgprot(L_PTE_PRESENT|L_PTE_YOUNG| 210 pgprot_t prot = __pgprot_modify(PAGE_KERNEL,
211 L_PTE_DIRTY|L_PTE_WRITE| 211 L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE);
212 L_PTE_MT_BUFFERABLE);
213 212
214 p1 = vmap(&page, 1, VM_IOREMAP, prot); 213 p1 = vmap(&page, 1, VM_IOREMAP, prot);
215 p2 = vmap(&page, 1, VM_IOREMAP, prot); 214 p2 = vmap(&page, 1, VM_IOREMAP, prot);
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 329594e760cd..6f3a4b7a3b82 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -131,7 +131,7 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page)
131 */ 131 */
132 if (addr) 132 if (addr)
133#endif 133#endif
134 __cpuc_flush_dcache_page(addr); 134 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
135 135
136 /* 136 /*
137 * If this is a page cache page, and we have an aliasing VIPT cache, 137 * If this is a page cache page, and we have an aliasing VIPT cache,
@@ -258,5 +258,5 @@ void __flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned l
258 * in this mapping of the page. FIXME: this is overkill 258 * in this mapping of the page. FIXME: this is overkill
259 * since we actually ask for a write-back and invalidate. 259 * since we actually ask for a write-back and invalidate.
260 */ 260 */
261 __cpuc_flush_dcache_page(page_address(page)); 261 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
262} 262}
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index 30f82fb5918c..2be1ec7c1b41 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -79,7 +79,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
79 unsigned int idx = type + KM_TYPE_NR * smp_processor_id(); 79 unsigned int idx = type + KM_TYPE_NR * smp_processor_id();
80 80
81 if (kvaddr >= (void *)FIXADDR_START) { 81 if (kvaddr >= (void *)FIXADDR_START) {
82 __cpuc_flush_dcache_page((void *)vaddr); 82 __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE);
83#ifdef CONFIG_DEBUG_HIGHMEM 83#ifdef CONFIG_DEBUG_HIGHMEM
84 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); 84 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
85 set_pte_ext(TOP_PTE(vaddr), __pte(0), 0); 85 set_pte_ext(TOP_PTE(vaddr), __pte(0), 0);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 52c40d155672..a04ffbbbe253 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -616,7 +616,7 @@ void __init mem_init(void)
616 "%dK data, %dK init, %luK highmem)\n", 616 "%dK data, %dK init, %luK highmem)\n",
617 nr_free_pages() << (PAGE_SHIFT-10), codesize >> 10, 617 nr_free_pages() << (PAGE_SHIFT-10), codesize >> 10,
618 datasize >> 10, initsize >> 10, 618 datasize >> 10, initsize >> 10,
619 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 619 totalhigh_pages << (PAGE_SHIFT-10));
620 620
621 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 621 if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
622 extern int sysctl_overcommit_memory; 622 extern int sysctl_overcommit_memory;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 8c7fbd19a4b3..1708da82da96 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -453,8 +453,7 @@ static void __init build_mem_type_table(void)
453 453
454 pgprot_user = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | user_pgprot); 454 pgprot_user = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | user_pgprot);
455 pgprot_kernel = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | 455 pgprot_kernel = __pgprot(L_PTE_PRESENT | L_PTE_YOUNG |
456 L_PTE_DIRTY | L_PTE_WRITE | 456 L_PTE_DIRTY | L_PTE_WRITE | kern_pgprot);
457 L_PTE_EXEC | kern_pgprot);
458 457
459 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask; 458 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask;
460 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask; 459 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 900811cc9130..374a8311bc84 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -61,7 +61,7 @@ void setup_mm_for_reboot(char mode)
61 61
62void flush_dcache_page(struct page *page) 62void flush_dcache_page(struct page *page)
63{ 63{
64 __cpuc_flush_dcache_page(page_address(page)); 64 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
65} 65}
66EXPORT_SYMBOL(flush_dcache_page); 66EXPORT_SYMBOL(flush_dcache_page);
67 67
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index d9fb4b98c49f..8012e24282b2 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -231,17 +231,18 @@ ENTRY(arm1020_coherent_user_range)
231 mov pc, lr 231 mov pc, lr
232 232
233/* 233/*
234 * flush_kern_dcache_page(void *page) 234 * flush_kern_dcache_area(void *addr, size_t size)
235 * 235 *
236 * Ensure no D cache aliasing occurs, either with itself or 236 * Ensure no D cache aliasing occurs, either with itself or
237 * the I cache 237 * the I cache
238 * 238 *
239 * - page - page aligned address 239 * - addr - kernel address
240 * - size - region size
240 */ 241 */
241ENTRY(arm1020_flush_kern_dcache_page) 242ENTRY(arm1020_flush_kern_dcache_area)
242 mov ip, #0 243 mov ip, #0
243#ifndef CONFIG_CPU_DCACHE_DISABLE 244#ifndef CONFIG_CPU_DCACHE_DISABLE
244 add r1, r0, #PAGE_SZ 245 add r1, r0, r1
2451: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2461: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
246 mcr p15, 0, ip, c7, c10, 4 @ drain WB 247 mcr p15, 0, ip, c7, c10, 4 @ drain WB
247 add r0, r0, #CACHE_DLINESIZE 248 add r0, r0, #CACHE_DLINESIZE
@@ -335,7 +336,7 @@ ENTRY(arm1020_cache_fns)
335 .long arm1020_flush_user_cache_range 336 .long arm1020_flush_user_cache_range
336 .long arm1020_coherent_kern_range 337 .long arm1020_coherent_kern_range
337 .long arm1020_coherent_user_range 338 .long arm1020_coherent_user_range
338 .long arm1020_flush_kern_dcache_page 339 .long arm1020_flush_kern_dcache_area
339 .long arm1020_dma_inv_range 340 .long arm1020_dma_inv_range
340 .long arm1020_dma_clean_range 341 .long arm1020_dma_clean_range
341 .long arm1020_dma_flush_range 342 .long arm1020_dma_flush_range
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index 7453b75dcea5..41fe25d234f5 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -225,17 +225,18 @@ ENTRY(arm1020e_coherent_user_range)
225 mov pc, lr 225 mov pc, lr
226 226
227/* 227/*
228 * flush_kern_dcache_page(void *page) 228 * flush_kern_dcache_area(void *addr, size_t size)
229 * 229 *
230 * Ensure no D cache aliasing occurs, either with itself or 230 * Ensure no D cache aliasing occurs, either with itself or
231 * the I cache 231 * the I cache
232 * 232 *
233 * - page - page aligned address 233 * - addr - kernel address
234 * - size - region size
234 */ 235 */
235ENTRY(arm1020e_flush_kern_dcache_page) 236ENTRY(arm1020e_flush_kern_dcache_area)
236 mov ip, #0 237 mov ip, #0
237#ifndef CONFIG_CPU_DCACHE_DISABLE 238#ifndef CONFIG_CPU_DCACHE_DISABLE
238 add r1, r0, #PAGE_SZ 239 add r1, r0, r1
2391: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2401: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
240 add r0, r0, #CACHE_DLINESIZE 241 add r0, r0, #CACHE_DLINESIZE
241 cmp r0, r1 242 cmp r0, r1
@@ -321,7 +322,7 @@ ENTRY(arm1020e_cache_fns)
321 .long arm1020e_flush_user_cache_range 322 .long arm1020e_flush_user_cache_range
322 .long arm1020e_coherent_kern_range 323 .long arm1020e_coherent_kern_range
323 .long arm1020e_coherent_user_range 324 .long arm1020e_coherent_user_range
324 .long arm1020e_flush_kern_dcache_page 325 .long arm1020e_flush_kern_dcache_area
325 .long arm1020e_dma_inv_range 326 .long arm1020e_dma_inv_range
326 .long arm1020e_dma_clean_range 327 .long arm1020e_dma_clean_range
327 .long arm1020e_dma_flush_range 328 .long arm1020e_dma_flush_range
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 8eb72d75a8b6..20a5b1b31a70 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -214,17 +214,18 @@ ENTRY(arm1022_coherent_user_range)
214 mov pc, lr 214 mov pc, lr
215 215
216/* 216/*
217 * flush_kern_dcache_page(void *page) 217 * flush_kern_dcache_area(void *addr, size_t size)
218 * 218 *
219 * Ensure no D cache aliasing occurs, either with itself or 219 * Ensure no D cache aliasing occurs, either with itself or
220 * the I cache 220 * the I cache
221 * 221 *
222 * - page - page aligned address 222 * - addr - kernel address
223 * - size - region size
223 */ 224 */
224ENTRY(arm1022_flush_kern_dcache_page) 225ENTRY(arm1022_flush_kern_dcache_area)
225 mov ip, #0 226 mov ip, #0
226#ifndef CONFIG_CPU_DCACHE_DISABLE 227#ifndef CONFIG_CPU_DCACHE_DISABLE
227 add r1, r0, #PAGE_SZ 228 add r1, r0, r1
2281: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2291: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
229 add r0, r0, #CACHE_DLINESIZE 230 add r0, r0, #CACHE_DLINESIZE
230 cmp r0, r1 231 cmp r0, r1
@@ -310,7 +311,7 @@ ENTRY(arm1022_cache_fns)
310 .long arm1022_flush_user_cache_range 311 .long arm1022_flush_user_cache_range
311 .long arm1022_coherent_kern_range 312 .long arm1022_coherent_kern_range
312 .long arm1022_coherent_user_range 313 .long arm1022_coherent_user_range
313 .long arm1022_flush_kern_dcache_page 314 .long arm1022_flush_kern_dcache_area
314 .long arm1022_dma_inv_range 315 .long arm1022_dma_inv_range
315 .long arm1022_dma_clean_range 316 .long arm1022_dma_clean_range
316 .long arm1022_dma_flush_range 317 .long arm1022_dma_flush_range
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 3b59f0d67139..96aedb10fcc4 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -208,17 +208,18 @@ ENTRY(arm1026_coherent_user_range)
208 mov pc, lr 208 mov pc, lr
209 209
210/* 210/*
211 * flush_kern_dcache_page(void *page) 211 * flush_kern_dcache_area(void *addr, size_t size)
212 * 212 *
213 * Ensure no D cache aliasing occurs, either with itself or 213 * Ensure no D cache aliasing occurs, either with itself or
214 * the I cache 214 * the I cache
215 * 215 *
216 * - page - page aligned address 216 * - addr - kernel address
217 * - size - region size
217 */ 218 */
218ENTRY(arm1026_flush_kern_dcache_page) 219ENTRY(arm1026_flush_kern_dcache_area)
219 mov ip, #0 220 mov ip, #0
220#ifndef CONFIG_CPU_DCACHE_DISABLE 221#ifndef CONFIG_CPU_DCACHE_DISABLE
221 add r1, r0, #PAGE_SZ 222 add r1, r0, r1
2221: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2231: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
223 add r0, r0, #CACHE_DLINESIZE 224 add r0, r0, #CACHE_DLINESIZE
224 cmp r0, r1 225 cmp r0, r1
@@ -304,7 +305,7 @@ ENTRY(arm1026_cache_fns)
304 .long arm1026_flush_user_cache_range 305 .long arm1026_flush_user_cache_range
305 .long arm1026_coherent_kern_range 306 .long arm1026_coherent_kern_range
306 .long arm1026_coherent_user_range 307 .long arm1026_coherent_user_range
307 .long arm1026_flush_kern_dcache_page 308 .long arm1026_flush_kern_dcache_area
308 .long arm1026_dma_inv_range 309 .long arm1026_dma_inv_range
309 .long arm1026_dma_clean_range 310 .long arm1026_dma_clean_range
310 .long arm1026_dma_flush_range 311 .long arm1026_dma_flush_range
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 2b7c197cc58d..471669e2d7cb 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -207,15 +207,16 @@ ENTRY(arm920_coherent_user_range)
207 mov pc, lr 207 mov pc, lr
208 208
209/* 209/*
210 * flush_kern_dcache_page(void *page) 210 * flush_kern_dcache_area(void *addr, size_t size)
211 * 211 *
212 * Ensure no D cache aliasing occurs, either with itself or 212 * Ensure no D cache aliasing occurs, either with itself or
213 * the I cache 213 * the I cache
214 * 214 *
215 * - addr - page aligned address 215 * - addr - kernel address
216 * - size - region size
216 */ 217 */
217ENTRY(arm920_flush_kern_dcache_page) 218ENTRY(arm920_flush_kern_dcache_area)
218 add r1, r0, #PAGE_SZ 219 add r1, r0, r1
2191: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2201: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
220 add r0, r0, #CACHE_DLINESIZE 221 add r0, r0, #CACHE_DLINESIZE
221 cmp r0, r1 222 cmp r0, r1
@@ -293,7 +294,7 @@ ENTRY(arm920_cache_fns)
293 .long arm920_flush_user_cache_range 294 .long arm920_flush_user_cache_range
294 .long arm920_coherent_kern_range 295 .long arm920_coherent_kern_range
295 .long arm920_coherent_user_range 296 .long arm920_coherent_user_range
296 .long arm920_flush_kern_dcache_page 297 .long arm920_flush_kern_dcache_area
297 .long arm920_dma_inv_range 298 .long arm920_dma_inv_range
298 .long arm920_dma_clean_range 299 .long arm920_dma_clean_range
299 .long arm920_dma_flush_range 300 .long arm920_dma_flush_range
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index 06a1aa4e3398..ee111b00fa41 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -209,15 +209,16 @@ ENTRY(arm922_coherent_user_range)
209 mov pc, lr 209 mov pc, lr
210 210
211/* 211/*
212 * flush_kern_dcache_page(void *page) 212 * flush_kern_dcache_area(void *addr, size_t size)
213 * 213 *
214 * Ensure no D cache aliasing occurs, either with itself or 214 * Ensure no D cache aliasing occurs, either with itself or
215 * the I cache 215 * the I cache
216 * 216 *
217 * - addr - page aligned address 217 * - addr - kernel address
218 * - size - region size
218 */ 219 */
219ENTRY(arm922_flush_kern_dcache_page) 220ENTRY(arm922_flush_kern_dcache_area)
220 add r1, r0, #PAGE_SZ 221 add r1, r0, r1
2211: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2221: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
222 add r0, r0, #CACHE_DLINESIZE 223 add r0, r0, #CACHE_DLINESIZE
223 cmp r0, r1 224 cmp r0, r1
@@ -295,7 +296,7 @@ ENTRY(arm922_cache_fns)
295 .long arm922_flush_user_cache_range 296 .long arm922_flush_user_cache_range
296 .long arm922_coherent_kern_range 297 .long arm922_coherent_kern_range
297 .long arm922_coherent_user_range 298 .long arm922_coherent_user_range
298 .long arm922_flush_kern_dcache_page 299 .long arm922_flush_kern_dcache_area
299 .long arm922_dma_inv_range 300 .long arm922_dma_inv_range
300 .long arm922_dma_clean_range 301 .long arm922_dma_clean_range
301 .long arm922_dma_flush_range 302 .long arm922_dma_flush_range
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index cb53435a85ae..8deb5bde58e4 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -251,15 +251,16 @@ ENTRY(arm925_coherent_user_range)
251 mov pc, lr 251 mov pc, lr
252 252
253/* 253/*
254 * flush_kern_dcache_page(void *page) 254 * flush_kern_dcache_area(void *addr, size_t size)
255 * 255 *
256 * Ensure no D cache aliasing occurs, either with itself or 256 * Ensure no D cache aliasing occurs, either with itself or
257 * the I cache 257 * the I cache
258 * 258 *
259 * - addr - page aligned address 259 * - addr - kernel address
260 * - size - region size
260 */ 261 */
261ENTRY(arm925_flush_kern_dcache_page) 262ENTRY(arm925_flush_kern_dcache_area)
262 add r1, r0, #PAGE_SZ 263 add r1, r0, r1
2631: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2641: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
264 add r0, r0, #CACHE_DLINESIZE 265 add r0, r0, #CACHE_DLINESIZE
265 cmp r0, r1 266 cmp r0, r1
@@ -346,7 +347,7 @@ ENTRY(arm925_cache_fns)
346 .long arm925_flush_user_cache_range 347 .long arm925_flush_user_cache_range
347 .long arm925_coherent_kern_range 348 .long arm925_coherent_kern_range
348 .long arm925_coherent_user_range 349 .long arm925_coherent_user_range
349 .long arm925_flush_kern_dcache_page 350 .long arm925_flush_kern_dcache_area
350 .long arm925_dma_inv_range 351 .long arm925_dma_inv_range
351 .long arm925_dma_clean_range 352 .long arm925_dma_clean_range
352 .long arm925_dma_flush_range 353 .long arm925_dma_flush_range
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 1c4848704bb3..64db6e275a44 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -214,15 +214,16 @@ ENTRY(arm926_coherent_user_range)
214 mov pc, lr 214 mov pc, lr
215 215
216/* 216/*
217 * flush_kern_dcache_page(void *page) 217 * flush_kern_dcache_area(void *addr, size_t size)
218 * 218 *
219 * Ensure no D cache aliasing occurs, either with itself or 219 * Ensure no D cache aliasing occurs, either with itself or
220 * the I cache 220 * the I cache
221 * 221 *
222 * - addr - page aligned address 222 * - addr - kernel address
223 * - size - region size
223 */ 224 */
224ENTRY(arm926_flush_kern_dcache_page) 225ENTRY(arm926_flush_kern_dcache_area)
225 add r1, r0, #PAGE_SZ 226 add r1, r0, r1
2261: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2271: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
227 add r0, r0, #CACHE_DLINESIZE 228 add r0, r0, #CACHE_DLINESIZE
228 cmp r0, r1 229 cmp r0, r1
@@ -309,7 +310,7 @@ ENTRY(arm926_cache_fns)
309 .long arm926_flush_user_cache_range 310 .long arm926_flush_user_cache_range
310 .long arm926_coherent_kern_range 311 .long arm926_coherent_kern_range
311 .long arm926_coherent_user_range 312 .long arm926_coherent_user_range
312 .long arm926_flush_kern_dcache_page 313 .long arm926_flush_kern_dcache_area
313 .long arm926_dma_inv_range 314 .long arm926_dma_inv_range
314 .long arm926_dma_clean_range 315 .long arm926_dma_clean_range
315 .long arm926_dma_flush_range 316 .long arm926_dma_flush_range
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 5b0f8464c8f2..8196b9f401fb 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -141,14 +141,15 @@ ENTRY(arm940_coherent_user_range)
141 /* FALLTHROUGH */ 141 /* FALLTHROUGH */
142 142
143/* 143/*
144 * flush_kern_dcache_page(void *page) 144 * flush_kern_dcache_area(void *addr, size_t size)
145 * 145 *
146 * Ensure no D cache aliasing occurs, either with itself or 146 * Ensure no D cache aliasing occurs, either with itself or
147 * the I cache 147 * the I cache
148 * 148 *
149 * - addr - page aligned address 149 * - addr - kernel address
150 * - size - region size
150 */ 151 */
151ENTRY(arm940_flush_kern_dcache_page) 152ENTRY(arm940_flush_kern_dcache_area)
152 mov ip, #0 153 mov ip, #0
153 mov r1, #(CACHE_DSEGMENTS - 1) << 4 @ 4 segments 154 mov r1, #(CACHE_DSEGMENTS - 1) << 4 @ 4 segments
1541: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries 1551: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries
@@ -238,7 +239,7 @@ ENTRY(arm940_cache_fns)
238 .long arm940_flush_user_cache_range 239 .long arm940_flush_user_cache_range
239 .long arm940_coherent_kern_range 240 .long arm940_coherent_kern_range
240 .long arm940_coherent_user_range 241 .long arm940_coherent_user_range
241 .long arm940_flush_kern_dcache_page 242 .long arm940_flush_kern_dcache_area
242 .long arm940_dma_inv_range 243 .long arm940_dma_inv_range
243 .long arm940_dma_clean_range 244 .long arm940_dma_clean_range
244 .long arm940_dma_flush_range 245 .long arm940_dma_flush_range
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index 40c0449a139b..9a951239c86c 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -183,16 +183,17 @@ ENTRY(arm946_coherent_user_range)
183 mov pc, lr 183 mov pc, lr
184 184
185/* 185/*
186 * flush_kern_dcache_page(void *page) 186 * flush_kern_dcache_area(void *addr, size_t size)
187 * 187 *
188 * Ensure no D cache aliasing occurs, either with itself or 188 * Ensure no D cache aliasing occurs, either with itself or
189 * the I cache 189 * the I cache
190 * 190 *
191 * - addr - page aligned address 191 * - addr - kernel address
192 * - size - region size
192 * (same as arm926) 193 * (same as arm926)
193 */ 194 */
194ENTRY(arm946_flush_kern_dcache_page) 195ENTRY(arm946_flush_kern_dcache_area)
195 add r1, r0, #PAGE_SZ 196 add r1, r0, r1
1961: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 1971: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
197 add r0, r0, #CACHE_DLINESIZE 198 add r0, r0, #CACHE_DLINESIZE
198 cmp r0, r1 199 cmp r0, r1
@@ -280,7 +281,7 @@ ENTRY(arm946_cache_fns)
280 .long arm946_flush_user_cache_range 281 .long arm946_flush_user_cache_range
281 .long arm946_coherent_kern_range 282 .long arm946_coherent_kern_range
282 .long arm946_coherent_user_range 283 .long arm946_coherent_user_range
283 .long arm946_flush_kern_dcache_page 284 .long arm946_flush_kern_dcache_area
284 .long arm946_dma_inv_range 285 .long arm946_dma_inv_range
285 .long arm946_dma_clean_range 286 .long arm946_dma_clean_range
286 .long arm946_dma_flush_range 287 .long arm946_dma_flush_range
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index d0d7795200fc..dbc39383e66a 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -226,16 +226,17 @@ ENTRY(feroceon_coherent_user_range)
226 mov pc, lr 226 mov pc, lr
227 227
228/* 228/*
229 * flush_kern_dcache_page(void *page) 229 * flush_kern_dcache_area(void *addr, size_t size)
230 * 230 *
231 * Ensure no D cache aliasing occurs, either with itself or 231 * Ensure no D cache aliasing occurs, either with itself or
232 * the I cache 232 * the I cache
233 * 233 *
234 * - addr - page aligned address 234 * - addr - kernel address
235 * - size - region size
235 */ 236 */
236 .align 5 237 .align 5
237ENTRY(feroceon_flush_kern_dcache_page) 238ENTRY(feroceon_flush_kern_dcache_area)
238 add r1, r0, #PAGE_SZ 239 add r1, r0, r1
2391: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 2401: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
240 add r0, r0, #CACHE_DLINESIZE 241 add r0, r0, #CACHE_DLINESIZE
241 cmp r0, r1 242 cmp r0, r1
@@ -246,7 +247,7 @@ ENTRY(feroceon_flush_kern_dcache_page)
246 mov pc, lr 247 mov pc, lr
247 248
248 .align 5 249 .align 5
249ENTRY(feroceon_range_flush_kern_dcache_page) 250ENTRY(feroceon_range_flush_kern_dcache_area)
250 mrs r2, cpsr 251 mrs r2, cpsr
251 add r1, r0, #PAGE_SZ - CACHE_DLINESIZE @ top addr is inclusive 252 add r1, r0, #PAGE_SZ - CACHE_DLINESIZE @ top addr is inclusive
252 orr r3, r2, #PSR_I_BIT 253 orr r3, r2, #PSR_I_BIT
@@ -372,7 +373,7 @@ ENTRY(feroceon_cache_fns)
372 .long feroceon_flush_user_cache_range 373 .long feroceon_flush_user_cache_range
373 .long feroceon_coherent_kern_range 374 .long feroceon_coherent_kern_range
374 .long feroceon_coherent_user_range 375 .long feroceon_coherent_user_range
375 .long feroceon_flush_kern_dcache_page 376 .long feroceon_flush_kern_dcache_area
376 .long feroceon_dma_inv_range 377 .long feroceon_dma_inv_range
377 .long feroceon_dma_clean_range 378 .long feroceon_dma_clean_range
378 .long feroceon_dma_flush_range 379 .long feroceon_dma_flush_range
@@ -383,7 +384,7 @@ ENTRY(feroceon_range_cache_fns)
383 .long feroceon_flush_user_cache_range 384 .long feroceon_flush_user_cache_range
384 .long feroceon_coherent_kern_range 385 .long feroceon_coherent_kern_range
385 .long feroceon_coherent_user_range 386 .long feroceon_coherent_user_range
386 .long feroceon_range_flush_kern_dcache_page 387 .long feroceon_range_flush_kern_dcache_area
387 .long feroceon_range_dma_inv_range 388 .long feroceon_range_dma_inv_range
388 .long feroceon_range_dma_clean_range 389 .long feroceon_range_dma_clean_range
389 .long feroceon_range_dma_flush_range 390 .long feroceon_range_dma_flush_range
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S
index 52b5fd74fbb3..9674d36cc97d 100644
--- a/arch/arm/mm/proc-mohawk.S
+++ b/arch/arm/mm/proc-mohawk.S
@@ -186,15 +186,16 @@ ENTRY(mohawk_coherent_user_range)
186 mov pc, lr 186 mov pc, lr
187 187
188/* 188/*
189 * flush_kern_dcache_page(void *page) 189 * flush_kern_dcache_area(void *addr, size_t size)
190 * 190 *
191 * Ensure no D cache aliasing occurs, either with itself or 191 * Ensure no D cache aliasing occurs, either with itself or
192 * the I cache 192 * the I cache
193 * 193 *
194 * - addr - page aligned address 194 * - addr - kernel address
195 * - size - region size
195 */ 196 */
196ENTRY(mohawk_flush_kern_dcache_page) 197ENTRY(mohawk_flush_kern_dcache_area)
197 add r1, r0, #PAGE_SZ 198 add r1, r0, r1
1981: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry 1991: mcr p15, 0, r0, c7, c14, 1 @ clean+invalidate D entry
199 add r0, r0, #CACHE_DLINESIZE 200 add r0, r0, #CACHE_DLINESIZE
200 cmp r0, r1 201 cmp r0, r1
@@ -273,7 +274,7 @@ ENTRY(mohawk_cache_fns)
273 .long mohawk_flush_user_cache_range 274 .long mohawk_flush_user_cache_range
274 .long mohawk_coherent_kern_range 275 .long mohawk_coherent_kern_range
275 .long mohawk_coherent_user_range 276 .long mohawk_coherent_user_range
276 .long mohawk_flush_kern_dcache_page 277 .long mohawk_flush_kern_dcache_area
277 .long mohawk_dma_inv_range 278 .long mohawk_dma_inv_range
278 .long mohawk_dma_clean_range 279 .long mohawk_dma_clean_range
279 .long mohawk_dma_flush_range 280 .long mohawk_dma_flush_range
diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c
index ac5c80062b70..3e6210b4d6d4 100644
--- a/arch/arm/mm/proc-syms.c
+++ b/arch/arm/mm/proc-syms.c
@@ -27,8 +27,7 @@ EXPORT_SYMBOL(__cpuc_flush_kern_all);
27EXPORT_SYMBOL(__cpuc_flush_user_all); 27EXPORT_SYMBOL(__cpuc_flush_user_all);
28EXPORT_SYMBOL(__cpuc_flush_user_range); 28EXPORT_SYMBOL(__cpuc_flush_user_range);
29EXPORT_SYMBOL(__cpuc_coherent_kern_range); 29EXPORT_SYMBOL(__cpuc_coherent_kern_range);
30EXPORT_SYMBOL(__cpuc_flush_dcache_page); 30EXPORT_SYMBOL(__cpuc_flush_dcache_area);
31EXPORT_SYMBOL(dmac_inv_range); /* because of flush_ioremap_region() */
32#else 31#else
33EXPORT_SYMBOL(cpu_cache); 32EXPORT_SYMBOL(cpu_cache);
34#endif 33#endif
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 5485c821101c..395cc90c6613 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -254,10 +254,9 @@ __pj4_v6_proc_info:
254 .long 0x560f5810 254 .long 0x560f5810
255 .long 0xff0ffff0 255 .long 0xff0ffff0
256 .long PMD_TYPE_SECT | \ 256 .long PMD_TYPE_SECT | \
257 PMD_SECT_BUFFERABLE | \
258 PMD_SECT_CACHEABLE | \
259 PMD_SECT_AP_WRITE | \ 257 PMD_SECT_AP_WRITE | \
260 PMD_SECT_AP_READ 258 PMD_SECT_AP_READ | \
259 PMD_FLAGS
261 .long PMD_TYPE_SECT | \ 260 .long PMD_TYPE_SECT | \
262 PMD_SECT_XN | \ 261 PMD_SECT_XN | \
263 PMD_SECT_AP_WRITE | \ 262 PMD_SECT_AP_WRITE | \
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index fab134e29826..8e4f6dca8997 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -226,15 +226,16 @@ ENTRY(xsc3_coherent_user_range)
226 mov pc, lr 226 mov pc, lr
227 227
228/* 228/*
229 * flush_kern_dcache_page(void *page) 229 * flush_kern_dcache_area(void *addr, size_t size)
230 * 230 *
231 * Ensure no D cache aliasing occurs, either with itself or 231 * Ensure no D cache aliasing occurs, either with itself or
232 * the I cache. 232 * the I cache.
233 * 233 *
234 * - addr - page aligned address 234 * - addr - kernel address
235 * - size - region size
235 */ 236 */
236ENTRY(xsc3_flush_kern_dcache_page) 237ENTRY(xsc3_flush_kern_dcache_area)
237 add r1, r0, #PAGE_SZ 238 add r1, r0, r1
2381: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line 2391: mcr p15, 0, r0, c7, c14, 1 @ clean/invalidate L1 D line
239 add r0, r0, #CACHELINESIZE 240 add r0, r0, #CACHELINESIZE
240 cmp r0, r1 241 cmp r0, r1
@@ -309,7 +310,7 @@ ENTRY(xsc3_cache_fns)
309 .long xsc3_flush_user_cache_range 310 .long xsc3_flush_user_cache_range
310 .long xsc3_coherent_kern_range 311 .long xsc3_coherent_kern_range
311 .long xsc3_coherent_user_range 312 .long xsc3_coherent_user_range
312 .long xsc3_flush_kern_dcache_page 313 .long xsc3_flush_kern_dcache_area
313 .long xsc3_dma_inv_range 314 .long xsc3_dma_inv_range
314 .long xsc3_dma_clean_range 315 .long xsc3_dma_clean_range
315 .long xsc3_dma_flush_range 316 .long xsc3_dma_flush_range
@@ -406,6 +407,13 @@ __xsc3_setup:
406 407
407 adr r5, xsc3_crval 408 adr r5, xsc3_crval
408 ldmia r5, {r5, r6} 409 ldmia r5, {r5, r6}
410
411#ifdef CONFIG_CACHE_XSC3L2
412 mrc p15, 1, r0, c0, c0, 1 @ get L2 present information
413 ands r0, r0, #0xf8
414 orrne r6, r6, #(1 << 26) @ enable L2 if present
415#endif
416
409 mrc p15, 0, r0, c1, c0, 0 @ get control register 417 mrc p15, 0, r0, c1, c0, 0 @ get control register
410 bic r0, r0, r5 @ ..V. ..R. .... ..A. 418 bic r0, r0, r5 @ ..V. ..R. .... ..A.
411 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu) 419 orr r0, r0, r6 @ ..VI Z..S .... .C.M (mmu)
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index f056c283682d..93df47265f2d 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -284,15 +284,16 @@ ENTRY(xscale_coherent_user_range)
284 mov pc, lr 284 mov pc, lr
285 285
286/* 286/*
287 * flush_kern_dcache_page(void *page) 287 * flush_kern_dcache_area(void *addr, size_t size)
288 * 288 *
289 * Ensure no D cache aliasing occurs, either with itself or 289 * Ensure no D cache aliasing occurs, either with itself or
290 * the I cache 290 * the I cache
291 * 291 *
292 * - addr - page aligned address 292 * - addr - kernel address
293 * - size - region size
293 */ 294 */
294ENTRY(xscale_flush_kern_dcache_page) 295ENTRY(xscale_flush_kern_dcache_area)
295 add r1, r0, #PAGE_SZ 296 add r1, r0, r1
2961: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 2971: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
297 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry 298 mcr p15, 0, r0, c7, c6, 1 @ invalidate D entry
298 add r0, r0, #CACHELINESIZE 299 add r0, r0, #CACHELINESIZE
@@ -368,7 +369,7 @@ ENTRY(xscale_cache_fns)
368 .long xscale_flush_user_cache_range 369 .long xscale_flush_user_cache_range
369 .long xscale_coherent_kern_range 370 .long xscale_coherent_kern_range
370 .long xscale_coherent_user_range 371 .long xscale_coherent_user_range
371 .long xscale_flush_kern_dcache_page 372 .long xscale_flush_kern_dcache_area
372 .long xscale_dma_inv_range 373 .long xscale_dma_inv_range
373 .long xscale_dma_clean_range 374 .long xscale_dma_clean_range
374 .long xscale_dma_flush_range 375 .long xscale_dma_flush_range
@@ -392,7 +393,7 @@ ENTRY(xscale_80200_A0_A1_cache_fns)
392 .long xscale_flush_user_cache_range 393 .long xscale_flush_user_cache_range
393 .long xscale_coherent_kern_range 394 .long xscale_coherent_kern_range
394 .long xscale_coherent_user_range 395 .long xscale_coherent_user_range
395 .long xscale_flush_kern_dcache_page 396 .long xscale_flush_kern_dcache_area
396 .long xscale_dma_flush_range 397 .long xscale_dma_flush_range
397 .long xscale_dma_clean_range 398 .long xscale_dma_clean_range
398 .long xscale_dma_flush_range 399 .long xscale_dma_flush_range
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S
index a26a605b73bd..0cb1848bd876 100644
--- a/arch/arm/mm/tlb-v7.S
+++ b/arch/arm/mm/tlb-v7.S
@@ -40,7 +40,6 @@ ENTRY(v7wbi_flush_user_tlb_range)
40 asid r3, r3 @ mask ASID 40 asid r3, r3 @ mask ASID
41 orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA 41 orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA
42 mov r1, r1, lsl #PAGE_SHIFT 42 mov r1, r1, lsl #PAGE_SHIFT
43 vma_vm_flags r2, r2 @ get vma->vm_flags
441: 431:
45#ifdef CONFIG_SMP 44#ifdef CONFIG_SMP
46 mcr p15, 0, r0, c8, c3, 1 @ TLB invalidate U MVA (shareable) 45 mcr p15, 0, r0, c8, c3, 1 @ TLB invalidate U MVA (shareable)
diff --git a/arch/arm/nwfpe/Makefile b/arch/arm/nwfpe/Makefile
index b29178c0414e..deb3a82ddbdf 100644
--- a/arch/arm/nwfpe/Makefile
+++ b/arch/arm/nwfpe/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_FPE_NWFPE) += nwfpe.o
6 6
7nwfpe-y += fpa11.o fpa11_cpdo.o fpa11_cpdt.o \ 7nwfpe-y += fpa11.o fpa11_cpdo.o fpa11_cpdt.o \
8 fpa11_cprt.o fpmodule.o fpopcode.o \ 8 fpa11_cprt.o fpmodule.o fpopcode.o \
9 softfloat.o single_cpdo.o double_cpdo.o 9 softfloat.o single_cpdo.o double_cpdo.o \
10 entry.o
10 11
11nwfpe-$(CONFIG_FPE_NWFPE_XP) += extended_cpdo.o 12nwfpe-$(CONFIG_FPE_NWFPE_XP) += extended_cpdo.o
12nwfpe-$(CONFIG_CPU_32) += entry.o
diff --git a/arch/arm/oprofile/op_model_v7.c b/arch/arm/oprofile/op_model_v7.c
index f20295f14adb..2088a6c0cc0e 100644
--- a/arch/arm/oprofile/op_model_v7.c
+++ b/arch/arm/oprofile/op_model_v7.c
@@ -191,12 +191,8 @@ int armv7_setup_pmnc(void)
191 return -EBUSY; 191 return -EBUSY;
192 } 192 }
193 193
194 /* 194 /* Initialize & Reset PMNC: C bit and P bit */
195 * Initialize & Reset PMNC: C bit, D bit and P bit. 195 armv7_pmnc_write(PMNC_P | PMNC_C);
196 * Note: Using a slower count for CCNT (D bit: divide by 64) results
197 * in a more stable system
198 */
199 armv7_pmnc_write(PMNC_P | PMNC_C | PMNC_D);
200 196
201 197
202 for (cnt = CCNT; cnt < CNTMAX; cnt++) { 198 for (cnt = CCNT; cnt < CNTMAX; cnt++) {
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx25.h b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
index 810c47f56e77..9af494f0ab3d 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx25.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
@@ -58,19 +58,19 @@
58 58
59#define MX25_PAD_A18__A18 IOMUX_PAD(0x23c, 0x020, 0x10, 0, 0, NO_PAD_CTRL) 59#define MX25_PAD_A18__A18 IOMUX_PAD(0x23c, 0x020, 0x10, 0, 0, NO_PAD_CTRL)
60#define MX25_PAD_A18__GPIO_2_4 IOMUX_PAD(0x23c, 0x020, 0x15, 0, 0, NO_PAD_CTRL) 60#define MX25_PAD_A18__GPIO_2_4 IOMUX_PAD(0x23c, 0x020, 0x15, 0, 0, NO_PAD_CTRL)
61#define MX25_PAD_A18__FEC_COL IOMUX_PAD(0x23c, 0x020, 0x17, 0x504, 0, NO_PAD_CTL) 61#define MX25_PAD_A18__FEC_COL IOMUX_PAD(0x23c, 0x020, 0x17, 0x504, 0, NO_PAD_CTRL)
62 62
63#define MX25_PAD_A19__A19 IOMUX_PAD(0x240, 0x024, 0x10, 0, 0, NO_PAD_CTRL) 63#define MX25_PAD_A19__A19 IOMUX_PAD(0x240, 0x024, 0x10, 0, 0, NO_PAD_CTRL)
64#define MX25_PAD_A19__FEC_RX_ER IOMUX_PAD(0x240, 0x024, 0x17, 0x518, 0, NO_PAD_CTL) 64#define MX25_PAD_A19__FEC_RX_ER IOMUX_PAD(0x240, 0x024, 0x17, 0x518, 0, NO_PAD_CTRL)
65#define MX25_PAD_A19__GPIO_2_5 IOMUX_PAD(0x240, 0x024, 0x15, 0, 0, NO_PAD_CTRL) 65#define MX25_PAD_A19__GPIO_2_5 IOMUX_PAD(0x240, 0x024, 0x15, 0, 0, NO_PAD_CTRL)
66 66
67#define MX25_PAD_A20__A20 IOMUX_PAD(0x244, 0x028, 0x10, 0, 0, NO_PAD_CTRL) 67#define MX25_PAD_A20__A20 IOMUX_PAD(0x244, 0x028, 0x10, 0, 0, NO_PAD_CTRL)
68#define MX25_PAD_A20__GPIO_2_6 IOMUX_PAD(0x244, 0x028, 0x15, 0, 0, NO_PAD_CTRL) 68#define MX25_PAD_A20__GPIO_2_6 IOMUX_PAD(0x244, 0x028, 0x15, 0, 0, NO_PAD_CTRL)
69#define MX25_PAD_A20__FEC_RDATA2 IOMUX_PAD(0x244, 0x028, 0x17, 0x50c, 0, NO_PAD_CTL) 69#define MX25_PAD_A20__FEC_RDATA2 IOMUX_PAD(0x244, 0x028, 0x17, 0x50c, 0, NO_PAD_CTRL)
70 70
71#define MX25_PAD_A21__A21 IOMUX_PAD(0x248, 0x02c, 0x10, 0, 0, NO_PAD_CTRL) 71#define MX25_PAD_A21__A21 IOMUX_PAD(0x248, 0x02c, 0x10, 0, 0, NO_PAD_CTRL)
72#define MX25_PAD_A21__GPIO_2_7 IOMUX_PAD(0x248, 0x02c, 0x15, 0, 0, NO_PAD_CTRL) 72#define MX25_PAD_A21__GPIO_2_7 IOMUX_PAD(0x248, 0x02c, 0x15, 0, 0, NO_PAD_CTRL)
73#define MX25_PAD_A21__FEC_RDATA3 IOMUX_PAD(0x248, 0x02c, 0x17, 0x510, 0, NO_PAD_CTL) 73#define MX25_PAD_A21__FEC_RDATA3 IOMUX_PAD(0x248, 0x02c, 0x17, 0x510, 0, NO_PAD_CTRL)
74 74
75#define MX25_PAD_A22__A22 IOMUX_PAD(0x000, 0x030, 0x10, 0, 0, NO_PAD_CTRL) 75#define MX25_PAD_A22__A22 IOMUX_PAD(0x000, 0x030, 0x10, 0, 0, NO_PAD_CTRL)
76#define MX25_PAD_A22__GPIO_2_8 IOMUX_PAD(0x000, 0x030, 0x15, 0, 0, NO_PAD_CTRL) 76#define MX25_PAD_A22__GPIO_2_8 IOMUX_PAD(0x000, 0x030, 0x15, 0, 0, NO_PAD_CTRL)
@@ -80,11 +80,11 @@
80 80
81#define MX25_PAD_A24__A24 IOMUX_PAD(0x250, 0x038, 0x10, 0, 0, NO_PAD_CTRL) 81#define MX25_PAD_A24__A24 IOMUX_PAD(0x250, 0x038, 0x10, 0, 0, NO_PAD_CTRL)
82#define MX25_PAD_A24__GPIO_2_10 IOMUX_PAD(0x250, 0x038, 0x15, 0, 0, NO_PAD_CTRL) 82#define MX25_PAD_A24__GPIO_2_10 IOMUX_PAD(0x250, 0x038, 0x15, 0, 0, NO_PAD_CTRL)
83#define MX25_PAD_A24__FEC_RX_CLK IOMUX_PAD(0x250, 0x038, 0x17, 0x514, 0, NO_PAD_CTL) 83#define MX25_PAD_A24__FEC_RX_CLK IOMUX_PAD(0x250, 0x038, 0x17, 0x514, 0, NO_PAD_CTRL)
84 84
85#define MX25_PAD_A25__A25 IOMUX_PAD(0x254, 0x03c, 0x10, 0, 0, NO_PAD_CTRL) 85#define MX25_PAD_A25__A25 IOMUX_PAD(0x254, 0x03c, 0x10, 0, 0, NO_PAD_CTRL)
86#define MX25_PAD_A25__GPIO_2_11 IOMUX_PAD(0x254, 0x03c, 0x15, 0, 0, NO_PAD_CTRL) 86#define MX25_PAD_A25__GPIO_2_11 IOMUX_PAD(0x254, 0x03c, 0x15, 0, 0, NO_PAD_CTRL)
87#define MX25_PAD_A25__FEC_CRS IOMUX_PAD(0x254, 0x03c, 0x17, 0x508, 0, NO_PAD_CTL) 87#define MX25_PAD_A25__FEC_CRS IOMUX_PAD(0x254, 0x03c, 0x17, 0x508, 0, NO_PAD_CTRL)
88 88
89#define MX25_PAD_EB0__EB0 IOMUX_PAD(0x258, 0x040, 0x10, 0, 0, NO_PAD_CTRL) 89#define MX25_PAD_EB0__EB0 IOMUX_PAD(0x258, 0x040, 0x10, 0, 0, NO_PAD_CTRL)
90#define MX25_PAD_EB0__AUD4_TXD IOMUX_PAD(0x258, 0x040, 0x14, 0x464, 0, NO_PAD_CTRL) 90#define MX25_PAD_EB0__AUD4_TXD IOMUX_PAD(0x258, 0x040, 0x14, 0x464, 0, NO_PAD_CTRL)
@@ -112,7 +112,7 @@
112#define MX25_PAD_CS5__UART5_RTS IOMUX_PAD(0x268, 0x058, 0x13, 0x574, 0, NO_PAD_CTRL) 112#define MX25_PAD_CS5__UART5_RTS IOMUX_PAD(0x268, 0x058, 0x13, 0x574, 0, NO_PAD_CTRL)
113#define MX25_PAD_CS5__GPIO_3_21 IOMUX_PAD(0x268, 0x058, 0x15, 0, 0, NO_PAD_CTRL) 113#define MX25_PAD_CS5__GPIO_3_21 IOMUX_PAD(0x268, 0x058, 0x15, 0, 0, NO_PAD_CTRL)
114 114
115#define MX25_PAD_NF_CE0__NF_CE0 IOMUX_PAD(0x26c, 0x05c, 0x10, 0, 0, NO_PAD_CTL) 115#define MX25_PAD_NF_CE0__NF_CE0 IOMUX_PAD(0x26c, 0x05c, 0x10, 0, 0, NO_PAD_CTRL)
116#define MX25_PAD_NF_CE0__GPIO_3_22 IOMUX_PAD(0x26c, 0x05c, 0x15, 0, 0, NO_PAD_CTRL) 116#define MX25_PAD_NF_CE0__GPIO_3_22 IOMUX_PAD(0x26c, 0x05c, 0x15, 0, 0, NO_PAD_CTRL)
117 117
118#define MX25_PAD_ECB__ECB IOMUX_PAD(0x270, 0x060, 0x10, 0, 0, NO_PAD_CTRL) 118#define MX25_PAD_ECB__ECB IOMUX_PAD(0x270, 0x060, 0x10, 0, 0, NO_PAD_CTRL)
@@ -229,28 +229,28 @@
229#define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL) 229#define MX25_PAD_LD7__GPIO_1_21 IOMUX_PAD(0x2dc, 0x0e4, 0x15, 0, 0, NO_PAD_CTRL)
230 230
231#define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, NO_PAD_CTRL) 231#define MX25_PAD_LD8__LD8 IOMUX_PAD(0x2e0, 0x0e8, 0x10, 0, 0, NO_PAD_CTRL)
232#define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTL) 232#define MX25_PAD_LD8__FEC_TX_ERR IOMUX_PAD(0x2e0, 0x0e8, 0x15, 0, 0, NO_PAD_CTRL)
233 233
234#define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, NO_PAD_CTRL) 234#define MX25_PAD_LD9__LD9 IOMUX_PAD(0x2e4, 0x0ec, 0x10, 0, 0, NO_PAD_CTRL)
235#define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTL) 235#define MX25_PAD_LD9__FEC_COL IOMUX_PAD(0x2e4, 0x0ec, 0x15, 0x504, 1, NO_PAD_CTRL)
236 236
237#define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, NO_PAD_CTRL) 237#define MX25_PAD_LD10__LD10 IOMUX_PAD(0x2e8, 0x0f0, 0x10, 0, 0, NO_PAD_CTRL)
238#define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTL) 238#define MX25_PAD_LD10__FEC_RX_ER IOMUX_PAD(0x2e8, 0x0f0, 0x15, 0x518, 1, NO_PAD_CTRL)
239 239
240#define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, NO_PAD_CTRL) 240#define MX25_PAD_LD11__LD11 IOMUX_PAD(0x2ec, 0x0f4, 0x10, 0, 0, NO_PAD_CTRL)
241#define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTL) 241#define MX25_PAD_LD11__FEC_RDATA2 IOMUX_PAD(0x2ec, 0x0f4, 0x15, 0x50c, 1, NO_PAD_CTRL)
242 242
243#define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, NO_PAD_CTRL) 243#define MX25_PAD_LD12__LD12 IOMUX_PAD(0x2f0, 0x0f8, 0x10, 0, 0, NO_PAD_CTRL)
244#define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTL) 244#define MX25_PAD_LD12__FEC_RDATA3 IOMUX_PAD(0x2f0, 0x0f8, 0x15, 0x510, 1, NO_PAD_CTRL)
245 245
246#define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, NO_PAD_CTRL) 246#define MX25_PAD_LD13__LD13 IOMUX_PAD(0x2f4, 0x0fc, 0x10, 0, 0, NO_PAD_CTRL)
247#define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTL) 247#define MX25_PAD_LD13__FEC_TDATA2 IOMUX_PAD(0x2f4, 0x0fc, 0x15, 0, 0, NO_PAD_CTRL)
248 248
249#define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, NO_PAD_CTRL) 249#define MX25_PAD_LD14__LD14 IOMUX_PAD(0x2f8, 0x100, 0x10, 0, 0, NO_PAD_CTRL)
250#define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTL) 250#define MX25_PAD_LD14__FEC_TDATA3 IOMUX_PAD(0x2f8, 0x100, 0x15, 0, 0, NO_PAD_CTRL)
251 251
252#define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, NO_PAD_CTRL) 252#define MX25_PAD_LD15__LD15 IOMUX_PAD(0x2fc, 0x104, 0x10, 0, 0, NO_PAD_CTRL)
253#define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTL) 253#define MX25_PAD_LD15__FEC_RX_CLK IOMUX_PAD(0x2fc, 0x104, 0x15, 0x514, 1, NO_PAD_CTRL)
254 254
255#define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL) 255#define MX25_PAD_HSYNC__HSYNC IOMUX_PAD(0x300, 0x108, 0x10, 0, 0, NO_PAD_CTRL)
256#define MX25_PAD_HSYNC__GPIO_1_22 IOMUX_PAD(0x300, 0x108, 0x15, 0, 0, NO_PAD_CTRL) 256#define MX25_PAD_HSYNC__GPIO_1_22 IOMUX_PAD(0x300, 0x108, 0x15, 0, 0, NO_PAD_CTRL)
@@ -265,7 +265,7 @@
265#define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL) 265#define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL)
266 266
267#define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL) 267#define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL)
268#define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTL) 268#define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTRL)
269 269
270#define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL) 270#define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL)
271#define MX25_PAD_PWM__GPIO_1_26 IOMUX_PAD(0x314, 0x11c, 0x15, 0, 0, NO_PAD_CTRL) 271#define MX25_PAD_PWM__GPIO_1_26 IOMUX_PAD(0x314, 0x11c, 0x15, 0, 0, NO_PAD_CTRL)
@@ -354,19 +354,19 @@
354#define MX25_PAD_UART2_TXD__GPIO_4_27 IOMUX_PAD(0x37c, 0x184, 0x15, 0, 0, NO_PAD_CTRL) 354#define MX25_PAD_UART2_TXD__GPIO_4_27 IOMUX_PAD(0x37c, 0x184, 0x15, 0, 0, NO_PAD_CTRL)
355 355
356#define MX25_PAD_UART2_RTS__UART2_RTS IOMUX_PAD(0x380, 0x188, 0x10, 0, 0, NO_PAD_CTRL) 356#define MX25_PAD_UART2_RTS__UART2_RTS IOMUX_PAD(0x380, 0x188, 0x10, 0, 0, NO_PAD_CTRL)
357#define MX25_PAD_UART2_RTS__FEC_COL IOMUX_PAD(0x380, 0x188, 0x12, 0x504, 2, NO_PAD_CTL) 357#define MX25_PAD_UART2_RTS__FEC_COL IOMUX_PAD(0x380, 0x188, 0x12, 0x504, 2, NO_PAD_CTRL)
358#define MX25_PAD_UART2_RTS__GPIO_4_28 IOMUX_PAD(0x380, 0x188, 0x15, 0, 0, NO_PAD_CTRL) 358#define MX25_PAD_UART2_RTS__GPIO_4_28 IOMUX_PAD(0x380, 0x188, 0x15, 0, 0, NO_PAD_CTRL)
359 359
360#define MX25_PAD_UART2_CTS__FEC_RX_ER IOMUX_PAD(0x384, 0x18c, 0x12, 0x518, 2, NO_PAD_CTL) 360#define MX25_PAD_UART2_CTS__FEC_RX_ER IOMUX_PAD(0x384, 0x18c, 0x12, 0x518, 2, NO_PAD_CTRL)
361#define MX25_PAD_UART2_CTS__UART2_CTS IOMUX_PAD(0x384, 0x18c, 0x10, 0, 0, NO_PAD_CTRL) 361#define MX25_PAD_UART2_CTS__UART2_CTS IOMUX_PAD(0x384, 0x18c, 0x10, 0, 0, NO_PAD_CTRL)
362#define MX25_PAD_UART2_CTS__GPIO_4_29 IOMUX_PAD(0x384, 0x18c, 0x15, 0, 0, NO_PAD_CTRL) 362#define MX25_PAD_UART2_CTS__GPIO_4_29 IOMUX_PAD(0x384, 0x18c, 0x15, 0, 0, NO_PAD_CTRL)
363 363
364#define MX25_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x388, 0x190, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 364#define MX25_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x388, 0x190, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
365#define MX25_PAD_SD1_CMD__FEC_RDATA2 IOMUX_PAD(0x388, 0x190, 0x12, 0x50c, 2, NO_PAD_CTL) 365#define MX25_PAD_SD1_CMD__FEC_RDATA2 IOMUX_PAD(0x388, 0x190, 0x12, 0x50c, 2, NO_PAD_CTRL)
366#define MX25_PAD_SD1_CMD__GPIO_2_23 IOMUX_PAD(0x388, 0x190, 0x15, 0, 0, NO_PAD_CTRL) 366#define MX25_PAD_SD1_CMD__GPIO_2_23 IOMUX_PAD(0x388, 0x190, 0x15, 0, 0, NO_PAD_CTRL)
367 367
368#define MX25_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x38c, 0x194, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 368#define MX25_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x38c, 0x194, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
369#define MX25_PAD_SD1_CLK__FEC_RDATA3 IOMUX_PAD(0x38c, 0x194, 0x12, 0x510, 2, NO_PAD_CTL) 369#define MX25_PAD_SD1_CLK__FEC_RDATA3 IOMUX_PAD(0x38c, 0x194, 0x12, 0x510, 2, NO_PAD_CTRL)
370#define MX25_PAD_SD1_CLK__GPIO_2_24 IOMUX_PAD(0x38c, 0x194, 0x15, 0, 0, NO_PAD_CTRL) 370#define MX25_PAD_SD1_CLK__GPIO_2_24 IOMUX_PAD(0x38c, 0x194, 0x15, 0, 0, NO_PAD_CTRL)
371 371
372#define MX25_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x390, 0x198, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 372#define MX25_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x390, 0x198, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
@@ -377,11 +377,11 @@
377#define MX25_PAD_SD1_DATA1__GPIO_2_26 IOMUX_PAD(0x394, 0x19c, 0x15, 0, 0, NO_PAD_CTRL) 377#define MX25_PAD_SD1_DATA1__GPIO_2_26 IOMUX_PAD(0x394, 0x19c, 0x15, 0, 0, NO_PAD_CTRL)
378 378
379#define MX25_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x398, 0x1a0, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 379#define MX25_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x398, 0x1a0, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
380#define MX25_PAD_SD1_DATA2__FEC_RX_CLK IOMUX_PAD(0x398, 0x1a0, 0x15, 0x514, 2, NO_PAD_CTL) 380#define MX25_PAD_SD1_DATA2__FEC_RX_CLK IOMUX_PAD(0x398, 0x1a0, 0x15, 0x514, 2, NO_PAD_CTRL)
381#define MX25_PAD_SD1_DATA2__GPIO_2_27 IOMUX_PAD(0x398, 0x1a0, 0x15, 0, 0, NO_PAD_CTRL) 381#define MX25_PAD_SD1_DATA2__GPIO_2_27 IOMUX_PAD(0x398, 0x1a0, 0x15, 0, 0, NO_PAD_CTRL)
382 382
383#define MX25_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x39c, 0x1a4, 0x10, 0, 0, PAD_CTL_PUS_47K_UP) 383#define MX25_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x39c, 0x1a4, 0x10, 0, 0, PAD_CTL_PUS_47K_UP)
384#define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTL) 384#define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTRL)
385#define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL) 385#define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL)
386 386
387#define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, PAD_CTL_PKE) 387#define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, PAD_CTL_PKE)
@@ -410,7 +410,7 @@
410#define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) 410#define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE)
411#define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL) 411#define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL)
412 412
413#define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTL) 413#define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTRL)
414#define MX25_PAD_FEC_MDC__AUD4_TXD IOMUX_PAD(0x3c0, 0x1c8, 0x12, 0x464, 1, NO_PAD_CTRL) 414#define MX25_PAD_FEC_MDC__AUD4_TXD IOMUX_PAD(0x3c0, 0x1c8, 0x12, 0x464, 1, NO_PAD_CTRL)
415#define MX25_PAD_FEC_MDC__GPIO_3_5 IOMUX_PAD(0x3c0, 0x1c8, 0x15, 0, 0, NO_PAD_CTRL) 415#define MX25_PAD_FEC_MDC__GPIO_3_5 IOMUX_PAD(0x3c0, 0x1c8, 0x15, 0, 0, NO_PAD_CTRL)
416 416
@@ -418,23 +418,23 @@
418#define MX25_PAD_FEC_MDIO__AUD4_RXD IOMUX_PAD(0x3c4, 0x1cc, 0x12, 0x460, 1, NO_PAD_CTRL) 418#define MX25_PAD_FEC_MDIO__AUD4_RXD IOMUX_PAD(0x3c4, 0x1cc, 0x12, 0x460, 1, NO_PAD_CTRL)
419#define MX25_PAD_FEC_MDIO__GPIO_3_6 IOMUX_PAD(0x3c4, 0x1cc, 0x15, 0, 0, NO_PAD_CTRL) 419#define MX25_PAD_FEC_MDIO__GPIO_3_6 IOMUX_PAD(0x3c4, 0x1cc, 0x15, 0, 0, NO_PAD_CTRL)
420 420
421#define MX25_PAD_FEC_TDATA0__FEC_TDATA0 IOMUX_PAD(0x3c8, 0x1d0, 0x10, 0, 0, NO_PAD_CTL) 421#define MX25_PAD_FEC_TDATA0__FEC_TDATA0 IOMUX_PAD(0x3c8, 0x1d0, 0x10, 0, 0, NO_PAD_CTRL)
422#define MX25_PAD_FEC_TDATA0__GPIO_3_7 IOMUX_PAD(0x3c8, 0x1d0, 0x15, 0, 0, NO_PAD_CTRL) 422#define MX25_PAD_FEC_TDATA0__GPIO_3_7 IOMUX_PAD(0x3c8, 0x1d0, 0x15, 0, 0, NO_PAD_CTRL)
423 423
424#define MX25_PAD_FEC_TDATA1__FEC_TDATA1 IOMUX_PAD(0x3cc, 0x1d4, 0x10, 0, 0, NO_PAD_CTL) 424#define MX25_PAD_FEC_TDATA1__FEC_TDATA1 IOMUX_PAD(0x3cc, 0x1d4, 0x10, 0, 0, NO_PAD_CTRL)
425#define MX25_PAD_FEC_TDATA1__AUD4_TXFS IOMUX_PAD(0x3cc, 0x1d4, 0x12, 0x474, 1, NO_PAD_CTRL) 425#define MX25_PAD_FEC_TDATA1__AUD4_TXFS IOMUX_PAD(0x3cc, 0x1d4, 0x12, 0x474, 1, NO_PAD_CTRL)
426#define MX25_PAD_FEC_TDATA1__GPIO_3_8 IOMUX_PAD(0x3cc, 0x1d4, 0x15, 0, 0, NO_PAD_CTRL) 426#define MX25_PAD_FEC_TDATA1__GPIO_3_8 IOMUX_PAD(0x3cc, 0x1d4, 0x15, 0, 0, NO_PAD_CTRL)
427 427
428#define MX25_PAD_FEC_TX_EN__FEC_TX_EN IOMUX_PAD(0x3d0, 0x1d8, 0x10, 0, 0, NO_PAD_CTL) 428#define MX25_PAD_FEC_TX_EN__FEC_TX_EN IOMUX_PAD(0x3d0, 0x1d8, 0x10, 0, 0, NO_PAD_CTRL)
429#define MX25_PAD_FEC_TX_EN__GPIO_3_9 IOMUX_PAD(0x3d0, 0x1d8, 0x15, 0, 0, NO_PAD_CTRL) 429#define MX25_PAD_FEC_TX_EN__GPIO_3_9 IOMUX_PAD(0x3d0, 0x1d8, 0x15, 0, 0, NO_PAD_CTRL)
430 430
431#define MX25_PAD_FEC_RDATA0__FEC_RDATA0 IOMUX_PAD(0x3d4, 0x1dc, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL) 431#define MX25_PAD_FEC_RDATA0__FEC_RDATA0 IOMUX_PAD(0x3d4, 0x1dc, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL)
432#define MX25_PAD_FEC_RDATA0__GPIO_3_10 IOMUX_PAD(0x3d4, 0x1dc, 0x15, 0, 0, NO_PAD_CTRL) 432#define MX25_PAD_FEC_RDATA0__GPIO_3_10 IOMUX_PAD(0x3d4, 0x1dc, 0x15, 0, 0, NO_PAD_CTRL)
433 433
434#define MX25_PAD_FEC_RDATA1__FEC_RDATA1 IOMUX_PAD(0x3d8, 0x1e0, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL) 434#define MX25_PAD_FEC_RDATA1__FEC_RDATA1 IOMUX_PAD(0x3d8, 0x1e0, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL)
435#define MX25_PAD_FEC_RDATA1__GPIO_3_11 IOMUX_PAD(0x3d8, 0x1e0, 0x15, 0, 0, NO_PAD_CTRL) 435#define MX25_PAD_FEC_RDATA1__GPIO_3_11 IOMUX_PAD(0x3d8, 0x1e0, 0x15, 0, 0, NO_PAD_CTRL)
436 436
437#define MX25_PAD_FEC_RX_DV__FEC_RX_DV IOMUX_PAD(0x3dc, 0x1e4, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTL) 437#define MX25_PAD_FEC_RX_DV__FEC_RX_DV IOMUX_PAD(0x3dc, 0x1e4, 0x10, 0, 0, PAD_CTL_PUS_100K_DOWN | NO_PAD_CTRL)
438#define MX25_PAD_FEC_RX_DV__CAN2_RX IOMUX_PAD(0x3dc, 0x1e4, 0x14, 0x484, 0, PAD_CTL_PUS_22K_UP) 438#define MX25_PAD_FEC_RX_DV__CAN2_RX IOMUX_PAD(0x3dc, 0x1e4, 0x14, 0x484, 0, PAD_CTL_PUS_22K_UP)
439#define MX25_PAD_FEC_RX_DV__GPIO_3_12 IOMUX_PAD(0x3dc, 0x1e4, 0x15, 0, 0, NO_PAD_CTRL) 439#define MX25_PAD_FEC_RX_DV__GPIO_3_12 IOMUX_PAD(0x3dc, 0x1e4, 0x15, 0, 0, NO_PAD_CTRL)
440 440
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
index 91e738144804..854e2dc58481 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -41,4 +41,8 @@
41#define UART1_BASE_ADDR 0x43f90000 41#define UART1_BASE_ADDR 0x43f90000
42#define UART2_BASE_ADDR 0x43f94000 42#define UART2_BASE_ADDR 0x43f94000
43 43
44#define MX25_FEC_BASE_ADDR 0x50038000
45
46#define MX25_INT_FEC 57
47
44#endif /* __MACH_MX25_H__ */ 48#endif /* __MACH_MX25_H__ */
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 89cafc937249..d9f8c844c385 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -36,10 +36,6 @@ static struct clk_functions *arch_clock;
36 * Standard clock functions defined in include/linux/clk.h 36 * Standard clock functions defined in include/linux/clk.h
37 *-------------------------------------------------------------------------*/ 37 *-------------------------------------------------------------------------*/
38 38
39/* This functions is moved to arch/arm/common/clkdev.c. For OMAP4 since
40 * clock framework is not up , it is defined here to avoid rework in
41 * every driver. Also dummy prcm reset function is added */
42
43int clk_enable(struct clk *clk) 39int clk_enable(struct clk *clk)
44{ 40{
45 unsigned long flags; 41 unsigned long flags;
@@ -305,7 +301,6 @@ void clk_enable_init_clocks(void)
305 clk_enable(clkp); 301 clk_enable(clkp);
306 } 302 }
307} 303}
308EXPORT_SYMBOL(clk_enable_init_clocks);
309 304
310/* 305/*
311 * Low level helpers 306 * Low level helpers
@@ -334,7 +329,16 @@ void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
334 arch_clock->clk_init_cpufreq_table(table); 329 arch_clock->clk_init_cpufreq_table(table);
335 spin_unlock_irqrestore(&clockfw_lock, flags); 330 spin_unlock_irqrestore(&clockfw_lock, flags);
336} 331}
337EXPORT_SYMBOL(clk_init_cpufreq_table); 332
333void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
334{
335 unsigned long flags;
336
337 spin_lock_irqsave(&clockfw_lock, flags);
338 if (arch_clock->clk_exit_cpufreq_table)
339 arch_clock->clk_exit_cpufreq_table(table);
340 spin_unlock_irqrestore(&clockfw_lock, flags);
341}
338#endif 342#endif
339 343
340/*-------------------------------------------------------------------------*/ 344/*-------------------------------------------------------------------------*/
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index f8ddbdd8b076..6d3d33360056 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -134,6 +134,7 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
134 134
135static int omap_cpu_exit(struct cpufreq_policy *policy) 135static int omap_cpu_exit(struct cpufreq_policy *policy)
136{ 136{
137 clk_exit_cpufreq_table(&freq_table);
137 clk_put(mpu_clk); 138 clk_put(mpu_clk);
138 return 0; 139 return 0;
139} 140}
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 04846811d0aa..d17620c50c28 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -192,6 +192,7 @@ struct gpio_bank {
192 u32 saved_risingdetect; 192 u32 saved_risingdetect;
193#endif 193#endif
194 u32 level_mask; 194 u32 level_mask;
195 u32 toggle_mask;
195 spinlock_t lock; 196 spinlock_t lock;
196 struct gpio_chip chip; 197 struct gpio_chip chip;
197 struct clk *dbck; 198 struct clk *dbck;
@@ -749,6 +750,44 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
749} 750}
750#endif 751#endif
751 752
753/*
754 * This only applies to chips that can't do both rising and falling edge
755 * detection at once. For all other chips, this function is a noop.
756 */
757static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio)
758{
759 void __iomem *reg = bank->base;
760 u32 l = 0;
761
762 switch (bank->method) {
763#ifdef CONFIG_ARCH_OMAP1
764 case METHOD_MPUIO:
765 reg += OMAP_MPUIO_GPIO_INT_EDGE;
766 break;
767#endif
768#ifdef CONFIG_ARCH_OMAP15XX
769 case METHOD_GPIO_1510:
770 reg += OMAP1510_GPIO_INT_CONTROL;
771 break;
772#endif
773#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
774 case METHOD_GPIO_7XX:
775 reg += OMAP7XX_GPIO_INT_CONTROL;
776 break;
777#endif
778 default:
779 return;
780 }
781
782 l = __raw_readl(reg);
783 if ((l >> gpio) & 1)
784 l &= ~(1 << gpio);
785 else
786 l |= 1 << gpio;
787
788 __raw_writel(l, reg);
789}
790
752static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) 791static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
753{ 792{
754 void __iomem *reg = bank->base; 793 void __iomem *reg = bank->base;
@@ -759,6 +798,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
759 case METHOD_MPUIO: 798 case METHOD_MPUIO:
760 reg += OMAP_MPUIO_GPIO_INT_EDGE; 799 reg += OMAP_MPUIO_GPIO_INT_EDGE;
761 l = __raw_readl(reg); 800 l = __raw_readl(reg);
801 if (trigger & IRQ_TYPE_EDGE_BOTH)
802 bank->toggle_mask |= 1 << gpio;
762 if (trigger & IRQ_TYPE_EDGE_RISING) 803 if (trigger & IRQ_TYPE_EDGE_RISING)
763 l |= 1 << gpio; 804 l |= 1 << gpio;
764 else if (trigger & IRQ_TYPE_EDGE_FALLING) 805 else if (trigger & IRQ_TYPE_EDGE_FALLING)
@@ -771,6 +812,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
771 case METHOD_GPIO_1510: 812 case METHOD_GPIO_1510:
772 reg += OMAP1510_GPIO_INT_CONTROL; 813 reg += OMAP1510_GPIO_INT_CONTROL;
773 l = __raw_readl(reg); 814 l = __raw_readl(reg);
815 if (trigger & IRQ_TYPE_EDGE_BOTH)
816 bank->toggle_mask |= 1 << gpio;
774 if (trigger & IRQ_TYPE_EDGE_RISING) 817 if (trigger & IRQ_TYPE_EDGE_RISING)
775 l |= 1 << gpio; 818 l |= 1 << gpio;
776 else if (trigger & IRQ_TYPE_EDGE_FALLING) 819 else if (trigger & IRQ_TYPE_EDGE_FALLING)
@@ -803,6 +846,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
803 case METHOD_GPIO_7XX: 846 case METHOD_GPIO_7XX:
804 reg += OMAP7XX_GPIO_INT_CONTROL; 847 reg += OMAP7XX_GPIO_INT_CONTROL;
805 l = __raw_readl(reg); 848 l = __raw_readl(reg);
849 if (trigger & IRQ_TYPE_EDGE_BOTH)
850 bank->toggle_mask |= 1 << gpio;
806 if (trigger & IRQ_TYPE_EDGE_RISING) 851 if (trigger & IRQ_TYPE_EDGE_RISING)
807 l |= 1 << gpio; 852 l |= 1 << gpio;
808 else if (trigger & IRQ_TYPE_EDGE_FALLING) 853 else if (trigger & IRQ_TYPE_EDGE_FALLING)
@@ -1072,7 +1117,7 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena
1072 */ 1117 */
1073static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) 1118static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
1074{ 1119{
1075 unsigned long flags; 1120 unsigned long uninitialized_var(flags);
1076 1121
1077 switch (bank->method) { 1122 switch (bank->method) {
1078#ifdef CONFIG_ARCH_OMAP16XX 1123#ifdef CONFIG_ARCH_OMAP16XX
@@ -1217,7 +1262,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1217{ 1262{
1218 void __iomem *isr_reg = NULL; 1263 void __iomem *isr_reg = NULL;
1219 u32 isr; 1264 u32 isr;
1220 unsigned int gpio_irq; 1265 unsigned int gpio_irq, gpio_index;
1221 struct gpio_bank *bank; 1266 struct gpio_bank *bank;
1222 u32 retrigger = 0; 1267 u32 retrigger = 0;
1223 int unmasked = 0; 1268 int unmasked = 0;
@@ -1284,9 +1329,23 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1284 1329
1285 gpio_irq = bank->virtual_irq_start; 1330 gpio_irq = bank->virtual_irq_start;
1286 for (; isr != 0; isr >>= 1, gpio_irq++) { 1331 for (; isr != 0; isr >>= 1, gpio_irq++) {
1332 gpio_index = get_gpio_index(irq_to_gpio(gpio_irq));
1333
1287 if (!(isr & 1)) 1334 if (!(isr & 1))
1288 continue; 1335 continue;
1289 1336
1337#ifdef CONFIG_ARCH_OMAP1
1338 /*
1339 * Some chips can't respond to both rising and falling
1340 * at the same time. If this irq was requested with
1341 * both flags, we need to flip the ICR data for the IRQ
1342 * to respond to the IRQ for the opposite direction.
1343 * This will be indicated in the bank toggle_mask.
1344 */
1345 if (bank->toggle_mask & (1 << gpio_index))
1346 _toggle_gpio_edge_triggering(bank, gpio_index);
1347#endif
1348
1290 generic_handle_irq(gpio_irq); 1349 generic_handle_irq(gpio_irq);
1291 } 1350 }
1292 } 1351 }
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
index 376ce18216ff..5cd622039da0 100644
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -99,7 +99,6 @@ struct fb_info;
99struct omap_backlight_config { 99struct omap_backlight_config {
100 int default_intensity; 100 int default_intensity;
101 int (*set_power)(struct device *dev, int state); 101 int (*set_power)(struct device *dev, int state);
102 int (*check_fb)(struct fb_info *fb);
103}; 102};
104 103
105struct omap_fbmem_config { 104struct omap_fbmem_config {
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 309b6d1dccdb..94fe2a0ce40a 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -119,6 +119,7 @@ struct clk_functions {
119 void (*clk_disable_unused)(struct clk *clk); 119 void (*clk_disable_unused)(struct clk *clk);
120#ifdef CONFIG_CPU_FREQ 120#ifdef CONFIG_CPU_FREQ
121 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **); 121 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **);
122 void (*clk_exit_cpufreq_table)(struct cpufreq_frequency_table **);
122#endif 123#endif
123}; 124};
124 125
@@ -135,6 +136,7 @@ extern unsigned long followparent_recalc(struct clk *clk);
135extern void clk_enable_init_clocks(void); 136extern void clk_enable_init_clocks(void);
136#ifdef CONFIG_CPU_FREQ 137#ifdef CONFIG_CPU_FREQ
137extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); 138extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
139extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
138#endif 140#endif
139 141
140extern const struct clkops clkops_null; 142extern const struct clkops clkops_null;
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h
index 2ae884378638..a745d62fad0d 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -147,7 +147,7 @@
147#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) 147#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
148#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) 148#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
149#define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ 149#define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \
150 + ((i) >> 1) * 4 + (!(i) & 1) * 2) 150 + ((i) >> 1) * 4 + (!((i) & 1)) * 2)
151#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) 151#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4)
152#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) 152#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8)
153#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) 153#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0)
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index 7e5319f907d1..a3e7b471bcba 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/plat-omap/include/plat/io.h
@@ -122,16 +122,21 @@
122#define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET) 122#define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET)
123#define OMAP243X_SMS_SIZE SZ_1M 123#define OMAP243X_SMS_SIZE SZ_1M
124 124
125/* DSP */ 125/* 2420 IVA */
126#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ 126#define DSP_MEM_2420_PHYS OMAP2420_DSP_MEM_BASE
127#define DSP_MEM_24XX_VIRT 0xe0000000 127 /* 0x58000000 --> 0xfc100000 */
128#define DSP_MEM_24XX_SIZE 0x28000 128#define DSP_MEM_2420_VIRT 0xfc100000
129#define DSP_IPI_24XX_PHYS OMAP2420_DSP_IPI_BASE /* 0x59000000 */ 129#define DSP_MEM_2420_SIZE 0x28000
130#define DSP_IPI_24XX_VIRT 0xe1000000 130#define DSP_IPI_2420_PHYS OMAP2420_DSP_IPI_BASE
131#define DSP_IPI_24XX_SIZE SZ_4K 131 /* 0x59000000 --> 0xfc128000 */
132#define DSP_MMU_24XX_PHYS OMAP2420_DSP_MMU_BASE /* 0x5a000000 */ 132#define DSP_IPI_2420_VIRT 0xfc128000
133#define DSP_MMU_24XX_VIRT 0xe2000000 133#define DSP_IPI_2420_SIZE SZ_4K
134#define DSP_MMU_24XX_SIZE SZ_4K 134#define DSP_MMU_2420_PHYS OMAP2420_DSP_MMU_BASE
135 /* 0x5a000000 --> 0xfc129000 */
136#define DSP_MMU_2420_VIRT 0xfc129000
137#define DSP_MMU_2420_SIZE SZ_4K
138
139/* 2430 IVA2.1 - currently unmapped */
135 140
136/* 141/*
137 * ---------------------------------------------------------------------------- 142 * ----------------------------------------------------------------------------
@@ -182,16 +187,7 @@
182#define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET) 187#define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET)
183#define OMAP343X_SDRC_SIZE SZ_1M 188#define OMAP343X_SDRC_SIZE SZ_1M
184 189
185/* DSP */ 190/* 3430 IVA - currently unmapped */
186#define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */
187#define DSP_MEM_34XX_VIRT 0xe0000000
188#define DSP_MEM_34XX_SIZE 0x28000
189#define DSP_IPI_34XX_PHYS OMAP34XX_DSP_IPI_BASE /* 0x59000000 */
190#define DSP_IPI_34XX_VIRT 0xe1000000
191#define DSP_IPI_34XX_SIZE SZ_4K
192#define DSP_MMU_34XX_PHYS OMAP34XX_DSP_MMU_BASE /* 0x5a000000 */
193#define DSP_MMU_34XX_VIRT 0xe2000000
194#define DSP_MMU_34XX_SIZE SZ_4K
195 191
196/* 192/*
197 * ---------------------------------------------------------------------------- 193 * ----------------------------------------------------------------------------
diff --git a/arch/arm/plat-omap/include/plat/mux.h b/arch/arm/plat-omap/include/plat/mux.h
index 8f069cc80350..692c90e89ac3 100644
--- a/arch/arm/plat-omap/include/plat/mux.h
+++ b/arch/arm/plat-omap/include/plat/mux.h
@@ -183,6 +183,14 @@ enum omap7xx_index {
183 /* I2C */ 183 /* I2C */
184 I2C_7XX_SCL, 184 I2C_7XX_SCL,
185 I2C_7XX_SDA, 185 I2C_7XX_SDA,
186
187 /* SPI */
188 SPI_7XX_1,
189 SPI_7XX_2,
190 SPI_7XX_3,
191 SPI_7XX_4,
192 SPI_7XX_5,
193 SPI_7XX_6,
186}; 194};
187 195
188enum omap1xxx_index { 196enum omap1xxx_index {
diff --git a/arch/arm/plat-omap/include/plat/omap7xx.h b/arch/arm/plat-omap/include/plat/omap7xx.h
index 53f52414b0e9..48e4757e1e30 100644
--- a/arch/arm/plat-omap/include/plat/omap7xx.h
+++ b/arch/arm/plat-omap/include/plat/omap7xx.h
@@ -46,6 +46,9 @@
46#define OMAP7XX_DSPREG_SIZE SZ_128K 46#define OMAP7XX_DSPREG_SIZE SZ_128K
47#define OMAP7XX_DSPREG_START 0xE1000000 47#define OMAP7XX_DSPREG_START 0xE1000000
48 48
49#define OMAP7XX_SPI1_BASE 0xfffc0800
50#define OMAP7XX_SPI2_BASE 0xfffc1000
51
49/* 52/*
50 * ---------------------------------------------------------------------------- 53 * ----------------------------------------------------------------------------
51 * OMAP7XX specific configuration registers 54 * OMAP7XX specific configuration registers
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c
index 11f5d7961c73..0cfd54f519c4 100644
--- a/arch/arm/plat-omap/io.c
+++ b/arch/arm/plat-omap/io.c
@@ -66,12 +66,12 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
66 return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT); 66 return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT);
67 } 67 }
68 if (cpu_is_omap2420()) { 68 if (cpu_is_omap2420()) {
69 if (BETWEEN(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_SIZE)) 69 if (BETWEEN(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_SIZE))
70 return XLATE(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_VIRT); 70 return XLATE(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_VIRT);
71 if (BETWEEN(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE)) 71 if (BETWEEN(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE))
72 return XLATE(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE); 72 return XLATE(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE);
73 if (BETWEEN(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_SIZE)) 73 if (BETWEEN(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_SIZE))
74 return XLATE(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_VIRT); 74 return XLATE(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_VIRT);
75 } 75 }
76 if (cpu_is_omap2430()) { 76 if (cpu_is_omap2430()) {
77 if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE)) 77 if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE))
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index c0ff1e39d893..463d6386aff2 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -827,7 +827,7 @@ EXPORT_SYMBOL_GPL(iommu_get);
827 **/ 827 **/
828void iommu_put(struct iommu *obj) 828void iommu_put(struct iommu *obj)
829{ 829{
830 if (!obj && IS_ERR(obj)) 830 if (!obj || IS_ERR(obj))
831 return; 831 return;
832 832
833 mutex_lock(&obj->iommu_lock); 833 mutex_lock(&obj->iommu_lock);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 2cc1cc328bac..f75767278fc3 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -436,7 +436,7 @@ int omap_mcbsp_request(unsigned int id)
436 dev_err(mcbsp->dev, "Unable to request TX IRQ %d " 436 dev_err(mcbsp->dev, "Unable to request TX IRQ %d "
437 "for McBSP%d\n", mcbsp->tx_irq, 437 "for McBSP%d\n", mcbsp->tx_irq,
438 mcbsp->id); 438 mcbsp->id);
439 return err; 439 goto error;
440 } 440 }
441 441
442 init_completion(&mcbsp->rx_irq_completion); 442 init_completion(&mcbsp->rx_irq_completion);
@@ -446,12 +446,26 @@ int omap_mcbsp_request(unsigned int id)
446 dev_err(mcbsp->dev, "Unable to request RX IRQ %d " 446 dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
447 "for McBSP%d\n", mcbsp->rx_irq, 447 "for McBSP%d\n", mcbsp->rx_irq,
448 mcbsp->id); 448 mcbsp->id);
449 free_irq(mcbsp->tx_irq, (void *)mcbsp); 449 goto tx_irq;
450 return err;
451 } 450 }
452 } 451 }
453 452
454 return 0; 453 return 0;
454tx_irq:
455 free_irq(mcbsp->tx_irq, (void *)mcbsp);
456error:
457 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
458 mcbsp->pdata->ops->free(id);
459
460 /* Do procedure specific to omap34xx arch, if applicable */
461 omap34xx_mcbsp_free(mcbsp);
462
463 clk_disable(mcbsp->fclk);
464 clk_disable(mcbsp->iclk);
465
466 mcbsp->free = 1;
467
468 return err;
455} 469}
456EXPORT_SYMBOL(omap_mcbsp_request); 470EXPORT_SYMBOL(omap_mcbsp_request);
457 471
diff --git a/arch/arm/plat-pxa/pwm.c b/arch/arm/plat-pxa/pwm.c
index a9eabdcfa163..51dc5c8106c0 100644
--- a/arch/arm/plat-pxa/pwm.c
+++ b/arch/arm/plat-pxa/pwm.c
@@ -204,14 +204,14 @@ static int __devinit pwm_probe(struct platform_device *pdev)
204 goto err_free_clk; 204 goto err_free_clk;
205 } 205 }
206 206
207 r = request_mem_region(r->start, r->end - r->start + 1, pdev->name); 207 r = request_mem_region(r->start, resource_size(r), pdev->name);
208 if (r == NULL) { 208 if (r == NULL) {
209 dev_err(&pdev->dev, "failed to request memory resource\n"); 209 dev_err(&pdev->dev, "failed to request memory resource\n");
210 ret = -EBUSY; 210 ret = -EBUSY;
211 goto err_free_clk; 211 goto err_free_clk;
212 } 212 }
213 213
214 pwm->mmio_base = ioremap(r->start, r->end - r->start + 1); 214 pwm->mmio_base = ioremap(r->start, resource_size(r));
215 if (pwm->mmio_base == NULL) { 215 if (pwm->mmio_base == NULL) {
216 dev_err(&pdev->dev, "failed to ioremap() registers\n"); 216 dev_err(&pdev->dev, "failed to ioremap() registers\n");
217 ret = -ENODEV; 217 ret = -ENODEV;
@@ -241,7 +241,7 @@ static int __devinit pwm_probe(struct platform_device *pdev)
241 return 0; 241 return 0;
242 242
243err_free_mem: 243err_free_mem:
244 release_mem_region(r->start, r->end - r->start + 1); 244 release_mem_region(r->start, resource_size(r));
245err_free_clk: 245err_free_clk:
246 clk_put(pwm->clk); 246 clk_put(pwm->clk);
247err_free: 247err_free:
@@ -271,7 +271,7 @@ static int __devexit pwm_remove(struct platform_device *pdev)
271 iounmap(pwm->mmio_base); 271 iounmap(pwm->mmio_base);
272 272
273 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 273 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
274 release_mem_region(r->start, r->end - r->start + 1); 274 release_mem_region(r->start, resource_size(r));
275 275
276 clk_put(pwm->clk); 276 clk_put(pwm->clk);
277 kfree(pwm); 277 kfree(pwm);
diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
index e771e77dcd54..84808ccda70e 100644
--- a/arch/arm/plat-s3c/dev-nand.c
+++ b/arch/arm/plat-s3c/dev-nand.c
@@ -114,7 +114,7 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
114 114
115 for (i = 0; i < npd->nr_sets; i++) { 115 for (i = 0; i < npd->nr_sets; i++) {
116 ret = s3c_nand_copy_set(to); 116 ret = s3c_nand_copy_set(to);
117 if (!ret) { 117 if (ret) {
118 printk(KERN_ERR "%s: failed to copy set %d\n", 118 printk(KERN_ERR "%s: failed to copy set %d\n",
119 __func__, i); 119 __func__, i);
120 return; 120 return;
@@ -122,6 +122,8 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
122 to++; 122 to++;
123 } 123 }
124 } 124 }
125
126 s3c_device_nand.dev.platform_data = npd;
125} 127}
126 128
127EXPORT_SYMBOL_GPL(s3c_nand_set_platdata); 129EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
diff --git a/arch/arm/plat-s3c/include/plat/devs.h b/arch/arm/plat-s3c/include/plat/devs.h
index 932cbbbb4273..c1c20b023917 100644
--- a/arch/arm/plat-s3c/include/plat/devs.h
+++ b/arch/arm/plat-s3c/include/plat/devs.h
@@ -31,6 +31,7 @@ extern struct platform_device s3c64xx_device_iisv4;
31extern struct platform_device s3c64xx_device_pcm0; 31extern struct platform_device s3c64xx_device_pcm0;
32extern struct platform_device s3c64xx_device_pcm1; 32extern struct platform_device s3c64xx_device_pcm1;
33 33
34extern struct platform_device s3c_device_ts;
34extern struct platform_device s3c_device_fb; 35extern struct platform_device s3c_device_fb;
35extern struct platform_device s3c_device_usb; 36extern struct platform_device s3c_device_usb;
36extern struct platform_device s3c_device_lcd; 37extern struct platform_device s3c_device_lcd;
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index f52a92ce8dda..7f686a31e672 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -37,6 +37,8 @@
37#include <plat/cpu.h> 37#include <plat/cpu.h>
38#include <plat/regs-spi.h> 38#include <plat/regs-spi.h>
39 39
40#include <mach/ts.h>
41
40/* Serial port registrations */ 42/* Serial port registrations */
41 43
42static struct resource s3c2410_uart0_resource[] = { 44static struct resource s3c2410_uart0_resource[] = {
@@ -182,6 +184,22 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
182 } 184 }
183} 185}
184 186
187/* Touchscreen */
188struct platform_device s3c_device_ts = {
189 .name = "s3c2410-ts",
190 .id = -1,
191};
192EXPORT_SYMBOL(s3c_device_ts);
193
194static struct s3c2410_ts_mach_info s3c2410ts_info;
195
196void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
197{
198 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info));
199 s3c_device_ts.dev.platform_data = &s3c2410ts_info;
200}
201EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
202
185/* USB Device (Gadget)*/ 203/* USB Device (Gadget)*/
186 204
187static struct resource s3c_usbgadget_resource[] = { 205static struct resource s3c_usbgadget_resource[] = {
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
index 1364317d421e..12623a474b54 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.c
+++ b/arch/arm/plat-s3c24xx/s3c244x.c
@@ -70,6 +70,7 @@ void __init s3c244x_map_io(void)
70 s3c_device_sdi.name = "s3c2440-sdi"; 70 s3c_device_sdi.name = "s3c2440-sdi";
71 s3c_device_i2c0.name = "s3c2440-i2c"; 71 s3c_device_i2c0.name = "s3c2440-i2c";
72 s3c_device_nand.name = "s3c2440-nand"; 72 s3c_device_nand.name = "s3c2440-nand";
73 s3c_device_ts.name = "s3c2440-ts";
73 s3c_device_usbgadget.name = "s3c2440-usbgadget"; 74 s3c_device_usbgadget.name = "s3c2440-usbgadget";
74} 75}
75 76
diff --git a/arch/arm/plat-s3c64xx/s3c6400-clock.c b/arch/arm/plat-s3c64xx/s3c6400-clock.c
index 6ffa21eb1b91..ffd56deb9e81 100644
--- a/arch/arm/plat-s3c64xx/s3c6400-clock.c
+++ b/arch/arm/plat-s3c64xx/s3c6400-clock.c
@@ -46,6 +46,7 @@ static struct clk clk_ext_xtal_mux = {
46#define clk_fin_epll clk_ext_xtal_mux 46#define clk_fin_epll clk_ext_xtal_mux
47 47
48#define clk_fout_mpll clk_mpll 48#define clk_fout_mpll clk_mpll
49#define clk_fout_epll clk_epll
49 50
50struct clk_sources { 51struct clk_sources {
51 unsigned int nr_sources; 52 unsigned int nr_sources;
@@ -88,11 +89,6 @@ static struct clksrc_clk clk_mout_apll = {
88 .sources = &clk_src_apll, 89 .sources = &clk_src_apll,
89}; 90};
90 91
91static struct clk clk_fout_epll = {
92 .name = "fout_epll",
93 .id = -1,
94};
95
96static struct clk *clk_src_epll_list[] = { 92static struct clk *clk_src_epll_list[] = {
97 [0] = &clk_fin_epll, 93 [0] = &clk_fin_epll,
98 [1] = &clk_fout_epll, 94 [1] = &clk_fout_epll,
@@ -715,7 +711,6 @@ static struct clk *clks[] __initdata = {
715 &clk_iis_cd1, 711 &clk_iis_cd1,
716 &clk_pcm_cd, 712 &clk_pcm_cd,
717 &clk_mout_epll.clk, 713 &clk_mout_epll.clk,
718 &clk_fout_epll,
719 &clk_mout_mpll.clk, 714 &clk_mout_mpll.clk,
720 &clk_dout_mpll, 715 &clk_dout_mpll,
721 &clk_mmc0.clk, 716 &clk_mmc0.clk,
@@ -760,7 +755,4 @@ void __init s3c6400_register_clocks(unsigned armclk_divlimit)
760 clkp->name, ret); 755 clkp->name, ret);
761 } 756 }
762 } 757 }
763
764 clk_mpll.parent = &clk_mout_mpll.clk;
765 clk_epll.parent = &clk_mout_epll.clk;
766} 758}
diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 1dbaa29ac4d7..635cb1865e4d 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -4,7 +4,7 @@
4# Copyright (C) 2001 Russell King 4# Copyright (C) 2001 Russell King
5# 5#
6 6
7include/asm-arm/mach-types.h: $(src)/gen-mach-types $(src)/mach-types 7include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
8 @echo ' Generating $@' 8 @echo ' Generating $@'
9 @mkdir -p $(dir $@) 9 @mkdir -p $(dir $@)
10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/arm/tools/gen-mach-types b/arch/arm/tools/gen-mach-types
index ce319ef64bc1..04fef71d7be9 100644
--- a/arch/arm/tools/gen-mach-types
+++ b/arch/arm/tools/gen-mach-types
@@ -1,6 +1,6 @@
1#!/bin/awk 1#!/bin/awk
2# 2#
3# Awk script to generate include/asm-arm/mach-types.h 3# Awk script to generate include/generated/mach-types.h
4# 4#
5BEGIN { nr = 0 } 5BEGIN { nr = 0 }
6/^#/ { next } 6/^#/ { next }
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 07b976da6174..c3a74ce24ef6 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Wed Nov 25 22:14:58 2009 15# Last update: Wed Dec 16 20:06:34 2009
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -1776,6 +1776,7 @@ cybook3 MACH_CYBOOK3 CYBOOK3 1784
1776wdg002 MACH_WDG002 WDG002 1785 1776wdg002 MACH_WDG002 WDG002 1785
1777sg560adsl MACH_SG560ADSL SG560ADSL 1786 1777sg560adsl MACH_SG560ADSL SG560ADSL 1786
1778nextio_n2800_ica MACH_NEXTIO_N2800_ICA NEXTIO_N2800_ICA 1787 1778nextio_n2800_ica MACH_NEXTIO_N2800_ICA NEXTIO_N2800_ICA 1787
1779dove_db MACH_DOVE_DB DOVE_DB 1788
1779marvell_newdb MACH_MARVELL_NEWDB MARVELL_NEWDB 1789 1780marvell_newdb MACH_MARVELL_NEWDB MARVELL_NEWDB 1789
1780vandihud MACH_VANDIHUD VANDIHUD 1790 1781vandihud MACH_VANDIHUD VANDIHUD 1790
1781magx_e8 MACH_MAGX_E8 MAGX_E8 1791 1782magx_e8 MACH_MAGX_E8 MAGX_E8 1791
@@ -2536,3 +2537,44 @@ c3ax03 MACH_C3AX03 C3AX03 2549
2536mxt_td60 MACH_MXT_TD60 MXT_TD60 2550 2537mxt_td60 MACH_MXT_TD60 MXT_TD60 2550
2537esyx MACH_ESYX ESYX 2551 2538esyx MACH_ESYX ESYX 2551
2538bulldog MACH_BULLDOG BULLDOG 2553 2539bulldog MACH_BULLDOG BULLDOG 2553
2540derell_me2000 MACH_DERELL_ME2000 DERELL_ME2000 2554
2541bcmring_base MACH_BCMRING_BASE BCMRING_BASE 2555
2542bcmring_evm MACH_BCMRING_EVM BCMRING_EVM 2556
2543bcmring_evm_jazz MACH_BCMRING_EVM_JAZZ BCMRING_EVM_JAZZ 2557
2544bcmring_sp MACH_BCMRING_SP BCMRING_SP 2558
2545bcmring_sv MACH_BCMRING_SV BCMRING_SV 2559
2546bcmring_sv_jazz MACH_BCMRING_SV_JAZZ BCMRING_SV_JAZZ 2560
2547bcmring_tablet MACH_BCMRING_TABLET BCMRING_TABLET 2561
2548bcmring_vp MACH_BCMRING_VP BCMRING_VP 2562
2549bcmring_evm_seikor MACH_BCMRING_EVM_SEIKOR BCMRING_EVM_SEIKOR 2563
2550bcmring_sp_wqvga MACH_BCMRING_SP_WQVGA BCMRING_SP_WQVGA 2564
2551bcmring_custom MACH_BCMRING_CUSTOM BCMRING_CUSTOM 2565
2552acer_s200 MACH_ACER_S200 ACER_S200 2566
2553bt270 MACH_BT270 BT270 2567
2554iseo MACH_ISEO ISEO 2568
2555cezanne MACH_CEZANNE CEZANNE 2569
2556lucca MACH_LUCCA LUCCA 2570
2557supersmart MACH_SUPERSMART SUPERSMART 2571
2558magnolia2 MACH_MAGNOLIA2 MAGNOLIA2 2573
2559emxx MACH_EMXX EMXX 2574
2560outlaw MACH_OUTLAW OUTLAW 2575
2561riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576
2562riot_vox MACH_RIOT_VOX RIOT_VOX 2577
2563riot_x37 MACH_RIOT_X37 RIOT_X37 2578
2564mega25mx MACH_MEGA25MX MEGA25MX 2579
2565benzina2 MACH_BENZINA2 BENZINA2 2580
2566ignite MACH_IGNITE IGNITE 2581
2567foggia MACH_FOGGIA FOGGIA 2582
2568arezzo MACH_AREZZO AREZZO 2583
2569leica_skywalker MACH_LEICA_SKYWALKER LEICA_SKYWALKER 2584
2570jacinto2_jamr MACH_JACINTO2_JAMR JACINTO2_JAMR 2585
2571gts_nova MACH_GTS_NOVA GTS_NOVA 2586
2572p3600 MACH_P3600 P3600 2587
2573dlt2 MACH_DLT2 DLT2 2588
2574df3120 MACH_DF3120 DF3120 2589
2575ecucore_9g20 MACH_ECUCORE_9G20 ECUCORE_9G20 2590
2576nautel_lpc3240 MACH_NAUTEL_LPC3240 NAUTEL_LPC3240 2591
2577glacier MACH_GLACIER GLACIER 2592
2578phrazer_bulldog MACH_PHRAZER_BULLDOG PHRAZER_BULLDOG 2593
2579omap3_bulldog MACH_OMAP3_BULLDOG OMAP3_BULLDOG 2594
2580pca101 MACH_PCA101 PCA101 2595
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index aed05bc3c2ea..f60a5400a25b 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -63,14 +63,15 @@ static void vfp_thread_flush(struct thread_info *thread)
63 put_cpu(); 63 put_cpu();
64} 64}
65 65
66static void vfp_thread_release(struct thread_info *thread) 66static void vfp_thread_exit(struct thread_info *thread)
67{ 67{
68 /* release case: Per-thread VFP cleanup. */ 68 /* release case: Per-thread VFP cleanup. */
69 union vfp_state *vfp = &thread->vfpstate; 69 union vfp_state *vfp = &thread->vfpstate;
70 unsigned int cpu = thread->cpu; 70 unsigned int cpu = get_cpu();
71 71
72 if (last_VFP_context[cpu] == vfp) 72 if (last_VFP_context[cpu] == vfp)
73 last_VFP_context[cpu] = NULL; 73 last_VFP_context[cpu] = NULL;
74 put_cpu();
74} 75}
75 76
76/* 77/*
@@ -88,11 +89,13 @@ static void vfp_thread_release(struct thread_info *thread)
88 * but may change at any time. 89 * but may change at any time.
89 * - we could be preempted if tree preempt rcu is enabled, so 90 * - we could be preempted if tree preempt rcu is enabled, so
90 * it is unsafe to use thread->cpu. 91 * it is unsafe to use thread->cpu.
91 * THREAD_NOTIFY_RELEASE: 92 * THREAD_NOTIFY_EXIT
92 * - the thread (v) will not be running on any CPU; it is a dead thread. 93 * - the thread (v) will be running on the local CPU, so
93 * - thread->cpu will be the last CPU the thread ran on, which may not 94 * v === current_thread_info()
94 * be the current CPU. 95 * - thread->cpu is the local CPU number at the time it is accessed,
95 * - we could be preempted if tree preempt rcu is enabled. 96 * but may change at any time.
97 * - we could be preempted if tree preempt rcu is enabled, so
98 * it is unsafe to use thread->cpu.
96 */ 99 */
97static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) 100static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
98{ 101{
@@ -133,7 +136,7 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
133 if (cmd == THREAD_NOTIFY_FLUSH) 136 if (cmd == THREAD_NOTIFY_FLUSH)
134 vfp_thread_flush(thread); 137 vfp_thread_flush(thread);
135 else 138 else
136 vfp_thread_release(thread); 139 vfp_thread_exit(thread);
137 140
138 return NOTIFY_DONE; 141 return NOTIFY_DONE;
139} 142}
diff --git a/arch/avr32/include/asm/asm-offsets.h b/arch/avr32/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/avr32/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/blackfin/include/asm/asm-offsets.h b/arch/blackfin/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/blackfin/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h
index 944a07c6cfd6..1d04e4078340 100644
--- a/arch/blackfin/include/asm/page.h
+++ b/arch/blackfin/include/asm/page.h
@@ -10,4 +10,9 @@
10#include <asm-generic/page.h> 10#include <asm-generic/page.h>
11#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 11#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
12 12
13#define VM_DATA_DEFAULT_FLAGS \
14 (VM_READ | VM_WRITE | \
15 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
16 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
17
13#endif 18#endif
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c
index f1036b6b9293..34c7c3ed2c9c 100644
--- a/arch/blackfin/kernel/kgdb.c
+++ b/arch/blackfin/kernel/kgdb.c
@@ -6,23 +6,9 @@
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
8 8
9#include <linux/string.h>
10#include <linux/kernel.h>
11#include <linux/sched.h>
12#include <linux/smp.h>
13#include <linux/spinlock.h>
14#include <linux/delay.h>
15#include <linux/ptrace.h> /* for linux pt_regs struct */ 9#include <linux/ptrace.h> /* for linux pt_regs struct */
16#include <linux/kgdb.h> 10#include <linux/kgdb.h>
17#include <linux/console.h>
18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/irq.h>
21#include <linux/uaccess.h> 11#include <linux/uaccess.h>
22#include <asm/system.h>
23#include <asm/traps.h>
24#include <asm/blackfin.h>
25#include <asm/dma.h>
26 12
27void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 13void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
28{ 14{
@@ -147,7 +133,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
147 regs->lb1 = gdb_regs[BFIN_LB1]; 133 regs->lb1 = gdb_regs[BFIN_LB1];
148 regs->usp = gdb_regs[BFIN_USP]; 134 regs->usp = gdb_regs[BFIN_USP];
149 regs->syscfg = gdb_regs[BFIN_SYSCFG]; 135 regs->syscfg = gdb_regs[BFIN_SYSCFG];
150 regs->retx = gdb_regs[BFIN_PC]; 136 regs->retx = gdb_regs[BFIN_RETX];
151 regs->retn = gdb_regs[BFIN_RETN]; 137 regs->retn = gdb_regs[BFIN_RETN];
152 regs->rete = gdb_regs[BFIN_RETE]; 138 regs->rete = gdb_regs[BFIN_RETE];
153 regs->pc = gdb_regs[BFIN_PC]; 139 regs->pc = gdb_regs[BFIN_PC];
@@ -424,182 +410,6 @@ struct kgdb_arch arch_kgdb_ops = {
424 .correct_hw_break = bfin_correct_hw_break, 410 .correct_hw_break = bfin_correct_hw_break,
425}; 411};
426 412
427static int hex(char ch)
428{
429 if ((ch >= 'a') && (ch <= 'f'))
430 return ch - 'a' + 10;
431 if ((ch >= '0') && (ch <= '9'))
432 return ch - '0';
433 if ((ch >= 'A') && (ch <= 'F'))
434 return ch - 'A' + 10;
435 return -1;
436}
437
438static int validate_memory_access_address(unsigned long addr, int size)
439{
440 if (size < 0 || addr == 0)
441 return -EFAULT;
442 return bfin_mem_access_type(addr, size);
443}
444
445static int bfin_probe_kernel_read(char *dst, char *src, int size)
446{
447 unsigned long lsrc = (unsigned long)src;
448 int mem_type;
449
450 mem_type = validate_memory_access_address(lsrc, size);
451 if (mem_type < 0)
452 return mem_type;
453
454 if (lsrc >= SYSMMR_BASE) {
455 if (size == 2 && lsrc % 2 == 0) {
456 u16 mmr = bfin_read16(src);
457 memcpy(dst, &mmr, sizeof(mmr));
458 return 0;
459 } else if (size == 4 && lsrc % 4 == 0) {
460 u32 mmr = bfin_read32(src);
461 memcpy(dst, &mmr, sizeof(mmr));
462 return 0;
463 }
464 } else {
465 switch (mem_type) {
466 case BFIN_MEM_ACCESS_CORE:
467 case BFIN_MEM_ACCESS_CORE_ONLY:
468 return probe_kernel_read(dst, src, size);
469 /* XXX: should support IDMA here with SMP */
470 case BFIN_MEM_ACCESS_DMA:
471 if (dma_memcpy(dst, src, size))
472 return 0;
473 break;
474 case BFIN_MEM_ACCESS_ITEST:
475 if (isram_memcpy(dst, src, size))
476 return 0;
477 break;
478 }
479 }
480
481 return -EFAULT;
482}
483
484static int bfin_probe_kernel_write(char *dst, char *src, int size)
485{
486 unsigned long ldst = (unsigned long)dst;
487 int mem_type;
488
489 mem_type = validate_memory_access_address(ldst, size);
490 if (mem_type < 0)
491 return mem_type;
492
493 if (ldst >= SYSMMR_BASE) {
494 if (size == 2 && ldst % 2 == 0) {
495 u16 mmr;
496 memcpy(&mmr, src, sizeof(mmr));
497 bfin_write16(dst, mmr);
498 return 0;
499 } else if (size == 4 && ldst % 4 == 0) {
500 u32 mmr;
501 memcpy(&mmr, src, sizeof(mmr));
502 bfin_write32(dst, mmr);
503 return 0;
504 }
505 } else {
506 switch (mem_type) {
507 case BFIN_MEM_ACCESS_CORE:
508 case BFIN_MEM_ACCESS_CORE_ONLY:
509 return probe_kernel_write(dst, src, size);
510 /* XXX: should support IDMA here with SMP */
511 case BFIN_MEM_ACCESS_DMA:
512 if (dma_memcpy(dst, src, size))
513 return 0;
514 break;
515 case BFIN_MEM_ACCESS_ITEST:
516 if (isram_memcpy(dst, src, size))
517 return 0;
518 break;
519 }
520 }
521
522 return -EFAULT;
523}
524
525/*
526 * Convert the memory pointed to by mem into hex, placing result in buf.
527 * Return a pointer to the last char put in buf (null). May return an error.
528 */
529int kgdb_mem2hex(char *mem, char *buf, int count)
530{
531 char *tmp;
532 int err;
533
534 /*
535 * We use the upper half of buf as an intermediate buffer for the
536 * raw memory copy. Hex conversion will work against this one.
537 */
538 tmp = buf + count;
539
540 err = bfin_probe_kernel_read(tmp, mem, count);
541 if (!err) {
542 while (count > 0) {
543 buf = pack_hex_byte(buf, *tmp);
544 tmp++;
545 count--;
546 }
547
548 *buf = 0;
549 }
550
551 return err;
552}
553
554/*
555 * Copy the binary array pointed to by buf into mem. Fix $, #, and
556 * 0x7d escaped with 0x7d. Return a pointer to the character after
557 * the last byte written.
558 */
559int kgdb_ebin2mem(char *buf, char *mem, int count)
560{
561 char *tmp_old, *tmp_new;
562 int size;
563
564 tmp_old = tmp_new = buf;
565
566 for (size = 0; size < count; ++size) {
567 if (*tmp_old == 0x7d)
568 *tmp_new = *(++tmp_old) ^ 0x20;
569 else
570 *tmp_new = *tmp_old;
571 tmp_new++;
572 tmp_old++;
573 }
574
575 return bfin_probe_kernel_write(mem, buf, count);
576}
577
578/*
579 * Convert the hex array pointed to by buf into binary to be placed in mem.
580 * Return a pointer to the character AFTER the last byte written.
581 * May return an error.
582 */
583int kgdb_hex2mem(char *buf, char *mem, int count)
584{
585 char *tmp_raw, *tmp_hex;
586
587 /*
588 * We use the upper half of buf as an intermediate buffer for the
589 * raw memory that is converted from hex.
590 */
591 tmp_raw = buf + count * 2;
592
593 tmp_hex = tmp_raw - 1;
594 while (tmp_hex >= buf) {
595 tmp_raw--;
596 *tmp_raw = hex(*tmp_hex--);
597 *tmp_raw |= hex(*tmp_hex--) << 4;
598 }
599
600 return bfin_probe_kernel_write(mem, tmp_raw, count);
601}
602
603#define IN_MEM(addr, size, l1_addr, l1_size) \ 413#define IN_MEM(addr, size, l1_addr, l1_size) \
604({ \ 414({ \
605 unsigned long __addr = (unsigned long)(addr); \ 415 unsigned long __addr = (unsigned long)(addr); \
@@ -629,21 +439,6 @@ int kgdb_validate_break_address(unsigned long addr)
629 return -EFAULT; 439 return -EFAULT;
630} 440}
631 441
632int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr)
633{
634 int err = bfin_probe_kernel_read(saved_instr, (char *)addr,
635 BREAK_INSTR_SIZE);
636 if (err)
637 return err;
638 return bfin_probe_kernel_write((char *)addr, arch_kgdb_ops.gdb_bpt_instr,
639 BREAK_INSTR_SIZE);
640}
641
642int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle)
643{
644 return bfin_probe_kernel_write((char *)addr, bundle, BREAK_INSTR_SIZE);
645}
646
647int kgdb_arch_init(void) 442int kgdb_arch_init(void)
648{ 443{
649 kgdb_single_step = 0; 444 kgdb_single_step = 0;
diff --git a/arch/blackfin/mm/Makefile b/arch/blackfin/mm/Makefile
index d489f894f4b1..4c011b1f661f 100644
--- a/arch/blackfin/mm/Makefile
+++ b/arch/blackfin/mm/Makefile
@@ -2,4 +2,4 @@
2# arch/blackfin/mm/Makefile 2# arch/blackfin/mm/Makefile
3# 3#
4 4
5obj-y := sram-alloc.o isram-driver.o init.o 5obj-y := sram-alloc.o isram-driver.o init.o maccess.o
diff --git a/arch/blackfin/mm/maccess.c b/arch/blackfin/mm/maccess.c
new file mode 100644
index 000000000000..b71cebc1f8a3
--- /dev/null
+++ b/arch/blackfin/mm/maccess.c
@@ -0,0 +1,97 @@
1/*
2 * safe read and write memory routines callable while atomic
3 *
4 * Copyright 2005-2008 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/uaccess.h>
10#include <asm/dma.h>
11
12static int validate_memory_access_address(unsigned long addr, int size)
13{
14 if (size < 0 || addr == 0)
15 return -EFAULT;
16 return bfin_mem_access_type(addr, size);
17}
18
19long probe_kernel_read(void *dst, void *src, size_t size)
20{
21 unsigned long lsrc = (unsigned long)src;
22 int mem_type;
23
24 mem_type = validate_memory_access_address(lsrc, size);
25 if (mem_type < 0)
26 return mem_type;
27
28 if (lsrc >= SYSMMR_BASE) {
29 if (size == 2 && lsrc % 2 == 0) {
30 u16 mmr = bfin_read16(src);
31 memcpy(dst, &mmr, sizeof(mmr));
32 return 0;
33 } else if (size == 4 && lsrc % 4 == 0) {
34 u32 mmr = bfin_read32(src);
35 memcpy(dst, &mmr, sizeof(mmr));
36 return 0;
37 }
38 } else {
39 switch (mem_type) {
40 case BFIN_MEM_ACCESS_CORE:
41 case BFIN_MEM_ACCESS_CORE_ONLY:
42 return __probe_kernel_read(dst, src, size);
43 /* XXX: should support IDMA here with SMP */
44 case BFIN_MEM_ACCESS_DMA:
45 if (dma_memcpy(dst, src, size))
46 return 0;
47 break;
48 case BFIN_MEM_ACCESS_ITEST:
49 if (isram_memcpy(dst, src, size))
50 return 0;
51 break;
52 }
53 }
54
55 return -EFAULT;
56}
57
58long probe_kernel_write(void *dst, void *src, size_t size)
59{
60 unsigned long ldst = (unsigned long)dst;
61 int mem_type;
62
63 mem_type = validate_memory_access_address(ldst, size);
64 if (mem_type < 0)
65 return mem_type;
66
67 if (ldst >= SYSMMR_BASE) {
68 if (size == 2 && ldst % 2 == 0) {
69 u16 mmr;
70 memcpy(&mmr, src, sizeof(mmr));
71 bfin_write16(dst, mmr);
72 return 0;
73 } else if (size == 4 && ldst % 4 == 0) {
74 u32 mmr;
75 memcpy(&mmr, src, sizeof(mmr));
76 bfin_write32(dst, mmr);
77 return 0;
78 }
79 } else {
80 switch (mem_type) {
81 case BFIN_MEM_ACCESS_CORE:
82 case BFIN_MEM_ACCESS_CORE_ONLY:
83 return __probe_kernel_write(dst, src, size);
84 /* XXX: should support IDMA here with SMP */
85 case BFIN_MEM_ACCESS_DMA:
86 if (dma_memcpy(dst, src, size))
87 return 0;
88 break;
89 case BFIN_MEM_ACCESS_ITEST:
90 if (isram_memcpy(dst, src, size))
91 return 0;
92 break;
93 }
94 }
95
96 return -EFAULT;
97}
diff --git a/arch/cris/arch-v32/kernel/head.S b/arch/cris/arch-v32/kernel/head.S
index 3db478eb5155..76266f80a5f1 100644
--- a/arch/cris/arch-v32/kernel/head.S
+++ b/arch/cris/arch-v32/kernel/head.S
@@ -10,7 +10,6 @@
10 * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so 10 * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so
11 * -traditional must not be used when assembling this file. 11 * -traditional must not be used when assembling this file.
12 */ 12 */
13#include <linux/autoconf.h>
14#include <arch/memmap.h> 13#include <arch/memmap.h>
15#include <hwregs/reg_rdwr.h> 14#include <hwregs/reg_rdwr.h>
16#include <hwregs/intr_vect.h> 15#include <hwregs/intr_vect.h>
diff --git a/arch/cris/include/asm/asm-offsets.h b/arch/cris/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/cris/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/cris/kernel/asm-offsets.c b/arch/cris/kernel/asm-offsets.c
index ddd6fbbe75de..dd7b8e983221 100644
--- a/arch/cris/kernel/asm-offsets.c
+++ b/arch/cris/kernel/asm-offsets.c
@@ -1,6 +1,5 @@
1#include <linux/sched.h> 1#include <linux/sched.h>
2#include <asm/thread_info.h> 2#include <asm/thread_info.h>
3#include <linux/autoconf.h>
4 3
5/* 4/*
6 * Generate definitions needed by assembly language modules. 5 * Generate definitions needed by assembly language modules.
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index bbfda67d2907..d49d17d2a14f 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -8,7 +8,6 @@
8 * the kernel has booted. 8 * the kernel has booted.
9 */ 9 */
10 10
11#include <linux/autoconf.h>
12#include <asm-generic/vmlinux.lds.h> 11#include <asm-generic/vmlinux.lds.h>
13#include <asm/page.h> 12#include <asm/page.h>
14 13
diff --git a/arch/frv/include/asm/asm-offsets.h b/arch/frv/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/frv/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/frv/include/asm/page.h b/arch/frv/include/asm/page.h
index 25c6a5002355..8c97068ac8fc 100644
--- a/arch/frv/include/asm/page.h
+++ b/arch/frv/include/asm/page.h
@@ -63,12 +63,10 @@ extern unsigned long max_pfn;
63#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 63#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
64 64
65 65
66#ifdef CONFIG_MMU
67#define VM_DATA_DEFAULT_FLAGS \ 66#define VM_DATA_DEFAULT_FLAGS \
68 (VM_READ | VM_WRITE | \ 67 (VM_READ | VM_WRITE | \
69 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ 68 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
70 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 69 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
71#endif
72 70
73#endif /* __ASSEMBLY__ */ 71#endif /* __ASSEMBLY__ */
74 72
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 55e4fab7c0bc..75cf7f4b2fa8 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/utsrelease.h> 13#include <generated/utsrelease.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
diff --git a/arch/h8300/include/asm/asm-offsets.h b/arch/h8300/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/h8300/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index e7cbaa02cd0b..475e2725fbde 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -103,4 +103,4 @@ archprepare: make_nr_irqs_h FORCE
103PHONY += make_nr_irqs_h FORCE 103PHONY += make_nr_irqs_h FORCE
104 104
105make_nr_irqs_h: FORCE 105make_nr_irqs_h: FORCE
106 $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h 106 $(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.h
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 91df9686a0da..7ae58892ba8d 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -132,6 +132,12 @@ extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
132extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 132extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
133#endif 133#endif
134 134
135static inline bool arch_has_acpi_pdc(void) { return true; }
136static inline void arch_acpi_set_pdc_bits(u32 *buf)
137{
138 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
139}
140
135#define acpi_unlazy_tlb(x) 141#define acpi_unlazy_tlb(x)
136 142
137#ifdef CONFIG_ACPI_NUMA 143#ifdef CONFIG_ACPI_NUMA
diff --git a/arch/ia64/include/asm/asm-offsets.h b/arch/ia64/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/ia64/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/ia64/include/asm/ftrace.h b/arch/ia64/include/asm/ftrace.h
index d20db3c2a656..fbd1a2470cae 100644
--- a/arch/ia64/include/asm/ftrace.h
+++ b/arch/ia64/include/asm/ftrace.h
@@ -8,7 +8,6 @@
8extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0); 8extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0);
9#define mcount _mcount 9#define mcount _mcount
10 10
11#include <asm/kprobes.h>
12/* In IA64, MCOUNT_ADDR is set in link time, so it's not a constant at compile time */ 11/* In IA64, MCOUNT_ADDR is set in link time, so it's not a constant at compile time */
13#define MCOUNT_ADDR (((struct fnptr *)mcount)->ip) 12#define MCOUNT_ADDR (((struct fnptr *)mcount)->ip)
14#define FTRACE_ADDR (((struct fnptr *)ftrace_caller)->ip) 13#define FTRACE_ADDR (((struct fnptr *)ftrace_caller)->ip)
diff --git a/arch/ia64/include/asm/irq.h b/arch/ia64/include/asm/irq.h
index 5282546cdf82..91b920fd7d53 100644
--- a/arch/ia64/include/asm/irq.h
+++ b/arch/ia64/include/asm/irq.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/cpumask.h> 15#include <linux/cpumask.h>
16#include <asm-ia64/nr-irqs.h> 16#include <generated/nr-irqs.h>
17 17
18static __inline__ int 18static __inline__ int
19irq_canonicalize (int irq) 19irq_canonicalize (int irq)
diff --git a/arch/ia64/include/asm/kprobes.h b/arch/ia64/include/asm/kprobes.h
index dbf83fb28db3..d5505d6f2382 100644
--- a/arch/ia64/include/asm/kprobes.h
+++ b/arch/ia64/include/asm/kprobes.h
@@ -103,11 +103,6 @@ typedef struct kprobe_opcode {
103 bundle_t bundle; 103 bundle_t bundle;
104} kprobe_opcode_t; 104} kprobe_opcode_t;
105 105
106struct fnptr {
107 unsigned long ip;
108 unsigned long gp;
109};
110
111/* Architecture specific copy of original instruction*/ 106/* Architecture specific copy of original instruction*/
112struct arch_specific_insn { 107struct arch_specific_insn {
113 /* copy of the instruction to be emulated */ 108 /* copy of the instruction to be emulated */
diff --git a/arch/ia64/include/asm/tlb.h b/arch/ia64/include/asm/tlb.h
index 85d965cb19a0..23cce999eb1c 100644
--- a/arch/ia64/include/asm/tlb.h
+++ b/arch/ia64/include/asm/tlb.h
@@ -74,7 +74,7 @@ struct ia64_tr_entry {
74extern int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size); 74extern int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size);
75extern void ia64_ptr_entry(u64 target_mask, int slot); 75extern void ia64_ptr_entry(u64 target_mask, int slot);
76 76
77extern struct ia64_tr_entry __per_cpu_idtrs[NR_CPUS][2][IA64_TR_ALLOC_MAX]; 77extern struct ia64_tr_entry *ia64_idtrs[NR_CPUS];
78 78
79/* 79/*
80 region register macros 80 region register macros
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 3ddb4e709dba..d323071d0f91 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -33,7 +33,9 @@
33/* 33/*
34 * Returns a bitmask of CPUs on Node 'node'. 34 * Returns a bitmask of CPUs on Node 'node'.
35 */ 35 */
36#define cpumask_of_node(node) (&node_to_cpu_mask[node]) 36#define cpumask_of_node(node) ((node) == -1 ? \
37 cpu_all_mask : \
38 &node_to_cpu_mask[node])
37 39
38/* 40/*
39 * Returns the number of the node containing Node 'nid'. 41 * Returns the number of the node containing Node 'nid'.
diff --git a/arch/ia64/include/asm/types.h b/arch/ia64/include/asm/types.h
index bcd260e597de..93773fd37be0 100644
--- a/arch/ia64/include/asm/types.h
+++ b/arch/ia64/include/asm/types.h
@@ -35,6 +35,11 @@ typedef unsigned int umode_t;
35 */ 35 */
36# ifdef __KERNEL__ 36# ifdef __KERNEL__
37 37
38struct fnptr {
39 unsigned long ip;
40 unsigned long gp;
41};
42
38/* DMA addresses are 64-bits wide, in general. */ 43/* DMA addresses are 64-bits wide, in general. */
39typedef u64 dma_addr_t; 44typedef u64 dma_addr_t;
40 45
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 6b7edcab0cb5..e1236349c99f 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -18,10 +18,6 @@ obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o
18obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o 18obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o
19obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o 19obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
20 20
21ifneq ($(CONFIG_ACPI_PROCESSOR),)
22obj-y += acpi-processor.o
23endif
24
25obj-$(CONFIG_IA64_PALINFO) += palinfo.o 21obj-$(CONFIG_IA64_PALINFO) += palinfo.o
26obj-$(CONFIG_IOSAPIC) += iosapic.o 22obj-$(CONFIG_IOSAPIC) += iosapic.o
27obj-$(CONFIG_MODULES) += module.o 23obj-$(CONFIG_MODULES) += module.o
@@ -81,17 +77,14 @@ define cmd_nr_irqs
81endef 77endef
82 78
83# We use internal kbuild rules to avoid the "is up to date" message from make 79# We use internal kbuild rules to avoid the "is up to date" message from make
84arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \ 80arch/$(SRCARCH)/kernel/nr-irqs.s: arch/$(SRCARCH)/kernel/nr-irqs.c
85 $(wildcard $(srctree)/include/asm-ia64/*/irq.h)
86 $(Q)mkdir -p $(dir $@) 81 $(Q)mkdir -p $(dir $@)
87 $(call if_changed_dep,cc_s_c) 82 $(call if_changed_dep,cc_s_c)
88 83
89include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s 84include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s
90 $(Q)mkdir -p $(dir $@) 85 $(Q)mkdir -p $(dir $@)
91 $(call cmd,nr_irqs) 86 $(call cmd,nr_irqs)
92 87
93clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
94
95# 88#
96# native ivt.S, entry.S and fsys.S 89# native ivt.S, entry.S and fsys.S
97# 90#
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c
deleted file mode 100644
index dbda7bde6112..000000000000
--- a/arch/ia64/kernel/acpi-processor.c
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * arch/ia64/kernel/acpi-processor.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for platforms with Intel CPUs
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/acpi.h>
13
14#include <acpi/processor.h>
15#include <asm/acpi.h>
16
17static void init_intel_pdc(struct acpi_processor *pr)
18{
19 struct acpi_object_list *obj_list;
20 union acpi_object *obj;
21 u32 *buf;
22
23 /* allocate and initialize pdc. It will be used later. */
24 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
25 if (!obj_list) {
26 printk(KERN_ERR "Memory allocation error\n");
27 return;
28 }
29
30 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
31 if (!obj) {
32 printk(KERN_ERR "Memory allocation error\n");
33 kfree(obj_list);
34 return;
35 }
36
37 buf = kmalloc(12, GFP_KERNEL);
38 if (!buf) {
39 printk(KERN_ERR "Memory allocation error\n");
40 kfree(obj);
41 kfree(obj_list);
42 return;
43 }
44
45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1;
47 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
48 /*
49 * The default of PDC_SMP_T_SWCOORD bit is set for IA64 cpu so
50 * that OSPM is capable of native ACPI throttling software
51 * coordination using BIOS supplied _TSD info.
52 */
53 buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
54
55 obj->type = ACPI_TYPE_BUFFER;
56 obj->buffer.length = 12;
57 obj->buffer.pointer = (u8 *) buf;
58 obj_list->count = 1;
59 obj_list->pointer = obj;
60 pr->pdc = obj_list;
61
62 return;
63}
64
65/* Initialize _PDC data based on the CPU vendor */
66void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
67{
68 pr->pdc = NULL;
69 init_intel_pdc(pr);
70 return;
71}
72
73EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
74
75void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
76{
77 if (pr->pdc) {
78 kfree(pr->pdc->pointer->buffer.pointer);
79 kfree(pr->pdc->pointer);
80 kfree(pr->pdc);
81 pr->pdc = NULL;
82 }
83}
84
85EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 32f2639e9b0a..378b4833024f 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1225,9 +1225,12 @@ static void mca_insert_tr(u64 iord)
1225 unsigned long psr; 1225 unsigned long psr;
1226 int cpu = smp_processor_id(); 1226 int cpu = smp_processor_id();
1227 1227
1228 if (!ia64_idtrs[cpu])
1229 return;
1230
1228 psr = ia64_clear_ic(); 1231 psr = ia64_clear_ic();
1229 for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) { 1232 for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) {
1230 p = &__per_cpu_idtrs[cpu][iord-1][i]; 1233 p = ia64_idtrs[cpu] + (iord - 1) * IA64_TR_ALLOC_MAX;
1231 if (p->pte & 0x1) { 1234 if (p->pte & 0x1) {
1232 old_rr = ia64_get_rr(p->ifa); 1235 old_rr = ia64_get_rr(p->ifa);
1233 if (old_rr != p->rr) { 1236 if (old_rr != p->rr) {
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 5246285a95fb..6bcbe215b9a4 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2293,7 +2293,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
2293 * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur) 2293 * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur)
2294 * return -ENOMEM; 2294 * return -ENOMEM;
2295 */ 2295 */
2296 if (size > task->signal->rlim[RLIMIT_MEMLOCK].rlim_cur) 2296 if (size > task_rlimit(task, RLIMIT_MEMLOCK))
2297 return -ENOMEM; 2297 return -ENOMEM;
2298 2298
2299 /* 2299 /*
diff --git a/arch/ia64/kvm/asm-offsets.c b/arch/ia64/kvm/asm-offsets.c
index 0c3564a7a033..9324c875caf5 100644
--- a/arch/ia64/kvm/asm-offsets.c
+++ b/arch/ia64/kvm/asm-offsets.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/autoconf.h>
26#include <linux/kvm_host.h> 25#include <linux/kvm_host.h>
27#include <linux/kbuild.h> 26#include <linux/kbuild.h>
28 27
diff --git a/arch/ia64/kvm/vcpu.h b/arch/ia64/kvm/vcpu.h
index 360724d3ae69..988911b4cc7a 100644
--- a/arch/ia64/kvm/vcpu.h
+++ b/arch/ia64/kvm/vcpu.h
@@ -388,6 +388,9 @@ static inline u64 __gpfn_is_io(u64 gpfn)
388#define _vmm_raw_spin_lock(x) do {}while(0) 388#define _vmm_raw_spin_lock(x) do {}while(0)
389#define _vmm_raw_spin_unlock(x) do {}while(0) 389#define _vmm_raw_spin_unlock(x) do {}while(0)
390#else 390#else
391typedef struct {
392 volatile unsigned int lock;
393} vmm_spinlock_t;
391#define _vmm_raw_spin_lock(x) \ 394#define _vmm_raw_spin_lock(x) \
392 do { \ 395 do { \
393 __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ 396 __u32 *ia64_spinlock_ptr = (__u32 *) (x); \
@@ -405,12 +408,12 @@ static inline u64 __gpfn_is_io(u64 gpfn)
405 408
406#define _vmm_raw_spin_unlock(x) \ 409#define _vmm_raw_spin_unlock(x) \
407 do { barrier(); \ 410 do { barrier(); \
408 ((spinlock_t *)x)->raw_lock.lock = 0; } \ 411 ((vmm_spinlock_t *)x)->lock = 0; } \
409while (0) 412while (0)
410#endif 413#endif
411 414
412void vmm_spin_lock(spinlock_t *lock); 415void vmm_spin_lock(vmm_spinlock_t *lock);
413void vmm_spin_unlock(spinlock_t *lock); 416void vmm_spin_unlock(vmm_spinlock_t *lock);
414enum { 417enum {
415 I_TLB = 1, 418 I_TLB = 1,
416 D_TLB = 2 419 D_TLB = 2
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c
index f4b4c899bb6c..7a62f75778c5 100644
--- a/arch/ia64/kvm/vmm.c
+++ b/arch/ia64/kvm/vmm.c
@@ -60,12 +60,12 @@ static void __exit kvm_vmm_exit(void)
60 return ; 60 return ;
61} 61}
62 62
63void vmm_spin_lock(spinlock_t *lock) 63void vmm_spin_lock(vmm_spinlock_t *lock)
64{ 64{
65 _vmm_raw_spin_lock(lock); 65 _vmm_raw_spin_lock(lock);
66} 66}
67 67
68void vmm_spin_unlock(spinlock_t *lock) 68void vmm_spin_unlock(vmm_spinlock_t *lock)
69{ 69{
70 _vmm_raw_spin_unlock(lock); 70 _vmm_raw_spin_unlock(lock);
71} 71}
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index 20b3852f7a6e..4332f7ee5203 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -182,7 +182,7 @@ void mark_pages_dirty(struct kvm_vcpu *v, u64 pte, u64 ps)
182{ 182{
183 u64 i, dirty_pages = 1; 183 u64 i, dirty_pages = 1;
184 u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT; 184 u64 base_gfn = (pte&_PAGE_PPN_MASK) >> PAGE_SHIFT;
185 spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa); 185 vmm_spinlock_t *lock = __kvm_va(v->arch.dirty_log_lock_pa);
186 void *dirty_bitmap = (void *)KVM_MEM_DIRTY_LOG_BASE; 186 void *dirty_bitmap = (void *)KVM_MEM_DIRTY_LOG_BASE;
187 187
188 dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT; 188 dirty_pages <<= ps <= PAGE_SHIFT ? 0 : ps - PAGE_SHIFT;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b9609c69343a..7c0d4814a68d 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -91,7 +91,7 @@ dma_mark_clean(void *addr, size_t size)
91inline void 91inline void
92ia64_set_rbs_bot (void) 92ia64_set_rbs_bot (void)
93{ 93{
94 unsigned long stack_size = current->signal->rlim[RLIMIT_STACK].rlim_max & -16; 94 unsigned long stack_size = rlimit_max(RLIMIT_STACK) & -16;
95 95
96 if (stack_size > MAX_USER_STACK_SIZE) 96 if (stack_size > MAX_USER_STACK_SIZE)
97 stack_size = MAX_USER_STACK_SIZE; 97 stack_size = MAX_USER_STACK_SIZE;
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index ee09d261f2e6..f3de9d7a98b4 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -48,7 +48,7 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
48DEFINE_PER_CPU(u8, ia64_tr_num); /*Number of TR slots in current processor*/ 48DEFINE_PER_CPU(u8, ia64_tr_num); /*Number of TR slots in current processor*/
49DEFINE_PER_CPU(u8, ia64_tr_used); /*Max Slot number used by kernel*/ 49DEFINE_PER_CPU(u8, ia64_tr_used); /*Max Slot number used by kernel*/
50 50
51struct ia64_tr_entry __per_cpu_idtrs[NR_CPUS][2][IA64_TR_ALLOC_MAX]; 51struct ia64_tr_entry *ia64_idtrs[NR_CPUS];
52 52
53/* 53/*
54 * Initializes the ia64_ctx.bitmap array based on max_ctx+1. 54 * Initializes the ia64_ctx.bitmap array based on max_ctx+1.
@@ -429,10 +429,16 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size)
429 struct ia64_tr_entry *p; 429 struct ia64_tr_entry *p;
430 int cpu = smp_processor_id(); 430 int cpu = smp_processor_id();
431 431
432 if (!ia64_idtrs[cpu]) {
433 ia64_idtrs[cpu] = kmalloc(2 * IA64_TR_ALLOC_MAX *
434 sizeof (struct ia64_tr_entry), GFP_KERNEL);
435 if (!ia64_idtrs[cpu])
436 return -ENOMEM;
437 }
432 r = -EINVAL; 438 r = -EINVAL;
433 /*Check overlap with existing TR entries*/ 439 /*Check overlap with existing TR entries*/
434 if (target_mask & 0x1) { 440 if (target_mask & 0x1) {
435 p = &__per_cpu_idtrs[cpu][0][0]; 441 p = ia64_idtrs[cpu];
436 for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu); 442 for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu);
437 i++, p++) { 443 i++, p++) {
438 if (p->pte & 0x1) 444 if (p->pte & 0x1)
@@ -444,7 +450,7 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size)
444 } 450 }
445 } 451 }
446 if (target_mask & 0x2) { 452 if (target_mask & 0x2) {
447 p = &__per_cpu_idtrs[cpu][1][0]; 453 p = ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX;
448 for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu); 454 for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu);
449 i++, p++) { 455 i++, p++) {
450 if (p->pte & 0x1) 456 if (p->pte & 0x1)
@@ -459,16 +465,16 @@ int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size)
459 for (i = IA64_TR_ALLOC_BASE; i < per_cpu(ia64_tr_num, cpu); i++) { 465 for (i = IA64_TR_ALLOC_BASE; i < per_cpu(ia64_tr_num, cpu); i++) {
460 switch (target_mask & 0x3) { 466 switch (target_mask & 0x3) {
461 case 1: 467 case 1:
462 if (!(__per_cpu_idtrs[cpu][0][i].pte & 0x1)) 468 if (!((ia64_idtrs[cpu] + i)->pte & 0x1))
463 goto found; 469 goto found;
464 continue; 470 continue;
465 case 2: 471 case 2:
466 if (!(__per_cpu_idtrs[cpu][1][i].pte & 0x1)) 472 if (!((ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i)->pte & 0x1))
467 goto found; 473 goto found;
468 continue; 474 continue;
469 case 3: 475 case 3:
470 if (!(__per_cpu_idtrs[cpu][0][i].pte & 0x1) && 476 if (!((ia64_idtrs[cpu] + i)->pte & 0x1) &&
471 !(__per_cpu_idtrs[cpu][1][i].pte & 0x1)) 477 !((ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i)->pte & 0x1))
472 goto found; 478 goto found;
473 continue; 479 continue;
474 default: 480 default:
@@ -488,7 +494,7 @@ found:
488 if (target_mask & 0x1) { 494 if (target_mask & 0x1) {
489 ia64_itr(0x1, i, va, pte, log_size); 495 ia64_itr(0x1, i, va, pte, log_size);
490 ia64_srlz_i(); 496 ia64_srlz_i();
491 p = &__per_cpu_idtrs[cpu][0][i]; 497 p = ia64_idtrs[cpu] + i;
492 p->ifa = va; 498 p->ifa = va;
493 p->pte = pte; 499 p->pte = pte;
494 p->itir = log_size << 2; 500 p->itir = log_size << 2;
@@ -497,7 +503,7 @@ found:
497 if (target_mask & 0x2) { 503 if (target_mask & 0x2) {
498 ia64_itr(0x2, i, va, pte, log_size); 504 ia64_itr(0x2, i, va, pte, log_size);
499 ia64_srlz_i(); 505 ia64_srlz_i();
500 p = &__per_cpu_idtrs[cpu][1][i]; 506 p = ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i;
501 p->ifa = va; 507 p->ifa = va;
502 p->pte = pte; 508 p->pte = pte;
503 p->itir = log_size << 2; 509 p->itir = log_size << 2;
@@ -528,7 +534,7 @@ void ia64_ptr_entry(u64 target_mask, int slot)
528 return; 534 return;
529 535
530 if (target_mask & 0x1) { 536 if (target_mask & 0x1) {
531 p = &__per_cpu_idtrs[cpu][0][slot]; 537 p = ia64_idtrs[cpu] + slot;
532 if ((p->pte&0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) { 538 if ((p->pte&0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) {
533 p->pte = 0; 539 p->pte = 0;
534 ia64_ptr(0x1, p->ifa, p->itir>>2); 540 ia64_ptr(0x1, p->ifa, p->itir>>2);
@@ -537,7 +543,7 @@ void ia64_ptr_entry(u64 target_mask, int slot)
537 } 543 }
538 544
539 if (target_mask & 0x2) { 545 if (target_mask & 0x2) {
540 p = &__per_cpu_idtrs[cpu][1][slot]; 546 p = ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + slot;
541 if ((p->pte & 0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) { 547 if ((p->pte & 0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) {
542 p->pte = 0; 548 p->pte = 0;
543 ia64_ptr(0x2, p->ifa, p->itir>>2); 549 ia64_ptr(0x2, p->ifa, p->itir>>2);
@@ -546,8 +552,8 @@ void ia64_ptr_entry(u64 target_mask, int slot)
546 } 552 }
547 553
548 for (i = per_cpu(ia64_tr_used, cpu); i >= IA64_TR_ALLOC_BASE; i--) { 554 for (i = per_cpu(ia64_tr_used, cpu); i >= IA64_TR_ALLOC_BASE; i--) {
549 if ((__per_cpu_idtrs[cpu][0][i].pte & 0x1) || 555 if (((ia64_idtrs[cpu] + i)->pte & 0x1) ||
550 (__per_cpu_idtrs[cpu][1][i].pte & 0x1)) 556 ((ia64_idtrs[cpu] + IA64_TR_ALLOC_MAX + i)->pte & 0x1))
551 break; 557 break;
552 } 558 }
553 per_cpu(ia64_tr_used, cpu) = i; 559 per_cpu(ia64_tr_used, cpu) = i;
diff --git a/arch/m68k/include/asm/asm-offsets.h b/arch/m68k/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/m68k/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index 7f57436ec18f..359065d5a9f2 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/virtconvert.h>
6 7
7/* 8/*
8 * These are for ISA/PCI shared memory _only_ and should never be used 9 * These are for ISA/PCI shared memory _only_ and should never be used
@@ -165,19 +166,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
165 166
166extern void iounmap(void *addr); 167extern void iounmap(void *addr);
167 168
168/* Pages to physical address... */
169#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
170#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)
171
172/*
173 * Macros used for converting between virtual and physical mappings.
174 */
175#define phys_to_virt(vaddr) ((void *) (vaddr))
176#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
177
178#define virt_to_bus virt_to_phys
179#define bus_to_virt phys_to_virt
180
181/* 169/*
182 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 170 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
183 * access 171 * access
diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
index 1f31b060cc8d..8029a33e03c3 100644
--- a/arch/m68k/include/asm/page_no.h
+++ b/arch/m68k/include/asm/page_no.h
@@ -56,8 +56,8 @@ extern unsigned long memory_end;
56 56
57#ifndef __ASSEMBLY__ 57#ifndef __ASSEMBLY__
58 58
59#define __pa(vaddr) virt_to_phys((void *)(vaddr)) 59#define __pa(vaddr) ((unsigned long)(vaddr))
60#define __va(paddr) phys_to_virt((unsigned long)(paddr)) 60#define __va(paddr) ((void *)(paddr))
61 61
62#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 62#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
63#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 63#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
diff --git a/arch/m68k/include/asm/virtconvert.h b/arch/m68k/include/asm/virtconvert.h
index 22ab05c9c52b..3f834b3ab5bd 100644
--- a/arch/m68k/include/asm/virtconvert.h
+++ b/arch/m68k/include/asm/virtconvert.h
@@ -26,6 +26,7 @@ static inline void *phys_to_virt(unsigned long address)
26} 26}
27 27
28/* Permanent address of a page. */ 28/* Permanent address of a page. */
29#ifdef CONFIG_MMU
29#ifdef CONFIG_SINGLE_MEMORY_CHUNK 30#ifdef CONFIG_SINGLE_MEMORY_CHUNK
30#define page_to_phys(page) \ 31#define page_to_phys(page) \
31 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT)) 32 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
@@ -37,6 +38,9 @@ static inline void *phys_to_virt(unsigned long address)
37 page_to_pfn(__page) << PAGE_SHIFT; \ 38 page_to_pfn(__page) << PAGE_SHIFT; \
38}) 39})
39#endif 40#endif
41#else
42#define page_to_phys(page) (((page) - mem_map) << PAGE_SHIFT)
43#endif
40 44
41/* 45/*
42 * IO bus memory addresses are 1:1 with the physical address, 46 * IO bus memory addresses are 1:1 with the physical address,
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 86edb5fbcfc3..ef54128baa0b 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -196,7 +196,7 @@
196 * for them and trying to understand what they mean. 196 * for them and trying to understand what they mean.
197 * 197 *
198 * CONFIG_xxx: These are the obvious machine configuration defines created 198 * CONFIG_xxx: These are the obvious machine configuration defines created
199 * during configuration. These are defined in include/linux/autoconf.h. 199 * during configuration. These are defined in autoconf.h.
200 * 200 *
201 * CONSOLE: There is support for head.S console in this file. This 201 * CONSOLE: There is support for head.S console in this file. This
202 * console can talk to a Mac frame buffer, but could easily be extrapolated 202 * console can talk to a Mac frame buffer, but could easily be extrapolated
diff --git a/arch/microblaze/include/asm/asm-offsets.h b/arch/microblaze/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/microblaze/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fd7620f025fa..9541171f1220 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -5,9 +5,12 @@ config MIPS
5 select HAVE_IDE 5 select HAVE_IDE
6 select HAVE_OPROFILE 6 select HAVE_OPROFILE
7 select HAVE_ARCH_KGDB 7 select HAVE_ARCH_KGDB
8 # Horrible source of confusion. Die, die, die ... 8 select HAVE_FUNCTION_TRACER
9 select EMBEDDED 9 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
10 select RTC_LIB if !LEMOTE_FULOONG2E 10 select HAVE_DYNAMIC_FTRACE
11 select HAVE_FTRACE_MCOUNT_RECORD
12 select HAVE_FUNCTION_GRAPH_TRACER
13 select RTC_LIB if !MACH_LOONGSON
11 14
12mainmenu "Linux/MIPS Kernel Configuration" 15mainmenu "Linux/MIPS Kernel Configuration"
13 16
@@ -22,6 +25,7 @@ choice
22 25
23config MACH_ALCHEMY 26config MACH_ALCHEMY
24 bool "Alchemy processor based machines" 27 bool "Alchemy processor based machines"
28 select SYS_SUPPORTS_ZBOOT
25 29
26config AR7 30config AR7
27 bool "Texas Instruments AR7" 31 bool "Texas Instruments AR7"
@@ -36,6 +40,7 @@ config AR7
36 select SYS_HAS_EARLY_PRINTK 40 select SYS_HAS_EARLY_PRINTK
37 select SYS_SUPPORTS_32BIT_KERNEL 41 select SYS_SUPPORTS_32BIT_KERNEL
38 select SYS_SUPPORTS_LITTLE_ENDIAN 42 select SYS_SUPPORTS_LITTLE_ENDIAN
43 select SYS_SUPPORTS_ZBOOT_UART16550
39 select GENERIC_GPIO 44 select GENERIC_GPIO
40 select GCD 45 select GCD
41 select VLYNQ 46 select VLYNQ
@@ -43,23 +48,6 @@ config AR7
43 Support for the Texas Instruments AR7 System-on-a-Chip 48 Support for the Texas Instruments AR7 System-on-a-Chip
44 family: TNETD7100, 7200 and 7300. 49 family: TNETD7100, 7200 and 7300.
45 50
46config BASLER_EXCITE
47 bool "Basler eXcite smart camera"
48 select CEVT_R4K
49 select CSRC_R4K
50 select DMA_COHERENT
51 select HW_HAS_PCI
52 select IRQ_CPU
53 select IRQ_CPU_RM7K
54 select IRQ_CPU_RM9K
55 select MIPS_RM9122
56 select SYS_HAS_CPU_RM9000
57 select SYS_SUPPORTS_32BIT_KERNEL
58 select SYS_SUPPORTS_BIG_ENDIAN
59 help
60 The eXcite is a smart camera platform manufactured by
61 Basler Vision Technologies AG.
62
63config BCM47XX 51config BCM47XX
64 bool "BCM47XX based boards" 52 bool "BCM47XX based boards"
65 select CEVT_R4K 53 select CEVT_R4K
@@ -192,6 +180,7 @@ config LASAT
192 180
193config MACH_LOONGSON 181config MACH_LOONGSON
194 bool "Loongson family of machines" 182 bool "Loongson family of machines"
183 select SYS_SUPPORTS_ZBOOT_UART16550
195 help 184 help
196 This enables the support of Loongson family of machines. 185 This enables the support of Loongson family of machines.
197 186
@@ -233,6 +222,7 @@ config MIPS_MALTA
233 select SYS_SUPPORTS_MIPS_CMP 222 select SYS_SUPPORTS_MIPS_CMP
234 select SYS_SUPPORTS_MULTITHREADING 223 select SYS_SUPPORTS_MULTITHREADING
235 select SYS_SUPPORTS_SMARTMIPS 224 select SYS_SUPPORTS_SMARTMIPS
225 select SYS_SUPPORTS_ZBOOT
236 help 226 help
237 This enables support for the MIPS Technologies Malta evaluation 227 This enables support for the MIPS Technologies Malta evaluation
238 board. 228 board.
@@ -334,6 +324,24 @@ config PMC_YOSEMITE
334 Yosemite is an evaluation board for the RM9000x2 processor 324 Yosemite is an evaluation board for the RM9000x2 processor
335 manufactured by PMC-Sierra. 325 manufactured by PMC-Sierra.
336 326
327config POWERTV
328 bool "Cisco PowerTV"
329 select BOOT_ELF32
330 select CEVT_R4K
331 select CPU_MIPSR2_IRQ_VI
332 select CPU_MIPSR2_IRQ_EI
333 select CSRC_POWERTV
334 select DMA_NONCOHERENT
335 select HW_HAS_PCI
336 select SYS_HAS_EARLY_PRINTK
337 select SYS_HAS_CPU_MIPS32_R2
338 select SYS_SUPPORTS_32BIT_KERNEL
339 select SYS_SUPPORTS_BIG_ENDIAN
340 select SYS_SUPPORTS_HIGHMEM
341 select USB_OHCI_LITTLE_ENDIAN
342 help
343 This enables support for the Cisco PowerTV Platform.
344
337config SGI_IP22 345config SGI_IP22
338 bool "SGI IP22 (Indy/Indigo2)" 346 bool "SGI IP22 (Indy/Indigo2)"
339 select ARC 347 select ARC
@@ -674,11 +682,11 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
674endchoice 682endchoice
675 683
676source "arch/mips/alchemy/Kconfig" 684source "arch/mips/alchemy/Kconfig"
677source "arch/mips/basler/excite/Kconfig"
678source "arch/mips/bcm63xx/Kconfig" 685source "arch/mips/bcm63xx/Kconfig"
679source "arch/mips/jazz/Kconfig" 686source "arch/mips/jazz/Kconfig"
680source "arch/mips/lasat/Kconfig" 687source "arch/mips/lasat/Kconfig"
681source "arch/mips/pmc-sierra/Kconfig" 688source "arch/mips/pmc-sierra/Kconfig"
689source "arch/mips/powertv/Kconfig"
682source "arch/mips/sgi-ip27/Kconfig" 690source "arch/mips/sgi-ip27/Kconfig"
683source "arch/mips/sibyte/Kconfig" 691source "arch/mips/sibyte/Kconfig"
684source "arch/mips/txx9/Kconfig" 692source "arch/mips/txx9/Kconfig"
@@ -778,6 +786,9 @@ config CSRC_BCM1480
778config CSRC_IOASIC 786config CSRC_IOASIC
779 bool 787 bool
780 788
789config CSRC_POWERTV
790 bool
791
781config CSRC_R4K_LIB 792config CSRC_R4K_LIB
782 bool 793 bool
783 794
@@ -806,20 +817,6 @@ config DMA_NONCOHERENT
806config DMA_NEED_PCI_MAP_STATE 817config DMA_NEED_PCI_MAP_STATE
807 bool 818 bool
808 819
809config EARLY_PRINTK
810 bool "Early printk" if EMBEDDED && DEBUG_KERNEL
811 depends on SYS_HAS_EARLY_PRINTK
812 default y
813 help
814 This option enables special console drivers which allow the kernel
815 to print messages very early in the bootup process.
816
817 This is useful for kernel debugging when your machine crashes very
818 early before the console code is initialized. For normal operation,
819 it is not recommended because it looks ugly on some machines and
820 doesn't cooperate with an X server. You should normally say N here,
821 unless you want to debug such a crash.
822
823config SYS_HAS_EARLY_PRINTK 820config SYS_HAS_EARLY_PRINTK
824 bool 821 bool
825 822
@@ -1069,6 +1066,21 @@ config CPU_LOONGSON2E
1069 The Loongson 2E processor implements the MIPS III instruction set 1066 The Loongson 2E processor implements the MIPS III instruction set
1070 with many extensions. 1067 with many extensions.
1071 1068
1069 It has an internal FPGA northbridge, which is compatiable to
1070 bonito64.
1071
1072config CPU_LOONGSON2F
1073 bool "Loongson 2F"
1074 depends on SYS_HAS_CPU_LOONGSON2F
1075 select CPU_LOONGSON2
1076 help
1077 The Loongson 2F processor implements the MIPS III instruction set
1078 with many extensions.
1079
1080 Loongson2F have built-in DDR2 and PCIX controller. The PCIX controller
1081 have a similar programming interface with FPGA northbridge used in
1082 Loongson2E.
1083
1072config CPU_MIPS32_R1 1084config CPU_MIPS32_R1
1073 bool "MIPS32 Release 1" 1085 bool "MIPS32 Release 1"
1074 depends on SYS_HAS_CPU_MIPS32_R1 1086 depends on SYS_HAS_CPU_MIPS32_R1
@@ -1294,6 +1306,16 @@ config CPU_CAVIUM_OCTEON
1294 1306
1295endchoice 1307endchoice
1296 1308
1309config SYS_SUPPORTS_ZBOOT
1310 bool
1311 select HAVE_KERNEL_GZIP
1312 select HAVE_KERNEL_BZIP2
1313 select HAVE_KERNEL_LZMA
1314
1315config SYS_SUPPORTS_ZBOOT_UART16550
1316 bool
1317 select SYS_SUPPORTS_ZBOOT
1318
1297config CPU_LOONGSON2 1319config CPU_LOONGSON2
1298 bool 1320 bool
1299 select CPU_SUPPORTS_32BIT_KERNEL 1321 select CPU_SUPPORTS_32BIT_KERNEL
@@ -1303,6 +1325,12 @@ config CPU_LOONGSON2
1303config SYS_HAS_CPU_LOONGSON2E 1325config SYS_HAS_CPU_LOONGSON2E
1304 bool 1326 bool
1305 1327
1328config SYS_HAS_CPU_LOONGSON2F
1329 bool
1330 select CPU_SUPPORTS_CPUFREQ
1331 select CPU_SUPPORTS_ADDRWINCFG if 64BIT
1332 select CPU_SUPPORTS_UNCACHED_ACCELERATED
1333
1306config SYS_HAS_CPU_MIPS32_R1 1334config SYS_HAS_CPU_MIPS32_R1
1307 bool 1335 bool
1308 1336
@@ -1411,8 +1439,17 @@ config CPU_SUPPORTS_32BIT_KERNEL
1411 bool 1439 bool
1412config CPU_SUPPORTS_64BIT_KERNEL 1440config CPU_SUPPORTS_64BIT_KERNEL
1413 bool 1441 bool
1442config CPU_SUPPORTS_CPUFREQ
1443 bool
1444config CPU_SUPPORTS_ADDRWINCFG
1445 bool
1414config CPU_SUPPORTS_HUGEPAGES 1446config CPU_SUPPORTS_HUGEPAGES
1415 bool 1447 bool
1448config CPU_SUPPORTS_UNCACHED_ACCELERATED
1449 bool
1450config MIPS_PGD_C0_CONTEXT
1451 bool
1452 default y if 64BIT && CPU_MIPSR2
1416 1453
1417# 1454#
1418# Set to y for ptrace access to watch registers. 1455# Set to y for ptrace access to watch registers.
@@ -2024,15 +2061,6 @@ config STACKTRACE_SUPPORT
2024 2061
2025source "init/Kconfig" 2062source "init/Kconfig"
2026 2063
2027config PROBE_INITRD_HEADER
2028 bool "Probe initrd header created by addinitrd"
2029 depends on BLK_DEV_INITRD
2030 help
2031 Probe initrd header at the last page of kernel image.
2032 Say Y here if you are using arch/mips/boot/addinitrd.c to
2033 add initrd or initramfs image to the kernel image.
2034 Otherwise, say N.
2035
2036source "kernel/Kconfig.freezer" 2064source "kernel/Kconfig.freezer"
2037 2065
2038menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" 2066menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
@@ -2104,6 +2132,7 @@ config MMU
2104 2132
2105config I8253 2133config I8253
2106 bool 2134 bool
2135 select MIPS_EXTERNAL_TIMER
2107 2136
2108config ZONE_DMA32 2137config ZONE_DMA32
2109 bool 2138 bool
@@ -2180,6 +2209,8 @@ source "kernel/power/Kconfig"
2180 2209
2181endmenu 2210endmenu
2182 2211
2212source "arch/mips/kernel/cpufreq/Kconfig"
2213
2183source "net/Kconfig" 2214source "net/Kconfig"
2184 2215
2185source "drivers/Kconfig" 2216source "drivers/Kconfig"
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 364ca8938807..d2b88a0be519 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -6,15 +6,66 @@ config TRACE_IRQFLAGS_SUPPORT
6 6
7source "lib/Kconfig.debug" 7source "lib/Kconfig.debug"
8 8
9config EARLY_PRINTK
10 bool "Early printk" if EMBEDDED
11 depends on SYS_HAS_EARLY_PRINTK
12 default y
13 help
14 This option enables special console drivers which allow the kernel
15 to print messages very early in the bootup process.
16
17 This is useful for kernel debugging when your machine crashes very
18 early before the console code is initialized. For normal operation,
19 it is not recommended because it looks ugly on some machines and
20 doesn't cooperate with an X server. You should normally say N here,
21 unless you want to debug such a crash.
22
23config CMDLINE_BOOL
24 bool "Built-in kernel command line"
25 default n
26 help
27 For most systems, it is firmware or second stage bootloader that
28 by default specifies the kernel command line options. However,
29 it might be necessary or advantageous to either override the
30 default kernel command line or add a few extra options to it.
31 For such cases, this option allows you to hardcode your own
32 command line options directly into the kernel. For that, you
33 should choose 'Y' here, and fill in the extra boot arguments
34 in CONFIG_CMDLINE.
35
36 The built-in options will be concatenated to the default command
37 line if CMDLINE_OVERRIDE is set to 'N'. Otherwise, the default
38 command line will be ignored and replaced by the built-in string.
39
40 Most MIPS systems will normally expect 'N' here and rely upon
41 the command line from the firmware or the second-stage bootloader.
42
9config CMDLINE 43config CMDLINE
10 string "Default kernel command string" 44 string "Default kernel command string"
45 depends on CMDLINE_BOOL
11 default "" 46 default ""
12 help 47 help
13 On some platforms, there is currently no way for the boot loader to 48 On some platforms, there is currently no way for the boot loader to
14 pass arguments to the kernel. For these platforms, you can supply 49 pass arguments to the kernel. For these platforms, and for the cases
15 some command-line options at build time by entering them here. In 50 when you want to add some extra options to the command line or ignore
16 other cases you can specify kernel args so that you don't have 51 the default command line, you can supply some command-line options at
17 to set them up in board prom initialization routines. 52 build time by entering them here. In other cases you can specify
53 kernel args so that you don't have to set them up in board prom
54 initialization routines.
55
56 For more information, see the CMDLINE_BOOL and CMDLINE_OVERRIDE
57 options.
58
59config CMDLINE_OVERRIDE
60 bool "Built-in command line overrides firware arguments"
61 default n
62 depends on CMDLINE_BOOL
63 help
64 By setting this option to 'Y' you will have your kernel ignore
65 command line arguments from firmware or second stage bootloader.
66 Instead, the built-in command line will be used exclusively.
67
68 Normally, you will choose 'N' here.
18 69
19config DEBUG_STACK_USAGE 70config DEBUG_STACK_USAGE
20 bool "Enable stack utilization instrumentation" 71 bool "Enable stack utilization instrumentation"
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 77f5021218d3..1893efd43fca 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -48,7 +48,16 @@ ifneq ($(SUBARCH),$(ARCH))
48 endif 48 endif
49endif 49endif
50 50
51ifndef CONFIG_FUNCTION_TRACER
51cflags-y := -ffunction-sections 52cflags-y := -ffunction-sections
53endif
54ifdef CONFIG_FUNCTION_GRAPH_TRACER
55 ifndef KBUILD_MCOUNT_RA_ADDRESS
56 ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
57 cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS
58 endif
59 endif
60endif
52cflags-y += $(call cc-option, -mno-check-zero-division) 61cflags-y += $(call cc-option, -mno-check-zero-division)
53 62
54ifdef CONFIG_32BIT 63ifdef CONFIG_32BIT
@@ -69,6 +78,7 @@ endif
69 78
70all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32) 79all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32)
71all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64) 80all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64)
81all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
72 82
73# 83#
74# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel 84# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
@@ -124,6 +134,8 @@ cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
124cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap 134cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
125cflags-$(CONFIG_CPU_LOONGSON2E) += \ 135cflags-$(CONFIG_CPU_LOONGSON2E) += \
126 $(call cc-option,-march=loongson2e,-march=r4600) 136 $(call cc-option,-march=loongson2e,-march=r4600)
137cflags-$(CONFIG_CPU_LOONGSON2F) += \
138 $(call cc-option,-march=loongson2f,-march=r4600)
127 139
128cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 140cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
129 -Wa,-mips32 -Wa,--trap 141 -Wa,-mips32 -Wa,--trap
@@ -324,6 +336,7 @@ core-$(CONFIG_MACH_LOONGSON) +=arch/mips/loongson/
324cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson \ 336cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson \
325 -mno-branch-likely 337 -mno-branch-likely
326load-$(CONFIG_LEMOTE_FULOONG2E) +=0xffffffff80100000 338load-$(CONFIG_LEMOTE_FULOONG2E) +=0xffffffff80100000
339load-$(CONFIG_LEMOTE_MACH2F) +=0xffffffff80200000
327 340
328# 341#
329# MIPS Malta board 342# MIPS Malta board
@@ -331,7 +344,7 @@ load-$(CONFIG_LEMOTE_FULOONG2E) +=0xffffffff80100000
331core-$(CONFIG_MIPS_MALTA) += arch/mips/mti-malta/ 344core-$(CONFIG_MIPS_MALTA) += arch/mips/mti-malta/
332cflags-$(CONFIG_MIPS_MALTA) += -I$(srctree)/arch/mips/include/asm/mach-malta 345cflags-$(CONFIG_MIPS_MALTA) += -I$(srctree)/arch/mips/include/asm/mach-malta
333load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000 346load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
334all-$(CONFIG_MIPS_MALTA) := vmlinux.bin 347all-$(CONFIG_MIPS_MALTA) := vmlinuz.bin
335 348
336# 349#
337# MIPS SIM 350# MIPS SIM
@@ -356,13 +369,6 @@ cflags-$(CONFIG_PMC_YOSEMITE) += -I$(srctree)/arch/mips/include/asm/mach-yosemit
356load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000 369load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
357 370
358# 371#
359# Basler eXcite
360#
361core-$(CONFIG_BASLER_EXCITE) += arch/mips/basler/excite/
362cflags-$(CONFIG_BASLER_EXCITE) += -I$(srctree)/arch/mips/include/asm/mach-excite
363load-$(CONFIG_BASLER_EXCITE) += 0x80100000
364
365#
366# LASAT platforms 372# LASAT platforms
367# 373#
368core-$(CONFIG_LASAT) += arch/mips/lasat/ 374core-$(CONFIG_LASAT) += arch/mips/lasat/
@@ -441,6 +447,13 @@ core-$(CONFIG_NEC_MARKEINS) += arch/mips/emma/markeins/
441load-$(CONFIG_NEC_MARKEINS) += 0xffffffff88100000 447load-$(CONFIG_NEC_MARKEINS) += 0xffffffff88100000
442 448
443# 449#
450# Cisco PowerTV Platform
451#
452core-$(CONFIG_POWERTV) += arch/mips/powertv/
453cflags-$(CONFIG_POWERTV) += -I$(srctree)/arch/mips/include/asm/mach-powertv
454load-$(CONFIG_POWERTV) += 0xffffffff90800000
455
456#
444# SGI IP22 (Indy/Indigo2) 457# SGI IP22 (Indy/Indigo2)
445# 458#
446# Set the load address to >= 0xffffffff88069000 if you want to leave space for 459# Set the load address to >= 0xffffffff88069000 if you want to leave space for
@@ -581,7 +594,7 @@ load-$(CONFIG_SNI_RM) += 0xffffffff80600000
581else 594else
582load-$(CONFIG_SNI_RM) += 0xffffffff80030000 595load-$(CONFIG_SNI_RM) += 0xffffffff80030000
583endif 596endif
584all-$(CONFIG_SNI_RM) := vmlinux.ecoff 597all-$(CONFIG_SNI_RM) := vmlinuz.ecoff
585 598
586# 599#
587# Common TXx9 600# Common TXx9
@@ -699,9 +712,23 @@ vmlinux.64: vmlinux
699 $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@ 712 $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
700 713
701makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1) 714makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
715makezboot =$(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
716 VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $(1)
702 717
703all: $(all-y) 718all: $(all-y)
704 719
720vmlinuz: vmlinux FORCE
721 +@$(call makezboot,$@)
722
723vmlinuz.bin: vmlinux
724 +@$(call makezboot,$@)
725
726vmlinuz.ecoff: vmlinux
727 +@$(call makezboot,$@)
728
729vmlinuz.srec: vmlinux
730 +@$(call makezboot,$@)
731
705vmlinux.bin: $(vmlinux-32) 732vmlinux.bin: $(vmlinux-32)
706 +@$(call makeboot,$@) 733 +@$(call makeboot,$@)
707 734
@@ -726,11 +753,13 @@ endif
726 753
727install: 754install:
728 $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE) 755 $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
756 $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
729 $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE) 757 $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
730 $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE) 758 $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
731 759
732archclean: 760archclean:
733 @$(MAKE) $(clean)=arch/mips/boot 761 @$(MAKE) $(clean)=arch/mips/boot
762 @$(MAKE) $(clean)=arch/mips/boot/compressed
734 @$(MAKE) $(clean)=arch/mips/lasat 763 @$(MAKE) $(clean)=arch/mips/lasat
735 764
736define archhelp 765define archhelp
@@ -738,10 +767,18 @@ define archhelp
738 echo ' vmlinux.ecoff - ECOFF boot image' 767 echo ' vmlinux.ecoff - ECOFF boot image'
739 echo ' vmlinux.bin - Raw binary boot image' 768 echo ' vmlinux.bin - Raw binary boot image'
740 echo ' vmlinux.srec - SREC boot image' 769 echo ' vmlinux.srec - SREC boot image'
770 echo ' vmlinuz - Compressed boot(zboot) image'
771 echo ' vmlinuz.ecoff - ECOFF zboot image'
772 echo ' vmlinuz.bin - Raw binary zboot image'
773 echo ' vmlinuz.srec - SREC zboot image'
741 echo 774 echo
742 echo ' These will be default as apropriate for a configured platform.' 775 echo ' These will be default as apropriate for a configured platform.'
743endef 776endef
744 777
745CLEAN_FILES += vmlinux.32 \ 778CLEAN_FILES += vmlinux.32 \
746 vmlinux.64 \ 779 vmlinux.64 \
747 vmlinux.ecoff 780 vmlinux.ecoff \
781 vmlinuz \
782 vmlinuz.ecoff \
783 vmlinuz.bin \
784 vmlinuz.srec
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 19c1c82849ff..5c68569344c1 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -613,7 +613,7 @@ u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags)
613 dma_cache_wback_inv((unsigned long)buf, nbytes); 613 dma_cache_wback_inv((unsigned long)buf, nbytes);
614 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 614 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
615 au_sync(); 615 au_sync();
616 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 616 dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
617 ctp->chan_ptr->ddma_dbell = 0; 617 ctp->chan_ptr->ddma_dbell = 0;
618 618
619 /* Get next descriptor pointer. */ 619 /* Get next descriptor pointer. */
@@ -676,7 +676,7 @@ _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags)
676 dma_cache_inv((unsigned long)buf, nbytes); 676 dma_cache_inv((unsigned long)buf, nbytes);
677 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */ 677 dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
678 au_sync(); 678 au_sync();
679 dma_cache_wback_inv((unsigned long)dp, sizeof(dp)); 679 dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
680 ctp->chan_ptr->ddma_dbell = 0; 680 ctp->chan_ptr->ddma_dbell = 0;
681 681
682 /* Get next descriptor pointer. */ 682 /* Get next descriptor pointer. */
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 835f3f0319ca..85169c08d8dc 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -505,7 +505,7 @@ static int __init ar7_register_devices(void)
505 int res; 505 int res;
506 u32 *bootcr, val; 506 u32 *bootcr, val;
507#ifdef CONFIG_SERIAL_8250 507#ifdef CONFIG_SERIAL_8250
508 static struct uart_port uart_port[2]; 508 static struct uart_port uart_port[2] __initdata;
509 509
510 memset(uart_port, 0, sizeof(struct uart_port) * 2); 510 memset(uart_port, 0, sizeof(struct uart_port) * 2);
511 511
diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
index 5ad6f1db6567..c1fdd3682812 100644
--- a/arch/mips/ar7/prom.c
+++ b/arch/mips/ar7/prom.c
@@ -219,14 +219,6 @@ static void __init console_config(void)
219 if (strstr(prom_getcmdline(), "console=")) 219 if (strstr(prom_getcmdline(), "console="))
220 return; 220 return;
221 221
222#ifdef CONFIG_KGDB
223 if (!strstr(prom_getcmdline(), "nokgdb")) {
224 strcat(prom_getcmdline(), " console=kgdb");
225 kgdb_enabled = 1;
226 return;
227 }
228#endif
229
230 s = prom_getenv("modetty0"); 222 s = prom_getenv("modetty0");
231 if (s) { 223 if (s) {
232 baud = simple_strtoul(s, &p, 10); 224 baud = simple_strtoul(s, &p, 10);
@@ -280,13 +272,6 @@ static inline void serial_out(int offset, int value)
280 writel(value, (void *)PORT(offset)); 272 writel(value, (void *)PORT(offset));
281} 273}
282 274
283char prom_getchar(void)
284{
285 while (!(serial_in(UART_LSR) & UART_LSR_DR))
286 ;
287 return serial_in(UART_RX);
288}
289
290int prom_putchar(char c) 275int prom_putchar(char c)
291{ 276{
292 while ((serial_in(UART_LSR) & UART_LSR_TEMT) == 0) 277 while ((serial_in(UART_LSR) & UART_LSR_TEMT) == 0)
diff --git a/arch/mips/basler/excite/Kconfig b/arch/mips/basler/excite/Kconfig
deleted file mode 100644
index ba506075608b..000000000000
--- a/arch/mips/basler/excite/Kconfig
+++ /dev/null
@@ -1,9 +0,0 @@
1config BASLER_EXCITE_PROTOTYPE
2 bool "Support for pre-release units"
3 depends on BASLER_EXCITE
4 default n
5 help
6 Pre-series (prototype) units are different from later ones in
7 some ways. Select this option if you have one of these. Please
8 note that a kernel built with this option selected will not be
9 able to run on normal units.
diff --git a/arch/mips/basler/excite/Makefile b/arch/mips/basler/excite/Makefile
deleted file mode 100644
index cff29cf46d03..000000000000
--- a/arch/mips/basler/excite/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1#
2# Makefile for Basler eXcite
3#
4
5obj-$(CONFIG_BASLER_EXCITE) += excite_irq.o excite_prom.o excite_setup.o \
6 excite_device.o excite_procfs.o
7
8obj-m += excite_iodev.o
diff --git a/arch/mips/basler/excite/excite_device.c b/arch/mips/basler/excite/excite_device.c
deleted file mode 100644
index e00bc2d7f301..000000000000
--- a/arch/mips/basler/excite/excite_device.c
+++ /dev/null
@@ -1,403 +0,0 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
23#include <linux/ioport.h>
24#include <linux/err.h>
25#include <linux/jiffies.h>
26#include <linux/sched.h>
27#include <asm/types.h>
28#include <asm/rm9k-ocd.h>
29
30#include <excite.h>
31#include <rm9k_eth.h>
32#include <rm9k_wdt.h>
33#include <rm9k_xicap.h>
34#include <excite_nandflash.h>
35
36#include "excite_iodev.h"
37
38#define RM9K_GE_UNIT 0
39#define XICAP_UNIT 0
40#define NAND_UNIT 0
41
42#define DLL_TIMEOUT 3 /* seconds */
43
44
45#define RINIT(__start__, __end__, __name__, __parent__) { \
46 .name = __name__ "_0", \
47 .start = (__start__), \
48 .end = (__end__), \
49 .flags = 0, \
50 .parent = (__parent__) \
51}
52
53#define RINIT_IRQ(__irq__, __name__) { \
54 .name = __name__ "_0", \
55 .start = (__irq__), \
56 .end = (__irq__), \
57 .flags = IORESOURCE_IRQ, \
58 .parent = NULL \
59}
60
61
62
63enum {
64 slice_xicap,
65 slice_eth
66};
67
68
69
70static struct resource
71 excite_ctr_resource __maybe_unused = {
72 .name = "GPI counters",
73 .start = 0,
74 .end = 5,
75 .flags = 0,
76 .parent = NULL,
77 .sibling = NULL,
78 .child = NULL
79 },
80 excite_gpislice_resource __maybe_unused = {
81 .name = "GPI slices",
82 .start = 0,
83 .end = 1,
84 .flags = 0,
85 .parent = NULL,
86 .sibling = NULL,
87 .child = NULL
88 },
89 excite_mdio_channel_resource __maybe_unused = {
90 .name = "MDIO channels",
91 .start = 0,
92 .end = 1,
93 .flags = 0,
94 .parent = NULL,
95 .sibling = NULL,
96 .child = NULL
97 },
98 excite_fifomem_resource __maybe_unused = {
99 .name = "FIFO memory",
100 .start = 0,
101 .end = 767,
102 .flags = 0,
103 .parent = NULL,
104 .sibling = NULL,
105 .child = NULL
106 },
107 excite_scram_resource __maybe_unused = {
108 .name = "Scratch RAM",
109 .start = EXCITE_PHYS_SCRAM,
110 .end = EXCITE_PHYS_SCRAM + EXCITE_SIZE_SCRAM - 1,
111 .flags = IORESOURCE_MEM,
112 .parent = NULL,
113 .sibling = NULL,
114 .child = NULL
115 },
116 excite_fpga_resource __maybe_unused = {
117 .name = "System FPGA",
118 .start = EXCITE_PHYS_FPGA,
119 .end = EXCITE_PHYS_FPGA + EXCITE_SIZE_FPGA - 1,
120 .flags = IORESOURCE_MEM,
121 .parent = NULL,
122 .sibling = NULL,
123 .child = NULL
124 },
125 excite_nand_resource __maybe_unused = {
126 .name = "NAND flash control",
127 .start = EXCITE_PHYS_NAND,
128 .end = EXCITE_PHYS_NAND + EXCITE_SIZE_NAND - 1,
129 .flags = IORESOURCE_MEM,
130 .parent = NULL,
131 .sibling = NULL,
132 .child = NULL
133 },
134 excite_titan_resource __maybe_unused = {
135 .name = "TITAN registers",
136 .start = EXCITE_PHYS_TITAN,
137 .end = EXCITE_PHYS_TITAN + EXCITE_SIZE_TITAN - 1,
138 .flags = IORESOURCE_MEM,
139 .parent = NULL,
140 .sibling = NULL,
141 .child = NULL
142 };
143
144
145
146static void adjust_resources(struct resource *res, unsigned int n)
147{
148 struct resource *p;
149 const unsigned long mask = IORESOURCE_IO | IORESOURCE_MEM
150 | IORESOURCE_IRQ | IORESOURCE_DMA;
151
152 for (p = res; p < res + n; p++) {
153 const struct resource * const parent = p->parent;
154 if (parent) {
155 p->start += parent->start;
156 p->end += parent->start;
157 p->flags = parent->flags & mask;
158 }
159 }
160}
161
162
163
164#if defined(CONFIG_EXCITE_FCAP_GPI) || defined(CONFIG_EXCITE_FCAP_GPI_MODULE)
165static struct resource xicap_rsrc[] = {
166 RINIT(0x4840, 0x486f, XICAP_RESOURCE_FIFO_RX, &excite_titan_resource),
167 RINIT(0x4940, 0x494b, XICAP_RESOURCE_FIFO_TX, &excite_titan_resource),
168 RINIT(0x5040, 0x5127, XICAP_RESOURCE_XDMA, &excite_titan_resource),
169 RINIT(0x1000, 0x112f, XICAP_RESOURCE_PKTPROC, &excite_titan_resource),
170 RINIT(0x1100, 0x110f, XICAP_RESOURCE_PKT_STREAM, &excite_fpga_resource),
171 RINIT(0x0800, 0x0bff, XICAP_RESOURCE_DMADESC, &excite_scram_resource),
172 RINIT(slice_xicap, slice_xicap, XICAP_RESOURCE_GPI_SLICE, &excite_gpislice_resource),
173 RINIT(0x0100, 0x02ff, XICAP_RESOURCE_FIFO_BLK, &excite_fifomem_resource),
174 RINIT_IRQ(TITAN_IRQ, XICAP_RESOURCE_IRQ)
175};
176
177static struct platform_device xicap_pdev = {
178 .name = XICAP_NAME,
179 .id = XICAP_UNIT,
180 .num_resources = ARRAY_SIZE(xicap_rsrc),
181 .resource = xicap_rsrc
182};
183
184/*
185 * Create a platform device for the GPI port that receives the
186 * image data from the embedded camera.
187 */
188static int __init xicap_devinit(void)
189{
190 unsigned long tend;
191 u32 reg;
192 int retval;
193
194 adjust_resources(xicap_rsrc, ARRAY_SIZE(xicap_rsrc));
195
196 /* Power up the slice and configure it. */
197 reg = titan_readl(CPTC1R);
198 reg &= ~(0x11100 << slice_xicap);
199 titan_writel(reg, CPTC1R);
200
201 /* Enable slice & DLL. */
202 reg= titan_readl(CPRR);
203 reg &= ~(0x00030003 << (slice_xicap * 2));
204 titan_writel(reg, CPRR);
205
206 /* Wait for DLLs to lock */
207 tend = jiffies + DLL_TIMEOUT * HZ;
208 while (time_before(jiffies, tend)) {
209 if (!(~titan_readl(CPDSR) & (0x1 << (slice_xicap * 4))))
210 break;
211 yield();
212 }
213
214 if (~titan_readl(CPDSR) & (0x1 << (slice_xicap * 4))) {
215 printk(KERN_ERR "%s: DLL not locked after %u seconds\n",
216 xicap_pdev.name, DLL_TIMEOUT);
217 retval = -ETIME;
218 } else {
219 /* Register platform device */
220 retval = platform_device_register(&xicap_pdev);
221 }
222
223 return retval;
224}
225
226device_initcall(xicap_devinit);
227#endif /* defined(CONFIG_EXCITE_FCAP_GPI) || defined(CONFIG_EXCITE_FCAP_GPI_MODULE) */
228
229
230
231#if defined(CONFIG_WDT_RM9K_GPI) || defined(CONFIG_WDT_RM9K_GPI_MODULE)
232static struct resource wdt_rsrc[] = {
233 RINIT(0, 0, WDT_RESOURCE_COUNTER, &excite_ctr_resource),
234 RINIT(0x0084, 0x008f, WDT_RESOURCE_REGS, &excite_titan_resource),
235 RINIT_IRQ(TITAN_IRQ, WDT_RESOURCE_IRQ)
236};
237
238static struct platform_device wdt_pdev = {
239 .name = WDT_NAME,
240 .id = -1,
241 .num_resources = ARRAY_SIZE(wdt_rsrc),
242 .resource = wdt_rsrc
243};
244
245/*
246 * Create a platform device for the GPI port that receives the
247 * image data from the embedded camera.
248 */
249static int __init wdt_devinit(void)
250{
251 adjust_resources(wdt_rsrc, ARRAY_SIZE(wdt_rsrc));
252 return platform_device_register(&wdt_pdev);
253}
254
255device_initcall(wdt_devinit);
256#endif /* defined(CONFIG_WDT_RM9K_GPI) || defined(CONFIG_WDT_RM9K_GPI_MODULE) */
257
258
259
260static struct resource excite_nandflash_rsrc[] = {
261 RINIT(0x2000, 0x201f, EXCITE_NANDFLASH_RESOURCE_REGS, &excite_nand_resource)
262};
263
264static struct platform_device excite_nandflash_pdev = {
265 .name = "excite_nand",
266 .id = NAND_UNIT,
267 .num_resources = ARRAY_SIZE(excite_nandflash_rsrc),
268 .resource = excite_nandflash_rsrc
269};
270
271/*
272 * Create a platform device for the access to the nand-flash
273 * port
274 */
275static int __init excite_nandflash_devinit(void)
276{
277 adjust_resources(excite_nandflash_rsrc, ARRAY_SIZE(excite_nandflash_rsrc));
278
279 /* nothing to be done here */
280
281 /* Register platform device */
282 return platform_device_register(&excite_nandflash_pdev);
283}
284
285device_initcall(excite_nandflash_devinit);
286
287
288
289static struct resource iodev_rsrc[] = {
290 RINIT_IRQ(FPGA1_IRQ, IODEV_RESOURCE_IRQ)
291};
292
293static struct platform_device io_pdev = {
294 .name = IODEV_NAME,
295 .id = -1,
296 .num_resources = ARRAY_SIZE(iodev_rsrc),
297 .resource = iodev_rsrc
298};
299
300/*
301 * Create a platform device for the external I/O ports.
302 */
303static int __init io_devinit(void)
304{
305 adjust_resources(iodev_rsrc, ARRAY_SIZE(iodev_rsrc));
306 return platform_device_register(&io_pdev);
307}
308
309device_initcall(io_devinit);
310
311
312
313
314#if defined(CONFIG_RM9K_GE) || defined(CONFIG_RM9K_GE_MODULE)
315static struct resource rm9k_ge_rsrc[] = {
316 RINIT(0x2200, 0x27ff, RM9K_GE_RESOURCE_MAC, &excite_titan_resource),
317 RINIT(0x1800, 0x1fff, RM9K_GE_RESOURCE_MSTAT, &excite_titan_resource),
318 RINIT(0x2000, 0x212f, RM9K_GE_RESOURCE_PKTPROC, &excite_titan_resource),
319 RINIT(0x5140, 0x5227, RM9K_GE_RESOURCE_XDMA, &excite_titan_resource),
320 RINIT(0x4870, 0x489f, RM9K_GE_RESOURCE_FIFO_RX, &excite_titan_resource),
321 RINIT(0x494c, 0x4957, RM9K_GE_RESOURCE_FIFO_TX, &excite_titan_resource),
322 RINIT(0x0000, 0x007f, RM9K_GE_RESOURCE_FIFOMEM_RX, &excite_fifomem_resource),
323 RINIT(0x0080, 0x00ff, RM9K_GE_RESOURCE_FIFOMEM_TX, &excite_fifomem_resource),
324 RINIT(0x0180, 0x019f, RM9K_GE_RESOURCE_PHY, &excite_titan_resource),
325 RINIT(0x0000, 0x03ff, RM9K_GE_RESOURCE_DMADESC_RX, &excite_scram_resource),
326 RINIT(0x0400, 0x07ff, RM9K_GE_RESOURCE_DMADESC_TX, &excite_scram_resource),
327 RINIT(slice_eth, slice_eth, RM9K_GE_RESOURCE_GPI_SLICE, &excite_gpislice_resource),
328 RINIT(0, 0, RM9K_GE_RESOURCE_MDIO_CHANNEL, &excite_mdio_channel_resource),
329 RINIT_IRQ(TITAN_IRQ, RM9K_GE_RESOURCE_IRQ_MAIN),
330 RINIT_IRQ(PHY_IRQ, RM9K_GE_RESOURCE_IRQ_PHY)
331};
332
333static struct platform_device rm9k_ge_pdev = {
334 .name = RM9K_GE_NAME,
335 .id = RM9K_GE_UNIT,
336 .num_resources = ARRAY_SIZE(rm9k_ge_rsrc),
337 .resource = rm9k_ge_rsrc
338};
339
340
341
342/*
343 * Create a platform device for the Ethernet port.
344 */
345static int __init rm9k_ge_devinit(void)
346{
347 u32 reg;
348
349 adjust_resources(rm9k_ge_rsrc, ARRAY_SIZE(rm9k_ge_rsrc));
350
351 /* Power up the slice and configure it. */
352 reg = titan_readl(CPTC1R);
353 reg &= ~(0x11000 << slice_eth);
354 reg |= 0x100 << slice_eth;
355 titan_writel(reg, CPTC1R);
356
357 /* Take the MAC out of reset, reset the DLLs. */
358 reg = titan_readl(CPRR);
359 reg &= ~(0x00030000 << (slice_eth * 2));
360 reg |= 0x3 << (slice_eth * 2);
361 titan_writel(reg, CPRR);
362
363 return platform_device_register(&rm9k_ge_pdev);
364}
365
366device_initcall(rm9k_ge_devinit);
367#endif /* defined(CONFIG_RM9K_GE) || defined(CONFIG_RM9K_GE_MODULE) */
368
369
370
371static int __init excite_setup_devs(void)
372{
373 int res;
374 u32 reg;
375
376 /* Enable xdma and fifo interrupts */
377 reg = titan_readl(0x0050);
378 titan_writel(reg | 0x18000000, 0x0050);
379
380 res = request_resource(&iomem_resource, &excite_titan_resource);
381 if (res)
382 return res;
383 res = request_resource(&iomem_resource, &excite_scram_resource);
384 if (res)
385 return res;
386 res = request_resource(&iomem_resource, &excite_fpga_resource);
387 if (res)
388 return res;
389 res = request_resource(&iomem_resource, &excite_nand_resource);
390 if (res)
391 return res;
392 excite_fpga_resource.flags = excite_fpga_resource.parent->flags &
393 ( IORESOURCE_IO | IORESOURCE_MEM
394 | IORESOURCE_IRQ | IORESOURCE_DMA);
395 excite_nand_resource.flags = excite_nand_resource.parent->flags &
396 ( IORESOURCE_IO | IORESOURCE_MEM
397 | IORESOURCE_IRQ | IORESOURCE_DMA);
398
399 return 0;
400}
401
402arch_initcall(excite_setup_devs);
403
diff --git a/arch/mips/basler/excite/excite_iodev.c b/arch/mips/basler/excite/excite_iodev.c
deleted file mode 100644
index 938b1d0b7652..000000000000
--- a/arch/mips/basler/excite/excite_iodev.c
+++ /dev/null
@@ -1,178 +0,0 @@
1/*
2 * Copyright (C) 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/compiler.h>
21#include <linux/init.h>
22#include <linux/module.h>
23#include <linux/sched.h>
24#include <linux/wait.h>
25#include <linux/poll.h>
26#include <linux/interrupt.h>
27#include <linux/platform_device.h>
28#include <linux/miscdevice.h>
29#include <linux/smp_lock.h>
30
31#include "excite_iodev.h"
32
33
34
35static const struct resource *iodev_get_resource(struct platform_device *, const char *, unsigned int);
36static int __init iodev_probe(struct platform_device *);
37static int __exit iodev_remove(struct platform_device *);
38static int iodev_open(struct inode *, struct file *);
39static int iodev_release(struct inode *, struct file *);
40static ssize_t iodev_read(struct file *, char __user *, size_t s, loff_t *);
41static unsigned int iodev_poll(struct file *, struct poll_table_struct *);
42static irqreturn_t iodev_irqhdl(int, void *);
43
44
45
46static const char iodev_name[] = "iodev";
47static unsigned int iodev_irq;
48static DECLARE_WAIT_QUEUE_HEAD(wq);
49
50
51
52static const struct file_operations fops =
53{
54 .owner = THIS_MODULE,
55 .open = iodev_open,
56 .release = iodev_release,
57 .read = iodev_read,
58 .poll = iodev_poll
59};
60
61static struct miscdevice miscdev =
62{
63 .minor = MISC_DYNAMIC_MINOR,
64 .name = iodev_name,
65 .fops = &fops
66};
67
68static struct platform_driver iodev_driver = {
69 .driver = {
70 .name = iodev_name,
71 .owner = THIS_MODULE,
72 },
73 .probe = iodev_probe,
74 .remove = __devexit_p(iodev_remove),
75};
76
77
78
79static const struct resource *
80iodev_get_resource(struct platform_device *pdv, const char *name,
81 unsigned int type)
82{
83 char buf[80];
84 if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf)
85 return NULL;
86 return platform_get_resource_byname(pdv, type, buf);
87}
88
89
90
91/* No hotplugging on the platform bus - use __init */
92static int __init iodev_probe(struct platform_device *dev)
93{
94 const struct resource * const ri =
95 iodev_get_resource(dev, IODEV_RESOURCE_IRQ, IORESOURCE_IRQ);
96
97 if (unlikely(!ri))
98 return -ENXIO;
99
100 iodev_irq = ri->start;
101 return misc_register(&miscdev);
102}
103
104
105
106static int __exit iodev_remove(struct platform_device *dev)
107{
108 return misc_deregister(&miscdev);
109}
110
111static int iodev_open(struct inode *i, struct file *f)
112{
113 int ret;
114
115 ret = request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED,
116 iodev_name, &miscdev);
117
118 return ret;
119}
120
121static int iodev_release(struct inode *i, struct file *f)
122{
123 free_irq(iodev_irq, &miscdev);
124 return 0;
125}
126
127
128
129
130static ssize_t
131iodev_read(struct file *f, char __user *d, size_t s, loff_t *o)
132{
133 ssize_t ret;
134 DEFINE_WAIT(w);
135
136 prepare_to_wait(&wq, &w, TASK_INTERRUPTIBLE);
137 if (!signal_pending(current))
138 schedule();
139 ret = signal_pending(current) ? -ERESTARTSYS : 0;
140 finish_wait(&wq, &w);
141 return ret;
142}
143
144
145static unsigned int iodev_poll(struct file *f, struct poll_table_struct *p)
146{
147 poll_wait(f, &wq, p);
148 return POLLOUT | POLLWRNORM;
149}
150
151static irqreturn_t iodev_irqhdl(int irq, void *ctxt)
152{
153 wake_up(&wq);
154
155 return IRQ_HANDLED;
156}
157
158static int __init iodev_init_module(void)
159{
160 return platform_driver_register(&iodev_driver);
161}
162
163
164
165static void __exit iodev_cleanup_module(void)
166{
167 platform_driver_unregister(&iodev_driver);
168}
169
170module_init(iodev_init_module);
171module_exit(iodev_cleanup_module);
172
173
174
175MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
176MODULE_DESCRIPTION("Basler eXcite i/o interrupt handler");
177MODULE_VERSION("0.0");
178MODULE_LICENSE("GPL");
diff --git a/arch/mips/basler/excite/excite_iodev.h b/arch/mips/basler/excite/excite_iodev.h
deleted file mode 100644
index cbfbb5d2ee62..000000000000
--- a/arch/mips/basler/excite/excite_iodev.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __EXCITE_IODEV_H__
2#define __EXCITE_IODEV_H__
3
4/* Device name */
5#define IODEV_NAME "iodev"
6
7/* Resource names */
8#define IODEV_RESOURCE_IRQ "excite_iodev_irq"
9
10#endif /* __EXCITE_IODEV_H__ */
diff --git a/arch/mips/basler/excite/excite_irq.c b/arch/mips/basler/excite/excite_irq.c
deleted file mode 100644
index 934e0a6b1011..000000000000
--- a/arch/mips/basler/excite/excite_irq.c
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * Copyright (C) by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslereb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/kernel_stat.h>
23#include <linux/module.h>
24#include <linux/signal.h>
25#include <linux/sched.h>
26#include <linux/types.h>
27#include <linux/interrupt.h>
28#include <linux/ioport.h>
29#include <linux/timex.h>
30#include <linux/slab.h>
31#include <linux/random.h>
32#include <linux/bitops.h>
33#include <asm/bootinfo.h>
34#include <asm/io.h>
35#include <asm/irq.h>
36#include <asm/irq_cpu.h>
37#include <asm/mipsregs.h>
38#include <asm/system.h>
39#include <asm/rm9k-ocd.h>
40
41#include <excite.h>
42
43extern asmlinkage void excite_handle_int(void);
44
45/*
46 * Initialize the interrupt handler
47 */
48void __init arch_init_irq(void)
49{
50 mips_cpu_irq_init();
51 rm7k_cpu_irq_init();
52 rm9k_cpu_irq_init();
53}
54
55asmlinkage void plat_irq_dispatch(void)
56{
57 const u32
58 interrupts = read_c0_cause() >> 8,
59 mask = ((read_c0_status() >> 8) & 0x000000ff) |
60 (read_c0_intcontrol() & 0x0000ff00),
61 pending = interrupts & mask;
62 u32 msgintflags, msgintmask, msgint;
63
64 /* process timer interrupt */
65 if (pending & (1 << TIMER_IRQ)) {
66 do_IRQ(TIMER_IRQ);
67 return;
68 }
69
70 /* Process PCI interrupts */
71#if USB_IRQ < 10
72 msgintflags = ocd_readl(INTP0Status0 + (USB_MSGINT / 0x20 * 0x10));
73 msgintmask = ocd_readl(INTP0Mask0 + (USB_MSGINT / 0x20 * 0x10));
74 msgint = msgintflags & msgintmask & (0x1 << (USB_MSGINT % 0x20));
75 if ((pending & (1 << USB_IRQ)) && msgint) {
76#else
77 if (pending & (1 << USB_IRQ)) {
78#endif
79 do_IRQ(USB_IRQ);
80 return;
81 }
82
83 /* Process TITAN interrupts */
84 msgintflags = ocd_readl(INTP0Status0 + (TITAN_MSGINT / 0x20 * 0x10));
85 msgintmask = ocd_readl(INTP0Mask0 + (TITAN_MSGINT / 0x20 * 0x10));
86 msgint = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20));
87 if ((pending & (1 << TITAN_IRQ)) && msgint) {
88 ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10));
89 do_IRQ(TITAN_IRQ);
90 return;
91 }
92
93 /* Process FPGA line #0 interrupts */
94 msgintflags = ocd_readl(INTP0Status0 + (FPGA0_MSGINT / 0x20 * 0x10));
95 msgintmask = ocd_readl(INTP0Mask0 + (FPGA0_MSGINT / 0x20 * 0x10));
96 msgint = msgintflags & msgintmask & (0x1 << (FPGA0_MSGINT % 0x20));
97 if ((pending & (1 << FPGA0_IRQ)) && msgint) {
98 do_IRQ(FPGA0_IRQ);
99 return;
100 }
101
102 /* Process FPGA line #1 interrupts */
103 msgintflags = ocd_readl(INTP0Status0 + (FPGA1_MSGINT / 0x20 * 0x10));
104 msgintmask = ocd_readl(INTP0Mask0 + (FPGA1_MSGINT / 0x20 * 0x10));
105 msgint = msgintflags & msgintmask & (0x1 << (FPGA1_MSGINT % 0x20));
106 if ((pending & (1 << FPGA1_IRQ)) && msgint) {
107 do_IRQ(FPGA1_IRQ);
108 return;
109 }
110
111 /* Process PHY interrupts */
112 msgintflags = ocd_readl(INTP0Status0 + (PHY_MSGINT / 0x20 * 0x10));
113 msgintmask = ocd_readl(INTP0Mask0 + (PHY_MSGINT / 0x20 * 0x10));
114 msgint = msgintflags & msgintmask & (0x1 << (PHY_MSGINT % 0x20));
115 if ((pending & (1 << PHY_IRQ)) && msgint) {
116 do_IRQ(PHY_IRQ);
117 return;
118 }
119
120 /* Process spurious interrupts */
121 spurious_interrupt();
122}
diff --git a/arch/mips/basler/excite/excite_procfs.c b/arch/mips/basler/excite/excite_procfs.c
deleted file mode 100644
index 08923e6825b5..000000000000
--- a/arch/mips/basler/excite/excite_procfs.c
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * Copyright (C) 2004, 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * Procfs support for Basler eXcite
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/module.h>
22#include <linux/proc_fs.h>
23#include <linux/seq_file.h>
24#include <linux/stat.h>
25#include <asm/page.h>
26#include <asm/io.h>
27#include <asm/system.h>
28#include <asm/rm9k-ocd.h>
29
30#include <excite.h>
31
32static int excite_unit_id_proc_show(struct seq_file *m, void *v)
33{
34 seq_printf(m, "%06x", unit_id);
35 return 0;
36}
37
38static int excite_unit_id_proc_open(struct inode *inode, struct file *file)
39{
40 return single_open(file, excite_unit_id_proc_show, NULL);
41}
42
43static const struct file_operations excite_unit_id_proc_fops = {
44 .owner = THIS_MODULE,
45 .open = excite_unit_id_proc_open,
46 .read = seq_read,
47 .llseek = seq_lseek,
48 .release = single_release,
49};
50
51static int
52excite_bootrom_read(char *page, char **start, off_t off, int count,
53 int *eof, void *data)
54{
55 void __iomem * src;
56
57 if (off >= EXCITE_SIZE_BOOTROM) {
58 *eof = 1;
59 return 0;
60 }
61
62 if ((off + count) > EXCITE_SIZE_BOOTROM)
63 count = EXCITE_SIZE_BOOTROM - off;
64
65 src = ioremap(EXCITE_PHYS_BOOTROM + off, count);
66 if (src) {
67 memcpy_fromio(page, src, count);
68 iounmap(src);
69 *start = page;
70 } else {
71 count = -ENOMEM;
72 }
73
74 return count;
75}
76
77void excite_procfs_init(void)
78{
79 /* Create & populate /proc/excite */
80 struct proc_dir_entry * const pdir = proc_mkdir("excite", NULL);
81 if (pdir) {
82 struct proc_dir_entry * e;
83
84 e = proc_create("unit_id", S_IRUGO, pdir,
85 &excite_unit_id_proc_fops);
86 if (e) e->size = 6;
87
88 e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
89 excite_bootrom_read, NULL);
90 if (e) e->size = EXCITE_SIZE_BOOTROM;
91 }
92}
diff --git a/arch/mips/basler/excite/excite_prom.c b/arch/mips/basler/excite/excite_prom.c
deleted file mode 100644
index 68d8bc597e34..000000000000
--- a/arch/mips/basler/excite/excite_prom.c
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 * Copyright (C) 2004, 2005 by Thomas Koeller (thomas.koeller@baslerweb.com)
3 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
4 * Manish Lachwani.
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
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/mm.h>
24#include <linux/delay.h>
25#include <linux/smp.h>
26#include <linux/module.h>
27#include <asm/io.h>
28#include <asm/pgtable.h>
29#include <asm/processor.h>
30#include <asm/reboot.h>
31#include <asm/system.h>
32#include <asm/bootinfo.h>
33#include <asm/string.h>
34
35#include <excite.h>
36
37/* This struct is used by Redboot to pass arguments to the kernel */
38typedef struct
39{
40 char *name;
41 char *val;
42} t_env_var;
43
44struct parmblock {
45 t_env_var memsize;
46 t_env_var modetty0;
47 t_env_var ethaddr;
48 t_env_var env_end;
49 char *argv[2];
50 char text[0];
51};
52
53static unsigned int prom_argc;
54static const char ** prom_argv;
55static const t_env_var * prom_env;
56
57static void prom_halt(void) __attribute__((noreturn));
58static void prom_exit(void) __attribute__((noreturn));
59
60
61
62const char *get_system_type(void)
63{
64 return "Basler eXcite";
65}
66
67/*
68 * Halt the system
69 */
70static void prom_halt(void)
71{
72 printk(KERN_NOTICE "\n** System halted.\n");
73 while (1)
74 asm volatile (
75 "\t.set\tmips3\n"
76 "\twait\n"
77 "\t.set\tmips0\n"
78 );
79}
80
81/*
82 * Reset the CPU and re-enter Redboot
83 */
84static void prom_exit(void)
85{
86 unsigned int i;
87 volatile unsigned char * const flg =
88 (volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_DPR);
89
90 /* Clear the watchdog reset flag, set the reboot flag */
91 *flg &= ~0x01;
92 *flg |= 0x80;
93
94 for (i = 0; i < 10; i++) {
95 *(volatile unsigned char *) (EXCITE_ADDR_FPGA + EXCITE_FPGA_SYSCTL) = 0x02;
96 iob();
97 mdelay(1000);
98 }
99
100 printk(KERN_NOTICE "Reset failed\n");
101 prom_halt();
102}
103
104static const char __init *prom_getenv(char *name)
105{
106 const t_env_var * p;
107 for (p = prom_env; p->name != NULL; p++)
108 if(strcmp(name, p->name) == 0)
109 break;
110 return p->val;
111}
112
113/*
114 * Init routine which accepts the variables from Redboot
115 */
116void __init prom_init(void)
117{
118 const struct parmblock * const pb = (struct parmblock *) fw_arg2;
119
120 prom_argc = fw_arg0;
121 prom_argv = (const char **) fw_arg1;
122 prom_env = &pb->memsize;
123
124 /* Callbacks for halt, restart */
125 _machine_restart = (void (*)(char *)) prom_exit;
126 _machine_halt = prom_halt;
127
128#ifdef CONFIG_32BIT
129 /* copy command line */
130 strcpy(arcs_cmdline, prom_argv[1]);
131 memsize = simple_strtol(prom_getenv("memsize"), NULL, 16);
132 strcpy(modetty, prom_getenv("modetty0"));
133#endif /* CONFIG_32BIT */
134
135#ifdef CONFIG_64BIT
136# error 64 bit support not implemented
137#endif /* CONFIG_64BIT */
138}
139
140/* This is called from free_initmem(), so we need to provide it */
141void __init prom_free_prom_memory(void)
142{
143 /* Nothing to do */
144}
diff --git a/arch/mips/basler/excite/excite_setup.c b/arch/mips/basler/excite/excite_setup.c
deleted file mode 100644
index d66b3b8edf2a..000000000000
--- a/arch/mips/basler/excite/excite_setup.c
+++ /dev/null
@@ -1,302 +0,0 @@
1/*
2 * Copyright (C) 2004, 2005 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle and
5 * Manish Lachwani.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/types.h>
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/string.h>
26#include <linux/tty.h>
27#include <linux/serial_core.h>
28#include <linux/serial.h>
29#include <linux/serial_8250.h>
30#include <linux/ioport.h>
31#include <linux/spinlock.h>
32#include <asm/bootinfo.h>
33#include <asm/mipsregs.h>
34#include <asm/pgtable-32.h>
35#include <asm/io.h>
36#include <asm/time.h>
37#include <asm/rm9k-ocd.h>
38
39#include <excite.h>
40
41#define TITAN_UART_CLK 25000000
42
43#if 1
44/* normal serial port assignment */
45#define REGBASE_SER0 0x0208
46#define REGBASE_SER1 0x0238
47#define MASK_SER0 0x1
48#define MASK_SER1 0x2
49#else
50/* serial ports swapped */
51#define REGBASE_SER0 0x0238
52#define REGBASE_SER1 0x0208
53#define MASK_SER0 0x2
54#define MASK_SER1 0x1
55#endif
56
57unsigned long memsize;
58char modetty[30];
59unsigned int titan_irq = TITAN_IRQ;
60static void __iomem * ctl_regs;
61u32 unit_id;
62
63volatile void __iomem * const ocd_base = (void *) (EXCITE_ADDR_OCD);
64volatile void __iomem * const titan_base = (void *) (EXCITE_ADDR_TITAN);
65
66/* Protect access to shared GPI registers */
67DEFINE_SPINLOCK(titan_lock);
68int titan_irqflags;
69
70
71/*
72 * The eXcite platform uses the alternate timer interrupt
73 *
74 * Fixme: At the time of this writing cevt-r4k.c doesn't yet know about how
75 * to handle the alternate timer interrupt of the RM9000.
76 */
77void __init plat_time_init(void)
78{
79 const u32 modebit5 = ocd_readl(0x00e4);
80 unsigned int mult = ((modebit5 >> 11) & 0x1f) + 2;
81 unsigned int div = ((modebit5 >> 16) & 0x1f) + 2;
82
83 if (div == 33)
84 div = 1;
85 mips_hpt_frequency = EXCITE_CPU_EXT_CLOCK * mult / div / 2;
86}
87
88static int __init excite_init_console(void)
89{
90#if defined(CONFIG_SERIAL_8250)
91 static __initdata char serr[] =
92 KERN_ERR "Serial port #%u setup failed\n";
93 struct uart_port up;
94
95 /* Take the DUART out of reset */
96 titan_writel(0x00ff1cff, CPRR);
97
98#if (CONFIG_SERIAL_8250_NR_UARTS > 1)
99 /* Enable both ports */
100 titan_writel(MASK_SER0 | MASK_SER1, UACFG);
101#else
102 /* Enable port #0 only */
103 titan_writel(MASK_SER0, UACFG);
104#endif
105
106 /*
107 * Set up serial port #0. Do not use autodetection; the result is
108 * not what we want.
109 */
110 memset(&up, 0, sizeof(up));
111 up.membase = (char *) titan_addr(REGBASE_SER0);
112 up.irq = TITAN_IRQ;
113 up.uartclk = TITAN_UART_CLK;
114 up.regshift = 0;
115 up.iotype = UPIO_RM9000;
116 up.type = PORT_RM9000;
117 up.flags = UPF_SHARE_IRQ;
118 up.line = 0;
119 if (early_serial_setup(&up))
120 printk(serr, up.line);
121
122#if CONFIG_SERIAL_8250_NR_UARTS > 1
123 /* And now for port #1. */
124 up.membase = (char *) titan_addr(REGBASE_SER1);
125 up.line = 1;
126 if (early_serial_setup(&up))
127 printk(serr, up.line);
128#endif /* CONFIG_SERIAL_8250_NR_UARTS > 1 */
129#else
130 /* Leave the DUART in reset */
131 titan_writel(0x00ff3cff, CPRR);
132#endif /* defined(CONFIG_SERIAL_8250) */
133
134 return 0;
135}
136
137static int __init excite_platform_init(void)
138{
139 unsigned int i;
140 unsigned char buf[3];
141 u8 reg;
142 void __iomem * dpr;
143
144 /* BIU buffer allocations */
145 ocd_writel(8, CPURSLMT); /* CPU */
146 titan_writel(4, CPGRWL); /* GPI / Ethernet */
147
148 /* Map control registers located in FPGA */
149 ctl_regs = ioremap_nocache(EXCITE_PHYS_FPGA + EXCITE_FPGA_SYSCTL, 16);
150 if (!ctl_regs)
151 panic("eXcite: failed to map platform control registers\n");
152 memcpy_fromio(buf, ctl_regs + 2, ARRAY_SIZE(buf));
153 unit_id = buf[0] | (buf[1] << 8) | (buf[2] << 16);
154
155 /* Clear the reboot flag */
156 dpr = ioremap_nocache(EXCITE_PHYS_FPGA + EXCITE_FPGA_DPR, 1);
157 reg = __raw_readb(dpr);
158 __raw_writeb(reg & 0x7f, dpr);
159 iounmap(dpr);
160
161 /* Interrupt controller setup */
162 for (i = INTP0Status0; i < INTP0Status0 + 0x80; i += 0x10) {
163 ocd_writel(0x00000000, i + 0x04);
164 ocd_writel(0xffffffff, i + 0x0c);
165 }
166 ocd_writel(0x2, NMICONFIG);
167
168 ocd_writel(0x1 << (TITAN_MSGINT % 0x20),
169 INTP0Mask0 + (0x10 * (TITAN_MSGINT / 0x20)));
170 ocd_writel((0x1 << (FPGA0_MSGINT % 0x20))
171 | ocd_readl(INTP0Mask0 + (0x10 * (FPGA0_MSGINT / 0x20))),
172 INTP0Mask0 + (0x10 * (FPGA0_MSGINT / 0x20)));
173 ocd_writel((0x1 << (FPGA1_MSGINT % 0x20))
174 | ocd_readl(INTP0Mask0 + (0x10 * (FPGA1_MSGINT / 0x20))),
175 INTP0Mask0 + (0x10 * (FPGA1_MSGINT / 0x20)));
176 ocd_writel((0x1 << (PHY_MSGINT % 0x20))
177 | ocd_readl(INTP0Mask0 + (0x10 * (PHY_MSGINT / 0x20))),
178 INTP0Mask0 + (0x10 * (PHY_MSGINT / 0x20)));
179#if USB_IRQ < 10
180 ocd_writel((0x1 << (USB_MSGINT % 0x20))
181 | ocd_readl(INTP0Mask0 + (0x10 * (USB_MSGINT / 0x20))),
182 INTP0Mask0 + (0x10 * (USB_MSGINT / 0x20)));
183#endif
184 /* Enable the packet FIFO, XDMA and XDMA arbiter */
185 titan_writel(0x00ff18ff, CPRR);
186
187 /*
188 * Set up the PADMUX. Power down all ethernet slices,
189 * they will be powered up and configured at device startup.
190 */
191 titan_writel(0x00878206, CPTC1R);
192 titan_writel(0x00001100, CPTC0R); /* latch PADMUX, enable WCIMODE */
193
194 /* Reset and enable the FIFO block */
195 titan_writel(0x00000001, SDRXFCIE);
196 titan_writel(0x00000001, SDTXFCIE);
197 titan_writel(0x00000100, SDRXFCIE);
198 titan_writel(0x00000000, SDTXFCIE);
199
200 /*
201 * Initialize the common interrupt shared by all components of
202 * the GPI/Ethernet subsystem.
203 */
204 titan_writel((EXCITE_PHYS_OCD >> 12), CPCFG0);
205 titan_writel(TITAN_MSGINT, CPCFG1);
206
207 /*
208 * XDMA configuration.
209 * In order for the XDMA to be sharable among multiple drivers,
210 * the setup must be done here in the platform. The reason is that
211 * this setup can only be done while the XDMA is in reset. If this
212 * were done in a driver, it would interrupt all other drivers
213 * using the XDMA.
214 */
215 titan_writel(0x80021dff, GXCFG); /* XDMA reset */
216 titan_writel(0x00000000, CPXCISRA);
217 titan_writel(0x00000000, CPXCISRB); /* clear pending interrupts */
218#if defined(CONFIG_HIGHMEM)
219# error change for HIGHMEM support!
220#else
221 titan_writel(0x00000000, GXDMADRPFX); /* buffer address prefix */
222#endif
223 titan_writel(0, GXDMA_DESCADR);
224
225 for (i = 0x5040; i <= 0x5300; i += 0x0040)
226 titan_writel(0x80080000, i); /* reset channel */
227
228 titan_writel((0x1 << 29) /* no sparse tx descr. */
229 | (0x1 << 28) /* no sparse rx descr. */
230 | (0x1 << 23) | (0x1 << 24) /* descriptor coherency */
231 | (0x1 << 21) | (0x1 << 22) /* data coherency */
232 | (0x1 << 17)
233 | 0x1dff,
234 GXCFG);
235
236#if defined(CONFIG_SMP)
237# error No SMP support
238#else
239 /* All interrupts go to core #0 only. */
240 titan_writel(0x1f007fff, CPDST0A);
241 titan_writel(0x00000000, CPDST0B);
242 titan_writel(0x0000ff3f, CPDST1A);
243 titan_writel(0x00000000, CPDST1B);
244 titan_writel(0x00ffffff, CPXDSTA);
245 titan_writel(0x00000000, CPXDSTB);
246#endif
247
248 /* Enable DUART interrupts, disable everything else. */
249 titan_writel(0x04000000, CPGIG0ER);
250 titan_writel(0x000000c0, CPGIG1ER);
251
252 excite_procfs_init();
253 return 0;
254}
255
256void __init plat_mem_setup(void)
257{
258 volatile u32 * const boot_ocd_base = (u32 *) 0xbf7fc000;
259
260 /* Announce RAM to system */
261 add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
262
263 /* Set up the peripheral address map */
264 *(boot_ocd_base + (LKB9 / sizeof(u32))) = 0;
265 *(boot_ocd_base + (LKB10 / sizeof(u32))) = 0;
266 *(boot_ocd_base + (LKB11 / sizeof(u32))) = 0;
267 *(boot_ocd_base + (LKB12 / sizeof(u32))) = 0;
268 wmb();
269 *(boot_ocd_base + (LKB0 / sizeof(u32))) = EXCITE_PHYS_OCD >> 4;
270 wmb();
271
272 ocd_writel((EXCITE_PHYS_TITAN >> 4) | 0x1UL, LKB5);
273 ocd_writel(((EXCITE_SIZE_TITAN >> 4) & 0x7fffff00) - 0x100, LKM5);
274 ocd_writel((EXCITE_PHYS_SCRAM >> 4) | 0x1UL, LKB13);
275 ocd_writel(((EXCITE_SIZE_SCRAM >> 4) & 0xffffff00) - 0x100, LKM13);
276
277 /* Local bus slot #0 */
278 ocd_writel(0x00040510, LDP0);
279 ocd_writel((EXCITE_PHYS_BOOTROM >> 4) | 0x1UL, LKB9);
280 ocd_writel(((EXCITE_SIZE_BOOTROM >> 4) & 0x03ffff00) - 0x100, LKM9);
281
282 /* Local bus slot #2 */
283 ocd_writel(0x00000330, LDP2);
284 ocd_writel((EXCITE_PHYS_FPGA >> 4) | 0x1, LKB11);
285 ocd_writel(((EXCITE_SIZE_FPGA >> 4) - 0x100) & 0x03ffff00, LKM11);
286
287 /* Local bus slot #3 */
288 ocd_writel(0x00123413, LDP3);
289 ocd_writel((EXCITE_PHYS_NAND >> 4) | 0x1, LKB12);
290 ocd_writel(((EXCITE_SIZE_NAND >> 4) - 0x100) & 0x03ffff00, LKM12);
291}
292
293
294
295console_initcall(excite_init_console);
296arch_initcall(excite_platform_init);
297
298EXPORT_SYMBOL(titan_lock);
299EXPORT_SYMBOL(titan_irqflags);
300EXPORT_SYMBOL(titan_irq);
301EXPORT_SYMBOL(ocd_base);
302EXPORT_SYMBOL(titan_base);
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index fb284c3b2cff..c51405e57921 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -100,11 +100,11 @@ static __init void prom_init_console(void)
100 100
101static __init void prom_init_cmdline(void) 101static __init void prom_init_cmdline(void)
102{ 102{
103 static char buf[CL_SIZE] __initdata; 103 static char buf[COMMAND_LINE_SIZE] __initdata;
104 104
105 /* Get the kernel command line from CFE */ 105 /* Get the kernel command line from CFE */
106 if (cfe_getenv("LINUX_CMDLINE", buf, CL_SIZE) >= 0) { 106 if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) {
107 buf[CL_SIZE-1] = 0; 107 buf[COMMAND_LINE_SIZE - 1] = 0;
108 strcpy(arcs_cmdline, buf); 108 strcpy(arcs_cmdline, buf);
109 } 109 }
110 110
@@ -112,13 +112,13 @@ static __init void prom_init_cmdline(void)
112 * as CFE is not available anymore later in the boot process. */ 112 * as CFE is not available anymore later in the boot process. */
113 if ((strstr(arcs_cmdline, "console=")) == NULL) { 113 if ((strstr(arcs_cmdline, "console=")) == NULL) {
114 /* Try to read the default serial port used by CFE */ 114 /* Try to read the default serial port used by CFE */
115 if ((cfe_getenv("BOOT_CONSOLE", buf, CL_SIZE) < 0) 115 if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0)
116 || (strncmp("uart", buf, 4))) 116 || (strncmp("uart", buf, 4)))
117 /* Default to uart0 */ 117 /* Default to uart0 */
118 strcpy(buf, "uart0"); 118 strcpy(buf, "uart0");
119 119
120 /* Compute the new command line */ 120 /* Compute the new command line */
121 snprintf(arcs_cmdline, CL_SIZE, "%s console=ttyS%c,115200", 121 snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200",
122 arcs_cmdline, buf[4]); 122 arcs_cmdline, buf[4]);
123 } 123 }
124} 124}
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 05a35cf5963d..1fe412c43171 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -346,27 +346,26 @@ static struct board_info __initdata board_96348gw = {
346}; 346};
347 347
348static struct board_info __initdata board_FAST2404 = { 348static struct board_info __initdata board_FAST2404 = {
349 .name = "F@ST2404", 349 .name = "F@ST2404",
350 .expected_cpu_id = 0x6348, 350 .expected_cpu_id = 0x6348,
351
352 .has_enet0 = 1,
353 .has_enet1 = 1,
354 .has_pci = 1,
355 351
356 .enet0 = { 352 .has_enet0 = 1,
357 .has_phy = 1, 353 .has_enet1 = 1,
358 .use_internal_phy = 1, 354 .has_pci = 1,
359 },
360 355
361 .enet1 = { 356 .enet0 = {
362 .force_speed_100 = 1, 357 .has_phy = 1,
363 .force_duplex_full = 1, 358 .use_internal_phy = 1,
364 }, 359 },
365 360
361 .enet1 = {
362 .force_speed_100 = 1,
363 .force_duplex_full = 1,
364 },
366 365
367 .has_ohci0 = 1, 366 .has_ohci0 = 1,
368 .has_pccard = 1, 367 .has_pccard = 1,
369 .has_ehci0 = 1, 368 .has_ehci0 = 1,
370}; 369};
371 370
372static struct board_info __initdata board_DV201AMR = { 371static struct board_info __initdata board_DV201AMR = {
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
index fb284fbc5853..be252efa0757 100644
--- a/arch/mips/bcm63xx/prom.c
+++ b/arch/mips/bcm63xx/prom.c
@@ -40,9 +40,6 @@ void __init prom_init(void)
40 reg &= ~mask; 40 reg &= ~mask;
41 bcm_perf_writel(reg, PERF_CKCTL_REG); 41 bcm_perf_writel(reg, PERF_CKCTL_REG);
42 42
43 /* assign command line from kernel config */
44 strcpy(arcs_cmdline, CONFIG_CMDLINE);
45
46 /* register gpiochip */ 43 /* register gpiochip */
47 bcm63xx_gpio_init(); 44 bcm63xx_gpio_init();
48 45
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
index ba63401c6e10..4667a5f9280b 100644
--- a/arch/mips/boot/.gitignore
+++ b/arch/mips/boot/.gitignore
@@ -1,4 +1,5 @@
1mkboot 1mkboot
2elf2ecoff 2elf2ecoff
3vmlinux.*
3zImage 4zImage
4zImage.tmp 5zImage.tmp
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 2a209d74f0b4..e39a08edcaaa 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -25,10 +25,10 @@ strip-flags = $(addprefix --remove-section=,$(drop-sections))
25 25
26VMLINUX = vmlinux 26VMLINUX = vmlinux
27 27
28all: vmlinux.ecoff vmlinux.srec addinitrd 28all: vmlinux.ecoff vmlinux.srec
29 29
30vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) 30vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX)
31 $(obj)/elf2ecoff $(VMLINUX) vmlinux.ecoff $(E2EFLAGS) 31 $(obj)/elf2ecoff $(VMLINUX) $(obj)/vmlinux.ecoff $(E2EFLAGS)
32 32
33$(obj)/elf2ecoff: $(obj)/elf2ecoff.c 33$(obj)/elf2ecoff: $(obj)/elf2ecoff.c
34 $(HOSTCC) -o $@ $^ 34 $(HOSTCC) -o $@ $^
@@ -39,11 +39,7 @@ vmlinux.bin: $(VMLINUX)
39vmlinux.srec: $(VMLINUX) 39vmlinux.srec: $(VMLINUX)
40 $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec 40 $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec
41 41
42$(obj)/addinitrd: $(obj)/addinitrd.c 42clean-files += elf2ecoff \
43 $(HOSTCC) -o $@ $^
44
45clean-files += addinitrd \
46 elf2ecoff \
47 vmlinux.bin \ 43 vmlinux.bin \
48 vmlinux.ecoff \ 44 vmlinux.ecoff \
49 vmlinux.srec 45 vmlinux.srec
diff --git a/arch/mips/boot/addinitrd.c b/arch/mips/boot/addinitrd.c
deleted file mode 100644
index b5b3febc10cc..000000000000
--- a/arch/mips/boot/addinitrd.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * addinitrd - program to add a initrd image to an ecoff kernel
3 *
4 * (C) 1999 Thomas Bogendoerfer
5 * minor modifications, cleanup: Guido Guenther <agx@sigxcpu.org>
6 * further cleanup: Maciej W. Rozycki
7 */
8
9#include <sys/types.h>
10#include <sys/stat.h>
11#include <fcntl.h>
12#include <unistd.h>
13#include <stdio.h>
14#include <netinet/in.h>
15
16#include "ecoff.h"
17
18#define MIPS_PAGE_SIZE 4096
19#define MIPS_PAGE_MASK (MIPS_PAGE_SIZE-1)
20
21#define swab16(x) \
22 ((unsigned short)( \
23 (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \
24 (((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
25
26#define swab32(x) \
27 ((unsigned int)( \
28 (((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) | \
29 (((unsigned int)(x) & (unsigned int)0x0000ff00UL) << 8) | \
30 (((unsigned int)(x) & (unsigned int)0x00ff0000UL) >> 8) | \
31 (((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
32
33#define SWAB(a) (swab ? swab32(a) : (a))
34
35void die(char *s)
36{
37 perror(s);
38 exit(1);
39}
40
41int main(int argc, char *argv[])
42{
43 int fd_vmlinux, fd_initrd, fd_outfile;
44 FILHDR efile;
45 AOUTHDR eaout;
46 SCNHDR esecs[3];
47 struct stat st;
48 char buf[1024];
49 unsigned long loadaddr;
50 unsigned long initrd_header[2];
51 int i, cnt;
52 int swab = 0;
53
54 if (argc != 4) {
55 printf("Usage: %s <vmlinux> <initrd> <outfile>\n", argv[0]);
56 exit(1);
57 }
58
59 if ((fd_vmlinux = open (argv[1], O_RDONLY)) < 0)
60 die("open vmlinux");
61 if (read (fd_vmlinux, &efile, sizeof efile) != sizeof efile)
62 die("read file header");
63 if (read (fd_vmlinux, &eaout, sizeof eaout) != sizeof eaout)
64 die("read aout header");
65 if (read (fd_vmlinux, esecs, sizeof esecs) != sizeof esecs)
66 die("read section headers");
67 /*
68 * check whether the file is good for us
69 */
70 /* TBD */
71
72 /*
73 * check, if we have to swab words
74 */
75 if (ntohs(0xaa55) == 0xaa55) {
76 if (efile.f_magic == swab16(MIPSELMAGIC))
77 swab = 1;
78 } else {
79 if (efile.f_magic == swab16(MIPSEBMAGIC))
80 swab = 1;
81 }
82
83 /* make sure we have an empty data segment for the initrd */
84 if (eaout.dsize || esecs[1].s_size) {
85 fprintf(stderr, "Data segment not empty. Giving up!\n");
86 exit(1);
87 }
88 if ((fd_initrd = open (argv[2], O_RDONLY)) < 0)
89 die("open initrd");
90 if (fstat (fd_initrd, &st) < 0)
91 die("fstat initrd");
92 loadaddr = ((SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)
93 + MIPS_PAGE_SIZE-1) & ~MIPS_PAGE_MASK) - 8;
94 if (loadaddr < (SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size)))
95 loadaddr += MIPS_PAGE_SIZE;
96 initrd_header[0] = SWAB(0x494E5244);
97 initrd_header[1] = SWAB(st.st_size);
98 eaout.dsize = esecs[1].s_size = initrd_header[1] = SWAB(st.st_size+8);
99 eaout.data_start = esecs[1].s_vaddr = esecs[1].s_paddr = SWAB(loadaddr);
100
101 if ((fd_outfile = open (argv[3], O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
102 die("open outfile");
103 if (write (fd_outfile, &efile, sizeof efile) != sizeof efile)
104 die("write file header");
105 if (write (fd_outfile, &eaout, sizeof eaout) != sizeof eaout)
106 die("write aout header");
107 if (write (fd_outfile, esecs, sizeof esecs) != sizeof esecs)
108 die("write section headers");
109 /* skip padding */
110 if(lseek(fd_vmlinux, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
111 die("lseek vmlinux");
112 if(lseek(fd_outfile, SWAB(esecs[0].s_scnptr), SEEK_SET) == (off_t)-1)
113 die("lseek outfile");
114 /* copy text segment */
115 cnt = SWAB(eaout.tsize);
116 while (cnt) {
117 if ((i = read (fd_vmlinux, buf, sizeof buf)) <= 0)
118 die("read vmlinux");
119 if (write (fd_outfile, buf, i) != i)
120 die("write vmlinux");
121 cnt -= i;
122 }
123 if (write (fd_outfile, initrd_header, sizeof initrd_header) != sizeof initrd_header)
124 die("write initrd header");
125 while ((i = read (fd_initrd, buf, sizeof buf)) > 0)
126 if (write (fd_outfile, buf, i) != i)
127 die("write initrd");
128 close(fd_vmlinux);
129 close(fd_initrd);
130 return 0;
131}
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
new file mode 100644
index 000000000000..671d3448fad4
--- /dev/null
+++ b/arch/mips/boot/compressed/Makefile
@@ -0,0 +1,97 @@
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License.
4#
5# Adapted for MIPS Pete Popov, Dan Malek
6#
7# Copyright (C) 1994 by Linus Torvalds
8# Adapted for PowerPC by Gary Thomas
9# modified by Cort (cort@cs.nmt.edu)
10#
11# Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University
12# Author: Wu Zhangjin <wuzj@lemote.com>
13#
14
15# compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
16VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1)
17VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536))))
18VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" ] && printf %x $$(($(VMLINUX_LOAD_ADDRESS) + $(VMLINUX_SIZE))))
19
20# set the default size of the mallocing area for decompressing
21BOOT_HEAP_SIZE := 0x400000
22
23# Disable Function Tracer
24KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//")
25
26KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \
27 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" \
28
29KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
30 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ ) \
31 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE)
32
33obj-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
34
35obj-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
36
37OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
38$(obj)/vmlinux.bin: $(KBUILD_IMAGE)
39 $(call if_changed,objcopy)
40
41suffix_$(CONFIG_KERNEL_GZIP) = gz
42suffix_$(CONFIG_KERNEL_BZIP2) = bz2
43suffix_$(CONFIG_KERNEL_LZMA) = lzma
44tool_$(CONFIG_KERNEL_GZIP) = gzip
45tool_$(CONFIG_KERNEL_BZIP2) = bzip2
46tool_$(CONFIG_KERNEL_LZMA) = lzma
47$(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin
48 $(call if_changed,$(tool_y))
49
50$(obj)/piggy.o: $(obj)/vmlinux.$(suffix_y) $(obj)/dummy.o
51 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) \
52 --add-section=.image=$< \
53 --set-section-flags=.image=contents,alloc,load,readonly,data \
54 $(obj)/dummy.o $@
55
56LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T
57vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o
58 $(call if_changed,ld)
59 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@
60
61#
62# Some DECstations need all possible sections of an ECOFF executable
63#
64ifdef CONFIG_MACH_DECSTATION
65 E2EFLAGS = -a
66else
67 E2EFLAGS =
68endif
69
70# elf2ecoff can only handle 32bit image
71
72ifdef CONFIG_32BIT
73 VMLINUZ = vmlinuz
74else
75 VMLINUZ = vmlinuz.32
76endif
77
78vmlinuz.32: vmlinuz
79 $(Q)$(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
80
81vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
82 $(Q)$(obj)/../elf2ecoff $(VMLINUZ) vmlinuz.ecoff $(E2EFLAGS)
83
84$(obj)/../elf2ecoff: $(src)/../elf2ecoff.c
85 $(Q)$(HOSTCC) -o $@ $^
86
87OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
88vmlinuz.bin: vmlinuz
89 $(call if_changed,objcopy)
90
91OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
92vmlinuz.srec: vmlinuz
93 $(call if_changed,objcopy)
94
95clean:
96clean-files += *.o \
97 vmlinu*
diff --git a/arch/mips/boot/compressed/dbg.c b/arch/mips/boot/compressed/dbg.c
new file mode 100644
index 000000000000..ff4dc7a33a9f
--- /dev/null
+++ b/arch/mips/boot/compressed/dbg.c
@@ -0,0 +1,37 @@
1/*
2 * MIPS-specific debug support for pre-boot environment
3 *
4 * NOTE: putc() is board specific, if your board have a 16550 compatible uart,
5 * please select SYS_SUPPORTS_ZBOOT_UART16550 for your machine. othewise, you
6 * need to implement your own putc().
7 */
8
9#include <linux/init.h>
10#include <linux/types.h>
11
12void __attribute__ ((weak)) putc(char c)
13{
14}
15
16void puts(const char *s)
17{
18 char c;
19 while ((c = *s++) != '\0') {
20 putc(c);
21 if (c == '\n')
22 putc('\r');
23 }
24}
25
26void puthex(unsigned long long val)
27{
28
29 unsigned char buf[10];
30 int i;
31 for (i = 7; i >= 0; i--) {
32 buf[i] = "0123456789ABCDEF"[val & 0x0F];
33 val >>= 4;
34 }
35 buf[8] = '\0';
36 puts(buf);
37}
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
new file mode 100644
index 000000000000..e48fd72898a8
--- /dev/null
+++ b/arch/mips/boot/compressed/decompress.c
@@ -0,0 +1,116 @@
1/*
2 * Misc. bootloader code for many machines.
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: Matt Porter <mporter@mvista.com> Derived from
6 * arch/ppc/boot/prep/misc.c
7 *
8 * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
9 * Author: Wu Zhangjin <wuzj@lemote.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17#include <linux/types.h>
18#include <linux/kernel.h>
19
20#include <asm/addrspace.h>
21
22/* These two variables specify the free mem region
23 * that can be used for temporary malloc area
24 */
25unsigned long free_mem_ptr;
26unsigned long free_mem_end_ptr;
27char *zimage_start;
28
29/* The linker tells us where the image is. */
30extern unsigned char __image_begin, __image_end;
31
32/* debug interfaces */
33extern void puts(const char *s);
34extern void puthex(unsigned long long val);
35
36void error(char *x)
37{
38 puts("\n\n");
39 puts(x);
40 puts("\n\n -- System halted");
41
42 while (1)
43 ; /* Halt */
44}
45
46/* activate the code for pre-boot environment */
47#define STATIC static
48
49#ifdef CONFIG_KERNEL_GZIP
50void *memcpy(void *dest, const void *src, size_t n)
51{
52 int i;
53 const char *s = src;
54 char *d = dest;
55
56 for (i = 0; i < n; i++)
57 d[i] = s[i];
58 return dest;
59}
60#include "../../../../lib/decompress_inflate.c"
61#endif
62
63#ifdef CONFIG_KERNEL_BZIP2
64void *memset(void *s, int c, size_t n)
65{
66 int i;
67 char *ss = s;
68
69 for (i = 0; i < n; i++)
70 ss[i] = c;
71 return s;
72}
73#include "../../../../lib/decompress_bunzip2.c"
74#endif
75
76#ifdef CONFIG_KERNEL_LZMA
77#include "../../../../lib/decompress_unlzma.c"
78#endif
79
80void decompress_kernel(unsigned long boot_heap_start)
81{
82 int zimage_size;
83
84 /*
85 * We link ourself to an arbitrary low address. When we run, we
86 * relocate outself to that address. __image_beign points to
87 * the part of the image where the zImage is. -- Tom
88 */
89 zimage_start = (char *)(unsigned long)(&__image_begin);
90 zimage_size = (unsigned long)(&__image_end) -
91 (unsigned long)(&__image_begin);
92
93 /*
94 * The zImage and initrd will be between start and _end, so they've
95 * already been moved once. We're good to go now. -- Tom
96 */
97 puts("zimage at: ");
98 puthex((unsigned long)zimage_start);
99 puts(" ");
100 puthex((unsigned long)(zimage_size + zimage_start));
101 puts("\n");
102
103 /* this area are prepared for mallocing when decompressing */
104 free_mem_ptr = boot_heap_start;
105 free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE;
106
107 /* Display standard Linux/MIPS boot prompt for kernel args */
108 puts("Uncompressing Linux at load address ");
109 puthex(VMLINUX_LOAD_ADDRESS_ULL);
110 puts("\n");
111 /* Decompress the kernel with according algorithm */
112 decompress(zimage_start, zimage_size, 0, 0,
113 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error);
114 /* FIXME: is there a need to flush cache here? */
115 puts("Now, booting the kernel...\n");
116}
diff --git a/arch/mips/boot/compressed/dummy.c b/arch/mips/boot/compressed/dummy.c
new file mode 100644
index 000000000000..31dbf45bf99c
--- /dev/null
+++ b/arch/mips/boot/compressed/dummy.c
@@ -0,0 +1,4 @@
1int main(void)
2{
3 return 0;
4}
diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
new file mode 100644
index 000000000000..4e65a8420bee
--- /dev/null
+++ b/arch/mips/boot/compressed/head.S
@@ -0,0 +1,56 @@
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) 1994, 1995 Waldorf Electronics
7 * Written by Ralf Baechle and Andreas Busse
8 * Copyright (C) 1995 - 1999 Ralf Baechle
9 * Copyright (C) 1996 Paul M. Antoine
10 * Modified for DECStation and hence R3000 support by Paul M. Antoine
11 * Further modifications by David S. Miller and Harald Koerfgen
12 * Copyright (C) 1999 Silicon Graphics, Inc.
13 */
14
15#include <asm/asm.h>
16#include <asm/regdef.h>
17
18 .set noreorder
19 .cprestore
20 LEAF(start)
21start:
22 /* Save boot rom start args */
23 move s0, a0
24 move s1, a1
25 move s2, a2
26 move s3, a3
27
28 /* Clear BSS */
29 PTR_LA a0, _edata
30 PTR_LA a2, _end
311: sw zero, 0(a0)
32 bne a2, a0, 1b
33 addiu a0, a0, 4
34
35 PTR_LA a0, (.heap) /* heap address */
36 PTR_LA sp, (.stack + 8192) /* stack address */
37
38 PTR_LA ra, 2f
39 PTR_LA k0, decompress_kernel
40 jr k0
41 nop
422:
43 move a0, s0
44 move a1, s1
45 move a2, s2
46 move a3, s3
47 PTR_LI k0, KERNEL_ENTRY
48 jr k0
49 nop
503:
51 b 3b
52 nop
53 END(start)
54
55 .comm .heap,BOOT_HEAP_SIZE,4
56 .comm .stack,4096*2,4
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
new file mode 100644
index 000000000000..613a35b02f50
--- /dev/null
+++ b/arch/mips/boot/compressed/ld.script
@@ -0,0 +1,67 @@
1/*
2 * ld.script for compressed kernel support of MIPS
3 *
4 * Copyright (C) 2009 Lemote Inc.
5 * Author: Wu Zhangjin <wuzj@lemote.com>
6 */
7
8OUTPUT_ARCH(mips)
9ENTRY(start)
10SECTIONS
11{
12 /* . = VMLINUZ_LOAD_ADDRESS */
13 /* read-only */
14 _text = .; /* Text and read-only data */
15 .text : {
16 _ftext = . ;
17 *(.text)
18 *(.rodata)
19 } = 0
20 _etext = .; /* End of text section */
21
22 /* writable */
23 .data : { /* Data */
24 _fdata = . ;
25 *(.data)
26 /* Put the compressed image here, so bss is on the end. */
27 __image_begin = .;
28 *(.image)
29 __image_end = .;
30 CONSTRUCTORS
31 }
32 .sdata : { *(.sdata) }
33 . = ALIGN(4);
34 _edata = .; /* End of data section */
35
36 /* BSS */
37 __bss_start = .;
38 _fbss = .;
39 .sbss : { *(.sbss) *(.scommon) }
40 .bss : {
41 *(.dynbss)
42 *(.bss)
43 *(COMMON)
44 }
45 . = ALIGN(4);
46 _end = . ;
47
48 /* These are needed for ELF backends which have not yet been converted
49 * to the new style linker. */
50
51 .stab 0 : { *(.stab) }
52 .stabstr 0 : { *(.stabstr) }
53
54 /* These must appear regardless of . */
55 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
56 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
57
58 /* Sections to be discarded */
59 /DISCARD/ : {
60 *(.MIPS.options)
61 *(.options)
62 *(.pdr)
63 *(.reginfo)
64 *(.comment)
65 *(.note)
66 }
67}
diff --git a/arch/mips/boot/compressed/uart-16550.c b/arch/mips/boot/compressed/uart-16550.c
new file mode 100644
index 000000000000..c9caaf4fbf60
--- /dev/null
+++ b/arch/mips/boot/compressed/uart-16550.c
@@ -0,0 +1,43 @@
1/*
2 * 16550 compatible uart based serial debug support for zboot
3 */
4
5#include <linux/types.h>
6#include <linux/serial_reg.h>
7#include <linux/init.h>
8
9#include <asm/addrspace.h>
10
11#if defined(CONFIG_MACH_LOONGSON) || defined(CONFIG_MIPS_MALTA)
12#define UART_BASE 0x1fd003f8
13#define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
14#endif
15
16#ifdef CONFIG_AR7
17#include <ar7.h>
18#define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))
19#endif
20
21#ifndef PORT
22#error please define the serial port address for your own machine
23#endif
24
25static inline unsigned int serial_in(int offset)
26{
27 return *((char *)PORT(offset));
28}
29
30static inline void serial_out(int offset, int value)
31{
32 *((char *)PORT(offset)) = value;
33}
34
35void putc(char c)
36{
37 int timeout = 1024;
38
39 while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
40 ;
41
42 serial_out(UART_TX, c);
43}
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index 139436280520..3e9876317e61 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -9,7 +9,7 @@
9# Copyright (C) 2005-2009 Cavium Networks 9# Copyright (C) 2005-2009 Cavium Networks
10# 10#
11 11
12obj-y := setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o 12obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o
13obj-y += dma-octeon.o flash_setup.o 13obj-y += dma-octeon.o flash_setup.o
14obj-y += octeon-memcpy.o 14obj-y += octeon-memcpy.o
15 15
diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c
new file mode 100644
index 000000000000..b6df5387e855
--- /dev/null
+++ b/arch/mips/cavium-octeon/cpu.c
@@ -0,0 +1,52 @@
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) 2009 Wind River Systems,
7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */
9#include <linux/init.h>
10#include <linux/irqflags.h>
11#include <linux/notifier.h>
12#include <linux/prefetch.h>
13#include <linux/sched.h>
14
15#include <asm/cop2.h>
16#include <asm/current.h>
17#include <asm/mipsregs.h>
18#include <asm/page.h>
19#include <asm/octeon/octeon.h>
20
21static int cnmips_cu2_call(struct notifier_block *nfb, unsigned long action,
22 void *data)
23{
24 unsigned long flags;
25 unsigned int status;
26
27 switch (action) {
28 case CU2_EXCEPTION:
29 prefetch(&current->thread.cp2);
30 local_irq_save(flags);
31 KSTK_STATUS(current) |= ST0_CU2;
32 status = read_c0_status();
33 write_c0_status(status | ST0_CU2);
34 octeon_cop2_restore(&(current->thread.cp2));
35 write_c0_status(status & ~ST0_CU2);
36 local_irq_restore(flags);
37
38 return NOTIFY_BAD; /* Don't call default notifier */
39 }
40
41 return NOTIFY_OK; /* Let default notifier send signals */
42}
43
44static struct notifier_block cnmips_cu2_notifier = {
45 .notifier_call = cnmips_cu2_call,
46};
47
48static int cnmips_cu2_setup(void)
49{
50 return register_cu2_notifier(&cnmips_cu2_notifier);
51}
52early_initcall(cnmips_cu2_setup);
diff --git a/arch/mips/cavium-octeon/csrc-octeon.c b/arch/mips/cavium-octeon/csrc-octeon.c
index 96110f217dcd..0bf4bbe04ae2 100644
--- a/arch/mips/cavium-octeon/csrc-octeon.c
+++ b/arch/mips/cavium-octeon/csrc-octeon.c
@@ -50,6 +50,38 @@ static struct clocksource clocksource_mips = {
50 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 50 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
51}; 51};
52 52
53unsigned long long notrace sched_clock(void)
54{
55 /* 64-bit arithmatic can overflow, so use 128-bit. */
56#if (__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ <= 3))
57 u64 t1, t2, t3;
58 unsigned long long rv;
59 u64 mult = clocksource_mips.mult;
60 u64 shift = clocksource_mips.shift;
61 u64 cnt = read_c0_cvmcount();
62
63 asm (
64 "dmultu\t%[cnt],%[mult]\n\t"
65 "nor\t%[t1],$0,%[shift]\n\t"
66 "mfhi\t%[t2]\n\t"
67 "mflo\t%[t3]\n\t"
68 "dsll\t%[t2],%[t2],1\n\t"
69 "dsrlv\t%[rv],%[t3],%[shift]\n\t"
70 "dsllv\t%[t1],%[t2],%[t1]\n\t"
71 "or\t%[rv],%[t1],%[rv]\n\t"
72 : [rv] "=&r" (rv), [t1] "=&r" (t1), [t2] "=&r" (t2), [t3] "=&r" (t3)
73 : [cnt] "r" (cnt), [mult] "r" (mult), [shift] "r" (shift)
74 : "hi", "lo");
75 return rv;
76#else
77 /* GCC > 4.3 do it the easy way. */
78 unsigned int __attribute__((mode(TI))) t;
79 t = read_c0_cvmcount();
80 t = t * clocksource_mips.mult;
81 return (unsigned long long)(t >> clocksource_mips.shift);
82#endif
83}
84
53void __init plat_time_init(void) 85void __init plat_time_init(void)
54{ 86{
55 clocksource_mips.rating = 300; 87 clocksource_mips.rating = 300;
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index be711dd2d918..cfdb4c2ac5c3 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -159,6 +159,94 @@ out:
159} 159}
160device_initcall(octeon_rng_device_init); 160device_initcall(octeon_rng_device_init);
161 161
162/* Octeon SMI/MDIO interface. */
163static int __init octeon_mdiobus_device_init(void)
164{
165 struct platform_device *pd;
166 int ret = 0;
167
168 if (octeon_is_simulation())
169 return 0; /* No mdio in the simulator. */
170
171 /* The bus number is the platform_device id. */
172 pd = platform_device_alloc("mdio-octeon", 0);
173 if (!pd) {
174 ret = -ENOMEM;
175 goto out;
176 }
177
178 ret = platform_device_add(pd);
179 if (ret)
180 goto fail;
181
182 return ret;
183fail:
184 platform_device_put(pd);
185
186out:
187 return ret;
188
189}
190device_initcall(octeon_mdiobus_device_init);
191
192/* Octeon mgmt port Ethernet interface. */
193static int __init octeon_mgmt_device_init(void)
194{
195 struct platform_device *pd;
196 int ret = 0;
197 int port, num_ports;
198
199 struct resource mgmt_port_resource = {
200 .flags = IORESOURCE_IRQ,
201 .start = -1,
202 .end = -1
203 };
204
205 if (!OCTEON_IS_MODEL(OCTEON_CN56XX) && !OCTEON_IS_MODEL(OCTEON_CN52XX))
206 return 0;
207
208 if (OCTEON_IS_MODEL(OCTEON_CN56XX))
209 num_ports = 1;
210 else
211 num_ports = 2;
212
213 for (port = 0; port < num_ports; port++) {
214 pd = platform_device_alloc("octeon_mgmt", port);
215 if (!pd) {
216 ret = -ENOMEM;
217 goto out;
218 }
219 switch (port) {
220 case 0:
221 mgmt_port_resource.start = OCTEON_IRQ_MII0;
222 break;
223 case 1:
224 mgmt_port_resource.start = OCTEON_IRQ_MII1;
225 break;
226 default:
227 BUG();
228 }
229 mgmt_port_resource.end = mgmt_port_resource.start;
230
231 ret = platform_device_add_resources(pd, &mgmt_port_resource, 1);
232
233 if (ret)
234 goto fail;
235
236 ret = platform_device_add(pd);
237 if (ret)
238 goto fail;
239 }
240 return ret;
241fail:
242 platform_device_put(pd);
243
244out:
245 return ret;
246
247}
248device_initcall(octeon_mgmt_device_init);
249
162MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); 250MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
163MODULE_LICENSE("GPL"); 251MODULE_LICENSE("GPL");
164MODULE_DESCRIPTION("Platform driver for Octeon SOC"); 252MODULE_DESCRIPTION("Platform driver for Octeon SOC");
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index b51644227241..ec3b2c417f7c 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -97,26 +97,18 @@ void __init plat_mem_setup(void)
97 97
98void __init prom_init(void) 98void __init prom_init(void)
99{ 99{
100 int narg, indx, posn, nchr;
101 unsigned long memsz; 100 unsigned long memsz;
101 int argc, i;
102 char **argv; 102 char **argv;
103 103
104 memsz = fw_arg0 & 0x7fff0000; 104 memsz = fw_arg0 & 0x7fff0000;
105 narg = fw_arg0 & 0x0000ffff; 105 argc = fw_arg0 & 0x0000ffff;
106 106 argv = (char **)fw_arg1;
107 if (narg) { 107
108 arcs_cmdline[0] = '\0'; 108 for (i = 1; i < argc; i++) {
109 argv = (char **) fw_arg1; 109 strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
110 posn = 0; 110 if (i < (argc - 1))
111 for (indx = 1; indx < narg; ++indx) { 111 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
112 nchr = strlen(argv[indx]);
113 if (posn + 1 + nchr + 1 > sizeof(arcs_cmdline))
114 break;
115 if (posn)
116 arcs_cmdline[posn++] = ' ';
117 strcpy(arcs_cmdline + posn, argv[indx]);
118 posn += nchr;
119 }
120 } 112 }
121 113
122 add_memory_region(0x0, memsz, BOOT_MEM_RAM); 114 add_memory_region(0x0, memsz, BOOT_MEM_RAM);
diff --git a/arch/mips/configs/ar7_defconfig b/arch/mips/configs/ar7_defconfig
index 35648302f7cc..5a5b6ba7514e 100644
--- a/arch/mips/configs/ar7_defconfig
+++ b/arch/mips/configs/ar7_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12CONFIG_AR7=y 12CONFIG_AR7=y
13# CONFIG_BASLER_EXCITE is not set
14# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
15# CONFIG_MIPS_COBALT is not set 14# CONFIG_MIPS_COBALT is not set
16# CONFIG_MACH_DECSTATION is not set 15# CONFIG_MACH_DECSTATION is not set
@@ -265,7 +264,6 @@ CONFIG_DEFAULT_DEADLINE=y
265# CONFIG_DEFAULT_CFQ is not set 264# CONFIG_DEFAULT_CFQ is not set
266# CONFIG_DEFAULT_NOOP is not set 265# CONFIG_DEFAULT_NOOP is not set
267CONFIG_DEFAULT_IOSCHED="deadline" 266CONFIG_DEFAULT_IOSCHED="deadline"
268CONFIG_PROBE_INITRD_HEADER=y
269# CONFIG_FREEZER is not set 267# CONFIG_FREEZER is not set
270 268
271# 269#
@@ -1053,7 +1051,9 @@ CONFIG_TRACING_SUPPORT=y
1053# CONFIG_DYNAMIC_DEBUG is not set 1051# CONFIG_DYNAMIC_DEBUG is not set
1054# CONFIG_SAMPLES is not set 1052# CONFIG_SAMPLES is not set
1055CONFIG_HAVE_ARCH_KGDB=y 1053CONFIG_HAVE_ARCH_KGDB=y
1054CONFIG_CMDLINE_BOOL=y
1056CONFIG_CMDLINE="rootfstype=squashfs,jffs2" 1055CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
1056# CONFIG_CMDLINE_OVERRIDE is not set
1057 1057
1058# 1058#
1059# Security options 1059# Security options
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 94b7d57f906d..267bd46120bc 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13CONFIG_BCM47XX=y 12CONFIG_BCM47XX=y
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1853,7 +1852,7 @@ CONFIG_DEBUG_FS=y
1853# CONFIG_HEADERS_CHECK is not set 1852# CONFIG_HEADERS_CHECK is not set
1854# CONFIG_DEBUG_KERNEL is not set 1853# CONFIG_DEBUG_KERNEL is not set
1855# CONFIG_SAMPLES is not set 1854# CONFIG_SAMPLES is not set
1856CONFIG_CMDLINE="" 1855# CONFIG_CMDLINE_BOOL is not set
1857 1856
1858# 1857#
1859# Security options 1858# Security options
diff --git a/arch/mips/configs/bcm63xx_defconfig b/arch/mips/configs/bcm63xx_defconfig
index ea00c18d1f7b..7fee0273c829 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14CONFIG_BCM63XX=y 13CONFIG_BCM63XX=y
15# CONFIG_MIPS_COBALT is not set 14# CONFIG_MIPS_COBALT is not set
@@ -942,7 +941,9 @@ CONFIG_TRACING_SUPPORT=y
942# CONFIG_BLK_DEV_IO_TRACE is not set 941# CONFIG_BLK_DEV_IO_TRACE is not set
943# CONFIG_SAMPLES is not set 942# CONFIG_SAMPLES is not set
944CONFIG_HAVE_ARCH_KGDB=y 943CONFIG_HAVE_ARCH_KGDB=y
944CONFIG_CMDLINE_BOOL=y
945CONFIG_CMDLINE="console=ttyS0,115200" 945CONFIG_CMDLINE="console=ttyS0,115200"
946# CONFIG_CMDLINE_OVERRIDE is not set
946 947
947# 948#
948# Security options 949# Security options
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index 13d9eb4736c0..c2f06e38c854 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1237,7 +1236,7 @@ CONFIG_DEBUG_MUTEXES=y
1237# CONFIG_BACKTRACE_SELF_TEST is not set 1236# CONFIG_BACKTRACE_SELF_TEST is not set
1238# CONFIG_FAULT_INJECTION is not set 1237# CONFIG_FAULT_INJECTION is not set
1239# CONFIG_SAMPLES is not set 1238# CONFIG_SAMPLES is not set
1240CONFIG_CMDLINE="" 1239# CONFIG_CMDLINE_BOOL is not set
1241# CONFIG_DEBUG_STACK_USAGE is not set 1240# CONFIG_DEBUG_STACK_USAGE is not set
1242# CONFIG_SB1XXX_CORELIS is not set 1241# CONFIG_SB1XXX_CORELIS is not set
1243# CONFIG_RUNTIME_DEBUG is not set 1242# CONFIG_RUNTIME_DEBUG is not set
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index 185df23fd460..72b7e456916e 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -783,7 +782,9 @@ CONFIG_ENABLE_MUST_CHECK=y
783# CONFIG_HEADERS_CHECK is not set 782# CONFIG_HEADERS_CHECK is not set
784# CONFIG_DEBUG_KERNEL is not set 783# CONFIG_DEBUG_KERNEL is not set
785CONFIG_CROSSCOMPILE=y 784CONFIG_CROSSCOMPILE=y
785CONFIG_CMDLINE_BOOL=y
786CONFIG_CMDLINE="mem=32M console=ttyVR0,38400" 786CONFIG_CMDLINE="mem=32M console=ttyVR0,38400"
787# CONFIG_CMDLINE_OVERRIDE is not set
787 788
788# 789#
789# Security options 790# Security options
diff --git a/arch/mips/configs/cavium-octeon_defconfig b/arch/mips/configs/cavium-octeon_defconfig
index 7afaa28a3768..c8507bc8e925 100644
--- a/arch/mips/configs/cavium-octeon_defconfig
+++ b/arch/mips/configs/cavium-octeon_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -269,7 +268,6 @@ CONFIG_DEFAULT_CFQ=y
269# CONFIG_DEFAULT_NOOP is not set 268# CONFIG_DEFAULT_NOOP is not set
270CONFIG_DEFAULT_IOSCHED="cfq" 269CONFIG_DEFAULT_IOSCHED="cfq"
271CONFIG_CLASSIC_RCU=y 270CONFIG_CLASSIC_RCU=y
272# CONFIG_PROBE_INITRD_HEADER is not set
273# CONFIG_FREEZER is not set 271# CONFIG_FREEZER is not set
274 272
275# 273#
@@ -822,7 +820,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
822# CONFIG_SAMPLES is not set 820# CONFIG_SAMPLES is not set
823CONFIG_HAVE_ARCH_KGDB=y 821CONFIG_HAVE_ARCH_KGDB=y
824# CONFIG_KGDB is not set 822# CONFIG_KGDB is not set
825CONFIG_CMDLINE="" 823# CONFIG_CMDLINE_BOOL is not set
826# CONFIG_DEBUG_STACK_USAGE is not set 824# CONFIG_DEBUG_STACK_USAGE is not set
827# CONFIG_RUNTIME_DEBUG is not set 825# CONFIG_RUNTIME_DEBUG is not set
828 826
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 6c8cca8589ba..49e61312e006 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14CONFIG_MIPS_COBALT=y 13CONFIG_MIPS_COBALT=y
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1126,7 +1125,7 @@ CONFIG_FRAME_WARN=1024
1126# CONFIG_SLUB_STATS is not set 1125# CONFIG_SLUB_STATS is not set
1127# CONFIG_DEBUG_MEMORY_INIT is not set 1126# CONFIG_DEBUG_MEMORY_INIT is not set
1128# CONFIG_SAMPLES is not set 1127# CONFIG_SAMPLES is not set
1129CONFIG_CMDLINE="" 1128# CONFIG_CMDLINE_BOOL is not set
1130 1129
1131# 1130#
1132# Security options 1131# Security options
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index dbdf3bb1a34a..68e90cd6b2d4 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_DB1000=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1090,7 +1089,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1090# CONFIG_DEBUG_KERNEL is not set 1089# CONFIG_DEBUG_KERNEL is not set
1091CONFIG_LOG_BUF_SHIFT=14 1090CONFIG_LOG_BUF_SHIFT=14
1092CONFIG_CROSSCOMPILE=y 1091CONFIG_CROSSCOMPILE=y
1093CONFIG_CMDLINE="" 1092# CONFIG_CMDLINE_BOOL is not set
1094 1093
1095# 1094#
1096# Security options 1095# Security options
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index fa6814475898..90812830e940 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_DB1100=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1090,7 +1089,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1090# CONFIG_DEBUG_KERNEL is not set 1089# CONFIG_DEBUG_KERNEL is not set
1091CONFIG_LOG_BUF_SHIFT=14 1090CONFIG_LOG_BUF_SHIFT=14
1092CONFIG_CROSSCOMPILE=y 1091CONFIG_CROSSCOMPILE=y
1093CONFIG_CMDLINE="" 1092# CONFIG_CMDLINE_BOOL is not set
1094 1093
1095# 1094#
1096# Security options 1095# Security options
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index d73f1de43b5d..dabf03032e06 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -23,7 +23,6 @@ CONFIG_MACH_ALCHEMY=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24CONFIG_MIPS_DB1200=y 24CONFIG_MIPS_DB1200=y
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1172,7 +1171,9 @@ CONFIG_ENABLE_MUST_CHECK=y
1172# CONFIG_DEBUG_KERNEL is not set 1171# CONFIG_DEBUG_KERNEL is not set
1173CONFIG_LOG_BUF_SHIFT=14 1172CONFIG_LOG_BUF_SHIFT=14
1174CONFIG_CROSSCOMPILE=y 1173CONFIG_CROSSCOMPILE=y
1174CONFIG_CMDLINE_BOOL=y
1175CONFIG_CMDLINE="mem=48M" 1175CONFIG_CMDLINE="mem=48M"
1176# CONFIG_CMDLINE_OVERRIDE is not set
1176 1177
1177# 1178#
1178# Security options 1179# Security options
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index ec3e028a5b2e..a15131373138 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_DB1500=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1390,7 +1389,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1390# CONFIG_DEBUG_KERNEL is not set 1389# CONFIG_DEBUG_KERNEL is not set
1391CONFIG_LOG_BUF_SHIFT=14 1390CONFIG_LOG_BUF_SHIFT=14
1392CONFIG_CROSSCOMPILE=y 1391CONFIG_CROSSCOMPILE=y
1393CONFIG_CMDLINE="" 1392# CONFIG_CMDLINE_BOOL is not set
1394 1393
1395# 1394#
1396# Security options 1395# Security options
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 7631dae51be9..6b64339c0014 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -23,7 +23,6 @@ CONFIG_MACH_ALCHEMY=y
23CONFIG_MIPS_DB1550=y 23CONFIG_MIPS_DB1550=y
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1207,7 +1206,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1207# CONFIG_DEBUG_KERNEL is not set 1206# CONFIG_DEBUG_KERNEL is not set
1208CONFIG_LOG_BUF_SHIFT=14 1207CONFIG_LOG_BUF_SHIFT=14
1209CONFIG_CROSSCOMPILE=y 1208CONFIG_CROSSCOMPILE=y
1210CONFIG_CMDLINE="" 1209# CONFIG_CMDLINE_BOOL is not set
1211 1210
1212# 1211#
1213# Security options 1212# Security options
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index 9e65e6a2dcb3..cbb4d86f2912 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27CONFIG_MACH_DECSTATION=y 26CONFIG_MACH_DECSTATION=y
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -882,7 +881,7 @@ CONFIG_MAGIC_SYSRQ=y
882# CONFIG_DEBUG_KERNEL is not set 881# CONFIG_DEBUG_KERNEL is not set
883CONFIG_LOG_BUF_SHIFT=14 882CONFIG_LOG_BUF_SHIFT=14
884CONFIG_CROSSCOMPILE=y 883CONFIG_CROSSCOMPILE=y
885CONFIG_CMDLINE="" 884# CONFIG_CMDLINE_BOOL is not set
886 885
887# 886#
888# Security options 887# Security options
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 1bd84d42b14f..52968c46c806 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -561,7 +560,9 @@ CONFIG_ENABLE_MUST_CHECK=y
561# CONFIG_HEADERS_CHECK is not set 560# CONFIG_HEADERS_CHECK is not set
562# CONFIG_DEBUG_KERNEL is not set 561# CONFIG_DEBUG_KERNEL is not set
563CONFIG_CROSSCOMPILE=y 562CONFIG_CROSSCOMPILE=y
563CONFIG_CMDLINE_BOOL=y
564CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x1f0,0x3f6,40 mem=8M" 564CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x1f0,0x3f6,40 mem=8M"
565# CONFIG_CMDLINE_OVERRIDE is not set
565 566
566# 567#
567# Security options 568# Security options
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
deleted file mode 100644
index 1995d43a2ed1..000000000000
--- a/arch/mips/configs/excite_defconfig
+++ /dev/null
@@ -1,1335 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20
4# Tue Feb 20 21:47:31 2007
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11CONFIG_ZONE_DMA=y
12# CONFIG_MIPS_MTX1 is not set
13# CONFIG_MIPS_BOSPORUS is not set
14# CONFIG_MIPS_PB1000 is not set
15# CONFIG_MIPS_PB1100 is not set
16# CONFIG_MIPS_PB1500 is not set
17# CONFIG_MIPS_PB1550 is not set
18# CONFIG_MIPS_PB1200 is not set
19# CONFIG_MIPS_DB1000 is not set
20# CONFIG_MIPS_DB1100 is not set
21# CONFIG_MIPS_DB1500 is not set
22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set
25CONFIG_BASLER_EXCITE=y
26# CONFIG_BASLER_EXCITE_PROTOTYPE is not set
27# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set
30# CONFIG_MIPS_MALTA is not set
31# CONFIG_WR_PPMC is not set
32# CONFIG_MIPS_SIM is not set
33# CONFIG_MOMENCO_JAGUAR_ATX is not set
34# CONFIG_MIPS_XXS1500 is not set
35# CONFIG_PNX8550_JBS is not set
36# CONFIG_PNX8550_STB810 is not set
37# CONFIG_MACH_VR41XX is not set
38# CONFIG_PMC_YOSEMITE is not set
39# CONFIG_MARKEINS is not set
40# CONFIG_SGI_IP22 is not set
41# CONFIG_SGI_IP27 is not set
42# CONFIG_SGI_IP32 is not set
43# CONFIG_SIBYTE_BIGSUR is not set
44# CONFIG_SIBYTE_SWARM is not set
45# CONFIG_SIBYTE_SENTOSA is not set
46# CONFIG_SIBYTE_RHONE is not set
47# CONFIG_SIBYTE_CARMEL is not set
48# CONFIG_SIBYTE_LITTLESUR is not set
49# CONFIG_SIBYTE_CRHINE is not set
50# CONFIG_SIBYTE_CRHONE is not set
51# CONFIG_SNI_RM is not set
52# CONFIG_TOSHIBA_JMR3927 is not set
53# CONFIG_TOSHIBA_RBTX4927 is not set
54# CONFIG_TOSHIBA_RBTX4938 is not set
55CONFIG_RWSEM_GENERIC_SPINLOCK=y
56# CONFIG_ARCH_HAS_ILOG2_U32 is not set
57# CONFIG_ARCH_HAS_ILOG2_U64 is not set
58CONFIG_GENERIC_FIND_NEXT_BIT=y
59CONFIG_GENERIC_HWEIGHT=y
60CONFIG_GENERIC_CALIBRATE_DELAY=y
61CONFIG_GENERIC_TIME=y
62CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
63# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
64CONFIG_DMA_COHERENT=y
65CONFIG_CPU_BIG_ENDIAN=y
66# CONFIG_CPU_LITTLE_ENDIAN is not set
67CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
68CONFIG_IRQ_CPU=y
69CONFIG_IRQ_CPU_RM7K=y
70CONFIG_IRQ_CPU_RM9K=y
71CONFIG_MIPS_RM9122=y
72CONFIG_SERIAL_RM9000=y
73CONFIG_GPI_RM9000=y
74CONFIG_WDT_RM9000=y
75CONFIG_MIPS_L1_CACHE_SHIFT=5
76
77#
78# CPU selection
79#
80# CONFIG_CPU_MIPS32_R1 is not set
81# CONFIG_CPU_MIPS32_R2 is not set
82# CONFIG_CPU_MIPS64_R1 is not set
83# CONFIG_CPU_MIPS64_R2 is not set
84# CONFIG_CPU_R3000 is not set
85# CONFIG_CPU_TX39XX is not set
86# CONFIG_CPU_VR41XX is not set
87# CONFIG_CPU_R4300 is not set
88# CONFIG_CPU_R4X00 is not set
89# CONFIG_CPU_TX49XX is not set
90# CONFIG_CPU_R5000 is not set
91# CONFIG_CPU_R5432 is not set
92# CONFIG_CPU_R6000 is not set
93# CONFIG_CPU_NEVADA is not set
94# CONFIG_CPU_R8000 is not set
95# CONFIG_CPU_R10000 is not set
96# CONFIG_CPU_RM7000 is not set
97CONFIG_CPU_RM9000=y
98# CONFIG_CPU_SB1 is not set
99CONFIG_SYS_HAS_CPU_RM9000=y
100CONFIG_WEAK_ORDERING=y
101CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
102CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
103CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
104CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
105
106#
107# Kernel type
108#
109CONFIG_32BIT=y
110# CONFIG_64BIT is not set
111CONFIG_PAGE_SIZE_4KB=y
112# CONFIG_PAGE_SIZE_8KB is not set
113# CONFIG_PAGE_SIZE_16KB is not set
114# CONFIG_PAGE_SIZE_64KB is not set
115CONFIG_CPU_HAS_PREFETCH=y
116CONFIG_MIPS_MT_DISABLED=y
117# CONFIG_MIPS_MT_SMP is not set
118# CONFIG_MIPS_MT_SMTC is not set
119# CONFIG_MIPS_VPE_LOADER is not set
120# CONFIG_64BIT_PHYS_ADDR is not set
121CONFIG_CPU_HAS_SYNC=y
122CONFIG_GENERIC_HARDIRQS=y
123CONFIG_GENERIC_IRQ_PROBE=y
124CONFIG_CPU_SUPPORTS_HIGHMEM=y
125CONFIG_ARCH_FLATMEM_ENABLE=y
126CONFIG_SELECT_MEMORY_MODEL=y
127CONFIG_FLATMEM_MANUAL=y
128# CONFIG_DISCONTIGMEM_MANUAL is not set
129# CONFIG_SPARSEMEM_MANUAL is not set
130CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4
134# CONFIG_RESOURCES_64BIT is not set
135CONFIG_ZONE_DMA_FLAG=1
136# CONFIG_HZ_48 is not set
137# CONFIG_HZ_100 is not set
138# CONFIG_HZ_128 is not set
139# CONFIG_HZ_250 is not set
140# CONFIG_HZ_256 is not set
141CONFIG_HZ_1000=y
142# CONFIG_HZ_1024 is not set
143CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
144CONFIG_HZ=1000
145# CONFIG_PREEMPT_NONE is not set
146# CONFIG_PREEMPT_VOLUNTARY is not set
147CONFIG_PREEMPT=y
148CONFIG_PREEMPT_BKL=y
149# CONFIG_KEXEC is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153
154#
155# Code maturity level options
156#
157CONFIG_EXPERIMENTAL=y
158CONFIG_BROKEN_ON_SMP=y
159CONFIG_LOCK_KERNEL=y
160CONFIG_INIT_ENV_ARG_LIMIT=32
161
162#
163# General setup
164#
165CONFIG_LOCALVERSION=""
166# CONFIG_LOCALVERSION_AUTO is not set
167CONFIG_SWAP=y
168CONFIG_SYSVIPC=y
169# CONFIG_IPC_NS is not set
170CONFIG_SYSVIPC_SYSCTL=y
171CONFIG_POSIX_MQUEUE=y
172# CONFIG_BSD_PROCESS_ACCT is not set
173# CONFIG_TASKSTATS is not set
174# CONFIG_UTS_NS is not set
175# CONFIG_AUDIT is not set
176# CONFIG_IKCONFIG is not set
177CONFIG_SYSFS_DEPRECATED=y
178# CONFIG_RELAY is not set
179CONFIG_CC_OPTIMIZE_FOR_SIZE=y
180CONFIG_SYSCTL=y
181CONFIG_EMBEDDED=y
182CONFIG_SYSCTL_SYSCALL=y
183CONFIG_KALLSYMS=y
184# CONFIG_KALLSYMS_EXTRA_PASS is not set
185CONFIG_HOTPLUG=y
186CONFIG_PRINTK=y
187CONFIG_BUG=y
188CONFIG_ELF_CORE=y
189CONFIG_BASE_FULL=y
190CONFIG_FUTEX=y
191CONFIG_EPOLL=y
192CONFIG_SHMEM=y
193CONFIG_SLAB=y
194CONFIG_VM_EVENT_COUNTERS=y
195CONFIG_RT_MUTEXES=y
196# CONFIG_TINY_SHMEM is not set
197CONFIG_BASE_SMALL=0
198# CONFIG_SLOB is not set
199
200#
201# Loadable module support
202#
203CONFIG_MODULES=y
204CONFIG_MODULE_UNLOAD=y
205# CONFIG_MODULE_FORCE_UNLOAD is not set
206# CONFIG_MODVERSIONS is not set
207# CONFIG_MODULE_SRCVERSION_ALL is not set
208CONFIG_KMOD=y
209
210#
211# Block layer
212#
213CONFIG_BLOCK=y
214# CONFIG_LBD is not set
215# CONFIG_BLK_DEV_IO_TRACE is not set
216# CONFIG_LSF is not set
217
218#
219# IO Schedulers
220#
221CONFIG_IOSCHED_NOOP=y
222CONFIG_IOSCHED_AS=y
223CONFIG_IOSCHED_DEADLINE=y
224CONFIG_IOSCHED_CFQ=y
225CONFIG_DEFAULT_AS=y
226# CONFIG_DEFAULT_DEADLINE is not set
227# CONFIG_DEFAULT_CFQ is not set
228# CONFIG_DEFAULT_NOOP is not set
229CONFIG_DEFAULT_IOSCHED="anticipatory"
230
231#
232# Bus options (PCI, PCMCIA, EISA, ISA, TC)
233#
234CONFIG_HW_HAS_PCI=y
235CONFIG_PCI=y
236CONFIG_MMU=y
237
238#
239# PCCARD (PCMCIA/CardBus) support
240#
241# CONFIG_PCCARD is not set
242
243#
244# PCI Hotplug Support
245#
246# CONFIG_HOTPLUG_PCI is not set
247
248#
249# Executable file formats
250#
251CONFIG_BINFMT_ELF=y
252# CONFIG_BINFMT_MISC is not set
253CONFIG_TRAD_SIGNALS=y
254
255#
256# Power management options
257#
258CONFIG_PM=y
259# CONFIG_PM_LEGACY is not set
260# CONFIG_PM_DEBUG is not set
261# CONFIG_PM_SYSFS_DEPRECATED is not set
262
263#
264# Networking
265#
266CONFIG_NET=y
267
268#
269# Networking options
270#
271# CONFIG_NETDEBUG is not set
272CONFIG_PACKET=y
273CONFIG_PACKET_MMAP=y
274CONFIG_UNIX=y
275CONFIG_XFRM=y
276# CONFIG_XFRM_USER is not set
277# CONFIG_XFRM_SUB_POLICY is not set
278CONFIG_XFRM_MIGRATE=y
279# CONFIG_NET_KEY is not set
280CONFIG_INET=y
281# CONFIG_IP_MULTICAST is not set
282# CONFIG_IP_ADVANCED_ROUTER is not set
283CONFIG_IP_FIB_HASH=y
284CONFIG_IP_PNP=y
285CONFIG_IP_PNP_DHCP=y
286# CONFIG_IP_PNP_BOOTP is not set
287# CONFIG_IP_PNP_RARP is not set
288# CONFIG_NET_IPIP is not set
289# CONFIG_NET_IPGRE is not set
290# CONFIG_ARPD is not set
291# CONFIG_SYN_COOKIES is not set
292# CONFIG_INET_AH is not set
293# CONFIG_INET_ESP is not set
294# CONFIG_INET_IPCOMP is not set
295# CONFIG_INET_XFRM_TUNNEL is not set
296# CONFIG_INET_TUNNEL is not set
297CONFIG_INET_XFRM_MODE_TRANSPORT=m
298CONFIG_INET_XFRM_MODE_TUNNEL=m
299CONFIG_INET_XFRM_MODE_BEET=m
300CONFIG_INET_DIAG=y
301CONFIG_INET_TCP_DIAG=y
302# CONFIG_TCP_CONG_ADVANCED is not set
303CONFIG_TCP_CONG_CUBIC=y
304CONFIG_DEFAULT_TCP_CONG="cubic"
305CONFIG_TCP_MD5SIG=y
306# CONFIG_IPV6 is not set
307# CONFIG_INET6_XFRM_TUNNEL is not set
308# CONFIG_INET6_TUNNEL is not set
309CONFIG_NETWORK_SECMARK=y
310# CONFIG_NETFILTER is not set
311
312#
313# DCCP Configuration (EXPERIMENTAL)
314#
315# CONFIG_IP_DCCP is not set
316
317#
318# SCTP Configuration (EXPERIMENTAL)
319#
320# CONFIG_IP_SCTP is not set
321
322#
323# TIPC Configuration (EXPERIMENTAL)
324#
325# CONFIG_TIPC is not set
326# CONFIG_ATM is not set
327# CONFIG_BRIDGE is not set
328# CONFIG_VLAN_8021Q is not set
329# CONFIG_DECNET is not set
330# CONFIG_LLC2 is not set
331# CONFIG_IPX is not set
332# CONFIG_ATALK is not set
333# CONFIG_X25 is not set
334# CONFIG_LAPB is not set
335# CONFIG_ECONET is not set
336# CONFIG_WAN_ROUTER is not set
337
338#
339# QoS and/or fair queueing
340#
341# CONFIG_NET_SCHED is not set
342
343#
344# Network testing
345#
346# CONFIG_NET_PKTGEN is not set
347# CONFIG_HAMRADIO is not set
348# CONFIG_IRDA is not set
349# CONFIG_BT is not set
350# CONFIG_IEEE80211 is not set
351
352#
353# Device Drivers
354#
355
356#
357# Generic Driver Options
358#
359CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y
361CONFIG_FW_LOADER=m
362# CONFIG_SYS_HYPERVISOR is not set
363
364#
365# Connector - unified userspace <-> kernelspace linker
366#
367# CONFIG_CONNECTOR is not set
368
369#
370# Memory Technology Devices (MTD)
371#
372CONFIG_MTD=y
373# CONFIG_MTD_DEBUG is not set
374# CONFIG_MTD_CONCAT is not set
375CONFIG_MTD_PARTITIONS=y
376# CONFIG_MTD_REDBOOT_PARTS is not set
377# CONFIG_MTD_CMDLINE_PARTS is not set
378
379#
380# User Modules And Translation Layers
381#
382CONFIG_MTD_CHAR=y
383CONFIG_MTD_BLKDEVS=y
384CONFIG_MTD_BLOCK=y
385# CONFIG_FTL is not set
386# CONFIG_NFTL is not set
387# CONFIG_INFTL is not set
388# CONFIG_RFD_FTL is not set
389# CONFIG_SSFDC is not set
390
391#
392# RAM/ROM/Flash chip drivers
393#
394# CONFIG_MTD_CFI is not set
395# CONFIG_MTD_JEDECPROBE is not set
396CONFIG_MTD_MAP_BANK_WIDTH_1=y
397CONFIG_MTD_MAP_BANK_WIDTH_2=y
398CONFIG_MTD_MAP_BANK_WIDTH_4=y
399# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
400# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
401# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
402CONFIG_MTD_CFI_I1=y
403CONFIG_MTD_CFI_I2=y
404# CONFIG_MTD_CFI_I4 is not set
405# CONFIG_MTD_CFI_I8 is not set
406# CONFIG_MTD_RAM is not set
407# CONFIG_MTD_ROM is not set
408# CONFIG_MTD_ABSENT is not set
409# CONFIG_MTD_OBSOLETE_CHIPS is not set
410
411#
412# Mapping drivers for chip access
413#
414# CONFIG_MTD_COMPLEX_MAPPINGS is not set
415# CONFIG_MTD_PLATRAM is not set
416
417#
418# Self-contained MTD device drivers
419#
420# CONFIG_MTD_PMC551 is not set
421# CONFIG_MTD_SLRAM is not set
422# CONFIG_MTD_PHRAM is not set
423# CONFIG_MTD_MTDRAM is not set
424# CONFIG_MTD_BLOCK2MTD is not set
425
426#
427# Disk-On-Chip Device Drivers
428#
429# CONFIG_MTD_DOC2000 is not set
430# CONFIG_MTD_DOC2001 is not set
431# CONFIG_MTD_DOC2001PLUS is not set
432
433#
434# NAND Flash Device Drivers
435#
436CONFIG_MTD_NAND=y
437CONFIG_MTD_NAND_VERIFY_WRITE=y
438# CONFIG_MTD_NAND_ECC_SMC is not set
439CONFIG_MTD_NAND_IDS=y
440# CONFIG_MTD_NAND_DISKONCHIP is not set
441# CONFIG_MTD_NAND_BASLER_EXCITE is not set
442# CONFIG_MTD_NAND_CAFE is not set
443# CONFIG_MTD_NAND_NANDSIM is not set
444
445#
446# OneNAND Flash Device Drivers
447#
448# CONFIG_MTD_ONENAND is not set
449
450#
451# Parallel port support
452#
453# CONFIG_PARPORT is not set
454
455#
456# Plug and Play support
457#
458# CONFIG_PNPACPI is not set
459
460#
461# Block devices
462#
463# CONFIG_BLK_CPQ_DA is not set
464# CONFIG_BLK_CPQ_CISS_DA is not set
465# CONFIG_BLK_DEV_DAC960 is not set
466# CONFIG_BLK_DEV_UMEM is not set
467# CONFIG_BLK_DEV_COW_COMMON is not set
468CONFIG_BLK_DEV_LOOP=m
469# CONFIG_BLK_DEV_CRYPTOLOOP is not set
470# CONFIG_BLK_DEV_NBD is not set
471# CONFIG_BLK_DEV_SX8 is not set
472# CONFIG_BLK_DEV_UB is not set
473# CONFIG_BLK_DEV_RAM is not set
474# CONFIG_BLK_DEV_INITRD is not set
475# CONFIG_CDROM_PKTCDVD is not set
476# CONFIG_ATA_OVER_ETH is not set
477
478#
479# Misc devices
480#
481CONFIG_SGI_IOC4=m
482# CONFIG_TIFM_CORE is not set
483
484#
485# ATA/ATAPI/MFM/RLL support
486#
487# CONFIG_IDE is not set
488
489#
490# SCSI device support
491#
492# CONFIG_RAID_ATTRS is not set
493CONFIG_SCSI=y
494CONFIG_SCSI_TGT=m
495# CONFIG_SCSI_NETLINK is not set
496# CONFIG_SCSI_PROC_FS is not set
497
498#
499# SCSI support type (disk, tape, CD-ROM)
500#
501CONFIG_BLK_DEV_SD=y
502# CONFIG_CHR_DEV_ST is not set
503# CONFIG_CHR_DEV_OSST is not set
504# CONFIG_BLK_DEV_SR is not set
505# CONFIG_CHR_DEV_SG is not set
506# CONFIG_CHR_DEV_SCH is not set
507
508#
509# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
510#
511# CONFIG_SCSI_MULTI_LUN is not set
512# CONFIG_SCSI_CONSTANTS is not set
513# CONFIG_SCSI_LOGGING is not set
514CONFIG_SCSI_SCAN_ASYNC=y
515
516#
517# SCSI Transports
518#
519# CONFIG_SCSI_SPI_ATTRS is not set
520# CONFIG_SCSI_FC_ATTRS is not set
521# CONFIG_SCSI_ISCSI_ATTRS is not set
522CONFIG_SCSI_SAS_ATTRS=m
523CONFIG_SCSI_SAS_LIBSAS=m
524# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
525
526#
527# SCSI low-level drivers
528#
529# CONFIG_ISCSI_TCP is not set
530# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
531# CONFIG_SCSI_3W_9XXX is not set
532# CONFIG_SCSI_ACARD is not set
533# CONFIG_SCSI_AACRAID is not set
534# CONFIG_SCSI_AIC7XXX is not set
535# CONFIG_SCSI_AIC7XXX_OLD is not set
536# CONFIG_SCSI_AIC79XX is not set
537CONFIG_SCSI_AIC94XX=m
538# CONFIG_AIC94XX_DEBUG is not set
539# CONFIG_SCSI_DPT_I2O is not set
540# CONFIG_SCSI_ARCMSR is not set
541# CONFIG_MEGARAID_NEWGEN is not set
542# CONFIG_MEGARAID_LEGACY is not set
543# CONFIG_MEGARAID_SAS is not set
544# CONFIG_SCSI_HPTIOP is not set
545# CONFIG_SCSI_DMX3191D is not set
546# CONFIG_SCSI_FUTURE_DOMAIN is not set
547# CONFIG_SCSI_IPS is not set
548# CONFIG_SCSI_INITIO is not set
549# CONFIG_SCSI_INIA100 is not set
550# CONFIG_SCSI_STEX is not set
551# CONFIG_SCSI_SYM53C8XX_2 is not set
552# CONFIG_SCSI_QLOGIC_1280 is not set
553# CONFIG_SCSI_QLA_FC is not set
554# CONFIG_SCSI_QLA_ISCSI is not set
555# CONFIG_SCSI_LPFC is not set
556# CONFIG_SCSI_DC395x is not set
557# CONFIG_SCSI_DC390T is not set
558# CONFIG_SCSI_NSP32 is not set
559# CONFIG_SCSI_DEBUG is not set
560# CONFIG_SCSI_SRP is not set
561
562#
563# Serial ATA (prod) and Parallel ATA (experimental) drivers
564#
565# CONFIG_ATA is not set
566
567#
568# Multi-device support (RAID and LVM)
569#
570# CONFIG_MD is not set
571
572#
573# Fusion MPT device support
574#
575# CONFIG_FUSION is not set
576# CONFIG_FUSION_SPI is not set
577# CONFIG_FUSION_FC is not set
578# CONFIG_FUSION_SAS is not set
579
580#
581# IEEE 1394 (FireWire) support
582#
583# CONFIG_IEEE1394 is not set
584
585#
586# I2O device support
587#
588# CONFIG_I2O is not set
589
590#
591# Network device support
592#
593CONFIG_NETDEVICES=y
594# CONFIG_DUMMY is not set
595# CONFIG_BONDING is not set
596# CONFIG_EQUALIZER is not set
597# CONFIG_TUN is not set
598
599#
600# ARCnet devices
601#
602# CONFIG_ARCNET is not set
603
604#
605# PHY device support
606#
607
608#
609# Ethernet (10 or 100Mbit)
610#
611# CONFIG_NET_ETHERNET is not set
612
613#
614# Ethernet (1000 Mbit)
615#
616# CONFIG_ACENIC is not set
617# CONFIG_DL2K is not set
618# CONFIG_E1000 is not set
619# CONFIG_NS83820 is not set
620# CONFIG_HAMACHI is not set
621# CONFIG_YELLOWFIN is not set
622# CONFIG_R8169 is not set
623# CONFIG_SIS190 is not set
624# CONFIG_SKGE is not set
625# CONFIG_SKY2 is not set
626# CONFIG_SK98LIN is not set
627# CONFIG_TIGON3 is not set
628# CONFIG_BNX2 is not set
629CONFIG_QLA3XXX=m
630# CONFIG_ATL1 is not set
631
632#
633# Ethernet (10000 Mbit)
634#
635# CONFIG_CHELSIO_T1 is not set
636CONFIG_CHELSIO_T3=m
637# CONFIG_IXGB is not set
638# CONFIG_S2IO is not set
639# CONFIG_MYRI10GE is not set
640CONFIG_NETXEN_NIC=m
641
642#
643# Token Ring devices
644#
645# CONFIG_TR is not set
646
647#
648# Wireless LAN (non-hamradio)
649#
650# CONFIG_NET_RADIO is not set
651
652#
653# Wan interfaces
654#
655# CONFIG_WAN is not set
656# CONFIG_FDDI is not set
657# CONFIG_HIPPI is not set
658# CONFIG_PPP is not set
659# CONFIG_SLIP is not set
660# CONFIG_NET_FC is not set
661# CONFIG_SHAPER is not set
662# CONFIG_NETCONSOLE is not set
663# CONFIG_NETPOLL is not set
664# CONFIG_NET_POLL_CONTROLLER is not set
665
666#
667# ISDN subsystem
668#
669# CONFIG_ISDN is not set
670
671#
672# Telephony Support
673#
674# CONFIG_PHONE is not set
675
676#
677# Input device support
678#
679CONFIG_INPUT=y
680# CONFIG_INPUT_FF_MEMLESS is not set
681
682#
683# Userland interfaces
684#
685CONFIG_INPUT_MOUSEDEV=m
686CONFIG_INPUT_MOUSEDEV_PSAUX=y
687CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
688CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
689# CONFIG_INPUT_JOYDEV is not set
690# CONFIG_INPUT_TSDEV is not set
691CONFIG_INPUT_EVDEV=m
692# CONFIG_INPUT_EVBUG is not set
693
694#
695# Input Device Drivers
696#
697# CONFIG_INPUT_KEYBOARD is not set
698# CONFIG_INPUT_MOUSE is not set
699# CONFIG_INPUT_JOYSTICK is not set
700# CONFIG_INPUT_TOUCHSCREEN is not set
701# CONFIG_INPUT_MISC is not set
702
703#
704# Hardware I/O ports
705#
706# CONFIG_SERIO is not set
707# CONFIG_GAMEPORT is not set
708
709#
710# Character devices
711#
712CONFIG_VT=y
713CONFIG_VT_CONSOLE=y
714CONFIG_HW_CONSOLE=y
715CONFIG_VT_HW_CONSOLE_BINDING=y
716# CONFIG_SERIAL_NONSTANDARD is not set
717
718#
719# Serial drivers
720#
721CONFIG_SERIAL_8250=y
722CONFIG_SERIAL_8250_CONSOLE=y
723CONFIG_SERIAL_8250_PCI=y
724CONFIG_SERIAL_8250_NR_UARTS=2
725CONFIG_SERIAL_8250_RUNTIME_UARTS=2
726CONFIG_SERIAL_8250_EXTENDED=y
727# CONFIG_SERIAL_8250_MANY_PORTS is not set
728CONFIG_SERIAL_8250_SHARE_IRQ=y
729# CONFIG_SERIAL_8250_DETECT_IRQ is not set
730# CONFIG_SERIAL_8250_RSA is not set
731
732#
733# Non-8250 serial port support
734#
735CONFIG_SERIAL_CORE=y
736CONFIG_SERIAL_CORE_CONSOLE=y
737# CONFIG_SERIAL_JSM is not set
738CONFIG_UNIX98_PTYS=y
739# CONFIG_LEGACY_PTYS is not set
740
741#
742# IPMI
743#
744# CONFIG_IPMI_HANDLER is not set
745
746#
747# Watchdog Cards
748#
749CONFIG_WATCHDOG=y
750# CONFIG_WATCHDOG_NOWAYOUT is not set
751
752#
753# Watchdog Device Drivers
754#
755# CONFIG_SOFT_WATCHDOG is not set
756CONFIG_WDT_RM9K_GPI=m
757
758#
759# PCI-based Watchdog Cards
760#
761# CONFIG_PCIPCWATCHDOG is not set
762# CONFIG_WDTPCI is not set
763
764#
765# USB-based Watchdog Cards
766#
767# CONFIG_USBPCWATCHDOG is not set
768# CONFIG_HW_RANDOM is not set
769# CONFIG_RTC is not set
770# CONFIG_GEN_RTC is not set
771# CONFIG_DTLK is not set
772# CONFIG_R3964 is not set
773# CONFIG_APPLICOM is not set
774# CONFIG_DRM is not set
775# CONFIG_RAW_DRIVER is not set
776
777#
778# TPM devices
779#
780# CONFIG_TCG_TPM is not set
781
782#
783# I2C support
784#
785# CONFIG_I2C is not set
786
787#
788# SPI support
789#
790# CONFIG_SPI is not set
791# CONFIG_SPI_MASTER is not set
792
793#
794# Dallas's 1-wire bus
795#
796# CONFIG_W1 is not set
797
798#
799# Hardware Monitoring support
800#
801# CONFIG_HWMON is not set
802# CONFIG_HWMON_VID is not set
803
804#
805# Multimedia devices
806#
807# CONFIG_VIDEO_DEV is not set
808
809#
810# Digital Video Broadcasting Devices
811#
812# CONFIG_DVB is not set
813# CONFIG_USB_DABUSB is not set
814
815#
816# Graphics support
817#
818# CONFIG_FIRMWARE_EDID is not set
819CONFIG_FB=y
820# CONFIG_FB_CFB_FILLRECT is not set
821# CONFIG_FB_CFB_COPYAREA is not set
822# CONFIG_FB_CFB_IMAGEBLIT is not set
823# CONFIG_FB_SVGALIB is not set
824# CONFIG_FB_MACMODES is not set
825# CONFIG_FB_BACKLIGHT is not set
826# CONFIG_FB_MODE_HELPERS is not set
827# CONFIG_FB_TILEBLITTING is not set
828# CONFIG_FB_CIRRUS is not set
829# CONFIG_FB_PM2 is not set
830# CONFIG_FB_CYBER2000 is not set
831# CONFIG_FB_ASILIANT is not set
832# CONFIG_FB_IMSTT is not set
833# CONFIG_FB_S1D13XXX is not set
834# CONFIG_FB_NVIDIA is not set
835# CONFIG_FB_RIVA is not set
836# CONFIG_FB_MATROX is not set
837# CONFIG_FB_RADEON is not set
838# CONFIG_FB_ATY128 is not set
839# CONFIG_FB_ATY is not set
840# CONFIG_FB_S3 is not set
841# CONFIG_FB_SAVAGE is not set
842# CONFIG_FB_SIS is not set
843# CONFIG_FB_NEOMAGIC is not set
844# CONFIG_FB_KYRO is not set
845# CONFIG_FB_3DFX is not set
846# CONFIG_FB_VOODOO1 is not set
847# CONFIG_FB_SMIVGX is not set
848# CONFIG_FB_TRIDENT is not set
849# CONFIG_FB_VIRTUAL is not set
850
851#
852# Console display driver support
853#
854# CONFIG_VGA_CONSOLE is not set
855CONFIG_DUMMY_CONSOLE=y
856CONFIG_FRAMEBUFFER_CONSOLE=m
857# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
858# CONFIG_FONTS is not set
859CONFIG_FONT_8x8=y
860CONFIG_FONT_8x16=y
861
862#
863# Logo configuration
864#
865# CONFIG_LOGO is not set
866# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
867
868#
869# Sound
870#
871# CONFIG_SOUND is not set
872
873#
874# HID Devices
875#
876CONFIG_HID=y
877# CONFIG_HID_DEBUG is not set
878
879#
880# USB support
881#
882CONFIG_USB_ARCH_HAS_HCD=y
883CONFIG_USB_ARCH_HAS_OHCI=y
884CONFIG_USB_ARCH_HAS_EHCI=y
885CONFIG_USB=y
886# CONFIG_USB_DEBUG is not set
887
888#
889# Miscellaneous USB options
890#
891CONFIG_USB_DEVICEFS=y
892# CONFIG_USB_DYNAMIC_MINORS is not set
893# CONFIG_USB_SUSPEND is not set
894# CONFIG_USB_OTG is not set
895
896#
897# USB Host Controller Drivers
898#
899CONFIG_USB_EHCI_HCD=y
900# CONFIG_USB_EHCI_SPLIT_ISO is not set
901# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
902# CONFIG_USB_EHCI_TT_NEWSCHED is not set
903# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
904# CONFIG_USB_ISP116X_HCD is not set
905CONFIG_USB_OHCI_HCD=y
906# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
907# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
908CONFIG_USB_OHCI_LITTLE_ENDIAN=y
909# CONFIG_USB_UHCI_HCD is not set
910# CONFIG_USB_SL811_HCD is not set
911
912#
913# USB Device Class drivers
914#
915# CONFIG_USB_ACM is not set
916# CONFIG_USB_PRINTER is not set
917
918#
919# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
920#
921
922#
923# may also be needed; see USB_STORAGE Help for more information
924#
925CONFIG_USB_STORAGE=y
926# CONFIG_USB_STORAGE_DEBUG is not set
927# CONFIG_USB_STORAGE_DATAFAB is not set
928# CONFIG_USB_STORAGE_FREECOM is not set
929# CONFIG_USB_STORAGE_DPCM is not set
930# CONFIG_USB_STORAGE_USBAT is not set
931# CONFIG_USB_STORAGE_SDDR09 is not set
932# CONFIG_USB_STORAGE_SDDR55 is not set
933# CONFIG_USB_STORAGE_JUMPSHOT is not set
934# CONFIG_USB_STORAGE_ALAUDA is not set
935# CONFIG_USB_STORAGE_KARMA is not set
936# CONFIG_USB_LIBUSUAL is not set
937
938#
939# USB Input Devices
940#
941CONFIG_USB_HID=m
942# CONFIG_USB_HIDINPUT_POWERBOOK is not set
943# CONFIG_HID_FF is not set
944# CONFIG_USB_HIDDEV is not set
945
946#
947# USB HID Boot Protocol drivers
948#
949# CONFIG_USB_KBD is not set
950# CONFIG_USB_MOUSE is not set
951# CONFIG_USB_AIPTEK is not set
952# CONFIG_USB_WACOM is not set
953# CONFIG_USB_ACECAD is not set
954# CONFIG_USB_KBTAB is not set
955# CONFIG_USB_POWERMATE is not set
956# CONFIG_USB_TOUCHSCREEN is not set
957# CONFIG_USB_YEALINK is not set
958# CONFIG_USB_XPAD is not set
959# CONFIG_USB_ATI_REMOTE is not set
960# CONFIG_USB_ATI_REMOTE2 is not set
961# CONFIG_USB_KEYSPAN_REMOTE is not set
962# CONFIG_USB_APPLETOUCH is not set
963# CONFIG_USB_GTCO is not set
964
965#
966# USB Imaging devices
967#
968# CONFIG_USB_MDC800 is not set
969# CONFIG_USB_MICROTEK is not set
970
971#
972# USB Network Adapters
973#
974# CONFIG_USB_CATC is not set
975# CONFIG_USB_KAWETH is not set
976# CONFIG_USB_PEGASUS is not set
977# CONFIG_USB_RTL8150 is not set
978# CONFIG_USB_USBNET_MII is not set
979# CONFIG_USB_USBNET is not set
980# CONFIG_USB_MON is not set
981
982#
983# USB port drivers
984#
985
986#
987# USB Serial Converter support
988#
989# CONFIG_USB_SERIAL is not set
990
991#
992# USB Miscellaneous drivers
993#
994# CONFIG_USB_EMI62 is not set
995# CONFIG_USB_EMI26 is not set
996# CONFIG_USB_ADUTUX is not set
997# CONFIG_USB_AUERSWALD is not set
998# CONFIG_USB_RIO500 is not set
999# CONFIG_USB_LEGOTOWER is not set
1000# CONFIG_USB_LCD is not set
1001# CONFIG_USB_BERRY_CHARGE is not set
1002# CONFIG_USB_LED is not set
1003# CONFIG_USB_CYPRESS_CY7C63 is not set
1004# CONFIG_USB_CYTHERM is not set
1005# CONFIG_USB_PHIDGET is not set
1006# CONFIG_USB_IDMOUSE is not set
1007# CONFIG_USB_FTDI_ELAN is not set
1008# CONFIG_USB_APPLEDISPLAY is not set
1009# CONFIG_USB_SISUSBVGA is not set
1010# CONFIG_USB_LD is not set
1011# CONFIG_USB_TRANCEVIBRATOR is not set
1012# CONFIG_USB_TEST is not set
1013
1014#
1015# USB DSL modem support
1016#
1017
1018#
1019# USB Gadget Support
1020#
1021# CONFIG_USB_GADGET is not set
1022
1023#
1024# MMC/SD Card support
1025#
1026# CONFIG_MMC is not set
1027
1028#
1029# LED devices
1030#
1031# CONFIG_NEW_LEDS is not set
1032
1033#
1034# LED drivers
1035#
1036
1037#
1038# LED Triggers
1039#
1040
1041#
1042# InfiniBand support
1043#
1044# CONFIG_INFINIBAND is not set
1045
1046#
1047# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1048#
1049
1050#
1051# Real Time Clock
1052#
1053# CONFIG_RTC_CLASS is not set
1054
1055#
1056# DMA Engine support
1057#
1058# CONFIG_DMA_ENGINE is not set
1059
1060#
1061# DMA Clients
1062#
1063
1064#
1065# DMA Devices
1066#
1067
1068#
1069# Auxiliary Display support
1070#
1071
1072#
1073# Virtualization
1074#
1075
1076#
1077# File systems
1078#
1079CONFIG_EXT2_FS=y
1080# CONFIG_EXT2_FS_XATTR is not set
1081# CONFIG_EXT2_FS_XIP is not set
1082# CONFIG_EXT3_FS is not set
1083# CONFIG_EXT4DEV_FS is not set
1084# CONFIG_REISERFS_FS is not set
1085# CONFIG_JFS_FS is not set
1086CONFIG_FS_POSIX_ACL=y
1087# CONFIG_XFS_FS is not set
1088# CONFIG_GFS2_FS is not set
1089# CONFIG_OCFS2_FS is not set
1090# CONFIG_MINIX_FS is not set
1091# CONFIG_ROMFS_FS is not set
1092CONFIG_INOTIFY=y
1093CONFIG_INOTIFY_USER=y
1094# CONFIG_QUOTA is not set
1095# CONFIG_DNOTIFY is not set
1096# CONFIG_AUTOFS_FS is not set
1097# CONFIG_AUTOFS4_FS is not set
1098# CONFIG_FUSE_FS is not set
1099CONFIG_GENERIC_ACL=y
1100
1101#
1102# CD-ROM/DVD Filesystems
1103#
1104# CONFIG_ISO9660_FS is not set
1105# CONFIG_UDF_FS is not set
1106
1107#
1108# DOS/FAT/NT Filesystems
1109#
1110CONFIG_FAT_FS=m
1111CONFIG_MSDOS_FS=m
1112CONFIG_VFAT_FS=m
1113CONFIG_FAT_DEFAULT_CODEPAGE=437
1114CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1115# CONFIG_NTFS_FS is not set
1116
1117#
1118# Pseudo filesystems
1119#
1120CONFIG_PROC_FS=y
1121CONFIG_PROC_KCORE=y
1122CONFIG_PROC_SYSCTL=y
1123CONFIG_SYSFS=y
1124CONFIG_TMPFS=y
1125CONFIG_TMPFS_POSIX_ACL=y
1126# CONFIG_HUGETLB_PAGE is not set
1127CONFIG_RAMFS=y
1128CONFIG_CONFIGFS_FS=m
1129
1130#
1131# Miscellaneous filesystems
1132#
1133# CONFIG_ADFS_FS is not set
1134# CONFIG_AFFS_FS is not set
1135# CONFIG_HFS_FS is not set
1136# CONFIG_HFSPLUS_FS is not set
1137# CONFIG_BEFS_FS is not set
1138# CONFIG_BFS_FS is not set
1139# CONFIG_EFS_FS is not set
1140CONFIG_JFFS2_FS=y
1141CONFIG_JFFS2_FS_DEBUG=0
1142CONFIG_JFFS2_FS_WRITEBUFFER=y
1143# CONFIG_JFFS2_SUMMARY is not set
1144# CONFIG_JFFS2_FS_XATTR is not set
1145# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1146CONFIG_JFFS2_ZLIB=y
1147CONFIG_JFFS2_RTIME=y
1148# CONFIG_JFFS2_RUBIN is not set
1149# CONFIG_CRAMFS is not set
1150# CONFIG_VXFS_FS is not set
1151# CONFIG_HPFS_FS is not set
1152# CONFIG_QNX4FS_FS is not set
1153# CONFIG_SYSV_FS is not set
1154# CONFIG_UFS_FS is not set
1155
1156#
1157# Network File Systems
1158#
1159CONFIG_NFS_FS=y
1160CONFIG_NFS_V3=y
1161# CONFIG_NFS_V3_ACL is not set
1162# CONFIG_NFS_V4 is not set
1163# CONFIG_NFS_DIRECTIO is not set
1164# CONFIG_NFSD is not set
1165CONFIG_ROOT_NFS=y
1166CONFIG_LOCKD=y
1167CONFIG_LOCKD_V4=y
1168CONFIG_NFS_COMMON=y
1169CONFIG_SUNRPC=y
1170# CONFIG_RPCSEC_GSS_KRB5 is not set
1171# CONFIG_RPCSEC_GSS_SPKM3 is not set
1172# CONFIG_SMB_FS is not set
1173# CONFIG_CIFS is not set
1174# CONFIG_NCP_FS is not set
1175# CONFIG_CODA_FS is not set
1176# CONFIG_AFS_FS is not set
1177# CONFIG_9P_FS is not set
1178
1179#
1180# Partition Types
1181#
1182CONFIG_PARTITION_ADVANCED=y
1183# CONFIG_ACORN_PARTITION is not set
1184# CONFIG_OSF_PARTITION is not set
1185# CONFIG_AMIGA_PARTITION is not set
1186# CONFIG_ATARI_PARTITION is not set
1187# CONFIG_MAC_PARTITION is not set
1188CONFIG_MSDOS_PARTITION=y
1189# CONFIG_BSD_DISKLABEL is not set
1190# CONFIG_MINIX_SUBPARTITION is not set
1191# CONFIG_SOLARIS_X86_PARTITION is not set
1192# CONFIG_UNIXWARE_DISKLABEL is not set
1193# CONFIG_LDM_PARTITION is not set
1194# CONFIG_SGI_PARTITION is not set
1195# CONFIG_ULTRIX_PARTITION is not set
1196# CONFIG_SUN_PARTITION is not set
1197# CONFIG_KARMA_PARTITION is not set
1198# CONFIG_EFI_PARTITION is not set
1199
1200#
1201# Native Language Support
1202#
1203CONFIG_NLS=y
1204CONFIG_NLS_DEFAULT="iso8859-1"
1205CONFIG_NLS_CODEPAGE_437=m
1206# CONFIG_NLS_CODEPAGE_737 is not set
1207# CONFIG_NLS_CODEPAGE_775 is not set
1208CONFIG_NLS_CODEPAGE_850=m
1209# CONFIG_NLS_CODEPAGE_852 is not set
1210# CONFIG_NLS_CODEPAGE_855 is not set
1211# CONFIG_NLS_CODEPAGE_857 is not set
1212# CONFIG_NLS_CODEPAGE_860 is not set
1213# CONFIG_NLS_CODEPAGE_861 is not set
1214# CONFIG_NLS_CODEPAGE_862 is not set
1215# CONFIG_NLS_CODEPAGE_863 is not set
1216# CONFIG_NLS_CODEPAGE_864 is not set
1217# CONFIG_NLS_CODEPAGE_865 is not set
1218# CONFIG_NLS_CODEPAGE_866 is not set
1219# CONFIG_NLS_CODEPAGE_869 is not set
1220# CONFIG_NLS_CODEPAGE_936 is not set
1221# CONFIG_NLS_CODEPAGE_950 is not set
1222# CONFIG_NLS_CODEPAGE_932 is not set
1223# CONFIG_NLS_CODEPAGE_949 is not set
1224# CONFIG_NLS_CODEPAGE_874 is not set
1225# CONFIG_NLS_ISO8859_8 is not set
1226# CONFIG_NLS_CODEPAGE_1250 is not set
1227# CONFIG_NLS_CODEPAGE_1251 is not set
1228# CONFIG_NLS_ASCII is not set
1229CONFIG_NLS_ISO8859_1=m
1230# CONFIG_NLS_ISO8859_2 is not set
1231# CONFIG_NLS_ISO8859_3 is not set
1232# CONFIG_NLS_ISO8859_4 is not set
1233# CONFIG_NLS_ISO8859_5 is not set
1234# CONFIG_NLS_ISO8859_6 is not set
1235# CONFIG_NLS_ISO8859_7 is not set
1236# CONFIG_NLS_ISO8859_9 is not set
1237# CONFIG_NLS_ISO8859_13 is not set
1238# CONFIG_NLS_ISO8859_14 is not set
1239# CONFIG_NLS_ISO8859_15 is not set
1240# CONFIG_NLS_KOI8_R is not set
1241# CONFIG_NLS_KOI8_U is not set
1242# CONFIG_NLS_UTF8 is not set
1243
1244#
1245# Distributed Lock Manager
1246#
1247CONFIG_DLM=m
1248CONFIG_DLM_TCP=y
1249# CONFIG_DLM_SCTP is not set
1250# CONFIG_DLM_DEBUG is not set
1251
1252#
1253# Profiling support
1254#
1255# CONFIG_PROFILING is not set
1256
1257#
1258# Kernel hacking
1259#
1260CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1261# CONFIG_PRINTK_TIME is not set
1262CONFIG_ENABLE_MUST_CHECK=y
1263# CONFIG_MAGIC_SYSRQ is not set
1264# CONFIG_UNUSED_SYMBOLS is not set
1265# CONFIG_DEBUG_FS is not set
1266# CONFIG_HEADERS_CHECK is not set
1267# CONFIG_DEBUG_KERNEL is not set
1268CONFIG_LOG_BUF_SHIFT=14
1269CONFIG_CROSSCOMPILE=y
1270CONFIG_CMDLINE=""
1271
1272#
1273# Security options
1274#
1275# CONFIG_KEYS is not set
1276# CONFIG_SECURITY is not set
1277
1278#
1279# Cryptographic options
1280#
1281CONFIG_CRYPTO=y
1282CONFIG_CRYPTO_ALGAPI=y
1283CONFIG_CRYPTO_BLKCIPHER=m
1284CONFIG_CRYPTO_HASH=m
1285CONFIG_CRYPTO_MANAGER=m
1286# CONFIG_CRYPTO_HMAC is not set
1287CONFIG_CRYPTO_XCBC=m
1288# CONFIG_CRYPTO_NULL is not set
1289# CONFIG_CRYPTO_MD4 is not set
1290CONFIG_CRYPTO_MD5=y
1291# CONFIG_CRYPTO_SHA1 is not set
1292# CONFIG_CRYPTO_SHA256 is not set
1293# CONFIG_CRYPTO_SHA512 is not set
1294# CONFIG_CRYPTO_WP512 is not set
1295# CONFIG_CRYPTO_TGR192 is not set
1296CONFIG_CRYPTO_GF128MUL=m
1297CONFIG_CRYPTO_ECB=m
1298CONFIG_CRYPTO_CBC=m
1299CONFIG_CRYPTO_PCBC=m
1300CONFIG_CRYPTO_LRW=m
1301# CONFIG_CRYPTO_DES is not set
1302CONFIG_CRYPTO_FCRYPT=m
1303# CONFIG_CRYPTO_BLOWFISH is not set
1304# CONFIG_CRYPTO_TWOFISH is not set
1305# CONFIG_CRYPTO_SERPENT is not set
1306# CONFIG_CRYPTO_AES is not set
1307# CONFIG_CRYPTO_CAST5 is not set
1308# CONFIG_CRYPTO_CAST6 is not set
1309# CONFIG_CRYPTO_TEA is not set
1310# CONFIG_CRYPTO_ARC4 is not set
1311# CONFIG_CRYPTO_KHAZAD is not set
1312# CONFIG_CRYPTO_ANUBIS is not set
1313# CONFIG_CRYPTO_DEFLATE is not set
1314# CONFIG_CRYPTO_MICHAEL_MIC is not set
1315# CONFIG_CRYPTO_CRC32C is not set
1316CONFIG_CRYPTO_CAMELLIA=m
1317# CONFIG_CRYPTO_TEST is not set
1318
1319#
1320# Hardware crypto devices
1321#
1322
1323#
1324# Library routines
1325#
1326CONFIG_BITREVERSE=y
1327# CONFIG_CRC_CCITT is not set
1328# CONFIG_CRC16 is not set
1329CONFIG_CRC32=y
1330# CONFIG_LIBCRC32C is not set
1331CONFIG_ZLIB_INFLATE=y
1332CONFIG_ZLIB_DEFLATE=y
1333CONFIG_PLIST=y
1334CONFIG_HAS_IOMEM=y
1335CONFIG_HAS_IOPORT=y
diff --git a/arch/mips/configs/fuloong2e_defconfig b/arch/mips/configs/fuloong2e_defconfig
index 0197f0de6b3f..a09dd03aa8c8 100644
--- a/arch/mips/configs/fuloong2e_defconfig
+++ b/arch/mips/configs/fuloong2e_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.31-rc1 3# Linux kernel version: 2.6.32-rc4
4# Thu Jul 2 22:37:00 2009 4# Fri Oct 16 13:18:01 2009
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -10,8 +10,8 @@ CONFIG_MIPS=y
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BASLER_EXCITE is not set
14# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set
15# CONFIG_MIPS_COBALT is not set 15# CONFIG_MIPS_COBALT is not set
16# CONFIG_MACH_DECSTATION is not set 16# CONFIG_MACH_DECSTATION is not set
17# CONFIG_MACH_JAZZ is not set 17# CONFIG_MACH_JAZZ is not set
@@ -105,6 +105,8 @@ CONFIG_CPU_LOONGSON2E=y
105# CONFIG_CPU_RM9000 is not set 105# CONFIG_CPU_RM9000 is not set
106# CONFIG_CPU_SB1 is not set 106# CONFIG_CPU_SB1 is not set
107# CONFIG_CPU_CAVIUM_OCTEON is not set 107# CONFIG_CPU_CAVIUM_OCTEON is not set
108CONFIG_SYS_SUPPORTS_ZBOOT=y
109CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y
108CONFIG_CPU_LOONGSON2=y 110CONFIG_CPU_LOONGSON2=y
109CONFIG_SYS_HAS_CPU_LOONGSON2E=y 111CONFIG_SYS_HAS_CPU_LOONGSON2E=y
110CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 112CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
@@ -135,12 +137,16 @@ CONFIG_SYS_SUPPORTS_HIGHMEM=y
135CONFIG_ARCH_FLATMEM_ENABLE=y 137CONFIG_ARCH_FLATMEM_ENABLE=y
136CONFIG_ARCH_POPULATES_NODE_MAP=y 138CONFIG_ARCH_POPULATES_NODE_MAP=y
137CONFIG_SELECT_MEMORY_MODEL=y 139CONFIG_SELECT_MEMORY_MODEL=y
138CONFIG_FLATMEM_MANUAL=y 140# CONFIG_FLATMEM_MANUAL is not set
139# CONFIG_DISCONTIGMEM_MANUAL is not set 141# CONFIG_DISCONTIGMEM_MANUAL is not set
140# CONFIG_SPARSEMEM_MANUAL is not set 142CONFIG_SPARSEMEM_MANUAL=y
141CONFIG_FLATMEM=y 143CONFIG_SPARSEMEM=y
142CONFIG_FLAT_NODE_MEM_MAP=y 144CONFIG_HAVE_MEMORY_PRESENT=y
143CONFIG_SPARSEMEM_STATIC=y 145CONFIG_SPARSEMEM_STATIC=y
146
147#
148# Memory hotplug is currently incompatible with Software Suspend
149#
144CONFIG_PAGEFLAGS_EXTENDED=y 150CONFIG_PAGEFLAGS_EXTENDED=y
145CONFIG_SPLIT_PTLOCK_CPUS=4 151CONFIG_SPLIT_PTLOCK_CPUS=4
146CONFIG_PHYS_ADDR_T_64BIT=y 152CONFIG_PHYS_ADDR_T_64BIT=y
@@ -148,6 +154,7 @@ CONFIG_ZONE_DMA_FLAG=0
148CONFIG_VIRT_TO_BUS=y 154CONFIG_VIRT_TO_BUS=y
149CONFIG_HAVE_MLOCK=y 155CONFIG_HAVE_MLOCK=y
150CONFIG_HAVE_MLOCKED_PAGE_BIT=y 156CONFIG_HAVE_MLOCKED_PAGE_BIT=y
157# CONFIG_KSM is not set
151CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 158CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
152CONFIG_TICK_ONESHOT=y 159CONFIG_TICK_ONESHOT=y
153CONFIG_NO_HZ=y 160CONFIG_NO_HZ=y
@@ -180,6 +187,12 @@ CONFIG_BROKEN_ON_SMP=y
180CONFIG_INIT_ENV_ARG_LIMIT=32 187CONFIG_INIT_ENV_ARG_LIMIT=32
181CONFIG_LOCALVERSION="-fuloong2e" 188CONFIG_LOCALVERSION="-fuloong2e"
182# CONFIG_LOCALVERSION_AUTO is not set 189# CONFIG_LOCALVERSION_AUTO is not set
190CONFIG_HAVE_KERNEL_GZIP=y
191CONFIG_HAVE_KERNEL_BZIP2=y
192CONFIG_HAVE_KERNEL_LZMA=y
193CONFIG_KERNEL_GZIP=y
194# CONFIG_KERNEL_BZIP2 is not set
195# CONFIG_KERNEL_LZMA is not set
183CONFIG_SWAP=y 196CONFIG_SWAP=y
184CONFIG_SYSVIPC=y 197CONFIG_SYSVIPC=y
185CONFIG_SYSVIPC_SYSCTL=y 198CONFIG_SYSVIPC_SYSCTL=y
@@ -193,11 +206,12 @@ CONFIG_BSD_PROCESS_ACCT=y
193# 206#
194# RCU Subsystem 207# RCU Subsystem
195# 208#
196CONFIG_CLASSIC_RCU=y 209CONFIG_TREE_RCU=y
197# CONFIG_TREE_RCU is not set 210# CONFIG_TREE_PREEMPT_RCU is not set
198# CONFIG_PREEMPT_RCU is not set 211# CONFIG_RCU_TRACE is not set
212CONFIG_RCU_FANOUT=64
213# CONFIG_RCU_FANOUT_EXACT is not set
199# CONFIG_TREE_RCU_TRACE is not set 214# CONFIG_TREE_RCU_TRACE is not set
200# CONFIG_PREEMPT_RCU_TRACE is not set
201CONFIG_IKCONFIG=y 215CONFIG_IKCONFIG=y
202CONFIG_IKCONFIG_PROC=y 216CONFIG_IKCONFIG_PROC=y
203CONFIG_LOG_BUF_SHIFT=14 217CONFIG_LOG_BUF_SHIFT=14
@@ -235,18 +249,16 @@ CONFIG_SHMEM=y
235CONFIG_AIO=y 249CONFIG_AIO=y
236 250
237# 251#
238# Performance Counters 252# Kernel Performance Events And Counters
239# 253#
240CONFIG_VM_EVENT_COUNTERS=y 254CONFIG_VM_EVENT_COUNTERS=y
241CONFIG_PCI_QUIRKS=y 255CONFIG_PCI_QUIRKS=y
242# CONFIG_STRIP_ASM_SYMS is not set
243# CONFIG_COMPAT_BRK is not set 256# CONFIG_COMPAT_BRK is not set
244CONFIG_SLAB=y 257CONFIG_SLAB=y
245# CONFIG_SLUB is not set 258# CONFIG_SLUB is not set
246# CONFIG_SLOB is not set 259# CONFIG_SLOB is not set
247CONFIG_PROFILING=y 260CONFIG_PROFILING=y
248CONFIG_TRACEPOINTS=y 261CONFIG_TRACEPOINTS=y
249CONFIG_MARKERS=y
250CONFIG_OPROFILE=m 262CONFIG_OPROFILE=m
251CONFIG_HAVE_OPROFILE=y 263CONFIG_HAVE_OPROFILE=y
252CONFIG_HAVE_SYSCALL_WRAPPERS=y 264CONFIG_HAVE_SYSCALL_WRAPPERS=y
@@ -255,8 +267,8 @@ CONFIG_HAVE_SYSCALL_WRAPPERS=y
255# GCOV-based kernel profiling 267# GCOV-based kernel profiling
256# 268#
257# CONFIG_GCOV_KERNEL is not set 269# CONFIG_GCOV_KERNEL is not set
258# CONFIG_SLOW_WORK is not set 270CONFIG_SLOW_WORK=y
259# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 271CONFIG_HAVE_GENERIC_DMA_COHERENT=y
260CONFIG_SLABINFO=y 272CONFIG_SLABINFO=y
261CONFIG_RT_MUTEXES=y 273CONFIG_RT_MUTEXES=y
262CONFIG_BASE_SMALL=0 274CONFIG_BASE_SMALL=0
@@ -283,7 +295,7 @@ CONFIG_IOSCHED_CFQ=y
283CONFIG_DEFAULT_CFQ=y 295CONFIG_DEFAULT_CFQ=y
284# CONFIG_DEFAULT_NOOP is not set 296# CONFIG_DEFAULT_NOOP is not set
285CONFIG_DEFAULT_IOSCHED="cfq" 297CONFIG_DEFAULT_IOSCHED="cfq"
286# CONFIG_FREEZER is not set 298CONFIG_FREEZER=y
287 299
288# 300#
289# Bus options (PCI, PCMCIA, EISA, ISA, TC) 301# Bus options (PCI, PCMCIA, EISA, ISA, TC)
@@ -321,9 +333,14 @@ CONFIG_ARCH_HIBERNATION_POSSIBLE=y
321CONFIG_ARCH_SUSPEND_POSSIBLE=y 333CONFIG_ARCH_SUSPEND_POSSIBLE=y
322CONFIG_PM=y 334CONFIG_PM=y
323# CONFIG_PM_DEBUG is not set 335# CONFIG_PM_DEBUG is not set
336CONFIG_PM_SLEEP=y
324# CONFIG_SUSPEND is not set 337# CONFIG_SUSPEND is not set
325# CONFIG_HIBERNATION is not set 338CONFIG_HIBERNATION_NVS=y
339CONFIG_HIBERNATION=y
340CONFIG_PM_STD_PARTITION="/dev/hda3"
341# CONFIG_PM_RUNTIME is not set
326CONFIG_NET=y 342CONFIG_NET=y
343CONFIG_COMPAT_NETLINK_MESSAGES=y
327 344
328# 345#
329# Networking options 346# Networking options
@@ -442,6 +459,7 @@ CONFIG_IP_NF_ARPFILTER=m
442CONFIG_IP_NF_ARP_MANGLE=m 459CONFIG_IP_NF_ARP_MANGLE=m
443# CONFIG_IP_DCCP is not set 460# CONFIG_IP_DCCP is not set
444# CONFIG_IP_SCTP is not set 461# CONFIG_IP_SCTP is not set
462# CONFIG_RDS is not set
445# CONFIG_TIPC is not set 463# CONFIG_TIPC is not set
446# CONFIG_ATM is not set 464# CONFIG_ATM is not set
447# CONFIG_BRIDGE is not set 465# CONFIG_BRIDGE is not set
@@ -473,6 +491,7 @@ CONFIG_NET_CLS_ROUTE=y
473# CONFIG_AF_RXRPC is not set 491# CONFIG_AF_RXRPC is not set
474CONFIG_WIRELESS=y 492CONFIG_WIRELESS=y
475# CONFIG_CFG80211 is not set 493# CONFIG_CFG80211 is not set
494CONFIG_CFG80211_DEFAULT_PS_VALUE=0
476CONFIG_WIRELESS_OLD_REGULATORY=y 495CONFIG_WIRELESS_OLD_REGULATORY=y
477CONFIG_WIRELESS_EXT=y 496CONFIG_WIRELESS_EXT=y
478CONFIG_WIRELESS_EXT_SYSFS=y 497CONFIG_WIRELESS_EXT_SYSFS=y
@@ -481,7 +500,6 @@ CONFIG_WIRELESS_EXT_SYSFS=y
481# 500#
482# CFG80211 needs to be enabled for MAC80211 501# CFG80211 needs to be enabled for MAC80211
483# 502#
484CONFIG_MAC80211_DEFAULT_PS_VALUE=0
485# CONFIG_WIMAX is not set 503# CONFIG_WIMAX is not set
486# CONFIG_RFKILL is not set 504# CONFIG_RFKILL is not set
487CONFIG_NET_9P=m 505CONFIG_NET_9P=m
@@ -495,6 +513,7 @@ CONFIG_NET_9P=m
495# Generic Driver Options 513# Generic Driver Options
496# 514#
497CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 515CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
516# CONFIG_DEVTMPFS is not set
498CONFIG_STANDALONE=y 517CONFIG_STANDALONE=y
499CONFIG_PREVENT_FIRMWARE_BUILD=y 518CONFIG_PREVENT_FIRMWARE_BUILD=y
500CONFIG_FW_LOADER=m 519CONFIG_FW_LOADER=m
@@ -504,9 +523,9 @@ CONFIG_EXTRA_FIRMWARE=""
504# CONFIG_CONNECTOR is not set 523# CONFIG_CONNECTOR is not set
505CONFIG_MTD=m 524CONFIG_MTD=m
506# CONFIG_MTD_DEBUG is not set 525# CONFIG_MTD_DEBUG is not set
526# CONFIG_MTD_TESTS is not set
507# CONFIG_MTD_CONCAT is not set 527# CONFIG_MTD_CONCAT is not set
508# CONFIG_MTD_PARTITIONS is not set 528# CONFIG_MTD_PARTITIONS is not set
509# CONFIG_MTD_TESTS is not set
510 529
511# 530#
512# User Modules And Translation Layers 531# User Modules And Translation Layers
@@ -820,6 +839,7 @@ CONFIG_8139TOO=y
820# CONFIG_SUNDANCE is not set 839# CONFIG_SUNDANCE is not set
821# CONFIG_TLAN is not set 840# CONFIG_TLAN is not set
822# CONFIG_KS8842 is not set 841# CONFIG_KS8842 is not set
842# CONFIG_KS8851_MLL is not set
823# CONFIG_VIA_RHINE is not set 843# CONFIG_VIA_RHINE is not set
824# CONFIG_SC92031 is not set 844# CONFIG_SC92031 is not set
825# CONFIG_ATL2 is not set 845# CONFIG_ATL2 is not set
@@ -867,10 +887,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
867# CONFIG_SFC is not set 887# CONFIG_SFC is not set
868# CONFIG_BE2NET is not set 888# CONFIG_BE2NET is not set
869# CONFIG_TR is not set 889# CONFIG_TR is not set
870 890CONFIG_WLAN=y
871#
872# Wireless LAN
873#
874# CONFIG_WLAN_PRE80211 is not set 891# CONFIG_WLAN_PRE80211 is not set
875# CONFIG_WLAN_80211 is not set 892# CONFIG_WLAN_80211 is not set
876 893
@@ -886,6 +903,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
886# CONFIG_USB_PEGASUS is not set 903# CONFIG_USB_PEGASUS is not set
887# CONFIG_USB_RTL8150 is not set 904# CONFIG_USB_RTL8150 is not set
888# CONFIG_USB_USBNET is not set 905# CONFIG_USB_USBNET is not set
906# CONFIG_USB_CDC_PHONET is not set
889# CONFIG_WAN is not set 907# CONFIG_WAN is not set
890# CONFIG_FDDI is not set 908# CONFIG_FDDI is not set
891# CONFIG_HIPPI is not set 909# CONFIG_HIPPI is not set
@@ -933,12 +951,16 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
933# Input Device Drivers 951# Input Device Drivers
934# 952#
935CONFIG_INPUT_KEYBOARD=y 953CONFIG_INPUT_KEYBOARD=y
954# CONFIG_KEYBOARD_ADP5588 is not set
936CONFIG_KEYBOARD_ATKBD=y 955CONFIG_KEYBOARD_ATKBD=y
937# CONFIG_KEYBOARD_SUNKBD is not set 956# CONFIG_QT2160 is not set
938# CONFIG_KEYBOARD_LKKBD is not set 957# CONFIG_KEYBOARD_LKKBD is not set
939# CONFIG_KEYBOARD_XTKBD is not set 958# CONFIG_KEYBOARD_MAX7359 is not set
940# CONFIG_KEYBOARD_NEWTON is not set 959# CONFIG_KEYBOARD_NEWTON is not set
960# CONFIG_KEYBOARD_OPENCORES is not set
941# CONFIG_KEYBOARD_STOWAWAY is not set 961# CONFIG_KEYBOARD_STOWAWAY is not set
962# CONFIG_KEYBOARD_SUNKBD is not set
963# CONFIG_KEYBOARD_XTKBD is not set
942CONFIG_INPUT_MOUSE=y 964CONFIG_INPUT_MOUSE=y
943CONFIG_MOUSE_PS2=y 965CONFIG_MOUSE_PS2=y
944CONFIG_MOUSE_PS2_ALPS=y 966CONFIG_MOUSE_PS2_ALPS=y
@@ -946,6 +968,7 @@ CONFIG_MOUSE_PS2_LOGIPS2PP=y
946CONFIG_MOUSE_PS2_SYNAPTICS=y 968CONFIG_MOUSE_PS2_SYNAPTICS=y
947CONFIG_MOUSE_PS2_TRACKPOINT=y 969CONFIG_MOUSE_PS2_TRACKPOINT=y
948# CONFIG_MOUSE_PS2_ELANTECH is not set 970# CONFIG_MOUSE_PS2_ELANTECH is not set
971# CONFIG_MOUSE_PS2_SENTELIC is not set
949# CONFIG_MOUSE_PS2_TOUCHKIT is not set 972# CONFIG_MOUSE_PS2_TOUCHKIT is not set
950CONFIG_MOUSE_SERIAL=y 973CONFIG_MOUSE_SERIAL=y
951# CONFIG_MOUSE_APPLETOUCH is not set 974# CONFIG_MOUSE_APPLETOUCH is not set
@@ -1015,6 +1038,7 @@ CONFIG_RTC=y
1015CONFIG_DEVPORT=y 1038CONFIG_DEVPORT=y
1016CONFIG_I2C=m 1039CONFIG_I2C=m
1017CONFIG_I2C_BOARDINFO=y 1040CONFIG_I2C_BOARDINFO=y
1041CONFIG_I2C_COMPAT=y
1018CONFIG_I2C_CHARDEV=m 1042CONFIG_I2C_CHARDEV=m
1019CONFIG_I2C_HELPER_AUTO=y 1043CONFIG_I2C_HELPER_AUTO=y
1020 1044
@@ -1070,9 +1094,6 @@ CONFIG_I2C_VIAPRO=m
1070# Miscellaneous I2C Chip support 1094# Miscellaneous I2C Chip support
1071# 1095#
1072# CONFIG_DS1682 is not set 1096# CONFIG_DS1682 is not set
1073# CONFIG_SENSORS_PCF8574 is not set
1074# CONFIG_PCF8575 is not set
1075# CONFIG_SENSORS_PCA9539 is not set
1076# CONFIG_SENSORS_TSL2550 is not set 1097# CONFIG_SENSORS_TSL2550 is not set
1077# CONFIG_I2C_DEBUG_CORE is not set 1098# CONFIG_I2C_DEBUG_CORE is not set
1078# CONFIG_I2C_DEBUG_ALGO is not set 1099# CONFIG_I2C_DEBUG_ALGO is not set
@@ -1088,7 +1109,6 @@ CONFIG_I2C_VIAPRO=m
1088# CONFIG_POWER_SUPPLY is not set 1109# CONFIG_POWER_SUPPLY is not set
1089# CONFIG_HWMON is not set 1110# CONFIG_HWMON is not set
1090# CONFIG_THERMAL is not set 1111# CONFIG_THERMAL is not set
1091# CONFIG_THERMAL_HWMON is not set
1092# CONFIG_WATCHDOG is not set 1112# CONFIG_WATCHDOG is not set
1093CONFIG_SSB_POSSIBLE=y 1113CONFIG_SSB_POSSIBLE=y
1094 1114
@@ -1105,6 +1125,7 @@ CONFIG_SSB_POSSIBLE=y
1105# CONFIG_HTC_PASIC3 is not set 1125# CONFIG_HTC_PASIC3 is not set
1106# CONFIG_MFD_TMIO is not set 1126# CONFIG_MFD_TMIO is not set
1107# CONFIG_MFD_WM8400 is not set 1127# CONFIG_MFD_WM8400 is not set
1128# CONFIG_MFD_WM831X is not set
1108# CONFIG_MFD_WM8350_I2C is not set 1129# CONFIG_MFD_WM8350_I2C is not set
1109# CONFIG_MFD_PCF50633 is not set 1130# CONFIG_MFD_PCF50633 is not set
1110# CONFIG_AB3100_CORE is not set 1131# CONFIG_AB3100_CORE is not set
@@ -1114,6 +1135,7 @@ CONFIG_SSB_POSSIBLE=y
1114# 1135#
1115# Graphics support 1136# Graphics support
1116# 1137#
1138CONFIG_VGA_ARB=y
1117# CONFIG_DRM is not set 1139# CONFIG_DRM is not set
1118# CONFIG_VGASTATE is not set 1140# CONFIG_VGASTATE is not set
1119CONFIG_VIDEO_OUTPUT_CONTROL=m 1141CONFIG_VIDEO_OUTPUT_CONTROL=m
@@ -1198,6 +1220,7 @@ CONFIG_FONT_8x16=y
1198# CONFIG_LOGO is not set 1220# CONFIG_LOGO is not set
1199CONFIG_SOUND=y 1221CONFIG_SOUND=y
1200CONFIG_SOUND_OSS_CORE=y 1222CONFIG_SOUND_OSS_CORE=y
1223CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1201CONFIG_SND=m 1224CONFIG_SND=m
1202CONFIG_SND_TIMER=m 1225CONFIG_SND_TIMER=m
1203CONFIG_SND_PCM=m 1226CONFIG_SND_PCM=m
@@ -1304,7 +1327,6 @@ CONFIG_SND_USB=y
1304CONFIG_AC97_BUS=m 1327CONFIG_AC97_BUS=m
1305CONFIG_HID_SUPPORT=y 1328CONFIG_HID_SUPPORT=y
1306CONFIG_HID=y 1329CONFIG_HID=y
1307# CONFIG_HID_DEBUG is not set
1308CONFIG_HIDRAW=y 1330CONFIG_HIDRAW=y
1309 1331
1310# 1332#
@@ -1356,6 +1378,7 @@ CONFIG_USB_EHCI_TT_NEWSCHED=y
1356# CONFIG_USB_OXU210HP_HCD is not set 1378# CONFIG_USB_OXU210HP_HCD is not set
1357# CONFIG_USB_ISP116X_HCD is not set 1379# CONFIG_USB_ISP116X_HCD is not set
1358CONFIG_USB_ISP1760_HCD=m 1380CONFIG_USB_ISP1760_HCD=m
1381# CONFIG_USB_ISP1362_HCD is not set
1359CONFIG_USB_OHCI_HCD=y 1382CONFIG_USB_OHCI_HCD=y
1360# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1383# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1361# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1384# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1453,6 +1476,7 @@ CONFIG_UIO_CIF=m
1453# CONFIG_UIO_SMX is not set 1476# CONFIG_UIO_SMX is not set
1454# CONFIG_UIO_AEC is not set 1477# CONFIG_UIO_AEC is not set
1455# CONFIG_UIO_SERCOS3 is not set 1478# CONFIG_UIO_SERCOS3 is not set
1479# CONFIG_UIO_PCI_GENERIC is not set
1456 1480
1457# 1481#
1458# TI VLYNQ 1482# TI VLYNQ
@@ -1469,10 +1493,10 @@ CONFIG_EXT3_FS=y
1469# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 1493# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1470# CONFIG_EXT3_FS_XATTR is not set 1494# CONFIG_EXT3_FS_XATTR is not set
1471CONFIG_EXT4_FS=m 1495CONFIG_EXT4_FS=m
1472CONFIG_EXT4DEV_COMPAT=y
1473CONFIG_EXT4_FS_XATTR=y 1496CONFIG_EXT4_FS_XATTR=y
1474CONFIG_EXT4_FS_POSIX_ACL=y 1497CONFIG_EXT4_FS_POSIX_ACL=y
1475CONFIG_EXT4_FS_SECURITY=y 1498CONFIG_EXT4_FS_SECURITY=y
1499# CONFIG_EXT4_DEBUG is not set
1476CONFIG_FS_XIP=y 1500CONFIG_FS_XIP=y
1477CONFIG_JBD=y 1501CONFIG_JBD=y
1478# CONFIG_JBD_DEBUG is not set 1502# CONFIG_JBD_DEBUG is not set
@@ -1489,6 +1513,7 @@ CONFIG_FS_POSIX_ACL=y
1489# CONFIG_GFS2_FS is not set 1513# CONFIG_GFS2_FS is not set
1490# CONFIG_OCFS2_FS is not set 1514# CONFIG_OCFS2_FS is not set
1491# CONFIG_BTRFS_FS is not set 1515# CONFIG_BTRFS_FS is not set
1516# CONFIG_NILFS2_FS is not set
1492CONFIG_FILE_LOCKING=y 1517CONFIG_FILE_LOCKING=y
1493CONFIG_FSNOTIFY=y 1518CONFIG_FSNOTIFY=y
1494CONFIG_DNOTIFY=y 1519CONFIG_DNOTIFY=y
@@ -1557,7 +1582,6 @@ CONFIG_OMFS_FS=m
1557# CONFIG_ROMFS_FS is not set 1582# CONFIG_ROMFS_FS is not set
1558# CONFIG_SYSV_FS is not set 1583# CONFIG_SYSV_FS is not set
1559# CONFIG_UFS_FS is not set 1584# CONFIG_UFS_FS is not set
1560# CONFIG_NILFS2_FS is not set
1561CONFIG_NETWORK_FILESYSTEMS=y 1585CONFIG_NETWORK_FILESYSTEMS=y
1562CONFIG_NFS_FS=m 1586CONFIG_NFS_FS=m
1563CONFIG_NFS_V3=y 1587CONFIG_NFS_V3=y
@@ -1666,6 +1690,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1666# CONFIG_ENABLE_MUST_CHECK is not set 1690# CONFIG_ENABLE_MUST_CHECK is not set
1667CONFIG_FRAME_WARN=2048 1691CONFIG_FRAME_WARN=2048
1668# CONFIG_MAGIC_SYSRQ is not set 1692# CONFIG_MAGIC_SYSRQ is not set
1693# CONFIG_STRIP_ASM_SYMS is not set
1669# CONFIG_UNUSED_SYMBOLS is not set 1694# CONFIG_UNUSED_SYMBOLS is not set
1670CONFIG_DEBUG_FS=y 1695CONFIG_DEBUG_FS=y
1671# CONFIG_HEADERS_CHECK is not set 1696# CONFIG_HEADERS_CHECK is not set
@@ -1678,13 +1703,14 @@ CONFIG_NOP_TRACER=y
1678CONFIG_RING_BUFFER=y 1703CONFIG_RING_BUFFER=y
1679CONFIG_EVENT_TRACING=y 1704CONFIG_EVENT_TRACING=y
1680CONFIG_CONTEXT_SWITCH_TRACER=y 1705CONFIG_CONTEXT_SWITCH_TRACER=y
1706CONFIG_RING_BUFFER_ALLOW_SWAP=y
1681CONFIG_TRACING=y 1707CONFIG_TRACING=y
1682CONFIG_TRACING_SUPPORT=y 1708CONFIG_TRACING_SUPPORT=y
1683# CONFIG_FTRACE is not set 1709# CONFIG_FTRACE is not set
1684# CONFIG_DYNAMIC_DEBUG is not set 1710# CONFIG_DYNAMIC_DEBUG is not set
1685# CONFIG_SAMPLES is not set 1711# CONFIG_SAMPLES is not set
1686CONFIG_HAVE_ARCH_KGDB=y 1712CONFIG_HAVE_ARCH_KGDB=y
1687CONFIG_CMDLINE="" 1713# CONFIG_CMDLINE_BOOL is not set
1688 1714
1689# 1715#
1690# Security options 1716# Security options
@@ -1742,11 +1768,13 @@ CONFIG_CRYPTO_XTS=m
1742# 1768#
1743CONFIG_CRYPTO_HMAC=y 1769CONFIG_CRYPTO_HMAC=y
1744# CONFIG_CRYPTO_XCBC is not set 1770# CONFIG_CRYPTO_XCBC is not set
1771# CONFIG_CRYPTO_VMAC is not set
1745 1772
1746# 1773#
1747# Digest 1774# Digest
1748# 1775#
1749# CONFIG_CRYPTO_CRC32C is not set 1776# CONFIG_CRYPTO_CRC32C is not set
1777CONFIG_CRYPTO_GHASH=m
1750# CONFIG_CRYPTO_MD4 is not set 1778# CONFIG_CRYPTO_MD4 is not set
1751CONFIG_CRYPTO_MD5=m 1779CONFIG_CRYPTO_MD5=m
1752# CONFIG_CRYPTO_MICHAEL_MIC is not set 1780# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index f14d38ba6034..222d7eca2fe4 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1188,7 +1187,7 @@ CONFIG_DEBUG_MEMORY_INIT=y
1188CONFIG_DYNAMIC_PRINTK_DEBUG=y 1187CONFIG_DYNAMIC_PRINTK_DEBUG=y
1189# CONFIG_SAMPLES is not set 1188# CONFIG_SAMPLES is not set
1190CONFIG_HAVE_ARCH_KGDB=y 1189CONFIG_HAVE_ARCH_KGDB=y
1191CONFIG_CMDLINE="" 1190# CONFIG_CMDLINE_BOOL is not set
1192 1191
1193# 1192#
1194# Security options 1193# Security options
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 1fc73aa7b509..ed84b4cb3c8d 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -940,7 +939,7 @@ CONFIG_ENABLE_MUST_CHECK=y
940# CONFIG_HEADERS_CHECK is not set 939# CONFIG_HEADERS_CHECK is not set
941# CONFIG_DEBUG_KERNEL is not set 940# CONFIG_DEBUG_KERNEL is not set
942CONFIG_CROSSCOMPILE=y 941CONFIG_CROSSCOMPILE=y
943CONFIG_CMDLINE="" 942# CONFIG_CMDLINE_BOOL is not set
944 943
945# 944#
946# Security options 945# Security options
diff --git a/arch/mips/configs/ip28_defconfig b/arch/mips/configs/ip28_defconfig
index 539dccb0345d..dab2e5aaadaf 100644
--- a/arch/mips/configs/ip28_defconfig
+++ b/arch/mips/configs/ip28_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -816,7 +815,7 @@ CONFIG_MAGIC_SYSRQ=y
816# CONFIG_HEADERS_CHECK is not set 815# CONFIG_HEADERS_CHECK is not set
817# CONFIG_DEBUG_KERNEL is not set 816# CONFIG_DEBUG_KERNEL is not set
818# CONFIG_SAMPLES is not set 817# CONFIG_SAMPLES is not set
819CONFIG_CMDLINE="" 818# CONFIG_CMDLINE_BOOL is not set
820 819
821# 820#
822# Security options 821# Security options
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index d934bdefb393..1841c88d3d24 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1126,7 +1125,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
1126# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 1125# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1127# CONFIG_SAMPLES is not set 1126# CONFIG_SAMPLES is not set
1128CONFIG_HAVE_ARCH_KGDB=y 1127CONFIG_HAVE_ARCH_KGDB=y
1129CONFIG_CMDLINE="" 1128# CONFIG_CMDLINE_BOOL is not set
1130 1129
1131# 1130#
1132# Security options 1131# Security options
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index d22df61833a8..14c2ab3b2674 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28CONFIG_MACH_JAZZ=y 27CONFIG_MACH_JAZZ=y
@@ -1374,7 +1373,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1374# CONFIG_DEBUG_KERNEL is not set 1373# CONFIG_DEBUG_KERNEL is not set
1375CONFIG_LOG_BUF_SHIFT=14 1374CONFIG_LOG_BUF_SHIFT=14
1376CONFIG_CROSSCOMPILE=y 1375CONFIG_CROSSCOMPILE=y
1377CONFIG_CMDLINE="" 1376# CONFIG_CMDLINE_BOOL is not set
1378 1377
1379# 1378#
1380# Security options 1379# Security options
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 5380f1f582d9..4d66c44cced8 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -835,7 +834,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
835# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 834# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
836# CONFIG_SAMPLES is not set 835# CONFIG_SAMPLES is not set
837CONFIG_HAVE_ARCH_KGDB=y 836CONFIG_HAVE_ARCH_KGDB=y
838CONFIG_CMDLINE="" 837# CONFIG_CMDLINE_BOOL is not set
839 838
840# 839#
841# Security options 840# Security options
diff --git a/arch/mips/configs/lasat_defconfig b/arch/mips/configs/lasat_defconfig
index 044074db7e55..08d481e3d42a 100644
--- a/arch/mips/configs/lasat_defconfig
+++ b/arch/mips/configs/lasat_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -798,7 +797,7 @@ CONFIG_MAGIC_SYSRQ=y
798# CONFIG_HEADERS_CHECK is not set 797# CONFIG_HEADERS_CHECK is not set
799# CONFIG_DEBUG_KERNEL is not set 798# CONFIG_DEBUG_KERNEL is not set
800CONFIG_CROSSCOMPILE=y 799CONFIG_CROSSCOMPILE=y
801CONFIG_CMDLINE="" 800# CONFIG_CMDLINE_BOOL is not set
802 801
803# 802#
804# Security options 803# Security options
diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig
new file mode 100644
index 000000000000..b71a0a4fb95f
--- /dev/null
+++ b/arch/mips/configs/lemote2f_defconfig
@@ -0,0 +1,1835 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32-rc6
4# Mon Nov 9 23:42:42 2009
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set
15# CONFIG_MIPS_COBALT is not set
16# CONFIG_MACH_DECSTATION is not set
17# CONFIG_MACH_JAZZ is not set
18# CONFIG_LASAT is not set
19CONFIG_MACH_LOONGSON=y
20# CONFIG_MIPS_MALTA is not set
21# CONFIG_MIPS_SIM is not set
22# CONFIG_NEC_MARKEINS is not set
23# CONFIG_MACH_VR41XX is not set
24# CONFIG_NXP_STB220 is not set
25# CONFIG_NXP_STB225 is not set
26# CONFIG_PNX8550_JBS is not set
27# CONFIG_PNX8550_STB810 is not set
28# CONFIG_PMC_MSP is not set
29# CONFIG_PMC_YOSEMITE is not set
30# CONFIG_SGI_IP22 is not set
31# CONFIG_SGI_IP27 is not set
32# CONFIG_SGI_IP28 is not set
33# CONFIG_SGI_IP32 is not set
34# CONFIG_SIBYTE_CRHINE is not set
35# CONFIG_SIBYTE_CARMEL is not set
36# CONFIG_SIBYTE_CRHONE is not set
37# CONFIG_SIBYTE_RHONE is not set
38# CONFIG_SIBYTE_SWARM is not set
39# CONFIG_SIBYTE_LITTLESUR is not set
40# CONFIG_SIBYTE_SENTOSA is not set
41# CONFIG_SIBYTE_BIGSUR is not set
42# CONFIG_SNI_RM is not set
43# CONFIG_MACH_TX39XX is not set
44# CONFIG_MACH_TX49XX is not set
45# CONFIG_MIKROTIK_RB532 is not set
46# CONFIG_WR_PPMC is not set
47# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
48# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
49# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
50CONFIG_ARCH_SPARSEMEM_ENABLE=y
51# CONFIG_LEMOTE_FULOONG2E is not set
52CONFIG_LEMOTE_MACH2F=y
53CONFIG_CS5536=y
54CONFIG_RWSEM_GENERIC_SPINLOCK=y
55# CONFIG_ARCH_HAS_ILOG2_U32 is not set
56# CONFIG_ARCH_HAS_ILOG2_U64 is not set
57CONFIG_ARCH_SUPPORTS_OPROFILE=y
58CONFIG_GENERIC_FIND_NEXT_BIT=y
59CONFIG_GENERIC_HWEIGHT=y
60CONFIG_GENERIC_CALIBRATE_DELAY=y
61CONFIG_GENERIC_CLOCKEVENTS=y
62CONFIG_GENERIC_TIME=y
63CONFIG_GENERIC_CMOS_UPDATE=y
64CONFIG_SCHED_OMIT_FRAME_POINTER=y
65CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
66CONFIG_CEVT_R4K_LIB=y
67CONFIG_CEVT_R4K=y
68CONFIG_CSRC_R4K_LIB=y
69CONFIG_CSRC_R4K=y
70CONFIG_DMA_NONCOHERENT=y
71CONFIG_DMA_NEED_PCI_MAP_STATE=y
72CONFIG_EARLY_PRINTK=y
73CONFIG_SYS_HAS_EARLY_PRINTK=y
74CONFIG_I8259=y
75# CONFIG_NO_IOPORT is not set
76CONFIG_GENERIC_ISA_DMA=y
77CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN=y
78# CONFIG_CPU_BIG_ENDIAN is not set
79CONFIG_CPU_LITTLE_ENDIAN=y
80CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
81CONFIG_IRQ_CPU=y
82CONFIG_BOOT_ELF32=y
83CONFIG_MIPS_L1_CACHE_SHIFT=5
84
85#
86# CPU selection
87#
88# CONFIG_CPU_LOONGSON2E is not set
89CONFIG_CPU_LOONGSON2F=y
90# CONFIG_CPU_MIPS32_R1 is not set
91# CONFIG_CPU_MIPS32_R2 is not set
92# CONFIG_CPU_MIPS64_R1 is not set
93# CONFIG_CPU_MIPS64_R2 is not set
94# CONFIG_CPU_R3000 is not set
95# CONFIG_CPU_TX39XX is not set
96# CONFIG_CPU_VR41XX is not set
97# CONFIG_CPU_R4300 is not set
98# CONFIG_CPU_R4X00 is not set
99# CONFIG_CPU_TX49XX is not set
100# CONFIG_CPU_R5000 is not set
101# CONFIG_CPU_R5432 is not set
102# CONFIG_CPU_R5500 is not set
103# CONFIG_CPU_R6000 is not set
104# CONFIG_CPU_NEVADA is not set
105# CONFIG_CPU_R8000 is not set
106# CONFIG_CPU_R10000 is not set
107# CONFIG_CPU_RM7000 is not set
108# CONFIG_CPU_RM9000 is not set
109# CONFIG_CPU_SB1 is not set
110# CONFIG_CPU_CAVIUM_OCTEON is not set
111CONFIG_SYS_SUPPORTS_ZBOOT=y
112CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y
113CONFIG_CPU_LOONGSON2=y
114CONFIG_SYS_HAS_CPU_LOONGSON2F=y
115CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
116CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
117CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
118CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
119
120#
121# Kernel type
122#
123# CONFIG_32BIT is not set
124CONFIG_64BIT=y
125# CONFIG_PAGE_SIZE_4KB is not set
126# CONFIG_PAGE_SIZE_8KB is not set
127CONFIG_PAGE_SIZE_16KB=y
128# CONFIG_PAGE_SIZE_32KB is not set
129# CONFIG_PAGE_SIZE_64KB is not set
130CONFIG_BOARD_SCACHE=y
131CONFIG_MIPS_MT_DISABLED=y
132# CONFIG_MIPS_MT_SMP is not set
133# CONFIG_MIPS_MT_SMTC is not set
134CONFIG_CPU_HAS_WB=y
135CONFIG_CPU_HAS_SYNC=y
136CONFIG_GENERIC_HARDIRQS=y
137CONFIG_GENERIC_IRQ_PROBE=y
138CONFIG_CPU_SUPPORTS_HIGHMEM=y
139CONFIG_SYS_SUPPORTS_HIGHMEM=y
140CONFIG_ARCH_FLATMEM_ENABLE=y
141CONFIG_ARCH_POPULATES_NODE_MAP=y
142CONFIG_SELECT_MEMORY_MODEL=y
143# CONFIG_FLATMEM_MANUAL is not set
144# CONFIG_DISCONTIGMEM_MANUAL is not set
145CONFIG_SPARSEMEM_MANUAL=y
146CONFIG_SPARSEMEM=y
147CONFIG_HAVE_MEMORY_PRESENT=y
148CONFIG_SPARSEMEM_STATIC=y
149
150#
151# Memory hotplug is currently incompatible with Software Suspend
152#
153CONFIG_PAGEFLAGS_EXTENDED=y
154CONFIG_SPLIT_PTLOCK_CPUS=4
155CONFIG_PHYS_ADDR_T_64BIT=y
156CONFIG_ZONE_DMA_FLAG=0
157CONFIG_VIRT_TO_BUS=y
158CONFIG_HAVE_MLOCK=y
159CONFIG_HAVE_MLOCKED_PAGE_BIT=y
160# CONFIG_KSM is not set
161CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
162CONFIG_TICK_ONESHOT=y
163CONFIG_NO_HZ=y
164CONFIG_HIGH_RES_TIMERS=y
165CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
166# CONFIG_HZ_48 is not set
167# CONFIG_HZ_100 is not set
168# CONFIG_HZ_128 is not set
169CONFIG_HZ_250=y
170# CONFIG_HZ_256 is not set
171# CONFIG_HZ_1000 is not set
172# CONFIG_HZ_1024 is not set
173CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
174CONFIG_HZ=250
175# CONFIG_PREEMPT_NONE is not set
176# CONFIG_PREEMPT_VOLUNTARY is not set
177CONFIG_PREEMPT=y
178# CONFIG_KEXEC is not set
179# CONFIG_SECCOMP is not set
180CONFIG_LOCKDEP_SUPPORT=y
181CONFIG_STACKTRACE_SUPPORT=y
182CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
183CONFIG_CONSTRUCTORS=y
184
185#
186# General setup
187#
188CONFIG_EXPERIMENTAL=y
189CONFIG_BROKEN_ON_SMP=y
190CONFIG_LOCK_KERNEL=y
191CONFIG_INIT_ENV_ARG_LIMIT=32
192CONFIG_LOCALVERSION=""
193# CONFIG_LOCALVERSION_AUTO is not set
194CONFIG_HAVE_KERNEL_GZIP=y
195CONFIG_HAVE_KERNEL_BZIP2=y
196CONFIG_HAVE_KERNEL_LZMA=y
197# CONFIG_KERNEL_GZIP is not set
198# CONFIG_KERNEL_BZIP2 is not set
199CONFIG_KERNEL_LZMA=y
200CONFIG_SWAP=y
201CONFIG_SYSVIPC=y
202CONFIG_SYSVIPC_SYSCTL=y
203# CONFIG_POSIX_MQUEUE is not set
204CONFIG_BSD_PROCESS_ACCT=y
205CONFIG_BSD_PROCESS_ACCT_V3=y
206# CONFIG_TASKSTATS is not set
207CONFIG_AUDIT=y
208
209#
210# RCU Subsystem
211#
212CONFIG_TREE_RCU=y
213# CONFIG_TREE_PREEMPT_RCU is not set
214# CONFIG_RCU_TRACE is not set
215CONFIG_RCU_FANOUT=64
216# CONFIG_RCU_FANOUT_EXACT is not set
217# CONFIG_TREE_RCU_TRACE is not set
218CONFIG_IKCONFIG=y
219CONFIG_IKCONFIG_PROC=y
220CONFIG_LOG_BUF_SHIFT=15
221# CONFIG_GROUP_SCHED is not set
222# CONFIG_CGROUPS is not set
223CONFIG_SYSFS_DEPRECATED=y
224CONFIG_SYSFS_DEPRECATED_V2=y
225# CONFIG_RELAY is not set
226# CONFIG_NAMESPACES is not set
227# CONFIG_BLK_DEV_INITRD is not set
228# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
229CONFIG_SYSCTL=y
230CONFIG_ANON_INODES=y
231CONFIG_EMBEDDED=y
232CONFIG_SYSCTL_SYSCALL=y
233CONFIG_KALLSYMS=y
234# CONFIG_KALLSYMS_EXTRA_PASS is not set
235CONFIG_HOTPLUG=y
236CONFIG_PRINTK=y
237CONFIG_BUG=y
238CONFIG_ELF_CORE=y
239CONFIG_PCSPKR_PLATFORM=y
240CONFIG_BASE_FULL=y
241CONFIG_FUTEX=y
242CONFIG_EPOLL=y
243CONFIG_SIGNALFD=y
244CONFIG_TIMERFD=y
245CONFIG_EVENTFD=y
246CONFIG_SHMEM=y
247CONFIG_AIO=y
248
249#
250# Kernel Performance Events And Counters
251#
252CONFIG_VM_EVENT_COUNTERS=y
253CONFIG_PCI_QUIRKS=y
254CONFIG_SLUB_DEBUG=y
255CONFIG_COMPAT_BRK=y
256# CONFIG_SLAB is not set
257CONFIG_SLUB=y
258# CONFIG_SLOB is not set
259# CONFIG_PROFILING is not set
260CONFIG_HAVE_OPROFILE=y
261CONFIG_HAVE_SYSCALL_WRAPPERS=y
262
263#
264# GCOV-based kernel profiling
265#
266# CONFIG_SLOW_WORK is not set
267CONFIG_HAVE_GENERIC_DMA_COHERENT=y
268CONFIG_SLABINFO=y
269CONFIG_RT_MUTEXES=y
270CONFIG_BASE_SMALL=0
271CONFIG_MODULES=y
272# CONFIG_MODULE_FORCE_LOAD is not set
273CONFIG_MODULE_UNLOAD=y
274# CONFIG_MODULE_FORCE_UNLOAD is not set
275CONFIG_MODVERSIONS=y
276# CONFIG_MODULE_SRCVERSION_ALL is not set
277CONFIG_BLOCK=y
278CONFIG_BLK_DEV_BSG=y
279CONFIG_BLK_DEV_INTEGRITY=y
280CONFIG_BLOCK_COMPAT=y
281
282#
283# IO Schedulers
284#
285CONFIG_IOSCHED_NOOP=y
286CONFIG_IOSCHED_AS=y
287CONFIG_IOSCHED_DEADLINE=y
288CONFIG_IOSCHED_CFQ=y
289# CONFIG_DEFAULT_AS is not set
290# CONFIG_DEFAULT_DEADLINE is not set
291CONFIG_DEFAULT_CFQ=y
292# CONFIG_DEFAULT_NOOP is not set
293CONFIG_DEFAULT_IOSCHED="cfq"
294CONFIG_FREEZER=y
295
296#
297# Bus options (PCI, PCMCIA, EISA, ISA, TC)
298#
299CONFIG_HW_HAS_PCI=y
300CONFIG_PCI=y
301CONFIG_PCI_DOMAINS=y
302# CONFIG_ARCH_SUPPORTS_MSI is not set
303CONFIG_PCI_LEGACY=y
304# CONFIG_PCI_STUB is not set
305# CONFIG_PCI_IOV is not set
306CONFIG_ISA=y
307CONFIG_MMU=y
308# CONFIG_PCCARD is not set
309# CONFIG_HOTPLUG_PCI is not set
310
311#
312# Executable file formats
313#
314CONFIG_BINFMT_ELF=y
315# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
316# CONFIG_HAVE_AOUT is not set
317# CONFIG_BINFMT_MISC is not set
318CONFIG_MIPS32_COMPAT=y
319CONFIG_COMPAT=y
320CONFIG_SYSVIPC_COMPAT=y
321CONFIG_MIPS32_O32=y
322CONFIG_MIPS32_N32=y
323CONFIG_BINFMT_ELF32=y
324
325#
326# Power management options
327#
328CONFIG_ARCH_HIBERNATION_POSSIBLE=y
329CONFIG_ARCH_SUSPEND_POSSIBLE=y
330CONFIG_PM=y
331# CONFIG_PM_DEBUG is not set
332CONFIG_PM_SLEEP=y
333CONFIG_SUSPEND=y
334CONFIG_SUSPEND_FREEZER=y
335CONFIG_HIBERNATION_NVS=y
336CONFIG_HIBERNATION=y
337CONFIG_PM_STD_PARTITION="/dev/hda3"
338# CONFIG_PM_RUNTIME is not set
339CONFIG_NET=y
340CONFIG_COMPAT_NETLINK_MESSAGES=y
341
342#
343# Networking options
344#
345CONFIG_PACKET=y
346CONFIG_PACKET_MMAP=y
347CONFIG_UNIX=y
348CONFIG_XFRM=y
349# CONFIG_XFRM_USER is not set
350# CONFIG_XFRM_SUB_POLICY is not set
351# CONFIG_XFRM_MIGRATE is not set
352# CONFIG_XFRM_STATISTICS is not set
353# CONFIG_NET_KEY is not set
354CONFIG_INET=y
355CONFIG_IP_MULTICAST=y
356CONFIG_IP_ADVANCED_ROUTER=y
357CONFIG_ASK_IP_FIB_HASH=y
358# CONFIG_IP_FIB_TRIE is not set
359CONFIG_IP_FIB_HASH=y
360CONFIG_IP_MULTIPLE_TABLES=y
361CONFIG_IP_ROUTE_MULTIPATH=y
362CONFIG_IP_ROUTE_VERBOSE=y
363# CONFIG_IP_PNP is not set
364# CONFIG_NET_IPIP is not set
365# CONFIG_NET_IPGRE is not set
366CONFIG_IP_MROUTE=y
367CONFIG_IP_PIMSM_V1=y
368CONFIG_IP_PIMSM_V2=y
369# CONFIG_ARPD is not set
370CONFIG_SYN_COOKIES=y
371# CONFIG_INET_AH is not set
372# CONFIG_INET_ESP is not set
373# CONFIG_INET_IPCOMP is not set
374# CONFIG_INET_XFRM_TUNNEL is not set
375CONFIG_INET_TUNNEL=m
376CONFIG_INET_XFRM_MODE_TRANSPORT=m
377CONFIG_INET_XFRM_MODE_TUNNEL=m
378CONFIG_INET_XFRM_MODE_BEET=m
379CONFIG_INET_LRO=y
380CONFIG_INET_DIAG=y
381CONFIG_INET_TCP_DIAG=y
382CONFIG_TCP_CONG_ADVANCED=y
383CONFIG_TCP_CONG_BIC=y
384CONFIG_TCP_CONG_CUBIC=y
385CONFIG_TCP_CONG_WESTWOOD=m
386CONFIG_TCP_CONG_HTCP=m
387# CONFIG_TCP_CONG_HSTCP is not set
388# CONFIG_TCP_CONG_HYBLA is not set
389# CONFIG_TCP_CONG_VEGAS is not set
390# CONFIG_TCP_CONG_SCALABLE is not set
391# CONFIG_TCP_CONG_LP is not set
392# CONFIG_TCP_CONG_VENO is not set
393# CONFIG_TCP_CONG_YEAH is not set
394# CONFIG_TCP_CONG_ILLINOIS is not set
395CONFIG_DEFAULT_BIC=y
396# CONFIG_DEFAULT_CUBIC is not set
397# CONFIG_DEFAULT_HTCP is not set
398# CONFIG_DEFAULT_VEGAS is not set
399# CONFIG_DEFAULT_WESTWOOD is not set
400# CONFIG_DEFAULT_RENO is not set
401CONFIG_DEFAULT_TCP_CONG="bic"
402# CONFIG_TCP_MD5SIG is not set
403CONFIG_IPV6=m
404CONFIG_IPV6_PRIVACY=y
405# CONFIG_IPV6_ROUTER_PREF is not set
406# CONFIG_IPV6_OPTIMISTIC_DAD is not set
407# CONFIG_INET6_AH is not set
408# CONFIG_INET6_ESP is not set
409# CONFIG_INET6_IPCOMP is not set
410# CONFIG_IPV6_MIP6 is not set
411# CONFIG_INET6_XFRM_TUNNEL is not set
412# CONFIG_INET6_TUNNEL is not set
413CONFIG_INET6_XFRM_MODE_TRANSPORT=m
414CONFIG_INET6_XFRM_MODE_TUNNEL=m
415CONFIG_INET6_XFRM_MODE_BEET=m
416# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
417CONFIG_IPV6_SIT=m
418CONFIG_IPV6_NDISC_NODETYPE=y
419# CONFIG_IPV6_TUNNEL is not set
420# CONFIG_IPV6_MULTIPLE_TABLES is not set
421# CONFIG_IPV6_MROUTE is not set
422CONFIG_NETWORK_SECMARK=y
423CONFIG_NETFILTER=y
424# CONFIG_NETFILTER_DEBUG is not set
425CONFIG_NETFILTER_ADVANCED=y
426
427#
428# Core Netfilter Configuration
429#
430# CONFIG_NETFILTER_NETLINK_QUEUE is not set
431# CONFIG_NETFILTER_NETLINK_LOG is not set
432# CONFIG_NF_CONNTRACK is not set
433# CONFIG_NETFILTER_XTABLES is not set
434# CONFIG_IP_VS is not set
435
436#
437# IP: Netfilter Configuration
438#
439# CONFIG_NF_DEFRAG_IPV4 is not set
440# CONFIG_IP_NF_QUEUE is not set
441# CONFIG_IP_NF_IPTABLES is not set
442# CONFIG_IP_NF_ARPTABLES is not set
443
444#
445# IPv6: Netfilter Configuration
446#
447# CONFIG_IP6_NF_QUEUE is not set
448# CONFIG_IP6_NF_IPTABLES is not set
449# CONFIG_IP_DCCP is not set
450# CONFIG_IP_SCTP is not set
451# CONFIG_RDS is not set
452# CONFIG_TIPC is not set
453# CONFIG_ATM is not set
454# CONFIG_BRIDGE is not set
455# CONFIG_NET_DSA is not set
456# CONFIG_VLAN_8021Q is not set
457# CONFIG_DECNET is not set
458# CONFIG_LLC2 is not set
459# CONFIG_IPX is not set
460# CONFIG_ATALK is not set
461# CONFIG_X25 is not set
462# CONFIG_LAPB is not set
463# CONFIG_ECONET is not set
464# CONFIG_WAN_ROUTER is not set
465# CONFIG_PHONET is not set
466# CONFIG_IEEE802154 is not set
467CONFIG_NET_SCHED=y
468
469#
470# Queueing/Scheduling
471#
472# CONFIG_NET_SCH_CBQ is not set
473# CONFIG_NET_SCH_HTB is not set
474# CONFIG_NET_SCH_HFSC is not set
475# CONFIG_NET_SCH_PRIO is not set
476# CONFIG_NET_SCH_MULTIQ is not set
477# CONFIG_NET_SCH_RED is not set
478# CONFIG_NET_SCH_SFQ is not set
479# CONFIG_NET_SCH_TEQL is not set
480# CONFIG_NET_SCH_TBF is not set
481# CONFIG_NET_SCH_GRED is not set
482# CONFIG_NET_SCH_DSMARK is not set
483# CONFIG_NET_SCH_NETEM is not set
484# CONFIG_NET_SCH_DRR is not set
485# CONFIG_NET_SCH_INGRESS is not set
486
487#
488# Classification
489#
490CONFIG_NET_CLS=y
491# CONFIG_NET_CLS_BASIC is not set
492# CONFIG_NET_CLS_TCINDEX is not set
493# CONFIG_NET_CLS_ROUTE4 is not set
494# CONFIG_NET_CLS_FW is not set
495# CONFIG_NET_CLS_U32 is not set
496# CONFIG_NET_CLS_RSVP is not set
497# CONFIG_NET_CLS_RSVP6 is not set
498# CONFIG_NET_CLS_FLOW is not set
499CONFIG_NET_EMATCH=y
500CONFIG_NET_EMATCH_STACK=32
501# CONFIG_NET_EMATCH_CMP is not set
502# CONFIG_NET_EMATCH_NBYTE is not set
503# CONFIG_NET_EMATCH_U32 is not set
504# CONFIG_NET_EMATCH_META is not set
505# CONFIG_NET_EMATCH_TEXT is not set
506CONFIG_NET_CLS_ACT=y
507# CONFIG_NET_ACT_POLICE is not set
508# CONFIG_NET_ACT_GACT is not set
509# CONFIG_NET_ACT_MIRRED is not set
510# CONFIG_NET_ACT_NAT is not set
511# CONFIG_NET_ACT_PEDIT is not set
512# CONFIG_NET_ACT_SIMP is not set
513# CONFIG_NET_ACT_SKBEDIT is not set
514CONFIG_NET_SCH_FIFO=y
515# CONFIG_DCB is not set
516
517#
518# Network testing
519#
520# CONFIG_NET_PKTGEN is not set
521# CONFIG_HAMRADIO is not set
522# CONFIG_CAN is not set
523# CONFIG_IRDA is not set
524# CONFIG_BT is not set
525# CONFIG_AF_RXRPC is not set
526CONFIG_FIB_RULES=y
527CONFIG_WIRELESS=y
528# CONFIG_CFG80211 is not set
529CONFIG_CFG80211_DEFAULT_PS_VALUE=0
530# CONFIG_WIRELESS_OLD_REGULATORY is not set
531CONFIG_WIRELESS_EXT=y
532CONFIG_WIRELESS_EXT_SYSFS=y
533# CONFIG_LIB80211 is not set
534
535#
536# CFG80211 needs to be enabled for MAC80211
537#
538# CONFIG_WIMAX is not set
539CONFIG_RFKILL=m
540# CONFIG_RFKILL_INPUT is not set
541# CONFIG_NET_9P is not set
542
543#
544# Device Drivers
545#
546
547#
548# Generic Driver Options
549#
550CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
551# CONFIG_DEVTMPFS is not set
552CONFIG_STANDALONE=y
553CONFIG_PREVENT_FIRMWARE_BUILD=y
554CONFIG_FW_LOADER=y
555CONFIG_FIRMWARE_IN_KERNEL=y
556CONFIG_EXTRA_FIRMWARE=""
557# CONFIG_SYS_HYPERVISOR is not set
558# CONFIG_CONNECTOR is not set
559# CONFIG_MTD is not set
560# CONFIG_PARPORT is not set
561# CONFIG_PNP is not set
562CONFIG_BLK_DEV=y
563# CONFIG_BLK_CPQ_DA is not set
564# CONFIG_BLK_CPQ_CISS_DA is not set
565# CONFIG_BLK_DEV_DAC960 is not set
566# CONFIG_BLK_DEV_UMEM is not set
567# CONFIG_BLK_DEV_COW_COMMON is not set
568CONFIG_BLK_DEV_LOOP=y
569CONFIG_BLK_DEV_CRYPTOLOOP=y
570# CONFIG_BLK_DEV_NBD is not set
571# CONFIG_BLK_DEV_SX8 is not set
572# CONFIG_BLK_DEV_UB is not set
573CONFIG_BLK_DEV_RAM=y
574CONFIG_BLK_DEV_RAM_COUNT=16
575CONFIG_BLK_DEV_RAM_SIZE=8192
576# CONFIG_BLK_DEV_XIP is not set
577# CONFIG_CDROM_PKTCDVD is not set
578# CONFIG_ATA_OVER_ETH is not set
579# CONFIG_BLK_DEV_HD is not set
580CONFIG_MISC_DEVICES=y
581# CONFIG_PHANTOM is not set
582# CONFIG_SGI_IOC4 is not set
583# CONFIG_TIFM_CORE is not set
584# CONFIG_ENCLOSURE_SERVICES is not set
585# CONFIG_HP_ILO is not set
586# CONFIG_C2PORT is not set
587
588#
589# EEPROM support
590#
591# CONFIG_EEPROM_93CX6 is not set
592# CONFIG_CB710_CORE is not set
593CONFIG_HAVE_IDE=y
594CONFIG_IDE=y
595
596#
597# Please see Documentation/ide/ide.txt for help/info on IDE drives
598#
599CONFIG_IDE_XFER_MODE=y
600CONFIG_IDE_TIMINGS=y
601# CONFIG_BLK_DEV_IDE_SATA is not set
602CONFIG_IDE_GD=y
603CONFIG_IDE_GD_ATA=y
604# CONFIG_IDE_GD_ATAPI is not set
605# CONFIG_BLK_DEV_IDECD is not set
606# CONFIG_BLK_DEV_IDETAPE is not set
607CONFIG_IDE_TASK_IOCTL=y
608CONFIG_IDE_PROC_FS=y
609
610#
611# IDE chipset support/bugfixes
612#
613# CONFIG_IDE_GENERIC is not set
614# CONFIG_BLK_DEV_PLATFORM is not set
615CONFIG_BLK_DEV_IDEDMA_SFF=y
616
617#
618# PCI IDE chipsets support
619#
620CONFIG_BLK_DEV_IDEPCI=y
621# CONFIG_IDEPCI_PCIBUS_ORDER is not set
622# CONFIG_BLK_DEV_OFFBOARD is not set
623CONFIG_BLK_DEV_GENERIC=y
624# CONFIG_BLK_DEV_OPTI621 is not set
625CONFIG_BLK_DEV_IDEDMA_PCI=y
626# CONFIG_BLK_DEV_AEC62XX is not set
627# CONFIG_BLK_DEV_ALI15X3 is not set
628CONFIG_BLK_DEV_AMD74XX=y
629# CONFIG_BLK_DEV_CMD64X is not set
630# CONFIG_BLK_DEV_TRIFLEX is not set
631# CONFIG_BLK_DEV_CS5520 is not set
632# CONFIG_BLK_DEV_CS5530 is not set
633# CONFIG_BLK_DEV_HPT366 is not set
634# CONFIG_BLK_DEV_JMICRON is not set
635# CONFIG_BLK_DEV_SC1200 is not set
636# CONFIG_BLK_DEV_PIIX is not set
637# CONFIG_BLK_DEV_IT8172 is not set
638# CONFIG_BLK_DEV_IT8213 is not set
639# CONFIG_BLK_DEV_IT821X is not set
640# CONFIG_BLK_DEV_NS87415 is not set
641# CONFIG_BLK_DEV_PDC202XX_OLD is not set
642# CONFIG_BLK_DEV_PDC202XX_NEW is not set
643# CONFIG_BLK_DEV_SVWKS is not set
644# CONFIG_BLK_DEV_SIIMAGE is not set
645# CONFIG_BLK_DEV_SLC90E66 is not set
646# CONFIG_BLK_DEV_TRM290 is not set
647# CONFIG_BLK_DEV_VIA82CXXX is not set
648# CONFIG_BLK_DEV_TC86C001 is not set
649
650#
651# Other IDE chipsets support
652#
653
654#
655# Note: most of these also require special kernel boot parameters
656#
657# CONFIG_BLK_DEV_4DRIVES is not set
658# CONFIG_BLK_DEV_ALI14XX is not set
659# CONFIG_BLK_DEV_DTC2278 is not set
660# CONFIG_BLK_DEV_HT6560B is not set
661# CONFIG_BLK_DEV_QD65XX is not set
662# CONFIG_BLK_DEV_UMC8672 is not set
663CONFIG_BLK_DEV_IDEDMA=y
664
665#
666# SCSI device support
667#
668# CONFIG_RAID_ATTRS is not set
669CONFIG_SCSI=m
670CONFIG_SCSI_DMA=y
671# CONFIG_SCSI_TGT is not set
672# CONFIG_SCSI_NETLINK is not set
673CONFIG_SCSI_PROC_FS=y
674
675#
676# SCSI support type (disk, tape, CD-ROM)
677#
678CONFIG_BLK_DEV_SD=m
679# CONFIG_CHR_DEV_ST is not set
680# CONFIG_CHR_DEV_OSST is not set
681# CONFIG_BLK_DEV_SR is not set
682CONFIG_CHR_DEV_SG=m
683# CONFIG_CHR_DEV_SCH is not set
684CONFIG_SCSI_MULTI_LUN=y
685# CONFIG_SCSI_CONSTANTS is not set
686# CONFIG_SCSI_LOGGING is not set
687# CONFIG_SCSI_SCAN_ASYNC is not set
688CONFIG_SCSI_WAIT_SCAN=m
689
690#
691# SCSI Transports
692#
693# CONFIG_SCSI_SPI_ATTRS is not set
694# CONFIG_SCSI_FC_ATTRS is not set
695# CONFIG_SCSI_ISCSI_ATTRS is not set
696# CONFIG_SCSI_SAS_ATTRS is not set
697# CONFIG_SCSI_SAS_LIBSAS is not set
698# CONFIG_SCSI_SRP_ATTRS is not set
699# CONFIG_SCSI_LOWLEVEL is not set
700# CONFIG_SCSI_DH is not set
701# CONFIG_SCSI_OSD_INITIATOR is not set
702# CONFIG_ATA is not set
703# CONFIG_MD is not set
704# CONFIG_FUSION is not set
705
706#
707# IEEE 1394 (FireWire) support
708#
709
710#
711# You can enable one or both FireWire driver stacks.
712#
713
714#
715# See the help texts for more information.
716#
717# CONFIG_FIREWIRE is not set
718# CONFIG_IEEE1394 is not set
719# CONFIG_I2O is not set
720CONFIG_NETDEVICES=y
721# CONFIG_IFB is not set
722# CONFIG_DUMMY is not set
723# CONFIG_BONDING is not set
724# CONFIG_MACVLAN is not set
725# CONFIG_EQUALIZER is not set
726# CONFIG_TUN is not set
727# CONFIG_VETH is not set
728# CONFIG_ARCNET is not set
729# CONFIG_PHYLIB is not set
730CONFIG_NET_ETHERNET=y
731CONFIG_MII=y
732# CONFIG_AX88796 is not set
733# CONFIG_HAPPYMEAL is not set
734# CONFIG_SUNGEM is not set
735# CONFIG_CASSINI is not set
736# CONFIG_NET_VENDOR_3COM is not set
737# CONFIG_NET_VENDOR_SMC is not set
738# CONFIG_SMC91X is not set
739# CONFIG_DM9000 is not set
740# CONFIG_ETHOC is not set
741# CONFIG_NET_VENDOR_RACAL is not set
742# CONFIG_DNET is not set
743# CONFIG_NET_TULIP is not set
744# CONFIG_AT1700 is not set
745# CONFIG_DEPCA is not set
746# CONFIG_HP100 is not set
747# CONFIG_NET_ISA is not set
748# CONFIG_IBM_NEW_EMAC_ZMII is not set
749# CONFIG_IBM_NEW_EMAC_RGMII is not set
750# CONFIG_IBM_NEW_EMAC_TAH is not set
751# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
752# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
753# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
754# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
755CONFIG_NET_PCI=y
756# CONFIG_PCNET32 is not set
757# CONFIG_AMD8111_ETH is not set
758# CONFIG_ADAPTEC_STARFIRE is not set
759# CONFIG_AC3200 is not set
760# CONFIG_APRICOT is not set
761# CONFIG_B44 is not set
762# CONFIG_FORCEDETH is not set
763# CONFIG_CS89x0 is not set
764# CONFIG_TC35815 is not set
765# CONFIG_E100 is not set
766# CONFIG_FEALNX is not set
767# CONFIG_NATSEMI is not set
768# CONFIG_NE2K_PCI is not set
769# CONFIG_8139CP is not set
770CONFIG_8139TOO=y
771# CONFIG_8139TOO_PIO is not set
772CONFIG_8139TOO_TUNE_TWISTER=y
773# CONFIG_8139TOO_8129 is not set
774# CONFIG_8139_OLD_RX_RESET is not set
775# CONFIG_R6040 is not set
776# CONFIG_SIS900 is not set
777# CONFIG_EPIC100 is not set
778# CONFIG_SMSC9420 is not set
779# CONFIG_SUNDANCE is not set
780# CONFIG_TLAN is not set
781# CONFIG_KS8842 is not set
782# CONFIG_KS8851_MLL is not set
783# CONFIG_VIA_RHINE is not set
784# CONFIG_SC92031 is not set
785# CONFIG_ATL2 is not set
786CONFIG_NETDEV_1000=y
787# CONFIG_ACENIC is not set
788# CONFIG_DL2K is not set
789# CONFIG_E1000 is not set
790# CONFIG_E1000E is not set
791# CONFIG_IP1000 is not set
792# CONFIG_IGB is not set
793# CONFIG_IGBVF is not set
794# CONFIG_NS83820 is not set
795# CONFIG_HAMACHI is not set
796# CONFIG_YELLOWFIN is not set
797CONFIG_R8169=y
798# CONFIG_SIS190 is not set
799# CONFIG_SKGE is not set
800# CONFIG_SKY2 is not set
801# CONFIG_VIA_VELOCITY is not set
802# CONFIG_TIGON3 is not set
803# CONFIG_BNX2 is not set
804# CONFIG_CNIC is not set
805# CONFIG_QLA3XXX is not set
806# CONFIG_ATL1 is not set
807# CONFIG_ATL1E is not set
808# CONFIG_ATL1C is not set
809# CONFIG_JME is not set
810# CONFIG_NETDEV_10000 is not set
811# CONFIG_TR is not set
812CONFIG_WLAN=y
813CONFIG_WLAN_PRE80211=y
814# CONFIG_STRIP is not set
815# CONFIG_WAVELAN is not set
816CONFIG_WLAN_80211=y
817# CONFIG_LIBERTAS is not set
818# CONFIG_ATMEL is not set
819# CONFIG_PRISM54 is not set
820# CONFIG_USB_ZD1201 is not set
821# CONFIG_HOSTAP is not set
822
823#
824# Enable WiMAX (Networking options) to see the WiMAX drivers
825#
826
827#
828# USB Network Adapters
829#
830# CONFIG_USB_CATC is not set
831# CONFIG_USB_KAWETH is not set
832# CONFIG_USB_PEGASUS is not set
833# CONFIG_USB_RTL8150 is not set
834# CONFIG_USB_USBNET is not set
835# CONFIG_USB_HSO is not set
836# CONFIG_WAN is not set
837# CONFIG_FDDI is not set
838# CONFIG_HIPPI is not set
839# CONFIG_PPP is not set
840# CONFIG_SLIP is not set
841# CONFIG_NET_FC is not set
842# CONFIG_NETCONSOLE is not set
843# CONFIG_NETPOLL is not set
844# CONFIG_NET_POLL_CONTROLLER is not set
845# CONFIG_ISDN is not set
846# CONFIG_PHONE is not set
847
848#
849# Input device support
850#
851CONFIG_INPUT=y
852# CONFIG_INPUT_FF_MEMLESS is not set
853# CONFIG_INPUT_POLLDEV is not set
854
855#
856# Userland interfaces
857#
858CONFIG_INPUT_MOUSEDEV=y
859CONFIG_INPUT_MOUSEDEV_PSAUX=y
860CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
861CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
862# CONFIG_INPUT_JOYDEV is not set
863CONFIG_INPUT_EVDEV=y
864# CONFIG_INPUT_EVBUG is not set
865
866#
867# Input Device Drivers
868#
869CONFIG_INPUT_KEYBOARD=y
870CONFIG_KEYBOARD_ATKBD=y
871# CONFIG_KEYBOARD_LKKBD is not set
872# CONFIG_KEYBOARD_NEWTON is not set
873# CONFIG_KEYBOARD_OPENCORES is not set
874# CONFIG_KEYBOARD_STOWAWAY is not set
875# CONFIG_KEYBOARD_SUNKBD is not set
876# CONFIG_KEYBOARD_XTKBD is not set
877CONFIG_INPUT_MOUSE=y
878CONFIG_MOUSE_PS2=y
879# CONFIG_MOUSE_PS2_ALPS is not set
880# CONFIG_MOUSE_PS2_LOGIPS2PP is not set
881CONFIG_MOUSE_PS2_SYNAPTICS=y
882# CONFIG_MOUSE_PS2_TRACKPOINT is not set
883# CONFIG_MOUSE_PS2_ELANTECH is not set
884# CONFIG_MOUSE_PS2_SENTELIC is not set
885# CONFIG_MOUSE_PS2_TOUCHKIT is not set
886# CONFIG_MOUSE_SERIAL is not set
887# CONFIG_MOUSE_APPLETOUCH is not set
888# CONFIG_MOUSE_BCM5974 is not set
889# CONFIG_MOUSE_INPORT is not set
890# CONFIG_MOUSE_LOGIBM is not set
891# CONFIG_MOUSE_PC110PAD is not set
892# CONFIG_MOUSE_VSXXXAA is not set
893# CONFIG_INPUT_JOYSTICK is not set
894# CONFIG_INPUT_TABLET is not set
895# CONFIG_INPUT_TOUCHSCREEN is not set
896# CONFIG_INPUT_MISC is not set
897
898#
899# Hardware I/O ports
900#
901CONFIG_SERIO=y
902CONFIG_SERIO_I8042=y
903# CONFIG_SERIO_SERPORT is not set
904# CONFIG_SERIO_PCIPS2 is not set
905CONFIG_SERIO_LIBPS2=y
906# CONFIG_SERIO_RAW is not set
907# CONFIG_GAMEPORT is not set
908
909#
910# Character devices
911#
912CONFIG_VT=y
913CONFIG_CONSOLE_TRANSLATIONS=y
914CONFIG_VT_CONSOLE=y
915CONFIG_HW_CONSOLE=y
916# CONFIG_VT_HW_CONSOLE_BINDING is not set
917CONFIG_DEVKMEM=y
918CONFIG_SERIAL_NONSTANDARD=y
919# CONFIG_COMPUTONE is not set
920# CONFIG_ROCKETPORT is not set
921# CONFIG_CYCLADES is not set
922# CONFIG_DIGIEPCA is not set
923# CONFIG_MOXA_INTELLIO is not set
924# CONFIG_MOXA_SMARTIO is not set
925# CONFIG_ISI is not set
926# CONFIG_SYNCLINKMP is not set
927# CONFIG_SYNCLINK_GT is not set
928# CONFIG_N_HDLC is not set
929# CONFIG_RISCOM8 is not set
930# CONFIG_SPECIALIX is not set
931# CONFIG_STALDRV is not set
932# CONFIG_NOZOMI is not set
933
934#
935# Serial drivers
936#
937CONFIG_SERIAL_8250=y
938CONFIG_SERIAL_8250_CONSOLE=y
939# CONFIG_SERIAL_8250_PCI is not set
940CONFIG_SERIAL_8250_NR_UARTS=16
941CONFIG_SERIAL_8250_RUNTIME_UARTS=4
942CONFIG_SERIAL_8250_EXTENDED=y
943CONFIG_SERIAL_8250_MANY_PORTS=y
944CONFIG_SERIAL_8250_FOURPORT=y
945# CONFIG_SERIAL_8250_ACCENT is not set
946# CONFIG_SERIAL_8250_BOCA is not set
947# CONFIG_SERIAL_8250_EXAR_ST16C554 is not set
948# CONFIG_SERIAL_8250_HUB6 is not set
949# CONFIG_SERIAL_8250_SHARE_IRQ is not set
950# CONFIG_SERIAL_8250_DETECT_IRQ is not set
951# CONFIG_SERIAL_8250_RSA is not set
952
953#
954# Non-8250 serial port support
955#
956CONFIG_SERIAL_CORE=y
957CONFIG_SERIAL_CORE_CONSOLE=y
958# CONFIG_SERIAL_JSM is not set
959CONFIG_UNIX98_PTYS=y
960# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
961CONFIG_LEGACY_PTYS=y
962CONFIG_LEGACY_PTY_COUNT=16
963# CONFIG_IPMI_HANDLER is not set
964CONFIG_HW_RANDOM=y
965# CONFIG_HW_RANDOM_TIMERIOMEM is not set
966CONFIG_RTC=y
967# CONFIG_DTLK is not set
968# CONFIG_R3964 is not set
969# CONFIG_APPLICOM is not set
970# CONFIG_RAW_DRIVER is not set
971# CONFIG_TCG_TPM is not set
972CONFIG_DEVPORT=y
973# CONFIG_I2C is not set
974# CONFIG_SPI is not set
975
976#
977# PPS support
978#
979# CONFIG_PPS is not set
980# CONFIG_W1 is not set
981# CONFIG_POWER_SUPPLY is not set
982CONFIG_HWMON=y
983# CONFIG_HWMON_VID is not set
984# CONFIG_HWMON_DEBUG_CHIP is not set
985
986#
987# Native drivers
988#
989# CONFIG_SENSORS_I5K_AMB is not set
990# CONFIG_SENSORS_F71805F is not set
991# CONFIG_SENSORS_F71882FG is not set
992# CONFIG_SENSORS_IT87 is not set
993# CONFIG_SENSORS_PC87360 is not set
994# CONFIG_SENSORS_PC87427 is not set
995# CONFIG_SENSORS_SIS5595 is not set
996# CONFIG_SENSORS_SMSC47M1 is not set
997# CONFIG_SENSORS_SMSC47B397 is not set
998# CONFIG_SENSORS_VIA686A is not set
999# CONFIG_SENSORS_VT1211 is not set
1000# CONFIG_SENSORS_VT8231 is not set
1001# CONFIG_SENSORS_W83627HF is not set
1002# CONFIG_SENSORS_W83627EHF is not set
1003CONFIG_THERMAL=y
1004# CONFIG_THERMAL_HWMON is not set
1005# CONFIG_WATCHDOG is not set
1006CONFIG_SSB_POSSIBLE=y
1007
1008#
1009# Sonics Silicon Backplane
1010#
1011# CONFIG_SSB is not set
1012
1013#
1014# Multifunction device drivers
1015#
1016# CONFIG_MFD_CORE is not set
1017# CONFIG_MFD_SM501 is not set
1018# CONFIG_HTC_PASIC3 is not set
1019# CONFIG_MFD_TMIO is not set
1020# CONFIG_REGULATOR is not set
1021CONFIG_MEDIA_SUPPORT=m
1022
1023#
1024# Multimedia core support
1025#
1026CONFIG_VIDEO_DEV=m
1027CONFIG_VIDEO_V4L2_COMMON=m
1028CONFIG_VIDEO_ALLOW_V4L1=y
1029CONFIG_VIDEO_V4L1_COMPAT=y
1030# CONFIG_DVB_CORE is not set
1031CONFIG_VIDEO_MEDIA=m
1032
1033#
1034# Multimedia drivers
1035#
1036# CONFIG_MEDIA_ATTACH is not set
1037CONFIG_VIDEO_V4L2=m
1038CONFIG_VIDEO_V4L1=m
1039CONFIG_VIDEO_CAPTURE_DRIVERS=y
1040# CONFIG_VIDEO_ADV_DEBUG is not set
1041# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
1042CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
1043# CONFIG_VIDEO_VIVI is not set
1044# CONFIG_VIDEO_PMS is not set
1045# CONFIG_VIDEO_CPIA is not set
1046# CONFIG_VIDEO_CPIA2 is not set
1047# CONFIG_VIDEO_STRADIS is not set
1048CONFIG_V4L_USB_DRIVERS=y
1049CONFIG_USB_VIDEO_CLASS=m
1050CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
1051CONFIG_USB_GSPCA=m
1052# CONFIG_USB_M5602 is not set
1053# CONFIG_USB_STV06XX is not set
1054# CONFIG_USB_GL860 is not set
1055# CONFIG_USB_GSPCA_CONEX is not set
1056# CONFIG_USB_GSPCA_ETOMS is not set
1057# CONFIG_USB_GSPCA_FINEPIX is not set
1058# CONFIG_USB_GSPCA_JEILINJ is not set
1059# CONFIG_USB_GSPCA_MARS is not set
1060# CONFIG_USB_GSPCA_MR97310A is not set
1061# CONFIG_USB_GSPCA_OV519 is not set
1062# CONFIG_USB_GSPCA_OV534 is not set
1063# CONFIG_USB_GSPCA_PAC207 is not set
1064# CONFIG_USB_GSPCA_PAC7311 is not set
1065# CONFIG_USB_GSPCA_SN9C20X is not set
1066# CONFIG_USB_GSPCA_SONIXB is not set
1067# CONFIG_USB_GSPCA_SONIXJ is not set
1068# CONFIG_USB_GSPCA_SPCA500 is not set
1069# CONFIG_USB_GSPCA_SPCA501 is not set
1070# CONFIG_USB_GSPCA_SPCA505 is not set
1071# CONFIG_USB_GSPCA_SPCA506 is not set
1072# CONFIG_USB_GSPCA_SPCA508 is not set
1073# CONFIG_USB_GSPCA_SPCA561 is not set
1074# CONFIG_USB_GSPCA_SQ905 is not set
1075# CONFIG_USB_GSPCA_SQ905C is not set
1076# CONFIG_USB_GSPCA_STK014 is not set
1077# CONFIG_USB_GSPCA_SUNPLUS is not set
1078# CONFIG_USB_GSPCA_T613 is not set
1079# CONFIG_USB_GSPCA_TV8532 is not set
1080# CONFIG_USB_GSPCA_VC032X is not set
1081# CONFIG_USB_GSPCA_ZC3XX is not set
1082# CONFIG_VIDEO_HDPVR is not set
1083# CONFIG_USB_VICAM is not set
1084# CONFIG_USB_IBMCAM is not set
1085# CONFIG_USB_KONICAWC is not set
1086# CONFIG_USB_QUICKCAM_MESSENGER is not set
1087# CONFIG_USB_ET61X251 is not set
1088# CONFIG_USB_OV511 is not set
1089# CONFIG_USB_SE401 is not set
1090# CONFIG_USB_SN9C102 is not set
1091# CONFIG_USB_STV680 is not set
1092# CONFIG_USB_ZC0301 is not set
1093# CONFIG_USB_PWC is not set
1094CONFIG_USB_PWC_INPUT_EVDEV=y
1095# CONFIG_USB_ZR364XX is not set
1096# CONFIG_USB_STKWEBCAM is not set
1097# CONFIG_USB_S2255 is not set
1098# CONFIG_RADIO_ADAPTERS is not set
1099# CONFIG_DAB is not set
1100
1101#
1102# Graphics support
1103#
1104CONFIG_VGA_ARB=y
1105# CONFIG_DRM is not set
1106# CONFIG_VGASTATE is not set
1107CONFIG_VIDEO_OUTPUT_CONTROL=y
1108CONFIG_FB=y
1109CONFIG_FIRMWARE_EDID=y
1110# CONFIG_FB_DDC is not set
1111CONFIG_FB_BOOT_VESA_SUPPORT=y
1112CONFIG_FB_CFB_FILLRECT=y
1113CONFIG_FB_CFB_COPYAREA=y
1114CONFIG_FB_CFB_IMAGEBLIT=y
1115# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1116# CONFIG_FB_SYS_FILLRECT is not set
1117# CONFIG_FB_SYS_COPYAREA is not set
1118# CONFIG_FB_SYS_IMAGEBLIT is not set
1119# CONFIG_FB_FOREIGN_ENDIAN is not set
1120# CONFIG_FB_SYS_FOPS is not set
1121# CONFIG_FB_SVGALIB is not set
1122# CONFIG_FB_MACMODES is not set
1123# CONFIG_FB_BACKLIGHT is not set
1124CONFIG_FB_MODE_HELPERS=y
1125CONFIG_FB_TILEBLITTING=y
1126
1127#
1128# Frame buffer hardware drivers
1129#
1130# CONFIG_FB_CIRRUS is not set
1131# CONFIG_FB_PM2 is not set
1132# CONFIG_FB_CYBER2000 is not set
1133# CONFIG_FB_ASILIANT is not set
1134# CONFIG_FB_IMSTT is not set
1135# CONFIG_FB_S1D13XXX is not set
1136# CONFIG_FB_NVIDIA is not set
1137# CONFIG_FB_RIVA is not set
1138# CONFIG_FB_MATROX is not set
1139# CONFIG_FB_RADEON is not set
1140# CONFIG_FB_ATY128 is not set
1141# CONFIG_FB_ATY is not set
1142# CONFIG_FB_S3 is not set
1143# CONFIG_FB_SAVAGE is not set
1144CONFIG_FB_SIS=y
1145CONFIG_FB_SIS_300=y
1146CONFIG_FB_SIS_315=y
1147# CONFIG_FB_VIA is not set
1148# CONFIG_FB_NEOMAGIC is not set
1149# CONFIG_FB_KYRO is not set
1150# CONFIG_FB_3DFX is not set
1151# CONFIG_FB_VOODOO1 is not set
1152# CONFIG_FB_VT8623 is not set
1153# CONFIG_FB_TRIDENT is not set
1154# CONFIG_FB_ARK is not set
1155# CONFIG_FB_PM3 is not set
1156# CONFIG_FB_CARMINE is not set
1157# CONFIG_FB_VIRTUAL is not set
1158# CONFIG_FB_METRONOME is not set
1159# CONFIG_FB_MB862XX is not set
1160# CONFIG_FB_BROADSHEET is not set
1161CONFIG_BACKLIGHT_LCD_SUPPORT=y
1162# CONFIG_LCD_CLASS_DEVICE is not set
1163CONFIG_BACKLIGHT_CLASS_DEVICE=y
1164CONFIG_BACKLIGHT_GENERIC=y
1165
1166#
1167# Display device support
1168#
1169# CONFIG_DISPLAY_SUPPORT is not set
1170
1171#
1172# Console display driver support
1173#
1174# CONFIG_VGA_CONSOLE is not set
1175# CONFIG_MDA_CONSOLE is not set
1176CONFIG_DUMMY_CONSOLE=y
1177CONFIG_FRAMEBUFFER_CONSOLE=y
1178# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1179CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
1180CONFIG_FONTS=y
1181CONFIG_FONT_8x8=y
1182CONFIG_FONT_8x16=y
1183CONFIG_FONT_6x11=y
1184CONFIG_FONT_7x14=y
1185CONFIG_FONT_PEARL_8x8=y
1186CONFIG_FONT_ACORN_8x8=y
1187CONFIG_FONT_MINI_4x6=y
1188CONFIG_FONT_SUN8x16=y
1189CONFIG_FONT_SUN12x22=y
1190CONFIG_FONT_10x18=y
1191CONFIG_LOGO=y
1192# CONFIG_LOGO_LINUX_MONO is not set
1193# CONFIG_LOGO_LINUX_VGA16 is not set
1194CONFIG_LOGO_LINUX_CLUT224=y
1195CONFIG_SOUND=m
1196# CONFIG_SOUND_OSS_CORE is not set
1197CONFIG_SND=m
1198CONFIG_SND_TIMER=m
1199CONFIG_SND_PCM=m
1200# CONFIG_SND_SEQUENCER is not set
1201# CONFIG_SND_MIXER_OSS is not set
1202# CONFIG_SND_PCM_OSS is not set
1203# CONFIG_SND_HRTIMER is not set
1204# CONFIG_SND_RTCTIMER is not set
1205# CONFIG_SND_DYNAMIC_MINORS is not set
1206# CONFIG_SND_SUPPORT_OLD_API is not set
1207# CONFIG_SND_VERBOSE_PROCFS is not set
1208# CONFIG_SND_VERBOSE_PRINTK is not set
1209# CONFIG_SND_DEBUG is not set
1210CONFIG_SND_VMASTER=y
1211# CONFIG_SND_RAWMIDI_SEQ is not set
1212# CONFIG_SND_OPL3_LIB_SEQ is not set
1213# CONFIG_SND_OPL4_LIB_SEQ is not set
1214# CONFIG_SND_SBAWE_SEQ is not set
1215# CONFIG_SND_EMU10K1_SEQ is not set
1216CONFIG_SND_AC97_CODEC=m
1217# CONFIG_SND_DRIVERS is not set
1218CONFIG_SND_PCI=y
1219# CONFIG_SND_AD1889 is not set
1220# CONFIG_SND_ALS300 is not set
1221# CONFIG_SND_ALI5451 is not set
1222# CONFIG_SND_ATIIXP is not set
1223# CONFIG_SND_ATIIXP_MODEM is not set
1224# CONFIG_SND_AU8810 is not set
1225# CONFIG_SND_AU8820 is not set
1226# CONFIG_SND_AU8830 is not set
1227# CONFIG_SND_AW2 is not set
1228# CONFIG_SND_AZT3328 is not set
1229# CONFIG_SND_BT87X is not set
1230# CONFIG_SND_CA0106 is not set
1231# CONFIG_SND_CMIPCI is not set
1232# CONFIG_SND_OXYGEN is not set
1233# CONFIG_SND_CS4281 is not set
1234# CONFIG_SND_CS46XX is not set
1235CONFIG_SND_CS5535AUDIO=m
1236# CONFIG_SND_CTXFI is not set
1237# CONFIG_SND_DARLA20 is not set
1238# CONFIG_SND_GINA20 is not set
1239# CONFIG_SND_LAYLA20 is not set
1240# CONFIG_SND_DARLA24 is not set
1241# CONFIG_SND_GINA24 is not set
1242# CONFIG_SND_LAYLA24 is not set
1243# CONFIG_SND_MONA is not set
1244# CONFIG_SND_MIA is not set
1245# CONFIG_SND_ECHO3G is not set
1246# CONFIG_SND_INDIGO is not set
1247# CONFIG_SND_INDIGOIO is not set
1248# CONFIG_SND_INDIGODJ is not set
1249# CONFIG_SND_INDIGOIOX is not set
1250# CONFIG_SND_INDIGODJX is not set
1251# CONFIG_SND_EMU10K1 is not set
1252# CONFIG_SND_EMU10K1X is not set
1253# CONFIG_SND_ENS1370 is not set
1254# CONFIG_SND_ENS1371 is not set
1255# CONFIG_SND_ES1938 is not set
1256# CONFIG_SND_ES1968 is not set
1257# CONFIG_SND_FM801 is not set
1258# CONFIG_SND_HDA_INTEL is not set
1259# CONFIG_SND_HDSP is not set
1260# CONFIG_SND_HDSPM is not set
1261# CONFIG_SND_HIFIER is not set
1262# CONFIG_SND_ICE1712 is not set
1263# CONFIG_SND_ICE1724 is not set
1264# CONFIG_SND_INTEL8X0 is not set
1265# CONFIG_SND_INTEL8X0M is not set
1266# CONFIG_SND_KORG1212 is not set
1267# CONFIG_SND_LX6464ES is not set
1268# CONFIG_SND_MAESTRO3 is not set
1269# CONFIG_SND_MIXART is not set
1270# CONFIG_SND_NM256 is not set
1271# CONFIG_SND_PCXHR is not set
1272# CONFIG_SND_RIPTIDE is not set
1273# CONFIG_SND_RME32 is not set
1274# CONFIG_SND_RME96 is not set
1275# CONFIG_SND_RME9652 is not set
1276# CONFIG_SND_SONICVIBES is not set
1277# CONFIG_SND_TRIDENT is not set
1278# CONFIG_SND_VIA82XX is not set
1279# CONFIG_SND_VIA82XX_MODEM is not set
1280# CONFIG_SND_VIRTUOSO is not set
1281# CONFIG_SND_VX222 is not set
1282# CONFIG_SND_YMFPCI is not set
1283# CONFIG_SND_MIPS is not set
1284# CONFIG_SND_USB is not set
1285# CONFIG_SND_SOC is not set
1286# CONFIG_SOUND_PRIME is not set
1287CONFIG_AC97_BUS=m
1288CONFIG_HID_SUPPORT=y
1289CONFIG_HID=y
1290CONFIG_HIDRAW=y
1291
1292#
1293# USB Input Devices
1294#
1295CONFIG_USB_HID=y
1296# CONFIG_HID_PID is not set
1297CONFIG_USB_HIDDEV=y
1298
1299#
1300# Special HID drivers
1301#
1302# CONFIG_HID_A4TECH is not set
1303# CONFIG_HID_APPLE is not set
1304# CONFIG_HID_BELKIN is not set
1305# CONFIG_HID_CHERRY is not set
1306# CONFIG_HID_CHICONY is not set
1307# CONFIG_HID_CYPRESS is not set
1308# CONFIG_HID_DRAGONRISE is not set
1309# CONFIG_HID_EZKEY is not set
1310# CONFIG_HID_KYE is not set
1311# CONFIG_HID_GYRATION is not set
1312# CONFIG_HID_TWINHAN is not set
1313# CONFIG_HID_KENSINGTON is not set
1314# CONFIG_HID_LOGITECH is not set
1315# CONFIG_HID_MICROSOFT is not set
1316# CONFIG_HID_MONTEREY is not set
1317# CONFIG_HID_NTRIG is not set
1318# CONFIG_HID_PANTHERLORD is not set
1319# CONFIG_HID_PETALYNX is not set
1320# CONFIG_HID_SAMSUNG is not set
1321# CONFIG_HID_SONY is not set
1322# CONFIG_HID_SUNPLUS is not set
1323# CONFIG_HID_GREENASIA is not set
1324# CONFIG_HID_SMARTJOYPLUS is not set
1325# CONFIG_HID_TOPSEED is not set
1326# CONFIG_HID_THRUSTMASTER is not set
1327# CONFIG_HID_ZEROPLUS is not set
1328CONFIG_USB_SUPPORT=y
1329CONFIG_USB_ARCH_HAS_HCD=y
1330CONFIG_USB_ARCH_HAS_OHCI=y
1331CONFIG_USB_ARCH_HAS_EHCI=y
1332CONFIG_USB=y
1333# CONFIG_USB_DEBUG is not set
1334# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1335
1336#
1337# Miscellaneous USB options
1338#
1339CONFIG_USB_DEVICEFS=y
1340# CONFIG_USB_DEVICE_CLASS is not set
1341CONFIG_USB_DYNAMIC_MINORS=y
1342CONFIG_USB_SUSPEND=y
1343# CONFIG_USB_OTG is not set
1344CONFIG_USB_OTG_WHITELIST=y
1345# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1346CONFIG_USB_MON=y
1347# CONFIG_USB_WUSB is not set
1348# CONFIG_USB_WUSB_CBAF is not set
1349
1350#
1351# USB Host Controller Drivers
1352#
1353# CONFIG_USB_C67X00_HCD is not set
1354# CONFIG_USB_XHCI_HCD is not set
1355CONFIG_USB_EHCI_HCD=y
1356CONFIG_USB_EHCI_ROOT_HUB_TT=y
1357# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1358# CONFIG_USB_OXU210HP_HCD is not set
1359# CONFIG_USB_ISP116X_HCD is not set
1360# CONFIG_USB_ISP1760_HCD is not set
1361# CONFIG_USB_ISP1362_HCD is not set
1362CONFIG_USB_OHCI_HCD=y
1363# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1364# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1365CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1366CONFIG_USB_UHCI_HCD=m
1367# CONFIG_USB_SL811_HCD is not set
1368# CONFIG_USB_R8A66597_HCD is not set
1369# CONFIG_USB_WHCI_HCD is not set
1370# CONFIG_USB_HWA_HCD is not set
1371
1372#
1373# USB Device Class drivers
1374#
1375CONFIG_USB_ACM=m
1376# CONFIG_USB_PRINTER is not set
1377CONFIG_USB_WDM=m
1378# CONFIG_USB_TMC is not set
1379
1380#
1381# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1382#
1383
1384#
1385# also be needed; see USB_STORAGE Help for more info
1386#
1387CONFIG_USB_STORAGE=m
1388# CONFIG_USB_STORAGE_DEBUG is not set
1389CONFIG_USB_STORAGE_DATAFAB=m
1390CONFIG_USB_STORAGE_FREECOM=m
1391CONFIG_USB_STORAGE_ISD200=m
1392CONFIG_USB_STORAGE_USBAT=m
1393CONFIG_USB_STORAGE_SDDR09=m
1394CONFIG_USB_STORAGE_SDDR55=m
1395CONFIG_USB_STORAGE_JUMPSHOT=m
1396CONFIG_USB_STORAGE_ALAUDA=m
1397# CONFIG_USB_STORAGE_ONETOUCH is not set
1398# CONFIG_USB_STORAGE_KARMA is not set
1399# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1400# CONFIG_USB_LIBUSUAL is not set
1401
1402#
1403# USB Imaging devices
1404#
1405# CONFIG_USB_MDC800 is not set
1406# CONFIG_USB_MICROTEK is not set
1407
1408#
1409# USB port drivers
1410#
1411CONFIG_USB_SERIAL=m
1412# CONFIG_USB_EZUSB is not set
1413CONFIG_USB_SERIAL_GENERIC=y
1414# CONFIG_USB_SERIAL_AIRCABLE is not set
1415# CONFIG_USB_SERIAL_ARK3116 is not set
1416# CONFIG_USB_SERIAL_BELKIN is not set
1417# CONFIG_USB_SERIAL_CH341 is not set
1418# CONFIG_USB_SERIAL_WHITEHEAT is not set
1419# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1420# CONFIG_USB_SERIAL_CP210X is not set
1421# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1422# CONFIG_USB_SERIAL_EMPEG is not set
1423# CONFIG_USB_SERIAL_FTDI_SIO is not set
1424# CONFIG_USB_SERIAL_FUNSOFT is not set
1425# CONFIG_USB_SERIAL_VISOR is not set
1426# CONFIG_USB_SERIAL_IPAQ is not set
1427# CONFIG_USB_SERIAL_IR is not set
1428# CONFIG_USB_SERIAL_EDGEPORT is not set
1429# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1430# CONFIG_USB_SERIAL_GARMIN is not set
1431# CONFIG_USB_SERIAL_IPW is not set
1432# CONFIG_USB_SERIAL_IUU is not set
1433# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1434# CONFIG_USB_SERIAL_KEYSPAN is not set
1435# CONFIG_USB_SERIAL_KLSI is not set
1436# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1437# CONFIG_USB_SERIAL_MCT_U232 is not set
1438# CONFIG_USB_SERIAL_MOS7720 is not set
1439# CONFIG_USB_SERIAL_MOS7840 is not set
1440# CONFIG_USB_SERIAL_MOTOROLA is not set
1441# CONFIG_USB_SERIAL_NAVMAN is not set
1442# CONFIG_USB_SERIAL_PL2303 is not set
1443# CONFIG_USB_SERIAL_OTI6858 is not set
1444# CONFIG_USB_SERIAL_QUALCOMM is not set
1445# CONFIG_USB_SERIAL_SPCP8X5 is not set
1446# CONFIG_USB_SERIAL_HP4X is not set
1447# CONFIG_USB_SERIAL_SAFE is not set
1448# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
1449# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
1450# CONFIG_USB_SERIAL_SYMBOL is not set
1451# CONFIG_USB_SERIAL_TI is not set
1452# CONFIG_USB_SERIAL_CYBERJACK is not set
1453# CONFIG_USB_SERIAL_XIRCOM is not set
1454# CONFIG_USB_SERIAL_OPTION is not set
1455# CONFIG_USB_SERIAL_OMNINET is not set
1456# CONFIG_USB_SERIAL_OPTICON is not set
1457# CONFIG_USB_SERIAL_DEBUG is not set
1458
1459#
1460# USB Miscellaneous drivers
1461#
1462# CONFIG_USB_EMI62 is not set
1463# CONFIG_USB_EMI26 is not set
1464# CONFIG_USB_ADUTUX is not set
1465# CONFIG_USB_SEVSEG is not set
1466# CONFIG_USB_RIO500 is not set
1467# CONFIG_USB_LEGOTOWER is not set
1468# CONFIG_USB_LCD is not set
1469# CONFIG_USB_BERRY_CHARGE is not set
1470# CONFIG_USB_LED is not set
1471# CONFIG_USB_CYPRESS_CY7C63 is not set
1472# CONFIG_USB_CYTHERM is not set
1473# CONFIG_USB_IDMOUSE is not set
1474# CONFIG_USB_FTDI_ELAN is not set
1475# CONFIG_USB_APPLEDISPLAY is not set
1476# CONFIG_USB_SISUSBVGA is not set
1477# CONFIG_USB_LD is not set
1478# CONFIG_USB_TRANCEVIBRATOR is not set
1479# CONFIG_USB_IOWARRIOR is not set
1480# CONFIG_USB_TEST is not set
1481# CONFIG_USB_ISIGHTFW is not set
1482# CONFIG_USB_VST is not set
1483# CONFIG_USB_GADGET is not set
1484
1485#
1486# OTG and related infrastructure
1487#
1488# CONFIG_NOP_USB_XCEIV is not set
1489# CONFIG_UWB is not set
1490# CONFIG_MMC is not set
1491# CONFIG_MEMSTICK is not set
1492# CONFIG_NEW_LEDS is not set
1493# CONFIG_ACCESSIBILITY is not set
1494# CONFIG_INFINIBAND is not set
1495# CONFIG_RTC_CLASS is not set
1496# CONFIG_DMADEVICES is not set
1497# CONFIG_AUXDISPLAY is not set
1498# CONFIG_UIO is not set
1499
1500#
1501# TI VLYNQ
1502#
1503CONFIG_STAGING=y
1504# CONFIG_STAGING_EXCLUDE_BUILD is not set
1505# CONFIG_ET131X is not set
1506# CONFIG_USB_IP_COMMON is not set
1507# CONFIG_PRISM2_USB is not set
1508# CONFIG_ECHO is not set
1509# CONFIG_COMEDI is not set
1510# CONFIG_ASUS_OLED is not set
1511# CONFIG_ALTERA_PCIE_CHDMA is not set
1512# CONFIG_RTL8187SE is not set
1513# CONFIG_RTL8192SU is not set
1514# CONFIG_RTL8192E is not set
1515# CONFIG_INPUT_MIMIO is not set
1516# CONFIG_TRANZPORT is not set
1517
1518#
1519# Android
1520#
1521
1522#
1523# Qualcomm MSM Camera And Video
1524#
1525
1526#
1527# Camera Sensor Selection
1528#
1529# CONFIG_INPUT_GPIO is not set
1530# CONFIG_DST is not set
1531# CONFIG_POHMELFS is not set
1532# CONFIG_B3DFG is not set
1533# CONFIG_PLAN9AUTH is not set
1534# CONFIG_LINE6_USB is not set
1535# CONFIG_USB_SERIAL_QUATECH2 is not set
1536# CONFIG_USB_SERIAL_QUATECH_USB2 is not set
1537# CONFIG_VT6655 is not set
1538# CONFIG_VT6656 is not set
1539# CONFIG_FB_UDL is not set
1540# CONFIG_VME_BUS is not set
1541
1542#
1543# RAR Register Driver
1544#
1545# CONFIG_RAR_REGISTER is not set
1546# CONFIG_IIO is not set
1547CONFIG_FB_SM7XX=y
1548CONFIG_FB_SM7XX_ACCEL=y
1549
1550#
1551# File systems
1552#
1553# CONFIG_EXT2_FS is not set
1554CONFIG_EXT3_FS=y
1555# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1556CONFIG_EXT3_FS_XATTR=y
1557CONFIG_EXT3_FS_POSIX_ACL=y
1558CONFIG_EXT3_FS_SECURITY=y
1559# CONFIG_EXT4_FS is not set
1560CONFIG_JBD=y
1561CONFIG_FS_MBCACHE=y
1562# CONFIG_REISERFS_FS is not set
1563# CONFIG_JFS_FS is not set
1564CONFIG_FS_POSIX_ACL=y
1565# CONFIG_XFS_FS is not set
1566# CONFIG_GFS2_FS is not set
1567# CONFIG_OCFS2_FS is not set
1568# CONFIG_BTRFS_FS is not set
1569# CONFIG_NILFS2_FS is not set
1570CONFIG_FILE_LOCKING=y
1571CONFIG_FSNOTIFY=y
1572CONFIG_DNOTIFY=y
1573CONFIG_INOTIFY=y
1574CONFIG_INOTIFY_USER=y
1575CONFIG_QUOTA=y
1576# CONFIG_QUOTA_NETLINK_INTERFACE is not set
1577CONFIG_PRINT_QUOTA_WARNING=y
1578# CONFIG_QFMT_V1 is not set
1579# CONFIG_QFMT_V2 is not set
1580CONFIG_QUOTACTL=y
1581# CONFIG_AUTOFS_FS is not set
1582# CONFIG_AUTOFS4_FS is not set
1583# CONFIG_FUSE_FS is not set
1584
1585#
1586# Caches
1587#
1588# CONFIG_FSCACHE is not set
1589
1590#
1591# CD-ROM/DVD Filesystems
1592#
1593CONFIG_ISO9660_FS=m
1594CONFIG_JOLIET=y
1595CONFIG_ZISOFS=y
1596# CONFIG_UDF_FS is not set
1597
1598#
1599# DOS/FAT/NT Filesystems
1600#
1601CONFIG_FAT_FS=m
1602# CONFIG_MSDOS_FS is not set
1603CONFIG_VFAT_FS=m
1604CONFIG_FAT_DEFAULT_CODEPAGE=437
1605CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1606# CONFIG_NTFS_FS is not set
1607
1608#
1609# Pseudo filesystems
1610#
1611CONFIG_PROC_FS=y
1612CONFIG_PROC_KCORE=y
1613CONFIG_PROC_SYSCTL=y
1614CONFIG_PROC_PAGE_MONITOR=y
1615CONFIG_SYSFS=y
1616CONFIG_TMPFS=y
1617# CONFIG_TMPFS_POSIX_ACL is not set
1618# CONFIG_HUGETLB_PAGE is not set
1619# CONFIG_CONFIGFS_FS is not set
1620# CONFIG_MISC_FILESYSTEMS is not set
1621CONFIG_NETWORK_FILESYSTEMS=y
1622CONFIG_NFS_FS=m
1623CONFIG_NFS_V3=y
1624CONFIG_NFS_V3_ACL=y
1625# CONFIG_NFS_V4 is not set
1626# CONFIG_NFSD is not set
1627CONFIG_LOCKD=m
1628CONFIG_LOCKD_V4=y
1629CONFIG_NFS_ACL_SUPPORT=m
1630CONFIG_NFS_COMMON=y
1631CONFIG_SUNRPC=m
1632# CONFIG_RPCSEC_GSS_KRB5 is not set
1633# CONFIG_RPCSEC_GSS_SPKM3 is not set
1634# CONFIG_SMB_FS is not set
1635# CONFIG_CIFS is not set
1636# CONFIG_NCP_FS is not set
1637# CONFIG_CODA_FS is not set
1638# CONFIG_AFS_FS is not set
1639
1640#
1641# Partition Types
1642#
1643# CONFIG_PARTITION_ADVANCED is not set
1644CONFIG_MSDOS_PARTITION=y
1645CONFIG_NLS=y
1646CONFIG_NLS_DEFAULT="utf-8"
1647# CONFIG_NLS_CODEPAGE_437 is not set
1648# CONFIG_NLS_CODEPAGE_737 is not set
1649# CONFIG_NLS_CODEPAGE_775 is not set
1650# CONFIG_NLS_CODEPAGE_850 is not set
1651# CONFIG_NLS_CODEPAGE_852 is not set
1652# CONFIG_NLS_CODEPAGE_855 is not set
1653# CONFIG_NLS_CODEPAGE_857 is not set
1654# CONFIG_NLS_CODEPAGE_860 is not set
1655# CONFIG_NLS_CODEPAGE_861 is not set
1656# CONFIG_NLS_CODEPAGE_862 is not set
1657# CONFIG_NLS_CODEPAGE_863 is not set
1658# CONFIG_NLS_CODEPAGE_864 is not set
1659# CONFIG_NLS_CODEPAGE_865 is not set
1660# CONFIG_NLS_CODEPAGE_866 is not set
1661# CONFIG_NLS_CODEPAGE_869 is not set
1662# CONFIG_NLS_CODEPAGE_936 is not set
1663# CONFIG_NLS_CODEPAGE_950 is not set
1664# CONFIG_NLS_CODEPAGE_932 is not set
1665# CONFIG_NLS_CODEPAGE_949 is not set
1666# CONFIG_NLS_CODEPAGE_874 is not set
1667# CONFIG_NLS_ISO8859_8 is not set
1668# CONFIG_NLS_CODEPAGE_1250 is not set
1669# CONFIG_NLS_CODEPAGE_1251 is not set
1670# CONFIG_NLS_ASCII is not set
1671# CONFIG_NLS_ISO8859_1 is not set
1672# CONFIG_NLS_ISO8859_2 is not set
1673# CONFIG_NLS_ISO8859_3 is not set
1674# CONFIG_NLS_ISO8859_4 is not set
1675# CONFIG_NLS_ISO8859_5 is not set
1676# CONFIG_NLS_ISO8859_6 is not set
1677# CONFIG_NLS_ISO8859_7 is not set
1678# CONFIG_NLS_ISO8859_9 is not set
1679# CONFIG_NLS_ISO8859_13 is not set
1680# CONFIG_NLS_ISO8859_14 is not set
1681# CONFIG_NLS_ISO8859_15 is not set
1682# CONFIG_NLS_KOI8_R is not set
1683# CONFIG_NLS_KOI8_U is not set
1684# CONFIG_NLS_UTF8 is not set
1685# CONFIG_DLM is not set
1686
1687#
1688# Kernel hacking
1689#
1690CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1691CONFIG_PRINTK_TIME=y
1692CONFIG_ENABLE_WARN_DEPRECATED=y
1693CONFIG_ENABLE_MUST_CHECK=y
1694CONFIG_FRAME_WARN=1024
1695# CONFIG_MAGIC_SYSRQ is not set
1696CONFIG_STRIP_ASM_SYMS=y
1697# CONFIG_UNUSED_SYMBOLS is not set
1698# CONFIG_DEBUG_FS is not set
1699# CONFIG_HEADERS_CHECK is not set
1700# CONFIG_DEBUG_KERNEL is not set
1701# CONFIG_SLUB_DEBUG_ON is not set
1702# CONFIG_SLUB_STATS is not set
1703# CONFIG_DEBUG_MEMORY_INIT is not set
1704# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1705CONFIG_SYSCTL_SYSCALL_CHECK=y
1706CONFIG_TRACING_SUPPORT=y
1707# CONFIG_FTRACE is not set
1708# CONFIG_SAMPLES is not set
1709CONFIG_HAVE_ARCH_KGDB=y
1710# CONFIG_CMDLINE_BOOL is not set
1711
1712#
1713# Security options
1714#
1715# CONFIG_KEYS is not set
1716# CONFIG_SECURITY is not set
1717# CONFIG_SECURITYFS is not set
1718# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1719CONFIG_CRYPTO=y
1720
1721#
1722# Crypto core or helper
1723#
1724CONFIG_CRYPTO_ALGAPI=y
1725CONFIG_CRYPTO_ALGAPI2=y
1726CONFIG_CRYPTO_AEAD2=y
1727CONFIG_CRYPTO_BLKCIPHER=y
1728CONFIG_CRYPTO_BLKCIPHER2=y
1729CONFIG_CRYPTO_HASH2=y
1730CONFIG_CRYPTO_RNG2=y
1731CONFIG_CRYPTO_PCOMP=y
1732CONFIG_CRYPTO_MANAGER=y
1733CONFIG_CRYPTO_MANAGER2=y
1734# CONFIG_CRYPTO_GF128MUL is not set
1735# CONFIG_CRYPTO_NULL is not set
1736CONFIG_CRYPTO_WORKQUEUE=y
1737# CONFIG_CRYPTO_CRYPTD is not set
1738# CONFIG_CRYPTO_AUTHENC is not set
1739# CONFIG_CRYPTO_TEST is not set
1740
1741#
1742# Authenticated Encryption with Associated Data
1743#
1744# CONFIG_CRYPTO_CCM is not set
1745# CONFIG_CRYPTO_GCM is not set
1746# CONFIG_CRYPTO_SEQIV is not set
1747
1748#
1749# Block modes
1750#
1751CONFIG_CRYPTO_CBC=y
1752# CONFIG_CRYPTO_CTR is not set
1753# CONFIG_CRYPTO_CTS is not set
1754# CONFIG_CRYPTO_ECB is not set
1755# CONFIG_CRYPTO_LRW is not set
1756# CONFIG_CRYPTO_PCBC is not set
1757# CONFIG_CRYPTO_XTS is not set
1758
1759#
1760# Hash modes
1761#
1762# CONFIG_CRYPTO_HMAC is not set
1763# CONFIG_CRYPTO_XCBC is not set
1764# CONFIG_CRYPTO_VMAC is not set
1765
1766#
1767# Digest
1768#
1769# CONFIG_CRYPTO_CRC32C is not set
1770# CONFIG_CRYPTO_GHASH is not set
1771# CONFIG_CRYPTO_MD4 is not set
1772# CONFIG_CRYPTO_MD5 is not set
1773# CONFIG_CRYPTO_MICHAEL_MIC is not set
1774# CONFIG_CRYPTO_RMD128 is not set
1775# CONFIG_CRYPTO_RMD160 is not set
1776# CONFIG_CRYPTO_RMD256 is not set
1777# CONFIG_CRYPTO_RMD320 is not set
1778# CONFIG_CRYPTO_SHA1 is not set
1779# CONFIG_CRYPTO_SHA256 is not set
1780# CONFIG_CRYPTO_SHA512 is not set
1781# CONFIG_CRYPTO_TGR192 is not set
1782# CONFIG_CRYPTO_WP512 is not set
1783
1784#
1785# Ciphers
1786#
1787# CONFIG_CRYPTO_AES is not set
1788# CONFIG_CRYPTO_ANUBIS is not set
1789# CONFIG_CRYPTO_ARC4 is not set
1790# CONFIG_CRYPTO_BLOWFISH is not set
1791# CONFIG_CRYPTO_CAMELLIA is not set
1792# CONFIG_CRYPTO_CAST5 is not set
1793# CONFIG_CRYPTO_CAST6 is not set
1794# CONFIG_CRYPTO_DES is not set
1795# CONFIG_CRYPTO_FCRYPT is not set
1796# CONFIG_CRYPTO_KHAZAD is not set
1797# CONFIG_CRYPTO_SALSA20 is not set
1798# CONFIG_CRYPTO_SEED is not set
1799# CONFIG_CRYPTO_SERPENT is not set
1800# CONFIG_CRYPTO_TEA is not set
1801# CONFIG_CRYPTO_TWOFISH is not set
1802
1803#
1804# Compression
1805#
1806# CONFIG_CRYPTO_DEFLATE is not set
1807# CONFIG_CRYPTO_ZLIB is not set
1808# CONFIG_CRYPTO_LZO is not set
1809
1810#
1811# Random Number Generation
1812#
1813# CONFIG_CRYPTO_ANSI_CPRNG is not set
1814CONFIG_CRYPTO_HW=y
1815# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1816# CONFIG_BINARY_PRINTF is not set
1817
1818#
1819# Library routines
1820#
1821CONFIG_BITREVERSE=y
1822CONFIG_GENERIC_FIND_LAST_BIT=y
1823# CONFIG_CRC_CCITT is not set
1824# CONFIG_CRC16 is not set
1825CONFIG_CRC_T10DIF=y
1826# CONFIG_CRC_ITU_T is not set
1827CONFIG_CRC32=y
1828# CONFIG_CRC7 is not set
1829# CONFIG_LIBCRC32C is not set
1830CONFIG_AUDIT_GENERIC=y
1831CONFIG_ZLIB_INFLATE=m
1832CONFIG_HAS_IOMEM=y
1833CONFIG_HAS_IOPORT=y
1834CONFIG_HAS_DMA=y
1835CONFIG_NLATTR=y
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 3f01870b4d65..d3c601206db2 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
10# 10#
11CONFIG_ZONE_DMA=y 11CONFIG_ZONE_DMA=y
12# CONFIG_MACH_ALCHEMY is not set 12# CONFIG_MACH_ALCHEMY is not set
13# CONFIG_BASLER_EXCITE is not set
14# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
15# CONFIG_MIPS_COBALT is not set 14# CONFIG_MIPS_COBALT is not set
16# CONFIG_MACH_DECSTATION is not set 15# CONFIG_MACH_DECSTATION is not set
@@ -1591,7 +1590,7 @@ CONFIG_FRAME_WARN=1024
1591# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 1590# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1592# CONFIG_SAMPLES is not set 1591# CONFIG_SAMPLES is not set
1593CONFIG_HAVE_ARCH_KGDB=y 1592CONFIG_HAVE_ARCH_KGDB=y
1594CONFIG_CMDLINE="" 1593# CONFIG_CMDLINE_BOOL is not set
1595 1594
1596# 1595#
1597# Security options 1596# Security options
diff --git a/arch/mips/configs/markeins_defconfig b/arch/mips/configs/markeins_defconfig
index d001f7e87418..6a325c02b63c 100644
--- a/arch/mips/configs/markeins_defconfig
+++ b/arch/mips/configs/markeins_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -1366,7 +1365,9 @@ CONFIG_ENABLE_MUST_CHECK=y
1366# CONFIG_DEBUG_KERNEL is not set 1365# CONFIG_DEBUG_KERNEL is not set
1367CONFIG_LOG_BUF_SHIFT=14 1366CONFIG_LOG_BUF_SHIFT=14
1368CONFIG_CROSSCOMPILE=y 1367CONFIG_CROSSCOMPILE=y
1368CONFIG_CMDLINE_BOOL=y
1369CONFIG_CMDLINE="console=ttyS0,115200 mem=192m ip=bootp root=/dev/nfs rw" 1369CONFIG_CMDLINE="console=ttyS0,115200 mem=192m ip=bootp root=/dev/nfs rw"
1370# CONFIG_CMDLINE_OVERRIDE is not set
1370 1371
1371# 1372#
1372# Security options 1373# Security options
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 7358454deaa6..f77a34e0f938 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -635,7 +634,9 @@ CONFIG_FORCED_INLINING=y
635# CONFIG_RCU_TORTURE_TEST is not set 634# CONFIG_RCU_TORTURE_TEST is not set
636# CONFIG_FAULT_INJECTION is not set 635# CONFIG_FAULT_INJECTION is not set
637CONFIG_CROSSCOMPILE=y 636CONFIG_CROSSCOMPILE=y
637CONFIG_CMDLINE_BOOL=y
638CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp" 638CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp"
639# CONFIG_CMDLINE_OVERRIDE is not set
639# CONFIG_DEBUG_STACK_USAGE is not set 640# CONFIG_DEBUG_STACK_USAGE is not set
640# CONFIG_RUNTIME_DEBUG is not set 641# CONFIG_RUNTIME_DEBUG is not set
641 642
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index 8c720e51795b..17203056b22b 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -817,7 +816,9 @@ CONFIG_ENABLE_MUST_CHECK=y
817# CONFIG_HEADERS_CHECK is not set 816# CONFIG_HEADERS_CHECK is not set
818# CONFIG_DEBUG_KERNEL is not set 817# CONFIG_DEBUG_KERNEL is not set
819CONFIG_CROSSCOMPILE=y 818CONFIG_CROSSCOMPILE=y
819CONFIG_CMDLINE_BOOL=y
820CONFIG_CMDLINE="mem=32M console=ttyVR0,19200 ide0=0x170,0x376,73" 820CONFIG_CMDLINE="mem=32M console=ttyVR0,19200 ide0=0x170,0x376,73"
821# CONFIG_CMDLINE_OVERRIDE is not set
821 822
822# 823#
823# Security options 824# Security options
diff --git a/arch/mips/configs/msp71xx_defconfig b/arch/mips/configs/msp71xx_defconfig
index ecbc030b7b6c..000d185ddf42 100644
--- a/arch/mips/configs/msp71xx_defconfig
+++ b/arch/mips/configs/msp71xx_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -1412,7 +1411,7 @@ CONFIG_FORCED_INLINING=y
1412# CONFIG_RCU_TORTURE_TEST is not set 1411# CONFIG_RCU_TORTURE_TEST is not set
1413# CONFIG_FAULT_INJECTION is not set 1412# CONFIG_FAULT_INJECTION is not set
1414CONFIG_CROSSCOMPILE=y 1413CONFIG_CROSSCOMPILE=y
1415CONFIG_CMDLINE="" 1414# CONFIG_CMDLINE_BOOL is not set
1416# CONFIG_DEBUG_STACK_USAGE is not set 1415# CONFIG_DEBUG_STACK_USAGE is not set
1417# CONFIG_RUNTIME_DEBUG is not set 1416# CONFIG_RUNTIME_DEBUG is not set
1418# CONFIG_MIPS_UNCACHED is not set 1417# CONFIG_MIPS_UNCACHED is not set
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index 9477f040796d..144b94d9a6ad 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MACH_ALCHEMY=y
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -3018,7 +3017,7 @@ CONFIG_MAGIC_SYSRQ=y
3018# CONFIG_HEADERS_CHECK is not set 3017# CONFIG_HEADERS_CHECK is not set
3019# CONFIG_DEBUG_KERNEL is not set 3018# CONFIG_DEBUG_KERNEL is not set
3020CONFIG_CROSSCOMPILE=y 3019CONFIG_CROSSCOMPILE=y
3021CONFIG_CMDLINE="" 3020# CONFIG_CMDLINE_BOOL is not set
3022 3021
3023# 3022#
3024# Security options 3023# Security options
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index be8091ef0a79..ddf67f639194 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_PB1100=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1083,7 +1082,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1083# CONFIG_DEBUG_KERNEL is not set 1082# CONFIG_DEBUG_KERNEL is not set
1084CONFIG_LOG_BUF_SHIFT=14 1083CONFIG_LOG_BUF_SHIFT=14
1085CONFIG_CROSSCOMPILE=y 1084CONFIG_CROSSCOMPILE=y
1086CONFIG_CMDLINE="" 1085# CONFIG_CMDLINE_BOOL is not set
1087 1086
1088# 1087#
1089# Security options 1088# Security options
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index e74ba794c789..5ec60836b645 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_PB1500=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1200,7 +1199,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1200# CONFIG_DEBUG_KERNEL is not set 1199# CONFIG_DEBUG_KERNEL is not set
1201CONFIG_LOG_BUF_SHIFT=14 1200CONFIG_LOG_BUF_SHIFT=14
1202CONFIG_CROSSCOMPILE=y 1201CONFIG_CROSSCOMPILE=y
1203CONFIG_CMDLINE="" 1202# CONFIG_CMDLINE_BOOL is not set
1204 1203
1205# 1204#
1206# Security options 1205# Security options
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index 1d896fd830da..6647642b5d97 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -23,7 +23,6 @@ CONFIG_MIPS_PB1550=y
23# CONFIG_MIPS_DB1550 is not set 23# CONFIG_MIPS_DB1550 is not set
24# CONFIG_MIPS_DB1200 is not set 24# CONFIG_MIPS_DB1200 is not set
25# CONFIG_MIPS_MIRAGE is not set 25# CONFIG_MIPS_MIRAGE is not set
26# CONFIG_BASLER_EXCITE is not set
27# CONFIG_MIPS_COBALT is not set 26# CONFIG_MIPS_COBALT is not set
28# CONFIG_MACH_DECSTATION is not set 27# CONFIG_MACH_DECSTATION is not set
29# CONFIG_MACH_JAZZ is not set 28# CONFIG_MACH_JAZZ is not set
@@ -1193,7 +1192,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1193# CONFIG_DEBUG_KERNEL is not set 1192# CONFIG_DEBUG_KERNEL is not set
1194CONFIG_LOG_BUF_SHIFT=14 1193CONFIG_LOG_BUF_SHIFT=14
1195CONFIG_CROSSCOMPILE=y 1194CONFIG_CROSSCOMPILE=y
1196CONFIG_CMDLINE="" 1195# CONFIG_CMDLINE_BOOL is not set
1197 1196
1198# 1197#
1199# Security options 1198# Security options
diff --git a/arch/mips/configs/pnx8335-stb225_defconfig b/arch/mips/configs/pnx8335-stb225_defconfig
index fef4d31c2055..848344d588d1 100644
--- a/arch/mips/configs/pnx8335-stb225_defconfig
+++ b/arch/mips/configs/pnx8335-stb225_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1034,7 +1033,7 @@ CONFIG_FRAME_WARN=1024
1034# CONFIG_DEBUG_KERNEL is not set 1033# CONFIG_DEBUG_KERNEL is not set
1035# CONFIG_SAMPLES is not set 1034# CONFIG_SAMPLES is not set
1036# CONFIG_KERNEL_TESTS is not set 1035# CONFIG_KERNEL_TESTS is not set
1037CONFIG_CMDLINE="" 1036# CONFIG_CMDLINE_BOOL is not set
1038 1037
1039# 1038#
1040# Security options 1039# Security options
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index e10c7116c3c2..9d721fdccb30 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -1215,7 +1214,9 @@ CONFIG_DEBUG_MUTEXES=y
1215CONFIG_FORCED_INLINING=y 1214CONFIG_FORCED_INLINING=y
1216# CONFIG_RCU_TORTURE_TEST is not set 1215# CONFIG_RCU_TORTURE_TEST is not set
1217CONFIG_CROSSCOMPILE=y 1216CONFIG_CROSSCOMPILE=y
1217CONFIG_CMDLINE_BOOL=y
1218CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp" 1218CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
1219# CONFIG_CMDLINE_OVERRIDE is not set
1219# CONFIG_DEBUG_STACK_USAGE is not set 1220# CONFIG_DEBUG_STACK_USAGE is not set
1220# CONFIG_RUNTIME_DEBUG is not set 1221# CONFIG_RUNTIME_DEBUG is not set
1221 1222
diff --git a/arch/mips/configs/pnx8550-stb810_defconfig b/arch/mips/configs/pnx8550-stb810_defconfig
index 5ed3c8dfa0a1..ab07ec08c6fa 100644
--- a/arch/mips/configs/pnx8550-stb810_defconfig
+++ b/arch/mips/configs/pnx8550-stb810_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -1205,7 +1204,9 @@ CONFIG_DEBUG_SLAB=y
1205CONFIG_FORCED_INLINING=y 1204CONFIG_FORCED_INLINING=y
1206# CONFIG_RCU_TORTURE_TEST is not set 1205# CONFIG_RCU_TORTURE_TEST is not set
1207CONFIG_CROSSCOMPILE=y 1206CONFIG_CROSSCOMPILE=y
1207CONFIG_CMDLINE_BOOL=y
1208CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp" 1208CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
1209# CONFIG_CMDLINE_OVERRIDE is not set
1209# CONFIG_DEBUG_STACK_USAGE is not set 1210# CONFIG_DEBUG_STACK_USAGE is not set
1210# CONFIG_RUNTIME_DEBUG is not set 1211# CONFIG_RUNTIME_DEBUG is not set
1211 1212
diff --git a/arch/mips/configs/powertv_defconfig b/arch/mips/configs/powertv_defconfig
new file mode 100644
index 000000000000..7291633d81cc
--- /dev/null
+++ b/arch/mips/configs/powertv_defconfig
@@ -0,0 +1,1550 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc5
4# Fri Aug 28 14:49:33 2009
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
19# CONFIG_MIPS_MALTA is not set
20# CONFIG_MIPS_SIM is not set
21# CONFIG_NEC_MARKEINS is not set
22# CONFIG_MACH_VR41XX is not set
23# CONFIG_NXP_STB220 is not set
24# CONFIG_NXP_STB225 is not set
25# CONFIG_PNX8550_JBS is not set
26# CONFIG_PNX8550_STB810 is not set
27# CONFIG_PMC_MSP is not set
28# CONFIG_PMC_YOSEMITE is not set
29CONFIG_POWERTV=y
30# CONFIG_SGI_IP22 is not set
31# CONFIG_SGI_IP27 is not set
32# CONFIG_SGI_IP28 is not set
33# CONFIG_SGI_IP32 is not set
34# CONFIG_SIBYTE_CRHINE is not set
35# CONFIG_SIBYTE_CARMEL is not set
36# CONFIG_SIBYTE_CRHONE is not set
37# CONFIG_SIBYTE_RHONE is not set
38# CONFIG_SIBYTE_SWARM is not set
39# CONFIG_SIBYTE_LITTLESUR is not set
40# CONFIG_SIBYTE_SENTOSA is not set
41# CONFIG_SIBYTE_BIGSUR is not set
42# CONFIG_SNI_RM is not set
43# CONFIG_MACH_TX39XX is not set
44# CONFIG_MACH_TX49XX is not set
45# CONFIG_MIKROTIK_RB532 is not set
46# CONFIG_WR_PPMC is not set
47# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
48# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
49# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
50# CONFIG_MIN_RUNTIME_RESOURCES is not set
51# CONFIG_BOOTLOADER_DRIVER is not set
52CONFIG_BOOTLOADER_FAMILY="R2"
53CONFIG_CSRC_POWERTV=y
54CONFIG_RWSEM_GENERIC_SPINLOCK=y
55# CONFIG_ARCH_HAS_ILOG2_U32 is not set
56# CONFIG_ARCH_HAS_ILOG2_U64 is not set
57CONFIG_ARCH_SUPPORTS_OPROFILE=y
58CONFIG_GENERIC_FIND_NEXT_BIT=y
59CONFIG_GENERIC_HWEIGHT=y
60CONFIG_GENERIC_CALIBRATE_DELAY=y
61CONFIG_GENERIC_CLOCKEVENTS=y
62CONFIG_GENERIC_TIME=y
63CONFIG_GENERIC_CMOS_UPDATE=y
64CONFIG_SCHED_OMIT_FRAME_POINTER=y
65CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
66CONFIG_CEVT_R4K_LIB=y
67CONFIG_CEVT_R4K=y
68CONFIG_DMA_NONCOHERENT=y
69CONFIG_DMA_NEED_PCI_MAP_STATE=y
70# CONFIG_EARLY_PRINTK is not set
71CONFIG_SYS_HAS_EARLY_PRINTK=y
72# CONFIG_NO_IOPORT is not set
73CONFIG_CPU_BIG_ENDIAN=y
74# CONFIG_CPU_LITTLE_ENDIAN is not set
75CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
76CONFIG_BOOT_ELF32=y
77CONFIG_MIPS_L1_CACHE_SHIFT=5
78
79#
80# CPU selection
81#
82# CONFIG_CPU_LOONGSON2 is not set
83# CONFIG_CPU_MIPS32_R1 is not set
84CONFIG_CPU_MIPS32_R2=y
85# CONFIG_CPU_MIPS64_R1 is not set
86# CONFIG_CPU_MIPS64_R2 is not set
87# CONFIG_CPU_R3000 is not set
88# CONFIG_CPU_TX39XX is not set
89# CONFIG_CPU_VR41XX is not set
90# CONFIG_CPU_R4300 is not set
91# CONFIG_CPU_R4X00 is not set
92# CONFIG_CPU_TX49XX is not set
93# CONFIG_CPU_R5000 is not set
94# CONFIG_CPU_R5432 is not set
95# CONFIG_CPU_R5500 is not set
96# CONFIG_CPU_R6000 is not set
97# CONFIG_CPU_NEVADA is not set
98# CONFIG_CPU_R8000 is not set
99# CONFIG_CPU_R10000 is not set
100# CONFIG_CPU_RM7000 is not set
101# CONFIG_CPU_RM9000 is not set
102# CONFIG_CPU_SB1 is not set
103# CONFIG_CPU_CAVIUM_OCTEON is not set
104CONFIG_SYS_HAS_CPU_MIPS32_R2=y
105CONFIG_CPU_MIPS32=y
106CONFIG_CPU_MIPSR2=y
107CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
108CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
109CONFIG_HARDWARE_WATCHPOINTS=y
110
111#
112# Kernel type
113#
114CONFIG_32BIT=y
115# CONFIG_64BIT is not set
116CONFIG_PAGE_SIZE_4KB=y
117# CONFIG_PAGE_SIZE_8KB is not set
118# CONFIG_PAGE_SIZE_16KB is not set
119# CONFIG_PAGE_SIZE_32KB is not set
120# CONFIG_PAGE_SIZE_64KB is not set
121CONFIG_CPU_HAS_PREFETCH=y
122CONFIG_MIPS_MT_DISABLED=y
123# CONFIG_MIPS_MT_SMP is not set
124# CONFIG_MIPS_MT_SMTC is not set
125CONFIG_CPU_HAS_LLSC=y
126CONFIG_CPU_MIPSR2_IRQ_VI=y
127CONFIG_CPU_MIPSR2_IRQ_EI=y
128CONFIG_CPU_HAS_SYNC=y
129CONFIG_GENERIC_HARDIRQS=y
130CONFIG_GENERIC_IRQ_PROBE=y
131# CONFIG_HIGHMEM is not set
132CONFIG_CPU_SUPPORTS_HIGHMEM=y
133CONFIG_SYS_SUPPORTS_HIGHMEM=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_ARCH_POPULATES_NODE_MAP=y
136CONFIG_SELECT_MEMORY_MODEL=y
137CONFIG_FLATMEM_MANUAL=y
138# CONFIG_DISCONTIGMEM_MANUAL is not set
139# CONFIG_SPARSEMEM_MANUAL is not set
140CONFIG_FLATMEM=y
141CONFIG_FLAT_NODE_MEM_MAP=y
142CONFIG_PAGEFLAGS_EXTENDED=y
143CONFIG_SPLIT_PTLOCK_CPUS=4
144# CONFIG_PHYS_ADDR_T_64BIT is not set
145CONFIG_ZONE_DMA_FLAG=0
146CONFIG_VIRT_TO_BUS=y
147CONFIG_HAVE_MLOCK=y
148CONFIG_HAVE_MLOCKED_PAGE_BIT=y
149CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
150CONFIG_TICK_ONESHOT=y
151CONFIG_NO_HZ=y
152CONFIG_HIGH_RES_TIMERS=y
153CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
154# CONFIG_HZ_48 is not set
155# CONFIG_HZ_100 is not set
156# CONFIG_HZ_128 is not set
157# CONFIG_HZ_250 is not set
158# CONFIG_HZ_256 is not set
159CONFIG_HZ_1000=y
160# CONFIG_HZ_1024 is not set
161CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
162CONFIG_HZ=1000
163# CONFIG_PREEMPT_NONE is not set
164# CONFIG_PREEMPT_VOLUNTARY is not set
165CONFIG_PREEMPT=y
166# CONFIG_KEXEC is not set
167# CONFIG_SECCOMP is not set
168CONFIG_LOCKDEP_SUPPORT=y
169CONFIG_STACKTRACE_SUPPORT=y
170CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
171CONFIG_CONSTRUCTORS=y
172
173#
174# General setup
175#
176CONFIG_EXPERIMENTAL=y
177CONFIG_BROKEN_ON_SMP=y
178CONFIG_LOCK_KERNEL=y
179CONFIG_INIT_ENV_ARG_LIMIT=32
180CONFIG_LOCALVERSION=""
181CONFIG_LOCALVERSION_AUTO=y
182# CONFIG_SWAP is not set
183CONFIG_SYSVIPC=y
184CONFIG_SYSVIPC_SYSCTL=y
185# CONFIG_POSIX_MQUEUE is not set
186# CONFIG_BSD_PROCESS_ACCT is not set
187# CONFIG_TASKSTATS is not set
188# CONFIG_AUDIT is not set
189
190#
191# RCU Subsystem
192#
193CONFIG_CLASSIC_RCU=y
194# CONFIG_TREE_RCU is not set
195# CONFIG_PREEMPT_RCU is not set
196# CONFIG_TREE_RCU_TRACE is not set
197# CONFIG_PREEMPT_RCU_TRACE is not set
198# CONFIG_IKCONFIG is not set
199CONFIG_LOG_BUF_SHIFT=16
200CONFIG_GROUP_SCHED=y
201CONFIG_FAIR_GROUP_SCHED=y
202# CONFIG_RT_GROUP_SCHED is not set
203CONFIG_USER_SCHED=y
204# CONFIG_CGROUP_SCHED is not set
205# CONFIG_CGROUPS is not set
206# CONFIG_SYSFS_DEPRECATED_V2 is not set
207CONFIG_RELAY=y
208# CONFIG_NAMESPACES is not set
209CONFIG_BLK_DEV_INITRD=y
210CONFIG_INITRAMFS_SOURCE=""
211# CONFIG_RD_GZIP is not set
212# CONFIG_RD_BZIP2 is not set
213# CONFIG_RD_LZMA is not set
214# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
215CONFIG_SYSCTL=y
216CONFIG_ANON_INODES=y
217CONFIG_EMBEDDED=y
218# CONFIG_SYSCTL_SYSCALL is not set
219CONFIG_KALLSYMS=y
220CONFIG_KALLSYMS_ALL=y
221# CONFIG_KALLSYMS_EXTRA_PASS is not set
222CONFIG_HOTPLUG=y
223CONFIG_PRINTK=y
224CONFIG_BUG=y
225CONFIG_ELF_CORE=y
226# CONFIG_PCSPKR_PLATFORM is not set
227CONFIG_BASE_FULL=y
228CONFIG_FUTEX=y
229# CONFIG_EPOLL is not set
230# CONFIG_SIGNALFD is not set
231CONFIG_TIMERFD=y
232# CONFIG_EVENTFD is not set
233CONFIG_SHMEM=y
234CONFIG_AIO=y
235
236#
237# Performance Counters
238#
239# CONFIG_VM_EVENT_COUNTERS is not set
240CONFIG_PCI_QUIRKS=y
241# CONFIG_SLUB_DEBUG is not set
242# CONFIG_STRIP_ASM_SYMS is not set
243CONFIG_COMPAT_BRK=y
244# CONFIG_SLAB is not set
245CONFIG_SLUB=y
246# CONFIG_SLOB is not set
247# CONFIG_PROFILING is not set
248# CONFIG_MARKERS is not set
249CONFIG_HAVE_OPROFILE=y
250
251#
252# GCOV-based kernel profiling
253#
254# CONFIG_GCOV_KERNEL is not set
255# CONFIG_SLOW_WORK is not set
256# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
257CONFIG_RT_MUTEXES=y
258CONFIG_BASE_SMALL=0
259CONFIG_MODULES=y
260# CONFIG_MODULE_FORCE_LOAD is not set
261CONFIG_MODULE_UNLOAD=y
262# CONFIG_MODULE_FORCE_UNLOAD is not set
263CONFIG_MODVERSIONS=y
264CONFIG_MODULE_SRCVERSION_ALL=y
265CONFIG_BLOCK=y
266CONFIG_LBDAF=y
267# CONFIG_BLK_DEV_BSG is not set
268# CONFIG_BLK_DEV_INTEGRITY is not set
269
270#
271# IO Schedulers
272#
273CONFIG_IOSCHED_NOOP=y
274# CONFIG_IOSCHED_AS is not set
275# CONFIG_IOSCHED_DEADLINE is not set
276# CONFIG_IOSCHED_CFQ is not set
277# CONFIG_DEFAULT_AS is not set
278# CONFIG_DEFAULT_DEADLINE is not set
279# CONFIG_DEFAULT_CFQ is not set
280CONFIG_DEFAULT_NOOP=y
281CONFIG_DEFAULT_IOSCHED="noop"
282# CONFIG_PROBE_INITRD_HEADER is not set
283# CONFIG_FREEZER is not set
284
285#
286# Bus options (PCI, PCMCIA, EISA, ISA, TC)
287#
288CONFIG_HW_HAS_PCI=y
289CONFIG_PCI=y
290CONFIG_PCI_DOMAINS=y
291# CONFIG_ARCH_SUPPORTS_MSI is not set
292# CONFIG_PCI_LEGACY is not set
293# CONFIG_PCI_DEBUG is not set
294# CONFIG_PCI_STUB is not set
295# CONFIG_PCI_IOV is not set
296CONFIG_MMU=y
297# CONFIG_PCCARD is not set
298# CONFIG_HOTPLUG_PCI is not set
299
300#
301# Executable file formats
302#
303CONFIG_BINFMT_ELF=y
304# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
305# CONFIG_HAVE_AOUT is not set
306# CONFIG_BINFMT_MISC is not set
307CONFIG_TRAD_SIGNALS=y
308
309#
310# Power management options
311#
312CONFIG_ARCH_HIBERNATION_POSSIBLE=y
313CONFIG_ARCH_SUSPEND_POSSIBLE=y
314# CONFIG_PM is not set
315CONFIG_NET=y
316
317#
318# Networking options
319#
320CONFIG_PACKET=y
321CONFIG_PACKET_MMAP=y
322CONFIG_UNIX=y
323CONFIG_XFRM=y
324# CONFIG_XFRM_USER is not set
325# CONFIG_XFRM_SUB_POLICY is not set
326# CONFIG_XFRM_MIGRATE is not set
327# CONFIG_XFRM_STATISTICS is not set
328CONFIG_XFRM_IPCOMP=y
329# CONFIG_NET_KEY is not set
330CONFIG_INET=y
331CONFIG_IP_MULTICAST=y
332CONFIG_IP_ADVANCED_ROUTER=y
333CONFIG_ASK_IP_FIB_HASH=y
334# CONFIG_IP_FIB_TRIE is not set
335CONFIG_IP_FIB_HASH=y
336# CONFIG_IP_MULTIPLE_TABLES is not set
337# CONFIG_IP_ROUTE_MULTIPATH is not set
338# CONFIG_IP_ROUTE_VERBOSE is not set
339CONFIG_IP_PNP=y
340# CONFIG_IP_PNP_DHCP is not set
341# CONFIG_IP_PNP_BOOTP is not set
342# CONFIG_IP_PNP_RARP is not set
343# CONFIG_NET_IPIP is not set
344# CONFIG_NET_IPGRE is not set
345# CONFIG_IP_MROUTE is not set
346# CONFIG_ARPD is not set
347CONFIG_SYN_COOKIES=y
348# CONFIG_INET_AH is not set
349# CONFIG_INET_ESP is not set
350# CONFIG_INET_IPCOMP is not set
351# CONFIG_INET_XFRM_TUNNEL is not set
352# CONFIG_INET_TUNNEL is not set
353# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
354# CONFIG_INET_XFRM_MODE_TUNNEL is not set
355# CONFIG_INET_XFRM_MODE_BEET is not set
356# CONFIG_INET_LRO is not set
357# CONFIG_INET_DIAG is not set
358# CONFIG_TCP_CONG_ADVANCED is not set
359CONFIG_TCP_CONG_CUBIC=y
360CONFIG_DEFAULT_TCP_CONG="cubic"
361# CONFIG_TCP_MD5SIG is not set
362CONFIG_IPV6=y
363CONFIG_IPV6_PRIVACY=y
364# CONFIG_IPV6_ROUTER_PREF is not set
365# CONFIG_IPV6_OPTIMISTIC_DAD is not set
366CONFIG_INET6_AH=y
367CONFIG_INET6_ESP=y
368CONFIG_INET6_IPCOMP=y
369# CONFIG_IPV6_MIP6 is not set
370CONFIG_INET6_XFRM_TUNNEL=y
371CONFIG_INET6_TUNNEL=y
372# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
373# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
374# CONFIG_INET6_XFRM_MODE_BEET is not set
375# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
376# CONFIG_IPV6_SIT is not set
377CONFIG_IPV6_TUNNEL=y
378# CONFIG_IPV6_MULTIPLE_TABLES is not set
379# CONFIG_IPV6_MROUTE is not set
380# CONFIG_NETWORK_SECMARK is not set
381CONFIG_NETFILTER=y
382# CONFIG_NETFILTER_DEBUG is not set
383CONFIG_NETFILTER_ADVANCED=y
384# CONFIG_BRIDGE_NETFILTER is not set
385
386#
387# Core Netfilter Configuration
388#
389# CONFIG_NETFILTER_NETLINK_QUEUE is not set
390# CONFIG_NETFILTER_NETLINK_LOG is not set
391# CONFIG_NF_CONNTRACK is not set
392CONFIG_NETFILTER_XTABLES=y
393# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
394# CONFIG_NETFILTER_XT_TARGET_MARK is not set
395# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
396# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
397# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
398# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
399# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
400# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
401# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
402# CONFIG_NETFILTER_XT_MATCH_ESP is not set
403# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
404# CONFIG_NETFILTER_XT_MATCH_HL is not set
405# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
406# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
407# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
408# CONFIG_NETFILTER_XT_MATCH_MAC is not set
409# CONFIG_NETFILTER_XT_MATCH_MARK is not set
410CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
411# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
412# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
413# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
414# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
415# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
416# CONFIG_NETFILTER_XT_MATCH_REALM is not set
417# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
418# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
419# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
420# CONFIG_NETFILTER_XT_MATCH_STRING is not set
421# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
422# CONFIG_NETFILTER_XT_MATCH_TIME is not set
423# CONFIG_NETFILTER_XT_MATCH_U32 is not set
424# CONFIG_IP_VS is not set
425
426#
427# IP: Netfilter Configuration
428#
429# CONFIG_NF_DEFRAG_IPV4 is not set
430# CONFIG_IP_NF_QUEUE is not set
431CONFIG_IP_NF_IPTABLES=y
432# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
433# CONFIG_IP_NF_MATCH_AH is not set
434# CONFIG_IP_NF_MATCH_ECN is not set
435# CONFIG_IP_NF_MATCH_TTL is not set
436CONFIG_IP_NF_FILTER=y
437# CONFIG_IP_NF_TARGET_REJECT is not set
438# CONFIG_IP_NF_TARGET_LOG is not set
439# CONFIG_IP_NF_TARGET_ULOG is not set
440# CONFIG_IP_NF_MANGLE is not set
441# CONFIG_IP_NF_TARGET_TTL is not set
442# CONFIG_IP_NF_RAW is not set
443CONFIG_IP_NF_ARPTABLES=y
444CONFIG_IP_NF_ARPFILTER=y
445# CONFIG_IP_NF_ARP_MANGLE is not set
446
447#
448# IPv6: Netfilter Configuration
449#
450# CONFIG_IP6_NF_QUEUE is not set
451CONFIG_IP6_NF_IPTABLES=y
452# CONFIG_IP6_NF_MATCH_AH is not set
453# CONFIG_IP6_NF_MATCH_EUI64 is not set
454# CONFIG_IP6_NF_MATCH_FRAG is not set
455# CONFIG_IP6_NF_MATCH_OPTS is not set
456# CONFIG_IP6_NF_MATCH_HL is not set
457# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set
458# CONFIG_IP6_NF_MATCH_MH is not set
459# CONFIG_IP6_NF_MATCH_RT is not set
460# CONFIG_IP6_NF_TARGET_HL is not set
461# CONFIG_IP6_NF_TARGET_LOG is not set
462CONFIG_IP6_NF_FILTER=y
463# CONFIG_IP6_NF_TARGET_REJECT is not set
464# CONFIG_IP6_NF_MANGLE is not set
465# CONFIG_IP6_NF_RAW is not set
466# CONFIG_IP_DCCP is not set
467# CONFIG_IP_SCTP is not set
468# CONFIG_TIPC is not set
469# CONFIG_ATM is not set
470CONFIG_STP=y
471CONFIG_BRIDGE=y
472# CONFIG_NET_DSA is not set
473# CONFIG_VLAN_8021Q is not set
474# CONFIG_DECNET is not set
475CONFIG_LLC=y
476# CONFIG_LLC2 is not set
477# CONFIG_IPX is not set
478# CONFIG_ATALK is not set
479# CONFIG_X25 is not set
480# CONFIG_LAPB is not set
481# CONFIG_ECONET is not set
482# CONFIG_WAN_ROUTER is not set
483# CONFIG_PHONET is not set
484# CONFIG_IEEE802154 is not set
485CONFIG_NET_SCHED=y
486
487#
488# Queueing/Scheduling
489#
490# CONFIG_NET_SCH_CBQ is not set
491# CONFIG_NET_SCH_HTB is not set
492# CONFIG_NET_SCH_HFSC is not set
493# CONFIG_NET_SCH_PRIO is not set
494# CONFIG_NET_SCH_MULTIQ is not set
495# CONFIG_NET_SCH_RED is not set
496# CONFIG_NET_SCH_SFQ is not set
497# CONFIG_NET_SCH_TEQL is not set
498CONFIG_NET_SCH_TBF=y
499# CONFIG_NET_SCH_GRED is not set
500# CONFIG_NET_SCH_DSMARK is not set
501# CONFIG_NET_SCH_NETEM is not set
502# CONFIG_NET_SCH_DRR is not set
503
504#
505# Classification
506#
507# CONFIG_NET_CLS_BASIC is not set
508# CONFIG_NET_CLS_TCINDEX is not set
509# CONFIG_NET_CLS_ROUTE4 is not set
510# CONFIG_NET_CLS_FW is not set
511# CONFIG_NET_CLS_U32 is not set
512# CONFIG_NET_CLS_RSVP is not set
513# CONFIG_NET_CLS_RSVP6 is not set
514# CONFIG_NET_CLS_FLOW is not set
515# CONFIG_NET_EMATCH is not set
516# CONFIG_NET_CLS_ACT is not set
517CONFIG_NET_SCH_FIFO=y
518# CONFIG_DCB is not set
519
520#
521# Network testing
522#
523# CONFIG_NET_PKTGEN is not set
524# CONFIG_HAMRADIO is not set
525# CONFIG_CAN is not set
526# CONFIG_IRDA is not set
527# CONFIG_BT is not set
528# CONFIG_AF_RXRPC is not set
529# CONFIG_WIRELESS is not set
530# CONFIG_WIMAX is not set
531# CONFIG_RFKILL is not set
532# CONFIG_NET_9P is not set
533
534#
535# Device Drivers
536#
537
538#
539# Generic Driver Options
540#
541CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
542CONFIG_STANDALONE=y
543CONFIG_PREVENT_FIRMWARE_BUILD=y
544CONFIG_FW_LOADER=y
545CONFIG_FIRMWARE_IN_KERNEL=y
546CONFIG_EXTRA_FIRMWARE=""
547# CONFIG_DEBUG_DRIVER is not set
548# CONFIG_DEBUG_DEVRES is not set
549# CONFIG_SYS_HYPERVISOR is not set
550# CONFIG_CONNECTOR is not set
551CONFIG_MTD=y
552# CONFIG_MTD_DEBUG is not set
553# CONFIG_MTD_CONCAT is not set
554CONFIG_MTD_PARTITIONS=y
555# CONFIG_MTD_TESTS is not set
556# CONFIG_MTD_REDBOOT_PARTS is not set
557CONFIG_MTD_CMDLINE_PARTS=y
558# CONFIG_MTD_AR7_PARTS is not set
559
560#
561# User Modules And Translation Layers
562#
563CONFIG_MTD_CHAR=y
564CONFIG_MTD_BLKDEVS=y
565CONFIG_MTD_BLOCK=y
566# CONFIG_FTL is not set
567# CONFIG_NFTL is not set
568# CONFIG_INFTL is not set
569# CONFIG_RFD_FTL is not set
570# CONFIG_SSFDC is not set
571# CONFIG_MTD_OOPS is not set
572
573#
574# RAM/ROM/Flash chip drivers
575#
576# CONFIG_MTD_CFI is not set
577# CONFIG_MTD_JEDECPROBE is not set
578CONFIG_MTD_MAP_BANK_WIDTH_1=y
579CONFIG_MTD_MAP_BANK_WIDTH_2=y
580CONFIG_MTD_MAP_BANK_WIDTH_4=y
581# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
582# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
583# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
584CONFIG_MTD_CFI_I1=y
585CONFIG_MTD_CFI_I2=y
586# CONFIG_MTD_CFI_I4 is not set
587# CONFIG_MTD_CFI_I8 is not set
588# CONFIG_MTD_RAM is not set
589# CONFIG_MTD_ROM is not set
590# CONFIG_MTD_ABSENT is not set
591
592#
593# Mapping drivers for chip access
594#
595# CONFIG_MTD_COMPLEX_MAPPINGS is not set
596# CONFIG_MTD_INTEL_VR_NOR is not set
597# CONFIG_MTD_PLATRAM is not set
598
599#
600# Self-contained MTD device drivers
601#
602# CONFIG_MTD_PMC551 is not set
603# CONFIG_MTD_SLRAM is not set
604# CONFIG_MTD_PHRAM is not set
605# CONFIG_MTD_MTDRAM is not set
606# CONFIG_MTD_BLOCK2MTD is not set
607
608#
609# Disk-On-Chip Device Drivers
610#
611# CONFIG_MTD_DOC2000 is not set
612# CONFIG_MTD_DOC2001 is not set
613# CONFIG_MTD_DOC2001PLUS is not set
614CONFIG_MTD_NAND=y
615# CONFIG_MTD_NAND_VERIFY_WRITE is not set
616# CONFIG_MTD_NAND_ECC_SMC is not set
617# CONFIG_MTD_NAND_MUSEUM_IDS is not set
618CONFIG_MTD_NAND_IDS=y
619# CONFIG_MTD_NAND_DISKONCHIP is not set
620# CONFIG_MTD_NAND_CAFE is not set
621# CONFIG_MTD_NAND_NANDSIM is not set
622# CONFIG_MTD_NAND_PLATFORM is not set
623# CONFIG_MTD_ALAUDA is not set
624# CONFIG_MTD_ONENAND is not set
625
626#
627# LPDDR flash memory drivers
628#
629# CONFIG_MTD_LPDDR is not set
630
631#
632# UBI - Unsorted block images
633#
634# CONFIG_MTD_UBI is not set
635# CONFIG_PARPORT is not set
636CONFIG_BLK_DEV=y
637# CONFIG_BLK_CPQ_DA is not set
638# CONFIG_BLK_CPQ_CISS_DA is not set
639# CONFIG_BLK_DEV_DAC960 is not set
640# CONFIG_BLK_DEV_UMEM is not set
641# CONFIG_BLK_DEV_COW_COMMON is not set
642CONFIG_BLK_DEV_LOOP=y
643# CONFIG_BLK_DEV_CRYPTOLOOP is not set
644# CONFIG_BLK_DEV_NBD is not set
645# CONFIG_BLK_DEV_SX8 is not set
646# CONFIG_BLK_DEV_UB is not set
647CONFIG_BLK_DEV_RAM=y
648CONFIG_BLK_DEV_RAM_COUNT=16
649CONFIG_BLK_DEV_RAM_SIZE=32768
650# CONFIG_BLK_DEV_XIP is not set
651# CONFIG_CDROM_PKTCDVD is not set
652# CONFIG_ATA_OVER_ETH is not set
653# CONFIG_BLK_DEV_HD is not set
654# CONFIG_MISC_DEVICES is not set
655CONFIG_HAVE_IDE=y
656# CONFIG_IDE is not set
657
658#
659# SCSI device support
660#
661# CONFIG_RAID_ATTRS is not set
662CONFIG_SCSI=y
663CONFIG_SCSI_DMA=y
664# CONFIG_SCSI_TGT is not set
665# CONFIG_SCSI_NETLINK is not set
666# CONFIG_SCSI_PROC_FS is not set
667
668#
669# SCSI support type (disk, tape, CD-ROM)
670#
671CONFIG_BLK_DEV_SD=y
672# CONFIG_CHR_DEV_ST is not set
673# CONFIG_CHR_DEV_OSST is not set
674# CONFIG_BLK_DEV_SR is not set
675# CONFIG_CHR_DEV_SG is not set
676# CONFIG_CHR_DEV_SCH is not set
677# CONFIG_SCSI_MULTI_LUN is not set
678# CONFIG_SCSI_CONSTANTS is not set
679# CONFIG_SCSI_LOGGING is not set
680# CONFIG_SCSI_SCAN_ASYNC is not set
681CONFIG_SCSI_WAIT_SCAN=m
682
683#
684# SCSI Transports
685#
686# CONFIG_SCSI_SPI_ATTRS is not set
687# CONFIG_SCSI_FC_ATTRS is not set
688# CONFIG_SCSI_ISCSI_ATTRS is not set
689# CONFIG_SCSI_SAS_LIBSAS is not set
690# CONFIG_SCSI_SRP_ATTRS is not set
691# CONFIG_SCSI_LOWLEVEL is not set
692# CONFIG_SCSI_DH is not set
693# CONFIG_SCSI_OSD_INITIATOR is not set
694CONFIG_ATA=y
695# CONFIG_ATA_NONSTANDARD is not set
696CONFIG_SATA_PMP=y
697# CONFIG_SATA_AHCI is not set
698# CONFIG_SATA_SIL24 is not set
699CONFIG_ATA_SFF=y
700# CONFIG_SATA_SVW is not set
701# CONFIG_ATA_PIIX is not set
702# CONFIG_SATA_MV is not set
703# CONFIG_SATA_NV is not set
704# CONFIG_PDC_ADMA is not set
705# CONFIG_SATA_QSTOR is not set
706# CONFIG_SATA_PROMISE is not set
707# CONFIG_SATA_SX4 is not set
708# CONFIG_SATA_SIL is not set
709# CONFIG_SATA_SIS is not set
710# CONFIG_SATA_ULI is not set
711# CONFIG_SATA_VIA is not set
712# CONFIG_SATA_VITESSE is not set
713# CONFIG_SATA_INIC162X is not set
714# CONFIG_PATA_ALI is not set
715# CONFIG_PATA_AMD is not set
716# CONFIG_PATA_ARTOP is not set
717# CONFIG_PATA_ATIIXP is not set
718# CONFIG_PATA_CMD640_PCI is not set
719# CONFIG_PATA_CMD64X is not set
720# CONFIG_PATA_CS5520 is not set
721# CONFIG_PATA_CS5530 is not set
722# CONFIG_PATA_CYPRESS is not set
723# CONFIG_PATA_EFAR is not set
724# CONFIG_ATA_GENERIC is not set
725# CONFIG_PATA_HPT366 is not set
726# CONFIG_PATA_HPT37X is not set
727# CONFIG_PATA_HPT3X2N is not set
728# CONFIG_PATA_HPT3X3 is not set
729# CONFIG_PATA_IT821X is not set
730# CONFIG_PATA_IT8213 is not set
731# CONFIG_PATA_JMICRON is not set
732# CONFIG_PATA_TRIFLEX is not set
733# CONFIG_PATA_MARVELL is not set
734# CONFIG_PATA_MPIIX is not set
735# CONFIG_PATA_OLDPIIX is not set
736# CONFIG_PATA_NETCELL is not set
737# CONFIG_PATA_NINJA32 is not set
738# CONFIG_PATA_NS87410 is not set
739# CONFIG_PATA_NS87415 is not set
740# CONFIG_PATA_OPTI is not set
741# CONFIG_PATA_OPTIDMA is not set
742# CONFIG_PATA_PDC_OLD is not set
743# CONFIG_PATA_RADISYS is not set
744# CONFIG_PATA_RZ1000 is not set
745# CONFIG_PATA_SC1200 is not set
746# CONFIG_PATA_SERVERWORKS is not set
747# CONFIG_PATA_PDC2027X is not set
748# CONFIG_PATA_SIL680 is not set
749# CONFIG_PATA_SIS is not set
750# CONFIG_PATA_VIA is not set
751# CONFIG_PATA_WINBOND is not set
752# CONFIG_PATA_PLATFORM is not set
753# CONFIG_PATA_SCH is not set
754# CONFIG_MD is not set
755# CONFIG_FUSION is not set
756
757#
758# IEEE 1394 (FireWire) support
759#
760
761#
762# You can enable one or both FireWire driver stacks.
763#
764
765#
766# See the help texts for more information.
767#
768# CONFIG_FIREWIRE is not set
769# CONFIG_IEEE1394 is not set
770# CONFIG_I2O is not set
771CONFIG_NETDEVICES=y
772# CONFIG_DUMMY is not set
773# CONFIG_BONDING is not set
774# CONFIG_MACVLAN is not set
775# CONFIG_EQUALIZER is not set
776# CONFIG_TUN is not set
777# CONFIG_VETH is not set
778# CONFIG_ARCNET is not set
779# CONFIG_PHYLIB is not set
780CONFIG_NET_ETHERNET=y
781CONFIG_MII=y
782# CONFIG_AX88796 is not set
783# CONFIG_HAPPYMEAL is not set
784# CONFIG_SUNGEM is not set
785# CONFIG_CASSINI is not set
786# CONFIG_NET_VENDOR_3COM is not set
787# CONFIG_SMC91X is not set
788# CONFIG_DM9000 is not set
789# CONFIG_ETHOC is not set
790# CONFIG_DNET is not set
791# CONFIG_NET_TULIP is not set
792# CONFIG_HP100 is not set
793# CONFIG_IBM_NEW_EMAC_ZMII is not set
794# CONFIG_IBM_NEW_EMAC_RGMII is not set
795# CONFIG_IBM_NEW_EMAC_TAH is not set
796# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
797# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
798# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
799# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
800# CONFIG_NET_PCI is not set
801# CONFIG_B44 is not set
802# CONFIG_KS8842 is not set
803# CONFIG_ATL2 is not set
804CONFIG_NETDEV_1000=y
805# CONFIG_ACENIC is not set
806# CONFIG_DL2K is not set
807# CONFIG_E1000 is not set
808# CONFIG_E1000E is not set
809# CONFIG_IP1000 is not set
810# CONFIG_IGB is not set
811# CONFIG_IGBVF is not set
812# CONFIG_NS83820 is not set
813# CONFIG_HAMACHI is not set
814# CONFIG_YELLOWFIN is not set
815# CONFIG_R8169 is not set
816# CONFIG_SIS190 is not set
817# CONFIG_SKGE is not set
818# CONFIG_SKY2 is not set
819# CONFIG_VIA_VELOCITY is not set
820# CONFIG_TIGON3 is not set
821# CONFIG_BNX2 is not set
822# CONFIG_CNIC is not set
823# CONFIG_QLA3XXX is not set
824# CONFIG_ATL1 is not set
825# CONFIG_ATL1E is not set
826# CONFIG_ATL1C is not set
827# CONFIG_JME is not set
828CONFIG_NETDEV_10000=y
829# CONFIG_CHELSIO_T1 is not set
830CONFIG_CHELSIO_T3_DEPENDS=y
831# CONFIG_CHELSIO_T3 is not set
832# CONFIG_ENIC is not set
833# CONFIG_IXGBE is not set
834# CONFIG_IXGB is not set
835# CONFIG_S2IO is not set
836# CONFIG_VXGE is not set
837# CONFIG_MYRI10GE is not set
838# CONFIG_NETXEN_NIC is not set
839# CONFIG_NIU is not set
840# CONFIG_MLX4_EN is not set
841# CONFIG_MLX4_CORE is not set
842# CONFIG_TEHUTI is not set
843# CONFIG_BNX2X is not set
844# CONFIG_QLGE is not set
845# CONFIG_SFC is not set
846# CONFIG_BE2NET is not set
847# CONFIG_TR is not set
848
849#
850# Wireless LAN
851#
852# CONFIG_WLAN_PRE80211 is not set
853# CONFIG_WLAN_80211 is not set
854
855#
856# Enable WiMAX (Networking options) to see the WiMAX drivers
857#
858
859#
860# USB Network Adapters
861#
862# CONFIG_USB_CATC is not set
863# CONFIG_USB_KAWETH is not set
864# CONFIG_USB_PEGASUS is not set
865CONFIG_USB_RTL8150=y
866# CONFIG_USB_USBNET is not set
867# CONFIG_WAN is not set
868# CONFIG_FDDI is not set
869# CONFIG_HIPPI is not set
870# CONFIG_PPP is not set
871# CONFIG_SLIP is not set
872# CONFIG_NET_FC is not set
873# CONFIG_NETCONSOLE is not set
874# CONFIG_NETPOLL is not set
875# CONFIG_NET_POLL_CONTROLLER is not set
876# CONFIG_ISDN is not set
877# CONFIG_PHONE is not set
878
879#
880# Input device support
881#
882CONFIG_INPUT=y
883# CONFIG_INPUT_FF_MEMLESS is not set
884# CONFIG_INPUT_POLLDEV is not set
885
886#
887# Userland interfaces
888#
889# CONFIG_INPUT_MOUSEDEV is not set
890# CONFIG_INPUT_JOYDEV is not set
891CONFIG_INPUT_EVDEV=y
892# CONFIG_INPUT_EVBUG is not set
893
894#
895# Input Device Drivers
896#
897# CONFIG_INPUT_KEYBOARD is not set
898# CONFIG_INPUT_MOUSE is not set
899# CONFIG_INPUT_JOYSTICK is not set
900# CONFIG_INPUT_TABLET is not set
901# CONFIG_INPUT_TOUCHSCREEN is not set
902# CONFIG_INPUT_MISC is not set
903
904#
905# Hardware I/O ports
906#
907# CONFIG_SERIO is not set
908# CONFIG_GAMEPORT is not set
909
910#
911# Character devices
912#
913# CONFIG_VT is not set
914# CONFIG_DEVKMEM is not set
915# CONFIG_SERIAL_NONSTANDARD is not set
916# CONFIG_NOZOMI is not set
917
918#
919# Serial drivers
920#
921# CONFIG_SERIAL_8250 is not set
922
923#
924# Non-8250 serial port support
925#
926# CONFIG_SERIAL_JSM is not set
927CONFIG_UNIX98_PTYS=y
928# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
929# CONFIG_LEGACY_PTYS is not set
930# CONFIG_IPMI_HANDLER is not set
931# CONFIG_HW_RANDOM is not set
932# CONFIG_R3964 is not set
933# CONFIG_APPLICOM is not set
934# CONFIG_RAW_DRIVER is not set
935# CONFIG_TCG_TPM is not set
936CONFIG_DEVPORT=y
937# CONFIG_I2C is not set
938# CONFIG_SPI is not set
939
940#
941# PPS support
942#
943# CONFIG_PPS is not set
944# CONFIG_W1 is not set
945# CONFIG_POWER_SUPPLY is not set
946# CONFIG_HWMON is not set
947# CONFIG_THERMAL is not set
948# CONFIG_THERMAL_HWMON is not set
949# CONFIG_WATCHDOG is not set
950CONFIG_SSB_POSSIBLE=y
951
952#
953# Sonics Silicon Backplane
954#
955# CONFIG_SSB is not set
956
957#
958# Multifunction device drivers
959#
960# CONFIG_MFD_CORE is not set
961# CONFIG_MFD_SM501 is not set
962# CONFIG_HTC_PASIC3 is not set
963# CONFIG_MFD_TMIO is not set
964# CONFIG_REGULATOR is not set
965# CONFIG_MEDIA_SUPPORT is not set
966
967#
968# Graphics support
969#
970# CONFIG_DRM is not set
971# CONFIG_VGASTATE is not set
972# CONFIG_VIDEO_OUTPUT_CONTROL is not set
973# CONFIG_FB is not set
974# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
975
976#
977# Display device support
978#
979# CONFIG_DISPLAY_SUPPORT is not set
980# CONFIG_SOUND is not set
981CONFIG_HID_SUPPORT=y
982CONFIG_HID=y
983# CONFIG_HID_DEBUG is not set
984# CONFIG_HIDRAW is not set
985
986#
987# USB Input Devices
988#
989CONFIG_USB_HID=y
990# CONFIG_HID_PID is not set
991CONFIG_USB_HIDDEV=y
992
993#
994# Special HID drivers
995#
996# CONFIG_HID_A4TECH is not set
997# CONFIG_HID_APPLE is not set
998# CONFIG_HID_BELKIN is not set
999# CONFIG_HID_CHERRY is not set
1000# CONFIG_HID_CHICONY is not set
1001# CONFIG_HID_CYPRESS is not set
1002# CONFIG_HID_DRAGONRISE is not set
1003# CONFIG_HID_EZKEY is not set
1004# CONFIG_HID_KYE is not set
1005# CONFIG_HID_GYRATION is not set
1006# CONFIG_HID_KENSINGTON is not set
1007# CONFIG_HID_LOGITECH is not set
1008# CONFIG_HID_MICROSOFT is not set
1009# CONFIG_HID_MONTEREY is not set
1010# CONFIG_HID_NTRIG is not set
1011# CONFIG_HID_PANTHERLORD is not set
1012# CONFIG_HID_PETALYNX is not set
1013# CONFIG_HID_SAMSUNG is not set
1014# CONFIG_HID_SONY is not set
1015# CONFIG_HID_SUNPLUS is not set
1016# CONFIG_HID_GREENASIA is not set
1017# CONFIG_HID_SMARTJOYPLUS is not set
1018# CONFIG_HID_TOPSEED is not set
1019# CONFIG_HID_THRUSTMASTER is not set
1020# CONFIG_HID_ZEROPLUS is not set
1021CONFIG_USB_SUPPORT=y
1022CONFIG_USB_ARCH_HAS_HCD=y
1023CONFIG_USB_ARCH_HAS_OHCI=y
1024CONFIG_USB_ARCH_HAS_EHCI=y
1025CONFIG_USB=y
1026# CONFIG_USB_DEBUG is not set
1027CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1028
1029#
1030# Miscellaneous USB options
1031#
1032CONFIG_USB_DEVICEFS=y
1033# CONFIG_USB_DEVICE_CLASS is not set
1034# CONFIG_USB_DYNAMIC_MINORS is not set
1035# CONFIG_USB_OTG is not set
1036# CONFIG_USB_OTG_WHITELIST is not set
1037# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1038# CONFIG_USB_MON is not set
1039# CONFIG_USB_WUSB is not set
1040# CONFIG_USB_WUSB_CBAF is not set
1041
1042#
1043# USB Host Controller Drivers
1044#
1045# CONFIG_USB_C67X00_HCD is not set
1046# CONFIG_USB_XHCI_HCD is not set
1047CONFIG_USB_EHCI_HCD=y
1048# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1049# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1050# CONFIG_USB_OXU210HP_HCD is not set
1051# CONFIG_USB_ISP116X_HCD is not set
1052# CONFIG_USB_ISP1760_HCD is not set
1053CONFIG_USB_OHCI_HCD=y
1054# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1055# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1056CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1057# CONFIG_USB_UHCI_HCD is not set
1058# CONFIG_USB_SL811_HCD is not set
1059# CONFIG_USB_R8A66597_HCD is not set
1060# CONFIG_USB_WHCI_HCD is not set
1061# CONFIG_USB_HWA_HCD is not set
1062
1063#
1064# USB Device Class drivers
1065#
1066# CONFIG_USB_ACM is not set
1067# CONFIG_USB_PRINTER is not set
1068# CONFIG_USB_WDM is not set
1069# CONFIG_USB_TMC is not set
1070
1071#
1072# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1073#
1074
1075#
1076# also be needed; see USB_STORAGE Help for more info
1077#
1078CONFIG_USB_STORAGE=y
1079# CONFIG_USB_STORAGE_DEBUG is not set
1080# CONFIG_USB_STORAGE_DATAFAB is not set
1081# CONFIG_USB_STORAGE_FREECOM is not set
1082# CONFIG_USB_STORAGE_ISD200 is not set
1083# CONFIG_USB_STORAGE_USBAT is not set
1084# CONFIG_USB_STORAGE_SDDR09 is not set
1085# CONFIG_USB_STORAGE_SDDR55 is not set
1086# CONFIG_USB_STORAGE_JUMPSHOT is not set
1087# CONFIG_USB_STORAGE_ALAUDA is not set
1088# CONFIG_USB_STORAGE_ONETOUCH is not set
1089# CONFIG_USB_STORAGE_KARMA is not set
1090# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1091# CONFIG_USB_LIBUSUAL is not set
1092
1093#
1094# USB Imaging devices
1095#
1096# CONFIG_USB_MDC800 is not set
1097# CONFIG_USB_MICROTEK is not set
1098
1099#
1100# USB port drivers
1101#
1102CONFIG_USB_SERIAL=y
1103CONFIG_USB_SERIAL_CONSOLE=y
1104# CONFIG_USB_EZUSB is not set
1105# CONFIG_USB_SERIAL_GENERIC is not set
1106# CONFIG_USB_SERIAL_AIRCABLE is not set
1107# CONFIG_USB_SERIAL_ARK3116 is not set
1108# CONFIG_USB_SERIAL_BELKIN is not set
1109# CONFIG_USB_SERIAL_CH341 is not set
1110# CONFIG_USB_SERIAL_WHITEHEAT is not set
1111# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1112CONFIG_USB_SERIAL_CP210X=y
1113# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1114# CONFIG_USB_SERIAL_EMPEG is not set
1115# CONFIG_USB_SERIAL_FTDI_SIO is not set
1116# CONFIG_USB_SERIAL_FUNSOFT is not set
1117# CONFIG_USB_SERIAL_VISOR is not set
1118# CONFIG_USB_SERIAL_IPAQ is not set
1119# CONFIG_USB_SERIAL_IR is not set
1120# CONFIG_USB_SERIAL_EDGEPORT is not set
1121# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1122# CONFIG_USB_SERIAL_GARMIN is not set
1123# CONFIG_USB_SERIAL_IPW is not set
1124# CONFIG_USB_SERIAL_IUU is not set
1125# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1126# CONFIG_USB_SERIAL_KEYSPAN is not set
1127# CONFIG_USB_SERIAL_KLSI is not set
1128# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1129# CONFIG_USB_SERIAL_MCT_U232 is not set
1130# CONFIG_USB_SERIAL_MOS7720 is not set
1131# CONFIG_USB_SERIAL_MOS7840 is not set
1132# CONFIG_USB_SERIAL_MOTOROLA is not set
1133# CONFIG_USB_SERIAL_NAVMAN is not set
1134# CONFIG_USB_SERIAL_PL2303 is not set
1135# CONFIG_USB_SERIAL_OTI6858 is not set
1136# CONFIG_USB_SERIAL_QUALCOMM is not set
1137# CONFIG_USB_SERIAL_SPCP8X5 is not set
1138# CONFIG_USB_SERIAL_HP4X is not set
1139# CONFIG_USB_SERIAL_SAFE is not set
1140# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
1141# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
1142# CONFIG_USB_SERIAL_SYMBOL is not set
1143# CONFIG_USB_SERIAL_TI is not set
1144# CONFIG_USB_SERIAL_CYBERJACK is not set
1145# CONFIG_USB_SERIAL_XIRCOM is not set
1146# CONFIG_USB_SERIAL_OPTION is not set
1147# CONFIG_USB_SERIAL_OMNINET is not set
1148# CONFIG_USB_SERIAL_OPTICON is not set
1149# CONFIG_USB_SERIAL_DEBUG is not set
1150
1151#
1152# USB Miscellaneous drivers
1153#
1154# CONFIG_USB_EMI62 is not set
1155# CONFIG_USB_EMI26 is not set
1156# CONFIG_USB_ADUTUX is not set
1157# CONFIG_USB_SEVSEG is not set
1158# CONFIG_USB_RIO500 is not set
1159# CONFIG_USB_LEGOTOWER is not set
1160# CONFIG_USB_LCD is not set
1161# CONFIG_USB_BERRY_CHARGE is not set
1162# CONFIG_USB_LED is not set
1163# CONFIG_USB_CYPRESS_CY7C63 is not set
1164# CONFIG_USB_CYTHERM is not set
1165# CONFIG_USB_IDMOUSE is not set
1166# CONFIG_USB_FTDI_ELAN is not set
1167# CONFIG_USB_APPLEDISPLAY is not set
1168# CONFIG_USB_SISUSBVGA is not set
1169# CONFIG_USB_LD is not set
1170# CONFIG_USB_TRANCEVIBRATOR is not set
1171# CONFIG_USB_IOWARRIOR is not set
1172# CONFIG_USB_TEST is not set
1173# CONFIG_USB_ISIGHTFW is not set
1174# CONFIG_USB_VST is not set
1175# CONFIG_USB_GADGET is not set
1176
1177#
1178# OTG and related infrastructure
1179#
1180# CONFIG_NOP_USB_XCEIV is not set
1181# CONFIG_UWB is not set
1182# CONFIG_MMC is not set
1183# CONFIG_MEMSTICK is not set
1184# CONFIG_NEW_LEDS is not set
1185# CONFIG_ACCESSIBILITY is not set
1186# CONFIG_INFINIBAND is not set
1187CONFIG_RTC_LIB=y
1188# CONFIG_RTC_CLASS is not set
1189# CONFIG_DMADEVICES is not set
1190# CONFIG_AUXDISPLAY is not set
1191# CONFIG_UIO is not set
1192
1193#
1194# TI VLYNQ
1195#
1196# CONFIG_STAGING is not set
1197
1198#
1199# File systems
1200#
1201CONFIG_EXT2_FS=y
1202# CONFIG_EXT2_FS_XATTR is not set
1203# CONFIG_EXT2_FS_XIP is not set
1204CONFIG_EXT3_FS=y
1205# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1206# CONFIG_EXT3_FS_XATTR is not set
1207# CONFIG_EXT4_FS is not set
1208CONFIG_JBD=y
1209# CONFIG_JBD_DEBUG is not set
1210# CONFIG_REISERFS_FS is not set
1211# CONFIG_JFS_FS is not set
1212# CONFIG_FS_POSIX_ACL is not set
1213# CONFIG_XFS_FS is not set
1214# CONFIG_GFS2_FS is not set
1215# CONFIG_OCFS2_FS is not set
1216# CONFIG_BTRFS_FS is not set
1217CONFIG_FILE_LOCKING=y
1218CONFIG_FSNOTIFY=y
1219# CONFIG_DNOTIFY is not set
1220CONFIG_INOTIFY=y
1221CONFIG_INOTIFY_USER=y
1222# CONFIG_QUOTA is not set
1223# CONFIG_AUTOFS_FS is not set
1224# CONFIG_AUTOFS4_FS is not set
1225CONFIG_FUSE_FS=y
1226# CONFIG_CUSE is not set
1227
1228#
1229# Caches
1230#
1231# CONFIG_FSCACHE is not set
1232
1233#
1234# CD-ROM/DVD Filesystems
1235#
1236# CONFIG_ISO9660_FS is not set
1237# CONFIG_UDF_FS is not set
1238
1239#
1240# DOS/FAT/NT Filesystems
1241#
1242# CONFIG_MSDOS_FS is not set
1243# CONFIG_VFAT_FS is not set
1244# CONFIG_NTFS_FS is not set
1245
1246#
1247# Pseudo filesystems
1248#
1249CONFIG_PROC_FS=y
1250CONFIG_PROC_KCORE=y
1251CONFIG_PROC_SYSCTL=y
1252CONFIG_PROC_PAGE_MONITOR=y
1253CONFIG_SYSFS=y
1254CONFIG_TMPFS=y
1255# CONFIG_TMPFS_POSIX_ACL is not set
1256# CONFIG_HUGETLB_PAGE is not set
1257# CONFIG_CONFIGFS_FS is not set
1258CONFIG_MISC_FILESYSTEMS=y
1259# CONFIG_ADFS_FS is not set
1260# CONFIG_AFFS_FS is not set
1261# CONFIG_HFS_FS is not set
1262# CONFIG_HFSPLUS_FS is not set
1263# CONFIG_BEFS_FS is not set
1264# CONFIG_BFS_FS is not set
1265# CONFIG_EFS_FS is not set
1266CONFIG_JFFS2_FS=y
1267CONFIG_JFFS2_FS_DEBUG=0
1268CONFIG_JFFS2_FS_WRITEBUFFER=y
1269# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1270# CONFIG_JFFS2_SUMMARY is not set
1271# CONFIG_JFFS2_FS_XATTR is not set
1272# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1273CONFIG_JFFS2_ZLIB=y
1274# CONFIG_JFFS2_LZO is not set
1275CONFIG_JFFS2_RTIME=y
1276# CONFIG_JFFS2_RUBIN is not set
1277CONFIG_CRAMFS=y
1278# CONFIG_SQUASHFS is not set
1279# CONFIG_VXFS_FS is not set
1280# CONFIG_MINIX_FS is not set
1281# CONFIG_OMFS_FS is not set
1282# CONFIG_HPFS_FS is not set
1283# CONFIG_QNX4FS_FS is not set
1284# CONFIG_ROMFS_FS is not set
1285# CONFIG_SYSV_FS is not set
1286# CONFIG_UFS_FS is not set
1287# CONFIG_NILFS2_FS is not set
1288CONFIG_NETWORK_FILESYSTEMS=y
1289CONFIG_NFS_FS=y
1290CONFIG_NFS_V3=y
1291# CONFIG_NFS_V3_ACL is not set
1292# CONFIG_NFS_V4 is not set
1293CONFIG_ROOT_NFS=y
1294# CONFIG_NFSD is not set
1295CONFIG_LOCKD=y
1296CONFIG_LOCKD_V4=y
1297CONFIG_NFS_COMMON=y
1298CONFIG_SUNRPC=y
1299# CONFIG_RPCSEC_GSS_KRB5 is not set
1300# CONFIG_RPCSEC_GSS_SPKM3 is not set
1301# CONFIG_SMB_FS is not set
1302# CONFIG_CIFS is not set
1303# CONFIG_NCP_FS is not set
1304# CONFIG_CODA_FS is not set
1305# CONFIG_AFS_FS is not set
1306
1307#
1308# Partition Types
1309#
1310# CONFIG_PARTITION_ADVANCED is not set
1311CONFIG_MSDOS_PARTITION=y
1312CONFIG_NLS=y
1313CONFIG_NLS_DEFAULT="iso8859-1"
1314# CONFIG_NLS_CODEPAGE_437 is not set
1315# CONFIG_NLS_CODEPAGE_737 is not set
1316# CONFIG_NLS_CODEPAGE_775 is not set
1317# CONFIG_NLS_CODEPAGE_850 is not set
1318# CONFIG_NLS_CODEPAGE_852 is not set
1319# CONFIG_NLS_CODEPAGE_855 is not set
1320# CONFIG_NLS_CODEPAGE_857 is not set
1321# CONFIG_NLS_CODEPAGE_860 is not set
1322# CONFIG_NLS_CODEPAGE_861 is not set
1323# CONFIG_NLS_CODEPAGE_862 is not set
1324# CONFIG_NLS_CODEPAGE_863 is not set
1325# CONFIG_NLS_CODEPAGE_864 is not set
1326# CONFIG_NLS_CODEPAGE_865 is not set
1327# CONFIG_NLS_CODEPAGE_866 is not set
1328# CONFIG_NLS_CODEPAGE_869 is not set
1329# CONFIG_NLS_CODEPAGE_936 is not set
1330# CONFIG_NLS_CODEPAGE_950 is not set
1331# CONFIG_NLS_CODEPAGE_932 is not set
1332# CONFIG_NLS_CODEPAGE_949 is not set
1333# CONFIG_NLS_CODEPAGE_874 is not set
1334# CONFIG_NLS_ISO8859_8 is not set
1335# CONFIG_NLS_CODEPAGE_1250 is not set
1336# CONFIG_NLS_CODEPAGE_1251 is not set
1337# CONFIG_NLS_ASCII is not set
1338# CONFIG_NLS_ISO8859_1 is not set
1339# CONFIG_NLS_ISO8859_2 is not set
1340# CONFIG_NLS_ISO8859_3 is not set
1341# CONFIG_NLS_ISO8859_4 is not set
1342# CONFIG_NLS_ISO8859_5 is not set
1343# CONFIG_NLS_ISO8859_6 is not set
1344# CONFIG_NLS_ISO8859_7 is not set
1345# CONFIG_NLS_ISO8859_9 is not set
1346# CONFIG_NLS_ISO8859_13 is not set
1347# CONFIG_NLS_ISO8859_14 is not set
1348# CONFIG_NLS_ISO8859_15 is not set
1349# CONFIG_NLS_KOI8_R is not set
1350# CONFIG_NLS_KOI8_U is not set
1351# CONFIG_NLS_UTF8 is not set
1352# CONFIG_DLM is not set
1353
1354#
1355# Kernel hacking
1356#
1357CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1358CONFIG_PRINTK_TIME=y
1359CONFIG_ENABLE_WARN_DEPRECATED=y
1360CONFIG_ENABLE_MUST_CHECK=y
1361CONFIG_FRAME_WARN=1024
1362# CONFIG_MAGIC_SYSRQ is not set
1363# CONFIG_UNUSED_SYMBOLS is not set
1364CONFIG_DEBUG_FS=y
1365# CONFIG_HEADERS_CHECK is not set
1366CONFIG_DEBUG_KERNEL=y
1367# CONFIG_DEBUG_SHIRQ is not set
1368CONFIG_DETECT_SOFTLOCKUP=y
1369# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1370CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1371CONFIG_DETECT_HUNG_TASK=y
1372# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
1373CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1374# CONFIG_SCHED_DEBUG is not set
1375# CONFIG_SCHEDSTATS is not set
1376# CONFIG_TIMER_STATS is not set
1377# CONFIG_DEBUG_OBJECTS is not set
1378# CONFIG_DEBUG_PREEMPT is not set
1379# CONFIG_DEBUG_RT_MUTEXES is not set
1380# CONFIG_RT_MUTEX_TESTER is not set
1381# CONFIG_DEBUG_SPINLOCK is not set
1382# CONFIG_DEBUG_MUTEXES is not set
1383# CONFIG_DEBUG_LOCK_ALLOC is not set
1384# CONFIG_PROVE_LOCKING is not set
1385# CONFIG_LOCK_STAT is not set
1386# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1387# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1388# CONFIG_DEBUG_KOBJECT is not set
1389CONFIG_DEBUG_INFO=y
1390# CONFIG_DEBUG_VM is not set
1391# CONFIG_DEBUG_WRITECOUNT is not set
1392# CONFIG_DEBUG_MEMORY_INIT is not set
1393# CONFIG_DEBUG_LIST is not set
1394# CONFIG_DEBUG_SG is not set
1395# CONFIG_DEBUG_NOTIFIERS is not set
1396# CONFIG_BOOT_PRINTK_DELAY is not set
1397# CONFIG_RCU_TORTURE_TEST is not set
1398# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1399# CONFIG_BACKTRACE_SELF_TEST is not set
1400# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1401# CONFIG_FAULT_INJECTION is not set
1402# CONFIG_PAGE_POISONING is not set
1403CONFIG_TRACING_SUPPORT=y
1404CONFIG_FTRACE=y
1405# CONFIG_IRQSOFF_TRACER is not set
1406# CONFIG_PREEMPT_TRACER is not set
1407# CONFIG_SCHED_TRACER is not set
1408# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1409# CONFIG_BOOT_TRACER is not set
1410CONFIG_BRANCH_PROFILE_NONE=y
1411# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1412# CONFIG_PROFILE_ALL_BRANCHES is not set
1413# CONFIG_KMEMTRACE is not set
1414# CONFIG_WORKQUEUE_TRACER is not set
1415# CONFIG_BLK_DEV_IO_TRACE is not set
1416# CONFIG_DYNAMIC_DEBUG is not set
1417# CONFIG_SAMPLES is not set
1418CONFIG_HAVE_ARCH_KGDB=y
1419# CONFIG_KGDB is not set
1420# CONFIG_KMEMCHECK is not set
1421CONFIG_CMDLINE_BOOL=y
1422CONFIG_CMDLINE="rw dhash_entries=1024 ihash_entries=1024 ip=10.0.1.3:10.0.1.1:10.0.1.1:255.255.255.0:zeus:eth0: root=/dev/nfs nfsroot=/nfsroot/cramfs,wsize=512,rsize=512,tcp nokgdb console=ttyUSB0,115200 memsize=252M"
1423# CONFIG_CMDLINE_OVERRIDE is not set
1424# CONFIG_DEBUG_STACK_USAGE is not set
1425# CONFIG_RUNTIME_DEBUG is not set
1426
1427#
1428# Security options
1429#
1430# CONFIG_KEYS is not set
1431# CONFIG_SECURITY is not set
1432# CONFIG_SECURITYFS is not set
1433# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1434CONFIG_CRYPTO=y
1435
1436#
1437# Crypto core or helper
1438#
1439# CONFIG_CRYPTO_FIPS is not set
1440CONFIG_CRYPTO_ALGAPI=y
1441CONFIG_CRYPTO_ALGAPI2=y
1442CONFIG_CRYPTO_AEAD=y
1443CONFIG_CRYPTO_AEAD2=y
1444CONFIG_CRYPTO_BLKCIPHER=y
1445CONFIG_CRYPTO_BLKCIPHER2=y
1446CONFIG_CRYPTO_HASH=y
1447CONFIG_CRYPTO_HASH2=y
1448CONFIG_CRYPTO_RNG2=y
1449CONFIG_CRYPTO_PCOMP=y
1450CONFIG_CRYPTO_MANAGER=y
1451CONFIG_CRYPTO_MANAGER2=y
1452# CONFIG_CRYPTO_GF128MUL is not set
1453# CONFIG_CRYPTO_NULL is not set
1454CONFIG_CRYPTO_WORKQUEUE=y
1455# CONFIG_CRYPTO_CRYPTD is not set
1456CONFIG_CRYPTO_AUTHENC=y
1457# CONFIG_CRYPTO_TEST is not set
1458
1459#
1460# Authenticated Encryption with Associated Data
1461#
1462# CONFIG_CRYPTO_CCM is not set
1463# CONFIG_CRYPTO_GCM is not set
1464# CONFIG_CRYPTO_SEQIV is not set
1465
1466#
1467# Block modes
1468#
1469CONFIG_CRYPTO_CBC=y
1470# CONFIG_CRYPTO_CTR is not set
1471# CONFIG_CRYPTO_CTS is not set
1472# CONFIG_CRYPTO_ECB is not set
1473# CONFIG_CRYPTO_LRW is not set
1474# CONFIG_CRYPTO_PCBC is not set
1475# CONFIG_CRYPTO_XTS is not set
1476
1477#
1478# Hash modes
1479#
1480CONFIG_CRYPTO_HMAC=y
1481# CONFIG_CRYPTO_XCBC is not set
1482
1483#
1484# Digest
1485#
1486# CONFIG_CRYPTO_CRC32C is not set
1487# CONFIG_CRYPTO_MD4 is not set
1488CONFIG_CRYPTO_MD5=y
1489# CONFIG_CRYPTO_MICHAEL_MIC is not set
1490# CONFIG_CRYPTO_RMD128 is not set
1491# CONFIG_CRYPTO_RMD160 is not set
1492# CONFIG_CRYPTO_RMD256 is not set
1493# CONFIG_CRYPTO_RMD320 is not set
1494CONFIG_CRYPTO_SHA1=y
1495# CONFIG_CRYPTO_SHA256 is not set
1496# CONFIG_CRYPTO_SHA512 is not set
1497# CONFIG_CRYPTO_TGR192 is not set
1498# CONFIG_CRYPTO_WP512 is not set
1499
1500#
1501# Ciphers
1502#
1503# CONFIG_CRYPTO_AES is not set
1504# CONFIG_CRYPTO_ANUBIS is not set
1505# CONFIG_CRYPTO_ARC4 is not set
1506# CONFIG_CRYPTO_BLOWFISH is not set
1507# CONFIG_CRYPTO_CAMELLIA is not set
1508# CONFIG_CRYPTO_CAST5 is not set
1509# CONFIG_CRYPTO_CAST6 is not set
1510CONFIG_CRYPTO_DES=y
1511# CONFIG_CRYPTO_FCRYPT is not set
1512# CONFIG_CRYPTO_KHAZAD is not set
1513# CONFIG_CRYPTO_SALSA20 is not set
1514# CONFIG_CRYPTO_SEED is not set
1515# CONFIG_CRYPTO_SERPENT is not set
1516# CONFIG_CRYPTO_TEA is not set
1517# CONFIG_CRYPTO_TWOFISH is not set
1518
1519#
1520# Compression
1521#
1522CONFIG_CRYPTO_DEFLATE=y
1523# CONFIG_CRYPTO_ZLIB is not set
1524# CONFIG_CRYPTO_LZO is not set
1525
1526#
1527# Random Number Generation
1528#
1529# CONFIG_CRYPTO_ANSI_CPRNG is not set
1530# CONFIG_CRYPTO_HW is not set
1531# CONFIG_BINARY_PRINTF is not set
1532
1533#
1534# Library routines
1535#
1536CONFIG_BITREVERSE=y
1537CONFIG_GENERIC_FIND_LAST_BIT=y
1538# CONFIG_CRC_CCITT is not set
1539# CONFIG_CRC16 is not set
1540# CONFIG_CRC_T10DIF is not set
1541# CONFIG_CRC_ITU_T is not set
1542CONFIG_CRC32=y
1543# CONFIG_CRC7 is not set
1544# CONFIG_LIBCRC32C is not set
1545CONFIG_ZLIB_INFLATE=y
1546CONFIG_ZLIB_DEFLATE=y
1547CONFIG_HAS_IOMEM=y
1548CONFIG_HAS_IOPORT=y
1549CONFIG_HAS_DMA=y
1550CONFIG_NLATTR=y
diff --git a/arch/mips/configs/rb532_defconfig b/arch/mips/configs/rb532_defconfig
index f40c3a04739d..57a50483abdf 100644
--- a/arch/mips/configs/rb532_defconfig
+++ b/arch/mips/configs/rb532_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1204,7 +1203,7 @@ CONFIG_FRAME_WARN=1024
1204# CONFIG_HEADERS_CHECK is not set 1203# CONFIG_HEADERS_CHECK is not set
1205# CONFIG_DEBUG_KERNEL is not set 1204# CONFIG_DEBUG_KERNEL is not set
1206# CONFIG_SAMPLES is not set 1205# CONFIG_SAMPLES is not set
1207CONFIG_CMDLINE="" 1206# CONFIG_CMDLINE_BOOL is not set
1208 1207
1209# 1208#
1210# Security options 1209# Security options
diff --git a/arch/mips/configs/rbtx49xx_defconfig b/arch/mips/configs/rbtx49xx_defconfig
index 6c6a19aebe1f..21c2022d46ee 100644
--- a/arch/mips/configs/rbtx49xx_defconfig
+++ b/arch/mips/configs/rbtx49xx_defconfig
@@ -10,7 +10,6 @@ CONFIG_MIPS=y
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BASLER_EXCITE is not set
14# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
15# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
16# CONFIG_MIPS_COBALT is not set 15# CONFIG_MIPS_COBALT is not set
@@ -284,7 +283,6 @@ CONFIG_DEFAULT_AS=y
284# CONFIG_DEFAULT_CFQ is not set 283# CONFIG_DEFAULT_CFQ is not set
285# CONFIG_DEFAULT_NOOP is not set 284# CONFIG_DEFAULT_NOOP is not set
286CONFIG_DEFAULT_IOSCHED="anticipatory" 285CONFIG_DEFAULT_IOSCHED="anticipatory"
287# CONFIG_PROBE_INITRD_HEADER is not set
288# CONFIG_FREEZER is not set 286# CONFIG_FREEZER is not set
289 287
290# 288#
@@ -1063,7 +1061,7 @@ CONFIG_TRACING_SUPPORT=y
1063# CONFIG_DYNAMIC_DEBUG is not set 1061# CONFIG_DYNAMIC_DEBUG is not set
1064# CONFIG_SAMPLES is not set 1062# CONFIG_SAMPLES is not set
1065CONFIG_HAVE_ARCH_KGDB=y 1063CONFIG_HAVE_ARCH_KGDB=y
1066CONFIG_CMDLINE="" 1064# CONFIG_CMDLINE_BOOL is not set
1067 1065
1068# 1066#
1069# Security options 1067# Security options
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index e53b8d096cfc..790362890033 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -1694,7 +1693,7 @@ CONFIG_ENABLE_MUST_CHECK=y
1694# CONFIG_DEBUG_KERNEL is not set 1693# CONFIG_DEBUG_KERNEL is not set
1695CONFIG_LOG_BUF_SHIFT=14 1694CONFIG_LOG_BUF_SHIFT=14
1696CONFIG_CROSSCOMPILE=y 1695CONFIG_CROSSCOMPILE=y
1697CONFIG_CMDLINE="" 1696# CONFIG_CMDLINE_BOOL is not set
1698 1697
1699# 1698#
1700# Security options 1699# Security options
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 7f38c0b956f3..7f07bf02b838 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -961,7 +960,7 @@ CONFIG_ENABLE_MUST_CHECK=y
961# CONFIG_HEADERS_CHECK is not set 960# CONFIG_HEADERS_CHECK is not set
962# CONFIG_DEBUG_KERNEL is not set 961# CONFIG_DEBUG_KERNEL is not set
963# CONFIG_SAMPLES is not set 962# CONFIG_SAMPLES is not set
964CONFIG_CMDLINE="" 963# CONFIG_CMDLINE_BOOL is not set
965# CONFIG_SB1XXX_CORELIS is not set 964# CONFIG_SB1XXX_CORELIS is not set
966 965
967# 966#
diff --git a/arch/mips/configs/tb0219_defconfig b/arch/mips/configs/tb0219_defconfig
index b5059881bc7e..c54d1128f9a3 100644
--- a/arch/mips/configs/tb0219_defconfig
+++ b/arch/mips/configs/tb0219_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -892,7 +891,9 @@ CONFIG_FRAME_WARN=1024
892# CONFIG_HEADERS_CHECK is not set 891# CONFIG_HEADERS_CHECK is not set
893# CONFIG_DEBUG_KERNEL is not set 892# CONFIG_DEBUG_KERNEL is not set
894# CONFIG_SAMPLES is not set 893# CONFIG_SAMPLES is not set
894CONFIG_CMDLINE_BOOL=y
895CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs" 895CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
896# CONFIG_CMDLINE_OVERRIDE is not set
896 897
897# 898#
898# Security options 899# Security options
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index b06a716bf23f..e7c5cd32a2bd 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -895,7 +894,9 @@ CONFIG_FRAME_WARN=1024
895# CONFIG_HEADERS_CHECK is not set 894# CONFIG_HEADERS_CHECK is not set
896# CONFIG_DEBUG_KERNEL is not set 895# CONFIG_DEBUG_KERNEL is not set
897# CONFIG_SAMPLES is not set 896# CONFIG_SAMPLES is not set
897CONFIG_CMDLINE_BOOL=y
898CONFIG_CMDLINE="cca=3 mem=32M console=ttyVR0,115200" 898CONFIG_CMDLINE="cca=3 mem=32M console=ttyVR0,115200"
899# CONFIG_CMDLINE_OVERRIDE is not set
899 900
900# 901#
901# Security options 902# Security options
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index 46512cf7ce04..b50032ba4d01 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set 12# CONFIG_BCM47XX is not set
14# CONFIG_MIPS_COBALT is not set 13# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 14# CONFIG_MACH_DECSTATION is not set
@@ -1077,7 +1076,9 @@ CONFIG_FRAME_WARN=1024
1077# CONFIG_HEADERS_CHECK is not set 1076# CONFIG_HEADERS_CHECK is not set
1078# CONFIG_DEBUG_KERNEL is not set 1077# CONFIG_DEBUG_KERNEL is not set
1079# CONFIG_SAMPLES is not set 1078# CONFIG_SAMPLES is not set
1079CONFIG_CMDLINE_BOOL=y
1080CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs" 1080CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
1081# CONFIG_CMDLINE_OVERRIDE is not set
1081 1082
1082# 1083#
1083# Security options 1084# Security options
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index b437eb7f8672..c02ba08b69ab 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -9,7 +9,6 @@ CONFIG_MIPS=y
9# Machine selection 9# Machine selection
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_MIPS_COBALT is not set 12# CONFIG_MIPS_COBALT is not set
14# CONFIG_MACH_DECSTATION is not set 13# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 14# CONFIG_MACH_JAZZ is not set
@@ -755,7 +754,9 @@ CONFIG_ENABLE_MUST_CHECK=y
755# CONFIG_HEADERS_CHECK is not set 754# CONFIG_HEADERS_CHECK is not set
756# CONFIG_DEBUG_KERNEL is not set 755# CONFIG_DEBUG_KERNEL is not set
757CONFIG_CROSSCOMPILE=y 756CONFIG_CROSSCOMPILE=y
757CONFIG_CMDLINE_BOOL=y
758CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x170,0x376,49 mem=16M" 758CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x170,0x376,49 mem=16M"
759# CONFIG_CMDLINE_OVERRIDE is not set
759 760
760# 761#
761# Security options 762# Security options
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
index 06acc7482e4c..a35bc41389e5 100644
--- a/arch/mips/configs/wrppmc_defconfig
+++ b/arch/mips/configs/wrppmc_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -887,7 +886,9 @@ CONFIG_ENABLE_MUST_CHECK=y
887# CONFIG_DEBUG_KERNEL is not set 886# CONFIG_DEBUG_KERNEL is not set
888CONFIG_LOG_BUF_SHIFT=14 887CONFIG_LOG_BUF_SHIFT=14
889CONFIG_CROSSCOMPILE=y 888CONFIG_CROSSCOMPILE=y
889CONFIG_CMDLINE_BOOL=y
890CONFIG_CMDLINE="console=ttyS0,115200n8" 890CONFIG_CMDLINE="console=ttyS0,115200n8"
891# CONFIG_CMDLINE_OVERRIDE is not set
891 892
892# 893#
893# Security options 894# Security options
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index 69feaf88b510..e3d68d651e7d 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -22,7 +22,6 @@ CONFIG_ZONE_DMA=y
22# CONFIG_MIPS_DB1550 is not set 22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set 23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set 24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set 25# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 26# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 27# CONFIG_MACH_JAZZ is not set
@@ -824,7 +823,7 @@ CONFIG_DEBUG_MUTEXES=y
824CONFIG_FORCED_INLINING=y 823CONFIG_FORCED_INLINING=y
825# CONFIG_RCU_TORTURE_TEST is not set 824# CONFIG_RCU_TORTURE_TEST is not set
826CONFIG_CROSSCOMPILE=y 825CONFIG_CROSSCOMPILE=y
827CONFIG_CMDLINE="" 826# CONFIG_CMDLINE_BOOL is not set
828# CONFIG_DEBUG_STACK_USAGE is not set 827# CONFIG_DEBUG_STACK_USAGE is not set
829# CONFIG_RUNTIME_DEBUG is not set 828# CONFIG_RUNTIME_DEBUG is not set
830 829
diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c
index 4ca4eef934a5..5c8603c85f20 100644
--- a/arch/mips/fw/arc/cmdline.c
+++ b/arch/mips/fw/arc/cmdline.c
@@ -16,11 +16,6 @@
16 16
17#undef DEBUG_CMDLINE 17#undef DEBUG_CMDLINE
18 18
19char * __init prom_getcmdline(void)
20{
21 return arcs_cmdline;
22}
23
24static char *ignored[] = { 19static char *ignored[] = {
25 "ConsoleIn=", 20 "ConsoleIn=",
26 "ConsoleOut=", 21 "ConsoleOut=",
diff --git a/arch/mips/include/asm/asm-offsets.h b/arch/mips/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/mips/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index f5dfaf6a1606..09eee09780f2 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -67,9 +67,9 @@
67#define MACH_LEMOTE_ML2F7 3 67#define MACH_LEMOTE_ML2F7 3
68#define MACH_LEMOTE_YL2F89 4 68#define MACH_LEMOTE_YL2F89 4
69#define MACH_DEXXON_GDIUM2F10 5 69#define MACH_DEXXON_GDIUM2F10 5
70#define MACH_LOONGSON_END 6 70#define MACH_LEMOTE_NAS 6
71 71#define MACH_LEMOTE_LL2F 7
72#define CL_SIZE COMMAND_LINE_SIZE 72#define MACH_LOONGSON_END 8
73 73
74extern char *system_type; 74extern char *system_type;
75const char *get_system_type(void); 75const char *get_system_type(void);
@@ -107,7 +107,7 @@ extern void free_init_pages(const char *what,
107/* 107/*
108 * Initial kernel command line, usually setup by prom_init() 108 * Initial kernel command line, usually setup by prom_init()
109 */ 109 */
110extern char arcs_cmdline[CL_SIZE]; 110extern char arcs_cmdline[COMMAND_LINE_SIZE];
111 111
112/* 112/*
113 * Registers a0, a1, a3 and a4 as passed to the kernel entry by firmware 113 * Registers a0, a1, a3 and a4 as passed to the kernel entry by firmware
diff --git a/arch/mips/include/asm/clock.h b/arch/mips/include/asm/clock.h
new file mode 100644
index 000000000000..83894aa7932c
--- /dev/null
+++ b/arch/mips/include/asm/clock.h
@@ -0,0 +1,64 @@
1#ifndef __ASM_MIPS_CLOCK_H
2#define __ASM_MIPS_CLOCK_H
3
4#include <linux/kref.h>
5#include <linux/list.h>
6#include <linux/seq_file.h>
7#include <linux/clk.h>
8
9extern void (*cpu_wait) (void);
10
11struct clk;
12
13struct clk_ops {
14 void (*init) (struct clk *clk);
15 void (*enable) (struct clk *clk);
16 void (*disable) (struct clk *clk);
17 void (*recalc) (struct clk *clk);
18 int (*set_rate) (struct clk *clk, unsigned long rate, int algo_id);
19 long (*round_rate) (struct clk *clk, unsigned long rate);
20};
21
22struct clk {
23 struct list_head node;
24 const char *name;
25 int id;
26 struct module *owner;
27
28 struct clk *parent;
29 struct clk_ops *ops;
30
31 struct kref kref;
32
33 unsigned long rate;
34 unsigned long flags;
35};
36
37#define CLK_ALWAYS_ENABLED (1 << 0)
38#define CLK_RATE_PROPAGATES (1 << 1)
39
40/* Should be defined by processor-specific code */
41void arch_init_clk_ops(struct clk_ops **, int type);
42
43int clk_init(void);
44
45int __clk_enable(struct clk *);
46void __clk_disable(struct clk *);
47
48void clk_recalc_rate(struct clk *);
49
50int clk_register(struct clk *);
51void clk_unregister(struct clk *);
52
53/* the exported API, in addition to clk_set_rate */
54/**
55 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
56 * @clk: clock source
57 * @rate: desired clock rate in Hz
58 * @algo_id: algorithm id to be passed down to ops->set_rate
59 *
60 * Returns success (0) or negative errno.
61 */
62int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
63
64#endif /* __ASM_MIPS_CLOCK_H */
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
new file mode 100644
index 000000000000..6b04c98b7fad
--- /dev/null
+++ b/arch/mips/include/asm/cop2.h
@@ -0,0 +1,23 @@
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) 2009 Wind River Systems,
7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __ASM_COP2_H
10#define __ASM_COP2_H
11
12enum cu2_ops {
13 CU2_EXCEPTION,
14 CU2_LWC2_OP,
15 CU2_LDC2_OP,
16 CU2_SWC2_OP,
17 CU2_SDC2_OP,
18};
19
20extern int register_cu2_notifier(struct notifier_block *nb);
21extern int cu2_notifier_call_chain(unsigned long val, void *v);
22
23#endif /* __ASM_COP2_H */
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 4b96d1a36056..cf373a95fe4a 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -154,6 +154,8 @@
154#define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */ 154#define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */
155#define PRID_REV_VR4130 0x0080 155#define PRID_REV_VR4130 0x0080
156#define PRID_REV_34K_V1_0_2 0x0022 156#define PRID_REV_34K_V1_0_2 0x0022
157#define PRID_REV_LOONGSON2E 0x0002
158#define PRID_REV_LOONGSON2F 0x0003
157 159
158/* 160/*
159 * Older processors used to encode processor version and revision in two 161 * Older processors used to encode processor version and revision in two
diff --git a/arch/mips/include/asm/fcntl.h b/arch/mips/include/asm/fcntl.h
index 7c6681aa2ab8..e482fe90fe88 100644
--- a/arch/mips/include/asm/fcntl.h
+++ b/arch/mips/include/asm/fcntl.h
@@ -19,7 +19,7 @@
19#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ 19#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
20#define O_LARGEFILE 0x2000 /* allow large file opens */ 20#define O_LARGEFILE 0x2000 /* allow large file opens */
21/* 21/*
22 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using 22 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
23 * the O_SYNC flag. We continue to use the existing numerical value 23 * the O_SYNC flag. We continue to use the existing numerical value
24 * for O_DSYNC semantics now, but using the correct symbolic name for it. 24 * for O_DSYNC semantics now, but using the correct symbolic name for it.
25 * This new value is used to request true Posix O_SYNC semantics. It is 25 * This new value is used to request true Posix O_SYNC semantics. It is
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 8a3ef247659a..7fcef8ef3fab 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -28,15 +28,7 @@
28struct sigcontext; 28struct sigcontext;
29struct sigcontext32; 29struct sigcontext32;
30 30
31extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
32extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
33
34extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
35extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
36
37extern void fpu_emulator_init_fpu(void); 31extern void fpu_emulator_init_fpu(void);
38extern int fpu_emulator_save_context(struct sigcontext __user *sc);
39extern int fpu_emulator_restore_context(struct sigcontext __user *sc);
40extern void _init_fpu(void); 32extern void _init_fpu(void);
41extern void _save_fp(struct task_struct *); 33extern void _save_fp(struct task_struct *);
42extern void _restore_fp(struct task_struct *); 34extern void _restore_fp(struct task_struct *);
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h
index e5189572956c..aecada6f6117 100644
--- a/arch/mips/include/asm/fpu_emulator.h
+++ b/arch/mips/include/asm/fpu_emulator.h
@@ -25,17 +25,27 @@
25 25
26#include <asm/break.h> 26#include <asm/break.h>
27#include <asm/inst.h> 27#include <asm/inst.h>
28#include <asm/local.h>
29
30#ifdef CONFIG_DEBUG_FS
28 31
29struct mips_fpu_emulator_stats { 32struct mips_fpu_emulator_stats {
30 unsigned int emulated; 33 local_t emulated;
31 unsigned int loads; 34 local_t loads;
32 unsigned int stores; 35 local_t stores;
33 unsigned int cp1ops; 36 local_t cp1ops;
34 unsigned int cp1xops; 37 local_t cp1xops;
35 unsigned int errors; 38 local_t errors;
36}; 39};
37 40
38extern struct mips_fpu_emulator_stats fpuemustats; 41DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
42
43#define MIPS_FPU_EMU_INC_STATS(M) \
44 cpu_local_wrap(__local_inc(&__get_cpu_var(fpuemustats).M))
45
46#else
47#define MIPS_FPU_EMU_INC_STATS(M) do { } while (0)
48#endif /* CONFIG_DEBUG_FS */
39 49
40extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, 50extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
41 unsigned long cpc); 51 unsigned long cpc);
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
index 40a8c178f10d..3986cd8704f3 100644
--- a/arch/mips/include/asm/ftrace.h
+++ b/arch/mips/include/asm/ftrace.h
@@ -1 +1,90 @@
1/* empty */ 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 for
4 * more details.
5 *
6 * Copyright (C) 2009 DSLab, Lanzhou University, China
7 * Author: Wu Zhangjin <wuzj@lemote.com>
8 */
9
10#ifndef _ASM_MIPS_FTRACE_H
11#define _ASM_MIPS_FTRACE_H
12
13#ifdef CONFIG_FUNCTION_TRACER
14
15#define MCOUNT_ADDR ((unsigned long)(_mcount))
16#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
17
18#ifndef __ASSEMBLY__
19extern void _mcount(void);
20#define mcount _mcount
21
22#define safe_load(load, src, dst, error) \
23do { \
24 asm volatile ( \
25 "1: " load " %[" STR(dst) "], 0(%[" STR(src) "])\n"\
26 " li %[" STR(error) "], 0\n" \
27 "2:\n" \
28 \
29 ".section .fixup, \"ax\"\n" \
30 "3: li %[" STR(error) "], 1\n" \
31 " j 2b\n" \
32 ".previous\n" \
33 \
34 ".section\t__ex_table,\"a\"\n\t" \
35 STR(PTR) "\t1b, 3b\n\t" \
36 ".previous\n" \
37 \
38 : [dst] "=&r" (dst), [error] "=r" (error)\
39 : [src] "r" (src) \
40 : "memory" \
41 ); \
42} while (0)
43
44#define safe_store(store, src, dst, error) \
45do { \
46 asm volatile ( \
47 "1: " store " %[" STR(src) "], 0(%[" STR(dst) "])\n"\
48 " li %[" STR(error) "], 0\n" \
49 "2:\n" \
50 \
51 ".section .fixup, \"ax\"\n" \
52 "3: li %[" STR(error) "], 1\n" \
53 " j 2b\n" \
54 ".previous\n" \
55 \
56 ".section\t__ex_table,\"a\"\n\t"\
57 STR(PTR) "\t1b, 3b\n\t" \
58 ".previous\n" \
59 \
60 : [error] "=r" (error) \
61 : [dst] "r" (dst), [src] "r" (src)\
62 : "memory" \
63 ); \
64} while (0)
65
66#define safe_load_code(dst, src, error) \
67 safe_load(STR(lw), src, dst, error)
68#define safe_store_code(src, dst, error) \
69 safe_store(STR(sw), src, dst, error)
70
71#define safe_load_stack(dst, src, error) \
72 safe_load(STR(PTR_L), src, dst, error)
73
74#define safe_store_stack(src, dst, error) \
75 safe_store(STR(PTR_S), src, dst, error)
76
77
78#ifdef CONFIG_DYNAMIC_FTRACE
79static inline unsigned long ftrace_call_adjust(unsigned long addr)
80{
81 return addr;
82}
83
84struct dyn_arch_ftrace {
85};
86
87#endif /* CONFIG_DYNAMIC_FTRACE */
88#endif /* __ASSEMBLY__ */
89#endif /* CONFIG_FUNCTION_TRACER */
90#endif /* _ASM_MIPS_FTRACE_H */
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index 09b08d05ff72..06960364c96b 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -113,36 +113,11 @@ do { \
113 113
114#endif 114#endif
115 115
116/* 116extern void do_IRQ(unsigned int irq);
117 * do_IRQ handles all normal device IRQ's (the special
118 * SMP cross-CPU interrupts have their own specific
119 * handlers).
120 *
121 * Ideally there should be away to get this into kernel/irq/handle.c to
122 * avoid the overhead of a call for just a tiny function ...
123 */
124#define do_IRQ(irq) \
125do { \
126 irq_enter(); \
127 __DO_IRQ_SMTC_HOOK(irq); \
128 generic_handle_irq(irq); \
129 irq_exit(); \
130} while (0)
131 117
132#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF 118#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
133/*
134 * To avoid inefficient and in some cases pathological re-checking of
135 * IRQ affinity, we have this variant that skips the affinity check.
136 */
137
138 119
139#define do_IRQ_no_affinity(irq) \ 120extern void do_IRQ_no_affinity(unsigned int irq);
140do { \
141 irq_enter(); \
142 __NO_AFFINITY_IRQ_SMTC_HOOK(irq); \
143 generic_handle_irq(irq); \
144 irq_exit(); \
145} while (0)
146 121
147#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ 122#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
148 123
diff --git a/arch/mips/include/asm/mach-excite/cpu-feature-overrides.h b/arch/mips/include/asm/mach-excite/cpu-feature-overrides.h
deleted file mode 100644
index 107104c3cd12..000000000000
--- a/arch/mips/include/asm/mach-excite/cpu-feature-overrides.h
+++ /dev/null
@@ -1,48 +0,0 @@
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) 2004 Thomas Koeller <thomas.koeller@baslerweb.com>
7 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
11
12/*
13 * Basler eXcite has an RM9122 processor.
14 */
15#define cpu_has_watch 1
16#define cpu_has_mips16 0
17#define cpu_has_divec 0
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 0
23#define cpu_has_ejtag 0
24
25#define cpu_has_llsc 1
26#define cpu_has_vtag_icache 0
27#define cpu_has_dc_aliases 0
28#define cpu_has_ic_fills_f_dc 0
29#define cpu_has_dsp 0
30#define cpu_icache_snoops_remote_store 0
31#define cpu_has_mipsmt 0
32#define cpu_has_userlocal 0
33
34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1
36
37#define cpu_has_mips32r1 0
38#define cpu_has_mips32r2 0
39#define cpu_has_mips64r1 0
40#define cpu_has_mips64r2 0
41
42#define cpu_has_inclusive_pcaches 0
43
44#define cpu_dcache_line_size() 32
45#define cpu_icache_line_size() 32
46#define cpu_scache_line_size() 32
47
48#endif /* __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/arch/mips/include/asm/mach-excite/excite.h b/arch/mips/include/asm/mach-excite/excite.h
deleted file mode 100644
index 4c29ba44992c..000000000000
--- a/arch/mips/include/asm/mach-excite/excite.h
+++ /dev/null
@@ -1,154 +0,0 @@
1#ifndef __EXCITE_H__
2#define __EXCITE_H__
3
4#include <linux/init.h>
5#include <asm/addrspace.h>
6#include <asm/types.h>
7
8#define EXCITE_CPU_EXT_CLOCK 100000000
9
10#if !defined(__ASSEMBLY__)
11void __init excite_kgdb_init(void);
12void excite_procfs_init(void);
13extern unsigned long memsize;
14extern char modetty[];
15extern u32 unit_id;
16#endif
17
18/* Base name for XICAP devices */
19#define XICAP_NAME "xicap_gpi"
20
21/* OCD register offsets */
22#define LKB0 0x0038
23#define LKB5 0x0128
24#define LKM5 0x012C
25#define LKB7 0x0138
26#define LKM7 0x013c
27#define LKB8 0x0140
28#define LKM8 0x0144
29#define LKB9 0x0148
30#define LKM9 0x014c
31#define LKB10 0x0150
32#define LKM10 0x0154
33#define LKB11 0x0158
34#define LKM11 0x015c
35#define LKB12 0x0160
36#define LKM12 0x0164
37#define LKB13 0x0168
38#define LKM13 0x016c
39#define LDP0 0x0200
40#define LDP1 0x0210
41#define LDP2 0x0220
42#define LDP3 0x0230
43#define INTPIN0 0x0A40
44#define INTPIN1 0x0A44
45#define INTPIN2 0x0A48
46#define INTPIN3 0x0A4C
47#define INTPIN4 0x0A50
48#define INTPIN5 0x0A54
49#define INTPIN6 0x0A58
50#define INTPIN7 0x0A5C
51
52
53
54
55/* TITAN register offsets */
56#define CPRR 0x0004
57#define CPDSR 0x0008
58#define CPTC0R 0x000c
59#define CPTC1R 0x0010
60#define CPCFG0 0x0020
61#define CPCFG1 0x0024
62#define CPDST0A 0x0028
63#define CPDST0B 0x002c
64#define CPDST1A 0x0030
65#define CPDST1B 0x0034
66#define CPXDSTA 0x0038
67#define CPXDSTB 0x003c
68#define CPXCISRA 0x0048
69#define CPXCISRB 0x004c
70#define CPGIG0ER 0x0050
71#define CPGIG1ER 0x0054
72#define CPGRWL 0x0068
73#define CPURSLMT 0x00f8
74#define UACFG 0x0200
75#define UAINTS 0x0204
76#define SDRXFCIE 0x4828
77#define SDTXFCIE 0x4928
78#define INTP0Status0 0x1B00
79#define INTP0Mask0 0x1B04
80#define INTP0Set0 0x1B08
81#define INTP0Clear0 0x1B0C
82#define GXCFG 0x5000
83#define GXDMADRPFX 0x5018
84#define GXDMA_DESCADR 0x501c
85#define GXCH0TDESSTRT 0x5054
86
87/* IRQ definitions */
88#define NMICONFIG 0xac0
89#define TITAN_MSGINT 0xc4
90#define TITAN_IRQ ((TITAN_MSGINT / 0x20) + 2)
91#define FPGA0_MSGINT 0x5a
92#define FPGA0_IRQ ((FPGA0_MSGINT / 0x20) + 2)
93#define FPGA1_MSGINT 0x7b
94#define FPGA1_IRQ ((FPGA1_MSGINT / 0x20) + 2)
95#define PHY_MSGINT 0x9c
96#define PHY_IRQ ((PHY_MSGINT / 0x20) + 2)
97
98#if defined(CONFIG_BASLER_EXCITE_PROTOTYPE)
99/* Pre-release units used interrupt pin #9 */
100#define USB_IRQ 11
101#else
102/* Re-designed units use interrupt pin #1 */
103#define USB_MSGINT 0x39
104#define USB_IRQ ((USB_MSGINT / 0x20) + 2)
105#endif
106#define TIMER_IRQ 12
107
108
109/* Device address ranges */
110#define EXCITE_OFFS_OCD 0x1fffc000
111#define EXCITE_SIZE_OCD (16 * 1024)
112#define EXCITE_PHYS_OCD CPHYSADDR(EXCITE_OFFS_OCD)
113#define EXCITE_ADDR_OCD CKSEG1ADDR(EXCITE_OFFS_OCD)
114
115#define EXCITE_OFFS_SCRAM 0x1fffa000
116#define EXCITE_SIZE_SCRAM (8 << 10)
117#define EXCITE_PHYS_SCRAM CPHYSADDR(EXCITE_OFFS_SCRAM)
118#define EXCITE_ADDR_SCRAM CKSEG1ADDR(EXCITE_OFFS_SCRAM)
119
120#define EXCITE_OFFS_PCI_IO 0x1fff8000
121#define EXCITE_SIZE_PCI_IO (8 << 10)
122#define EXCITE_PHYS_PCI_IO CPHYSADDR(EXCITE_OFFS_PCI_IO)
123#define EXCITE_ADDR_PCI_IO CKSEG1ADDR(EXCITE_OFFS_PCI_IO)
124
125#define EXCITE_OFFS_TITAN 0x1fff0000
126#define EXCITE_SIZE_TITAN (32 << 10)
127#define EXCITE_PHYS_TITAN CPHYSADDR(EXCITE_OFFS_TITAN)
128#define EXCITE_ADDR_TITAN CKSEG1ADDR(EXCITE_OFFS_TITAN)
129
130#define EXCITE_OFFS_PCI_MEM 0x1ffe0000
131#define EXCITE_SIZE_PCI_MEM (64 << 10)
132#define EXCITE_PHYS_PCI_MEM CPHYSADDR(EXCITE_OFFS_PCI_MEM)
133#define EXCITE_ADDR_PCI_MEM CKSEG1ADDR(EXCITE_OFFS_PCI_MEM)
134
135#define EXCITE_OFFS_FPGA 0x1ffdc000
136#define EXCITE_SIZE_FPGA (16 << 10)
137#define EXCITE_PHYS_FPGA CPHYSADDR(EXCITE_OFFS_FPGA)
138#define EXCITE_ADDR_FPGA CKSEG1ADDR(EXCITE_OFFS_FPGA)
139
140#define EXCITE_OFFS_NAND 0x1ffd8000
141#define EXCITE_SIZE_NAND (16 << 10)
142#define EXCITE_PHYS_NAND CPHYSADDR(EXCITE_OFFS_NAND)
143#define EXCITE_ADDR_NAND CKSEG1ADDR(EXCITE_OFFS_NAND)
144
145#define EXCITE_OFFS_BOOTROM 0x1f000000
146#define EXCITE_SIZE_BOOTROM (8 << 20)
147#define EXCITE_PHYS_BOOTROM CPHYSADDR(EXCITE_OFFS_BOOTROM)
148#define EXCITE_ADDR_BOOTROM CKSEG1ADDR(EXCITE_OFFS_BOOTROM)
149
150/* FPGA address offsets */
151#define EXCITE_FPGA_DPR 0x0104 /* dual-ported ram */
152#define EXCITE_FPGA_SYSCTL 0x0200 /* system control register block */
153
154#endif /* __EXCITE_H__ */
diff --git a/arch/mips/include/asm/mach-excite/excite_fpga.h b/arch/mips/include/asm/mach-excite/excite_fpga.h
deleted file mode 100644
index 0a1ef69bece7..000000000000
--- a/arch/mips/include/asm/mach-excite/excite_fpga.h
+++ /dev/null
@@ -1,80 +0,0 @@
1#ifndef EXCITE_FPGA_H_INCLUDED
2#define EXCITE_FPGA_H_INCLUDED
3
4
5/**
6 * Address alignment of the individual FPGA bytes.
7 * The address arrangement of the individual bytes of the FPGA is two
8 * byte aligned at the embedded MK2 platform.
9 */
10#ifdef EXCITE_CCI_FPGA_MK2
11typedef unsigned char excite_cci_fpga_align_t __attribute__ ((aligned(2)));
12#else
13typedef unsigned char excite_cci_fpga_align_t;
14#endif
15
16
17/**
18 * Size of Dual Ported RAM.
19 */
20#define EXCITE_DPR_SIZE 263
21
22
23/**
24 * Size of Reserved Status Fields in Dual Ported RAM.
25 */
26#define EXCITE_DPR_STATUS_SIZE 7
27
28
29
30/**
31 * FPGA.
32 * Hardware register layout of the FPGA interface. The FPGA must accessed
33 * byte wise solely.
34 * @see EXCITE_CCI_DPR_MK2
35 */
36typedef struct excite_fpga {
37
38 /**
39 * Dual Ported RAM.
40 */
41 excite_cci_fpga_align_t dpr[EXCITE_DPR_SIZE];
42
43 /**
44 * Status.
45 */
46 excite_cci_fpga_align_t status[EXCITE_DPR_STATUS_SIZE];
47
48#ifdef EXCITE_CCI_FPGA_MK2
49 /**
50 * RM9000 Interrupt.
51 * Write access initiates interrupt at the RM9000 (MIPS) processor of the eXcite.
52 */
53 excite_cci_fpga_align_t rm9k_int;
54#else
55 /**
56 * MK2 Interrupt.
57 * Write access initiates interrupt at the ARM processor of the MK2.
58 */
59 excite_cci_fpga_align_t mk2_int;
60
61 excite_cci_fpga_align_t gap[0x1000-0x10f];
62
63 /**
64 * IRQ Source/Acknowledge.
65 */
66 excite_cci_fpga_align_t rm9k_irq_src;
67
68 /**
69 * IRQ Mask.
70 * Set bits enable the related interrupt.
71 */
72 excite_cci_fpga_align_t rm9k_irq_mask;
73#endif
74
75
76} excite_fpga;
77
78
79
80#endif /* ndef EXCITE_FPGA_H_INCLUDED */
diff --git a/arch/mips/include/asm/mach-excite/excite_nandflash.h b/arch/mips/include/asm/mach-excite/excite_nandflash.h
deleted file mode 100644
index c4cf6140622e..000000000000
--- a/arch/mips/include/asm/mach-excite/excite_nandflash.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __EXCITE_NANDFLASH_H__
2#define __EXCITE_NANDFLASH_H__
3
4/* Resource names */
5#define EXCITE_NANDFLASH_RESOURCE_REGS "excite_nandflash_regs"
6
7#endif /* __EXCITE_NANDFLASH_H__ */
diff --git a/arch/mips/include/asm/mach-excite/rm9k_eth.h b/arch/mips/include/asm/mach-excite/rm9k_eth.h
deleted file mode 100644
index 94705a46f72e..000000000000
--- a/arch/mips/include/asm/mach-excite/rm9k_eth.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#if !defined(__RM9K_ETH_H__)
2#define __RM9K_ETH_H__
3
4#define RM9K_GE_NAME "rm9k_ge"
5
6/* Resource names */
7#define RM9K_GE_RESOURCE_MAC "rm9k_ge_mac"
8#define RM9K_GE_RESOURCE_MSTAT "rm9k_ge_mstat"
9#define RM9K_GE_RESOURCE_PKTPROC "rm9k_ge_pktproc"
10#define RM9K_GE_RESOURCE_XDMA "rm9k_ge_xdma"
11#define RM9K_GE_RESOURCE_FIFO_RX "rm9k_ge_fifo_rx"
12#define RM9K_GE_RESOURCE_FIFO_TX "rm9k_ge_fifo_tx"
13#define RM9K_GE_RESOURCE_FIFOMEM_RX "rm9k_ge_fifo_memory_rx"
14#define RM9K_GE_RESOURCE_FIFOMEM_TX "rm9k_ge_fifo_memory_tx"
15#define RM9K_GE_RESOURCE_PHY "rm9k_ge_phy"
16#define RM9K_GE_RESOURCE_DMADESC_RX "rm9k_ge_dmadesc_rx"
17#define RM9K_GE_RESOURCE_DMADESC_TX "rm9k_ge_dmadesc_tx"
18#define RM9K_GE_RESOURCE_IRQ_MAIN "rm9k_ge_irq_main"
19#define RM9K_GE_RESOURCE_IRQ_PHY "rm9k_ge_irq_phy"
20#define RM9K_GE_RESOURCE_GPI_SLICE "rm9k_ge_gpi_slice"
21#define RM9K_GE_RESOURCE_MDIO_CHANNEL "rm9k_ge_mdio_channel"
22
23#endif /* !defined(__RM9K_ETH_H__) */
diff --git a/arch/mips/include/asm/mach-excite/rm9k_wdt.h b/arch/mips/include/asm/mach-excite/rm9k_wdt.h
deleted file mode 100644
index 3fa3c08d2da7..000000000000
--- a/arch/mips/include/asm/mach-excite/rm9k_wdt.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __RM9K_WDT_H__
2#define __RM9K_WDT_H__
3
4/* Device name */
5#define WDT_NAME "wdt_gpi"
6
7/* Resource names */
8#define WDT_RESOURCE_REGS "excite_watchdog_regs"
9#define WDT_RESOURCE_IRQ "excite_watchdog_irq"
10#define WDT_RESOURCE_COUNTER "excite_watchdog_counter"
11
12#endif /* __RM9K_WDT_H__ */
diff --git a/arch/mips/include/asm/mach-excite/rm9k_xicap.h b/arch/mips/include/asm/mach-excite/rm9k_xicap.h
deleted file mode 100644
index 009577734a8d..000000000000
--- a/arch/mips/include/asm/mach-excite/rm9k_xicap.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __EXCITE_XICAP_H__
2#define __EXCITE_XICAP_H__
3
4
5/* Resource names */
6#define XICAP_RESOURCE_FIFO_RX "xicap_fifo_rx"
7#define XICAP_RESOURCE_FIFO_TX "xicap_fifo_tx"
8#define XICAP_RESOURCE_XDMA "xicap_xdma"
9#define XICAP_RESOURCE_DMADESC "xicap_dmadesc"
10#define XICAP_RESOURCE_PKTPROC "xicap_pktproc"
11#define XICAP_RESOURCE_IRQ "xicap_irq"
12#define XICAP_RESOURCE_GPI_SLICE "xicap_gpi_slice"
13#define XICAP_RESOURCE_FIFO_BLK "xicap_fifo_blocks"
14#define XICAP_RESOURCE_PKT_STREAM "xicap_pkt_stream"
15
16#endif /* __EXCITE_XICAP_H__ */
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index 09a59bcc1b07..1b1a7d1632b9 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -24,7 +24,9 @@ extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
24 24
25#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid) 25#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid)
26#define parent_node(node) (node) 26#define parent_node(node) (node)
27#define cpumask_of_node(node) (&hub_data(node)->h_cpus) 27#define cpumask_of_node(node) ((node) == -1 ? \
28 cpu_all_mask : \
29 &hub_data(node)->h_cpus)
28struct pci_bus; 30struct pci_bus;
29extern int pcibus_to_node(struct pci_bus *); 31extern int pcibus_to_node(struct pci_bus *);
30 32
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536.h b/arch/mips/include/asm/mach-loongson/cs5536/cs5536.h
new file mode 100644
index 000000000000..021f77ca59ec
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/cs5536/cs5536.h
@@ -0,0 +1,305 @@
1/*
2 * The header file of cs5536 sourth bridge.
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu <liujl@lemote.com>
6 */
7
8#ifndef _CS5536_H
9#define _CS5536_H
10
11#include <linux/types.h>
12
13extern void _rdmsr(u32 msr, u32 *hi, u32 *lo);
14extern void _wrmsr(u32 msr, u32 hi, u32 lo);
15
16/*
17 * MSR module base
18 */
19#define CS5536_SB_MSR_BASE (0x00000000)
20#define CS5536_GLIU_MSR_BASE (0x10000000)
21#define CS5536_ILLEGAL_MSR_BASE (0x20000000)
22#define CS5536_USB_MSR_BASE (0x40000000)
23#define CS5536_IDE_MSR_BASE (0x60000000)
24#define CS5536_DIVIL_MSR_BASE (0x80000000)
25#define CS5536_ACC_MSR_BASE (0xa0000000)
26#define CS5536_UNUSED_MSR_BASE (0xc0000000)
27#define CS5536_GLCP_MSR_BASE (0xe0000000)
28
29#define SB_MSR_REG(offset) (CS5536_SB_MSR_BASE | (offset))
30#define GLIU_MSR_REG(offset) (CS5536_GLIU_MSR_BASE | (offset))
31#define ILLEGAL_MSR_REG(offset) (CS5536_ILLEGAL_MSR_BASE | (offset))
32#define USB_MSR_REG(offset) (CS5536_USB_MSR_BASE | (offset))
33#define IDE_MSR_REG(offset) (CS5536_IDE_MSR_BASE | (offset))
34#define DIVIL_MSR_REG(offset) (CS5536_DIVIL_MSR_BASE | (offset))
35#define ACC_MSR_REG(offset) (CS5536_ACC_MSR_BASE | (offset))
36#define UNUSED_MSR_REG(offset) (CS5536_UNUSED_MSR_BASE | (offset))
37#define GLCP_MSR_REG(offset) (CS5536_GLCP_MSR_BASE | (offset))
38
39/*
40 * BAR SPACE OF VIRTUAL PCI :
41 * range for pci probe use, length is the actual size.
42 */
43/* IO space for all DIVIL modules */
44#define CS5536_IRQ_RANGE 0xffffffe0 /* USERD FOR PCI PROBE */
45#define CS5536_IRQ_LENGTH 0x20 /* THE REGS ACTUAL LENGTH */
46#define CS5536_SMB_RANGE 0xfffffff8
47#define CS5536_SMB_LENGTH 0x08
48#define CS5536_GPIO_RANGE 0xffffff00
49#define CS5536_GPIO_LENGTH 0x100
50#define CS5536_MFGPT_RANGE 0xffffffc0
51#define CS5536_MFGPT_LENGTH 0x40
52#define CS5536_ACPI_RANGE 0xffffffe0
53#define CS5536_ACPI_LENGTH 0x20
54#define CS5536_PMS_RANGE 0xffffff80
55#define CS5536_PMS_LENGTH 0x80
56/* IO space for IDE */
57#define CS5536_IDE_RANGE 0xfffffff0
58#define CS5536_IDE_LENGTH 0x10
59/* IO space for ACC */
60#define CS5536_ACC_RANGE 0xffffff80
61#define CS5536_ACC_LENGTH 0x80
62/* MEM space for ALL USB modules */
63#define CS5536_OHCI_RANGE 0xfffff000
64#define CS5536_OHCI_LENGTH 0x1000
65#define CS5536_EHCI_RANGE 0xfffff000
66#define CS5536_EHCI_LENGTH 0x1000
67
68/*
69 * PCI MSR ACCESS
70 */
71#define PCI_MSR_CTRL 0xF0
72#define PCI_MSR_ADDR 0xF4
73#define PCI_MSR_DATA_LO 0xF8
74#define PCI_MSR_DATA_HI 0xFC
75
76/**************** MSR *****************************/
77
78/*
79 * GLIU STANDARD MSR
80 */
81#define GLIU_CAP 0x00
82#define GLIU_CONFIG 0x01
83#define GLIU_SMI 0x02
84#define GLIU_ERROR 0x03
85#define GLIU_PM 0x04
86#define GLIU_DIAG 0x05
87
88/*
89 * GLIU SPEC. MSR
90 */
91#define GLIU_P2D_BM0 0x20
92#define GLIU_P2D_BM1 0x21
93#define GLIU_P2D_BM2 0x22
94#define GLIU_P2D_BMK0 0x23
95#define GLIU_P2D_BMK1 0x24
96#define GLIU_P2D_BM3 0x25
97#define GLIU_P2D_BM4 0x26
98#define GLIU_COH 0x80
99#define GLIU_PAE 0x81
100#define GLIU_ARB 0x82
101#define GLIU_ASMI 0x83
102#define GLIU_AERR 0x84
103#define GLIU_DEBUG 0x85
104#define GLIU_PHY_CAP 0x86
105#define GLIU_NOUT_RESP 0x87
106#define GLIU_NOUT_WDATA 0x88
107#define GLIU_WHOAMI 0x8B
108#define GLIU_SLV_DIS 0x8C
109#define GLIU_IOD_BM0 0xE0
110#define GLIU_IOD_BM1 0xE1
111#define GLIU_IOD_BM2 0xE2
112#define GLIU_IOD_BM3 0xE3
113#define GLIU_IOD_BM4 0xE4
114#define GLIU_IOD_BM5 0xE5
115#define GLIU_IOD_BM6 0xE6
116#define GLIU_IOD_BM7 0xE7
117#define GLIU_IOD_BM8 0xE8
118#define GLIU_IOD_BM9 0xE9
119#define GLIU_IOD_SC0 0xEA
120#define GLIU_IOD_SC1 0xEB
121#define GLIU_IOD_SC2 0xEC
122#define GLIU_IOD_SC3 0xED
123#define GLIU_IOD_SC4 0xEE
124#define GLIU_IOD_SC5 0xEF
125#define GLIU_IOD_SC6 0xF0
126#define GLIU_IOD_SC7 0xF1
127
128/*
129 * SB STANDARD
130 */
131#define SB_CAP 0x00
132#define SB_CONFIG 0x01
133#define SB_SMI 0x02
134#define SB_ERROR 0x03
135#define SB_MAR_ERR_EN 0x00000001
136#define SB_TAR_ERR_EN 0x00000002
137#define SB_RSVD_BIT1 0x00000004
138#define SB_EXCEP_ERR_EN 0x00000008
139#define SB_SYSE_ERR_EN 0x00000010
140#define SB_PARE_ERR_EN 0x00000020
141#define SB_TAS_ERR_EN 0x00000040
142#define SB_MAR_ERR_FLAG 0x00010000
143#define SB_TAR_ERR_FLAG 0x00020000
144#define SB_RSVD_BIT2 0x00040000
145#define SB_EXCEP_ERR_FLAG 0x00080000
146#define SB_SYSE_ERR_FLAG 0x00100000
147#define SB_PARE_ERR_FLAG 0x00200000
148#define SB_TAS_ERR_FLAG 0x00400000
149#define SB_PM 0x04
150#define SB_DIAG 0x05
151
152/*
153 * SB SPEC.
154 */
155#define SB_CTRL 0x10
156#define SB_R0 0x20
157#define SB_R1 0x21
158#define SB_R2 0x22
159#define SB_R3 0x23
160#define SB_R4 0x24
161#define SB_R5 0x25
162#define SB_R6 0x26
163#define SB_R7 0x27
164#define SB_R8 0x28
165#define SB_R9 0x29
166#define SB_R10 0x2A
167#define SB_R11 0x2B
168#define SB_R12 0x2C
169#define SB_R13 0x2D
170#define SB_R14 0x2E
171#define SB_R15 0x2F
172
173/*
174 * GLCP STANDARD
175 */
176#define GLCP_CAP 0x00
177#define GLCP_CONFIG 0x01
178#define GLCP_SMI 0x02
179#define GLCP_ERROR 0x03
180#define GLCP_PM 0x04
181#define GLCP_DIAG 0x05
182
183/*
184 * GLCP SPEC.
185 */
186#define GLCP_CLK_DIS_DELAY 0x08
187#define GLCP_PM_CLK_DISABLE 0x09
188#define GLCP_GLB_PM 0x0B
189#define GLCP_DBG_OUT 0x0C
190#define GLCP_RSVD1 0x0D
191#define GLCP_SOFT_COM 0x0E
192#define SOFT_BAR_SMB_FLAG 0x00000001
193#define SOFT_BAR_GPIO_FLAG 0x00000002
194#define SOFT_BAR_MFGPT_FLAG 0x00000004
195#define SOFT_BAR_IRQ_FLAG 0x00000008
196#define SOFT_BAR_PMS_FLAG 0x00000010
197#define SOFT_BAR_ACPI_FLAG 0x00000020
198#define SOFT_BAR_IDE_FLAG 0x00000400
199#define SOFT_BAR_ACC_FLAG 0x00000800
200#define SOFT_BAR_OHCI_FLAG 0x00001000
201#define SOFT_BAR_EHCI_FLAG 0x00002000
202#define GLCP_RSVD2 0x0F
203#define GLCP_CLK_OFF 0x10
204#define GLCP_CLK_ACTIVE 0x11
205#define GLCP_CLK_DISABLE 0x12
206#define GLCP_CLK4ACK 0x13
207#define GLCP_SYS_RST 0x14
208#define GLCP_RSVD3 0x15
209#define GLCP_DBG_CLK_CTRL 0x16
210#define GLCP_CHIP_REV_ID 0x17
211
212/* PIC */
213#define PIC_YSEL_LOW 0x20
214#define PIC_YSEL_LOW_USB_SHIFT 8
215#define PIC_YSEL_LOW_ACC_SHIFT 16
216#define PIC_YSEL_LOW_FLASH_SHIFT 24
217#define PIC_YSEL_HIGH 0x21
218#define PIC_ZSEL_LOW 0x22
219#define PIC_ZSEL_HIGH 0x23
220#define PIC_IRQM_PRIM 0x24
221#define PIC_IRQM_LPC 0x25
222#define PIC_XIRR_STS_LOW 0x26
223#define PIC_XIRR_STS_HIGH 0x27
224#define PCI_SHDW 0x34
225
226/*
227 * DIVIL STANDARD
228 */
229#define DIVIL_CAP 0x00
230#define DIVIL_CONFIG 0x01
231#define DIVIL_SMI 0x02
232#define DIVIL_ERROR 0x03
233#define DIVIL_PM 0x04
234#define DIVIL_DIAG 0x05
235
236/*
237 * DIVIL SPEC.
238 */
239#define DIVIL_LBAR_IRQ 0x08
240#define DIVIL_LBAR_KEL 0x09
241#define DIVIL_LBAR_SMB 0x0B
242#define DIVIL_LBAR_GPIO 0x0C
243#define DIVIL_LBAR_MFGPT 0x0D
244#define DIVIL_LBAR_ACPI 0x0E
245#define DIVIL_LBAR_PMS 0x0F
246#define DIVIL_LEG_IO 0x14
247#define DIVIL_BALL_OPTS 0x15
248#define DIVIL_SOFT_IRQ 0x16
249#define DIVIL_SOFT_RESET 0x17
250
251/* MFGPT */
252#define MFGPT_IRQ 0x28
253
254/*
255 * IDE STANDARD
256 */
257#define IDE_CAP 0x00
258#define IDE_CONFIG 0x01
259#define IDE_SMI 0x02
260#define IDE_ERROR 0x03
261#define IDE_PM 0x04
262#define IDE_DIAG 0x05
263
264/*
265 * IDE SPEC.
266 */
267#define IDE_IO_BAR 0x08
268#define IDE_CFG 0x10
269#define IDE_DTC 0x12
270#define IDE_CAST 0x13
271#define IDE_ETC 0x14
272#define IDE_INTERNAL_PM 0x15
273
274/*
275 * ACC STANDARD
276 */
277#define ACC_CAP 0x00
278#define ACC_CONFIG 0x01
279#define ACC_SMI 0x02
280#define ACC_ERROR 0x03
281#define ACC_PM 0x04
282#define ACC_DIAG 0x05
283
284/*
285 * USB STANDARD
286 */
287#define USB_CAP 0x00
288#define USB_CONFIG 0x01
289#define USB_SMI 0x02
290#define USB_ERROR 0x03
291#define USB_PM 0x04
292#define USB_DIAG 0x05
293
294/*
295 * USB SPEC.
296 */
297#define USB_OHCI 0x08
298#define USB_EHCI 0x09
299
300/****************** NATIVE ***************************/
301/* GPIO : I/O SPACE; REG : 32BITS */
302#define GPIOL_OUT_VAL 0x00
303#define GPIOL_OUT_EN 0x04
304
305#endif /* _CS5536_H */
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h b/arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h
new file mode 100644
index 000000000000..4b493d6772c2
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/cs5536/cs5536_mfgpt.h
@@ -0,0 +1,35 @@
1/*
2 * cs5536 mfgpt header file
3 */
4
5#ifndef _CS5536_MFGPT_H
6#define _CS5536_MFGPT_H
7
8#include <cs5536/cs5536.h>
9#include <cs5536/cs5536_pci.h>
10
11#ifdef CONFIG_CS5536_MFGPT
12extern void setup_mfgpt0_timer(void);
13extern void disable_mfgpt0_counter(void);
14extern void enable_mfgpt0_counter(void);
15#else
16static inline void __maybe_unused setup_mfgpt0_timer(void)
17{
18}
19static inline void __maybe_unused disable_mfgpt0_counter(void)
20{
21}
22static inline void __maybe_unused enable_mfgpt0_counter(void)
23{
24}
25#endif
26
27#define MFGPT_TICK_RATE 14318000
28#define COMPARE ((MFGPT_TICK_RATE + HZ/2) / HZ)
29
30#define MFGPT_BASE mfgpt_base
31#define MFGPT0_CMP2 (MFGPT_BASE + 2)
32#define MFGPT0_CNT (MFGPT_BASE + 4)
33#define MFGPT0_SETUP (MFGPT_BASE + 6)
34
35#endif /*!_CS5536_MFGPT_H */
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h b/arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h
new file mode 100644
index 000000000000..0dca9c89ee7c
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/cs5536/cs5536_pci.h
@@ -0,0 +1,153 @@
1/*
2 * the definition file of cs5536 Virtual Support Module(VSM).
3 * pci configuration space can be accessed through the VSM, so
4 * there is no need of the MSR read/write now, except the spec.
5 * MSR registers which are not implemented yet.
6 *
7 * Copyright (C) 2007 Lemote Inc.
8 * Author : jlliu, liujl@lemote.com
9 */
10
11#ifndef _CS5536_PCI_H
12#define _CS5536_PCI_H
13
14#include <linux/types.h>
15#include <linux/pci_regs.h>
16
17extern void cs5536_pci_conf_write4(int function, int reg, u32 value);
18extern u32 cs5536_pci_conf_read4(int function, int reg);
19
20#define CS5536_ACC_INTR 9
21#define CS5536_IDE_INTR 14
22#define CS5536_USB_INTR 11
23#define CS5536_MFGPT_INTR 5
24#define CS5536_UART1_INTR 4
25#define CS5536_UART2_INTR 3
26
27/************** PCI BUS DEVICE FUNCTION ***************/
28
29/*
30 * PCI bus device function
31 */
32#define PCI_BUS_CS5536 0
33#define PCI_IDSEL_CS5536 14
34
35/********** STANDARD PCI-2.2 EXPANSION ****************/
36
37/*
38 * PCI configuration space
39 * we have to virtualize the PCI configure space head, so we should
40 * define the necessary IDs and some others.
41 */
42
43/* CONFIG of PCI VENDOR ID*/
44#define CFG_PCI_VENDOR_ID(mod_dev_id, sys_vendor_id) \
45 (((mod_dev_id) << 16) | (sys_vendor_id))
46
47/* VENDOR ID */
48#define CS5536_VENDOR_ID 0x1022
49
50/* DEVICE ID */
51#define CS5536_ISA_DEVICE_ID 0x2090
52#define CS5536_IDE_DEVICE_ID 0x209a
53#define CS5536_ACC_DEVICE_ID 0x2093
54#define CS5536_OHCI_DEVICE_ID 0x2094
55#define CS5536_EHCI_DEVICE_ID 0x2095
56
57/* CLASS CODE : CLASS SUB-CLASS INTERFACE */
58#define CS5536_ISA_CLASS_CODE 0x060100
59#define CS5536_IDE_CLASS_CODE 0x010180
60#define CS5536_ACC_CLASS_CODE 0x040100
61#define CS5536_OHCI_CLASS_CODE 0x0C0310
62#define CS5536_EHCI_CLASS_CODE 0x0C0320
63
64/* BHLC : BIST HEADER-TYPE LATENCY-TIMER CACHE-LINE-SIZE */
65
66#define CFG_PCI_CACHE_LINE_SIZE(header_type, latency_timer) \
67 ((PCI_NONE_BIST << 24) | ((header_type) << 16) \
68 | ((latency_timer) << 8) | PCI_NORMAL_CACHE_LINE_SIZE);
69
70#define PCI_NONE_BIST 0x00 /* RO not implemented yet. */
71#define PCI_BRIDGE_HEADER_TYPE 0x80 /* RO */
72#define PCI_NORMAL_HEADER_TYPE 0x00
73#define PCI_NORMAL_LATENCY_TIMER 0x00
74#define PCI_NORMAL_CACHE_LINE_SIZE 0x08 /* RW */
75
76/* BAR */
77#define PCI_BAR0_REG 0x10
78#define PCI_BAR1_REG 0x14
79#define PCI_BAR2_REG 0x18
80#define PCI_BAR3_REG 0x1c
81#define PCI_BAR4_REG 0x20
82#define PCI_BAR5_REG 0x24
83#define PCI_BAR_COUNT 6
84#define PCI_BAR_RANGE_MASK 0xFFFFFFFF
85
86/* CARDBUS CIS POINTER */
87#define PCI_CARDBUS_CIS_POINTER 0x00000000
88
89/* SUBSYSTEM VENDOR ID */
90#define CS5536_SUB_VENDOR_ID CS5536_VENDOR_ID
91
92/* SUBSYSTEM ID */
93#define CS5536_ISA_SUB_ID CS5536_ISA_DEVICE_ID
94#define CS5536_IDE_SUB_ID CS5536_IDE_DEVICE_ID
95#define CS5536_ACC_SUB_ID CS5536_ACC_DEVICE_ID
96#define CS5536_OHCI_SUB_ID CS5536_OHCI_DEVICE_ID
97#define CS5536_EHCI_SUB_ID CS5536_EHCI_DEVICE_ID
98
99/* EXPANSION ROM BAR */
100#define PCI_EXPANSION_ROM_BAR 0x00000000
101
102/* CAPABILITIES POINTER */
103#define PCI_CAPLIST_POINTER 0x00000000
104#define PCI_CAPLIST_USB_POINTER 0x40
105/* INTERRUPT */
106
107#define CFG_PCI_INTERRUPT_LINE(pin, mod_intr) \
108 ((PCI_MAX_LATENCY << 24) | (PCI_MIN_GRANT << 16) | \
109 ((pin) << 8) | (mod_intr))
110
111#define PCI_MAX_LATENCY 0x40
112#define PCI_MIN_GRANT 0x00
113#define PCI_DEFAULT_PIN 0x01
114
115/*********** EXPANSION PCI REG ************************/
116
117/*
118 * ISA EXPANSION
119 */
120#define PCI_UART1_INT_REG 0x50
121#define PCI_UART2_INT_REG 0x54
122#define PCI_ISA_FIXUP_REG 0x58
123
124/*
125 * IDE EXPANSION
126 */
127#define PCI_IDE_CFG_REG 0x40
128#define CS5536_IDE_FLASH_SIGNATURE 0xDEADBEEF
129#define PCI_IDE_DTC_REG 0x48
130#define PCI_IDE_CAST_REG 0x4C
131#define PCI_IDE_ETC_REG 0x50
132#define PCI_IDE_PM_REG 0x54
133#define PCI_IDE_INT_REG 0x60
134
135/*
136 * ACC EXPANSION
137 */
138#define PCI_ACC_INT_REG 0x50
139
140/*
141 * OHCI EXPANSION : INTTERUPT IS IMPLEMENTED BY THE OHCI
142 */
143#define PCI_OHCI_PM_REG 0x40
144#define PCI_OHCI_INT_REG 0x50
145
146/*
147 * EHCI EXPANSION
148 */
149#define PCI_EHCI_LEGSMIEN_REG 0x50
150#define PCI_EHCI_LEGSMISTS_REG 0x54
151#define PCI_EHCI_FLADJ_REG 0x60
152
153#endif /* _CS5536_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h b/arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h
new file mode 100644
index 000000000000..6305bea7e18e
--- /dev/null
+++ b/arch/mips/include/asm/mach-loongson/cs5536/cs5536_vsm.h
@@ -0,0 +1,31 @@
1/*
2 * the read/write interfaces for Virtual Support Module(VSM)
3 *
4 * Copyright (C) 2009 Lemote, Inc.
5 * Author: Wu Zhangjin <wuzj@lemote.com>
6 */
7
8#ifndef _CS5536_VSM_H
9#define _CS5536_VSM_H
10
11#include <linux/types.h>
12
13typedef void (*cs5536_pci_vsm_write)(int reg, u32 value);
14typedef u32 (*cs5536_pci_vsm_read)(int reg);
15
16#define DECLARE_CS5536_MODULE(name) \
17extern void pci_##name##_write_reg(int reg, u32 value); \
18extern u32 pci_##name##_read_reg(int reg);
19
20/* ide module */
21DECLARE_CS5536_MODULE(ide)
22/* acc module */
23DECLARE_CS5536_MODULE(acc)
24/* ohci module */
25DECLARE_CS5536_MODULE(ohci)
26/* isa module */
27DECLARE_CS5536_MODULE(isa)
28/* ehci module */
29DECLARE_CS5536_MODULE(ehci)
30
31#endif /* _CS5536_VSM_H */
diff --git a/arch/mips/include/asm/mach-loongson/dma-coherence.h b/arch/mips/include/asm/mach-loongson/dma-coherence.h
index 71a6851ba833..981c75f91a7d 100644
--- a/arch/mips/include/asm/mach-loongson/dma-coherence.h
+++ b/arch/mips/include/asm/mach-loongson/dma-coherence.h
@@ -28,7 +28,11 @@ static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
28static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 28static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
29 dma_addr_t dma_addr) 29 dma_addr_t dma_addr)
30{ 30{
31#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
32 return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff);
33#else
31 return dma_addr & 0x7fffffff; 34 return dma_addr & 0x7fffffff;
35#endif
32} 36}
33 37
34static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 38static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index da70bcf2304e..ee8bc8376972 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology 2 * Copyright (C) 2009 Lemote, Inc.
3 * Author: Wu Zhangjin <wuzj@lemote.com> 3 * Author: Wu Zhangjin <wuzj@lemote.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
@@ -15,9 +15,6 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18/* there is an internal bonito64-compatiable northbridge in loongson2e/2f */
19#include <asm/mips-boards/bonito64.h>
20
21/* loongson internal northbridge initialization */ 18/* loongson internal northbridge initialization */
22extern void bonito_irq_init(void); 19extern void bonito_irq_init(void);
23 20
@@ -32,7 +29,19 @@ extern unsigned long memsize, highmemsize;
32/* loongson-specific command line, env and memory initialization */ 29/* loongson-specific command line, env and memory initialization */
33extern void __init prom_init_memory(void); 30extern void __init prom_init_memory(void);
34extern void __init prom_init_cmdline(void); 31extern void __init prom_init_cmdline(void);
32extern void __init prom_init_machtype(void);
35extern void __init prom_init_env(void); 33extern void __init prom_init_env(void);
34#ifdef CONFIG_LOONGSON_UART_BASE
35extern unsigned long _loongson_uart_base, loongson_uart_base;
36extern void prom_init_loongson_uart_base(void);
37#endif
38
39static inline void prom_init_uart_base(void)
40{
41#ifdef CONFIG_LOONGSON_UART_BASE
42 prom_init_loongson_uart_base();
43#endif
44}
36 45
37/* irq operation functions */ 46/* irq operation functions */
38extern void bonito_irqdispatch(void); 47extern void bonito_irqdispatch(void);
@@ -40,25 +49,276 @@ extern void __init bonito_irq_init(void);
40extern void __init set_irq_trigger_mode(void); 49extern void __init set_irq_trigger_mode(void);
41extern void __init mach_init_irq(void); 50extern void __init mach_init_irq(void);
42extern void mach_irq_dispatch(unsigned int pending); 51extern void mach_irq_dispatch(unsigned int pending);
52extern int mach_i8259_irq(void);
53
54/* We need this in some places... */
55#define delay() ({ \
56 int x; \
57 for (x = 0; x < 100000; x++) \
58 __asm__ __volatile__(""); \
59})
60
61#define LOONGSON_REG(x) \
62 (*(volatile u32 *)((char *)CKSEG1ADDR(LOONGSON_REG_BASE) + (x)))
63
64#define LOONGSON_IRQ_BASE 32
65#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
66
67#define LOONGSON_FLASH_BASE 0x1c000000
68#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */
69#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
70
71#define LOONGSON_LIO0_BASE 0x1e000000
72#define LOONGSON_LIO0_SIZE 0x01C00000 /* 28M */
73#define LOONGSON_LIO0_TOP (LOONGSON_LIO0_BASE+LOONGSON_LIO0_SIZE-1)
74
75#define LOONGSON_BOOT_BASE 0x1fc00000
76#define LOONGSON_BOOT_SIZE 0x00100000 /* 1M */
77#define LOONGSON_BOOT_TOP (LOONGSON_BOOT_BASE+LOONGSON_BOOT_SIZE-1)
78#define LOONGSON_REG_BASE 0x1fe00000
79#define LOONGSON_REG_SIZE 0x00100000 /* 256Bytes + 256Bytes + ??? */
80#define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1)
81
82#define LOONGSON_LIO1_BASE 0x1ff00000
83#define LOONGSON_LIO1_SIZE 0x00100000 /* 1M */
84#define LOONGSON_LIO1_TOP (LOONGSON_LIO1_BASE+LOONGSON_LIO1_SIZE-1)
85
86#define LOONGSON_PCILO0_BASE 0x10000000
87#define LOONGSON_PCILO1_BASE 0x14000000
88#define LOONGSON_PCILO2_BASE 0x18000000
89#define LOONGSON_PCILO_BASE LOONGSON_PCILO0_BASE
90#define LOONGSON_PCILO_SIZE 0x0c000000 /* 64M * 3 */
91#define LOONGSON_PCILO_TOP (LOONGSON_PCILO0_BASE+LOONGSON_PCILO_SIZE-1)
92
93#define LOONGSON_PCICFG_BASE 0x1fe80000
94#define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */
95#define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1)
96#define LOONGSON_PCIIO_BASE 0x1fd00000
97#define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */
98#define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1)
99
100/* Loongson Register Bases */
101
102#define LOONGSON_PCICONFIGBASE 0x00
103#define LOONGSON_REGBASE 0x100
43 104
44/* PCI Configuration Registers */ 105/* PCI Configuration Registers */
45#define LOONGSON_PCI_ISR4C BONITO_PCI_REG(0x4c) 106
107#define LOONGSON_PCI_REG(x) LOONGSON_REG(LOONGSON_PCICONFIGBASE + (x))
108#define LOONGSON_PCIDID LOONGSON_PCI_REG(0x00)
109#define LOONGSON_PCICMD LOONGSON_PCI_REG(0x04)
110#define LOONGSON_PCICLASS LOONGSON_PCI_REG(0x08)
111#define LOONGSON_PCILTIMER LOONGSON_PCI_REG(0x0c)
112#define LOONGSON_PCIBASE0 LOONGSON_PCI_REG(0x10)
113#define LOONGSON_PCIBASE1 LOONGSON_PCI_REG(0x14)
114#define LOONGSON_PCIBASE2 LOONGSON_PCI_REG(0x18)
115#define LOONGSON_PCIBASE3 LOONGSON_PCI_REG(0x1c)
116#define LOONGSON_PCIBASE4 LOONGSON_PCI_REG(0x20)
117#define LOONGSON_PCIEXPRBASE LOONGSON_PCI_REG(0x30)
118#define LOONGSON_PCIINT LOONGSON_PCI_REG(0x3c)
119
120#define LOONGSON_PCI_ISR4C LOONGSON_PCI_REG(0x4c)
121
122#define LOONGSON_PCICMD_PERR_CLR 0x80000000
123#define LOONGSON_PCICMD_SERR_CLR 0x40000000
124#define LOONGSON_PCICMD_MABORT_CLR 0x20000000
125#define LOONGSON_PCICMD_MTABORT_CLR 0x10000000
126#define LOONGSON_PCICMD_TABORT_CLR 0x08000000
127#define LOONGSON_PCICMD_MPERR_CLR 0x01000000
128#define LOONGSON_PCICMD_PERRRESPEN 0x00000040
129#define LOONGSON_PCICMD_ASTEPEN 0x00000080
130#define LOONGSON_PCICMD_SERREN 0x00000100
131#define LOONGSON_PCILTIMER_BUSLATENCY 0x0000ff00
132#define LOONGSON_PCILTIMER_BUSLATENCY_SHIFT 8
133
134/* Loongson h/w Configuration */
135
136#define LOONGSON_GENCFG_OFFSET 0x4
137#define LOONGSON_GENCFG LOONGSON_REG(LOONGSON_REGBASE + LOONGSON_GENCFG_OFFSET)
138
139#define LOONGSON_GENCFG_DEBUGMODE 0x00000001
140#define LOONGSON_GENCFG_SNOOPEN 0x00000002
141#define LOONGSON_GENCFG_CPUSELFRESET 0x00000004
142
143#define LOONGSON_GENCFG_FORCE_IRQA 0x00000008
144#define LOONGSON_GENCFG_IRQA_ISOUT 0x00000010
145#define LOONGSON_GENCFG_IRQA_FROM_INT1 0x00000020
146#define LOONGSON_GENCFG_BYTESWAP 0x00000040
147
148#define LOONGSON_GENCFG_UNCACHED 0x00000080
149#define LOONGSON_GENCFG_PREFETCHEN 0x00000100
150#define LOONGSON_GENCFG_WBEHINDEN 0x00000200
151#define LOONGSON_GENCFG_CACHEALG 0x00000c00
152#define LOONGSON_GENCFG_CACHEALG_SHIFT 10
153#define LOONGSON_GENCFG_PCIQUEUE 0x00001000
154#define LOONGSON_GENCFG_CACHESTOP 0x00002000
155#define LOONGSON_GENCFG_MSTRBYTESWAP 0x00004000
156#define LOONGSON_GENCFG_BUSERREN 0x00008000
157#define LOONGSON_GENCFG_NORETRYTIMEOUT 0x00010000
158#define LOONGSON_GENCFG_SHORTCOPYTIMEOUT 0x00020000
159
160/* PCI address map control */
161
162#define LOONGSON_PCIMAP LOONGSON_REG(LOONGSON_REGBASE + 0x10)
163#define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14)
164#define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18)
165
166/* GPIO Regs - r/w */
167
168#define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c)
169#define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20)
170
171/* ICU Configuration Regs - r/w */
172
173#define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24)
174#define LOONGSON_INTSTEER LOONGSON_REG(LOONGSON_REGBASE + 0x28)
175#define LOONGSON_INTPOL LOONGSON_REG(LOONGSON_REGBASE + 0x2c)
176
177/* ICU Enable Regs - IntEn & IntISR are r/o. */
178
179#define LOONGSON_INTENSET LOONGSON_REG(LOONGSON_REGBASE + 0x30)
180#define LOONGSON_INTENCLR LOONGSON_REG(LOONGSON_REGBASE + 0x34)
181#define LOONGSON_INTEN LOONGSON_REG(LOONGSON_REGBASE + 0x38)
182#define LOONGSON_INTISR LOONGSON_REG(LOONGSON_REGBASE + 0x3c)
183
184/* ICU */
185#define LOONGSON_ICU_MBOXES 0x0000000f
186#define LOONGSON_ICU_MBOXES_SHIFT 0
187#define LOONGSON_ICU_DMARDY 0x00000010
188#define LOONGSON_ICU_DMAEMPTY 0x00000020
189#define LOONGSON_ICU_COPYRDY 0x00000040
190#define LOONGSON_ICU_COPYEMPTY 0x00000080
191#define LOONGSON_ICU_COPYERR 0x00000100
192#define LOONGSON_ICU_PCIIRQ 0x00000200
193#define LOONGSON_ICU_MASTERERR 0x00000400
194#define LOONGSON_ICU_SYSTEMERR 0x00000800
195#define LOONGSON_ICU_DRAMPERR 0x00001000
196#define LOONGSON_ICU_RETRYERR 0x00002000
197#define LOONGSON_ICU_GPIOS 0x01ff0000
198#define LOONGSON_ICU_GPIOS_SHIFT 16
199#define LOONGSON_ICU_GPINS 0x7e000000
200#define LOONGSON_ICU_GPINS_SHIFT 25
201#define LOONGSON_ICU_MBOX(N) (1<<(LOONGSON_ICU_MBOXES_SHIFT+(N)))
202#define LOONGSON_ICU_GPIO(N) (1<<(LOONGSON_ICU_GPIOS_SHIFT+(N)))
203#define LOONGSON_ICU_GPIN(N) (1<<(LOONGSON_ICU_GPINS_SHIFT+(N)))
204
205/* PCI prefetch window base & mask */
206
207#define LOONGSON_MEM_WIN_BASE_L LOONGSON_REG(LOONGSON_REGBASE + 0x40)
208#define LOONGSON_MEM_WIN_BASE_H LOONGSON_REG(LOONGSON_REGBASE + 0x44)
209#define LOONGSON_MEM_WIN_MASK_L LOONGSON_REG(LOONGSON_REGBASE + 0x48)
210#define LOONGSON_MEM_WIN_MASK_H LOONGSON_REG(LOONGSON_REGBASE + 0x4c)
46 211
47/* PCI_Hit*_Sel_* */ 212/* PCI_Hit*_Sel_* */
48 213
49#define LOONGSON_PCI_HIT0_SEL_L BONITO(BONITO_REGBASE + 0x50) 214#define LOONGSON_PCI_HIT0_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x50)
50#define LOONGSON_PCI_HIT0_SEL_H BONITO(BONITO_REGBASE + 0x54) 215#define LOONGSON_PCI_HIT0_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x54)
51#define LOONGSON_PCI_HIT1_SEL_L BONITO(BONITO_REGBASE + 0x58) 216#define LOONGSON_PCI_HIT1_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x58)
52#define LOONGSON_PCI_HIT1_SEL_H BONITO(BONITO_REGBASE + 0x5c) 217#define LOONGSON_PCI_HIT1_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x5c)
53#define LOONGSON_PCI_HIT2_SEL_L BONITO(BONITO_REGBASE + 0x60) 218#define LOONGSON_PCI_HIT2_SEL_L LOONGSON_REG(LOONGSON_REGBASE + 0x60)
54#define LOONGSON_PCI_HIT2_SEL_H BONITO(BONITO_REGBASE + 0x64) 219#define LOONGSON_PCI_HIT2_SEL_H LOONGSON_REG(LOONGSON_REGBASE + 0x64)
55 220
56/* PXArb Config & Status */ 221/* PXArb Config & Status */
57 222
58#define LOONGSON_PXARB_CFG BONITO(BONITO_REGBASE + 0x68) 223#define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68)
59#define LOONGSON_PXARB_STATUS BONITO(BONITO_REGBASE + 0x6c) 224#define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c)
225
226/* pcimap */
227
228#define LOONGSON_PCIMAP_PCIMAP_LO0 0x0000003f
229#define LOONGSON_PCIMAP_PCIMAP_LO0_SHIFT 0
230#define LOONGSON_PCIMAP_PCIMAP_LO1 0x00000fc0
231#define LOONGSON_PCIMAP_PCIMAP_LO1_SHIFT 6
232#define LOONGSON_PCIMAP_PCIMAP_LO2 0x0003f000
233#define LOONGSON_PCIMAP_PCIMAP_LO2_SHIFT 12
234#define LOONGSON_PCIMAP_PCIMAP_2 0x00040000
235#define LOONGSON_PCIMAP_WIN(WIN, ADDR) \
236 ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
237
238#ifdef CONFIG_CPU_SUPPORTS_CPUFREQ
239#include <linux/cpufreq.h>
240extern void loongson2_cpu_wait(void);
241extern struct cpufreq_frequency_table loongson2_clockmod_table[];
242
243/* Chip Config */
244#define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80)
245#endif
246
247/*
248 * address windows configuration module
249 *
250 * loongson2e do not have this module
251 */
252#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
253
254/* address window config module base address */
255#define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul
256#define LOONGSON_ADDRWINCFG_SIZE 0x180
257
258extern unsigned long _loongson_addrwincfg_base;
259#define LOONGSON_ADDRWINCFG(offset) \
260 (*(volatile u64 *)(_loongson_addrwincfg_base + (offset)))
261
262#define CPU_WIN0_BASE LOONGSON_ADDRWINCFG(0x00)
263#define CPU_WIN1_BASE LOONGSON_ADDRWINCFG(0x08)
264#define CPU_WIN2_BASE LOONGSON_ADDRWINCFG(0x10)
265#define CPU_WIN3_BASE LOONGSON_ADDRWINCFG(0x18)
266
267#define CPU_WIN0_MASK LOONGSON_ADDRWINCFG(0x20)
268#define CPU_WIN1_MASK LOONGSON_ADDRWINCFG(0x28)
269#define CPU_WIN2_MASK LOONGSON_ADDRWINCFG(0x30)
270#define CPU_WIN3_MASK LOONGSON_ADDRWINCFG(0x38)
271
272#define CPU_WIN0_MMAP LOONGSON_ADDRWINCFG(0x40)
273#define CPU_WIN1_MMAP LOONGSON_ADDRWINCFG(0x48)
274#define CPU_WIN2_MMAP LOONGSON_ADDRWINCFG(0x50)
275#define CPU_WIN3_MMAP LOONGSON_ADDRWINCFG(0x58)
276
277#define PCIDMA_WIN0_BASE LOONGSON_ADDRWINCFG(0x60)
278#define PCIDMA_WIN1_BASE LOONGSON_ADDRWINCFG(0x68)
279#define PCIDMA_WIN2_BASE LOONGSON_ADDRWINCFG(0x70)
280#define PCIDMA_WIN3_BASE LOONGSON_ADDRWINCFG(0x78)
281
282#define PCIDMA_WIN0_MASK LOONGSON_ADDRWINCFG(0x80)
283#define PCIDMA_WIN1_MASK LOONGSON_ADDRWINCFG(0x88)
284#define PCIDMA_WIN2_MASK LOONGSON_ADDRWINCFG(0x90)
285#define PCIDMA_WIN3_MASK LOONGSON_ADDRWINCFG(0x98)
286
287#define PCIDMA_WIN0_MMAP LOONGSON_ADDRWINCFG(0xa0)
288#define PCIDMA_WIN1_MMAP LOONGSON_ADDRWINCFG(0xa8)
289#define PCIDMA_WIN2_MMAP LOONGSON_ADDRWINCFG(0xb0)
290#define PCIDMA_WIN3_MMAP LOONGSON_ADDRWINCFG(0xb8)
291
292#define ADDRWIN_WIN0 0
293#define ADDRWIN_WIN1 1
294#define ADDRWIN_WIN2 2
295#define ADDRWIN_WIN3 3
296
297#define ADDRWIN_MAP_DST_DDR 0
298#define ADDRWIN_MAP_DST_PCI 1
299#define ADDRWIN_MAP_DST_LIO 1
300
301/*
302 * s: CPU, PCIDMA
303 * d: DDR, PCI, LIO
304 * win: 0, 1, 2, 3
305 * src: map source
306 * dst: map destination
307 * size: ~mask + 1
308 */
309#define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\
310 s##_WIN##w##_BASE = (src); \
311 s##_WIN##w##_MMAP = (src) | ADDRWIN_MAP_DST_##d; \
312 s##_WIN##w##_MASK = ~(size-1); \
313} while (0)
314
315#define LOONGSON_ADDRWIN_CPUTOPCI(win, src, dst, size) \
316 LOONGSON_ADDRWIN_CFG(CPU, PCI, win, src, dst, size)
317#define LOONGSON_ADDRWIN_CPUTODDR(win, src, dst, size) \
318 LOONGSON_ADDRWIN_CFG(CPU, DDR, win, src, dst, size)
319#define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \
320 LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size)
60 321
61/* loongson2-specific perf counter IRQ */ 322#endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */
62#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6)
63 323
64#endif /* __ASM_MACH_LOONGSON_LOONGSON_H */ 324#endif /* __ASM_MACH_LOONGSON_LOONGSON_H */
diff --git a/arch/mips/include/asm/mach-loongson/machine.h b/arch/mips/include/asm/mach-loongson/machine.h
index 206ea2067916..acf8359cb135 100644
--- a/arch/mips/include/asm/mach-loongson/machine.h
+++ b/arch/mips/include/asm/mach-loongson/machine.h
@@ -13,10 +13,15 @@
13 13
14#ifdef CONFIG_LEMOTE_FULOONG2E 14#ifdef CONFIG_LEMOTE_FULOONG2E
15 15
16#define LOONGSON_UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
17
18#define LOONGSON_MACHTYPE MACH_LEMOTE_FL2E 16#define LOONGSON_MACHTYPE MACH_LEMOTE_FL2E
19 17
20#endif 18#endif
21 19
20/* use fuloong2f as the default machine of LEMOTE_MACH2F */
21#ifdef CONFIG_LEMOTE_MACH2F
22
23#define LOONGSON_MACHTYPE MACH_LEMOTE_FL2F
24
25#endif
26
22#endif /* __ASM_MACH_LOONGSON_MACHINE_H */ 27#endif /* __ASM_MACH_LOONGSON_MACHINE_H */
diff --git a/arch/mips/include/asm/mach-loongson/mem.h b/arch/mips/include/asm/mach-loongson/mem.h
index bd7b3cba7e35..e9960f341b96 100644
--- a/arch/mips/include/asm/mach-loongson/mem.h
+++ b/arch/mips/include/asm/mach-loongson/mem.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology 2 * Copyright (C) 2009 Lemote, Inc.
3 * Author: Wu Zhangjin <wuzj@lemote.com> 3 * Author: Wu Zhangjin <wuzj@lemote.com>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
@@ -12,19 +12,30 @@
12#define __ASM_MACH_LOONGSON_MEM_H 12#define __ASM_MACH_LOONGSON_MEM_H
13 13
14/* 14/*
15 * On Lemote Loongson 2e 15 * high memory space
16 * 16 *
17 * the high memory space starts from 512M. 17 * in loongson2e, starts from 512M
18 * the peripheral registers reside between 0x1000:0000 and 0x2000:0000. 18 * in loongson2f, starts from 2G 256M
19 */ 19 */
20#ifdef CONFIG_CPU_LOONGSON2E
21#define LOONGSON_HIGHMEM_START 0x20000000
22#else
23#define LOONGSON_HIGHMEM_START 0x90000000
24#endif
20 25
21#ifdef CONFIG_LEMOTE_FULOONG2E 26/*
22 27 * the peripheral registers(MMIO):
23#define LOONGSON_HIGHMEM_START 0x20000000 28 *
29 * On the Lemote Loongson 2e system, reside between 0x1000:0000 and 0x2000:0000.
30 * On the Lemote Loongson 2f system, reside between 0x1000:0000 and 0x8000:0000.
31 */
24 32
25#define LOONGSON_MMIO_MEM_START 0x10000000 33#define LOONGSON_MMIO_MEM_START 0x10000000
26#define LOONGSON_MMIO_MEM_END 0x20000000
27 34
35#ifdef CONFIG_CPU_LOONGSON2E
36#define LOONGSON_MMIO_MEM_END 0x20000000
37#else
38#define LOONGSON_MMIO_MEM_END 0x80000000
28#endif 39#endif
29 40
30#endif /* __ASM_MACH_LOONGSON_MEM_H */ 41#endif /* __ASM_MACH_LOONGSON_MEM_H */
diff --git a/arch/mips/include/asm/mach-loongson/pci.h b/arch/mips/include/asm/mach-loongson/pci.h
index f1663ca81da0..a199a4f6de4e 100644
--- a/arch/mips/include/asm/mach-loongson/pci.h
+++ b/arch/mips/include/asm/mach-loongson/pci.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org> 2 * Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org>
3 * Copyright (c) 2009 Wu Zhangjin <wuzj@lemote.com>
3 * 4 *
4 * This program is free software; you can redistribute it 5 * This program is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General 6 * and/or modify it under the terms of the GNU General
@@ -22,16 +23,39 @@
22#ifndef __ASM_MACH_LOONGSON_PCI_H_ 23#ifndef __ASM_MACH_LOONGSON_PCI_H_
23#define __ASM_MACH_LOONGSON_PCI_H_ 24#define __ASM_MACH_LOONGSON_PCI_H_
24 25
25extern struct pci_ops bonito64_pci_ops; 26extern struct pci_ops loongson_pci_ops;
26 27
27#ifdef CONFIG_LEMOTE_FULOONG2E 28/* this is an offset from mips_io_port_base */
29#define LOONGSON_PCI_IO_START 0x00004000UL
30
31#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
32
33/*
34 * we use address window2 to map cpu address space to pci space
35 * window2: cpu [1G, 2G] -> pci [1G, 2G]
36 * why not use window 0 & 1? because they are used by cpu when booting.
37 * window0: cpu [0, 256M] -> ddr [0, 256M]
38 * window1: cpu [256M, 512M] -> pci [256M, 512M]
39 */
40
41/* the smallest LOONGSON_CPU_MEM_SRC can be 512M */
42#define LOONGSON_CPU_MEM_SRC 0x40000000ul /* 1G */
43#define LOONGSON_PCI_MEM_DST LOONGSON_CPU_MEM_SRC
44
45#define LOONGSON_PCI_MEM_START LOONGSON_PCI_MEM_DST
46#define LOONGSON_PCI_MEM_END (0x80000000ul-1) /* 2G */
47
48#define MMAP_CPUTOPCI_SIZE (LOONGSON_PCI_MEM_END - \
49 LOONGSON_PCI_MEM_START + 1)
50
51#else /* loongson2f/32bit & loongson2e */
28 52
29/* this pci memory space is mapped by pcimap in pci.c */ 53/* this pci memory space is mapped by pcimap in pci.c */
30#define LOONGSON_PCI_MEM_START BONITO_PCILO1_BASE 54#define LOONGSON_PCI_MEM_START LOONGSON_PCILO1_BASE
31#define LOONGSON_PCI_MEM_END (BONITO_PCILO1_BASE + 0x04000000 * 2) 55#define LOONGSON_PCI_MEM_END (LOONGSON_PCILO1_BASE + 0x04000000 * 2)
32/* this is an offset from mips_io_port_base */ 56/* this is an offset from mips_io_port_base */
33#define LOONGSON_PCI_IO_START 0x00004000UL 57#define LOONGSON_PCI_IO_START 0x00004000UL
34 58
35#endif 59#endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
36 60
37#endif /* !__ASM_MACH_LOONGSON_PCI_H_ */ 61#endif /* !__ASM_MACH_LOONGSON_PCI_H_ */
diff --git a/arch/mips/include/asm/mach-powertv/asic.h b/arch/mips/include/asm/mach-powertv/asic.h
new file mode 100644
index 000000000000..bcad43a93ebf
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/asic.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_ASIC_H
20#define _ASM_MACH_POWERTV_ASIC_H
21
22#include <linux/ioport.h>
23#include <asm/mach-powertv/asic_regs.h>
24
25#define DVR_CAPABLE (1<<0)
26#define PCIE_CAPABLE (1<<1)
27#define FFS_CAPABLE (1<<2)
28#define DISPLAY_CAPABLE (1<<3)
29
30/* Platform Family types
31 * For compitability, the new value must be added in the end */
32enum family_type {
33 FAMILY_8500,
34 FAMILY_8500RNG,
35 FAMILY_4500,
36 FAMILY_1500,
37 FAMILY_8600,
38 FAMILY_4600,
39 FAMILY_4600VZA,
40 FAMILY_8600VZB,
41 FAMILY_1500VZE,
42 FAMILY_1500VZF,
43 FAMILIES
44};
45
46/* Register maps for each ASIC */
47extern const struct register_map calliope_register_map;
48extern const struct register_map cronus_register_map;
49extern const struct register_map zeus_register_map;
50
51extern struct resource dvr_cronus_resources[];
52extern struct resource dvr_zeus_resources[];
53extern struct resource non_dvr_calliope_resources[];
54extern struct resource non_dvr_cronus_resources[];
55extern struct resource non_dvr_cronuslite_resources[];
56extern struct resource non_dvr_vz_calliope_resources[];
57extern struct resource non_dvr_vze_calliope_resources[];
58extern struct resource non_dvr_vzf_calliope_resources[];
59extern struct resource non_dvr_zeus_resources[];
60
61extern void powertv_platform_init(void);
62extern void platform_alloc_bootmem(void);
63extern enum asic_type platform_get_asic(void);
64extern enum family_type platform_get_family(void);
65extern int platform_supports_dvr(void);
66extern int platform_supports_ffs(void);
67extern int platform_supports_pcie(void);
68extern int platform_supports_display(void);
69extern void configure_platform(void);
70extern void platform_configure_usb_ehci(void);
71extern void platform_unconfigure_usb_ehci(void);
72extern void platform_configure_usb_ohci(void);
73extern void platform_unconfigure_usb_ohci(void);
74
75/* Platform Resources */
76#define ASIC_RESOURCE_GET_EXISTS 1
77extern struct resource *asic_resource_get(const char *name);
78extern void platform_release_memory(void *baddr, int size);
79
80/* Reboot Cause */
81extern void set_reboot_cause(char code, unsigned int data, unsigned int data2);
82extern void set_locked_reboot_cause(char code, unsigned int data,
83 unsigned int data2);
84
85enum sys_reboot_type {
86 sys_unknown_reboot = 0x00, /* Unknown reboot cause */
87 sys_davic_change = 0x01, /* Reboot due to change in DAVIC
88 * mode */
89 sys_user_reboot = 0x02, /* Reboot initiated by user */
90 sys_system_reboot = 0x03, /* Reboot initiated by OS */
91 sys_trap_reboot = 0x04, /* Reboot due to a CPU trap */
92 sys_silent_reboot = 0x05, /* Silent reboot */
93 sys_boot_ldr_reboot = 0x06, /* Bootloader reboot */
94 sys_power_up_reboot = 0x07, /* Power on bootup. Older
95 * drivers may report as
96 * userReboot. */
97 sys_code_change = 0x08, /* Reboot to take code change.
98 * Older drivers may report as
99 * userReboot. */
100 sys_hardware_reset = 0x09, /* HW watchdog or front-panel
101 * reset button reset. Older
102 * drivers may report as
103 * userReboot. */
104 sys_watchdogInterrupt = 0x0A /* Pre-watchdog interrupt */
105};
106
107#endif /* _ASM_MACH_POWERTV_ASIC_H */
diff --git a/arch/mips/include/asm/mach-powertv/asic_regs.h b/arch/mips/include/asm/mach-powertv/asic_regs.h
new file mode 100644
index 000000000000..9a65c93782f9
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/asic_regs.h
@@ -0,0 +1,155 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef __ASM_MACH_POWERTV_ASIC_H_
20#define __ASM_MACH_POWERTV_ASIC_H_
21#include <linux/io.h>
22
23/* ASIC types */
24enum asic_type {
25 ASIC_UNKNOWN,
26 ASIC_ZEUS,
27 ASIC_CALLIOPE,
28 ASIC_CRONUS,
29 ASIC_CRONUSLITE,
30 ASICS
31};
32
33/* hardcoded values read from Chip Version registers */
34#define CRONUS_10 0x0B4C1C20
35#define CRONUS_11 0x0B4C1C21
36#define CRONUSLITE_10 0x0B4C1C40
37
38#define NAND_FLASH_BASE 0x03000000
39#define ZEUS_IO_BASE 0x09000000
40#define CALLIOPE_IO_BASE 0x08000000
41#define CRONUS_IO_BASE 0x09000000
42#define ASIC_IO_SIZE 0x01000000
43
44/* Definitions for backward compatibility */
45#define UART1_INTSTAT uart1_intstat
46#define UART1_INTEN uart1_inten
47#define UART1_CONFIG1 uart1_config1
48#define UART1_CONFIG2 uart1_config2
49#define UART1_DIVISORHI uart1_divisorhi
50#define UART1_DIVISORLO uart1_divisorlo
51#define UART1_DATA uart1_data
52#define UART1_STATUS uart1_status
53
54/* ASIC register enumeration */
55struct register_map {
56 u32 eic_slow0_strt_add;
57 u32 eic_cfg_bits;
58 u32 eic_ready_status;
59
60 u32 chipver3;
61 u32 chipver2;
62 u32 chipver1;
63 u32 chipver0;
64
65 u32 uart1_intstat;
66 u32 uart1_inten;
67 u32 uart1_config1;
68 u32 uart1_config2;
69 u32 uart1_divisorhi;
70 u32 uart1_divisorlo;
71 u32 uart1_data;
72 u32 uart1_status;
73
74 u32 int_stat_3;
75 u32 int_stat_2;
76 u32 int_stat_1;
77 u32 int_stat_0;
78 u32 int_config;
79 u32 int_int_scan;
80 u32 ien_int_3;
81 u32 ien_int_2;
82 u32 ien_int_1;
83 u32 ien_int_0;
84 u32 int_level_3_3;
85 u32 int_level_3_2;
86 u32 int_level_3_1;
87 u32 int_level_3_0;
88 u32 int_level_2_3;
89 u32 int_level_2_2;
90 u32 int_level_2_1;
91 u32 int_level_2_0;
92 u32 int_level_1_3;
93 u32 int_level_1_2;
94 u32 int_level_1_1;
95 u32 int_level_1_0;
96 u32 int_level_0_3;
97 u32 int_level_0_2;
98 u32 int_level_0_1;
99 u32 int_level_0_0;
100 u32 int_docsis_en;
101
102 u32 mips_pll_setup;
103 u32 usb_fs;
104 u32 test_bus;
105 u32 crt_spare;
106 u32 usb2_ohci_int_mask;
107 u32 usb2_strap;
108 u32 ehci_hcapbase;
109 u32 ohci_hc_revision;
110 u32 bcm1_bs_lmi_steer;
111 u32 usb2_control;
112 u32 usb2_stbus_obc;
113 u32 usb2_stbus_mess_size;
114 u32 usb2_stbus_chunk_size;
115
116 u32 pcie_regs;
117 u32 tim_ch;
118 u32 tim_cl;
119 u32 gpio_dout;
120 u32 gpio_din;
121 u32 gpio_dir;
122 u32 watchdog;
123 u32 front_panel;
124
125 u32 register_maps;
126};
127
128extern enum asic_type asic;
129extern const struct register_map *register_map;
130extern unsigned long asic_phy_base; /* Physical address of ASIC */
131extern unsigned long asic_base; /* Virtual address of ASIC */
132
133/*
134 * Macros to interface to registers through their ioremapped address
135 * asic_reg_offset Returns the offset of a given register from the start
136 * of the ASIC address space
137 * asic_reg_phys_addr Returns the physical address of the given register
138 * asic_reg_addr Returns the iomapped virtual address of the given
139 * register.
140 */
141#define asic_reg_offset(x) (register_map->x)
142#define asic_reg_phys_addr(x) (asic_phy_base + asic_reg_offset(x))
143#define asic_reg_addr(x) \
144 ((unsigned int *) (asic_base + asic_reg_offset(x)))
145
146/*
147 * The asic_reg macro is gone. It should be replaced by either asic_read or
148 * asic_write, as appropriate.
149 */
150
151#define asic_read(x) readl(asic_reg_addr(x))
152#define asic_write(v, x) writel(v, asic_reg_addr(x))
153
154extern void asic_irq_init(void);
155#endif
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
new file mode 100644
index 000000000000..5b8d5ebeb838
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
@@ -0,0 +1,119 @@
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 * Version from mach-generic modified to support PowerTV port
7 * Portions Copyright (C) 2009 Cisco Systems, Inc.
8 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
9 *
10 */
11
12#ifndef __ASM_MACH_POWERTV_DMA_COHERENCE_H
13#define __ASM_MACH_POWERTV_DMA_COHERENCE_H
14
15#include <linux/sched.h>
16#include <linux/version.h>
17#include <linux/device.h>
18#include <asm/mach-powertv/asic.h>
19
20static inline bool is_kseg2(void *addr)
21{
22 return (unsigned long)addr >= KSEG2;
23}
24
25static inline unsigned long virt_to_phys_from_pte(void *addr)
26{
27 pgd_t *pgd;
28 pud_t *pud;
29 pmd_t *pmd;
30 pte_t *ptep, pte;
31
32 unsigned long virt_addr = (unsigned long)addr;
33 unsigned long phys_addr = 0UL;
34
35 /* get the page global directory. */
36 pgd = pgd_offset_k(virt_addr);
37
38 if (!pgd_none(*pgd)) {
39 /* get the page upper directory */
40 pud = pud_offset(pgd, virt_addr);
41 if (!pud_none(*pud)) {
42 /* get the page middle directory */
43 pmd = pmd_offset(pud, virt_addr);
44 if (!pmd_none(*pmd)) {
45 /* get a pointer to the page table entry */
46 ptep = pte_offset(pmd, virt_addr);
47 pte = *ptep;
48 /* check for a valid page */
49 if (pte_present(pte)) {
50 /* get the physical address the page is
51 * refering to */
52 phys_addr = (unsigned long)
53 page_to_phys(pte_page(pte));
54 /* add the offset within the page */
55 phys_addr |= (virt_addr & ~PAGE_MASK);
56 }
57 }
58 }
59 }
60
61 return phys_addr;
62}
63
64static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
65 size_t size)
66{
67 if (is_kseg2(addr))
68 return phys_to_bus(virt_to_phys_from_pte(addr));
69 else
70 return phys_to_bus(virt_to_phys(addr));
71}
72
73static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
74 struct page *page)
75{
76 return phys_to_bus(page_to_phys(page));
77}
78
79static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
80 dma_addr_t dma_addr)
81{
82 return bus_to_phys(dma_addr);
83}
84
85static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
86 size_t size, enum dma_data_direction direction)
87{
88}
89
90static inline int plat_dma_supported(struct device *dev, u64 mask)
91{
92 /*
93 * we fall back to GFP_DMA when the mask isn't all 1s,
94 * so we can't guarantee allocations that must be
95 * within a tighter range than GFP_DMA..
96 */
97 if (mask < DMA_BIT_MASK(24))
98 return 0;
99
100 return 1;
101}
102
103static inline void plat_extra_sync_for_device(struct device *dev)
104{
105 return;
106}
107
108static inline int plat_dma_mapping_error(struct device *dev,
109 dma_addr_t dma_addr)
110{
111 return 0;
112}
113
114static inline int plat_device_is_coherent(struct device *dev)
115{
116 return 0;
117}
118
119#endif /* __ASM_MACH_POWERTV_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/mach-powertv/interrupts.h b/arch/mips/include/asm/mach-powertv/interrupts.h
new file mode 100644
index 000000000000..629a57413657
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/interrupts.h
@@ -0,0 +1,254 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_INTERRUPTS_H_
20#define _ASM_MACH_POWERTV_INTERRUPTS_H_
21
22/*
23 * Defines for all of the interrupt lines
24 */
25
26/* Definitions for backward compatibility */
27#define kIrq_Uart1 irq_uart1
28
29#define ibase 0
30
31/*------------- Register: int_stat_3 */
32/* 126 unused (bit 31) */
33#define irq_asc2video (ibase+126) /* ASC 2 Video Interrupt */
34#define irq_asc1video (ibase+125) /* ASC 1 Video Interrupt */
35#define irq_comms_block_wd (ibase+124) /* ASC 1 Video Interrupt */
36#define irq_fdma_mailbox (ibase+123) /* FDMA Mailbox Output */
37#define irq_fdma_gp (ibase+122) /* FDMA GP Output */
38#define irq_mips_pic (ibase+121) /* MIPS Performance Counter
39 * Interrupt */
40#define irq_mips_timer (ibase+120) /* MIPS Timer Interrupt */
41#define irq_memory_protect (ibase+119) /* Memory Protection Interrupt
42 * -- Ored by glue logic inside
43 * SPARC ILC (see
44 * INT_MEM_PROT_STAT, below,
45 * for individual interrupts)
46 */
47/* 118 unused (bit 22) */
48#define irq_sbag (ibase+117) /* SBAG Interrupt -- Ored by
49 * glue logic inside SPARC ILC
50 * (see INT_SBAG_STAT, below,
51 * for individual interrupts) */
52#define irq_qam_b_fec (ibase+116) /* QAM B FEC Interrupt */
53#define irq_qam_a_fec (ibase+115) /* QAM A FEC Interrupt */
54/* 114 unused (bit 18) */
55#define irq_mailbox (ibase+113) /* Mailbox Debug Interrupt --
56 * Ored by glue logic inside
57 * SPARC ILC (see
58 * INT_MAILBOX_STAT, below, for
59 * individual interrupts) */
60#define irq_fuse_stat1 (ibase+112) /* Fuse Status 1 */
61#define irq_fuse_stat2 (ibase+111) /* Fuse Status 2 */
62#define irq_fuse_stat3 (ibase+110) /* Blitter Interrupt / Fuse
63 * Status 3 */
64#define irq_blitter (ibase+110) /* Blitter Interrupt / Fuse
65 * Status 3 */
66#define irq_avc1_pp0 (ibase+109) /* AVC Decoder #1 PP0
67 * Interrupt */
68#define irq_avc1_pp1 (ibase+108) /* AVC Decoder #1 PP1
69 * Interrupt */
70#define irq_avc1_mbe (ibase+107) /* AVC Decoder #1 MBE
71 * Interrupt */
72#define irq_avc2_pp0 (ibase+106) /* AVC Decoder #2 PP0
73 * Interrupt */
74#define irq_avc2_pp1 (ibase+105) /* AVC Decoder #2 PP1
75 * Interrupt */
76#define irq_avc2_mbe (ibase+104) /* AVC Decoder #2 MBE
77 * Interrupt */
78#define irq_zbug_spi (ibase+103) /* Zbug SPI Slave Interrupt */
79#define irq_qam_mod2 (ibase+102) /* QAM Modulator 2 DMA
80 * Interrupt */
81#define irq_ir_rx (ibase+101) /* IR RX 2 Interrupt */
82#define irq_aud_dsp2 (ibase+100) /* Audio DSP #2 Interrupt */
83#define irq_aud_dsp1 (ibase+99) /* Audio DSP #1 Interrupt */
84#define irq_docsis (ibase+98) /* DOCSIS Debug Interrupt */
85#define irq_sd_dvp1 (ibase+97) /* SD DVP #1 Interrupt */
86#define irq_sd_dvp2 (ibase+96) /* SD DVP #2 Interrupt */
87/*------------- Register: int_stat_2 */
88#define irq_hd_dvp (ibase+95) /* HD DVP Interrupt */
89#define kIrq_Prewatchdog (ibase+94) /* watchdog Pre-Interrupt */
90#define irq_timer2 (ibase+93) /* Programmable Timer
91 * Interrupt 2 */
92#define irq_1394 (ibase+92) /* 1394 Firewire Interrupt */
93#define irq_usbohci (ibase+91) /* USB 2.0 OHCI Interrupt */
94#define irq_usbehci (ibase+90) /* USB 2.0 EHCI Interrupt */
95#define irq_pciexp (ibase+89) /* PCI Express 0 Interrupt */
96#define irq_pciexp0 (ibase+89) /* PCI Express 0 Interrupt */
97#define irq_afe1 (ibase+88) /* AFE 1 Interrupt */
98#define irq_sata (ibase+87) /* SATA 1 Interrupt */
99#define irq_sata1 (ibase+87) /* SATA 1 Interrupt */
100#define irq_dtcp (ibase+86) /* DTCP Interrupt */
101#define irq_pciexp1 (ibase+85) /* PCI Express 1 Interrupt */
102/* 84 unused (bit 20) */
103/* 83 unused (bit 19) */
104/* 82 unused (bit 18) */
105#define irq_sata2 (ibase+81) /* SATA2 Interrupt */
106#define irq_uart2 (ibase+80) /* UART2 Interrupt */
107#define irq_legacy_usb (ibase+79) /* Legacy USB Host ISR (1.1
108 * Host module) */
109#define irq_pod (ibase+78) /* POD Interrupt */
110#define irq_slave_usb (ibase+77) /* Slave USB */
111#define irq_denc1 (ibase+76) /* DENC #1 VTG Interrupt */
112#define irq_vbi_vtg (ibase+75) /* VBI VTG Interrupt */
113#define irq_afe2 (ibase+74) /* AFE 2 Interrupt */
114#define irq_denc2 (ibase+73) /* DENC #2 VTG Interrupt */
115#define irq_asc2 (ibase+72) /* ASC #2 Interrupt */
116#define irq_asc1 (ibase+71) /* ASC #1 Interrupt */
117#define irq_mod_dma (ibase+70) /* Modulator DMA Interrupt */
118#define irq_byte_eng1 (ibase+69) /* Byte Engine Interrupt [1] */
119#define irq_byte_eng0 (ibase+68) /* Byte Engine Interrupt [0] */
120/* 67 unused (bit 03) */
121/* 66 unused (bit 02) */
122/* 65 unused (bit 01) */
123/* 64 unused (bit 00) */
124/*------------- Register: int_stat_1 */
125/* 63 unused (bit 31) */
126/* 62 unused (bit 30) */
127/* 61 unused (bit 29) */
128/* 60 unused (bit 28) */
129/* 59 unused (bit 27) */
130/* 58 unused (bit 26) */
131/* 57 unused (bit 25) */
132/* 56 unused (bit 24) */
133#define irq_buf_dma_mem2mem (ibase+55) /* BufDMA Memory to Memory
134 * Interrupt */
135#define irq_buf_dma_usbtransmit (ibase+54) /* BufDMA USB Transmit
136 * Interrupt */
137#define irq_buf_dma_qpskpodtransmit (ibase+53) /* BufDMA QPSK/POD Tramsit
138 * Interrupt */
139#define irq_buf_dma_transmit_error (ibase+52) /* BufDMA Transmit Error
140 * Interrupt */
141#define irq_buf_dma_usbrecv (ibase+51) /* BufDMA USB Receive
142 * Interrupt */
143#define irq_buf_dma_qpskpodrecv (ibase+50) /* BufDMA QPSK/POD Receive
144 * Interrupt */
145#define irq_buf_dma_recv_error (ibase+49) /* BufDMA Receive Error
146 * Interrupt */
147#define irq_qamdma_transmit_play (ibase+48) /* QAMDMA Transmit/Play
148 * Interrupt */
149#define irq_qamdma_transmit_error (ibase+47) /* QAMDMA Transmit Error
150 * Interrupt */
151#define irq_qamdma_recv2high (ibase+46) /* QAMDMA Receive 2 High
152 * (Chans 63-32) */
153#define irq_qamdma_recv2low (ibase+45) /* QAMDMA Receive 2 Low
154 * (Chans 31-0) */
155#define irq_qamdma_recv1high (ibase+44) /* QAMDMA Receive 1 High
156 * (Chans 63-32) */
157#define irq_qamdma_recv1low (ibase+43) /* QAMDMA Receive 1 Low
158 * (Chans 31-0) */
159#define irq_qamdma_recv_error (ibase+42) /* QAMDMA Receive Error
160 * Interrupt */
161#define irq_mpegsplice (ibase+41) /* MPEG Splice Interrupt */
162#define irq_deinterlace_rdy (ibase+40) /* Deinterlacer Frame Ready
163 * Interrupt */
164#define irq_ext_in0 (ibase+39) /* External Interrupt irq_in0 */
165#define irq_gpio3 (ibase+38) /* GP I/O IRQ 3 - From GP I/O
166 * Module */
167#define irq_gpio2 (ibase+37) /* GP I/O IRQ 2 - From GP I/O
168 * Module (ABE_intN) */
169#define irq_pcrcmplt1 (ibase+36) /* PCR Capture Complete or
170 * Discontinuity 1 */
171#define irq_pcrcmplt2 (ibase+35) /* PCR Capture Complete or
172 * Discontinuity 2 */
173#define irq_parse_peierr (ibase+34) /* PID Parser Error Detect
174 * (PEI) */
175#define irq_parse_cont_err (ibase+33) /* PID Parser continuity error
176 * detect */
177#define irq_ds1framer (ibase+32) /* DS1 Framer Interrupt */
178/*------------- Register: int_stat_0 */
179#define irq_gpio1 (ibase+31) /* GP I/O IRQ 1 - From GP I/O
180 * Module */
181#define irq_gpio0 (ibase+30) /* GP I/O IRQ 0 - From GP I/O
182 * Module */
183#define irq_qpsk_out_aloha (ibase+29) /* QPSK Output Slotted Aloha
184 * (chan 3) Transmission
185 * Completed OK */
186#define irq_qpsk_out_tdma (ibase+28) /* QPSK Output TDMA (chan 2)
187 * Transmission Completed OK */
188#define irq_qpsk_out_reserve (ibase+27) /* QPSK Output Reservation
189 * (chan 1) Transmission
190 * Completed OK */
191#define irq_qpsk_out_aloha_err (ibase+26) /* QPSK Output Slotted Aloha
192 * (chan 3)Transmission
193 * completed with Errors. */
194#define irq_qpsk_out_tdma_err (ibase+25) /* QPSK Output TDMA (chan 2)
195 * Transmission completed with
196 * Errors. */
197#define irq_qpsk_out_rsrv_err (ibase+24) /* QPSK Output Reservation
198 * (chan 1) Transmission
199 * completed with Errors */
200#define irq_aloha_fail (ibase+23) /* Unsuccessful Resend of Aloha
201 * for N times. Aloha retry
202 * timeout for channel 3. */
203#define irq_timer1 (ibase+22) /* Programmable Timer
204 * Interrupt */
205#define irq_keyboard (ibase+21) /* Keyboard Module Interrupt */
206#define irq_i2c (ibase+20) /* I2C Module Interrupt */
207#define irq_spi (ibase+19) /* SPI Module Interrupt */
208#define irq_irblaster (ibase+18) /* IR Blaster Interrupt */
209#define irq_splice_detect (ibase+17) /* PID Key Change Interrupt or
210 * Splice Detect Interrupt */
211#define irq_se_micro (ibase+16) /* Secure Micro I/F Module
212 * Interrupt */
213#define irq_uart1 (ibase+15) /* UART Interrupt */
214#define irq_irrecv (ibase+14) /* IR Receiver Interrupt */
215#define irq_host_int1 (ibase+13) /* Host-to-Host Interrupt 1 */
216#define irq_host_int0 (ibase+12) /* Host-to-Host Interrupt 0 */
217#define irq_qpsk_hecerr (ibase+11) /* QPSK HEC Error Interrupt */
218#define irq_qpsk_crcerr (ibase+10) /* QPSK AAL-5 CRC Error
219 * Interrupt */
220/* 9 unused (bit 09) */
221/* 8 unused (bit 08) */
222#define irq_psicrcerr (ibase+7) /* QAM PSI CRC Error
223 * Interrupt */
224#define irq_psilength_err (ibase+6) /* QAM PSI Length Error
225 * Interrupt */
226#define irq_esfforward (ibase+5) /* ESF Interrupt Mark From
227 * Forward Path Reference -
228 * every 3ms when forward Mbits
229 * and forward slot control
230 * bytes are updated. */
231#define irq_esfreverse (ibase+4) /* ESF Interrupt Mark from
232 * Reverse Path Reference -
233 * delayed from forward mark by
234 * the ranging delay plus a
235 * fixed amount. When reverse
236 * Mbits and reverse slot
237 * control bytes are updated.
238 * Occurs every 3ms for 3.0M and
239 * 1.554 M upstream rates and
240 * every 6 ms for 256K upstream
241 * rate. */
242#define irq_aloha_timeout (ibase+3) /* Slotted-Aloha timeout on
243 * Channel 1. */
244#define irq_reservation (ibase+2) /* Partial (or Incremental)
245 * Reservation Message Completed
246 * or Slotted aloha verify for
247 * channel 1. */
248#define irq_aloha3 (ibase+1) /* Slotted-Aloha Message Verify
249 * Interrupt or Reservation
250 * increment completed for
251 * channel 3. */
252#define irq_mpeg_d (ibase+0) /* MPEG Decoder Interrupt */
253#endif /* _ASM_MACH_POWERTV_INTERRUPTS_H_ */
254
diff --git a/arch/mips/include/asm/mach-powertv/ioremap.h b/arch/mips/include/asm/mach-powertv/ioremap.h
new file mode 100644
index 000000000000..e6276d5146e8
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/ioremap.h
@@ -0,0 +1,90 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 *
7 * Portions Copyright (C) Cisco Systems, Inc.
8 */
9#ifndef __ASM_MACH_POWERTV_IOREMAP_H
10#define __ASM_MACH_POWERTV_IOREMAP_H
11
12#include <linux/types.h>
13
14#define LOW_MEM_BOUNDARY_PHYS 0x20000000
15#define LOW_MEM_BOUNDARY_MASK (~(LOW_MEM_BOUNDARY_PHYS - 1))
16
17/*
18 * The bus addresses are different than the physical addresses that
19 * the processor sees by an offset. This offset varies by ASIC
20 * version. Define a variable to hold the offset and some macros to
21 * make the conversion simpler. */
22extern unsigned long phys_to_bus_offset;
23
24#ifdef CONFIG_HIGHMEM
25#define MEM_GAP_PHYS 0x60000000
26/*
27 * TODO: We will use the hard code for conversion between physical and
28 * bus until the bootloader releases their device tree to us.
29 */
30#define phys_to_bus(x) (((x) < LOW_MEM_BOUNDARY_PHYS) ? \
31 ((x) + phys_to_bus_offset) : (x))
32#define bus_to_phys(x) (((x) < MEM_GAP_PHYS_ADDR) ? \
33 ((x) - phys_to_bus_offset) : (x))
34#else
35#define phys_to_bus(x) ((x) + phys_to_bus_offset)
36#define bus_to_phys(x) ((x) - phys_to_bus_offset)
37#endif
38
39/*
40 * Determine whether the address we are given is for an ASIC device
41 * Params: addr Address to check
42 * Returns: Zero if the address is not for ASIC devices, non-zero
43 * if it is.
44 */
45static inline int asic_is_device_addr(phys_t addr)
46{
47 return !((phys_t)addr & (phys_t) LOW_MEM_BOUNDARY_MASK);
48}
49
50/*
51 * Determine whether the address we are given is external RAM mappable
52 * into KSEG1.
53 * Params: addr Address to check
54 * Returns: Zero if the address is not for external RAM and
55 */
56static inline int asic_is_lowmem_ram_addr(phys_t addr)
57{
58 /*
59 * The RAM always starts at the following address in the processor's
60 * physical address space
61 */
62 static const phys_t phys_ram_base = 0x10000000;
63 phys_t bus_ram_base;
64
65 bus_ram_base = phys_to_bus_offset + phys_ram_base;
66
67 return addr >= bus_ram_base &&
68 addr < (bus_ram_base + (LOW_MEM_BOUNDARY_PHYS - phys_ram_base));
69}
70
71/*
72 * Allow physical addresses to be fixed up to help peripherals located
73 * outside the low 32-bit range -- generic pass-through version.
74 */
75static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
76{
77 return phys_addr;
78}
79
80static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
81 unsigned long flags)
82{
83 return NULL;
84}
85
86static inline int plat_iounmap(const volatile void __iomem *addr)
87{
88 return 0;
89}
90#endif /* __ASM_MACH_POWERTV_IOREMAP_H */
diff --git a/arch/mips/include/asm/mach-powertv/irq.h b/arch/mips/include/asm/mach-powertv/irq.h
new file mode 100644
index 000000000000..4bd5d0c61a91
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/irq.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef _ASM_MACH_POWERTV_IRQ_H
20#define _ASM_MACH_POWERTV_IRQ_H
21#include <asm/mach-powertv/interrupts.h>
22
23#define MIPS_CPU_IRQ_BASE ibase
24#define NR_IRQS 127
25#endif
diff --git a/arch/mips/include/asm/mach-powertv/powertv-clock.h b/arch/mips/include/asm/mach-powertv/powertv-clock.h
new file mode 100644
index 000000000000..6f3e9a0fcf8c
--- /dev/null
+++ b/arch/mips/include/asm/mach-powertv/powertv-clock.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18/*
19 * Local definitions for the powertv PCI code
20 */
21
22#ifndef _POWERTV_PCI_POWERTV_PCI_H_
23#define _POWERTV_PCI_POWERTV_PCI_H_
24extern int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
25extern int asic_pcie_init(void);
26extern int asic_pcie_init(void);
27
28extern int log_level;
29#endif
diff --git a/arch/mips/include/asm/mach-excite/war.h b/arch/mips/include/asm/mach-powertv/war.h
index 1f82180c1598..7ac05ecc512b 100644
--- a/arch/mips/include/asm/mach-excite/war.h
+++ b/arch/mips/include/asm/mach-powertv/war.h
@@ -3,10 +3,13 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * This version for the PowerTV platform copied from the Malta version.
7 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org> 8 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
9 * Portions copyright (C) 2009 Cisco Systems, Inc.
7 */ 10 */
8#ifndef __ASM_MIPS_MACH_EXCITE_WAR_H 11#ifndef __ASM_MACH_POWERTV_WAR_H
9#define __ASM_MIPS_MACH_EXCITE_WAR_H 12#define __ASM_MACH_POWERTV_WAR_H
10 13
11#define R4600_V1_INDEX_ICACHEOP_WAR 0 14#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0 15#define R4600_V1_HIT_CACHEOP_WAR 0
@@ -14,12 +17,12 @@
14#define R5432_CP0_INTERRUPT_WAR 0 17#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0 18#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0 19#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0 20#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 0 21#define MIPS_CACHE_SYNC_WAR 1
19#define TX49XX_ICACHE_INDEX_INV_WAR 0 22#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 1 23#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1 24#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0 25#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0 26#define MIPS34K_MISSED_ITLB_WAR 0
24 27
25#endif /* __ASM_MIPS_MACH_EXCITE_WAR_H */ 28#endif /* __ASM_MACH_POWERTV_WAR_H */
diff --git a/arch/mips/include/asm/mips-boards/bonito64.h b/arch/mips/include/asm/mips-boards/bonito64.h
index a576ce044c3c..d14e2adc4be5 100644
--- a/arch/mips/include/asm/mips-boards/bonito64.h
+++ b/arch/mips/include/asm/mips-boards/bonito64.h
@@ -26,11 +26,6 @@
26/* offsets from base register */ 26/* offsets from base register */
27#define BONITO(x) (x) 27#define BONITO(x) (x)
28 28
29#elif defined(CONFIG_LEMOTE_FULOONG2E)
30
31#define BONITO(x) (*(volatile u32 *)((char *)CKSEG1ADDR(BONITO_REG_BASE) + (x)))
32#define BONITO_IRQ_BASE 32
33
34#else 29#else
35 30
36/* 31/*
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 6083db586500..145bb81ccaa5 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -24,6 +24,33 @@
24#endif /* SMTC */ 24#endif /* SMTC */
25#include <asm-generic/mm_hooks.h> 25#include <asm-generic/mm_hooks.h>
26 26
27#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
28
29#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
30 tlbmiss_handler_setup_pgd((unsigned long)(pgd))
31
32static inline void tlbmiss_handler_setup_pgd(unsigned long pgd)
33{
34 /* Check for swapper_pg_dir and convert to physical address. */
35 if ((pgd & CKSEG3) == CKSEG0)
36 pgd = CPHYSADDR(pgd);
37 write_c0_context(pgd << 11);
38}
39
40#define TLBMISS_HANDLER_SETUP() \
41 do { \
42 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \
43 write_c0_xcontext((unsigned long) smp_processor_id() << 51); \
44 } while (0)
45
46
47static inline unsigned long get_current_pgd(void)
48{
49 return PHYS_TO_XKSEG_CACHED((read_c0_context() >> 11) & ~0xfffUL);
50}
51
52#else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/
53
27/* 54/*
28 * For the fast tlb miss handlers, we keep a per cpu array of pointers 55 * For the fast tlb miss handlers, we keep a per cpu array of pointers
29 * to the current pgd for each processor. Also, the proc. id is stuffed 56 * to the current pgd for each processor. Also, the proc. id is stuffed
@@ -46,7 +73,7 @@ extern unsigned long pgd_current[];
46 back_to_back_c0_hazard(); \ 73 back_to_back_c0_hazard(); \
47 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 74 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
48#endif 75#endif
49 76#endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/
50#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) 77#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
51 78
52#define ASID_INC 0x40 79#define ASID_INC 0x40
diff --git a/arch/mips/include/asm/octeon/cvmx-agl-defs.h b/arch/mips/include/asm/octeon/cvmx-agl-defs.h
new file mode 100644
index 000000000000..ec94b9ab7be1
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-agl-defs.h
@@ -0,0 +1,1194 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_AGL_DEFS_H__
29#define __CVMX_AGL_DEFS_H__
30
31#define CVMX_AGL_GMX_BAD_REG \
32 CVMX_ADD_IO_SEG(0x00011800E0000518ull)
33#define CVMX_AGL_GMX_BIST \
34 CVMX_ADD_IO_SEG(0x00011800E0000400ull)
35#define CVMX_AGL_GMX_DRV_CTL \
36 CVMX_ADD_IO_SEG(0x00011800E00007F0ull)
37#define CVMX_AGL_GMX_INF_MODE \
38 CVMX_ADD_IO_SEG(0x00011800E00007F8ull)
39#define CVMX_AGL_GMX_PRTX_CFG(offset) \
40 CVMX_ADD_IO_SEG(0x00011800E0000010ull + (((offset) & 1) * 2048))
41#define CVMX_AGL_GMX_RXX_ADR_CAM0(offset) \
42 CVMX_ADD_IO_SEG(0x00011800E0000180ull + (((offset) & 1) * 2048))
43#define CVMX_AGL_GMX_RXX_ADR_CAM1(offset) \
44 CVMX_ADD_IO_SEG(0x00011800E0000188ull + (((offset) & 1) * 2048))
45#define CVMX_AGL_GMX_RXX_ADR_CAM2(offset) \
46 CVMX_ADD_IO_SEG(0x00011800E0000190ull + (((offset) & 1) * 2048))
47#define CVMX_AGL_GMX_RXX_ADR_CAM3(offset) \
48 CVMX_ADD_IO_SEG(0x00011800E0000198ull + (((offset) & 1) * 2048))
49#define CVMX_AGL_GMX_RXX_ADR_CAM4(offset) \
50 CVMX_ADD_IO_SEG(0x00011800E00001A0ull + (((offset) & 1) * 2048))
51#define CVMX_AGL_GMX_RXX_ADR_CAM5(offset) \
52 CVMX_ADD_IO_SEG(0x00011800E00001A8ull + (((offset) & 1) * 2048))
53#define CVMX_AGL_GMX_RXX_ADR_CAM_EN(offset) \
54 CVMX_ADD_IO_SEG(0x00011800E0000108ull + (((offset) & 1) * 2048))
55#define CVMX_AGL_GMX_RXX_ADR_CTL(offset) \
56 CVMX_ADD_IO_SEG(0x00011800E0000100ull + (((offset) & 1) * 2048))
57#define CVMX_AGL_GMX_RXX_DECISION(offset) \
58 CVMX_ADD_IO_SEG(0x00011800E0000040ull + (((offset) & 1) * 2048))
59#define CVMX_AGL_GMX_RXX_FRM_CHK(offset) \
60 CVMX_ADD_IO_SEG(0x00011800E0000020ull + (((offset) & 1) * 2048))
61#define CVMX_AGL_GMX_RXX_FRM_CTL(offset) \
62 CVMX_ADD_IO_SEG(0x00011800E0000018ull + (((offset) & 1) * 2048))
63#define CVMX_AGL_GMX_RXX_FRM_MAX(offset) \
64 CVMX_ADD_IO_SEG(0x00011800E0000030ull + (((offset) & 1) * 2048))
65#define CVMX_AGL_GMX_RXX_FRM_MIN(offset) \
66 CVMX_ADD_IO_SEG(0x00011800E0000028ull + (((offset) & 1) * 2048))
67#define CVMX_AGL_GMX_RXX_IFG(offset) \
68 CVMX_ADD_IO_SEG(0x00011800E0000058ull + (((offset) & 1) * 2048))
69#define CVMX_AGL_GMX_RXX_INT_EN(offset) \
70 CVMX_ADD_IO_SEG(0x00011800E0000008ull + (((offset) & 1) * 2048))
71#define CVMX_AGL_GMX_RXX_INT_REG(offset) \
72 CVMX_ADD_IO_SEG(0x00011800E0000000ull + (((offset) & 1) * 2048))
73#define CVMX_AGL_GMX_RXX_JABBER(offset) \
74 CVMX_ADD_IO_SEG(0x00011800E0000038ull + (((offset) & 1) * 2048))
75#define CVMX_AGL_GMX_RXX_PAUSE_DROP_TIME(offset) \
76 CVMX_ADD_IO_SEG(0x00011800E0000068ull + (((offset) & 1) * 2048))
77#define CVMX_AGL_GMX_RXX_STATS_CTL(offset) \
78 CVMX_ADD_IO_SEG(0x00011800E0000050ull + (((offset) & 1) * 2048))
79#define CVMX_AGL_GMX_RXX_STATS_OCTS(offset) \
80 CVMX_ADD_IO_SEG(0x00011800E0000088ull + (((offset) & 1) * 2048))
81#define CVMX_AGL_GMX_RXX_STATS_OCTS_CTL(offset) \
82 CVMX_ADD_IO_SEG(0x00011800E0000098ull + (((offset) & 1) * 2048))
83#define CVMX_AGL_GMX_RXX_STATS_OCTS_DMAC(offset) \
84 CVMX_ADD_IO_SEG(0x00011800E00000A8ull + (((offset) & 1) * 2048))
85#define CVMX_AGL_GMX_RXX_STATS_OCTS_DRP(offset) \
86 CVMX_ADD_IO_SEG(0x00011800E00000B8ull + (((offset) & 1) * 2048))
87#define CVMX_AGL_GMX_RXX_STATS_PKTS(offset) \
88 CVMX_ADD_IO_SEG(0x00011800E0000080ull + (((offset) & 1) * 2048))
89#define CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(offset) \
90 CVMX_ADD_IO_SEG(0x00011800E00000C0ull + (((offset) & 1) * 2048))
91#define CVMX_AGL_GMX_RXX_STATS_PKTS_CTL(offset) \
92 CVMX_ADD_IO_SEG(0x00011800E0000090ull + (((offset) & 1) * 2048))
93#define CVMX_AGL_GMX_RXX_STATS_PKTS_DMAC(offset) \
94 CVMX_ADD_IO_SEG(0x00011800E00000A0ull + (((offset) & 1) * 2048))
95#define CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(offset) \
96 CVMX_ADD_IO_SEG(0x00011800E00000B0ull + (((offset) & 1) * 2048))
97#define CVMX_AGL_GMX_RXX_UDD_SKP(offset) \
98 CVMX_ADD_IO_SEG(0x00011800E0000048ull + (((offset) & 1) * 2048))
99#define CVMX_AGL_GMX_RX_BP_DROPX(offset) \
100 CVMX_ADD_IO_SEG(0x00011800E0000420ull + (((offset) & 1) * 8))
101#define CVMX_AGL_GMX_RX_BP_OFFX(offset) \
102 CVMX_ADD_IO_SEG(0x00011800E0000460ull + (((offset) & 1) * 8))
103#define CVMX_AGL_GMX_RX_BP_ONX(offset) \
104 CVMX_ADD_IO_SEG(0x00011800E0000440ull + (((offset) & 1) * 8))
105#define CVMX_AGL_GMX_RX_PRT_INFO \
106 CVMX_ADD_IO_SEG(0x00011800E00004E8ull)
107#define CVMX_AGL_GMX_RX_TX_STATUS \
108 CVMX_ADD_IO_SEG(0x00011800E00007E8ull)
109#define CVMX_AGL_GMX_SMACX(offset) \
110 CVMX_ADD_IO_SEG(0x00011800E0000230ull + (((offset) & 1) * 2048))
111#define CVMX_AGL_GMX_STAT_BP \
112 CVMX_ADD_IO_SEG(0x00011800E0000520ull)
113#define CVMX_AGL_GMX_TXX_APPEND(offset) \
114 CVMX_ADD_IO_SEG(0x00011800E0000218ull + (((offset) & 1) * 2048))
115#define CVMX_AGL_GMX_TXX_CTL(offset) \
116 CVMX_ADD_IO_SEG(0x00011800E0000270ull + (((offset) & 1) * 2048))
117#define CVMX_AGL_GMX_TXX_MIN_PKT(offset) \
118 CVMX_ADD_IO_SEG(0x00011800E0000240ull + (((offset) & 1) * 2048))
119#define CVMX_AGL_GMX_TXX_PAUSE_PKT_INTERVAL(offset) \
120 CVMX_ADD_IO_SEG(0x00011800E0000248ull + (((offset) & 1) * 2048))
121#define CVMX_AGL_GMX_TXX_PAUSE_PKT_TIME(offset) \
122 CVMX_ADD_IO_SEG(0x00011800E0000238ull + (((offset) & 1) * 2048))
123#define CVMX_AGL_GMX_TXX_PAUSE_TOGO(offset) \
124 CVMX_ADD_IO_SEG(0x00011800E0000258ull + (((offset) & 1) * 2048))
125#define CVMX_AGL_GMX_TXX_PAUSE_ZERO(offset) \
126 CVMX_ADD_IO_SEG(0x00011800E0000260ull + (((offset) & 1) * 2048))
127#define CVMX_AGL_GMX_TXX_SOFT_PAUSE(offset) \
128 CVMX_ADD_IO_SEG(0x00011800E0000250ull + (((offset) & 1) * 2048))
129#define CVMX_AGL_GMX_TXX_STAT0(offset) \
130 CVMX_ADD_IO_SEG(0x00011800E0000280ull + (((offset) & 1) * 2048))
131#define CVMX_AGL_GMX_TXX_STAT1(offset) \
132 CVMX_ADD_IO_SEG(0x00011800E0000288ull + (((offset) & 1) * 2048))
133#define CVMX_AGL_GMX_TXX_STAT2(offset) \
134 CVMX_ADD_IO_SEG(0x00011800E0000290ull + (((offset) & 1) * 2048))
135#define CVMX_AGL_GMX_TXX_STAT3(offset) \
136 CVMX_ADD_IO_SEG(0x00011800E0000298ull + (((offset) & 1) * 2048))
137#define CVMX_AGL_GMX_TXX_STAT4(offset) \
138 CVMX_ADD_IO_SEG(0x00011800E00002A0ull + (((offset) & 1) * 2048))
139#define CVMX_AGL_GMX_TXX_STAT5(offset) \
140 CVMX_ADD_IO_SEG(0x00011800E00002A8ull + (((offset) & 1) * 2048))
141#define CVMX_AGL_GMX_TXX_STAT6(offset) \
142 CVMX_ADD_IO_SEG(0x00011800E00002B0ull + (((offset) & 1) * 2048))
143#define CVMX_AGL_GMX_TXX_STAT7(offset) \
144 CVMX_ADD_IO_SEG(0x00011800E00002B8ull + (((offset) & 1) * 2048))
145#define CVMX_AGL_GMX_TXX_STAT8(offset) \
146 CVMX_ADD_IO_SEG(0x00011800E00002C0ull + (((offset) & 1) * 2048))
147#define CVMX_AGL_GMX_TXX_STAT9(offset) \
148 CVMX_ADD_IO_SEG(0x00011800E00002C8ull + (((offset) & 1) * 2048))
149#define CVMX_AGL_GMX_TXX_STATS_CTL(offset) \
150 CVMX_ADD_IO_SEG(0x00011800E0000268ull + (((offset) & 1) * 2048))
151#define CVMX_AGL_GMX_TXX_THRESH(offset) \
152 CVMX_ADD_IO_SEG(0x00011800E0000210ull + (((offset) & 1) * 2048))
153#define CVMX_AGL_GMX_TX_BP \
154 CVMX_ADD_IO_SEG(0x00011800E00004D0ull)
155#define CVMX_AGL_GMX_TX_COL_ATTEMPT \
156 CVMX_ADD_IO_SEG(0x00011800E0000498ull)
157#define CVMX_AGL_GMX_TX_IFG \
158 CVMX_ADD_IO_SEG(0x00011800E0000488ull)
159#define CVMX_AGL_GMX_TX_INT_EN \
160 CVMX_ADD_IO_SEG(0x00011800E0000508ull)
161#define CVMX_AGL_GMX_TX_INT_REG \
162 CVMX_ADD_IO_SEG(0x00011800E0000500ull)
163#define CVMX_AGL_GMX_TX_JAM \
164 CVMX_ADD_IO_SEG(0x00011800E0000490ull)
165#define CVMX_AGL_GMX_TX_LFSR \
166 CVMX_ADD_IO_SEG(0x00011800E00004F8ull)
167#define CVMX_AGL_GMX_TX_OVR_BP \
168 CVMX_ADD_IO_SEG(0x00011800E00004C8ull)
169#define CVMX_AGL_GMX_TX_PAUSE_PKT_DMAC \
170 CVMX_ADD_IO_SEG(0x00011800E00004A0ull)
171#define CVMX_AGL_GMX_TX_PAUSE_PKT_TYPE \
172 CVMX_ADD_IO_SEG(0x00011800E00004A8ull)
173
174union cvmx_agl_gmx_bad_reg {
175 uint64_t u64;
176 struct cvmx_agl_gmx_bad_reg_s {
177 uint64_t reserved_38_63:26;
178 uint64_t txpsh1:1;
179 uint64_t txpop1:1;
180 uint64_t ovrflw1:1;
181 uint64_t txpsh:1;
182 uint64_t txpop:1;
183 uint64_t ovrflw:1;
184 uint64_t reserved_27_31:5;
185 uint64_t statovr:1;
186 uint64_t reserved_23_25:3;
187 uint64_t loststat:1;
188 uint64_t reserved_4_21:18;
189 uint64_t out_ovr:2;
190 uint64_t reserved_0_1:2;
191 } s;
192 struct cvmx_agl_gmx_bad_reg_s cn52xx;
193 struct cvmx_agl_gmx_bad_reg_s cn52xxp1;
194 struct cvmx_agl_gmx_bad_reg_cn56xx {
195 uint64_t reserved_35_63:29;
196 uint64_t txpsh:1;
197 uint64_t txpop:1;
198 uint64_t ovrflw:1;
199 uint64_t reserved_27_31:5;
200 uint64_t statovr:1;
201 uint64_t reserved_23_25:3;
202 uint64_t loststat:1;
203 uint64_t reserved_3_21:19;
204 uint64_t out_ovr:1;
205 uint64_t reserved_0_1:2;
206 } cn56xx;
207 struct cvmx_agl_gmx_bad_reg_cn56xx cn56xxp1;
208};
209
210union cvmx_agl_gmx_bist {
211 uint64_t u64;
212 struct cvmx_agl_gmx_bist_s {
213 uint64_t reserved_10_63:54;
214 uint64_t status:10;
215 } s;
216 struct cvmx_agl_gmx_bist_s cn52xx;
217 struct cvmx_agl_gmx_bist_s cn52xxp1;
218 struct cvmx_agl_gmx_bist_s cn56xx;
219 struct cvmx_agl_gmx_bist_s cn56xxp1;
220};
221
222union cvmx_agl_gmx_drv_ctl {
223 uint64_t u64;
224 struct cvmx_agl_gmx_drv_ctl_s {
225 uint64_t reserved_49_63:15;
226 uint64_t byp_en1:1;
227 uint64_t reserved_45_47:3;
228 uint64_t pctl1:5;
229 uint64_t reserved_37_39:3;
230 uint64_t nctl1:5;
231 uint64_t reserved_17_31:15;
232 uint64_t byp_en:1;
233 uint64_t reserved_13_15:3;
234 uint64_t pctl:5;
235 uint64_t reserved_5_7:3;
236 uint64_t nctl:5;
237 } s;
238 struct cvmx_agl_gmx_drv_ctl_s cn52xx;
239 struct cvmx_agl_gmx_drv_ctl_s cn52xxp1;
240 struct cvmx_agl_gmx_drv_ctl_cn56xx {
241 uint64_t reserved_17_63:47;
242 uint64_t byp_en:1;
243 uint64_t reserved_13_15:3;
244 uint64_t pctl:5;
245 uint64_t reserved_5_7:3;
246 uint64_t nctl:5;
247 } cn56xx;
248 struct cvmx_agl_gmx_drv_ctl_cn56xx cn56xxp1;
249};
250
251union cvmx_agl_gmx_inf_mode {
252 uint64_t u64;
253 struct cvmx_agl_gmx_inf_mode_s {
254 uint64_t reserved_2_63:62;
255 uint64_t en:1;
256 uint64_t reserved_0_0:1;
257 } s;
258 struct cvmx_agl_gmx_inf_mode_s cn52xx;
259 struct cvmx_agl_gmx_inf_mode_s cn52xxp1;
260 struct cvmx_agl_gmx_inf_mode_s cn56xx;
261 struct cvmx_agl_gmx_inf_mode_s cn56xxp1;
262};
263
264union cvmx_agl_gmx_prtx_cfg {
265 uint64_t u64;
266 struct cvmx_agl_gmx_prtx_cfg_s {
267 uint64_t reserved_6_63:58;
268 uint64_t tx_en:1;
269 uint64_t rx_en:1;
270 uint64_t slottime:1;
271 uint64_t duplex:1;
272 uint64_t speed:1;
273 uint64_t en:1;
274 } s;
275 struct cvmx_agl_gmx_prtx_cfg_s cn52xx;
276 struct cvmx_agl_gmx_prtx_cfg_s cn52xxp1;
277 struct cvmx_agl_gmx_prtx_cfg_s cn56xx;
278 struct cvmx_agl_gmx_prtx_cfg_s cn56xxp1;
279};
280
281union cvmx_agl_gmx_rxx_adr_cam0 {
282 uint64_t u64;
283 struct cvmx_agl_gmx_rxx_adr_cam0_s {
284 uint64_t adr:64;
285 } s;
286 struct cvmx_agl_gmx_rxx_adr_cam0_s cn52xx;
287 struct cvmx_agl_gmx_rxx_adr_cam0_s cn52xxp1;
288 struct cvmx_agl_gmx_rxx_adr_cam0_s cn56xx;
289 struct cvmx_agl_gmx_rxx_adr_cam0_s cn56xxp1;
290};
291
292union cvmx_agl_gmx_rxx_adr_cam1 {
293 uint64_t u64;
294 struct cvmx_agl_gmx_rxx_adr_cam1_s {
295 uint64_t adr:64;
296 } s;
297 struct cvmx_agl_gmx_rxx_adr_cam1_s cn52xx;
298 struct cvmx_agl_gmx_rxx_adr_cam1_s cn52xxp1;
299 struct cvmx_agl_gmx_rxx_adr_cam1_s cn56xx;
300 struct cvmx_agl_gmx_rxx_adr_cam1_s cn56xxp1;
301};
302
303union cvmx_agl_gmx_rxx_adr_cam2 {
304 uint64_t u64;
305 struct cvmx_agl_gmx_rxx_adr_cam2_s {
306 uint64_t adr:64;
307 } s;
308 struct cvmx_agl_gmx_rxx_adr_cam2_s cn52xx;
309 struct cvmx_agl_gmx_rxx_adr_cam2_s cn52xxp1;
310 struct cvmx_agl_gmx_rxx_adr_cam2_s cn56xx;
311 struct cvmx_agl_gmx_rxx_adr_cam2_s cn56xxp1;
312};
313
314union cvmx_agl_gmx_rxx_adr_cam3 {
315 uint64_t u64;
316 struct cvmx_agl_gmx_rxx_adr_cam3_s {
317 uint64_t adr:64;
318 } s;
319 struct cvmx_agl_gmx_rxx_adr_cam3_s cn52xx;
320 struct cvmx_agl_gmx_rxx_adr_cam3_s cn52xxp1;
321 struct cvmx_agl_gmx_rxx_adr_cam3_s cn56xx;
322 struct cvmx_agl_gmx_rxx_adr_cam3_s cn56xxp1;
323};
324
325union cvmx_agl_gmx_rxx_adr_cam4 {
326 uint64_t u64;
327 struct cvmx_agl_gmx_rxx_adr_cam4_s {
328 uint64_t adr:64;
329 } s;
330 struct cvmx_agl_gmx_rxx_adr_cam4_s cn52xx;
331 struct cvmx_agl_gmx_rxx_adr_cam4_s cn52xxp1;
332 struct cvmx_agl_gmx_rxx_adr_cam4_s cn56xx;
333 struct cvmx_agl_gmx_rxx_adr_cam4_s cn56xxp1;
334};
335
336union cvmx_agl_gmx_rxx_adr_cam5 {
337 uint64_t u64;
338 struct cvmx_agl_gmx_rxx_adr_cam5_s {
339 uint64_t adr:64;
340 } s;
341 struct cvmx_agl_gmx_rxx_adr_cam5_s cn52xx;
342 struct cvmx_agl_gmx_rxx_adr_cam5_s cn52xxp1;
343 struct cvmx_agl_gmx_rxx_adr_cam5_s cn56xx;
344 struct cvmx_agl_gmx_rxx_adr_cam5_s cn56xxp1;
345};
346
347union cvmx_agl_gmx_rxx_adr_cam_en {
348 uint64_t u64;
349 struct cvmx_agl_gmx_rxx_adr_cam_en_s {
350 uint64_t reserved_8_63:56;
351 uint64_t en:8;
352 } s;
353 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn52xx;
354 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn52xxp1;
355 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn56xx;
356 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn56xxp1;
357};
358
359union cvmx_agl_gmx_rxx_adr_ctl {
360 uint64_t u64;
361 struct cvmx_agl_gmx_rxx_adr_ctl_s {
362 uint64_t reserved_4_63:60;
363 uint64_t cam_mode:1;
364 uint64_t mcst:2;
365 uint64_t bcst:1;
366 } s;
367 struct cvmx_agl_gmx_rxx_adr_ctl_s cn52xx;
368 struct cvmx_agl_gmx_rxx_adr_ctl_s cn52xxp1;
369 struct cvmx_agl_gmx_rxx_adr_ctl_s cn56xx;
370 struct cvmx_agl_gmx_rxx_adr_ctl_s cn56xxp1;
371};
372
373union cvmx_agl_gmx_rxx_decision {
374 uint64_t u64;
375 struct cvmx_agl_gmx_rxx_decision_s {
376 uint64_t reserved_5_63:59;
377 uint64_t cnt:5;
378 } s;
379 struct cvmx_agl_gmx_rxx_decision_s cn52xx;
380 struct cvmx_agl_gmx_rxx_decision_s cn52xxp1;
381 struct cvmx_agl_gmx_rxx_decision_s cn56xx;
382 struct cvmx_agl_gmx_rxx_decision_s cn56xxp1;
383};
384
385union cvmx_agl_gmx_rxx_frm_chk {
386 uint64_t u64;
387 struct cvmx_agl_gmx_rxx_frm_chk_s {
388 uint64_t reserved_9_63:55;
389 uint64_t skperr:1;
390 uint64_t rcverr:1;
391 uint64_t lenerr:1;
392 uint64_t alnerr:1;
393 uint64_t fcserr:1;
394 uint64_t jabber:1;
395 uint64_t maxerr:1;
396 uint64_t reserved_1_1:1;
397 uint64_t minerr:1;
398 } s;
399 struct cvmx_agl_gmx_rxx_frm_chk_s cn52xx;
400 struct cvmx_agl_gmx_rxx_frm_chk_s cn52xxp1;
401 struct cvmx_agl_gmx_rxx_frm_chk_s cn56xx;
402 struct cvmx_agl_gmx_rxx_frm_chk_s cn56xxp1;
403};
404
405union cvmx_agl_gmx_rxx_frm_ctl {
406 uint64_t u64;
407 struct cvmx_agl_gmx_rxx_frm_ctl_s {
408 uint64_t reserved_10_63:54;
409 uint64_t pre_align:1;
410 uint64_t pad_len:1;
411 uint64_t vlan_len:1;
412 uint64_t pre_free:1;
413 uint64_t ctl_smac:1;
414 uint64_t ctl_mcst:1;
415 uint64_t ctl_bck:1;
416 uint64_t ctl_drp:1;
417 uint64_t pre_strp:1;
418 uint64_t pre_chk:1;
419 } s;
420 struct cvmx_agl_gmx_rxx_frm_ctl_s cn52xx;
421 struct cvmx_agl_gmx_rxx_frm_ctl_s cn52xxp1;
422 struct cvmx_agl_gmx_rxx_frm_ctl_s cn56xx;
423 struct cvmx_agl_gmx_rxx_frm_ctl_s cn56xxp1;
424};
425
426union cvmx_agl_gmx_rxx_frm_max {
427 uint64_t u64;
428 struct cvmx_agl_gmx_rxx_frm_max_s {
429 uint64_t reserved_16_63:48;
430 uint64_t len:16;
431 } s;
432 struct cvmx_agl_gmx_rxx_frm_max_s cn52xx;
433 struct cvmx_agl_gmx_rxx_frm_max_s cn52xxp1;
434 struct cvmx_agl_gmx_rxx_frm_max_s cn56xx;
435 struct cvmx_agl_gmx_rxx_frm_max_s cn56xxp1;
436};
437
438union cvmx_agl_gmx_rxx_frm_min {
439 uint64_t u64;
440 struct cvmx_agl_gmx_rxx_frm_min_s {
441 uint64_t reserved_16_63:48;
442 uint64_t len:16;
443 } s;
444 struct cvmx_agl_gmx_rxx_frm_min_s cn52xx;
445 struct cvmx_agl_gmx_rxx_frm_min_s cn52xxp1;
446 struct cvmx_agl_gmx_rxx_frm_min_s cn56xx;
447 struct cvmx_agl_gmx_rxx_frm_min_s cn56xxp1;
448};
449
450union cvmx_agl_gmx_rxx_ifg {
451 uint64_t u64;
452 struct cvmx_agl_gmx_rxx_ifg_s {
453 uint64_t reserved_4_63:60;
454 uint64_t ifg:4;
455 } s;
456 struct cvmx_agl_gmx_rxx_ifg_s cn52xx;
457 struct cvmx_agl_gmx_rxx_ifg_s cn52xxp1;
458 struct cvmx_agl_gmx_rxx_ifg_s cn56xx;
459 struct cvmx_agl_gmx_rxx_ifg_s cn56xxp1;
460};
461
462union cvmx_agl_gmx_rxx_int_en {
463 uint64_t u64;
464 struct cvmx_agl_gmx_rxx_int_en_s {
465 uint64_t reserved_20_63:44;
466 uint64_t pause_drp:1;
467 uint64_t reserved_16_18:3;
468 uint64_t ifgerr:1;
469 uint64_t coldet:1;
470 uint64_t falerr:1;
471 uint64_t rsverr:1;
472 uint64_t pcterr:1;
473 uint64_t ovrerr:1;
474 uint64_t reserved_9_9:1;
475 uint64_t skperr:1;
476 uint64_t rcverr:1;
477 uint64_t lenerr:1;
478 uint64_t alnerr:1;
479 uint64_t fcserr:1;
480 uint64_t jabber:1;
481 uint64_t maxerr:1;
482 uint64_t reserved_1_1:1;
483 uint64_t minerr:1;
484 } s;
485 struct cvmx_agl_gmx_rxx_int_en_s cn52xx;
486 struct cvmx_agl_gmx_rxx_int_en_s cn52xxp1;
487 struct cvmx_agl_gmx_rxx_int_en_s cn56xx;
488 struct cvmx_agl_gmx_rxx_int_en_s cn56xxp1;
489};
490
491union cvmx_agl_gmx_rxx_int_reg {
492 uint64_t u64;
493 struct cvmx_agl_gmx_rxx_int_reg_s {
494 uint64_t reserved_20_63:44;
495 uint64_t pause_drp:1;
496 uint64_t reserved_16_18:3;
497 uint64_t ifgerr:1;
498 uint64_t coldet:1;
499 uint64_t falerr:1;
500 uint64_t rsverr:1;
501 uint64_t pcterr:1;
502 uint64_t ovrerr:1;
503 uint64_t reserved_9_9:1;
504 uint64_t skperr:1;
505 uint64_t rcverr:1;
506 uint64_t lenerr:1;
507 uint64_t alnerr:1;
508 uint64_t fcserr:1;
509 uint64_t jabber:1;
510 uint64_t maxerr:1;
511 uint64_t reserved_1_1:1;
512 uint64_t minerr:1;
513 } s;
514 struct cvmx_agl_gmx_rxx_int_reg_s cn52xx;
515 struct cvmx_agl_gmx_rxx_int_reg_s cn52xxp1;
516 struct cvmx_agl_gmx_rxx_int_reg_s cn56xx;
517 struct cvmx_agl_gmx_rxx_int_reg_s cn56xxp1;
518};
519
520union cvmx_agl_gmx_rxx_jabber {
521 uint64_t u64;
522 struct cvmx_agl_gmx_rxx_jabber_s {
523 uint64_t reserved_16_63:48;
524 uint64_t cnt:16;
525 } s;
526 struct cvmx_agl_gmx_rxx_jabber_s cn52xx;
527 struct cvmx_agl_gmx_rxx_jabber_s cn52xxp1;
528 struct cvmx_agl_gmx_rxx_jabber_s cn56xx;
529 struct cvmx_agl_gmx_rxx_jabber_s cn56xxp1;
530};
531
532union cvmx_agl_gmx_rxx_pause_drop_time {
533 uint64_t u64;
534 struct cvmx_agl_gmx_rxx_pause_drop_time_s {
535 uint64_t reserved_16_63:48;
536 uint64_t status:16;
537 } s;
538 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn52xx;
539 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn52xxp1;
540 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn56xx;
541 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn56xxp1;
542};
543
544union cvmx_agl_gmx_rxx_stats_ctl {
545 uint64_t u64;
546 struct cvmx_agl_gmx_rxx_stats_ctl_s {
547 uint64_t reserved_1_63:63;
548 uint64_t rd_clr:1;
549 } s;
550 struct cvmx_agl_gmx_rxx_stats_ctl_s cn52xx;
551 struct cvmx_agl_gmx_rxx_stats_ctl_s cn52xxp1;
552 struct cvmx_agl_gmx_rxx_stats_ctl_s cn56xx;
553 struct cvmx_agl_gmx_rxx_stats_ctl_s cn56xxp1;
554};
555
556union cvmx_agl_gmx_rxx_stats_octs {
557 uint64_t u64;
558 struct cvmx_agl_gmx_rxx_stats_octs_s {
559 uint64_t reserved_48_63:16;
560 uint64_t cnt:48;
561 } s;
562 struct cvmx_agl_gmx_rxx_stats_octs_s cn52xx;
563 struct cvmx_agl_gmx_rxx_stats_octs_s cn52xxp1;
564 struct cvmx_agl_gmx_rxx_stats_octs_s cn56xx;
565 struct cvmx_agl_gmx_rxx_stats_octs_s cn56xxp1;
566};
567
568union cvmx_agl_gmx_rxx_stats_octs_ctl {
569 uint64_t u64;
570 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s {
571 uint64_t reserved_48_63:16;
572 uint64_t cnt:48;
573 } s;
574 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn52xx;
575 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn52xxp1;
576 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn56xx;
577 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn56xxp1;
578};
579
580union cvmx_agl_gmx_rxx_stats_octs_dmac {
581 uint64_t u64;
582 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s {
583 uint64_t reserved_48_63:16;
584 uint64_t cnt:48;
585 } s;
586 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn52xx;
587 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn52xxp1;
588 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn56xx;
589 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn56xxp1;
590};
591
592union cvmx_agl_gmx_rxx_stats_octs_drp {
593 uint64_t u64;
594 struct cvmx_agl_gmx_rxx_stats_octs_drp_s {
595 uint64_t reserved_48_63:16;
596 uint64_t cnt:48;
597 } s;
598 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn52xx;
599 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn52xxp1;
600 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn56xx;
601 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn56xxp1;
602};
603
604union cvmx_agl_gmx_rxx_stats_pkts {
605 uint64_t u64;
606 struct cvmx_agl_gmx_rxx_stats_pkts_s {
607 uint64_t reserved_32_63:32;
608 uint64_t cnt:32;
609 } s;
610 struct cvmx_agl_gmx_rxx_stats_pkts_s cn52xx;
611 struct cvmx_agl_gmx_rxx_stats_pkts_s cn52xxp1;
612 struct cvmx_agl_gmx_rxx_stats_pkts_s cn56xx;
613 struct cvmx_agl_gmx_rxx_stats_pkts_s cn56xxp1;
614};
615
616union cvmx_agl_gmx_rxx_stats_pkts_bad {
617 uint64_t u64;
618 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s {
619 uint64_t reserved_32_63:32;
620 uint64_t cnt:32;
621 } s;
622 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn52xx;
623 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn52xxp1;
624 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn56xx;
625 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn56xxp1;
626};
627
628union cvmx_agl_gmx_rxx_stats_pkts_ctl {
629 uint64_t u64;
630 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s {
631 uint64_t reserved_32_63:32;
632 uint64_t cnt:32;
633 } s;
634 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn52xx;
635 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn52xxp1;
636 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn56xx;
637 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn56xxp1;
638};
639
640union cvmx_agl_gmx_rxx_stats_pkts_dmac {
641 uint64_t u64;
642 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s {
643 uint64_t reserved_32_63:32;
644 uint64_t cnt:32;
645 } s;
646 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn52xx;
647 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn52xxp1;
648 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn56xx;
649 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn56xxp1;
650};
651
652union cvmx_agl_gmx_rxx_stats_pkts_drp {
653 uint64_t u64;
654 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s {
655 uint64_t reserved_32_63:32;
656 uint64_t cnt:32;
657 } s;
658 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn52xx;
659 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn52xxp1;
660 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn56xx;
661 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn56xxp1;
662};
663
664union cvmx_agl_gmx_rxx_udd_skp {
665 uint64_t u64;
666 struct cvmx_agl_gmx_rxx_udd_skp_s {
667 uint64_t reserved_9_63:55;
668 uint64_t fcssel:1;
669 uint64_t reserved_7_7:1;
670 uint64_t len:7;
671 } s;
672 struct cvmx_agl_gmx_rxx_udd_skp_s cn52xx;
673 struct cvmx_agl_gmx_rxx_udd_skp_s cn52xxp1;
674 struct cvmx_agl_gmx_rxx_udd_skp_s cn56xx;
675 struct cvmx_agl_gmx_rxx_udd_skp_s cn56xxp1;
676};
677
678union cvmx_agl_gmx_rx_bp_dropx {
679 uint64_t u64;
680 struct cvmx_agl_gmx_rx_bp_dropx_s {
681 uint64_t reserved_6_63:58;
682 uint64_t mark:6;
683 } s;
684 struct cvmx_agl_gmx_rx_bp_dropx_s cn52xx;
685 struct cvmx_agl_gmx_rx_bp_dropx_s cn52xxp1;
686 struct cvmx_agl_gmx_rx_bp_dropx_s cn56xx;
687 struct cvmx_agl_gmx_rx_bp_dropx_s cn56xxp1;
688};
689
690union cvmx_agl_gmx_rx_bp_offx {
691 uint64_t u64;
692 struct cvmx_agl_gmx_rx_bp_offx_s {
693 uint64_t reserved_6_63:58;
694 uint64_t mark:6;
695 } s;
696 struct cvmx_agl_gmx_rx_bp_offx_s cn52xx;
697 struct cvmx_agl_gmx_rx_bp_offx_s cn52xxp1;
698 struct cvmx_agl_gmx_rx_bp_offx_s cn56xx;
699 struct cvmx_agl_gmx_rx_bp_offx_s cn56xxp1;
700};
701
702union cvmx_agl_gmx_rx_bp_onx {
703 uint64_t u64;
704 struct cvmx_agl_gmx_rx_bp_onx_s {
705 uint64_t reserved_9_63:55;
706 uint64_t mark:9;
707 } s;
708 struct cvmx_agl_gmx_rx_bp_onx_s cn52xx;
709 struct cvmx_agl_gmx_rx_bp_onx_s cn52xxp1;
710 struct cvmx_agl_gmx_rx_bp_onx_s cn56xx;
711 struct cvmx_agl_gmx_rx_bp_onx_s cn56xxp1;
712};
713
714union cvmx_agl_gmx_rx_prt_info {
715 uint64_t u64;
716 struct cvmx_agl_gmx_rx_prt_info_s {
717 uint64_t reserved_18_63:46;
718 uint64_t drop:2;
719 uint64_t reserved_2_15:14;
720 uint64_t commit:2;
721 } s;
722 struct cvmx_agl_gmx_rx_prt_info_s cn52xx;
723 struct cvmx_agl_gmx_rx_prt_info_s cn52xxp1;
724 struct cvmx_agl_gmx_rx_prt_info_cn56xx {
725 uint64_t reserved_17_63:47;
726 uint64_t drop:1;
727 uint64_t reserved_1_15:15;
728 uint64_t commit:1;
729 } cn56xx;
730 struct cvmx_agl_gmx_rx_prt_info_cn56xx cn56xxp1;
731};
732
733union cvmx_agl_gmx_rx_tx_status {
734 uint64_t u64;
735 struct cvmx_agl_gmx_rx_tx_status_s {
736 uint64_t reserved_6_63:58;
737 uint64_t tx:2;
738 uint64_t reserved_2_3:2;
739 uint64_t rx:2;
740 } s;
741 struct cvmx_agl_gmx_rx_tx_status_s cn52xx;
742 struct cvmx_agl_gmx_rx_tx_status_s cn52xxp1;
743 struct cvmx_agl_gmx_rx_tx_status_cn56xx {
744 uint64_t reserved_5_63:59;
745 uint64_t tx:1;
746 uint64_t reserved_1_3:3;
747 uint64_t rx:1;
748 } cn56xx;
749 struct cvmx_agl_gmx_rx_tx_status_cn56xx cn56xxp1;
750};
751
752union cvmx_agl_gmx_smacx {
753 uint64_t u64;
754 struct cvmx_agl_gmx_smacx_s {
755 uint64_t reserved_48_63:16;
756 uint64_t smac:48;
757 } s;
758 struct cvmx_agl_gmx_smacx_s cn52xx;
759 struct cvmx_agl_gmx_smacx_s cn52xxp1;
760 struct cvmx_agl_gmx_smacx_s cn56xx;
761 struct cvmx_agl_gmx_smacx_s cn56xxp1;
762};
763
764union cvmx_agl_gmx_stat_bp {
765 uint64_t u64;
766 struct cvmx_agl_gmx_stat_bp_s {
767 uint64_t reserved_17_63:47;
768 uint64_t bp:1;
769 uint64_t cnt:16;
770 } s;
771 struct cvmx_agl_gmx_stat_bp_s cn52xx;
772 struct cvmx_agl_gmx_stat_bp_s cn52xxp1;
773 struct cvmx_agl_gmx_stat_bp_s cn56xx;
774 struct cvmx_agl_gmx_stat_bp_s cn56xxp1;
775};
776
777union cvmx_agl_gmx_txx_append {
778 uint64_t u64;
779 struct cvmx_agl_gmx_txx_append_s {
780 uint64_t reserved_4_63:60;
781 uint64_t force_fcs:1;
782 uint64_t fcs:1;
783 uint64_t pad:1;
784 uint64_t preamble:1;
785 } s;
786 struct cvmx_agl_gmx_txx_append_s cn52xx;
787 struct cvmx_agl_gmx_txx_append_s cn52xxp1;
788 struct cvmx_agl_gmx_txx_append_s cn56xx;
789 struct cvmx_agl_gmx_txx_append_s cn56xxp1;
790};
791
792union cvmx_agl_gmx_txx_ctl {
793 uint64_t u64;
794 struct cvmx_agl_gmx_txx_ctl_s {
795 uint64_t reserved_2_63:62;
796 uint64_t xsdef_en:1;
797 uint64_t xscol_en:1;
798 } s;
799 struct cvmx_agl_gmx_txx_ctl_s cn52xx;
800 struct cvmx_agl_gmx_txx_ctl_s cn52xxp1;
801 struct cvmx_agl_gmx_txx_ctl_s cn56xx;
802 struct cvmx_agl_gmx_txx_ctl_s cn56xxp1;
803};
804
805union cvmx_agl_gmx_txx_min_pkt {
806 uint64_t u64;
807 struct cvmx_agl_gmx_txx_min_pkt_s {
808 uint64_t reserved_8_63:56;
809 uint64_t min_size:8;
810 } s;
811 struct cvmx_agl_gmx_txx_min_pkt_s cn52xx;
812 struct cvmx_agl_gmx_txx_min_pkt_s cn52xxp1;
813 struct cvmx_agl_gmx_txx_min_pkt_s cn56xx;
814 struct cvmx_agl_gmx_txx_min_pkt_s cn56xxp1;
815};
816
817union cvmx_agl_gmx_txx_pause_pkt_interval {
818 uint64_t u64;
819 struct cvmx_agl_gmx_txx_pause_pkt_interval_s {
820 uint64_t reserved_16_63:48;
821 uint64_t interval:16;
822 } s;
823 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn52xx;
824 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn52xxp1;
825 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn56xx;
826 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn56xxp1;
827};
828
829union cvmx_agl_gmx_txx_pause_pkt_time {
830 uint64_t u64;
831 struct cvmx_agl_gmx_txx_pause_pkt_time_s {
832 uint64_t reserved_16_63:48;
833 uint64_t time:16;
834 } s;
835 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn52xx;
836 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn52xxp1;
837 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn56xx;
838 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn56xxp1;
839};
840
841union cvmx_agl_gmx_txx_pause_togo {
842 uint64_t u64;
843 struct cvmx_agl_gmx_txx_pause_togo_s {
844 uint64_t reserved_16_63:48;
845 uint64_t time:16;
846 } s;
847 struct cvmx_agl_gmx_txx_pause_togo_s cn52xx;
848 struct cvmx_agl_gmx_txx_pause_togo_s cn52xxp1;
849 struct cvmx_agl_gmx_txx_pause_togo_s cn56xx;
850 struct cvmx_agl_gmx_txx_pause_togo_s cn56xxp1;
851};
852
853union cvmx_agl_gmx_txx_pause_zero {
854 uint64_t u64;
855 struct cvmx_agl_gmx_txx_pause_zero_s {
856 uint64_t reserved_1_63:63;
857 uint64_t send:1;
858 } s;
859 struct cvmx_agl_gmx_txx_pause_zero_s cn52xx;
860 struct cvmx_agl_gmx_txx_pause_zero_s cn52xxp1;
861 struct cvmx_agl_gmx_txx_pause_zero_s cn56xx;
862 struct cvmx_agl_gmx_txx_pause_zero_s cn56xxp1;
863};
864
865union cvmx_agl_gmx_txx_soft_pause {
866 uint64_t u64;
867 struct cvmx_agl_gmx_txx_soft_pause_s {
868 uint64_t reserved_16_63:48;
869 uint64_t time:16;
870 } s;
871 struct cvmx_agl_gmx_txx_soft_pause_s cn52xx;
872 struct cvmx_agl_gmx_txx_soft_pause_s cn52xxp1;
873 struct cvmx_agl_gmx_txx_soft_pause_s cn56xx;
874 struct cvmx_agl_gmx_txx_soft_pause_s cn56xxp1;
875};
876
877union cvmx_agl_gmx_txx_stat0 {
878 uint64_t u64;
879 struct cvmx_agl_gmx_txx_stat0_s {
880 uint64_t xsdef:32;
881 uint64_t xscol:32;
882 } s;
883 struct cvmx_agl_gmx_txx_stat0_s cn52xx;
884 struct cvmx_agl_gmx_txx_stat0_s cn52xxp1;
885 struct cvmx_agl_gmx_txx_stat0_s cn56xx;
886 struct cvmx_agl_gmx_txx_stat0_s cn56xxp1;
887};
888
889union cvmx_agl_gmx_txx_stat1 {
890 uint64_t u64;
891 struct cvmx_agl_gmx_txx_stat1_s {
892 uint64_t scol:32;
893 uint64_t mcol:32;
894 } s;
895 struct cvmx_agl_gmx_txx_stat1_s cn52xx;
896 struct cvmx_agl_gmx_txx_stat1_s cn52xxp1;
897 struct cvmx_agl_gmx_txx_stat1_s cn56xx;
898 struct cvmx_agl_gmx_txx_stat1_s cn56xxp1;
899};
900
901union cvmx_agl_gmx_txx_stat2 {
902 uint64_t u64;
903 struct cvmx_agl_gmx_txx_stat2_s {
904 uint64_t reserved_48_63:16;
905 uint64_t octs:48;
906 } s;
907 struct cvmx_agl_gmx_txx_stat2_s cn52xx;
908 struct cvmx_agl_gmx_txx_stat2_s cn52xxp1;
909 struct cvmx_agl_gmx_txx_stat2_s cn56xx;
910 struct cvmx_agl_gmx_txx_stat2_s cn56xxp1;
911};
912
913union cvmx_agl_gmx_txx_stat3 {
914 uint64_t u64;
915 struct cvmx_agl_gmx_txx_stat3_s {
916 uint64_t reserved_32_63:32;
917 uint64_t pkts:32;
918 } s;
919 struct cvmx_agl_gmx_txx_stat3_s cn52xx;
920 struct cvmx_agl_gmx_txx_stat3_s cn52xxp1;
921 struct cvmx_agl_gmx_txx_stat3_s cn56xx;
922 struct cvmx_agl_gmx_txx_stat3_s cn56xxp1;
923};
924
925union cvmx_agl_gmx_txx_stat4 {
926 uint64_t u64;
927 struct cvmx_agl_gmx_txx_stat4_s {
928 uint64_t hist1:32;
929 uint64_t hist0:32;
930 } s;
931 struct cvmx_agl_gmx_txx_stat4_s cn52xx;
932 struct cvmx_agl_gmx_txx_stat4_s cn52xxp1;
933 struct cvmx_agl_gmx_txx_stat4_s cn56xx;
934 struct cvmx_agl_gmx_txx_stat4_s cn56xxp1;
935};
936
937union cvmx_agl_gmx_txx_stat5 {
938 uint64_t u64;
939 struct cvmx_agl_gmx_txx_stat5_s {
940 uint64_t hist3:32;
941 uint64_t hist2:32;
942 } s;
943 struct cvmx_agl_gmx_txx_stat5_s cn52xx;
944 struct cvmx_agl_gmx_txx_stat5_s cn52xxp1;
945 struct cvmx_agl_gmx_txx_stat5_s cn56xx;
946 struct cvmx_agl_gmx_txx_stat5_s cn56xxp1;
947};
948
949union cvmx_agl_gmx_txx_stat6 {
950 uint64_t u64;
951 struct cvmx_agl_gmx_txx_stat6_s {
952 uint64_t hist5:32;
953 uint64_t hist4:32;
954 } s;
955 struct cvmx_agl_gmx_txx_stat6_s cn52xx;
956 struct cvmx_agl_gmx_txx_stat6_s cn52xxp1;
957 struct cvmx_agl_gmx_txx_stat6_s cn56xx;
958 struct cvmx_agl_gmx_txx_stat6_s cn56xxp1;
959};
960
961union cvmx_agl_gmx_txx_stat7 {
962 uint64_t u64;
963 struct cvmx_agl_gmx_txx_stat7_s {
964 uint64_t hist7:32;
965 uint64_t hist6:32;
966 } s;
967 struct cvmx_agl_gmx_txx_stat7_s cn52xx;
968 struct cvmx_agl_gmx_txx_stat7_s cn52xxp1;
969 struct cvmx_agl_gmx_txx_stat7_s cn56xx;
970 struct cvmx_agl_gmx_txx_stat7_s cn56xxp1;
971};
972
973union cvmx_agl_gmx_txx_stat8 {
974 uint64_t u64;
975 struct cvmx_agl_gmx_txx_stat8_s {
976 uint64_t mcst:32;
977 uint64_t bcst:32;
978 } s;
979 struct cvmx_agl_gmx_txx_stat8_s cn52xx;
980 struct cvmx_agl_gmx_txx_stat8_s cn52xxp1;
981 struct cvmx_agl_gmx_txx_stat8_s cn56xx;
982 struct cvmx_agl_gmx_txx_stat8_s cn56xxp1;
983};
984
985union cvmx_agl_gmx_txx_stat9 {
986 uint64_t u64;
987 struct cvmx_agl_gmx_txx_stat9_s {
988 uint64_t undflw:32;
989 uint64_t ctl:32;
990 } s;
991 struct cvmx_agl_gmx_txx_stat9_s cn52xx;
992 struct cvmx_agl_gmx_txx_stat9_s cn52xxp1;
993 struct cvmx_agl_gmx_txx_stat9_s cn56xx;
994 struct cvmx_agl_gmx_txx_stat9_s cn56xxp1;
995};
996
997union cvmx_agl_gmx_txx_stats_ctl {
998 uint64_t u64;
999 struct cvmx_agl_gmx_txx_stats_ctl_s {
1000 uint64_t reserved_1_63:63;
1001 uint64_t rd_clr:1;
1002 } s;
1003 struct cvmx_agl_gmx_txx_stats_ctl_s cn52xx;
1004 struct cvmx_agl_gmx_txx_stats_ctl_s cn52xxp1;
1005 struct cvmx_agl_gmx_txx_stats_ctl_s cn56xx;
1006 struct cvmx_agl_gmx_txx_stats_ctl_s cn56xxp1;
1007};
1008
1009union cvmx_agl_gmx_txx_thresh {
1010 uint64_t u64;
1011 struct cvmx_agl_gmx_txx_thresh_s {
1012 uint64_t reserved_6_63:58;
1013 uint64_t cnt:6;
1014 } s;
1015 struct cvmx_agl_gmx_txx_thresh_s cn52xx;
1016 struct cvmx_agl_gmx_txx_thresh_s cn52xxp1;
1017 struct cvmx_agl_gmx_txx_thresh_s cn56xx;
1018 struct cvmx_agl_gmx_txx_thresh_s cn56xxp1;
1019};
1020
1021union cvmx_agl_gmx_tx_bp {
1022 uint64_t u64;
1023 struct cvmx_agl_gmx_tx_bp_s {
1024 uint64_t reserved_2_63:62;
1025 uint64_t bp:2;
1026 } s;
1027 struct cvmx_agl_gmx_tx_bp_s cn52xx;
1028 struct cvmx_agl_gmx_tx_bp_s cn52xxp1;
1029 struct cvmx_agl_gmx_tx_bp_cn56xx {
1030 uint64_t reserved_1_63:63;
1031 uint64_t bp:1;
1032 } cn56xx;
1033 struct cvmx_agl_gmx_tx_bp_cn56xx cn56xxp1;
1034};
1035
1036union cvmx_agl_gmx_tx_col_attempt {
1037 uint64_t u64;
1038 struct cvmx_agl_gmx_tx_col_attempt_s {
1039 uint64_t reserved_5_63:59;
1040 uint64_t limit:5;
1041 } s;
1042 struct cvmx_agl_gmx_tx_col_attempt_s cn52xx;
1043 struct cvmx_agl_gmx_tx_col_attempt_s cn52xxp1;
1044 struct cvmx_agl_gmx_tx_col_attempt_s cn56xx;
1045 struct cvmx_agl_gmx_tx_col_attempt_s cn56xxp1;
1046};
1047
1048union cvmx_agl_gmx_tx_ifg {
1049 uint64_t u64;
1050 struct cvmx_agl_gmx_tx_ifg_s {
1051 uint64_t reserved_8_63:56;
1052 uint64_t ifg2:4;
1053 uint64_t ifg1:4;
1054 } s;
1055 struct cvmx_agl_gmx_tx_ifg_s cn52xx;
1056 struct cvmx_agl_gmx_tx_ifg_s cn52xxp1;
1057 struct cvmx_agl_gmx_tx_ifg_s cn56xx;
1058 struct cvmx_agl_gmx_tx_ifg_s cn56xxp1;
1059};
1060
1061union cvmx_agl_gmx_tx_int_en {
1062 uint64_t u64;
1063 struct cvmx_agl_gmx_tx_int_en_s {
1064 uint64_t reserved_18_63:46;
1065 uint64_t late_col:2;
1066 uint64_t reserved_14_15:2;
1067 uint64_t xsdef:2;
1068 uint64_t reserved_10_11:2;
1069 uint64_t xscol:2;
1070 uint64_t reserved_4_7:4;
1071 uint64_t undflw:2;
1072 uint64_t reserved_1_1:1;
1073 uint64_t pko_nxa:1;
1074 } s;
1075 struct cvmx_agl_gmx_tx_int_en_s cn52xx;
1076 struct cvmx_agl_gmx_tx_int_en_s cn52xxp1;
1077 struct cvmx_agl_gmx_tx_int_en_cn56xx {
1078 uint64_t reserved_17_63:47;
1079 uint64_t late_col:1;
1080 uint64_t reserved_13_15:3;
1081 uint64_t xsdef:1;
1082 uint64_t reserved_9_11:3;
1083 uint64_t xscol:1;
1084 uint64_t reserved_3_7:5;
1085 uint64_t undflw:1;
1086 uint64_t reserved_1_1:1;
1087 uint64_t pko_nxa:1;
1088 } cn56xx;
1089 struct cvmx_agl_gmx_tx_int_en_cn56xx cn56xxp1;
1090};
1091
1092union cvmx_agl_gmx_tx_int_reg {
1093 uint64_t u64;
1094 struct cvmx_agl_gmx_tx_int_reg_s {
1095 uint64_t reserved_18_63:46;
1096 uint64_t late_col:2;
1097 uint64_t reserved_14_15:2;
1098 uint64_t xsdef:2;
1099 uint64_t reserved_10_11:2;
1100 uint64_t xscol:2;
1101 uint64_t reserved_4_7:4;
1102 uint64_t undflw:2;
1103 uint64_t reserved_1_1:1;
1104 uint64_t pko_nxa:1;
1105 } s;
1106 struct cvmx_agl_gmx_tx_int_reg_s cn52xx;
1107 struct cvmx_agl_gmx_tx_int_reg_s cn52xxp1;
1108 struct cvmx_agl_gmx_tx_int_reg_cn56xx {
1109 uint64_t reserved_17_63:47;
1110 uint64_t late_col:1;
1111 uint64_t reserved_13_15:3;
1112 uint64_t xsdef:1;
1113 uint64_t reserved_9_11:3;
1114 uint64_t xscol:1;
1115 uint64_t reserved_3_7:5;
1116 uint64_t undflw:1;
1117 uint64_t reserved_1_1:1;
1118 uint64_t pko_nxa:1;
1119 } cn56xx;
1120 struct cvmx_agl_gmx_tx_int_reg_cn56xx cn56xxp1;
1121};
1122
1123union cvmx_agl_gmx_tx_jam {
1124 uint64_t u64;
1125 struct cvmx_agl_gmx_tx_jam_s {
1126 uint64_t reserved_8_63:56;
1127 uint64_t jam:8;
1128 } s;
1129 struct cvmx_agl_gmx_tx_jam_s cn52xx;
1130 struct cvmx_agl_gmx_tx_jam_s cn52xxp1;
1131 struct cvmx_agl_gmx_tx_jam_s cn56xx;
1132 struct cvmx_agl_gmx_tx_jam_s cn56xxp1;
1133};
1134
1135union cvmx_agl_gmx_tx_lfsr {
1136 uint64_t u64;
1137 struct cvmx_agl_gmx_tx_lfsr_s {
1138 uint64_t reserved_16_63:48;
1139 uint64_t lfsr:16;
1140 } s;
1141 struct cvmx_agl_gmx_tx_lfsr_s cn52xx;
1142 struct cvmx_agl_gmx_tx_lfsr_s cn52xxp1;
1143 struct cvmx_agl_gmx_tx_lfsr_s cn56xx;
1144 struct cvmx_agl_gmx_tx_lfsr_s cn56xxp1;
1145};
1146
1147union cvmx_agl_gmx_tx_ovr_bp {
1148 uint64_t u64;
1149 struct cvmx_agl_gmx_tx_ovr_bp_s {
1150 uint64_t reserved_10_63:54;
1151 uint64_t en:2;
1152 uint64_t reserved_6_7:2;
1153 uint64_t bp:2;
1154 uint64_t reserved_2_3:2;
1155 uint64_t ign_full:2;
1156 } s;
1157 struct cvmx_agl_gmx_tx_ovr_bp_s cn52xx;
1158 struct cvmx_agl_gmx_tx_ovr_bp_s cn52xxp1;
1159 struct cvmx_agl_gmx_tx_ovr_bp_cn56xx {
1160 uint64_t reserved_9_63:55;
1161 uint64_t en:1;
1162 uint64_t reserved_5_7:3;
1163 uint64_t bp:1;
1164 uint64_t reserved_1_3:3;
1165 uint64_t ign_full:1;
1166 } cn56xx;
1167 struct cvmx_agl_gmx_tx_ovr_bp_cn56xx cn56xxp1;
1168};
1169
1170union cvmx_agl_gmx_tx_pause_pkt_dmac {
1171 uint64_t u64;
1172 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s {
1173 uint64_t reserved_48_63:16;
1174 uint64_t dmac:48;
1175 } s;
1176 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn52xx;
1177 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn52xxp1;
1178 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn56xx;
1179 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn56xxp1;
1180};
1181
1182union cvmx_agl_gmx_tx_pause_pkt_type {
1183 uint64_t u64;
1184 struct cvmx_agl_gmx_tx_pause_pkt_type_s {
1185 uint64_t reserved_16_63:48;
1186 uint64_t type:16;
1187 } s;
1188 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn52xx;
1189 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn52xxp1;
1190 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn56xx;
1191 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn56xxp1;
1192};
1193
1194#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-mixx-defs.h b/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
new file mode 100644
index 000000000000..dab6dca492f9
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
@@ -0,0 +1,248 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_MIXX_DEFS_H__
29#define __CVMX_MIXX_DEFS_H__
30
31#define CVMX_MIXX_BIST(offset) \
32 CVMX_ADD_IO_SEG(0x0001070000100078ull + (((offset) & 1) * 2048))
33#define CVMX_MIXX_CTL(offset) \
34 CVMX_ADD_IO_SEG(0x0001070000100020ull + (((offset) & 1) * 2048))
35#define CVMX_MIXX_INTENA(offset) \
36 CVMX_ADD_IO_SEG(0x0001070000100050ull + (((offset) & 1) * 2048))
37#define CVMX_MIXX_IRCNT(offset) \
38 CVMX_ADD_IO_SEG(0x0001070000100030ull + (((offset) & 1) * 2048))
39#define CVMX_MIXX_IRHWM(offset) \
40 CVMX_ADD_IO_SEG(0x0001070000100028ull + (((offset) & 1) * 2048))
41#define CVMX_MIXX_IRING1(offset) \
42 CVMX_ADD_IO_SEG(0x0001070000100010ull + (((offset) & 1) * 2048))
43#define CVMX_MIXX_IRING2(offset) \
44 CVMX_ADD_IO_SEG(0x0001070000100018ull + (((offset) & 1) * 2048))
45#define CVMX_MIXX_ISR(offset) \
46 CVMX_ADD_IO_SEG(0x0001070000100048ull + (((offset) & 1) * 2048))
47#define CVMX_MIXX_ORCNT(offset) \
48 CVMX_ADD_IO_SEG(0x0001070000100040ull + (((offset) & 1) * 2048))
49#define CVMX_MIXX_ORHWM(offset) \
50 CVMX_ADD_IO_SEG(0x0001070000100038ull + (((offset) & 1) * 2048))
51#define CVMX_MIXX_ORING1(offset) \
52 CVMX_ADD_IO_SEG(0x0001070000100000ull + (((offset) & 1) * 2048))
53#define CVMX_MIXX_ORING2(offset) \
54 CVMX_ADD_IO_SEG(0x0001070000100008ull + (((offset) & 1) * 2048))
55#define CVMX_MIXX_REMCNT(offset) \
56 CVMX_ADD_IO_SEG(0x0001070000100058ull + (((offset) & 1) * 2048))
57
58union cvmx_mixx_bist {
59 uint64_t u64;
60 struct cvmx_mixx_bist_s {
61 uint64_t reserved_4_63:60;
62 uint64_t mrqdat:1;
63 uint64_t ipfdat:1;
64 uint64_t irfdat:1;
65 uint64_t orfdat:1;
66 } s;
67 struct cvmx_mixx_bist_s cn52xx;
68 struct cvmx_mixx_bist_s cn52xxp1;
69 struct cvmx_mixx_bist_s cn56xx;
70 struct cvmx_mixx_bist_s cn56xxp1;
71};
72
73union cvmx_mixx_ctl {
74 uint64_t u64;
75 struct cvmx_mixx_ctl_s {
76 uint64_t reserved_8_63:56;
77 uint64_t crc_strip:1;
78 uint64_t busy:1;
79 uint64_t en:1;
80 uint64_t reset:1;
81 uint64_t lendian:1;
82 uint64_t nbtarb:1;
83 uint64_t mrq_hwm:2;
84 } s;
85 struct cvmx_mixx_ctl_s cn52xx;
86 struct cvmx_mixx_ctl_s cn52xxp1;
87 struct cvmx_mixx_ctl_s cn56xx;
88 struct cvmx_mixx_ctl_s cn56xxp1;
89};
90
91union cvmx_mixx_intena {
92 uint64_t u64;
93 struct cvmx_mixx_intena_s {
94 uint64_t reserved_7_63:57;
95 uint64_t orunena:1;
96 uint64_t irunena:1;
97 uint64_t data_drpena:1;
98 uint64_t ithena:1;
99 uint64_t othena:1;
100 uint64_t ivfena:1;
101 uint64_t ovfena:1;
102 } s;
103 struct cvmx_mixx_intena_s cn52xx;
104 struct cvmx_mixx_intena_s cn52xxp1;
105 struct cvmx_mixx_intena_s cn56xx;
106 struct cvmx_mixx_intena_s cn56xxp1;
107};
108
109union cvmx_mixx_ircnt {
110 uint64_t u64;
111 struct cvmx_mixx_ircnt_s {
112 uint64_t reserved_20_63:44;
113 uint64_t ircnt:20;
114 } s;
115 struct cvmx_mixx_ircnt_s cn52xx;
116 struct cvmx_mixx_ircnt_s cn52xxp1;
117 struct cvmx_mixx_ircnt_s cn56xx;
118 struct cvmx_mixx_ircnt_s cn56xxp1;
119};
120
121union cvmx_mixx_irhwm {
122 uint64_t u64;
123 struct cvmx_mixx_irhwm_s {
124 uint64_t reserved_40_63:24;
125 uint64_t ibplwm:20;
126 uint64_t irhwm:20;
127 } s;
128 struct cvmx_mixx_irhwm_s cn52xx;
129 struct cvmx_mixx_irhwm_s cn52xxp1;
130 struct cvmx_mixx_irhwm_s cn56xx;
131 struct cvmx_mixx_irhwm_s cn56xxp1;
132};
133
134union cvmx_mixx_iring1 {
135 uint64_t u64;
136 struct cvmx_mixx_iring1_s {
137 uint64_t reserved_60_63:4;
138 uint64_t isize:20;
139 uint64_t reserved_36_39:4;
140 uint64_t ibase:33;
141 uint64_t reserved_0_2:3;
142 } s;
143 struct cvmx_mixx_iring1_s cn52xx;
144 struct cvmx_mixx_iring1_s cn52xxp1;
145 struct cvmx_mixx_iring1_s cn56xx;
146 struct cvmx_mixx_iring1_s cn56xxp1;
147};
148
149union cvmx_mixx_iring2 {
150 uint64_t u64;
151 struct cvmx_mixx_iring2_s {
152 uint64_t reserved_52_63:12;
153 uint64_t itlptr:20;
154 uint64_t reserved_20_31:12;
155 uint64_t idbell:20;
156 } s;
157 struct cvmx_mixx_iring2_s cn52xx;
158 struct cvmx_mixx_iring2_s cn52xxp1;
159 struct cvmx_mixx_iring2_s cn56xx;
160 struct cvmx_mixx_iring2_s cn56xxp1;
161};
162
163union cvmx_mixx_isr {
164 uint64_t u64;
165 struct cvmx_mixx_isr_s {
166 uint64_t reserved_7_63:57;
167 uint64_t orun:1;
168 uint64_t irun:1;
169 uint64_t data_drp:1;
170 uint64_t irthresh:1;
171 uint64_t orthresh:1;
172 uint64_t idblovf:1;
173 uint64_t odblovf:1;
174 } s;
175 struct cvmx_mixx_isr_s cn52xx;
176 struct cvmx_mixx_isr_s cn52xxp1;
177 struct cvmx_mixx_isr_s cn56xx;
178 struct cvmx_mixx_isr_s cn56xxp1;
179};
180
181union cvmx_mixx_orcnt {
182 uint64_t u64;
183 struct cvmx_mixx_orcnt_s {
184 uint64_t reserved_20_63:44;
185 uint64_t orcnt:20;
186 } s;
187 struct cvmx_mixx_orcnt_s cn52xx;
188 struct cvmx_mixx_orcnt_s cn52xxp1;
189 struct cvmx_mixx_orcnt_s cn56xx;
190 struct cvmx_mixx_orcnt_s cn56xxp1;
191};
192
193union cvmx_mixx_orhwm {
194 uint64_t u64;
195 struct cvmx_mixx_orhwm_s {
196 uint64_t reserved_20_63:44;
197 uint64_t orhwm:20;
198 } s;
199 struct cvmx_mixx_orhwm_s cn52xx;
200 struct cvmx_mixx_orhwm_s cn52xxp1;
201 struct cvmx_mixx_orhwm_s cn56xx;
202 struct cvmx_mixx_orhwm_s cn56xxp1;
203};
204
205union cvmx_mixx_oring1 {
206 uint64_t u64;
207 struct cvmx_mixx_oring1_s {
208 uint64_t reserved_60_63:4;
209 uint64_t osize:20;
210 uint64_t reserved_36_39:4;
211 uint64_t obase:33;
212 uint64_t reserved_0_2:3;
213 } s;
214 struct cvmx_mixx_oring1_s cn52xx;
215 struct cvmx_mixx_oring1_s cn52xxp1;
216 struct cvmx_mixx_oring1_s cn56xx;
217 struct cvmx_mixx_oring1_s cn56xxp1;
218};
219
220union cvmx_mixx_oring2 {
221 uint64_t u64;
222 struct cvmx_mixx_oring2_s {
223 uint64_t reserved_52_63:12;
224 uint64_t otlptr:20;
225 uint64_t reserved_20_31:12;
226 uint64_t odbell:20;
227 } s;
228 struct cvmx_mixx_oring2_s cn52xx;
229 struct cvmx_mixx_oring2_s cn52xxp1;
230 struct cvmx_mixx_oring2_s cn56xx;
231 struct cvmx_mixx_oring2_s cn56xxp1;
232};
233
234union cvmx_mixx_remcnt {
235 uint64_t u64;
236 struct cvmx_mixx_remcnt_s {
237 uint64_t reserved_52_63:12;
238 uint64_t iremcnt:20;
239 uint64_t reserved_20_31:12;
240 uint64_t oremcnt:20;
241 } s;
242 struct cvmx_mixx_remcnt_s cn52xx;
243 struct cvmx_mixx_remcnt_s cn52xxp1;
244 struct cvmx_mixx_remcnt_s cn56xx;
245 struct cvmx_mixx_remcnt_s cn56xxp1;
246};
247
248#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-smix-defs.h b/arch/mips/include/asm/octeon/cvmx-smix-defs.h
new file mode 100644
index 000000000000..9ae45fcbe3e3
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-smix-defs.h
@@ -0,0 +1,178 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2008 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_SMIX_DEFS_H__
29#define __CVMX_SMIX_DEFS_H__
30
31#define CVMX_SMIX_CLK(offset) \
32 CVMX_ADD_IO_SEG(0x0001180000001818ull + (((offset) & 1) * 256))
33#define CVMX_SMIX_CMD(offset) \
34 CVMX_ADD_IO_SEG(0x0001180000001800ull + (((offset) & 1) * 256))
35#define CVMX_SMIX_EN(offset) \
36 CVMX_ADD_IO_SEG(0x0001180000001820ull + (((offset) & 1) * 256))
37#define CVMX_SMIX_RD_DAT(offset) \
38 CVMX_ADD_IO_SEG(0x0001180000001810ull + (((offset) & 1) * 256))
39#define CVMX_SMIX_WR_DAT(offset) \
40 CVMX_ADD_IO_SEG(0x0001180000001808ull + (((offset) & 1) * 256))
41
42union cvmx_smix_clk {
43 uint64_t u64;
44 struct cvmx_smix_clk_s {
45 uint64_t reserved_25_63:39;
46 uint64_t mode:1;
47 uint64_t reserved_21_23:3;
48 uint64_t sample_hi:5;
49 uint64_t sample_mode:1;
50 uint64_t reserved_14_14:1;
51 uint64_t clk_idle:1;
52 uint64_t preamble:1;
53 uint64_t sample:4;
54 uint64_t phase:8;
55 } s;
56 struct cvmx_smix_clk_cn30xx {
57 uint64_t reserved_21_63:43;
58 uint64_t sample_hi:5;
59 uint64_t reserved_14_15:2;
60 uint64_t clk_idle:1;
61 uint64_t preamble:1;
62 uint64_t sample:4;
63 uint64_t phase:8;
64 } cn30xx;
65 struct cvmx_smix_clk_cn30xx cn31xx;
66 struct cvmx_smix_clk_cn30xx cn38xx;
67 struct cvmx_smix_clk_cn30xx cn38xxp2;
68 struct cvmx_smix_clk_cn50xx {
69 uint64_t reserved_25_63:39;
70 uint64_t mode:1;
71 uint64_t reserved_21_23:3;
72 uint64_t sample_hi:5;
73 uint64_t reserved_14_15:2;
74 uint64_t clk_idle:1;
75 uint64_t preamble:1;
76 uint64_t sample:4;
77 uint64_t phase:8;
78 } cn50xx;
79 struct cvmx_smix_clk_s cn52xx;
80 struct cvmx_smix_clk_cn50xx cn52xxp1;
81 struct cvmx_smix_clk_s cn56xx;
82 struct cvmx_smix_clk_cn50xx cn56xxp1;
83 struct cvmx_smix_clk_cn30xx cn58xx;
84 struct cvmx_smix_clk_cn30xx cn58xxp1;
85};
86
87union cvmx_smix_cmd {
88 uint64_t u64;
89 struct cvmx_smix_cmd_s {
90 uint64_t reserved_18_63:46;
91 uint64_t phy_op:2;
92 uint64_t reserved_13_15:3;
93 uint64_t phy_adr:5;
94 uint64_t reserved_5_7:3;
95 uint64_t reg_adr:5;
96 } s;
97 struct cvmx_smix_cmd_cn30xx {
98 uint64_t reserved_17_63:47;
99 uint64_t phy_op:1;
100 uint64_t reserved_13_15:3;
101 uint64_t phy_adr:5;
102 uint64_t reserved_5_7:3;
103 uint64_t reg_adr:5;
104 } cn30xx;
105 struct cvmx_smix_cmd_cn30xx cn31xx;
106 struct cvmx_smix_cmd_cn30xx cn38xx;
107 struct cvmx_smix_cmd_cn30xx cn38xxp2;
108 struct cvmx_smix_cmd_s cn50xx;
109 struct cvmx_smix_cmd_s cn52xx;
110 struct cvmx_smix_cmd_s cn52xxp1;
111 struct cvmx_smix_cmd_s cn56xx;
112 struct cvmx_smix_cmd_s cn56xxp1;
113 struct cvmx_smix_cmd_cn30xx cn58xx;
114 struct cvmx_smix_cmd_cn30xx cn58xxp1;
115};
116
117union cvmx_smix_en {
118 uint64_t u64;
119 struct cvmx_smix_en_s {
120 uint64_t reserved_1_63:63;
121 uint64_t en:1;
122 } s;
123 struct cvmx_smix_en_s cn30xx;
124 struct cvmx_smix_en_s cn31xx;
125 struct cvmx_smix_en_s cn38xx;
126 struct cvmx_smix_en_s cn38xxp2;
127 struct cvmx_smix_en_s cn50xx;
128 struct cvmx_smix_en_s cn52xx;
129 struct cvmx_smix_en_s cn52xxp1;
130 struct cvmx_smix_en_s cn56xx;
131 struct cvmx_smix_en_s cn56xxp1;
132 struct cvmx_smix_en_s cn58xx;
133 struct cvmx_smix_en_s cn58xxp1;
134};
135
136union cvmx_smix_rd_dat {
137 uint64_t u64;
138 struct cvmx_smix_rd_dat_s {
139 uint64_t reserved_18_63:46;
140 uint64_t pending:1;
141 uint64_t val:1;
142 uint64_t dat:16;
143 } s;
144 struct cvmx_smix_rd_dat_s cn30xx;
145 struct cvmx_smix_rd_dat_s cn31xx;
146 struct cvmx_smix_rd_dat_s cn38xx;
147 struct cvmx_smix_rd_dat_s cn38xxp2;
148 struct cvmx_smix_rd_dat_s cn50xx;
149 struct cvmx_smix_rd_dat_s cn52xx;
150 struct cvmx_smix_rd_dat_s cn52xxp1;
151 struct cvmx_smix_rd_dat_s cn56xx;
152 struct cvmx_smix_rd_dat_s cn56xxp1;
153 struct cvmx_smix_rd_dat_s cn58xx;
154 struct cvmx_smix_rd_dat_s cn58xxp1;
155};
156
157union cvmx_smix_wr_dat {
158 uint64_t u64;
159 struct cvmx_smix_wr_dat_s {
160 uint64_t reserved_18_63:46;
161 uint64_t pending:1;
162 uint64_t val:1;
163 uint64_t dat:16;
164 } s;
165 struct cvmx_smix_wr_dat_s cn30xx;
166 struct cvmx_smix_wr_dat_s cn31xx;
167 struct cvmx_smix_wr_dat_s cn38xx;
168 struct cvmx_smix_wr_dat_s cn38xxp2;
169 struct cvmx_smix_wr_dat_s cn50xx;
170 struct cvmx_smix_wr_dat_s cn52xx;
171 struct cvmx_smix_wr_dat_s cn52xxp1;
172 struct cvmx_smix_wr_dat_s cn56xx;
173 struct cvmx_smix_wr_dat_s cn56xxp1;
174 struct cvmx_smix_wr_dat_s cn58xx;
175 struct cvmx_smix_wr_dat_s cn58xxp1;
176};
177
178#endif
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index cac9b1a206fc..4d0a8c61fc3e 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -47,6 +47,7 @@ struct octeon_cop2_state;
47extern unsigned long octeon_crypto_enable(struct octeon_cop2_state *state); 47extern unsigned long octeon_crypto_enable(struct octeon_cop2_state *state);
48extern void octeon_crypto_disable(struct octeon_cop2_state *state, 48extern void octeon_crypto_disable(struct octeon_cop2_state *state,
49 unsigned long flags); 49 unsigned long flags);
50extern asmlinkage void octeon_cop2_restore(struct octeon_cop2_state *task);
50 51
51extern void octeon_init_cvmcount(void); 52extern void octeon_init_cvmcount(void);
52 53
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index d6eb6134abec..1854336e56a2 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -390,6 +390,19 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
390#include <asm-generic/pgtable.h> 390#include <asm-generic/pgtable.h>
391 391
392/* 392/*
393 * uncached accelerated TLB map for video memory access
394 */
395#ifdef CONFIG_CPU_SUPPORTS_UNCACHED_ACCELERATED
396#define __HAVE_PHYS_MEM_ACCESS_PROT
397
398struct file;
399pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
400 unsigned long size, pgprot_t vma_prot);
401int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
402 unsigned long size, pgprot_t *vma_prot);
403#endif
404
405/*
393 * We provide our own get_unmapped area to cope with the virtual aliasing 406 * We provide our own get_unmapped area to cope with the virtual aliasing
394 * constraints placed on us by the cache architecture. 407 * constraints placed on us by the cache architecture.
395 */ 408 */
diff --git a/arch/mips/include/asm/sgialib.h b/arch/mips/include/asm/sgialib.h
index bfce5c786f1c..63741ca1e422 100644
--- a/arch/mips/include/asm/sgialib.h
+++ b/arch/mips/include/asm/sgialib.h
@@ -85,8 +85,7 @@ extern void prom_identify_arch(void);
85extern PCHAR ArcGetEnvironmentVariable(PCHAR name); 85extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
86extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value); 86extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value);
87 87
88/* ARCS command line acquisition and parsing. */ 88/* ARCS command line parsing. */
89extern char *prom_getcmdline(void);
90extern void prom_init_cmdline(void); 89extern void prom_init_cmdline(void);
91 90
92/* Acquiring info about the current time, etc. */ 91/* Acquiring info about the current time, etc. */
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index db0fa7b5aeaf..3b6da3330e32 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -51,9 +51,6 @@
51 LONG_S v1, PT_ACX(sp) 51 LONG_S v1, PT_ACX(sp)
52#else 52#else
53 mfhi v1 53 mfhi v1
54 LONG_S v1, PT_HI(sp)
55 mflo v1
56 LONG_S v1, PT_LO(sp)
57#endif 54#endif
58#ifdef CONFIG_32BIT 55#ifdef CONFIG_32BIT
59 LONG_S $8, PT_R8(sp) 56 LONG_S $8, PT_R8(sp)
@@ -62,10 +59,17 @@
62 LONG_S $10, PT_R10(sp) 59 LONG_S $10, PT_R10(sp)
63 LONG_S $11, PT_R11(sp) 60 LONG_S $11, PT_R11(sp)
64 LONG_S $12, PT_R12(sp) 61 LONG_S $12, PT_R12(sp)
62#ifndef CONFIG_CPU_HAS_SMARTMIPS
63 LONG_S v1, PT_HI(sp)
64 mflo v1
65#endif
65 LONG_S $13, PT_R13(sp) 66 LONG_S $13, PT_R13(sp)
66 LONG_S $14, PT_R14(sp) 67 LONG_S $14, PT_R14(sp)
67 LONG_S $15, PT_R15(sp) 68 LONG_S $15, PT_R15(sp)
68 LONG_S $24, PT_R24(sp) 69 LONG_S $24, PT_R24(sp)
70#ifndef CONFIG_CPU_HAS_SMARTMIPS
71 LONG_S v1, PT_LO(sp)
72#endif
69 .endm 73 .endm
70 74
71 .macro SAVE_STATIC 75 .macro SAVE_STATIC
@@ -83,15 +87,19 @@
83#ifdef CONFIG_SMP 87#ifdef CONFIG_SMP
84#ifdef CONFIG_MIPS_MT_SMTC 88#ifdef CONFIG_MIPS_MT_SMTC
85#define PTEBASE_SHIFT 19 /* TCBIND */ 89#define PTEBASE_SHIFT 19 /* TCBIND */
90#define CPU_ID_REG CP0_TCBIND
91#define CPU_ID_MFC0 mfc0
92#elif defined(CONFIG_MIPS_PGD_C0_CONTEXT)
93#define PTEBASE_SHIFT 48 /* XCONTEXT */
94#define CPU_ID_REG CP0_XCONTEXT
95#define CPU_ID_MFC0 MFC0
86#else 96#else
87#define PTEBASE_SHIFT 23 /* CONTEXT */ 97#define PTEBASE_SHIFT 23 /* CONTEXT */
98#define CPU_ID_REG CP0_CONTEXT
99#define CPU_ID_MFC0 MFC0
88#endif 100#endif
89 .macro get_saved_sp /* SMP variation */ 101 .macro get_saved_sp /* SMP variation */
90#ifdef CONFIG_MIPS_MT_SMTC 102 CPU_ID_MFC0 k0, CPU_ID_REG
91 mfc0 k0, CP0_TCBIND
92#else
93 MFC0 k0, CP0_CONTEXT
94#endif
95#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) 103#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
96 lui k1, %hi(kernelsp) 104 lui k1, %hi(kernelsp)
97#else 105#else
@@ -107,11 +115,7 @@
107 .endm 115 .endm
108 116
109 .macro set_saved_sp stackp temp temp2 117 .macro set_saved_sp stackp temp temp2
110#ifdef CONFIG_MIPS_MT_SMTC 118 CPU_ID_MFC0 \temp, CPU_ID_REG
111 mfc0 \temp, CP0_TCBIND
112#else
113 MFC0 \temp, CP0_CONTEXT
114#endif
115 LONG_SRL \temp, PTEBASE_SHIFT 119 LONG_SRL \temp, PTEBASE_SHIFT
116 LONG_S \stackp, kernelsp(\temp) 120 LONG_S \stackp, kernelsp(\temp)
117 .endm 121 .endm
@@ -166,7 +170,6 @@
166 LONG_S $0, PT_R0(sp) 170 LONG_S $0, PT_R0(sp)
167 mfc0 v1, CP0_STATUS 171 mfc0 v1, CP0_STATUS
168 LONG_S $2, PT_R2(sp) 172 LONG_S $2, PT_R2(sp)
169 LONG_S v1, PT_STATUS(sp)
170#ifdef CONFIG_MIPS_MT_SMTC 173#ifdef CONFIG_MIPS_MT_SMTC
171 /* 174 /*
172 * Ideally, these instructions would be shuffled in 175 * Ideally, these instructions would be shuffled in
@@ -178,20 +181,21 @@
178 LONG_S v1, PT_TCSTATUS(sp) 181 LONG_S v1, PT_TCSTATUS(sp)
179#endif /* CONFIG_MIPS_MT_SMTC */ 182#endif /* CONFIG_MIPS_MT_SMTC */
180 LONG_S $4, PT_R4(sp) 183 LONG_S $4, PT_R4(sp)
181 mfc0 v1, CP0_CAUSE
182 LONG_S $5, PT_R5(sp) 184 LONG_S $5, PT_R5(sp)
183 LONG_S v1, PT_CAUSE(sp) 185 LONG_S v1, PT_STATUS(sp)
186 mfc0 v1, CP0_CAUSE
184 LONG_S $6, PT_R6(sp) 187 LONG_S $6, PT_R6(sp)
185 MFC0 v1, CP0_EPC
186 LONG_S $7, PT_R7(sp) 188 LONG_S $7, PT_R7(sp)
189 LONG_S v1, PT_CAUSE(sp)
190 MFC0 v1, CP0_EPC
187#ifdef CONFIG_64BIT 191#ifdef CONFIG_64BIT
188 LONG_S $8, PT_R8(sp) 192 LONG_S $8, PT_R8(sp)
189 LONG_S $9, PT_R9(sp) 193 LONG_S $9, PT_R9(sp)
190#endif 194#endif
191 LONG_S v1, PT_EPC(sp)
192 LONG_S $25, PT_R25(sp) 195 LONG_S $25, PT_R25(sp)
193 LONG_S $28, PT_R28(sp) 196 LONG_S $28, PT_R28(sp)
194 LONG_S $31, PT_R31(sp) 197 LONG_S $31, PT_R31(sp)
198 LONG_S v1, PT_EPC(sp)
195 ori $28, sp, _THREAD_MASK 199 ori $28, sp, _THREAD_MASK
196 xori $28, _THREAD_MASK 200 xori $28, _THREAD_MASK
197#ifdef CONFIG_CPU_CAVIUM_OCTEON 201#ifdef CONFIG_CPU_CAVIUM_OCTEON
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index eecd2a9f155c..9326af5186fe 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -2,14 +2,17 @@
2# Makefile for the Linux/MIPS kernel. 2# Makefile for the Linux/MIPS kernel.
3# 3#
4 4
5CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
6
7extra-y := head.o init_task.o vmlinux.lds 5extra-y := head.o init_task.o vmlinux.lds
8 6
9obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ 7obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
10 ptrace.o reset.o setup.o signal.o syscall.o \ 8 ptrace.o reset.o setup.o signal.o syscall.o \
11 time.o topology.o traps.o unaligned.o watch.o 9 time.o topology.o traps.o unaligned.o watch.o
12 10
11ifdef CONFIG_FUNCTION_TRACER
12CFLAGS_REMOVE_ftrace.o = -pg
13CFLAGS_REMOVE_early_printk.o = -pg
14endif
15
13obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o 16obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
14obj-$(CONFIG_CEVT_R4K_LIB) += cevt-r4k.o 17obj-$(CONFIG_CEVT_R4K_LIB) += cevt-r4k.o
15obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o 18obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o
@@ -19,6 +22,7 @@ obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
19obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o 22obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
20obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o 23obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
21obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o 24obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o
25obj-$(CONFIG_CSRC_POWERTV) += csrc-powertv.o
22obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o 26obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
23obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 27obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o
24obj-$(CONFIG_SYNC_R4K) += sync-r4k.o 28obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
@@ -26,6 +30,8 @@ obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
26obj-$(CONFIG_STACKTRACE) += stacktrace.o 30obj-$(CONFIG_STACKTRACE) += stacktrace.o
27obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 31obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
28 32
33obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
34
29obj-$(CONFIG_CPU_LOONGSON2) += r4k_fpu.o r4k_switch.o 35obj-$(CONFIG_CPU_LOONGSON2) += r4k_fpu.o r4k_switch.o
30obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o 36obj-$(CONFIG_CPU_MIPS32) += r4k_fpu.o r4k_switch.o
31obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o 37obj-$(CONFIG_CPU_MIPS64) += r4k_fpu.o r4k_switch.o
@@ -92,4 +98,8 @@ CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/n
92 98
93obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 99obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
94 100
101obj-$(CONFIG_MIPS_CPUFREQ) += cpufreq/
102
95EXTRA_CFLAGS += -Werror 103EXTRA_CFLAGS += -Werror
104
105CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 7a51866068a4..80e202eca056 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -16,6 +16,7 @@
16#include <linux/ptrace.h> 16#include <linux/ptrace.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/module.h>
19 20
20#include <asm/bugs.h> 21#include <asm/bugs.h>
21#include <asm/cpu.h> 22#include <asm/cpu.h>
@@ -32,6 +33,7 @@
32 * the CPU very much. 33 * the CPU very much.
33 */ 34 */
34void (*cpu_wait)(void); 35void (*cpu_wait)(void);
36EXPORT_SYMBOL(cpu_wait);
35 37
36static void r3081_wait(void) 38static void r3081_wait(void)
37{ 39{
diff --git a/arch/mips/kernel/cpufreq/Kconfig b/arch/mips/kernel/cpufreq/Kconfig
new file mode 100644
index 000000000000..58c601eee6fd
--- /dev/null
+++ b/arch/mips/kernel/cpufreq/Kconfig
@@ -0,0 +1,41 @@
1#
2# CPU Frequency scaling
3#
4
5config MIPS_EXTERNAL_TIMER
6 bool
7
8config MIPS_CPUFREQ
9 bool
10 default y
11 depends on CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
12
13if MIPS_CPUFREQ
14
15menu "CPU Frequency scaling"
16
17source "drivers/cpufreq/Kconfig"
18
19if CPU_FREQ
20
21comment "CPUFreq processor drivers"
22
23config LOONGSON2_CPUFREQ
24 tristate "Loongson2 CPUFreq Driver"
25 select CPU_FREQ_TABLE
26 depends on MIPS_CPUFREQ
27 help
28 This option adds a CPUFreq driver for loongson processors which
29 support software configurable cpu frequency.
30
31 Loongson2F and it's successors support this feature.
32
33 For details, take a look at <file:Documentation/cpu-freq/>.
34
35 If in doubt, say N.
36
37endif # CPU_FREQ
38
39endmenu
40
41endif # MIPS_CPUFREQ
diff --git a/arch/mips/kernel/cpufreq/Makefile b/arch/mips/kernel/cpufreq/Makefile
new file mode 100644
index 000000000000..c3479a432efe
--- /dev/null
+++ b/arch/mips/kernel/cpufreq/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the Linux/MIPS cpufreq.
3#
4
5obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o loongson2_clock.o
diff --git a/arch/mips/kernel/cpufreq/loongson2_clock.c b/arch/mips/kernel/cpufreq/loongson2_clock.c
new file mode 100644
index 000000000000..d7ca256e33ef
--- /dev/null
+++ b/arch/mips/kernel/cpufreq/loongson2_clock.c
@@ -0,0 +1,166 @@
1/*
2 * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology
3 * Author: Yanhua, yanh@lemote.com
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/cpufreq.h>
11#include <linux/platform_device.h>
12
13#include <asm/clock.h>
14
15#include <loongson.h>
16
17static LIST_HEAD(clock_list);
18static DEFINE_SPINLOCK(clock_lock);
19static DEFINE_MUTEX(clock_list_sem);
20
21/* Minimum CLK support */
22enum {
23 DC_ZERO, DC_25PT = 2, DC_37PT, DC_50PT, DC_62PT, DC_75PT,
24 DC_87PT, DC_DISABLE, DC_RESV
25};
26
27struct cpufreq_frequency_table loongson2_clockmod_table[] = {
28 {DC_RESV, CPUFREQ_ENTRY_INVALID},
29 {DC_ZERO, CPUFREQ_ENTRY_INVALID},
30 {DC_25PT, 0},
31 {DC_37PT, 0},
32 {DC_50PT, 0},
33 {DC_62PT, 0},
34 {DC_75PT, 0},
35 {DC_87PT, 0},
36 {DC_DISABLE, 0},
37 {DC_RESV, CPUFREQ_TABLE_END},
38};
39EXPORT_SYMBOL_GPL(loongson2_clockmod_table);
40
41static struct clk cpu_clk = {
42 .name = "cpu_clk",
43 .flags = CLK_ALWAYS_ENABLED | CLK_RATE_PROPAGATES,
44 .rate = 800000000,
45};
46
47struct clk *clk_get(struct device *dev, const char *id)
48{
49 return &cpu_clk;
50}
51EXPORT_SYMBOL(clk_get);
52
53static void propagate_rate(struct clk *clk)
54{
55 struct clk *clkp;
56
57 list_for_each_entry(clkp, &clock_list, node) {
58 if (likely(clkp->parent != clk))
59 continue;
60 if (likely(clkp->ops && clkp->ops->recalc))
61 clkp->ops->recalc(clkp);
62 if (unlikely(clkp->flags & CLK_RATE_PROPAGATES))
63 propagate_rate(clkp);
64 }
65}
66
67int clk_enable(struct clk *clk)
68{
69 return 0;
70}
71EXPORT_SYMBOL(clk_enable);
72
73void clk_disable(struct clk *clk)
74{
75}
76EXPORT_SYMBOL(clk_disable);
77
78unsigned long clk_get_rate(struct clk *clk)
79{
80 return (unsigned long)clk->rate;
81}
82EXPORT_SYMBOL(clk_get_rate);
83
84void clk_put(struct clk *clk)
85{
86}
87EXPORT_SYMBOL(clk_put);
88
89int clk_set_rate(struct clk *clk, unsigned long rate)
90{
91 return clk_set_rate_ex(clk, rate, 0);
92}
93EXPORT_SYMBOL_GPL(clk_set_rate);
94
95int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id)
96{
97 int ret = 0;
98 int regval;
99 int i;
100
101 if (likely(clk->ops && clk->ops->set_rate)) {
102 unsigned long flags;
103
104 spin_lock_irqsave(&clock_lock, flags);
105 ret = clk->ops->set_rate(clk, rate, algo_id);
106 spin_unlock_irqrestore(&clock_lock, flags);
107 }
108
109 if (unlikely(clk->flags & CLK_RATE_PROPAGATES))
110 propagate_rate(clk);
111
112 for (i = 0; loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END;
113 i++) {
114 if (loongson2_clockmod_table[i].frequency ==
115 CPUFREQ_ENTRY_INVALID)
116 continue;
117 if (rate == loongson2_clockmod_table[i].frequency)
118 break;
119 }
120 if (rate != loongson2_clockmod_table[i].frequency)
121 return -ENOTSUPP;
122
123 clk->rate = rate;
124
125 regval = LOONGSON_CHIPCFG0;
126 regval = (regval & ~0x7) | (loongson2_clockmod_table[i].index - 1);
127 LOONGSON_CHIPCFG0 = regval;
128
129 return ret;
130}
131EXPORT_SYMBOL_GPL(clk_set_rate_ex);
132
133long clk_round_rate(struct clk *clk, unsigned long rate)
134{
135 if (likely(clk->ops && clk->ops->round_rate)) {
136 unsigned long flags, rounded;
137
138 spin_lock_irqsave(&clock_lock, flags);
139 rounded = clk->ops->round_rate(clk, rate);
140 spin_unlock_irqrestore(&clock_lock, flags);
141
142 return rounded;
143 }
144
145 return rate;
146}
147EXPORT_SYMBOL_GPL(clk_round_rate);
148
149/*
150 * This is the simple version of Loongson-2 wait, Maybe we need do this in
151 * interrupt disabled content
152 */
153
154DEFINE_SPINLOCK(loongson2_wait_lock);
155void loongson2_cpu_wait(void)
156{
157 u32 cpu_freq;
158 unsigned long flags;
159
160 spin_lock_irqsave(&loongson2_wait_lock, flags);
161 cpu_freq = LOONGSON_CHIPCFG0;
162 LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */
163 LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */
164 spin_unlock_irqrestore(&loongson2_wait_lock, flags);
165}
166EXPORT_SYMBOL_GPL(loongson2_cpu_wait);
diff --git a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
new file mode 100644
index 000000000000..2f6a0b147ab8
--- /dev/null
+++ b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
@@ -0,0 +1,227 @@
1/*
2 * Cpufreq driver for the loongson-2 processors
3 *
4 * The 2E revision of loongson processor not support this feature.
5 *
6 * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology
7 * Author: Yanhua, yanh@lemote.com
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/cpufreq.h>
14#include <linux/module.h>
15#include <linux/err.h>
16#include <linux/sched.h> /* set_cpus_allowed() */
17#include <linux/delay.h>
18#include <linux/platform_device.h>
19
20#include <asm/clock.h>
21
22#include <loongson.h>
23
24static uint nowait;
25
26static struct clk *cpuclk;
27
28static void (*saved_cpu_wait) (void);
29
30static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
31 unsigned long val, void *data);
32
33static struct notifier_block loongson2_cpufreq_notifier_block = {
34 .notifier_call = loongson2_cpu_freq_notifier
35};
36
37static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
38 unsigned long val, void *data)
39{
40 if (val == CPUFREQ_POSTCHANGE)
41 current_cpu_data.udelay_val = loops_per_jiffy;
42
43 return 0;
44}
45
46static unsigned int loongson2_cpufreq_get(unsigned int cpu)
47{
48 return clk_get_rate(cpuclk);
49}
50
51/*
52 * Here we notify other drivers of the proposed change and the final change.
53 */
54static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
55 unsigned int target_freq,
56 unsigned int relation)
57{
58 unsigned int cpu = policy->cpu;
59 unsigned int newstate = 0;
60 cpumask_t cpus_allowed;
61 struct cpufreq_freqs freqs;
62 unsigned int freq;
63
64 if (!cpu_online(cpu))
65 return -ENODEV;
66
67 cpus_allowed = current->cpus_allowed;
68 set_cpus_allowed(current, cpumask_of_cpu(cpu));
69
70 if (cpufreq_frequency_table_target
71 (policy, &loongson2_clockmod_table[0], target_freq, relation,
72 &newstate))
73 return -EINVAL;
74
75 freq =
76 ((cpu_clock_freq / 1000) *
77 loongson2_clockmod_table[newstate].index) / 8;
78 if (freq < policy->min || freq > policy->max)
79 return -EINVAL;
80
81 pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000);
82
83 freqs.cpu = cpu;
84 freqs.old = loongson2_cpufreq_get(cpu);
85 freqs.new = freq;
86 freqs.flags = 0;
87
88 if (freqs.new == freqs.old)
89 return 0;
90
91 /* notifiers */
92 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
93
94 set_cpus_allowed(current, cpus_allowed);
95
96 /* setting the cpu frequency */
97 clk_set_rate(cpuclk, freq);
98
99 /* notifiers */
100 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
101
102 pr_debug("cpufreq: set frequency %u kHz\n", freq);
103
104 return 0;
105}
106
107static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
108{
109 int i;
110
111 if (!cpu_online(policy->cpu))
112 return -ENODEV;
113
114 cpuclk = clk_get(NULL, "cpu_clk");
115 if (IS_ERR(cpuclk)) {
116 printk(KERN_ERR "cpufreq: couldn't get CPU clk\n");
117 return PTR_ERR(cpuclk);
118 }
119
120 cpuclk->rate = cpu_clock_freq / 1000;
121 if (!cpuclk->rate)
122 return -EINVAL;
123
124 /* clock table init */
125 for (i = 2;
126 (loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END);
127 i++)
128 loongson2_clockmod_table[i].frequency = (cpuclk->rate * i) / 8;
129
130 policy->cur = loongson2_cpufreq_get(policy->cpu);
131
132 cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0],
133 policy->cpu);
134
135 return cpufreq_frequency_table_cpuinfo(policy,
136 &loongson2_clockmod_table[0]);
137}
138
139static int loongson2_cpufreq_verify(struct cpufreq_policy *policy)
140{
141 return cpufreq_frequency_table_verify(policy,
142 &loongson2_clockmod_table[0]);
143}
144
145static int loongson2_cpufreq_exit(struct cpufreq_policy *policy)
146{
147 clk_put(cpuclk);
148 return 0;
149}
150
151static struct freq_attr *loongson2_table_attr[] = {
152 &cpufreq_freq_attr_scaling_available_freqs,
153 NULL,
154};
155
156static struct cpufreq_driver loongson2_cpufreq_driver = {
157 .owner = THIS_MODULE,
158 .name = "loongson2",
159 .init = loongson2_cpufreq_cpu_init,
160 .verify = loongson2_cpufreq_verify,
161 .target = loongson2_cpufreq_target,
162 .get = loongson2_cpufreq_get,
163 .exit = loongson2_cpufreq_exit,
164 .attr = loongson2_table_attr,
165};
166
167static struct platform_device_id platform_device_ids[] = {
168 {
169 .name = "loongson2_cpufreq",
170 },
171 {}
172};
173
174MODULE_DEVICE_TABLE(platform, platform_device_ids);
175
176static struct platform_driver platform_driver = {
177 .driver = {
178 .name = "loongson2_cpufreq",
179 .owner = THIS_MODULE,
180 },
181 .id_table = platform_device_ids,
182};
183
184static int __init cpufreq_init(void)
185{
186 int ret;
187
188 /* Register platform stuff */
189 ret = platform_driver_register(&platform_driver);
190 if (ret)
191 return ret;
192
193 pr_info("cpufreq: Loongson-2F CPU frequency driver.\n");
194
195 cpufreq_register_notifier(&loongson2_cpufreq_notifier_block,
196 CPUFREQ_TRANSITION_NOTIFIER);
197
198 ret = cpufreq_register_driver(&loongson2_cpufreq_driver);
199
200 if (!ret && !nowait) {
201 saved_cpu_wait = cpu_wait;
202 cpu_wait = loongson2_cpu_wait;
203 }
204
205 return ret;
206}
207
208static void __exit cpufreq_exit(void)
209{
210 if (!nowait && saved_cpu_wait)
211 cpu_wait = saved_cpu_wait;
212 cpufreq_unregister_driver(&loongson2_cpufreq_driver);
213 cpufreq_unregister_notifier(&loongson2_cpufreq_notifier_block,
214 CPUFREQ_TRANSITION_NOTIFIER);
215
216 platform_driver_unregister(&platform_driver);
217}
218
219module_init(cpufreq_init);
220module_exit(cpufreq_exit);
221
222module_param(nowait, uint, 0644);
223MODULE_PARM_DESC(nowait, "Disable Loongson-2F specific wait");
224
225MODULE_AUTHOR("Yanhua <yanh@lemote.com>");
226MODULE_DESCRIPTION("cpufreq driver for Loongson2F");
227MODULE_LICENSE("GPL");
diff --git a/arch/mips/kernel/csrc-powertv.c b/arch/mips/kernel/csrc-powertv.c
new file mode 100644
index 000000000000..a27c16c8690e
--- /dev/null
+++ b/arch/mips/kernel/csrc-powertv.c
@@ -0,0 +1,180 @@
1/*
2 * Copyright (C) 2008 Scientific-Atlanta, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18/*
19 * The file comes from kernel/csrc-r4k.c
20 */
21#include <linux/clocksource.h>
22#include <linux/init.h>
23
24#include <asm/time.h> /* Not included in linux/time.h */
25
26#include <asm/mach-powertv/asic_regs.h>
27#include "powertv-clock.h"
28
29/* MIPS PLL Register Definitions */
30#define PLL_GET_M(x) (((x) >> 8) & 0x000000FF)
31#define PLL_GET_N(x) (((x) >> 16) & 0x000000FF)
32#define PLL_GET_P(x) (((x) >> 24) & 0x00000007)
33
34/*
35 * returns: Clock frequency in kHz
36 */
37unsigned int __init mips_get_pll_freq(void)
38{
39 unsigned int pll_reg, m, n, p;
40 unsigned int fin = 54000; /* Base frequency in kHz */
41 unsigned int fout;
42
43 /* Read PLL register setting */
44 pll_reg = asic_read(mips_pll_setup);
45 m = PLL_GET_M(pll_reg);
46 n = PLL_GET_N(pll_reg);
47 p = PLL_GET_P(pll_reg);
48 pr_info("MIPS PLL Register:0x%x M=%d N=%d P=%d\n", pll_reg, m, n, p);
49
50 /* Calculate clock frequency = (2 * N * 54MHz) / (M * (2**P)) */
51 fout = ((2 * n * fin) / (m * (0x01 << p)));
52
53 pr_info("MIPS Clock Freq=%d kHz\n", fout);
54
55 return fout;
56}
57
58static cycle_t c0_hpt_read(struct clocksource *cs)
59{
60 return read_c0_count();
61}
62
63static struct clocksource clocksource_mips = {
64 .name = "powertv-counter",
65 .read = c0_hpt_read,
66 .mask = CLOCKSOURCE_MASK(32),
67 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
68};
69
70static void __init powertv_c0_hpt_clocksource_init(void)
71{
72 unsigned int pll_freq = mips_get_pll_freq();
73
74 pr_info("CPU frequency %d.%02d MHz\n", pll_freq / 1000,
75 (pll_freq % 1000) * 100 / 1000);
76
77 mips_hpt_frequency = pll_freq / 2 * 1000;
78
79 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
80
81 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
82
83 clocksource_register(&clocksource_mips);
84}
85
86/**
87 * struct tim_c - free running counter
88 * @hi: High 16 bits of the counter
89 * @lo: Low 32 bits of the counter
90 *
91 * Lays out the structure of the free running counter in memory. This counter
92 * increments at a rate of 27 MHz/8 on all platforms.
93 */
94struct tim_c {
95 unsigned int hi;
96 unsigned int lo;
97};
98
99static struct tim_c *tim_c;
100
101static cycle_t tim_c_read(struct clocksource *cs)
102{
103 unsigned int hi;
104 unsigned int next_hi;
105 unsigned int lo;
106
107 hi = readl(&tim_c->hi);
108
109 for (;;) {
110 lo = readl(&tim_c->lo);
111 next_hi = readl(&tim_c->hi);
112 if (next_hi == hi)
113 break;
114 hi = next_hi;
115 }
116
117pr_crit("%s: read %llx\n", __func__, ((u64) hi << 32) | lo);
118 return ((u64) hi << 32) | lo;
119}
120
121#define TIM_C_SIZE 48 /* # bits in the timer */
122
123static struct clocksource clocksource_tim_c = {
124 .name = "powertv-tim_c",
125 .read = tim_c_read,
126 .mask = CLOCKSOURCE_MASK(TIM_C_SIZE),
127 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
128};
129
130/**
131 * powertv_tim_c_clocksource_init - set up a clock source for the TIM_C clock
132 *
133 * The hard part here is coming up with a constant k and shift s such that
134 * the 48-bit TIM_C value multiplied by k doesn't overflow and that value,
135 * when shifted right by s, yields the corresponding number of nanoseconds.
136 * We know that TIM_C counts at 27 MHz/8, so each cycle corresponds to
137 * 1 / (27,000,000/8) seconds. Multiply that by a billion and you get the
138 * number of nanoseconds. Since the TIM_C value has 48 bits and the math is
139 * done in 64 bits, avoiding an overflow means that k must be less than
140 * 64 - 48 = 16 bits.
141 */
142static void __init powertv_tim_c_clocksource_init(void)
143{
144 int prescale;
145 unsigned long dividend;
146 unsigned long k;
147 int s;
148 const int max_k_bits = (64 - 48) - 1;
149 const unsigned long billion = 1000000000;
150 const unsigned long counts_per_second = 27000000 / 8;
151
152 prescale = BITS_PER_LONG - ilog2(billion) - 1;
153 dividend = billion << prescale;
154 k = dividend / counts_per_second;
155 s = ilog2(k) - max_k_bits;
156
157 if (s < 0)
158 s = prescale;
159
160 else {
161 k >>= s;
162 s += prescale;
163 }
164
165 clocksource_tim_c.mult = k;
166 clocksource_tim_c.shift = s;
167 clocksource_tim_c.rating = 200;
168
169 clocksource_register(&clocksource_tim_c);
170 tim_c = (struct tim_c *) asic_reg_addr(tim_ch);
171}
172
173/**
174 powertv_clocksource_init - initialize all clocksources
175 */
176void __init powertv_clocksource_init(void)
177{
178 powertv_c0_hpt_clocksource_init();
179 powertv_tim_c_clocksource_init();
180}
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
new file mode 100644
index 000000000000..68b067040d8b
--- /dev/null
+++ b/arch/mips/kernel/ftrace.c
@@ -0,0 +1,275 @@
1/*
2 * Code for replacing ftrace calls with jumps.
3 *
4 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
5 * Copyright (C) 2009 DSLab, Lanzhou University, China
6 * Author: Wu Zhangjin <wuzj@lemote.com>
7 *
8 * Thanks goes to Steven Rostedt for writing the original x86 version.
9 */
10
11#include <linux/uaccess.h>
12#include <linux/init.h>
13#include <linux/ftrace.h>
14
15#include <asm/cacheflush.h>
16#include <asm/asm.h>
17#include <asm/asm-offsets.h>
18
19#ifdef CONFIG_DYNAMIC_FTRACE
20
21#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */
22#define ADDR_MASK 0x03ffffff /* op_code|addr : 31...26|25 ....0 */
23#define jump_insn_encode(op_code, addr) \
24 ((unsigned int)((op_code) | (((addr) >> 2) & ADDR_MASK)))
25
26static unsigned int ftrace_nop = 0x00000000;
27
28static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
29{
30 int faulted;
31
32 /* *(unsigned int *)ip = new_code; */
33 safe_store_code(new_code, ip, faulted);
34
35 if (unlikely(faulted))
36 return -EFAULT;
37
38 flush_icache_range(ip, ip + 8);
39
40 return 0;
41}
42
43static int lui_v1;
44static int jal_mcount;
45
46int ftrace_make_nop(struct module *mod,
47 struct dyn_ftrace *rec, unsigned long addr)
48{
49 unsigned int new;
50 int faulted;
51 unsigned long ip = rec->ip;
52
53 /* We have compiled module with -mlong-calls, but compiled the kernel
54 * without it, we need to cope with them respectively. */
55 if (ip & 0x40000000) {
56 /* record it for ftrace_make_call */
57 if (lui_v1 == 0) {
58 /* lui_v1 = *(unsigned int *)ip; */
59 safe_load_code(lui_v1, ip, faulted);
60
61 if (unlikely(faulted))
62 return -EFAULT;
63 }
64
65 /* lui v1, hi_16bit_of_mcount --> b 1f (0x10000004)
66 * addiu v1, v1, low_16bit_of_mcount
67 * move at, ra
68 * jalr v1
69 * nop
70 * 1f: (ip + 12)
71 */
72 new = 0x10000004;
73 } else {
74 /* record/calculate it for ftrace_make_call */
75 if (jal_mcount == 0) {
76 /* We can record it directly like this:
77 * jal_mcount = *(unsigned int *)ip;
78 * Herein, jump over the first two nop instructions */
79 jal_mcount = jump_insn_encode(JAL, (MCOUNT_ADDR + 8));
80 }
81
82 /* move at, ra
83 * jalr v1 --> nop
84 */
85 new = ftrace_nop;
86 }
87 return ftrace_modify_code(ip, new);
88}
89
90static int modified; /* initialized as 0 by default */
91
92int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
93{
94 unsigned int new;
95 unsigned long ip = rec->ip;
96
97 /* We just need to remove the "b ftrace_stub" at the fist time! */
98 if (modified == 0) {
99 modified = 1;
100 ftrace_modify_code(addr, ftrace_nop);
101 }
102 /* ip, module: 0xc0000000, kernel: 0x80000000 */
103 new = (ip & 0x40000000) ? lui_v1 : jal_mcount;
104
105 return ftrace_modify_code(ip, new);
106}
107
108#define FTRACE_CALL_IP ((unsigned long)(&ftrace_call))
109
110int ftrace_update_ftrace_func(ftrace_func_t func)
111{
112 unsigned int new;
113
114 new = jump_insn_encode(JAL, (unsigned long)func);
115
116 return ftrace_modify_code(FTRACE_CALL_IP, new);
117}
118
119int __init ftrace_dyn_arch_init(void *data)
120{
121 /* The return code is retured via data */
122 *(unsigned long *)data = 0;
123
124 return 0;
125}
126#endif /* CONFIG_DYNAMIC_FTRACE */
127
128#ifdef CONFIG_FUNCTION_GRAPH_TRACER
129
130#ifdef CONFIG_DYNAMIC_FTRACE
131
132extern void ftrace_graph_call(void);
133#define JMP 0x08000000 /* jump to target directly */
134#define CALL_FTRACE_GRAPH_CALLER \
135 jump_insn_encode(JMP, (unsigned long)(&ftrace_graph_caller))
136#define FTRACE_GRAPH_CALL_IP ((unsigned long)(&ftrace_graph_call))
137
138int ftrace_enable_ftrace_graph_caller(void)
139{
140 return ftrace_modify_code(FTRACE_GRAPH_CALL_IP,
141 CALL_FTRACE_GRAPH_CALLER);
142}
143
144int ftrace_disable_ftrace_graph_caller(void)
145{
146 return ftrace_modify_code(FTRACE_GRAPH_CALL_IP, ftrace_nop);
147}
148
149#endif /* !CONFIG_DYNAMIC_FTRACE */
150
151#ifndef KBUILD_MCOUNT_RA_ADDRESS
152#define S_RA_SP (0xafbf << 16) /* s{d,w} ra, offset(sp) */
153#define S_R_SP (0xafb0 << 16) /* s{d,w} R, offset(sp) */
154#define OFFSET_MASK 0xffff /* stack offset range: 0 ~ PT_SIZE */
155
156unsigned long ftrace_get_parent_addr(unsigned long self_addr,
157 unsigned long parent,
158 unsigned long parent_addr,
159 unsigned long fp)
160{
161 unsigned long sp, ip, ra;
162 unsigned int code;
163 int faulted;
164
165 /* in module or kernel? */
166 if (self_addr & 0x40000000) {
167 /* module: move to the instruction "lui v1, HI_16BIT_OF_MCOUNT" */
168 ip = self_addr - 20;
169 } else {
170 /* kernel: move to the instruction "move ra, at" */
171 ip = self_addr - 12;
172 }
173
174 /* search the text until finding the non-store instruction or "s{d,w}
175 * ra, offset(sp)" instruction */
176 do {
177 ip -= 4;
178
179 /* get the code at "ip": code = *(unsigned int *)ip; */
180 safe_load_code(code, ip, faulted);
181
182 if (unlikely(faulted))
183 return 0;
184
185 /* If we hit the non-store instruction before finding where the
186 * ra is stored, then this is a leaf function and it does not
187 * store the ra on the stack. */
188 if ((code & S_R_SP) != S_R_SP)
189 return parent_addr;
190
191 } while (((code & S_RA_SP) != S_RA_SP));
192
193 sp = fp + (code & OFFSET_MASK);
194
195 /* ra = *(unsigned long *)sp; */
196 safe_load_stack(ra, sp, faulted);
197 if (unlikely(faulted))
198 return 0;
199
200 if (ra == parent)
201 return sp;
202 return 0;
203}
204
205#endif
206
207/*
208 * Hook the return address and push it in the stack of return addrs
209 * in current thread info.
210 */
211void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
212 unsigned long fp)
213{
214 unsigned long old;
215 struct ftrace_graph_ent trace;
216 unsigned long return_hooker = (unsigned long)
217 &return_to_handler;
218 int faulted;
219
220 if (unlikely(atomic_read(&current->tracing_graph_pause)))
221 return;
222
223 /* "parent" is the stack address saved the return address of the caller
224 * of _mcount.
225 *
226 * if the gcc < 4.5, a leaf function does not save the return address
227 * in the stack address, so, we "emulate" one in _mcount's stack space,
228 * and hijack it directly, but for a non-leaf function, it save the
229 * return address to the its own stack space, we can not hijack it
230 * directly, but need to find the real stack address,
231 * ftrace_get_parent_addr() does it!
232 *
233 * if gcc>= 4.5, with the new -mmcount-ra-address option, for a
234 * non-leaf function, the location of the return address will be saved
235 * to $12 for us, and for a leaf function, only put a zero into $12. we
236 * do it in ftrace_graph_caller of mcount.S.
237 */
238
239 /* old = *parent; */
240 safe_load_stack(old, parent, faulted);
241 if (unlikely(faulted))
242 goto out;
243#ifndef KBUILD_MCOUNT_RA_ADDRESS
244 parent = (unsigned long *)ftrace_get_parent_addr(self_addr, old,
245 (unsigned long)parent,
246 fp);
247 /* If fails when getting the stack address of the non-leaf function's
248 * ra, stop function graph tracer and return */
249 if (parent == 0)
250 goto out;
251#endif
252 /* *parent = return_hooker; */
253 safe_store_stack(return_hooker, parent, faulted);
254 if (unlikely(faulted))
255 goto out;
256
257 if (ftrace_push_return_trace(old, self_addr, &trace.depth, fp) ==
258 -EBUSY) {
259 *parent = old;
260 return;
261 }
262
263 trace.func = self_addr;
264
265 /* Only trace if the calling function expects to */
266 if (!ftrace_graph_entry(&trace)) {
267 current->curr_ret_stack--;
268 *parent = old;
269 }
270 return;
271out:
272 ftrace_graph_stop();
273 WARN_ON(1);
274}
275#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 8b0b4181219f..981f86c26168 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -22,6 +22,7 @@
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/kallsyms.h> 23#include <linux/kallsyms.h>
24#include <linux/kgdb.h> 24#include <linux/kgdb.h>
25#include <linux/ftrace.h>
25 26
26#include <asm/atomic.h> 27#include <asm/atomic.h>
27#include <asm/system.h> 28#include <asm/system.h>
@@ -150,3 +151,32 @@ void __init init_IRQ(void)
150 kgdb_early_setup = 1; 151 kgdb_early_setup = 1;
151#endif 152#endif
152} 153}
154
155/*
156 * do_IRQ handles all normal device IRQ's (the special
157 * SMP cross-CPU interrupts have their own specific
158 * handlers).
159 */
160void __irq_entry do_IRQ(unsigned int irq)
161{
162 irq_enter();
163 __DO_IRQ_SMTC_HOOK(irq);
164 generic_handle_irq(irq);
165 irq_exit();
166}
167
168#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
169/*
170 * To avoid inefficient and in some cases pathological re-checking of
171 * IRQ affinity, we have this variant that skips the affinity check.
172 */
173
174void __irq_entry do_IRQ_no_affinity(unsigned int irq)
175{
176 irq_enter();
177 __NO_AFFINITY_IRQ_SMTC_HOOK(irq);
178 generic_handle_irq(irq);
179 irq_exit();
180}
181
182#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
new file mode 100644
index 000000000000..0a9cfdb271dd
--- /dev/null
+++ b/arch/mips/kernel/mcount.S
@@ -0,0 +1,189 @@
1/*
2 * MIPS specific _mcount support
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive for
6 * more details.
7 *
8 * Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University, China
9 * Author: Wu Zhangjin <wuzj@lemote.com>
10 */
11
12#include <asm/regdef.h>
13#include <asm/stackframe.h>
14#include <asm/ftrace.h>
15
16 .text
17 .set noreorder
18 .set noat
19
20 .macro MCOUNT_SAVE_REGS
21 PTR_SUBU sp, PT_SIZE
22 PTR_S ra, PT_R31(sp)
23 PTR_S AT, PT_R1(sp)
24 PTR_S a0, PT_R4(sp)
25 PTR_S a1, PT_R5(sp)
26 PTR_S a2, PT_R6(sp)
27 PTR_S a3, PT_R7(sp)
28#ifdef CONFIG_64BIT
29 PTR_S a4, PT_R8(sp)
30 PTR_S a5, PT_R9(sp)
31 PTR_S a6, PT_R10(sp)
32 PTR_S a7, PT_R11(sp)
33#endif
34 .endm
35
36 .macro MCOUNT_RESTORE_REGS
37 PTR_L ra, PT_R31(sp)
38 PTR_L AT, PT_R1(sp)
39 PTR_L a0, PT_R4(sp)
40 PTR_L a1, PT_R5(sp)
41 PTR_L a2, PT_R6(sp)
42 PTR_L a3, PT_R7(sp)
43#ifdef CONFIG_64BIT
44 PTR_L a4, PT_R8(sp)
45 PTR_L a5, PT_R9(sp)
46 PTR_L a6, PT_R10(sp)
47 PTR_L a7, PT_R11(sp)
48#endif
49#ifdef CONFIG_64BIT
50 PTR_ADDIU sp, PT_SIZE
51#else
52 PTR_ADDIU sp, (PT_SIZE + 8)
53#endif
54.endm
55
56 .macro RETURN_BACK
57 jr ra
58 move ra, AT
59 .endm
60
61#ifdef CONFIG_DYNAMIC_FTRACE
62
63NESTED(ftrace_caller, PT_SIZE, ra)
64 .globl _mcount
65_mcount:
66 b ftrace_stub
67 nop
68 lw t1, function_trace_stop
69 bnez t1, ftrace_stub
70 nop
71
72 MCOUNT_SAVE_REGS
73#ifdef KBUILD_MCOUNT_RA_ADDRESS
74 PTR_S t0, PT_R12(sp) /* t0 saved the location of the return address(at) by -mmcount-ra-address */
75#endif
76
77 move a0, ra /* arg1: next ip, selfaddr */
78 .globl ftrace_call
79ftrace_call:
80 nop /* a placeholder for the call to a real tracing function */
81 move a1, AT /* arg2: the caller's next ip, parent */
82
83#ifdef CONFIG_FUNCTION_GRAPH_TRACER
84 .globl ftrace_graph_call
85ftrace_graph_call:
86 nop
87 nop
88#endif
89
90 MCOUNT_RESTORE_REGS
91 .globl ftrace_stub
92ftrace_stub:
93 RETURN_BACK
94 END(ftrace_caller)
95
96#else /* ! CONFIG_DYNAMIC_FTRACE */
97
98NESTED(_mcount, PT_SIZE, ra)
99 lw t1, function_trace_stop
100 bnez t1, ftrace_stub
101 nop
102 PTR_LA t1, ftrace_stub
103 PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */
104 bne t1, t2, static_trace
105 nop
106
107#ifdef CONFIG_FUNCTION_GRAPH_TRACER
108 PTR_L t3, ftrace_graph_return
109 bne t1, t3, ftrace_graph_caller
110 nop
111 PTR_LA t1, ftrace_graph_entry_stub
112 PTR_L t3, ftrace_graph_entry
113 bne t1, t3, ftrace_graph_caller
114 nop
115#endif
116 b ftrace_stub
117 nop
118
119static_trace:
120 MCOUNT_SAVE_REGS
121
122 move a0, ra /* arg1: next ip, selfaddr */
123 jalr t2 /* (1) call *ftrace_trace_function */
124 move a1, AT /* arg2: the caller's next ip, parent */
125
126 MCOUNT_RESTORE_REGS
127 .globl ftrace_stub
128ftrace_stub:
129 RETURN_BACK
130 END(_mcount)
131
132#endif /* ! CONFIG_DYNAMIC_FTRACE */
133
134#ifdef CONFIG_FUNCTION_GRAPH_TRACER
135
136NESTED(ftrace_graph_caller, PT_SIZE, ra)
137#ifdef CONFIG_DYNAMIC_FTRACE
138 PTR_L a1, PT_R31(sp) /* load the original ra from the stack */
139#ifdef KBUILD_MCOUNT_RA_ADDRESS
140 PTR_L t0, PT_R12(sp) /* load the original t0 from the stack */
141#endif
142#else
143 MCOUNT_SAVE_REGS
144 move a1, ra /* arg2: next ip, selfaddr */
145#endif
146
147#ifdef KBUILD_MCOUNT_RA_ADDRESS
148 bnez t0, 1f /* non-leaf func: t0 saved the location of the return address */
149 nop
150 PTR_LA t0, PT_R1(sp) /* leaf func: get the location of at(old ra) from our own stack */
1511: move a0, t0 /* arg1: the location of the return address */
152#else
153 PTR_LA a0, PT_R1(sp) /* arg1: &AT -> a0 */
154#endif
155 jal prepare_ftrace_return
156#ifdef CONFIG_FRAME_POINTER
157 move a2, fp /* arg3: frame pointer */
158#else
159#ifdef CONFIG_64BIT
160 PTR_LA a2, PT_SIZE(sp)
161#else
162 PTR_LA a2, (PT_SIZE+8)(sp)
163#endif
164#endif
165
166 MCOUNT_RESTORE_REGS
167 RETURN_BACK
168 END(ftrace_graph_caller)
169
170 .align 2
171 .globl return_to_handler
172return_to_handler:
173 PTR_SUBU sp, PT_SIZE
174 PTR_S v0, PT_R2(sp)
175
176 jal ftrace_return_to_handler
177 PTR_S v1, PT_R3(sp)
178
179 /* restore the real parent address: v0 -> ra */
180 move ra, v0
181
182 PTR_L v0, PT_R2(sp)
183 PTR_L v1, PT_R3(sp)
184 jr ra
185 PTR_ADDIU sp, PT_SIZE
186#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
187
188 .set at
189 .set reorder
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 225755d0c1f6..1d04807874db 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -13,6 +13,7 @@
13#include <asm/checksum.h> 13#include <asm/checksum.h>
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/ftrace.h>
16 17
17extern void *__bzero(void *__s, size_t __count); 18extern void *__bzero(void *__s, size_t __count);
18extern long __strncpy_from_user_nocheck_asm(char *__to, 19extern long __strncpy_from_user_nocheck_asm(char *__to,
@@ -51,3 +52,7 @@ EXPORT_SYMBOL(csum_partial_copy_nocheck);
51EXPORT_SYMBOL(__csum_partial_copy_user); 52EXPORT_SYMBOL(__csum_partial_copy_user);
52 53
53EXPORT_SYMBOL(invalid_pte_table); 54EXPORT_SYMBOL(invalid_pte_table);
55#ifdef CONFIG_FUNCTION_TRACER
56/* _mcount is defined in arch/mips/kernel/mcount.S */
57EXPORT_SYMBOL(_mcount);
58#endif
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 2b290d70083e..f9513f9e61d3 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -58,8 +58,12 @@ EXPORT_SYMBOL(mips_machtype);
58 58
59struct boot_mem_map boot_mem_map; 59struct boot_mem_map boot_mem_map;
60 60
61static char command_line[CL_SIZE]; 61static char __initdata command_line[COMMAND_LINE_SIZE];
62 char arcs_cmdline[CL_SIZE]=CONFIG_CMDLINE; 62char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
63
64#ifdef CONFIG_CMDLINE_BOOL
65static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
66#endif
63 67
64/* 68/*
65 * mips_io_port_base is the begin of the address space to which x86 style 69 * mips_io_port_base is the begin of the address space to which x86 style
@@ -166,26 +170,8 @@ static unsigned long __init init_initrd(void)
166 * already set up initrd_start and initrd_end. In these cases 170 * already set up initrd_start and initrd_end. In these cases
167 * perfom sanity checks and use them if all looks good. 171 * perfom sanity checks and use them if all looks good.
168 */ 172 */
169 if (!initrd_start || initrd_end <= initrd_start) { 173 if (!initrd_start || initrd_end <= initrd_start)
170#ifdef CONFIG_PROBE_INITRD_HEADER
171 u32 *initrd_header;
172
173 /*
174 * See if initrd has been added to the kernel image by
175 * arch/mips/boot/addinitrd.c. In that case a header is
176 * prepended to initrd and is made up by 8 bytes. The first
177 * word is a magic number and the second one is the size of
178 * initrd. Initrd start must be page aligned in any cases.
179 */
180 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
181 if (initrd_header[0] != 0x494E5244)
182 goto disable;
183 initrd_start = (unsigned long)(initrd_header + 2);
184 initrd_end = initrd_start + initrd_header[1];
185#else
186 goto disable; 174 goto disable;
187#endif
188 }
189 175
190 if (initrd_start & ~PAGE_MASK) { 176 if (initrd_start & ~PAGE_MASK) {
191 pr_err("initrd start must be page aligned\n"); 177 pr_err("initrd start must be page aligned\n");
@@ -476,8 +462,20 @@ static void __init arch_mem_init(char **cmdline_p)
476 pr_info("Determined physical RAM map:\n"); 462 pr_info("Determined physical RAM map:\n");
477 print_memory_map(); 463 print_memory_map();
478 464
479 strlcpy(command_line, arcs_cmdline, sizeof(command_line)); 465#ifdef CONFIG_CMDLINE_BOOL
480 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 466#ifdef CONFIG_CMDLINE_OVERRIDE
467 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
468#else
469 if (builtin_cmdline[0]) {
470 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
471 strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE);
472 }
473 strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
474#endif
475#else
476 strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE);
477#endif
478 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
481 479
482 *cmdline_p = command_line; 480 *cmdline_p = command_line;
483 481
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 6254041b942f..d0c68b5d717b 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -35,6 +35,15 @@
35 35
36#include "signal-common.h" 36#include "signal-common.h"
37 37
38static int (*save_fp_context)(struct sigcontext __user *sc);
39static int (*restore_fp_context)(struct sigcontext __user *sc);
40
41extern asmlinkage int _save_fp_context(struct sigcontext __user *sc);
42extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc);
43
44extern asmlinkage int fpu_emulator_save_context(struct sigcontext __user *sc);
45extern asmlinkage int fpu_emulator_restore_context(struct sigcontext __user *sc);
46
38/* 47/*
39 * Horribly complicated - with the bloody RM9000 workarounds enabled 48 * Horribly complicated - with the bloody RM9000 workarounds enabled
40 * the signal trampolines is moving to the end of the structure so we can 49 * the signal trampolines is moving to the end of the structure so we can
@@ -709,3 +718,40 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
709 key_replace_session_keyring(); 718 key_replace_session_keyring();
710 } 719 }
711} 720}
721
722#ifdef CONFIG_SMP
723static int smp_save_fp_context(struct sigcontext __user *sc)
724{
725 return raw_cpu_has_fpu
726 ? _save_fp_context(sc)
727 : fpu_emulator_save_context(sc);
728}
729
730static int smp_restore_fp_context(struct sigcontext __user *sc)
731{
732 return raw_cpu_has_fpu
733 ? _restore_fp_context(sc)
734 : fpu_emulator_restore_context(sc);
735}
736#endif
737
738static int signal_setup(void)
739{
740#ifdef CONFIG_SMP
741 /* For now just do the cpu_has_fpu check when the functions are invoked */
742 save_fp_context = smp_save_fp_context;
743 restore_fp_context = smp_restore_fp_context;
744#else
745 if (cpu_has_fpu) {
746 save_fp_context = _save_fp_context;
747 restore_fp_context = _restore_fp_context;
748 } else {
749 save_fp_context = fpu_emulator_save_context;
750 restore_fp_context = fpu_emulator_restore_context;
751 }
752#endif
753
754 return 0;
755}
756
757arch_initcall(signal_setup);
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 2e74075ac0ca..03abaf048f09 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -35,6 +35,15 @@
35 35
36#include "signal-common.h" 36#include "signal-common.h"
37 37
38static int (*save_fp_context32)(struct sigcontext32 __user *sc);
39static int (*restore_fp_context32)(struct sigcontext32 __user *sc);
40
41extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc);
42extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc);
43
44extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 __user *sc);
45extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user *sc);
46
38/* 47/*
39 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ... 48 * Including <asm/unistd.h> would give use the 64-bit syscall numbers ...
40 */ 49 */
@@ -828,3 +837,18 @@ SYSCALL_DEFINE5(32_waitid, int, which, compat_pid_t, pid,
828 info.si_code |= __SI_CHLD; 837 info.si_code |= __SI_CHLD;
829 return copy_siginfo_to_user32(uinfo, &info); 838 return copy_siginfo_to_user32(uinfo, &info);
830} 839}
840
841static int signal32_init(void)
842{
843 if (cpu_has_fpu) {
844 save_fp_context32 = _save_fp_context32;
845 restore_fp_context32 = _restore_fp_context32;
846 } else {
847 save_fp_context32 = fpu_emulator_save_context32;
848 restore_fp_context32 = fpu_emulator_restore_context32;
849 }
850
851 return 0;
852}
853
854arch_initcall(signal32_init);
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index e72e6844d134..6cdca1956b77 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -32,6 +32,7 @@
32#include <linux/cpumask.h> 32#include <linux/cpumask.h>
33#include <linux/cpu.h> 33#include <linux/cpu.h>
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/ftrace.h>
35 36
36#include <asm/atomic.h> 37#include <asm/atomic.h>
37#include <asm/cpu.h> 38#include <asm/cpu.h>
@@ -130,7 +131,7 @@ asmlinkage __cpuinit void start_secondary(void)
130/* 131/*
131 * Call into both interrupt handlers, as we share the IPI for them 132 * Call into both interrupt handlers, as we share the IPI for them
132 */ 133 */
133void smp_call_function_interrupt(void) 134void __irq_entry smp_call_function_interrupt(void)
134{ 135{
135 irq_enter(); 136 irq_enter();
136 generic_smp_call_function_single_interrupt(); 137 generic_smp_call_function_single_interrupt();
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index a38e3ee95515..23499b5bd9c3 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/ftrace.h>
28 29
29#include <asm/cpu.h> 30#include <asm/cpu.h>
30#include <asm/processor.h> 31#include <asm/processor.h>
@@ -939,23 +940,29 @@ static void ipi_call_interrupt(void)
939 940
940DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device); 941DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
941 942
942void ipi_decode(struct smtc_ipi *pipi) 943static void __irq_entry smtc_clock_tick_interrupt(void)
943{ 944{
944 unsigned int cpu = smp_processor_id(); 945 unsigned int cpu = smp_processor_id();
945 struct clock_event_device *cd; 946 struct clock_event_device *cd;
947 int irq = MIPS_CPU_IRQ_BASE + 1;
948
949 irq_enter();
950 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
951 cd = &per_cpu(mips_clockevent_device, cpu);
952 cd->event_handler(cd);
953 irq_exit();
954}
955
956void ipi_decode(struct smtc_ipi *pipi)
957{
946 void *arg_copy = pipi->arg; 958 void *arg_copy = pipi->arg;
947 int type_copy = pipi->type; 959 int type_copy = pipi->type;
948 int irq = MIPS_CPU_IRQ_BASE + 1;
949 960
950 smtc_ipi_nq(&freeIPIq, pipi); 961 smtc_ipi_nq(&freeIPIq, pipi);
951 962
952 switch (type_copy) { 963 switch (type_copy) {
953 case SMTC_CLOCK_TICK: 964 case SMTC_CLOCK_TICK:
954 irq_enter(); 965 smtc_clock_tick_interrupt();
955 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
956 cd = &per_cpu(mips_clockevent_device, cpu);
957 cd->event_handler(cd);
958 irq_exit();
959 break; 966 break;
960 967
961 case LINUX_SMP_IPI: 968 case LINUX_SMP_IPI:
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 0a18b4c62afb..308e43460864 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -25,10 +25,12 @@
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/kgdb.h> 26#include <linux/kgdb.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/notifier.h>
28 29
29#include <asm/bootinfo.h> 30#include <asm/bootinfo.h>
30#include <asm/branch.h> 31#include <asm/branch.h>
31#include <asm/break.h> 32#include <asm/break.h>
33#include <asm/cop2.h>
32#include <asm/cpu.h> 34#include <asm/cpu.h>
33#include <asm/dsp.h> 35#include <asm/dsp.h>
34#include <asm/fpu.h> 36#include <asm/fpu.h>
@@ -79,10 +81,6 @@ extern asmlinkage void handle_reserved(void);
79extern int fpu_emulator_cop1Handler(struct pt_regs *xcp, 81extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
80 struct mips_fpu_struct *ctx, int has_fpu); 82 struct mips_fpu_struct *ctx, int has_fpu);
81 83
82#ifdef CONFIG_CPU_CAVIUM_OCTEON
83extern asmlinkage void octeon_cop2_restore(struct octeon_cop2_state *task);
84#endif
85
86void (*board_be_init)(void); 84void (*board_be_init)(void);
87int (*board_be_handler)(struct pt_regs *regs, int is_fixup); 85int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
88void (*board_nmi_handler_setup)(void); 86void (*board_nmi_handler_setup)(void);
@@ -857,6 +855,44 @@ static void mt_ase_fp_affinity(void)
857#endif /* CONFIG_MIPS_MT_FPAFF */ 855#endif /* CONFIG_MIPS_MT_FPAFF */
858} 856}
859 857
858/*
859 * No lock; only written during early bootup by CPU 0.
860 */
861static RAW_NOTIFIER_HEAD(cu2_chain);
862
863int __ref register_cu2_notifier(struct notifier_block *nb)
864{
865 return raw_notifier_chain_register(&cu2_chain, nb);
866}
867
868int cu2_notifier_call_chain(unsigned long val, void *v)
869{
870 return raw_notifier_call_chain(&cu2_chain, val, v);
871}
872
873static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
874 void *data)
875{
876 struct pt_regs *regs = data;
877
878 switch (action) {
879 default:
880 die_if_kernel("Unhandled kernel unaligned access or invalid "
881 "instruction", regs);
882 /* Fall through */
883
884 case CU2_EXCEPTION:
885 force_sig(SIGILL, current);
886 }
887
888 return NOTIFY_OK;
889}
890
891static struct notifier_block default_cu2_notifier = {
892 .notifier_call = default_cu2_call,
893 .priority = 0x80000000, /* Run last */
894};
895
860asmlinkage void do_cpu(struct pt_regs *regs) 896asmlinkage void do_cpu(struct pt_regs *regs)
861{ 897{
862 unsigned int __user *epc; 898 unsigned int __user *epc;
@@ -920,17 +956,9 @@ asmlinkage void do_cpu(struct pt_regs *regs)
920 return; 956 return;
921 957
922 case 2: 958 case 2:
923#ifdef CONFIG_CPU_CAVIUM_OCTEON 959 raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs);
924 prefetch(&current->thread.cp2); 960 break;
925 local_irq_save(flags); 961
926 KSTK_STATUS(current) |= ST0_CU2;
927 status = read_c0_status();
928 write_c0_status(status | ST0_CU2);
929 octeon_cop2_restore(&(current->thread.cp2));
930 write_c0_status(status & ~ST0_CU2);
931 local_irq_restore(flags);
932 return;
933#endif
934 case 3: 962 case 3:
935 break; 963 break;
936 } 964 }
@@ -1367,77 +1395,6 @@ void *set_vi_handler(int n, vi_handler_t addr)
1367 return set_vi_srs_handler(n, addr, 0); 1395 return set_vi_srs_handler(n, addr, 0);
1368} 1396}
1369 1397
1370/*
1371 * This is used by native signal handling
1372 */
1373asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
1374asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
1375
1376extern asmlinkage int _save_fp_context(struct sigcontext __user *sc);
1377extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc);
1378
1379extern asmlinkage int fpu_emulator_save_context(struct sigcontext __user *sc);
1380extern asmlinkage int fpu_emulator_restore_context(struct sigcontext __user *sc);
1381
1382#ifdef CONFIG_SMP
1383static int smp_save_fp_context(struct sigcontext __user *sc)
1384{
1385 return raw_cpu_has_fpu
1386 ? _save_fp_context(sc)
1387 : fpu_emulator_save_context(sc);
1388}
1389
1390static int smp_restore_fp_context(struct sigcontext __user *sc)
1391{
1392 return raw_cpu_has_fpu
1393 ? _restore_fp_context(sc)
1394 : fpu_emulator_restore_context(sc);
1395}
1396#endif
1397
1398static inline void signal_init(void)
1399{
1400#ifdef CONFIG_SMP
1401 /* For now just do the cpu_has_fpu check when the functions are invoked */
1402 save_fp_context = smp_save_fp_context;
1403 restore_fp_context = smp_restore_fp_context;
1404#else
1405 if (cpu_has_fpu) {
1406 save_fp_context = _save_fp_context;
1407 restore_fp_context = _restore_fp_context;
1408 } else {
1409 save_fp_context = fpu_emulator_save_context;
1410 restore_fp_context = fpu_emulator_restore_context;
1411 }
1412#endif
1413}
1414
1415#ifdef CONFIG_MIPS32_COMPAT
1416
1417/*
1418 * This is used by 32-bit signal stuff on the 64-bit kernel
1419 */
1420asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
1421asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
1422
1423extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc);
1424extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc);
1425
1426extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 __user *sc);
1427extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user *sc);
1428
1429static inline void signal32_init(void)
1430{
1431 if (cpu_has_fpu) {
1432 save_fp_context32 = _save_fp_context32;
1433 restore_fp_context32 = _restore_fp_context32;
1434 } else {
1435 save_fp_context32 = fpu_emulator_save_context32;
1436 restore_fp_context32 = fpu_emulator_restore_context32;
1437 }
1438}
1439#endif
1440
1441extern void cpu_cache_init(void); 1398extern void cpu_cache_init(void);
1442extern void tlb_init(void); 1399extern void tlb_init(void);
1443extern void flush_tlb_handlers(void); 1400extern void flush_tlb_handlers(void);
@@ -1751,13 +1708,10 @@ void __init trap_init(void)
1751 else 1708 else
1752 memcpy((void *)(ebase + 0x080), &except_vec3_generic, 0x80); 1709 memcpy((void *)(ebase + 0x080), &except_vec3_generic, 0x80);
1753 1710
1754 signal_init();
1755#ifdef CONFIG_MIPS32_COMPAT
1756 signal32_init();
1757#endif
1758
1759 local_flush_icache_range(ebase, ebase + 0x400); 1711 local_flush_icache_range(ebase, ebase + 0x400);
1760 flush_tlb_handlers(); 1712 flush_tlb_handlers();
1761 1713
1762 sort_extable(__start___dbe_table, __stop___dbe_table); 1714 sort_extable(__start___dbe_table, __stop___dbe_table);
1715
1716 register_cu2_notifier(&default_cu2_notifier);
1763} 1717}
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 67bd626942ab..69b039ca8d83 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -81,6 +81,7 @@
81#include <asm/asm.h> 81#include <asm/asm.h>
82#include <asm/branch.h> 82#include <asm/branch.h>
83#include <asm/byteorder.h> 83#include <asm/byteorder.h>
84#include <asm/cop2.h>
84#include <asm/inst.h> 85#include <asm/inst.h>
85#include <asm/uaccess.h> 86#include <asm/uaccess.h>
86#include <asm/system.h> 87#include <asm/system.h>
@@ -451,17 +452,27 @@ static void emulate_load_store_insn(struct pt_regs *regs,
451 */ 452 */
452 goto sigbus; 453 goto sigbus;
453 454
455 /*
456 * COP2 is available to implementor for application specific use.
457 * It's up to applications to register a notifier chain and do
458 * whatever they have to do, including possible sending of signals.
459 */
454 case lwc2_op: 460 case lwc2_op:
461 cu2_notifier_call_chain(CU2_LWC2_OP, regs);
462 break;
463
455 case ldc2_op: 464 case ldc2_op:
465 cu2_notifier_call_chain(CU2_LDC2_OP, regs);
466 break;
467
456 case swc2_op: 468 case swc2_op:
469 cu2_notifier_call_chain(CU2_SWC2_OP, regs);
470 break;
471
457 case sdc2_op: 472 case sdc2_op:
458 /* 473 cu2_notifier_call_chain(CU2_SDC2_OP, regs);
459 * These are the coprocessor 2 load/stores. The current 474 break;
460 * implementations don't use cp2 and cp2 should always be 475
461 * disabled in c0_status. So send SIGILL.
462 * (No longer true: The Sony Praystation uses cp2 for
463 * 3D matrix operations. Dunno if that thingy has a MMU ...)
464 */
465 default: 476 default:
466 /* 477 /*
467 * Pheeee... We encountered an yet unknown instruction or 478 * Pheeee... We encountered an yet unknown instruction or
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 162b29954baa..f25df73db923 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -46,6 +46,7 @@ SECTIONS
46 SCHED_TEXT 46 SCHED_TEXT
47 LOCK_TEXT 47 LOCK_TEXT
48 KPROBES_TEXT 48 KPROBES_TEXT
49 IRQENTRY_TEXT
49 *(.text.*) 50 *(.text.*)
50 *(.fixup) 51 *(.fixup)
51 *(.gnu.warning) 52 *(.gnu.warning)
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c
index 0bb6037afba3..8e388da1926f 100644
--- a/arch/mips/lasat/picvue_proc.c
+++ b/arch/mips/lasat/picvue_proc.c
@@ -4,12 +4,14 @@
4 * Brian Murphy <brian.murphy@eicon.com> 4 * Brian Murphy <brian.murphy@eicon.com>
5 * 5 *
6 */ 6 */
7#include <linux/bug.h>
7#include <linux/kernel.h> 8#include <linux/kernel.h>
8#include <linux/module.h> 9#include <linux/module.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/errno.h> 11#include <linux/errno.h>
11 12
12#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/seq_file.h>
13#include <linux/interrupt.h> 15#include <linux/interrupt.h>
14 16
15#include <linux/timer.h> 17#include <linux/timer.h>
@@ -38,12 +40,9 @@ static void pvc_display(unsigned long data)
38 40
39static DECLARE_TASKLET(pvc_display_tasklet, &pvc_display, 0); 41static DECLARE_TASKLET(pvc_display_tasklet, &pvc_display, 0);
40 42
41static int pvc_proc_read_line(char *page, char **start, 43static int pvc_line_proc_show(struct seq_file *m, void *v)
42 off_t off, int count,
43 int *eof, void *data)
44{ 44{
45 char *origpage = page; 45 int lineno = *(int *)m->private;
46 int lineno = *(int *)data;
47 46
48 if (lineno < 0 || lineno > PVC_NLINES) { 47 if (lineno < 0 || lineno > PVC_NLINES) {
49 printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno); 48 printk(KERN_WARNING "proc_read_line: invalid lineno %d\n", lineno);
@@ -51,45 +50,66 @@ static int pvc_proc_read_line(char *page, char **start,
51 } 50 }
52 51
53 mutex_lock(&pvc_mutex); 52 mutex_lock(&pvc_mutex);
54 page += sprintf(page, "%s\n", pvc_lines[lineno]); 53 seq_printf(m, "%s\n", pvc_lines[lineno]);
55 mutex_unlock(&pvc_mutex); 54 mutex_unlock(&pvc_mutex);
56 55
57 return page - origpage; 56 return 0;
58} 57}
59 58
60static int pvc_proc_write_line(struct file *file, const char *buffer, 59static int pvc_line_proc_open(struct inode *inode, struct file *file)
61 unsigned long count, void *data)
62{ 60{
63 int origcount = count; 61 return single_open(file, pvc_line_proc_show, PDE(inode)->data);
64 int lineno = *(int *)data; 62}
65 63
66 if (lineno < 0 || lineno > PVC_NLINES) { 64static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
67 printk(KERN_WARNING "proc_write_line: invalid lineno %d\n", 65 size_t count, loff_t *pos)
68 lineno); 66{
69 return origcount; 67 int lineno = *(int *)PDE(file->f_path.dentry->d_inode)->data;
70 } 68 char kbuf[PVC_LINELEN];
69 size_t len;
70
71 BUG_ON(lineno < 0 || lineno > PVC_NLINES);
71 72
72 if (count > PVC_LINELEN) 73 len = min(count, sizeof(kbuf) - 1);
73 count = PVC_LINELEN; 74 if (copy_from_user(kbuf, buf, len))
75 return -EFAULT;
76 kbuf[len] = '\0';
74 77
75 if (buffer[count-1] == '\n') 78 if (len > 0 && kbuf[len - 1] == '\n')
76 count--; 79 len--;
77 80
78 mutex_lock(&pvc_mutex); 81 mutex_lock(&pvc_mutex);
79 strncpy(pvc_lines[lineno], buffer, count); 82 strncpy(pvc_lines[lineno], kbuf, len);
80 pvc_lines[lineno][count] = '\0'; 83 pvc_lines[lineno][len] = '\0';
81 mutex_unlock(&pvc_mutex); 84 mutex_unlock(&pvc_mutex);
82 85
83 tasklet_schedule(&pvc_display_tasklet); 86 tasklet_schedule(&pvc_display_tasklet);
84 87
85 return origcount; 88 return count;
86} 89}
87 90
88static int pvc_proc_write_scroll(struct file *file, const char *buffer, 91static const struct file_operations pvc_line_proc_fops = {
89 unsigned long count, void *data) 92 .owner = THIS_MODULE,
93 .open = pvc_line_proc_open,
94 .read = seq_read,
95 .llseek = seq_lseek,
96 .release = single_release,
97 .write = pvc_line_proc_write,
98};
99
100static ssize_t pvc_scroll_proc_write(struct file *file, const char __user *buf,
101 size_t count, loff_t *pos)
90{ 102{
91 int origcount = count; 103 char kbuf[42];
92 int cmd = simple_strtol(buffer, NULL, 10); 104 size_t len;
105 int cmd;
106
107 len = min(count, sizeof(kbuf) - 1);
108 if (copy_from_user(kbuf, buf, len))
109 return -EFAULT;
110 kbuf[len] = '\0';
111
112 cmd = simple_strtol(kbuf, NULL, 10);
93 113
94 mutex_lock(&pvc_mutex); 114 mutex_lock(&pvc_mutex);
95 if (scroll_interval != 0) 115 if (scroll_interval != 0)
@@ -110,22 +130,31 @@ static int pvc_proc_write_scroll(struct file *file, const char *buffer,
110 } 130 }
111 mutex_unlock(&pvc_mutex); 131 mutex_unlock(&pvc_mutex);
112 132
113 return origcount; 133 return count;
114} 134}
115 135
116static int pvc_proc_read_scroll(char *page, char **start, 136static int pvc_scroll_proc_show(struct seq_file *m, void *v)
117 off_t off, int count,
118 int *eof, void *data)
119{ 137{
120 char *origpage = page;
121
122 mutex_lock(&pvc_mutex); 138 mutex_lock(&pvc_mutex);
123 page += sprintf(page, "%d\n", scroll_dir * scroll_interval); 139 seq_printf(m, "%d\n", scroll_dir * scroll_interval);
124 mutex_unlock(&pvc_mutex); 140 mutex_unlock(&pvc_mutex);
125 141
126 return page - origpage; 142 return 0;
127} 143}
128 144
145static int pvc_scroll_proc_open(struct inode *inode, struct file *file)
146{
147 return single_open(file, pvc_scroll_proc_show, NULL);
148}
149
150static const struct file_operations pvc_scroll_proc_fops = {
151 .owner = THIS_MODULE,
152 .open = pvc_scroll_proc_open,
153 .read = seq_read,
154 .llseek = seq_lseek,
155 .release = single_release,
156 .write = pvc_scroll_proc_write,
157};
129 158
130void pvc_proc_timerfunc(unsigned long data) 159void pvc_proc_timerfunc(unsigned long data)
131{ 160{
@@ -163,22 +192,16 @@ static int __init pvc_proc_init(void)
163 pvc_linedata[i] = i; 192 pvc_linedata[i] = i;
164 } 193 }
165 for (i = 0; i < PVC_NLINES; i++) { 194 for (i = 0; i < PVC_NLINES; i++) {
166 proc_entry = create_proc_entry(pvc_linename[i], 0644, 195 proc_entry = proc_create_data(pvc_linename[i], 0644, pvc_display_dir,
167 pvc_display_dir); 196 &pvc_line_proc_fops, &pvc_linedata[i]);
168 if (proc_entry == NULL) 197 if (proc_entry == NULL)
169 goto error; 198 goto error;
170
171 proc_entry->read_proc = pvc_proc_read_line;
172 proc_entry->write_proc = pvc_proc_write_line;
173 proc_entry->data = &pvc_linedata[i];
174 } 199 }
175 proc_entry = create_proc_entry("scroll", 0644, pvc_display_dir); 200 proc_entry = proc_create("scroll", 0644, pvc_display_dir,
201 &pvc_scroll_proc_fops);
176 if (proc_entry == NULL) 202 if (proc_entry == NULL)
177 goto error; 203 goto error;
178 204
179 proc_entry->write_proc = pvc_proc_write_scroll;
180 proc_entry->read_proc = pvc_proc_read_scroll;
181
182 init_timer(&timer); 205 init_timer(&timer);
183 timer.function = pvc_proc_timerfunc; 206 timer.function = pvc_proc_timerfunc;
184 207
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c
index 6acc6cb85f0a..20fde19a5fbf 100644
--- a/arch/mips/lasat/prom.c
+++ b/arch/mips/lasat/prom.c
@@ -100,8 +100,8 @@ void __init prom_init(void)
100 100
101 /* Get the command line */ 101 /* Get the command line */
102 if (argc > 0) { 102 if (argc > 0) {
103 strncpy(arcs_cmdline, argv[0], CL_SIZE-1); 103 strncpy(arcs_cmdline, argv[0], COMMAND_LINE_SIZE-1);
104 arcs_cmdline[CL_SIZE-1] = '\0'; 104 arcs_cmdline[COMMAND_LINE_SIZE-1] = '\0';
105 } 105 }
106 106
107 /* Set the I/O base address */ 107 /* Set the I/O base address */
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index 14b9a28a4aec..d87ffd04cb0a 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -204,7 +204,7 @@ static ctl_table lasat_table[] = {
204 .maxlen = sizeof(int), 204 .maxlen = sizeof(int),
205 .mode = 0644, 205 .mode = 0644,
206 .proc_handler = proc_lasat_prid, 206 .proc_handler = proc_lasat_prid,
207. }, 207 },
208#ifdef CONFIG_INET 208#ifdef CONFIG_INET
209 { 209 {
210 .procname = "ipaddr", 210 .procname = "ipaddr",
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index d45092505fa1..3df1967dea08 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -1,31 +1,85 @@
1choice 1choice
2 prompt "Machine Type" 2 prompt "Machine Type"
3 depends on MACH_LOONGSON 3 depends on MACH_LOONGSON
4 4
5config LEMOTE_FULOONG2E 5config LEMOTE_FULOONG2E
6 bool "Lemote Fuloong(2e) mini-PC" 6 bool "Lemote Fuloong(2e) mini-PC"
7 select ARCH_SPARSEMEM_ENABLE 7 select ARCH_SPARSEMEM_ENABLE
8 select CEVT_R4K 8 select CEVT_R4K
9 select CSRC_R4K 9 select CSRC_R4K
10 select SYS_HAS_CPU_LOONGSON2E 10 select SYS_HAS_CPU_LOONGSON2E
11 select DMA_NONCOHERENT 11 select DMA_NONCOHERENT
12 select BOOT_ELF32 12 select BOOT_ELF32
13 select BOARD_SCACHE 13 select BOARD_SCACHE
14 select HW_HAS_PCI 14 select HW_HAS_PCI
15 select I8259 15 select I8259
16 select ISA 16 select ISA
17 select IRQ_CPU 17 select IRQ_CPU
18 select SYS_SUPPORTS_32BIT_KERNEL 18 select SYS_SUPPORTS_32BIT_KERNEL
19 select SYS_SUPPORTS_64BIT_KERNEL 19 select SYS_SUPPORTS_64BIT_KERNEL
20 select SYS_SUPPORTS_LITTLE_ENDIAN 20 select SYS_SUPPORTS_LITTLE_ENDIAN
21 select SYS_SUPPORTS_HIGHMEM 21 select SYS_SUPPORTS_HIGHMEM
22 select SYS_HAS_EARLY_PRINTK 22 select SYS_HAS_EARLY_PRINTK
23 select GENERIC_HARDIRQS_NO__DO_IRQ 23 select GENERIC_HARDIRQS_NO__DO_IRQ
24 select GENERIC_ISA_DMA_SUPPORT_BROKEN 24 select GENERIC_ISA_DMA_SUPPORT_BROKEN
25 select CPU_HAS_WB 25 select CPU_HAS_WB
26 help 26 help
27 Lemote Fuloong(2e) mini-PC board based on the Chinese Loongson-2E CPU and 27 Lemote Fuloong(2e) mini-PC board based on the Chinese Loongson-2E CPU and
28 an FPGA northbridge 28 an FPGA northbridge
29 29
30 Lemote Fuloong(2e) mini PC have a VIA686B south bridge. 30 Lemote Fuloong(2e) mini PC have a VIA686B south bridge.
31
32config LEMOTE_MACH2F
33 bool "Lemote Loongson 2F family machines"
34 select ARCH_SPARSEMEM_ENABLE
35 select BOARD_SCACHE
36 select BOOT_ELF32
37 select CEVT_R4K if ! MIPS_EXTERNAL_TIMER
38 select CPU_HAS_WB
39 select CS5536
40 select CSRC_R4K if ! MIPS_EXTERNAL_TIMER
41 select DMA_NONCOHERENT
42 select GENERIC_HARDIRQS_NO__DO_IRQ
43 select GENERIC_ISA_DMA_SUPPORT_BROKEN
44 select HW_HAS_PCI
45 select I8259
46 select IRQ_CPU
47 select ISA
48 select SYS_HAS_CPU_LOONGSON2F
49 select SYS_HAS_EARLY_PRINTK
50 select SYS_SUPPORTS_32BIT_KERNEL
51 select SYS_SUPPORTS_64BIT_KERNEL
52 select SYS_SUPPORTS_HIGHMEM
53 select SYS_SUPPORTS_LITTLE_ENDIAN
54 help
55 Lemote Loongson 2F family machines utilize the 2F revision of
56 Loongson processor and the AMD CS5536 south bridge.
57
58 These family machines include fuloong2f mini PC, yeeloong2f notebook,
59 LingLoong allinone PC and so forth.
31endchoice 60endchoice
61
62config CS5536
63 bool
64
65config CS5536_MFGPT
66 bool "CS5536 MFGPT Timer"
67 depends on CS5536
68 select MIPS_EXTERNAL_TIMER
69 help
70 This option enables the mfgpt0 timer of AMD CS5536.
71
72 If you want to enable the Loongson2 CPUFreq Driver, Please enable
73 this option at first, otherwise, You will get wrong system time.
74
75 If unsure, say Yes.
76
77config LOONGSON_SUSPEND
78 bool
79 default y
80 depends on CPU_SUPPORTS_CPUFREQ && SUSPEND
81
82config LOONGSON_UART_BASE
83 bool
84 default y
85 depends on EARLY_PRINTK || SERIAL_8250
diff --git a/arch/mips/loongson/Makefile b/arch/mips/loongson/Makefile
index 39048c455d7d..2b76cb0fb07d 100644
--- a/arch/mips/loongson/Makefile
+++ b/arch/mips/loongson/Makefile
@@ -9,3 +9,9 @@ obj-$(CONFIG_MACH_LOONGSON) += common/
9# 9#
10 10
11obj-$(CONFIG_LEMOTE_FULOONG2E) += fuloong-2e/ 11obj-$(CONFIG_LEMOTE_FULOONG2E) += fuloong-2e/
12
13#
14# Lemote loongson2f family machines
15#
16
17obj-$(CONFIG_LEMOTE_MACH2F) += lemote-2f/
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
index 656b3cc0a2a6..7668c4de1151 100644
--- a/arch/mips/loongson/common/Makefile
+++ b/arch/mips/loongson/common/Makefile
@@ -3,9 +3,23 @@
3# 3#
4 4
5obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ 5obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \
6 pci.o bonito-irq.o mem.o machtype.o 6 pci.o bonito-irq.o mem.o machtype.o platform.o
7 7
8# 8#
9# Early printk support 9# Serial port support
10# 10#
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
12obj-$(CONFIG_SERIAL_8250) += serial.o
13obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o
14
15#
16# Enable CS5536 Virtual Support Module(VSM) to virtulize the PCI configure
17# space
18#
19obj-$(CONFIG_CS5536) += cs5536/
20
21#
22# Suspend Support
23#
24
25obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
diff --git a/arch/mips/loongson/common/bonito-irq.c b/arch/mips/loongson/common/bonito-irq.c
index 3e31e7ad713e..2dc2a4cc632a 100644
--- a/arch/mips/loongson/common/bonito-irq.c
+++ b/arch/mips/loongson/common/bonito-irq.c
@@ -12,18 +12,19 @@
12 * option) any later version. 12 * option) any later version.
13 */ 13 */
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/compiler.h>
15 16
16#include <loongson.h> 17#include <loongson.h>
17 18
18static inline void bonito_irq_enable(unsigned int irq) 19static inline void bonito_irq_enable(unsigned int irq)
19{ 20{
20 BONITO_INTENSET = (1 << (irq - BONITO_IRQ_BASE)); 21 LOONGSON_INTENSET = (1 << (irq - LOONGSON_IRQ_BASE));
21 mmiowb(); 22 mmiowb();
22} 23}
23 24
24static inline void bonito_irq_disable(unsigned int irq) 25static inline void bonito_irq_disable(unsigned int irq)
25{ 26{
26 BONITO_INTENCLR = (1 << (irq - BONITO_IRQ_BASE)); 27 LOONGSON_INTENCLR = (1 << (irq - LOONGSON_IRQ_BASE));
27 mmiowb(); 28 mmiowb();
28} 29}
29 30
@@ -35,7 +36,7 @@ static struct irq_chip bonito_irq_type = {
35 .unmask = bonito_irq_enable, 36 .unmask = bonito_irq_enable,
36}; 37};
37 38
38static struct irqaction dma_timeout_irqaction = { 39static struct irqaction __maybe_unused dma_timeout_irqaction = {
39 .handler = no_action, 40 .handler = no_action,
40 .name = "dma_timeout", 41 .name = "dma_timeout",
41}; 42};
@@ -44,8 +45,10 @@ void bonito_irq_init(void)
44{ 45{
45 u32 i; 46 u32 i;
46 47
47 for (i = BONITO_IRQ_BASE; i < BONITO_IRQ_BASE + 32; i++) 48 for (i = LOONGSON_IRQ_BASE; i < LOONGSON_IRQ_BASE + 32; i++)
48 set_irq_chip_and_handler(i, &bonito_irq_type, handle_level_irq); 49 set_irq_chip_and_handler(i, &bonito_irq_type, handle_level_irq);
49 50
50 setup_irq(BONITO_IRQ_BASE + 10, &dma_timeout_irqaction); 51#ifdef CONFIG_CPU_LOONGSON2E
52 setup_irq(LOONGSON_IRQ_BASE + 10, &dma_timeout_irqaction);
53#endif
51} 54}
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c
index 75f1b243ee4e..7ad47f227477 100644
--- a/arch/mips/loongson/common/cmdline.c
+++ b/arch/mips/loongson/common/cmdline.c
@@ -9,7 +9,7 @@
9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
10 * Author: Fuxin Zhang, zhangfx@lemote.com 10 * Author: Fuxin Zhang, zhangfx@lemote.com
11 * 11 *
12 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology 12 * Copyright (C) 2009 Lemote Inc.
13 * Author: Wu Zhangjin, wuzj@lemote.com 13 * Author: Wu Zhangjin, wuzj@lemote.com
14 * 14 *
15 * This program is free software; you can redistribute it and/or modify it 15 * This program is free software; you can redistribute it and/or modify it
@@ -49,4 +49,6 @@ void __init prom_init_cmdline(void)
49 strcat(arcs_cmdline, " console=ttyS0,115200"); 49 strcat(arcs_cmdline, " console=ttyS0,115200");
50 if ((strstr(arcs_cmdline, "root=")) == NULL) 50 if ((strstr(arcs_cmdline, "root=")) == NULL)
51 strcat(arcs_cmdline, " root=/dev/hda1"); 51 strcat(arcs_cmdline, " root=/dev/hda1");
52
53 prom_init_machtype();
52} 54}
diff --git a/arch/mips/loongson/common/cs5536/Makefile b/arch/mips/loongson/common/cs5536/Makefile
new file mode 100644
index 000000000000..510d4cdc2378
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/Makefile
@@ -0,0 +1,13 @@
1#
2# Makefile for CS5536 support.
3#
4
5obj-$(CONFIG_CS5536) += cs5536_pci.o cs5536_ide.o cs5536_acc.o cs5536_ohci.o \
6 cs5536_isa.o cs5536_ehci.o
7
8#
9# Enable cs5536 mfgpt Timer
10#
11obj-$(CONFIG_CS5536_MFGPT) += cs5536_mfgpt.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/loongson/common/cs5536/cs5536_acc.c b/arch/mips/loongson/common/cs5536/cs5536_acc.c
new file mode 100644
index 000000000000..b49485f187e0
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_acc.c
@@ -0,0 +1,140 @@
1/*
2 * the ACC Virtual Support Module of AMD CS5536
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu, liujl@lemote.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <cs5536/cs5536.h>
17#include <cs5536/cs5536_pci.h>
18
19void pci_acc_write_reg(int reg, u32 value)
20{
21 u32 hi = 0, lo = value;
22
23 switch (reg) {
24 case PCI_COMMAND:
25 _rdmsr(GLIU_MSR_REG(GLIU_PAE), &hi, &lo);
26 if (value & PCI_COMMAND_MASTER)
27 lo |= (0x03 << 8);
28 else
29 lo &= ~(0x03 << 8);
30 _wrmsr(GLIU_MSR_REG(GLIU_PAE), hi, lo);
31 break;
32 case PCI_STATUS:
33 if (value & PCI_STATUS_PARITY) {
34 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
35 if (lo & SB_PARE_ERR_FLAG) {
36 lo = (lo & 0x0000ffff) | SB_PARE_ERR_FLAG;
37 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo);
38 }
39 }
40 break;
41 case PCI_BAR0_REG:
42 if (value == PCI_BAR_RANGE_MASK) {
43 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
44 lo |= SOFT_BAR_ACC_FLAG;
45 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
46 } else if (value & 0x01) {
47 value &= 0xfffffffc;
48 hi = 0xA0000000 | ((value & 0x000ff000) >> 12);
49 lo = 0x000fff80 | ((value & 0x00000fff) << 20);
50 _wrmsr(GLIU_MSR_REG(GLIU_IOD_BM1), hi, lo);
51 }
52 break;
53 case PCI_ACC_INT_REG:
54 _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo);
55 /* disable all the usb interrupt in PIC */
56 lo &= ~(0xf << PIC_YSEL_LOW_ACC_SHIFT);
57 if (value) /* enable all the acc interrupt in PIC */
58 lo |= (CS5536_ACC_INTR << PIC_YSEL_LOW_ACC_SHIFT);
59 _wrmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), hi, lo);
60 break;
61 default:
62 break;
63 }
64}
65
66u32 pci_acc_read_reg(int reg)
67{
68 u32 hi, lo;
69 u32 conf_data = 0;
70
71 switch (reg) {
72 case PCI_VENDOR_ID:
73 conf_data =
74 CFG_PCI_VENDOR_ID(CS5536_ACC_DEVICE_ID, CS5536_VENDOR_ID);
75 break;
76 case PCI_COMMAND:
77 _rdmsr(GLIU_MSR_REG(GLIU_IOD_BM1), &hi, &lo);
78 if (((lo & 0xfff00000) || (hi & 0x000000ff))
79 && ((hi & 0xf0000000) == 0xa0000000))
80 conf_data |= PCI_COMMAND_IO;
81 _rdmsr(GLIU_MSR_REG(GLIU_PAE), &hi, &lo);
82 if ((lo & 0x300) == 0x300)
83 conf_data |= PCI_COMMAND_MASTER;
84 break;
85 case PCI_STATUS:
86 conf_data |= PCI_STATUS_66MHZ;
87 conf_data |= PCI_STATUS_FAST_BACK;
88 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
89 if (lo & SB_PARE_ERR_FLAG)
90 conf_data |= PCI_STATUS_PARITY;
91 conf_data |= PCI_STATUS_DEVSEL_MEDIUM;
92 break;
93 case PCI_CLASS_REVISION:
94 _rdmsr(ACC_MSR_REG(ACC_CAP), &hi, &lo);
95 conf_data = lo & 0x000000ff;
96 conf_data |= (CS5536_ACC_CLASS_CODE << 8);
97 break;
98 case PCI_CACHE_LINE_SIZE:
99 conf_data =
100 CFG_PCI_CACHE_LINE_SIZE(PCI_NORMAL_HEADER_TYPE,
101 PCI_NORMAL_LATENCY_TIMER);
102 break;
103 case PCI_BAR0_REG:
104 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
105 if (lo & SOFT_BAR_ACC_FLAG) {
106 conf_data = CS5536_ACC_RANGE |
107 PCI_BASE_ADDRESS_SPACE_IO;
108 lo &= ~SOFT_BAR_ACC_FLAG;
109 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
110 } else {
111 _rdmsr(GLIU_MSR_REG(GLIU_IOD_BM1), &hi, &lo);
112 conf_data = (hi & 0x000000ff) << 12;
113 conf_data |= (lo & 0xfff00000) >> 20;
114 conf_data |= 0x01;
115 conf_data &= ~0x02;
116 }
117 break;
118 case PCI_CARDBUS_CIS:
119 conf_data = PCI_CARDBUS_CIS_POINTER;
120 break;
121 case PCI_SUBSYSTEM_VENDOR_ID:
122 conf_data =
123 CFG_PCI_VENDOR_ID(CS5536_ACC_SUB_ID, CS5536_SUB_VENDOR_ID);
124 break;
125 case PCI_ROM_ADDRESS:
126 conf_data = PCI_EXPANSION_ROM_BAR;
127 break;
128 case PCI_CAPABILITY_LIST:
129 conf_data = PCI_CAPLIST_USB_POINTER;
130 break;
131 case PCI_INTERRUPT_LINE:
132 conf_data =
133 CFG_PCI_INTERRUPT_LINE(PCI_DEFAULT_PIN, CS5536_ACC_INTR);
134 break;
135 default:
136 break;
137 }
138
139 return conf_data;
140}
diff --git a/arch/mips/loongson/common/cs5536/cs5536_ehci.c b/arch/mips/loongson/common/cs5536/cs5536_ehci.c
new file mode 100644
index 000000000000..74f9c59d36af
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_ehci.c
@@ -0,0 +1,158 @@
1/*
2 * the EHCI Virtual Support Module of AMD CS5536
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu, liujl@lemote.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <cs5536/cs5536.h>
17#include <cs5536/cs5536_pci.h>
18
19void pci_ehci_write_reg(int reg, u32 value)
20{
21 u32 hi = 0, lo = value;
22
23 switch (reg) {
24 case PCI_COMMAND:
25 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
26 if (value & PCI_COMMAND_MASTER)
27 hi |= PCI_COMMAND_MASTER;
28 else
29 hi &= ~PCI_COMMAND_MASTER;
30
31 if (value & PCI_COMMAND_MEMORY)
32 hi |= PCI_COMMAND_MEMORY;
33 else
34 hi &= ~PCI_COMMAND_MEMORY;
35 _wrmsr(USB_MSR_REG(USB_EHCI), hi, lo);
36 break;
37 case PCI_STATUS:
38 if (value & PCI_STATUS_PARITY) {
39 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
40 if (lo & SB_PARE_ERR_FLAG) {
41 lo = (lo & 0x0000ffff) | SB_PARE_ERR_FLAG;
42 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo);
43 }
44 }
45 break;
46 case PCI_BAR0_REG:
47 if (value == PCI_BAR_RANGE_MASK) {
48 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
49 lo |= SOFT_BAR_EHCI_FLAG;
50 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
51 } else if ((value & 0x01) == 0x00) {
52 _wrmsr(USB_MSR_REG(USB_EHCI), hi, lo);
53
54 value &= 0xfffffff0;
55 hi = 0x40000000 | ((value & 0xff000000) >> 24);
56 lo = 0x000fffff | ((value & 0x00fff000) << 8);
57 _wrmsr(GLIU_MSR_REG(GLIU_P2D_BM4), hi, lo);
58 }
59 break;
60 case PCI_EHCI_LEGSMIEN_REG:
61 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
62 hi &= 0x003f0000;
63 hi |= (value & 0x3f) << 16;
64 _wrmsr(USB_MSR_REG(USB_EHCI), hi, lo);
65 break;
66 case PCI_EHCI_FLADJ_REG:
67 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
68 hi &= ~0x00003f00;
69 hi |= value & 0x00003f00;
70 _wrmsr(USB_MSR_REG(USB_EHCI), hi, lo);
71 break;
72 default:
73 break;
74 }
75}
76
77u32 pci_ehci_read_reg(int reg)
78{
79 u32 conf_data = 0;
80 u32 hi, lo;
81
82 switch (reg) {
83 case PCI_VENDOR_ID:
84 conf_data =
85 CFG_PCI_VENDOR_ID(CS5536_EHCI_DEVICE_ID, CS5536_VENDOR_ID);
86 break;
87 case PCI_COMMAND:
88 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
89 if (hi & PCI_COMMAND_MASTER)
90 conf_data |= PCI_COMMAND_MASTER;
91 if (hi & PCI_COMMAND_MEMORY)
92 conf_data |= PCI_COMMAND_MEMORY;
93 break;
94 case PCI_STATUS:
95 conf_data |= PCI_STATUS_66MHZ;
96 conf_data |= PCI_STATUS_FAST_BACK;
97 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
98 if (lo & SB_PARE_ERR_FLAG)
99 conf_data |= PCI_STATUS_PARITY;
100 conf_data |= PCI_STATUS_DEVSEL_MEDIUM;
101 break;
102 case PCI_CLASS_REVISION:
103 _rdmsr(USB_MSR_REG(USB_CAP), &hi, &lo);
104 conf_data = lo & 0x000000ff;
105 conf_data |= (CS5536_EHCI_CLASS_CODE << 8);
106 break;
107 case PCI_CACHE_LINE_SIZE:
108 conf_data =
109 CFG_PCI_CACHE_LINE_SIZE(PCI_NORMAL_HEADER_TYPE,
110 PCI_NORMAL_LATENCY_TIMER);
111 break;
112 case PCI_BAR0_REG:
113 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
114 if (lo & SOFT_BAR_EHCI_FLAG) {
115 conf_data = CS5536_EHCI_RANGE |
116 PCI_BASE_ADDRESS_SPACE_MEMORY;
117 lo &= ~SOFT_BAR_EHCI_FLAG;
118 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
119 } else {
120 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
121 conf_data = lo & 0xfffff000;
122 }
123 break;
124 case PCI_CARDBUS_CIS:
125 conf_data = PCI_CARDBUS_CIS_POINTER;
126 break;
127 case PCI_SUBSYSTEM_VENDOR_ID:
128 conf_data =
129 CFG_PCI_VENDOR_ID(CS5536_EHCI_SUB_ID, CS5536_SUB_VENDOR_ID);
130 break;
131 case PCI_ROM_ADDRESS:
132 conf_data = PCI_EXPANSION_ROM_BAR;
133 break;
134 case PCI_CAPABILITY_LIST:
135 conf_data = PCI_CAPLIST_USB_POINTER;
136 break;
137 case PCI_INTERRUPT_LINE:
138 conf_data =
139 CFG_PCI_INTERRUPT_LINE(PCI_DEFAULT_PIN, CS5536_USB_INTR);
140 break;
141 case PCI_EHCI_LEGSMIEN_REG:
142 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
143 conf_data = (hi & 0x003f0000) >> 16;
144 break;
145 case PCI_EHCI_LEGSMISTS_REG:
146 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
147 conf_data = (hi & 0x3f000000) >> 24;
148 break;
149 case PCI_EHCI_FLADJ_REG:
150 _rdmsr(USB_MSR_REG(USB_EHCI), &hi, &lo);
151 conf_data = hi & 0x00003f00;
152 break;
153 default:
154 break;
155 }
156
157 return conf_data;
158}
diff --git a/arch/mips/loongson/common/cs5536/cs5536_ide.c b/arch/mips/loongson/common/cs5536/cs5536_ide.c
new file mode 100644
index 000000000000..3f61594b3884
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_ide.c
@@ -0,0 +1,179 @@
1/*
2 * the IDE Virtual Support Module of AMD CS5536
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu, liujl@lemote.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <cs5536/cs5536.h>
17#include <cs5536/cs5536_pci.h>
18
19void pci_ide_write_reg(int reg, u32 value)
20{
21 u32 hi = 0, lo = value;
22
23 switch (reg) {
24 case PCI_COMMAND:
25 _rdmsr(GLIU_MSR_REG(GLIU_PAE), &hi, &lo);
26 if (value & PCI_COMMAND_MASTER)
27 lo |= (0x03 << 4);
28 else
29 lo &= ~(0x03 << 4);
30 _wrmsr(GLIU_MSR_REG(GLIU_PAE), hi, lo);
31 break;
32 case PCI_STATUS:
33 if (value & PCI_STATUS_PARITY) {
34 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
35 if (lo & SB_PARE_ERR_FLAG) {
36 lo = (lo & 0x0000ffff) | SB_PARE_ERR_FLAG;
37 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo);
38 }
39 }
40 break;
41 case PCI_CACHE_LINE_SIZE:
42 value &= 0x0000ff00;
43 _rdmsr(SB_MSR_REG(SB_CTRL), &hi, &lo);
44 hi &= 0xffffff00;
45 hi |= (value >> 8);
46 _wrmsr(SB_MSR_REG(SB_CTRL), hi, lo);
47 break;
48 case PCI_BAR4_REG:
49 if (value == PCI_BAR_RANGE_MASK) {
50 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
51 lo |= SOFT_BAR_IDE_FLAG;
52 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
53 } else if (value & 0x01) {
54 lo = (value & 0xfffffff0) | 0x1;
55 _wrmsr(IDE_MSR_REG(IDE_IO_BAR), hi, lo);
56
57 value &= 0xfffffffc;
58 hi = 0x60000000 | ((value & 0x000ff000) >> 12);
59 lo = 0x000ffff0 | ((value & 0x00000fff) << 20);
60 _wrmsr(GLIU_MSR_REG(GLIU_IOD_BM2), hi, lo);
61 }
62 break;
63 case PCI_IDE_CFG_REG:
64 if (value == CS5536_IDE_FLASH_SIGNATURE) {
65 _rdmsr(DIVIL_MSR_REG(DIVIL_BALL_OPTS), &hi, &lo);
66 lo |= 0x01;
67 _wrmsr(DIVIL_MSR_REG(DIVIL_BALL_OPTS), hi, lo);
68 } else
69 _wrmsr(IDE_MSR_REG(IDE_CFG), hi, lo);
70 break;
71 case PCI_IDE_DTC_REG:
72 _wrmsr(IDE_MSR_REG(IDE_DTC), hi, lo);
73 break;
74 case PCI_IDE_CAST_REG:
75 _wrmsr(IDE_MSR_REG(IDE_CAST), hi, lo);
76 break;
77 case PCI_IDE_ETC_REG:
78 _wrmsr(IDE_MSR_REG(IDE_ETC), hi, lo);
79 break;
80 case PCI_IDE_PM_REG:
81 _wrmsr(IDE_MSR_REG(IDE_INTERNAL_PM), hi, lo);
82 break;
83 default:
84 break;
85 }
86}
87
88u32 pci_ide_read_reg(int reg)
89{
90 u32 conf_data = 0;
91 u32 hi, lo;
92
93 switch (reg) {
94 case PCI_VENDOR_ID:
95 conf_data =
96 CFG_PCI_VENDOR_ID(CS5536_IDE_DEVICE_ID, CS5536_VENDOR_ID);
97 break;
98 case PCI_COMMAND:
99 _rdmsr(IDE_MSR_REG(IDE_IO_BAR), &hi, &lo);
100 if (lo & 0xfffffff0)
101 conf_data |= PCI_COMMAND_IO;
102 _rdmsr(GLIU_MSR_REG(GLIU_PAE), &hi, &lo);
103 if ((lo & 0x30) == 0x30)
104 conf_data |= PCI_COMMAND_MASTER;
105 break;
106 case PCI_STATUS:
107 conf_data |= PCI_STATUS_66MHZ;
108 conf_data |= PCI_STATUS_FAST_BACK;
109 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
110 if (lo & SB_PARE_ERR_FLAG)
111 conf_data |= PCI_STATUS_PARITY;
112 conf_data |= PCI_STATUS_DEVSEL_MEDIUM;
113 break;
114 case PCI_CLASS_REVISION:
115 _rdmsr(IDE_MSR_REG(IDE_CAP), &hi, &lo);
116 conf_data = lo & 0x000000ff;
117 conf_data |= (CS5536_IDE_CLASS_CODE << 8);
118 break;
119 case PCI_CACHE_LINE_SIZE:
120 _rdmsr(SB_MSR_REG(SB_CTRL), &hi, &lo);
121 hi &= 0x000000f8;
122 conf_data = CFG_PCI_CACHE_LINE_SIZE(PCI_NORMAL_HEADER_TYPE, hi);
123 break;
124 case PCI_BAR4_REG:
125 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
126 if (lo & SOFT_BAR_IDE_FLAG) {
127 conf_data = CS5536_IDE_RANGE |
128 PCI_BASE_ADDRESS_SPACE_IO;
129 lo &= ~SOFT_BAR_IDE_FLAG;
130 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
131 } else {
132 _rdmsr(IDE_MSR_REG(IDE_IO_BAR), &hi, &lo);
133 conf_data = lo & 0xfffffff0;
134 conf_data |= 0x01;
135 conf_data &= ~0x02;
136 }
137 break;
138 case PCI_CARDBUS_CIS:
139 conf_data = PCI_CARDBUS_CIS_POINTER;
140 break;
141 case PCI_SUBSYSTEM_VENDOR_ID:
142 conf_data =
143 CFG_PCI_VENDOR_ID(CS5536_IDE_SUB_ID, CS5536_SUB_VENDOR_ID);
144 break;
145 case PCI_ROM_ADDRESS:
146 conf_data = PCI_EXPANSION_ROM_BAR;
147 break;
148 case PCI_CAPABILITY_LIST:
149 conf_data = PCI_CAPLIST_POINTER;
150 break;
151 case PCI_INTERRUPT_LINE:
152 conf_data =
153 CFG_PCI_INTERRUPT_LINE(PCI_DEFAULT_PIN, CS5536_IDE_INTR);
154 break;
155 case PCI_IDE_CFG_REG:
156 _rdmsr(IDE_MSR_REG(IDE_CFG), &hi, &lo);
157 conf_data = lo;
158 break;
159 case PCI_IDE_DTC_REG:
160 _rdmsr(IDE_MSR_REG(IDE_DTC), &hi, &lo);
161 conf_data = lo;
162 break;
163 case PCI_IDE_CAST_REG:
164 _rdmsr(IDE_MSR_REG(IDE_CAST), &hi, &lo);
165 conf_data = lo;
166 break;
167 case PCI_IDE_ETC_REG:
168 _rdmsr(IDE_MSR_REG(IDE_ETC), &hi, &lo);
169 conf_data = lo;
170 case PCI_IDE_PM_REG:
171 _rdmsr(IDE_MSR_REG(IDE_INTERNAL_PM), &hi, &lo);
172 conf_data = lo;
173 break;
174 default:
175 break;
176 }
177
178 return conf_data;
179}
diff --git a/arch/mips/loongson/common/cs5536/cs5536_isa.c b/arch/mips/loongson/common/cs5536/cs5536_isa.c
new file mode 100644
index 000000000000..b6f17f538e48
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_isa.c
@@ -0,0 +1,316 @@
1/*
2 * the ISA Virtual Support Module of AMD CS5536
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu, liujl@lemote.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <cs5536/cs5536.h>
17#include <cs5536/cs5536_pci.h>
18
19/* common variables for PCI_ISA_READ/WRITE_BAR */
20static const u32 divil_msr_reg[6] = {
21 DIVIL_MSR_REG(DIVIL_LBAR_SMB), DIVIL_MSR_REG(DIVIL_LBAR_GPIO),
22 DIVIL_MSR_REG(DIVIL_LBAR_MFGPT), DIVIL_MSR_REG(DIVIL_LBAR_IRQ),
23 DIVIL_MSR_REG(DIVIL_LBAR_PMS), DIVIL_MSR_REG(DIVIL_LBAR_ACPI),
24};
25
26static const u32 soft_bar_flag[6] = {
27 SOFT_BAR_SMB_FLAG, SOFT_BAR_GPIO_FLAG, SOFT_BAR_MFGPT_FLAG,
28 SOFT_BAR_IRQ_FLAG, SOFT_BAR_PMS_FLAG, SOFT_BAR_ACPI_FLAG,
29};
30
31static const u32 sb_msr_reg[6] = {
32 SB_MSR_REG(SB_R0), SB_MSR_REG(SB_R1), SB_MSR_REG(SB_R2),
33 SB_MSR_REG(SB_R3), SB_MSR_REG(SB_R4), SB_MSR_REG(SB_R5),
34};
35
36static const u32 bar_space_range[6] = {
37 CS5536_SMB_RANGE, CS5536_GPIO_RANGE, CS5536_MFGPT_RANGE,
38 CS5536_IRQ_RANGE, CS5536_PMS_RANGE, CS5536_ACPI_RANGE,
39};
40
41static const int bar_space_len[6] = {
42 CS5536_SMB_LENGTH, CS5536_GPIO_LENGTH, CS5536_MFGPT_LENGTH,
43 CS5536_IRQ_LENGTH, CS5536_PMS_LENGTH, CS5536_ACPI_LENGTH,
44};
45
46/*
47 * enable the divil module bar space.
48 *
49 * For all the DIVIL module LBAR, you should control the DIVIL LBAR reg
50 * and the RCONFx(0~5) reg to use the modules.
51 */
52static void divil_lbar_enable(void)
53{
54 u32 hi, lo;
55 int offset;
56
57 /*
58 * The DIVIL IRQ is not used yet. and make the RCONF0 reserved.
59 */
60
61 for (offset = DIVIL_LBAR_SMB; offset <= DIVIL_LBAR_PMS; offset++) {
62 _rdmsr(DIVIL_MSR_REG(offset), &hi, &lo);
63 hi |= 0x01;
64 _wrmsr(DIVIL_MSR_REG(DIVIL_LBAR_SMB), hi, lo);
65 }
66}
67
68/*
69 * disable the divil module bar space.
70 */
71static void divil_lbar_disable(void)
72{
73 u32 hi, lo;
74 int offset;
75
76 for (offset = DIVIL_LBAR_SMB; offset <= DIVIL_LBAR_PMS; offset++) {
77 _rdmsr(DIVIL_MSR_REG(offset), &hi, &lo);
78 hi &= ~0x01;
79 _wrmsr(DIVIL_MSR_REG(DIVIL_LBAR_SMB), hi, lo);
80 }
81}
82
83/*
84 * BAR write: write value to the n BAR
85 */
86
87void pci_isa_write_bar(int n, u32 value)
88{
89 u32 hi = 0, lo = value;
90
91 if (value == PCI_BAR_RANGE_MASK) {
92 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
93 lo |= soft_bar_flag[n];
94 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
95 } else if (value & 0x01) {
96 /* NATIVE reg */
97 hi = 0x0000f001;
98 lo &= bar_space_range[n];
99 _wrmsr(divil_msr_reg[n], hi, lo);
100
101 /* RCONFx is 4bytes in units for I/O space */
102 hi = ((value & 0x000ffffc) << 12) |
103 ((bar_space_len[n] - 4) << 12) | 0x01;
104 lo = ((value & 0x000ffffc) << 12) | 0x01;
105 _wrmsr(sb_msr_reg[n], hi, lo);
106 }
107}
108
109/*
110 * BAR read: read the n BAR
111 */
112
113u32 pci_isa_read_bar(int n)
114{
115 u32 conf_data = 0;
116 u32 hi, lo;
117
118 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
119 if (lo & soft_bar_flag[n]) {
120 conf_data = bar_space_range[n] | PCI_BASE_ADDRESS_SPACE_IO;
121 lo &= ~soft_bar_flag[n];
122 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
123 } else {
124 _rdmsr(divil_msr_reg[n], &hi, &lo);
125 conf_data = lo & bar_space_range[n];
126 conf_data |= 0x01;
127 conf_data &= ~0x02;
128 }
129 return conf_data;
130}
131
132/*
133 * isa_write: ISA write transfer
134 *
135 * We assume that this is not a bus master transfer.
136 */
137void pci_isa_write_reg(int reg, u32 value)
138{
139 u32 hi = 0, lo = value;
140 u32 temp;
141
142 switch (reg) {
143 case PCI_COMMAND:
144 if (value & PCI_COMMAND_IO)
145 divil_lbar_enable();
146 else
147 divil_lbar_disable();
148 break;
149 case PCI_STATUS:
150 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
151 temp = lo & 0x0000ffff;
152 if ((value & PCI_STATUS_SIG_TARGET_ABORT) &&
153 (lo & SB_TAS_ERR_EN))
154 temp |= SB_TAS_ERR_FLAG;
155
156 if ((value & PCI_STATUS_REC_TARGET_ABORT) &&
157 (lo & SB_TAR_ERR_EN))
158 temp |= SB_TAR_ERR_FLAG;
159
160 if ((value & PCI_STATUS_REC_MASTER_ABORT)
161 && (lo & SB_MAR_ERR_EN))
162 temp |= SB_MAR_ERR_FLAG;
163
164 if ((value & PCI_STATUS_DETECTED_PARITY)
165 && (lo & SB_PARE_ERR_EN))
166 temp |= SB_PARE_ERR_FLAG;
167
168 lo = temp;
169 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo);
170 break;
171 case PCI_CACHE_LINE_SIZE:
172 value &= 0x0000ff00;
173 _rdmsr(SB_MSR_REG(SB_CTRL), &hi, &lo);
174 hi &= 0xffffff00;
175 hi |= (value >> 8);
176 _wrmsr(SB_MSR_REG(SB_CTRL), hi, lo);
177 break;
178 case PCI_BAR0_REG:
179 pci_isa_write_bar(0, value);
180 break;
181 case PCI_BAR1_REG:
182 pci_isa_write_bar(1, value);
183 break;
184 case PCI_BAR2_REG:
185 pci_isa_write_bar(2, value);
186 break;
187 case PCI_BAR3_REG:
188 pci_isa_write_bar(3, value);
189 break;
190 case PCI_BAR4_REG:
191 pci_isa_write_bar(4, value);
192 break;
193 case PCI_BAR5_REG:
194 pci_isa_write_bar(5, value);
195 break;
196 case PCI_UART1_INT_REG:
197 _rdmsr(DIVIL_MSR_REG(PIC_YSEL_HIGH), &hi, &lo);
198 /* disable uart1 interrupt in PIC */
199 lo &= ~(0xf << 24);
200 if (value) /* enable uart1 interrupt in PIC */
201 lo |= (CS5536_UART1_INTR << 24);
202 _wrmsr(DIVIL_MSR_REG(PIC_YSEL_HIGH), hi, lo);
203 break;
204 case PCI_UART2_INT_REG:
205 _rdmsr(DIVIL_MSR_REG(PIC_YSEL_HIGH), &hi, &lo);
206 /* disable uart2 interrupt in PIC */
207 lo &= ~(0xf << 28);
208 if (value) /* enable uart2 interrupt in PIC */
209 lo |= (CS5536_UART2_INTR << 28);
210 _wrmsr(DIVIL_MSR_REG(PIC_YSEL_HIGH), hi, lo);
211 break;
212 case PCI_ISA_FIXUP_REG:
213 if (value) {
214 /* enable the TARGET ABORT/MASTER ABORT etc. */
215 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
216 lo |= 0x00000063;
217 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo);
218 }
219
220 default:
221 /* ALL OTHER PCI CONFIG SPACE HEADER IS NOT IMPLEMENTED. */
222 break;
223 }
224}
225
226/*
227 * isa_read: ISA read transfers
228 *
229 * We assume that this is not a bus master transfer.
230 */
231u32 pci_isa_read_reg(int reg)
232{
233 u32 conf_data = 0;
234 u32 hi, lo;
235
236 switch (reg) {
237 case PCI_VENDOR_ID:
238 conf_data =
239 CFG_PCI_VENDOR_ID(CS5536_ISA_DEVICE_ID, CS5536_VENDOR_ID);
240 break;
241 case PCI_COMMAND:
242 /* we just check the first LBAR for the IO enable bit, */
243 /* maybe we should changed later. */
244 _rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_SMB), &hi, &lo);
245 if (hi & 0x01)
246 conf_data |= PCI_COMMAND_IO;
247 break;
248 case PCI_STATUS:
249 conf_data |= PCI_STATUS_66MHZ;
250 conf_data |= PCI_STATUS_DEVSEL_MEDIUM;
251 conf_data |= PCI_STATUS_FAST_BACK;
252
253 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
254 if (lo & SB_TAS_ERR_FLAG)
255 conf_data |= PCI_STATUS_SIG_TARGET_ABORT;
256 if (lo & SB_TAR_ERR_FLAG)
257 conf_data |= PCI_STATUS_REC_TARGET_ABORT;
258 if (lo & SB_MAR_ERR_FLAG)
259 conf_data |= PCI_STATUS_REC_MASTER_ABORT;
260 if (lo & SB_PARE_ERR_FLAG)
261 conf_data |= PCI_STATUS_DETECTED_PARITY;
262 break;
263 case PCI_CLASS_REVISION:
264 _rdmsr(GLCP_MSR_REG(GLCP_CHIP_REV_ID), &hi, &lo);
265 conf_data = lo & 0x000000ff;
266 conf_data |= (CS5536_ISA_CLASS_CODE << 8);
267 break;
268 case PCI_CACHE_LINE_SIZE:
269 _rdmsr(SB_MSR_REG(SB_CTRL), &hi, &lo);
270 hi &= 0x000000f8;
271 conf_data = CFG_PCI_CACHE_LINE_SIZE(PCI_BRIDGE_HEADER_TYPE, hi);
272 break;
273 /*
274 * we only use the LBAR of DIVIL, no RCONF used.
275 * all of them are IO space.
276 */
277 case PCI_BAR0_REG:
278 return pci_isa_read_bar(0);
279 break;
280 case PCI_BAR1_REG:
281 return pci_isa_read_bar(1);
282 break;
283 case PCI_BAR2_REG:
284 return pci_isa_read_bar(2);
285 break;
286 case PCI_BAR3_REG:
287 break;
288 case PCI_BAR4_REG:
289 return pci_isa_read_bar(4);
290 break;
291 case PCI_BAR5_REG:
292 return pci_isa_read_bar(5);
293 break;
294 case PCI_CARDBUS_CIS:
295 conf_data = PCI_CARDBUS_CIS_POINTER;
296 break;
297 case PCI_SUBSYSTEM_VENDOR_ID:
298 conf_data =
299 CFG_PCI_VENDOR_ID(CS5536_ISA_SUB_ID, CS5536_SUB_VENDOR_ID);
300 break;
301 case PCI_ROM_ADDRESS:
302 conf_data = PCI_EXPANSION_ROM_BAR;
303 break;
304 case PCI_CAPABILITY_LIST:
305 conf_data = PCI_CAPLIST_POINTER;
306 break;
307 case PCI_INTERRUPT_LINE:
308 /* no interrupt used here */
309 conf_data = CFG_PCI_INTERRUPT_LINE(0x00, 0x00);
310 break;
311 default:
312 break;
313 }
314
315 return conf_data;
316}
diff --git a/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
new file mode 100644
index 000000000000..6cb44dbaeec2
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
@@ -0,0 +1,217 @@
1/*
2 * CS5536 General timer functions
3 *
4 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
5 * Author: Yanhua, yanh@lemote.com
6 *
7 * Copyright (C) 2009 Lemote Inc.
8 * Author: Wu zhangjin, wuzj@lemote.com
9 *
10 * Reference: AMD Geode(TM) CS5536 Companion Device Data Book
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/io.h>
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/jiffies.h>
22#include <linux/spinlock.h>
23#include <linux/interrupt.h>
24#include <linux/clockchips.h>
25
26#include <asm/time.h>
27
28#include <cs5536/cs5536_mfgpt.h>
29
30DEFINE_SPINLOCK(mfgpt_lock);
31EXPORT_SYMBOL(mfgpt_lock);
32
33static u32 mfgpt_base;
34
35/*
36 * Initialize the MFGPT timer.
37 *
38 * This is also called after resume to bring the MFGPT into operation again.
39 */
40
41/* disable counter */
42void disable_mfgpt0_counter(void)
43{
44 outw(inw(MFGPT0_SETUP) & 0x7fff, MFGPT0_SETUP);
45}
46EXPORT_SYMBOL(disable_mfgpt0_counter);
47
48/* enable counter, comparator2 to event mode, 14.318MHz clock */
49void enable_mfgpt0_counter(void)
50{
51 outw(0xe310, MFGPT0_SETUP);
52}
53EXPORT_SYMBOL(enable_mfgpt0_counter);
54
55static void init_mfgpt_timer(enum clock_event_mode mode,
56 struct clock_event_device *evt)
57{
58 spin_lock(&mfgpt_lock);
59
60 switch (mode) {
61 case CLOCK_EVT_MODE_PERIODIC:
62 outw(COMPARE, MFGPT0_CMP2); /* set comparator2 */
63 outw(0, MFGPT0_CNT); /* set counter to 0 */
64 enable_mfgpt0_counter();
65 break;
66
67 case CLOCK_EVT_MODE_SHUTDOWN:
68 case CLOCK_EVT_MODE_UNUSED:
69 if (evt->mode == CLOCK_EVT_MODE_PERIODIC ||
70 evt->mode == CLOCK_EVT_MODE_ONESHOT)
71 disable_mfgpt0_counter();
72 break;
73
74 case CLOCK_EVT_MODE_ONESHOT:
75 /* The oneshot mode have very high deviation, Not use it! */
76 break;
77
78 case CLOCK_EVT_MODE_RESUME:
79 /* Nothing to do here */
80 break;
81 }
82 spin_unlock(&mfgpt_lock);
83}
84
85static struct clock_event_device mfgpt_clockevent = {
86 .name = "mfgpt",
87 .features = CLOCK_EVT_FEAT_PERIODIC,
88 .set_mode = init_mfgpt_timer,
89 .irq = CS5536_MFGPT_INTR,
90};
91
92static irqreturn_t timer_interrupt(int irq, void *dev_id)
93{
94 u32 basehi;
95
96 /*
97 * get MFGPT base address
98 *
99 * NOTE: do not remove me, it's need for the value of mfgpt_base is
100 * variable
101 */
102 _rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_MFGPT), &basehi, &mfgpt_base);
103
104 /* ack */
105 outw(inw(MFGPT0_SETUP) | 0x4000, MFGPT0_SETUP);
106
107 mfgpt_clockevent.event_handler(&mfgpt_clockevent);
108
109 return IRQ_HANDLED;
110}
111
112static struct irqaction irq5 = {
113 .handler = timer_interrupt,
114 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
115 .name = "timer"
116};
117
118/*
119 * Initialize the conversion factor and the min/max deltas of the clock event
120 * structure and register the clock event source with the framework.
121 */
122void __init setup_mfgpt0_timer(void)
123{
124 u32 basehi;
125 struct clock_event_device *cd = &mfgpt_clockevent;
126 unsigned int cpu = smp_processor_id();
127
128 cd->cpumask = cpumask_of(cpu);
129 clockevent_set_clock(cd, MFGPT_TICK_RATE);
130 cd->max_delta_ns = clockevent_delta2ns(0xffff, cd);
131 cd->min_delta_ns = clockevent_delta2ns(0xf, cd);
132
133 /* Enable MFGPT0 Comparator 2 Output to the Interrupt Mapper */
134 _wrmsr(DIVIL_MSR_REG(MFGPT_IRQ), 0, 0x100);
135
136 /* Enable Interrupt Gate 5 */
137 _wrmsr(DIVIL_MSR_REG(PIC_ZSEL_LOW), 0, 0x50000);
138
139 /* get MFGPT base address */
140 _rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_MFGPT), &basehi, &mfgpt_base);
141
142 clockevents_register_device(cd);
143
144 setup_irq(CS5536_MFGPT_INTR, &irq5);
145}
146
147/*
148 * Since the MFGPT overflows every tick, its not very useful
149 * to just read by itself. So use jiffies to emulate a free
150 * running counter:
151 */
152static cycle_t mfgpt_read(struct clocksource *cs)
153{
154 unsigned long flags;
155 int count;
156 u32 jifs;
157 static int old_count;
158 static u32 old_jifs;
159
160 spin_lock_irqsave(&mfgpt_lock, flags);
161 /*
162 * Although our caller may have the read side of xtime_lock,
163 * this is now a seqlock, and we are cheating in this routine
164 * by having side effects on state that we cannot undo if
165 * there is a collision on the seqlock and our caller has to
166 * retry. (Namely, old_jifs and old_count.) So we must treat
167 * jiffies as volatile despite the lock. We read jiffies
168 * before latching the timer count to guarantee that although
169 * the jiffies value might be older than the count (that is,
170 * the counter may underflow between the last point where
171 * jiffies was incremented and the point where we latch the
172 * count), it cannot be newer.
173 */
174 jifs = jiffies;
175 /* read the count */
176 count = inw(MFGPT0_CNT);
177
178 /*
179 * It's possible for count to appear to go the wrong way for this
180 * reason:
181 *
182 * The timer counter underflows, but we haven't handled the resulting
183 * interrupt and incremented jiffies yet.
184 *
185 * Previous attempts to handle these cases intelligently were buggy, so
186 * we just do the simple thing now.
187 */
188 if (count < old_count && jifs == old_jifs)
189 count = old_count;
190
191 old_count = count;
192 old_jifs = jifs;
193
194 spin_unlock_irqrestore(&mfgpt_lock, flags);
195
196 return (cycle_t) (jifs * COMPARE) + count;
197}
198
199static struct clocksource clocksource_mfgpt = {
200 .name = "mfgpt",
201 .rating = 120, /* Functional for real use, but not desired */
202 .read = mfgpt_read,
203 .mask = CLOCKSOURCE_MASK(32),
204 .mult = 0,
205 .shift = 22,
206};
207
208int __init init_mfgpt_clocksource(void)
209{
210 if (num_possible_cpus() > 1) /* MFGPT does not scale! */
211 return 0;
212
213 clocksource_mfgpt.mult = clocksource_hz2mult(MFGPT_TICK_RATE, 22);
214 return clocksource_register(&clocksource_mfgpt);
215}
216
217arch_initcall(init_mfgpt_clocksource);
diff --git a/arch/mips/loongson/common/cs5536/cs5536_ohci.c b/arch/mips/loongson/common/cs5536/cs5536_ohci.c
new file mode 100644
index 000000000000..8fdb02b6e90f
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_ohci.c
@@ -0,0 +1,147 @@
1/*
2 * the OHCI Virtual Support Module of AMD CS5536
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu, liujl@lemote.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <cs5536/cs5536.h>
17#include <cs5536/cs5536_pci.h>
18
19void pci_ohci_write_reg(int reg, u32 value)
20{
21 u32 hi = 0, lo = value;
22
23 switch (reg) {
24 case PCI_COMMAND:
25 _rdmsr(USB_MSR_REG(USB_OHCI), &hi, &lo);
26 if (value & PCI_COMMAND_MASTER)
27 hi |= PCI_COMMAND_MASTER;
28 else
29 hi &= ~PCI_COMMAND_MASTER;
30
31 if (value & PCI_COMMAND_MEMORY)
32 hi |= PCI_COMMAND_MEMORY;
33 else
34 hi &= ~PCI_COMMAND_MEMORY;
35 _wrmsr(USB_MSR_REG(USB_OHCI), hi, lo);
36 break;
37 case PCI_STATUS:
38 if (value & PCI_STATUS_PARITY) {
39 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
40 if (lo & SB_PARE_ERR_FLAG) {
41 lo = (lo & 0x0000ffff) | SB_PARE_ERR_FLAG;
42 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo);
43 }
44 }
45 break;
46 case PCI_BAR0_REG:
47 if (value == PCI_BAR_RANGE_MASK) {
48 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
49 lo |= SOFT_BAR_OHCI_FLAG;
50 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
51 } else if ((value & 0x01) == 0x00) {
52 _wrmsr(USB_MSR_REG(USB_OHCI), hi, lo);
53
54 value &= 0xfffffff0;
55 hi = 0x40000000 | ((value & 0xff000000) >> 24);
56 lo = 0x000fffff | ((value & 0x00fff000) << 8);
57 _wrmsr(GLIU_MSR_REG(GLIU_P2D_BM3), hi, lo);
58 }
59 break;
60 case PCI_OHCI_INT_REG:
61 _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo);
62 lo &= ~(0xf << PIC_YSEL_LOW_USB_SHIFT);
63 if (value) /* enable all the usb interrupt in PIC */
64 lo |= (CS5536_USB_INTR << PIC_YSEL_LOW_USB_SHIFT);
65 _wrmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), hi, lo);
66 break;
67 default:
68 break;
69 }
70}
71
72u32 pci_ohci_read_reg(int reg)
73{
74 u32 conf_data = 0;
75 u32 hi, lo;
76
77 switch (reg) {
78 case PCI_VENDOR_ID:
79 conf_data =
80 CFG_PCI_VENDOR_ID(CS5536_OHCI_DEVICE_ID, CS5536_VENDOR_ID);
81 break;
82 case PCI_COMMAND:
83 _rdmsr(USB_MSR_REG(USB_OHCI), &hi, &lo);
84 if (hi & PCI_COMMAND_MASTER)
85 conf_data |= PCI_COMMAND_MASTER;
86 if (hi & PCI_COMMAND_MEMORY)
87 conf_data |= PCI_COMMAND_MEMORY;
88 break;
89 case PCI_STATUS:
90 conf_data |= PCI_STATUS_66MHZ;
91 conf_data |= PCI_STATUS_FAST_BACK;
92 _rdmsr(SB_MSR_REG(SB_ERROR), &hi, &lo);
93 if (lo & SB_PARE_ERR_FLAG)
94 conf_data |= PCI_STATUS_PARITY;
95 conf_data |= PCI_STATUS_DEVSEL_MEDIUM;
96 break;
97 case PCI_CLASS_REVISION:
98 _rdmsr(USB_MSR_REG(USB_CAP), &hi, &lo);
99 conf_data = lo & 0x000000ff;
100 conf_data |= (CS5536_OHCI_CLASS_CODE << 8);
101 break;
102 case PCI_CACHE_LINE_SIZE:
103 conf_data =
104 CFG_PCI_CACHE_LINE_SIZE(PCI_NORMAL_HEADER_TYPE,
105 PCI_NORMAL_LATENCY_TIMER);
106 break;
107 case PCI_BAR0_REG:
108 _rdmsr(GLCP_MSR_REG(GLCP_SOFT_COM), &hi, &lo);
109 if (lo & SOFT_BAR_OHCI_FLAG) {
110 conf_data = CS5536_OHCI_RANGE |
111 PCI_BASE_ADDRESS_SPACE_MEMORY;
112 lo &= ~SOFT_BAR_OHCI_FLAG;
113 _wrmsr(GLCP_MSR_REG(GLCP_SOFT_COM), hi, lo);
114 } else {
115 _rdmsr(USB_MSR_REG(USB_OHCI), &hi, &lo);
116 conf_data = lo & 0xffffff00;
117 conf_data &= ~0x0000000f; /* 32bit mem */
118 }
119 break;
120 case PCI_CARDBUS_CIS:
121 conf_data = PCI_CARDBUS_CIS_POINTER;
122 break;
123 case PCI_SUBSYSTEM_VENDOR_ID:
124 conf_data =
125 CFG_PCI_VENDOR_ID(CS5536_OHCI_SUB_ID, CS5536_SUB_VENDOR_ID);
126 break;
127 case PCI_ROM_ADDRESS:
128 conf_data = PCI_EXPANSION_ROM_BAR;
129 break;
130 case PCI_CAPABILITY_LIST:
131 conf_data = PCI_CAPLIST_USB_POINTER;
132 break;
133 case PCI_INTERRUPT_LINE:
134 conf_data =
135 CFG_PCI_INTERRUPT_LINE(PCI_DEFAULT_PIN, CS5536_USB_INTR);
136 break;
137 case PCI_OHCI_INT_REG:
138 _rdmsr(DIVIL_MSR_REG(PIC_YSEL_LOW), &hi, &lo);
139 if ((lo & 0x00000f00) == CS5536_USB_INTR)
140 conf_data = 1;
141 break;
142 default:
143 break;
144 }
145
146 return conf_data;
147}
diff --git a/arch/mips/loongson/common/cs5536/cs5536_pci.c b/arch/mips/loongson/common/cs5536/cs5536_pci.c
new file mode 100644
index 000000000000..e23f3d7d2c1d
--- /dev/null
+++ b/arch/mips/loongson/common/cs5536/cs5536_pci.c
@@ -0,0 +1,87 @@
1/*
2 * read/write operation to the PCI config space of CS5536
3 *
4 * Copyright (C) 2007 Lemote, Inc.
5 * Author : jlliu, liujl@lemote.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * the Virtual Support Module(VSM) for virtulizing the PCI
16 * configure space are defined in cs5536_modulename.c respectively,
17 *
18 * after this virtulizing, user can access the PCI configure space
19 * directly as a normal multi-function PCI device which follows
20 * the PCI-2.2 spec.
21 */
22
23#include <linux/types.h>
24#include <cs5536/cs5536_vsm.h>
25
26enum {
27 CS5536_FUNC_START = -1,
28 CS5536_ISA_FUNC,
29 reserved_func,
30 CS5536_IDE_FUNC,
31 CS5536_ACC_FUNC,
32 CS5536_OHCI_FUNC,
33 CS5536_EHCI_FUNC,
34 CS5536_FUNC_END,
35};
36
37static const cs5536_pci_vsm_write vsm_conf_write[] = {
38 [CS5536_ISA_FUNC] pci_isa_write_reg,
39 [reserved_func] NULL,
40 [CS5536_IDE_FUNC] pci_ide_write_reg,
41 [CS5536_ACC_FUNC] pci_acc_write_reg,
42 [CS5536_OHCI_FUNC] pci_ohci_write_reg,
43 [CS5536_EHCI_FUNC] pci_ehci_write_reg,
44};
45
46static const cs5536_pci_vsm_read vsm_conf_read[] = {
47 [CS5536_ISA_FUNC] pci_isa_read_reg,
48 [reserved_func] NULL,
49 [CS5536_IDE_FUNC] pci_ide_read_reg,
50 [CS5536_ACC_FUNC] pci_acc_read_reg,
51 [CS5536_OHCI_FUNC] pci_ohci_read_reg,
52 [CS5536_EHCI_FUNC] pci_ehci_read_reg,
53};
54
55/*
56 * write to PCI config space and transfer it to MSR write.
57 */
58void cs5536_pci_conf_write4(int function, int reg, u32 value)
59{
60 if ((function <= CS5536_FUNC_START) || (function >= CS5536_FUNC_END))
61 return;
62 if ((reg < 0) || (reg > 0x100) || ((reg & 0x03) != 0))
63 return;
64
65 if (vsm_conf_write[function] != NULL)
66 vsm_conf_write[function](reg, value);
67}
68
69/*
70 * read PCI config space and transfer it to MSR access.
71 */
72u32 cs5536_pci_conf_read4(int function, int reg)
73{
74 u32 data = 0;
75
76 if ((function <= CS5536_FUNC_START) || (function >= CS5536_FUNC_END))
77 return 0;
78 if ((reg < 0) || ((reg & 0x03) != 0))
79 return 0;
80 if (reg > 0x100)
81 return 0xffffffff;
82
83 if (vsm_conf_read[function] != NULL)
84 data = vsm_conf_read[function](reg);
85
86 return data;
87}
diff --git a/arch/mips/loongson/common/early_printk.c b/arch/mips/loongson/common/early_printk.c
index bc73edc0cfd8..23e7a8f8897f 100644
--- a/arch/mips/loongson/common/early_printk.c
+++ b/arch/mips/loongson/common/early_printk.c
@@ -1,7 +1,7 @@
1/* early printk support 1/* early printk support
2 * 2 *
3 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca> 3 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
4 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology 4 * Copyright (c) 2009 Lemote Inc.
5 * Author: Wu Zhangjin, wuzj@lemote.com 5 * Author: Wu Zhangjin, wuzj@lemote.com
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
@@ -12,26 +12,29 @@
12#include <linux/serial_reg.h> 12#include <linux/serial_reg.h>
13 13
14#include <loongson.h> 14#include <loongson.h>
15#include <machine.h>
16 15
17#define PORT(base, offset) (u8 *)(base + offset) 16#define PORT(base, offset) (u8 *)(base + offset)
18 17
19static inline unsigned int serial_in(phys_addr_t base, int offset) 18static inline unsigned int serial_in(unsigned char *base, int offset)
20{ 19{
21 return readb(PORT(base, offset)); 20 return readb(PORT(base, offset));
22} 21}
23 22
24static inline void serial_out(phys_addr_t base, int offset, int value) 23static inline void serial_out(unsigned char *base, int offset, int value)
25{ 24{
26 writeb(value, PORT(base, offset)); 25 writeb(value, PORT(base, offset));
27} 26}
28 27
29void prom_putchar(char c) 28void prom_putchar(char c)
30{ 29{
31 phys_addr_t uart_base = 30 int timeout;
32 (phys_addr_t) ioremap_nocache(LOONGSON_UART_BASE, 8); 31 unsigned char *uart_base;
33 32
34 while ((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) 33 uart_base = (unsigned char *)_loongson_uart_base;
34 timeout = 1024;
35
36 while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) &&
37 (timeout-- > 0))
35 ; 38 ;
36 39
37 serial_out(uart_base, UART_TX, c); 40 serial_out(uart_base, UART_TX, c);
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c
index b9ef50385541..196d947d929a 100644
--- a/arch/mips/loongson/common/env.c
+++ b/arch/mips/loongson/common/env.c
@@ -17,11 +17,14 @@
17 * Free Software Foundation; either version 2 of the License, or (at your 17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version. 18 * option) any later version.
19 */ 19 */
20#include <linux/module.h>
21
20#include <asm/bootinfo.h> 22#include <asm/bootinfo.h>
21 23
22#include <loongson.h> 24#include <loongson.h>
23 25
24unsigned long bus_clock, cpu_clock_freq; 26unsigned long bus_clock, cpu_clock_freq;
27EXPORT_SYMBOL(cpu_clock_freq);
25unsigned long memsize, highmemsize; 28unsigned long memsize, highmemsize;
26 29
27/* pmon passes arguments in 32bit pointers */ 30/* pmon passes arguments in 32bit pointers */
diff --git a/arch/mips/loongson/common/init.c b/arch/mips/loongson/common/init.c
index 3abe927422a3..a2abd9355737 100644
--- a/arch/mips/loongson/common/init.c
+++ b/arch/mips/loongson/common/init.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology 2 * Copyright (C) 2009 Lemote Inc.
3 * Author: Wu Zhangjin, wuzj@lemote.com 3 * Author: Wu Zhangjin, wuzj@lemote.com
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
@@ -10,19 +10,28 @@
10 10
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12 12
13#include <asm/bootinfo.h>
14
15#include <loongson.h> 13#include <loongson.h>
16 14
15/* Loongson CPU address windows config space base address */
16unsigned long __maybe_unused _loongson_addrwincfg_base;
17
17void __init prom_init(void) 18void __init prom_init(void)
18{ 19{
19 /* init base address of io space */ 20 /* init base address of io space */
20 set_io_port_base((unsigned long) 21 set_io_port_base((unsigned long)
21 ioremap(BONITO_PCIIO_BASE, BONITO_PCIIO_SIZE)); 22 ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
23
24#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
25 _loongson_addrwincfg_base = (unsigned long)
26 ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
27#endif
22 28
23 prom_init_cmdline(); 29 prom_init_cmdline();
24 prom_init_env(); 30 prom_init_env();
25 prom_init_memory(); 31 prom_init_memory();
32
33 /*init the uart base address */
34 prom_init_uart_base();
26} 35}
27 36
28void __init prom_free_prom_memory(void) 37void __init prom_free_prom_memory(void)
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson/common/irq.c
index b32b4a3e5137..20e732831978 100644
--- a/arch/mips/loongson/common/irq.c
+++ b/arch/mips/loongson/common/irq.c
@@ -20,21 +20,21 @@ void bonito_irqdispatch(void)
20 int i; 20 int i;
21 21
22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */ 22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
23 int_status = BONITO_INTISR; 23 int_status = LOONGSON_INTISR;
24 if (int_status & (1 << 10)) { 24 if (int_status & (1 << 10)) {
25 while (int_status & (1 << 10)) { 25 while (int_status & (1 << 10)) {
26 udelay(1); 26 udelay(1);
27 int_status = BONITO_INTISR; 27 int_status = LOONGSON_INTISR;
28 } 28 }
29 } 29 }
30 30
31 /* Get pending sources, masked by current enables */ 31 /* Get pending sources, masked by current enables */
32 int_status = BONITO_INTISR & BONITO_INTEN; 32 int_status = LOONGSON_INTISR & LOONGSON_INTEN;
33 33
34 if (int_status != 0) { 34 if (int_status != 0) {
35 i = __ffs(int_status); 35 i = __ffs(int_status);
36 int_status &= ~(1 << i); 36 int_status &= ~(1 << i);
37 do_IRQ(BONITO_IRQ_BASE + i); 37 do_IRQ(LOONGSON_IRQ_BASE + i);
38 } 38 }
39} 39}
40 40
@@ -60,13 +60,13 @@ void __init arch_init_irq(void)
60 set_irq_trigger_mode(); 60 set_irq_trigger_mode();
61 61
62 /* no steer */ 62 /* no steer */
63 BONITO_INTSTEER = 0; 63 LOONGSON_INTSTEER = 0;
64 64
65 /* 65 /*
66 * Mask out all interrupt by writing "1" to all bit position in 66 * Mask out all interrupt by writing "1" to all bit position in
67 * the interrupt reset reg. 67 * the interrupt reset reg.
68 */ 68 */
69 BONITO_INTENCLR = ~0; 69 LOONGSON_INTENCLR = ~0;
70 70
71 /* machine specific irq init */ 71 /* machine specific irq init */
72 mach_init_irq(); 72 mach_init_irq();
diff --git a/arch/mips/loongson/common/machtype.c b/arch/mips/loongson/common/machtype.c
index 7b348248de7d..0ed52b3f5314 100644
--- a/arch/mips/loongson/common/machtype.c
+++ b/arch/mips/loongson/common/machtype.c
@@ -15,6 +15,9 @@
15#include <loongson.h> 15#include <loongson.h>
16#include <machine.h> 16#include <machine.h>
17 17
18/* please ensure the length of the machtype string is less than 50 */
19#define MACHTYPE_LEN 50
20
18static const char *system_types[] = { 21static const char *system_types[] = {
19 [MACH_LOONGSON_UNKNOWN] "unknown loongson machine", 22 [MACH_LOONGSON_UNKNOWN] "unknown loongson machine",
20 [MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box", 23 [MACH_LEMOTE_FL2E] "lemote-fuloong-2e-box",
@@ -22,29 +25,35 @@ static const char *system_types[] = {
22 [MACH_LEMOTE_ML2F7] "lemote-mengloong-2f-7inches", 25 [MACH_LEMOTE_ML2F7] "lemote-mengloong-2f-7inches",
23 [MACH_LEMOTE_YL2F89] "lemote-yeeloong-2f-8.9inches", 26 [MACH_LEMOTE_YL2F89] "lemote-yeeloong-2f-8.9inches",
24 [MACH_DEXXON_GDIUM2F10] "dexxon-gidum-2f-10inches", 27 [MACH_DEXXON_GDIUM2F10] "dexxon-gidum-2f-10inches",
28 [MACH_LEMOTE_NAS] "lemote-nas-2f",
29 [MACH_LEMOTE_LL2F] "lemote-lynloong-2f",
25 [MACH_LOONGSON_END] NULL, 30 [MACH_LOONGSON_END] NULL,
26}; 31};
27 32
28const char *get_system_type(void) 33const char *get_system_type(void)
29{ 34{
30 if (mips_machtype == MACH_UNKNOWN)
31 mips_machtype = LOONGSON_MACHTYPE;
32
33 return system_types[mips_machtype]; 35 return system_types[mips_machtype];
34} 36}
35 37
36static __init int machtype_setup(char *str) 38void __init prom_init_machtype(void)
37{ 39{
40 char *p, str[MACHTYPE_LEN];
38 int machtype = MACH_LEMOTE_FL2E; 41 int machtype = MACH_LEMOTE_FL2E;
39 42
40 if (!str) 43 mips_machtype = LOONGSON_MACHTYPE;
41 return -EINVAL; 44
45 p = strstr(arcs_cmdline, "machtype=");
46 if (!p)
47 return;
48 p += strlen("machtype=");
49 strncpy(str, p, MACHTYPE_LEN);
50 p = strstr(str, " ");
51 if (p)
52 *p = '\0';
42 53
43 for (; system_types[machtype]; machtype++) 54 for (; system_types[machtype]; machtype++)
44 if (strstr(system_types[machtype], str)) { 55 if (strstr(system_types[machtype], str)) {
45 mips_machtype = machtype; 56 mips_machtype = machtype;
46 break; 57 break;
47 } 58 }
48 return 0;
49} 59}
50__setup("machtype=", machtype_setup);
diff --git a/arch/mips/loongson/common/mem.c b/arch/mips/loongson/common/mem.c
index e94ef158f980..ceacd092b446 100644
--- a/arch/mips/loongson/common/mem.c
+++ b/arch/mips/loongson/common/mem.c
@@ -12,15 +12,40 @@
12 12
13#include <loongson.h> 13#include <loongson.h>
14#include <mem.h> 14#include <mem.h>
15#include <pci.h>
15 16
16void __init prom_init_memory(void) 17void __init prom_init_memory(void)
17{ 18{
18 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM); 19 add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
20
21 add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize <<
22 20), BOOT_MEM_RESERVED);
23#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
24 {
25 int bit;
26
27 bit = fls(memsize + highmemsize);
28 if (bit != ffs(memsize + highmemsize))
29 bit += 20;
30 else
31 bit = bit + 20 - 1;
32
33 /* set cpu window3 to map CPU to DDR: 2G -> 2G */
34 LOONGSON_ADDRWIN_CPUTODDR(ADDRWIN_WIN3, 0x80000000ul,
35 0x80000000ul, (1 << bit));
36 mmiowb();
37 }
38#endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
39
19#ifdef CONFIG_64BIT 40#ifdef CONFIG_64BIT
20 if (highmemsize > 0) 41 if (highmemsize > 0)
21 add_memory_region(LOONGSON_HIGHMEM_START, 42 add_memory_region(LOONGSON_HIGHMEM_START,
22 highmemsize << 20, BOOT_MEM_RAM); 43 highmemsize << 20, BOOT_MEM_RAM);
23#endif /* CONFIG_64BIT */ 44
45 add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START -
46 LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED);
47
48#endif /* !CONFIG_64BIT */
24} 49}
25 50
26/* override of arch/mips/mm/cache.c: __uncached_access */ 51/* override of arch/mips/mm/cache.c: __uncached_access */
@@ -33,3 +58,61 @@ int __uncached_access(struct file *file, unsigned long addr)
33 ((addr >= LOONGSON_MMIO_MEM_START) && 58 ((addr >= LOONGSON_MMIO_MEM_START) &&
34 (addr < LOONGSON_MMIO_MEM_END)); 59 (addr < LOONGSON_MMIO_MEM_END));
35} 60}
61
62#ifdef CONFIG_CPU_SUPPORTS_UNCACHED_ACCELERATED
63
64#include <linux/pci.h>
65#include <linux/sched.h>
66#include <asm/current.h>
67
68static unsigned long uca_start, uca_end;
69
70pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
71 unsigned long size, pgprot_t vma_prot)
72{
73 unsigned long offset = pfn << PAGE_SHIFT;
74 unsigned long end = offset + size;
75
76 if (__uncached_access(file, offset)) {
77 if (((uca_start && offset) >= uca_start) &&
78 (end <= uca_end))
79 return __pgprot((pgprot_val(vma_prot) &
80 ~_CACHE_MASK) |
81 _CACHE_UNCACHED_ACCELERATED);
82 else
83 return pgprot_noncached(vma_prot);
84 }
85 return vma_prot;
86}
87
88static int __init find_vga_mem_init(void)
89{
90 struct pci_dev *dev = 0;
91 struct resource *r;
92 int idx;
93
94 if (uca_start)
95 return 0;
96
97 for_each_pci_dev(dev) {
98 if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA) {
99 for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
100 r = &dev->resource[idx];
101 if (!r->start && r->end)
102 continue;
103 if (r->flags & IORESOURCE_IO)
104 continue;
105 if (r->flags & IORESOURCE_MEM) {
106 uca_start = r->start;
107 uca_end = r->end;
108 return 0;
109 }
110 }
111 }
112 }
113
114 return 0;
115}
116
117late_initcall(find_vga_mem_init);
118#endif /* !CONFIG_CPU_SUPPORTS_UNCACHED_ACCELERATED */
diff --git a/arch/mips/loongson/common/pci.c b/arch/mips/loongson/common/pci.c
index a3a4abfb6c9a..31d8c5ecd16c 100644
--- a/arch/mips/loongson/common/pci.c
+++ b/arch/mips/loongson/common/pci.c
@@ -27,7 +27,7 @@ static struct resource loongson_pci_io_resource = {
27}; 27};
28 28
29static struct pci_controller loongson_pci_controller = { 29static struct pci_controller loongson_pci_controller = {
30 .pci_ops = &bonito64_pci_ops, 30 .pci_ops = &loongson_pci_ops,
31 .io_resource = &loongson_pci_io_resource, 31 .io_resource = &loongson_pci_io_resource,
32 .mem_resource = &loongson_pci_mem_resource, 32 .mem_resource = &loongson_pci_mem_resource,
33 .mem_offset = 0x00000000UL, 33 .mem_offset = 0x00000000UL,
@@ -44,15 +44,15 @@ static void __init setup_pcimap(void)
44 * pcimap: PCI_MAP2 PCI_Mem_Lo2 PCI_Mem_Lo1 PCI_Mem_Lo0 44 * pcimap: PCI_MAP2 PCI_Mem_Lo2 PCI_Mem_Lo1 PCI_Mem_Lo0
45 * [<2G] [384M,448M] [320M,384M] [0M,64M] 45 * [<2G] [384M,448M] [320M,384M] [0M,64M]
46 */ 46 */
47 BONITO_PCIMAP = BONITO_PCIMAP_PCIMAP_2 | 47 LOONGSON_PCIMAP = LOONGSON_PCIMAP_PCIMAP_2 |
48 BONITO_PCIMAP_WIN(2, BONITO_PCILO2_BASE) | 48 LOONGSON_PCIMAP_WIN(2, LOONGSON_PCILO2_BASE) |
49 BONITO_PCIMAP_WIN(1, BONITO_PCILO1_BASE) | 49 LOONGSON_PCIMAP_WIN(1, LOONGSON_PCILO1_BASE) |
50 BONITO_PCIMAP_WIN(0, 0); 50 LOONGSON_PCIMAP_WIN(0, 0);
51 51
52 /* 52 /*
53 * PCI-DMA to local mapping: [2G,2G+256M] -> [0M,256M] 53 * PCI-DMA to local mapping: [2G,2G+256M] -> [0M,256M]
54 */ 54 */
55 BONITO_PCIBASE0 = 0x80000000ul; /* base: 2G -> mmap: 0M */ 55 LOONGSON_PCIBASE0 = 0x80000000ul; /* base: 2G -> mmap: 0M */
56 /* size: 256M, burst transmission, pre-fetch enable, 64bit */ 56 /* size: 256M, burst transmission, pre-fetch enable, 64bit */
57 LOONGSON_PCI_HIT0_SEL_L = 0xc000000cul; 57 LOONGSON_PCI_HIT0_SEL_L = 0xc000000cul;
58 LOONGSON_PCI_HIT0_SEL_H = 0xfffffffful; 58 LOONGSON_PCI_HIT0_SEL_H = 0xfffffffful;
@@ -67,6 +67,14 @@ static void __init setup_pcimap(void)
67 /* can not change gnt to break pci transfer when device's gnt not 67 /* can not change gnt to break pci transfer when device's gnt not
68 deassert for some broken device */ 68 deassert for some broken device */
69 LOONGSON_PXARB_CFG = 0x00fe0105ul; 69 LOONGSON_PXARB_CFG = 0x00fe0105ul;
70
71#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
72 /*
73 * set cpu addr window2 to map CPU address space to PCI address space
74 */
75 LOONGSON_ADDRWIN_CPUTOPCI(ADDRWIN_WIN2, LOONGSON_CPU_MEM_SRC,
76 LOONGSON_PCI_MEM_DST, MMAP_CPUTOPCI_SIZE);
77#endif
70} 78}
71 79
72static int __init pcibios_init(void) 80static int __init pcibios_init(void)
diff --git a/arch/mips/loongson/common/platform.c b/arch/mips/loongson/common/platform.c
new file mode 100644
index 000000000000..be81777eb94d
--- /dev/null
+++ b/arch/mips/loongson/common/platform.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2009 Lemote Inc.
3 * Author: Wu Zhangjin, wuzj@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/err.h>
12#include <linux/platform_device.h>
13
14static struct platform_device loongson2_cpufreq_device = {
15 .name = "loongson2_cpufreq",
16 .id = -1,
17};
18
19static int __init loongson2_cpufreq_init(void)
20{
21 struct cpuinfo_mips *c = &current_cpu_data;
22
23 /* Only 2F revision and it's successors support CPUFreq */
24 if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_LOONGSON2F)
25 return platform_device_register(&loongson2_cpufreq_device);
26
27 return -ENODEV;
28}
29
30arch_initcall(loongson2_cpufreq_init);
diff --git a/arch/mips/loongson/common/pm.c b/arch/mips/loongson/common/pm.c
new file mode 100644
index 000000000000..b625fec8a4d5
--- /dev/null
+++ b/arch/mips/loongson/common/pm.c
@@ -0,0 +1,161 @@
1/*
2 * loongson-specific suspend support
3 *
4 * Copyright (C) 2009 Lemote Inc.
5 * Author: Wu Zhangjin <wuzj@lemote.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12#include <linux/suspend.h>
13#include <linux/interrupt.h>
14#include <linux/pm.h>
15
16#include <asm/i8259.h>
17#include <asm/mipsregs.h>
18
19#include <loongson.h>
20
21static unsigned int __maybe_unused cached_master_mask; /* i8259A */
22static unsigned int __maybe_unused cached_slave_mask;
23static unsigned int __maybe_unused cached_bonito_irq_mask; /* bonito */
24
25void arch_suspend_disable_irqs(void)
26{
27 /* disable all mips events */
28 local_irq_disable();
29
30#ifdef CONFIG_I8259
31 /* disable all events of i8259A */
32 cached_slave_mask = inb(PIC_SLAVE_IMR);
33 cached_master_mask = inb(PIC_MASTER_IMR);
34
35 outb(0xff, PIC_SLAVE_IMR);
36 inb(PIC_SLAVE_IMR);
37 outb(0xff, PIC_MASTER_IMR);
38 inb(PIC_MASTER_IMR);
39#endif
40 /* disable all events of bonito */
41 cached_bonito_irq_mask = LOONGSON_INTEN;
42 LOONGSON_INTENCLR = 0xffff;
43 (void)LOONGSON_INTENCLR;
44}
45
46void arch_suspend_enable_irqs(void)
47{
48 /* enable all mips events */
49 local_irq_enable();
50#ifdef CONFIG_I8259
51 /* only enable the cached events of i8259A */
52 outb(cached_slave_mask, PIC_SLAVE_IMR);
53 outb(cached_master_mask, PIC_MASTER_IMR);
54#endif
55 /* enable all cached events of bonito */
56 LOONGSON_INTENSET = cached_bonito_irq_mask;
57 (void)LOONGSON_INTENSET;
58}
59
60/*
61 * Setup the board-specific events for waking up loongson from wait mode
62 */
63void __weak setup_wakeup_events(void)
64{
65}
66
67/*
68 * Check wakeup events
69 */
70int __weak wakeup_loongson(void)
71{
72 return 1;
73}
74
75/*
76 * If the events are really what we want to wakeup the CPU, wake it up
77 * otherwise put the CPU asleep again.
78 */
79static void wait_for_wakeup_events(void)
80{
81 while (!wakeup_loongson())
82 LOONGSON_CHIPCFG0 &= ~0x7;
83}
84
85/*
86 * Stop all perf counters
87 *
88 * $24 is the control register of Loongson perf counter
89 */
90static inline void stop_perf_counters(void)
91{
92 __write_64bit_c0_register($24, 0, 0);
93}
94
95
96static void loongson_suspend_enter(void)
97{
98 static unsigned int cached_cpu_freq;
99
100 /* setup wakeup events via enabling the IRQs */
101 setup_wakeup_events();
102
103 stop_perf_counters();
104
105 cached_cpu_freq = LOONGSON_CHIPCFG0;
106
107 /* Put CPU into wait mode */
108 LOONGSON_CHIPCFG0 &= ~0x7;
109
110 /* wait for the given events to wakeup cpu from wait mode */
111 wait_for_wakeup_events();
112
113 LOONGSON_CHIPCFG0 = cached_cpu_freq;
114 mmiowb();
115}
116
117void __weak mach_suspend(void)
118{
119}
120
121void __weak mach_resume(void)
122{
123}
124
125static int loongson_pm_enter(suspend_state_t state)
126{
127 mach_suspend();
128
129 /* processor specific suspend */
130 loongson_suspend_enter();
131
132 mach_resume();
133
134 return 0;
135}
136
137static int loongson_pm_valid_state(suspend_state_t state)
138{
139 switch (state) {
140 case PM_SUSPEND_ON:
141 case PM_SUSPEND_STANDBY:
142 case PM_SUSPEND_MEM:
143 return 1;
144
145 default:
146 return 0;
147 }
148}
149
150static struct platform_suspend_ops loongson_pm_ops = {
151 .valid = loongson_pm_valid_state,
152 .enter = loongson_pm_enter,
153};
154
155static int __init loongson_pm_init(void)
156{
157 suspend_set_ops(&loongson_pm_ops);
158
159 return 0;
160}
161arch_initcall(loongson_pm_init);
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c
index 97e918251edd..d57f1719da95 100644
--- a/arch/mips/loongson/common/reset.c
+++ b/arch/mips/loongson/common/reset.c
@@ -22,7 +22,7 @@ static void loongson_restart(char *command)
22 mach_prepare_reboot(); 22 mach_prepare_reboot();
23 23
24 /* reboot via jumping to boot base address */ 24 /* reboot via jumping to boot base address */
25 ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) (); 25 ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();
26} 26}
27 27
28static void loongson_halt(void) 28static void loongson_halt(void)
diff --git a/arch/mips/loongson/common/serial.c b/arch/mips/loongson/common/serial.c
new file mode 100644
index 000000000000..23b66a5f88cb
--- /dev/null
+++ b/arch/mips/loongson/common/serial.c
@@ -0,0 +1,76 @@
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 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * Copyright (C) 2009 Lemote, Inc.
9 * Author: Yan hua (yanhua@lemote.com)
10 * Author: Wu Zhangjin (wuzj@lemote.com)
11 */
12
13#include <linux/io.h>
14#include <linux/init.h>
15#include <linux/serial_8250.h>
16
17#include <asm/bootinfo.h>
18
19#include <loongson.h>
20#include <machine.h>
21
22#define PORT(int) \
23{ \
24 .irq = int, \
25 .uartclk = 1843200, \
26 .iotype = UPIO_PORT, \
27 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
28 .regshift = 0, \
29}
30
31#define PORT_M(int) \
32{ \
33 .irq = MIPS_CPU_IRQ_BASE + (int), \
34 .uartclk = 3686400, \
35 .iotype = UPIO_MEM, \
36 .membase = (void __iomem *)NULL, \
37 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
38 .regshift = 0, \
39}
40
41static struct plat_serial8250_port uart8250_data[][2] = {
42 [MACH_LOONGSON_UNKNOWN] {},
43 [MACH_LEMOTE_FL2E] {PORT(4), {} },
44 [MACH_LEMOTE_FL2F] {PORT(3), {} },
45 [MACH_LEMOTE_ML2F7] {PORT_M(3), {} },
46 [MACH_LEMOTE_YL2F89] {PORT_M(3), {} },
47 [MACH_DEXXON_GDIUM2F10] {PORT_M(3), {} },
48 [MACH_LEMOTE_NAS] {PORT_M(3), {} },
49 [MACH_LEMOTE_LL2F] {PORT(3), {} },
50 [MACH_LOONGSON_END] {},
51};
52
53static struct platform_device uart8250_device = {
54 .name = "serial8250",
55 .id = PLAT8250_DEV_PLATFORM,
56};
57
58static int __init serial_init(void)
59{
60 unsigned char iotype;
61
62 iotype = uart8250_data[mips_machtype][0].iotype;
63
64 if (UPIO_MEM == iotype)
65 uart8250_data[mips_machtype][0].membase =
66 (void __iomem *)_loongson_uart_base;
67 else if (UPIO_PORT == iotype)
68 uart8250_data[mips_machtype][0].iobase =
69 loongson_uart_base - LOONGSON_PCIIO_BASE;
70
71 uart8250_device.dev.platform_data = uart8250_data[mips_machtype];
72
73 return platform_device_register(&uart8250_device);
74}
75
76device_initcall(serial_init);
diff --git a/arch/mips/loongson/common/time.c b/arch/mips/loongson/common/time.c
index 6e08c8270abe..35f0b66a94f5 100644
--- a/arch/mips/loongson/common/time.c
+++ b/arch/mips/loongson/common/time.c
@@ -14,11 +14,14 @@
14#include <asm/time.h> 14#include <asm/time.h>
15 15
16#include <loongson.h> 16#include <loongson.h>
17#include <cs5536/cs5536_mfgpt.h>
17 18
18void __init plat_time_init(void) 19void __init plat_time_init(void)
19{ 20{
20 /* setup mips r4k timer */ 21 /* setup mips r4k timer */
21 mips_hpt_frequency = cpu_clock_freq / 2; 22 mips_hpt_frequency = cpu_clock_freq / 2;
23
24 setup_mfgpt0_timer();
22} 25}
23 26
24void read_persistent_clock(struct timespec *ts) 27void read_persistent_clock(struct timespec *ts)
diff --git a/arch/mips/loongson/common/uart_base.c b/arch/mips/loongson/common/uart_base.c
new file mode 100644
index 000000000000..78ff66ae749e
--- /dev/null
+++ b/arch/mips/loongson/common/uart_base.c
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2009 Lemote Inc.
3 * Author: Wu Zhangjin, wuzj@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/module.h>
12#include <asm/bootinfo.h>
13
14#include <loongson.h>
15
16/* ioremapped */
17unsigned long _loongson_uart_base;
18EXPORT_SYMBOL(_loongson_uart_base);
19/* raw */
20unsigned long loongson_uart_base;
21EXPORT_SYMBOL(loongson_uart_base);
22
23void prom_init_loongson_uart_base(void)
24{
25 switch (mips_machtype) {
26 case MACH_LEMOTE_FL2E:
27 loongson_uart_base = LOONGSON_PCIIO_BASE + 0x3f8;
28 break;
29 case MACH_LEMOTE_FL2F:
30 case MACH_LEMOTE_LL2F:
31 loongson_uart_base = LOONGSON_PCIIO_BASE + 0x2f8;
32 break;
33 case MACH_LEMOTE_ML2F7:
34 case MACH_LEMOTE_YL2F89:
35 case MACH_DEXXON_GDIUM2F10:
36 case MACH_LEMOTE_NAS:
37 default:
38 /* The CPU provided serial port */
39 loongson_uart_base = LOONGSON_LIO1_BASE + 0x3f8;
40 break;
41 }
42
43 _loongson_uart_base =
44 (unsigned long)ioremap_nocache(loongson_uart_base, 8);
45}
diff --git a/arch/mips/loongson/fuloong-2e/irq.c b/arch/mips/loongson/fuloong-2e/irq.c
index 7888cf69424a..320e9379bdd7 100644
--- a/arch/mips/loongson/fuloong-2e/irq.c
+++ b/arch/mips/loongson/fuloong-2e/irq.c
@@ -47,8 +47,8 @@ static struct irqaction cascade_irqaction = {
47void __init set_irq_trigger_mode(void) 47void __init set_irq_trigger_mode(void)
48{ 48{
49 /* most bonito irq should be level triggered */ 49 /* most bonito irq should be level triggered */
50 BONITO_INTEDGE = BONITO_ICU_SYSTEMERR | BONITO_ICU_MASTERERR | 50 LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |
51 BONITO_ICU_RETRYERR | BONITO_ICU_MBOXES; 51 LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;
52} 52}
53 53
54void __init mach_init_irq(void) 54void __init mach_init_irq(void)
diff --git a/arch/mips/loongson/fuloong-2e/reset.c b/arch/mips/loongson/fuloong-2e/reset.c
index 677fe186db95..fc16c677d476 100644
--- a/arch/mips/loongson/fuloong-2e/reset.c
+++ b/arch/mips/loongson/fuloong-2e/reset.c
@@ -14,8 +14,8 @@
14 14
15void mach_prepare_reboot(void) 15void mach_prepare_reboot(void)
16{ 16{
17 BONITO_BONGENCFG &= ~(1 << 2); 17 LOONGSON_GENCFG &= ~(1 << 2);
18 BONITO_BONGENCFG |= (1 << 2); 18 LOONGSON_GENCFG |= (1 << 2);
19} 19}
20 20
21void mach_prepare_shutdown(void) 21void mach_prepare_shutdown(void)
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
new file mode 100644
index 000000000000..4d84b27dc41b
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for lemote loongson2f family machines
3#
4
5obj-y += irq.o reset.o ec_kb3310b.o
6
7#
8# Suspend Support
9#
10
11obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.c b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
new file mode 100644
index 000000000000..4d84111a2cd4
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/ec_kb3310b.c
@@ -0,0 +1,130 @@
1/*
2 * Basic KB3310B Embedded Controller support for the YeeLoong 2F netbook
3 *
4 * Copyright (C) 2008 Lemote Inc.
5 * Author: liujl <liujl@lemote.com>, 2008-04-20
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/module.h>
14#include <linux/spinlock.h>
15#include <linux/delay.h>
16
17#include "ec_kb3310b.h"
18
19static DEFINE_SPINLOCK(index_access_lock);
20static DEFINE_SPINLOCK(port_access_lock);
21
22unsigned char ec_read(unsigned short addr)
23{
24 unsigned char value;
25 unsigned long flags;
26
27 spin_lock_irqsave(&index_access_lock, flags);
28 outb((addr & 0xff00) >> 8, EC_IO_PORT_HIGH);
29 outb((addr & 0x00ff), EC_IO_PORT_LOW);
30 value = inb(EC_IO_PORT_DATA);
31 spin_unlock_irqrestore(&index_access_lock, flags);
32
33 return value;
34}
35EXPORT_SYMBOL_GPL(ec_read);
36
37void ec_write(unsigned short addr, unsigned char val)
38{
39 unsigned long flags;
40
41 spin_lock_irqsave(&index_access_lock, flags);
42 outb((addr & 0xff00) >> 8, EC_IO_PORT_HIGH);
43 outb((addr & 0x00ff), EC_IO_PORT_LOW);
44 outb(val, EC_IO_PORT_DATA);
45 /* flush the write action */
46 inb(EC_IO_PORT_DATA);
47 spin_unlock_irqrestore(&index_access_lock, flags);
48
49 return;
50}
51EXPORT_SYMBOL_GPL(ec_write);
52
53/*
54 * This function is used for EC command writes and corresponding status queries.
55 */
56int ec_query_seq(unsigned char cmd)
57{
58 int timeout;
59 unsigned char status;
60 unsigned long flags;
61 int ret = 0;
62
63 spin_lock_irqsave(&port_access_lock, flags);
64
65 /* make chip goto reset mode */
66 udelay(EC_REG_DELAY);
67 outb(cmd, EC_CMD_PORT);
68 udelay(EC_REG_DELAY);
69
70 /* check if the command is received by ec */
71 timeout = EC_CMD_TIMEOUT;
72 status = inb(EC_STS_PORT);
73 while (timeout-- && (status & (1 << 1))) {
74 status = inb(EC_STS_PORT);
75 udelay(EC_REG_DELAY);
76 }
77
78 if (timeout <= 0) {
79 printk(KERN_ERR "%s: deadable error : timeout...\n", __func__);
80 ret = -EINVAL;
81 } else
82 printk(KERN_INFO
83 "(%x/%d)ec issued command %d status : 0x%x\n",
84 timeout, EC_CMD_TIMEOUT - timeout, cmd, status);
85
86 spin_unlock_irqrestore(&port_access_lock, flags);
87
88 return ret;
89}
90EXPORT_SYMBOL_GPL(ec_query_seq);
91
92/*
93 * Send query command to EC to get the proper event number
94 */
95int ec_query_event_num(void)
96{
97 return ec_query_seq(CMD_GET_EVENT_NUM);
98}
99EXPORT_SYMBOL(ec_query_event_num);
100
101/*
102 * Get event number from EC
103 *
104 * NOTE: This routine must follow the query_event_num function in the
105 * interrupt.
106 */
107int ec_get_event_num(void)
108{
109 int timeout = 100;
110 unsigned char value;
111 unsigned char status;
112
113 udelay(EC_REG_DELAY);
114 status = inb(EC_STS_PORT);
115 udelay(EC_REG_DELAY);
116 while (timeout-- && !(status & (1 << 0))) {
117 status = inb(EC_STS_PORT);
118 udelay(EC_REG_DELAY);
119 }
120 if (timeout <= 0) {
121 pr_info("%s: get event number timeout.\n", __func__);
122
123 return -EINVAL;
124 }
125 value = inb(EC_DAT_PORT);
126 udelay(EC_REG_DELAY);
127
128 return value;
129}
130EXPORT_SYMBOL(ec_get_event_num);
diff --git a/arch/mips/loongson/lemote-2f/ec_kb3310b.h b/arch/mips/loongson/lemote-2f/ec_kb3310b.h
new file mode 100644
index 000000000000..1595a21b315b
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/ec_kb3310b.h
@@ -0,0 +1,188 @@
1/*
2 * KB3310B Embedded Controller
3 *
4 * Copyright (C) 2008 Lemote Inc.
5 * Author: liujl <liujl@lemote.com>, 2008-03-14
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef _EC_KB3310B_H
14#define _EC_KB3310B_H
15
16extern unsigned char ec_read(unsigned short addr);
17extern void ec_write(unsigned short addr, unsigned char val);
18extern int ec_query_seq(unsigned char cmd);
19extern int ec_query_event_num(void);
20extern int ec_get_event_num(void);
21
22typedef int (*sci_handler) (int status);
23extern sci_handler yeeloong_report_lid_status;
24
25#define SCI_IRQ_NUM 0x0A
26
27/*
28 * The following registers are determined by the EC index configuration.
29 * 1, fill the PORT_HIGH as EC register high part.
30 * 2, fill the PORT_LOW as EC register low part.
31 * 3, fill the PORT_DATA as EC register write data or get the data from it.
32 */
33#define EC_IO_PORT_HIGH 0x0381
34#define EC_IO_PORT_LOW 0x0382
35#define EC_IO_PORT_DATA 0x0383
36
37/*
38 * EC delay time is 500us for register and status access
39 */
40#define EC_REG_DELAY 500 /* unit : us */
41#define EC_CMD_TIMEOUT 0x1000
42
43/*
44 * EC access port for SCI communication
45 */
46#define EC_CMD_PORT 0x66
47#define EC_STS_PORT 0x66
48#define EC_DAT_PORT 0x62
49#define CMD_INIT_IDLE_MODE 0xdd
50#define CMD_EXIT_IDLE_MODE 0xdf
51#define CMD_INIT_RESET_MODE 0xd8
52#define CMD_REBOOT_SYSTEM 0x8c
53#define CMD_GET_EVENT_NUM 0x84
54#define CMD_PROGRAM_PIECE 0xda
55
56/* temperature & fan registers */
57#define REG_TEMPERATURE_VALUE 0xF458
58#define REG_FAN_AUTO_MAN_SWITCH 0xF459
59#define BIT_FAN_AUTO 0
60#define BIT_FAN_MANUAL 1
61#define REG_FAN_CONTROL 0xF4D2
62#define BIT_FAN_CONTROL_ON (1 << 0)
63#define BIT_FAN_CONTROL_OFF (0 << 0)
64#define REG_FAN_STATUS 0xF4DA
65#define BIT_FAN_STATUS_ON (1 << 0)
66#define BIT_FAN_STATUS_OFF (0 << 0)
67#define REG_FAN_SPEED_HIGH 0xFE22
68#define REG_FAN_SPEED_LOW 0xFE23
69#define REG_FAN_SPEED_LEVEL 0xF4CC
70/* fan speed divider */
71#define FAN_SPEED_DIVIDER 480000 /* (60*1000*1000/62.5/2)*/
72
73/* battery registers */
74#define REG_BAT_DESIGN_CAP_HIGH 0xF77D
75#define REG_BAT_DESIGN_CAP_LOW 0xF77E
76#define REG_BAT_FULLCHG_CAP_HIGH 0xF780
77#define REG_BAT_FULLCHG_CAP_LOW 0xF781
78#define REG_BAT_DESIGN_VOL_HIGH 0xF782
79#define REG_BAT_DESIGN_VOL_LOW 0xF783
80#define REG_BAT_CURRENT_HIGH 0xF784
81#define REG_BAT_CURRENT_LOW 0xF785
82#define REG_BAT_VOLTAGE_HIGH 0xF786
83#define REG_BAT_VOLTAGE_LOW 0xF787
84#define REG_BAT_TEMPERATURE_HIGH 0xF788
85#define REG_BAT_TEMPERATURE_LOW 0xF789
86#define REG_BAT_RELATIVE_CAP_HIGH 0xF492
87#define REG_BAT_RELATIVE_CAP_LOW 0xF493
88#define REG_BAT_VENDOR 0xF4C4
89#define FLAG_BAT_VENDOR_SANYO 0x01
90#define FLAG_BAT_VENDOR_SIMPLO 0x02
91#define REG_BAT_CELL_COUNT 0xF4C6
92#define FLAG_BAT_CELL_3S1P 0x03
93#define FLAG_BAT_CELL_3S2P 0x06
94#define REG_BAT_CHARGE 0xF4A2
95#define FLAG_BAT_CHARGE_DISCHARGE 0x01
96#define FLAG_BAT_CHARGE_CHARGE 0x02
97#define FLAG_BAT_CHARGE_ACPOWER 0x00
98#define REG_BAT_STATUS 0xF4B0
99#define BIT_BAT_STATUS_LOW (1 << 5)
100#define BIT_BAT_STATUS_DESTROY (1 << 2)
101#define BIT_BAT_STATUS_FULL (1 << 1)
102#define BIT_BAT_STATUS_IN (1 << 0)
103#define REG_BAT_CHARGE_STATUS 0xF4B1
104#define BIT_BAT_CHARGE_STATUS_OVERTEMP (1 << 2)
105#define BIT_BAT_CHARGE_STATUS_PRECHG (1 << 1)
106#define REG_BAT_STATE 0xF482
107#define BIT_BAT_STATE_CHARGING (1 << 1)
108#define BIT_BAT_STATE_DISCHARGING (1 << 0)
109#define REG_BAT_POWER 0xF440
110#define BIT_BAT_POWER_S3 (1 << 2)
111#define BIT_BAT_POWER_ON (1 << 1)
112#define BIT_BAT_POWER_ACIN (1 << 0)
113
114/* other registers */
115/* Audio: rd/wr */
116#define REG_AUDIO_VOLUME 0xF46C
117#define REG_AUDIO_MUTE 0xF4E7
118#define REG_AUDIO_BEEP 0xF4D0
119/* USB port power or not: rd/wr */
120#define REG_USB0_FLAG 0xF461
121#define REG_USB1_FLAG 0xF462
122#define REG_USB2_FLAG 0xF463
123#define BIT_USB_FLAG_ON 1
124#define BIT_USB_FLAG_OFF 0
125/* LID */
126#define REG_LID_DETECT 0xF4BD
127#define BIT_LID_DETECT_ON 1
128#define BIT_LID_DETECT_OFF 0
129/* CRT */
130#define REG_CRT_DETECT 0xF4AD
131#define BIT_CRT_DETECT_PLUG 1
132#define BIT_CRT_DETECT_UNPLUG 0
133/* LCD backlight brightness adjust: 9 levels */
134#define REG_DISPLAY_BRIGHTNESS 0xF4F5
135/* Black screen Status */
136#define BIT_DISPLAY_LCD_ON 1
137#define BIT_DISPLAY_LCD_OFF 0
138/* LCD backlight control: off/restore */
139#define REG_BACKLIGHT_CTRL 0xF7BD
140#define BIT_BACKLIGHT_ON 1
141#define BIT_BACKLIGHT_OFF 0
142/* Reset the machine auto-clear: rd/wr */
143#define REG_RESET 0xF4EC
144#define BIT_RESET_ON 1
145/* Light the led: rd/wr */
146#define REG_LED 0xF4C8
147#define BIT_LED_RED_POWER (1 << 0)
148#define BIT_LED_ORANGE_POWER (1 << 1)
149#define BIT_LED_GREEN_CHARGE (1 << 2)
150#define BIT_LED_RED_CHARGE (1 << 3)
151#define BIT_LED_NUMLOCK (1 << 4)
152/* Test led mode, all led on/off */
153#define REG_LED_TEST 0xF4C2
154#define BIT_LED_TEST_IN 1
155#define BIT_LED_TEST_OUT 0
156/* Camera on/off */
157#define REG_CAMERA_STATUS 0xF46A
158#define BIT_CAMERA_STATUS_ON 1
159#define BIT_CAMERA_STATUS_OFF 0
160#define REG_CAMERA_CONTROL 0xF7B7
161#define BIT_CAMERA_CONTROL_OFF 0
162#define BIT_CAMERA_CONTROL_ON 1
163/* Wlan Status */
164#define REG_WLAN 0xF4FA
165#define BIT_WLAN_ON 1
166#define BIT_WLAN_OFF 0
167#define REG_DISPLAY_LCD 0xF79F
168
169/* SCI Event Number from EC */
170enum {
171 EVENT_LID = 0x23, /* LID open/close */
172 EVENT_DISPLAY_TOGGLE, /* Fn+F3 for display switch */
173 EVENT_SLEEP, /* Fn+F1 for entering sleep mode */
174 EVENT_OVERTEMP, /* Over-temperature happened */
175 EVENT_CRT_DETECT, /* CRT is connected */
176 EVENT_CAMERA, /* Camera on/off */
177 EVENT_USB_OC2, /* USB2 Over Current occurred */
178 EVENT_USB_OC0, /* USB0 Over Current occurred */
179 EVENT_BLACK_SCREEN, /* Turn on/off backlight */
180 EVENT_AUDIO_MUTE, /* Mute on/off */
181 EVENT_DISPLAY_BRIGHTNESS,/* LCD backlight brightness adjust */
182 EVENT_AC_BAT, /* AC & Battery relative issue */
183 EVENT_AUDIO_VOLUME, /* Volume adjust */
184 EVENT_WLAN, /* Wlan on/off */
185 EVENT_END
186};
187
188#endif /* !_EC_KB3310B_H */
diff --git a/arch/mips/loongson/lemote-2f/irq.c b/arch/mips/loongson/lemote-2f/irq.c
new file mode 100644
index 000000000000..77d32f9cf31e
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/irq.c
@@ -0,0 +1,134 @@
1/*
2 * Copyright (C) 2007 Lemote Inc.
3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#include <linux/interrupt.h>
12#include <linux/module.h>
13
14#include <asm/irq_cpu.h>
15#include <asm/i8259.h>
16#include <asm/mipsregs.h>
17
18#include <loongson.h>
19#include <machine.h>
20
21#define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* cpu timer */
22#define LOONGSON_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
23#define LOONGSON_NORTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 6) /* bonito */
24#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 3) /* cpu serial port */
25#define LOONGSON_SOUTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 2) /* i8259 */
26
27#define LOONGSON_INT_BIT_INT0 (1 << 11)
28#define LOONGSON_INT_BIT_INT1 (1 << 12)
29
30/*
31 * The generic i8259_irq() make the kernel hang on booting. Since we cannot
32 * get the irq via the IRR directly, we access the ISR instead.
33 */
34int mach_i8259_irq(void)
35{
36 int irq, isr;
37
38 irq = -1;
39
40 if ((LOONGSON_INTISR & LOONGSON_INTEN) & LOONGSON_INT_BIT_INT0) {
41 spin_lock(&i8259A_lock);
42 isr = inb(PIC_MASTER_CMD) &
43 ~inb(PIC_MASTER_IMR) & ~(1 << PIC_CASCADE_IR);
44 if (!isr)
45 isr = (inb(PIC_SLAVE_CMD) & ~inb(PIC_SLAVE_IMR)) << 8;
46 irq = ffs(isr) - 1;
47 if (unlikely(irq == 7)) {
48 /*
49 * This may be a spurious interrupt.
50 *
51 * Read the interrupt status register (ISR). If the most
52 * significant bit is not set then there is no valid
53 * interrupt.
54 */
55 outb(0x0B, PIC_MASTER_ISR); /* ISR register */
56 if (~inb(PIC_MASTER_ISR) & 0x80)
57 irq = -1;
58 }
59 spin_unlock(&i8259A_lock);
60 }
61
62 return irq;
63}
64EXPORT_SYMBOL(mach_i8259_irq);
65
66static void i8259_irqdispatch(void)
67{
68 int irq;
69
70 irq = mach_i8259_irq();
71 if (irq >= 0)
72 do_IRQ(irq);
73 else
74 spurious_interrupt();
75}
76
77void mach_irq_dispatch(unsigned int pending)
78{
79 if (pending & CAUSEF_IP7)
80 do_IRQ(LOONGSON_TIMER_IRQ);
81 else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */
82#ifdef CONFIG_OPROFILE
83 do_IRQ(LOONGSON2_PERFCNT_IRQ);
84#endif
85 bonito_irqdispatch();
86 } else if (pending & CAUSEF_IP3) /* CPU UART */
87 do_IRQ(LOONGSON_UART_IRQ);
88 else if (pending & CAUSEF_IP2) /* South Bridge */
89 i8259_irqdispatch();
90 else
91 spurious_interrupt();
92}
93
94void __init set_irq_trigger_mode(void)
95{
96 /* setup cs5536 as high level trigger */
97 LOONGSON_INTPOL = LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1;
98 LOONGSON_INTEDGE &= ~(LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1);
99}
100
101static irqreturn_t ip6_action(int cpl, void *dev_id)
102{
103 return IRQ_HANDLED;
104}
105
106struct irqaction ip6_irqaction = {
107 .handler = ip6_action,
108 .name = "cascade",
109 .flags = IRQF_SHARED,
110};
111
112struct irqaction cascade_irqaction = {
113 .handler = no_action,
114 .name = "cascade",
115};
116
117void __init mach_init_irq(void)
118{
119 /* init all controller
120 * 0-15 ------> i8259 interrupt
121 * 16-23 ------> mips cpu interrupt
122 * 32-63 ------> bonito irq
123 */
124
125 /* Sets the first-level interrupt dispatcher. */
126 mips_cpu_irq_init();
127 init_i8259_irqs();
128 bonito_irq_init();
129
130 /* setup north bridge irq (bonito) */
131 setup_irq(LOONGSON_NORTH_BRIDGE_IRQ, &ip6_irqaction);
132 /* setup source bridge irq (i8259) */
133 setup_irq(LOONGSON_SOUTH_BRIDGE_IRQ, &cascade_irqaction);
134}
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
new file mode 100644
index 000000000000..d7af2e616592
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -0,0 +1,149 @@
1/*
2 * Lemote loongson2f family machines' specific suspend support
3 *
4 * Copyright (C) 2009 Lemote Inc.
5 * Author: Wu Zhangjin <wuzj@lemote.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/suspend.h>
14#include <linux/interrupt.h>
15#include <linux/pm.h>
16#include <linux/i8042.h>
17#include <linux/module.h>
18
19#include <asm/i8259.h>
20#include <asm/mipsregs.h>
21#include <asm/bootinfo.h>
22
23#include <loongson.h>
24
25#include <cs5536/cs5536_mfgpt.h>
26#include "ec_kb3310b.h"
27
28#define I8042_KBD_IRQ 1
29#define I8042_CTR_KBDINT 0x01
30#define I8042_CTR_KBDDIS 0x10
31
32static unsigned char i8042_ctr;
33
34static int i8042_enable_kbd_port(void)
35{
36 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) {
37 pr_err("i8042.c: Can't read CTR while enabling i8042 kbd port."
38 "\n");
39 return -EIO;
40 }
41
42 i8042_ctr &= ~I8042_CTR_KBDDIS;
43 i8042_ctr |= I8042_CTR_KBDINT;
44
45 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
46 i8042_ctr &= ~I8042_CTR_KBDINT;
47 i8042_ctr |= I8042_CTR_KBDDIS;
48 pr_err("i8042.c: Failed to enable KBD port.\n");
49
50 return -EIO;
51 }
52
53 return 0;
54}
55
56void setup_wakeup_events(void)
57{
58 int irq_mask;
59
60 switch (mips_machtype) {
61 case MACH_LEMOTE_ML2F7:
62 case MACH_LEMOTE_YL2F89:
63 /* open the keyboard irq in i8259A */
64 outb((0xff & ~(1 << I8042_KBD_IRQ)), PIC_MASTER_IMR);
65 irq_mask = inb(PIC_MASTER_IMR);
66
67 /* enable keyboard port */
68 i8042_enable_kbd_port();
69
70 /* Wakeup CPU via SCI lid open event */
71 outb(irq_mask & ~(1 << PIC_CASCADE_IR), PIC_MASTER_IMR);
72 inb(PIC_MASTER_IMR);
73 outb(0xff & ~(1 << (SCI_IRQ_NUM - 8)), PIC_SLAVE_IMR);
74 inb(PIC_SLAVE_IMR);
75
76 break;
77
78 default:
79 break;
80 }
81}
82
83static struct delayed_work lid_task;
84static int initialized;
85/* yeeloong_report_lid_status will be implemented in yeeloong_laptop.c */
86sci_handler yeeloong_report_lid_status;
87EXPORT_SYMBOL(yeeloong_report_lid_status);
88static void yeeloong_lid_update_task(struct work_struct *work)
89{
90 if (yeeloong_report_lid_status)
91 yeeloong_report_lid_status(BIT_LID_DETECT_ON);
92}
93
94int wakeup_loongson(void)
95{
96 int irq;
97
98 /* query the interrupt number */
99 irq = mach_i8259_irq();
100 if (irq < 0)
101 return 0;
102
103 printk(KERN_INFO "%s: irq = %d\n", __func__, irq);
104
105 if (irq == I8042_KBD_IRQ)
106 return 1;
107 else if (irq == SCI_IRQ_NUM) {
108 int ret, sci_event;
109 /* query the event number */
110 ret = ec_query_seq(CMD_GET_EVENT_NUM);
111 if (ret < 0)
112 return 0;
113 sci_event = ec_get_event_num();
114 if (sci_event < 0)
115 return 0;
116 if (sci_event == EVENT_LID) {
117 int lid_status;
118 /* check the LID status */
119 lid_status = ec_read(REG_LID_DETECT);
120 /* wakeup cpu when people open the LID */
121 if (lid_status == BIT_LID_DETECT_ON) {
122 /* If we call it directly here, the WARNING
123 * will be sent out by getnstimeofday
124 * via "WARN_ON(timekeeping_suspended);"
125 * because we can not schedule in suspend mode.
126 */
127 if (initialized == 0) {
128 INIT_DELAYED_WORK(&lid_task,
129 yeeloong_lid_update_task);
130 initialized = 1;
131 }
132 schedule_delayed_work(&lid_task, 1);
133 return 1;
134 }
135 }
136 }
137
138 return 0;
139}
140
141void __weak mach_suspend(void)
142{
143 disable_mfgpt0_counter();
144}
145
146void __weak mach_resume(void)
147{
148 enable_mfgpt0_counter();
149}
diff --git a/arch/mips/loongson/lemote-2f/reset.c b/arch/mips/loongson/lemote-2f/reset.c
new file mode 100644
index 000000000000..51d1a60d5349
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/reset.c
@@ -0,0 +1,159 @@
1/* Board-specific reboot/shutdown routines
2 *
3 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
4 *
5 * Copyright (C) 2009 Lemote Inc.
6 * Author: Wu Zhangjin, wuzj@lemote.com
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/io.h>
15#include <linux/delay.h>
16#include <linux/types.h>
17
18#include <asm/bootinfo.h>
19
20#include <loongson.h>
21
22#include <cs5536/cs5536.h>
23#include "ec_kb3310b.h"
24
25static void reset_cpu(void)
26{
27 /*
28 * reset cpu to full speed, this is needed when enabling cpu frequency
29 * scalling
30 */
31 LOONGSON_CHIPCFG0 |= 0x7;
32}
33
34/* reset support for fuloong2f */
35
36static void fl2f_reboot(void)
37{
38 reset_cpu();
39
40 /* send a reset signal to south bridge.
41 *
42 * NOTE: if enable "Power Management" in kernel, rtl8169 will not reset
43 * normally with this reset operation and it will not work in PMON, but
44 * you can type halt command and then reboot, seems the hardware reset
45 * logic not work normally.
46 */
47 {
48 u32 hi, lo;
49 _rdmsr(DIVIL_MSR_REG(DIVIL_SOFT_RESET), &hi, &lo);
50 lo |= 0x00000001;
51 _wrmsr(DIVIL_MSR_REG(DIVIL_SOFT_RESET), hi, lo);
52 }
53}
54
55static void fl2f_shutdown(void)
56{
57 u32 hi, lo, val;
58 int gpio_base;
59
60 /* get gpio base */
61 _rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_GPIO), &hi, &lo);
62 gpio_base = lo & 0xff00;
63
64 /* make cs5536 gpio13 output enable */
65 val = inl(gpio_base + GPIOL_OUT_EN);
66 val &= ~(1 << (16 + 13));
67 val |= (1 << 13);
68 outl(val, gpio_base + GPIOL_OUT_EN);
69 mmiowb();
70 /* make cs5536 gpio13 output low level voltage. */
71 val = inl(gpio_base + GPIOL_OUT_VAL) & ~(1 << (13));
72 val |= (1 << (16 + 13));
73 outl(val, gpio_base + GPIOL_OUT_VAL);
74 mmiowb();
75}
76
77/* reset support for yeeloong2f and mengloong2f notebook */
78
79void ml2f_reboot(void)
80{
81 reset_cpu();
82
83 /* sending an reset signal to EC(embedded controller) */
84 ec_write(REG_RESET, BIT_RESET_ON);
85}
86
87#define yl2f89_reboot ml2f_reboot
88
89/* menglong(7inches) laptop has different shutdown logic from 8.9inches */
90#define EC_SHUTDOWN_IO_PORT_HIGH 0xff2d
91#define EC_SHUTDOWN_IO_PORT_LOW 0xff2e
92#define EC_SHUTDOWN_IO_PORT_DATA 0xff2f
93#define REG_SHUTDOWN_HIGH 0xFC
94#define REG_SHUTDOWN_LOW 0x29
95#define BIT_SHUTDOWN_ON (1 << 1)
96
97static void ml2f_shutdown(void)
98{
99 u8 val;
100 u64 i;
101
102 outb(REG_SHUTDOWN_HIGH, EC_SHUTDOWN_IO_PORT_HIGH);
103 outb(REG_SHUTDOWN_LOW, EC_SHUTDOWN_IO_PORT_LOW);
104 mmiowb();
105 val = inb(EC_SHUTDOWN_IO_PORT_DATA);
106 outb(val & (~BIT_SHUTDOWN_ON), EC_SHUTDOWN_IO_PORT_DATA);
107 mmiowb();
108 /* need enough wait here... how many microseconds needs? */
109 for (i = 0; i < 0x10000; i++)
110 delay();
111 outb(val | BIT_SHUTDOWN_ON, EC_SHUTDOWN_IO_PORT_DATA);
112 mmiowb();
113}
114
115static void yl2f89_shutdown(void)
116{
117 /* cpu-gpio0 output low */
118 LOONGSON_GPIODATA &= ~0x00000001;
119 /* cpu-gpio0 as output */
120 LOONGSON_GPIOIE &= ~0x00000001;
121}
122
123void mach_prepare_reboot(void)
124{
125 switch (mips_machtype) {
126 case MACH_LEMOTE_FL2F:
127 case MACH_LEMOTE_NAS:
128 case MACH_LEMOTE_LL2F:
129 fl2f_reboot();
130 break;
131 case MACH_LEMOTE_ML2F7:
132 ml2f_reboot();
133 break;
134 case MACH_LEMOTE_YL2F89:
135 yl2f89_reboot();
136 break;
137 default:
138 break;
139 }
140}
141
142void mach_prepare_shutdown(void)
143{
144 switch (mips_machtype) {
145 case MACH_LEMOTE_FL2F:
146 case MACH_LEMOTE_NAS:
147 case MACH_LEMOTE_LL2F:
148 fl2f_shutdown();
149 break;
150 case MACH_LEMOTE_ML2F7:
151 ml2f_shutdown();
152 break;
153 case MACH_LEMOTE_YL2F89:
154 yl2f89_shutdown();
155 break;
156 default:
157 break;
158 }
159}
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 454b53924490..8f2f8e9d8b21 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -35,6 +35,7 @@
35 * better performance by compiling with -msoft-float! 35 * better performance by compiling with -msoft-float!
36 */ 36 */
37#include <linux/sched.h> 37#include <linux/sched.h>
38#include <linux/module.h>
38#include <linux/debugfs.h> 39#include <linux/debugfs.h>
39 40
40#include <asm/inst.h> 41#include <asm/inst.h>
@@ -68,7 +69,9 @@ static int fpux_emu(struct pt_regs *,
68 69
69/* Further private data for which no space exists in mips_fpu_struct */ 70/* Further private data for which no space exists in mips_fpu_struct */
70 71
71struct mips_fpu_emulator_stats fpuemustats; 72#ifdef CONFIG_DEBUG_FS
73DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
74#endif
72 75
73/* Control registers */ 76/* Control registers */
74 77
@@ -209,7 +212,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
209 unsigned int cond; 212 unsigned int cond;
210 213
211 if (get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) { 214 if (get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) {
212 fpuemustats.errors++; 215 MIPS_FPU_EMU_INC_STATS(errors);
213 return SIGBUS; 216 return SIGBUS;
214 } 217 }
215 218
@@ -240,7 +243,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
240 return SIGILL; 243 return SIGILL;
241 } 244 }
242 if (get_user(ir, (mips_instruction __user *) emulpc)) { 245 if (get_user(ir, (mips_instruction __user *) emulpc)) {
243 fpuemustats.errors++; 246 MIPS_FPU_EMU_INC_STATS(errors);
244 return SIGBUS; 247 return SIGBUS;
245 } 248 }
246 /* __compute_return_epc() will have updated cp0_epc */ 249 /* __compute_return_epc() will have updated cp0_epc */
@@ -253,16 +256,16 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
253 } 256 }
254 257
255 emul: 258 emul:
256 fpuemustats.emulated++; 259 MIPS_FPU_EMU_INC_STATS(emulated);
257 switch (MIPSInst_OPCODE(ir)) { 260 switch (MIPSInst_OPCODE(ir)) {
258 case ldc1_op:{ 261 case ldc1_op:{
259 u64 __user *va = (u64 __user *) (xcp->regs[MIPSInst_RS(ir)] + 262 u64 __user *va = (u64 __user *) (xcp->regs[MIPSInst_RS(ir)] +
260 MIPSInst_SIMM(ir)); 263 MIPSInst_SIMM(ir));
261 u64 val; 264 u64 val;
262 265
263 fpuemustats.loads++; 266 MIPS_FPU_EMU_INC_STATS(loads);
264 if (get_user(val, va)) { 267 if (get_user(val, va)) {
265 fpuemustats.errors++; 268 MIPS_FPU_EMU_INC_STATS(errors);
266 return SIGBUS; 269 return SIGBUS;
267 } 270 }
268 DITOREG(val, MIPSInst_RT(ir)); 271 DITOREG(val, MIPSInst_RT(ir));
@@ -274,10 +277,10 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
274 MIPSInst_SIMM(ir)); 277 MIPSInst_SIMM(ir));
275 u64 val; 278 u64 val;
276 279
277 fpuemustats.stores++; 280 MIPS_FPU_EMU_INC_STATS(stores);
278 DIFROMREG(val, MIPSInst_RT(ir)); 281 DIFROMREG(val, MIPSInst_RT(ir));
279 if (put_user(val, va)) { 282 if (put_user(val, va)) {
280 fpuemustats.errors++; 283 MIPS_FPU_EMU_INC_STATS(errors);
281 return SIGBUS; 284 return SIGBUS;
282 } 285 }
283 break; 286 break;
@@ -288,9 +291,9 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
288 MIPSInst_SIMM(ir)); 291 MIPSInst_SIMM(ir));
289 u32 val; 292 u32 val;
290 293
291 fpuemustats.loads++; 294 MIPS_FPU_EMU_INC_STATS(loads);
292 if (get_user(val, va)) { 295 if (get_user(val, va)) {
293 fpuemustats.errors++; 296 MIPS_FPU_EMU_INC_STATS(errors);
294 return SIGBUS; 297 return SIGBUS;
295 } 298 }
296 SITOREG(val, MIPSInst_RT(ir)); 299 SITOREG(val, MIPSInst_RT(ir));
@@ -302,10 +305,10 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
302 MIPSInst_SIMM(ir)); 305 MIPSInst_SIMM(ir));
303 u32 val; 306 u32 val;
304 307
305 fpuemustats.stores++; 308 MIPS_FPU_EMU_INC_STATS(stores);
306 SIFROMREG(val, MIPSInst_RT(ir)); 309 SIFROMREG(val, MIPSInst_RT(ir));
307 if (put_user(val, va)) { 310 if (put_user(val, va)) {
308 fpuemustats.errors++; 311 MIPS_FPU_EMU_INC_STATS(errors);
309 return SIGBUS; 312 return SIGBUS;
310 } 313 }
311 break; 314 break;
@@ -429,7 +432,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
429 432
430 if (get_user(ir, 433 if (get_user(ir,
431 (mips_instruction __user *) xcp->cp0_epc)) { 434 (mips_instruction __user *) xcp->cp0_epc)) {
432 fpuemustats.errors++; 435 MIPS_FPU_EMU_INC_STATS(errors);
433 return SIGBUS; 436 return SIGBUS;
434 } 437 }
435 438
@@ -595,7 +598,7 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
595{ 598{
596 unsigned rcsr = 0; /* resulting csr */ 599 unsigned rcsr = 0; /* resulting csr */
597 600
598 fpuemustats.cp1xops++; 601 MIPS_FPU_EMU_INC_STATS(cp1xops);
599 602
600 switch (MIPSInst_FMA_FFMT(ir)) { 603 switch (MIPSInst_FMA_FFMT(ir)) {
601 case s_fmt:{ /* 0 */ 604 case s_fmt:{ /* 0 */
@@ -610,9 +613,9 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
610 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + 613 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] +
611 xcp->regs[MIPSInst_FT(ir)]); 614 xcp->regs[MIPSInst_FT(ir)]);
612 615
613 fpuemustats.loads++; 616 MIPS_FPU_EMU_INC_STATS(loads);
614 if (get_user(val, va)) { 617 if (get_user(val, va)) {
615 fpuemustats.errors++; 618 MIPS_FPU_EMU_INC_STATS(errors);
616 return SIGBUS; 619 return SIGBUS;
617 } 620 }
618 SITOREG(val, MIPSInst_FD(ir)); 621 SITOREG(val, MIPSInst_FD(ir));
@@ -622,11 +625,11 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
622 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + 625 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] +
623 xcp->regs[MIPSInst_FT(ir)]); 626 xcp->regs[MIPSInst_FT(ir)]);
624 627
625 fpuemustats.stores++; 628 MIPS_FPU_EMU_INC_STATS(stores);
626 629
627 SIFROMREG(val, MIPSInst_FS(ir)); 630 SIFROMREG(val, MIPSInst_FS(ir));
628 if (put_user(val, va)) { 631 if (put_user(val, va)) {
629 fpuemustats.errors++; 632 MIPS_FPU_EMU_INC_STATS(errors);
630 return SIGBUS; 633 return SIGBUS;
631 } 634 }
632 break; 635 break;
@@ -687,9 +690,9 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
687 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + 690 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] +
688 xcp->regs[MIPSInst_FT(ir)]); 691 xcp->regs[MIPSInst_FT(ir)]);
689 692
690 fpuemustats.loads++; 693 MIPS_FPU_EMU_INC_STATS(loads);
691 if (get_user(val, va)) { 694 if (get_user(val, va)) {
692 fpuemustats.errors++; 695 MIPS_FPU_EMU_INC_STATS(errors);
693 return SIGBUS; 696 return SIGBUS;
694 } 697 }
695 DITOREG(val, MIPSInst_FD(ir)); 698 DITOREG(val, MIPSInst_FD(ir));
@@ -699,10 +702,10 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
699 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + 702 va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] +
700 xcp->regs[MIPSInst_FT(ir)]); 703 xcp->regs[MIPSInst_FT(ir)]);
701 704
702 fpuemustats.stores++; 705 MIPS_FPU_EMU_INC_STATS(stores);
703 DIFROMREG(val, MIPSInst_FS(ir)); 706 DIFROMREG(val, MIPSInst_FS(ir));
704 if (put_user(val, va)) { 707 if (put_user(val, va)) {
705 fpuemustats.errors++; 708 MIPS_FPU_EMU_INC_STATS(errors);
706 return SIGBUS; 709 return SIGBUS;
707 } 710 }
708 break; 711 break;
@@ -769,7 +772,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
769#endif 772#endif
770 } rv; /* resulting value */ 773 } rv; /* resulting value */
771 774
772 fpuemustats.cp1ops++; 775 MIPS_FPU_EMU_INC_STATS(cp1ops);
773 switch (rfmt = (MIPSInst_FFMT(ir) & 0xf)) { 776 switch (rfmt = (MIPSInst_FFMT(ir) & 0xf)) {
774 case s_fmt:{ /* 0 */ 777 case s_fmt:{ /* 0 */
775 union { 778 union {
@@ -1240,7 +1243,7 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
1240 prevepc = xcp->cp0_epc; 1243 prevepc = xcp->cp0_epc;
1241 1244
1242 if (get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) { 1245 if (get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) {
1243 fpuemustats.errors++; 1246 MIPS_FPU_EMU_INC_STATS(errors);
1244 return SIGBUS; 1247 return SIGBUS;
1245 } 1248 }
1246 if (insn == 0) 1249 if (insn == 0)
@@ -1276,33 +1279,50 @@ int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
1276} 1279}
1277 1280
1278#ifdef CONFIG_DEBUG_FS 1281#ifdef CONFIG_DEBUG_FS
1282
1283static int fpuemu_stat_get(void *data, u64 *val)
1284{
1285 int cpu;
1286 unsigned long sum = 0;
1287 for_each_online_cpu(cpu) {
1288 struct mips_fpu_emulator_stats *ps;
1289 local_t *pv;
1290 ps = &per_cpu(fpuemustats, cpu);
1291 pv = (void *)ps + (unsigned long)data;
1292 sum += local_read(pv);
1293 }
1294 *val = sum;
1295 return 0;
1296}
1297DEFINE_SIMPLE_ATTRIBUTE(fops_fpuemu_stat, fpuemu_stat_get, NULL, "%llu\n");
1298
1279extern struct dentry *mips_debugfs_dir; 1299extern struct dentry *mips_debugfs_dir;
1280static int __init debugfs_fpuemu(void) 1300static int __init debugfs_fpuemu(void)
1281{ 1301{
1282 struct dentry *d, *dir; 1302 struct dentry *d, *dir;
1283 int i;
1284 static struct {
1285 const char *name;
1286 unsigned int *v;
1287 } vars[] __initdata = {
1288 { "emulated", &fpuemustats.emulated },
1289 { "loads", &fpuemustats.loads },
1290 { "stores", &fpuemustats.stores },
1291 { "cp1ops", &fpuemustats.cp1ops },
1292 { "cp1xops", &fpuemustats.cp1xops },
1293 { "errors", &fpuemustats.errors },
1294 };
1295 1303
1296 if (!mips_debugfs_dir) 1304 if (!mips_debugfs_dir)
1297 return -ENODEV; 1305 return -ENODEV;
1298 dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir); 1306 dir = debugfs_create_dir("fpuemustats", mips_debugfs_dir);
1299 if (!dir) 1307 if (!dir)
1300 return -ENOMEM; 1308 return -ENOMEM;
1301 for (i = 0; i < ARRAY_SIZE(vars); i++) { 1309
1302 d = debugfs_create_u32(vars[i].name, S_IRUGO, dir, vars[i].v); 1310#define FPU_STAT_CREATE(M) \
1303 if (!d) 1311 do { \
1304 return -ENOMEM; 1312 d = debugfs_create_file(#M , S_IRUGO, dir, \
1305 } 1313 (void *)offsetof(struct mips_fpu_emulator_stats, M), \
1314 &fops_fpuemu_stat); \
1315 if (!d) \
1316 return -ENOMEM; \
1317 } while (0)
1318
1319 FPU_STAT_CREATE(emulated);
1320 FPU_STAT_CREATE(loads);
1321 FPU_STAT_CREATE(stores);
1322 FPU_STAT_CREATE(cp1ops);
1323 FPU_STAT_CREATE(cp1xops);
1324 FPU_STAT_CREATE(errors);
1325
1306 return 0; 1326 return 0;
1307} 1327}
1308__initcall(debugfs_fpuemu); 1328__initcall(debugfs_fpuemu);
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c
index df7b9d928efc..36d975ae08f8 100644
--- a/arch/mips/math-emu/dsemul.c
+++ b/arch/mips/math-emu/dsemul.c
@@ -98,7 +98,7 @@ int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc)
98 err |= __put_user(cpc, &fr->epc); 98 err |= __put_user(cpc, &fr->epc);
99 99
100 if (unlikely(err)) { 100 if (unlikely(err)) {
101 fpuemustats.errors++; 101 MIPS_FPU_EMU_INC_STATS(errors);
102 return SIGBUS; 102 return SIGBUS;
103 } 103 }
104 104
@@ -136,7 +136,7 @@ int do_dsemulret(struct pt_regs *xcp)
136 err |= __get_user(cookie, &fr->cookie); 136 err |= __get_user(cookie, &fr->cookie);
137 137
138 if (unlikely(err || (insn != BREAK_MATH) || (cookie != BD_COOKIE))) { 138 if (unlikely(err || (insn != BREAK_MATH) || (cookie != BD_COOKIE))) {
139 fpuemustats.errors++; 139 MIPS_FPU_EMU_INC_STATS(errors);
140 return 0; 140 return 0;
141 } 141 }
142 142
diff --git a/arch/mips/mipssim/Makefile b/arch/mips/mipssim/Makefile
index 57f43c1c7882..41b96571315e 100644
--- a/arch/mips/mipssim/Makefile
+++ b/arch/mips/mipssim/Makefile
@@ -17,8 +17,7 @@
17# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 17# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18# 18#
19 19
20obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o \ 20obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o
21 sim_cmdline.o
22 21
23obj-$(CONFIG_EARLY_PRINTK) += sim_console.o 22obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
24obj-$(CONFIG_MIPS_MT_SMTC) += sim_smtc.o 23obj-$(CONFIG_MIPS_MT_SMTC) += sim_smtc.o
diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c
index 2877675c5f0d..55f22a3afe61 100644
--- a/arch/mips/mipssim/sim_setup.c
+++ b/arch/mips/mipssim/sim_setup.c
@@ -49,9 +49,6 @@ void __init plat_mem_setup(void)
49 set_io_port_base(0xbfd00000); 49 set_io_port_base(0xbfd00000);
50 50
51 serial_init(); 51 serial_init();
52
53 pr_info("Linux started...\n");
54
55} 52}
56 53
57extern struct plat_smp_ops ssmtc_smp_ops; 54extern struct plat_smp_ops ssmtc_smp_ops;
@@ -60,8 +57,6 @@ void __init prom_init(void)
60{ 57{
61 set_io_port_base(0xbfd00000); 58 set_io_port_base(0xbfd00000);
62 59
63 pr_info("\nLINUX started...\n");
64 prom_init_cmdline();
65 prom_meminit(); 60 prom_meminit();
66 61
67#ifdef CONFIG_MIPS_MT_SMP 62#ifdef CONFIG_MIPS_MT_SMP
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index 1bd1f18ac23c..3571090ba178 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -567,13 +567,10 @@ static uint32_t extract_dc(unsigned short addr, int data)
567 datalo = ((unsigned long long)datalohi << 32) | datalolo; 567 datalo = ((unsigned long long)datalohi << 32) | datalolo;
568 ecc = dc_ecc(datalo); 568 ecc = dc_ecc(datalo);
569 if (ecc != datahi) { 569 if (ecc != datahi) {
570 int bits = 0; 570 int bits;
571 bad_ecc |= 1 << (3-offset); 571 bad_ecc |= 1 << (3-offset);
572 ecc ^= datahi; 572 ecc ^= datahi;
573 while (ecc) { 573 bits = hweight8(ecc);
574 if (ecc & 1) bits++;
575 ecc >>= 1;
576 }
577 res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE; 574 res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE;
578 } 575 }
579 printk(" %02X-%016llX", datahi, datalo); 576 printk(" %02X-%016llX", datahi, datalo);
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 8d1f4f363049..1651942f7feb 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -424,7 +424,7 @@ void __init mem_init(void)
424 reservedpages << (PAGE_SHIFT-10), 424 reservedpages << (PAGE_SHIFT-10),
425 datasize >> 10, 425 datasize >> 10,
426 initsize >> 10, 426 initsize >> 10,
427 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 427 totalhigh_pages << (PAGE_SHIFT-10));
428} 428}
429#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 429#endif /* !CONFIG_NEED_MULTIPLE_NODES */
430 430
@@ -462,7 +462,9 @@ void __init_refok free_initmem(void)
462 __pa_symbol(&__init_end)); 462 __pa_symbol(&__init_end));
463} 463}
464 464
465#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
465unsigned long pgd_current[NR_CPUS]; 466unsigned long pgd_current[NR_CPUS];
467#endif
466/* 468/*
467 * On 64-bit we've got three-level pagetables with a slightly 469 * On 64-bit we've got three-level pagetables with a slightly
468 * different layout ... 470 * different layout ...
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index bb1719a55d22..badcf5e8d695 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -73,9 +73,6 @@ static int __cpuinit m4kc_tlbp_war(void)
73enum label_id { 73enum label_id {
74 label_second_part = 1, 74 label_second_part = 1,
75 label_leave, 75 label_leave,
76#ifdef MODULE_START
77 label_module_alloc,
78#endif
79 label_vmalloc, 76 label_vmalloc,
80 label_vmalloc_done, 77 label_vmalloc_done,
81 label_tlbw_hazard, 78 label_tlbw_hazard,
@@ -92,9 +89,6 @@ enum label_id {
92 89
93UASM_L_LA(_second_part) 90UASM_L_LA(_second_part)
94UASM_L_LA(_leave) 91UASM_L_LA(_leave)
95#ifdef MODULE_START
96UASM_L_LA(_module_alloc)
97#endif
98UASM_L_LA(_vmalloc) 92UASM_L_LA(_vmalloc)
99UASM_L_LA(_vmalloc_done) 93UASM_L_LA(_vmalloc_done)
100UASM_L_LA(_tlbw_hazard) 94UASM_L_LA(_tlbw_hazard)
@@ -160,6 +154,12 @@ static u32 tlb_handler[128] __cpuinitdata;
160static struct uasm_label labels[128] __cpuinitdata; 154static struct uasm_label labels[128] __cpuinitdata;
161static struct uasm_reloc relocs[128] __cpuinitdata; 155static struct uasm_reloc relocs[128] __cpuinitdata;
162 156
157#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
158/*
159 * CONFIG_MIPS_PGD_C0_CONTEXT implies 64 bit and lack of pgd_current,
160 * we cannot do r3000 under these circumstances.
161 */
162
163/* 163/*
164 * The R3000 TLB handler is simple. 164 * The R3000 TLB handler is simple.
165 */ 165 */
@@ -199,6 +199,7 @@ static void __cpuinit build_r3000_tlb_refill_handler(void)
199 199
200 dump_handler((u32 *)ebase, 32); 200 dump_handler((u32 *)ebase, 32);
201} 201}
202#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
202 203
203/* 204/*
204 * The R4000 TLB handler is much more complicated. We have two 205 * The R4000 TLB handler is much more complicated. We have two
@@ -497,8 +498,9 @@ static void __cpuinit
497build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, 498build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
498 unsigned int tmp, unsigned int ptr) 499 unsigned int tmp, unsigned int ptr)
499{ 500{
501#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
500 long pgdc = (long)pgd_current; 502 long pgdc = (long)pgd_current;
501 503#endif
502 /* 504 /*
503 * The vmalloc handling is not in the hotpath. 505 * The vmalloc handling is not in the hotpath.
504 */ 506 */
@@ -506,7 +508,15 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
506 uasm_il_bltz(p, r, tmp, label_vmalloc); 508 uasm_il_bltz(p, r, tmp, label_vmalloc);
507 /* No uasm_i_nop needed here, since the next insn doesn't touch TMP. */ 509 /* No uasm_i_nop needed here, since the next insn doesn't touch TMP. */
508 510
509#ifdef CONFIG_SMP 511#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
512 /*
513 * &pgd << 11 stored in CONTEXT [23..63].
514 */
515 UASM_i_MFC0(p, ptr, C0_CONTEXT);
516 uasm_i_dins(p, ptr, 0, 0, 23); /* Clear lower 23 bits of context. */
517 uasm_i_ori(p, ptr, ptr, 0x540); /* 1 0 1 0 1 << 6 xkphys cached */
518 uasm_i_drotr(p, ptr, ptr, 11);
519#elif defined(CONFIG_SMP)
510# ifdef CONFIG_MIPS_MT_SMTC 520# ifdef CONFIG_MIPS_MT_SMTC
511 /* 521 /*
512 * SMTC uses TCBind value as "CPU" index 522 * SMTC uses TCBind value as "CPU" index
@@ -520,7 +530,7 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
520 */ 530 */
521 uasm_i_dmfc0(p, ptr, C0_CONTEXT); 531 uasm_i_dmfc0(p, ptr, C0_CONTEXT);
522 uasm_i_dsrl(p, ptr, ptr, 23); 532 uasm_i_dsrl(p, ptr, ptr, 23);
523#endif 533# endif
524 UASM_i_LA_mostly(p, tmp, pgdc); 534 UASM_i_LA_mostly(p, tmp, pgdc);
525 uasm_i_daddu(p, ptr, ptr, tmp); 535 uasm_i_daddu(p, ptr, ptr, tmp);
526 uasm_i_dmfc0(p, tmp, C0_BADVADDR); 536 uasm_i_dmfc0(p, tmp, C0_BADVADDR);
@@ -802,8 +812,6 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
802 } else { 812 } else {
803#if defined(CONFIG_HUGETLB_PAGE) 813#if defined(CONFIG_HUGETLB_PAGE)
804 const enum label_id ls = label_tlb_huge_update; 814 const enum label_id ls = label_tlb_huge_update;
805#elif defined(MODULE_START)
806 const enum label_id ls = label_module_alloc;
807#else 815#else
808 const enum label_id ls = label_vmalloc; 816 const enum label_id ls = label_vmalloc;
809#endif 817#endif
@@ -1033,6 +1041,7 @@ build_pte_modifiable(u32 **p, struct uasm_reloc **r,
1033 iPTE_LW(p, pte, ptr); 1041 iPTE_LW(p, pte, ptr);
1034} 1042}
1035 1043
1044#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
1036/* 1045/*
1037 * R3000 style TLB load/store/modify handlers. 1046 * R3000 style TLB load/store/modify handlers.
1038 */ 1047 */
@@ -1184,6 +1193,7 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1184 1193
1185 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm)); 1194 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm));
1186} 1195}
1196#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
1187 1197
1188/* 1198/*
1189 * R4000 style TLB load/store/modify handlers. 1199 * R4000 style TLB load/store/modify handlers.
@@ -1400,6 +1410,7 @@ void __cpuinit build_tlb_refill_handler(void)
1400 case CPU_TX3912: 1410 case CPU_TX3912:
1401 case CPU_TX3922: 1411 case CPU_TX3922:
1402 case CPU_TX3927: 1412 case CPU_TX3927:
1413#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
1403 build_r3000_tlb_refill_handler(); 1414 build_r3000_tlb_refill_handler();
1404 if (!run_once) { 1415 if (!run_once) {
1405 build_r3000_tlb_load_handler(); 1416 build_r3000_tlb_load_handler();
@@ -1407,6 +1418,9 @@ void __cpuinit build_tlb_refill_handler(void)
1407 build_r3000_tlb_modify_handler(); 1418 build_r3000_tlb_modify_handler();
1408 run_once++; 1419 run_once++;
1409 } 1420 }
1421#else
1422 panic("No R3000 TLB refill handler");
1423#endif
1410 break; 1424 break;
1411 1425
1412 case CPU_R6000: 1426 case CPU_R6000:
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index f467199676a8..0a165c5179a1 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -60,11 +60,11 @@ enum opcode {
60 insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, 60 insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl,
61 insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0, 61 insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0,
62 insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, 62 insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl,
63 insn_dsrl32, insn_dsubu, insn_eret, insn_j, insn_jal, insn_jr, 63 insn_dsrl32, insn_drotr, insn_dsubu, insn_eret, insn_j, insn_jal,
64 insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0, 64 insn_jr, insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0,
65 insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, 65 insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd,
66 insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw, 66 insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw,
67 insn_tlbp, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori 67 insn_tlbp, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, insn_dins
68}; 68};
69 69
70struct insn { 70struct insn {
@@ -104,6 +104,7 @@ static struct insn insn_table[] __cpuinitdata = {
104 { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE }, 104 { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE },
105 { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, 105 { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE },
106 { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, 106 { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE },
107 { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE },
107 { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, 108 { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD },
108 { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, 109 { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 },
109 { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, 110 { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM },
@@ -132,6 +133,7 @@ static struct insn insn_table[] __cpuinitdata = {
132 { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 }, 133 { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 },
133 { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, 134 { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD },
134 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 135 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
136 { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE },
135 { insn_invalid, 0, 0 } 137 { insn_invalid, 0, 0 }
136}; 138};
137 139
@@ -304,6 +306,12 @@ Ip_u2u1s3(op) \
304 build_insn(buf, insn##op, b, a, c); \ 306 build_insn(buf, insn##op, b, a, c); \
305} 307}
306 308
309#define I_u2u1msbu3(op) \
310Ip_u2u1msbu3(op) \
311{ \
312 build_insn(buf, insn##op, b, a, c+d-1, c); \
313}
314
307#define I_u1u2(op) \ 315#define I_u1u2(op) \
308Ip_u1u2(op) \ 316Ip_u1u2(op) \
309{ \ 317{ \
@@ -349,6 +357,7 @@ I_u2u1u3(_dsll32)
349I_u2u1u3(_dsra) 357I_u2u1u3(_dsra)
350I_u2u1u3(_dsrl) 358I_u2u1u3(_dsrl)
351I_u2u1u3(_dsrl32) 359I_u2u1u3(_dsrl32)
360I_u2u1u3(_drotr)
352I_u3u1u2(_dsubu) 361I_u3u1u2(_dsubu)
353I_0(_eret) 362I_0(_eret)
354I_u1(_j) 363I_u1(_j)
@@ -377,6 +386,7 @@ I_0(_tlbwi)
377I_0(_tlbwr) 386I_0(_tlbwr)
378I_u3u1u2(_xor) 387I_u3u1u2(_xor)
379I_u2u1u3(_xori) 388I_u2u1u3(_xori)
389I_u2u1msbu3(_dins);
380 390
381/* Handle labels. */ 391/* Handle labels. */
382void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) 392void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
diff --git a/arch/mips/mm/uasm.h b/arch/mips/mm/uasm.h
index c6d1e3dd82d4..3d153edaa51e 100644
--- a/arch/mips/mm/uasm.h
+++ b/arch/mips/mm/uasm.h
@@ -34,6 +34,11 @@ uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c)
34void __cpuinit \ 34void __cpuinit \
35uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 35uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
36 36
37#define Ip_u2u1msbu3(op) \
38void __cpuinit \
39uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
40 unsigned int d)
41
37#define Ip_u1u2(op) \ 42#define Ip_u1u2(op) \
38void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) 43void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
39 44
@@ -65,6 +70,7 @@ Ip_u2u1u3(_dsll32);
65Ip_u2u1u3(_dsra); 70Ip_u2u1u3(_dsra);
66Ip_u2u1u3(_dsrl); 71Ip_u2u1u3(_dsrl);
67Ip_u2u1u3(_dsrl32); 72Ip_u2u1u3(_dsrl32);
73Ip_u2u1u3(_drotr);
68Ip_u3u1u2(_dsubu); 74Ip_u3u1u2(_dsubu);
69Ip_0(_eret); 75Ip_0(_eret);
70Ip_u1(_j); 76Ip_u1(_j);
@@ -93,6 +99,7 @@ Ip_0(_tlbwi);
93Ip_0(_tlbwr); 99Ip_0(_tlbwr);
94Ip_u3u1u2(_xor); 100Ip_u3u1u2(_xor);
95Ip_u2u1u3(_xori); 101Ip_u2u1u3(_xori);
102Ip_u2u1msbu3(_dins);
96 103
97/* Handle labels. */ 104/* Handle labels. */
98struct uasm_label { 105struct uasm_label {
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index f1b14c8a4a1c..414f0c99b196 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -355,7 +355,6 @@ void __init prom_init(void)
355 board_nmi_handler_setup = mips_nmi_setup; 355 board_nmi_handler_setup = mips_nmi_setup;
356 board_ejtag_handler_setup = mips_ejtag_setup; 356 board_ejtag_handler_setup = mips_ejtag_setup;
357 357
358 pr_info("\nLINUX started...\n");
359 prom_init_cmdline(); 358 prom_init_cmdline();
360 prom_meminit(); 359 prom_meminit();
361#ifdef CONFIG_SERIAL_8250_CONSOLE 360#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 9035c64bc5ed..b27419c84919 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -55,7 +55,7 @@ static struct prom_pmemblock * __init prom_getmdesc(void)
55 char *memsize_str; 55 char *memsize_str;
56 unsigned int memsize; 56 unsigned int memsize;
57 char *ptr; 57 char *ptr;
58 static char cmdline[CL_SIZE] __initdata; 58 static char cmdline[COMMAND_LINE_SIZE] __initdata;
59 59
60 /* otherwise look in the environment */ 60 /* otherwise look in the environment */
61 memsize_str = prom_getenv("memsize"); 61 memsize_str = prom_getenv("memsize");
diff --git a/arch/mips/nxp/pnx833x/common/interrupts.c b/arch/mips/nxp/pnx833x/common/interrupts.c
index 30533ba200e2..3a467c04f811 100644
--- a/arch/mips/nxp/pnx833x/common/interrupts.c
+++ b/arch/mips/nxp/pnx833x/common/interrupts.c
@@ -295,7 +295,7 @@ static int pnx833x_set_type_gpio_irq(unsigned int irq, unsigned int flow_type)
295} 295}
296 296
297static struct irq_chip pnx833x_pic_irq_type = { 297static struct irq_chip pnx833x_pic_irq_type = {
298 .typename = "PNX-PIC", 298 .name = "PNX-PIC",
299 .startup = pnx833x_startup_pic_irq, 299 .startup = pnx833x_startup_pic_irq,
300 .shutdown = pnx833x_shutdown_pic_irq, 300 .shutdown = pnx833x_shutdown_pic_irq,
301 .enable = pnx833x_enable_pic_irq, 301 .enable = pnx833x_enable_pic_irq,
@@ -305,7 +305,7 @@ static struct irq_chip pnx833x_pic_irq_type = {
305}; 305};
306 306
307static struct irq_chip pnx833x_gpio_irq_type = { 307static struct irq_chip pnx833x_gpio_irq_type = {
308 .typename = "PNX-GPIO", 308 .name = "PNX-GPIO",
309 .startup = pnx833x_startup_gpio_irq, 309 .startup = pnx833x_startup_gpio_irq,
310 .shutdown = pnx833x_disable_gpio_irq, 310 .shutdown = pnx833x_disable_gpio_irq,
311 .enable = pnx833x_enable_gpio_irq, 311 .enable = pnx833x_enable_gpio_irq,
diff --git a/arch/mips/oprofile/op_model_loongson2.c b/arch/mips/oprofile/op_model_loongson2.c
index 575cd1473475..475ff46712ab 100644
--- a/arch/mips/oprofile/op_model_loongson2.c
+++ b/arch/mips/oprofile/op_model_loongson2.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Loongson2 performance counter driver for oprofile 2 * Loongson2 performance counter driver for oprofile
3 * 3 *
4 * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology 4 * Copyright (C) 2009 Lemote Inc.
5 * Author: Yanhua <yanh@lemote.com> 5 * Author: Yanhua <yanh@lemote.com>
6 * Author: Wu Zhangjin <wuzj@lemote.com> 6 * Author: Wu Zhangjin <wuzj@lemote.com>
7 * 7 *
@@ -125,6 +125,9 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
125 */ 125 */
126 126
127 /* Check whether the irq belongs to me */ 127 /* Check whether the irq belongs to me */
128 enabled = read_c0_perfcnt() & LOONGSON2_PERFCNT_INT_EN;
129 if (!enabled)
130 return IRQ_NONE;
128 enabled = reg.cnt1_enabled | reg.cnt2_enabled; 131 enabled = reg.cnt1_enabled | reg.cnt2_enabled;
129 if (!enabled) 132 if (!enabled)
130 return IRQ_NONE; 133 return IRQ_NONE;
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 91bfe73a7f60..c9209ca6c8e7 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -22,13 +22,13 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \
22# 22#
23# These are still pretty much in the old state, watch, go blind. 23# These are still pretty much in the old state, watch, go blind.
24# 24#
25obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o
26obj-$(CONFIG_LASAT) += pci-lasat.o 25obj-$(CONFIG_LASAT) += pci-lasat.o
27obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o 26obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
28obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o 27obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o
29obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o 28obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o
30obj-$(CONFIG_SOC_PNX8550) += fixup-pnx8550.o ops-pnx8550.o 29obj-$(CONFIG_SOC_PNX8550) += fixup-pnx8550.o ops-pnx8550.o
31obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-bonito64.o 30obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o
31obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o ops-loongson2.o
32obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o 32obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o
33obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o 33obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o
34obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o 34obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
diff --git a/arch/mips/pci/fixup-excite.c b/arch/mips/pci/fixup-excite.c
deleted file mode 100644
index cd64d9f177c4..000000000000
--- a/arch/mips/pci/fixup-excite.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/pci.h>
22#include <excite.h>
23
24int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
25{
26 if (pin == 0)
27 return -1;
28
29 return USB_IRQ; /* USB controller is the only PCI device */
30}
31
32/* Do platform specific device initialization at pci_enable_device() time */
33int pcibios_plat_dev_init(struct pci_dev *dev)
34{
35 return 0;
36}
diff --git a/arch/mips/pci/fixup-fuloong2e.c b/arch/mips/pci/fixup-fuloong2e.c
index 0c4c7a81213f..4f6d8da07f93 100644
--- a/arch/mips/pci/fixup-fuloong2e.c
+++ b/arch/mips/pci/fixup-fuloong2e.c
@@ -13,7 +13,8 @@
13 */ 13 */
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <asm/mips-boards/bonito64.h> 16
17#include <loongson.h>
17 18
18/* South bridge slot number is set by the pci probe process */ 19/* South bridge slot number is set by the pci probe process */
19static u8 sb_slot = 5; 20static u8 sb_slot = 5;
@@ -35,7 +36,7 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
35 break; 36 break;
36 } 37 }
37 } else { 38 } else {
38 irq = BONITO_IRQ_BASE + 25 + pin; 39 irq = LOONGSON_IRQ_BASE + 25 + pin;
39 } 40 }
40 return irq; 41 return irq;
41 42
diff --git a/arch/mips/pci/fixup-lemote2f.c b/arch/mips/pci/fixup-lemote2f.c
new file mode 100644
index 000000000000..caf2edeb02f0
--- /dev/null
+++ b/arch/mips/pci/fixup-lemote2f.c
@@ -0,0 +1,160 @@
1/*
2 * Copyright (C) 2008 Lemote Technology
3 * Copyright (C) 2004 ICT CAS
4 * Author: Li xiaoyu, lixy@ict.ac.cn
5 *
6 * Copyright (C) 2007 Lemote, Inc.
7 * Author: Fuxin Zhang, zhangfx@lemote.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#include <linux/init.h>
15#include <linux/pci.h>
16
17#include <loongson.h>
18#include <cs5536/cs5536.h>
19#include <cs5536/cs5536_pci.h>
20
21/* PCI interrupt pins
22 *
23 * These should not be changed, or you should consider loongson2f interrupt
24 * register and your pci card dispatch
25 */
26
27#define PCIA 4
28#define PCIB 5
29#define PCIC 6
30#define PCID 7
31
32/* all the pci device has the PCIA pin, check the datasheet. */
33static char irq_tab[][5] __initdata = {
34 /* INTA INTB INTC INTD */
35 {0, 0, 0, 0, 0}, /* 11: Unused */
36 {0, 0, 0, 0, 0}, /* 12: Unused */
37 {0, 0, 0, 0, 0}, /* 13: Unused */
38 {0, 0, 0, 0, 0}, /* 14: Unused */
39 {0, 0, 0, 0, 0}, /* 15: Unused */
40 {0, 0, 0, 0, 0}, /* 16: Unused */
41 {0, PCIA, 0, 0, 0}, /* 17: RTL8110-0 */
42 {0, PCIB, 0, 0, 0}, /* 18: RTL8110-1 */
43 {0, PCIC, 0, 0, 0}, /* 19: SiI3114 */
44 {0, PCID, 0, 0, 0}, /* 20: 3-ports nec usb */
45 {0, PCIA, PCIB, PCIC, PCID}, /* 21: PCI-SLOT */
46 {0, 0, 0, 0, 0}, /* 22: Unused */
47 {0, 0, 0, 0, 0}, /* 23: Unused */
48 {0, 0, 0, 0, 0}, /* 24: Unused */
49 {0, 0, 0, 0, 0}, /* 25: Unused */
50 {0, 0, 0, 0, 0}, /* 26: Unused */
51 {0, 0, 0, 0, 0}, /* 27: Unused */
52};
53
54int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
55{
56 int virq;
57
58 if ((PCI_SLOT(dev->devfn) != PCI_IDSEL_CS5536)
59 && (PCI_SLOT(dev->devfn) < 32)) {
60 virq = irq_tab[slot][pin];
61 printk(KERN_INFO "slot: %d, pin: %d, irq: %d\n", slot, pin,
62 virq + LOONGSON_IRQ_BASE);
63 if (virq != 0)
64 return LOONGSON_IRQ_BASE + virq;
65 else
66 return 0;
67 } else if (PCI_SLOT(dev->devfn) == PCI_IDSEL_CS5536) { /* cs5536 */
68 switch (PCI_FUNC(dev->devfn)) {
69 case 2:
70 pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
71 CS5536_IDE_INTR);
72 return CS5536_IDE_INTR; /* for IDE */
73 case 3:
74 pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
75 CS5536_ACC_INTR);
76 return CS5536_ACC_INTR; /* for AUDIO */
77 case 4: /* for OHCI */
78 case 5: /* for EHCI */
79 case 6: /* for UDC */
80 case 7: /* for OTG */
81 pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
82 CS5536_USB_INTR);
83 return CS5536_USB_INTR;
84 }
85 return dev->irq;
86 } else {
87 printk(KERN_INFO " strange pci slot number.\n");
88 return 0;
89 }
90}
91
92/* Do platform specific device initialization at pci_enable_device() time */
93int pcibios_plat_dev_init(struct pci_dev *dev)
94{
95 return 0;
96}
97
98/* CS5536 SPEC. fixup */
99static void __init loongson_cs5536_isa_fixup(struct pci_dev *pdev)
100{
101 /* the uart1 and uart2 interrupt in PIC is enabled as default */
102 pci_write_config_dword(pdev, PCI_UART1_INT_REG, 1);
103 pci_write_config_dword(pdev, PCI_UART2_INT_REG, 1);
104}
105
106static void __init loongson_cs5536_ide_fixup(struct pci_dev *pdev)
107{
108 /* setting the mutex pin as IDE function */
109 pci_write_config_dword(pdev, PCI_IDE_CFG_REG,
110 CS5536_IDE_FLASH_SIGNATURE);
111}
112
113static void __init loongson_cs5536_acc_fixup(struct pci_dev *pdev)
114{
115 /* enable the AUDIO interrupt in PIC */
116 pci_write_config_dword(pdev, PCI_ACC_INT_REG, 1);
117
118 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xc0);
119}
120
121static void __init loongson_cs5536_ohci_fixup(struct pci_dev *pdev)
122{
123 /* enable the OHCI interrupt in PIC */
124 /* THE OHCI, EHCI, UDC, OTG are shared with interrupt in PIC */
125 pci_write_config_dword(pdev, PCI_OHCI_INT_REG, 1);
126}
127
128static void __init loongson_cs5536_ehci_fixup(struct pci_dev *pdev)
129{
130 u32 hi, lo;
131
132 /* Serial short detect enable */
133 _rdmsr(USB_MSR_REG(USB_CONFIG), &hi, &lo);
134 _wrmsr(USB_MSR_REG(USB_CONFIG), (1 << 1) | (1 << 2) | (1 << 3), lo);
135
136 /* setting the USB2.0 micro frame length */
137 pci_write_config_dword(pdev, PCI_EHCI_FLADJ_REG, 0x2000);
138}
139
140static void __init loongson_nec_fixup(struct pci_dev *pdev)
141{
142 unsigned int val;
143
144 pci_read_config_dword(pdev, 0xe0, &val);
145 /* Only 2 port be used */
146 pci_write_config_dword(pdev, 0xe0, (val & ~3) | 0x2);
147}
148
149DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA,
150 loongson_cs5536_isa_fixup);
151DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_OHC,
152 loongson_cs5536_ohci_fixup);
153DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_EHC,
154 loongson_cs5536_ehci_fixup);
155DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_AUDIO,
156 loongson_cs5536_acc_fixup);
157DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE,
158 loongson_cs5536_ide_fixup);
159DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
160 loongson_nec_fixup);
diff --git a/arch/mips/pci/ops-bonito64.c b/arch/mips/pci/ops-bonito64.c
index 54e55e7a2431..1b3e03f20c54 100644
--- a/arch/mips/pci/ops-bonito64.c
+++ b/arch/mips/pci/ops-bonito64.c
@@ -29,13 +29,8 @@
29#define PCI_ACCESS_READ 0 29#define PCI_ACCESS_READ 0
30#define PCI_ACCESS_WRITE 1 30#define PCI_ACCESS_WRITE 1
31 31
32#ifdef CONFIG_LEMOTE_FULOONG2E
33#define CFG_SPACE_REG(offset) (void *)CKSEG1ADDR(BONITO_PCICFG_BASE | (offset))
34#define ID_SEL_BEGIN 11
35#else
36#define CFG_SPACE_REG(offset) (void *)CKSEG1ADDR(_pcictrl_bonito_pcicfg + (offset)) 32#define CFG_SPACE_REG(offset) (void *)CKSEG1ADDR(_pcictrl_bonito_pcicfg + (offset))
37#define ID_SEL_BEGIN 10 33#define ID_SEL_BEGIN 10
38#endif
39#define MAX_DEV_NUM (31 - ID_SEL_BEGIN) 34#define MAX_DEV_NUM (31 - ID_SEL_BEGIN)
40 35
41 36
@@ -77,10 +72,8 @@ static int bonito64_pcibios_config_access(unsigned char access_type,
77 addrp = CFG_SPACE_REG(addr & 0xffff); 72 addrp = CFG_SPACE_REG(addr & 0xffff);
78 if (access_type == PCI_ACCESS_WRITE) { 73 if (access_type == PCI_ACCESS_WRITE) {
79 writel(cpu_to_le32(*data), addrp); 74 writel(cpu_to_le32(*data), addrp);
80#ifndef CONFIG_LEMOTE_FULOONG2E
81 /* Wait till done */ 75 /* Wait till done */
82 while (BONITO_PCIMSTAT & 0xF); 76 while (BONITO_PCIMSTAT & 0xF);
83#endif
84 } else { 77 } else {
85 *data = le32_to_cpu(readl(addrp)); 78 *data = le32_to_cpu(readl(addrp));
86 } 79 }
diff --git a/arch/mips/pci/ops-loongson2.c b/arch/mips/pci/ops-loongson2.c
new file mode 100644
index 000000000000..aa5d3da27212
--- /dev/null
+++ b/arch/mips/pci/ops-loongson2.c
@@ -0,0 +1,208 @@
1/*
2 * fuloong2e specific PCI support.
3 *
4 * Copyright (C) 1999, 2000, 2004 MIPS Technologies, Inc.
5 * All rights reserved.
6 * Authors: Carsten Langgaard <carstenl@mips.com>
7 * Maciej W. Rozycki <macro@mips.com>
8 *
9 * Copyright (C) 2009 Lemote Inc.
10 * Author: Wu Zhangjin <wuzj@lemote.com>
11 *
12 * This program is free software; you can distribute it and/or modify it
13 * under the terms of the GNU General Public License (Version 2) as
14 * published by the Free Software Foundation.
15 */
16#include <linux/types.h>
17#include <linux/pci.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20
21#include <loongson.h>
22
23#ifdef CONFIG_CS5536
24#include <cs5536/cs5536_pci.h>
25#include <cs5536/cs5536.h>
26#endif
27
28#define PCI_ACCESS_READ 0
29#define PCI_ACCESS_WRITE 1
30
31#define CFG_SPACE_REG(offset) \
32 (void *)CKSEG1ADDR(LOONGSON_PCICFG_BASE | (offset))
33#define ID_SEL_BEGIN 11
34#define MAX_DEV_NUM (31 - ID_SEL_BEGIN)
35
36
37static int loongson_pcibios_config_access(unsigned char access_type,
38 struct pci_bus *bus,
39 unsigned int devfn, int where,
40 u32 *data)
41{
42 u32 busnum = bus->number;
43 u32 addr, type;
44 u32 dummy;
45 void *addrp;
46 int device = PCI_SLOT(devfn);
47 int function = PCI_FUNC(devfn);
48 int reg = where & ~3;
49
50 if (busnum == 0) {
51 /* board-specific part,currently,only fuloong2f,yeeloong2f
52 * use CS5536, fuloong2e use via686b, gdium has no
53 * south bridge
54 */
55#ifdef CONFIG_CS5536
56 /* cs5536_pci_conf_read4/write4() will call _rdmsr/_wrmsr() to
57 * access the regsters PCI_MSR_ADDR, PCI_MSR_DATA_LO,
58 * PCI_MSR_DATA_HI, which is bigger than PCI_MSR_CTRL, so, it
59 * will not go this branch, but the others. so, no calling dead
60 * loop here.
61 */
62 if ((PCI_IDSEL_CS5536 == device) && (reg < PCI_MSR_CTRL)) {
63 switch (access_type) {
64 case PCI_ACCESS_READ:
65 *data = cs5536_pci_conf_read4(function, reg);
66 break;
67 case PCI_ACCESS_WRITE:
68 cs5536_pci_conf_write4(function, reg, *data);
69 break;
70 }
71 return 0;
72 }
73#endif
74 /* Type 0 configuration for onboard PCI bus */
75 if (device > MAX_DEV_NUM)
76 return -1;
77
78 addr = (1 << (device + ID_SEL_BEGIN)) | (function << 8) | reg;
79 type = 0;
80 } else {
81 /* Type 1 configuration for offboard PCI bus */
82 addr = (busnum << 16) | (device << 11) | (function << 8) | reg;
83 type = 0x10000;
84 }
85
86 /* Clear aborts */
87 LOONGSON_PCICMD |= LOONGSON_PCICMD_MABORT_CLR | \
88 LOONGSON_PCICMD_MTABORT_CLR;
89
90 LOONGSON_PCIMAP_CFG = (addr >> 16) | type;
91
92 /* Flush Bonito register block */
93 dummy = LOONGSON_PCIMAP_CFG;
94 mmiowb();
95
96 addrp = CFG_SPACE_REG(addr & 0xffff);
97 if (access_type == PCI_ACCESS_WRITE)
98 writel(cpu_to_le32(*data), addrp);
99 else
100 *data = le32_to_cpu(readl(addrp));
101
102 /* Detect Master/Target abort */
103 if (LOONGSON_PCICMD & (LOONGSON_PCICMD_MABORT_CLR |
104 LOONGSON_PCICMD_MTABORT_CLR)) {
105 /* Error occurred */
106
107 /* Clear bits */
108 LOONGSON_PCICMD |= (LOONGSON_PCICMD_MABORT_CLR |
109 LOONGSON_PCICMD_MTABORT_CLR);
110
111 return -1;
112 }
113
114 return 0;
115
116}
117
118
119/*
120 * We can't address 8 and 16 bit words directly. Instead we have to
121 * read/write a 32bit word and mask/modify the data we actually want.
122 */
123static int loongson_pcibios_read(struct pci_bus *bus, unsigned int devfn,
124 int where, int size, u32 *val)
125{
126 u32 data = 0;
127
128 if ((size == 2) && (where & 1))
129 return PCIBIOS_BAD_REGISTER_NUMBER;
130 else if ((size == 4) && (where & 3))
131 return PCIBIOS_BAD_REGISTER_NUMBER;
132
133 if (loongson_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
134 &data))
135 return -1;
136
137 if (size == 1)
138 *val = (data >> ((where & 3) << 3)) & 0xff;
139 else if (size == 2)
140 *val = (data >> ((where & 3) << 3)) & 0xffff;
141 else
142 *val = data;
143
144 return PCIBIOS_SUCCESSFUL;
145}
146
147static int loongson_pcibios_write(struct pci_bus *bus, unsigned int devfn,
148 int where, int size, u32 val)
149{
150 u32 data = 0;
151
152 if ((size == 2) && (where & 1))
153 return PCIBIOS_BAD_REGISTER_NUMBER;
154 else if ((size == 4) && (where & 3))
155 return PCIBIOS_BAD_REGISTER_NUMBER;
156
157 if (size == 4)
158 data = val;
159 else {
160 if (loongson_pcibios_config_access(PCI_ACCESS_READ, bus, devfn,
161 where, &data))
162 return -1;
163
164 if (size == 1)
165 data = (data & ~(0xff << ((where & 3) << 3))) |
166 (val << ((where & 3) << 3));
167 else if (size == 2)
168 data = (data & ~(0xffff << ((where & 3) << 3))) |
169 (val << ((where & 3) << 3));
170 }
171
172 if (loongson_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where,
173 &data))
174 return -1;
175
176 return PCIBIOS_SUCCESSFUL;
177}
178
179struct pci_ops loongson_pci_ops = {
180 .read = loongson_pcibios_read,
181 .write = loongson_pcibios_write
182};
183
184#ifdef CONFIG_CS5536
185void _rdmsr(u32 msr, u32 *hi, u32 *lo)
186{
187 struct pci_bus bus = {
188 .number = PCI_BUS_CS5536
189 };
190 u32 devfn = PCI_DEVFN(PCI_IDSEL_CS5536, 0);
191 loongson_pcibios_write(&bus, devfn, PCI_MSR_ADDR, 4, msr);
192 loongson_pcibios_read(&bus, devfn, PCI_MSR_DATA_LO, 4, lo);
193 loongson_pcibios_read(&bus, devfn, PCI_MSR_DATA_HI, 4, hi);
194}
195EXPORT_SYMBOL(_rdmsr);
196
197void _wrmsr(u32 msr, u32 hi, u32 lo)
198{
199 struct pci_bus bus = {
200 .number = PCI_BUS_CS5536
201 };
202 u32 devfn = PCI_DEVFN(PCI_IDSEL_CS5536, 0);
203 loongson_pcibios_write(&bus, devfn, PCI_MSR_ADDR, 4, msr);
204 loongson_pcibios_write(&bus, devfn, PCI_MSR_DATA_LO, 4, lo);
205 loongson_pcibios_write(&bus, devfn, PCI_MSR_DATA_HI, 4, hi);
206}
207EXPORT_SYMBOL(_wrmsr);
208#endif
diff --git a/arch/mips/pci/pci-excite.c b/arch/mips/pci/pci-excite.c
deleted file mode 100644
index 8a56876afcc6..000000000000
--- a/arch/mips/pci/pci-excite.c
+++ /dev/null
@@ -1,149 +0,0 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 * Based on the PMC-Sierra Yosemite board support by Ralf Baechle.
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/init.h>
21#include <linux/kernel.h>
22#include <linux/types.h>
23#include <linux/pci.h>
24#include <linux/bitops.h>
25#include <asm/rm9k-ocd.h>
26#include <excite.h>
27
28
29extern struct pci_ops titan_pci_ops;
30
31
32static struct resource
33 mem_resource = {
34 .name = "PCI memory",
35 .start = EXCITE_PHYS_PCI_MEM,
36 .end = EXCITE_PHYS_PCI_MEM + EXCITE_SIZE_PCI_MEM - 1,
37 .flags = IORESOURCE_MEM
38 },
39 io_resource = {
40 .name = "PCI I/O",
41 .start = EXCITE_PHYS_PCI_IO,
42 .end = EXCITE_PHYS_PCI_IO + EXCITE_SIZE_PCI_IO - 1,
43 .flags = IORESOURCE_IO
44 };
45
46
47static struct pci_controller bx_controller = {
48 .pci_ops = &titan_pci_ops,
49 .mem_resource = &mem_resource,
50 .mem_offset = 0x00000000UL,
51 .io_resource = &io_resource,
52 .io_offset = 0x00000000UL
53};
54
55
56static char
57 iopage_failed[] __initdata = "Cannot allocate PCI I/O page",
58 modebits_no_pci[] __initdata = "PCI is not configured in mode bits";
59
60#define RM9000x2_OCD_HTSC 0x0604
61#define RM9000x2_OCD_HTBHL 0x060c
62#define RM9000x2_OCD_PCIHRST 0x078c
63
64#define RM9K_OCD_MODEBIT1 0x00d4 /* (MODEBIT1) Mode Bit 1 */
65#define RM9K_OCD_CPHDCR 0x00f4 /* CPU-PCI/HT Data Control. */
66
67#define PCISC_FB2B 0x00000200
68#define PCISC_MWICG 0x00000010
69#define PCISC_EMC 0x00000004
70#define PCISC_ERMA 0x00000002
71
72
73
74static int __init basler_excite_pci_setup(void)
75{
76 const unsigned int fullbars = memsize / (256 << 20);
77 unsigned int i;
78
79 /* Check modebits to see if PCI is really enabled. */
80 if (!((ocd_readl(RM9K_OCD_MODEBIT1) >> (47-32)) & 0x1))
81 panic(modebits_no_pci);
82
83 if (NULL == request_mem_region(EXCITE_PHYS_PCI_IO, EXCITE_SIZE_PCI_IO,
84 "Memory-mapped PCI I/O page"))
85 panic(iopage_failed);
86
87 /* Enable PCI 0 as master for config cycles */
88 ocd_writel(PCISC_EMC | PCISC_ERMA, RM9000x2_OCD_HTSC);
89
90
91 /* Set up latency timer */
92 ocd_writel(0x8008, RM9000x2_OCD_HTBHL);
93
94 /* Setup host IO and Memory space */
95 ocd_writel((EXCITE_PHYS_PCI_IO >> 4) | 1, LKB7);
96 ocd_writel(((EXCITE_SIZE_PCI_IO >> 4) & 0x7fffff00) - 0x100, LKM7);
97 ocd_writel((EXCITE_PHYS_PCI_MEM >> 4) | 1, LKB8);
98 ocd_writel(((EXCITE_SIZE_PCI_MEM >> 4) & 0x7fffff00) - 0x100, LKM8);
99
100 /* Set up PCI BARs to map all installed memory */
101 for (i = 0; i < 6; i++) {
102 const unsigned int bar = 0x610 + i * 4;
103
104 if (i < fullbars) {
105 ocd_writel(0x10000000 * i, bar);
106 ocd_writel(0x01000000 * i, bar + 0x140);
107 ocd_writel(0x0ffff029, bar + 0x100);
108 continue;
109 }
110
111 if (i == fullbars) {
112 int o;
113 u32 mask;
114
115 const unsigned long rem = memsize - i * 0x10000000;
116 if (!rem) {
117 ocd_writel(0x00000000, bar + 0x100);
118 continue;
119 }
120
121 o = ffs(rem) - 1;
122 if (rem & ~(0x1 << o))
123 o++;
124 mask = ((0x1 << o) & 0x0ffff000) - 0x1000;
125 ocd_writel(0x10000000 * i, bar);
126 ocd_writel(0x01000000 * i, bar + 0x140);
127 ocd_writel(0x00000029 | mask, bar + 0x100);
128 continue;
129 }
130
131 ocd_writel(0x00000000, bar + 0x100);
132 }
133
134 /* Finally, enable the PCI interrupt */
135#if USB_IRQ > 7
136 set_c0_intcontrol(1 << USB_IRQ);
137#else
138 set_c0_status(1 << (USB_IRQ + 8));
139#endif
140
141 ioport_resource.start = EXCITE_PHYS_PCI_IO;
142 ioport_resource.end = EXCITE_PHYS_PCI_IO + EXCITE_SIZE_PCI_IO - 1;
143 set_io_port_base((unsigned long) ioremap_nocache(EXCITE_PHYS_PCI_IO, EXCITE_SIZE_PCI_IO));
144 register_pci_controller(&bx_controller);
145 return 0;
146}
147
148
149arch_initcall(basler_excite_pci_setup);
diff --git a/arch/mips/powertv/Kconfig b/arch/mips/powertv/Kconfig
new file mode 100644
index 000000000000..ff0e7e3e6954
--- /dev/null
+++ b/arch/mips/powertv/Kconfig
@@ -0,0 +1,21 @@
1source "arch/mips/powertv/asic/Kconfig"
2
3config BOOTLOADER_DRIVER
4 bool "PowerTV Bootloader Driver Support"
5 default n
6 depends on POWERTV
7 help
8 Use this option if you want to load bootloader driver.
9
10config BOOTLOADER_FAMILY
11 string "POWERTV Bootloader Family string"
12 default "85"
13 depends on POWERTV && !BOOTLOADER_DRIVER
14 help
15 This value should be specified when the bootloader driver is disabled
16 and must be exactly two characters long. Families supported are:
17 R1 - RNG-100 R2 - RNG-200
18 A1 - Class A B1 - Class B
19 E1 - Class E F1 - Class F
20 44 - 45xx 46 - 46xx
21 85 - 85xx 86 - 86xx
diff --git a/arch/mips/powertv/Makefile b/arch/mips/powertv/Makefile
new file mode 100644
index 000000000000..0a0d73c0564f
--- /dev/null
+++ b/arch/mips/powertv/Makefile
@@ -0,0 +1,28 @@
1#
2# Carsten Langgaard, carstenl@mips.com
3# Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4#
5# Carsten Langgaard, carstenl@mips.com
6# Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
7# Portions copyright (C) 2009 Cisco Systems, Inc.
8#
9# This program is free software; you can distribute it and/or modify it
10# under the terms of the GNU General Public License (Version 2) as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope it will be useful, but WITHOUT
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16# for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21#
22# Makefile for the Cisco PowerTV-specific kernel interface routines
23# under Linux.
24#
25
26obj-y += init.o memory.o reset.o time.o powertv_setup.o asic/ pci/
27
28EXTRA_CFLAGS += -Wall -Werror
diff --git a/arch/mips/powertv/asic/Kconfig b/arch/mips/powertv/asic/Kconfig
new file mode 100644
index 000000000000..2016bfe94d66
--- /dev/null
+++ b/arch/mips/powertv/asic/Kconfig
@@ -0,0 +1,28 @@
1config MIN_RUNTIME_RESOURCES
2 bool "Support for minimum runtime resources"
3 default n
4 depends on POWERTV
5 help
6 Enables support for minimizing the number of (SA asic) runtime
7 resources that are preallocated by the kernel.
8
9config MIN_RUNTIME_DOCSIS
10 bool "Support for minimum DOCSIS resource"
11 default y
12 depends on MIN_RUNTIME_RESOURCES
13 help
14 Enables support for the preallocated DOCSIS resource.
15
16config MIN_RUNTIME_PMEM
17 bool "Support for minimum PMEM resource"
18 default y
19 depends on MIN_RUNTIME_RESOURCES
20 help
21 Enables support for the preallocated Memory resource.
22
23config MIN_RUNTIME_TFTP
24 bool "Support for minimum TFTP resource"
25 default y
26 depends on MIN_RUNTIME_RESOURCES
27 help
28 Enables support for the preallocated TFTP resource.
diff --git a/arch/mips/powertv/asic/Makefile b/arch/mips/powertv/asic/Makefile
new file mode 100644
index 000000000000..bebfdcff0443
--- /dev/null
+++ b/arch/mips/powertv/asic/Makefile
@@ -0,0 +1,23 @@
1#
2# Copyright (C) 2009 Scientific-Atlanta, Inc.
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19obj-y += asic-calliope.o asic-cronus.o asic-zeus.o asic_devices.o asic_int.o \
20 irq_asic.o prealloc-calliope.o prealloc-cronus.o \
21 prealloc-cronuslite.o prealloc-zeus.o
22
23EXTRA_CFLAGS += -Wall -Werror
diff --git a/arch/mips/powertv/asic/asic-calliope.c b/arch/mips/powertv/asic/asic-calliope.c
new file mode 100644
index 000000000000..03d3884c6270
--- /dev/null
+++ b/arch/mips/powertv/asic/asic-calliope.c
@@ -0,0 +1,98 @@
1/*
2 * Locations of devices in the Calliope ASIC.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 *
23 * Description: Defines the platform resources for the SA settop.
24 */
25
26#include <asm/mach-powertv/asic.h>
27
28const struct register_map calliope_register_map = {
29 .eic_slow0_strt_add = 0x800000,
30 .eic_cfg_bits = 0x800038,
31 .eic_ready_status = 0x80004c,
32
33 .chipver3 = 0xA00800,
34 .chipver2 = 0xA00804,
35 .chipver1 = 0xA00808,
36 .chipver0 = 0xA0080c,
37
38 /* The registers of IRBlaster */
39 .uart1_intstat = 0xA01800,
40 .uart1_inten = 0xA01804,
41 .uart1_config1 = 0xA01808,
42 .uart1_config2 = 0xA0180C,
43 .uart1_divisorhi = 0xA01810,
44 .uart1_divisorlo = 0xA01814,
45 .uart1_data = 0xA01818,
46 .uart1_status = 0xA0181C,
47
48 .int_stat_3 = 0xA02800,
49 .int_stat_2 = 0xA02804,
50 .int_stat_1 = 0xA02808,
51 .int_stat_0 = 0xA0280c,
52 .int_config = 0xA02810,
53 .int_int_scan = 0xA02818,
54 .ien_int_3 = 0xA02830,
55 .ien_int_2 = 0xA02834,
56 .ien_int_1 = 0xA02838,
57 .ien_int_0 = 0xA0283c,
58 .int_level_3_3 = 0xA02880,
59 .int_level_3_2 = 0xA02884,
60 .int_level_3_1 = 0xA02888,
61 .int_level_3_0 = 0xA0288c,
62 .int_level_2_3 = 0xA02890,
63 .int_level_2_2 = 0xA02894,
64 .int_level_2_1 = 0xA02898,
65 .int_level_2_0 = 0xA0289c,
66 .int_level_1_3 = 0xA028a0,
67 .int_level_1_2 = 0xA028a4,
68 .int_level_1_1 = 0xA028a8,
69 .int_level_1_0 = 0xA028ac,
70 .int_level_0_3 = 0xA028b0,
71 .int_level_0_2 = 0xA028b4,
72 .int_level_0_1 = 0xA028b8,
73 .int_level_0_0 = 0xA028bc,
74 .int_docsis_en = 0xA028F4,
75
76 .mips_pll_setup = 0x980000,
77 .usb_fs = 0x980030, /* -default 72800028- */
78 .test_bus = 0x9800CC,
79 .crt_spare = 0x9800d4,
80 .usb2_ohci_int_mask = 0x9A000c,
81 .usb2_strap = 0x9A0014,
82 .ehci_hcapbase = 0x9BFE00,
83 .ohci_hc_revision = 0x9BFC00,
84 .bcm1_bs_lmi_steer = 0x9E0004,
85 .usb2_control = 0x9E0054,
86 .usb2_stbus_obc = 0x9BFF00,
87 .usb2_stbus_mess_size = 0x9BFF04,
88 .usb2_stbus_chunk_size = 0x9BFF08,
89
90 .pcie_regs = 0x000000, /* -doesn't exist- */
91 .tim_ch = 0xA02C10,
92 .tim_cl = 0xA02C14,
93 .gpio_dout = 0xA02c20,
94 .gpio_din = 0xA02c24,
95 .gpio_dir = 0xA02c2C,
96 .watchdog = 0xA02c30,
97 .front_panel = 0x000000, /* -not used- */
98};
diff --git a/arch/mips/powertv/asic/asic-cronus.c b/arch/mips/powertv/asic/asic-cronus.c
new file mode 100644
index 000000000000..5f4589c9f83d
--- /dev/null
+++ b/arch/mips/powertv/asic/asic-cronus.c
@@ -0,0 +1,98 @@
1/*
2 * Locations of devices in the Cronus ASIC
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 *
23 * Description: Defines the platform resources for the SA settop.
24 */
25
26#include <asm/mach-powertv/asic.h>
27
28const struct register_map cronus_register_map = {
29 .eic_slow0_strt_add = 0x000000,
30 .eic_cfg_bits = 0x000038,
31 .eic_ready_status = 0x00004C,
32
33 .chipver3 = 0x2A0800,
34 .chipver2 = 0x2A0804,
35 .chipver1 = 0x2A0808,
36 .chipver0 = 0x2A080C,
37
38 /* The registers of IRBlaster */
39 .uart1_intstat = 0x2A1800,
40 .uart1_inten = 0x2A1804,
41 .uart1_config1 = 0x2A1808,
42 .uart1_config2 = 0x2A180C,
43 .uart1_divisorhi = 0x2A1810,
44 .uart1_divisorlo = 0x2A1814,
45 .uart1_data = 0x2A1818,
46 .uart1_status = 0x2A181C,
47
48 .int_stat_3 = 0x2A2800,
49 .int_stat_2 = 0x2A2804,
50 .int_stat_1 = 0x2A2808,
51 .int_stat_0 = 0x2A280C,
52 .int_config = 0x2A2810,
53 .int_int_scan = 0x2A2818,
54 .ien_int_3 = 0x2A2830,
55 .ien_int_2 = 0x2A2834,
56 .ien_int_1 = 0x2A2838,
57 .ien_int_0 = 0x2A283C,
58 .int_level_3_3 = 0x2A2880,
59 .int_level_3_2 = 0x2A2884,
60 .int_level_3_1 = 0x2A2888,
61 .int_level_3_0 = 0x2A288C,
62 .int_level_2_3 = 0x2A2890,
63 .int_level_2_2 = 0x2A2894,
64 .int_level_2_1 = 0x2A2898,
65 .int_level_2_0 = 0x2A289C,
66 .int_level_1_3 = 0x2A28A0,
67 .int_level_1_2 = 0x2A28A4,
68 .int_level_1_1 = 0x2A28A8,
69 .int_level_1_0 = 0x2A28AC,
70 .int_level_0_3 = 0x2A28B0,
71 .int_level_0_2 = 0x2A28B4,
72 .int_level_0_1 = 0x2A28B8,
73 .int_level_0_0 = 0x2A28BC,
74 .int_docsis_en = 0x2A28F4,
75
76 .mips_pll_setup = 0x1C0000,
77 .usb_fs = 0x1C0018,
78 .test_bus = 0x1C00CC,
79 .crt_spare = 0x1c00d4,
80 .usb2_ohci_int_mask = 0x20000C,
81 .usb2_strap = 0x200014,
82 .ehci_hcapbase = 0x21FE00,
83 .ohci_hc_revision = 0x1E0000,
84 .bcm1_bs_lmi_steer = 0x2E0008,
85 .usb2_control = 0x2E004C,
86 .usb2_stbus_obc = 0x21FF00,
87 .usb2_stbus_mess_size = 0x21FF04,
88 .usb2_stbus_chunk_size = 0x21FF08,
89
90 .pcie_regs = 0x220000,
91 .tim_ch = 0x2A2C10,
92 .tim_cl = 0x2A2C14,
93 .gpio_dout = 0x2A2C20,
94 .gpio_din = 0x2A2C24,
95 .gpio_dir = 0x2A2C2C,
96 .watchdog = 0x2A2C30,
97 .front_panel = 0x2A3800,
98};
diff --git a/arch/mips/powertv/asic/asic-zeus.c b/arch/mips/powertv/asic/asic-zeus.c
new file mode 100644
index 000000000000..1469daab920e
--- /dev/null
+++ b/arch/mips/powertv/asic/asic-zeus.c
@@ -0,0 +1,98 @@
1/*
2 * Locations of devices in the Zeus ASIC
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 *
23 * Description: Defines the platform resources for the SA settop.
24 */
25
26#include <asm/mach-powertv/asic.h>
27
28const struct register_map zeus_register_map = {
29 .eic_slow0_strt_add = 0x000000,
30 .eic_cfg_bits = 0x000038,
31 .eic_ready_status = 0x00004c,
32
33 .chipver3 = 0x280800,
34 .chipver2 = 0x280804,
35 .chipver1 = 0x280808,
36 .chipver0 = 0x28080c,
37
38 /* The registers of IRBlaster */
39 .uart1_intstat = 0x281800,
40 .uart1_inten = 0x281804,
41 .uart1_config1 = 0x281808,
42 .uart1_config2 = 0x28180C,
43 .uart1_divisorhi = 0x281810,
44 .uart1_divisorlo = 0x281814,
45 .uart1_data = 0x281818,
46 .uart1_status = 0x28181C,
47
48 .int_stat_3 = 0x282800,
49 .int_stat_2 = 0x282804,
50 .int_stat_1 = 0x282808,
51 .int_stat_0 = 0x28280c,
52 .int_config = 0x282810,
53 .int_int_scan = 0x282818,
54 .ien_int_3 = 0x282830,
55 .ien_int_2 = 0x282834,
56 .ien_int_1 = 0x282838,
57 .ien_int_0 = 0x28283c,
58 .int_level_3_3 = 0x282880,
59 .int_level_3_2 = 0x282884,
60 .int_level_3_1 = 0x282888,
61 .int_level_3_0 = 0x28288c,
62 .int_level_2_3 = 0x282890,
63 .int_level_2_2 = 0x282894,
64 .int_level_2_1 = 0x282898,
65 .int_level_2_0 = 0x28289c,
66 .int_level_1_3 = 0x2828a0,
67 .int_level_1_2 = 0x2828a4,
68 .int_level_1_1 = 0x2828a8,
69 .int_level_1_0 = 0x2828ac,
70 .int_level_0_3 = 0x2828b0,
71 .int_level_0_2 = 0x2828b4,
72 .int_level_0_1 = 0x2828b8,
73 .int_level_0_0 = 0x2828bc,
74 .int_docsis_en = 0x2828F4,
75
76 .mips_pll_setup = 0x1a0000,
77 .usb_fs = 0x1a0018,
78 .test_bus = 0x1a0238,
79 .crt_spare = 0x1a0090,
80 .usb2_ohci_int_mask = 0x1e000c,
81 .usb2_strap = 0x1e0014,
82 .ehci_hcapbase = 0x1FFE00,
83 .ohci_hc_revision = 0x1FFC00,
84 .bcm1_bs_lmi_steer = 0x2C0008,
85 .usb2_control = 0x2c01a0,
86 .usb2_stbus_obc = 0x1FFF00,
87 .usb2_stbus_mess_size = 0x1FFF04,
88 .usb2_stbus_chunk_size = 0x1FFF08,
89
90 .pcie_regs = 0x200000,
91 .tim_ch = 0x282C10,
92 .tim_cl = 0x282C14,
93 .gpio_dout = 0x282c20,
94 .gpio_din = 0x282c24,
95 .gpio_dir = 0x282c2C,
96 .watchdog = 0x282c30,
97 .front_panel = 0x283800,
98};
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
new file mode 100644
index 000000000000..bae82880b6b5
--- /dev/null
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -0,0 +1,787 @@
1/*
2 * ASIC Device List Intialization
3 *
4 * Description: Defines the platform resources for the SA settop.
5 *
6 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Author: Ken Eppinett
23 * David Schleef <ds@schleef.org>
24 *
25 * Description: Defines the platform resources for the SA settop.
26 *
27 * NOTE: The bootloader allocates persistent memory at an address which is
28 * 16 MiB below the end of the highest address in KSEG0. All fixed
29 * address memory reservations must avoid this region.
30 */
31
32#include <linux/device.h>
33#include <linux/kernel.h>
34#include <linux/init.h>
35#include <linux/resource.h>
36#include <linux/serial_reg.h>
37#include <linux/io.h>
38#include <linux/bootmem.h>
39#include <linux/mm.h>
40#include <linux/platform_device.h>
41#include <linux/module.h>
42#include <asm/page.h>
43#include <linux/swap.h>
44#include <linux/highmem.h>
45#include <linux/dma-mapping.h>
46
47#include <asm/mach-powertv/asic.h>
48#include <asm/mach-powertv/asic_regs.h>
49#include <asm/mach-powertv/interrupts.h>
50
51#ifdef CONFIG_BOOTLOADER_DRIVER
52#include <asm/mach-powertv/kbldr.h>
53#endif
54#include <asm/bootinfo.h>
55
56#define BOOTLDRFAMILY(byte1, byte0) (((byte1) << 8) | (byte0))
57
58/*
59 * Forward Prototypes
60 */
61static void pmem_setup_resource(void);
62
63/*
64 * Global Variables
65 */
66enum asic_type asic;
67
68unsigned int platform_features;
69unsigned int platform_family;
70const struct register_map *register_map;
71EXPORT_SYMBOL(register_map); /* Exported for testing */
72unsigned long asic_phy_base;
73unsigned long asic_base;
74EXPORT_SYMBOL(asic_base); /* Exported for testing */
75struct resource *gp_resources;
76static bool usb_configured;
77
78/*
79 * Don't recommend to use it directly, it is usually used by kernel internally.
80 * Portable code should be using interfaces such as ioremp, dma_map_single, etc.
81 */
82unsigned long phys_to_bus_offset;
83EXPORT_SYMBOL(phys_to_bus_offset);
84
85/*
86 *
87 * IO Resource Definition
88 *
89 */
90
91struct resource asic_resource = {
92 .name = "ASIC Resource",
93 .start = 0,
94 .end = ASIC_IO_SIZE,
95 .flags = IORESOURCE_MEM,
96};
97
98/*
99 *
100 * USB Host Resource Definition
101 *
102 */
103
104static struct resource ehci_resources[] = {
105 {
106 .parent = &asic_resource,
107 .start = 0,
108 .end = 0xff,
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 .start = irq_usbehci,
113 .end = irq_usbehci,
114 .flags = IORESOURCE_IRQ,
115 },
116};
117
118static u64 ehci_dmamask = DMA_BIT_MASK(32);
119
120static struct platform_device ehci_device = {
121 .name = "powertv-ehci",
122 .id = 0,
123 .num_resources = 2,
124 .resource = ehci_resources,
125 .dev = {
126 .dma_mask = &ehci_dmamask,
127 .coherent_dma_mask = DMA_BIT_MASK(32),
128 },
129};
130
131static struct resource ohci_resources[] = {
132 {
133 .parent = &asic_resource,
134 .start = 0,
135 .end = 0xff,
136 .flags = IORESOURCE_MEM,
137 },
138 {
139 .start = irq_usbohci,
140 .end = irq_usbohci,
141 .flags = IORESOURCE_IRQ,
142 },
143};
144
145static u64 ohci_dmamask = DMA_BIT_MASK(32);
146
147static struct platform_device ohci_device = {
148 .name = "powertv-ohci",
149 .id = 0,
150 .num_resources = 2,
151 .resource = ohci_resources,
152 .dev = {
153 .dma_mask = &ohci_dmamask,
154 .coherent_dma_mask = DMA_BIT_MASK(32),
155 },
156};
157
158static struct platform_device *platform_devices[] = {
159 &ehci_device,
160 &ohci_device,
161};
162
163/*
164 *
165 * Platform Configuration and Device Initialization
166 *
167 */
168static void __init fs_update(int pe, int md, int sdiv, int disable_div_by_3)
169{
170 int en_prg, byp, pwr, nsb, val;
171 int sout;
172
173 sout = 1;
174 en_prg = 1;
175 byp = 0;
176 nsb = 1;
177 pwr = 1;
178
179 val = ((sdiv << 29) | (md << 24) | (pe<<8) | (sout<<3) | (byp<<2) |
180 (nsb<<1) | (disable_div_by_3<<5));
181
182 asic_write(val, usb_fs);
183 asic_write(val | (en_prg<<4), usb_fs);
184 asic_write(val | (en_prg<<4) | pwr, usb_fs);
185}
186
187/*
188 * Allow override of bootloader-specified model
189 */
190static char __initdata cmdline[COMMAND_LINE_SIZE];
191
192#define FORCEFAMILY_PARAM "forcefamily"
193
194static __init int check_forcefamily(unsigned char forced_family[2])
195{
196 const char *p;
197
198 forced_family[0] = '\0';
199 forced_family[1] = '\0';
200
201 /* Check the command line for a forcefamily directive */
202 strncpy(cmdline, arcs_cmdline, COMMAND_LINE_SIZE - 1);
203 p = strstr(cmdline, FORCEFAMILY_PARAM);
204 if (p && (p != cmdline) && (*(p - 1) != ' '))
205 p = strstr(p, " " FORCEFAMILY_PARAM "=");
206
207 if (p) {
208 p += strlen(FORCEFAMILY_PARAM "=");
209
210 if (*p == '\0' || *(p + 1) == '\0' ||
211 (*(p + 2) != '\0' && *(p + 2) != ' '))
212 pr_err(FORCEFAMILY_PARAM " must be exactly two "
213 "characters long, ignoring value\n");
214
215 else {
216 forced_family[0] = *p;
217 forced_family[1] = *(p + 1);
218 }
219 }
220
221 return 0;
222}
223
224/*
225 * platform_set_family - determine major platform family type.
226 *
227 * Returns family type; -1 if none
228 * Returns the family type; -1 if none
229 *
230 */
231static __init noinline void platform_set_family(void)
232{
233#define BOOTLDRFAMILY(byte1, byte0) (((byte1) << 8) | (byte0))
234
235 unsigned char forced_family[2];
236 unsigned short bootldr_family;
237
238 check_forcefamily(forced_family);
239
240 if (forced_family[0] != '\0' && forced_family[1] != '\0')
241 bootldr_family = BOOTLDRFAMILY(forced_family[0],
242 forced_family[1]);
243 else {
244
245#ifdef CONFIG_BOOTLOADER_DRIVER
246 bootldr_family = (unsigned short) kbldr_GetSWFamily();
247#else
248#if defined(CONFIG_BOOTLOADER_FAMILY)
249 bootldr_family = (unsigned short) BOOTLDRFAMILY(
250 CONFIG_BOOTLOADER_FAMILY[0],
251 CONFIG_BOOTLOADER_FAMILY[1]);
252#else
253#error "Unknown Bootloader Family"
254#endif
255#endif
256 }
257
258 pr_info("Bootloader Family = 0x%04X\n", bootldr_family);
259
260 switch (bootldr_family) {
261 case BOOTLDRFAMILY('R', '1'):
262 platform_family = FAMILY_1500;
263 break;
264 case BOOTLDRFAMILY('4', '4'):
265 platform_family = FAMILY_4500;
266 break;
267 case BOOTLDRFAMILY('4', '6'):
268 platform_family = FAMILY_4600;
269 break;
270 case BOOTLDRFAMILY('A', '1'):
271 platform_family = FAMILY_4600VZA;
272 break;
273 case BOOTLDRFAMILY('8', '5'):
274 platform_family = FAMILY_8500;
275 break;
276 case BOOTLDRFAMILY('R', '2'):
277 platform_family = FAMILY_8500RNG;
278 break;
279 case BOOTLDRFAMILY('8', '6'):
280 platform_family = FAMILY_8600;
281 break;
282 case BOOTLDRFAMILY('B', '1'):
283 platform_family = FAMILY_8600VZB;
284 break;
285 case BOOTLDRFAMILY('E', '1'):
286 platform_family = FAMILY_1500VZE;
287 break;
288 case BOOTLDRFAMILY('F', '1'):
289 platform_family = FAMILY_1500VZF;
290 break;
291 default:
292 platform_family = -1;
293 }
294}
295
296unsigned int platform_get_family(void)
297{
298 return platform_family;
299}
300EXPORT_SYMBOL(platform_get_family);
301
302/*
303 * \brief usb_eye_configure() for optimizing the USB eye on Calliope.
304 *
305 * \param unsigned int value saved to the register.
306 *
307 * \return none
308 *
309 */
310static void __init usb_eye_configure(unsigned int value)
311{
312 asic_write(asic_read(crt_spare) | value, crt_spare);
313}
314
315/*
316 * platform_get_asic - determine the ASIC type.
317 *
318 * \param none
319 *
320 * \return ASIC type; ASIC_UNKNOWN if none
321 *
322 */
323enum asic_type platform_get_asic(void)
324{
325 return asic;
326}
327EXPORT_SYMBOL(platform_get_asic);
328
329/*
330 * platform_configure_usb - usb configuration based on platform type.
331 * @bcm1_usb2_ctl: value for the BCM1_USB2_CTL register, which is
332 * quirky
333 */
334static void __init platform_configure_usb(void)
335{
336 u32 bcm1_usb2_ctl;
337
338 if (usb_configured)
339 return;
340
341 switch (asic) {
342 case ASIC_ZEUS:
343 fs_update(0x0000, 0x11, 0x02, 0);
344 bcm1_usb2_ctl = 0x803;
345 break;
346
347 case ASIC_CRONUS:
348 case ASIC_CRONUSLITE:
349 fs_update(0x0000, 0x11, 0x02, 0);
350 bcm1_usb2_ctl = 0x803;
351 break;
352
353 case ASIC_CALLIOPE:
354 fs_update(0x0000, 0x11, 0x02, 1);
355
356 switch (platform_family) {
357 case FAMILY_1500VZE:
358 break;
359
360 case FAMILY_1500VZF:
361 usb_eye_configure(0x003c0000);
362 break;
363
364 default:
365 usb_eye_configure(0x00300000);
366 break;
367 }
368
369 bcm1_usb2_ctl = 0x803;
370 break;
371
372 default:
373 pr_err("Unknown ASIC type: %d\n", asic);
374 break;
375 }
376
377 /* turn on USB power */
378 asic_write(0, usb2_strap);
379 /* Enable all OHCI interrupts */
380 asic_write(bcm1_usb2_ctl, usb2_control);
381 /* USB2_STBUS_OBC store32/load32 */
382 asic_write(3, usb2_stbus_obc);
383 /* USB2_STBUS_MESS_SIZE 2 packets */
384 asic_write(1, usb2_stbus_mess_size);
385 /* USB2_STBUS_CHUNK_SIZE 2 packets */
386 asic_write(1, usb2_stbus_chunk_size);
387
388 usb_configured = true;
389}
390
391/*
392 * Set up the USB EHCI interface
393 */
394void platform_configure_usb_ehci()
395{
396 platform_configure_usb();
397}
398
399/*
400 * Set up the USB OHCI interface
401 */
402void platform_configure_usb_ohci()
403{
404 platform_configure_usb();
405}
406
407/*
408 * Shut the USB EHCI interface down--currently a NOP
409 */
410void platform_unconfigure_usb_ehci()
411{
412}
413
414/*
415 * Shut the USB OHCI interface down--currently a NOP
416 */
417void platform_unconfigure_usb_ohci()
418{
419}
420
421/**
422 * configure_platform - configuration based on platform type.
423 */
424void __init configure_platform(void)
425{
426 platform_set_family();
427
428 switch (platform_family) {
429 case FAMILY_1500:
430 case FAMILY_1500VZE:
431 case FAMILY_1500VZF:
432 platform_features = FFS_CAPABLE;
433 asic = ASIC_CALLIOPE;
434 asic_phy_base = CALLIOPE_IO_BASE;
435 register_map = &calliope_register_map;
436 asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
437 ASIC_IO_SIZE);
438
439 if (platform_family == FAMILY_1500VZE) {
440 gp_resources = non_dvr_vze_calliope_resources;
441 pr_info("Platform: 1500/Vz Class E - "
442 "CALLIOPE, NON_DVR_CAPABLE\n");
443 } else if (platform_family == FAMILY_1500VZF) {
444 gp_resources = non_dvr_vzf_calliope_resources;
445 pr_info("Platform: 1500/Vz Class F - "
446 "CALLIOPE, NON_DVR_CAPABLE\n");
447 } else {
448 gp_resources = non_dvr_calliope_resources;
449 pr_info("Platform: 1500/RNG100 - CALLIOPE, "
450 "NON_DVR_CAPABLE\n");
451 }
452 break;
453
454 case FAMILY_4500:
455 platform_features = FFS_CAPABLE | PCIE_CAPABLE |
456 DISPLAY_CAPABLE;
457 asic = ASIC_ZEUS;
458 asic_phy_base = ZEUS_IO_BASE;
459 register_map = &zeus_register_map;
460 asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
461 ASIC_IO_SIZE);
462 gp_resources = non_dvr_zeus_resources;
463
464 pr_info("Platform: 4500 - ZEUS, NON_DVR_CAPABLE\n");
465 break;
466
467 case FAMILY_4600:
468 {
469 unsigned int chipversion = 0;
470
471 /* The settop has PCIE but it isn't used, so don't advertise
472 * it*/
473 platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
474 asic_phy_base = CRONUS_IO_BASE; /* same as Cronus */
475 register_map = &cronus_register_map; /* same as Cronus */
476 asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
477 ASIC_IO_SIZE);
478 gp_resources = non_dvr_cronuslite_resources;
479
480 /* ASIC version will determine if this is a real CronusLite or
481 * Castrati(Cronus) */
482 chipversion = asic_read(chipver3) << 24;
483 chipversion |= asic_read(chipver2) << 16;
484 chipversion |= asic_read(chipver1) << 8;
485 chipversion |= asic_read(chipver0);
486
487 if ((chipversion == CRONUS_10) || (chipversion == CRONUS_11))
488 asic = ASIC_CRONUS;
489 else
490 asic = ASIC_CRONUSLITE;
491
492 pr_info("Platform: 4600 - %s, NON_DVR_CAPABLE, "
493 "chipversion=0x%08X\n",
494 (asic == ASIC_CRONUS) ? "CRONUS" : "CRONUS LITE",
495 chipversion);
496 break;
497 }
498 case FAMILY_4600VZA:
499 platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
500 asic = ASIC_CRONUS;
501 asic_phy_base = CRONUS_IO_BASE;
502 register_map = &cronus_register_map;
503 asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
504 ASIC_IO_SIZE);
505 gp_resources = non_dvr_cronus_resources;
506
507 pr_info("Platform: Vz Class A - CRONUS, NON_DVR_CAPABLE\n");
508 break;
509
510 case FAMILY_8500:
511 case FAMILY_8500RNG:
512 platform_features = DVR_CAPABLE | PCIE_CAPABLE |
513 DISPLAY_CAPABLE;
514 asic = ASIC_ZEUS;
515 asic_phy_base = ZEUS_IO_BASE;
516 register_map = &zeus_register_map;
517 asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
518 ASIC_IO_SIZE);
519 gp_resources = dvr_zeus_resources;
520
521 pr_info("Platform: 8500/RNG200 - ZEUS, DVR_CAPABLE\n");
522 break;
523
524 case FAMILY_8600:
525 case FAMILY_8600VZB:
526 platform_features = DVR_CAPABLE | PCIE_CAPABLE |
527 DISPLAY_CAPABLE;
528 asic = ASIC_CRONUS;
529 asic_phy_base = CRONUS_IO_BASE;
530 register_map = &cronus_register_map;
531 asic_base = (unsigned long)ioremap_nocache(asic_phy_base,
532 ASIC_IO_SIZE);
533 gp_resources = dvr_cronus_resources;
534
535 pr_info("Platform: 8600/Vz Class B - CRONUS, "
536 "DVR_CAPABLE\n");
537 break;
538
539 default:
540 pr_crit("Platform: UNKNOWN PLATFORM\n");
541 break;
542 }
543
544 switch (asic) {
545 case ASIC_ZEUS:
546 phys_to_bus_offset = 0x30000000;
547 break;
548 case ASIC_CALLIOPE:
549 phys_to_bus_offset = 0x10000000;
550 break;
551 case ASIC_CRONUSLITE:
552 /* Fall through */
553 case ASIC_CRONUS:
554 /*
555 * TODO: We suppose 0x10000000 aliases into 0x20000000-
556 * 0x2XXXXXXX. If 0x10000000 aliases into 0x60000000-
557 * 0x6XXXXXXX, the offset should be 0x50000000, not 0x10000000.
558 */
559 phys_to_bus_offset = 0x10000000;
560 break;
561 default:
562 phys_to_bus_offset = 0x00000000;
563 break;
564 }
565}
566
567/**
568 * platform_devices_init - sets up USB device resourse.
569 */
570static int __init platform_devices_init(void)
571{
572 pr_notice("%s: ----- Initializing USB resources -----\n", __func__);
573
574 asic_resource.start = asic_phy_base;
575 asic_resource.end += asic_resource.start;
576
577 ehci_resources[0].start = asic_reg_phys_addr(ehci_hcapbase);
578 ehci_resources[0].end += ehci_resources[0].start;
579
580 ohci_resources[0].start = asic_reg_phys_addr(ohci_hc_revision);
581 ohci_resources[0].end += ohci_resources[0].start;
582
583 set_io_port_base(0);
584
585 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
586
587 return 0;
588}
589
590arch_initcall(platform_devices_init);
591
592/*
593 *
594 * BOOTMEM ALLOCATION
595 *
596 */
597/*
598 * Allocates/reserves the Platform memory resources early in the boot process.
599 * This ignores any resources that are designated IORESOURCE_IO
600 */
601void __init platform_alloc_bootmem(void)
602{
603 int i;
604 int total = 0;
605
606 /* Get persistent memory data from command line before allocating
607 * resources. This need to happen before normal command line parsing
608 * has been done */
609 pmem_setup_resource();
610
611 /* Loop through looking for resources that want a particular address */
612 for (i = 0; gp_resources[i].flags != 0; i++) {
613 int size = gp_resources[i].end - gp_resources[i].start + 1;
614 if ((gp_resources[i].start != 0) &&
615 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
616 reserve_bootmem(bus_to_phys(gp_resources[i].start),
617 size, 0);
618 total += gp_resources[i].end -
619 gp_resources[i].start + 1;
620 pr_info("reserve resource %s at %08x (%u bytes)\n",
621 gp_resources[i].name, gp_resources[i].start,
622 gp_resources[i].end -
623 gp_resources[i].start + 1);
624 }
625 }
626
627 /* Loop through assigning addresses for those that are left */
628 for (i = 0; gp_resources[i].flags != 0; i++) {
629 int size = gp_resources[i].end - gp_resources[i].start + 1;
630 if ((gp_resources[i].start == 0) &&
631 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
632 void *mem = alloc_bootmem_pages(size);
633
634 if (mem == NULL)
635 pr_err("Unable to allocate bootmem pages "
636 "for %s\n", gp_resources[i].name);
637
638 else {
639 gp_resources[i].start =
640 phys_to_bus(virt_to_phys(mem));
641 gp_resources[i].end =
642 gp_resources[i].start + size - 1;
643 total += size;
644 pr_info("allocate resource %s at %08x "
645 "(%u bytes)\n",
646 gp_resources[i].name,
647 gp_resources[i].start, size);
648 }
649 }
650 }
651
652 pr_info("Total Platform driver memory allocation: 0x%08x\n", total);
653
654 /* indicate resources that are platform I/O related */
655 for (i = 0; gp_resources[i].flags != 0; i++) {
656 if ((gp_resources[i].start != 0) &&
657 ((gp_resources[i].flags & IORESOURCE_IO) != 0)) {
658 pr_info("reserved platform resource %s at %08x\n",
659 gp_resources[i].name, gp_resources[i].start);
660 }
661 }
662}
663
664/*
665 *
666 * PERSISTENT MEMORY (PMEM) CONFIGURATION
667 *
668 */
669static unsigned long pmemaddr __initdata;
670
671static int __init early_param_pmemaddr(char *p)
672{
673 pmemaddr = (unsigned long)simple_strtoul(p, NULL, 0);
674 return 0;
675}
676early_param("pmemaddr", early_param_pmemaddr);
677
678static long pmemlen __initdata;
679
680static int __init early_param_pmemlen(char *p)
681{
682/* TODO: we can use this code when and if the bootloader ever changes this */
683#if 0
684 pmemlen = (unsigned long)simple_strtoul(p, NULL, 0);
685#else
686 pmemlen = 0x20000;
687#endif
688 return 0;
689}
690early_param("pmemlen", early_param_pmemlen);
691
692/*
693 * Set up persistent memory. If we were given values, we patch the array of
694 * resources. Otherwise, persistent memory may be allocated anywhere at all.
695 */
696static void __init pmem_setup_resource(void)
697{
698 struct resource *resource;
699 resource = asic_resource_get("DiagPersistentMemory");
700
701 if (resource && pmemaddr && pmemlen) {
702 /* The address provided by bootloader is in kseg0. Convert to
703 * a bus address. */
704 resource->start = phys_to_bus(pmemaddr - 0x80000000);
705 resource->end = resource->start + pmemlen - 1;
706
707 pr_info("persistent memory: start=0x%x end=0x%x\n",
708 resource->start, resource->end);
709 }
710}
711
712/*
713 *
714 * RESOURCE ACCESS FUNCTIONS
715 *
716 */
717
718/**
719 * asic_resource_get - retrieves parameters for a platform resource.
720 * @name: string to match resource
721 *
722 * Returns a pointer to a struct resource corresponding to the given name.
723 *
724 * CANNOT BE NAMED platform_resource_get, which would be the obvious choice,
725 * as this function name is already declared
726 */
727struct resource *asic_resource_get(const char *name)
728{
729 int i;
730
731 for (i = 0; gp_resources[i].flags != 0; i++) {
732 if (strcmp(gp_resources[i].name, name) == 0)
733 return &gp_resources[i];
734 }
735
736 return NULL;
737}
738EXPORT_SYMBOL(asic_resource_get);
739
740/**
741 * platform_release_memory - release pre-allocated memory
742 * @ptr: pointer to memory to release
743 * @size: size of resource
744 *
745 * This must only be called for memory allocated or reserved via the boot
746 * memory allocator.
747 */
748void platform_release_memory(void *ptr, int size)
749{
750 unsigned long addr;
751 unsigned long end;
752
753 addr = ((unsigned long)ptr + (PAGE_SIZE - 1)) & PAGE_MASK;
754 end = ((unsigned long)ptr + size) & PAGE_MASK;
755
756 for (; addr < end; addr += PAGE_SIZE) {
757 ClearPageReserved(virt_to_page(__va(addr)));
758 init_page_count(virt_to_page(__va(addr)));
759 free_page((unsigned long)__va(addr));
760 }
761}
762EXPORT_SYMBOL(platform_release_memory);
763
764/*
765 *
766 * FEATURE AVAILABILITY FUNCTIONS
767 *
768 */
769int platform_supports_dvr(void)
770{
771 return (platform_features & DVR_CAPABLE) != 0;
772}
773
774int platform_supports_ffs(void)
775{
776 return (platform_features & FFS_CAPABLE) != 0;
777}
778
779int platform_supports_pcie(void)
780{
781 return (platform_features & PCIE_CAPABLE) != 0;
782}
783
784int platform_supports_display(void)
785{
786 return (platform_features & DISPLAY_CAPABLE) != 0;
787}
diff --git a/arch/mips/powertv/asic/asic_int.c b/arch/mips/powertv/asic/asic_int.c
new file mode 100644
index 000000000000..80b2eed21ac3
--- /dev/null
+++ b/arch/mips/powertv/asic/asic_int.c
@@ -0,0 +1,125 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
4 * Copyright (C) 2001 Ralf Baechle
5 * Portions copyright (C) 2009 Cisco Systems, Inc.
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * Routines for generic manipulation of the interrupts found on the PowerTV
21 * platform.
22 *
23 * The interrupt controller is located in the South Bridge a PIIX4 device
24 * with two internal 82C95 interrupt controllers.
25 */
26#include <linux/init.h>
27#include <linux/irq.h>
28#include <linux/sched.h>
29#include <linux/slab.h>
30#include <linux/interrupt.h>
31#include <linux/kernel_stat.h>
32#include <linux/kernel.h>
33#include <linux/random.h>
34
35#include <asm/irq_cpu.h>
36#include <linux/io.h>
37#include <asm/irq_regs.h>
38#include <asm/mips-boards/generic.h>
39
40#include <asm/mach-powertv/asic_regs.h>
41
42static DEFINE_SPINLOCK(asic_irq_lock);
43
44static inline int get_int(void)
45{
46 unsigned long flags;
47 int irq;
48
49 spin_lock_irqsave(&asic_irq_lock, flags);
50
51 irq = (asic_read(int_int_scan) >> 4) - 1;
52
53 if (irq == 0 || irq >= NR_IRQS)
54 irq = -1;
55
56 spin_unlock_irqrestore(&asic_irq_lock, flags);
57
58 return irq;
59}
60
61static void asic_irqdispatch(void)
62{
63 int irq;
64
65 irq = get_int();
66 if (irq < 0)
67 return; /* interrupt has already been cleared */
68
69 do_IRQ(irq);
70}
71
72static inline int clz(unsigned long x)
73{
74 __asm__(
75 " .set push \n"
76 " .set mips32 \n"
77 " clz %0, %1 \n"
78 " .set pop \n"
79 : "=r" (x)
80 : "r" (x));
81
82 return x;
83}
84
85/*
86 * Version of ffs that only looks at bits 12..15.
87 */
88static inline unsigned int irq_ffs(unsigned int pending)
89{
90 return fls(pending) - 1 + CAUSEB_IP;
91}
92
93/*
94 * TODO: check how it works under EIC mode.
95 */
96asmlinkage void plat_irq_dispatch(void)
97{
98 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
99 int irq;
100
101 irq = irq_ffs(pending);
102
103 if (irq == CAUSEF_IP3)
104 asic_irqdispatch();
105 else if (irq >= 0)
106 do_IRQ(irq);
107 else
108 spurious_interrupt();
109}
110
111void __init arch_init_irq(void)
112{
113 int i;
114
115 asic_irq_init();
116
117 /*
118 * Initialize interrupt exception vectors.
119 */
120 if (cpu_has_veic || cpu_has_vint) {
121 int nvec = cpu_has_veic ? 64 : 8;
122 for (i = 0; i < nvec; i++)
123 set_vi_handler(i, asic_irqdispatch);
124 }
125}
diff --git a/arch/mips/powertv/asic/irq_asic.c b/arch/mips/powertv/asic/irq_asic.c
new file mode 100644
index 000000000000..b54d24499b06
--- /dev/null
+++ b/arch/mips/powertv/asic/irq_asic.c
@@ -0,0 +1,116 @@
1/*
2 * Portions copyright (C) 2005-2009 Scientific Atlanta
3 * Portions copyright (C) 2009 Cisco Systems, Inc.
4 *
5 * Modified from arch/mips/kernel/irq-rm7000.c:
6 * Copyright (C) 2003 Ralf Baechle
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/kernel.h>
16
17#include <asm/irq_cpu.h>
18#include <asm/mipsregs.h>
19#include <asm/system.h>
20
21#include <asm/mach-powertv/asic_regs.h>
22
23static inline void unmask_asic_irq(unsigned int irq)
24{
25 unsigned long enable_bit;
26
27 enable_bit = (1 << (irq & 0x1f));
28
29 switch (irq >> 5) {
30 case 0:
31 asic_write(asic_read(ien_int_0) | enable_bit, ien_int_0);
32 break;
33 case 1:
34 asic_write(asic_read(ien_int_1) | enable_bit, ien_int_1);
35 break;
36 case 2:
37 asic_write(asic_read(ien_int_2) | enable_bit, ien_int_2);
38 break;
39 case 3:
40 asic_write(asic_read(ien_int_3) | enable_bit, ien_int_3);
41 break;
42 default:
43 BUG();
44 }
45}
46
47static inline void mask_asic_irq(unsigned int irq)
48{
49 unsigned long disable_mask;
50
51 disable_mask = ~(1 << (irq & 0x1f));
52
53 switch (irq >> 5) {
54 case 0:
55 asic_write(asic_read(ien_int_0) & disable_mask, ien_int_0);
56 break;
57 case 1:
58 asic_write(asic_read(ien_int_1) & disable_mask, ien_int_1);
59 break;
60 case 2:
61 asic_write(asic_read(ien_int_2) & disable_mask, ien_int_2);
62 break;
63 case 3:
64 asic_write(asic_read(ien_int_3) & disable_mask, ien_int_3);
65 break;
66 default:
67 BUG();
68 }
69}
70
71static struct irq_chip asic_irq_chip = {
72 .name = "ASIC Level",
73 .ack = mask_asic_irq,
74 .mask = mask_asic_irq,
75 .mask_ack = mask_asic_irq,
76 .unmask = unmask_asic_irq,
77 .eoi = unmask_asic_irq,
78};
79
80void __init asic_irq_init(void)
81{
82 int i;
83
84 /* set priority to 0 */
85 write_c0_status(read_c0_status() & ~(0x0000fc00));
86
87 asic_write(0, ien_int_0);
88 asic_write(0, ien_int_1);
89 asic_write(0, ien_int_2);
90 asic_write(0, ien_int_3);
91
92 asic_write(0x0fffffff, int_level_3_3);
93 asic_write(0xffffffff, int_level_3_2);
94 asic_write(0xffffffff, int_level_3_1);
95 asic_write(0xffffffff, int_level_3_0);
96 asic_write(0xffffffff, int_level_2_3);
97 asic_write(0xffffffff, int_level_2_2);
98 asic_write(0xffffffff, int_level_2_1);
99 asic_write(0xffffffff, int_level_2_0);
100 asic_write(0xffffffff, int_level_1_3);
101 asic_write(0xffffffff, int_level_1_2);
102 asic_write(0xffffffff, int_level_1_1);
103 asic_write(0xffffffff, int_level_1_0);
104 asic_write(0xffffffff, int_level_0_3);
105 asic_write(0xffffffff, int_level_0_2);
106 asic_write(0xffffffff, int_level_0_1);
107 asic_write(0xffffffff, int_level_0_0);
108
109 asic_write(0xf, int_int_scan);
110
111 /*
112 * Initialize interrupt handlers.
113 */
114 for (i = 0; i < NR_IRQS; i++)
115 set_irq_chip_and_handler(i, &asic_irq_chip, handle_level_irq);
116}
diff --git a/arch/mips/powertv/asic/prealloc-calliope.c b/arch/mips/powertv/asic/prealloc-calliope.c
new file mode 100644
index 000000000000..cd5b76a1c951
--- /dev/null
+++ b/arch/mips/powertv/asic/prealloc-calliope.c
@@ -0,0 +1,620 @@
1/*
2 * Memory pre-allocations for Calliope boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <asm/mach-powertv/asic.h>
26
27/*
28 * NON_DVR_CAPABLE CALLIOPE RESOURCES
29 */
30struct resource non_dvr_calliope_resources[] __initdata =
31{
32 /*
33 * VIDEO / LX1
34 */
35 {
36 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
37 .start = 0x24000000,
38 .end = 0x24200000 - 1, /*2MiB */
39 .flags = IORESOURCE_MEM,
40 },
41 {
42 .name = "ST231aMonitor", /*8KiB block ST231a monitor */
43 .start = 0x24200000,
44 .end = 0x24202000 - 1,
45 .flags = IORESOURCE_MEM,
46 },
47 {
48 .name = "MediaMemory1",
49 .start = 0x24202000,
50 .end = 0x26700000 - 1, /*~36.9MiB (32MiB - (2MiB + 8KiB)) */
51 .flags = IORESOURCE_MEM,
52 },
53 /*
54 * Sysaudio Driver
55 */
56 {
57 .name = "DSP_Image_Buff",
58 .start = 0x00000000,
59 .end = 0x000FFFFF,
60 .flags = IORESOURCE_MEM,
61 },
62 {
63 .name = "ADSC_CPU_PCM_Buff",
64 .start = 0x00000000,
65 .end = 0x00009FFF,
66 .flags = IORESOURCE_MEM,
67 },
68 {
69 .name = "ADSC_AUX_Buff",
70 .start = 0x00000000,
71 .end = 0x00003FFF,
72 .flags = IORESOURCE_MEM,
73 },
74 {
75 .name = "ADSC_Main_Buff",
76 .start = 0x00000000,
77 .end = 0x00003FFF,
78 .flags = IORESOURCE_MEM,
79 },
80 /*
81 * STAVEM driver/STAPI
82 */
83 {
84 .name = "AVMEMPartition0",
85 .start = 0x00000000,
86 .end = 0x00600000 - 1, /* 6 MB total */
87 .flags = IORESOURCE_MEM,
88 },
89 /*
90 * DOCSIS Subsystem
91 */
92 {
93 .name = "Docsis",
94 .start = 0x22000000,
95 .end = 0x22700000 - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 /*
99 * GHW HAL Driver
100 */
101 {
102 .name = "GraphicsHeap",
103 .start = 0x22700000,
104 .end = 0x23500000 - 1, /* 14 MB total */
105 .flags = IORESOURCE_MEM,
106 },
107 /*
108 * multi com buffer area
109 */
110 {
111 .name = "MulticomSHM",
112 .start = 0x23700000,
113 .end = 0x23720000 - 1,
114 .flags = IORESOURCE_MEM,
115 },
116 /*
117 * DMA Ring buffer (don't need recording buffers)
118 */
119 {
120 .name = "BMM_Buffer",
121 .start = 0x00000000,
122 .end = 0x000AA000 - 1,
123 .flags = IORESOURCE_MEM,
124 },
125 /*
126 * Display bins buffer for unit0
127 */
128 {
129 .name = "DisplayBins0",
130 .start = 0x00000000,
131 .end = 0x00000FFF, /* 4 KB total */
132 .flags = IORESOURCE_MEM,
133 },
134 /*
135 *
136 * AVFS: player HAL memory
137 *
138 *
139 */
140 {
141 .name = "AvfsDmaMem",
142 .start = 0x00000000,
143 .end = 0x002c4c00 - 1, /* 945K * 3 for playback */
144 .flags = IORESOURCE_MEM,
145 },
146 /*
147 * PMEM
148 */
149 {
150 .name = "DiagPersistentMemory",
151 .start = 0x00000000,
152 .end = 0x10000 - 1,
153 .flags = IORESOURCE_MEM,
154 },
155 /*
156 * Smartcard
157 */
158 {
159 .name = "SmartCardInfo",
160 .start = 0x00000000,
161 .end = 0x2800 - 1,
162 .flags = IORESOURCE_MEM,
163 },
164 /*
165 * NAND Flash
166 */
167 {
168 .name = "NandFlash",
169 .start = NAND_FLASH_BASE,
170 .end = NAND_FLASH_BASE + 0x400 - 1,
171 .flags = IORESOURCE_IO,
172 },
173 /*
174 * Synopsys GMAC Memory Region
175 */
176 {
177 .name = "GMAC",
178 .start = 0x00000000,
179 .end = 0x00010000 - 1,
180 .flags = IORESOURCE_MEM,
181 },
182 /*
183 * Add other resources here
184 *
185 */
186 { },
187};
188
189struct resource non_dvr_vz_calliope_resources[] __initdata =
190{
191 /*
192 * VIDEO / LX1
193 */
194 {
195 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
196 .start = 0x24000000,
197 .end = 0x24200000 - 1, /*2 Meg */
198 .flags = IORESOURCE_MEM,
199 },
200 {
201 .name = "ST231aMonitor", /* 8k block ST231a monitor */
202 .start = 0x24200000,
203 .end = 0x24202000 - 1,
204 .flags = IORESOURCE_MEM,
205 },
206 {
207 .name = "MediaMemory1",
208 .start = 0x22202000,
209 .end = 0x22C20B85 - 1, /* 10.12 Meg */
210 .flags = IORESOURCE_MEM,
211 },
212 /*
213 * Sysaudio Driver
214 */
215 {
216 .name = "DSP_Image_Buff",
217 .start = 0x00000000,
218 .end = 0x000FFFFF,
219 .flags = IORESOURCE_MEM,
220 },
221 {
222 .name = "ADSC_CPU_PCM_Buff",
223 .start = 0x00000000,
224 .end = 0x00009FFF,
225 .flags = IORESOURCE_MEM,
226 },
227 {
228 .name = "ADSC_AUX_Buff",
229 .start = 0x00000000,
230 .end = 0x00003FFF,
231 .flags = IORESOURCE_MEM,
232 },
233 {
234 .name = "ADSC_Main_Buff",
235 .start = 0x00000000,
236 .end = 0x00003FFF,
237 .flags = IORESOURCE_MEM,
238 },
239 /*
240 * STAVEM driver/STAPI
241 */
242 {
243 .name = "AVMEMPartition0",
244 .start = 0x20300000,
245 .end = 0x20620000-1, /*3.125 MB total */
246 .flags = IORESOURCE_MEM,
247 },
248 /*
249 * GHW HAL Driver
250 */
251 {
252 .name = "GraphicsHeap",
253 .start = 0x20100000,
254 .end = 0x20300000 - 1,
255 .flags = IORESOURCE_MEM,
256 },
257 /*
258 * multi com buffer area
259 */
260 {
261 .name = "MulticomSHM",
262 .start = 0x23900000,
263 .end = 0x23920000 - 1,
264 .flags = IORESOURCE_MEM,
265 },
266 /*
267 * DMA Ring buffer
268 */
269 {
270 .name = "BMM_Buffer",
271 .start = 0x00000000,
272 .end = 0x000AA000 - 1,
273 .flags = IORESOURCE_MEM,
274 },
275 /*
276 * Display bins buffer for unit0
277 */
278 {
279 .name = "DisplayBins0",
280 .start = 0x00000000,
281 .end = 0x00000FFF,
282 .flags = IORESOURCE_MEM,
283 },
284 /*
285 * PMEM
286 */
287 {
288 .name = "DiagPersistentMemory",
289 .start = 0x00000000,
290 .end = 0x10000 - 1,
291 .flags = IORESOURCE_MEM,
292 },
293 /*
294 * Smartcard
295 */
296 {
297 .name = "SmartCardInfo",
298 .start = 0x00000000,
299 .end = 0x2800 - 1,
300 .flags = IORESOURCE_MEM,
301 },
302 /*
303 * NAND Flash
304 */
305 {
306 .name = "NandFlash",
307 .start = NAND_FLASH_BASE,
308 .end = NAND_FLASH_BASE+0x400 - 1,
309 .flags = IORESOURCE_IO,
310 },
311 /*
312 * Synopsys GMAC Memory Region
313 */
314 {
315 .name = "GMAC",
316 .start = 0x00000000,
317 .end = 0x00010000 - 1,
318 .flags = IORESOURCE_MEM,
319 },
320 /*
321 * Add other resources here
322 */
323 { },
324};
325
326struct resource non_dvr_vze_calliope_resources[] __initdata =
327{
328 /*
329 * VIDEO / LX1
330 */
331 {
332 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
333 .start = 0x22000000,
334 .end = 0x22200000 - 1, /*2 Meg */
335 .flags = IORESOURCE_MEM,
336 },
337 {
338 .name = "ST231aMonitor", /* 8k block ST231a monitor */
339 .start = 0x22200000,
340 .end = 0x22202000 - 1,
341 .flags = IORESOURCE_MEM,
342 },
343 {
344 .name = "MediaMemory1",
345 .start = 0x22202000,
346 .end = 0x22C20B85 - 1, /* 10.12 Meg */
347 .flags = IORESOURCE_MEM,
348 },
349 /*
350 * Sysaudio Driver
351 */
352 {
353 .name = "DSP_Image_Buff",
354 .start = 0x00000000,
355 .end = 0x000FFFFF,
356 .flags = IORESOURCE_MEM,
357 },
358 {
359 .name = "ADSC_CPU_PCM_Buff",
360 .start = 0x00000000,
361 .end = 0x00009FFF,
362 .flags = IORESOURCE_MEM,
363 },
364 {
365 .name = "ADSC_AUX_Buff",
366 .start = 0x00000000,
367 .end = 0x00003FFF,
368 .flags = IORESOURCE_MEM,
369 },
370 {
371 .name = "ADSC_Main_Buff",
372 .start = 0x00000000,
373 .end = 0x00003FFF,
374 .flags = IORESOURCE_MEM,
375 },
376 /*
377 * STAVEM driver/STAPI
378 */
379 {
380 .name = "AVMEMPartition0",
381 .start = 0x20396000,
382 .end = 0x206B6000 - 1, /* 3.125 MB total */
383 .flags = IORESOURCE_MEM,
384 },
385 /*
386 * GHW HAL Driver
387 */
388 {
389 .name = "GraphicsHeap",
390 .start = 0x20100000,
391 .end = 0x20396000 - 1,
392 .flags = IORESOURCE_MEM,
393 },
394 /*
395 * multi com buffer area
396 */
397 {
398 .name = "MulticomSHM",
399 .start = 0x206B6000,
400 .end = 0x206D6000 - 1,
401 .flags = IORESOURCE_MEM,
402 },
403 /*
404 * DMA Ring buffer
405 */
406 {
407 .name = "BMM_Buffer",
408 .start = 0x00000000,
409 .end = 0x000AA000 - 1,
410 .flags = IORESOURCE_MEM,
411 },
412 /*
413 * Display bins buffer for unit0
414 */
415 {
416 .name = "DisplayBins0",
417 .start = 0x00000000,
418 .end = 0x00000FFF,
419 .flags = IORESOURCE_MEM,
420 },
421 /*
422 * PMEM
423 */
424 {
425 .name = "DiagPersistentMemory",
426 .start = 0x00000000,
427 .end = 0x10000 - 1,
428 .flags = IORESOURCE_MEM,
429 },
430 /*
431 * Smartcard
432 */
433 {
434 .name = "SmartCardInfo",
435 .start = 0x00000000,
436 .end = 0x2800 - 1,
437 .flags = IORESOURCE_MEM,
438 },
439 /*
440 * NAND Flash
441 */
442 {
443 .name = "NandFlash",
444 .start = NAND_FLASH_BASE,
445 .end = NAND_FLASH_BASE+0x400 - 1,
446 .flags = IORESOURCE_MEM,
447 },
448 /*
449 * Synopsys GMAC Memory Region
450 */
451 {
452 .name = "GMAC",
453 .start = 0x00000000,
454 .end = 0x00010000 - 1,
455 .flags = IORESOURCE_MEM,
456 },
457 /*
458 * Add other resources here
459 */
460 { },
461};
462
463struct resource non_dvr_vzf_calliope_resources[] __initdata =
464{
465 /*
466 * VIDEO / LX1
467 */
468 {
469 .name = "ST231aImage", /*Delta-Mu 1 image and ram */
470 .start = 0x24000000,
471 .end = 0x24200000 - 1, /*2MiB */
472 .flags = IORESOURCE_MEM,
473 },
474 {
475 .name = "ST231aMonitor", /*8KiB block ST231a monitor */
476 .start = 0x24200000,
477 .end = 0x24202000 - 1,
478 .flags = IORESOURCE_MEM,
479 },
480 {
481 .name = "MediaMemory1",
482 .start = 0x24202000,
483 /* ~19.4 (21.5MiB - (2MiB + 8KiB)) */
484 .end = 0x25580000 - 1,
485 .flags = IORESOURCE_MEM,
486 },
487 /*
488 * Sysaudio Driver
489 */
490 {
491 .name = "DSP_Image_Buff",
492 .start = 0x00000000,
493 .end = 0x000FFFFF,
494 .flags = IORESOURCE_MEM,
495 },
496 {
497 .name = "ADSC_CPU_PCM_Buff",
498 .start = 0x00000000,
499 .end = 0x00009FFF,
500 .flags = IORESOURCE_MEM,
501 },
502 {
503 .name = "ADSC_AUX_Buff",
504 .start = 0x00000000,
505 .end = 0x00003FFF,
506 .flags = IORESOURCE_MEM,
507 },
508 {
509 .name = "ADSC_Main_Buff",
510 .start = 0x00000000,
511 .end = 0x00003FFF,
512 .flags = IORESOURCE_MEM,
513 },
514 /*
515 * STAVEM driver/STAPI
516 */
517 {
518 .name = "AVMEMPartition0",
519 .start = 0x00000000,
520 .end = 0x00480000 - 1, /* 4.5 MB total */
521 .flags = IORESOURCE_MEM,
522 },
523 /*
524 * GHW HAL Driver
525 */
526 {
527 .name = "GraphicsHeap",
528 .start = 0x22700000,
529 .end = 0x23500000 - 1, /* 14 MB total */
530 .flags = IORESOURCE_MEM,
531 },
532 /*
533 * multi com buffer area
534 */
535 {
536 .name = "MulticomSHM",
537 .start = 0x23700000,
538 .end = 0x23720000 - 1,
539 .flags = IORESOURCE_MEM,
540 },
541 /*
542 * DMA Ring buffer (don't need recording buffers)
543 */
544 {
545 .name = "BMM_Buffer",
546 .start = 0x00000000,
547 .end = 0x000AA000 - 1,
548 .flags = IORESOURCE_MEM,
549 },
550 /*
551 * Display bins buffer for unit0
552 */
553 {
554 .name = "DisplayBins0",
555 .start = 0x00000000,
556 .end = 0x00000FFF, /* 4 KB total */
557 .flags = IORESOURCE_MEM,
558 },
559 /*
560 * Display bins buffer for unit1
561 */
562 {
563 .name = "DisplayBins1",
564 .start = 0x00000000,
565 .end = 0x00000FFF, /* 4 KB total */
566 .flags = IORESOURCE_MEM,
567 },
568 /*
569 *
570 * AVFS: player HAL memory
571 *
572 *
573 */
574 {
575 .name = "AvfsDmaMem",
576 .start = 0x00000000,
577 .end = 0x002c4c00 - 1, /* 945K * 3 for playback */
578 .flags = IORESOURCE_MEM,
579 },
580 /*
581 * PMEM
582 */
583 {
584 .name = "DiagPersistentMemory",
585 .start = 0x00000000,
586 .end = 0x10000 - 1,
587 .flags = IORESOURCE_MEM,
588 },
589 /*
590 * Smartcard
591 */
592 {
593 .name = "SmartCardInfo",
594 .start = 0x00000000,
595 .end = 0x2800 - 1,
596 .flags = IORESOURCE_MEM,
597 },
598 /*
599 * NAND Flash
600 */
601 {
602 .name = "NandFlash",
603 .start = NAND_FLASH_BASE,
604 .end = NAND_FLASH_BASE + 0x400 - 1,
605 .flags = IORESOURCE_MEM,
606 },
607 /*
608 * Synopsys GMAC Memory Region
609 */
610 {
611 .name = "GMAC",
612 .start = 0x00000000,
613 .end = 0x00010000 - 1,
614 .flags = IORESOURCE_MEM,
615 },
616 /*
617 * Add other resources here
618 */
619 { },
620};
diff --git a/arch/mips/powertv/asic/prealloc-cronus.c b/arch/mips/powertv/asic/prealloc-cronus.c
new file mode 100644
index 000000000000..45a5c3ea718c
--- /dev/null
+++ b/arch/mips/powertv/asic/prealloc-cronus.c
@@ -0,0 +1,608 @@
1/*
2 * Memory pre-allocations for Cronus boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <asm/mach-powertv/asic.h>
26
27/*
28 * DVR_CAPABLE CRONUS RESOURCES
29 */
30struct resource dvr_cronus_resources[] __initdata =
31{
32 /*
33 *
34 * VIDEO1 / LX1
35 *
36 */
37 {
38 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
39 .start = 0x24000000,
40 .end = 0x241FFFFF, /* 2MiB */
41 .flags = IORESOURCE_MEM,
42 },
43 {
44 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
45 .start = 0x24200000,
46 .end = 0x24201FFF,
47 .flags = IORESOURCE_MEM,
48 },
49 {
50 .name = "MediaMemory1",
51 .start = 0x24202000,
52 .end = 0x25FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
53 .flags = IORESOURCE_MEM,
54 },
55 /*
56 *
57 * VIDEO2 / LX2
58 *
59 */
60 {
61 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
62 .start = 0x60000000,
63 .end = 0x601FFFFF, /* 2MiB */
64 .flags = IORESOURCE_IO,
65 },
66 {
67 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
68 .start = 0x60200000,
69 .end = 0x60201FFF,
70 .flags = IORESOURCE_IO,
71 },
72 {
73 .name = "MediaMemory2",
74 .start = 0x60202000,
75 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
76 .flags = IORESOURCE_IO,
77 },
78 /*
79 *
80 * Sysaudio Driver
81 *
82 * This driver requires:
83 *
84 * Arbitrary Based Buffers:
85 * DSP_Image_Buff - DSP code and data images (1MB)
86 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
87 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
88 * ADSC_Main_Buff - ADSC Main buffer (16KB)
89 *
90 */
91 {
92 .name = "DSP_Image_Buff",
93 .start = 0x00000000,
94 .end = 0x000FFFFF,
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .name = "ADSC_CPU_PCM_Buff",
99 .start = 0x00000000,
100 .end = 0x00009FFF,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .name = "ADSC_AUX_Buff",
105 .start = 0x00000000,
106 .end = 0x00003FFF,
107 .flags = IORESOURCE_MEM,
108 },
109 {
110 .name = "ADSC_Main_Buff",
111 .start = 0x00000000,
112 .end = 0x00003FFF,
113 .flags = IORESOURCE_MEM,
114 },
115 /*
116 *
117 * STAVEM driver/STAPI
118 *
119 * This driver requires:
120 *
121 * Arbitrary Based Buffers:
122 * This memory area is used for allocating buffers for Video decoding
123 * purposes. Allocation/De-allocation within this buffer is managed
124 * by the STAVMEM driver of the STAPI. They could be Decimated
125 * Picture Buffers, Intermediate Buffers, as deemed necessary for
126 * video decoding purposes, for any video decoders on Zeus.
127 *
128 */
129 {
130 .name = "AVMEMPartition0",
131 .start = 0x63580000,
132 .end = 0x64180000 - 1, /* 12 MB total */
133 .flags = IORESOURCE_IO,
134 },
135 /*
136 *
137 * DOCSIS Subsystem
138 *
139 * This driver requires:
140 *
141 * Arbitrary Based Buffers:
142 * Docsis -
143 *
144 */
145 {
146 .name = "Docsis",
147 .start = 0x62000000,
148 .end = 0x62700000 - 1, /* 7 MB total */
149 .flags = IORESOURCE_IO,
150 },
151 /*
152 *
153 * GHW HAL Driver
154 *
155 * This driver requires:
156 *
157 * Arbitrary Based Buffers:
158 * GraphicsHeap - PowerTV Graphics Heap
159 *
160 */
161 {
162 .name = "GraphicsHeap",
163 .start = 0x62700000,
164 .end = 0x63500000 - 1, /* 14 MB total */
165 .flags = IORESOURCE_IO,
166 },
167 /*
168 *
169 * multi com buffer area
170 *
171 * This driver requires:
172 *
173 * Arbitrary Based Buffers:
174 * Docsis -
175 *
176 */
177 {
178 .name = "MulticomSHM",
179 .start = 0x26000000,
180 .end = 0x26020000 - 1,
181 .flags = IORESOURCE_MEM,
182 },
183 /*
184 *
185 * DMA Ring buffer
186 *
187 * This driver requires:
188 *
189 * Arbitrary Based Buffers:
190 * Docsis -
191 *
192 */
193 {
194 .name = "BMM_Buffer",
195 .start = 0x00000000,
196 .end = 0x00280000 - 1,
197 .flags = IORESOURCE_MEM,
198 },
199 /*
200 *
201 * Display bins buffer for unit0
202 *
203 * This driver requires:
204 *
205 * Arbitrary Based Buffers:
206 * Display Bins for unit0
207 *
208 */
209 {
210 .name = "DisplayBins0",
211 .start = 0x00000000,
212 .end = 0x00000FFF, /* 4 KB total */
213 .flags = IORESOURCE_MEM,
214 },
215 /*
216 *
217 * Display bins buffer
218 *
219 * This driver requires:
220 *
221 * Arbitrary Based Buffers:
222 * Display Bins for unit1
223 *
224 */
225 {
226 .name = "DisplayBins1",
227 .start = 0x64AD4000,
228 .end = 0x64AD5000 - 1, /* 4 KB total */
229 .flags = IORESOURCE_IO,
230 },
231 /*
232 *
233 * ITFS
234 *
235 * This driver requires:
236 *
237 * Arbitrary Based Buffers:
238 * Docsis -
239 *
240 */
241 {
242 .name = "ITFS",
243 .start = 0x64180000,
244 /* 815,104 bytes each for 2 ITFS partitions. */
245 .end = 0x6430DFFF,
246 .flags = IORESOURCE_IO,
247 },
248 /*
249 *
250 * AVFS
251 *
252 * This driver requires:
253 *
254 * Arbitrary Based Buffers:
255 * Docsis -
256 *
257 */
258 {
259 .name = "AvfsDmaMem",
260 .start = 0x6430E000,
261 /* (945K * 8) = (128K *3) 5 playbacks / 3 server */
262 .end = 0x64AD0000 - 1,
263 .flags = IORESOURCE_IO,
264 },
265 {
266 .name = "AvfsFileSys",
267 .start = 0x64AD0000,
268 .end = 0x64AD1000 - 1, /* 4K */
269 .flags = IORESOURCE_IO,
270 },
271 /*
272 *
273 * PMEM
274 *
275 * This driver requires:
276 *
277 * Arbitrary Based Buffers:
278 * Persistent memory for diagnostics.
279 *
280 */
281 {
282 .name = "DiagPersistentMemory",
283 .start = 0x00000000,
284 .end = 0x10000 - 1,
285 .flags = IORESOURCE_MEM,
286 },
287 /*
288 *
289 * Smartcard
290 *
291 * This driver requires:
292 *
293 * Arbitrary Based Buffers:
294 * Read and write buffers for Internal/External cards
295 *
296 */
297 {
298 .name = "SmartCardInfo",
299 .start = 0x64AD1000,
300 .end = 0x64AD3800 - 1,
301 .flags = IORESOURCE_IO,
302 },
303 /*
304 *
305 * KAVNET
306 * NP Reset Vector - must be of the form xxCxxxxx
307 * NP Image - must be video bank 1
308 * NP IPC - must be video bank 2
309 */
310 {
311 .name = "NP_Reset_Vector",
312 .start = 0x27c00000,
313 .end = 0x27c01000 - 1,
314 .flags = IORESOURCE_MEM,
315 },
316 {
317 .name = "NP_Image",
318 .start = 0x27020000,
319 .end = 0x27060000 - 1,
320 .flags = IORESOURCE_MEM,
321 },
322 {
323 .name = "NP_IPC",
324 .start = 0x63500000,
325 .end = 0x63580000 - 1,
326 .flags = IORESOURCE_IO,
327 },
328 /*
329 * Add other resources here
330 */
331 { },
332};
333
334/*
335 * NON_DVR_CAPABLE CRONUS RESOURCES
336 */
337struct resource non_dvr_cronus_resources[] __initdata =
338{
339 /*
340 *
341 * VIDEO1 / LX1
342 *
343 */
344 {
345 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
346 .start = 0x24000000,
347 .end = 0x241FFFFF, /* 2MiB */
348 .flags = IORESOURCE_MEM,
349 },
350 {
351 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
352 .start = 0x24200000,
353 .end = 0x24201FFF,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .name = "MediaMemory1",
358 .start = 0x24202000,
359 .end = 0x25FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
360 .flags = IORESOURCE_MEM,
361 },
362 /*
363 *
364 * VIDEO2 / LX2
365 *
366 */
367 {
368 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
369 .start = 0x60000000,
370 .end = 0x601FFFFF, /* 2MiB */
371 .flags = IORESOURCE_IO,
372 },
373 {
374 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
375 .start = 0x60200000,
376 .end = 0x60201FFF,
377 .flags = IORESOURCE_IO,
378 },
379 {
380 .name = "MediaMemory2",
381 .start = 0x60202000,
382 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
383 .flags = IORESOURCE_IO,
384 },
385 /*
386 *
387 * Sysaudio Driver
388 *
389 * This driver requires:
390 *
391 * Arbitrary Based Buffers:
392 * DSP_Image_Buff - DSP code and data images (1MB)
393 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
394 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
395 * ADSC_Main_Buff - ADSC Main buffer (16KB)
396 *
397 */
398 {
399 .name = "DSP_Image_Buff",
400 .start = 0x00000000,
401 .end = 0x000FFFFF,
402 .flags = IORESOURCE_MEM,
403 },
404 {
405 .name = "ADSC_CPU_PCM_Buff",
406 .start = 0x00000000,
407 .end = 0x00009FFF,
408 .flags = IORESOURCE_MEM,
409 },
410 {
411 .name = "ADSC_AUX_Buff",
412 .start = 0x00000000,
413 .end = 0x00003FFF,
414 .flags = IORESOURCE_MEM,
415 },
416 {
417 .name = "ADSC_Main_Buff",
418 .start = 0x00000000,
419 .end = 0x00003FFF,
420 .flags = IORESOURCE_MEM,
421 },
422 /*
423 *
424 * STAVEM driver/STAPI
425 *
426 * This driver requires:
427 *
428 * Arbitrary Based Buffers:
429 * This memory area is used for allocating buffers for Video decoding
430 * purposes. Allocation/De-allocation within this buffer is managed
431 * by the STAVMEM driver of the STAPI. They could be Decimated
432 * Picture Buffers, Intermediate Buffers, as deemed necessary for
433 * video decoding purposes, for any video decoders on Zeus.
434 *
435 */
436 {
437 .name = "AVMEMPartition0",
438 .start = 0x63580000,
439 .end = 0x64180000 - 1, /* 12 MB total */
440 .flags = IORESOURCE_IO,
441 },
442 /*
443 *
444 * DOCSIS Subsystem
445 *
446 * This driver requires:
447 *
448 * Arbitrary Based Buffers:
449 * Docsis -
450 *
451 */
452 {
453 .name = "Docsis",
454 .start = 0x62000000,
455 .end = 0x62700000 - 1, /* 7 MB total */
456 .flags = IORESOURCE_IO,
457 },
458 /*
459 *
460 * GHW HAL Driver
461 *
462 * This driver requires:
463 *
464 * Arbitrary Based Buffers:
465 * GraphicsHeap - PowerTV Graphics Heap
466 *
467 */
468 {
469 .name = "GraphicsHeap",
470 .start = 0x62700000,
471 .end = 0x63500000 - 1, /* 14 MB total */
472 .flags = IORESOURCE_IO,
473 },
474 /*
475 *
476 * multi com buffer area
477 *
478 * This driver requires:
479 *
480 * Arbitrary Based Buffers:
481 * Docsis -
482 *
483 */
484 {
485 .name = "MulticomSHM",
486 .start = 0x26000000,
487 .end = 0x26020000 - 1,
488 .flags = IORESOURCE_MEM,
489 },
490 /*
491 *
492 * DMA Ring buffer
493 *
494 * This driver requires:
495 *
496 * Arbitrary Based Buffers:
497 * Docsis -
498 *
499 */
500 {
501 .name = "BMM_Buffer",
502 .start = 0x00000000,
503 .end = 0x000AA000 - 1,
504 .flags = IORESOURCE_MEM,
505 },
506 /*
507 *
508 * Display bins buffer for unit0
509 *
510 * This driver requires:
511 *
512 * Arbitrary Based Buffers:
513 * Display Bins for unit0
514 *
515 */
516 {
517 .name = "DisplayBins0",
518 .start = 0x00000000,
519 .end = 0x00000FFF, /* 4 KB total */
520 .flags = IORESOURCE_MEM,
521 },
522 /*
523 *
524 * Display bins buffer
525 *
526 * This driver requires:
527 *
528 * Arbitrary Based Buffers:
529 * Display Bins for unit1
530 *
531 */
532 {
533 .name = "DisplayBins1",
534 .start = 0x64AD4000,
535 .end = 0x64AD5000 - 1, /* 4 KB total */
536 .flags = IORESOURCE_IO,
537 },
538 /*
539 *
540 * AVFS: player HAL memory
541 *
542 *
543 */
544 {
545 .name = "AvfsDmaMem",
546 .start = 0x6430E000,
547 .end = 0x645D2C00 - 1, /* 945K * 3 for playback */
548 .flags = IORESOURCE_IO,
549 },
550 /*
551 *
552 * PMEM
553 *
554 * This driver requires:
555 *
556 * Arbitrary Based Buffers:
557 * Persistent memory for diagnostics.
558 *
559 */
560 {
561 .name = "DiagPersistentMemory",
562 .start = 0x00000000,
563 .end = 0x10000 - 1,
564 .flags = IORESOURCE_MEM,
565 },
566 /*
567 *
568 * Smartcard
569 *
570 * This driver requires:
571 *
572 * Arbitrary Based Buffers:
573 * Read and write buffers for Internal/External cards
574 *
575 */
576 {
577 .name = "SmartCardInfo",
578 .start = 0x64AD1000,
579 .end = 0x64AD3800 - 1,
580 .flags = IORESOURCE_IO,
581 },
582 /*
583 *
584 * KAVNET
585 * NP Reset Vector - must be of the form xxCxxxxx
586 * NP Image - must be video bank 1
587 * NP IPC - must be video bank 2
588 */
589 {
590 .name = "NP_Reset_Vector",
591 .start = 0x27c00000,
592 .end = 0x27c01000 - 1,
593 .flags = IORESOURCE_MEM,
594 },
595 {
596 .name = "NP_Image",
597 .start = 0x27020000,
598 .end = 0x27060000 - 1,
599 .flags = IORESOURCE_MEM,
600 },
601 {
602 .name = "NP_IPC",
603 .start = 0x63500000,
604 .end = 0x63580000 - 1,
605 .flags = IORESOURCE_IO,
606 },
607 { },
608};
diff --git a/arch/mips/powertv/asic/prealloc-cronuslite.c b/arch/mips/powertv/asic/prealloc-cronuslite.c
new file mode 100644
index 000000000000..23a905613c04
--- /dev/null
+++ b/arch/mips/powertv/asic/prealloc-cronuslite.c
@@ -0,0 +1,290 @@
1/*
2 * Memory pre-allocations for Cronus Lite boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <asm/mach-powertv/asic.h>
26
27/*
28 * NON_DVR_CAPABLE CRONUSLITE RESOURCES
29 */
30struct resource non_dvr_cronuslite_resources[] __initdata =
31{
32 /*
33 *
34 * VIDEO2 / LX2
35 *
36 */
37 {
38 .name = "ST231aImage", /* Delta-Mu 2 image and ram */
39 .start = 0x60000000,
40 .end = 0x601FFFFF, /* 2MiB */
41 .flags = IORESOURCE_IO,
42 },
43 {
44 .name = "ST231aMonitor", /* 8KiB block ST231b monitor */
45 .start = 0x60200000,
46 .end = 0x60201FFF,
47 .flags = IORESOURCE_IO,
48 },
49 {
50 .name = "MediaMemory1",
51 .start = 0x60202000,
52 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
53 .flags = IORESOURCE_IO,
54 },
55 /*
56 *
57 * Sysaudio Driver
58 *
59 * This driver requires:
60 *
61 * Arbitrary Based Buffers:
62 * DSP_Image_Buff - DSP code and data images (1MB)
63 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
64 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
65 * ADSC_Main_Buff - ADSC Main buffer (16KB)
66 *
67 */
68 {
69 .name = "DSP_Image_Buff",
70 .start = 0x00000000,
71 .end = 0x000FFFFF,
72 .flags = IORESOURCE_MEM,
73 },
74 {
75 .name = "ADSC_CPU_PCM_Buff",
76 .start = 0x00000000,
77 .end = 0x00009FFF,
78 .flags = IORESOURCE_MEM,
79 },
80 {
81 .name = "ADSC_AUX_Buff",
82 .start = 0x00000000,
83 .end = 0x00003FFF,
84 .flags = IORESOURCE_MEM,
85 },
86 {
87 .name = "ADSC_Main_Buff",
88 .start = 0x00000000,
89 .end = 0x00003FFF,
90 .flags = IORESOURCE_MEM,
91 },
92 /*
93 *
94 * STAVEM driver/STAPI
95 *
96 * This driver requires:
97 *
98 * Arbitrary Based Buffers:
99 * This memory area is used for allocating buffers for Video decoding
100 * purposes. Allocation/De-allocation within this buffer is managed
101 * by the STAVMEM driver of the STAPI. They could be Decimated
102 * Picture Buffers, Intermediate Buffers, as deemed necessary for
103 * video decoding purposes, for any video decoders on Zeus.
104 *
105 */
106 {
107 .name = "AVMEMPartition0",
108 .start = 0x63580000,
109 .end = 0x63B80000 - 1, /* 6 MB total */
110 .flags = IORESOURCE_IO,
111 },
112 /*
113 *
114 * DOCSIS Subsystem
115 *
116 * This driver requires:
117 *
118 * Arbitrary Based Buffers:
119 * Docsis -
120 *
121 */
122 {
123 .name = "Docsis",
124 .start = 0x62000000,
125 .end = 0x62700000 - 1, /* 7 MB total */
126 .flags = IORESOURCE_IO,
127 },
128 /*
129 *
130 * GHW HAL Driver
131 *
132 * This driver requires:
133 *
134 * Arbitrary Based Buffers:
135 * GraphicsHeap - PowerTV Graphics Heap
136 *
137 */
138 {
139 .name = "GraphicsHeap",
140 .start = 0x62700000,
141 .end = 0x63500000 - 1, /* 14 MB total */
142 .flags = IORESOURCE_IO,
143 },
144 /*
145 *
146 * multi com buffer area
147 *
148 * This driver requires:
149 *
150 * Arbitrary Based Buffers:
151 * Docsis -
152 *
153 */
154 {
155 .name = "MulticomSHM",
156 .start = 0x26000000,
157 .end = 0x26020000 - 1,
158 .flags = IORESOURCE_MEM,
159 },
160 /*
161 *
162 * DMA Ring buffer
163 *
164 * This driver requires:
165 *
166 * Arbitrary Based Buffers:
167 * Docsis -
168 *
169 */
170 {
171 .name = "BMM_Buffer",
172 .start = 0x00000000,
173 .end = 0x000AA000 - 1,
174 .flags = IORESOURCE_MEM,
175 },
176 /*
177 *
178 * Display bins buffer for unit0
179 *
180 * This driver requires:
181 *
182 * Arbitrary Based Buffers:
183 * Display Bins for unit0
184 *
185 */
186 {
187 .name = "DisplayBins0",
188 .start = 0x00000000,
189 .end = 0x00000FFF, /* 4 KB total */
190 .flags = IORESOURCE_MEM,
191 },
192 /*
193 *
194 * Display bins buffer
195 *
196 * This driver requires:
197 *
198 * Arbitrary Based Buffers:
199 * Display Bins for unit1
200 *
201 */
202 {
203 .name = "DisplayBins1",
204 .start = 0x63B83000,
205 .end = 0x63B84000 - 1, /* 4 KB total */
206 .flags = IORESOURCE_IO,
207 },
208 /*
209 *
210 * AVFS: player HAL memory
211 *
212 *
213 */
214 {
215 .name = "AvfsDmaMem",
216 .start = 0x63B84000,
217 .end = 0x63E48C00 - 1, /* 945K * 3 for playback */
218 .flags = IORESOURCE_IO,
219 },
220 /*
221 *
222 * PMEM
223 *
224 * This driver requires:
225 *
226 * Arbitrary Based Buffers:
227 * Persistent memory for diagnostics.
228 *
229 */
230 {
231 .name = "DiagPersistentMemory",
232 .start = 0x00000000,
233 .end = 0x10000 - 1,
234 .flags = IORESOURCE_MEM,
235 },
236 /*
237 *
238 * Smartcard
239 *
240 * This driver requires:
241 *
242 * Arbitrary Based Buffers:
243 * Read and write buffers for Internal/External cards
244 *
245 */
246 {
247 .name = "SmartCardInfo",
248 .start = 0x63B80000,
249 .end = 0x63B82800 - 1,
250 .flags = IORESOURCE_IO,
251 },
252 /*
253 *
254 * KAVNET
255 * NP Reset Vector - must be of the form xxCxxxxx
256 * NP Image - must be video bank 1
257 * NP IPC - must be video bank 2
258 */
259 {
260 .name = "NP_Reset_Vector",
261 .start = 0x27c00000,
262 .end = 0x27c01000 - 1,
263 .flags = IORESOURCE_MEM,
264 },
265 {
266 .name = "NP_Image",
267 .start = 0x27020000,
268 .end = 0x27060000 - 1,
269 .flags = IORESOURCE_MEM,
270 },
271 {
272 .name = "NP_IPC",
273 .start = 0x63500000,
274 .end = 0x63580000 - 1,
275 .flags = IORESOURCE_IO,
276 },
277 /*
278 * NAND Flash
279 */
280 {
281 .name = "NandFlash",
282 .start = NAND_FLASH_BASE,
283 .end = NAND_FLASH_BASE + 0x400 - 1,
284 .flags = IORESOURCE_IO,
285 },
286 /*
287 * Add other resources here
288 */
289 { },
290};
diff --git a/arch/mips/powertv/asic/prealloc-zeus.c b/arch/mips/powertv/asic/prealloc-zeus.c
new file mode 100644
index 000000000000..018d4514dbe3
--- /dev/null
+++ b/arch/mips/powertv/asic/prealloc-zeus.c
@@ -0,0 +1,459 @@
1/*
2 * Memory pre-allocations for Zeus boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: Ken Eppinett
21 * David Schleef <ds@schleef.org>
22 */
23
24#include <linux/init.h>
25#include <asm/mach-powertv/asic.h>
26
27/*
28 * DVR_CAPABLE RESOURCES
29 */
30struct resource dvr_zeus_resources[] __initdata =
31{
32 /*
33 *
34 * VIDEO1 / LX1
35 *
36 */
37 {
38 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
39 .start = 0x20000000,
40 .end = 0x201FFFFF, /* 2MiB */
41 .flags = IORESOURCE_IO,
42 },
43 {
44 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
45 .start = 0x20200000,
46 .end = 0x20201FFF,
47 .flags = IORESOURCE_IO,
48 },
49 {
50 .name = "MediaMemory1",
51 .start = 0x20202000,
52 .end = 0x21FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
53 .flags = IORESOURCE_IO,
54 },
55 /*
56 *
57 * VIDEO2 / LX2
58 *
59 */
60 {
61 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
62 .start = 0x30000000,
63 .end = 0x301FFFFF, /* 2MiB */
64 .flags = IORESOURCE_IO,
65 },
66 {
67 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
68 .start = 0x30200000,
69 .end = 0x30201FFF,
70 .flags = IORESOURCE_IO,
71 },
72 {
73 .name = "MediaMemory2",
74 .start = 0x30202000,
75 .end = 0x31FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
76 .flags = IORESOURCE_IO,
77 },
78 /*
79 *
80 * Sysaudio Driver
81 *
82 * This driver requires:
83 *
84 * Arbitrary Based Buffers:
85 * DSP_Image_Buff - DSP code and data images (1MB)
86 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
87 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
88 * ADSC_Main_Buff - ADSC Main buffer (16KB)
89 *
90 */
91 {
92 .name = "DSP_Image_Buff",
93 .start = 0x00000000,
94 .end = 0x000FFFFF,
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .name = "ADSC_CPU_PCM_Buff",
99 .start = 0x00000000,
100 .end = 0x00009FFF,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .name = "ADSC_AUX_Buff",
105 .start = 0x00000000,
106 .end = 0x00003FFF,
107 .flags = IORESOURCE_MEM,
108 },
109 {
110 .name = "ADSC_Main_Buff",
111 .start = 0x00000000,
112 .end = 0x00003FFF,
113 .flags = IORESOURCE_MEM,
114 },
115 /*
116 *
117 * STAVEM driver/STAPI
118 *
119 * This driver requires:
120 *
121 * Arbitrary Based Buffers:
122 * This memory area is used for allocating buffers for Video decoding
123 * purposes. Allocation/De-allocation within this buffer is managed
124 * by the STAVMEM driver of the STAPI. They could be Decimated
125 * Picture Buffers, Intermediate Buffers, as deemed necessary for
126 * video decoding purposes, for any video decoders on Zeus.
127 *
128 */
129 {
130 .name = "AVMEMPartition0",
131 .start = 0x00000000,
132 .end = 0x00c00000 - 1, /* 12 MB total */
133 .flags = IORESOURCE_MEM,
134 },
135 /*
136 *
137 * DOCSIS Subsystem
138 *
139 * This driver requires:
140 *
141 * Arbitrary Based Buffers:
142 * Docsis -
143 *
144 */
145 {
146 .name = "Docsis",
147 .start = 0x40100000,
148 .end = 0x407fffff,
149 .flags = IORESOURCE_MEM,
150 },
151 /*
152 *
153 * GHW HAL Driver
154 *
155 * This driver requires:
156 *
157 * Arbitrary Based Buffers:
158 * GraphicsHeap - PowerTV Graphics Heap
159 *
160 */
161 {
162 .name = "GraphicsHeap",
163 .start = 0x46900000,
164 .end = 0x47700000 - 1, /* 14 MB total */
165 .flags = IORESOURCE_MEM,
166 },
167 /*
168 *
169 * multi com buffer area
170 *
171 * This driver requires:
172 *
173 * Arbitrary Based Buffers:
174 * Docsis -
175 *
176 */
177 {
178 .name = "MulticomSHM",
179 .start = 0x47900000,
180 .end = 0x47920000 - 1,
181 .flags = IORESOURCE_MEM,
182 },
183 /*
184 *
185 * DMA Ring buffer
186 *
187 * This driver requires:
188 *
189 * Arbitrary Based Buffers:
190 * Docsis -
191 *
192 */
193 {
194 .name = "BMM_Buffer",
195 .start = 0x00000000,
196 .end = 0x00280000 - 1,
197 .flags = IORESOURCE_MEM,
198 },
199 /*
200 *
201 * Display bins buffer for unit0
202 *
203 * This driver requires:
204 *
205 * Arbitrary Based Buffers:
206 * Display Bins for unit0
207 *
208 */
209 {
210 .name = "DisplayBins0",
211 .start = 0x00000000,
212 .end = 0x00000FFF, /* 4 KB total */
213 .flags = IORESOURCE_MEM,
214 },
215 /*
216 *
217 * Display bins buffer
218 *
219 * This driver requires:
220 *
221 * Arbitrary Based Buffers:
222 * Display Bins for unit1
223 *
224 */
225 {
226 .name = "DisplayBins1",
227 .start = 0x00000000,
228 .end = 0x00000FFF, /* 4 KB total */
229 .flags = IORESOURCE_MEM,
230 },
231 /*
232 *
233 * ITFS
234 *
235 * This driver requires:
236 *
237 * Arbitrary Based Buffers:
238 * Docsis -
239 *
240 */
241 {
242 .name = "ITFS",
243 .start = 0x00000000,
244 /* 815,104 bytes each for 2 ITFS partitions. */
245 .end = 0x0018DFFF,
246 .flags = IORESOURCE_MEM,
247 },
248 /*
249 *
250 * AVFS
251 *
252 * This driver requires:
253 *
254 * Arbitrary Based Buffers:
255 * Docsis -
256 *
257 */
258 {
259 .name = "AvfsDmaMem",
260 .start = 0x00000000,
261 /* (945K * 8) = (128K * 3) 5 playbacks / 3 server */
262 .end = 0x007c2000 - 1,
263 .flags = IORESOURCE_MEM,
264 },
265 {
266 .name = "AvfsFileSys",
267 .start = 0x00000000,
268 .end = 0x00001000 - 1, /* 4K */
269 .flags = IORESOURCE_MEM,
270 },
271 /*
272 *
273 * PMEM
274 *
275 * This driver requires:
276 *
277 * Arbitrary Based Buffers:
278 * Persistent memory for diagnostics.
279 *
280 */
281 {
282 .name = "DiagPersistentMemory",
283 .start = 0x00000000,
284 .end = 0x10000 - 1,
285 .flags = IORESOURCE_MEM,
286 },
287 /*
288 *
289 * Smartcard
290 *
291 * This driver requires:
292 *
293 * Arbitrary Based Buffers:
294 * Read and write buffers for Internal/External cards
295 *
296 */
297 {
298 .name = "SmartCardInfo",
299 .start = 0x00000000,
300 .end = 0x2800 - 1,
301 .flags = IORESOURCE_MEM,
302 },
303 /*
304 * Add other resources here
305 */
306 { },
307};
308
309/*
310 * NON_DVR_CAPABLE ZEUS RESOURCES
311 */
312struct resource non_dvr_zeus_resources[] __initdata =
313{
314 /*
315 * VIDEO1 / LX1
316 */
317 {
318 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
319 .start = 0x20000000,
320 .end = 0x201FFFFF, /* 2MiB */
321 .flags = IORESOURCE_IO,
322 },
323 {
324 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
325 .start = 0x20200000,
326 .end = 0x20201FFF,
327 .flags = IORESOURCE_IO,
328 },
329 {
330 .name = "MediaMemory1",
331 .start = 0x20202000,
332 .end = 0x21FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
333 .flags = IORESOURCE_IO,
334 },
335 /*
336 * Sysaudio Driver
337 */
338 {
339 .name = "DSP_Image_Buff",
340 .start = 0x00000000,
341 .end = 0x000FFFFF,
342 .flags = IORESOURCE_MEM,
343 },
344 {
345 .name = "ADSC_CPU_PCM_Buff",
346 .start = 0x00000000,
347 .end = 0x00009FFF,
348 .flags = IORESOURCE_MEM,
349 },
350 {
351 .name = "ADSC_AUX_Buff",
352 .start = 0x00000000,
353 .end = 0x00003FFF,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .name = "ADSC_Main_Buff",
358 .start = 0x00000000,
359 .end = 0x00003FFF,
360 .flags = IORESOURCE_MEM,
361 },
362 /*
363 * STAVEM driver/STAPI
364 */
365 {
366 .name = "AVMEMPartition0",
367 .start = 0x00000000,
368 .end = 0x00600000 - 1, /* 6 MB total */
369 .flags = IORESOURCE_MEM,
370 },
371 /*
372 * DOCSIS Subsystem
373 */
374 {
375 .name = "Docsis",
376 .start = 0x40100000,
377 .end = 0x407fffff,
378 .flags = IORESOURCE_MEM,
379 },
380 /*
381 * GHW HAL Driver
382 */
383 {
384 .name = "GraphicsHeap",
385 .start = 0x46900000,
386 .end = 0x47700000 - 1, /* 14 MB total */
387 .flags = IORESOURCE_MEM,
388 },
389 /*
390 * multi com buffer area
391 */
392 {
393 .name = "MulticomSHM",
394 .start = 0x47900000,
395 .end = 0x47920000 - 1,
396 .flags = IORESOURCE_MEM,
397 },
398 /*
399 * DMA Ring buffer
400 */
401 {
402 .name = "BMM_Buffer",
403 .start = 0x00000000,
404 .end = 0x00280000 - 1,
405 .flags = IORESOURCE_MEM,
406 },
407 /*
408 * Display bins buffer for unit0
409 */
410 {
411 .name = "DisplayBins0",
412 .start = 0x00000000,
413 .end = 0x00000FFF, /* 4 KB total */
414 .flags = IORESOURCE_MEM,
415 },
416 /*
417 *
418 * AVFS: player HAL memory
419 *
420 *
421 */
422 {
423 .name = "AvfsDmaMem",
424 .start = 0x00000000,
425 .end = 0x002c4c00 - 1, /* 945K * 3 for playback */
426 .flags = IORESOURCE_MEM,
427 },
428 /*
429 * PMEM
430 */
431 {
432 .name = "DiagPersistentMemory",
433 .start = 0x00000000,
434 .end = 0x10000 - 1,
435 .flags = IORESOURCE_MEM,
436 },
437 /*
438 * Smartcard
439 */
440 {
441 .name = "SmartCardInfo",
442 .start = 0x00000000,
443 .end = 0x2800 - 1,
444 .flags = IORESOURCE_MEM,
445 },
446 /*
447 * NAND Flash
448 */
449 {
450 .name = "NandFlash",
451 .start = NAND_FLASH_BASE,
452 .end = NAND_FLASH_BASE + 0x400 - 1,
453 .flags = IORESOURCE_IO,
454 },
455 /*
456 * Add other resources here
457 */
458 { },
459};
diff --git a/arch/mips/powertv/init.c b/arch/mips/powertv/init.c
new file mode 100644
index 000000000000..0afe227f1d0a
--- /dev/null
+++ b/arch/mips/powertv/init.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 1999, 2000, 2004, 2005 MIPS Technologies, Inc.
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Portions copyright (C) 2009 Cisco Systems, Inc.
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 *
21 * PROM library initialisation code.
22 */
23#include <linux/init.h>
24#include <linux/string.h>
25#include <linux/kernel.h>
26
27#include <asm/bootinfo.h>
28#include <linux/io.h>
29#include <asm/system.h>
30#include <asm/cacheflush.h>
31#include <asm/traps.h>
32
33#include <asm/mips-boards/prom.h>
34#include <asm/mips-boards/generic.h>
35#include <asm/mach-powertv/asic.h>
36
37static int *_prom_envp;
38unsigned long _prom_memsize;
39
40/*
41 * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
42 * This macro take care of sign extension, if running in 64-bit mode.
43 */
44#define prom_envp(index) ((char *)(long)_prom_envp[(index)])
45
46char *prom_getenv(char *envname)
47{
48 char *result = NULL;
49
50 if (_prom_envp != NULL) {
51 /*
52 * Return a pointer to the given environment variable.
53 * In 64-bit mode: we're using 64-bit pointers, but all pointers
54 * in the PROM structures are only 32-bit, so we need some
55 * workarounds, if we are running in 64-bit mode.
56 */
57 int i, index = 0;
58
59 i = strlen(envname);
60
61 while (prom_envp(index)) {
62 if (strncmp(envname, prom_envp(index), i) == 0) {
63 result = prom_envp(index + 1);
64 break;
65 }
66 index += 2;
67 }
68 }
69
70 return result;
71}
72
73/* TODO: Verify on linux-mips mailing list that the following two */
74/* functions are correct */
75/* TODO: Copy NMI and EJTAG exception vectors to memory from the */
76/* BootROM exception vectors. Flush their cache entries. test it. */
77
78static void __init mips_nmi_setup(void)
79{
80 void *base;
81#if defined(CONFIG_CPU_MIPS32_R1)
82 base = cpu_has_veic ?
83 (void *)(CAC_BASE + 0xa80) :
84 (void *)(CAC_BASE + 0x380);
85#elif defined(CONFIG_CPU_MIPS32_R2)
86 base = (void *)0xbfc00000;
87#else
88#error NMI exception handler address not defined
89#endif
90}
91
92static void __init mips_ejtag_setup(void)
93{
94 void *base;
95
96#if defined(CONFIG_CPU_MIPS32_R1)
97 base = cpu_has_veic ?
98 (void *)(CAC_BASE + 0xa00) :
99 (void *)(CAC_BASE + 0x300);
100#elif defined(CONFIG_CPU_MIPS32_R2)
101 base = (void *)0xbfc00480;
102#else
103#error EJTAG exception handler address not defined
104#endif
105}
106
107void __init prom_init(void)
108{
109 int prom_argc;
110 char *prom_argv;
111
112 prom_argc = fw_arg0;
113 prom_argv = (char *) fw_arg1;
114 _prom_envp = (int *) fw_arg2;
115 _prom_memsize = (unsigned long) fw_arg3;
116
117 board_nmi_handler_setup = mips_nmi_setup;
118 board_ejtag_handler_setup = mips_ejtag_setup;
119
120 if (prom_argc == 1)
121 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE);
122
123 configure_platform();
124 prom_meminit();
125
126#ifndef CONFIG_BOOTLOADER_DRIVER
127 pr_info("\nBootloader driver isn't loaded...\n");
128#endif
129}
diff --git a/arch/mips/powertv/init.h b/arch/mips/powertv/init.h
new file mode 100644
index 000000000000..b194c34ca966
--- /dev/null
+++ b/arch/mips/powertv/init.h
@@ -0,0 +1,26 @@
1/*
2 * Definitions from powertv init.c file
3 *
4 * Copyright (C) 2009 Cisco Systems, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#ifndef _POWERTV_INIT_H
24#define _POWERTV_INIT_H
25extern unsigned long _prom_memsize;
26#endif
diff --git a/arch/mips/powertv/memory.c b/arch/mips/powertv/memory.c
new file mode 100644
index 000000000000..f49eb3d0358b
--- /dev/null
+++ b/arch/mips/powertv/memory.c
@@ -0,0 +1,181 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * Apparently originally from arch/mips/malta-memory.c. Modified to work
20 * with the PowerTV bootloader.
21 */
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/bootmem.h>
25#include <linux/pfn.h>
26#include <linux/string.h>
27
28#include <asm/bootinfo.h>
29#include <asm/page.h>
30#include <asm/sections.h>
31
32#include <asm/mips-boards/prom.h>
33
34#include "init.h"
35
36/* Memory constants */
37#define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */
38#define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
39#define DEFAULT_MEMSIZE MEBIBYTE(256) /* If no memsize provided */
40#define LOW_MEM_MAX MEBIBYTE(252) /* Max usable low mem */
41#define RES_BOOTLDR_MEMSIZE MEBIBYTE(1) /* Memory reserved for bldr */
42#define BOOT_MEM_SIZE KIBIBYTE(256) /* Memory reserved for bldr */
43#define PHYS_MEM_START 0x10000000 /* Start of physical memory */
44
45char __initdata cmdline[COMMAND_LINE_SIZE];
46
47void __init prom_meminit(void)
48{
49 char *memsize_str;
50 unsigned long memsize = 0;
51 unsigned int physend;
52 char *ptr;
53 int low_mem;
54 int high_mem;
55
56 /* Check the command line first for a memsize directive */
57 strcpy(cmdline, arcs_cmdline);
58 ptr = strstr(cmdline, "memsize=");
59 if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
60 ptr = strstr(ptr, " memsize=");
61
62 if (ptr) {
63 memsize = memparse(ptr + 8, &ptr);
64 } else {
65 /* otherwise look in the environment */
66 memsize_str = prom_getenv("memsize");
67
68 if (memsize_str != NULL) {
69 pr_info("prom memsize = %s\n", memsize_str);
70 memsize = simple_strtol(memsize_str, NULL, 0);
71 }
72
73 if (memsize == 0) {
74 if (_prom_memsize != 0) {
75 memsize = _prom_memsize;
76 pr_info("_prom_memsize = 0x%lx\n", memsize);
77 /* add in memory that the bootloader doesn't
78 * report */
79 memsize += BOOT_MEM_SIZE;
80 } else {
81 memsize = DEFAULT_MEMSIZE;
82 pr_info("Memsize not passed by bootloader, "
83 "defaulting to 0x%lx\n", memsize);
84 }
85 }
86 }
87
88 physend = PFN_ALIGN(&_end) - 0x80000000;
89 if (memsize > LOW_MEM_MAX) {
90 low_mem = LOW_MEM_MAX;
91 high_mem = memsize - low_mem;
92 } else {
93 low_mem = memsize;
94 high_mem = 0;
95 }
96
97/*
98 * TODO: We will use the hard code for memory configuration until
99 * the bootloader releases their device tree to us.
100 */
101 /*
102 * Add the memory reserved for use by the bootloader to the
103 * memory map.
104 */
105 add_memory_region(PHYS_MEM_START, RES_BOOTLDR_MEMSIZE,
106 BOOT_MEM_RESERVED);
107#ifdef CONFIG_HIGHMEM_256_128
108 /*
109 * Add memory in low for general use by the kernel and its friends
110 * (like drivers, applications, etc).
111 */
112 add_memory_region(PHYS_MEM_START + RES_BOOTLDR_MEMSIZE,
113 LOW_MEM_MAX - RES_BOOTLDR_MEMSIZE, BOOT_MEM_RAM);
114 /*
115 * Add the memory reserved for reset vector.
116 */
117 add_memory_region(0x1fc00000, MEBIBYTE(4), BOOT_MEM_RESERVED);
118 /*
119 * Add the memory reserved.
120 */
121 add_memory_region(0x20000000, MEBIBYTE(1024 + 75), BOOT_MEM_RESERVED);
122 /*
123 * Add memory in high for general use by the kernel and its friends
124 * (like drivers, applications, etc).
125 *
126 * 75MB is reserved for devices which are using the memory in high.
127 */
128 add_memory_region(0x60000000 + MEBIBYTE(75), MEBIBYTE(128 - 75),
129 BOOT_MEM_RAM);
130#elif defined CONFIG_HIGHMEM_128_128
131 /*
132 * Add memory in low for general use by the kernel and its friends
133 * (like drivers, applications, etc).
134 */
135 add_memory_region(PHYS_MEM_START + RES_BOOTLDR_MEMSIZE,
136 MEBIBYTE(128) - RES_BOOTLDR_MEMSIZE, BOOT_MEM_RAM);
137 /*
138 * Add the memory reserved.
139 */
140 add_memory_region(PHYS_MEM_START + MEBIBYTE(128),
141 MEBIBYTE(128 + 1024 + 75), BOOT_MEM_RESERVED);
142 /*
143 * Add memory in high for general use by the kernel and its friends
144 * (like drivers, applications, etc).
145 *
146 * 75MB is reserved for devices which are using the memory in high.
147 */
148 add_memory_region(0x60000000 + MEBIBYTE(75), MEBIBYTE(128 - 75),
149 BOOT_MEM_RAM);
150#else
151 /* Add low memory regions for either:
152 * - no-highmemory configuration case -OR-
153 * - highmemory "HIGHMEM_LOWBANK_ONLY" case
154 */
155 /*
156 * Add memory for general use by the kernel and its friends
157 * (like drivers, applications, etc).
158 */
159 add_memory_region(PHYS_MEM_START + RES_BOOTLDR_MEMSIZE,
160 low_mem - RES_BOOTLDR_MEMSIZE, BOOT_MEM_RAM);
161 /*
162 * Add the memory reserved for reset vector.
163 */
164 add_memory_region(0x1fc00000, MEBIBYTE(4), BOOT_MEM_RESERVED);
165#endif
166}
167
168void __init prom_free_prom_memory(void)
169{
170 unsigned long addr;
171 int i;
172
173 for (i = 0; i < boot_mem_map.nr_map; i++) {
174 if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
175 continue;
176
177 addr = boot_mem_map.map[i].addr;
178 free_init_pages("prom memory",
179 addr, addr + boot_mem_map.map[i].size);
180 }
181}
diff --git a/arch/mips/powertv/pci/Makefile b/arch/mips/powertv/pci/Makefile
new file mode 100644
index 000000000000..f5c62462fc9d
--- /dev/null
+++ b/arch/mips/powertv/pci/Makefile
@@ -0,0 +1,21 @@
1#
2# Copyright (C) 2009 Scientific-Atlanta, Inc.
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19obj-$(CONFIG_PCI) += fixup-powertv.o
20
21EXTRA_CFLAGS += -Wall -Werror
diff --git a/arch/mips/powertv/pci/fixup-powertv.c b/arch/mips/powertv/pci/fixup-powertv.c
new file mode 100644
index 000000000000..726bc2e824b3
--- /dev/null
+++ b/arch/mips/powertv/pci/fixup-powertv.c
@@ -0,0 +1,36 @@
1#include <linux/init.h>
2#include <linux/pci.h>
3#include <asm/mach-powertv/interrupts.h>
4#include "powertv-pci.h"
5
6int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
7{
8 return asic_pcie_map_irq(dev, slot, pin);
9}
10
11/* Do platform specific device initialization at pci_enable_device() time */
12int pcibios_plat_dev_init(struct pci_dev *dev)
13{
14 return 0;
15}
16
17/*
18 * asic_pcie_map_irq
19 *
20 * Parameters:
21 * *dev - pointer to a pci_dev structure (not used)
22 * slot - slot number (not used)
23 * pin - pin number (not used)
24 *
25 * Return Value:
26 * Returns: IRQ number (always the PCI Express IRQ number)
27 *
28 * Description:
29 * asic_pcie_map_irq will return the IRQ number of the PCI Express interrupt.
30 *
31 */
32int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
33{
34 return irq_pciexp;
35}
36EXPORT_SYMBOL(asic_pcie_map_irq);
diff --git a/arch/mips/powertv/pci/powertv-pci.h b/arch/mips/powertv/pci/powertv-pci.h
new file mode 100644
index 000000000000..1b5886bbd759
--- /dev/null
+++ b/arch/mips/powertv/pci/powertv-pci.h
@@ -0,0 +1,31 @@
1/*
2 * powertv-pci.c
3 *
4 * Copyright (C) 2009 Cisco Systems, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20/*
21 * Local definitions for the powertv PCI code
22 */
23
24#ifndef _POWERTV_PCI_POWERTV_PCI_H_
25#define _POWERTV_PCI_POWERTV_PCI_H_
26extern int asic_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
27extern int asic_pcie_init(void);
28extern int asic_pcie_init(void);
29
30extern int log_level;
31#endif
diff --git a/arch/mips/powertv/powertv-clock.h b/arch/mips/powertv/powertv-clock.h
new file mode 100644
index 000000000000..d94c54311485
--- /dev/null
+++ b/arch/mips/powertv/powertv-clock.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2009 Cisco Systems, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * Author: David VomLehn
19 */
20
21#ifndef _POWERTV_POWERTV_CLOCK_H
22#define _POWERTV_POWERTV_CLOCK_H
23extern int powertv_clockevent_init(void);
24extern void powertv_clocksource_init(void);
25extern unsigned int mips_get_pll_freq(void);
26#endif
diff --git a/arch/mips/powertv/powertv_setup.c b/arch/mips/powertv/powertv_setup.c
new file mode 100644
index 000000000000..698b1eafbe98
--- /dev/null
+++ b/arch/mips/powertv/powertv_setup.c
@@ -0,0 +1,330 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 */
19#include <linux/init.h>
20#include <linux/sched.h>
21#include <linux/ioport.h>
22#include <linux/pci.h>
23#include <linux/screen_info.h>
24#include <linux/notifier.h>
25#include <linux/etherdevice.h>
26#include <linux/if_ether.h>
27#include <linux/ctype.h>
28
29#include <linux/cpu.h>
30#include <asm/bootinfo.h>
31#include <asm/irq.h>
32#include <asm/mips-boards/generic.h>
33#include <asm/mips-boards/prom.h>
34#include <asm/dma.h>
35#include <linux/time.h>
36#include <asm/traps.h>
37#include <asm/asm-offsets.h>
38#include "reset.h"
39
40#define VAL(n) STR(n)
41
42/*
43 * Macros for loading addresses and storing registers:
44 * PTR_LA Load the address into a register
45 * LONG_S Store the full width of the given register.
46 * LONG_L Load the full width of the given register
47 * PTR_ADDIU Add a constant value to a register used as a pointer
48 * REG_SIZE Number of 8-bit bytes in a full width register
49 */
50#ifdef CONFIG_64BIT
51#warning TODO: 64-bit code needs to be verified
52#define PTR_LA "dla "
53#define LONG_S "sd "
54#define LONG_L "ld "
55#define PTR_ADDIU "daddiu "
56#define REG_SIZE "8" /* In bytes */
57#endif
58
59#ifdef CONFIG_32BIT
60#define PTR_LA "la "
61#define LONG_S "sw "
62#define LONG_L "lw "
63#define PTR_ADDIU "addiu "
64#define REG_SIZE "4" /* In bytes */
65#endif
66
67static void register_panic_notifier(void);
68static int panic_handler(struct notifier_block *notifier_block,
69 unsigned long event, void *cause_string);
70
71const char *get_system_type(void)
72{
73 return "PowerTV";
74}
75
76void __init plat_mem_setup(void)
77{
78 panic_on_oops = 1;
79 register_panic_notifier();
80
81#if 0
82 mips_pcibios_init();
83#endif
84 mips_reboot_setup();
85}
86
87/*
88 * Install a panic notifier for platform-specific diagnostics
89 */
90static void register_panic_notifier()
91{
92 static struct notifier_block panic_notifier = {
93 .notifier_call = panic_handler,
94 .next = NULL,
95 .priority = INT_MAX
96 };
97 atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier);
98}
99
100static int panic_handler(struct notifier_block *notifier_block,
101 unsigned long event, void *cause_string)
102{
103 struct pt_regs my_regs;
104
105 /* Save all of the registers */
106 {
107 unsigned long at, v0, v1; /* Must be on the stack */
108
109 /* Start by saving $at and v0 on the stack. We use $at
110 * ourselves, but it looks like the compiler may use v0 or v1
111 * to load the address of the pt_regs structure. We'll come
112 * back later to store the registers in the pt_regs
113 * structure. */
114 __asm__ __volatile__ (
115 ".set noat\n"
116 LONG_S "$at, %[at]\n"
117 LONG_S "$2, %[v0]\n"
118 LONG_S "$3, %[v1]\n"
119 :
120 [at] "=m" (at),
121 [v0] "=m" (v0),
122 [v1] "=m" (v1)
123 :
124 : "at"
125 );
126
127 __asm__ __volatile__ (
128 ".set noat\n"
129 "move $at, %[pt_regs]\n"
130
131 /* Argument registers */
132 LONG_S "$4, " VAL(PT_R4) "($at)\n"
133 LONG_S "$5, " VAL(PT_R5) "($at)\n"
134 LONG_S "$6, " VAL(PT_R6) "($at)\n"
135 LONG_S "$7, " VAL(PT_R7) "($at)\n"
136
137 /* Temporary regs */
138 LONG_S "$8, " VAL(PT_R8) "($at)\n"
139 LONG_S "$9, " VAL(PT_R9) "($at)\n"
140 LONG_S "$10, " VAL(PT_R10) "($at)\n"
141 LONG_S "$11, " VAL(PT_R11) "($at)\n"
142 LONG_S "$12, " VAL(PT_R12) "($at)\n"
143 LONG_S "$13, " VAL(PT_R13) "($at)\n"
144 LONG_S "$14, " VAL(PT_R14) "($at)\n"
145 LONG_S "$15, " VAL(PT_R15) "($at)\n"
146
147 /* "Saved" registers */
148 LONG_S "$16, " VAL(PT_R16) "($at)\n"
149 LONG_S "$17, " VAL(PT_R17) "($at)\n"
150 LONG_S "$18, " VAL(PT_R18) "($at)\n"
151 LONG_S "$19, " VAL(PT_R19) "($at)\n"
152 LONG_S "$20, " VAL(PT_R20) "($at)\n"
153 LONG_S "$21, " VAL(PT_R21) "($at)\n"
154 LONG_S "$22, " VAL(PT_R22) "($at)\n"
155 LONG_S "$23, " VAL(PT_R23) "($at)\n"
156
157 /* Add'l temp regs */
158 LONG_S "$24, " VAL(PT_R24) "($at)\n"
159 LONG_S "$25, " VAL(PT_R25) "($at)\n"
160
161 /* Kernel temp regs */
162 LONG_S "$26, " VAL(PT_R26) "($at)\n"
163 LONG_S "$27, " VAL(PT_R27) "($at)\n"
164
165 /* Global pointer, stack pointer, frame pointer and
166 * return address */
167 LONG_S "$gp, " VAL(PT_R28) "($at)\n"
168 LONG_S "$sp, " VAL(PT_R29) "($at)\n"
169 LONG_S "$fp, " VAL(PT_R30) "($at)\n"
170 LONG_S "$ra, " VAL(PT_R31) "($at)\n"
171
172 /* Now we can get the $at and v0 registers back and
173 * store them */
174 LONG_L "$8, %[at]\n"
175 LONG_S "$8, " VAL(PT_R1) "($at)\n"
176 LONG_L "$8, %[v0]\n"
177 LONG_S "$8, " VAL(PT_R2) "($at)\n"
178 LONG_L "$8, %[v1]\n"
179 LONG_S "$8, " VAL(PT_R3) "($at)\n"
180 :
181 :
182 [at] "m" (at),
183 [v0] "m" (v0),
184 [v1] "m" (v1),
185 [pt_regs] "r" (&my_regs)
186 : "at", "t0"
187 );
188
189 /* Set the current EPC value to be the current location in this
190 * function */
191 __asm__ __volatile__ (
192 ".set noat\n"
193 "1:\n"
194 PTR_LA "$at, 1b\n"
195 LONG_S "$at, %[cp0_epc]\n"
196 :
197 [cp0_epc] "=m" (my_regs.cp0_epc)
198 :
199 : "at"
200 );
201
202 my_regs.cp0_cause = read_c0_cause();
203 my_regs.cp0_status = read_c0_status();
204 }
205
206#ifdef CONFIG_DIAGNOSTICS
207 failure_report((char *) cause_string,
208 have_die_regs ? &die_regs : &my_regs);
209 have_die_regs = false;
210#else
211 pr_crit("I'm feeling a bit sleepy. hmmmmm... perhaps a nap would... "
212 "zzzz... \n");
213#endif
214
215 return NOTIFY_DONE;
216}
217
218/* Information about the RF MAC address, if one was supplied on the
219 * command line. */
220static bool have_rfmac;
221static u8 rfmac[ETH_ALEN];
222
223static int rfmac_param(char *p)
224{
225 u8 *q;
226 bool is_high_nibble;
227 int c;
228
229 /* Skip a leading "0x", if present */
230 if (*p == '0' && *(p+1) == 'x')
231 p += 2;
232
233 q = rfmac;
234 is_high_nibble = true;
235
236 for (c = (unsigned char) *p++;
237 isxdigit(c) && q - rfmac < ETH_ALEN;
238 c = (unsigned char) *p++) {
239 int nibble;
240
241 nibble = (isdigit(c) ? (c - '0') :
242 (isupper(c) ? c - 'A' + 10 : c - 'a' + 10));
243
244 if (is_high_nibble)
245 *q = nibble << 4;
246 else
247 *q++ |= nibble;
248
249 is_high_nibble = !is_high_nibble;
250 }
251
252 /* If we parsed all the way to the end of the parameter value and
253 * parsed all ETH_ALEN bytes, we have a usable RF MAC address */
254 have_rfmac = (c == '\0' && q - rfmac == ETH_ALEN);
255
256 return 0;
257}
258
259early_param("rfmac", rfmac_param);
260
261/*
262 * Generate an Ethernet MAC address that has a good chance of being unique.
263 * @addr: Pointer to six-byte array containing the Ethernet address
264 * Generates an Ethernet MAC address that is highly likely to be unique for
265 * this particular system on a network with other systems of the same type.
266 *
267 * The problem we are solving is that, when random_ether_addr() is used to
268 * generate MAC addresses at startup, there isn't much entropy for the random
269 * number generator to use and the addresses it produces are fairly likely to
270 * be the same as those of other identical systems on the same local network.
271 * This is true even for relatively small numbers of systems (for the reason
272 * why, see the Wikipedia entry for "Birthday problem" at:
273 * http://en.wikipedia.org/wiki/Birthday_problem
274 *
275 * The good news is that we already have a MAC address known to be unique, the
276 * RF MAC address. The bad news is that this address is already in use on the
277 * RF interface. Worse, the obvious trick, taking the RF MAC address and
278 * turning on the locally managed bit, has already been used for other devices.
279 * Still, this does give us something to work with.
280 *
281 * The approach we take is:
282 * 1. If we can't get the RF MAC Address, just call random_ether_addr.
283 * 2. Use the 24-bit NIC-specific bits of the RF MAC address as the last 24
284 * bits of the new address. This is very likely to be unique, except for
285 * the current box.
286 * 3. To avoid using addresses already on the current box, we set the top
287 * six bits of the address with a value different from any currently
288 * registered Scientific Atlanta organizationally unique identifyer
289 * (OUI). This avoids duplication with any addresses on the system that
290 * were generated from valid Scientific Atlanta-registered address by
291 * simply flipping the locally managed bit.
292 * 4. We aren't generating a multicast address, so we leave the multicast
293 * bit off. Since we aren't using a registered address, we have to set
294 * the locally managed bit.
295 * 5. We then randomly generate the remaining 16-bits. This does two
296 * things:
297 * a. It allows us to call this function for more than one device
298 * in this system
299 * b. It ensures that things will probably still work even if
300 * some device on the device network has a locally managed
301 * address that matches the top six bits from step 2.
302 */
303void platform_random_ether_addr(u8 addr[ETH_ALEN])
304{
305 const int num_random_bytes = 2;
306 const unsigned char non_sciatl_oui_bits = 0xc0u;
307 const unsigned char mac_addr_locally_managed = (1 << 1);
308
309 if (!have_rfmac) {
310 pr_warning("rfmac not available on command line; "
311 "generating random MAC address\n");
312 random_ether_addr(addr);
313 }
314
315 else {
316 int i;
317
318 /* Set the first byte to something that won't match a Scientific
319 * Atlanta OUI, is locally managed, and isn't a multicast
320 * address */
321 addr[0] = non_sciatl_oui_bits | mac_addr_locally_managed;
322
323 /* Get some bytes of random address information */
324 get_random_bytes(&addr[1], num_random_bytes);
325
326 /* Copy over the NIC-specific bits of the RF MAC address */
327 for (i = 1 + num_random_bytes; i < ETH_ALEN; i++)
328 addr[i] = rfmac[i];
329 }
330}
diff --git a/arch/mips/powertv/reset.c b/arch/mips/powertv/reset.c
new file mode 100644
index 000000000000..0007652cb774
--- /dev/null
+++ b/arch/mips/powertv/reset.c
@@ -0,0 +1,47 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 */
19#include <linux/pm.h>
20
21#include <linux/io.h>
22#include <asm/reboot.h> /* Not included by linux/reboot.h */
23
24#ifdef CONFIG_BOOTLOADER_DRIVER
25#include <asm/mach-powertv/kbldr.h>
26#endif
27
28#include <asm/mach-powertv/asic_regs.h>
29#include "reset.h"
30
31static void mips_machine_restart(char *command)
32{
33#ifdef CONFIG_BOOTLOADER_DRIVER
34 /*
35 * Call the bootloader's reset function to ensure
36 * that persistent data is flushed before hard reset
37 */
38 kbldr_SetCauseAndReset();
39#else
40 writel(0x1, asic_reg_addr(watchdog));
41#endif
42}
43
44void mips_reboot_setup(void)
45{
46 _machine_restart = mips_machine_restart;
47}
diff --git a/arch/mips/powertv/reset.h b/arch/mips/powertv/reset.h
new file mode 100644
index 000000000000..888fd09e2620
--- /dev/null
+++ b/arch/mips/powertv/reset.h
@@ -0,0 +1,26 @@
1/*
2 * Definitions from powertv reset.c file
3 *
4 * Copyright (C) 2009 Cisco Systems, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#ifndef _POWERTV_POWERTV_RESET_H
24#define _POWERTV_POWERTV_RESET_H
25extern void mips_reboot_setup(void);
26#endif
diff --git a/arch/mips/mipssim/sim_cmdline.c b/arch/mips/powertv/time.c
index 74240e1ce5a5..9fd7b67f2af7 100644
--- a/arch/mips/mipssim/sim_cmdline.c
+++ b/arch/mips/powertv/time.c
@@ -1,5 +1,7 @@
1/* 1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Portions copyright (C) 2009 Cisco Systems, Inc.
3 * 5 *
4 * This program is free software; you can distribute it and/or modify it 6 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as 7 * under the terms of the GNU General Public License (Version 2) as
@@ -14,19 +16,21 @@
14 * with this program; if not, write to the Free Software Foundation, Inc., 16 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 * 18 *
19 * Setting up the clock on the MIPS boards.
17 */ 20 */
21
18#include <linux/init.h> 22#include <linux/init.h>
19#include <linux/string.h> 23#include <asm/mach-powertv/interrupts.h>
20#include <asm/bootinfo.h> 24#include <asm/time.h>
21 25
22extern char arcs_cmdline[]; 26#include "powertv-clock.h"
23 27
24char * __init prom_getcmdline(void) 28unsigned int __cpuinit get_c0_compare_int(void)
25{ 29{
26 return arcs_cmdline; 30 return irq_mips_timer;
27} 31}
28 32
29void __init prom_init_cmdline(void) 33void __init plat_time_init(void)
30{ 34{
31 /* XXX: Get boot line from environment? */ 35 powertv_clocksource_init();
32} 36}
diff --git a/arch/mips/rb532/prom.c b/arch/mips/rb532/prom.c
index ad5bd1097974..d7c26d00cfef 100644
--- a/arch/mips/rb532/prom.c
+++ b/arch/mips/rb532/prom.c
@@ -69,7 +69,7 @@ static inline unsigned long tag2ul(char *arg, const char *tag)
69 69
70void __init prom_setup_cmdline(void) 70void __init prom_setup_cmdline(void)
71{ 71{
72 static char cmd_line[CL_SIZE] __initdata; 72 static char cmd_line[COMMAND_LINE_SIZE] __initdata;
73 char *cp, *board; 73 char *cp, *board;
74 int prom_argc; 74 int prom_argc;
75 char **prom_argv, **prom_envp; 75 char **prom_argv, **prom_envp;
@@ -115,7 +115,7 @@ void __init prom_setup_cmdline(void)
115 strcpy(cp, arcs_cmdline); 115 strcpy(cp, arcs_cmdline);
116 cp += strlen(arcs_cmdline); 116 cp += strlen(arcs_cmdline);
117 } 117 }
118 cmd_line[CL_SIZE-1] = '\0'; 118 cmd_line[COMMAND_LINE_SIZE - 1] = '\0';
119 119
120 strcpy(arcs_cmdline, cmd_line); 120 strcpy(arcs_cmdline, cmd_line);
121} 121}
diff --git a/arch/mips/sgi-ip22/ip22-eisa.c b/arch/mips/sgi-ip22/ip22-eisa.c
index 1617241d2737..da44ccb20829 100644
--- a/arch/mips/sgi-ip22/ip22-eisa.c
+++ b/arch/mips/sgi-ip22/ip22-eisa.c
@@ -50,9 +50,9 @@
50 50
51static char __init *decode_eisa_sig(unsigned long addr) 51static char __init *decode_eisa_sig(unsigned long addr)
52{ 52{
53 static char sig_str[EISA_SIG_LEN]; 53 static char sig_str[EISA_SIG_LEN] __initdata;
54 u8 sig[4]; 54 u8 sig[4];
55 u16 rev; 55 u16 rev;
56 int i; 56 int i;
57 57
58 for (i = 0; i < 4; i++) { 58 for (i = 0; i < 4; i++) {
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index 0ecd5fe9486e..383f11d7f442 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/ftrace.h>
16 17
17#include <asm/irq_cpu.h> 18#include <asm/irq_cpu.h>
18#include <asm/sgi/hpc3.h> 19#include <asm/sgi/hpc3.h>
@@ -150,7 +151,7 @@ static void indy_local1_irqdispatch(void)
150 151
151extern void ip22_be_interrupt(int irq); 152extern void ip22_be_interrupt(int irq);
152 153
153static void indy_buserror_irq(void) 154static void __irq_entry indy_buserror_irq(void)
154{ 155{
155 int irq = SGI_BUSERR_IRQ; 156 int irq = SGI_BUSERR_IRQ;
156 157
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index b9a931358e23..5deeb68b6c9c 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -67,7 +67,7 @@ void __init plat_mem_setup(void)
67 cserial = ArcGetEnvironmentVariable("ConsoleOut"); 67 cserial = ArcGetEnvironmentVariable("ConsoleOut");
68 68
69 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) { 69 if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
70 static char options[8]; 70 static char options[8] __initdata;
71 char *baud = ArcGetEnvironmentVariable("dbaud"); 71 char *baud = ArcGetEnvironmentVariable("dbaud");
72 if (baud) 72 if (baud)
73 strcpy(options, baud); 73 strcpy(options, baud);
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index c8f7d2328b24..603fc91c1030 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -16,6 +16,7 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h> 17#include <linux/kernel_stat.h>
18#include <linux/time.h> 18#include <linux/time.h>
19#include <linux/ftrace.h>
19 20
20#include <asm/cpu.h> 21#include <asm/cpu.h>
21#include <asm/mipsregs.h> 22#include <asm/mipsregs.h>
@@ -115,7 +116,7 @@ __init void plat_time_init(void)
115} 116}
116 117
117/* Generic SGI handler for (spurious) 8254 interrupts */ 118/* Generic SGI handler for (spurious) 8254 interrupts */
118void indy_8254timer_irq(void) 119void __irq_entry indy_8254timer_irq(void)
119{ 120{
120 int irq = SGI_8254_0_IRQ; 121 int irq = SGI_8254_0_IRQ;
121 ULONG cnt; 122 ULONG cnt;
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index f61c164d1e67..bc1297109cc5 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -505,5 +505,5 @@ void __init mem_init(void)
505 (num_physpages - tmp) << (PAGE_SHIFT-10), 505 (num_physpages - tmp) << (PAGE_SHIFT-10),
506 datasize >> 10, 506 datasize >> 10,
507 initsize >> 10, 507 initsize >> 10,
508 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 508 totalhigh_pages << (PAGE_SHIFT-10));
509} 509}
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index c5a5d4a31b4b..3abd1465ec02 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -90,7 +90,7 @@ void __init plat_mem_setup(void)
90 { 90 {
91 char* con = ArcGetEnvironmentVariable("console"); 91 char* con = ArcGetEnvironmentVariable("console");
92 if (con && *con == 'd') { 92 if (con && *con == 'd') {
93 static char options[8]; 93 static char options[8] __initdata;
94 char *baud = ArcGetEnvironmentVariable("dbaud"); 94 char *baud = ArcGetEnvironmentVariable("dbaud");
95 if (baud) 95 if (baud)
96 strcpy(options, baud); 96 strcpy(options, baud);
diff --git a/arch/mips/sibyte/common/cfe.c b/arch/mips/sibyte/common/cfe.c
index eb5396cf81bb..6343011e9902 100644
--- a/arch/mips/sibyte/common/cfe.c
+++ b/arch/mips/sibyte/common/cfe.c
@@ -287,7 +287,7 @@ void __init prom_init(void)
287 * boot console 287 * boot console
288 */ 288 */
289 cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); 289 cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
290 if (cfe_getenv("LINUX_CMDLINE", arcs_cmdline, CL_SIZE) < 0) { 290 if (cfe_getenv("LINUX_CMDLINE", arcs_cmdline, COMMAND_LINE_SIZE) < 0) {
291 if (argc >= 0) { 291 if (argc >= 0) {
292 /* The loader should have set the command line */ 292 /* The loader should have set the command line */
293 /* too early for panic to do any good */ 293 /* too early for panic to do any good */
@@ -318,7 +318,7 @@ void __init prom_init(void)
318#endif /* CONFIG_BLK_DEV_INITRD */ 318#endif /* CONFIG_BLK_DEV_INITRD */
319 319
320 /* Not sure this is needed, but it's the safe way. */ 320 /* Not sure this is needed, but it's the safe way. */
321 arcs_cmdline[CL_SIZE-1] = 0; 321 arcs_cmdline[COMMAND_LINE_SIZE-1] = 0;
322 322
323 prom_meminit(); 323 prom_meminit();
324 324
diff --git a/arch/mips/sni/a20r.c b/arch/mips/sni/a20r.c
index 7dd76fb3b645..e6980892834a 100644
--- a/arch/mips/sni/a20r.c
+++ b/arch/mips/sni/a20r.c
@@ -188,7 +188,7 @@ static void end_a20r_irq(unsigned int irq)
188} 188}
189 189
190static struct irq_chip a20r_irq_type = { 190static struct irq_chip a20r_irq_type = {
191 .typename = "A20R", 191 .name = "A20R",
192 .ack = mask_a20r_irq, 192 .ack = mask_a20r_irq,
193 .mask = mask_a20r_irq, 193 .mask = mask_a20r_irq,
194 .mask_ack = mask_a20r_irq, 194 .mask_ack = mask_a20r_irq,
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 74e6c67982fb..51e62bbaa23b 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -214,7 +214,7 @@ static void end_pcimt_irq(unsigned int irq)
214} 214}
215 215
216static struct irq_chip pcimt_irq_type = { 216static struct irq_chip pcimt_irq_type = {
217 .typename = "PCIMT", 217 .name = "PCIMT",
218 .ack = disable_pcimt_irq, 218 .ack = disable_pcimt_irq,
219 .mask = disable_pcimt_irq, 219 .mask = disable_pcimt_irq,
220 .mask_ack = disable_pcimt_irq, 220 .mask_ack = disable_pcimt_irq,
diff --git a/arch/mips/sni/pcit.c b/arch/mips/sni/pcit.c
index 071a9573ac7f..f4699d35858b 100644
--- a/arch/mips/sni/pcit.c
+++ b/arch/mips/sni/pcit.c
@@ -176,7 +176,7 @@ void end_pcit_irq(unsigned int irq)
176} 176}
177 177
178static struct irq_chip pcit_irq_type = { 178static struct irq_chip pcit_irq_type = {
179 .typename = "PCIT", 179 .name = "PCIT",
180 .ack = disable_pcit_irq, 180 .ack = disable_pcit_irq,
181 .mask = disable_pcit_irq, 181 .mask = disable_pcit_irq,
182 .mask_ack = disable_pcit_irq, 182 .mask_ack = disable_pcit_irq,
diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index 5e687819cbc2..46f00691f448 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -449,7 +449,7 @@ void end_rm200_irq(unsigned int irq)
449} 449}
450 450
451static struct irq_chip rm200_irq_type = { 451static struct irq_chip rm200_irq_type = {
452 .typename = "RM200", 452 .name = "RM200",
453 .ack = disable_rm200_irq, 453 .ack = disable_rm200_irq,
454 .mask = disable_rm200_irq, 454 .mask = disable_rm200_irq,
455 .mask_ack = disable_rm200_irq, 455 .mask_ack = disable_rm200_irq,
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index a49272ce7ef5..d16b462154c3 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -60,7 +60,7 @@ static void __init sni_console_setup(void)
60 char *cdev; 60 char *cdev;
61 char *baud; 61 char *baud;
62 int port; 62 int port;
63 static char options[8]; 63 static char options[8] __initdata;
64 64
65 cdev = prom_getenv("console_dev"); 65 cdev = prom_getenv("console_dev");
66 if (strncmp(cdev, "tty", 3) == 0) { 66 if (strncmp(cdev, "tty", 3) == 0) {
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index d66802edebb2..e27809b6d04f 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -160,7 +160,6 @@ static void __init prom_init_cmdline(void)
160 int argc; 160 int argc;
161 int *argv32; 161 int *argv32;
162 int i; /* Always ignore the "-c" at argv[0] */ 162 int i; /* Always ignore the "-c" at argv[0] */
163 static char builtin[CL_SIZE] __initdata;
164 163
165 if (fw_arg0 >= CKSEG0 || fw_arg1 < CKSEG0) { 164 if (fw_arg0 >= CKSEG0 || fw_arg1 < CKSEG0) {
166 /* 165 /*
@@ -174,20 +173,6 @@ static void __init prom_init_cmdline(void)
174 argv32 = (int *)fw_arg1; 173 argv32 = (int *)fw_arg1;
175 } 174 }
176 175
177 /* ignore all built-in args if any f/w args given */
178 /*
179 * But if built-in strings was started with '+', append them
180 * to command line args. If built-in was started with '-',
181 * ignore all f/w args.
182 */
183 builtin[0] = '\0';
184 if (arcs_cmdline[0] == '+')
185 strcpy(builtin, arcs_cmdline + 1);
186 else if (arcs_cmdline[0] == '-') {
187 strcpy(builtin, arcs_cmdline + 1);
188 argc = 0;
189 } else if (argc <= 1)
190 strcpy(builtin, arcs_cmdline);
191 arcs_cmdline[0] = '\0'; 176 arcs_cmdline[0] = '\0';
192 177
193 for (i = 1; i < argc; i++) { 178 for (i = 1; i < argc; i++) {
@@ -201,12 +186,6 @@ static void __init prom_init_cmdline(void)
201 } else 186 } else
202 strcat(arcs_cmdline, str); 187 strcat(arcs_cmdline, str);
203 } 188 }
204 /* append saved builtin args */
205 if (builtin[0]) {
206 if (arcs_cmdline[0])
207 strcat(arcs_cmdline, " ");
208 strcat(arcs_cmdline, builtin);
209 }
210} 189}
211 190
212static int txx9_ic_disable __initdata; 191static int txx9_ic_disable __initdata;
@@ -315,7 +294,7 @@ static inline void txx9_cache_fixup(void)
315 294
316static void __init preprocess_cmdline(void) 295static void __init preprocess_cmdline(void)
317{ 296{
318 static char cmdline[CL_SIZE] __initdata; 297 static char cmdline[COMMAND_LINE_SIZE] __initdata;
319 char *s; 298 char *s;
320 299
321 strcpy(cmdline, arcs_cmdline); 300 strcpy(cmdline, arcs_cmdline);
diff --git a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
index 1386e6f081c8..23916321cc1b 100644
--- a/arch/mips/vr41xx/common/init.c
+++ b/arch/mips/vr41xx/common/init.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * init.c, Common initialization routines for NEC VR4100 series. 2 * init.c, Common initialization routines for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2003-2008 Yoichi Yuasa <yuasa@linux-mips.org> 4 * Copyright (C) 2003-2009 Yoichi Yuasa <yuasa@linux-mips.org>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
@@ -66,9 +66,9 @@ void __init prom_init(void)
66 argv = (char **)fw_arg1; 66 argv = (char **)fw_arg1;
67 67
68 for (i = 1; i < argc; i++) { 68 for (i = 1; i < argc; i++) {
69 strcat(arcs_cmdline, argv[i]); 69 strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
70 if (i < (argc - 1)) 70 if (i < (argc - 1))
71 strcat(arcs_cmdline, " "); 71 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
72 } 72 }
73} 73}
74 74
diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile
index dd0c8ff52a68..ac5c6bdb2f05 100644
--- a/arch/mn10300/Makefile
+++ b/arch/mn10300/Makefile
@@ -19,7 +19,7 @@ CCDIR := $(strip $(patsubst %/specs,%,$(CCSPECS)))
19KBUILD_CPPFLAGS += -nostdinc -I$(CCDIR)/include 19KBUILD_CPPFLAGS += -nostdinc -I$(CCDIR)/include
20 20
21LDFLAGS := 21LDFLAGS :=
22OBJCOPYFLAGS := -O binary -R .note -R .comment -S 22OBJCOPYFLAGS := -O binary -R .note -R .comment -R .GCC-command-line -R .note.gnu.build-id -S
23#LDFLAGS_vmlinux := -Map linkmap.txt 23#LDFLAGS_vmlinux := -Map linkmap.txt
24CHECKFLAGS += 24CHECKFLAGS +=
25 25
diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig
index 3acce23708b0..441920d8ff58 100644
--- a/arch/mn10300/configs/asb2303_defconfig
+++ b/arch/mn10300/configs/asb2303_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.30-rc2 3# Linux kernel version: 2.6.33-rc1
4# Sat Apr 18 11:13:22 2009 4# Tue Dec 22 19:26:25 2009
5# 5#
6CONFIG_MN10300=y 6CONFIG_MN10300=y
7CONFIG_AM33=y 7CONFIG_AM33=y
@@ -22,6 +22,7 @@ CONFIG_GENERIC_HARDIRQS=y
22# CONFIG_HOTPLUG_CPU is not set 22# CONFIG_HOTPLUG_CPU is not set
23CONFIG_HZ=1000 23CONFIG_HZ=1000
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25CONFIG_CONSTRUCTORS=y
25 26
26# 27#
27# General setup 28# General setup
@@ -43,11 +44,10 @@ CONFIG_BSD_PROCESS_ACCT=y
43# 44#
44# RCU Subsystem 45# RCU Subsystem
45# 46#
46CONFIG_CLASSIC_RCU=y
47# CONFIG_TREE_RCU is not set 47# CONFIG_TREE_RCU is not set
48# CONFIG_PREEMPT_RCU is not set 48# CONFIG_TREE_PREEMPT_RCU is not set
49CONFIG_TINY_RCU=y
49# CONFIG_TREE_RCU_TRACE is not set 50# CONFIG_TREE_RCU_TRACE is not set
50# CONFIG_PREEMPT_RCU_TRACE is not set
51# CONFIG_IKCONFIG is not set 51# CONFIG_IKCONFIG is not set
52CONFIG_LOG_BUF_SHIFT=14 52CONFIG_LOG_BUF_SHIFT=14
53# CONFIG_GROUP_SCHED is not set 53# CONFIG_GROUP_SCHED is not set
@@ -62,7 +62,6 @@ CONFIG_ANON_INODES=y
62CONFIG_EMBEDDED=y 62CONFIG_EMBEDDED=y
63CONFIG_SYSCTL_SYSCALL=y 63CONFIG_SYSCTL_SYSCALL=y
64# CONFIG_KALLSYMS is not set 64# CONFIG_KALLSYMS is not set
65CONFIG_STRIP_ASM_SYMS=y
66# CONFIG_HOTPLUG is not set 65# CONFIG_HOTPLUG is not set
67CONFIG_PRINTK=y 66CONFIG_PRINTK=y
68CONFIG_BUG=y 67CONFIG_BUG=y
@@ -75,14 +74,22 @@ CONFIG_TIMERFD=y
75CONFIG_EVENTFD=y 74CONFIG_EVENTFD=y
76CONFIG_SHMEM=y 75CONFIG_SHMEM=y
77CONFIG_AIO=y 76CONFIG_AIO=y
77
78#
79# Kernel Performance Events And Counters
80#
78# CONFIG_VM_EVENT_COUNTERS is not set 81# CONFIG_VM_EVENT_COUNTERS is not set
79CONFIG_COMPAT_BRK=y 82CONFIG_COMPAT_BRK=y
80CONFIG_SLAB=y 83CONFIG_SLAB=y
81# CONFIG_SLUB is not set 84# CONFIG_SLUB is not set
82# CONFIG_SLOB is not set 85# CONFIG_SLOB is not set
83CONFIG_PROFILING=y 86CONFIG_PROFILING=y
84# CONFIG_MARKERS is not set
85CONFIG_HAVE_OPROFILE=y 87CONFIG_HAVE_OPROFILE=y
88CONFIG_HAVE_ARCH_TRACEHOOK=y
89
90#
91# GCOV-based kernel profiling
92#
86# CONFIG_SLOW_WORK is not set 93# CONFIG_SLOW_WORK is not set
87# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 94# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
88CONFIG_SLABINFO=y 95CONFIG_SLABINFO=y
@@ -90,6 +97,35 @@ CONFIG_RT_MUTEXES=y
90CONFIG_BASE_SMALL=0 97CONFIG_BASE_SMALL=0
91# CONFIG_MODULES is not set 98# CONFIG_MODULES is not set
92# CONFIG_BLOCK is not set 99# CONFIG_BLOCK is not set
100# CONFIG_INLINE_SPIN_TRYLOCK is not set
101# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
102# CONFIG_INLINE_SPIN_LOCK is not set
103# CONFIG_INLINE_SPIN_LOCK_BH is not set
104# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
105# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
106# CONFIG_INLINE_SPIN_UNLOCK is not set
107# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
108# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
109# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
110# CONFIG_INLINE_READ_TRYLOCK is not set
111# CONFIG_INLINE_READ_LOCK is not set
112# CONFIG_INLINE_READ_LOCK_BH is not set
113# CONFIG_INLINE_READ_LOCK_IRQ is not set
114# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
115# CONFIG_INLINE_READ_UNLOCK is not set
116# CONFIG_INLINE_READ_UNLOCK_BH is not set
117# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
118# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
119# CONFIG_INLINE_WRITE_TRYLOCK is not set
120# CONFIG_INLINE_WRITE_LOCK is not set
121# CONFIG_INLINE_WRITE_LOCK_BH is not set
122# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
123# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
124# CONFIG_INLINE_WRITE_UNLOCK is not set
125# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
126# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
127# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
128# CONFIG_MUTEX_SPIN_ON_OWNER is not set
93# CONFIG_FREEZER is not set 129# CONFIG_FREEZER is not set
94 130
95# 131#
@@ -145,9 +181,8 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
145CONFIG_ZONE_DMA_FLAG=0 181CONFIG_ZONE_DMA_FLAG=0
146CONFIG_NR_QUICK=1 182CONFIG_NR_QUICK=1
147CONFIG_VIRT_TO_BUS=y 183CONFIG_VIRT_TO_BUS=y
148CONFIG_UNEVICTABLE_LRU=y 184# CONFIG_KSM is not set
149CONFIG_HAVE_MLOCK=y 185CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
150CONFIG_HAVE_MLOCKED_PAGE_BIT=y
151 186
152# 187#
153# Power management options 188# Power management options
@@ -202,6 +237,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
202# CONFIG_NETFILTER is not set 237# CONFIG_NETFILTER is not set
203# CONFIG_IP_DCCP is not set 238# CONFIG_IP_DCCP is not set
204# CONFIG_IP_SCTP is not set 239# CONFIG_IP_SCTP is not set
240# CONFIG_RDS is not set
205# CONFIG_TIPC is not set 241# CONFIG_TIPC is not set
206# CONFIG_ATM is not set 242# CONFIG_ATM is not set
207# CONFIG_BRIDGE is not set 243# CONFIG_BRIDGE is not set
@@ -216,6 +252,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
216# CONFIG_ECONET is not set 252# CONFIG_ECONET is not set
217# CONFIG_WAN_ROUTER is not set 253# CONFIG_WAN_ROUTER is not set
218# CONFIG_PHONET is not set 254# CONFIG_PHONET is not set
255# CONFIG_IEEE802154 is not set
219# CONFIG_NET_SCHED is not set 256# CONFIG_NET_SCHED is not set
220# CONFIG_DCB is not set 257# CONFIG_DCB is not set
221 258
@@ -341,7 +378,6 @@ CONFIG_MISC_DEVICES=y
341# CONFIG_SCSI_DMA is not set 378# CONFIG_SCSI_DMA is not set
342# CONFIG_SCSI_NETLINK is not set 379# CONFIG_SCSI_NETLINK is not set
343CONFIG_NETDEVICES=y 380CONFIG_NETDEVICES=y
344CONFIG_COMPAT_NET_DEV_OPS=y
345# CONFIG_DUMMY is not set 381# CONFIG_DUMMY is not set
346# CONFIG_BONDING is not set 382# CONFIG_BONDING is not set
347# CONFIG_MACVLAN is not set 383# CONFIG_MACVLAN is not set
@@ -362,14 +398,11 @@ CONFIG_SMC91X=y
362# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 398# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
363# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 399# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
364# CONFIG_B44 is not set 400# CONFIG_B44 is not set
401# CONFIG_KS8842 is not set
402# CONFIG_KS8851_MLL is not set
365# CONFIG_NETDEV_1000 is not set 403# CONFIG_NETDEV_1000 is not set
366# CONFIG_NETDEV_10000 is not set 404# CONFIG_NETDEV_10000 is not set
367 405# CONFIG_WLAN is not set
368#
369# Wireless LAN
370#
371# CONFIG_WLAN_PRE80211 is not set
372# CONFIG_WLAN_80211 is not set
373 406
374# 407#
375# Enable WiMAX (Networking options) to see the WiMAX drivers 408# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -430,11 +463,15 @@ CONFIG_RTC=y
430# CONFIG_TCG_TPM is not set 463# CONFIG_TCG_TPM is not set
431# CONFIG_I2C is not set 464# CONFIG_I2C is not set
432# CONFIG_SPI is not set 465# CONFIG_SPI is not set
466
467#
468# PPS support
469#
470# CONFIG_PPS is not set
433# CONFIG_W1 is not set 471# CONFIG_W1 is not set
434# CONFIG_POWER_SUPPLY is not set 472# CONFIG_POWER_SUPPLY is not set
435# CONFIG_HWMON is not set 473# CONFIG_HWMON is not set
436# CONFIG_THERMAL is not set 474# CONFIG_THERMAL is not set
437# CONFIG_THERMAL_HWMON is not set
438# CONFIG_WATCHDOG is not set 475# CONFIG_WATCHDOG is not set
439CONFIG_SSB_POSSIBLE=y 476CONFIG_SSB_POSSIBLE=y
440 477
@@ -451,22 +488,7 @@ CONFIG_SSB_POSSIBLE=y
451# CONFIG_HTC_PASIC3 is not set 488# CONFIG_HTC_PASIC3 is not set
452# CONFIG_MFD_TMIO is not set 489# CONFIG_MFD_TMIO is not set
453# CONFIG_REGULATOR is not set 490# CONFIG_REGULATOR is not set
454 491# CONFIG_MEDIA_SUPPORT is not set
455#
456# Multimedia devices
457#
458
459#
460# Multimedia core support
461#
462# CONFIG_VIDEO_DEV is not set
463# CONFIG_DVB_CORE is not set
464# CONFIG_VIDEO_MEDIA is not set
465
466#
467# Multimedia drivers
468#
469# CONFIG_DAB is not set
470 492
471# 493#
472# Graphics support 494# Graphics support
@@ -490,11 +512,17 @@ CONFIG_SSB_POSSIBLE=y
490# CONFIG_DMADEVICES is not set 512# CONFIG_DMADEVICES is not set
491# CONFIG_AUXDISPLAY is not set 513# CONFIG_AUXDISPLAY is not set
492# CONFIG_UIO is not set 514# CONFIG_UIO is not set
515
516#
517# TI VLYNQ
518#
493# CONFIG_STAGING is not set 519# CONFIG_STAGING is not set
494 520
495# 521#
496# File systems 522# File systems
497# 523#
524CONFIG_FILE_LOCKING=y
525CONFIG_FSNOTIFY=y
498CONFIG_DNOTIFY=y 526CONFIG_DNOTIFY=y
499CONFIG_INOTIFY=y 527CONFIG_INOTIFY=y
500CONFIG_INOTIFY_USER=y 528CONFIG_INOTIFY_USER=y
@@ -539,6 +567,7 @@ CONFIG_NFS_V3=y
539# CONFIG_NFS_V3_ACL is not set 567# CONFIG_NFS_V3_ACL is not set
540# CONFIG_NFS_V4 is not set 568# CONFIG_NFS_V4 is not set
541CONFIG_ROOT_NFS=y 569CONFIG_ROOT_NFS=y
570# CONFIG_NFSD is not set
542CONFIG_LOCKD=y 571CONFIG_LOCKD=y
543CONFIG_LOCKD_V4=y 572CONFIG_LOCKD_V4=y
544CONFIG_NFS_COMMON=y 573CONFIG_NFS_COMMON=y
@@ -561,13 +590,13 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
561CONFIG_ENABLE_MUST_CHECK=y 590CONFIG_ENABLE_MUST_CHECK=y
562CONFIG_FRAME_WARN=1024 591CONFIG_FRAME_WARN=1024
563CONFIG_MAGIC_SYSRQ=y 592CONFIG_MAGIC_SYSRQ=y
593CONFIG_STRIP_ASM_SYMS=y
564# CONFIG_UNUSED_SYMBOLS is not set 594# CONFIG_UNUSED_SYMBOLS is not set
565# CONFIG_DEBUG_FS is not set 595# CONFIG_DEBUG_FS is not set
566# CONFIG_HEADERS_CHECK is not set 596# CONFIG_HEADERS_CHECK is not set
567# CONFIG_DEBUG_KERNEL is not set 597# CONFIG_DEBUG_KERNEL is not set
568# CONFIG_DEBUG_BUGVERBOSE is not set 598CONFIG_DEBUG_BUGVERBOSE=y
569# CONFIG_DEBUG_MEMORY_INIT is not set 599# CONFIG_DEBUG_MEMORY_INIT is not set
570# CONFIG_RCU_CPU_STALL_DETECTOR is not set
571# CONFIG_SYSCTL_SYSCALL_CHECK is not set 600# CONFIG_SYSCTL_SYSCALL_CHECK is not set
572# CONFIG_SAMPLES is not set 601# CONFIG_SAMPLES is not set
573 602
@@ -577,7 +606,11 @@ CONFIG_MAGIC_SYSRQ=y
577# CONFIG_KEYS is not set 606# CONFIG_KEYS is not set
578# CONFIG_SECURITY is not set 607# CONFIG_SECURITY is not set
579# CONFIG_SECURITYFS is not set 608# CONFIG_SECURITYFS is not set
580# CONFIG_SECURITY_FILE_CAPABILITIES is not set 609# CONFIG_DEFAULT_SECURITY_SELINUX is not set
610# CONFIG_DEFAULT_SECURITY_SMACK is not set
611# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
612CONFIG_DEFAULT_SECURITY_DAC=y
613CONFIG_DEFAULT_SECURITY=""
581# CONFIG_CRYPTO is not set 614# CONFIG_CRYPTO is not set
582# CONFIG_BINARY_PRINTF is not set 615# CONFIG_BINARY_PRINTF is not set
583 616
diff --git a/arch/mn10300/include/asm/asm-offsets.h b/arch/mn10300/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/mn10300/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h
index 0b610f482abb..f49ac49e09ad 100644
--- a/arch/mn10300/include/asm/bitops.h
+++ b/arch/mn10300/include/asm/bitops.h
@@ -165,7 +165,7 @@ static inline __attribute__((const))
165unsigned long __ffs(unsigned long x) 165unsigned long __ffs(unsigned long x)
166{ 166{
167 int bit; 167 int bit;
168 asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(x & -x)); 168 asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(x & -x) : "cc");
169 return bit; 169 return bit;
170} 170}
171 171
@@ -177,7 +177,7 @@ static inline __attribute__((const))
177int __ilog2_u32(u32 n) 177int __ilog2_u32(u32 n)
178{ 178{
179 int bit; 179 int bit;
180 asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(n)); 180 asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(n) : "cc");
181 return bit; 181 return bit;
182} 182}
183 183
diff --git a/arch/mn10300/include/asm/div64.h b/arch/mn10300/include/asm/div64.h
index 3a8329b3e869..34dcb8e68309 100644
--- a/arch/mn10300/include/asm/div64.h
+++ b/arch/mn10300/include/asm/div64.h
@@ -72,6 +72,7 @@ unsigned __muldiv64u(unsigned val, unsigned mult, unsigned div)
72 * MDR = MDR:val%div */ 72 * MDR = MDR:val%div */
73 : "=r"(result) 73 : "=r"(result)
74 : "0"(val), "ir"(mult), "r"(div) 74 : "0"(val), "ir"(mult), "r"(div)
75 : "cc"
75 ); 76 );
76 77
77 return result; 78 return result;
@@ -92,6 +93,7 @@ signed __muldiv64s(signed val, signed mult, signed div)
92 * MDR = MDR:val%div */ 93 * MDR = MDR:val%div */
93 : "=r"(result) 94 : "=r"(result)
94 : "0"(val), "ir"(mult), "r"(div) 95 : "0"(val), "ir"(mult), "r"(div)
96 : "cc"
95 ); 97 );
96 98
97 return result; 99 return result;
diff --git a/arch/mn10300/include/asm/system.h b/arch/mn10300/include/asm/system.h
index 8214fb7e7fe4..3636c054dcd5 100644
--- a/arch/mn10300/include/asm/system.h
+++ b/arch/mn10300/include/asm/system.h
@@ -143,6 +143,7 @@ do { \
143 " mov %0,epsw \n" \ 143 " mov %0,epsw \n" \
144 : "=&d"(tmp) \ 144 : "=&d"(tmp) \
145 : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw) \ 145 : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw) \
146 : "cc" \
146 ); \ 147 ); \
147} while (0) 148} while (0)
148 149
diff --git a/arch/mn10300/include/asm/tlbflush.h b/arch/mn10300/include/asm/tlbflush.h
index e0239865abcb..1a7e29281c5d 100644
--- a/arch/mn10300/include/asm/tlbflush.h
+++ b/arch/mn10300/include/asm/tlbflush.h
@@ -22,7 +22,7 @@ do { \
22 " mov %0,%1 \n" \ 22 " mov %0,%1 \n" \
23 : "=d"(w) \ 23 : "=d"(w) \
24 : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV) \ 24 : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV) \
25 : "memory" \ 25 : "cc", "memory" \
26 ); \ 26 ); \
27} while (0) 27} while (0)
28 28
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h
index 167e10ff06d9..197a7af3dd8a 100644
--- a/arch/mn10300/include/asm/uaccess.h
+++ b/arch/mn10300/include/asm/uaccess.h
@@ -316,7 +316,7 @@ do { \
316 " .previous\n" \ 316 " .previous\n" \
317 : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ 317 : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\
318 : "0"(__from), "1"(__to), "2"(size) \ 318 : "0"(__from), "1"(__to), "2"(size) \
319 : "memory"); \ 319 : "cc", "memory"); \
320 } \ 320 } \
321} while (0) 321} while (0)
322 322
@@ -352,7 +352,7 @@ do { \
352 " .previous\n" \ 352 " .previous\n" \
353 : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ 353 : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\
354 : "0"(__from), "1"(__to), "2"(size) \ 354 : "0"(__from), "1"(__to), "2"(size) \
355 : "memory"); \ 355 : "cc", "memory"); \
356 } \ 356 } \
357} while (0) 357} while (0)
358 358
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index 2a983931c11f..c05acb95c2a9 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -348,10 +348,11 @@
348#define __NR_pwritev 335 348#define __NR_pwritev 335
349#define __NR_rt_tgsigqueueinfo 336 349#define __NR_rt_tgsigqueueinfo 336
350#define __NR_perf_event_open 337 350#define __NR_perf_event_open 337
351#define __NR_recvmmsg 338
351 352
352#ifdef __KERNEL__ 353#ifdef __KERNEL__
353 354
354#define NR_syscalls 338 355#define NR_syscalls 339
355 356
356/* 357/*
357 * specify the deprecated syscalls we want to support on this arch 358 * specify the deprecated syscalls we want to support on this arch
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index c9ee6c009d79..88e3e1c3cc21 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -724,6 +724,7 @@ ENTRY(sys_call_table)
724 .long sys_pwritev /* 335 */ 724 .long sys_pwritev /* 335 */
725 .long sys_rt_tgsigqueueinfo 725 .long sys_rt_tgsigqueueinfo
726 .long sys_perf_event_open 726 .long sys_perf_event_open
727 .long sys_recvmmsg
727 728
728 729
729nr_syscalls=(.-sys_call_table)/4 730nr_syscalls=(.-sys_call_table)/4
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index 229b710fc5d5..ef34d5a0f8bd 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -380,7 +380,8 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask)
380 u32 epsw; 380 u32 epsw;
381 asm volatile(" bclr %1,(%2) \n" 381 asm volatile(" bclr %1,(%2) \n"
382 " mov epsw,%0 \n" 382 " mov epsw,%0 \n"
383 : "=d"(epsw) : "d"(mask), "a"(ptr)); 383 : "=d"(epsw) : "d"(mask), "a"(ptr)
384 : "cc", "memory");
384 return !(epsw & EPSW_FLAG_Z); 385 return !(epsw & EPSW_FLAG_Z);
385} 386}
386 387
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index a21f43bc68e2..717db14c2cc3 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -264,7 +264,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
264 264
265 /* this is the X/Open sanctioned signal stack switching. */ 265 /* this is the X/Open sanctioned signal stack switching. */
266 if (ka->sa.sa_flags & SA_ONSTACK) { 266 if (ka->sa.sa_flags & SA_ONSTACK) {
267 if (!on_sig_stack(sp)) 267 if (sas_ss_flags(sp) == 0)
268 sp = current->sas_ss_sp + current->sas_ss_size; 268 sp = current->sas_ss_sp + current->sas_ss_size;
269 } 269 }
270 270
diff --git a/arch/mn10300/lib/checksum.c b/arch/mn10300/lib/checksum.c
index 274f29ec33c1..b6580f5d89ee 100644
--- a/arch/mn10300/lib/checksum.c
+++ b/arch/mn10300/lib/checksum.c
@@ -22,6 +22,7 @@ static inline unsigned short from32to16(__wsum sum)
22 " addc 0xffff,%0 \n" 22 " addc 0xffff,%0 \n"
23 : "=r" (sum) 23 : "=r" (sum)
24 : "r" (sum << 16), "0" (sum & 0xffff0000) 24 : "r" (sum << 16), "0" (sum & 0xffff0000)
25 : "cc"
25 ); 26 );
26 return sum >> 16; 27 return sum >> 16;
27} 28}
diff --git a/arch/mn10300/lib/delay.c b/arch/mn10300/lib/delay.c
index cce66bc0822d..fdf6f710f94e 100644
--- a/arch/mn10300/lib/delay.c
+++ b/arch/mn10300/lib/delay.c
@@ -28,7 +28,8 @@ void __delay(unsigned long loops)
28 "2: add -1,%0 \n" 28 "2: add -1,%0 \n"
29 " bne 2b \n" 29 " bne 2b \n"
30 : "=&d" (d0) 30 : "=&d" (d0)
31 : "0" (loops)); 31 : "0" (loops)
32 : "cc");
32} 33}
33EXPORT_SYMBOL(__delay); 34EXPORT_SYMBOL(__delay);
34 35
diff --git a/arch/mn10300/lib/usercopy.c b/arch/mn10300/lib/usercopy.c
index a75b203059c1..7826e6c364e7 100644
--- a/arch/mn10300/lib/usercopy.c
+++ b/arch/mn10300/lib/usercopy.c
@@ -62,7 +62,7 @@ do { \
62 " .previous" \ 62 " .previous" \
63 :"=&r"(res), "=r"(count), "=&r"(w) \ 63 :"=&r"(res), "=r"(count), "=&r"(w) \
64 :"i"(-EFAULT), "1"(count), "a"(src), "a"(dst) \ 64 :"i"(-EFAULT), "1"(count), "a"(src), "a"(dst) \
65 :"memory"); \ 65 : "memory", "cc"); \
66} while (0) 66} while (0)
67 67
68long 68long
@@ -109,7 +109,7 @@ do { \
109 ".previous\n" \ 109 ".previous\n" \
110 : "+r"(size), "=&r"(w) \ 110 : "+r"(size), "=&r"(w) \
111 : "a"(addr), "d"(0) \ 111 : "a"(addr), "d"(0) \
112 : "memory"); \ 112 : "memory", "cc"); \
113} while (0) 113} while (0)
114 114
115unsigned long 115unsigned long
@@ -161,6 +161,6 @@ long strnlen_user(const char *s, long n)
161 ".previous\n" 161 ".previous\n"
162 :"=d"(res), "=&r"(w) 162 :"=d"(res), "=&r"(w)
163 :"0"(0), "a"(s), "r"(n) 163 :"0"(0), "a"(s), "r"(n)
164 :"memory"); 164 : "memory", "cc");
165 return res; 165 return res;
166} 166}
diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c
index f3649d8f50e3..ee82d624b3c6 100644
--- a/arch/mn10300/mm/dma-alloc.c
+++ b/arch/mn10300/mm/dma-alloc.c
@@ -16,12 +16,24 @@
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19static unsigned long pci_sram_allocated = 0xbc000000;
20
19void *dma_alloc_coherent(struct device *dev, size_t size, 21void *dma_alloc_coherent(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, int gfp) 22 dma_addr_t *dma_handle, int gfp)
21{ 23{
22 unsigned long addr; 24 unsigned long addr;
23 void *ret; 25 void *ret;
24 26
27 printk("dma_alloc_coherent(%s,%zu,,%x)\n", dev_name(dev), size, gfp);
28
29 if (0xbe000000 - pci_sram_allocated >= size) {
30 size = (size + 255) & ~255;
31 addr = pci_sram_allocated;
32 pci_sram_allocated += size;
33 ret = (void *) addr;
34 goto done;
35 }
36
25 /* ignore region specifiers */ 37 /* ignore region specifiers */
26 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); 38 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
27 39
@@ -41,7 +53,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
41 /* write back and evict all cache lines covering this region */ 53 /* write back and evict all cache lines covering this region */
42 mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE); 54 mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE);
43 55
56done:
44 *dma_handle = virt_to_bus((void *) addr); 57 *dma_handle = virt_to_bus((void *) addr);
58 printk("dma_alloc_coherent() = %p [%x]\n", ret, *dma_handle);
45 return ret; 59 return ret;
46} 60}
47EXPORT_SYMBOL(dma_alloc_coherent); 61EXPORT_SYMBOL(dma_alloc_coherent);
@@ -51,6 +65,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
51{ 65{
52 unsigned long addr = (unsigned long) vaddr & ~0x20000000; 66 unsigned long addr = (unsigned long) vaddr & ~0x20000000;
53 67
68 if (addr >= 0x9c000000)
69 return;
70
54 free_pages(addr, get_order(size)); 71 free_pages(addr, get_order(size));
55} 72}
56EXPORT_SYMBOL(dma_free_coherent); 73EXPORT_SYMBOL(dma_free_coherent);
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index ec1420562dc7..dd27a9a35152 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -118,8 +118,7 @@ void __init mem_init(void)
118 reservedpages << (PAGE_SHIFT - 10), 118 reservedpages << (PAGE_SHIFT - 10),
119 datasize >> 10, 119 datasize >> 10,
120 initsize >> 10, 120 initsize >> 10,
121 (unsigned long) (totalhigh_pages << (PAGE_SHIFT - 10)) 121 totalhigh_pages << (PAGE_SHIFT - 10));
122 );
123} 122}
124 123
125/* 124/*
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c
index 30016251f658..6dffbf97ac26 100644
--- a/arch/mn10300/mm/misalignment.c
+++ b/arch/mn10300/mm/misalignment.c
@@ -633,13 +633,13 @@ static int misalignment_addr(unsigned long *registers, unsigned long sp,
633 goto displace_or_inc; 633 goto displace_or_inc;
634 case SD24: 634 case SD24:
635 tmp = disp << 8; 635 tmp = disp << 8;
636 asm("asr 8,%0" : "=r"(tmp) : "0"(tmp)); 636 asm("asr 8,%0" : "=r"(tmp) : "0"(tmp) : "cc");
637 disp = (long) tmp; 637 disp = (long) tmp;
638 goto displace_or_inc; 638 goto displace_or_inc;
639 case SIMM4_2: 639 case SIMM4_2:
640 tmp = opcode >> 4 & 0x0f; 640 tmp = opcode >> 4 & 0x0f;
641 tmp <<= 28; 641 tmp <<= 28;
642 asm("asr 28,%0" : "=r"(tmp) : "0"(tmp)); 642 asm("asr 28,%0" : "=r"(tmp) : "0"(tmp) : "cc");
643 disp = (long) tmp; 643 disp = (long) tmp;
644 goto displace_or_inc; 644 goto displace_or_inc;
645 case IMM8: 645 case IMM8:
diff --git a/arch/mn10300/unit-asb2305/include/unit/serial.h b/arch/mn10300/unit-asb2305/include/unit/serial.h
index 3bfc90938787..8086cc092cec 100644
--- a/arch/mn10300/unit-asb2305/include/unit/serial.h
+++ b/arch/mn10300/unit-asb2305/include/unit/serial.h
@@ -11,7 +11,7 @@
11#ifndef _ASM_UNIT_SERIAL_H 11#ifndef _ASM_UNIT_SERIAL_H
12#define _ASM_UNIT_SERIAL_H 12#define _ASM_UNIT_SERIAL_H
13 13
14#include <asm/cpu/cpu-regs.h> 14#include <asm/cpu-regs.h>
15#include <proc/irq.h> 15#include <proc/irq.h>
16#include <linux/serial_reg.h> 16#include <linux/serial_reg.h>
17 17
diff --git a/arch/mn10300/unit-asb2305/include/unit/timex.h b/arch/mn10300/unit-asb2305/include/unit/timex.h
index a71c49aa85eb..d1c72d59fa9f 100644
--- a/arch/mn10300/unit-asb2305/include/unit/timex.h
+++ b/arch/mn10300/unit-asb2305/include/unit/timex.h
@@ -15,7 +15,7 @@
15#include <linux/irq.h> 15#include <linux/irq.h>
16#endif /* __ASSEMBLY__ */ 16#endif /* __ASSEMBLY__ */
17 17
18#include <asm/cpu/timer-regs.h> 18#include <asm/timer-regs.h>
19#include <unit/clock.h> 19#include <unit/clock.h>
20 20
21/* 21/*
diff --git a/arch/mn10300/unit-asb2305/leds.c b/arch/mn10300/unit-asb2305/leds.c
index d345ff9042d5..6f8de9954026 100644
--- a/arch/mn10300/unit-asb2305/leds.c
+++ b/arch/mn10300/unit-asb2305/leds.c
@@ -13,8 +13,8 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/cpu/intctl-regs.h> 16#include <asm/intctl-regs.h>
17#include <asm/cpu/rtc-regs.h> 17#include <asm/rtc-regs.h>
18#include <unit/leds.h> 18#include <unit/leds.h>
19 19
20static const u8 asb2305_led_hex_tbl[16] = { 20static const u8 asb2305_led_hex_tbl[16] = {
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index d100ca788468..78cd134ddf7d 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -218,45 +218,6 @@ void __init pcibios_resource_survey(void)
218 pcibios_allocate_resources(1); 218 pcibios_allocate_resources(1);
219} 219}
220 220
221int pcibios_enable_resources(struct pci_dev *dev, int mask)
222{
223 u16 cmd, old_cmd;
224 int idx;
225 struct resource *r;
226
227 pci_read_config_word(dev, PCI_COMMAND, &cmd);
228 old_cmd = cmd;
229
230 for (idx = 0; idx < 6; idx++) {
231 /* Only set up the requested stuff */
232 if (!(mask & (1 << idx)))
233 continue;
234
235 r = &dev->resource[idx];
236
237 if (!r->start && r->end) {
238 printk(KERN_ERR
239 "PCI: Device %s not available because of"
240 " resource collisions\n",
241 pci_name(dev));
242 return -EINVAL;
243 }
244
245 if (r->flags & IORESOURCE_IO)
246 cmd |= PCI_COMMAND_IO;
247 if (r->flags & IORESOURCE_MEM)
248 cmd |= PCI_COMMAND_MEMORY;
249 }
250
251 if (dev->resource[PCI_ROM_RESOURCE].start)
252 cmd |= PCI_COMMAND_MEMORY;
253
254 if (cmd != old_cmd)
255 pci_write_config_word(dev, PCI_COMMAND, cmd);
256
257 return 0;
258}
259
260/* 221/*
261 * If we set up a device for bus mastering, we need to check the latency 222 * If we set up a device for bus mastering, we need to check the latency
262 * timer as certain crappy BIOSes forget to set it properly. 223 * timer as certain crappy BIOSes forget to set it properly.
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h
index 9763d1ce343a..c3fa294b6e28 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.h
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.h
@@ -34,7 +34,6 @@ extern unsigned int pci_probe;
34extern unsigned int pcibios_max_latency; 34extern unsigned int pcibios_max_latency;
35 35
36extern void pcibios_resource_survey(void); 36extern void pcibios_resource_survey(void);
37extern int pcibios_enable_resources(struct pci_dev *dev, int mask);
38 37
39/* pci.c */ 38/* pci.c */
40 39
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 07dbbcda3b2e..2cb7e75ba1c0 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -27,6 +27,29 @@ struct pci_bus *pci_root_bus;
27struct pci_ops *pci_root_ops; 27struct pci_ops *pci_root_ops;
28 28
29/* 29/*
30 * The accessible PCI window does not cover the entire CPU address space, but
31 * there are devices we want to access outside of that window, so we need to
32 * insert specific PCI bus resources instead of using the platform-level bus
33 * resources directly for the PCI root bus.
34 *
35 * These are configured and inserted by pcibios_init() and are attached to the
36 * root bus by pcibios_fixup_bus().
37 */
38static struct resource pci_ioport_resource = {
39 .name = "PCI IO",
40 .start = 0xbe000000,
41 .end = 0xbe03ffff,
42 .flags = IORESOURCE_IO,
43};
44
45static struct resource pci_iomem_resource = {
46 .name = "PCI mem",
47 .start = 0xb8000000,
48 .end = 0xbbffffff,
49 .flags = IORESOURCE_MEM,
50};
51
52/*
30 * Functions for accessing PCI configuration space 53 * Functions for accessing PCI configuration space
31 */ 54 */
32 55
@@ -279,7 +302,7 @@ static int __init pci_sanity_check(struct pci_ops *o)
279 (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) 302 (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ)))
280 return 1; 303 return 1;
281 304
282 printk(KERN_ERROR "PCI: Sanity check failed\n"); 305 printk(KERN_ERR "PCI: Sanity check failed\n");
283 return 0; 306 return 0;
284} 307}
285 308
@@ -297,6 +320,7 @@ static int __init pci_check_direct(void)
297 printk(KERN_INFO "PCI: Using configuration ampci\n"); 320 printk(KERN_INFO "PCI: Using configuration ampci\n");
298 request_mem_region(0xBE040000, 256, "AMPCI bridge"); 321 request_mem_region(0xBE040000, 256, "AMPCI bridge");
299 request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); 322 request_mem_region(0xBFFFFFF4, 12, "PCI ampci");
323 request_mem_region(0xBC000000, 32 * 1024 * 1024, "PCI SRAM");
300 return 0; 324 return 0;
301 } 325 }
302 326
@@ -358,6 +382,11 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
358{ 382{
359 struct pci_dev *dev; 383 struct pci_dev *dev;
360 384
385 if (bus->number == 0) {
386 bus->resource[0] = &pci_ioport_resource;
387 bus->resource[1] = &pci_iomem_resource;
388 }
389
361 if (bus->self) { 390 if (bus->self) {
362 pci_read_bridge_bases(bus); 391 pci_read_bridge_bases(bus);
363 pcibios_fixup_device_resources(bus->self); 392 pcibios_fixup_device_resources(bus->self);
@@ -380,6 +409,11 @@ static int __init pcibios_init(void)
380 iomem_resource.start = 0xA0000000; 409 iomem_resource.start = 0xA0000000;
381 iomem_resource.end = 0xDFFFFFFF; 410 iomem_resource.end = 0xDFFFFFFF;
382 411
412 if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0)
413 panic("Unable to insert PCI IOMEM resource\n");
414 if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0)
415 panic("Unable to insert PCI IOPORT resource\n");
416
383 if (!pci_probe) 417 if (!pci_probe)
384 return 0; 418 return 0;
385 419
@@ -391,32 +425,11 @@ static int __init pcibios_init(void)
391 printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", 425 printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n",
392 MEM_PAGING_REG); 426 MEM_PAGING_REG);
393 427
394 { 428 pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL);
395#if 0
396 static struct pci_bus am33_root_bus = {
397 .children = LIST_HEAD_INIT(am33_root_bus.children),
398 .devices = LIST_HEAD_INIT(am33_root_bus.devices),
399 .number = 0,
400 .secondary = 0,
401 .resource = { &ioport_resource, &iomem_resource },
402 };
403
404 am33_root_bus.ops = pci_root_ops;
405 list_add_tail(&am33_root_bus.node, &pci_root_buses);
406
407 am33_root_bus.subordinate = pci_do_scan_bus(0);
408
409 pci_root_bus = &am33_root_bus;
410#else
411 pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL);
412#endif
413 }
414 429
415 pcibios_irq_init(); 430 pcibios_irq_init();
416 pcibios_fixup_irqs(); 431 pcibios_fixup_irqs();
417#if 0
418 pcibios_resource_survey(); 432 pcibios_resource_survey();
419#endif
420 return 0; 433 return 0;
421} 434}
422 435
@@ -440,7 +453,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
440{ 453{
441 int err; 454 int err;
442 455
443 err = pcibios_enable_resources(dev, mask); 456 err = pci_enable_resources(dev, mask);
444 if (err == 0) 457 if (err == 0)
445 pcibios_enable_irq(dev); 458 pcibios_enable_irq(dev);
446 return err; 459 return err;
@@ -455,6 +468,7 @@ static void __init unit_disable_pcnet(struct pci_bus *bus, struct pci_ops *o)
455 468
456 bus->number = 0; 469 bus->number = 0;
457 470
471 o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x);
458 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); 472 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x);
459 x |= PCI_COMMAND_MASTER | 473 x |= PCI_COMMAND_MASTER |
460 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 474 PCI_COMMAND_IO | PCI_COMMAND_MEMORY |
diff --git a/arch/mn10300/unit-asb2305/unit-init.c b/arch/mn10300/unit-asb2305/unit-init.c
index 1c452cc3f6e9..a76c8e0ab90f 100644
--- a/arch/mn10300/unit-asb2305/unit-init.c
+++ b/arch/mn10300/unit-asb2305/unit-init.c
@@ -15,9 +15,8 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/setup.h> 16#include <asm/setup.h>
17#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/cpu/intctl-regs.h> 18#include <asm/intctl-regs.h>
19#include <asm/cpu/rtc-regs.h> 19#include <asm/serial-regs.h>
20#include <asm/cpu/serial-regs.h>
21#include <unit/serial.h> 20#include <unit/serial.h>
22 21
23/* 22/*
diff --git a/arch/parisc/include/asm/asm-offsets.h b/arch/parisc/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/parisc/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index bb2465bcb327..826a30a00f59 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -20,7 +20,7 @@
20all: $(obj)/zImage 20all: $(obj)/zImage
21 21
22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
23 -fno-strict-aliasing -Os -msoft-float -pipe \ 23 -fno-strict-aliasing -Os -msoft-float -pipe -D__KERNEL__\
24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
25 -isystem $(shell $(CROSS32CC) -print-file-name=include) 25 -isystem $(shell $(CROSS32CC) -print-file-name=include)
26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
@@ -34,6 +34,8 @@ BOOTCFLAGS += -fno-stack-protector
34endif 34endif
35 35
36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) 36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
37BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include
38BOOTCFLAGS += -Iinclude
37 39
38DTS_FLAGS ?= -p 1024 40DTS_FLAGS ?= -p 1024
39 41
diff --git a/arch/powerpc/boot/dts/katmai.dts b/arch/powerpc/boot/dts/katmai.dts
index 51eb6ed5da2d..8f345de960cd 100644
--- a/arch/powerpc/boot/dts/katmai.dts
+++ b/arch/powerpc/boot/dts/katmai.dts
@@ -108,12 +108,19 @@
108 dcr-reg = <0x00c 0x002>; 108 dcr-reg = <0x00c 0x002>;
109 }; 109 };
110 110
111 MQ0: mq {
112 compatible = "ibm,mq-440spe";
113 dcr-reg = <0x040 0x020>;
114 };
115
111 plb { 116 plb {
112 compatible = "ibm,plb-440spe", "ibm,plb-440gp", "ibm,plb4"; 117 compatible = "ibm,plb-440spe", "ibm,plb-440gp", "ibm,plb4";
113 #address-cells = <2>; 118 #address-cells = <2>;
114 #size-cells = <1>; 119 #size-cells = <1>;
115 /* addr-child addr-parent size */ 120 /* addr-child addr-parent size */
116 ranges = <0x4 0xe0000000 0x4 0xe0000000 0x20000000 121 ranges = <0x4 0x00100000 0x4 0x00100000 0x00001000
122 0x4 0x00200000 0x4 0x00200000 0x00000400
123 0x4 0xe0000000 0x4 0xe0000000 0x20000000
117 0xc 0x00000000 0xc 0x00000000 0x20000000 124 0xc 0x00000000 0xc 0x00000000 0x20000000
118 0xd 0x00000000 0xd 0x00000000 0x80000000 125 0xd 0x00000000 0xd 0x00000000 0x80000000
119 0xd 0x80000000 0xd 0x80000000 0x80000000 126 0xd 0x80000000 0xd 0x80000000 0x80000000
@@ -400,6 +407,49 @@
400 0x0 0x0 0x0 0x3 &UIC3 0xa 0x4 /* swizzled int C */ 407 0x0 0x0 0x0 0x3 &UIC3 0xa 0x4 /* swizzled int C */
401 0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>; 408 0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>;
402 }; 409 };
410
411 I2O: i2o@400100000 {
412 compatible = "ibm,i2o-440spe";
413 reg = <0x00000004 0x00100000 0x100>;
414 dcr-reg = <0x060 0x020>;
415 };
416
417 DMA0: dma0@400100100 {
418 compatible = "ibm,dma-440spe";
419 cell-index = <0>;
420 reg = <0x00000004 0x00100100 0x100>;
421 dcr-reg = <0x060 0x020>;
422 interrupt-parent = <&DMA0>;
423 interrupts = <0 1>;
424 #interrupt-cells = <1>;
425 #address-cells = <0>;
426 #size-cells = <0>;
427 interrupt-map = <
428 0 &UIC0 0x14 4
429 1 &UIC1 0x16 4>;
430 };
431
432 DMA1: dma1@400100200 {
433 compatible = "ibm,dma-440spe";
434 cell-index = <1>;
435 reg = <0x00000004 0x00100200 0x100>;
436 dcr-reg = <0x060 0x020>;
437 interrupt-parent = <&DMA1>;
438 interrupts = <0 1>;
439 #interrupt-cells = <1>;
440 #address-cells = <0>;
441 #size-cells = <0>;
442 interrupt-map = <
443 0 &UIC0 0x16 4
444 1 &UIC1 0x16 4>;
445 };
446
447 xor-accel@400200000 {
448 compatible = "amcc,xor-accelerator";
449 reg = <0x00000004 0x00200000 0x400>;
450 interrupt-parent = <&UIC1>;
451 interrupts = <0x1f 4>;
452 };
403 }; 453 };
404 454
405 chosen { 455 chosen {
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 32e10f588c1d..8a3a4f3ef831 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -204,6 +204,7 @@
204 interrupt-parent = <&ipic>; 204 interrupt-parent = <&ipic>;
205 tbi-handle = <&tbi0>; 205 tbi-handle = <&tbi0>;
206 phy-handle = < &phy0 >; 206 phy-handle = < &phy0 >;
207 fsl,magic-packet;
207 208
208 mdio@520 { 209 mdio@520 {
209 #address-cells = <1>; 210 #address-cells = <1>;
@@ -246,6 +247,7 @@
246 interrupt-parent = <&ipic>; 247 interrupt-parent = <&ipic>;
247 tbi-handle = <&tbi1>; 248 tbi-handle = <&tbi1>;
248 phy-handle = < &phy1 >; 249 phy-handle = < &phy1 >;
250 fsl,magic-packet;
249 251
250 mdio@520 { 252 mdio@520 {
251 #address-cells = <1>; 253 #address-cells = <1>;
@@ -309,6 +311,22 @@
309 interrupt-parent = <&ipic>; 311 interrupt-parent = <&ipic>;
310 }; 312 };
311 313
314 gtm1: timer@500 {
315 compatible = "fsl,mpc8315-gtm", "fsl,gtm";
316 reg = <0x500 0x100>;
317 interrupts = <90 8 78 8 84 8 72 8>;
318 interrupt-parent = <&ipic>;
319 clock-frequency = <133333333>;
320 };
321
322 timer@600 {
323 compatible = "fsl,mpc8315-gtm", "fsl,gtm";
324 reg = <0x600 0x100>;
325 interrupts = <91 8 79 8 85 8 73 8>;
326 interrupt-parent = <&ipic>;
327 clock-frequency = <133333333>;
328 };
329
312 /* IPIC 330 /* IPIC
313 * interrupts cell = <intr #, sense> 331 * interrupts cell = <intr #, sense>
314 * sense values match linux IORESOURCE_IRQ_* defines: 332 * sense values match linux IORESOURCE_IRQ_* defines:
@@ -337,6 +355,15 @@
337 0x59 0x8>; 355 0x59 0x8>;
338 interrupt-parent = < &ipic >; 356 interrupt-parent = < &ipic >;
339 }; 357 };
358
359 pmc: power@b00 {
360 compatible = "fsl,mpc8315-pmc", "fsl,mpc8313-pmc",
361 "fsl,mpc8349-pmc";
362 reg = <0xb00 0x100 0xa00 0x100>;
363 interrupts = <80 8>;
364 interrupt-parent = <&ipic>;
365 fsl,mpc8313-wakeup-timer = <&gtm1>;
366 };
340 }; 367 };
341 368
342 pci0: pci@e0008500 { 369 pci0: pci@e0008500 {
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index feeeb7f9d609..b53d1df11e2d 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -63,6 +63,24 @@
63 reg = <0x200 0x100>; 63 reg = <0x200 0x100>;
64 }; 64 };
65 65
66 gpio1: gpio-controller@c00 {
67 #gpio-cells = <2>;
68 compatible = "fsl,mpc8349-gpio";
69 reg = <0xc00 0x100>;
70 interrupts = <74 0x8>;
71 interrupt-parent = <&ipic>;
72 gpio-controller;
73 };
74
75 gpio2: gpio-controller@d00 {
76 #gpio-cells = <2>;
77 compatible = "fsl,mpc8349-gpio";
78 reg = <0xd00 0x100>;
79 interrupts = <75 0x8>;
80 interrupt-parent = <&ipic>;
81 gpio-controller;
82 };
83
66 i2c@3000 { 84 i2c@3000 {
67 #address-cells = <1>; 85 #address-cells = <1>;
68 #size-cells = <0>; 86 #size-cells = <0>;
@@ -72,6 +90,12 @@
72 interrupts = <14 0x8>; 90 interrupts = <14 0x8>;
73 interrupt-parent = <&ipic>; 91 interrupt-parent = <&ipic>;
74 dfsrr; 92 dfsrr;
93
94 eeprom: at24@50 {
95 compatible = "st-micro,24c256";
96 reg = <0x50>;
97 };
98
75 }; 99 };
76 100
77 i2c@3100 { 101 i2c@3100 {
@@ -91,6 +115,25 @@
91 interrupt-parent = <&ipic>; 115 interrupt-parent = <&ipic>;
92 }; 116 };
93 117
118 pcf1: iexp@38 {
119 #gpio-cells = <2>;
120 compatible = "ti,pcf8574a";
121 reg = <0x38>;
122 gpio-controller;
123 };
124
125 pcf2: iexp@39 {
126 #gpio-cells = <2>;
127 compatible = "ti,pcf8574a";
128 reg = <0x39>;
129 gpio-controller;
130 };
131
132 spd: at24@51 {
133 compatible = "at24,spd";
134 reg = <0x51>;
135 };
136
94 mcu_pio: mcu@a { 137 mcu_pio: mcu@a {
95 #gpio-cells = <2>; 138 #gpio-cells = <2>;
96 compatible = "fsl,mc9s08qg8-mpc8349emitx", 139 compatible = "fsl,mc9s08qg8-mpc8349emitx",
@@ -275,6 +318,24 @@
275 reg = <0x700 0x100>; 318 reg = <0x700 0x100>;
276 device_type = "ipic"; 319 device_type = "ipic";
277 }; 320 };
321
322 gpio-leds {
323 compatible = "gpio-leds";
324
325 green {
326 label = "Green";
327 gpios = <&pcf1 0 1>;
328 linux,default-trigger = "heartbeat";
329 };
330
331 yellow {
332 label = "Yellow";
333 gpios = <&pcf1 1 1>;
334 /* linux,default-trigger = "heartbeat"; */
335 default-state = "on";
336 };
337 };
338
278 }; 339 };
279 340
280 pci0: pci@e0008500 { 341 pci0: pci@e0008500 {
@@ -331,7 +392,26 @@
331 compatible = "fsl,mpc8349e-localbus", 392 compatible = "fsl,mpc8349e-localbus",
332 "fsl,pq2pro-localbus"; 393 "fsl,pq2pro-localbus";
333 reg = <0xe0005000 0xd8>; 394 reg = <0xe0005000 0xd8>;
334 ranges = <0x3 0x0 0xf0000000 0x210>; 395 ranges = <0x0 0x0 0xfe000000 0x1000000 /* flash */
396 0x1 0x0 0xf8000000 0x20000 /* VSC 7385 */
397 0x2 0x0 0xf9000000 0x200000 /* exp slot */
398 0x3 0x0 0xf0000000 0x210>; /* CF slot */
399
400 flash@0,0 {
401 compatible = "cfi-flash";
402 reg = <0x0 0x0 0x800000>;
403 bank-width = <2>;
404 device-width = <1>;
405 };
406
407 flash@0,800000 {
408 #address-cells = <1>;
409 #size-cells = <1>;
410 compatible = "cfi-flash";
411 reg = <0x0 0x800000 0x800000>;
412 bank-width = <2>;
413 device-width = <1>;
414 };
335 415
336 pata@3,0 { 416 pata@3,0 {
337 compatible = "fsl,mpc8349emitx-pata", "ata-generic"; 417 compatible = "fsl,mpc8349emitx-pata", "ata-generic";
diff --git a/arch/powerpc/boot/dts/warp.dts b/arch/powerpc/boot/dts/warp.dts
index 31605ee4afb6..e576ee85c42f 100644
--- a/arch/powerpc/boot/dts/warp.dts
+++ b/arch/powerpc/boot/dts/warp.dts
@@ -146,7 +146,7 @@
146 146
147 fpga@2,4000 { 147 fpga@2,4000 {
148 compatible = "pika,fpga-sd"; 148 compatible = "pika,fpga-sd";
149 reg = <0x00000002 0x00004000 0x00000A00>; 149 reg = <0x00000002 0x00004000 0x00004000>;
150 }; 150 };
151 151
152 nor@0,0 { 152 nor@0,0 {
diff --git a/arch/powerpc/boot/ugecon.c b/arch/powerpc/boot/ugecon.c
index 50609ea6ddf8..8f2a6b311534 100644
--- a/arch/powerpc/boot/ugecon.c
+++ b/arch/powerpc/boot/ugecon.c
@@ -86,7 +86,7 @@ static void ug_putc(char ch)
86 86
87 while (!ug_is_txfifo_ready() && count--) 87 while (!ug_is_txfifo_ready() && count--)
88 barrier(); 88 barrier();
89 if (count) 89 if (count >= 0)
90 ug_raw_putc(ch); 90 ug_raw_putc(ch);
91} 91}
92 92
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index fc905924c022..826a65d3f002 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -757,7 +757,7 @@ CONFIG_SUNGEM=y
757# CONFIG_B44 is not set 757# CONFIG_B44 is not set
758# CONFIG_ATL2 is not set 758# CONFIG_ATL2 is not set
759CONFIG_NETDEV_1000=y 759CONFIG_NETDEV_1000=y
760CONFIG_ACENIC=y 760CONFIG_ACENIC=m
761CONFIG_ACENIC_OMIT_TIGON_I=y 761CONFIG_ACENIC_OMIT_TIGON_I=y
762# CONFIG_DL2K is not set 762# CONFIG_DL2K is not set
763CONFIG_E1000=y 763CONFIG_E1000=y
@@ -794,8 +794,8 @@ CONFIG_NETDEV_10000=y
794# CONFIG_BNX2X is not set 794# CONFIG_BNX2X is not set
795# CONFIG_QLGE is not set 795# CONFIG_QLGE is not set
796# CONFIG_SFC is not set 796# CONFIG_SFC is not set
797CONFIG_TR=y 797# CONFIG_TR is not set
798CONFIG_IBMOL=y 798# CONFIG_IBMOL is not set
799# CONFIG_3C359 is not set 799# CONFIG_3C359 is not set
800# CONFIG_TMS380TR is not set 800# CONFIG_TMS380TR is not set
801 801
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig
index f925c555508e..76982c51a4c7 100644
--- a/arch/powerpc/configs/iseries_defconfig
+++ b/arch/powerpc/configs/iseries_defconfig
@@ -714,8 +714,8 @@ CONFIG_NETDEV_10000=y
714# CONFIG_BNX2X is not set 714# CONFIG_BNX2X is not set
715# CONFIG_QLGE is not set 715# CONFIG_QLGE is not set
716# CONFIG_SFC is not set 716# CONFIG_SFC is not set
717CONFIG_TR=y 717# CONFIG_TR is not set
718CONFIG_IBMOL=y 718# CONFIG_IBMOL is not set
719# CONFIG_3C359 is not set 719# CONFIG_3C359 is not set
720# CONFIG_TMS380TR is not set 720# CONFIG_TMS380TR is not set
721 721
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index 252401824575..7b3804a6e363 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -304,11 +304,11 @@ CONFIG_TICK_ONESHOT=y
304CONFIG_NO_HZ=y 304CONFIG_NO_HZ=y
305CONFIG_HIGH_RES_TIMERS=y 305CONFIG_HIGH_RES_TIMERS=y
306CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 306CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
307# CONFIG_HZ_100 is not set 307CONFIG_HZ_100=y
308CONFIG_HZ_250=y 308# CONFIG_HZ_250 is not set
309# CONFIG_HZ_300 is not set 309# CONFIG_HZ_300 is not set
310# CONFIG_HZ_1000 is not set 310# CONFIG_HZ_1000 is not set
311CONFIG_HZ=250 311CONFIG_HZ=100
312CONFIG_SCHED_HRTICK=y 312CONFIG_SCHED_HRTICK=y
313CONFIG_PREEMPT_NONE=y 313CONFIG_PREEMPT_NONE=y
314# CONFIG_PREEMPT_VOLUNTARY is not set 314# CONFIG_PREEMPT_VOLUNTARY is not set
@@ -980,7 +980,7 @@ CONFIG_E100=y
980# CONFIG_SC92031 is not set 980# CONFIG_SC92031 is not set
981# CONFIG_ATL2 is not set 981# CONFIG_ATL2 is not set
982CONFIG_NETDEV_1000=y 982CONFIG_NETDEV_1000=y
983CONFIG_ACENIC=y 983CONFIG_ACENIC=m
984CONFIG_ACENIC_OMIT_TIGON_I=y 984CONFIG_ACENIC_OMIT_TIGON_I=y
985# CONFIG_DL2K is not set 985# CONFIG_DL2K is not set
986CONFIG_E1000=y 986CONFIG_E1000=y
@@ -1023,8 +1023,8 @@ CONFIG_PASEMI_MAC=y
1023# CONFIG_BNX2X is not set 1023# CONFIG_BNX2X is not set
1024# CONFIG_QLGE is not set 1024# CONFIG_QLGE is not set
1025# CONFIG_SFC is not set 1025# CONFIG_SFC is not set
1026CONFIG_TR=y 1026# CONFIG_TR is not set
1027CONFIG_IBMOL=y 1027# CONFIG_IBMOL is not set
1028# CONFIG_3C359 is not set 1028# CONFIG_3C359 is not set
1029# CONFIG_TMS380TR is not set 1029# CONFIG_TMS380TR is not set
1030 1030
@@ -1863,7 +1863,7 @@ CONFIG_HFSPLUS_FS=m
1863# CONFIG_BEFS_FS is not set 1863# CONFIG_BEFS_FS is not set
1864# CONFIG_BFS_FS is not set 1864# CONFIG_BFS_FS is not set
1865# CONFIG_EFS_FS is not set 1865# CONFIG_EFS_FS is not set
1866CONFIG_CRAMFS=y 1866CONFIG_CRAMFS=m
1867# CONFIG_VXFS_FS is not set 1867# CONFIG_VXFS_FS is not set
1868# CONFIG_MINIX_FS is not set 1868# CONFIG_MINIX_FS is not set
1869# CONFIG_OMFS_FS is not set 1869# CONFIG_OMFS_FS is not set
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig
index 18af46036258..8195f1650cbf 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -1008,8 +1008,8 @@ CONFIG_IXGB=m
1008# CONFIG_QLGE is not set 1008# CONFIG_QLGE is not set
1009# CONFIG_SFC is not set 1009# CONFIG_SFC is not set
1010# CONFIG_BE2NET is not set 1010# CONFIG_BE2NET is not set
1011CONFIG_TR=y 1011# CONFIG_TR is not set
1012CONFIG_IBMOL=y 1012# CONFIG_IBMOL is not set
1013# CONFIG_3C359 is not set 1013# CONFIG_3C359 is not set
1014# CONFIG_TMS380TR is not set 1014# CONFIG_TMS380TR is not set
1015CONFIG_WLAN=y 1015CONFIG_WLAN=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index c568329723b8..ca9ff9aad74a 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -230,11 +230,11 @@ CONFIG_TICK_ONESHOT=y
230CONFIG_NO_HZ=y 230CONFIG_NO_HZ=y
231CONFIG_HIGH_RES_TIMERS=y 231CONFIG_HIGH_RES_TIMERS=y
232CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 232CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
233# CONFIG_HZ_100 is not set 233CONFIG_HZ_100=y
234CONFIG_HZ_250=y 234# CONFIG_HZ_250 is not set
235# CONFIG_HZ_300 is not set 235# CONFIG_HZ_300 is not set
236# CONFIG_HZ_1000 is not set 236# CONFIG_HZ_1000 is not set
237CONFIG_HZ=250 237CONFIG_HZ=100
238CONFIG_SCHED_HRTICK=y 238CONFIG_SCHED_HRTICK=y
239CONFIG_PREEMPT_NONE=y 239CONFIG_PREEMPT_NONE=y
240# CONFIG_PREEMPT_VOLUNTARY is not set 240# CONFIG_PREEMPT_VOLUNTARY is not set
@@ -796,7 +796,7 @@ CONFIG_E100=y
796# CONFIG_NET_POCKET is not set 796# CONFIG_NET_POCKET is not set
797# CONFIG_ATL2 is not set 797# CONFIG_ATL2 is not set
798CONFIG_NETDEV_1000=y 798CONFIG_NETDEV_1000=y
799CONFIG_ACENIC=y 799CONFIG_ACENIC=m
800CONFIG_ACENIC_OMIT_TIGON_I=y 800CONFIG_ACENIC_OMIT_TIGON_I=y
801# CONFIG_DL2K is not set 801# CONFIG_DL2K is not set
802CONFIG_E1000=y 802CONFIG_E1000=y
@@ -834,8 +834,8 @@ CONFIG_S2IO=m
834# CONFIG_BNX2X is not set 834# CONFIG_BNX2X is not set
835# CONFIG_QLGE is not set 835# CONFIG_QLGE is not set
836# CONFIG_SFC is not set 836# CONFIG_SFC is not set
837CONFIG_TR=y 837# CONFIG_TR is not set
838CONFIG_IBMOL=y 838# CONFIG_IBMOL is not set
839# CONFIG_3C359 is not set 839# CONFIG_3C359 is not set
840# CONFIG_TMS380TR is not set 840# CONFIG_TMS380TR is not set
841 841
@@ -1494,7 +1494,7 @@ CONFIG_CONFIGFS_FS=m
1494# CONFIG_BEFS_FS is not set 1494# CONFIG_BEFS_FS is not set
1495# CONFIG_BFS_FS is not set 1495# CONFIG_BFS_FS is not set
1496# CONFIG_EFS_FS is not set 1496# CONFIG_EFS_FS is not set
1497CONFIG_CRAMFS=y 1497CONFIG_CRAMFS=m
1498# CONFIG_VXFS_FS is not set 1498# CONFIG_VXFS_FS is not set
1499# CONFIG_MINIX_FS is not set 1499# CONFIG_MINIX_FS is not set
1500# CONFIG_OMFS_FS is not set 1500# CONFIG_OMFS_FS is not set
diff --git a/arch/powerpc/include/asm/asm-offsets.h b/arch/powerpc/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/powerpc/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
index 64e1fdca233e..2c15212e1700 100644
--- a/arch/powerpc/include/asm/bug.h
+++ b/arch/powerpc/include/asm/bug.h
@@ -68,7 +68,7 @@
68 _EMIT_BUG_ENTRY \ 68 _EMIT_BUG_ENTRY \
69 : : "i" (__FILE__), "i" (__LINE__), \ 69 : : "i" (__FILE__), "i" (__LINE__), \
70 "i" (0), "i" (sizeof(struct bug_entry))); \ 70 "i" (0), "i" (sizeof(struct bug_entry))); \
71 for(;;) ; \ 71 unreachable(); \
72} while (0) 72} while (0)
73 73
74#define BUG_ON(x) do { \ 74#define BUG_ON(x) do { \
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
index ea04632399d8..38762edb5e58 100644
--- a/arch/powerpc/include/asm/gpio.h
+++ b/arch/powerpc/include/asm/gpio.h
@@ -38,12 +38,9 @@ static inline int gpio_cansleep(unsigned int gpio)
38 return __gpio_cansleep(gpio); 38 return __gpio_cansleep(gpio);
39} 39}
40 40
41/*
42 * Not implemented, yet.
43 */
44static inline int gpio_to_irq(unsigned int gpio) 41static inline int gpio_to_irq(unsigned int gpio)
45{ 42{
46 return -ENOSYS; 43 return __gpio_to_irq(gpio);
47} 44}
48 45
49static inline int irq_to_gpio(unsigned int irq) 46static inline int irq_to_gpio(unsigned int irq)
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
index 3839839f83c7..b876e989220b 100644
--- a/arch/powerpc/kernel/align.c
+++ b/arch/powerpc/kernel/align.c
@@ -642,10 +642,14 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg,
642 */ 642 */
643static int emulate_vsx(unsigned char __user *addr, unsigned int reg, 643static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
644 unsigned int areg, struct pt_regs *regs, 644 unsigned int areg, struct pt_regs *regs,
645 unsigned int flags, unsigned int length) 645 unsigned int flags, unsigned int length,
646 unsigned int elsize)
646{ 647{
647 char *ptr; 648 char *ptr;
649 unsigned long *lptr;
648 int ret = 0; 650 int ret = 0;
651 int sw = 0;
652 int i, j;
649 653
650 flush_vsx_to_thread(current); 654 flush_vsx_to_thread(current);
651 655
@@ -654,19 +658,35 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
654 else 658 else
655 ptr = (char *) &current->thread.vr[reg - 32]; 659 ptr = (char *) &current->thread.vr[reg - 32];
656 660
657 if (flags & ST) 661 lptr = (unsigned long *) ptr;
658 ret = __copy_to_user(addr, ptr, length); 662
659 else { 663 if (flags & SW)
660 if (flags & SPLT){ 664 sw = elsize-1;
661 ret = __copy_from_user(ptr, addr, length); 665
662 ptr += length; 666 for (j = 0; j < length; j += elsize) {
667 for (i = 0; i < elsize; ++i) {
668 if (flags & ST)
669 ret |= __put_user(ptr[i^sw], addr + i);
670 else
671 ret |= __get_user(ptr[i^sw], addr + i);
663 } 672 }
664 ret |= __copy_from_user(ptr, addr, length); 673 ptr += elsize;
674 addr += elsize;
665 } 675 }
666 if (flags & U) 676
667 regs->gpr[areg] = regs->dar; 677 if (!ret) {
668 if (ret) 678 if (flags & U)
679 regs->gpr[areg] = regs->dar;
680
681 /* Splat load copies the same data to top and bottom 8 bytes */
682 if (flags & SPLT)
683 lptr[1] = lptr[0];
684 /* For 8 byte loads, zero the top 8 bytes */
685 else if (!(flags & ST) && (8 == length))
686 lptr[1] = 0;
687 } else
669 return -EFAULT; 688 return -EFAULT;
689
670 return 1; 690 return 1;
671} 691}
672#endif 692#endif
@@ -767,16 +787,25 @@ int fix_alignment(struct pt_regs *regs)
767 787
768#ifdef CONFIG_VSX 788#ifdef CONFIG_VSX
769 if ((instruction & 0xfc00003e) == 0x7c000018) { 789 if ((instruction & 0xfc00003e) == 0x7c000018) {
770 /* Additional register addressing bit (64 VSX vs 32 FPR/GPR */ 790 unsigned int elsize;
791
792 /* Additional register addressing bit (64 VSX vs 32 FPR/GPR) */
771 reg |= (instruction & 0x1) << 5; 793 reg |= (instruction & 0x1) << 5;
772 /* Simple inline decoder instead of a table */ 794 /* Simple inline decoder instead of a table */
795 /* VSX has only 8 and 16 byte memory accesses */
796 nb = 8;
773 if (instruction & 0x200) 797 if (instruction & 0x200)
774 nb = 16; 798 nb = 16;
775 else if (instruction & 0x080) 799
776 nb = 8; 800 /* Vector stores in little-endian mode swap individual
777 else 801 elements, so process them separately */
778 nb = 4; 802 elsize = 4;
803 if (instruction & 0x80)
804 elsize = 8;
805
779 flags = 0; 806 flags = 0;
807 if (regs->msr & MSR_LE)
808 flags |= SW;
780 if (instruction & 0x100) 809 if (instruction & 0x100)
781 flags |= ST; 810 flags |= ST;
782 if (instruction & 0x040) 811 if (instruction & 0x040)
@@ -787,7 +816,7 @@ int fix_alignment(struct pt_regs *regs)
787 nb = 8; 816 nb = 8;
788 } 817 }
789 PPC_WARN_ALIGNMENT(vsx, regs); 818 PPC_WARN_ALIGNMENT(vsx, regs);
790 return emulate_vsx(addr, reg, areg, regs, flags, nb); 819 return emulate_vsx(addr, reg, areg, regs, flags, nb, elsize);
791 } 820 }
792#endif 821#endif
793 /* A size of 0 indicates an instruction we don't support, with 822 /* A size of 0 indicates an instruction we don't support, with
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e8dfdbd9327a..cadbed679fbb 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1107,6 +1107,12 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1107 list_for_each_entry(dev, &bus->devices, bus_list) { 1107 list_for_each_entry(dev, &bus->devices, bus_list) {
1108 struct dev_archdata *sd = &dev->dev.archdata; 1108 struct dev_archdata *sd = &dev->dev.archdata;
1109 1109
1110 /* Cardbus can call us to add new devices to a bus, so ignore
1111 * those who are already fully discovered
1112 */
1113 if (dev->is_added)
1114 continue;
1115
1110 /* Setup OF node pointer in archdata */ 1116 /* Setup OF node pointer in archdata */
1111 sd->of_node = pci_device_to_OF_node(dev); 1117 sd->of_node = pci_device_to_OF_node(dev);
1112 1118
@@ -1147,6 +1153,13 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1147} 1153}
1148EXPORT_SYMBOL(pcibios_fixup_bus); 1154EXPORT_SYMBOL(pcibios_fixup_bus);
1149 1155
1156void __devinit pci_fixup_cardbus(struct pci_bus *bus)
1157{
1158 /* Now fixup devices on that bus */
1159 pcibios_setup_bus_devices(bus);
1160}
1161
1162
1150static int skip_isa_ioresource_align(struct pci_dev *dev) 1163static int skip_isa_ioresource_align(struct pci_dev *dev)
1151{ 1164{
1152 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && 1165 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index 5598f88f142e..e4beeb371a73 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -390,6 +390,26 @@ static void kvmppc_mmu_book3s_64_mtsrin(struct kvm_vcpu *vcpu, u32 srnum,
390{ 390{
391 u64 rb = 0, rs = 0; 391 u64 rb = 0, rs = 0;
392 392
393 /*
394 * According to Book3 2.01 mtsrin is implemented as:
395 *
396 * The SLB entry specified by (RB)32:35 is loaded from register
397 * RS, as follows.
398 *
399 * SLBE Bit Source SLB Field
400 *
401 * 0:31 0x0000_0000 ESID-0:31
402 * 32:35 (RB)32:35 ESID-32:35
403 * 36 0b1 V
404 * 37:61 0x00_0000|| 0b0 VSID-0:24
405 * 62:88 (RS)37:63 VSID-25:51
406 * 89:91 (RS)33:35 Ks Kp N
407 * 92 (RS)36 L ((RS)36 must be 0b0)
408 * 93 0b0 C
409 */
410
411 dprintk("KVM MMU: mtsrin(0x%x, 0x%lx)\n", srnum, value);
412
393 /* ESID = srnum */ 413 /* ESID = srnum */
394 rb |= (srnum & 0xf) << 28; 414 rb |= (srnum & 0xf) << 28;
395 /* Set the valid bit */ 415 /* Set the valid bit */
@@ -400,7 +420,7 @@ static void kvmppc_mmu_book3s_64_mtsrin(struct kvm_vcpu *vcpu, u32 srnum,
400 /* VSID = VSID */ 420 /* VSID = VSID */
401 rs |= (value & 0xfffffff) << 12; 421 rs |= (value & 0xfffffff) << 12;
402 /* flags = flags */ 422 /* flags = flags */
403 rs |= ((value >> 27) & 0xf) << 9; 423 rs |= ((value >> 28) & 0x7) << 9;
404 424
405 kvmppc_mmu_book3s_64_slbmte(vcpu, rs, rb); 425 kvmppc_mmu_book3s_64_slbmte(vcpu, rs, rb);
406} 426}
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 50f867d657df..3ecdcec0a39e 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -340,7 +340,7 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
340 else 340 else
341 def->tlbiel = 0; 341 def->tlbiel = 0;
342 342
343 DBG(" %d: shift=%02x, sllp=%04x, avpnm=%08x, " 343 DBG(" %d: shift=%02x, sllp=%04lx, avpnm=%08lx, "
344 "tlbiel=%d, penc=%d\n", 344 "tlbiel=%d, penc=%d\n",
345 idx, shift, def->sllp, def->avpnm, def->tlbiel, 345 idx, shift, def->sllp, def->avpnm, def->tlbiel,
346 def->penc); 346 def->penc);
@@ -663,7 +663,7 @@ static void __init htab_initialize(void)
663 base = (unsigned long)__va(lmb.memory.region[i].base); 663 base = (unsigned long)__va(lmb.memory.region[i].base);
664 size = lmb.memory.region[i].size; 664 size = lmb.memory.region[i].size;
665 665
666 DBG("creating mapping for region: %lx..%lx (prot: %x)\n", 666 DBG("creating mapping for region: %lx..%lx (prot: %lx)\n",
667 base, size, prot); 667 base, size, prot);
668 668
669#ifdef CONFIG_U3_DART 669#ifdef CONFIG_U3_DART
@@ -879,7 +879,7 @@ static inline int subpage_protection(struct mm_struct *mm, unsigned long ea)
879 */ 879 */
880int hash_page(unsigned long ea, unsigned long access, unsigned long trap) 880int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
881{ 881{
882 void *pgdir; 882 pgd_t *pgdir;
883 unsigned long vsid; 883 unsigned long vsid;
884 struct mm_struct *mm; 884 struct mm_struct *mm;
885 pte_t *ptep; 885 pte_t *ptep;
@@ -1025,7 +1025,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
1025 else 1025 else
1026#endif /* CONFIG_PPC_HAS_HASH_64K */ 1026#endif /* CONFIG_PPC_HAS_HASH_64K */
1027 { 1027 {
1028 int spp = subpage_protection(pgdir, ea); 1028 int spp = subpage_protection(mm, ea);
1029 if (access & spp) 1029 if (access & spp)
1030 rc = -2; 1030 rc = -2;
1031 else 1031 else
@@ -1115,7 +1115,7 @@ void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize,
1115{ 1115{
1116 unsigned long hash, index, shift, hidx, slot; 1116 unsigned long hash, index, shift, hidx, slot;
1117 1117
1118 DBG_LOW("flush_hash_page(va=%016x)\n", va); 1118 DBG_LOW("flush_hash_page(va=%016lx)\n", va);
1119 pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 1119 pte_iterate_hashed_subpages(pte, psize, va, index, shift) {
1120 hash = hpt_hash(va, shift, ssize); 1120 hash = hpt_hash(va, shift, ssize);
1121 hidx = __rpte_to_hidx(pte, index); 1121 hidx = __rpte_to_hidx(pte, index);
@@ -1123,7 +1123,7 @@ void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize,
1123 hash = ~hash; 1123 hash = ~hash;
1124 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1124 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
1125 slot += hidx & _PTEIDX_GROUP_IX; 1125 slot += hidx & _PTEIDX_GROUP_IX;
1126 DBG_LOW(" sub %d: hash=%x, hidx=%x\n", index, slot, hidx); 1126 DBG_LOW(" sub %ld: hash=%lx, hidx=%lx\n", index, slot, hidx);
1127 ppc_md.hpte_invalidate(slot, va, psize, ssize, local); 1127 ppc_md.hpte_invalidate(slot, va, psize, ssize, local);
1128 } pte_iterate_hashed_end(); 1128 } pte_iterate_hashed_end();
1129} 1129}
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index be4f34c30a0b..1044a634b6d0 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -353,7 +353,7 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self,
353 read_lock(&tasklist_lock); 353 read_lock(&tasklist_lock);
354 for_each_process(p) { 354 for_each_process(p) {
355 if (p->mm) 355 if (p->mm)
356 cpu_mask_clear_cpu(cpu, mm_cpumask(p->mm)); 356 cpumask_clear_cpu(cpu, mm_cpumask(p->mm));
357 } 357 }
358 read_unlock(&tasklist_lock); 358 read_unlock(&tasklist_lock);
359 break; 359 break;
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 177e4038b43c..573b3bd1c45b 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -382,7 +382,7 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
382 return 0; 382 return 0;
383 if (!get_pteptr(&init_mm, address, &kpte, &kpmd)) 383 if (!get_pteptr(&init_mm, address, &kpte, &kpmd))
384 return -EINVAL; 384 return -EINVAL;
385 set_pte_at(&init_mm, address, kpte, mk_pte(page, prot)); 385 __set_pte_at(&init_mm, address, kpte, mk_pte(page, prot), 0);
386 wmb(); 386 wmb();
387#ifdef CONFIG_PPC_STD_MMU 387#ifdef CONFIG_PPC_STD_MMU
388 flush_hash_pages(0, address, pmd_val(*kpmd), 1); 388 flush_hash_pages(0, address, pmd_val(*kpmd), 1);
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index bcc69e1f77c1..45c0cb9b67e6 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/utsrelease.h> 13#include <generated/utsrelease.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <asm/prom.h> 16#include <asm/prom.h>
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index d306f07b9aa1..43805348b81e 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -32,6 +32,7 @@
32#define PMCCR1_NEXT_STATE 0x0C /* Next state for power management */ 32#define PMCCR1_NEXT_STATE 0x0C /* Next state for power management */
33#define PMCCR1_NEXT_STATE_SHIFT 2 33#define PMCCR1_NEXT_STATE_SHIFT 2
34#define PMCCR1_CURR_STATE 0x03 /* Current state for power management*/ 34#define PMCCR1_CURR_STATE 0x03 /* Current state for power management*/
35#define IMMR_SYSCR_OFFSET 0x100
35#define IMMR_RCW_OFFSET 0x900 36#define IMMR_RCW_OFFSET 0x900
36#define RCW_PCI_HOST 0x80000000 37#define RCW_PCI_HOST 0x80000000
37 38
@@ -78,6 +79,22 @@ struct mpc83xx_clock {
78 u32 sccr; 79 u32 sccr;
79}; 80};
80 81
82struct mpc83xx_syscr {
83 __be32 sgprl;
84 __be32 sgprh;
85 __be32 spridr;
86 __be32 :32;
87 __be32 spcr;
88 __be32 sicrl;
89 __be32 sicrh;
90};
91
92struct mpc83xx_saved {
93 u32 sicrl;
94 u32 sicrh;
95 u32 sccr;
96};
97
81struct pmc_type { 98struct pmc_type {
82 int has_deep_sleep; 99 int has_deep_sleep;
83}; 100};
@@ -87,6 +104,8 @@ static int has_deep_sleep, deep_sleeping;
87static int pmc_irq; 104static int pmc_irq;
88static struct mpc83xx_pmc __iomem *pmc_regs; 105static struct mpc83xx_pmc __iomem *pmc_regs;
89static struct mpc83xx_clock __iomem *clock_regs; 106static struct mpc83xx_clock __iomem *clock_regs;
107static struct mpc83xx_syscr __iomem *syscr_regs;
108static struct mpc83xx_saved saved_regs;
90static int is_pci_agent, wake_from_pci; 109static int is_pci_agent, wake_from_pci;
91static phys_addr_t immrbase; 110static phys_addr_t immrbase;
92static int pci_pm_state; 111static int pci_pm_state;
@@ -137,6 +156,20 @@ static irqreturn_t pmc_irq_handler(int irq, void *dev_id)
137 return ret; 156 return ret;
138} 157}
139 158
159static void mpc83xx_suspend_restore_regs(void)
160{
161 out_be32(&syscr_regs->sicrl, saved_regs.sicrl);
162 out_be32(&syscr_regs->sicrh, saved_regs.sicrh);
163 out_be32(&clock_regs->sccr, saved_regs.sccr);
164}
165
166static void mpc83xx_suspend_save_regs(void)
167{
168 saved_regs.sicrl = in_be32(&syscr_regs->sicrl);
169 saved_regs.sicrh = in_be32(&syscr_regs->sicrh);
170 saved_regs.sccr = in_be32(&clock_regs->sccr);
171}
172
140static int mpc83xx_suspend_enter(suspend_state_t state) 173static int mpc83xx_suspend_enter(suspend_state_t state)
141{ 174{
142 int ret = -EAGAIN; 175 int ret = -EAGAIN;
@@ -166,6 +199,8 @@ static int mpc83xx_suspend_enter(suspend_state_t state)
166 */ 199 */
167 200
168 if (deep_sleeping) { 201 if (deep_sleeping) {
202 mpc83xx_suspend_save_regs();
203
169 out_be32(&pmc_regs->mask, PMCER_ALL); 204 out_be32(&pmc_regs->mask, PMCER_ALL);
170 205
171 out_be32(&pmc_regs->config1, 206 out_be32(&pmc_regs->config1,
@@ -179,6 +214,8 @@ static int mpc83xx_suspend_enter(suspend_state_t state)
179 in_be32(&pmc_regs->config1) & ~PMCCR1_POWER_OFF); 214 in_be32(&pmc_regs->config1) & ~PMCCR1_POWER_OFF);
180 215
181 out_be32(&pmc_regs->mask, PMCER_PMCI); 216 out_be32(&pmc_regs->mask, PMCER_PMCI);
217
218 mpc83xx_suspend_restore_regs();
182 } else { 219 } else {
183 out_be32(&pmc_regs->mask, PMCER_PMCI); 220 out_be32(&pmc_regs->mask, PMCER_PMCI);
184 221
@@ -194,7 +231,7 @@ out:
194 return ret; 231 return ret;
195} 232}
196 233
197static void mpc83xx_suspend_finish(void) 234static void mpc83xx_suspend_end(void)
198{ 235{
199 deep_sleeping = 0; 236 deep_sleeping = 0;
200} 237}
@@ -278,7 +315,7 @@ static struct platform_suspend_ops mpc83xx_suspend_ops = {
278 .valid = mpc83xx_suspend_valid, 315 .valid = mpc83xx_suspend_valid,
279 .begin = mpc83xx_suspend_begin, 316 .begin = mpc83xx_suspend_begin,
280 .enter = mpc83xx_suspend_enter, 317 .enter = mpc83xx_suspend_enter,
281 .finish = mpc83xx_suspend_finish, 318 .end = mpc83xx_suspend_end,
282}; 319};
283 320
284static int pmc_probe(struct of_device *ofdev, 321static int pmc_probe(struct of_device *ofdev,
@@ -333,12 +370,23 @@ static int pmc_probe(struct of_device *ofdev,
333 goto out_pmc; 370 goto out_pmc;
334 } 371 }
335 372
373 if (has_deep_sleep) {
374 syscr_regs = ioremap(immrbase + IMMR_SYSCR_OFFSET,
375 sizeof(*syscr_regs));
376 if (!syscr_regs) {
377 ret = -ENOMEM;
378 goto out_syscr;
379 }
380 }
381
336 if (is_pci_agent) 382 if (is_pci_agent)
337 mpc83xx_set_agent(); 383 mpc83xx_set_agent();
338 384
339 suspend_set_ops(&mpc83xx_suspend_ops); 385 suspend_set_ops(&mpc83xx_suspend_ops);
340 return 0; 386 return 0;
341 387
388out_syscr:
389 iounmap(clock_regs);
342out_pmc: 390out_pmc:
343 iounmap(pmc_regs); 391 iounmap(pmc_regs);
344out: 392out:
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index c5028a2e5a58..21f61b8c445b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -86,7 +86,7 @@ static int mpc8568_fixup_125_clock(struct phy_device *phydev)
86 scr = phy_read(phydev, MV88E1111_SCR); 86 scr = phy_read(phydev, MV88E1111_SCR);
87 87
88 if (scr < 0) 88 if (scr < 0)
89 return err; 89 return scr;
90 90
91 err = phy_write(phydev, MV88E1111_SCR, scr | 0x0008); 91 err = phy_write(phydev, MV88E1111_SCR, scr | 0x0008);
92 92
diff --git a/arch/powerpc/platforms/amigaone/setup.c b/arch/powerpc/platforms/amigaone/setup.c
index 9290a7a442d0..fb4eb0df054c 100644
--- a/arch/powerpc/platforms/amigaone/setup.c
+++ b/arch/powerpc/platforms/amigaone/setup.c
@@ -14,7 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include <linux/utsrelease.h> 17#include <generated/utsrelease.h>
18 18
19#include <asm/machdep.h> 19#include <asm/machdep.h>
20#include <asm/cputable.h> 20#include <asm/cputable.h>
diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile
index b93f877ba504..b9d5d678aa44 100644
--- a/arch/powerpc/platforms/cell/spufs/Makefile
+++ b/arch/powerpc/platforms/cell/spufs/Makefile
@@ -13,10 +13,8 @@ SPU_CC := $(SPU_CROSS)gcc
13SPU_AS := $(SPU_CROSS)gcc 13SPU_AS := $(SPU_CROSS)gcc
14SPU_LD := $(SPU_CROSS)ld 14SPU_LD := $(SPU_CROSS)ld
15SPU_OBJCOPY := $(SPU_CROSS)objcopy 15SPU_OBJCOPY := $(SPU_CROSS)objcopy
16SPU_CFLAGS := -O2 -Wall -I$(srctree)/include \ 16SPU_CFLAGS := -O2 -Wall -I$(srctree)/include -D__KERNEL__
17 -I$(objtree)/include2 -D__KERNEL__ 17SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include -D__KERNEL__
18SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include \
19 -I$(objtree)/include2 -D__KERNEL__
20SPU_LDFLAGS := -N -Ttext=0x0 18SPU_LDFLAGS := -N -Ttext=0x0
21 19
22$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h 20$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 52f3df3b4ca0..8f41685d8f42 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -23,7 +23,7 @@
23#include <linux/reboot.h> 23#include <linux/reboot.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/utsrelease.h> 26#include <generated/utsrelease.h>
27#include <linux/adb.h> 27#include <linux/adb.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
index d5963285e3be..c278bd3a8fec 100644
--- a/arch/powerpc/platforms/embedded6xx/flipper-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
@@ -102,7 +102,7 @@ static int flipper_pic_map(struct irq_host *h, unsigned int virq,
102 irq_hw_number_t hwirq) 102 irq_hw_number_t hwirq)
103{ 103{
104 set_irq_chip_data(virq, h->host_data); 104 set_irq_chip_data(virq, h->host_data);
105 get_irq_desc(virq)->status |= IRQ_LEVEL; 105 irq_to_desc(virq)->status |= IRQ_LEVEL;
106 set_irq_chip_and_handler(virq, &flipper_pic, handle_level_irq); 106 set_irq_chip_and_handler(virq, &flipper_pic, handle_level_irq);
107 return 0; 107 return 0;
108} 108}
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index dd20bff33207..a771f91e215b 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -95,7 +95,7 @@ static int hlwd_pic_map(struct irq_host *h, unsigned int virq,
95 irq_hw_number_t hwirq) 95 irq_hw_number_t hwirq)
96{ 96{
97 set_irq_chip_data(virq, h->host_data); 97 set_irq_chip_data(virq, h->host_data);
98 get_irq_desc(virq)->status |= IRQ_LEVEL; 98 irq_to_desc(virq)->status |= IRQ_LEVEL;
99 set_irq_chip_and_handler(virq, &hlwd_pic, handle_level_irq); 99 set_irq_chip_and_handler(virq, &hlwd_pic, handle_level_irq);
100 return 0; 100 return 0;
101} 101}
@@ -132,9 +132,9 @@ static void hlwd_pic_irq_cascade(unsigned int cascade_virq,
132 struct irq_host *irq_host = get_irq_data(cascade_virq); 132 struct irq_host *irq_host = get_irq_data(cascade_virq);
133 unsigned int virq; 133 unsigned int virq;
134 134
135 spin_lock(&desc->lock); 135 raw_spin_lock(&desc->lock);
136 desc->chip->mask(cascade_virq); /* IRQ_LEVEL */ 136 desc->chip->mask(cascade_virq); /* IRQ_LEVEL */
137 spin_unlock(&desc->lock); 137 raw_spin_unlock(&desc->lock);
138 138
139 virq = __hlwd_pic_get_irq(irq_host); 139 virq = __hlwd_pic_get_irq(irq_host);
140 if (virq != NO_IRQ) 140 if (virq != NO_IRQ)
@@ -142,11 +142,11 @@ static void hlwd_pic_irq_cascade(unsigned int cascade_virq,
142 else 142 else
143 pr_err("spurious interrupt!\n"); 143 pr_err("spurious interrupt!\n");
144 144
145 spin_lock(&desc->lock); 145 raw_spin_lock(&desc->lock);
146 desc->chip->ack(cascade_virq); /* IRQ_LEVEL */ 146 desc->chip->ack(cascade_virq); /* IRQ_LEVEL */
147 if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask) 147 if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
148 desc->chip->unmask(cascade_virq); 148 desc->chip->unmask(cascade_virq);
149 spin_unlock(&desc->lock); 149 raw_spin_unlock(&desc->lock);
150} 150}
151 151
152/* 152/*
diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
index edc956cc8b13..20a8ed91962e 100644
--- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
+++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
@@ -120,7 +120,7 @@ static void ug_putc(char ch)
120 120
121 while (!ug_is_txfifo_ready() && count--) 121 while (!ug_is_txfifo_ready() && count--)
122 barrier(); 122 barrier();
123 if (count) 123 if (count >= 0)
124 ug_raw_putc(ch); 124 ug_raw_putc(ch);
125} 125}
126 126
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 0d9343df35bc..6617915bcb1a 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -855,59 +855,58 @@ static int mf_get_boot_rtc(struct rtc_time *tm)
855} 855}
856 856
857#ifdef CONFIG_PROC_FS 857#ifdef CONFIG_PROC_FS
858 858static int mf_cmdline_proc_show(struct seq_file *m, void *v)
859static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
860 int count, int *eof, void *data)
861{ 859{
862 int len; 860 char *page, *p;
863 char *p;
864 struct vsp_cmd_data vsp_cmd; 861 struct vsp_cmd_data vsp_cmd;
865 int rc; 862 int rc;
866 dma_addr_t dma_addr; 863 dma_addr_t dma_addr;
867 864
868 /* The HV appears to return no more than 256 bytes of command line */ 865 /* The HV appears to return no more than 256 bytes of command line */
869 if (off >= 256) 866 page = kmalloc(256, GFP_KERNEL);
870 return 0; 867 if (!page)
871 if ((off + count) > 256) 868 return -ENOMEM;
872 count = 256 - off;
873 869
874 dma_addr = iseries_hv_map(page, off + count, DMA_FROM_DEVICE); 870 dma_addr = iseries_hv_map(page, 256, DMA_FROM_DEVICE);
875 if (dma_addr == DMA_ERROR_CODE) 871 if (dma_addr == DMA_ERROR_CODE) {
872 kfree(page);
876 return -ENOMEM; 873 return -ENOMEM;
877 memset(page, 0, off + count); 874 }
875 memset(page, 0, 256);
878 memset(&vsp_cmd, 0, sizeof(vsp_cmd)); 876 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
879 vsp_cmd.cmd = 33; 877 vsp_cmd.cmd = 33;
880 vsp_cmd.sub_data.kern.token = dma_addr; 878 vsp_cmd.sub_data.kern.token = dma_addr;
881 vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex; 879 vsp_cmd.sub_data.kern.address_type = HvLpDma_AddressType_TceIndex;
882 vsp_cmd.sub_data.kern.side = (u64)data; 880 vsp_cmd.sub_data.kern.side = (u64)m->private;
883 vsp_cmd.sub_data.kern.length = off + count; 881 vsp_cmd.sub_data.kern.length = 256;
884 mb(); 882 mb();
885 rc = signal_vsp_instruction(&vsp_cmd); 883 rc = signal_vsp_instruction(&vsp_cmd);
886 iseries_hv_unmap(dma_addr, off + count, DMA_FROM_DEVICE); 884 iseries_hv_unmap(dma_addr, 256, DMA_FROM_DEVICE);
887 if (rc) 885 if (rc) {
886 kfree(page);
888 return rc; 887 return rc;
889 if (vsp_cmd.result_code != 0) 888 }
889 if (vsp_cmd.result_code != 0) {
890 kfree(page);
890 return -ENOMEM; 891 return -ENOMEM;
892 }
891 p = page; 893 p = page;
892 len = 0; 894 while (p - page < 256) {
893 while (len < (off + count)) { 895 if (*p == '\0' || *p == '\n') {
894 if ((*p == '\0') || (*p == '\n')) { 896 *p = '\n';
895 if (*p == '\0')
896 *p = '\n';
897 p++;
898 len++;
899 *eof = 1;
900 break; 897 break;
901 } 898 }
902 p++; 899 p++;
903 len++;
904 }
905 900
906 if (len < off) {
907 *eof = 1;
908 len = 0;
909 } 901 }
910 return len; 902 seq_write(m, page, p - page);
903 kfree(page);
904 return 0;
905}
906
907static int mf_cmdline_proc_open(struct inode *inode, struct file *file)
908{
909 return single_open(file, mf_cmdline_proc_show, PDE(inode)->data);
911} 910}
912 911
913#if 0 912#if 0
@@ -962,10 +961,8 @@ static int proc_mf_dump_vmlinux(char *page, char **start, off_t off,
962} 961}
963#endif 962#endif
964 963
965static int proc_mf_dump_side(char *page, char **start, off_t off, 964static int mf_side_proc_show(struct seq_file *m, void *v)
966 int count, int *eof, void *data)
967{ 965{
968 int len;
969 char mf_current_side = ' '; 966 char mf_current_side = ' ';
970 struct vsp_cmd_data vsp_cmd; 967 struct vsp_cmd_data vsp_cmd;
971 968
@@ -989,21 +986,17 @@ static int proc_mf_dump_side(char *page, char **start, off_t off,
989 } 986 }
990 } 987 }
991 988
992 len = sprintf(page, "%c\n", mf_current_side); 989 seq_printf(m, "%c\n", mf_current_side);
990 return 0;
991}
993 992
994 if (len <= (off + count)) 993static int mf_side_proc_open(struct inode *inode, struct file *file)
995 *eof = 1; 994{
996 *start = page + off; 995 return single_open(file, mf_side_proc_show, NULL);
997 len -= off;
998 if (len > count)
999 len = count;
1000 if (len < 0)
1001 len = 0;
1002 return len;
1003} 996}
1004 997
1005static int proc_mf_change_side(struct file *file, const char __user *buffer, 998static ssize_t mf_side_proc_write(struct file *file, const char __user *buffer,
1006 unsigned long count, void *data) 999 size_t count, loff_t *pos)
1007{ 1000{
1008 char side; 1001 char side;
1009 u64 newSide; 1002 u64 newSide;
@@ -1041,6 +1034,15 @@ static int proc_mf_change_side(struct file *file, const char __user *buffer,
1041 return count; 1034 return count;
1042} 1035}
1043 1036
1037static const struct file_operations mf_side_proc_fops = {
1038 .owner = THIS_MODULE,
1039 .open = mf_side_proc_open,
1040 .read = seq_read,
1041 .llseek = seq_lseek,
1042 .release = single_release,
1043 .write = mf_side_proc_write,
1044};
1045
1044#if 0 1046#if 0
1045static void mf_getSrcHistory(char *buffer, int size) 1047static void mf_getSrcHistory(char *buffer, int size)
1046{ 1048{
@@ -1087,8 +1089,7 @@ static void mf_getSrcHistory(char *buffer, int size)
1087} 1089}
1088#endif 1090#endif
1089 1091
1090static int proc_mf_dump_src(char *page, char **start, off_t off, 1092static int mf_src_proc_show(struct seq_file *m, void *v)
1091 int count, int *eof, void *data)
1092{ 1093{
1093#if 0 1094#if 0
1094 int len; 1095 int len;
@@ -1109,8 +1110,13 @@ static int proc_mf_dump_src(char *page, char **start, off_t off,
1109#endif 1110#endif
1110} 1111}
1111 1112
1112static int proc_mf_change_src(struct file *file, const char __user *buffer, 1113static int mf_src_proc_open(struct inode *inode, struct file *file)
1113 unsigned long count, void *data) 1114{
1115 return single_open(file, mf_src_proc_show, NULL);
1116}
1117
1118static ssize_t mf_src_proc_write(struct file *file, const char __user *buffer,
1119 size_t count, loff_t *pos)
1114{ 1120{
1115 char stkbuf[10]; 1121 char stkbuf[10];
1116 1122
@@ -1135,9 +1141,19 @@ static int proc_mf_change_src(struct file *file, const char __user *buffer,
1135 return count; 1141 return count;
1136} 1142}
1137 1143
1138static int proc_mf_change_cmdline(struct file *file, const char __user *buffer, 1144static const struct file_operations mf_src_proc_fops = {
1139 unsigned long count, void *data) 1145 .owner = THIS_MODULE,
1146 .open = mf_src_proc_open,
1147 .read = seq_read,
1148 .llseek = seq_lseek,
1149 .release = single_release,
1150 .write = mf_src_proc_write,
1151};
1152
1153static ssize_t mf_cmdline_proc_write(struct file *file, const char __user *buffer,
1154 size_t count, loff_t *pos)
1140{ 1155{
1156 void *data = PDE(file->f_path.dentry->d_inode)->data;
1141 struct vsp_cmd_data vsp_cmd; 1157 struct vsp_cmd_data vsp_cmd;
1142 dma_addr_t dma_addr; 1158 dma_addr_t dma_addr;
1143 char *page; 1159 char *page;
@@ -1172,6 +1188,15 @@ out:
1172 return ret; 1188 return ret;
1173} 1189}
1174 1190
1191static const struct file_operations mf_cmdline_proc_fops = {
1192 .owner = THIS_MODULE,
1193 .open = mf_cmdline_proc_open,
1194 .read = seq_read,
1195 .llseek = seq_lseek,
1196 .release = single_release,
1197 .write = mf_cmdline_proc_write,
1198};
1199
1175static ssize_t proc_mf_change_vmlinux(struct file *file, 1200static ssize_t proc_mf_change_vmlinux(struct file *file,
1176 const char __user *buf, 1201 const char __user *buf,
1177 size_t count, loff_t *ppos) 1202 size_t count, loff_t *ppos)
@@ -1246,12 +1271,10 @@ static int __init mf_proc_init(void)
1246 if (!mf) 1271 if (!mf)
1247 return 1; 1272 return 1;
1248 1273
1249 ent = create_proc_entry("cmdline", S_IFREG|S_IRUSR|S_IWUSR, mf); 1274 ent = proc_create_data("cmdline", S_IRUSR|S_IWUSR, mf,
1275 &mf_cmdline_proc_fops, (void *)(long)i);
1250 if (!ent) 1276 if (!ent)
1251 return 1; 1277 return 1;
1252 ent->data = (void *)(long)i;
1253 ent->read_proc = proc_mf_dump_cmdline;
1254 ent->write_proc = proc_mf_change_cmdline;
1255 1278
1256 if (i == 3) /* no vmlinux entry for 'D' */ 1279 if (i == 3) /* no vmlinux entry for 'D' */
1257 continue; 1280 continue;
@@ -1263,19 +1286,15 @@ static int __init mf_proc_init(void)
1263 return 1; 1286 return 1;
1264 } 1287 }
1265 1288
1266 ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); 1289 ent = proc_create("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root,
1290 &mf_side_proc_fops);
1267 if (!ent) 1291 if (!ent)
1268 return 1; 1292 return 1;
1269 ent->data = (void *)0;
1270 ent->read_proc = proc_mf_dump_side;
1271 ent->write_proc = proc_mf_change_side;
1272 1293
1273 ent = create_proc_entry("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); 1294 ent = proc_create("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root,
1295 &mf_src_proc_fops);
1274 if (!ent) 1296 if (!ent)
1275 return 1; 1297 return 1;
1276 ent->data = (void *)0;
1277 ent->read_proc = proc_mf_dump_src;
1278 ent->write_proc = proc_mf_change_src;
1279 1298
1280 return 0; 1299 return 0;
1281} 1300}
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index 49ff4dc422b7..5aea94f30836 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -116,7 +116,7 @@ static int proc_viopath_show(struct seq_file *m, void *v)
116 u16 vlanMap; 116 u16 vlanMap;
117 dma_addr_t handle; 117 dma_addr_t handle;
118 HvLpEvent_Rc hvrc; 118 HvLpEvent_Rc hvrc;
119 DECLARE_COMPLETION(done); 119 DECLARE_COMPLETION_ONSTACK(done);
120 struct device_node *node; 120 struct device_node *node;
121 const char *sysid; 121 const char *sysid;
122 122
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index cf660916ae0b..9dd789a7370d 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -12,7 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/utsrelease.h> 15#include <generated/utsrelease.h>
16#include <asm/sections.h> 16#include <asm/sections.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/page.h> 18#include <asm/page.h>
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 27554c807fd5..c667f0f02c34 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -2,6 +2,8 @@ config PPC_PSERIES
2 depends on PPC64 && PPC_BOOK3S 2 depends on PPC64 && PPC_BOOK3S
3 bool "IBM pSeries & new (POWER5-based) iSeries" 3 bool "IBM pSeries & new (POWER5-based) iSeries"
4 select MPIC 4 select MPIC
5 select PCI_MSI
6 select XICS
5 select PPC_I8259 7 select PPC_I8259
6 select PPC_RTAS 8 select PPC_RTAS
7 select PPC_RTAS_DAEMON 9 select PPC_RTAS_DAEMON
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index bcdcf0ccc8d7..a277f2e28dbc 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -38,19 +38,28 @@
38#include <asm/mmu.h> 38#include <asm/mmu.h>
39#include <asm/pgalloc.h> 39#include <asm/pgalloc.h>
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <linux/memory.h>
41 42
42#include "plpar_wrappers.h" 43#include "plpar_wrappers.h"
43 44
44#define CMM_DRIVER_VERSION "1.0.0" 45#define CMM_DRIVER_VERSION "1.0.0"
45#define CMM_DEFAULT_DELAY 1 46#define CMM_DEFAULT_DELAY 1
47#define CMM_HOTPLUG_DELAY 5
46#define CMM_DEBUG 0 48#define CMM_DEBUG 0
47#define CMM_DISABLE 0 49#define CMM_DISABLE 0
48#define CMM_OOM_KB 1024 50#define CMM_OOM_KB 1024
49#define CMM_MIN_MEM_MB 256 51#define CMM_MIN_MEM_MB 256
50#define KB2PAGES(_p) ((_p)>>(PAGE_SHIFT-10)) 52#define KB2PAGES(_p) ((_p)>>(PAGE_SHIFT-10))
51#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10)) 53#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
54/*
55 * The priority level tries to ensure that this notifier is called as
56 * late as possible to reduce thrashing in the shared memory pool.
57 */
58#define CMM_MEM_HOTPLUG_PRI 1
59#define CMM_MEM_ISOLATE_PRI 15
52 60
53static unsigned int delay = CMM_DEFAULT_DELAY; 61static unsigned int delay = CMM_DEFAULT_DELAY;
62static unsigned int hotplug_delay = CMM_HOTPLUG_DELAY;
54static unsigned int oom_kb = CMM_OOM_KB; 63static unsigned int oom_kb = CMM_OOM_KB;
55static unsigned int cmm_debug = CMM_DEBUG; 64static unsigned int cmm_debug = CMM_DEBUG;
56static unsigned int cmm_disabled = CMM_DISABLE; 65static unsigned int cmm_disabled = CMM_DISABLE;
@@ -65,6 +74,10 @@ MODULE_VERSION(CMM_DRIVER_VERSION);
65module_param_named(delay, delay, uint, S_IRUGO | S_IWUSR); 74module_param_named(delay, delay, uint, S_IRUGO | S_IWUSR);
66MODULE_PARM_DESC(delay, "Delay (in seconds) between polls to query hypervisor paging requests. " 75MODULE_PARM_DESC(delay, "Delay (in seconds) between polls to query hypervisor paging requests. "
67 "[Default=" __stringify(CMM_DEFAULT_DELAY) "]"); 76 "[Default=" __stringify(CMM_DEFAULT_DELAY) "]");
77module_param_named(hotplug_delay, hotplug_delay, uint, S_IRUGO | S_IWUSR);
78MODULE_PARM_DESC(delay, "Delay (in seconds) after memory hotplug remove "
79 "before loaning resumes. "
80 "[Default=" __stringify(CMM_HOTPLUG_DELAY) "]");
68module_param_named(oom_kb, oom_kb, uint, S_IRUGO | S_IWUSR); 81module_param_named(oom_kb, oom_kb, uint, S_IRUGO | S_IWUSR);
69MODULE_PARM_DESC(oom_kb, "Amount of memory in kb to free on OOM. " 82MODULE_PARM_DESC(oom_kb, "Amount of memory in kb to free on OOM. "
70 "[Default=" __stringify(CMM_OOM_KB) "]"); 83 "[Default=" __stringify(CMM_OOM_KB) "]");
@@ -92,6 +105,9 @@ static unsigned long oom_freed_pages;
92static struct cmm_page_array *cmm_page_list; 105static struct cmm_page_array *cmm_page_list;
93static DEFINE_SPINLOCK(cmm_lock); 106static DEFINE_SPINLOCK(cmm_lock);
94 107
108static DEFINE_MUTEX(hotplug_mutex);
109static int hotplug_occurred; /* protected by the hotplug mutex */
110
95static struct task_struct *cmm_thread_ptr; 111static struct task_struct *cmm_thread_ptr;
96 112
97/** 113/**
@@ -110,6 +126,17 @@ static long cmm_alloc_pages(long nr)
110 cmm_dbg("Begin request for %ld pages\n", nr); 126 cmm_dbg("Begin request for %ld pages\n", nr);
111 127
112 while (nr) { 128 while (nr) {
129 /* Exit if a hotplug operation is in progress or occurred */
130 if (mutex_trylock(&hotplug_mutex)) {
131 if (hotplug_occurred) {
132 mutex_unlock(&hotplug_mutex);
133 break;
134 }
135 mutex_unlock(&hotplug_mutex);
136 } else {
137 break;
138 }
139
113 addr = __get_free_page(GFP_NOIO | __GFP_NOWARN | 140 addr = __get_free_page(GFP_NOIO | __GFP_NOWARN |
114 __GFP_NORETRY | __GFP_NOMEMALLOC); 141 __GFP_NORETRY | __GFP_NOMEMALLOC);
115 if (!addr) 142 if (!addr)
@@ -119,8 +146,9 @@ static long cmm_alloc_pages(long nr)
119 if (!pa || pa->index >= CMM_NR_PAGES) { 146 if (!pa || pa->index >= CMM_NR_PAGES) {
120 /* Need a new page for the page list. */ 147 /* Need a new page for the page list. */
121 spin_unlock(&cmm_lock); 148 spin_unlock(&cmm_lock);
122 npa = (struct cmm_page_array *)__get_free_page(GFP_NOIO | __GFP_NOWARN | 149 npa = (struct cmm_page_array *)__get_free_page(
123 __GFP_NORETRY | __GFP_NOMEMALLOC); 150 GFP_NOIO | __GFP_NOWARN |
151 __GFP_NORETRY | __GFP_NOMEMALLOC);
124 if (!npa) { 152 if (!npa) {
125 pr_info("%s: Can not allocate new page list\n", __func__); 153 pr_info("%s: Can not allocate new page list\n", __func__);
126 free_page(addr); 154 free_page(addr);
@@ -282,9 +310,28 @@ static int cmm_thread(void *dummy)
282 while (1) { 310 while (1) {
283 timeleft = msleep_interruptible(delay * 1000); 311 timeleft = msleep_interruptible(delay * 1000);
284 312
285 if (kthread_should_stop() || timeleft) { 313 if (kthread_should_stop() || timeleft)
286 loaned_pages_target = loaned_pages;
287 break; 314 break;
315
316 if (mutex_trylock(&hotplug_mutex)) {
317 if (hotplug_occurred) {
318 hotplug_occurred = 0;
319 mutex_unlock(&hotplug_mutex);
320 cmm_dbg("Hotplug operation has occurred, "
321 "loaning activity suspended "
322 "for %d seconds.\n",
323 hotplug_delay);
324 timeleft = msleep_interruptible(hotplug_delay *
325 1000);
326 if (kthread_should_stop() || timeleft)
327 break;
328 continue;
329 }
330 mutex_unlock(&hotplug_mutex);
331 } else {
332 cmm_dbg("Hotplug operation in progress, activity "
333 "suspended\n");
334 continue;
288 } 335 }
289 336
290 cmm_get_mpp(); 337 cmm_get_mpp();
@@ -414,6 +461,193 @@ static struct notifier_block cmm_reboot_nb = {
414}; 461};
415 462
416/** 463/**
464 * cmm_count_pages - Count the number of pages loaned in a particular range.
465 *
466 * @arg: memory_isolate_notify structure with address range and count
467 *
468 * Return value:
469 * 0 on success
470 **/
471static unsigned long cmm_count_pages(void *arg)
472{
473 struct memory_isolate_notify *marg = arg;
474 struct cmm_page_array *pa;
475 unsigned long start = (unsigned long)pfn_to_kaddr(marg->start_pfn);
476 unsigned long end = start + (marg->nr_pages << PAGE_SHIFT);
477 unsigned long idx;
478
479 spin_lock(&cmm_lock);
480 pa = cmm_page_list;
481 while (pa) {
482 if ((unsigned long)pa >= start && (unsigned long)pa < end)
483 marg->pages_found++;
484 for (idx = 0; idx < pa->index; idx++)
485 if (pa->page[idx] >= start && pa->page[idx] < end)
486 marg->pages_found++;
487 pa = pa->next;
488 }
489 spin_unlock(&cmm_lock);
490 return 0;
491}
492
493/**
494 * cmm_memory_isolate_cb - Handle memory isolation notifier calls
495 * @self: notifier block struct
496 * @action: action to take
497 * @arg: struct memory_isolate_notify data for handler
498 *
499 * Return value:
500 * NOTIFY_OK or notifier error based on subfunction return value
501 **/
502static int cmm_memory_isolate_cb(struct notifier_block *self,
503 unsigned long action, void *arg)
504{
505 int ret = 0;
506
507 if (action == MEM_ISOLATE_COUNT)
508 ret = cmm_count_pages(arg);
509
510 if (ret)
511 ret = notifier_from_errno(ret);
512 else
513 ret = NOTIFY_OK;
514
515 return ret;
516}
517
518static struct notifier_block cmm_mem_isolate_nb = {
519 .notifier_call = cmm_memory_isolate_cb,
520 .priority = CMM_MEM_ISOLATE_PRI
521};
522
523/**
524 * cmm_mem_going_offline - Unloan pages where memory is to be removed
525 * @arg: memory_notify structure with page range to be offlined
526 *
527 * Return value:
528 * 0 on success
529 **/
530static int cmm_mem_going_offline(void *arg)
531{
532 struct memory_notify *marg = arg;
533 unsigned long start_page = (unsigned long)pfn_to_kaddr(marg->start_pfn);
534 unsigned long end_page = start_page + (marg->nr_pages << PAGE_SHIFT);
535 struct cmm_page_array *pa_curr, *pa_last, *npa;
536 unsigned long idx;
537 unsigned long freed = 0;
538
539 cmm_dbg("Memory going offline, searching 0x%lx (%ld pages).\n",
540 start_page, marg->nr_pages);
541 spin_lock(&cmm_lock);
542
543 /* Search the page list for pages in the range to be offlined */
544 pa_last = pa_curr = cmm_page_list;
545 while (pa_curr) {
546 for (idx = (pa_curr->index - 1); (idx + 1) > 0; idx--) {
547 if ((pa_curr->page[idx] < start_page) ||
548 (pa_curr->page[idx] >= end_page))
549 continue;
550
551 plpar_page_set_active(__pa(pa_curr->page[idx]));
552 free_page(pa_curr->page[idx]);
553 freed++;
554 loaned_pages--;
555 totalram_pages++;
556 pa_curr->page[idx] = pa_last->page[--pa_last->index];
557 if (pa_last->index == 0) {
558 if (pa_curr == pa_last)
559 pa_curr = pa_last->next;
560 pa_last = pa_last->next;
561 free_page((unsigned long)cmm_page_list);
562 cmm_page_list = pa_last;
563 continue;
564 }
565 }
566 pa_curr = pa_curr->next;
567 }
568
569 /* Search for page list structures in the range to be offlined */
570 pa_last = NULL;
571 pa_curr = cmm_page_list;
572 while (pa_curr) {
573 if (((unsigned long)pa_curr >= start_page) &&
574 ((unsigned long)pa_curr < end_page)) {
575 npa = (struct cmm_page_array *)__get_free_page(
576 GFP_NOIO | __GFP_NOWARN |
577 __GFP_NORETRY | __GFP_NOMEMALLOC);
578 if (!npa) {
579 spin_unlock(&cmm_lock);
580 cmm_dbg("Failed to allocate memory for list "
581 "management. Memory hotplug "
582 "failed.\n");
583 return ENOMEM;
584 }
585 memcpy(npa, pa_curr, PAGE_SIZE);
586 if (pa_curr == cmm_page_list)
587 cmm_page_list = npa;
588 if (pa_last)
589 pa_last->next = npa;
590 free_page((unsigned long) pa_curr);
591 freed++;
592 pa_curr = npa;
593 }
594
595 pa_last = pa_curr;
596 pa_curr = pa_curr->next;
597 }
598
599 spin_unlock(&cmm_lock);
600 cmm_dbg("Released %ld pages in the search range.\n", freed);
601
602 return 0;
603}
604
605/**
606 * cmm_memory_cb - Handle memory hotplug notifier calls
607 * @self: notifier block struct
608 * @action: action to take
609 * @arg: struct memory_notify data for handler
610 *
611 * Return value:
612 * NOTIFY_OK or notifier error based on subfunction return value
613 *
614 **/
615static int cmm_memory_cb(struct notifier_block *self,
616 unsigned long action, void *arg)
617{
618 int ret = 0;
619
620 switch (action) {
621 case MEM_GOING_OFFLINE:
622 mutex_lock(&hotplug_mutex);
623 hotplug_occurred = 1;
624 ret = cmm_mem_going_offline(arg);
625 break;
626 case MEM_OFFLINE:
627 case MEM_CANCEL_OFFLINE:
628 mutex_unlock(&hotplug_mutex);
629 cmm_dbg("Memory offline operation complete.\n");
630 break;
631 case MEM_GOING_ONLINE:
632 case MEM_ONLINE:
633 case MEM_CANCEL_ONLINE:
634 break;
635 }
636
637 if (ret)
638 ret = notifier_from_errno(ret);
639 else
640 ret = NOTIFY_OK;
641
642 return ret;
643}
644
645static struct notifier_block cmm_mem_nb = {
646 .notifier_call = cmm_memory_cb,
647 .priority = CMM_MEM_HOTPLUG_PRI
648};
649
650/**
417 * cmm_init - Module initialization 651 * cmm_init - Module initialization
418 * 652 *
419 * Return value: 653 * Return value:
@@ -435,18 +669,24 @@ static int cmm_init(void)
435 if ((rc = cmm_sysfs_register(&cmm_sysdev))) 669 if ((rc = cmm_sysfs_register(&cmm_sysdev)))
436 goto out_reboot_notifier; 670 goto out_reboot_notifier;
437 671
672 if (register_memory_notifier(&cmm_mem_nb) ||
673 register_memory_isolate_notifier(&cmm_mem_isolate_nb))
674 goto out_unregister_notifier;
675
438 if (cmm_disabled) 676 if (cmm_disabled)
439 return rc; 677 return rc;
440 678
441 cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread"); 679 cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread");
442 if (IS_ERR(cmm_thread_ptr)) { 680 if (IS_ERR(cmm_thread_ptr)) {
443 rc = PTR_ERR(cmm_thread_ptr); 681 rc = PTR_ERR(cmm_thread_ptr);
444 goto out_unregister_sysfs; 682 goto out_unregister_notifier;
445 } 683 }
446 684
447 return rc; 685 return rc;
448 686
449out_unregister_sysfs: 687out_unregister_notifier:
688 unregister_memory_notifier(&cmm_mem_nb);
689 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
450 cmm_unregister_sysfs(&cmm_sysdev); 690 cmm_unregister_sysfs(&cmm_sysdev);
451out_reboot_notifier: 691out_reboot_notifier:
452 unregister_reboot_notifier(&cmm_reboot_nb); 692 unregister_reboot_notifier(&cmm_reboot_nb);
@@ -467,6 +707,8 @@ static void cmm_exit(void)
467 kthread_stop(cmm_thread_ptr); 707 kthread_stop(cmm_thread_ptr);
468 unregister_oom_notifier(&cmm_oom_nb); 708 unregister_oom_notifier(&cmm_oom_nb);
469 unregister_reboot_notifier(&cmm_reboot_nb); 709 unregister_reboot_notifier(&cmm_reboot_nb);
710 unregister_memory_notifier(&cmm_mem_nb);
711 unregister_memory_isolate_notifier(&cmm_mem_isolate_nb);
470 cmm_free_pages(loaned_pages); 712 cmm_free_pages(loaned_pages);
471 cmm_unregister_sysfs(&cmm_sysdev); 713 cmm_unregister_sysfs(&cmm_sysdev);
472} 714}
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 12df9e8812a9..67b7a10f9fce 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -346,12 +346,14 @@ int dlpar_release_drc(u32 drc_index)
346 346
347static DEFINE_MUTEX(pseries_cpu_hotplug_mutex); 347static DEFINE_MUTEX(pseries_cpu_hotplug_mutex);
348 348
349void cpu_hotplug_driver_lock() 349void cpu_hotplug_driver_lock(void)
350__acquires(pseries_cpu_hotplug_mutex)
350{ 351{
351 mutex_lock(&pseries_cpu_hotplug_mutex); 352 mutex_lock(&pseries_cpu_hotplug_mutex);
352} 353}
353 354
354void cpu_hotplug_driver_unlock() 355void cpu_hotplug_driver_unlock(void)
356__releases(pseries_cpu_hotplug_mutex)
355{ 357{
356 mutex_unlock(&pseries_cpu_hotplug_mutex); 358 mutex_unlock(&pseries_cpu_hotplug_mutex);
357} 359}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 8868c012268a..b4886635972c 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -144,8 +144,8 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
144 hcpuid = get_hard_smp_processor_id(nr); 144 hcpuid = get_hard_smp_processor_id(nr);
145 rc = plpar_hcall_norets(H_PROD, hcpuid); 145 rc = plpar_hcall_norets(H_PROD, hcpuid);
146 if (rc != H_SUCCESS) 146 if (rc != H_SUCCESS)
147 panic("Error: Prod to wake up processor %d Ret= %ld\n", 147 printk(KERN_ERR "Error: Prod to wake up processor %d\
148 nr, rc); 148 Ret= %ld\n", nr, rc);
149 } 149 }
150} 150}
151 151
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index 971483f0dfac..1709ac5aac7c 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -143,13 +143,23 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
143 struct irq_desc *desc = irq_to_desc(virq); 143 struct irq_desc *desc = irq_to_desc(virq);
144 unsigned int vold, vnew, edibit; 144 unsigned int vold, vnew, edibit;
145 145
146 if (flow_type == IRQ_TYPE_NONE) 146 /* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or
147 flow_type = IRQ_TYPE_LEVEL_LOW; 147 * IRQ_TYPE_EDGE_BOTH (default). All others are IRQ_TYPE_EDGE_FALLING
148 148 * or IRQ_TYPE_LEVEL_LOW (default)
149 if (flow_type & IRQ_TYPE_EDGE_RISING) { 149 */
150 printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n", 150 if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) {
151 flow_type); 151 if (flow_type == IRQ_TYPE_NONE)
152 return -EINVAL; 152 flow_type = IRQ_TYPE_EDGE_BOTH;
153
154 if (flow_type != IRQ_TYPE_EDGE_BOTH &&
155 flow_type != IRQ_TYPE_EDGE_FALLING)
156 goto err_sense;
157 } else {
158 if (flow_type == IRQ_TYPE_NONE)
159 flow_type = IRQ_TYPE_LEVEL_LOW;
160
161 if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH))
162 goto err_sense;
153 } 163 }
154 164
155 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); 165 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
@@ -181,6 +191,10 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
181 if (vold != vnew) 191 if (vold != vnew)
182 out_be32(&cpm2_intctl->ic_siexr, vnew); 192 out_be32(&cpm2_intctl->ic_siexr, vnew);
183 return 0; 193 return 0;
194
195err_sense:
196 pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type);
197 return -EINVAL;
184} 198}
185 199
186static struct irq_chip cpm2_pic = { 200static struct irq_chip cpm2_pic = {
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 4e3a3e345ab3..e1a028c1f18d 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -464,8 +464,7 @@ static void __iomem *mpc83xx_pcie_remap_cfg(struct pci_bus *bus,
464{ 464{
465 struct pci_controller *hose = pci_bus_to_host(bus); 465 struct pci_controller *hose = pci_bus_to_host(bus);
466 struct mpc83xx_pcie_priv *pcie = hose->dn->data; 466 struct mpc83xx_pcie_priv *pcie = hose->dn->data;
467 u8 bus_no = bus->number - hose->first_busno; 467 u32 dev_base = bus->number << 24 | devfn << 16;
468 u32 dev_base = bus_no << 24 | devfn << 16;
469 int ret; 468 int ret;
470 469
471 ret = mpc83xx_pcie_exclude_device(bus, devfn); 470 ret = mpc83xx_pcie_exclude_device(bus, devfn);
@@ -515,12 +514,17 @@ static int mpc83xx_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
515static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, 514static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
516 int offset, int len, u32 val) 515 int offset, int len, u32 val)
517{ 516{
517 struct pci_controller *hose = pci_bus_to_host(bus);
518 void __iomem *cfg_addr; 518 void __iomem *cfg_addr;
519 519
520 cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); 520 cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset);
521 if (!cfg_addr) 521 if (!cfg_addr)
522 return PCIBIOS_DEVICE_NOT_FOUND; 522 return PCIBIOS_DEVICE_NOT_FOUND;
523 523
524 /* PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS */
525 if (offset == PCI_PRIMARY_BUS && bus->number == hose->first_busno)
526 val &= 0xffffff00;
527
524 switch (len) { 528 switch (len) {
525 case 1: 529 case 1:
526 out_8(cfg_addr, val); 530 out_8(cfg_addr, val);
diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c
index 103eace36194..ee1c0e1cf4a7 100644
--- a/arch/powerpc/sysdev/mpc8xxx_gpio.c
+++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c
@@ -54,6 +54,22 @@ static void mpc8xxx_gpio_save_regs(struct of_mm_gpio_chip *mm)
54 mpc8xxx_gc->data = in_be32(mm->regs + GPIO_DAT); 54 mpc8xxx_gc->data = in_be32(mm->regs + GPIO_DAT);
55} 55}
56 56
57/* Workaround GPIO 1 errata on MPC8572/MPC8536. The status of GPIOs
58 * defined as output cannot be determined by reading GPDAT register,
59 * so we use shadow data register instead. The status of input pins
60 * is determined by reading GPDAT register.
61 */
62static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio)
63{
64 u32 val;
65 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
66 struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
67
68 val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR);
69
70 return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio);
71}
72
57static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) 73static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio)
58{ 74{
59 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); 75 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
@@ -136,7 +152,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
136 gc->ngpio = MPC8XXX_GPIO_PINS; 152 gc->ngpio = MPC8XXX_GPIO_PINS;
137 gc->direction_input = mpc8xxx_gpio_dir_in; 153 gc->direction_input = mpc8xxx_gpio_dir_in;
138 gc->direction_output = mpc8xxx_gpio_dir_out; 154 gc->direction_output = mpc8xxx_gpio_dir_out;
139 gc->get = mpc8xxx_gpio_get; 155 if (of_device_is_compatible(np, "fsl,mpc8572-gpio"))
156 gc->get = mpc8572_gpio_get;
157 else
158 gc->get = mpc8xxx_gpio_get;
140 gc->set = mpc8xxx_gpio_set; 159 gc->set = mpc8xxx_gpio_set;
141 160
142 ret = of_mm_gpiochip_add(np, mm_gc); 161 ret = of_mm_gpiochip_add(np, mm_gc);
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index aa9d06e5925b..470dc6c11d57 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -567,13 +567,11 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
567#endif /* CONFIG_MPIC_U3_HT_IRQS */ 567#endif /* CONFIG_MPIC_U3_HT_IRQS */
568 568
569#ifdef CONFIG_SMP 569#ifdef CONFIG_SMP
570static int irq_choose_cpu(unsigned int virt_irq) 570static int irq_choose_cpu(const cpumask_t *mask)
571{ 571{
572 cpumask_t mask;
573 int cpuid; 572 int cpuid;
574 573
575 cpumask_copy(&mask, irq_to_desc(virt_irq)->affinity); 574 if (cpumask_equal(mask, cpu_all_mask)) {
576 if (cpus_equal(mask, CPU_MASK_ALL)) {
577 static int irq_rover; 575 static int irq_rover;
578 static DEFINE_SPINLOCK(irq_rover_lock); 576 static DEFINE_SPINLOCK(irq_rover_lock);
579 unsigned long flags; 577 unsigned long flags;
@@ -594,20 +592,15 @@ static int irq_choose_cpu(unsigned int virt_irq)
594 592
595 spin_unlock_irqrestore(&irq_rover_lock, flags); 593 spin_unlock_irqrestore(&irq_rover_lock, flags);
596 } else { 594 } else {
597 cpumask_t tmp; 595 cpuid = cpumask_first_and(mask, cpu_online_mask);
598 596 if (cpuid >= nr_cpu_ids)
599 cpus_and(tmp, cpu_online_map, mask);
600
601 if (cpus_empty(tmp))
602 goto do_round_robin; 597 goto do_round_robin;
603
604 cpuid = first_cpu(tmp);
605 } 598 }
606 599
607 return get_hard_smp_processor_id(cpuid); 600 return get_hard_smp_processor_id(cpuid);
608} 601}
609#else 602#else
610static int irq_choose_cpu(unsigned int virt_irq) 603static int irq_choose_cpu(const cpumask_t *mask)
611{ 604{
612 return hard_smp_processor_id(); 605 return hard_smp_processor_id();
613} 606}
@@ -816,7 +809,7 @@ int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask)
816 unsigned int src = mpic_irq_to_hw(irq); 809 unsigned int src = mpic_irq_to_hw(irq);
817 810
818 if (mpic->flags & MPIC_SINGLE_DEST_CPU) { 811 if (mpic->flags & MPIC_SINGLE_DEST_CPU) {
819 int cpuid = irq_choose_cpu(irq); 812 int cpuid = irq_choose_cpu(cpumask);
820 813
821 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid); 814 mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
822 } else { 815 } else {
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 1d44eee80fa1..0f67cd79d481 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -39,7 +39,12 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
39 39
40 pr_debug("mpic: found U3, guessing msi allocator setup\n"); 40 pr_debug("mpic: found U3, guessing msi allocator setup\n");
41 41
42 /* Reserve source numbers we know are reserved in the HW */ 42 /* Reserve source numbers we know are reserved in the HW.
43 *
44 * This is a bit of a mix of U3 and U4 reserves but that's going
45 * to work fine, we have plenty enugh numbers left so let's just
46 * mark anything we don't like reserved.
47 */
43 for (i = 0; i < 8; i++) 48 for (i = 0; i < 8; i++)
44 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i); 49 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
45 50
@@ -49,6 +54,10 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
49 for (i = 100; i < 105; i++) 54 for (i = 100; i < 105; i++)
50 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i); 55 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
51 56
57 for (i = 124; i < mpic->irq_count; i++)
58 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, i);
59
60
52 np = NULL; 61 np = NULL;
53 while ((np = of_find_all_nodes(np))) { 62 while ((np = of_find_all_nodes(np))) {
54 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); 63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name);
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index d3caf23e6312..bcbfe79c704b 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -64,12 +64,12 @@ static u64 read_ht_magic_addr(struct pci_dev *pdev, unsigned int pos)
64 return addr; 64 return addr;
65} 65}
66 66
67static u64 find_ht_magic_addr(struct pci_dev *pdev) 67static u64 find_ht_magic_addr(struct pci_dev *pdev, unsigned int hwirq)
68{ 68{
69 struct pci_bus *bus; 69 struct pci_bus *bus;
70 unsigned int pos; 70 unsigned int pos;
71 71
72 for (bus = pdev->bus; bus; bus = bus->parent) { 72 for (bus = pdev->bus; bus && bus->self; bus = bus->parent) {
73 pos = pci_find_ht_capability(bus->self, HT_CAPTYPE_MSI_MAPPING); 73 pos = pci_find_ht_capability(bus->self, HT_CAPTYPE_MSI_MAPPING);
74 if (pos) 74 if (pos)
75 return read_ht_magic_addr(bus->self, pos); 75 return read_ht_magic_addr(bus->self, pos);
@@ -78,13 +78,41 @@ static u64 find_ht_magic_addr(struct pci_dev *pdev)
78 return 0; 78 return 0;
79} 79}
80 80
81static u64 find_u4_magic_addr(struct pci_dev *pdev, unsigned int hwirq)
82{
83 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
84
85 /* U4 PCIe MSIs need to write to the special register in
86 * the bridge that generates interrupts. There should be
87 * theorically a register at 0xf8005000 where you just write
88 * the MSI number and that triggers the right interrupt, but
89 * unfortunately, this is busted in HW, the bridge endian swaps
90 * the value and hits the wrong nibble in the register.
91 *
92 * So instead we use another register set which is used normally
93 * for converting HT interrupts to MPIC interrupts, which decodes
94 * the interrupt number as part of the low address bits
95 *
96 * This will not work if we ever use more than one legacy MSI in
97 * a block but we never do. For one MSI or multiple MSI-X where
98 * each interrupt address can be specified separately, it works
99 * just fine.
100 */
101 if (of_device_is_compatible(hose->dn, "u4-pcie") ||
102 of_device_is_compatible(hose->dn, "U4-pcie"))
103 return 0xf8004000 | (hwirq << 4);
104
105 return 0;
106}
107
81static int u3msi_msi_check_device(struct pci_dev *pdev, int nvec, int type) 108static int u3msi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
82{ 109{
83 if (type == PCI_CAP_ID_MSIX) 110 if (type == PCI_CAP_ID_MSIX)
84 pr_debug("u3msi: MSI-X untested, trying anyway.\n"); 111 pr_debug("u3msi: MSI-X untested, trying anyway.\n");
85 112
86 /* If we can't find a magic address then MSI ain't gonna work */ 113 /* If we can't find a magic address then MSI ain't gonna work */
87 if (find_ht_magic_addr(pdev) == 0) { 114 if (find_ht_magic_addr(pdev, 0) == 0 &&
115 find_u4_magic_addr(pdev, 0) == 0) {
88 pr_debug("u3msi: no magic address found for %s\n", 116 pr_debug("u3msi: no magic address found for %s\n",
89 pci_name(pdev)); 117 pci_name(pdev));
90 return -ENXIO; 118 return -ENXIO;
@@ -118,10 +146,6 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
118 u64 addr; 146 u64 addr;
119 int hwirq; 147 int hwirq;
120 148
121 addr = find_ht_magic_addr(pdev);
122 msg.address_lo = addr & 0xFFFFFFFF;
123 msg.address_hi = addr >> 32;
124
125 list_for_each_entry(entry, &pdev->msi_list, list) { 149 list_for_each_entry(entry, &pdev->msi_list, list) {
126 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1); 150 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1);
127 if (hwirq < 0) { 151 if (hwirq < 0) {
@@ -129,6 +153,12 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
129 return hwirq; 153 return hwirq;
130 } 154 }
131 155
156 addr = find_ht_magic_addr(pdev, hwirq);
157 if (addr == 0)
158 addr = find_u4_magic_addr(pdev, hwirq);
159 msg.address_lo = addr & 0xFFFFFFFF;
160 msg.address_hi = addr >> 32;
161
132 virq = irq_create_mapping(msi_mpic->irqhost, hwirq); 162 virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
133 if (virq == NO_IRQ) { 163 if (virq == NO_IRQ) {
134 pr_debug("u3msi: failed mapping hwirq 0x%x\n", hwirq); 164 pr_debug("u3msi: failed mapping hwirq 0x%x\n", hwirq);
@@ -143,6 +173,8 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
143 pr_debug("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n", 173 pr_debug("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
144 virq, hwirq, (unsigned long)addr); 174 virq, hwirq, (unsigned long)addr);
145 175
176 printk("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
177 virq, hwirq, (unsigned long)addr);
146 msg.data = hwirq; 178 msg.data = hwirq;
147 write_msi_msg(virq, &msg); 179 write_msi_msg(virq, &msg);
148 180
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 6118890c946d..6be4503201ac 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -174,7 +174,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm)
174 if (IS_ERR(sctx->fallback.cip)) { 174 if (IS_ERR(sctx->fallback.cip)) {
175 pr_err("Allocating AES fallback algorithm %s failed\n", 175 pr_err("Allocating AES fallback algorithm %s failed\n",
176 name); 176 name);
177 return PTR_ERR(sctx->fallback.blk); 177 return PTR_ERR(sctx->fallback.cip);
178 } 178 }
179 179
180 return 0; 180 return 0;
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index f4e53c6708dc..b416aa11b91e 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/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.31 3# Linux kernel version: 2.6.33-rc2
4# Tue Sep 22 17:43:13 2009 4# Mon Jan 4 09:03:07 2010
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -51,6 +51,7 @@ CONFIG_AUDIT=y
51# 51#
52CONFIG_TREE_RCU=y 52CONFIG_TREE_RCU=y
53# CONFIG_TREE_PREEMPT_RCU is not set 53# CONFIG_TREE_PREEMPT_RCU is not set
54# CONFIG_TINY_RCU is not set
54# CONFIG_RCU_TRACE is not set 55# CONFIG_RCU_TRACE is not set
55CONFIG_RCU_FANOUT=64 56CONFIG_RCU_FANOUT=64
56# CONFIG_RCU_FANOUT_EXACT is not set 57# CONFIG_RCU_FANOUT_EXACT is not set
@@ -113,7 +114,6 @@ CONFIG_HAVE_PERF_EVENTS=y
113# CONFIG_PERF_EVENTS is not set 114# CONFIG_PERF_EVENTS is not set
114# CONFIG_PERF_COUNTERS is not set 115# CONFIG_PERF_COUNTERS is not set
115CONFIG_VM_EVENT_COUNTERS=y 116CONFIG_VM_EVENT_COUNTERS=y
116# CONFIG_STRIP_ASM_SYMS is not set
117# CONFIG_COMPAT_BRK is not set 117# CONFIG_COMPAT_BRK is not set
118CONFIG_SLAB=y 118CONFIG_SLAB=y
119# CONFIG_SLUB is not set 119# CONFIG_SLUB is not set
@@ -149,21 +149,78 @@ CONFIG_STOP_MACHINE=y
149CONFIG_BLOCK=y 149CONFIG_BLOCK=y
150CONFIG_BLK_DEV_BSG=y 150CONFIG_BLK_DEV_BSG=y
151# CONFIG_BLK_DEV_INTEGRITY is not set 151# CONFIG_BLK_DEV_INTEGRITY is not set
152# CONFIG_BLK_CGROUP is not set
152CONFIG_BLOCK_COMPAT=y 153CONFIG_BLOCK_COMPAT=y
153 154
154# 155#
155# IO Schedulers 156# IO Schedulers
156# 157#
157CONFIG_IOSCHED_NOOP=y 158CONFIG_IOSCHED_NOOP=y
158CONFIG_IOSCHED_AS=y
159CONFIG_IOSCHED_DEADLINE=y 159CONFIG_IOSCHED_DEADLINE=y
160CONFIG_IOSCHED_CFQ=y 160CONFIG_IOSCHED_CFQ=y
161# CONFIG_DEFAULT_AS is not set 161# CONFIG_CFQ_GROUP_IOSCHED is not set
162CONFIG_DEFAULT_DEADLINE=y 162CONFIG_DEFAULT_DEADLINE=y
163# CONFIG_DEFAULT_CFQ is not set 163# CONFIG_DEFAULT_CFQ is not set
164# CONFIG_DEFAULT_NOOP is not set 164# CONFIG_DEFAULT_NOOP is not set
165CONFIG_DEFAULT_IOSCHED="deadline" 165CONFIG_DEFAULT_IOSCHED="deadline"
166CONFIG_PREEMPT_NOTIFIERS=y 166CONFIG_PREEMPT_NOTIFIERS=y
167CONFIG_ARCH_INLINE_SPIN_TRYLOCK=y
168CONFIG_ARCH_INLINE_SPIN_TRYLOCK_BH=y
169CONFIG_ARCH_INLINE_SPIN_LOCK=y
170CONFIG_ARCH_INLINE_SPIN_LOCK_BH=y
171CONFIG_ARCH_INLINE_SPIN_LOCK_IRQ=y
172CONFIG_ARCH_INLINE_SPIN_LOCK_IRQSAVE=y
173CONFIG_ARCH_INLINE_SPIN_UNLOCK=y
174CONFIG_ARCH_INLINE_SPIN_UNLOCK_BH=y
175CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQ=y
176CONFIG_ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE=y
177CONFIG_ARCH_INLINE_READ_TRYLOCK=y
178CONFIG_ARCH_INLINE_READ_LOCK=y
179CONFIG_ARCH_INLINE_READ_LOCK_BH=y
180CONFIG_ARCH_INLINE_READ_LOCK_IRQ=y
181CONFIG_ARCH_INLINE_READ_LOCK_IRQSAVE=y
182CONFIG_ARCH_INLINE_READ_UNLOCK=y
183CONFIG_ARCH_INLINE_READ_UNLOCK_BH=y
184CONFIG_ARCH_INLINE_READ_UNLOCK_IRQ=y
185CONFIG_ARCH_INLINE_READ_UNLOCK_IRQRESTORE=y
186CONFIG_ARCH_INLINE_WRITE_TRYLOCK=y
187CONFIG_ARCH_INLINE_WRITE_LOCK=y
188CONFIG_ARCH_INLINE_WRITE_LOCK_BH=y
189CONFIG_ARCH_INLINE_WRITE_LOCK_IRQ=y
190CONFIG_ARCH_INLINE_WRITE_LOCK_IRQSAVE=y
191CONFIG_ARCH_INLINE_WRITE_UNLOCK=y
192CONFIG_ARCH_INLINE_WRITE_UNLOCK_BH=y
193CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQ=y
194CONFIG_ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE=y
195# CONFIG_INLINE_SPIN_TRYLOCK is not set
196# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
197# CONFIG_INLINE_SPIN_LOCK is not set
198# CONFIG_INLINE_SPIN_LOCK_BH is not set
199# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
200# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
201# CONFIG_INLINE_SPIN_UNLOCK is not set
202# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
203# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
204# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
205# CONFIG_INLINE_READ_TRYLOCK is not set
206# CONFIG_INLINE_READ_LOCK is not set
207# CONFIG_INLINE_READ_LOCK_BH is not set
208# CONFIG_INLINE_READ_LOCK_IRQ is not set
209# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
210# CONFIG_INLINE_READ_UNLOCK is not set
211# CONFIG_INLINE_READ_UNLOCK_BH is not set
212# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
213# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
214# CONFIG_INLINE_WRITE_TRYLOCK is not set
215# CONFIG_INLINE_WRITE_LOCK is not set
216# CONFIG_INLINE_WRITE_LOCK_BH is not set
217# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
218# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
219# CONFIG_INLINE_WRITE_UNLOCK is not set
220# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
221# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
222# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
223# CONFIG_MUTEX_SPIN_ON_OWNER is not set
167CONFIG_FREEZER=y 224CONFIG_FREEZER=y
168 225
169# 226#
@@ -227,14 +284,13 @@ CONFIG_MEMORY_HOTPLUG=y
227CONFIG_MEMORY_HOTPLUG_SPARSE=y 284CONFIG_MEMORY_HOTPLUG_SPARSE=y
228CONFIG_MEMORY_HOTREMOVE=y 285CONFIG_MEMORY_HOTREMOVE=y
229CONFIG_PAGEFLAGS_EXTENDED=y 286CONFIG_PAGEFLAGS_EXTENDED=y
230CONFIG_SPLIT_PTLOCK_CPUS=4 287CONFIG_SPLIT_PTLOCK_CPUS=999999
231CONFIG_MIGRATION=y 288CONFIG_MIGRATION=y
232CONFIG_PHYS_ADDR_T_64BIT=y 289CONFIG_PHYS_ADDR_T_64BIT=y
233CONFIG_ZONE_DMA_FLAG=1 290CONFIG_ZONE_DMA_FLAG=1
234CONFIG_BOUNCE=y 291CONFIG_BOUNCE=y
235CONFIG_VIRT_TO_BUS=y 292CONFIG_VIRT_TO_BUS=y
236CONFIG_HAVE_MLOCK=y 293# CONFIG_KSM is not set
237CONFIG_HAVE_MLOCKED_PAGE_BIT=y
238CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 294CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
239 295
240# 296#
@@ -339,6 +395,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
339CONFIG_INET6_XFRM_MODE_BEET=y 395CONFIG_INET6_XFRM_MODE_BEET=y
340# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 396# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
341CONFIG_IPV6_SIT=y 397CONFIG_IPV6_SIT=y
398# CONFIG_IPV6_SIT_6RD is not set
342CONFIG_IPV6_NDISC_NODETYPE=y 399CONFIG_IPV6_NDISC_NODETYPE=y
343# CONFIG_IPV6_TUNNEL is not set 400# CONFIG_IPV6_TUNNEL is not set
344# CONFIG_IPV6_MULTIPLE_TABLES is not set 401# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -504,6 +561,10 @@ CONFIG_BLK_DEV=y
504# CONFIG_BLK_DEV_COW_COMMON is not set 561# CONFIG_BLK_DEV_COW_COMMON is not set
505CONFIG_BLK_DEV_LOOP=m 562CONFIG_BLK_DEV_LOOP=m
506# CONFIG_BLK_DEV_CRYPTOLOOP is not set 563# CONFIG_BLK_DEV_CRYPTOLOOP is not set
564
565#
566# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
567#
507CONFIG_BLK_DEV_NBD=m 568CONFIG_BLK_DEV_NBD=m
508# CONFIG_BLK_DEV_OSD is not set 569# CONFIG_BLK_DEV_OSD is not set
509CONFIG_BLK_DEV_RAM=y 570CONFIG_BLK_DEV_RAM=y
@@ -710,7 +771,6 @@ CONFIG_S390_VMUR=m
710# CONFIG_PPS is not set 771# CONFIG_PPS is not set
711# CONFIG_POWER_SUPPLY is not set 772# CONFIG_POWER_SUPPLY is not set
712# CONFIG_THERMAL is not set 773# CONFIG_THERMAL is not set
713# CONFIG_THERMAL_HWMON is not set
714# CONFIG_WATCHDOG is not set 774# CONFIG_WATCHDOG is not set
715# CONFIG_REGULATOR is not set 775# CONFIG_REGULATOR is not set
716# CONFIG_MEMSTICK is not set 776# CONFIG_MEMSTICK is not set
@@ -864,6 +924,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
864CONFIG_ENABLE_MUST_CHECK=y 924CONFIG_ENABLE_MUST_CHECK=y
865CONFIG_FRAME_WARN=2048 925CONFIG_FRAME_WARN=2048
866CONFIG_MAGIC_SYSRQ=y 926CONFIG_MAGIC_SYSRQ=y
927# CONFIG_STRIP_ASM_SYMS is not set
867# CONFIG_UNUSED_SYMBOLS is not set 928# CONFIG_UNUSED_SYMBOLS is not set
868CONFIG_DEBUG_FS=y 929CONFIG_DEBUG_FS=y
869# CONFIG_HEADERS_CHECK is not set 930# CONFIG_HEADERS_CHECK is not set
@@ -931,7 +992,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
931CONFIG_SAMPLES=y 992CONFIG_SAMPLES=y
932# CONFIG_SAMPLE_KOBJECT is not set 993# CONFIG_SAMPLE_KOBJECT is not set
933# CONFIG_SAMPLE_KPROBES is not set 994# CONFIG_SAMPLE_KPROBES is not set
934# CONFIG_KMEMCHECK is not set
935 995
936# 996#
937# Security options 997# Security options
@@ -939,7 +999,11 @@ CONFIG_SAMPLES=y
939# CONFIG_KEYS is not set 999# CONFIG_KEYS is not set
940# CONFIG_SECURITY is not set 1000# CONFIG_SECURITY is not set
941# CONFIG_SECURITYFS is not set 1001# CONFIG_SECURITYFS is not set
942# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1002# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1003# CONFIG_DEFAULT_SECURITY_SMACK is not set
1004# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1005CONFIG_DEFAULT_SECURITY_DAC=y
1006CONFIG_DEFAULT_SECURITY=""
943CONFIG_CRYPTO=y 1007CONFIG_CRYPTO=y
944 1008
945# 1009#
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 77df726180ba..2b92d501425f 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -164,7 +164,7 @@ static inline void part_hdr__part_name(enum diag204_format type, void *hdr,
164 LPAR_NAME_LEN); 164 LPAR_NAME_LEN);
165 EBCASC(name, LPAR_NAME_LEN); 165 EBCASC(name, LPAR_NAME_LEN);
166 name[LPAR_NAME_LEN] = 0; 166 name[LPAR_NAME_LEN] = 0;
167 strstrip(name); 167 strim(name);
168} 168}
169 169
170struct cpu_info { 170struct cpu_info {
@@ -523,7 +523,7 @@ static int diag224_idx2name(int index, char *name)
523 memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN), 523 memcpy(name, diag224_cpu_names + ((index + 1) * CPU_NAME_LEN),
524 CPU_NAME_LEN); 524 CPU_NAME_LEN);
525 name[CPU_NAME_LEN] = 0; 525 name[CPU_NAME_LEN] = 0;
526 strstrip(name); 526 strim(name);
527 return 0; 527 return 0;
528} 528}
529 529
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index d01fc8f799f0..f0b0d31f0b48 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -124,7 +124,7 @@ static int hpyfs_vm_create_guest(struct super_block *sb,
124 /* guest dir */ 124 /* guest dir */
125 memcpy(guest_name, data->guest_name, NAME_LEN); 125 memcpy(guest_name, data->guest_name, NAME_LEN);
126 EBCASC(guest_name, NAME_LEN); 126 EBCASC(guest_name, NAME_LEN);
127 strstrip(guest_name); 127 strim(guest_name);
128 guest_dir = hypfs_mkdir(sb, systems_dir, guest_name); 128 guest_dir = hypfs_mkdir(sb, systems_dir, guest_name);
129 if (IS_ERR(guest_dir)) 129 if (IS_ERR(guest_dir))
130 return PTR_ERR(guest_dir); 130 return PTR_ERR(guest_dir);
diff --git a/arch/s390/include/asm/asm-offsets.h b/arch/s390/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/s390/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/s390/include/asm/param.h b/arch/s390/include/asm/param.h
index 34aaa4603347..c616821bf2ac 100644
--- a/arch/s390/include/asm/param.h
+++ b/arch/s390/include/asm/param.h
@@ -1,30 +1,6 @@
1/*
2 * include/asm-s390/param.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/param.h"
7 */
8
9#ifndef _ASMS390_PARAM_H 1#ifndef _ASMS390_PARAM_H
10#define _ASMS390_PARAM_H 2#define _ASMS390_PARAM_H
11 3
12#ifdef __KERNEL__ 4#include <asm-generic/param.h>
13# define HZ CONFIG_HZ /* Internal kernel timer frequency */
14# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
16#endif
17
18#ifndef HZ
19#define HZ 100
20#endif
21
22#define EXEC_PAGESIZE 4096
23
24#ifndef NOGROUP
25#define NOGROUP (-1)
26#endif
27
28#define MAXHOSTNAMELEN 64 /* max length of hostname */
29 5
30#endif 6#endif /* _ASMS390_PARAM_H */
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index cb5232df151e..192a7203a14f 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -269,7 +269,8 @@
269#define __NR_pwritev 329 269#define __NR_pwritev 329
270#define __NR_rt_tgsigqueueinfo 330 270#define __NR_rt_tgsigqueueinfo 330
271#define __NR_perf_event_open 331 271#define __NR_perf_event_open 331
272#define NR_syscalls 332 272#define __NR_recvmmsg 332
273#define NR_syscalls 333
273 274
274/* 275/*
275 * There are some system calls that are not present on 64 bit, some 276 * There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 30de2d0e52bb..faeaccc7d7d9 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1853,3 +1853,12 @@ sys32_execve_wrapper:
1853 llgtr %r3,%r3 # compat_uptr_t * 1853 llgtr %r3,%r3 # compat_uptr_t *
1854 llgtr %r4,%r4 # compat_uptr_t * 1854 llgtr %r4,%r4 # compat_uptr_t *
1855 jg sys32_execve # branch to system call 1855 jg sys32_execve # branch to system call
1856
1857 .globl compat_sys_recvmmsg_wrapper
1858compat_sys_recvmmsg_wrapper:
1859 lgfr %r2,%r2 # int
1860 llgtr %r3,%r3 # struct compat_mmsghdr *
1861 llgfr %r4,%r4 # unsigned int
1862 llgfr %r5,%r5 # unsigned int
1863 llgtr %r6,%r6 # struct compat_timespec *
1864 jg compat_sys_recvmmsg
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 4890ac6d7faa..4d73296fed74 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -221,7 +221,7 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
221 const char *buf, size_t len) \ 221 const char *buf, size_t len) \
222{ \ 222{ \
223 strncpy(_value, buf, sizeof(_value) - 1); \ 223 strncpy(_value, buf, sizeof(_value) - 1); \
224 strstrip(_value); \ 224 strim(_value); \
225 return len; \ 225 return len; \
226} \ 226} \
227static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 227static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
@@ -472,7 +472,7 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj,
472 return sprintf(page, "#unknown#\n"); 472 return sprintf(page, "#unknown#\n");
473 memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); 473 memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN);
474 EBCASC(loadparm, LOADPARM_LEN); 474 EBCASC(loadparm, LOADPARM_LEN);
475 strstrip(loadparm); 475 strim(loadparm);
476 return sprintf(page, "%s\n", loadparm); 476 return sprintf(page, "%s\n", loadparm);
477} 477}
478 478
@@ -776,7 +776,7 @@ static void reipl_get_ascii_loadparm(char *loadparm,
776 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); 776 memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN);
777 EBCASC(loadparm, LOADPARM_LEN); 777 EBCASC(loadparm, LOADPARM_LEN);
778 loadparm[LOADPARM_LEN] = 0; 778 loadparm[LOADPARM_LEN] = 0;
779 strstrip(loadparm); 779 strim(loadparm);
780} 780}
781 781
782static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb, 782static ssize_t reipl_generic_loadparm_show(struct ipl_parameter_block *ipb,
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 653c6a178740..13815d39f7dd 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -959,7 +959,7 @@ static const struct user_regset s390_compat_regsets[] = {
959 .set = s390_fpregs_set, 959 .set = s390_fpregs_set,
960 }, 960 },
961 [REGSET_GENERAL_EXTENDED] = { 961 [REGSET_GENERAL_EXTENDED] = {
962 .core_note_type = NT_PRXSTATUS, 962 .core_note_type = NT_S390_HIGH_GPRS,
963 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), 963 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t),
964 .size = sizeof(compat_long_t), 964 .size = sizeof(compat_long_t),
965 .align = sizeof(compat_long_t), 965 .align = sizeof(compat_long_t),
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 30eca070d426..4f292c936872 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -340,3 +340,4 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ 341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */
342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) 342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
343SYSCALL(sys_recvmmsg,sys_recvmmsg,compat_sys_recvmmsg_wrapper)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index c2e42cc65ce7..6e7ad63854c0 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -18,7 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/ptrace.h> 21#include <linux/tracehook.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/smp.h> 24#include <linux/smp.h>
@@ -382,7 +382,7 @@ void __kprobes do_single_step(struct pt_regs *regs)
382 SIGTRAP) == NOTIFY_STOP){ 382 SIGTRAP) == NOTIFY_STOP){
383 return; 383 return;
384 } 384 }
385 if ((current->ptrace & PT_PTRACED) != 0) 385 if (tracehook_consider_fatal_signal(current, SIGTRAP))
386 force_sig(SIGTRAP, current); 386 force_sig(SIGTRAP, current);
387} 387}
388 388
@@ -483,7 +483,7 @@ static void illegal_op(struct pt_regs * regs, long interruption_code)
483 if (get_user(*((__u16 *) opcode), (__u16 __user *) location)) 483 if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
484 return; 484 return;
485 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { 485 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
486 if (current->ptrace & PT_PTRACED) 486 if (tracehook_consider_fatal_signal(current, SIGTRAP))
487 force_sig(SIGTRAP, current); 487 force_sig(SIGTRAP, current);
488 else 488 else
489 signal = SIGILL; 489 signal = SIGILL;
diff --git a/arch/score/include/asm/asm-offsets.h b/arch/score/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/score/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/score/include/asm/cacheflush.h b/arch/score/include/asm/cacheflush.h
index caaba24036e3..1d545d0ce206 100644
--- a/arch/score/include/asm/cacheflush.h
+++ b/arch/score/include/asm/cacheflush.h
@@ -14,10 +14,12 @@ extern void flush_cache_sigtramp(unsigned long addr);
14extern void flush_icache_all(void); 14extern void flush_icache_all(void);
15extern void flush_icache_range(unsigned long start, unsigned long end); 15extern void flush_icache_range(unsigned long start, unsigned long end);
16extern void flush_dcache_range(unsigned long start, unsigned long end); 16extern void flush_dcache_range(unsigned long start, unsigned long end);
17extern void flush_dcache_page(struct page *page);
18
19#define PG_dcache_dirty PG_arch_1
17 20
18#define flush_cache_dup_mm(mm) do {} while (0) 21#define flush_cache_dup_mm(mm) do {} while (0)
19#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 22#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
20#define flush_dcache_page(page) do {} while (0)
21#define flush_dcache_mmap_lock(mapping) do {} while (0) 23#define flush_dcache_mmap_lock(mapping) do {} while (0)
22#define flush_dcache_mmap_unlock(mapping) do {} while (0) 24#define flush_dcache_mmap_unlock(mapping) do {} while (0)
23#define flush_cache_vmap(start, end) do {} while (0) 25#define flush_cache_vmap(start, end) do {} while (0)
diff --git a/arch/score/include/asm/delay.h b/arch/score/include/asm/delay.h
index 6726ec199dc0..529e494712a5 100644
--- a/arch/score/include/asm/delay.h
+++ b/arch/score/include/asm/delay.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_SCORE_DELAY_H 1#ifndef _ASM_SCORE_DELAY_H
2#define _ASM_SCORE_DELAY_H 2#define _ASM_SCORE_DELAY_H
3 3
4#include <asm-generic/param.h>
5
4static inline void __delay(unsigned long loops) 6static inline void __delay(unsigned long loops)
5{ 7{
6 /* 3 cycles per loop. */ 8 /* 3 cycles per loop. */
diff --git a/arch/score/include/asm/page.h b/arch/score/include/asm/page.h
index d92a5a2d36d4..1e9ade8e77e6 100644
--- a/arch/score/include/asm/page.h
+++ b/arch/score/include/asm/page.h
@@ -74,7 +74,7 @@ extern unsigned long max_pfn;
74#define page_to_bus(page) (page_to_phys(page)) 74#define page_to_bus(page) (page_to_phys(page))
75#define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr))) 75#define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr)))
76 76
77#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_mapnr) 77#define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn))
78 78
79#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) 79#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
80 80
diff --git a/arch/score/kernel/setup.c b/arch/score/kernel/setup.c
index 6a2503c75c4e..6f898c057878 100644
--- a/arch/score/kernel/setup.c
+++ b/arch/score/kernel/setup.c
@@ -49,6 +49,7 @@ static void __init bootmem_init(void)
49 49
50 min_low_pfn = PFN_UP(MEMORY_START); 50 min_low_pfn = PFN_UP(MEMORY_START);
51 max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE); 51 max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE);
52 max_mapnr = max_low_pfn - min_low_pfn;
52 53
53 /* Initialize the boot-time allocator with low memory only. */ 54 /* Initialize the boot-time allocator with low memory only. */
54 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, 55 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
diff --git a/arch/score/mm/cache.c b/arch/score/mm/cache.c
index dbac9d9dfddd..b25e95743600 100644
--- a/arch/score/mm/cache.c
+++ b/arch/score/mm/cache.c
@@ -29,6 +29,7 @@
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/fs.h>
32 33
33#include <asm/mmu_context.h> 34#include <asm/mmu_context.h>
34 35
@@ -51,6 +52,27 @@ static void flush_data_cache_page(unsigned long addr)
51 } 52 }
52} 53}
53 54
55void flush_dcache_page(struct page *page)
56{
57 struct address_space *mapping = page_mapping(page);
58 unsigned long addr;
59
60 if (PageHighMem(page))
61 return;
62 if (mapping && !mapping_mapped(mapping)) {
63 set_bit(PG_dcache_dirty, &(page)->flags);
64 return;
65 }
66
67 /*
68 * We could delay the flush for the !page_mapping case too. But that
69 * case is for exec env/arg pages and those are %99 certainly going to
70 * get faulted into the tlb (and thus flushed) anyways.
71 */
72 addr = (unsigned long) page_address(page);
73 flush_data_cache_page(addr);
74}
75
54/* called by update_mmu_cache. */ 76/* called by update_mmu_cache. */
55void __update_cache(struct vm_area_struct *vma, unsigned long address, 77void __update_cache(struct vm_area_struct *vma, unsigned long address,
56 pte_t pte) 78 pte_t pte)
@@ -63,11 +85,11 @@ void __update_cache(struct vm_area_struct *vma, unsigned long address,
63 if (unlikely(!pfn_valid(pfn))) 85 if (unlikely(!pfn_valid(pfn)))
64 return; 86 return;
65 page = pfn_to_page(pfn); 87 page = pfn_to_page(pfn);
66 if (page_mapping(page) && test_bit(PG_arch_1, &page->flags)) { 88 if (page_mapping(page) && test_bit(PG_dcache_dirty, &(page)->flags)) {
67 addr = (unsigned long) page_address(page); 89 addr = (unsigned long) page_address(page);
68 if (exec) 90 if (exec)
69 flush_data_cache_page(addr); 91 flush_data_cache_page(addr);
70 clear_bit(PG_arch_1, &page->flags); 92 clear_bit(PG_dcache_dirty, &(page)->flags);
71 } 93 }
72} 94}
73 95
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c
index 4e3dcd0c4716..dfaf458d6702 100644
--- a/arch/score/mm/init.c
+++ b/arch/score/mm/init.c
@@ -83,7 +83,6 @@ void __init mem_init(void)
83 unsigned long codesize, reservedpages, datasize, initsize; 83 unsigned long codesize, reservedpages, datasize, initsize;
84 unsigned long tmp, ram = 0; 84 unsigned long tmp, ram = 0;
85 85
86 max_mapnr = max_low_pfn;
87 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 86 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
88 totalram_pages += free_all_bootmem(); 87 totalram_pages += free_all_bootmem();
89 totalram_pages -= setup_zero_page(); /* Setup zeroed pages. */ 88 totalram_pages -= setup_zero_page(); /* Setup zeroed pages. */
@@ -101,17 +100,13 @@ void __init mem_init(void)
101 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 100 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
102 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 101 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
103 102
104 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
105 kclist_add(&kcore_vmalloc, (void *) VMALLOC_START,
106 VMALLOC_END - VMALLOC_START);
107
108 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 103 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
109 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", 104 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
110 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 105 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
111 ram << (PAGE_SHIFT-10), codesize >> 10, 106 ram << (PAGE_SHIFT-10), codesize >> 10,
112 reservedpages << (PAGE_SHIFT-10), datasize >> 10, 107 reservedpages << (PAGE_SHIFT-10), datasize >> 10,
113 initsize >> 10, 108 initsize >> 10,
114 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 109 totalhigh_pages << (PAGE_SHIFT-10));
115} 110}
116#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 111#endif /* !CONFIG_NEED_MULTIPLE_NODES */
117 112
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0031a6979f3a..2121fbb2ff4c 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -540,14 +540,16 @@ config SH_TIMER_MTU2
540 540
541config SH_PCLK_FREQ 541config SH_PCLK_FREQ
542 int "Peripheral clock frequency (in Hz)" 542 int "Peripheral clock frequency (in Hz)"
543 default "27000000" if CPU_SUBTYPE_SH7343 543 depends on SH_CLK_CPG_LEGACY
544 default "31250000" if CPU_SUBTYPE_SH7619 544 default "31250000" if CPU_SUBTYPE_SH7619
545 default "32000000" if CPU_SUBTYPE_SH7722 545 default "33333333" if CPU_SUBTYPE_SH7770 || \
546 default "33333333" if CPU_SUBTYPE_SH7770 || CPU_SUBTYPE_SH7723 || \ 546 CPU_SUBTYPE_SH7760 || \
547 CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7705 || \ 547 CPU_SUBTYPE_SH7705 || \
548 CPU_SUBTYPE_SH7203 || CPU_SUBTYPE_SH7206 || \ 548 CPU_SUBTYPE_SH7203 || \
549 CPU_SUBTYPE_SH7263 || CPU_SUBTYPE_MXG || \ 549 CPU_SUBTYPE_SH7206 || \
550 CPU_SUBTYPE_SH7786 || CPU_SUBTYPE_SH7724 550 CPU_SUBTYPE_SH7263 || \
551 CPU_SUBTYPE_MXG || \
552 CPU_SUBTYPE_SH7786
551 default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R 553 default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R
552 default "66000000" if CPU_SUBTYPE_SH4_202 554 default "66000000" if CPU_SUBTYPE_SH4_202
553 default "50000000" 555 default "50000000"
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index ac17c5ac550e..db91925c79d1 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -205,10 +205,7 @@ libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
205 205
206BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \ 206BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \
207 zImage vmlinux.srec romImage 207 zImage vmlinux.srec romImage
208PHONY += maketools $(BOOT_TARGETS) FORCE 208PHONY += $(BOOT_TARGETS)
209
210maketools: include/linux/version.h FORCE
211 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
212 209
213all: $(KBUILD_IMAGE) 210all: $(KBUILD_IMAGE)
214 211
@@ -217,7 +214,8 @@ $(BOOT_TARGETS): vmlinux
217 214
218compressed: zImage 215compressed: zImage
219 216
220archprepare: maketools 217archprepare:
218 $(Q)$(MAKE) $(build)=arch/sh/tools include/generated/machtypes.h
221 219
222archclean: 220archclean:
223 $(Q)$(MAKE) $(clean)=$(boot) 221 $(Q)$(MAKE) $(clean)=$(boot)
@@ -234,5 +232,3 @@ define archhelp
234 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' 232 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)'
235 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' 233 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)'
236endef 234endef
237
238CLEAN_FILES += include/asm-sh/machtypes.h
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 194aaca22d47..6a8861b39f05 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -128,8 +128,6 @@ static struct platform_device nor_flash_device = {
128 128
129/* SH Eth */ 129/* SH Eth */
130#define SH_ETH_ADDR (0xA4600000) 130#define SH_ETH_ADDR (0xA4600000)
131#define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
132#define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
133static struct resource sh_eth_resources[] = { 131static struct resource sh_eth_resources[] = {
134 [0] = { 132 [0] = {
135 .start = SH_ETH_ADDR, 133 .start = SH_ETH_ADDR,
@@ -509,6 +507,7 @@ static struct platform_device sdhi1_device = {
509 507
510#else 508#else
511 509
510/* MMC SPI */
512static int mmc_spi_get_ro(struct device *dev) 511static int mmc_spi_get_ro(struct device *dev)
513{ 512{
514 return gpio_get_value(GPIO_PTY6); 513 return gpio_get_value(GPIO_PTY6);
@@ -542,6 +541,7 @@ static struct spi_board_info spi_bus[] = {
542 }, 541 },
543}; 542};
544 543
544/* MSIOF0 */
545static struct sh_msiof_spi_info msiof0_data = { 545static struct sh_msiof_spi_info msiof0_data = {
546 .num_chipselect = 1, 546 .num_chipselect = 1,
547}; 547};
diff --git a/arch/sh/configs/ap325rxa_defconfig b/arch/sh/configs/ap325rxa_defconfig
index 2f78d01cc6c0..8931a60e37a4 100644
--- a/arch/sh/configs/ap325rxa_defconfig
+++ b/arch/sh/configs/ap325rxa_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.31 3# Linux kernel version: 2.6.33-rc2
4# Fri Sep 25 11:22:50 2009 4# Mon Jan 4 11:10:59 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -62,6 +64,7 @@ CONFIG_BSD_PROCESS_ACCT=y
62# 64#
63CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
64# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
65# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
66CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
67# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -99,6 +102,7 @@ CONFIG_EVENTFD=y
99CONFIG_SHMEM=y 102CONFIG_SHMEM=y
100CONFIG_AIO=y 103CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y 104CONFIG_HAVE_PERF_EVENTS=y
105CONFIG_PERF_USE_VMALLOC=y
102 106
103# 107#
104# Kernel Performance Events And Counters 108# Kernel Performance Events And Counters
@@ -116,6 +120,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
116CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
118CONFIG_HAVE_ARCH_TRACEHOOK=y 122CONFIG_HAVE_ARCH_TRACEHOOK=y
123CONFIG_HAVE_DMA_ATTRS=y
119CONFIG_HAVE_CLK=y 124CONFIG_HAVE_CLK=y
120CONFIG_HAVE_DMA_API_DEBUG=y 125CONFIG_HAVE_DMA_API_DEBUG=y
121 126
@@ -142,14 +147,41 @@ CONFIG_LBDAF=y
142# IO Schedulers 147# IO Schedulers
143# 148#
144CONFIG_IOSCHED_NOOP=y 149CONFIG_IOSCHED_NOOP=y
145CONFIG_IOSCHED_AS=y
146CONFIG_IOSCHED_DEADLINE=y 150CONFIG_IOSCHED_DEADLINE=y
147CONFIG_IOSCHED_CFQ=y 151CONFIG_IOSCHED_CFQ=y
148# CONFIG_DEFAULT_AS is not set
149# CONFIG_DEFAULT_DEADLINE is not set 152# CONFIG_DEFAULT_DEADLINE is not set
150CONFIG_DEFAULT_CFQ=y 153CONFIG_DEFAULT_CFQ=y
151# CONFIG_DEFAULT_NOOP is not set 154# CONFIG_DEFAULT_NOOP is not set
152CONFIG_DEFAULT_IOSCHED="cfq" 155CONFIG_DEFAULT_IOSCHED="cfq"
156# CONFIG_INLINE_SPIN_TRYLOCK is not set
157# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
158# CONFIG_INLINE_SPIN_LOCK is not set
159# CONFIG_INLINE_SPIN_LOCK_BH is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
162# CONFIG_INLINE_SPIN_UNLOCK is not set
163# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
164# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
165# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
166# CONFIG_INLINE_READ_TRYLOCK is not set
167# CONFIG_INLINE_READ_LOCK is not set
168# CONFIG_INLINE_READ_LOCK_BH is not set
169# CONFIG_INLINE_READ_LOCK_IRQ is not set
170# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
171# CONFIG_INLINE_READ_UNLOCK is not set
172# CONFIG_INLINE_READ_UNLOCK_BH is not set
173# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
174# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
175# CONFIG_INLINE_WRITE_TRYLOCK is not set
176# CONFIG_INLINE_WRITE_LOCK is not set
177# CONFIG_INLINE_WRITE_LOCK_BH is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
180# CONFIG_INLINE_WRITE_UNLOCK is not set
181# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
182# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
183# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
184# CONFIG_MUTEX_SPIN_ON_OWNER is not set
153CONFIG_FREEZER=y 185CONFIG_FREEZER=y
154 186
155# 187#
@@ -205,6 +237,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
205CONFIG_MEMORY_START=0x08000000 237CONFIG_MEMORY_START=0x08000000
206CONFIG_MEMORY_SIZE=0x08000000 238CONFIG_MEMORY_SIZE=0x08000000
207CONFIG_29BIT=y 239CONFIG_29BIT=y
240# CONFIG_PMB_ENABLE is not set
208# CONFIG_X2TLB is not set 241# CONFIG_X2TLB is not set
209CONFIG_VSYSCALL=y 242CONFIG_VSYSCALL=y
210CONFIG_ARCH_FLATMEM_ENABLE=y 243CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -229,8 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
229# CONFIG_PHYS_ADDR_T_64BIT is not set 262# CONFIG_PHYS_ADDR_T_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=0 263CONFIG_ZONE_DMA_FLAG=0
231CONFIG_NR_QUICK=2 264CONFIG_NR_QUICK=2
232CONFIG_HAVE_MLOCK=y
233CONFIG_HAVE_MLOCKED_PAGE_BIT=y
234# CONFIG_KSM is not set 265# CONFIG_KSM is not set
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 266CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236 267
@@ -262,7 +293,6 @@ CONFIG_SH_AP325RXA=y
262# 293#
263CONFIG_SH_TIMER_TMU=y 294CONFIG_SH_TIMER_TMU=y
264# CONFIG_SH_TIMER_CMT is not set 295# CONFIG_SH_TIMER_CMT is not set
265CONFIG_SH_PCLK_FREQ=33333333
266CONFIG_SH_CLK_CPG=y 296CONFIG_SH_CLK_CPG=y
267CONFIG_TICK_ONESHOT=y 297CONFIG_TICK_ONESHOT=y
268# CONFIG_NO_HZ is not set 298# CONFIG_NO_HZ is not set
@@ -418,9 +448,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
418# CONFIG_AF_RXRPC is not set 448# CONFIG_AF_RXRPC is not set
419CONFIG_WIRELESS=y 449CONFIG_WIRELESS=y
420# CONFIG_CFG80211 is not set 450# CONFIG_CFG80211 is not set
421CONFIG_CFG80211_DEFAULT_PS_VALUE=0
422# CONFIG_WIRELESS_OLD_REGULATORY is not set
423# CONFIG_WIRELESS_EXT is not set
424# CONFIG_LIB80211 is not set 451# CONFIG_LIB80211 is not set
425 452
426# 453#
@@ -550,6 +577,10 @@ CONFIG_MTD_UBI_BEB_RESERVE=1
550CONFIG_BLK_DEV=y 577CONFIG_BLK_DEV=y
551# CONFIG_BLK_DEV_COW_COMMON is not set 578# CONFIG_BLK_DEV_COW_COMMON is not set
552# CONFIG_BLK_DEV_LOOP is not set 579# CONFIG_BLK_DEV_LOOP is not set
580
581#
582# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
583#
553# CONFIG_BLK_DEV_NBD is not set 584# CONFIG_BLK_DEV_NBD is not set
554CONFIG_BLK_DEV_RAM=y 585CONFIG_BLK_DEV_RAM=y
555CONFIG_BLK_DEV_RAM_COUNT=4 586CONFIG_BLK_DEV_RAM_COUNT=4
@@ -559,9 +590,12 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
559# CONFIG_ATA_OVER_ETH is not set 590# CONFIG_ATA_OVER_ETH is not set
560# CONFIG_BLK_DEV_HD is not set 591# CONFIG_BLK_DEV_HD is not set
561CONFIG_MISC_DEVICES=y 592CONFIG_MISC_DEVICES=y
593# CONFIG_AD525X_DPOT is not set
562# CONFIG_ICS932S401 is not set 594# CONFIG_ICS932S401 is not set
563# CONFIG_ENCLOSURE_SERVICES is not set 595# CONFIG_ENCLOSURE_SERVICES is not set
564# CONFIG_ISL29003 is not set 596# CONFIG_ISL29003 is not set
597# CONFIG_DS1682 is not set
598# CONFIG_TI_DAC7512 is not set
565# CONFIG_C2PORT is not set 599# CONFIG_C2PORT is not set
566 600
567# 601#
@@ -572,6 +606,7 @@ CONFIG_MISC_DEVICES=y
572# CONFIG_EEPROM_LEGACY is not set 606# CONFIG_EEPROM_LEGACY is not set
573# CONFIG_EEPROM_MAX6875 is not set 607# CONFIG_EEPROM_MAX6875 is not set
574# CONFIG_EEPROM_93CX6 is not set 608# CONFIG_EEPROM_93CX6 is not set
609# CONFIG_IWMC3200TOP is not set
575CONFIG_HAVE_IDE=y 610CONFIG_HAVE_IDE=y
576# CONFIG_IDE is not set 611# CONFIG_IDE is not set
577 612
@@ -664,11 +699,11 @@ CONFIG_SMSC911X=y
664# CONFIG_B44 is not set 699# CONFIG_B44 is not set
665# CONFIG_KS8842 is not set 700# CONFIG_KS8842 is not set
666# CONFIG_KS8851 is not set 701# CONFIG_KS8851 is not set
702# CONFIG_KS8851_MLL is not set
667# CONFIG_NETDEV_1000 is not set 703# CONFIG_NETDEV_1000 is not set
668# CONFIG_NETDEV_10000 is not set 704# CONFIG_NETDEV_10000 is not set
669CONFIG_WLAN=y 705CONFIG_WLAN=y
670# CONFIG_WLAN_PRE80211 is not set 706# CONFIG_HOSTAP is not set
671# CONFIG_WLAN_80211 is not set
672 707
673# 708#
674# Enable WiMAX (Networking options) to see the WiMAX drivers 709# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -688,6 +723,7 @@ CONFIG_WLAN=y
688CONFIG_INPUT=y 723CONFIG_INPUT=y
689# CONFIG_INPUT_FF_MEMLESS is not set 724# CONFIG_INPUT_FF_MEMLESS is not set
690# CONFIG_INPUT_POLLDEV is not set 725# CONFIG_INPUT_POLLDEV is not set
726# CONFIG_INPUT_SPARSEKMAP is not set
691 727
692# 728#
693# Userland interfaces 729# Userland interfaces
@@ -782,7 +818,6 @@ CONFIG_I2C_SH_MOBILE=y
782# 818#
783# Miscellaneous I2C Chip support 819# Miscellaneous I2C Chip support
784# 820#
785# CONFIG_DS1682 is not set
786# CONFIG_SENSORS_TSL2550 is not set 821# CONFIG_SENSORS_TSL2550 is not set
787# CONFIG_I2C_DEBUG_CORE is not set 822# CONFIG_I2C_DEBUG_CORE is not set
788# CONFIG_I2C_DEBUG_ALGO is not set 823# CONFIG_I2C_DEBUG_ALGO is not set
@@ -796,7 +831,10 @@ CONFIG_SPI_MASTER=y
796# 831#
797CONFIG_SPI_BITBANG=y 832CONFIG_SPI_BITBANG=y
798CONFIG_SPI_GPIO=y 833CONFIG_SPI_GPIO=y
834# CONFIG_SPI_SH_MSIOF is not set
799# CONFIG_SPI_SH_SCI is not set 835# CONFIG_SPI_SH_SCI is not set
836# CONFIG_SPI_XILINX is not set
837# CONFIG_SPI_DESIGNWARE is not set
800 838
801# 839#
802# SPI Protocol Masters 840# SPI Protocol Masters
@@ -854,11 +892,13 @@ CONFIG_SSB_POSSIBLE=y
854# 892#
855# CONFIG_MFD_CORE is not set 893# CONFIG_MFD_CORE is not set
856# CONFIG_MFD_SM501 is not set 894# CONFIG_MFD_SM501 is not set
895# CONFIG_MFD_SH_MOBILE_SDHI is not set
857# CONFIG_HTC_PASIC3 is not set 896# CONFIG_HTC_PASIC3 is not set
858# CONFIG_TPS65010 is not set 897# CONFIG_TPS65010 is not set
859# CONFIG_TWL4030_CORE is not set 898# CONFIG_TWL4030_CORE is not set
860# CONFIG_MFD_TMIO is not set 899# CONFIG_MFD_TMIO is not set
861# CONFIG_PMIC_DA903X is not set 900# CONFIG_PMIC_DA903X is not set
901# CONFIG_PMIC_ADP5520 is not set
862# CONFIG_MFD_WM8400 is not set 902# CONFIG_MFD_WM8400 is not set
863# CONFIG_MFD_WM831X is not set 903# CONFIG_MFD_WM831X is not set
864# CONFIG_MFD_WM8350_I2C is not set 904# CONFIG_MFD_WM8350_I2C is not set
@@ -866,6 +906,8 @@ CONFIG_SSB_POSSIBLE=y
866# CONFIG_MFD_MC13783 is not set 906# CONFIG_MFD_MC13783 is not set
867# CONFIG_AB3100_CORE is not set 907# CONFIG_AB3100_CORE is not set
868# CONFIG_EZX_PCAP is not set 908# CONFIG_EZX_PCAP is not set
909# CONFIG_MFD_88PM8607 is not set
910# CONFIG_AB4500_CORE is not set
869# CONFIG_REGULATOR is not set 911# CONFIG_REGULATOR is not set
870CONFIG_MEDIA_SUPPORT=y 912CONFIG_MEDIA_SUPPORT=y
871 913
@@ -882,6 +924,8 @@ CONFIG_VIDEO_MEDIA=y
882# 924#
883# Multimedia drivers 925# Multimedia drivers
884# 926#
927CONFIG_IR_CORE=y
928CONFIG_VIDEO_IR=y
885# CONFIG_MEDIA_ATTACH is not set 929# CONFIG_MEDIA_ATTACH is not set
886CONFIG_MEDIA_TUNER=y 930CONFIG_MEDIA_TUNER=y
887# CONFIG_MEDIA_TUNER_CUSTOMISE is not set 931# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
@@ -901,6 +945,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
901# CONFIG_VIDEO_ADV_DEBUG is not set 945# CONFIG_VIDEO_ADV_DEBUG is not set
902# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set 946# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
903CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 947CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
948CONFIG_VIDEO_IR_I2C=y
904# CONFIG_VIDEO_VIVI is not set 949# CONFIG_VIDEO_VIVI is not set
905# CONFIG_VIDEO_SAA5246A is not set 950# CONFIG_VIDEO_SAA5246A is not set
906# CONFIG_VIDEO_SAA5249 is not set 951# CONFIG_VIDEO_SAA5249 is not set
@@ -908,10 +953,13 @@ CONFIG_SOC_CAMERA=y
908# CONFIG_SOC_CAMERA_MT9M001 is not set 953# CONFIG_SOC_CAMERA_MT9M001 is not set
909# CONFIG_SOC_CAMERA_MT9M111 is not set 954# CONFIG_SOC_CAMERA_MT9M111 is not set
910# CONFIG_SOC_CAMERA_MT9T031 is not set 955# CONFIG_SOC_CAMERA_MT9T031 is not set
956# CONFIG_SOC_CAMERA_MT9T112 is not set
911# CONFIG_SOC_CAMERA_MT9V022 is not set 957# CONFIG_SOC_CAMERA_MT9V022 is not set
958# CONFIG_SOC_CAMERA_RJ54N1 is not set
912# CONFIG_SOC_CAMERA_TW9910 is not set 959# CONFIG_SOC_CAMERA_TW9910 is not set
913CONFIG_SOC_CAMERA_PLATFORM=y 960CONFIG_SOC_CAMERA_PLATFORM=y
914CONFIG_SOC_CAMERA_OV772X=y 961CONFIG_SOC_CAMERA_OV772X=y
962# CONFIG_SOC_CAMERA_OV9640 is not set
915CONFIG_VIDEO_SH_MOBILE_CEU=y 963CONFIG_VIDEO_SH_MOBILE_CEU=y
916# CONFIG_RADIO_ADAPTERS is not set 964# CONFIG_RADIO_ADAPTERS is not set
917# CONFIG_DAB is not set 965# CONFIG_DAB is not set
@@ -996,6 +1044,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
996# CONFIG_MMC_AT91 is not set 1044# CONFIG_MMC_AT91 is not set
997# CONFIG_MMC_ATMELMCI is not set 1045# CONFIG_MMC_ATMELMCI is not set
998CONFIG_MMC_SPI=y 1046CONFIG_MMC_SPI=y
1047# CONFIG_MMC_TMIO is not set
999# CONFIG_MEMSTICK is not set 1048# CONFIG_MEMSTICK is not set
1000# CONFIG_NEW_LEDS is not set 1049# CONFIG_NEW_LEDS is not set
1001# CONFIG_ACCESSIBILITY is not set 1050# CONFIG_ACCESSIBILITY is not set
@@ -1027,6 +1076,7 @@ CONFIG_RTC_INTF_DEV=y
1027CONFIG_RTC_DRV_PCF8563=y 1076CONFIG_RTC_DRV_PCF8563=y
1028# CONFIG_RTC_DRV_PCF8583 is not set 1077# CONFIG_RTC_DRV_PCF8583 is not set
1029# CONFIG_RTC_DRV_M41T80 is not set 1078# CONFIG_RTC_DRV_M41T80 is not set
1079# CONFIG_RTC_DRV_BQ32K is not set
1030# CONFIG_RTC_DRV_S35390A is not set 1080# CONFIG_RTC_DRV_S35390A is not set
1031# CONFIG_RTC_DRV_FM3130 is not set 1081# CONFIG_RTC_DRV_FM3130 is not set
1032# CONFIG_RTC_DRV_RX8581 is not set 1082# CONFIG_RTC_DRV_RX8581 is not set
@@ -1055,7 +1105,9 @@ CONFIG_RTC_DRV_PCF8563=y
1055# CONFIG_RTC_DRV_M48T86 is not set 1105# CONFIG_RTC_DRV_M48T86 is not set
1056# CONFIG_RTC_DRV_M48T35 is not set 1106# CONFIG_RTC_DRV_M48T35 is not set
1057# CONFIG_RTC_DRV_M48T59 is not set 1107# CONFIG_RTC_DRV_M48T59 is not set
1108# CONFIG_RTC_DRV_MSM6242 is not set
1058# CONFIG_RTC_DRV_BQ4802 is not set 1109# CONFIG_RTC_DRV_BQ4802 is not set
1110# CONFIG_RTC_DRV_RP5C01 is not set
1059# CONFIG_RTC_DRV_V3020 is not set 1111# CONFIG_RTC_DRV_V3020 is not set
1060 1112
1061# 1113#
@@ -1248,7 +1300,7 @@ CONFIG_FRAME_WARN=1024
1248# CONFIG_DEBUG_FS is not set 1300# CONFIG_DEBUG_FS is not set
1249# CONFIG_HEADERS_CHECK is not set 1301# CONFIG_HEADERS_CHECK is not set
1250# CONFIG_DEBUG_KERNEL is not set 1302# CONFIG_DEBUG_KERNEL is not set
1251# CONFIG_DEBUG_BUGVERBOSE is not set 1303CONFIG_DEBUG_BUGVERBOSE=y
1252# CONFIG_DEBUG_MEMORY_INIT is not set 1304# CONFIG_DEBUG_MEMORY_INIT is not set
1253# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1305# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1254# CONFIG_LATENCYTOP is not set 1306# CONFIG_LATENCYTOP is not set
@@ -1265,7 +1317,6 @@ CONFIG_TRACING_SUPPORT=y
1265# CONFIG_SAMPLES is not set 1317# CONFIG_SAMPLES is not set
1266CONFIG_HAVE_ARCH_KGDB=y 1318CONFIG_HAVE_ARCH_KGDB=y
1267# CONFIG_SH_STANDARD_BIOS is not set 1319# CONFIG_SH_STANDARD_BIOS is not set
1268# CONFIG_EARLY_SCIF_CONSOLE is not set
1269# CONFIG_DWARF_UNWINDER is not set 1320# CONFIG_DWARF_UNWINDER is not set
1270 1321
1271# 1322#
@@ -1274,7 +1325,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1274# CONFIG_KEYS is not set 1325# CONFIG_KEYS is not set
1275# CONFIG_SECURITY is not set 1326# CONFIG_SECURITY is not set
1276# CONFIG_SECURITYFS is not set 1327# CONFIG_SECURITYFS is not set
1277# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1328# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1329# CONFIG_DEFAULT_SECURITY_SMACK is not set
1330# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1331CONFIG_DEFAULT_SECURITY_DAC=y
1332CONFIG_DEFAULT_SECURITY=""
1278CONFIG_CRYPTO=y 1333CONFIG_CRYPTO=y
1279 1334
1280# 1335#
diff --git a/arch/sh/configs/cayman_defconfig b/arch/sh/configs/cayman_defconfig
index 6b863cb1e248..92589a950d07 100644
--- a/arch/sh/configs/cayman_defconfig
+++ b/arch/sh/configs/cayman_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.30 3# Linux kernel version: 2.6.33-rc2
4# Thu Jun 18 12:21:54 2009 4# Mon Jan 4 11:14:50 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7# CONFIG_SUPERH32 is not set 7# CONFIG_SUPERH32 is not set
@@ -14,11 +14,13 @@ CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y 16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y
17# CONFIG_GENERIC_GPIO is not set 18# CONFIG_GENERIC_GPIO is not set
18CONFIG_GENERIC_TIME=y 19CONFIG_GENERIC_TIME=y
19CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
20# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
21# CONFIG_ARCH_HIBERNATION_POSSIBLE is not set 22# CONFIG_ARCH_HIBERNATION_POSSIBLE is not set
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
22CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
23CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -28,7 +30,10 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28# CONFIG_ARCH_HAS_ILOG2_U64 is not set 30# CONFIG_ARCH_HAS_ILOG2_U64 is not set
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
31CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
36CONFIG_CONSTRUCTORS=y
32 37
33# 38#
34# General setup 39# General setup
@@ -39,6 +44,12 @@ CONFIG_LOCK_KERNEL=y
39CONFIG_INIT_ENV_ARG_LIMIT=32 44CONFIG_INIT_ENV_ARG_LIMIT=32
40CONFIG_LOCALVERSION="" 45CONFIG_LOCALVERSION=""
41CONFIG_LOCALVERSION_AUTO=y 46CONFIG_LOCALVERSION_AUTO=y
47CONFIG_HAVE_KERNEL_GZIP=y
48CONFIG_HAVE_KERNEL_BZIP2=y
49CONFIG_HAVE_KERNEL_LZMA=y
50CONFIG_KERNEL_GZIP=y
51# CONFIG_KERNEL_BZIP2 is not set
52# CONFIG_KERNEL_LZMA is not set
42CONFIG_SWAP=y 53CONFIG_SWAP=y
43# CONFIG_SYSVIPC is not set 54# CONFIG_SYSVIPC is not set
44CONFIG_POSIX_MQUEUE=y 55CONFIG_POSIX_MQUEUE=y
@@ -50,11 +61,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
50# 61#
51# RCU Subsystem 62# RCU Subsystem
52# 63#
53CONFIG_CLASSIC_RCU=y 64CONFIG_TREE_RCU=y
54# CONFIG_TREE_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
55# CONFIG_PREEMPT_RCU is not set 66# CONFIG_TINY_RCU is not set
67# CONFIG_RCU_TRACE is not set
68CONFIG_RCU_FANOUT=32
69# CONFIG_RCU_FANOUT_EXACT is not set
56# CONFIG_TREE_RCU_TRACE is not set 70# CONFIG_TREE_RCU_TRACE is not set
57# CONFIG_PREEMPT_RCU_TRACE is not set
58# CONFIG_IKCONFIG is not set 71# CONFIG_IKCONFIG is not set
59CONFIG_LOG_BUF_SHIFT=14 72CONFIG_LOG_BUF_SHIFT=14
60# CONFIG_GROUP_SCHED is not set 73# CONFIG_GROUP_SCHED is not set
@@ -85,24 +98,32 @@ CONFIG_TIMERFD=y
85CONFIG_EVENTFD=y 98CONFIG_EVENTFD=y
86CONFIG_SHMEM=y 99CONFIG_SHMEM=y
87CONFIG_AIO=y 100CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y
102CONFIG_PERF_USE_VMALLOC=y
88 103
89# 104#
90# Performance Counters 105# Kernel Performance Events And Counters
91# 106#
107# CONFIG_PERF_EVENTS is not set
108# CONFIG_PERF_COUNTERS is not set
92CONFIG_VM_EVENT_COUNTERS=y 109CONFIG_VM_EVENT_COUNTERS=y
93CONFIG_PCI_QUIRKS=y 110CONFIG_PCI_QUIRKS=y
94# CONFIG_STRIP_ASM_SYMS is not set
95CONFIG_COMPAT_BRK=y 111CONFIG_COMPAT_BRK=y
96CONFIG_SLAB=y 112CONFIG_SLAB=y
97# CONFIG_SLUB is not set 113# CONFIG_SLUB is not set
98# CONFIG_SLOB is not set 114# CONFIG_SLOB is not set
99# CONFIG_PROFILING is not set 115# CONFIG_PROFILING is not set
100# CONFIG_MARKERS is not set
101CONFIG_HAVE_OPROFILE=y 116CONFIG_HAVE_OPROFILE=y
102CONFIG_HAVE_IOREMAP_PROT=y 117CONFIG_HAVE_IOREMAP_PROT=y
103CONFIG_HAVE_ARCH_TRACEHOOK=y 118CONFIG_HAVE_ARCH_TRACEHOOK=y
119CONFIG_HAVE_DMA_ATTRS=y
104CONFIG_HAVE_CLK=y 120CONFIG_HAVE_CLK=y
105CONFIG_HAVE_DMA_API_DEBUG=y 121CONFIG_HAVE_DMA_API_DEBUG=y
122
123#
124# GCOV-based kernel profiling
125#
126# CONFIG_GCOV_KERNEL is not set
106# CONFIG_SLOW_WORK is not set 127# CONFIG_SLOW_WORK is not set
107CONFIG_HAVE_GENERIC_DMA_COHERENT=y 128CONFIG_HAVE_GENERIC_DMA_COHERENT=y
108CONFIG_SLABINFO=y 129CONFIG_SLABINFO=y
@@ -115,7 +136,7 @@ CONFIG_MODULE_UNLOAD=y
115# CONFIG_MODVERSIONS is not set 136# CONFIG_MODVERSIONS is not set
116# CONFIG_MODULE_SRCVERSION_ALL is not set 137# CONFIG_MODULE_SRCVERSION_ALL is not set
117CONFIG_BLOCK=y 138CONFIG_BLOCK=y
118# CONFIG_LBD is not set 139CONFIG_LBDAF=y
119# CONFIG_BLK_DEV_BSG is not set 140# CONFIG_BLK_DEV_BSG is not set
120# CONFIG_BLK_DEV_INTEGRITY is not set 141# CONFIG_BLK_DEV_INTEGRITY is not set
121 142
@@ -123,14 +144,41 @@ CONFIG_BLOCK=y
123# IO Schedulers 144# IO Schedulers
124# 145#
125CONFIG_IOSCHED_NOOP=y 146CONFIG_IOSCHED_NOOP=y
126CONFIG_IOSCHED_AS=y
127CONFIG_IOSCHED_DEADLINE=y 147CONFIG_IOSCHED_DEADLINE=y
128CONFIG_IOSCHED_CFQ=y 148CONFIG_IOSCHED_CFQ=y
129# CONFIG_DEFAULT_AS is not set
130# CONFIG_DEFAULT_DEADLINE is not set 149# CONFIG_DEFAULT_DEADLINE is not set
131CONFIG_DEFAULT_CFQ=y 150CONFIG_DEFAULT_CFQ=y
132# CONFIG_DEFAULT_NOOP is not set 151# CONFIG_DEFAULT_NOOP is not set
133CONFIG_DEFAULT_IOSCHED="cfq" 152CONFIG_DEFAULT_IOSCHED="cfq"
153# CONFIG_INLINE_SPIN_TRYLOCK is not set
154# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
155# CONFIG_INLINE_SPIN_LOCK is not set
156# CONFIG_INLINE_SPIN_LOCK_BH is not set
157# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
158# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
159# CONFIG_INLINE_SPIN_UNLOCK is not set
160# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
161# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
162# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
163# CONFIG_INLINE_READ_TRYLOCK is not set
164# CONFIG_INLINE_READ_LOCK is not set
165# CONFIG_INLINE_READ_LOCK_BH is not set
166# CONFIG_INLINE_READ_LOCK_IRQ is not set
167# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
168# CONFIG_INLINE_READ_UNLOCK is not set
169# CONFIG_INLINE_READ_UNLOCK_BH is not set
170# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
171# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
172# CONFIG_INLINE_WRITE_TRYLOCK is not set
173# CONFIG_INLINE_WRITE_LOCK is not set
174# CONFIG_INLINE_WRITE_LOCK_BH is not set
175# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
176# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
177# CONFIG_INLINE_WRITE_UNLOCK is not set
178# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
179# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
180# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
181# CONFIG_MUTEX_SPIN_ON_OWNER is not set
134# CONFIG_FREEZER is not set 182# CONFIG_FREEZER is not set
135 183
136# 184#
@@ -178,8 +226,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
178# CONFIG_PHYS_ADDR_T_64BIT is not set 226# CONFIG_PHYS_ADDR_T_64BIT is not set
179CONFIG_ZONE_DMA_FLAG=0 227CONFIG_ZONE_DMA_FLAG=0
180CONFIG_NR_QUICK=2 228CONFIG_NR_QUICK=2
181CONFIG_HAVE_MLOCK=y 229# CONFIG_KSM is not set
182CONFIG_HAVE_MLOCKED_PAGE_BIT=y
183CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 230CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
184 231
185# 232#
@@ -255,13 +302,13 @@ CONFIG_PREEMPT=y
255CONFIG_ZERO_PAGE_OFFSET=0x00001000 302CONFIG_ZERO_PAGE_OFFSET=0x00001000
256CONFIG_BOOT_LINK_OFFSET=0x00400000 303CONFIG_BOOT_LINK_OFFSET=0x00400000
257CONFIG_ENTRY_OFFSET=0x00001000 304CONFIG_ENTRY_OFFSET=0x00001000
258# CONFIG_CMDLINE_BOOL is not set 305# CONFIG_CMDLINE_OVERWRITE is not set
306# CONFIG_CMDLINE_EXTEND is not set
259 307
260# 308#
261# Bus options 309# Bus options
262# 310#
263CONFIG_PCI=y 311CONFIG_PCI=y
264CONFIG_SH_PCIDMA_NONCOHERENT=y
265# CONFIG_PCIEPORTBUS is not set 312# CONFIG_PCIEPORTBUS is not set
266# CONFIG_ARCH_SUPPORTS_MSI is not set 313# CONFIG_ARCH_SUPPORTS_MSI is not set
267CONFIG_PCI_LEGACY=y 314CONFIG_PCI_LEGACY=y
@@ -330,6 +377,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
330# CONFIG_NETFILTER is not set 377# CONFIG_NETFILTER is not set
331# CONFIG_IP_DCCP is not set 378# CONFIG_IP_DCCP is not set
332# CONFIG_IP_SCTP is not set 379# CONFIG_IP_SCTP is not set
380# CONFIG_RDS is not set
333# CONFIG_TIPC is not set 381# CONFIG_TIPC is not set
334# CONFIG_ATM is not set 382# CONFIG_ATM is not set
335# CONFIG_BRIDGE is not set 383# CONFIG_BRIDGE is not set
@@ -359,14 +407,11 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
359# CONFIG_AF_RXRPC is not set 407# CONFIG_AF_RXRPC is not set
360CONFIG_WIRELESS=y 408CONFIG_WIRELESS=y
361# CONFIG_CFG80211 is not set 409# CONFIG_CFG80211 is not set
362# CONFIG_WIRELESS_OLD_REGULATORY is not set
363# CONFIG_WIRELESS_EXT is not set
364# CONFIG_LIB80211 is not set 410# CONFIG_LIB80211 is not set
365 411
366# 412#
367# CFG80211 needs to be enabled for MAC80211 413# CFG80211 needs to be enabled for MAC80211
368# 414#
369CONFIG_MAC80211_DEFAULT_PS_VALUE=0
370# CONFIG_WIMAX is not set 415# CONFIG_WIMAX is not set
371# CONFIG_RFKILL is not set 416# CONFIG_RFKILL is not set
372# CONFIG_NET_9P is not set 417# CONFIG_NET_9P is not set
@@ -379,6 +424,7 @@ CONFIG_MAC80211_DEFAULT_PS_VALUE=0
379# Generic Driver Options 424# Generic Driver Options
380# 425#
381CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 426CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
427# CONFIG_DEVTMPFS is not set
382CONFIG_STANDALONE=y 428CONFIG_STANDALONE=y
383CONFIG_PREVENT_FIRMWARE_BUILD=y 429CONFIG_PREVENT_FIRMWARE_BUILD=y
384# CONFIG_FW_LOADER is not set 430# CONFIG_FW_LOADER is not set
@@ -395,6 +441,10 @@ CONFIG_BLK_DEV=y
395# CONFIG_BLK_DEV_COW_COMMON is not set 441# CONFIG_BLK_DEV_COW_COMMON is not set
396CONFIG_BLK_DEV_LOOP=y 442CONFIG_BLK_DEV_LOOP=y
397# CONFIG_BLK_DEV_CRYPTOLOOP is not set 443# CONFIG_BLK_DEV_CRYPTOLOOP is not set
444
445#
446# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
447#
398# CONFIG_BLK_DEV_NBD is not set 448# CONFIG_BLK_DEV_NBD is not set
399# CONFIG_BLK_DEV_SX8 is not set 449# CONFIG_BLK_DEV_SX8 is not set
400CONFIG_BLK_DEV_RAM=y 450CONFIG_BLK_DEV_RAM=y
@@ -405,6 +455,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
405# CONFIG_ATA_OVER_ETH is not set 455# CONFIG_ATA_OVER_ETH is not set
406# CONFIG_BLK_DEV_HD is not set 456# CONFIG_BLK_DEV_HD is not set
407CONFIG_MISC_DEVICES=y 457CONFIG_MISC_DEVICES=y
458# CONFIG_AD525X_DPOT is not set
408# CONFIG_PHANTOM is not set 459# CONFIG_PHANTOM is not set
409# CONFIG_SGI_IOC4 is not set 460# CONFIG_SGI_IOC4 is not set
410# CONFIG_TIFM_CORE is not set 461# CONFIG_TIFM_CORE is not set
@@ -412,6 +463,7 @@ CONFIG_MISC_DEVICES=y
412# CONFIG_ENCLOSURE_SERVICES is not set 463# CONFIG_ENCLOSURE_SERVICES is not set
413# CONFIG_HP_ILO is not set 464# CONFIG_HP_ILO is not set
414# CONFIG_ISL29003 is not set 465# CONFIG_ISL29003 is not set
466# CONFIG_DS1682 is not set
415# CONFIG_C2PORT is not set 467# CONFIG_C2PORT is not set
416 468
417# 469#
@@ -462,8 +514,11 @@ CONFIG_SCSI_LOWLEVEL=y
462# CONFIG_ISCSI_TCP is not set 514# CONFIG_ISCSI_TCP is not set
463# CONFIG_SCSI_CXGB3_ISCSI is not set 515# CONFIG_SCSI_CXGB3_ISCSI is not set
464# CONFIG_SCSI_BNX2_ISCSI is not set 516# CONFIG_SCSI_BNX2_ISCSI is not set
517# CONFIG_BE2ISCSI is not set
465# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 518# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
519# CONFIG_SCSI_HPSA is not set
466# CONFIG_SCSI_3W_9XXX is not set 520# CONFIG_SCSI_3W_9XXX is not set
521# CONFIG_SCSI_3W_SAS is not set
467# CONFIG_SCSI_ACARD is not set 522# CONFIG_SCSI_ACARD is not set
468# CONFIG_SCSI_AACRAID is not set 523# CONFIG_SCSI_AACRAID is not set
469# CONFIG_SCSI_AIC7XXX is not set 524# CONFIG_SCSI_AIC7XXX is not set
@@ -495,7 +550,10 @@ CONFIG_SCSI_LOWLEVEL=y
495# CONFIG_SCSI_DC390T is not set 550# CONFIG_SCSI_DC390T is not set
496# CONFIG_SCSI_NSP32 is not set 551# CONFIG_SCSI_NSP32 is not set
497# CONFIG_SCSI_DEBUG is not set 552# CONFIG_SCSI_DEBUG is not set
553# CONFIG_SCSI_PMCRAID is not set
554# CONFIG_SCSI_PM8001 is not set
498# CONFIG_SCSI_SRP is not set 555# CONFIG_SCSI_SRP is not set
556# CONFIG_SCSI_BFA_FC is not set
499# CONFIG_SCSI_DH is not set 557# CONFIG_SCSI_DH is not set
500# CONFIG_SCSI_OSD_INITIATOR is not set 558# CONFIG_SCSI_OSD_INITIATOR is not set
501# CONFIG_ATA is not set 559# CONFIG_ATA is not set
@@ -507,7 +565,11 @@ CONFIG_SCSI_LOWLEVEL=y
507# 565#
508 566
509# 567#
510# Enable only one of the two stacks, unless you know what you are doing 568# You can enable one or both FireWire driver stacks.
569#
570
571#
572# See the help texts for more information.
511# 573#
512# CONFIG_FIREWIRE is not set 574# CONFIG_FIREWIRE is not set
513# CONFIG_IEEE1394 is not set 575# CONFIG_IEEE1394 is not set
@@ -546,6 +608,7 @@ CONFIG_NET_ETHERNET=y
546# CONFIG_NET_PCI is not set 608# CONFIG_NET_PCI is not set
547# CONFIG_B44 is not set 609# CONFIG_B44 is not set
548# CONFIG_KS8842 is not set 610# CONFIG_KS8842 is not set
611# CONFIG_KS8851_MLL is not set
549# CONFIG_ATL2 is not set 612# CONFIG_ATL2 is not set
550CONFIG_NETDEV_1000=y 613CONFIG_NETDEV_1000=y
551# CONFIG_ACENIC is not set 614# CONFIG_ACENIC is not set
@@ -565,6 +628,7 @@ CONFIG_NETDEV_1000=y
565# CONFIG_VIA_VELOCITY is not set 628# CONFIG_VIA_VELOCITY is not set
566# CONFIG_TIGON3 is not set 629# CONFIG_TIGON3 is not set
567# CONFIG_BNX2 is not set 630# CONFIG_BNX2 is not set
631# CONFIG_CNIC is not set
568# CONFIG_QLA3XXX is not set 632# CONFIG_QLA3XXX is not set
569# CONFIG_ATL1 is not set 633# CONFIG_ATL1 is not set
570# CONFIG_ATL1E is not set 634# CONFIG_ATL1E is not set
@@ -590,12 +654,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
590# CONFIG_SFC is not set 654# CONFIG_SFC is not set
591# CONFIG_BE2NET is not set 655# CONFIG_BE2NET is not set
592# CONFIG_TR is not set 656# CONFIG_TR is not set
593 657CONFIG_WLAN=y
594# 658# CONFIG_ATMEL is not set
595# Wireless LAN 659# CONFIG_PRISM54 is not set
596# 660# CONFIG_HOSTAP is not set
597# CONFIG_WLAN_PRE80211 is not set
598# CONFIG_WLAN_80211 is not set
599 661
600# 662#
601# Enable WiMAX (Networking options) to see the WiMAX drivers 663# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -609,6 +671,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
609# CONFIG_NETCONSOLE is not set 671# CONFIG_NETCONSOLE is not set
610# CONFIG_NETPOLL is not set 672# CONFIG_NETPOLL is not set
611# CONFIG_NET_POLL_CONTROLLER is not set 673# CONFIG_NET_POLL_CONTROLLER is not set
674# CONFIG_VMXNET3 is not set
612# CONFIG_ISDN is not set 675# CONFIG_ISDN is not set
613# CONFIG_PHONE is not set 676# CONFIG_PHONE is not set
614 677
@@ -618,6 +681,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
618CONFIG_INPUT=y 681CONFIG_INPUT=y
619# CONFIG_INPUT_FF_MEMLESS is not set 682# CONFIG_INPUT_FF_MEMLESS is not set
620# CONFIG_INPUT_POLLDEV is not set 683# CONFIG_INPUT_POLLDEV is not set
684# CONFIG_INPUT_SPARSEKMAP is not set
621 685
622# 686#
623# Userland interfaces 687# Userland interfaces
@@ -682,6 +746,7 @@ CONFIG_HW_RANDOM=y
682CONFIG_DEVPORT=y 746CONFIG_DEVPORT=y
683CONFIG_I2C=m 747CONFIG_I2C=m
684CONFIG_I2C_BOARDINFO=y 748CONFIG_I2C_BOARDINFO=y
749CONFIG_I2C_COMPAT=y
685# CONFIG_I2C_CHARDEV is not set 750# CONFIG_I2C_CHARDEV is not set
686CONFIG_I2C_HELPER_AUTO=y 751CONFIG_I2C_HELPER_AUTO=y
687 752
@@ -710,6 +775,7 @@ CONFIG_I2C_HELPER_AUTO=y
710# 775#
711# I2C system bus drivers (mostly embedded / system-on-chip) 776# I2C system bus drivers (mostly embedded / system-on-chip)
712# 777#
778# CONFIG_I2C_DESIGNWARE is not set
713# CONFIG_I2C_OCORES is not set 779# CONFIG_I2C_OCORES is not set
714# CONFIG_I2C_SH_MOBILE is not set 780# CONFIG_I2C_SH_MOBILE is not set
715# CONFIG_I2C_SIMTEC is not set 781# CONFIG_I2C_SIMTEC is not set
@@ -721,11 +787,6 @@ CONFIG_I2C_HELPER_AUTO=y
721# CONFIG_I2C_TAOS_EVM is not set 787# CONFIG_I2C_TAOS_EVM is not set
722 788
723# 789#
724# Graphics adapter I2C/DDC channel drivers
725#
726# CONFIG_I2C_VOODOO3 is not set
727
728#
729# Other I2C/SMBus bus drivers 790# Other I2C/SMBus bus drivers
730# 791#
731# CONFIG_I2C_PCA_PLATFORM is not set 792# CONFIG_I2C_PCA_PLATFORM is not set
@@ -734,20 +795,26 @@ CONFIG_I2C_HELPER_AUTO=y
734# 795#
735# Miscellaneous I2C Chip support 796# Miscellaneous I2C Chip support
736# 797#
737# CONFIG_DS1682 is not set
738# CONFIG_SENSORS_PCF8574 is not set
739# CONFIG_PCF8575 is not set
740# CONFIG_SENSORS_PCA9539 is not set
741# CONFIG_SENSORS_TSL2550 is not set 798# CONFIG_SENSORS_TSL2550 is not set
742# CONFIG_I2C_DEBUG_CORE is not set 799# CONFIG_I2C_DEBUG_CORE is not set
743# CONFIG_I2C_DEBUG_ALGO is not set 800# CONFIG_I2C_DEBUG_ALGO is not set
744# CONFIG_I2C_DEBUG_BUS is not set 801# CONFIG_I2C_DEBUG_BUS is not set
745# CONFIG_I2C_DEBUG_CHIP is not set 802# CONFIG_I2C_DEBUG_CHIP is not set
746# CONFIG_SPI is not set 803# CONFIG_SPI is not set
804
805#
806# PPS support
807#
808# CONFIG_PPS is not set
747# CONFIG_W1 is not set 809# CONFIG_W1 is not set
748# CONFIG_POWER_SUPPLY is not set 810# CONFIG_POWER_SUPPLY is not set
749CONFIG_HWMON=y 811CONFIG_HWMON=y
750# CONFIG_HWMON_VID is not set 812# CONFIG_HWMON_VID is not set
813# CONFIG_HWMON_DEBUG_CHIP is not set
814
815#
816# Native drivers
817#
751# CONFIG_SENSORS_AD7414 is not set 818# CONFIG_SENSORS_AD7414 is not set
752# CONFIG_SENSORS_AD7418 is not set 819# CONFIG_SENSORS_AD7418 is not set
753# CONFIG_SENSORS_ADM1021 is not set 820# CONFIG_SENSORS_ADM1021 is not set
@@ -771,6 +838,7 @@ CONFIG_HWMON=y
771# CONFIG_SENSORS_GL520SM is not set 838# CONFIG_SENSORS_GL520SM is not set
772# CONFIG_SENSORS_IT87 is not set 839# CONFIG_SENSORS_IT87 is not set
773# CONFIG_SENSORS_LM63 is not set 840# CONFIG_SENSORS_LM63 is not set
841# CONFIG_SENSORS_LM73 is not set
774# CONFIG_SENSORS_LM75 is not set 842# CONFIG_SENSORS_LM75 is not set
775# CONFIG_SENSORS_LM77 is not set 843# CONFIG_SENSORS_LM77 is not set
776# CONFIG_SENSORS_LM78 is not set 844# CONFIG_SENSORS_LM78 is not set
@@ -797,6 +865,7 @@ CONFIG_HWMON=y
797# CONFIG_SENSORS_ADS7828 is not set 865# CONFIG_SENSORS_ADS7828 is not set
798# CONFIG_SENSORS_THMC50 is not set 866# CONFIG_SENSORS_THMC50 is not set
799# CONFIG_SENSORS_TMP401 is not set 867# CONFIG_SENSORS_TMP401 is not set
868# CONFIG_SENSORS_TMP421 is not set
800# CONFIG_SENSORS_VIA686A is not set 869# CONFIG_SENSORS_VIA686A is not set
801# CONFIG_SENSORS_VT1211 is not set 870# CONFIG_SENSORS_VT1211 is not set
802# CONFIG_SENSORS_VT8231 is not set 871# CONFIG_SENSORS_VT8231 is not set
@@ -808,9 +877,8 @@ CONFIG_HWMON=y
808# CONFIG_SENSORS_W83L786NG is not set 877# CONFIG_SENSORS_W83L786NG is not set
809# CONFIG_SENSORS_W83627HF is not set 878# CONFIG_SENSORS_W83627HF is not set
810# CONFIG_SENSORS_W83627EHF is not set 879# CONFIG_SENSORS_W83627EHF is not set
811# CONFIG_HWMON_DEBUG_CHIP is not set 880# CONFIG_SENSORS_LIS3_I2C is not set
812# CONFIG_THERMAL is not set 881# CONFIG_THERMAL is not set
813# CONFIG_THERMAL_HWMON is not set
814CONFIG_WATCHDOG=y 882CONFIG_WATCHDOG=y
815# CONFIG_WATCHDOG_NOWAYOUT is not set 883# CONFIG_WATCHDOG_NOWAYOUT is not set
816 884
@@ -837,17 +905,20 @@ CONFIG_SSB_POSSIBLE=y
837# 905#
838# CONFIG_MFD_CORE is not set 906# CONFIG_MFD_CORE is not set
839# CONFIG_MFD_SM501 is not set 907# CONFIG_MFD_SM501 is not set
908# CONFIG_MFD_SH_MOBILE_SDHI is not set
840# CONFIG_HTC_PASIC3 is not set 909# CONFIG_HTC_PASIC3 is not set
841# CONFIG_MFD_TMIO is not set 910# CONFIG_MFD_TMIO is not set
842# CONFIG_MFD_WM8400 is not set 911# CONFIG_MFD_WM8400 is not set
843# CONFIG_MFD_WM8350_I2C is not set 912# CONFIG_MFD_WM8350_I2C is not set
844# CONFIG_MFD_PCF50633 is not set 913# CONFIG_MFD_PCF50633 is not set
914# CONFIG_AB3100_CORE is not set
845# CONFIG_REGULATOR is not set 915# CONFIG_REGULATOR is not set
846# CONFIG_MEDIA_SUPPORT is not set 916# CONFIG_MEDIA_SUPPORT is not set
847 917
848# 918#
849# Graphics support 919# Graphics support
850# 920#
921CONFIG_VGA_ARB=y
851# CONFIG_DRM is not set 922# CONFIG_DRM is not set
852# CONFIG_VGASTATE is not set 923# CONFIG_VGASTATE is not set
853CONFIG_VIDEO_OUTPUT_CONTROL=y 924CONFIG_VIDEO_OUTPUT_CONTROL=y
@@ -939,7 +1010,6 @@ CONFIG_LOGO_SUPERH_CLUT224=y
939# CONFIG_SOUND is not set 1010# CONFIG_SOUND is not set
940CONFIG_HID_SUPPORT=y 1011CONFIG_HID_SUPPORT=y
941CONFIG_HID=y 1012CONFIG_HID=y
942# CONFIG_HID_DEBUG is not set
943# CONFIG_HIDRAW is not set 1013# CONFIG_HIDRAW is not set
944# CONFIG_HID_PID is not set 1014# CONFIG_HID_PID is not set
945 1015
@@ -1002,8 +1072,10 @@ CONFIG_FS_MBCACHE=y
1002# CONFIG_JFS_FS is not set 1072# CONFIG_JFS_FS is not set
1003# CONFIG_FS_POSIX_ACL is not set 1073# CONFIG_FS_POSIX_ACL is not set
1004# CONFIG_XFS_FS is not set 1074# CONFIG_XFS_FS is not set
1075# CONFIG_GFS2_FS is not set
1005# CONFIG_OCFS2_FS is not set 1076# CONFIG_OCFS2_FS is not set
1006# CONFIG_BTRFS_FS is not set 1077# CONFIG_BTRFS_FS is not set
1078# CONFIG_NILFS2_FS is not set
1007CONFIG_FILE_LOCKING=y 1079CONFIG_FILE_LOCKING=y
1008CONFIG_FSNOTIFY=y 1080CONFIG_FSNOTIFY=y
1009CONFIG_DNOTIFY=y 1081CONFIG_DNOTIFY=y
@@ -1067,7 +1139,6 @@ CONFIG_ROMFS_BACKED_BY_BLOCK=y
1067CONFIG_ROMFS_ON_BLOCK=y 1139CONFIG_ROMFS_ON_BLOCK=y
1068# CONFIG_SYSV_FS is not set 1140# CONFIG_SYSV_FS is not set
1069# CONFIG_UFS_FS is not set 1141# CONFIG_UFS_FS is not set
1070# CONFIG_NILFS2_FS is not set
1071CONFIG_NETWORK_FILESYSTEMS=y 1142CONFIG_NETWORK_FILESYSTEMS=y
1072CONFIG_NFS_FS=y 1143CONFIG_NFS_FS=y
1073CONFIG_NFS_V3=y 1144CONFIG_NFS_V3=y
@@ -1120,6 +1191,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1120CONFIG_ENABLE_MUST_CHECK=y 1191CONFIG_ENABLE_MUST_CHECK=y
1121CONFIG_FRAME_WARN=1024 1192CONFIG_FRAME_WARN=1024
1122CONFIG_MAGIC_SYSRQ=y 1193CONFIG_MAGIC_SYSRQ=y
1194# CONFIG_STRIP_ASM_SYMS is not set
1123# CONFIG_UNUSED_SYMBOLS is not set 1195# CONFIG_UNUSED_SYMBOLS is not set
1124CONFIG_DEBUG_FS=y 1196CONFIG_DEBUG_FS=y
1125# CONFIG_HEADERS_CHECK is not set 1197# CONFIG_HEADERS_CHECK is not set
@@ -1155,21 +1227,25 @@ CONFIG_DEBUG_BUGVERBOSE=y
1155# CONFIG_DEBUG_LIST is not set 1227# CONFIG_DEBUG_LIST is not set
1156# CONFIG_DEBUG_SG is not set 1228# CONFIG_DEBUG_SG is not set
1157# CONFIG_DEBUG_NOTIFIERS is not set 1229# CONFIG_DEBUG_NOTIFIERS is not set
1230# CONFIG_DEBUG_CREDENTIALS is not set
1158CONFIG_FRAME_POINTER=y 1231CONFIG_FRAME_POINTER=y
1159# CONFIG_RCU_TORTURE_TEST is not set 1232# CONFIG_RCU_TORTURE_TEST is not set
1160# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1233# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1161# CONFIG_BACKTRACE_SELF_TEST is not set 1234# CONFIG_BACKTRACE_SELF_TEST is not set
1162# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1235# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1236# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1163# CONFIG_FAULT_INJECTION is not set 1237# CONFIG_FAULT_INJECTION is not set
1164# CONFIG_LATENCYTOP is not set 1238# CONFIG_LATENCYTOP is not set
1165# CONFIG_SYSCTL_SYSCALL_CHECK is not set 1239# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1166# CONFIG_PAGE_POISONING is not set 1240# CONFIG_PAGE_POISONING is not set
1241CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
1167CONFIG_TRACING_SUPPORT=y 1242CONFIG_TRACING_SUPPORT=y
1168CONFIG_FTRACE=y 1243CONFIG_FTRACE=y
1169# CONFIG_IRQSOFF_TRACER is not set 1244# CONFIG_IRQSOFF_TRACER is not set
1170# CONFIG_PREEMPT_TRACER is not set 1245# CONFIG_PREEMPT_TRACER is not set
1171# CONFIG_SCHED_TRACER is not set 1246# CONFIG_SCHED_TRACER is not set
1172# CONFIG_ENABLE_DEFAULT_TRACERS is not set 1247# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1248# CONFIG_FTRACE_SYSCALLS is not set
1173# CONFIG_BOOT_TRACER is not set 1249# CONFIG_BOOT_TRACER is not set
1174CONFIG_BRANCH_PROFILE_NONE=y 1250CONFIG_BRANCH_PROFILE_NONE=y
1175# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set 1251# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
@@ -1180,11 +1256,9 @@ CONFIG_BRANCH_PROFILE_NONE=y
1180# CONFIG_DYNAMIC_DEBUG is not set 1256# CONFIG_DYNAMIC_DEBUG is not set
1181# CONFIG_DMA_API_DEBUG is not set 1257# CONFIG_DMA_API_DEBUG is not set
1182# CONFIG_SAMPLES is not set 1258# CONFIG_SAMPLES is not set
1183# CONFIG_KMEMCHECK is not set
1184# CONFIG_EARLY_SCIF_CONSOLE is not set
1185# CONFIG_DEBUG_BOOTMEM is not set
1186# CONFIG_DEBUG_STACK_USAGE is not set 1259# CONFIG_DEBUG_STACK_USAGE is not set
1187# CONFIG_4KSTACKS is not set 1260# CONFIG_4KSTACKS is not set
1261# CONFIG_DWARF_UNWINDER is not set
1188# CONFIG_SH_NO_BSS_INIT is not set 1262# CONFIG_SH_NO_BSS_INIT is not set
1189CONFIG_SH64_SR_WATCH=y 1263CONFIG_SH64_SR_WATCH=y
1190 1264
@@ -1194,13 +1268,16 @@ CONFIG_SH64_SR_WATCH=y
1194# CONFIG_KEYS is not set 1268# CONFIG_KEYS is not set
1195# CONFIG_SECURITY is not set 1269# CONFIG_SECURITY is not set
1196# CONFIG_SECURITYFS is not set 1270# CONFIG_SECURITYFS is not set
1197# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1271# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1272# CONFIG_DEFAULT_SECURITY_SMACK is not set
1273# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1274CONFIG_DEFAULT_SECURITY_DAC=y
1275CONFIG_DEFAULT_SECURITY=""
1198CONFIG_CRYPTO=y 1276CONFIG_CRYPTO=y
1199 1277
1200# 1278#
1201# Crypto core or helper 1279# Crypto core or helper
1202# 1280#
1203# CONFIG_CRYPTO_FIPS is not set
1204# CONFIG_CRYPTO_MANAGER is not set 1281# CONFIG_CRYPTO_MANAGER is not set
1205# CONFIG_CRYPTO_MANAGER2 is not set 1282# CONFIG_CRYPTO_MANAGER2 is not set
1206# CONFIG_CRYPTO_GF128MUL is not set 1283# CONFIG_CRYPTO_GF128MUL is not set
@@ -1232,11 +1309,13 @@ CONFIG_CRYPTO=y
1232# 1309#
1233# CONFIG_CRYPTO_HMAC is not set 1310# CONFIG_CRYPTO_HMAC is not set
1234# CONFIG_CRYPTO_XCBC is not set 1311# CONFIG_CRYPTO_XCBC is not set
1312# CONFIG_CRYPTO_VMAC is not set
1235 1313
1236# 1314#
1237# Digest 1315# Digest
1238# 1316#
1239# CONFIG_CRYPTO_CRC32C is not set 1317# CONFIG_CRYPTO_CRC32C is not set
1318# CONFIG_CRYPTO_GHASH is not set
1240# CONFIG_CRYPTO_MD4 is not set 1319# CONFIG_CRYPTO_MD4 is not set
1241# CONFIG_CRYPTO_MD5 is not set 1320# CONFIG_CRYPTO_MD5 is not set
1242# CONFIG_CRYPTO_MICHAEL_MIC is not set 1321# CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -1299,5 +1378,6 @@ CONFIG_CRC32=y
1299CONFIG_HAS_IOMEM=y 1378CONFIG_HAS_IOMEM=y
1300CONFIG_HAS_IOPORT=y 1379CONFIG_HAS_IOPORT=y
1301CONFIG_HAS_DMA=y 1380CONFIG_HAS_DMA=y
1381CONFIG_HAVE_LMB=y
1302CONFIG_NLATTR=y 1382CONFIG_NLATTR=y
1303CONFIG_GENERIC_ATOMIC64=y 1383CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
index aedbd4f13046..55f652be954b 100644
--- a/arch/sh/configs/dreamcast_defconfig
+++ b/arch/sh/configs/dreamcast_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:56:07 2009 4# Mon Jan 4 11:17:35 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -21,6 +21,7 @@ CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_GENERIC_CMOS_UPDATE=y 21CONFIG_GENERIC_CMOS_UPDATE=y
22# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 22# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
23CONFIG_ARCH_HIBERNATION_POSSIBLE=y 23CONFIG_ARCH_HIBERNATION_POSSIBLE=y
24CONFIG_SYS_SUPPORTS_HUGETLBFS=y
24CONFIG_SYS_SUPPORTS_PCI=y 25CONFIG_SYS_SUPPORTS_PCI=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
26CONFIG_STACKTRACE_SUPPORT=y 27CONFIG_STACKTRACE_SUPPORT=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -63,6 +65,7 @@ CONFIG_BSD_PROCESS_ACCT=y
63# 65#
64CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 69# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -97,6 +100,7 @@ CONFIG_EVENTFD=y
97CONFIG_SHMEM=y 100CONFIG_SHMEM=y
98CONFIG_AIO=y 101CONFIG_AIO=y
99CONFIG_HAVE_PERF_EVENTS=y 102CONFIG_HAVE_PERF_EVENTS=y
103CONFIG_PERF_USE_VMALLOC=y
100 104
101# 105#
102# Kernel Performance Events And Counters 106# Kernel Performance Events And Counters
@@ -117,6 +121,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
117CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
120CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
121CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
122 127
@@ -143,14 +148,41 @@ CONFIG_LBDAF=y
143# IO Schedulers 148# IO Schedulers
144# 149#
145CONFIG_IOSCHED_NOOP=y 150CONFIG_IOSCHED_NOOP=y
146CONFIG_IOSCHED_AS=y
147CONFIG_IOSCHED_DEADLINE=y 151CONFIG_IOSCHED_DEADLINE=y
148CONFIG_IOSCHED_CFQ=y 152CONFIG_IOSCHED_CFQ=y
149CONFIG_DEFAULT_AS=y
150# CONFIG_DEFAULT_DEADLINE is not set 153# CONFIG_DEFAULT_DEADLINE is not set
151# CONFIG_DEFAULT_CFQ is not set 154CONFIG_DEFAULT_CFQ=y
152# CONFIG_DEFAULT_NOOP is not set 155# CONFIG_DEFAULT_NOOP is not set
153CONFIG_DEFAULT_IOSCHED="anticipatory" 156CONFIG_DEFAULT_IOSCHED="cfq"
157# CONFIG_INLINE_SPIN_TRYLOCK is not set
158# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK is not set
160# CONFIG_INLINE_SPIN_LOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
162# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
163# CONFIG_INLINE_SPIN_UNLOCK is not set
164# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
165# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
166# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
167# CONFIG_INLINE_READ_TRYLOCK is not set
168# CONFIG_INLINE_READ_LOCK is not set
169# CONFIG_INLINE_READ_LOCK_BH is not set
170# CONFIG_INLINE_READ_LOCK_IRQ is not set
171# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
172# CONFIG_INLINE_READ_UNLOCK is not set
173# CONFIG_INLINE_READ_UNLOCK_BH is not set
174# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
175# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
176# CONFIG_INLINE_WRITE_TRYLOCK is not set
177# CONFIG_INLINE_WRITE_LOCK is not set
178# CONFIG_INLINE_WRITE_LOCK_BH is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
180# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
181# CONFIG_INLINE_WRITE_UNLOCK is not set
182# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
183# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
184# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
185# CONFIG_MUTEX_SPIN_ON_OWNER is not set
154# CONFIG_FREEZER is not set 186# CONFIG_FREEZER is not set
155 187
156# 188#
@@ -232,8 +264,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
232# CONFIG_PHYS_ADDR_T_64BIT is not set 264# CONFIG_PHYS_ADDR_T_64BIT is not set
233CONFIG_ZONE_DMA_FLAG=0 265CONFIG_ZONE_DMA_FLAG=0
234CONFIG_NR_QUICK=2 266CONFIG_NR_QUICK=2
235CONFIG_HAVE_MLOCK=y
236CONFIG_HAVE_MLOCKED_PAGE_BIT=y
237# CONFIG_KSM is not set 267# CONFIG_KSM is not set
238CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 268CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
239 269
@@ -294,9 +324,9 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y
294# 324#
295# DMA support 325# DMA support
296# 326#
297CONFIG_SH_DMA_API=y
298CONFIG_SH_DMA=y 327CONFIG_SH_DMA=y
299CONFIG_SH_DMA_IRQ_MULTI=y 328CONFIG_SH_DMA_IRQ_MULTI=y
329CONFIG_SH_DMA_API=y
300CONFIG_NR_ONCHIP_DMA_CHANNELS=4 330CONFIG_NR_ONCHIP_DMA_CHANNELS=4
301CONFIG_NR_DMA_CHANNELS_BOOL=y 331CONFIG_NR_DMA_CHANNELS_BOOL=y
302CONFIG_NR_DMA_CHANNELS=9 332CONFIG_NR_DMA_CHANNELS=9
@@ -338,7 +368,6 @@ CONFIG_GUSA=y
338CONFIG_ZERO_PAGE_OFFSET=0x00001000 368CONFIG_ZERO_PAGE_OFFSET=0x00001000
339CONFIG_BOOT_LINK_OFFSET=0x00800000 369CONFIG_BOOT_LINK_OFFSET=0x00800000
340CONFIG_ENTRY_OFFSET=0x00001000 370CONFIG_ENTRY_OFFSET=0x00001000
341# CONFIG_UBC_WAKEUP is not set
342CONFIG_CMDLINE_OVERWRITE=y 371CONFIG_CMDLINE_OVERWRITE=y
343# CONFIG_CMDLINE_EXTEND is not set 372# CONFIG_CMDLINE_EXTEND is not set
344CONFIG_CMDLINE="console=ttySC1,115200 panic=3" 373CONFIG_CMDLINE="console=ttySC1,115200 panic=3"
@@ -348,7 +377,6 @@ CONFIG_CMDLINE="console=ttySC1,115200 panic=3"
348# 377#
349CONFIG_MAPLE=y 378CONFIG_MAPLE=y
350CONFIG_PCI=y 379CONFIG_PCI=y
351CONFIG_SH_PCIDMA_NONCOHERENT=y
352# CONFIG_PCIEPORTBUS is not set 380# CONFIG_PCIEPORTBUS is not set
353# CONFIG_ARCH_SUPPORTS_MSI is not set 381# CONFIG_ARCH_SUPPORTS_MSI is not set
354CONFIG_PCI_LEGACY=y 382CONFIG_PCI_LEGACY=y
@@ -443,9 +471,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
443# CONFIG_AF_RXRPC is not set 471# CONFIG_AF_RXRPC is not set
444CONFIG_WIRELESS=y 472CONFIG_WIRELESS=y
445# CONFIG_CFG80211 is not set 473# CONFIG_CFG80211 is not set
446CONFIG_CFG80211_DEFAULT_PS_VALUE=0
447# CONFIG_WIRELESS_OLD_REGULATORY is not set
448# CONFIG_WIRELESS_EXT is not set
449# CONFIG_LIB80211 is not set 474# CONFIG_LIB80211 is not set
450 475
451# 476#
@@ -478,6 +503,10 @@ CONFIG_GDROM=y
478# CONFIG_BLK_DEV_UMEM is not set 503# CONFIG_BLK_DEV_UMEM is not set
479# CONFIG_BLK_DEV_COW_COMMON is not set 504# CONFIG_BLK_DEV_COW_COMMON is not set
480# CONFIG_BLK_DEV_LOOP is not set 505# CONFIG_BLK_DEV_LOOP is not set
506
507#
508# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
509#
481# CONFIG_BLK_DEV_NBD is not set 510# CONFIG_BLK_DEV_NBD is not set
482# CONFIG_BLK_DEV_SX8 is not set 511# CONFIG_BLK_DEV_SX8 is not set
483# CONFIG_BLK_DEV_RAM is not set 512# CONFIG_BLK_DEV_RAM is not set
@@ -579,6 +608,7 @@ CONFIG_8139TOO=y
579# CONFIG_SUNDANCE is not set 608# CONFIG_SUNDANCE is not set
580# CONFIG_TLAN is not set 609# CONFIG_TLAN is not set
581# CONFIG_KS8842 is not set 610# CONFIG_KS8842 is not set
611# CONFIG_KS8851_MLL is not set
582# CONFIG_VIA_RHINE is not set 612# CONFIG_VIA_RHINE is not set
583# CONFIG_SC92031 is not set 613# CONFIG_SC92031 is not set
584# CONFIG_ATL2 is not set 614# CONFIG_ATL2 is not set
@@ -586,8 +616,9 @@ CONFIG_8139TOO=y
586# CONFIG_NETDEV_10000 is not set 616# CONFIG_NETDEV_10000 is not set
587# CONFIG_TR is not set 617# CONFIG_TR is not set
588CONFIG_WLAN=y 618CONFIG_WLAN=y
589# CONFIG_WLAN_PRE80211 is not set 619# CONFIG_ATMEL is not set
590# CONFIG_WLAN_80211 is not set 620# CONFIG_PRISM54 is not set
621# CONFIG_HOSTAP is not set
591 622
592# 623#
593# Enable WiMAX (Networking options) to see the WiMAX drivers 624# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -600,6 +631,7 @@ CONFIG_WLAN=y
600# CONFIG_NETCONSOLE is not set 631# CONFIG_NETCONSOLE is not set
601# CONFIG_NETPOLL is not set 632# CONFIG_NETPOLL is not set
602# CONFIG_NET_POLL_CONTROLLER is not set 633# CONFIG_NET_POLL_CONTROLLER is not set
634# CONFIG_VMXNET3 is not set
603# CONFIG_ISDN is not set 635# CONFIG_ISDN is not set
604# CONFIG_PHONE is not set 636# CONFIG_PHONE is not set
605 637
@@ -609,6 +641,7 @@ CONFIG_WLAN=y
609CONFIG_INPUT=y 641CONFIG_INPUT=y
610# CONFIG_INPUT_FF_MEMLESS is not set 642# CONFIG_INPUT_FF_MEMLESS is not set
611# CONFIG_INPUT_POLLDEV is not set 643# CONFIG_INPUT_POLLDEV is not set
644# CONFIG_INPUT_SPARSEKMAP is not set
612 645
613# 646#
614# Userland interfaces 647# Userland interfaces
@@ -655,6 +688,7 @@ CONFIG_SERIO=y
655# CONFIG_SERIO_PCIPS2 is not set 688# CONFIG_SERIO_PCIPS2 is not set
656CONFIG_SERIO_LIBPS2=y 689CONFIG_SERIO_LIBPS2=y
657# CONFIG_SERIO_RAW is not set 690# CONFIG_SERIO_RAW is not set
691# CONFIG_SERIO_ALTERA_PS2 is not set
658# CONFIG_GAMEPORT is not set 692# CONFIG_GAMEPORT is not set
659 693
660# 694#
@@ -734,6 +768,7 @@ CONFIG_SSB_POSSIBLE=y
734# 768#
735# CONFIG_MFD_CORE is not set 769# CONFIG_MFD_CORE is not set
736# CONFIG_MFD_SM501 is not set 770# CONFIG_MFD_SM501 is not set
771# CONFIG_MFD_SH_MOBILE_SDHI is not set
737# CONFIG_HTC_PASIC3 is not set 772# CONFIG_HTC_PASIC3 is not set
738# CONFIG_MFD_TMIO is not set 773# CONFIG_MFD_TMIO is not set
739# CONFIG_REGULATOR is not set 774# CONFIG_REGULATOR is not set
@@ -883,6 +918,7 @@ CONFIG_RTC_LIB=y
883# CONFIG_EXT2_FS is not set 918# CONFIG_EXT2_FS is not set
884# CONFIG_EXT3_FS is not set 919# CONFIG_EXT3_FS is not set
885# CONFIG_EXT4_FS is not set 920# CONFIG_EXT4_FS is not set
921CONFIG_EXT4_USE_FOR_EXT23=y
886# CONFIG_REISERFS_FS is not set 922# CONFIG_REISERFS_FS is not set
887# CONFIG_JFS_FS is not set 923# CONFIG_JFS_FS is not set
888# CONFIG_FS_POSIX_ACL is not set 924# CONFIG_FS_POSIX_ACL is not set
@@ -981,10 +1017,11 @@ CONFIG_FRAME_WARN=1024
981# CONFIG_DEBUG_FS is not set 1017# CONFIG_DEBUG_FS is not set
982# CONFIG_HEADERS_CHECK is not set 1018# CONFIG_HEADERS_CHECK is not set
983# CONFIG_DEBUG_KERNEL is not set 1019# CONFIG_DEBUG_KERNEL is not set
984# CONFIG_DEBUG_BUGVERBOSE is not set 1020CONFIG_DEBUG_BUGVERBOSE=y
985# CONFIG_DEBUG_MEMORY_INIT is not set 1021# CONFIG_DEBUG_MEMORY_INIT is not set
986# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1022# CONFIG_RCU_CPU_STALL_DETECTOR is not set
987# CONFIG_LATENCYTOP is not set 1023# CONFIG_LATENCYTOP is not set
1024# CONFIG_SYSCTL_SYSCALL_CHECK is not set
988CONFIG_HAVE_FUNCTION_TRACER=y 1025CONFIG_HAVE_FUNCTION_TRACER=y
989CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1026CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
990CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 1027CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -997,7 +1034,6 @@ CONFIG_TRACING_SUPPORT=y
997# CONFIG_SAMPLES is not set 1034# CONFIG_SAMPLES is not set
998CONFIG_HAVE_ARCH_KGDB=y 1035CONFIG_HAVE_ARCH_KGDB=y
999# CONFIG_SH_STANDARD_BIOS is not set 1036# CONFIG_SH_STANDARD_BIOS is not set
1000# CONFIG_EARLY_SCIF_CONSOLE is not set
1001# CONFIG_DWARF_UNWINDER is not set 1037# CONFIG_DWARF_UNWINDER is not set
1002 1038
1003# 1039#
@@ -1006,7 +1042,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1006# CONFIG_KEYS is not set 1042# CONFIG_KEYS is not set
1007# CONFIG_SECURITY is not set 1043# CONFIG_SECURITY is not set
1008# CONFIG_SECURITYFS is not set 1044# CONFIG_SECURITYFS is not set
1009# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1045# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1046# CONFIG_DEFAULT_SECURITY_SMACK is not set
1047# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1048CONFIG_DEFAULT_SECURITY_DAC=y
1049CONFIG_DEFAULT_SECURITY=""
1010CONFIG_CRYPTO=y 1050CONFIG_CRYPTO=y
1011 1051
1012# 1052#
diff --git a/arch/sh/configs/ecovec24-romimage_defconfig b/arch/sh/configs/ecovec24-romimage_defconfig
index 46874704e4e7..662c1ad20494 100644
--- a/arch/sh/configs/ecovec24-romimage_defconfig
+++ b/arch/sh/configs/ecovec24-romimage_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:56:41 2009 4# Mon Jan 4 11:18:17 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -61,6 +63,7 @@ CONFIG_BSD_PROCESS_ACCT=y
61# 63#
62CONFIG_TREE_RCU=y 64CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
66# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 67# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 68CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 69# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,6 +106,7 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -120,6 +124,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
120CONFIG_HAVE_KPROBES=y 124CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 125CONFIG_HAVE_KRETPROBES=y
122CONFIG_HAVE_ARCH_TRACEHOOK=y 126CONFIG_HAVE_ARCH_TRACEHOOK=y
127CONFIG_HAVE_DMA_ATTRS=y
123CONFIG_HAVE_CLK=y 128CONFIG_HAVE_CLK=y
124CONFIG_HAVE_DMA_API_DEBUG=y 129CONFIG_HAVE_DMA_API_DEBUG=y
125 130
@@ -142,14 +147,41 @@ CONFIG_BLOCK=y
142# IO Schedulers 147# IO Schedulers
143# 148#
144CONFIG_IOSCHED_NOOP=y 149CONFIG_IOSCHED_NOOP=y
145CONFIG_IOSCHED_AS=y
146CONFIG_IOSCHED_DEADLINE=y 150CONFIG_IOSCHED_DEADLINE=y
147CONFIG_IOSCHED_CFQ=y 151CONFIG_IOSCHED_CFQ=y
148# CONFIG_DEFAULT_AS is not set
149# CONFIG_DEFAULT_DEADLINE is not set 152# CONFIG_DEFAULT_DEADLINE is not set
150CONFIG_DEFAULT_CFQ=y 153CONFIG_DEFAULT_CFQ=y
151# CONFIG_DEFAULT_NOOP is not set 154# CONFIG_DEFAULT_NOOP is not set
152CONFIG_DEFAULT_IOSCHED="cfq" 155CONFIG_DEFAULT_IOSCHED="cfq"
156# CONFIG_INLINE_SPIN_TRYLOCK is not set
157# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
158# CONFIG_INLINE_SPIN_LOCK is not set
159# CONFIG_INLINE_SPIN_LOCK_BH is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
162CONFIG_INLINE_SPIN_UNLOCK=y
163# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
164CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
165# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
166# CONFIG_INLINE_READ_TRYLOCK is not set
167# CONFIG_INLINE_READ_LOCK is not set
168# CONFIG_INLINE_READ_LOCK_BH is not set
169# CONFIG_INLINE_READ_LOCK_IRQ is not set
170# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
171CONFIG_INLINE_READ_UNLOCK=y
172# CONFIG_INLINE_READ_UNLOCK_BH is not set
173CONFIG_INLINE_READ_UNLOCK_IRQ=y
174# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
175# CONFIG_INLINE_WRITE_TRYLOCK is not set
176# CONFIG_INLINE_WRITE_LOCK is not set
177# CONFIG_INLINE_WRITE_LOCK_BH is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
180CONFIG_INLINE_WRITE_UNLOCK=y
181# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
182CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
183# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
184# CONFIG_MUTEX_SPIN_ON_OWNER is not set
153# CONFIG_FREEZER is not set 185# CONFIG_FREEZER is not set
154 186
155# 187#
@@ -205,6 +237,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
205CONFIG_MEMORY_START=0x08000000 237CONFIG_MEMORY_START=0x08000000
206CONFIG_MEMORY_SIZE=0x10000000 238CONFIG_MEMORY_SIZE=0x10000000
207CONFIG_29BIT=y 239CONFIG_29BIT=y
240# CONFIG_PMB_ENABLE is not set
208# CONFIG_X2TLB is not set 241# CONFIG_X2TLB is not set
209CONFIG_VSYSCALL=y 242CONFIG_VSYSCALL=y
210CONFIG_ARCH_FLATMEM_ENABLE=y 243CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -229,8 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
229# CONFIG_PHYS_ADDR_T_64BIT is not set 262# CONFIG_PHYS_ADDR_T_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=0 263CONFIG_ZONE_DMA_FLAG=0
231CONFIG_NR_QUICK=2 264CONFIG_NR_QUICK=2
232CONFIG_HAVE_MLOCK=y
233CONFIG_HAVE_MLOCKED_PAGE_BIT=y
234# CONFIG_KSM is not set 265# CONFIG_KSM is not set
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 266CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236 267
@@ -264,7 +295,6 @@ CONFIG_SH_ECOVEC=y
264# 295#
265# CONFIG_SH_TIMER_TMU is not set 296# CONFIG_SH_TIMER_TMU is not set
266CONFIG_SH_TIMER_CMT=y 297CONFIG_SH_TIMER_CMT=y
267CONFIG_SH_PCLK_FREQ=33333333
268CONFIG_SH_CLK_CPG=y 298CONFIG_SH_CLK_CPG=y
269# CONFIG_NO_HZ is not set 299# CONFIG_NO_HZ is not set
270# CONFIG_HIGH_RES_TIMERS is not set 300# CONFIG_HIGH_RES_TIMERS is not set
@@ -406,7 +436,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
406# CONFIG_IRDA is not set 436# CONFIG_IRDA is not set
407# CONFIG_BT is not set 437# CONFIG_BT is not set
408# CONFIG_AF_RXRPC is not set 438# CONFIG_AF_RXRPC is not set
409# CONFIG_WIRELESS is not set 439CONFIG_WIRELESS=y
440# CONFIG_CFG80211 is not set
441# CONFIG_LIB80211 is not set
442
443#
444# CFG80211 needs to be enabled for MAC80211
445#
410# CONFIG_WIMAX is not set 446# CONFIG_WIMAX is not set
411# CONFIG_RFKILL is not set 447# CONFIG_RFKILL is not set
412# CONFIG_NET_9P is not set 448# CONFIG_NET_9P is not set
@@ -432,6 +468,10 @@ CONFIG_EXTRA_FIRMWARE=""
432CONFIG_BLK_DEV=y 468CONFIG_BLK_DEV=y
433# CONFIG_BLK_DEV_COW_COMMON is not set 469# CONFIG_BLK_DEV_COW_COMMON is not set
434# CONFIG_BLK_DEV_LOOP is not set 470# CONFIG_BLK_DEV_LOOP is not set
471
472#
473# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
474#
435# CONFIG_BLK_DEV_NBD is not set 475# CONFIG_BLK_DEV_NBD is not set
436# CONFIG_BLK_DEV_UB is not set 476# CONFIG_BLK_DEV_UB is not set
437# CONFIG_BLK_DEV_RAM is not set 477# CONFIG_BLK_DEV_RAM is not set
@@ -526,11 +566,12 @@ CONFIG_SH_ETH=y
526# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 566# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
527# CONFIG_B44 is not set 567# CONFIG_B44 is not set
528# CONFIG_KS8842 is not set 568# CONFIG_KS8842 is not set
569# CONFIG_KS8851_MLL is not set
529# CONFIG_NETDEV_1000 is not set 570# CONFIG_NETDEV_1000 is not set
530# CONFIG_NETDEV_10000 is not set 571# CONFIG_NETDEV_10000 is not set
531CONFIG_WLAN=y 572CONFIG_WLAN=y
532# CONFIG_WLAN_PRE80211 is not set 573# CONFIG_USB_ZD1201 is not set
533# CONFIG_WLAN_80211 is not set 574# CONFIG_HOSTAP is not set
534 575
535# 576#
536# Enable WiMAX (Networking options) to see the WiMAX drivers 577# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -559,6 +600,7 @@ CONFIG_WLAN=y
559CONFIG_INPUT=y 600CONFIG_INPUT=y
560# CONFIG_INPUT_FF_MEMLESS is not set 601# CONFIG_INPUT_FF_MEMLESS is not set
561# CONFIG_INPUT_POLLDEV is not set 602# CONFIG_INPUT_POLLDEV is not set
603# CONFIG_INPUT_SPARSEKMAP is not set
562 604
563# 605#
564# Userland interfaces 606# Userland interfaces
@@ -652,7 +694,6 @@ CONFIG_I2C_SH_MOBILE=y
652# 694#
653# Miscellaneous I2C Chip support 695# Miscellaneous I2C Chip support
654# 696#
655# CONFIG_DS1682 is not set
656# CONFIG_SENSORS_TSL2550 is not set 697# CONFIG_SENSORS_TSL2550 is not set
657# CONFIG_I2C_DEBUG_CORE is not set 698# CONFIG_I2C_DEBUG_CORE is not set
658# CONFIG_I2C_DEBUG_ALGO is not set 699# CONFIG_I2C_DEBUG_ALGO is not set
@@ -707,16 +748,19 @@ CONFIG_SSB_POSSIBLE=y
707# 748#
708# CONFIG_MFD_CORE is not set 749# CONFIG_MFD_CORE is not set
709# CONFIG_MFD_SM501 is not set 750# CONFIG_MFD_SM501 is not set
751# CONFIG_MFD_SH_MOBILE_SDHI is not set
710# CONFIG_HTC_PASIC3 is not set 752# CONFIG_HTC_PASIC3 is not set
711# CONFIG_TPS65010 is not set 753# CONFIG_TPS65010 is not set
712# CONFIG_TWL4030_CORE is not set 754# CONFIG_TWL4030_CORE is not set
713# CONFIG_MFD_TMIO is not set 755# CONFIG_MFD_TMIO is not set
714# CONFIG_PMIC_DA903X is not set 756# CONFIG_PMIC_DA903X is not set
757# CONFIG_PMIC_ADP5520 is not set
715# CONFIG_MFD_WM8400 is not set 758# CONFIG_MFD_WM8400 is not set
716# CONFIG_MFD_WM831X is not set 759# CONFIG_MFD_WM831X is not set
717# CONFIG_MFD_WM8350_I2C is not set 760# CONFIG_MFD_WM8350_I2C is not set
718# CONFIG_MFD_PCF50633 is not set 761# CONFIG_MFD_PCF50633 is not set
719# CONFIG_AB3100_CORE is not set 762# CONFIG_AB3100_CORE is not set
763# CONFIG_MFD_88PM8607 is not set
720# CONFIG_REGULATOR is not set 764# CONFIG_REGULATOR is not set
721# CONFIG_MEDIA_SUPPORT is not set 765# CONFIG_MEDIA_SUPPORT is not set
722 766
@@ -867,6 +911,7 @@ CONFIG_EXT2_FS=y
867# CONFIG_EXT2_FS_XIP is not set 911# CONFIG_EXT2_FS_XIP is not set
868# CONFIG_EXT3_FS is not set 912# CONFIG_EXT3_FS is not set
869# CONFIG_EXT4_FS is not set 913# CONFIG_EXT4_FS is not set
914CONFIG_EXT4_USE_FOR_EXT23=y
870# CONFIG_REISERFS_FS is not set 915# CONFIG_REISERFS_FS is not set
871# CONFIG_JFS_FS is not set 916# CONFIG_JFS_FS is not set
872# CONFIG_FS_POSIX_ACL is not set 917# CONFIG_FS_POSIX_ACL is not set
@@ -979,7 +1024,7 @@ CONFIG_FRAME_WARN=1024
979CONFIG_DEBUG_FS=y 1024CONFIG_DEBUG_FS=y
980# CONFIG_HEADERS_CHECK is not set 1025# CONFIG_HEADERS_CHECK is not set
981# CONFIG_DEBUG_KERNEL is not set 1026# CONFIG_DEBUG_KERNEL is not set
982# CONFIG_DEBUG_BUGVERBOSE is not set 1027CONFIG_DEBUG_BUGVERBOSE=y
983# CONFIG_DEBUG_MEMORY_INIT is not set 1028# CONFIG_DEBUG_MEMORY_INIT is not set
984# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1029# CONFIG_RCU_CPU_STALL_DETECTOR is not set
985# CONFIG_LATENCYTOP is not set 1030# CONFIG_LATENCYTOP is not set
@@ -997,7 +1042,6 @@ CONFIG_TRACING_SUPPORT=y
997# CONFIG_SAMPLES is not set 1042# CONFIG_SAMPLES is not set
998CONFIG_HAVE_ARCH_KGDB=y 1043CONFIG_HAVE_ARCH_KGDB=y
999# CONFIG_SH_STANDARD_BIOS is not set 1044# CONFIG_SH_STANDARD_BIOS is not set
1000# CONFIG_EARLY_SCIF_CONSOLE is not set
1001# CONFIG_DWARF_UNWINDER is not set 1045# CONFIG_DWARF_UNWINDER is not set
1002 1046
1003# 1047#
@@ -1006,7 +1050,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1006# CONFIG_KEYS is not set 1050# CONFIG_KEYS is not set
1007# CONFIG_SECURITY is not set 1051# CONFIG_SECURITY is not set
1008# CONFIG_SECURITYFS is not set 1052# CONFIG_SECURITYFS is not set
1009# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1053# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1054# CONFIG_DEFAULT_SECURITY_SMACK is not set
1055# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1056CONFIG_DEFAULT_SECURITY_DAC=y
1057CONFIG_DEFAULT_SECURITY=""
1010# CONFIG_CRYPTO is not set 1058# CONFIG_CRYPTO is not set
1011# CONFIG_BINARY_PRINTF is not set 1059# CONFIG_BINARY_PRINTF is not set
1012 1060
diff --git a/arch/sh/configs/ecovec24_defconfig b/arch/sh/configs/ecovec24_defconfig
index cad918437ca7..18e3356406f3 100644
--- a/arch/sh/configs/ecovec24_defconfig
+++ b/arch/sh/configs/ecovec24_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:45:39 2009 4# Mon Jan 4 11:20:36 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -62,6 +64,7 @@ CONFIG_BSD_PROCESS_ACCT=y
62# 64#
63CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
64# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
65# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
66CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
67# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -99,6 +102,7 @@ CONFIG_EVENTFD=y
99CONFIG_SHMEM=y 102CONFIG_SHMEM=y
100CONFIG_AIO=y 103CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y 104CONFIG_HAVE_PERF_EVENTS=y
105CONFIG_PERF_USE_VMALLOC=y
102 106
103# 107#
104# Kernel Performance Events And Counters 108# Kernel Performance Events And Counters
@@ -116,6 +120,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
116CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
118CONFIG_HAVE_ARCH_TRACEHOOK=y 122CONFIG_HAVE_ARCH_TRACEHOOK=y
123CONFIG_HAVE_DMA_ATTRS=y
119CONFIG_HAVE_CLK=y 124CONFIG_HAVE_CLK=y
120CONFIG_HAVE_DMA_API_DEBUG=y 125CONFIG_HAVE_DMA_API_DEBUG=y
121 126
@@ -143,14 +148,41 @@ CONFIG_LBDAF=y
143# IO Schedulers 148# IO Schedulers
144# 149#
145CONFIG_IOSCHED_NOOP=y 150CONFIG_IOSCHED_NOOP=y
146CONFIG_IOSCHED_AS=y
147CONFIG_IOSCHED_DEADLINE=y 151CONFIG_IOSCHED_DEADLINE=y
148CONFIG_IOSCHED_CFQ=y 152CONFIG_IOSCHED_CFQ=y
149# CONFIG_DEFAULT_AS is not set
150# CONFIG_DEFAULT_DEADLINE is not set 153# CONFIG_DEFAULT_DEADLINE is not set
151CONFIG_DEFAULT_CFQ=y 154CONFIG_DEFAULT_CFQ=y
152# CONFIG_DEFAULT_NOOP is not set 155# CONFIG_DEFAULT_NOOP is not set
153CONFIG_DEFAULT_IOSCHED="cfq" 156CONFIG_DEFAULT_IOSCHED="cfq"
157# CONFIG_INLINE_SPIN_TRYLOCK is not set
158# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK is not set
160# CONFIG_INLINE_SPIN_LOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
162# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
163# CONFIG_INLINE_SPIN_UNLOCK is not set
164# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
165# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
166# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
167# CONFIG_INLINE_READ_TRYLOCK is not set
168# CONFIG_INLINE_READ_LOCK is not set
169# CONFIG_INLINE_READ_LOCK_BH is not set
170# CONFIG_INLINE_READ_LOCK_IRQ is not set
171# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
172# CONFIG_INLINE_READ_UNLOCK is not set
173# CONFIG_INLINE_READ_UNLOCK_BH is not set
174# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
175# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
176# CONFIG_INLINE_WRITE_TRYLOCK is not set
177# CONFIG_INLINE_WRITE_LOCK is not set
178# CONFIG_INLINE_WRITE_LOCK_BH is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
180# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
181# CONFIG_INLINE_WRITE_UNLOCK is not set
182# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
183# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
184# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
185# CONFIG_MUTEX_SPIN_ON_OWNER is not set
154CONFIG_FREEZER=y 186CONFIG_FREEZER=y
155 187
156# 188#
@@ -206,6 +238,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
206CONFIG_MEMORY_START=0x08000000 238CONFIG_MEMORY_START=0x08000000
207CONFIG_MEMORY_SIZE=0x10000000 239CONFIG_MEMORY_SIZE=0x10000000
208CONFIG_29BIT=y 240CONFIG_29BIT=y
241# CONFIG_PMB_ENABLE is not set
209# CONFIG_X2TLB is not set 242# CONFIG_X2TLB is not set
210CONFIG_VSYSCALL=y 243CONFIG_VSYSCALL=y
211CONFIG_ARCH_FLATMEM_ENABLE=y 244CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -230,8 +263,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
230# CONFIG_PHYS_ADDR_T_64BIT is not set 263# CONFIG_PHYS_ADDR_T_64BIT is not set
231CONFIG_ZONE_DMA_FLAG=0 264CONFIG_ZONE_DMA_FLAG=0
232CONFIG_NR_QUICK=2 265CONFIG_NR_QUICK=2
233CONFIG_HAVE_MLOCK=y
234CONFIG_HAVE_MLOCKED_PAGE_BIT=y
235# CONFIG_KSM is not set 266# CONFIG_KSM is not set
236CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 267CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
237 268
@@ -265,7 +296,6 @@ CONFIG_SH_ECOVEC=y
265# 296#
266CONFIG_SH_TIMER_TMU=y 297CONFIG_SH_TIMER_TMU=y
267# CONFIG_SH_TIMER_CMT is not set 298# CONFIG_SH_TIMER_CMT is not set
268CONFIG_SH_PCLK_FREQ=33333333
269CONFIG_SH_CLK_CPG=y 299CONFIG_SH_CLK_CPG=y
270# CONFIG_NO_HZ is not set 300# CONFIG_NO_HZ is not set
271# CONFIG_HIGH_RES_TIMERS is not set 301# CONFIG_HIGH_RES_TIMERS is not set
@@ -420,9 +450,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
420# CONFIG_AF_RXRPC is not set 450# CONFIG_AF_RXRPC is not set
421CONFIG_WIRELESS=y 451CONFIG_WIRELESS=y
422# CONFIG_CFG80211 is not set 452# CONFIG_CFG80211 is not set
423CONFIG_CFG80211_DEFAULT_PS_VALUE=0
424# CONFIG_WIRELESS_OLD_REGULATORY is not set
425# CONFIG_WIRELESS_EXT is not set
426# CONFIG_LIB80211 is not set 453# CONFIG_LIB80211 is not set
427 454
428# 455#
@@ -552,6 +579,10 @@ CONFIG_MTD_UBI_BEB_RESERVE=1
552CONFIG_BLK_DEV=y 579CONFIG_BLK_DEV=y
553# CONFIG_BLK_DEV_COW_COMMON is not set 580# CONFIG_BLK_DEV_COW_COMMON is not set
554# CONFIG_BLK_DEV_LOOP is not set 581# CONFIG_BLK_DEV_LOOP is not set
582
583#
584# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
585#
555# CONFIG_BLK_DEV_NBD is not set 586# CONFIG_BLK_DEV_NBD is not set
556# CONFIG_BLK_DEV_UB is not set 587# CONFIG_BLK_DEV_UB is not set
557CONFIG_BLK_DEV_RAM=y 588CONFIG_BLK_DEV_RAM=y
@@ -562,9 +593,12 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
562# CONFIG_ATA_OVER_ETH is not set 593# CONFIG_ATA_OVER_ETH is not set
563# CONFIG_BLK_DEV_HD is not set 594# CONFIG_BLK_DEV_HD is not set
564CONFIG_MISC_DEVICES=y 595CONFIG_MISC_DEVICES=y
596# CONFIG_AD525X_DPOT is not set
565# CONFIG_ICS932S401 is not set 597# CONFIG_ICS932S401 is not set
566# CONFIG_ENCLOSURE_SERVICES is not set 598# CONFIG_ENCLOSURE_SERVICES is not set
567# CONFIG_ISL29003 is not set 599# CONFIG_ISL29003 is not set
600# CONFIG_DS1682 is not set
601# CONFIG_TI_DAC7512 is not set
568# CONFIG_C2PORT is not set 602# CONFIG_C2PORT is not set
569 603
570# 604#
@@ -575,6 +609,7 @@ CONFIG_MISC_DEVICES=y
575# CONFIG_EEPROM_LEGACY is not set 609# CONFIG_EEPROM_LEGACY is not set
576# CONFIG_EEPROM_MAX6875 is not set 610# CONFIG_EEPROM_MAX6875 is not set
577# CONFIG_EEPROM_93CX6 is not set 611# CONFIG_EEPROM_93CX6 is not set
612# CONFIG_IWMC3200TOP is not set
578CONFIG_HAVE_IDE=y 613CONFIG_HAVE_IDE=y
579# CONFIG_IDE is not set 614# CONFIG_IDE is not set
580 615
@@ -669,11 +704,12 @@ CONFIG_SH_ETH=y
669# CONFIG_B44 is not set 704# CONFIG_B44 is not set
670# CONFIG_KS8842 is not set 705# CONFIG_KS8842 is not set
671# CONFIG_KS8851 is not set 706# CONFIG_KS8851 is not set
707# CONFIG_KS8851_MLL is not set
672# CONFIG_NETDEV_1000 is not set 708# CONFIG_NETDEV_1000 is not set
673# CONFIG_NETDEV_10000 is not set 709# CONFIG_NETDEV_10000 is not set
674CONFIG_WLAN=y 710CONFIG_WLAN=y
675# CONFIG_WLAN_PRE80211 is not set 711# CONFIG_USB_ZD1201 is not set
676# CONFIG_WLAN_80211 is not set 712# CONFIG_HOSTAP is not set
677 713
678# 714#
679# Enable WiMAX (Networking options) to see the WiMAX drivers 715# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -702,6 +738,7 @@ CONFIG_WLAN=y
702CONFIG_INPUT=y 738CONFIG_INPUT=y
703# CONFIG_INPUT_FF_MEMLESS is not set 739# CONFIG_INPUT_FF_MEMLESS is not set
704# CONFIG_INPUT_POLLDEV is not set 740# CONFIG_INPUT_POLLDEV is not set
741# CONFIG_INPUT_SPARSEKMAP is not set
705 742
706# 743#
707# Userland interfaces 744# Userland interfaces
@@ -810,7 +847,6 @@ CONFIG_I2C_SH_MOBILE=y
810# 847#
811# Miscellaneous I2C Chip support 848# Miscellaneous I2C Chip support
812# 849#
813# CONFIG_DS1682 is not set
814# CONFIG_SENSORS_TSL2550 is not set 850# CONFIG_SENSORS_TSL2550 is not set
815# CONFIG_I2C_DEBUG_CORE is not set 851# CONFIG_I2C_DEBUG_CORE is not set
816# CONFIG_I2C_DEBUG_ALGO is not set 852# CONFIG_I2C_DEBUG_ALGO is not set
@@ -824,7 +860,10 @@ CONFIG_SPI_MASTER=y
824# 860#
825CONFIG_SPI_BITBANG=y 861CONFIG_SPI_BITBANG=y
826# CONFIG_SPI_GPIO is not set 862# CONFIG_SPI_GPIO is not set
863# CONFIG_SPI_SH_MSIOF is not set
827# CONFIG_SPI_SH_SCI is not set 864# CONFIG_SPI_SH_SCI is not set
865# CONFIG_SPI_XILINX is not set
866# CONFIG_SPI_DESIGNWARE is not set
828 867
829# 868#
830# SPI Protocol Masters 869# SPI Protocol Masters
@@ -882,11 +921,13 @@ CONFIG_SSB_POSSIBLE=y
882# 921#
883# CONFIG_MFD_CORE is not set 922# CONFIG_MFD_CORE is not set
884# CONFIG_MFD_SM501 is not set 923# CONFIG_MFD_SM501 is not set
924# CONFIG_MFD_SH_MOBILE_SDHI is not set
885# CONFIG_HTC_PASIC3 is not set 925# CONFIG_HTC_PASIC3 is not set
886# CONFIG_TPS65010 is not set 926# CONFIG_TPS65010 is not set
887# CONFIG_TWL4030_CORE is not set 927# CONFIG_TWL4030_CORE is not set
888# CONFIG_MFD_TMIO is not set 928# CONFIG_MFD_TMIO is not set
889# CONFIG_PMIC_DA903X is not set 929# CONFIG_PMIC_DA903X is not set
930# CONFIG_PMIC_ADP5520 is not set
890# CONFIG_MFD_WM8400 is not set 931# CONFIG_MFD_WM8400 is not set
891# CONFIG_MFD_WM831X is not set 932# CONFIG_MFD_WM831X is not set
892# CONFIG_MFD_WM8350_I2C is not set 933# CONFIG_MFD_WM8350_I2C is not set
@@ -894,6 +935,8 @@ CONFIG_SSB_POSSIBLE=y
894# CONFIG_MFD_MC13783 is not set 935# CONFIG_MFD_MC13783 is not set
895# CONFIG_AB3100_CORE is not set 936# CONFIG_AB3100_CORE is not set
896# CONFIG_EZX_PCAP is not set 937# CONFIG_EZX_PCAP is not set
938# CONFIG_MFD_88PM8607 is not set
939# CONFIG_AB4500_CORE is not set
897# CONFIG_REGULATOR is not set 940# CONFIG_REGULATOR is not set
898CONFIG_MEDIA_SUPPORT=y 941CONFIG_MEDIA_SUPPORT=y
899 942
@@ -910,6 +953,8 @@ CONFIG_VIDEO_MEDIA=y
910# 953#
911# Multimedia drivers 954# Multimedia drivers
912# 955#
956CONFIG_IR_CORE=y
957CONFIG_VIDEO_IR=y
913# CONFIG_MEDIA_ATTACH is not set 958# CONFIG_MEDIA_ATTACH is not set
914CONFIG_MEDIA_TUNER=y 959CONFIG_MEDIA_TUNER=y
915# CONFIG_MEDIA_TUNER_CUSTOMISE is not set 960# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
@@ -930,6 +975,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
930# CONFIG_VIDEO_ADV_DEBUG is not set 975# CONFIG_VIDEO_ADV_DEBUG is not set
931# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set 976# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
932CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 977CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
978CONFIG_VIDEO_IR_I2C=y
933# CONFIG_VIDEO_VIVI is not set 979# CONFIG_VIDEO_VIVI is not set
934# CONFIG_VIDEO_CPIA is not set 980# CONFIG_VIDEO_CPIA is not set
935# CONFIG_VIDEO_CPIA2 is not set 981# CONFIG_VIDEO_CPIA2 is not set
@@ -939,10 +985,13 @@ CONFIG_SOC_CAMERA=y
939# CONFIG_SOC_CAMERA_MT9M001 is not set 985# CONFIG_SOC_CAMERA_MT9M001 is not set
940# CONFIG_SOC_CAMERA_MT9M111 is not set 986# CONFIG_SOC_CAMERA_MT9M111 is not set
941# CONFIG_SOC_CAMERA_MT9T031 is not set 987# CONFIG_SOC_CAMERA_MT9T031 is not set
988# CONFIG_SOC_CAMERA_MT9T112 is not set
942# CONFIG_SOC_CAMERA_MT9V022 is not set 989# CONFIG_SOC_CAMERA_MT9V022 is not set
990# CONFIG_SOC_CAMERA_RJ54N1 is not set
943# CONFIG_SOC_CAMERA_TW9910 is not set 991# CONFIG_SOC_CAMERA_TW9910 is not set
944# CONFIG_SOC_CAMERA_PLATFORM is not set 992# CONFIG_SOC_CAMERA_PLATFORM is not set
945# CONFIG_SOC_CAMERA_OV772X is not set 993# CONFIG_SOC_CAMERA_OV772X is not set
994# CONFIG_SOC_CAMERA_OV9640 is not set
946CONFIG_VIDEO_SH_MOBILE_CEU=y 995CONFIG_VIDEO_SH_MOBILE_CEU=y
947# CONFIG_V4L_USB_DRIVERS is not set 996# CONFIG_V4L_USB_DRIVERS is not set
948CONFIG_RADIO_ADAPTERS=y 997CONFIG_RADIO_ADAPTERS=y
@@ -952,6 +1001,7 @@ CONFIG_RADIO_ADAPTERS=y
952# CONFIG_RADIO_SI470X is not set 1001# CONFIG_RADIO_SI470X is not set
953# CONFIG_USB_MR800 is not set 1002# CONFIG_USB_MR800 is not set
954# CONFIG_RADIO_TEA5764 is not set 1003# CONFIG_RADIO_TEA5764 is not set
1004# CONFIG_RADIO_TEF6862 is not set
955# CONFIG_DAB is not set 1005# CONFIG_DAB is not set
956 1006
957# 1007#
@@ -1177,6 +1227,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
1177# CONFIG_MMC_AT91 is not set 1227# CONFIG_MMC_AT91 is not set
1178# CONFIG_MMC_ATMELMCI is not set 1228# CONFIG_MMC_ATMELMCI is not set
1179CONFIG_MMC_SPI=y 1229CONFIG_MMC_SPI=y
1230# CONFIG_MMC_TMIO is not set
1180# CONFIG_MEMSTICK is not set 1231# CONFIG_MEMSTICK is not set
1181# CONFIG_NEW_LEDS is not set 1232# CONFIG_NEW_LEDS is not set
1182# CONFIG_ACCESSIBILITY is not set 1233# CONFIG_ACCESSIBILITY is not set
@@ -1208,6 +1259,7 @@ CONFIG_RTC_INTF_DEV=y
1208CONFIG_RTC_DRV_PCF8563=y 1259CONFIG_RTC_DRV_PCF8563=y
1209# CONFIG_RTC_DRV_PCF8583 is not set 1260# CONFIG_RTC_DRV_PCF8583 is not set
1210# CONFIG_RTC_DRV_M41T80 is not set 1261# CONFIG_RTC_DRV_M41T80 is not set
1262# CONFIG_RTC_DRV_BQ32K is not set
1211# CONFIG_RTC_DRV_S35390A is not set 1263# CONFIG_RTC_DRV_S35390A is not set
1212# CONFIG_RTC_DRV_FM3130 is not set 1264# CONFIG_RTC_DRV_FM3130 is not set
1213# CONFIG_RTC_DRV_RX8581 is not set 1265# CONFIG_RTC_DRV_RX8581 is not set
@@ -1236,7 +1288,9 @@ CONFIG_RTC_DRV_PCF8563=y
1236# CONFIG_RTC_DRV_M48T86 is not set 1288# CONFIG_RTC_DRV_M48T86 is not set
1237# CONFIG_RTC_DRV_M48T35 is not set 1289# CONFIG_RTC_DRV_M48T35 is not set
1238# CONFIG_RTC_DRV_M48T59 is not set 1290# CONFIG_RTC_DRV_M48T59 is not set
1291# CONFIG_RTC_DRV_MSM6242 is not set
1239# CONFIG_RTC_DRV_BQ4802 is not set 1292# CONFIG_RTC_DRV_BQ4802 is not set
1293# CONFIG_RTC_DRV_RP5C01 is not set
1240# CONFIG_RTC_DRV_V3020 is not set 1294# CONFIG_RTC_DRV_V3020 is not set
1241 1295
1242# 1296#
@@ -1430,7 +1484,7 @@ CONFIG_FRAME_WARN=1024
1430CONFIG_DEBUG_FS=y 1484CONFIG_DEBUG_FS=y
1431# CONFIG_HEADERS_CHECK is not set 1485# CONFIG_HEADERS_CHECK is not set
1432# CONFIG_DEBUG_KERNEL is not set 1486# CONFIG_DEBUG_KERNEL is not set
1433# CONFIG_DEBUG_BUGVERBOSE is not set 1487CONFIG_DEBUG_BUGVERBOSE=y
1434# CONFIG_DEBUG_MEMORY_INIT is not set 1488# CONFIG_DEBUG_MEMORY_INIT is not set
1435# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1489# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1436# CONFIG_LATENCYTOP is not set 1490# CONFIG_LATENCYTOP is not set
@@ -1448,7 +1502,6 @@ CONFIG_TRACING_SUPPORT=y
1448# CONFIG_SAMPLES is not set 1502# CONFIG_SAMPLES is not set
1449CONFIG_HAVE_ARCH_KGDB=y 1503CONFIG_HAVE_ARCH_KGDB=y
1450# CONFIG_SH_STANDARD_BIOS is not set 1504# CONFIG_SH_STANDARD_BIOS is not set
1451# CONFIG_EARLY_SCIF_CONSOLE is not set
1452# CONFIG_DWARF_UNWINDER is not set 1505# CONFIG_DWARF_UNWINDER is not set
1453 1506
1454# 1507#
@@ -1457,7 +1510,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1457# CONFIG_KEYS is not set 1510# CONFIG_KEYS is not set
1458# CONFIG_SECURITY is not set 1511# CONFIG_SECURITY is not set
1459# CONFIG_SECURITYFS is not set 1512# CONFIG_SECURITYFS is not set
1460# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1513# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1514# CONFIG_DEFAULT_SECURITY_SMACK is not set
1515# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1516CONFIG_DEFAULT_SECURITY_DAC=y
1517CONFIG_DEFAULT_SECURITY=""
1461CONFIG_CRYPTO=y 1518CONFIG_CRYPTO=y
1462 1519
1463# 1520#
diff --git a/arch/sh/configs/edosk7705_defconfig b/arch/sh/configs/edosk7705_defconfig
index 86c9bc050629..72f8718dd738 100644
--- a/arch/sh/configs/edosk7705_defconfig
+++ b/arch/sh/configs/edosk7705_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:57:13 2009 4# Mon Jan 4 11:24:26 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -28,6 +28,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28CONFIG_ARCH_NO_VIRT_TO_BUS=y 28CONFIG_ARCH_NO_VIRT_TO_BUS=y
29CONFIG_ARCH_HAS_DEFAULT_IDLE=y 29CONFIG_ARCH_HAS_DEFAULT_IDLE=y
30CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 30CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
31CONFIG_DMA_NONCOHERENT=y
31CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
32CONFIG_CONSTRUCTORS=y 33CONFIG_CONSTRUCTORS=y
33 34
@@ -53,6 +54,7 @@ CONFIG_KERNEL_GZIP=y
53# 54#
54CONFIG_TREE_RCU=y 55CONFIG_TREE_RCU=y
55# CONFIG_TREE_PREEMPT_RCU is not set 56# CONFIG_TREE_PREEMPT_RCU is not set
57# CONFIG_TINY_RCU is not set
56# CONFIG_RCU_TRACE is not set 58# CONFIG_RCU_TRACE is not set
57CONFIG_RCU_FANOUT=32 59CONFIG_RCU_FANOUT=32
58# CONFIG_RCU_FANOUT_EXACT is not set 60# CONFIG_RCU_FANOUT_EXACT is not set
@@ -66,7 +68,6 @@ CONFIG_LOG_BUF_SHIFT=17
66# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 68# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
67CONFIG_EMBEDDED=y 69CONFIG_EMBEDDED=y
68# CONFIG_UID16 is not set 70# CONFIG_UID16 is not set
69# CONFIG_SYSCTL_SYSCALL is not set
70# CONFIG_KALLSYMS is not set 71# CONFIG_KALLSYMS is not set
71# CONFIG_HOTPLUG is not set 72# CONFIG_HOTPLUG is not set
72# CONFIG_PRINTK is not set 73# CONFIG_PRINTK is not set
@@ -81,6 +82,7 @@ CONFIG_EMBEDDED=y
81CONFIG_SHMEM=y 82CONFIG_SHMEM=y
82# CONFIG_AIO is not set 83# CONFIG_AIO is not set
83CONFIG_HAVE_PERF_EVENTS=y 84CONFIG_HAVE_PERF_EVENTS=y
85CONFIG_PERF_USE_VMALLOC=y
84 86
85# 87#
86# Kernel Performance Events And Counters 88# Kernel Performance Events And Counters
@@ -98,6 +100,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
98CONFIG_HAVE_KPROBES=y 100CONFIG_HAVE_KPROBES=y
99CONFIG_HAVE_KRETPROBES=y 101CONFIG_HAVE_KRETPROBES=y
100CONFIG_HAVE_ARCH_TRACEHOOK=y 102CONFIG_HAVE_ARCH_TRACEHOOK=y
103CONFIG_HAVE_DMA_ATTRS=y
101CONFIG_HAVE_CLK=y 104CONFIG_HAVE_CLK=y
102CONFIG_HAVE_DMA_API_DEBUG=y 105CONFIG_HAVE_DMA_API_DEBUG=y
103 106
@@ -109,6 +112,35 @@ CONFIG_HAVE_GENERIC_DMA_COHERENT=y
109CONFIG_BASE_SMALL=1 112CONFIG_BASE_SMALL=1
110# CONFIG_MODULES is not set 113# CONFIG_MODULES is not set
111# CONFIG_BLOCK is not set 114# CONFIG_BLOCK is not set
115# CONFIG_INLINE_SPIN_TRYLOCK is not set
116# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
117# CONFIG_INLINE_SPIN_LOCK is not set
118# CONFIG_INLINE_SPIN_LOCK_BH is not set
119# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
120# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
121CONFIG_INLINE_SPIN_UNLOCK=y
122# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
123CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
124# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
125# CONFIG_INLINE_READ_TRYLOCK is not set
126# CONFIG_INLINE_READ_LOCK is not set
127# CONFIG_INLINE_READ_LOCK_BH is not set
128# CONFIG_INLINE_READ_LOCK_IRQ is not set
129# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
130CONFIG_INLINE_READ_UNLOCK=y
131# CONFIG_INLINE_READ_UNLOCK_BH is not set
132CONFIG_INLINE_READ_UNLOCK_IRQ=y
133# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
134# CONFIG_INLINE_WRITE_TRYLOCK is not set
135# CONFIG_INLINE_WRITE_LOCK is not set
136# CONFIG_INLINE_WRITE_LOCK_BH is not set
137# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
138# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
139CONFIG_INLINE_WRITE_UNLOCK=y
140# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
141CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
142# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
143# CONFIG_MUTEX_SPIN_ON_OWNER is not set
112# CONFIG_FREEZER is not set 144# CONFIG_FREEZER is not set
113 145
114# 146#
@@ -186,8 +218,6 @@ CONFIG_MIGRATION=y
186# CONFIG_PHYS_ADDR_T_64BIT is not set 218# CONFIG_PHYS_ADDR_T_64BIT is not set
187CONFIG_ZONE_DMA_FLAG=0 219CONFIG_ZONE_DMA_FLAG=0
188CONFIG_NR_QUICK=2 220CONFIG_NR_QUICK=2
189CONFIG_HAVE_MLOCK=y
190CONFIG_HAVE_MLOCKED_PAGE_BIT=y
191# CONFIG_KSM is not set 221# CONFIG_KSM is not set
192CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 222CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
193 223
@@ -359,6 +389,7 @@ CONFIG_SSB_POSSIBLE=y
359# 389#
360# CONFIG_MFD_CORE is not set 390# CONFIG_MFD_CORE is not set
361# CONFIG_MFD_SM501 is not set 391# CONFIG_MFD_SM501 is not set
392# CONFIG_MFD_SH_MOBILE_SDHI is not set
362# CONFIG_HTC_PASIC3 is not set 393# CONFIG_HTC_PASIC3 is not set
363# CONFIG_MFD_TMIO is not set 394# CONFIG_MFD_TMIO is not set
364# CONFIG_REGULATOR is not set 395# CONFIG_REGULATOR is not set
@@ -416,7 +447,6 @@ CONFIG_INOTIFY_USER=y
416# CONFIG_PROC_FS is not set 447# CONFIG_PROC_FS is not set
417# CONFIG_SYSFS is not set 448# CONFIG_SYSFS is not set
418# CONFIG_TMPFS is not set 449# CONFIG_TMPFS is not set
419# CONFIG_HUGETLBFS is not set
420# CONFIG_HUGETLB_PAGE is not set 450# CONFIG_HUGETLB_PAGE is not set
421CONFIG_MISC_FILESYSTEMS=y 451CONFIG_MISC_FILESYSTEMS=y
422# CONFIG_NLS is not set 452# CONFIG_NLS is not set
@@ -448,7 +478,6 @@ CONFIG_TRACING_SUPPORT=y
448# CONFIG_SAMPLES is not set 478# CONFIG_SAMPLES is not set
449CONFIG_HAVE_ARCH_KGDB=y 479CONFIG_HAVE_ARCH_KGDB=y
450# CONFIG_SH_STANDARD_BIOS is not set 480# CONFIG_SH_STANDARD_BIOS is not set
451# CONFIG_EARLY_SCIF_CONSOLE is not set
452# CONFIG_DWARF_UNWINDER is not set 481# CONFIG_DWARF_UNWINDER is not set
453 482
454# 483#
@@ -456,7 +485,11 @@ CONFIG_HAVE_ARCH_KGDB=y
456# 485#
457# CONFIG_KEYS is not set 486# CONFIG_KEYS is not set
458# CONFIG_SECURITYFS is not set 487# CONFIG_SECURITYFS is not set
459# CONFIG_SECURITY_FILE_CAPABILITIES is not set 488# CONFIG_DEFAULT_SECURITY_SELINUX is not set
489# CONFIG_DEFAULT_SECURITY_SMACK is not set
490# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
491CONFIG_DEFAULT_SECURITY_DAC=y
492CONFIG_DEFAULT_SECURITY=""
460# CONFIG_CRYPTO is not set 493# CONFIG_CRYPTO is not set
461# CONFIG_BINARY_PRINTF is not set 494# CONFIG_BINARY_PRINTF is not set
462 495
diff --git a/arch/sh/configs/edosk7760_defconfig b/arch/sh/configs/edosk7760_defconfig
index 4c0f82b7def2..0932e6d656eb 100644
--- a/arch/sh/configs/edosk7760_defconfig
+++ b/arch/sh/configs/edosk7760_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:57:30 2009 4# Mon Jan 4 11:24:44 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -62,6 +64,7 @@ CONFIG_BSD_PROCESS_ACCT=y
62# 64#
63CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
64# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
65# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
66CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
67# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +105,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 105CONFIG_SHMEM=y
103CONFIG_AIO=y 106CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 107CONFIG_HAVE_PERF_EVENTS=y
108CONFIG_PERF_USE_VMALLOC=y
105 109
106# 110#
107# Kernel Performance Events And Counters 111# Kernel Performance Events And Counters
@@ -121,6 +125,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
121CONFIG_HAVE_KPROBES=y 125CONFIG_HAVE_KPROBES=y
122CONFIG_HAVE_KRETPROBES=y 126CONFIG_HAVE_KRETPROBES=y
123CONFIG_HAVE_ARCH_TRACEHOOK=y 127CONFIG_HAVE_ARCH_TRACEHOOK=y
128CONFIG_HAVE_DMA_ATTRS=y
124CONFIG_HAVE_CLK=y 129CONFIG_HAVE_CLK=y
125CONFIG_HAVE_DMA_API_DEBUG=y 130CONFIG_HAVE_DMA_API_DEBUG=y
126 131
@@ -147,14 +152,41 @@ CONFIG_LBDAF=y
147# IO Schedulers 152# IO Schedulers
148# 153#
149CONFIG_IOSCHED_NOOP=y 154CONFIG_IOSCHED_NOOP=y
150CONFIG_IOSCHED_AS=y
151CONFIG_IOSCHED_DEADLINE=y 155CONFIG_IOSCHED_DEADLINE=y
152CONFIG_IOSCHED_CFQ=y 156CONFIG_IOSCHED_CFQ=y
153# CONFIG_DEFAULT_AS is not set
154# CONFIG_DEFAULT_DEADLINE is not set 157# CONFIG_DEFAULT_DEADLINE is not set
155CONFIG_DEFAULT_CFQ=y 158CONFIG_DEFAULT_CFQ=y
156# CONFIG_DEFAULT_NOOP is not set 159# CONFIG_DEFAULT_NOOP is not set
157CONFIG_DEFAULT_IOSCHED="cfq" 160CONFIG_DEFAULT_IOSCHED="cfq"
161# CONFIG_INLINE_SPIN_TRYLOCK is not set
162# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
163# CONFIG_INLINE_SPIN_LOCK is not set
164# CONFIG_INLINE_SPIN_LOCK_BH is not set
165# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
166# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
167# CONFIG_INLINE_SPIN_UNLOCK is not set
168# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
169# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
170# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
171# CONFIG_INLINE_READ_TRYLOCK is not set
172# CONFIG_INLINE_READ_LOCK is not set
173# CONFIG_INLINE_READ_LOCK_BH is not set
174# CONFIG_INLINE_READ_LOCK_IRQ is not set
175# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
176# CONFIG_INLINE_READ_UNLOCK is not set
177# CONFIG_INLINE_READ_UNLOCK_BH is not set
178# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
179# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
180# CONFIG_INLINE_WRITE_TRYLOCK is not set
181# CONFIG_INLINE_WRITE_LOCK is not set
182# CONFIG_INLINE_WRITE_LOCK_BH is not set
183# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
184# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
185# CONFIG_INLINE_WRITE_UNLOCK is not set
186# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
187# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
188# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
189# CONFIG_MUTEX_SPIN_ON_OWNER is not set
158# CONFIG_FREEZER is not set 190# CONFIG_FREEZER is not set
159 191
160# 192#
@@ -230,8 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
230# CONFIG_PHYS_ADDR_T_64BIT is not set 262# CONFIG_PHYS_ADDR_T_64BIT is not set
231CONFIG_ZONE_DMA_FLAG=0 263CONFIG_ZONE_DMA_FLAG=0
232CONFIG_NR_QUICK=2 264CONFIG_NR_QUICK=2
233CONFIG_HAVE_MLOCK=y
234CONFIG_HAVE_MLOCKED_PAGE_BIT=y
235# CONFIG_KSM is not set 265# CONFIG_KSM is not set
236CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 266CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
237 267
@@ -278,9 +308,9 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
278# 308#
279# DMA support 309# DMA support
280# 310#
281CONFIG_SH_DMA_API=y
282CONFIG_SH_DMA=y 311CONFIG_SH_DMA=y
283CONFIG_SH_DMA_IRQ_MULTI=y 312CONFIG_SH_DMA_IRQ_MULTI=y
313CONFIG_SH_DMA_API=y
284CONFIG_NR_ONCHIP_DMA_CHANNELS=8 314CONFIG_NR_ONCHIP_DMA_CHANNELS=8
285# CONFIG_NR_DMA_CHANNELS_BOOL is not set 315# CONFIG_NR_DMA_CHANNELS_BOOL is not set
286# CONFIG_SH_DMABRG is not set 316# CONFIG_SH_DMABRG is not set
@@ -320,7 +350,6 @@ CONFIG_GUSA=y
320CONFIG_ZERO_PAGE_OFFSET=0x00001000 350CONFIG_ZERO_PAGE_OFFSET=0x00001000
321CONFIG_BOOT_LINK_OFFSET=0x02000000 351CONFIG_BOOT_LINK_OFFSET=0x02000000
322CONFIG_ENTRY_OFFSET=0x00001000 352CONFIG_ENTRY_OFFSET=0x00001000
323# CONFIG_UBC_WAKEUP is not set
324CONFIG_CMDLINE_OVERWRITE=y 353CONFIG_CMDLINE_OVERWRITE=y
325# CONFIG_CMDLINE_EXTEND is not set 354# CONFIG_CMDLINE_EXTEND is not set
326CONFIG_CMDLINE="mem=64M console=ttySC2,115200 root=/dev/nfs rw nfsroot=192.168.0.3:/scripts/filesys ip=192.168.0.4" 355CONFIG_CMDLINE="mem=64M console=ttySC2,115200 root=/dev/nfs rw nfsroot=192.168.0.3:/scripts/filesys ip=192.168.0.4"
@@ -415,9 +444,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
415# CONFIG_AF_RXRPC is not set 444# CONFIG_AF_RXRPC is not set
416CONFIG_WIRELESS=y 445CONFIG_WIRELESS=y
417# CONFIG_CFG80211 is not set 446# CONFIG_CFG80211 is not set
418CONFIG_CFG80211_DEFAULT_PS_VALUE=0
419# CONFIG_WIRELESS_OLD_REGULATORY is not set
420# CONFIG_WIRELESS_EXT is not set
421# CONFIG_LIB80211 is not set 447# CONFIG_LIB80211 is not set
422 448
423# 449#
@@ -534,6 +560,10 @@ CONFIG_MTD_PHYSMAP=y
534CONFIG_BLK_DEV=y 560CONFIG_BLK_DEV=y
535# CONFIG_BLK_DEV_COW_COMMON is not set 561# CONFIG_BLK_DEV_COW_COMMON is not set
536# CONFIG_BLK_DEV_LOOP is not set 562# CONFIG_BLK_DEV_LOOP is not set
563
564#
565# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
566#
537# CONFIG_BLK_DEV_NBD is not set 567# CONFIG_BLK_DEV_NBD is not set
538CONFIG_BLK_DEV_RAM=y 568CONFIG_BLK_DEV_RAM=y
539CONFIG_BLK_DEV_RAM_COUNT=16 569CONFIG_BLK_DEV_RAM_COUNT=16
@@ -581,11 +611,11 @@ CONFIG_SMC91X=y
581# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 611# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
582# CONFIG_B44 is not set 612# CONFIG_B44 is not set
583# CONFIG_KS8842 is not set 613# CONFIG_KS8842 is not set
614# CONFIG_KS8851_MLL is not set
584# CONFIG_NETDEV_1000 is not set 615# CONFIG_NETDEV_1000 is not set
585# CONFIG_NETDEV_10000 is not set 616# CONFIG_NETDEV_10000 is not set
586CONFIG_WLAN=y 617CONFIG_WLAN=y
587# CONFIG_WLAN_PRE80211 is not set 618# CONFIG_HOSTAP is not set
588# CONFIG_WLAN_80211 is not set
589 619
590# 620#
591# Enable WiMAX (Networking options) to see the WiMAX drivers 621# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -605,6 +635,7 @@ CONFIG_WLAN=y
605CONFIG_INPUT=y 635CONFIG_INPUT=y
606# CONFIG_INPUT_FF_MEMLESS is not set 636# CONFIG_INPUT_FF_MEMLESS is not set
607# CONFIG_INPUT_POLLDEV is not set 637# CONFIG_INPUT_POLLDEV is not set
638# CONFIG_INPUT_SPARSEKMAP is not set
608 639
609# 640#
610# Userland interfaces 641# Userland interfaces
@@ -698,7 +729,6 @@ CONFIG_I2C_SH7760=y
698# 729#
699# Miscellaneous I2C Chip support 730# Miscellaneous I2C Chip support
700# 731#
701# CONFIG_DS1682 is not set
702# CONFIG_SENSORS_TSL2550 is not set 732# CONFIG_SENSORS_TSL2550 is not set
703CONFIG_I2C_DEBUG_CORE=y 733CONFIG_I2C_DEBUG_CORE=y
704CONFIG_I2C_DEBUG_ALGO=y 734CONFIG_I2C_DEBUG_ALGO=y
@@ -727,15 +757,18 @@ CONFIG_SSB_POSSIBLE=y
727# 757#
728# CONFIG_MFD_CORE is not set 758# CONFIG_MFD_CORE is not set
729# CONFIG_MFD_SM501 is not set 759# CONFIG_MFD_SM501 is not set
760# CONFIG_MFD_SH_MOBILE_SDHI is not set
730# CONFIG_HTC_PASIC3 is not set 761# CONFIG_HTC_PASIC3 is not set
731# CONFIG_TWL4030_CORE is not set 762# CONFIG_TWL4030_CORE is not set
732# CONFIG_MFD_TMIO is not set 763# CONFIG_MFD_TMIO is not set
733# CONFIG_PMIC_DA903X is not set 764# CONFIG_PMIC_DA903X is not set
765# CONFIG_PMIC_ADP5520 is not set
734# CONFIG_MFD_WM8400 is not set 766# CONFIG_MFD_WM8400 is not set
735# CONFIG_MFD_WM831X is not set 767# CONFIG_MFD_WM831X is not set
736# CONFIG_MFD_WM8350_I2C is not set 768# CONFIG_MFD_WM8350_I2C is not set
737# CONFIG_MFD_PCF50633 is not set 769# CONFIG_MFD_PCF50633 is not set
738# CONFIG_AB3100_CORE is not set 770# CONFIG_AB3100_CORE is not set
771# CONFIG_MFD_88PM8607 is not set
739# CONFIG_REGULATOR is not set 772# CONFIG_REGULATOR is not set
740# CONFIG_MEDIA_SUPPORT is not set 773# CONFIG_MEDIA_SUPPORT is not set
741 774
@@ -1072,9 +1105,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1072CONFIG_HAVE_ARCH_KGDB=y 1105CONFIG_HAVE_ARCH_KGDB=y
1073# CONFIG_KGDB is not set 1106# CONFIG_KGDB is not set
1074# CONFIG_SH_STANDARD_BIOS is not set 1107# CONFIG_SH_STANDARD_BIOS is not set
1075CONFIG_EARLY_SCIF_CONSOLE=y
1076CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1077CONFIG_EARLY_PRINTK=y
1078# CONFIG_STACK_DEBUG is not set 1108# CONFIG_STACK_DEBUG is not set
1079# CONFIG_DEBUG_STACK_USAGE is not set 1109# CONFIG_DEBUG_STACK_USAGE is not set
1080# CONFIG_4KSTACKS is not set 1110# CONFIG_4KSTACKS is not set
@@ -1088,7 +1118,11 @@ CONFIG_DUMP_CODE=y
1088# CONFIG_KEYS is not set 1118# CONFIG_KEYS is not set
1089# CONFIG_SECURITY is not set 1119# CONFIG_SECURITY is not set
1090# CONFIG_SECURITYFS is not set 1120# CONFIG_SECURITYFS is not set
1091# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1121# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1122# CONFIG_DEFAULT_SECURITY_SMACK is not set
1123# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1124CONFIG_DEFAULT_SECURITY_DAC=y
1125CONFIG_DEFAULT_SECURITY=""
1092CONFIG_CRYPTO=y 1126CONFIG_CRYPTO=y
1093 1127
1094# 1128#
diff --git a/arch/sh/configs/espt_defconfig b/arch/sh/configs/espt_defconfig
index 9b785517abcf..f899e5613f86 100644
--- a/arch/sh/configs/espt_defconfig
+++ b/arch/sh/configs/espt_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:58:18 2009 4# Mon Jan 4 11:26:55 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -59,6 +61,7 @@ CONFIG_SYSVIPC_SYSCTL=y
59# 61#
60CONFIG_TREE_RCU=y 62CONFIG_TREE_RCU=y
61# CONFIG_TREE_PREEMPT_RCU is not set 63# CONFIG_TREE_PREEMPT_RCU is not set
64# CONFIG_TINY_RCU is not set
62# CONFIG_RCU_TRACE is not set 65# CONFIG_RCU_TRACE is not set
63CONFIG_RCU_FANOUT=32 66CONFIG_RCU_FANOUT=32
64# CONFIG_RCU_FANOUT_EXACT is not set 67# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,6 +106,7 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -124,6 +128,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
124CONFIG_HAVE_KPROBES=y 128CONFIG_HAVE_KPROBES=y
125CONFIG_HAVE_KRETPROBES=y 129CONFIG_HAVE_KRETPROBES=y
126CONFIG_HAVE_ARCH_TRACEHOOK=y 130CONFIG_HAVE_ARCH_TRACEHOOK=y
131CONFIG_HAVE_DMA_ATTRS=y
127CONFIG_HAVE_CLK=y 132CONFIG_HAVE_CLK=y
128CONFIG_HAVE_DMA_API_DEBUG=y 133CONFIG_HAVE_DMA_API_DEBUG=y
129 134
@@ -150,14 +155,41 @@ CONFIG_LBDAF=y
150# IO Schedulers 155# IO Schedulers
151# 156#
152CONFIG_IOSCHED_NOOP=y 157CONFIG_IOSCHED_NOOP=y
153CONFIG_IOSCHED_AS=y
154CONFIG_IOSCHED_DEADLINE=y 158CONFIG_IOSCHED_DEADLINE=y
155CONFIG_IOSCHED_CFQ=y 159CONFIG_IOSCHED_CFQ=y
156CONFIG_DEFAULT_AS=y
157# CONFIG_DEFAULT_DEADLINE is not set 160# CONFIG_DEFAULT_DEADLINE is not set
158# CONFIG_DEFAULT_CFQ is not set 161CONFIG_DEFAULT_CFQ=y
159# CONFIG_DEFAULT_NOOP is not set 162# CONFIG_DEFAULT_NOOP is not set
160CONFIG_DEFAULT_IOSCHED="anticipatory" 163CONFIG_DEFAULT_IOSCHED="cfq"
164# CONFIG_INLINE_SPIN_TRYLOCK is not set
165# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
166# CONFIG_INLINE_SPIN_LOCK is not set
167# CONFIG_INLINE_SPIN_LOCK_BH is not set
168# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
169# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
170CONFIG_INLINE_SPIN_UNLOCK=y
171# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
172CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
173# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
174# CONFIG_INLINE_READ_TRYLOCK is not set
175# CONFIG_INLINE_READ_LOCK is not set
176# CONFIG_INLINE_READ_LOCK_BH is not set
177# CONFIG_INLINE_READ_LOCK_IRQ is not set
178# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
179CONFIG_INLINE_READ_UNLOCK=y
180# CONFIG_INLINE_READ_UNLOCK_BH is not set
181CONFIG_INLINE_READ_UNLOCK_IRQ=y
182# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
183# CONFIG_INLINE_WRITE_TRYLOCK is not set
184# CONFIG_INLINE_WRITE_LOCK is not set
185# CONFIG_INLINE_WRITE_LOCK_BH is not set
186# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
187# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
188CONFIG_INLINE_WRITE_UNLOCK=y
189# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
190CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
191# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
192# CONFIG_MUTEX_SPIN_ON_OWNER is not set
161# CONFIG_FREEZER is not set 193# CONFIG_FREEZER is not set
162 194
163# 195#
@@ -211,6 +243,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
211CONFIG_MEMORY_START=0x0c000000 243CONFIG_MEMORY_START=0x0c000000
212CONFIG_MEMORY_SIZE=0x04000000 244CONFIG_MEMORY_SIZE=0x04000000
213CONFIG_29BIT=y 245CONFIG_29BIT=y
246# CONFIG_PMB_ENABLE is not set
214CONFIG_VSYSCALL=y 247CONFIG_VSYSCALL=y
215CONFIG_ARCH_FLATMEM_ENABLE=y 248CONFIG_ARCH_FLATMEM_ENABLE=y
216CONFIG_ARCH_SPARSEMEM_ENABLE=y 249CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -237,8 +270,6 @@ CONFIG_MIGRATION=y
237# CONFIG_PHYS_ADDR_T_64BIT is not set 270# CONFIG_PHYS_ADDR_T_64BIT is not set
238CONFIG_ZONE_DMA_FLAG=0 271CONFIG_ZONE_DMA_FLAG=0
239CONFIG_NR_QUICK=2 272CONFIG_NR_QUICK=2
240CONFIG_HAVE_MLOCK=y
241CONFIG_HAVE_MLOCKED_PAGE_BIT=y
242# CONFIG_KSM is not set 273# CONFIG_KSM is not set
243CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 274CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
244 275
@@ -419,7 +450,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
419# CONFIG_IRDA is not set 450# CONFIG_IRDA is not set
420# CONFIG_BT is not set 451# CONFIG_BT is not set
421# CONFIG_AF_RXRPC is not set 452# CONFIG_AF_RXRPC is not set
422# CONFIG_WIRELESS is not set 453CONFIG_WIRELESS=y
454# CONFIG_CFG80211 is not set
455# CONFIG_LIB80211 is not set
456
457#
458# CFG80211 needs to be enabled for MAC80211
459#
423# CONFIG_WIMAX is not set 460# CONFIG_WIMAX is not set
424# CONFIG_RFKILL is not set 461# CONFIG_RFKILL is not set
425# CONFIG_NET_9P is not set 462# CONFIG_NET_9P is not set
@@ -498,7 +535,6 @@ CONFIG_MTD_CFI_UTIL=y
498CONFIG_MTD_COMPLEX_MAPPINGS=y 535CONFIG_MTD_COMPLEX_MAPPINGS=y
499CONFIG_MTD_PHYSMAP=y 536CONFIG_MTD_PHYSMAP=y
500# CONFIG_MTD_PHYSMAP_COMPAT is not set 537# CONFIG_MTD_PHYSMAP_COMPAT is not set
501# CONFIG_MTD_GPIO_ADDR is not set
502# CONFIG_MTD_PLATRAM is not set 538# CONFIG_MTD_PLATRAM is not set
503 539
504# 540#
@@ -531,6 +567,10 @@ CONFIG_MTD_PHYSMAP=y
531CONFIG_BLK_DEV=y 567CONFIG_BLK_DEV=y
532# CONFIG_BLK_DEV_COW_COMMON is not set 568# CONFIG_BLK_DEV_COW_COMMON is not set
533# CONFIG_BLK_DEV_LOOP is not set 569# CONFIG_BLK_DEV_LOOP is not set
570
571#
572# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
573#
534# CONFIG_BLK_DEV_NBD is not set 574# CONFIG_BLK_DEV_NBD is not set
535# CONFIG_BLK_DEV_UB is not set 575# CONFIG_BLK_DEV_UB is not set
536# CONFIG_BLK_DEV_RAM is not set 576# CONFIG_BLK_DEV_RAM is not set
@@ -629,11 +669,12 @@ CONFIG_SH_ETH=y
629# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 669# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
630# CONFIG_B44 is not set 670# CONFIG_B44 is not set
631# CONFIG_KS8842 is not set 671# CONFIG_KS8842 is not set
672# CONFIG_KS8851_MLL is not set
632# CONFIG_NETDEV_1000 is not set 673# CONFIG_NETDEV_1000 is not set
633# CONFIG_NETDEV_10000 is not set 674# CONFIG_NETDEV_10000 is not set
634CONFIG_WLAN=y 675CONFIG_WLAN=y
635# CONFIG_WLAN_PRE80211 is not set 676# CONFIG_USB_ZD1201 is not set
636# CONFIG_WLAN_80211 is not set 677# CONFIG_HOSTAP is not set
637 678
638# 679#
639# Enable WiMAX (Networking options) to see the WiMAX drivers 680# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -662,6 +703,7 @@ CONFIG_WLAN=y
662CONFIG_INPUT=y 703CONFIG_INPUT=y
663# CONFIG_INPUT_FF_MEMLESS is not set 704# CONFIG_INPUT_FF_MEMLESS is not set
664# CONFIG_INPUT_POLLDEV is not set 705# CONFIG_INPUT_POLLDEV is not set
706# CONFIG_INPUT_SPARSEKMAP is not set
665 707
666# 708#
667# Userland interfaces 709# Userland interfaces
@@ -745,6 +787,7 @@ CONFIG_SSB_POSSIBLE=y
745# 787#
746# CONFIG_MFD_CORE is not set 788# CONFIG_MFD_CORE is not set
747# CONFIG_MFD_SM501 is not set 789# CONFIG_MFD_SM501 is not set
790# CONFIG_MFD_SH_MOBILE_SDHI is not set
748# CONFIG_HTC_PASIC3 is not set 791# CONFIG_HTC_PASIC3 is not set
749# CONFIG_MFD_TMIO is not set 792# CONFIG_MFD_TMIO is not set
750# CONFIG_REGULATOR is not set 793# CONFIG_REGULATOR is not set
@@ -1102,10 +1145,11 @@ CONFIG_DEBUG_FS=y
1102# CONFIG_HEADERS_CHECK is not set 1145# CONFIG_HEADERS_CHECK is not set
1103# CONFIG_DEBUG_KERNEL is not set 1146# CONFIG_DEBUG_KERNEL is not set
1104CONFIG_STACKTRACE=y 1147CONFIG_STACKTRACE=y
1105# CONFIG_DEBUG_BUGVERBOSE is not set 1148CONFIG_DEBUG_BUGVERBOSE=y
1106# CONFIG_DEBUG_MEMORY_INIT is not set 1149# CONFIG_DEBUG_MEMORY_INIT is not set
1107# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1150# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1108# CONFIG_LATENCYTOP is not set 1151# CONFIG_LATENCYTOP is not set
1152# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1109CONFIG_NOP_TRACER=y 1153CONFIG_NOP_TRACER=y
1110CONFIG_HAVE_FUNCTION_TRACER=y 1154CONFIG_HAVE_FUNCTION_TRACER=y
1111CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1155CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1125,7 +1169,6 @@ CONFIG_TRACING_SUPPORT=y
1125# CONFIG_SAMPLES is not set 1169# CONFIG_SAMPLES is not set
1126CONFIG_HAVE_ARCH_KGDB=y 1170CONFIG_HAVE_ARCH_KGDB=y
1127# CONFIG_SH_STANDARD_BIOS is not set 1171# CONFIG_SH_STANDARD_BIOS is not set
1128# CONFIG_EARLY_SCIF_CONSOLE is not set
1129# CONFIG_DWARF_UNWINDER is not set 1172# CONFIG_DWARF_UNWINDER is not set
1130 1173
1131# 1174#
@@ -1134,7 +1177,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1134# CONFIG_KEYS is not set 1177# CONFIG_KEYS is not set
1135# CONFIG_SECURITY is not set 1178# CONFIG_SECURITY is not set
1136# CONFIG_SECURITYFS is not set 1179# CONFIG_SECURITYFS is not set
1137# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1180# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1181# CONFIG_DEFAULT_SECURITY_SMACK is not set
1182# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1183CONFIG_DEFAULT_SECURITY_DAC=y
1184CONFIG_DEFAULT_SECURITY=""
1138CONFIG_CRYPTO=y 1185CONFIG_CRYPTO=y
1139 1186
1140# 1187#
diff --git a/arch/sh/configs/hp6xx_defconfig b/arch/sh/configs/hp6xx_defconfig
index f59be446f829..06644908631e 100644
--- a/arch/sh/configs/hp6xx_defconfig
+++ b/arch/sh/configs/hp6xx_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 17:59:45 2009 4# Mon Jan 4 11:30:31 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -30,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
35 36
@@ -57,6 +58,7 @@ CONFIG_BSD_PROCESS_ACCT=y
57# 58#
58CONFIG_TREE_RCU=y 59CONFIG_TREE_RCU=y
59# CONFIG_TREE_PREEMPT_RCU is not set 60# CONFIG_TREE_PREEMPT_RCU is not set
61# CONFIG_TINY_RCU is not set
60# CONFIG_RCU_TRACE is not set 62# CONFIG_RCU_TRACE is not set
61CONFIG_RCU_FANOUT=32 63CONFIG_RCU_FANOUT=32
62# CONFIG_RCU_FANOUT_EXACT is not set 64# CONFIG_RCU_FANOUT_EXACT is not set
@@ -92,6 +94,7 @@ CONFIG_EVENTFD=y
92CONFIG_SHMEM=y 94CONFIG_SHMEM=y
93CONFIG_AIO=y 95CONFIG_AIO=y
94CONFIG_HAVE_PERF_EVENTS=y 96CONFIG_HAVE_PERF_EVENTS=y
97CONFIG_PERF_USE_VMALLOC=y
95 98
96# 99#
97# Kernel Performance Events And Counters 100# Kernel Performance Events And Counters
@@ -109,6 +112,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
109CONFIG_HAVE_KPROBES=y 112CONFIG_HAVE_KPROBES=y
110CONFIG_HAVE_KRETPROBES=y 113CONFIG_HAVE_KRETPROBES=y
111CONFIG_HAVE_ARCH_TRACEHOOK=y 114CONFIG_HAVE_ARCH_TRACEHOOK=y
115CONFIG_HAVE_DMA_ATTRS=y
112CONFIG_HAVE_CLK=y 116CONFIG_HAVE_CLK=y
113CONFIG_HAVE_DMA_API_DEBUG=y 117CONFIG_HAVE_DMA_API_DEBUG=y
114 118
@@ -130,14 +134,41 @@ CONFIG_LBDAF=y
130# IO Schedulers 134# IO Schedulers
131# 135#
132CONFIG_IOSCHED_NOOP=y 136CONFIG_IOSCHED_NOOP=y
133CONFIG_IOSCHED_AS=y
134CONFIG_IOSCHED_DEADLINE=y 137CONFIG_IOSCHED_DEADLINE=y
135CONFIG_IOSCHED_CFQ=y 138CONFIG_IOSCHED_CFQ=y
136CONFIG_DEFAULT_AS=y
137# CONFIG_DEFAULT_DEADLINE is not set 139# CONFIG_DEFAULT_DEADLINE is not set
138# CONFIG_DEFAULT_CFQ is not set 140CONFIG_DEFAULT_CFQ=y
139# CONFIG_DEFAULT_NOOP is not set 141# CONFIG_DEFAULT_NOOP is not set
140CONFIG_DEFAULT_IOSCHED="anticipatory" 142CONFIG_DEFAULT_IOSCHED="cfq"
143# CONFIG_INLINE_SPIN_TRYLOCK is not set
144# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
145# CONFIG_INLINE_SPIN_LOCK is not set
146# CONFIG_INLINE_SPIN_LOCK_BH is not set
147# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
148# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
149CONFIG_INLINE_SPIN_UNLOCK=y
150# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
151CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
152# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
153# CONFIG_INLINE_READ_TRYLOCK is not set
154# CONFIG_INLINE_READ_LOCK is not set
155# CONFIG_INLINE_READ_LOCK_BH is not set
156# CONFIG_INLINE_READ_LOCK_IRQ is not set
157# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
158CONFIG_INLINE_READ_UNLOCK=y
159# CONFIG_INLINE_READ_UNLOCK_BH is not set
160CONFIG_INLINE_READ_UNLOCK_IRQ=y
161# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
162# CONFIG_INLINE_WRITE_TRYLOCK is not set
163# CONFIG_INLINE_WRITE_LOCK is not set
164# CONFIG_INLINE_WRITE_LOCK_BH is not set
165# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
166# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
167CONFIG_INLINE_WRITE_UNLOCK=y
168# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
169CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
170# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
171# CONFIG_MUTEX_SPIN_ON_OWNER is not set
141CONFIG_FREEZER=y 172CONFIG_FREEZER=y
142 173
143# 174#
@@ -213,8 +244,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
213# CONFIG_PHYS_ADDR_T_64BIT is not set 244# CONFIG_PHYS_ADDR_T_64BIT is not set
214CONFIG_ZONE_DMA_FLAG=0 245CONFIG_ZONE_DMA_FLAG=0
215CONFIG_NR_QUICK=2 246CONFIG_NR_QUICK=2
216CONFIG_HAVE_MLOCK=y
217CONFIG_HAVE_MLOCKED_PAGE_BIT=y
218# CONFIG_KSM is not set 247# CONFIG_KSM is not set
219CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 248CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
220 249
@@ -261,8 +290,8 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
261# 290#
262# DMA support 291# DMA support
263# 292#
264CONFIG_SH_DMA_API=y
265CONFIG_SH_DMA=y 293CONFIG_SH_DMA=y
294CONFIG_SH_DMA_API=y
266CONFIG_NR_ONCHIP_DMA_CHANNELS=6 295CONFIG_NR_ONCHIP_DMA_CHANNELS=6
267# CONFIG_NR_DMA_CHANNELS_BOOL is not set 296# CONFIG_NR_DMA_CHANNELS_BOOL is not set
268 297
@@ -313,7 +342,6 @@ CONFIG_ENTRY_OFFSET=0x00001000
313# 342#
314# CONFIG_ARCH_SUPPORTS_MSI is not set 343# CONFIG_ARCH_SUPPORTS_MSI is not set
315CONFIG_PCCARD=y 344CONFIG_PCCARD=y
316# CONFIG_PCMCIA_DEBUG is not set
317CONFIG_PCMCIA=y 345CONFIG_PCMCIA=y
318CONFIG_PCMCIA_LOAD_CIS=y 346CONFIG_PCMCIA_LOAD_CIS=y
319CONFIG_PCMCIA_IOCTL=y 347CONFIG_PCMCIA_IOCTL=y
@@ -363,6 +391,10 @@ CONFIG_EXTRA_FIRMWARE=""
363CONFIG_BLK_DEV=y 391CONFIG_BLK_DEV=y
364# CONFIG_BLK_DEV_COW_COMMON is not set 392# CONFIG_BLK_DEV_COW_COMMON is not set
365# CONFIG_BLK_DEV_LOOP is not set 393# CONFIG_BLK_DEV_LOOP is not set
394
395#
396# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
397#
366# CONFIG_BLK_DEV_RAM is not set 398# CONFIG_BLK_DEV_RAM is not set
367# CONFIG_CDROM_PKTCDVD is not set 399# CONFIG_CDROM_PKTCDVD is not set
368# CONFIG_BLK_DEV_HD is not set 400# CONFIG_BLK_DEV_HD is not set
@@ -432,6 +464,7 @@ CONFIG_PATA_PLATFORM=y
432CONFIG_INPUT=y 464CONFIG_INPUT=y
433# CONFIG_INPUT_FF_MEMLESS is not set 465# CONFIG_INPUT_FF_MEMLESS is not set
434CONFIG_INPUT_POLLDEV=y 466CONFIG_INPUT_POLLDEV=y
467# CONFIG_INPUT_SPARSEKMAP is not set
435 468
436# 469#
437# Userland interfaces 470# Userland interfaces
@@ -460,6 +493,7 @@ CONFIG_KEYBOARD_HP6XX=y
460# CONFIG_INPUT_TABLET is not set 493# CONFIG_INPUT_TABLET is not set
461CONFIG_INPUT_TOUCHSCREEN=y 494CONFIG_INPUT_TOUCHSCREEN=y
462# CONFIG_TOUCHSCREEN_AD7879 is not set 495# CONFIG_TOUCHSCREEN_AD7879 is not set
496# CONFIG_TOUCHSCREEN_DYNAPRO is not set
463# CONFIG_TOUCHSCREEN_FUJITSU is not set 497# CONFIG_TOUCHSCREEN_FUJITSU is not set
464# CONFIG_TOUCHSCREEN_GUNZE is not set 498# CONFIG_TOUCHSCREEN_GUNZE is not set
465# CONFIG_TOUCHSCREEN_ELO is not set 499# CONFIG_TOUCHSCREEN_ELO is not set
@@ -483,6 +517,7 @@ CONFIG_SERIO=y
483# CONFIG_SERIO_SERPORT is not set 517# CONFIG_SERIO_SERPORT is not set
484# CONFIG_SERIO_LIBPS2 is not set 518# CONFIG_SERIO_LIBPS2 is not set
485# CONFIG_SERIO_RAW is not set 519# CONFIG_SERIO_RAW is not set
520# CONFIG_SERIO_ALTERA_PS2 is not set
486# CONFIG_GAMEPORT is not set 521# CONFIG_GAMEPORT is not set
487 522
488# 523#
@@ -550,6 +585,7 @@ CONFIG_SSB_POSSIBLE=y
550# 585#
551# CONFIG_MFD_CORE is not set 586# CONFIG_MFD_CORE is not set
552# CONFIG_MFD_SM501 is not set 587# CONFIG_MFD_SM501 is not set
588# CONFIG_MFD_SH_MOBILE_SDHI is not set
553# CONFIG_HTC_PASIC3 is not set 589# CONFIG_HTC_PASIC3 is not set
554# CONFIG_MFD_TMIO is not set 590# CONFIG_MFD_TMIO is not set
555# CONFIG_REGULATOR is not set 591# CONFIG_REGULATOR is not set
@@ -659,7 +695,9 @@ CONFIG_RTC_INTF_DEV=y
659# CONFIG_RTC_DRV_M48T86 is not set 695# CONFIG_RTC_DRV_M48T86 is not set
660# CONFIG_RTC_DRV_M48T35 is not set 696# CONFIG_RTC_DRV_M48T35 is not set
661# CONFIG_RTC_DRV_M48T59 is not set 697# CONFIG_RTC_DRV_M48T59 is not set
698# CONFIG_RTC_DRV_MSM6242 is not set
662# CONFIG_RTC_DRV_BQ4802 is not set 699# CONFIG_RTC_DRV_BQ4802 is not set
700# CONFIG_RTC_DRV_RP5C01 is not set
663# CONFIG_RTC_DRV_V3020 is not set 701# CONFIG_RTC_DRV_V3020 is not set
664 702
665# 703#
@@ -684,6 +722,7 @@ CONFIG_EXT2_FS=y
684# CONFIG_EXT2_FS_XIP is not set 722# CONFIG_EXT2_FS_XIP is not set
685# CONFIG_EXT3_FS is not set 723# CONFIG_EXT3_FS is not set
686# CONFIG_EXT4_FS is not set 724# CONFIG_EXT4_FS is not set
725CONFIG_EXT4_USE_FOR_EXT23=y
687# CONFIG_REISERFS_FS is not set 726# CONFIG_REISERFS_FS is not set
688# CONFIG_JFS_FS is not set 727# CONFIG_JFS_FS is not set
689# CONFIG_FS_POSIX_ACL is not set 728# CONFIG_FS_POSIX_ACL is not set
@@ -731,7 +770,6 @@ CONFIG_PROC_SYSCTL=y
731CONFIG_PROC_PAGE_MONITOR=y 770CONFIG_PROC_PAGE_MONITOR=y
732CONFIG_SYSFS=y 771CONFIG_SYSFS=y
733# CONFIG_TMPFS is not set 772# CONFIG_TMPFS is not set
734# CONFIG_HUGETLBFS is not set
735# CONFIG_HUGETLB_PAGE is not set 773# CONFIG_HUGETLB_PAGE is not set
736# CONFIG_CONFIGFS_FS is not set 774# CONFIG_CONFIGFS_FS is not set
737CONFIG_MISC_FILESYSTEMS=y 775CONFIG_MISC_FILESYSTEMS=y
@@ -813,10 +851,11 @@ CONFIG_FRAME_WARN=1024
813# CONFIG_DEBUG_FS is not set 851# CONFIG_DEBUG_FS is not set
814# CONFIG_HEADERS_CHECK is not set 852# CONFIG_HEADERS_CHECK is not set
815# CONFIG_DEBUG_KERNEL is not set 853# CONFIG_DEBUG_KERNEL is not set
816# CONFIG_DEBUG_BUGVERBOSE is not set 854CONFIG_DEBUG_BUGVERBOSE=y
817# CONFIG_DEBUG_MEMORY_INIT is not set 855# CONFIG_DEBUG_MEMORY_INIT is not set
818# CONFIG_RCU_CPU_STALL_DETECTOR is not set 856# CONFIG_RCU_CPU_STALL_DETECTOR is not set
819# CONFIG_LATENCYTOP is not set 857# CONFIG_LATENCYTOP is not set
858# CONFIG_SYSCTL_SYSCALL_CHECK is not set
820CONFIG_HAVE_FUNCTION_TRACER=y 859CONFIG_HAVE_FUNCTION_TRACER=y
821CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 860CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
822CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 861CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -829,7 +868,6 @@ CONFIG_TRACING_SUPPORT=y
829# CONFIG_SAMPLES is not set 868# CONFIG_SAMPLES is not set
830CONFIG_HAVE_ARCH_KGDB=y 869CONFIG_HAVE_ARCH_KGDB=y
831# CONFIG_SH_STANDARD_BIOS is not set 870# CONFIG_SH_STANDARD_BIOS is not set
832# CONFIG_EARLY_SCIF_CONSOLE is not set
833# CONFIG_DWARF_UNWINDER is not set 871# CONFIG_DWARF_UNWINDER is not set
834 872
835# 873#
@@ -838,7 +876,11 @@ CONFIG_HAVE_ARCH_KGDB=y
838# CONFIG_KEYS is not set 876# CONFIG_KEYS is not set
839# CONFIG_SECURITY is not set 877# CONFIG_SECURITY is not set
840# CONFIG_SECURITYFS is not set 878# CONFIG_SECURITYFS is not set
841# CONFIG_SECURITY_FILE_CAPABILITIES is not set 879# CONFIG_DEFAULT_SECURITY_SELINUX is not set
880# CONFIG_DEFAULT_SECURITY_SMACK is not set
881# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
882CONFIG_DEFAULT_SECURITY_DAC=y
883CONFIG_DEFAULT_SECURITY=""
842CONFIG_CRYPTO=y 884CONFIG_CRYPTO=y
843 885
844# 886#
diff --git a/arch/sh/configs/kfr2r09-romimage_defconfig b/arch/sh/configs/kfr2r09-romimage_defconfig
index 02590e127f74..3d834e59e8f9 100644
--- a/arch/sh/configs/kfr2r09-romimage_defconfig
+++ b/arch/sh/configs/kfr2r09-romimage_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:01:48 2009 4# Mon Jan 4 11:31:09 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -60,6 +62,7 @@ CONFIG_BSD_PROCESS_ACCT=y
60# 62#
61CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +105,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 105CONFIG_SHMEM=y
103CONFIG_AIO=y 106CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 107CONFIG_HAVE_PERF_EVENTS=y
108CONFIG_PERF_USE_VMALLOC=y
105 109
106# 110#
107# Kernel Performance Events And Counters 111# Kernel Performance Events And Counters
@@ -119,6 +123,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
119CONFIG_HAVE_KPROBES=y 123CONFIG_HAVE_KPROBES=y
120CONFIG_HAVE_KRETPROBES=y 124CONFIG_HAVE_KRETPROBES=y
121CONFIG_HAVE_ARCH_TRACEHOOK=y 125CONFIG_HAVE_ARCH_TRACEHOOK=y
126CONFIG_HAVE_DMA_ATTRS=y
122CONFIG_HAVE_CLK=y 127CONFIG_HAVE_CLK=y
123CONFIG_HAVE_DMA_API_DEBUG=y 128CONFIG_HAVE_DMA_API_DEBUG=y
124 129
@@ -133,6 +138,35 @@ CONFIG_RT_MUTEXES=y
133CONFIG_BASE_SMALL=0 138CONFIG_BASE_SMALL=0
134# CONFIG_MODULES is not set 139# CONFIG_MODULES is not set
135# CONFIG_BLOCK is not set 140# CONFIG_BLOCK is not set
141# CONFIG_INLINE_SPIN_TRYLOCK is not set
142# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
143# CONFIG_INLINE_SPIN_LOCK is not set
144# CONFIG_INLINE_SPIN_LOCK_BH is not set
145# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
146# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
147CONFIG_INLINE_SPIN_UNLOCK=y
148# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
149CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
150# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
151# CONFIG_INLINE_READ_TRYLOCK is not set
152# CONFIG_INLINE_READ_LOCK is not set
153# CONFIG_INLINE_READ_LOCK_BH is not set
154# CONFIG_INLINE_READ_LOCK_IRQ is not set
155# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
156CONFIG_INLINE_READ_UNLOCK=y
157# CONFIG_INLINE_READ_UNLOCK_BH is not set
158CONFIG_INLINE_READ_UNLOCK_IRQ=y
159# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
160# CONFIG_INLINE_WRITE_TRYLOCK is not set
161# CONFIG_INLINE_WRITE_LOCK is not set
162# CONFIG_INLINE_WRITE_LOCK_BH is not set
163# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
164# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
165CONFIG_INLINE_WRITE_UNLOCK=y
166# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
167CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
168# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
169# CONFIG_MUTEX_SPIN_ON_OWNER is not set
136# CONFIG_FREEZER is not set 170# CONFIG_FREEZER is not set
137 171
138# 172#
@@ -188,6 +222,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
188CONFIG_MEMORY_START=0x08000000 222CONFIG_MEMORY_START=0x08000000
189CONFIG_MEMORY_SIZE=0x08000000 223CONFIG_MEMORY_SIZE=0x08000000
190CONFIG_29BIT=y 224CONFIG_29BIT=y
225# CONFIG_PMB_ENABLE is not set
191# CONFIG_X2TLB is not set 226# CONFIG_X2TLB is not set
192CONFIG_VSYSCALL=y 227CONFIG_VSYSCALL=y
193CONFIG_ARCH_FLATMEM_ENABLE=y 228CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -212,8 +247,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
212# CONFIG_PHYS_ADDR_T_64BIT is not set 247# CONFIG_PHYS_ADDR_T_64BIT is not set
213CONFIG_ZONE_DMA_FLAG=0 248CONFIG_ZONE_DMA_FLAG=0
214CONFIG_NR_QUICK=2 249CONFIG_NR_QUICK=2
215CONFIG_HAVE_MLOCK=y
216CONFIG_HAVE_MLOCKED_PAGE_BIT=y
217# CONFIG_KSM is not set 250# CONFIG_KSM is not set
218CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 251CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
219 252
@@ -247,7 +280,6 @@ CONFIG_SH_KFR2R09=y
247# 280#
248# CONFIG_SH_TIMER_TMU is not set 281# CONFIG_SH_TIMER_TMU is not set
249CONFIG_SH_TIMER_CMT=y 282CONFIG_SH_TIMER_CMT=y
250CONFIG_SH_PCLK_FREQ=33333333
251CONFIG_SH_CLK_CPG=y 283CONFIG_SH_CLK_CPG=y
252# CONFIG_NO_HZ is not set 284# CONFIG_NO_HZ is not set
253# CONFIG_HIGH_RES_TIMERS is not set 285# CONFIG_HIGH_RES_TIMERS is not set
@@ -429,6 +461,7 @@ CONFIG_HAVE_IDE=y
429CONFIG_INPUT=y 461CONFIG_INPUT=y
430# CONFIG_INPUT_FF_MEMLESS is not set 462# CONFIG_INPUT_FF_MEMLESS is not set
431# CONFIG_INPUT_POLLDEV is not set 463# CONFIG_INPUT_POLLDEV is not set
464# CONFIG_INPUT_SPARSEKMAP is not set
432 465
433# 466#
434# Userland interfaces 467# Userland interfaces
@@ -520,7 +553,6 @@ CONFIG_I2C_SH_MOBILE=y
520# 553#
521# Miscellaneous I2C Chip support 554# Miscellaneous I2C Chip support
522# 555#
523# CONFIG_DS1682 is not set
524# CONFIG_SENSORS_TSL2550 is not set 556# CONFIG_SENSORS_TSL2550 is not set
525# CONFIG_I2C_DEBUG_CORE is not set 557# CONFIG_I2C_DEBUG_CORE is not set
526# CONFIG_I2C_DEBUG_ALGO is not set 558# CONFIG_I2C_DEBUG_ALGO is not set
@@ -575,16 +607,19 @@ CONFIG_SSB_POSSIBLE=y
575# 607#
576# CONFIG_MFD_CORE is not set 608# CONFIG_MFD_CORE is not set
577# CONFIG_MFD_SM501 is not set 609# CONFIG_MFD_SM501 is not set
610# CONFIG_MFD_SH_MOBILE_SDHI is not set
578# CONFIG_HTC_PASIC3 is not set 611# CONFIG_HTC_PASIC3 is not set
579# CONFIG_TPS65010 is not set 612# CONFIG_TPS65010 is not set
580# CONFIG_TWL4030_CORE is not set 613# CONFIG_TWL4030_CORE is not set
581# CONFIG_MFD_TMIO is not set 614# CONFIG_MFD_TMIO is not set
582# CONFIG_PMIC_DA903X is not set 615# CONFIG_PMIC_DA903X is not set
616# CONFIG_PMIC_ADP5520 is not set
583# CONFIG_MFD_WM8400 is not set 617# CONFIG_MFD_WM8400 is not set
584# CONFIG_MFD_WM831X is not set 618# CONFIG_MFD_WM831X is not set
585# CONFIG_MFD_WM8350_I2C is not set 619# CONFIG_MFD_WM8350_I2C is not set
586# CONFIG_MFD_PCF50633 is not set 620# CONFIG_MFD_PCF50633 is not set
587# CONFIG_AB3100_CORE is not set 621# CONFIG_AB3100_CORE is not set
622# CONFIG_MFD_88PM8607 is not set
588# CONFIG_REGULATOR is not set 623# CONFIG_REGULATOR is not set
589# CONFIG_MEDIA_SUPPORT is not set 624# CONFIG_MEDIA_SUPPORT is not set
590 625
@@ -650,10 +685,12 @@ CONFIG_USB_GADGET_DUALSPEED=y
650# CONFIG_USB_ETH is not set 685# CONFIG_USB_ETH is not set
651# CONFIG_USB_GADGETFS is not set 686# CONFIG_USB_GADGETFS is not set
652# CONFIG_USB_FILE_STORAGE is not set 687# CONFIG_USB_FILE_STORAGE is not set
688# CONFIG_USB_MASS_STORAGE is not set
653# CONFIG_USB_G_SERIAL is not set 689# CONFIG_USB_G_SERIAL is not set
654# CONFIG_USB_MIDI_GADGET is not set 690# CONFIG_USB_MIDI_GADGET is not set
655# CONFIG_USB_G_PRINTER is not set 691# CONFIG_USB_G_PRINTER is not set
656CONFIG_USB_CDC_COMPOSITE=y 692CONFIG_USB_CDC_COMPOSITE=y
693# CONFIG_USB_G_MULTI is not set
657 694
658# 695#
659# OTG and related infrastructure 696# OTG and related infrastructure
@@ -725,7 +762,7 @@ CONFIG_FRAME_WARN=1024
725CONFIG_DEBUG_FS=y 762CONFIG_DEBUG_FS=y
726# CONFIG_HEADERS_CHECK is not set 763# CONFIG_HEADERS_CHECK is not set
727# CONFIG_DEBUG_KERNEL is not set 764# CONFIG_DEBUG_KERNEL is not set
728# CONFIG_DEBUG_BUGVERBOSE is not set 765CONFIG_DEBUG_BUGVERBOSE=y
729# CONFIG_DEBUG_MEMORY_INIT is not set 766# CONFIG_DEBUG_MEMORY_INIT is not set
730# CONFIG_RCU_CPU_STALL_DETECTOR is not set 767# CONFIG_RCU_CPU_STALL_DETECTOR is not set
731# CONFIG_LATENCYTOP is not set 768# CONFIG_LATENCYTOP is not set
@@ -743,7 +780,6 @@ CONFIG_TRACING_SUPPORT=y
743# CONFIG_SAMPLES is not set 780# CONFIG_SAMPLES is not set
744CONFIG_HAVE_ARCH_KGDB=y 781CONFIG_HAVE_ARCH_KGDB=y
745# CONFIG_SH_STANDARD_BIOS is not set 782# CONFIG_SH_STANDARD_BIOS is not set
746# CONFIG_EARLY_SCIF_CONSOLE is not set
747# CONFIG_DWARF_UNWINDER is not set 783# CONFIG_DWARF_UNWINDER is not set
748 784
749# 785#
@@ -752,7 +788,11 @@ CONFIG_HAVE_ARCH_KGDB=y
752# CONFIG_KEYS is not set 788# CONFIG_KEYS is not set
753# CONFIG_SECURITY is not set 789# CONFIG_SECURITY is not set
754# CONFIG_SECURITYFS is not set 790# CONFIG_SECURITYFS is not set
755# CONFIG_SECURITY_FILE_CAPABILITIES is not set 791# CONFIG_DEFAULT_SECURITY_SELINUX is not set
792# CONFIG_DEFAULT_SECURITY_SMACK is not set
793# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
794CONFIG_DEFAULT_SECURITY_DAC=y
795CONFIG_DEFAULT_SECURITY=""
756# CONFIG_CRYPTO is not set 796# CONFIG_CRYPTO is not set
757# CONFIG_BINARY_PRINTF is not set 797# CONFIG_BINARY_PRINTF is not set
758 798
diff --git a/arch/sh/configs/kfr2r09_defconfig b/arch/sh/configs/kfr2r09_defconfig
index 8ae65d294b11..f22be494ed99 100644
--- a/arch/sh/configs/kfr2r09_defconfig
+++ b/arch/sh/configs/kfr2r09_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.31 3# Linux kernel version: 2.6.33-rc2
4# Fri Sep 25 11:54:22 2009 4# Mon Jan 4 11:32:55 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -62,6 +64,7 @@ CONFIG_BSD_PROCESS_ACCT=y
62# 64#
63CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
64# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
65# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
66CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
67# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -104,6 +107,7 @@ CONFIG_EVENTFD=y
104CONFIG_SHMEM=y 107CONFIG_SHMEM=y
105CONFIG_AIO=y 108CONFIG_AIO=y
106CONFIG_HAVE_PERF_EVENTS=y 109CONFIG_HAVE_PERF_EVENTS=y
110CONFIG_PERF_USE_VMALLOC=y
107 111
108# 112#
109# Kernel Performance Events And Counters 113# Kernel Performance Events And Counters
@@ -121,6 +125,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
121CONFIG_HAVE_KPROBES=y 125CONFIG_HAVE_KPROBES=y
122CONFIG_HAVE_KRETPROBES=y 126CONFIG_HAVE_KRETPROBES=y
123CONFIG_HAVE_ARCH_TRACEHOOK=y 127CONFIG_HAVE_ARCH_TRACEHOOK=y
128CONFIG_HAVE_DMA_ATTRS=y
124CONFIG_HAVE_CLK=y 129CONFIG_HAVE_CLK=y
125CONFIG_HAVE_DMA_API_DEBUG=y 130CONFIG_HAVE_DMA_API_DEBUG=y
126 131
@@ -148,14 +153,41 @@ CONFIG_LBDAF=y
148# IO Schedulers 153# IO Schedulers
149# 154#
150CONFIG_IOSCHED_NOOP=y 155CONFIG_IOSCHED_NOOP=y
151# CONFIG_IOSCHED_AS is not set
152# CONFIG_IOSCHED_DEADLINE is not set 156# CONFIG_IOSCHED_DEADLINE is not set
153# CONFIG_IOSCHED_CFQ is not set 157# CONFIG_IOSCHED_CFQ is not set
154# CONFIG_DEFAULT_AS is not set
155# CONFIG_DEFAULT_DEADLINE is not set 158# CONFIG_DEFAULT_DEADLINE is not set
156# CONFIG_DEFAULT_CFQ is not set 159# CONFIG_DEFAULT_CFQ is not set
157CONFIG_DEFAULT_NOOP=y 160CONFIG_DEFAULT_NOOP=y
158CONFIG_DEFAULT_IOSCHED="noop" 161CONFIG_DEFAULT_IOSCHED="noop"
162# CONFIG_INLINE_SPIN_TRYLOCK is not set
163# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
164# CONFIG_INLINE_SPIN_LOCK is not set
165# CONFIG_INLINE_SPIN_LOCK_BH is not set
166# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
167# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
168# CONFIG_INLINE_SPIN_UNLOCK is not set
169# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
170# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
171# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
172# CONFIG_INLINE_READ_TRYLOCK is not set
173# CONFIG_INLINE_READ_LOCK is not set
174# CONFIG_INLINE_READ_LOCK_BH is not set
175# CONFIG_INLINE_READ_LOCK_IRQ is not set
176# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
177# CONFIG_INLINE_READ_UNLOCK is not set
178# CONFIG_INLINE_READ_UNLOCK_BH is not set
179# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
180# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
181# CONFIG_INLINE_WRITE_TRYLOCK is not set
182# CONFIG_INLINE_WRITE_LOCK is not set
183# CONFIG_INLINE_WRITE_LOCK_BH is not set
184# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
185# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
186# CONFIG_INLINE_WRITE_UNLOCK is not set
187# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
188# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
189# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
190# CONFIG_MUTEX_SPIN_ON_OWNER is not set
159# CONFIG_FREEZER is not set 191# CONFIG_FREEZER is not set
160 192
161# 193#
@@ -211,6 +243,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
211CONFIG_MEMORY_START=0x08000000 243CONFIG_MEMORY_START=0x08000000
212CONFIG_MEMORY_SIZE=0x08000000 244CONFIG_MEMORY_SIZE=0x08000000
213CONFIG_29BIT=y 245CONFIG_29BIT=y
246# CONFIG_PMB_ENABLE is not set
214# CONFIG_X2TLB is not set 247# CONFIG_X2TLB is not set
215CONFIG_VSYSCALL=y 248CONFIG_VSYSCALL=y
216CONFIG_ARCH_FLATMEM_ENABLE=y 249CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -235,8 +268,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
235# CONFIG_PHYS_ADDR_T_64BIT is not set 268# CONFIG_PHYS_ADDR_T_64BIT is not set
236CONFIG_ZONE_DMA_FLAG=0 269CONFIG_ZONE_DMA_FLAG=0
237CONFIG_NR_QUICK=2 270CONFIG_NR_QUICK=2
238CONFIG_HAVE_MLOCK=y
239CONFIG_HAVE_MLOCKED_PAGE_BIT=y
240# CONFIG_KSM is not set 271# CONFIG_KSM is not set
241CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 272CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
242 273
@@ -270,7 +301,6 @@ CONFIG_SH_KFR2R09=y
270# 301#
271# CONFIG_SH_TIMER_TMU is not set 302# CONFIG_SH_TIMER_TMU is not set
272CONFIG_SH_TIMER_CMT=y 303CONFIG_SH_TIMER_CMT=y
273CONFIG_SH_PCLK_FREQ=33333333
274CONFIG_SH_CLK_CPG=y 304CONFIG_SH_CLK_CPG=y
275CONFIG_TICK_ONESHOT=y 305CONFIG_TICK_ONESHOT=y
276CONFIG_NO_HZ=y 306CONFIG_NO_HZ=y
@@ -534,6 +564,10 @@ CONFIG_MTD_UBI_BEB_RESERVE=1
534CONFIG_BLK_DEV=y 564CONFIG_BLK_DEV=y
535# CONFIG_BLK_DEV_COW_COMMON is not set 565# CONFIG_BLK_DEV_COW_COMMON is not set
536# CONFIG_BLK_DEV_LOOP is not set 566# CONFIG_BLK_DEV_LOOP is not set
567
568#
569# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
570#
537# CONFIG_BLK_DEV_NBD is not set 571# CONFIG_BLK_DEV_NBD is not set
538# CONFIG_BLK_DEV_RAM is not set 572# CONFIG_BLK_DEV_RAM is not set
539# CONFIG_CDROM_PKTCDVD is not set 573# CONFIG_CDROM_PKTCDVD is not set
@@ -562,6 +596,7 @@ CONFIG_HAVE_IDE=y
562CONFIG_INPUT=y 596CONFIG_INPUT=y
563# CONFIG_INPUT_FF_MEMLESS is not set 597# CONFIG_INPUT_FF_MEMLESS is not set
564# CONFIG_INPUT_POLLDEV is not set 598# CONFIG_INPUT_POLLDEV is not set
599# CONFIG_INPUT_SPARSEKMAP is not set
565 600
566# 601#
567# Userland interfaces 602# Userland interfaces
@@ -668,7 +703,6 @@ CONFIG_I2C_SH_MOBILE=y
668# 703#
669# Miscellaneous I2C Chip support 704# Miscellaneous I2C Chip support
670# 705#
671# CONFIG_DS1682 is not set
672# CONFIG_SENSORS_TSL2550 is not set 706# CONFIG_SENSORS_TSL2550 is not set
673# CONFIG_I2C_DEBUG_CORE is not set 707# CONFIG_I2C_DEBUG_CORE is not set
674# CONFIG_I2C_DEBUG_ALGO is not set 708# CONFIG_I2C_DEBUG_ALGO is not set
@@ -723,16 +757,19 @@ CONFIG_SSB_POSSIBLE=y
723# 757#
724# CONFIG_MFD_CORE is not set 758# CONFIG_MFD_CORE is not set
725# CONFIG_MFD_SM501 is not set 759# CONFIG_MFD_SM501 is not set
760# CONFIG_MFD_SH_MOBILE_SDHI is not set
726# CONFIG_HTC_PASIC3 is not set 761# CONFIG_HTC_PASIC3 is not set
727# CONFIG_TPS65010 is not set 762# CONFIG_TPS65010 is not set
728# CONFIG_TWL4030_CORE is not set 763# CONFIG_TWL4030_CORE is not set
729# CONFIG_MFD_TMIO is not set 764# CONFIG_MFD_TMIO is not set
730# CONFIG_PMIC_DA903X is not set 765# CONFIG_PMIC_DA903X is not set
766# CONFIG_PMIC_ADP5520 is not set
731# CONFIG_MFD_WM8400 is not set 767# CONFIG_MFD_WM8400 is not set
732# CONFIG_MFD_WM831X is not set 768# CONFIG_MFD_WM831X is not set
733# CONFIG_MFD_WM8350_I2C is not set 769# CONFIG_MFD_WM8350_I2C is not set
734# CONFIG_MFD_PCF50633 is not set 770# CONFIG_MFD_PCF50633 is not set
735# CONFIG_AB3100_CORE is not set 771# CONFIG_AB3100_CORE is not set
772# CONFIG_MFD_88PM8607 is not set
736# CONFIG_REGULATOR is not set 773# CONFIG_REGULATOR is not set
737# CONFIG_MEDIA_SUPPORT is not set 774# CONFIG_MEDIA_SUPPORT is not set
738 775
@@ -847,10 +884,12 @@ CONFIG_USB_GADGET_DUALSPEED=y
847# CONFIG_USB_ETH is not set 884# CONFIG_USB_ETH is not set
848# CONFIG_USB_GADGETFS is not set 885# CONFIG_USB_GADGETFS is not set
849# CONFIG_USB_FILE_STORAGE is not set 886# CONFIG_USB_FILE_STORAGE is not set
887# CONFIG_USB_MASS_STORAGE is not set
850# CONFIG_USB_G_SERIAL is not set 888# CONFIG_USB_G_SERIAL is not set
851# CONFIG_USB_MIDI_GADGET is not set 889# CONFIG_USB_MIDI_GADGET is not set
852# CONFIG_USB_G_PRINTER is not set 890# CONFIG_USB_G_PRINTER is not set
853CONFIG_USB_CDC_COMPOSITE=y 891CONFIG_USB_CDC_COMPOSITE=m
892# CONFIG_USB_G_MULTI is not set
854 893
855# 894#
856# OTG and related infrastructure 895# OTG and related infrastructure
@@ -875,6 +914,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
875# CONFIG_MMC_SDHCI is not set 914# CONFIG_MMC_SDHCI is not set
876# CONFIG_MMC_AT91 is not set 915# CONFIG_MMC_AT91 is not set
877# CONFIG_MMC_ATMELMCI is not set 916# CONFIG_MMC_ATMELMCI is not set
917# CONFIG_MMC_TMIO is not set
878# CONFIG_MEMSTICK is not set 918# CONFIG_MEMSTICK is not set
879# CONFIG_NEW_LEDS is not set 919# CONFIG_NEW_LEDS is not set
880# CONFIG_ACCESSIBILITY is not set 920# CONFIG_ACCESSIBILITY is not set
@@ -906,6 +946,7 @@ CONFIG_RTC_INTF_DEV=y
906# CONFIG_RTC_DRV_PCF8563 is not set 946# CONFIG_RTC_DRV_PCF8563 is not set
907# CONFIG_RTC_DRV_PCF8583 is not set 947# CONFIG_RTC_DRV_PCF8583 is not set
908# CONFIG_RTC_DRV_M41T80 is not set 948# CONFIG_RTC_DRV_M41T80 is not set
949# CONFIG_RTC_DRV_BQ32K is not set
909# CONFIG_RTC_DRV_S35390A is not set 950# CONFIG_RTC_DRV_S35390A is not set
910# CONFIG_RTC_DRV_FM3130 is not set 951# CONFIG_RTC_DRV_FM3130 is not set
911# CONFIG_RTC_DRV_RX8581 is not set 952# CONFIG_RTC_DRV_RX8581 is not set
@@ -926,7 +967,9 @@ CONFIG_RTC_INTF_DEV=y
926# CONFIG_RTC_DRV_M48T86 is not set 967# CONFIG_RTC_DRV_M48T86 is not set
927# CONFIG_RTC_DRV_M48T35 is not set 968# CONFIG_RTC_DRV_M48T35 is not set
928# CONFIG_RTC_DRV_M48T59 is not set 969# CONFIG_RTC_DRV_M48T59 is not set
970# CONFIG_RTC_DRV_MSM6242 is not set
929# CONFIG_RTC_DRV_BQ4802 is not set 971# CONFIG_RTC_DRV_BQ4802 is not set
972# CONFIG_RTC_DRV_RP5C01 is not set
930# CONFIG_RTC_DRV_V3020 is not set 973# CONFIG_RTC_DRV_V3020 is not set
931 974
932# 975#
@@ -953,6 +996,7 @@ CONFIG_UIO_PDRV_GENIRQ=y
953# CONFIG_EXT2_FS is not set 996# CONFIG_EXT2_FS is not set
954# CONFIG_EXT3_FS is not set 997# CONFIG_EXT3_FS is not set
955# CONFIG_EXT4_FS is not set 998# CONFIG_EXT4_FS is not set
999CONFIG_EXT4_USE_FOR_EXT23=y
956# CONFIG_REISERFS_FS is not set 1000# CONFIG_REISERFS_FS is not set
957# CONFIG_JFS_FS is not set 1001# CONFIG_JFS_FS is not set
958# CONFIG_FS_POSIX_ACL is not set 1002# CONFIG_FS_POSIX_ACL is not set
@@ -1027,7 +1071,7 @@ CONFIG_FRAME_WARN=1024
1027CONFIG_DEBUG_FS=y 1071CONFIG_DEBUG_FS=y
1028# CONFIG_HEADERS_CHECK is not set 1072# CONFIG_HEADERS_CHECK is not set
1029# CONFIG_DEBUG_KERNEL is not set 1073# CONFIG_DEBUG_KERNEL is not set
1030# CONFIG_DEBUG_BUGVERBOSE is not set 1074CONFIG_DEBUG_BUGVERBOSE=y
1031# CONFIG_DEBUG_MEMORY_INIT is not set 1075# CONFIG_DEBUG_MEMORY_INIT is not set
1032# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1076# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1033# CONFIG_LATENCYTOP is not set 1077# CONFIG_LATENCYTOP is not set
@@ -1045,7 +1089,6 @@ CONFIG_TRACING_SUPPORT=y
1045# CONFIG_SAMPLES is not set 1089# CONFIG_SAMPLES is not set
1046CONFIG_HAVE_ARCH_KGDB=y 1090CONFIG_HAVE_ARCH_KGDB=y
1047# CONFIG_SH_STANDARD_BIOS is not set 1091# CONFIG_SH_STANDARD_BIOS is not set
1048# CONFIG_EARLY_SCIF_CONSOLE is not set
1049# CONFIG_DWARF_UNWINDER is not set 1092# CONFIG_DWARF_UNWINDER is not set
1050 1093
1051# 1094#
@@ -1054,7 +1097,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1054# CONFIG_KEYS is not set 1097# CONFIG_KEYS is not set
1055# CONFIG_SECURITY is not set 1098# CONFIG_SECURITY is not set
1056# CONFIG_SECURITYFS is not set 1099# CONFIG_SECURITYFS is not set
1057# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1100# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1101# CONFIG_DEFAULT_SECURITY_SMACK is not set
1102# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1103CONFIG_DEFAULT_SECURITY_DAC=y
1104CONFIG_DEFAULT_SECURITY=""
1058# CONFIG_CRYPTO is not set 1105# CONFIG_CRYPTO is not set
1059# CONFIG_BINARY_PRINTF is not set 1106# CONFIG_BINARY_PRINTF is not set
1060 1107
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index c2a9a3996388..2a42d4977fe4 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:05:49 2009 4# Mon Jan 4 11:35:31 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -60,6 +62,7 @@ CONFIG_SYSVIPC_SYSCTL=y
60# 62#
61CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -94,6 +97,7 @@ CONFIG_EVENTFD=y
94CONFIG_SHMEM=y 97CONFIG_SHMEM=y
95CONFIG_AIO=y 98CONFIG_AIO=y
96CONFIG_HAVE_PERF_EVENTS=y 99CONFIG_HAVE_PERF_EVENTS=y
100CONFIG_PERF_USE_VMALLOC=y
97 101
98# 102#
99# Kernel Performance Events And Counters 103# Kernel Performance Events And Counters
@@ -113,6 +117,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
113CONFIG_HAVE_KPROBES=y 117CONFIG_HAVE_KPROBES=y
114CONFIG_HAVE_KRETPROBES=y 118CONFIG_HAVE_KRETPROBES=y
115CONFIG_HAVE_ARCH_TRACEHOOK=y 119CONFIG_HAVE_ARCH_TRACEHOOK=y
120CONFIG_HAVE_DMA_ATTRS=y
116CONFIG_HAVE_CLK=y 121CONFIG_HAVE_CLK=y
117CONFIG_HAVE_DMA_API_DEBUG=y 122CONFIG_HAVE_DMA_API_DEBUG=y
118 123
@@ -139,14 +144,41 @@ CONFIG_LBDAF=y
139# IO Schedulers 144# IO Schedulers
140# 145#
141CONFIG_IOSCHED_NOOP=y 146CONFIG_IOSCHED_NOOP=y
142CONFIG_IOSCHED_AS=y
143CONFIG_IOSCHED_DEADLINE=y 147CONFIG_IOSCHED_DEADLINE=y
144CONFIG_IOSCHED_CFQ=y 148CONFIG_IOSCHED_CFQ=y
145CONFIG_DEFAULT_AS=y
146# CONFIG_DEFAULT_DEADLINE is not set 149# CONFIG_DEFAULT_DEADLINE is not set
147# CONFIG_DEFAULT_CFQ is not set 150CONFIG_DEFAULT_CFQ=y
148# CONFIG_DEFAULT_NOOP is not set 151# CONFIG_DEFAULT_NOOP is not set
149CONFIG_DEFAULT_IOSCHED="anticipatory" 152CONFIG_DEFAULT_IOSCHED="cfq"
153# CONFIG_INLINE_SPIN_TRYLOCK is not set
154# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
155# CONFIG_INLINE_SPIN_LOCK is not set
156# CONFIG_INLINE_SPIN_LOCK_BH is not set
157# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
158# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
159CONFIG_INLINE_SPIN_UNLOCK=y
160# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
161CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
162# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
163# CONFIG_INLINE_READ_TRYLOCK is not set
164# CONFIG_INLINE_READ_LOCK is not set
165# CONFIG_INLINE_READ_LOCK_BH is not set
166# CONFIG_INLINE_READ_LOCK_IRQ is not set
167# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
168CONFIG_INLINE_READ_UNLOCK=y
169# CONFIG_INLINE_READ_UNLOCK_BH is not set
170CONFIG_INLINE_READ_UNLOCK_IRQ=y
171# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
172# CONFIG_INLINE_WRITE_TRYLOCK is not set
173# CONFIG_INLINE_WRITE_LOCK is not set
174# CONFIG_INLINE_WRITE_LOCK_BH is not set
175# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
176# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
177CONFIG_INLINE_WRITE_UNLOCK=y
178# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
179CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
180# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
181# CONFIG_MUTEX_SPIN_ON_OWNER is not set
150# CONFIG_FREEZER is not set 182# CONFIG_FREEZER is not set
151 183
152# 184#
@@ -222,8 +254,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
222# CONFIG_PHYS_ADDR_T_64BIT is not set 254# CONFIG_PHYS_ADDR_T_64BIT is not set
223CONFIG_ZONE_DMA_FLAG=0 255CONFIG_ZONE_DMA_FLAG=0
224CONFIG_NR_QUICK=2 256CONFIG_NR_QUICK=2
225CONFIG_HAVE_MLOCK=y
226CONFIG_HAVE_MLOCKED_PAGE_BIT=y
227# CONFIG_KSM is not set 257# CONFIG_KSM is not set
228CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 258CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
229 259
@@ -311,7 +341,6 @@ CONFIG_GUSA=y
311CONFIG_ZERO_PAGE_OFFSET=0x00001000 341CONFIG_ZERO_PAGE_OFFSET=0x00001000
312CONFIG_BOOT_LINK_OFFSET=0x00800000 342CONFIG_BOOT_LINK_OFFSET=0x00800000
313CONFIG_ENTRY_OFFSET=0x00001000 343CONFIG_ENTRY_OFFSET=0x00001000
314# CONFIG_UBC_WAKEUP is not set
315# CONFIG_CMDLINE_OVERWRITE is not set 344# CONFIG_CMDLINE_OVERWRITE is not set
316# CONFIG_CMDLINE_EXTEND is not set 345# CONFIG_CMDLINE_EXTEND is not set
317 346
@@ -319,14 +348,12 @@ CONFIG_ENTRY_OFFSET=0x00001000
319# Bus options 348# Bus options
320# 349#
321CONFIG_PCI=y 350CONFIG_PCI=y
322CONFIG_SH_PCIDMA_NONCOHERENT=y
323# CONFIG_PCIEPORTBUS is not set 351# CONFIG_PCIEPORTBUS is not set
324# CONFIG_ARCH_SUPPORTS_MSI is not set 352# CONFIG_ARCH_SUPPORTS_MSI is not set
325CONFIG_PCI_LEGACY=y 353CONFIG_PCI_LEGACY=y
326# CONFIG_PCI_STUB is not set 354# CONFIG_PCI_STUB is not set
327# CONFIG_PCI_IOV is not set 355# CONFIG_PCI_IOV is not set
328CONFIG_PCCARD=y 356CONFIG_PCCARD=y
329# CONFIG_PCMCIA_DEBUG is not set
330CONFIG_PCMCIA=y 357CONFIG_PCMCIA=y
331CONFIG_PCMCIA_LOAD_CIS=y 358CONFIG_PCMCIA_LOAD_CIS=y
332CONFIG_PCMCIA_IOCTL=y 359CONFIG_PCMCIA_IOCTL=y
@@ -461,9 +488,6 @@ CONFIG_ATALK=m
461# CONFIG_AF_RXRPC is not set 488# CONFIG_AF_RXRPC is not set
462CONFIG_WIRELESS=y 489CONFIG_WIRELESS=y
463# CONFIG_CFG80211 is not set 490# CONFIG_CFG80211 is not set
464CONFIG_CFG80211_DEFAULT_PS_VALUE=0
465# CONFIG_WIRELESS_OLD_REGULATORY is not set
466# CONFIG_WIRELESS_EXT is not set
467# CONFIG_LIB80211 is not set 491# CONFIG_LIB80211 is not set
468 492
469# 493#
@@ -498,6 +522,10 @@ CONFIG_BLK_DEV=y
498# CONFIG_BLK_DEV_COW_COMMON is not set 522# CONFIG_BLK_DEV_COW_COMMON is not set
499CONFIG_BLK_DEV_LOOP=y 523CONFIG_BLK_DEV_LOOP=y
500# CONFIG_BLK_DEV_CRYPTOLOOP is not set 524# CONFIG_BLK_DEV_CRYPTOLOOP is not set
525
526#
527# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
528#
501# CONFIG_BLK_DEV_NBD is not set 529# CONFIG_BLK_DEV_NBD is not set
502# CONFIG_BLK_DEV_SX8 is not set 530# CONFIG_BLK_DEV_SX8 is not set
503# CONFIG_BLK_DEV_UB is not set 531# CONFIG_BLK_DEV_UB is not set
@@ -618,8 +646,11 @@ CONFIG_SCSI_LOWLEVEL=y
618# CONFIG_ISCSI_TCP is not set 646# CONFIG_ISCSI_TCP is not set
619# CONFIG_SCSI_CXGB3_ISCSI is not set 647# CONFIG_SCSI_CXGB3_ISCSI is not set
620# CONFIG_SCSI_BNX2_ISCSI is not set 648# CONFIG_SCSI_BNX2_ISCSI is not set
649# CONFIG_BE2ISCSI is not set
621# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 650# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
651# CONFIG_SCSI_HPSA is not set
622# CONFIG_SCSI_3W_9XXX is not set 652# CONFIG_SCSI_3W_9XXX is not set
653# CONFIG_SCSI_3W_SAS is not set
623# CONFIG_SCSI_ACARD is not set 654# CONFIG_SCSI_ACARD is not set
624# CONFIG_SCSI_AACRAID is not set 655# CONFIG_SCSI_AACRAID is not set
625# CONFIG_SCSI_AIC7XXX is not set 656# CONFIG_SCSI_AIC7XXX is not set
@@ -652,7 +683,9 @@ CONFIG_SCSI_LOWLEVEL=y
652# CONFIG_SCSI_NSP32 is not set 683# CONFIG_SCSI_NSP32 is not set
653# CONFIG_SCSI_DEBUG is not set 684# CONFIG_SCSI_DEBUG is not set
654# CONFIG_SCSI_PMCRAID is not set 685# CONFIG_SCSI_PMCRAID is not set
686# CONFIG_SCSI_PM8001 is not set
655# CONFIG_SCSI_SRP is not set 687# CONFIG_SCSI_SRP is not set
688# CONFIG_SCSI_BFA_FC is not set
656# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 689# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
657# CONFIG_SCSI_DH is not set 690# CONFIG_SCSI_DH is not set
658# CONFIG_SCSI_OSD_INITIATOR is not set 691# CONFIG_SCSI_OSD_INITIATOR is not set
@@ -733,6 +766,7 @@ CONFIG_8139CP=y
733# CONFIG_SUNDANCE is not set 766# CONFIG_SUNDANCE is not set
734# CONFIG_TLAN is not set 767# CONFIG_TLAN is not set
735# CONFIG_KS8842 is not set 768# CONFIG_KS8842 is not set
769# CONFIG_KS8851_MLL is not set
736# CONFIG_VIA_RHINE is not set 770# CONFIG_VIA_RHINE is not set
737# CONFIG_SC92031 is not set 771# CONFIG_SC92031 is not set
738# CONFIG_ATL2 is not set 772# CONFIG_ATL2 is not set
@@ -781,8 +815,13 @@ CONFIG_CHELSIO_T3_DEPENDS=y
781# CONFIG_BE2NET is not set 815# CONFIG_BE2NET is not set
782# CONFIG_TR is not set 816# CONFIG_TR is not set
783CONFIG_WLAN=y 817CONFIG_WLAN=y
784# CONFIG_WLAN_PRE80211 is not set 818# CONFIG_PCMCIA_RAYCS is not set
785# CONFIG_WLAN_80211 is not set 819# CONFIG_ATMEL is not set
820# CONFIG_AIRO_CS is not set
821# CONFIG_PCMCIA_WL3501 is not set
822# CONFIG_PRISM54 is not set
823# CONFIG_USB_ZD1201 is not set
824# CONFIG_HOSTAP is not set
786 825
787# 826#
788# Enable WiMAX (Networking options) to see the WiMAX drivers 827# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -806,6 +845,7 @@ CONFIG_USB_RTL8150=m
806# CONFIG_NETCONSOLE is not set 845# CONFIG_NETCONSOLE is not set
807# CONFIG_NETPOLL is not set 846# CONFIG_NETPOLL is not set
808# CONFIG_NET_POLL_CONTROLLER is not set 847# CONFIG_NET_POLL_CONTROLLER is not set
848# CONFIG_VMXNET3 is not set
809# CONFIG_ISDN is not set 849# CONFIG_ISDN is not set
810# CONFIG_PHONE is not set 850# CONFIG_PHONE is not set
811 851
@@ -815,6 +855,7 @@ CONFIG_USB_RTL8150=m
815CONFIG_INPUT=y 855CONFIG_INPUT=y
816CONFIG_INPUT_FF_MEMLESS=m 856CONFIG_INPUT_FF_MEMLESS=m
817# CONFIG_INPUT_POLLDEV is not set 857# CONFIG_INPUT_POLLDEV is not set
858# CONFIG_INPUT_SPARSEKMAP is not set
818 859
819# 860#
820# Userland interfaces 861# Userland interfaces
@@ -933,6 +974,7 @@ CONFIG_SSB_POSSIBLE=y
933# 974#
934# CONFIG_MFD_CORE is not set 975# CONFIG_MFD_CORE is not set
935# CONFIG_MFD_SM501 is not set 976# CONFIG_MFD_SM501 is not set
977# CONFIG_MFD_SH_MOBILE_SDHI is not set
936# CONFIG_HTC_PASIC3 is not set 978# CONFIG_HTC_PASIC3 is not set
937# CONFIG_MFD_TMIO is not set 979# CONFIG_MFD_TMIO is not set
938# CONFIG_REGULATOR is not set 980# CONFIG_REGULATOR is not set
@@ -1371,10 +1413,11 @@ CONFIG_FRAME_WARN=1024
1371# CONFIG_DEBUG_FS is not set 1413# CONFIG_DEBUG_FS is not set
1372# CONFIG_HEADERS_CHECK is not set 1414# CONFIG_HEADERS_CHECK is not set
1373# CONFIG_DEBUG_KERNEL is not set 1415# CONFIG_DEBUG_KERNEL is not set
1374# CONFIG_DEBUG_BUGVERBOSE is not set 1416CONFIG_DEBUG_BUGVERBOSE=y
1375# CONFIG_DEBUG_MEMORY_INIT is not set 1417# CONFIG_DEBUG_MEMORY_INIT is not set
1376# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1418# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1377# CONFIG_LATENCYTOP is not set 1419# CONFIG_LATENCYTOP is not set
1420# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1378CONFIG_HAVE_FUNCTION_TRACER=y 1421CONFIG_HAVE_FUNCTION_TRACER=y
1379CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1422CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1380CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 1423CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -1387,8 +1430,6 @@ CONFIG_TRACING_SUPPORT=y
1387# CONFIG_SAMPLES is not set 1430# CONFIG_SAMPLES is not set
1388CONFIG_HAVE_ARCH_KGDB=y 1431CONFIG_HAVE_ARCH_KGDB=y
1389CONFIG_SH_STANDARD_BIOS=y 1432CONFIG_SH_STANDARD_BIOS=y
1390# CONFIG_EARLY_SCIF_CONSOLE is not set
1391# CONFIG_EARLY_PRINTK is not set
1392# CONFIG_DWARF_UNWINDER is not set 1433# CONFIG_DWARF_UNWINDER is not set
1393 1434
1394# 1435#
@@ -1397,7 +1438,11 @@ CONFIG_SH_STANDARD_BIOS=y
1397# CONFIG_KEYS is not set 1438# CONFIG_KEYS is not set
1398# CONFIG_SECURITY is not set 1439# CONFIG_SECURITY is not set
1399# CONFIG_SECURITYFS is not set 1440# CONFIG_SECURITYFS is not set
1400# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1441# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1442# CONFIG_DEFAULT_SECURITY_SMACK is not set
1443# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1444CONFIG_DEFAULT_SECURITY_DAC=y
1445CONFIG_DEFAULT_SECURITY=""
1401CONFIG_CRYPTO=y 1446CONFIG_CRYPTO=y
1402 1447
1403# 1448#
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index ec0c0b432c74..f2f1f8c73b2f 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:09:59 2009 4# Mon Jan 4 11:37:01 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -60,6 +62,7 @@ CONFIG_SYSVIPC_SYSCTL=y
60# 62#
61CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -94,6 +97,7 @@ CONFIG_EVENTFD=y
94CONFIG_SHMEM=y 97CONFIG_SHMEM=y
95CONFIG_AIO=y 98CONFIG_AIO=y
96CONFIG_HAVE_PERF_EVENTS=y 99CONFIG_HAVE_PERF_EVENTS=y
100CONFIG_PERF_USE_VMALLOC=y
97 101
98# 102#
99# Kernel Performance Events And Counters 103# Kernel Performance Events And Counters
@@ -113,6 +117,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
113CONFIG_HAVE_KPROBES=y 117CONFIG_HAVE_KPROBES=y
114CONFIG_HAVE_KRETPROBES=y 118CONFIG_HAVE_KRETPROBES=y
115CONFIG_HAVE_ARCH_TRACEHOOK=y 119CONFIG_HAVE_ARCH_TRACEHOOK=y
120CONFIG_HAVE_DMA_ATTRS=y
116CONFIG_HAVE_CLK=y 121CONFIG_HAVE_CLK=y
117CONFIG_HAVE_DMA_API_DEBUG=y 122CONFIG_HAVE_DMA_API_DEBUG=y
118 123
@@ -139,14 +144,41 @@ CONFIG_LBDAF=y
139# IO Schedulers 144# IO Schedulers
140# 145#
141CONFIG_IOSCHED_NOOP=y 146CONFIG_IOSCHED_NOOP=y
142CONFIG_IOSCHED_AS=y
143CONFIG_IOSCHED_DEADLINE=y 147CONFIG_IOSCHED_DEADLINE=y
144CONFIG_IOSCHED_CFQ=y 148CONFIG_IOSCHED_CFQ=y
145CONFIG_DEFAULT_AS=y
146# CONFIG_DEFAULT_DEADLINE is not set 149# CONFIG_DEFAULT_DEADLINE is not set
147# CONFIG_DEFAULT_CFQ is not set 150CONFIG_DEFAULT_CFQ=y
148# CONFIG_DEFAULT_NOOP is not set 151# CONFIG_DEFAULT_NOOP is not set
149CONFIG_DEFAULT_IOSCHED="anticipatory" 152CONFIG_DEFAULT_IOSCHED="cfq"
153# CONFIG_INLINE_SPIN_TRYLOCK is not set
154# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
155# CONFIG_INLINE_SPIN_LOCK is not set
156# CONFIG_INLINE_SPIN_LOCK_BH is not set
157# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
158# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
159CONFIG_INLINE_SPIN_UNLOCK=y
160# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
161CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
162# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
163# CONFIG_INLINE_READ_TRYLOCK is not set
164# CONFIG_INLINE_READ_LOCK is not set
165# CONFIG_INLINE_READ_LOCK_BH is not set
166# CONFIG_INLINE_READ_LOCK_IRQ is not set
167# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
168CONFIG_INLINE_READ_UNLOCK=y
169# CONFIG_INLINE_READ_UNLOCK_BH is not set
170CONFIG_INLINE_READ_UNLOCK_IRQ=y
171# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
172# CONFIG_INLINE_WRITE_TRYLOCK is not set
173# CONFIG_INLINE_WRITE_LOCK is not set
174# CONFIG_INLINE_WRITE_LOCK_BH is not set
175# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
176# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
177CONFIG_INLINE_WRITE_UNLOCK=y
178# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
179CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
180# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
181# CONFIG_MUTEX_SPIN_ON_OWNER is not set
150# CONFIG_FREEZER is not set 182# CONFIG_FREEZER is not set
151 183
152# 184#
@@ -222,8 +254,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
222# CONFIG_PHYS_ADDR_T_64BIT is not set 254# CONFIG_PHYS_ADDR_T_64BIT is not set
223CONFIG_ZONE_DMA_FLAG=0 255CONFIG_ZONE_DMA_FLAG=0
224CONFIG_NR_QUICK=2 256CONFIG_NR_QUICK=2
225CONFIG_HAVE_MLOCK=y
226CONFIG_HAVE_MLOCKED_PAGE_BIT=y
227# CONFIG_KSM is not set 257# CONFIG_KSM is not set
228CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 258CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
229 259
@@ -311,7 +341,6 @@ CONFIG_GUSA=y
311CONFIG_ZERO_PAGE_OFFSET=0x00001000 341CONFIG_ZERO_PAGE_OFFSET=0x00001000
312CONFIG_BOOT_LINK_OFFSET=0x00800000 342CONFIG_BOOT_LINK_OFFSET=0x00800000
313CONFIG_ENTRY_OFFSET=0x00001000 343CONFIG_ENTRY_OFFSET=0x00001000
314# CONFIG_UBC_WAKEUP is not set
315CONFIG_CMDLINE_OVERWRITE=y 344CONFIG_CMDLINE_OVERWRITE=y
316# CONFIG_CMDLINE_EXTEND is not set 345# CONFIG_CMDLINE_EXTEND is not set
317CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1" 346CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1"
@@ -320,14 +349,12 @@ CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1"
320# Bus options 349# Bus options
321# 350#
322CONFIG_PCI=y 351CONFIG_PCI=y
323CONFIG_SH_PCIDMA_NONCOHERENT=y
324# CONFIG_PCIEPORTBUS is not set 352# CONFIG_PCIEPORTBUS is not set
325# CONFIG_ARCH_SUPPORTS_MSI is not set 353# CONFIG_ARCH_SUPPORTS_MSI is not set
326CONFIG_PCI_LEGACY=y 354CONFIG_PCI_LEGACY=y
327# CONFIG_PCI_STUB is not set 355# CONFIG_PCI_STUB is not set
328# CONFIG_PCI_IOV is not set 356# CONFIG_PCI_IOV is not set
329CONFIG_PCCARD=y 357CONFIG_PCCARD=y
330CONFIG_PCMCIA_DEBUG=y
331CONFIG_PCMCIA=y 358CONFIG_PCMCIA=y
332CONFIG_PCMCIA_LOAD_CIS=y 359CONFIG_PCMCIA_LOAD_CIS=y
333CONFIG_PCMCIA_IOCTL=y 360CONFIG_PCMCIA_IOCTL=y
@@ -459,9 +486,6 @@ CONFIG_NETFILTER_ADVANCED=y
459# CONFIG_AF_RXRPC is not set 486# CONFIG_AF_RXRPC is not set
460CONFIG_WIRELESS=y 487CONFIG_WIRELESS=y
461# CONFIG_CFG80211 is not set 488# CONFIG_CFG80211 is not set
462CONFIG_CFG80211_DEFAULT_PS_VALUE=0
463# CONFIG_WIRELESS_OLD_REGULATORY is not set
464# CONFIG_WIRELESS_EXT is not set
465# CONFIG_LIB80211 is not set 489# CONFIG_LIB80211 is not set
466 490
467# 491#
@@ -496,6 +520,10 @@ CONFIG_BLK_DEV=y
496# CONFIG_BLK_DEV_COW_COMMON is not set 520# CONFIG_BLK_DEV_COW_COMMON is not set
497CONFIG_BLK_DEV_LOOP=y 521CONFIG_BLK_DEV_LOOP=y
498# CONFIG_BLK_DEV_CRYPTOLOOP is not set 522# CONFIG_BLK_DEV_CRYPTOLOOP is not set
523
524#
525# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
526#
499# CONFIG_BLK_DEV_NBD is not set 527# CONFIG_BLK_DEV_NBD is not set
500# CONFIG_BLK_DEV_SX8 is not set 528# CONFIG_BLK_DEV_SX8 is not set
501CONFIG_BLK_DEV_RAM=y 529CONFIG_BLK_DEV_RAM=y
@@ -558,8 +586,11 @@ CONFIG_SCSI_LOWLEVEL=y
558# CONFIG_ISCSI_TCP is not set 586# CONFIG_ISCSI_TCP is not set
559# CONFIG_SCSI_CXGB3_ISCSI is not set 587# CONFIG_SCSI_CXGB3_ISCSI is not set
560# CONFIG_SCSI_BNX2_ISCSI is not set 588# CONFIG_SCSI_BNX2_ISCSI is not set
589# CONFIG_BE2ISCSI is not set
561# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 590# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
591# CONFIG_SCSI_HPSA is not set
562# CONFIG_SCSI_3W_9XXX is not set 592# CONFIG_SCSI_3W_9XXX is not set
593# CONFIG_SCSI_3W_SAS is not set
563# CONFIG_SCSI_ACARD is not set 594# CONFIG_SCSI_ACARD is not set
564# CONFIG_SCSI_AACRAID is not set 595# CONFIG_SCSI_AACRAID is not set
565# CONFIG_SCSI_AIC7XXX is not set 596# CONFIG_SCSI_AIC7XXX is not set
@@ -593,7 +624,9 @@ CONFIG_SCSI_LOWLEVEL=y
593# CONFIG_SCSI_NSP32 is not set 624# CONFIG_SCSI_NSP32 is not set
594# CONFIG_SCSI_DEBUG is not set 625# CONFIG_SCSI_DEBUG is not set
595# CONFIG_SCSI_PMCRAID is not set 626# CONFIG_SCSI_PMCRAID is not set
627# CONFIG_SCSI_PM8001 is not set
596# CONFIG_SCSI_SRP is not set 628# CONFIG_SCSI_SRP is not set
629# CONFIG_SCSI_BFA_FC is not set
597# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 630# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
598# CONFIG_SCSI_DH is not set 631# CONFIG_SCSI_DH is not set
599# CONFIG_SCSI_OSD_INITIATOR is not set 632# CONFIG_SCSI_OSD_INITIATOR is not set
@@ -648,15 +681,16 @@ CONFIG_ATA_SFF=y
648# CONFIG_PATA_OPTI is not set 681# CONFIG_PATA_OPTI is not set
649# CONFIG_PATA_OPTIDMA is not set 682# CONFIG_PATA_OPTIDMA is not set
650# CONFIG_PATA_PCMCIA is not set 683# CONFIG_PATA_PCMCIA is not set
684# CONFIG_PATA_PDC2027X is not set
651# CONFIG_PATA_PDC_OLD is not set 685# CONFIG_PATA_PDC_OLD is not set
652# CONFIG_PATA_RADISYS is not set 686# CONFIG_PATA_RADISYS is not set
653# CONFIG_PATA_RDC is not set 687# CONFIG_PATA_RDC is not set
654# CONFIG_PATA_RZ1000 is not set 688# CONFIG_PATA_RZ1000 is not set
655# CONFIG_PATA_SC1200 is not set 689# CONFIG_PATA_SC1200 is not set
656# CONFIG_PATA_SERVERWORKS is not set 690# CONFIG_PATA_SERVERWORKS is not set
657# CONFIG_PATA_PDC2027X is not set
658# CONFIG_PATA_SIL680 is not set 691# CONFIG_PATA_SIL680 is not set
659# CONFIG_PATA_SIS is not set 692# CONFIG_PATA_SIS is not set
693# CONFIG_PATA_TOSHIBA is not set
660# CONFIG_PATA_VIA is not set 694# CONFIG_PATA_VIA is not set
661# CONFIG_PATA_WINBOND is not set 695# CONFIG_PATA_WINBOND is not set
662CONFIG_PATA_PLATFORM=y 696CONFIG_PATA_PLATFORM=y
@@ -732,6 +766,7 @@ CONFIG_8139TOO_TUNE_TWISTER=y
732# CONFIG_SUNDANCE is not set 766# CONFIG_SUNDANCE is not set
733# CONFIG_TLAN is not set 767# CONFIG_TLAN is not set
734# CONFIG_KS8842 is not set 768# CONFIG_KS8842 is not set
769# CONFIG_KS8851_MLL is not set
735# CONFIG_VIA_RHINE is not set 770# CONFIG_VIA_RHINE is not set
736# CONFIG_SC92031 is not set 771# CONFIG_SC92031 is not set
737# CONFIG_ATL2 is not set 772# CONFIG_ATL2 is not set
@@ -780,8 +815,12 @@ CONFIG_CHELSIO_T3_DEPENDS=y
780# CONFIG_BE2NET is not set 815# CONFIG_BE2NET is not set
781# CONFIG_TR is not set 816# CONFIG_TR is not set
782CONFIG_WLAN=y 817CONFIG_WLAN=y
783# CONFIG_WLAN_PRE80211 is not set 818# CONFIG_PCMCIA_RAYCS is not set
784# CONFIG_WLAN_80211 is not set 819# CONFIG_ATMEL is not set
820# CONFIG_AIRO_CS is not set
821# CONFIG_PCMCIA_WL3501 is not set
822# CONFIG_PRISM54 is not set
823# CONFIG_HOSTAP is not set
785 824
786# 825#
787# Enable WiMAX (Networking options) to see the WiMAX drivers 826# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -804,6 +843,7 @@ CONFIG_PCMCIA_PCNET=y
804# CONFIG_NETCONSOLE is not set 843# CONFIG_NETCONSOLE is not set
805# CONFIG_NETPOLL is not set 844# CONFIG_NETPOLL is not set
806# CONFIG_NET_POLL_CONTROLLER is not set 845# CONFIG_NET_POLL_CONTROLLER is not set
846# CONFIG_VMXNET3 is not set
807# CONFIG_ISDN is not set 847# CONFIG_ISDN is not set
808# CONFIG_PHONE is not set 848# CONFIG_PHONE is not set
809 849
@@ -813,6 +853,7 @@ CONFIG_PCMCIA_PCNET=y
813CONFIG_INPUT=y 853CONFIG_INPUT=y
814# CONFIG_INPUT_FF_MEMLESS is not set 854# CONFIG_INPUT_FF_MEMLESS is not set
815# CONFIG_INPUT_POLLDEV is not set 855# CONFIG_INPUT_POLLDEV is not set
856# CONFIG_INPUT_SPARSEKMAP is not set
816 857
817# 858#
818# Userland interfaces 859# Userland interfaces
@@ -931,6 +972,7 @@ CONFIG_SSB_POSSIBLE=y
931# 972#
932# CONFIG_MFD_CORE is not set 973# CONFIG_MFD_CORE is not set
933# CONFIG_MFD_SM501 is not set 974# CONFIG_MFD_SM501 is not set
975# CONFIG_MFD_SH_MOBILE_SDHI is not set
934# CONFIG_HTC_PASIC3 is not set 976# CONFIG_HTC_PASIC3 is not set
935# CONFIG_MFD_TMIO is not set 977# CONFIG_MFD_TMIO is not set
936# CONFIG_REGULATOR is not set 978# CONFIG_REGULATOR is not set
@@ -1020,7 +1062,9 @@ CONFIG_RTC_INTF_DEV=y
1020# CONFIG_RTC_DRV_M48T86 is not set 1062# CONFIG_RTC_DRV_M48T86 is not set
1021# CONFIG_RTC_DRV_M48T35 is not set 1063# CONFIG_RTC_DRV_M48T35 is not set
1022# CONFIG_RTC_DRV_M48T59 is not set 1064# CONFIG_RTC_DRV_M48T59 is not set
1065# CONFIG_RTC_DRV_MSM6242 is not set
1023# CONFIG_RTC_DRV_BQ4802 is not set 1066# CONFIG_RTC_DRV_BQ4802 is not set
1067# CONFIG_RTC_DRV_RP5C01 is not set
1024# CONFIG_RTC_DRV_V3020 is not set 1068# CONFIG_RTC_DRV_V3020 is not set
1025 1069
1026# 1070#
@@ -1195,10 +1239,11 @@ CONFIG_FRAME_WARN=1024
1195# CONFIG_DEBUG_FS is not set 1239# CONFIG_DEBUG_FS is not set
1196# CONFIG_HEADERS_CHECK is not set 1240# CONFIG_HEADERS_CHECK is not set
1197# CONFIG_DEBUG_KERNEL is not set 1241# CONFIG_DEBUG_KERNEL is not set
1198# CONFIG_DEBUG_BUGVERBOSE is not set 1242CONFIG_DEBUG_BUGVERBOSE=y
1199# CONFIG_DEBUG_MEMORY_INIT is not set 1243# CONFIG_DEBUG_MEMORY_INIT is not set
1200# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1244# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1201# CONFIG_LATENCYTOP is not set 1245# CONFIG_LATENCYTOP is not set
1246# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1202CONFIG_HAVE_FUNCTION_TRACER=y 1247CONFIG_HAVE_FUNCTION_TRACER=y
1203CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1248CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1204CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 1249CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -1211,8 +1256,6 @@ CONFIG_TRACING_SUPPORT=y
1211# CONFIG_SAMPLES is not set 1256# CONFIG_SAMPLES is not set
1212CONFIG_HAVE_ARCH_KGDB=y 1257CONFIG_HAVE_ARCH_KGDB=y
1213CONFIG_SH_STANDARD_BIOS=y 1258CONFIG_SH_STANDARD_BIOS=y
1214# CONFIG_EARLY_SCIF_CONSOLE is not set
1215# CONFIG_EARLY_PRINTK is not set
1216# CONFIG_DWARF_UNWINDER is not set 1259# CONFIG_DWARF_UNWINDER is not set
1217 1260
1218# 1261#
@@ -1221,7 +1264,11 @@ CONFIG_SH_STANDARD_BIOS=y
1221# CONFIG_KEYS is not set 1264# CONFIG_KEYS is not set
1222# CONFIG_SECURITY is not set 1265# CONFIG_SECURITY is not set
1223# CONFIG_SECURITYFS is not set 1266# CONFIG_SECURITYFS is not set
1224# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1267# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1268# CONFIG_DEFAULT_SECURITY_SMACK is not set
1269# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1270CONFIG_DEFAULT_SECURITY_DAC=y
1271CONFIG_DEFAULT_SECURITY=""
1225CONFIG_CRYPTO=y 1272CONFIG_CRYPTO=y
1226 1273
1227# 1274#
diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
index 79091e3e32c4..a7a16ce357ad 100644
--- a/arch/sh/configs/magicpanelr2_defconfig
+++ b/arch/sh/configs/magicpanelr2_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:10:49 2009 4# Mon Jan 4 11:37:42 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -30,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
35 36
@@ -63,6 +64,7 @@ CONFIG_AUDIT=y
63# 64#
64CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +104,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 104CONFIG_SHMEM=y
103CONFIG_AIO=y 105CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 106CONFIG_HAVE_PERF_EVENTS=y
107CONFIG_PERF_USE_VMALLOC=y
105 108
106# 109#
107# Kernel Performance Events And Counters 110# Kernel Performance Events And Counters
@@ -120,6 +123,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
120CONFIG_HAVE_KPROBES=y 123CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 124CONFIG_HAVE_KRETPROBES=y
122CONFIG_HAVE_ARCH_TRACEHOOK=y 125CONFIG_HAVE_ARCH_TRACEHOOK=y
126CONFIG_HAVE_DMA_ATTRS=y
123CONFIG_HAVE_CLK=y 127CONFIG_HAVE_CLK=y
124CONFIG_HAVE_DMA_API_DEBUG=y 128CONFIG_HAVE_DMA_API_DEBUG=y
125 129
@@ -146,14 +150,41 @@ CONFIG_LBDAF=y
146# IO Schedulers 150# IO Schedulers
147# 151#
148CONFIG_IOSCHED_NOOP=y 152CONFIG_IOSCHED_NOOP=y
149# CONFIG_IOSCHED_AS is not set
150# CONFIG_IOSCHED_DEADLINE is not set 153# CONFIG_IOSCHED_DEADLINE is not set
151# CONFIG_IOSCHED_CFQ is not set 154# CONFIG_IOSCHED_CFQ is not set
152# CONFIG_DEFAULT_AS is not set
153# CONFIG_DEFAULT_DEADLINE is not set 155# CONFIG_DEFAULT_DEADLINE is not set
154# CONFIG_DEFAULT_CFQ is not set 156# CONFIG_DEFAULT_CFQ is not set
155CONFIG_DEFAULT_NOOP=y 157CONFIG_DEFAULT_NOOP=y
156CONFIG_DEFAULT_IOSCHED="noop" 158CONFIG_DEFAULT_IOSCHED="noop"
159# CONFIG_INLINE_SPIN_TRYLOCK is not set
160# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK is not set
162# CONFIG_INLINE_SPIN_LOCK_BH is not set
163# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
164# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
165CONFIG_INLINE_SPIN_UNLOCK=y
166# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
167CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
168# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
169# CONFIG_INLINE_READ_TRYLOCK is not set
170# CONFIG_INLINE_READ_LOCK is not set
171# CONFIG_INLINE_READ_LOCK_BH is not set
172# CONFIG_INLINE_READ_LOCK_IRQ is not set
173# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
174CONFIG_INLINE_READ_UNLOCK=y
175# CONFIG_INLINE_READ_UNLOCK_BH is not set
176CONFIG_INLINE_READ_UNLOCK_IRQ=y
177# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
178# CONFIG_INLINE_WRITE_TRYLOCK is not set
179# CONFIG_INLINE_WRITE_LOCK is not set
180# CONFIG_INLINE_WRITE_LOCK_BH is not set
181# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
182# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
183CONFIG_INLINE_WRITE_UNLOCK=y
184# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
185CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
186# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
187# CONFIG_MUTEX_SPIN_ON_OWNER is not set
157# CONFIG_FREEZER is not set 188# CONFIG_FREEZER is not set
158 189
159# 190#
@@ -229,8 +260,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
229# CONFIG_PHYS_ADDR_T_64BIT is not set 260# CONFIG_PHYS_ADDR_T_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=0 261CONFIG_ZONE_DMA_FLAG=0
231CONFIG_NR_QUICK=2 262CONFIG_NR_QUICK=2
232CONFIG_HAVE_MLOCK=y
233CONFIG_HAVE_MLOCKED_PAGE_BIT=y
234# CONFIG_KSM is not set 263# CONFIG_KSM is not set
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 264CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236 265
@@ -283,8 +312,8 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
283# 312#
284# DMA support 313# DMA support
285# 314#
286CONFIG_SH_DMA_API=y
287CONFIG_SH_DMA=y 315CONFIG_SH_DMA=y
316CONFIG_SH_DMA_API=y
288CONFIG_NR_ONCHIP_DMA_CHANNELS=6 317CONFIG_NR_ONCHIP_DMA_CHANNELS=6
289# CONFIG_NR_DMA_CHANNELS_BOOL is not set 318# CONFIG_NR_DMA_CHANNELS_BOOL is not set
290 319
@@ -416,9 +445,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
416# CONFIG_AF_RXRPC is not set 445# CONFIG_AF_RXRPC is not set
417CONFIG_WIRELESS=y 446CONFIG_WIRELESS=y
418# CONFIG_CFG80211 is not set 447# CONFIG_CFG80211 is not set
419CONFIG_CFG80211_DEFAULT_PS_VALUE=0
420# CONFIG_WIRELESS_OLD_REGULATORY is not set
421# CONFIG_WIRELESS_EXT is not set
422# CONFIG_LIB80211 is not set 448# CONFIG_LIB80211 is not set
423 449
424# 450#
@@ -534,6 +560,10 @@ CONFIG_MTD_PHYSMAP=y
534CONFIG_BLK_DEV=y 560CONFIG_BLK_DEV=y
535# CONFIG_BLK_DEV_COW_COMMON is not set 561# CONFIG_BLK_DEV_COW_COMMON is not set
536# CONFIG_BLK_DEV_LOOP is not set 562# CONFIG_BLK_DEV_LOOP is not set
563
564#
565# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
566#
537# CONFIG_BLK_DEV_NBD is not set 567# CONFIG_BLK_DEV_NBD is not set
538CONFIG_BLK_DEV_RAM=y 568CONFIG_BLK_DEV_RAM=y
539CONFIG_BLK_DEV_RAM_COUNT=16 569CONFIG_BLK_DEV_RAM_COUNT=16
@@ -607,11 +637,11 @@ CONFIG_SMSC911X=y
607# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 637# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
608# CONFIG_B44 is not set 638# CONFIG_B44 is not set
609# CONFIG_KS8842 is not set 639# CONFIG_KS8842 is not set
640# CONFIG_KS8851_MLL is not set
610# CONFIG_NETDEV_1000 is not set 641# CONFIG_NETDEV_1000 is not set
611# CONFIG_NETDEV_10000 is not set 642# CONFIG_NETDEV_10000 is not set
612CONFIG_WLAN=y 643CONFIG_WLAN=y
613# CONFIG_WLAN_PRE80211 is not set 644# CONFIG_HOSTAP is not set
614# CONFIG_WLAN_80211 is not set
615 645
616# 646#
617# Enable WiMAX (Networking options) to see the WiMAX drivers 647# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -631,6 +661,7 @@ CONFIG_WLAN=y
631CONFIG_INPUT=y 661CONFIG_INPUT=y
632# CONFIG_INPUT_FF_MEMLESS is not set 662# CONFIG_INPUT_FF_MEMLESS is not set
633# CONFIG_INPUT_POLLDEV is not set 663# CONFIG_INPUT_POLLDEV is not set
664# CONFIG_INPUT_SPARSEKMAP is not set
634 665
635# 666#
636# Userland interfaces 667# Userland interfaces
@@ -675,6 +706,7 @@ CONFIG_SERIO=y
675CONFIG_SERIO_SERPORT=y 706CONFIG_SERIO_SERPORT=y
676CONFIG_SERIO_LIBPS2=y 707CONFIG_SERIO_LIBPS2=y
677# CONFIG_SERIO_RAW is not set 708# CONFIG_SERIO_RAW is not set
709# CONFIG_SERIO_ALTERA_PS2 is not set
678# CONFIG_GAMEPORT is not set 710# CONFIG_GAMEPORT is not set
679 711
680# 712#
@@ -766,6 +798,7 @@ CONFIG_SSB_POSSIBLE=y
766# 798#
767# CONFIG_MFD_CORE is not set 799# CONFIG_MFD_CORE is not set
768# CONFIG_MFD_SM501 is not set 800# CONFIG_MFD_SM501 is not set
801# CONFIG_MFD_SH_MOBILE_SDHI is not set
769# CONFIG_HTC_PASIC3 is not set 802# CONFIG_HTC_PASIC3 is not set
770# CONFIG_MFD_TMIO is not set 803# CONFIG_MFD_TMIO is not set
771# CONFIG_REGULATOR is not set 804# CONFIG_REGULATOR is not set
@@ -824,7 +857,9 @@ CONFIG_RTC_INTF_DEV=y
824# CONFIG_RTC_DRV_M48T86 is not set 857# CONFIG_RTC_DRV_M48T86 is not set
825# CONFIG_RTC_DRV_M48T35 is not set 858# CONFIG_RTC_DRV_M48T35 is not set
826# CONFIG_RTC_DRV_M48T59 is not set 859# CONFIG_RTC_DRV_M48T59 is not set
860# CONFIG_RTC_DRV_MSM6242 is not set
827# CONFIG_RTC_DRV_BQ4802 is not set 861# CONFIG_RTC_DRV_BQ4802 is not set
862# CONFIG_RTC_DRV_RP5C01 is not set
828# CONFIG_RTC_DRV_V3020 is not set 863# CONFIG_RTC_DRV_V3020 is not set
829 864
830# 865#
@@ -898,7 +933,6 @@ CONFIG_PROC_PAGE_MONITOR=y
898CONFIG_SYSFS=y 933CONFIG_SYSFS=y
899CONFIG_TMPFS=y 934CONFIG_TMPFS=y
900# CONFIG_TMPFS_POSIX_ACL is not set 935# CONFIG_TMPFS_POSIX_ACL is not set
901# CONFIG_HUGETLBFS is not set
902# CONFIG_HUGETLB_PAGE is not set 936# CONFIG_HUGETLB_PAGE is not set
903# CONFIG_CONFIGFS_FS is not set 937# CONFIG_CONFIGFS_FS is not set
904CONFIG_MISC_FILESYSTEMS=y 938CONFIG_MISC_FILESYSTEMS=y
@@ -1072,9 +1106,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1072CONFIG_HAVE_ARCH_KGDB=y 1106CONFIG_HAVE_ARCH_KGDB=y
1073# CONFIG_KGDB is not set 1107# CONFIG_KGDB is not set
1074# CONFIG_SH_STANDARD_BIOS is not set 1108# CONFIG_SH_STANDARD_BIOS is not set
1075CONFIG_EARLY_SCIF_CONSOLE=y
1076CONFIG_EARLY_SCIF_CONSOLE_PORT=0xa4430000
1077CONFIG_EARLY_PRINTK=y
1078# CONFIG_STACK_DEBUG is not set 1109# CONFIG_STACK_DEBUG is not set
1079# CONFIG_DEBUG_STACK_USAGE is not set 1110# CONFIG_DEBUG_STACK_USAGE is not set
1080# CONFIG_4KSTACKS is not set 1111# CONFIG_4KSTACKS is not set
@@ -1088,7 +1119,11 @@ CONFIG_DUMP_CODE=y
1088# CONFIG_KEYS is not set 1119# CONFIG_KEYS is not set
1089# CONFIG_SECURITY is not set 1120# CONFIG_SECURITY is not set
1090# CONFIG_SECURITYFS is not set 1121# CONFIG_SECURITYFS is not set
1091# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1122# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1123# CONFIG_DEFAULT_SECURITY_SMACK is not set
1124# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1125CONFIG_DEFAULT_SECURITY_DAC=y
1126CONFIG_DEFAULT_SECURITY=""
1092# CONFIG_CRYPTO is not set 1127# CONFIG_CRYPTO is not set
1093# CONFIG_BINARY_PRINTF is not set 1128# CONFIG_BINARY_PRINTF is not set
1094 1129
diff --git a/arch/sh/configs/microdev_defconfig b/arch/sh/configs/microdev_defconfig
index 6bb5976aff2a..7d43fabdc073 100644
--- a/arch/sh/configs/microdev_defconfig
+++ b/arch/sh/configs/microdev_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:14:35 2009 4# Mon Jan 4 11:40:41 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -60,6 +62,7 @@ CONFIG_BSD_PROCESS_ACCT=y
60# 62#
61CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -98,6 +101,7 @@ CONFIG_EVENTFD=y
98CONFIG_SHMEM=y 101CONFIG_SHMEM=y
99CONFIG_AIO=y 102CONFIG_AIO=y
100CONFIG_HAVE_PERF_EVENTS=y 103CONFIG_HAVE_PERF_EVENTS=y
104CONFIG_PERF_USE_VMALLOC=y
101 105
102# 106#
103# Kernel Performance Events And Counters 107# Kernel Performance Events And Counters
@@ -115,6 +119,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
115CONFIG_HAVE_KPROBES=y 119CONFIG_HAVE_KPROBES=y
116CONFIG_HAVE_KRETPROBES=y 120CONFIG_HAVE_KRETPROBES=y
117CONFIG_HAVE_ARCH_TRACEHOOK=y 121CONFIG_HAVE_ARCH_TRACEHOOK=y
122CONFIG_HAVE_DMA_ATTRS=y
118CONFIG_HAVE_CLK=y 123CONFIG_HAVE_CLK=y
119CONFIG_HAVE_DMA_API_DEBUG=y 124CONFIG_HAVE_DMA_API_DEBUG=y
120 125
@@ -136,14 +141,41 @@ CONFIG_LBDAF=y
136# IO Schedulers 141# IO Schedulers
137# 142#
138CONFIG_IOSCHED_NOOP=y 143CONFIG_IOSCHED_NOOP=y
139CONFIG_IOSCHED_AS=y
140CONFIG_IOSCHED_DEADLINE=y 144CONFIG_IOSCHED_DEADLINE=y
141CONFIG_IOSCHED_CFQ=y 145CONFIG_IOSCHED_CFQ=y
142CONFIG_DEFAULT_AS=y
143# CONFIG_DEFAULT_DEADLINE is not set 146# CONFIG_DEFAULT_DEADLINE is not set
144# CONFIG_DEFAULT_CFQ is not set 147CONFIG_DEFAULT_CFQ=y
145# CONFIG_DEFAULT_NOOP is not set 148# CONFIG_DEFAULT_NOOP is not set
146CONFIG_DEFAULT_IOSCHED="anticipatory" 149CONFIG_DEFAULT_IOSCHED="cfq"
150# CONFIG_INLINE_SPIN_TRYLOCK is not set
151# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
152# CONFIG_INLINE_SPIN_LOCK is not set
153# CONFIG_INLINE_SPIN_LOCK_BH is not set
154# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
155# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
156# CONFIG_INLINE_SPIN_UNLOCK is not set
157# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
158# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
159# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
160# CONFIG_INLINE_READ_TRYLOCK is not set
161# CONFIG_INLINE_READ_LOCK is not set
162# CONFIG_INLINE_READ_LOCK_BH is not set
163# CONFIG_INLINE_READ_LOCK_IRQ is not set
164# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
165# CONFIG_INLINE_READ_UNLOCK is not set
166# CONFIG_INLINE_READ_UNLOCK_BH is not set
167# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
168# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
169# CONFIG_INLINE_WRITE_TRYLOCK is not set
170# CONFIG_INLINE_WRITE_LOCK is not set
171# CONFIG_INLINE_WRITE_LOCK_BH is not set
172# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
173# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
174# CONFIG_INLINE_WRITE_UNLOCK is not set
175# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
176# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
177# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
178# CONFIG_MUTEX_SPIN_ON_OWNER is not set
147# CONFIG_FREEZER is not set 179# CONFIG_FREEZER is not set
148 180
149# 181#
@@ -225,8 +257,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
225# CONFIG_PHYS_ADDR_T_64BIT is not set 257# CONFIG_PHYS_ADDR_T_64BIT is not set
226CONFIG_ZONE_DMA_FLAG=0 258CONFIG_ZONE_DMA_FLAG=0
227CONFIG_NR_QUICK=2 259CONFIG_NR_QUICK=2
228CONFIG_HAVE_MLOCK=y
229CONFIG_HAVE_MLOCKED_PAGE_BIT=y
230# CONFIG_KSM is not set 260# CONFIG_KSM is not set
231CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 261CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
232 262
@@ -272,8 +302,8 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
272# 302#
273# DMA support 303# DMA support
274# 304#
275CONFIG_SH_DMA_API=y
276CONFIG_SH_DMA=y 305CONFIG_SH_DMA=y
306CONFIG_SH_DMA_API=y
277CONFIG_NR_ONCHIP_DMA_CHANNELS=6 307CONFIG_NR_ONCHIP_DMA_CHANNELS=6
278# CONFIG_NR_DMA_CHANNELS_BOOL is not set 308# CONFIG_NR_DMA_CHANNELS_BOOL is not set
279 309
@@ -312,7 +342,6 @@ CONFIG_GUSA=y
312CONFIG_ZERO_PAGE_OFFSET=0x00001000 342CONFIG_ZERO_PAGE_OFFSET=0x00001000
313CONFIG_BOOT_LINK_OFFSET=0x00800000 343CONFIG_BOOT_LINK_OFFSET=0x00800000
314CONFIG_ENTRY_OFFSET=0x00001000 344CONFIG_ENTRY_OFFSET=0x00001000
315# CONFIG_UBC_WAKEUP is not set
316CONFIG_CMDLINE_OVERWRITE=y 345CONFIG_CMDLINE_OVERWRITE=y
317# CONFIG_CMDLINE_EXTEND is not set 346# CONFIG_CMDLINE_EXTEND is not set
318CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/hda1" 347CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/hda1"
@@ -412,9 +441,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
412# CONFIG_AF_RXRPC is not set 441# CONFIG_AF_RXRPC is not set
413CONFIG_WIRELESS=y 442CONFIG_WIRELESS=y
414# CONFIG_CFG80211 is not set 443# CONFIG_CFG80211 is not set
415CONFIG_CFG80211_DEFAULT_PS_VALUE=0
416# CONFIG_WIRELESS_OLD_REGULATORY is not set
417# CONFIG_WIRELESS_EXT is not set
418# CONFIG_LIB80211 is not set 444# CONFIG_LIB80211 is not set
419 445
420# 446#
@@ -443,6 +469,10 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
443CONFIG_BLK_DEV=y 469CONFIG_BLK_DEV=y
444# CONFIG_BLK_DEV_COW_COMMON is not set 470# CONFIG_BLK_DEV_COW_COMMON is not set
445# CONFIG_BLK_DEV_LOOP is not set 471# CONFIG_BLK_DEV_LOOP is not set
472
473#
474# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
475#
446# CONFIG_BLK_DEV_NBD is not set 476# CONFIG_BLK_DEV_NBD is not set
447CONFIG_BLK_DEV_RAM=y 477CONFIG_BLK_DEV_RAM=y
448CONFIG_BLK_DEV_RAM_COUNT=16 478CONFIG_BLK_DEV_RAM_COUNT=16
@@ -517,11 +547,11 @@ CONFIG_SMC91X=y
517# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 547# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
518# CONFIG_B44 is not set 548# CONFIG_B44 is not set
519# CONFIG_KS8842 is not set 549# CONFIG_KS8842 is not set
550# CONFIG_KS8851_MLL is not set
520CONFIG_NETDEV_1000=y 551CONFIG_NETDEV_1000=y
521CONFIG_NETDEV_10000=y 552CONFIG_NETDEV_10000=y
522CONFIG_WLAN=y 553CONFIG_WLAN=y
523# CONFIG_WLAN_PRE80211 is not set 554# CONFIG_HOSTAP is not set
524# CONFIG_WLAN_80211 is not set
525 555
526# 556#
527# Enable WiMAX (Networking options) to see the WiMAX drivers 557# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -616,6 +646,7 @@ CONFIG_SSB_POSSIBLE=y
616# 646#
617# CONFIG_MFD_CORE is not set 647# CONFIG_MFD_CORE is not set
618# CONFIG_MFD_SM501 is not set 648# CONFIG_MFD_SM501 is not set
649# CONFIG_MFD_SH_MOBILE_SDHI is not set
619# CONFIG_HTC_PASIC3 is not set 650# CONFIG_HTC_PASIC3 is not set
620# CONFIG_MFD_TMIO is not set 651# CONFIG_MFD_TMIO is not set
621# CONFIG_REGULATOR is not set 652# CONFIG_REGULATOR is not set
@@ -835,10 +866,11 @@ CONFIG_FRAME_WARN=1024
835# CONFIG_DEBUG_FS is not set 866# CONFIG_DEBUG_FS is not set
836# CONFIG_HEADERS_CHECK is not set 867# CONFIG_HEADERS_CHECK is not set
837# CONFIG_DEBUG_KERNEL is not set 868# CONFIG_DEBUG_KERNEL is not set
838# CONFIG_DEBUG_BUGVERBOSE is not set 869CONFIG_DEBUG_BUGVERBOSE=y
839# CONFIG_DEBUG_MEMORY_INIT is not set 870# CONFIG_DEBUG_MEMORY_INIT is not set
840# CONFIG_RCU_CPU_STALL_DETECTOR is not set 871# CONFIG_RCU_CPU_STALL_DETECTOR is not set
841# CONFIG_LATENCYTOP is not set 872# CONFIG_LATENCYTOP is not set
873# CONFIG_SYSCTL_SYSCALL_CHECK is not set
842CONFIG_HAVE_FUNCTION_TRACER=y 874CONFIG_HAVE_FUNCTION_TRACER=y
843CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 875CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
844CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 876CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -851,7 +883,6 @@ CONFIG_TRACING_SUPPORT=y
851# CONFIG_SAMPLES is not set 883# CONFIG_SAMPLES is not set
852CONFIG_HAVE_ARCH_KGDB=y 884CONFIG_HAVE_ARCH_KGDB=y
853# CONFIG_SH_STANDARD_BIOS is not set 885# CONFIG_SH_STANDARD_BIOS is not set
854# CONFIG_EARLY_SCIF_CONSOLE is not set
855# CONFIG_DWARF_UNWINDER is not set 886# CONFIG_DWARF_UNWINDER is not set
856 887
857# 888#
@@ -860,7 +891,11 @@ CONFIG_HAVE_ARCH_KGDB=y
860# CONFIG_KEYS is not set 891# CONFIG_KEYS is not set
861# CONFIG_SECURITY is not set 892# CONFIG_SECURITY is not set
862# CONFIG_SECURITYFS is not set 893# CONFIG_SECURITYFS is not set
863# CONFIG_SECURITY_FILE_CAPABILITIES is not set 894# CONFIG_DEFAULT_SECURITY_SELINUX is not set
895# CONFIG_DEFAULT_SECURITY_SMACK is not set
896# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
897CONFIG_DEFAULT_SECURITY_DAC=y
898CONFIG_DEFAULT_SECURITY=""
864CONFIG_CRYPTO=y 899CONFIG_CRYPTO=y
865 900
866# 901#
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
index 65018283c3a8..d2b183117771 100644
--- a/arch/sh/configs/migor_defconfig
+++ b/arch/sh/configs/migor_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:17:41 2009 4# Mon Jan 4 11:41:41 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_NUMA=y 24CONFIG_SYS_SUPPORTS_NUMA=y
24CONFIG_SYS_SUPPORTS_CMT=y 25CONFIG_SYS_SUPPORTS_CMT=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -61,6 +63,7 @@ CONFIG_SYSVIPC_SYSCTL=y
61# 63#
62CONFIG_TREE_RCU=y 64CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
66# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 67# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 68CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 69# CONFIG_RCU_FANOUT_EXACT is not set
@@ -100,6 +103,7 @@ CONFIG_EVENTFD=y
100CONFIG_SHMEM=y 103CONFIG_SHMEM=y
101CONFIG_AIO=y 104CONFIG_AIO=y
102CONFIG_HAVE_PERF_EVENTS=y 105CONFIG_HAVE_PERF_EVENTS=y
106CONFIG_PERF_USE_VMALLOC=y
103 107
104# 108#
105# Kernel Performance Events And Counters 109# Kernel Performance Events And Counters
@@ -121,6 +125,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
121CONFIG_HAVE_KPROBES=y 125CONFIG_HAVE_KPROBES=y
122CONFIG_HAVE_KRETPROBES=y 126CONFIG_HAVE_KRETPROBES=y
123CONFIG_HAVE_ARCH_TRACEHOOK=y 127CONFIG_HAVE_ARCH_TRACEHOOK=y
128CONFIG_HAVE_DMA_ATTRS=y
124CONFIG_HAVE_CLK=y 129CONFIG_HAVE_CLK=y
125CONFIG_HAVE_DMA_API_DEBUG=y 130CONFIG_HAVE_DMA_API_DEBUG=y
126 131
@@ -147,14 +152,41 @@ CONFIG_LBDAF=y
147# IO Schedulers 152# IO Schedulers
148# 153#
149CONFIG_IOSCHED_NOOP=y 154CONFIG_IOSCHED_NOOP=y
150CONFIG_IOSCHED_AS=y
151CONFIG_IOSCHED_DEADLINE=y 155CONFIG_IOSCHED_DEADLINE=y
152CONFIG_IOSCHED_CFQ=y 156CONFIG_IOSCHED_CFQ=y
153CONFIG_DEFAULT_AS=y
154# CONFIG_DEFAULT_DEADLINE is not set 157# CONFIG_DEFAULT_DEADLINE is not set
155# CONFIG_DEFAULT_CFQ is not set 158CONFIG_DEFAULT_CFQ=y
156# CONFIG_DEFAULT_NOOP is not set 159# CONFIG_DEFAULT_NOOP is not set
157CONFIG_DEFAULT_IOSCHED="anticipatory" 160CONFIG_DEFAULT_IOSCHED="cfq"
161# CONFIG_INLINE_SPIN_TRYLOCK is not set
162# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
163# CONFIG_INLINE_SPIN_LOCK is not set
164# CONFIG_INLINE_SPIN_LOCK_BH is not set
165# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
166# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
167CONFIG_INLINE_SPIN_UNLOCK=y
168# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
169CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
170# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
171# CONFIG_INLINE_READ_TRYLOCK is not set
172# CONFIG_INLINE_READ_LOCK is not set
173# CONFIG_INLINE_READ_LOCK_BH is not set
174# CONFIG_INLINE_READ_LOCK_IRQ is not set
175# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
176CONFIG_INLINE_READ_UNLOCK=y
177# CONFIG_INLINE_READ_UNLOCK_BH is not set
178CONFIG_INLINE_READ_UNLOCK_IRQ=y
179# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
180# CONFIG_INLINE_WRITE_TRYLOCK is not set
181# CONFIG_INLINE_WRITE_LOCK is not set
182# CONFIG_INLINE_WRITE_LOCK_BH is not set
183# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
184# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
185CONFIG_INLINE_WRITE_UNLOCK=y
186# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
187CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
188# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
189# CONFIG_MUTEX_SPIN_ON_OWNER is not set
158CONFIG_FREEZER=y 190CONFIG_FREEZER=y
159 191
160# 192#
@@ -240,8 +272,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
240# CONFIG_PHYS_ADDR_T_64BIT is not set 272# CONFIG_PHYS_ADDR_T_64BIT is not set
241CONFIG_ZONE_DMA_FLAG=0 273CONFIG_ZONE_DMA_FLAG=0
242CONFIG_NR_QUICK=2 274CONFIG_NR_QUICK=2
243CONFIG_HAVE_MLOCK=y
244CONFIG_HAVE_MLOCKED_PAGE_BIT=y
245# CONFIG_KSM is not set 275# CONFIG_KSM is not set
246CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 276CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
247 277
@@ -277,7 +307,6 @@ CONFIG_SH_MIGOR_QVGA=y
277# 307#
278CONFIG_SH_TIMER_TMU=y 308CONFIG_SH_TIMER_TMU=y
279# CONFIG_SH_TIMER_CMT is not set 309# CONFIG_SH_TIMER_CMT is not set
280CONFIG_SH_PCLK_FREQ=33333333
281CONFIG_SH_CLK_CPG=y 310CONFIG_SH_CLK_CPG=y
282# CONFIG_NO_HZ is not set 311# CONFIG_NO_HZ is not set
283# CONFIG_HIGH_RES_TIMERS is not set 312# CONFIG_HIGH_RES_TIMERS is not set
@@ -433,10 +462,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
433# CONFIG_AF_RXRPC is not set 462# CONFIG_AF_RXRPC is not set
434CONFIG_WIRELESS=y 463CONFIG_WIRELESS=y
435# CONFIG_CFG80211 is not set 464# CONFIG_CFG80211 is not set
436CONFIG_CFG80211_DEFAULT_PS_VALUE=0
437# CONFIG_WIRELESS_OLD_REGULATORY is not set
438CONFIG_WIRELESS_EXT=y
439CONFIG_WIRELESS_EXT_SYSFS=y
440# CONFIG_LIB80211 is not set 465# CONFIG_LIB80211 is not set
441 466
442# 467#
@@ -554,6 +579,10 @@ CONFIG_MTD_NAND_PLATFORM=y
554CONFIG_BLK_DEV=y 579CONFIG_BLK_DEV=y
555# CONFIG_BLK_DEV_COW_COMMON is not set 580# CONFIG_BLK_DEV_COW_COMMON is not set
556# CONFIG_BLK_DEV_LOOP is not set 581# CONFIG_BLK_DEV_LOOP is not set
582
583#
584# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
585#
557# CONFIG_BLK_DEV_NBD is not set 586# CONFIG_BLK_DEV_NBD is not set
558CONFIG_BLK_DEV_RAM=y 587CONFIG_BLK_DEV_RAM=y
559CONFIG_BLK_DEV_RAM_COUNT=16 588CONFIG_BLK_DEV_RAM_COUNT=16
@@ -563,9 +592,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
563# CONFIG_ATA_OVER_ETH is not set 592# CONFIG_ATA_OVER_ETH is not set
564# CONFIG_BLK_DEV_HD is not set 593# CONFIG_BLK_DEV_HD is not set
565CONFIG_MISC_DEVICES=y 594CONFIG_MISC_DEVICES=y
595# CONFIG_AD525X_DPOT is not set
566# CONFIG_ICS932S401 is not set 596# CONFIG_ICS932S401 is not set
567# CONFIG_ENCLOSURE_SERVICES is not set 597# CONFIG_ENCLOSURE_SERVICES is not set
568# CONFIG_ISL29003 is not set 598# CONFIG_ISL29003 is not set
599# CONFIG_DS1682 is not set
569# CONFIG_C2PORT is not set 600# CONFIG_C2PORT is not set
570 601
571# 602#
@@ -646,11 +677,11 @@ CONFIG_SMC91X=y
646# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 677# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
647# CONFIG_B44 is not set 678# CONFIG_B44 is not set
648# CONFIG_KS8842 is not set 679# CONFIG_KS8842 is not set
680# CONFIG_KS8851_MLL is not set
649# CONFIG_NETDEV_1000 is not set 681# CONFIG_NETDEV_1000 is not set
650# CONFIG_NETDEV_10000 is not set 682# CONFIG_NETDEV_10000 is not set
651CONFIG_WLAN=y 683CONFIG_WLAN=y
652# CONFIG_WLAN_PRE80211 is not set 684# CONFIG_HOSTAP is not set
653# CONFIG_WLAN_80211 is not set
654 685
655# 686#
656# Enable WiMAX (Networking options) to see the WiMAX drivers 687# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -670,6 +701,7 @@ CONFIG_WLAN=y
670CONFIG_INPUT=y 701CONFIG_INPUT=y
671# CONFIG_INPUT_FF_MEMLESS is not set 702# CONFIG_INPUT_FF_MEMLESS is not set
672# CONFIG_INPUT_POLLDEV is not set 703# CONFIG_INPUT_POLLDEV is not set
704# CONFIG_INPUT_SPARSEKMAP is not set
673 705
674# 706#
675# Userland interfaces 707# Userland interfaces
@@ -776,7 +808,6 @@ CONFIG_I2C_SH_MOBILE=y
776# 808#
777# Miscellaneous I2C Chip support 809# Miscellaneous I2C Chip support
778# 810#
779# CONFIG_DS1682 is not set
780# CONFIG_SENSORS_TSL2550 is not set 811# CONFIG_SENSORS_TSL2550 is not set
781# CONFIG_I2C_DEBUG_CORE is not set 812# CONFIG_I2C_DEBUG_CORE is not set
782# CONFIG_I2C_DEBUG_ALGO is not set 813# CONFIG_I2C_DEBUG_ALGO is not set
@@ -831,16 +862,19 @@ CONFIG_SSB_POSSIBLE=y
831# 862#
832# CONFIG_MFD_CORE is not set 863# CONFIG_MFD_CORE is not set
833# CONFIG_MFD_SM501 is not set 864# CONFIG_MFD_SM501 is not set
865# CONFIG_MFD_SH_MOBILE_SDHI is not set
834# CONFIG_HTC_PASIC3 is not set 866# CONFIG_HTC_PASIC3 is not set
835# CONFIG_TPS65010 is not set 867# CONFIG_TPS65010 is not set
836# CONFIG_TWL4030_CORE is not set 868# CONFIG_TWL4030_CORE is not set
837# CONFIG_MFD_TMIO is not set 869# CONFIG_MFD_TMIO is not set
838# CONFIG_PMIC_DA903X is not set 870# CONFIG_PMIC_DA903X is not set
871# CONFIG_PMIC_ADP5520 is not set
839# CONFIG_MFD_WM8400 is not set 872# CONFIG_MFD_WM8400 is not set
840# CONFIG_MFD_WM831X is not set 873# CONFIG_MFD_WM831X is not set
841# CONFIG_MFD_WM8350_I2C is not set 874# CONFIG_MFD_WM8350_I2C is not set
842# CONFIG_MFD_PCF50633 is not set 875# CONFIG_MFD_PCF50633 is not set
843# CONFIG_AB3100_CORE is not set 876# CONFIG_AB3100_CORE is not set
877# CONFIG_MFD_88PM8607 is not set
844# CONFIG_REGULATOR is not set 878# CONFIG_REGULATOR is not set
845CONFIG_MEDIA_SUPPORT=y 879CONFIG_MEDIA_SUPPORT=y
846 880
@@ -857,6 +891,8 @@ CONFIG_VIDEO_MEDIA=y
857# 891#
858# Multimedia drivers 892# Multimedia drivers
859# 893#
894CONFIG_IR_CORE=y
895CONFIG_VIDEO_IR=y
860# CONFIG_MEDIA_ATTACH is not set 896# CONFIG_MEDIA_ATTACH is not set
861CONFIG_MEDIA_TUNER=y 897CONFIG_MEDIA_TUNER=y
862# CONFIG_MEDIA_TUNER_CUSTOMISE is not set 898# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
@@ -876,6 +912,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
876# CONFIG_VIDEO_ADV_DEBUG is not set 912# CONFIG_VIDEO_ADV_DEBUG is not set
877# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set 913# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
878CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 914CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
915CONFIG_VIDEO_IR_I2C=y
879# CONFIG_VIDEO_VIVI is not set 916# CONFIG_VIDEO_VIVI is not set
880# CONFIG_VIDEO_SAA5246A is not set 917# CONFIG_VIDEO_SAA5246A is not set
881# CONFIG_VIDEO_SAA5249 is not set 918# CONFIG_VIDEO_SAA5249 is not set
@@ -883,10 +920,13 @@ CONFIG_SOC_CAMERA=y
883# CONFIG_SOC_CAMERA_MT9M001 is not set 920# CONFIG_SOC_CAMERA_MT9M001 is not set
884# CONFIG_SOC_CAMERA_MT9M111 is not set 921# CONFIG_SOC_CAMERA_MT9M111 is not set
885# CONFIG_SOC_CAMERA_MT9T031 is not set 922# CONFIG_SOC_CAMERA_MT9T031 is not set
923# CONFIG_SOC_CAMERA_MT9T112 is not set
886# CONFIG_SOC_CAMERA_MT9V022 is not set 924# CONFIG_SOC_CAMERA_MT9V022 is not set
925# CONFIG_SOC_CAMERA_RJ54N1 is not set
887CONFIG_SOC_CAMERA_TW9910=y 926CONFIG_SOC_CAMERA_TW9910=y
888# CONFIG_SOC_CAMERA_PLATFORM is not set 927# CONFIG_SOC_CAMERA_PLATFORM is not set
889CONFIG_SOC_CAMERA_OV772X=y 928CONFIG_SOC_CAMERA_OV772X=y
929# CONFIG_SOC_CAMERA_OV9640 is not set
890CONFIG_VIDEO_SH_MOBILE_CEU=y 930CONFIG_VIDEO_SH_MOBILE_CEU=y
891# CONFIG_RADIO_ADAPTERS is not set 931# CONFIG_RADIO_ADAPTERS is not set
892# CONFIG_DAB is not set 932# CONFIG_DAB is not set
@@ -1009,10 +1049,12 @@ CONFIG_USB_GADGET_DUALSPEED=y
1009# CONFIG_USB_ETH is not set 1049# CONFIG_USB_ETH is not set
1010# CONFIG_USB_GADGETFS is not set 1050# CONFIG_USB_GADGETFS is not set
1011# CONFIG_USB_FILE_STORAGE is not set 1051# CONFIG_USB_FILE_STORAGE is not set
1012CONFIG_USB_G_SERIAL=y 1052# CONFIG_USB_MASS_STORAGE is not set
1053CONFIG_USB_G_SERIAL=m
1013# CONFIG_USB_MIDI_GADGET is not set 1054# CONFIG_USB_MIDI_GADGET is not set
1014# CONFIG_USB_G_PRINTER is not set 1055# CONFIG_USB_G_PRINTER is not set
1015# CONFIG_USB_CDC_COMPOSITE is not set 1056# CONFIG_USB_CDC_COMPOSITE is not set
1057# CONFIG_USB_G_MULTI is not set
1016 1058
1017# 1059#
1018# OTG and related infrastructure 1060# OTG and related infrastructure
@@ -1051,6 +1093,7 @@ CONFIG_RTC_DRV_RS5C372=y
1051# CONFIG_RTC_DRV_PCF8563 is not set 1093# CONFIG_RTC_DRV_PCF8563 is not set
1052# CONFIG_RTC_DRV_PCF8583 is not set 1094# CONFIG_RTC_DRV_PCF8583 is not set
1053# CONFIG_RTC_DRV_M41T80 is not set 1095# CONFIG_RTC_DRV_M41T80 is not set
1096# CONFIG_RTC_DRV_BQ32K is not set
1054# CONFIG_RTC_DRV_S35390A is not set 1097# CONFIG_RTC_DRV_S35390A is not set
1055# CONFIG_RTC_DRV_FM3130 is not set 1098# CONFIG_RTC_DRV_FM3130 is not set
1056# CONFIG_RTC_DRV_RX8581 is not set 1099# CONFIG_RTC_DRV_RX8581 is not set
@@ -1071,7 +1114,9 @@ CONFIG_RTC_DRV_RS5C372=y
1071# CONFIG_RTC_DRV_M48T86 is not set 1114# CONFIG_RTC_DRV_M48T86 is not set
1072# CONFIG_RTC_DRV_M48T35 is not set 1115# CONFIG_RTC_DRV_M48T35 is not set
1073# CONFIG_RTC_DRV_M48T59 is not set 1116# CONFIG_RTC_DRV_M48T59 is not set
1117# CONFIG_RTC_DRV_MSM6242 is not set
1074# CONFIG_RTC_DRV_BQ4802 is not set 1118# CONFIG_RTC_DRV_BQ4802 is not set
1119# CONFIG_RTC_DRV_RP5C01 is not set
1075# CONFIG_RTC_DRV_V3020 is not set 1120# CONFIG_RTC_DRV_V3020 is not set
1076 1121
1077# 1122#
@@ -1098,6 +1143,7 @@ CONFIG_UIO_PDRV_GENIRQ=y
1098# CONFIG_EXT2_FS is not set 1143# CONFIG_EXT2_FS is not set
1099# CONFIG_EXT3_FS is not set 1144# CONFIG_EXT3_FS is not set
1100# CONFIG_EXT4_FS is not set 1145# CONFIG_EXT4_FS is not set
1146CONFIG_EXT4_USE_FOR_EXT23=y
1101# CONFIG_REISERFS_FS is not set 1147# CONFIG_REISERFS_FS is not set
1102# CONFIG_JFS_FS is not set 1148# CONFIG_JFS_FS is not set
1103# CONFIG_FS_POSIX_ACL is not set 1149# CONFIG_FS_POSIX_ACL is not set
@@ -1206,10 +1252,11 @@ CONFIG_DEBUG_FS=y
1206# CONFIG_HEADERS_CHECK is not set 1252# CONFIG_HEADERS_CHECK is not set
1207# CONFIG_DEBUG_KERNEL is not set 1253# CONFIG_DEBUG_KERNEL is not set
1208CONFIG_STACKTRACE=y 1254CONFIG_STACKTRACE=y
1209# CONFIG_DEBUG_BUGVERBOSE is not set 1255CONFIG_DEBUG_BUGVERBOSE=y
1210# CONFIG_DEBUG_MEMORY_INIT is not set 1256# CONFIG_DEBUG_MEMORY_INIT is not set
1211# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1257# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1212# CONFIG_LATENCYTOP is not set 1258# CONFIG_LATENCYTOP is not set
1259# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1213CONFIG_NOP_TRACER=y 1260CONFIG_NOP_TRACER=y
1214CONFIG_HAVE_FUNCTION_TRACER=y 1261CONFIG_HAVE_FUNCTION_TRACER=y
1215CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1262CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1229,9 +1276,6 @@ CONFIG_TRACING_SUPPORT=y
1229# CONFIG_SAMPLES is not set 1276# CONFIG_SAMPLES is not set
1230CONFIG_HAVE_ARCH_KGDB=y 1277CONFIG_HAVE_ARCH_KGDB=y
1231# CONFIG_SH_STANDARD_BIOS is not set 1278# CONFIG_SH_STANDARD_BIOS is not set
1232CONFIG_EARLY_SCIF_CONSOLE=y
1233CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe00000
1234CONFIG_EARLY_PRINTK=y
1235# CONFIG_DWARF_UNWINDER is not set 1279# CONFIG_DWARF_UNWINDER is not set
1236 1280
1237# 1281#
@@ -1240,7 +1284,11 @@ CONFIG_EARLY_PRINTK=y
1240# CONFIG_KEYS is not set 1284# CONFIG_KEYS is not set
1241# CONFIG_SECURITY is not set 1285# CONFIG_SECURITY is not set
1242# CONFIG_SECURITYFS is not set 1286# CONFIG_SECURITYFS is not set
1243# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1287# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1288# CONFIG_DEFAULT_SECURITY_SMACK is not set
1289# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1290CONFIG_DEFAULT_SECURITY_DAC=y
1291CONFIG_DEFAULT_SECURITY=""
1244CONFIG_CRYPTO=y 1292CONFIG_CRYPTO=y
1245 1293
1246# 1294#
diff --git a/arch/sh/configs/polaris_defconfig b/arch/sh/configs/polaris_defconfig
index 7fc1952419aa..d50c0314281e 100644
--- a/arch/sh/configs/polaris_defconfig
+++ b/arch/sh/configs/polaris_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:20:53 2009 4# Mon Jan 4 11:45:25 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -29,6 +29,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 29CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 30CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
32CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 34CONFIG_CONSTRUCTORS=y
34 35
@@ -63,6 +64,7 @@ CONFIG_AUDIT=y
63# 64#
64CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +104,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 104CONFIG_SHMEM=y
103CONFIG_AIO=y 105CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 106CONFIG_HAVE_PERF_EVENTS=y
107CONFIG_PERF_USE_VMALLOC=y
105 108
106# 109#
107# Kernel Performance Events And Counters 110# Kernel Performance Events And Counters
@@ -120,6 +123,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
120CONFIG_HAVE_KPROBES=y 123CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 124CONFIG_HAVE_KRETPROBES=y
122CONFIG_HAVE_ARCH_TRACEHOOK=y 125CONFIG_HAVE_ARCH_TRACEHOOK=y
126CONFIG_HAVE_DMA_ATTRS=y
123CONFIG_HAVE_CLK=y 127CONFIG_HAVE_CLK=y
124CONFIG_HAVE_DMA_API_DEBUG=y 128CONFIG_HAVE_DMA_API_DEBUG=y
125 129
@@ -146,14 +150,41 @@ CONFIG_LBDAF=y
146# IO Schedulers 150# IO Schedulers
147# 151#
148CONFIG_IOSCHED_NOOP=y 152CONFIG_IOSCHED_NOOP=y
149# CONFIG_IOSCHED_AS is not set
150# CONFIG_IOSCHED_DEADLINE is not set 153# CONFIG_IOSCHED_DEADLINE is not set
151CONFIG_IOSCHED_CFQ=y 154CONFIG_IOSCHED_CFQ=y
152# CONFIG_DEFAULT_AS is not set
153# CONFIG_DEFAULT_DEADLINE is not set 155# CONFIG_DEFAULT_DEADLINE is not set
154CONFIG_DEFAULT_CFQ=y 156CONFIG_DEFAULT_CFQ=y
155# CONFIG_DEFAULT_NOOP is not set 157# CONFIG_DEFAULT_NOOP is not set
156CONFIG_DEFAULT_IOSCHED="cfq" 158CONFIG_DEFAULT_IOSCHED="cfq"
159# CONFIG_INLINE_SPIN_TRYLOCK is not set
160# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK is not set
162# CONFIG_INLINE_SPIN_LOCK_BH is not set
163# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
164# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
165# CONFIG_INLINE_SPIN_UNLOCK is not set
166# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
167# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
168# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
169# CONFIG_INLINE_READ_TRYLOCK is not set
170# CONFIG_INLINE_READ_LOCK is not set
171# CONFIG_INLINE_READ_LOCK_BH is not set
172# CONFIG_INLINE_READ_LOCK_IRQ is not set
173# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
174# CONFIG_INLINE_READ_UNLOCK is not set
175# CONFIG_INLINE_READ_UNLOCK_BH is not set
176# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
177# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
178# CONFIG_INLINE_WRITE_TRYLOCK is not set
179# CONFIG_INLINE_WRITE_LOCK is not set
180# CONFIG_INLINE_WRITE_LOCK_BH is not set
181# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
182# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
183# CONFIG_INLINE_WRITE_UNLOCK is not set
184# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
185# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
186# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
187# CONFIG_MUTEX_SPIN_ON_OWNER is not set
157# CONFIG_FREEZER is not set 188# CONFIG_FREEZER is not set
158 189
159# 190#
@@ -225,12 +256,10 @@ CONFIG_FLATMEM=y
225CONFIG_FLAT_NODE_MEM_MAP=y 256CONFIG_FLAT_NODE_MEM_MAP=y
226CONFIG_SPARSEMEM_STATIC=y 257CONFIG_SPARSEMEM_STATIC=y
227CONFIG_PAGEFLAGS_EXTENDED=y 258CONFIG_PAGEFLAGS_EXTENDED=y
228CONFIG_SPLIT_PTLOCK_CPUS=4 259CONFIG_SPLIT_PTLOCK_CPUS=999999
229# CONFIG_PHYS_ADDR_T_64BIT is not set 260# CONFIG_PHYS_ADDR_T_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=0 261CONFIG_ZONE_DMA_FLAG=0
231CONFIG_NR_QUICK=2 262CONFIG_NR_QUICK=2
232CONFIG_HAVE_MLOCK=y
233CONFIG_HAVE_MLOCKED_PAGE_BIT=y
234# CONFIG_KSM is not set 263# CONFIG_KSM is not set
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 264CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236 265
@@ -279,8 +308,8 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
279# 308#
280# DMA support 309# DMA support
281# 310#
282CONFIG_SH_DMA_API=y
283CONFIG_SH_DMA=y 311CONFIG_SH_DMA=y
312CONFIG_SH_DMA_API=y
284CONFIG_NR_ONCHIP_DMA_CHANNELS=6 313CONFIG_NR_ONCHIP_DMA_CHANNELS=6
285# CONFIG_NR_DMA_CHANNELS_BOOL is not set 314# CONFIG_NR_DMA_CHANNELS_BOOL is not set
286 315
@@ -409,7 +438,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
409# CONFIG_IRDA is not set 438# CONFIG_IRDA is not set
410# CONFIG_BT is not set 439# CONFIG_BT is not set
411# CONFIG_AF_RXRPC is not set 440# CONFIG_AF_RXRPC is not set
412# CONFIG_WIRELESS is not set 441CONFIG_WIRELESS=y
442# CONFIG_CFG80211 is not set
443# CONFIG_LIB80211 is not set
444
445#
446# CFG80211 needs to be enabled for MAC80211
447#
413# CONFIG_WIMAX is not set 448# CONFIG_WIMAX is not set
414# CONFIG_RFKILL is not set 449# CONFIG_RFKILL is not set
415# CONFIG_NET_9P is not set 450# CONFIG_NET_9P is not set
@@ -525,6 +560,10 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
525CONFIG_BLK_DEV=y 560CONFIG_BLK_DEV=y
526# CONFIG_BLK_DEV_COW_COMMON is not set 561# CONFIG_BLK_DEV_COW_COMMON is not set
527# CONFIG_BLK_DEV_LOOP is not set 562# CONFIG_BLK_DEV_LOOP is not set
563
564#
565# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
566#
528# CONFIG_BLK_DEV_NBD is not set 567# CONFIG_BLK_DEV_NBD is not set
529# CONFIG_BLK_DEV_RAM is not set 568# CONFIG_BLK_DEV_RAM is not set
530# CONFIG_CDROM_PKTCDVD is not set 569# CONFIG_CDROM_PKTCDVD is not set
@@ -595,11 +634,11 @@ CONFIG_SMSC911X=y
595# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 634# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
596# CONFIG_B44 is not set 635# CONFIG_B44 is not set
597# CONFIG_KS8842 is not set 636# CONFIG_KS8842 is not set
637# CONFIG_KS8851_MLL is not set
598# CONFIG_NETDEV_1000 is not set 638# CONFIG_NETDEV_1000 is not set
599# CONFIG_NETDEV_10000 is not set 639# CONFIG_NETDEV_10000 is not set
600CONFIG_WLAN=y 640CONFIG_WLAN=y
601# CONFIG_WLAN_PRE80211 is not set 641# CONFIG_HOSTAP is not set
602# CONFIG_WLAN_80211 is not set
603 642
604# 643#
605# Enable WiMAX (Networking options) to see the WiMAX drivers 644# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -619,6 +658,7 @@ CONFIG_WLAN=y
619CONFIG_INPUT=y 658CONFIG_INPUT=y
620# CONFIG_INPUT_FF_MEMLESS is not set 659# CONFIG_INPUT_FF_MEMLESS is not set
621# CONFIG_INPUT_POLLDEV is not set 660# CONFIG_INPUT_POLLDEV is not set
661# CONFIG_INPUT_SPARSEKMAP is not set
622 662
623# 663#
624# Userland interfaces 664# Userland interfaces
@@ -657,7 +697,6 @@ CONFIG_SERIAL_NONSTANDARD=y
657# CONFIG_N_HDLC is not set 697# CONFIG_N_HDLC is not set
658# CONFIG_RISCOM8 is not set 698# CONFIG_RISCOM8 is not set
659# CONFIG_SPECIALIX is not set 699# CONFIG_SPECIALIX is not set
660# CONFIG_RIO is not set
661# CONFIG_STALDRV is not set 700# CONFIG_STALDRV is not set
662 701
663# 702#
@@ -705,6 +744,7 @@ CONFIG_SSB_POSSIBLE=y
705# 744#
706# CONFIG_MFD_CORE is not set 745# CONFIG_MFD_CORE is not set
707# CONFIG_MFD_SM501 is not set 746# CONFIG_MFD_SM501 is not set
747# CONFIG_MFD_SH_MOBILE_SDHI is not set
708# CONFIG_HTC_PASIC3 is not set 748# CONFIG_HTC_PASIC3 is not set
709# CONFIG_MFD_TMIO is not set 749# CONFIG_MFD_TMIO is not set
710# CONFIG_REGULATOR is not set 750# CONFIG_REGULATOR is not set
@@ -764,7 +804,9 @@ CONFIG_RTC_INTF_DEV=y
764# CONFIG_RTC_DRV_M48T86 is not set 804# CONFIG_RTC_DRV_M48T86 is not set
765# CONFIG_RTC_DRV_M48T35 is not set 805# CONFIG_RTC_DRV_M48T35 is not set
766# CONFIG_RTC_DRV_M48T59 is not set 806# CONFIG_RTC_DRV_M48T59 is not set
807# CONFIG_RTC_DRV_MSM6242 is not set
767# CONFIG_RTC_DRV_BQ4802 is not set 808# CONFIG_RTC_DRV_BQ4802 is not set
809# CONFIG_RTC_DRV_RP5C01 is not set
768# CONFIG_RTC_DRV_V3020 is not set 810# CONFIG_RTC_DRV_V3020 is not set
769 811
770# 812#
@@ -787,6 +829,7 @@ CONFIG_RTC_DRV_SH=y
787# CONFIG_EXT2_FS is not set 829# CONFIG_EXT2_FS is not set
788# CONFIG_EXT3_FS is not set 830# CONFIG_EXT3_FS is not set
789# CONFIG_EXT4_FS is not set 831# CONFIG_EXT4_FS is not set
832CONFIG_EXT4_USE_FOR_EXT23=y
790# CONFIG_REISERFS_FS is not set 833# CONFIG_REISERFS_FS is not set
791# CONFIG_JFS_FS is not set 834# CONFIG_JFS_FS is not set
792# CONFIG_FS_POSIX_ACL is not set 835# CONFIG_FS_POSIX_ACL is not set
@@ -833,7 +876,6 @@ CONFIG_PROC_PAGE_MONITOR=y
833CONFIG_SYSFS=y 876CONFIG_SYSFS=y
834CONFIG_TMPFS=y 877CONFIG_TMPFS=y
835# CONFIG_TMPFS_POSIX_ACL is not set 878# CONFIG_TMPFS_POSIX_ACL is not set
836# CONFIG_HUGETLBFS is not set
837# CONFIG_HUGETLB_PAGE is not set 879# CONFIG_HUGETLB_PAGE is not set
838# CONFIG_CONFIGFS_FS is not set 880# CONFIG_CONFIGFS_FS is not set
839CONFIG_MISC_FILESYSTEMS=y 881CONFIG_MISC_FILESYSTEMS=y
@@ -977,9 +1019,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
977CONFIG_HAVE_ARCH_KGDB=y 1019CONFIG_HAVE_ARCH_KGDB=y
978# CONFIG_KGDB is not set 1020# CONFIG_KGDB is not set
979# CONFIG_SH_STANDARD_BIOS is not set 1021# CONFIG_SH_STANDARD_BIOS is not set
980CONFIG_EARLY_SCIF_CONSOLE=y
981CONFIG_EARLY_SCIF_CONSOLE_PORT=0xa4000150
982CONFIG_EARLY_PRINTK=y
983# CONFIG_STACK_DEBUG is not set 1022# CONFIG_STACK_DEBUG is not set
984# CONFIG_DEBUG_STACK_USAGE is not set 1023# CONFIG_DEBUG_STACK_USAGE is not set
985# CONFIG_4KSTACKS is not set 1024# CONFIG_4KSTACKS is not set
@@ -993,7 +1032,11 @@ CONFIG_DUMP_CODE=y
993# CONFIG_KEYS is not set 1032# CONFIG_KEYS is not set
994# CONFIG_SECURITY is not set 1033# CONFIG_SECURITY is not set
995# CONFIG_SECURITYFS is not set 1034# CONFIG_SECURITYFS is not set
996# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1035# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1036# CONFIG_DEFAULT_SECURITY_SMACK is not set
1037# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1038CONFIG_DEFAULT_SECURITY_DAC=y
1039CONFIG_DEFAULT_SECURITY=""
997# CONFIG_CRYPTO is not set 1040# CONFIG_CRYPTO is not set
998# CONFIG_BINARY_PRINTF is not set 1041# CONFIG_BINARY_PRINTF is not set
999 1042
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index 903b021e8d93..efda63d4070a 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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:24:31 2009 4# Mon Jan 4 13:16:13 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -31,6 +32,7 @@ CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_IO_TRAPPED=y 34CONFIG_IO_TRAPPED=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -63,6 +65,7 @@ CONFIG_BSD_PROCESS_ACCT=y
63# 65#
64CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 69# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,6 +106,7 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -110,6 +114,7 @@ CONFIG_HAVE_PERF_EVENTS=y
110CONFIG_PERF_EVENTS=y 114CONFIG_PERF_EVENTS=y
111CONFIG_EVENT_PROFILE=y 115CONFIG_EVENT_PROFILE=y
112# CONFIG_PERF_COUNTERS is not set 116# CONFIG_PERF_COUNTERS is not set
117# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
113CONFIG_VM_EVENT_COUNTERS=y 118CONFIG_VM_EVENT_COUNTERS=y
114CONFIG_PCI_QUIRKS=y 119CONFIG_PCI_QUIRKS=y
115CONFIG_COMPAT_BRK=y 120CONFIG_COMPAT_BRK=y
@@ -125,6 +130,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
125CONFIG_HAVE_KPROBES=y 130CONFIG_HAVE_KPROBES=y
126CONFIG_HAVE_KRETPROBES=y 131CONFIG_HAVE_KRETPROBES=y
127CONFIG_HAVE_ARCH_TRACEHOOK=y 132CONFIG_HAVE_ARCH_TRACEHOOK=y
133CONFIG_HAVE_DMA_ATTRS=y
128CONFIG_HAVE_CLK=y 134CONFIG_HAVE_CLK=y
129CONFIG_HAVE_DMA_API_DEBUG=y 135CONFIG_HAVE_DMA_API_DEBUG=y
130 136
@@ -135,6 +141,7 @@ CONFIG_HAVE_DMA_API_DEBUG=y
135# CONFIG_SLOW_WORK is not set 141# CONFIG_SLOW_WORK is not set
136CONFIG_HAVE_GENERIC_DMA_COHERENT=y 142CONFIG_HAVE_GENERIC_DMA_COHERENT=y
137CONFIG_SLABINFO=y 143CONFIG_SLABINFO=y
144CONFIG_RT_MUTEXES=y
138CONFIG_BASE_SMALL=0 145CONFIG_BASE_SMALL=0
139CONFIG_MODULES=y 146CONFIG_MODULES=y
140# CONFIG_MODULE_FORCE_LOAD is not set 147# CONFIG_MODULE_FORCE_LOAD is not set
@@ -151,14 +158,41 @@ CONFIG_LBDAF=y
151# IO Schedulers 158# IO Schedulers
152# 159#
153CONFIG_IOSCHED_NOOP=y 160CONFIG_IOSCHED_NOOP=y
154# CONFIG_IOSCHED_AS is not set
155# CONFIG_IOSCHED_DEADLINE is not set 161# CONFIG_IOSCHED_DEADLINE is not set
156# CONFIG_IOSCHED_CFQ is not set 162# CONFIG_IOSCHED_CFQ is not set
157# CONFIG_DEFAULT_AS is not set
158# CONFIG_DEFAULT_DEADLINE is not set 163# CONFIG_DEFAULT_DEADLINE is not set
159# CONFIG_DEFAULT_CFQ is not set 164# CONFIG_DEFAULT_CFQ is not set
160CONFIG_DEFAULT_NOOP=y 165CONFIG_DEFAULT_NOOP=y
161CONFIG_DEFAULT_IOSCHED="noop" 166CONFIG_DEFAULT_IOSCHED="noop"
167# CONFIG_INLINE_SPIN_TRYLOCK is not set
168# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
169# CONFIG_INLINE_SPIN_LOCK is not set
170# CONFIG_INLINE_SPIN_LOCK_BH is not set
171# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
172# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
173# CONFIG_INLINE_SPIN_UNLOCK is not set
174# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
175# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
176# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
177# CONFIG_INLINE_READ_TRYLOCK is not set
178# CONFIG_INLINE_READ_LOCK is not set
179# CONFIG_INLINE_READ_LOCK_BH is not set
180# CONFIG_INLINE_READ_LOCK_IRQ is not set
181# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
182# CONFIG_INLINE_READ_UNLOCK is not set
183# CONFIG_INLINE_READ_UNLOCK_BH is not set
184# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
185# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
186# CONFIG_INLINE_WRITE_TRYLOCK is not set
187# CONFIG_INLINE_WRITE_LOCK is not set
188# CONFIG_INLINE_WRITE_LOCK_BH is not set
189# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
190# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
191# CONFIG_INLINE_WRITE_UNLOCK is not set
192# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
193# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
194# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
195# CONFIG_MUTEX_SPIN_ON_OWNER is not set
162# CONFIG_FREEZER is not set 196# CONFIG_FREEZER is not set
163 197
164# 198#
@@ -245,8 +279,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
245# CONFIG_PHYS_ADDR_T_64BIT is not set 279# CONFIG_PHYS_ADDR_T_64BIT is not set
246CONFIG_ZONE_DMA_FLAG=0 280CONFIG_ZONE_DMA_FLAG=0
247CONFIG_NR_QUICK=2 281CONFIG_NR_QUICK=2
248CONFIG_HAVE_MLOCK=y
249CONFIG_HAVE_MLOCKED_PAGE_BIT=y
250# CONFIG_KSM is not set 282# CONFIG_KSM is not set
251CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 283CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
252 284
@@ -342,7 +374,6 @@ CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
342# Bus options 374# Bus options
343# 375#
344CONFIG_PCI=y 376CONFIG_PCI=y
345CONFIG_SH_PCIDMA_NONCOHERENT=y
346# CONFIG_PCIEPORTBUS is not set 377# CONFIG_PCIEPORTBUS is not set
347# CONFIG_ARCH_SUPPORTS_MSI is not set 378# CONFIG_ARCH_SUPPORTS_MSI is not set
348CONFIG_PCI_LEGACY=y 379CONFIG_PCI_LEGACY=y
@@ -449,10 +480,6 @@ CONFIG_LLC=m
449# CONFIG_AF_RXRPC is not set 480# CONFIG_AF_RXRPC is not set
450CONFIG_WIRELESS=y 481CONFIG_WIRELESS=y
451# CONFIG_CFG80211 is not set 482# CONFIG_CFG80211 is not set
452CONFIG_CFG80211_DEFAULT_PS_VALUE=0
453# CONFIG_WIRELESS_OLD_REGULATORY is not set
454CONFIG_WIRELESS_EXT=y
455CONFIG_WIRELESS_EXT_SYSFS=y
456# CONFIG_LIB80211 is not set 483# CONFIG_LIB80211 is not set
457 484
458# 485#
@@ -535,7 +562,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
535CONFIG_MTD_PHYSMAP=y 562CONFIG_MTD_PHYSMAP=y
536# CONFIG_MTD_PHYSMAP_COMPAT is not set 563# CONFIG_MTD_PHYSMAP_COMPAT is not set
537# CONFIG_MTD_PCI is not set 564# CONFIG_MTD_PCI is not set
538# CONFIG_MTD_GPIO_ADDR is not set
539# CONFIG_MTD_INTEL_VR_NOR is not set 565# CONFIG_MTD_INTEL_VR_NOR is not set
540# CONFIG_MTD_PLATRAM is not set 566# CONFIG_MTD_PLATRAM is not set
541 567
@@ -573,6 +599,10 @@ CONFIG_BLK_DEV=y
573# CONFIG_BLK_DEV_UMEM is not set 599# CONFIG_BLK_DEV_UMEM is not set
574# CONFIG_BLK_DEV_COW_COMMON is not set 600# CONFIG_BLK_DEV_COW_COMMON is not set
575# CONFIG_BLK_DEV_LOOP is not set 601# CONFIG_BLK_DEV_LOOP is not set
602
603#
604# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
605#
576# CONFIG_BLK_DEV_NBD is not set 606# CONFIG_BLK_DEV_NBD is not set
577# CONFIG_BLK_DEV_SX8 is not set 607# CONFIG_BLK_DEV_SX8 is not set
578CONFIG_BLK_DEV_RAM=y 608CONFIG_BLK_DEV_RAM=y
@@ -583,6 +613,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
583# CONFIG_ATA_OVER_ETH is not set 613# CONFIG_ATA_OVER_ETH is not set
584# CONFIG_BLK_DEV_HD is not set 614# CONFIG_BLK_DEV_HD is not set
585CONFIG_MISC_DEVICES=y 615CONFIG_MISC_DEVICES=y
616# CONFIG_AD525X_DPOT is not set
586# CONFIG_PHANTOM is not set 617# CONFIG_PHANTOM is not set
587# CONFIG_SGI_IOC4 is not set 618# CONFIG_SGI_IOC4 is not set
588# CONFIG_TIFM_CORE is not set 619# CONFIG_TIFM_CORE is not set
@@ -590,6 +621,7 @@ CONFIG_MISC_DEVICES=y
590# CONFIG_ENCLOSURE_SERVICES is not set 621# CONFIG_ENCLOSURE_SERVICES is not set
591# CONFIG_HP_ILO is not set 622# CONFIG_HP_ILO is not set
592# CONFIG_ISL29003 is not set 623# CONFIG_ISL29003 is not set
624# CONFIG_DS1682 is not set
593# CONFIG_C2PORT is not set 625# CONFIG_C2PORT is not set
594 626
595# 627#
@@ -640,8 +672,11 @@ CONFIG_SCSI_LOWLEVEL=y
640# CONFIG_ISCSI_TCP is not set 672# CONFIG_ISCSI_TCP is not set
641# CONFIG_SCSI_CXGB3_ISCSI is not set 673# CONFIG_SCSI_CXGB3_ISCSI is not set
642# CONFIG_SCSI_BNX2_ISCSI is not set 674# CONFIG_SCSI_BNX2_ISCSI is not set
675# CONFIG_BE2ISCSI is not set
643# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 676# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
677# CONFIG_SCSI_HPSA is not set
644# CONFIG_SCSI_3W_9XXX is not set 678# CONFIG_SCSI_3W_9XXX is not set
679# CONFIG_SCSI_3W_SAS is not set
645# CONFIG_SCSI_ACARD is not set 680# CONFIG_SCSI_ACARD is not set
646# CONFIG_SCSI_AACRAID is not set 681# CONFIG_SCSI_AACRAID is not set
647# CONFIG_SCSI_AIC7XXX is not set 682# CONFIG_SCSI_AIC7XXX is not set
@@ -675,7 +710,9 @@ CONFIG_SCSI_LOWLEVEL=y
675# CONFIG_SCSI_NSP32 is not set 710# CONFIG_SCSI_NSP32 is not set
676# CONFIG_SCSI_DEBUG is not set 711# CONFIG_SCSI_DEBUG is not set
677# CONFIG_SCSI_PMCRAID is not set 712# CONFIG_SCSI_PMCRAID is not set
713# CONFIG_SCSI_PM8001 is not set
678# CONFIG_SCSI_SRP is not set 714# CONFIG_SCSI_SRP is not set
715# CONFIG_SCSI_BFA_FC is not set
679# CONFIG_SCSI_DH is not set 716# CONFIG_SCSI_DH is not set
680# CONFIG_SCSI_OSD_INITIATOR is not set 717# CONFIG_SCSI_OSD_INITIATOR is not set
681CONFIG_ATA=y 718CONFIG_ATA=y
@@ -728,15 +765,16 @@ CONFIG_SATA_SIL=y
728# CONFIG_PATA_NS87415 is not set 765# CONFIG_PATA_NS87415 is not set
729# CONFIG_PATA_OPTI is not set 766# CONFIG_PATA_OPTI is not set
730# CONFIG_PATA_OPTIDMA is not set 767# CONFIG_PATA_OPTIDMA is not set
768# CONFIG_PATA_PDC2027X is not set
731# CONFIG_PATA_PDC_OLD is not set 769# CONFIG_PATA_PDC_OLD is not set
732# CONFIG_PATA_RADISYS is not set 770# CONFIG_PATA_RADISYS is not set
733# CONFIG_PATA_RDC is not set 771# CONFIG_PATA_RDC is not set
734# CONFIG_PATA_RZ1000 is not set 772# CONFIG_PATA_RZ1000 is not set
735# CONFIG_PATA_SC1200 is not set 773# CONFIG_PATA_SC1200 is not set
736# CONFIG_PATA_SERVERWORKS is not set 774# CONFIG_PATA_SERVERWORKS is not set
737# CONFIG_PATA_PDC2027X is not set
738# CONFIG_PATA_SIL680 is not set 775# CONFIG_PATA_SIL680 is not set
739# CONFIG_PATA_SIS is not set 776# CONFIG_PATA_SIS is not set
777# CONFIG_PATA_TOSHIBA is not set
740# CONFIG_PATA_VIA is not set 778# CONFIG_PATA_VIA is not set
741# CONFIG_PATA_WINBOND is not set 779# CONFIG_PATA_WINBOND is not set
742CONFIG_PATA_PLATFORM=y 780CONFIG_PATA_PLATFORM=y
@@ -813,6 +851,7 @@ CONFIG_8139TOO_8129=y
813# CONFIG_SUNDANCE is not set 851# CONFIG_SUNDANCE is not set
814# CONFIG_TLAN is not set 852# CONFIG_TLAN is not set
815# CONFIG_KS8842 is not set 853# CONFIG_KS8842 is not set
854# CONFIG_KS8851_MLL is not set
816CONFIG_VIA_RHINE=m 855CONFIG_VIA_RHINE=m
817CONFIG_VIA_RHINE_MMIO=y 856CONFIG_VIA_RHINE_MMIO=y
818# CONFIG_SC92031 is not set 857# CONFIG_SC92031 is not set
@@ -862,8 +901,9 @@ CONFIG_CHELSIO_T3_DEPENDS=y
862# CONFIG_BE2NET is not set 901# CONFIG_BE2NET is not set
863# CONFIG_TR is not set 902# CONFIG_TR is not set
864CONFIG_WLAN=y 903CONFIG_WLAN=y
865# CONFIG_WLAN_PRE80211 is not set 904# CONFIG_ATMEL is not set
866# CONFIG_WLAN_80211 is not set 905# CONFIG_PRISM54 is not set
906# CONFIG_HOSTAP is not set
867 907
868# 908#
869# Enable WiMAX (Networking options) to see the WiMAX drivers 909# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -877,6 +917,7 @@ CONFIG_WLAN=y
877# CONFIG_NETCONSOLE is not set 917# CONFIG_NETCONSOLE is not set
878# CONFIG_NETPOLL is not set 918# CONFIG_NETPOLL is not set
879# CONFIG_NET_POLL_CONTROLLER is not set 919# CONFIG_NET_POLL_CONTROLLER is not set
920# CONFIG_VMXNET3 is not set
880# CONFIG_ISDN is not set 921# CONFIG_ISDN is not set
881# CONFIG_PHONE is not set 922# CONFIG_PHONE is not set
882 923
@@ -886,6 +927,7 @@ CONFIG_WLAN=y
886CONFIG_INPUT=y 927CONFIG_INPUT=y
887# CONFIG_INPUT_FF_MEMLESS is not set 928# CONFIG_INPUT_FF_MEMLESS is not set
888# CONFIG_INPUT_POLLDEV is not set 929# CONFIG_INPUT_POLLDEV is not set
930# CONFIG_INPUT_SPARSEKMAP is not set
889 931
890# 932#
891# Userland interfaces 933# Userland interfaces
@@ -928,6 +970,7 @@ CONFIG_SERIO=y
928# CONFIG_SERIO_PCIPS2 is not set 970# CONFIG_SERIO_PCIPS2 is not set
929CONFIG_SERIO_LIBPS2=y 971CONFIG_SERIO_LIBPS2=y
930# CONFIG_SERIO_RAW is not set 972# CONFIG_SERIO_RAW is not set
973# CONFIG_SERIO_ALTERA_PS2 is not set
931# CONFIG_GAMEPORT is not set 974# CONFIG_GAMEPORT is not set
932 975
933# 976#
@@ -1008,11 +1051,6 @@ CONFIG_I2C_HIGHLANDER=y
1008# CONFIG_I2C_TAOS_EVM is not set 1051# CONFIG_I2C_TAOS_EVM is not set
1009 1052
1010# 1053#
1011# Graphics adapter I2C/DDC channel drivers
1012#
1013# CONFIG_I2C_VOODOO3 is not set
1014
1015#
1016# Other I2C/SMBus bus drivers 1054# Other I2C/SMBus bus drivers
1017# 1055#
1018# CONFIG_I2C_PCA_PLATFORM is not set 1056# CONFIG_I2C_PCA_PLATFORM is not set
@@ -1021,7 +1059,6 @@ CONFIG_I2C_HIGHLANDER=y
1021# 1059#
1022# Miscellaneous I2C Chip support 1060# Miscellaneous I2C Chip support
1023# 1061#
1024# CONFIG_DS1682 is not set
1025# CONFIG_SENSORS_TSL2550 is not set 1062# CONFIG_SENSORS_TSL2550 is not set
1026# CONFIG_I2C_DEBUG_CORE is not set 1063# CONFIG_I2C_DEBUG_CORE is not set
1027# CONFIG_I2C_DEBUG_ALGO is not set 1064# CONFIG_I2C_DEBUG_ALGO is not set
@@ -1065,6 +1102,7 @@ CONFIG_HWMON=y
1065# CONFIG_SENSORS_GL520SM is not set 1102# CONFIG_SENSORS_GL520SM is not set
1066# CONFIG_SENSORS_IT87 is not set 1103# CONFIG_SENSORS_IT87 is not set
1067# CONFIG_SENSORS_LM63 is not set 1104# CONFIG_SENSORS_LM63 is not set
1105# CONFIG_SENSORS_LM73 is not set
1068# CONFIG_SENSORS_LM75 is not set 1106# CONFIG_SENSORS_LM75 is not set
1069# CONFIG_SENSORS_LM77 is not set 1107# CONFIG_SENSORS_LM77 is not set
1070# CONFIG_SENSORS_LM78 is not set 1108# CONFIG_SENSORS_LM78 is not set
@@ -1103,6 +1141,7 @@ CONFIG_HWMON=y
1103# CONFIG_SENSORS_W83L786NG is not set 1141# CONFIG_SENSORS_W83L786NG is not set
1104# CONFIG_SENSORS_W83627HF is not set 1142# CONFIG_SENSORS_W83627HF is not set
1105# CONFIG_SENSORS_W83627EHF is not set 1143# CONFIG_SENSORS_W83627EHF is not set
1144# CONFIG_SENSORS_LIS3_I2C is not set
1106CONFIG_THERMAL=y 1145CONFIG_THERMAL=y
1107# CONFIG_THERMAL_HWMON is not set 1146# CONFIG_THERMAL_HWMON is not set
1108# CONFIG_WATCHDOG is not set 1147# CONFIG_WATCHDOG is not set
@@ -1118,15 +1157,18 @@ CONFIG_SSB_POSSIBLE=y
1118# 1157#
1119# CONFIG_MFD_CORE is not set 1158# CONFIG_MFD_CORE is not set
1120# CONFIG_MFD_SM501 is not set 1159# CONFIG_MFD_SM501 is not set
1160# CONFIG_MFD_SH_MOBILE_SDHI is not set
1121# CONFIG_HTC_PASIC3 is not set 1161# CONFIG_HTC_PASIC3 is not set
1122# CONFIG_TWL4030_CORE is not set 1162# CONFIG_TWL4030_CORE is not set
1123# CONFIG_MFD_TMIO is not set 1163# CONFIG_MFD_TMIO is not set
1124# CONFIG_PMIC_DA903X is not set 1164# CONFIG_PMIC_DA903X is not set
1165# CONFIG_PMIC_ADP5520 is not set
1125# CONFIG_MFD_WM8400 is not set 1166# CONFIG_MFD_WM8400 is not set
1126# CONFIG_MFD_WM831X is not set 1167# CONFIG_MFD_WM831X is not set
1127# CONFIG_MFD_WM8350_I2C is not set 1168# CONFIG_MFD_WM8350_I2C is not set
1128# CONFIG_MFD_PCF50633 is not set 1169# CONFIG_MFD_PCF50633 is not set
1129# CONFIG_AB3100_CORE is not set 1170# CONFIG_AB3100_CORE is not set
1171# CONFIG_MFD_88PM8607 is not set
1130# CONFIG_REGULATOR is not set 1172# CONFIG_REGULATOR is not set
1131# CONFIG_MEDIA_SUPPORT is not set 1173# CONFIG_MEDIA_SUPPORT is not set
1132 1174
@@ -1211,6 +1253,7 @@ CONFIG_RTC_DRV_RS5C372=y
1211# CONFIG_RTC_DRV_PCF8563 is not set 1253# CONFIG_RTC_DRV_PCF8563 is not set
1212# CONFIG_RTC_DRV_PCF8583 is not set 1254# CONFIG_RTC_DRV_PCF8583 is not set
1213# CONFIG_RTC_DRV_M41T80 is not set 1255# CONFIG_RTC_DRV_M41T80 is not set
1256# CONFIG_RTC_DRV_BQ32K is not set
1214# CONFIG_RTC_DRV_S35390A is not set 1257# CONFIG_RTC_DRV_S35390A is not set
1215# CONFIG_RTC_DRV_FM3130 is not set 1258# CONFIG_RTC_DRV_FM3130 is not set
1216# CONFIG_RTC_DRV_RX8581 is not set 1259# CONFIG_RTC_DRV_RX8581 is not set
@@ -1231,7 +1274,9 @@ CONFIG_RTC_DRV_RS5C372=y
1231# CONFIG_RTC_DRV_M48T86 is not set 1274# CONFIG_RTC_DRV_M48T86 is not set
1232# CONFIG_RTC_DRV_M48T35 is not set 1275# CONFIG_RTC_DRV_M48T35 is not set
1233# CONFIG_RTC_DRV_M48T59 is not set 1276# CONFIG_RTC_DRV_M48T59 is not set
1277# CONFIG_RTC_DRV_MSM6242 is not set
1234# CONFIG_RTC_DRV_BQ4802 is not set 1278# CONFIG_RTC_DRV_BQ4802 is not set
1279# CONFIG_RTC_DRV_RP5C01 is not set
1235# CONFIG_RTC_DRV_V3020 is not set 1280# CONFIG_RTC_DRV_V3020 is not set
1236 1281
1237# 1282#
@@ -1436,6 +1481,8 @@ CONFIG_SCHED_DEBUG=y
1436# CONFIG_DEBUG_OBJECTS is not set 1481# CONFIG_DEBUG_OBJECTS is not set
1437# CONFIG_DEBUG_SLAB is not set 1482# CONFIG_DEBUG_SLAB is not set
1438# CONFIG_DEBUG_PREEMPT is not set 1483# CONFIG_DEBUG_PREEMPT is not set
1484# CONFIG_DEBUG_RT_MUTEXES is not set
1485# CONFIG_RT_MUTEX_TESTER is not set
1439# CONFIG_DEBUG_SPINLOCK is not set 1486# CONFIG_DEBUG_SPINLOCK is not set
1440# CONFIG_DEBUG_MUTEXES is not set 1487# CONFIG_DEBUG_MUTEXES is not set
1441# CONFIG_DEBUG_LOCK_ALLOC is not set 1488# CONFIG_DEBUG_LOCK_ALLOC is not set
@@ -1462,6 +1509,7 @@ CONFIG_DEBUG_INFO=y
1462# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set 1509# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1463# CONFIG_FAULT_INJECTION is not set 1510# CONFIG_FAULT_INJECTION is not set
1464# CONFIG_LATENCYTOP is not set 1511# CONFIG_LATENCYTOP is not set
1512# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1465# CONFIG_PAGE_POISONING is not set 1513# CONFIG_PAGE_POISONING is not set
1466CONFIG_NOP_TRACER=y 1514CONFIG_NOP_TRACER=y
1467CONFIG_HAVE_FUNCTION_TRACER=y 1515CONFIG_HAVE_FUNCTION_TRACER=y
@@ -1498,9 +1546,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1498CONFIG_HAVE_ARCH_KGDB=y 1546CONFIG_HAVE_ARCH_KGDB=y
1499# CONFIG_KGDB is not set 1547# CONFIG_KGDB is not set
1500# CONFIG_SH_STANDARD_BIOS is not set 1548# CONFIG_SH_STANDARD_BIOS is not set
1501CONFIG_EARLY_SCIF_CONSOLE=y
1502CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe00000
1503# CONFIG_EARLY_PRINTK is not set
1504# CONFIG_STACK_DEBUG is not set 1549# CONFIG_STACK_DEBUG is not set
1505# CONFIG_DEBUG_STACK_USAGE is not set 1550# CONFIG_DEBUG_STACK_USAGE is not set
1506# CONFIG_4KSTACKS is not set 1551# CONFIG_4KSTACKS is not set
@@ -1514,7 +1559,11 @@ CONFIG_DUMP_CODE=y
1514# CONFIG_KEYS is not set 1559# CONFIG_KEYS is not set
1515# CONFIG_SECURITY is not set 1560# CONFIG_SECURITY is not set
1516# CONFIG_SECURITYFS is not set 1561# CONFIG_SECURITYFS is not set
1517# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1562# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1563# CONFIG_DEFAULT_SECURITY_SMACK is not set
1564# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1565CONFIG_DEFAULT_SECURITY_DAC=y
1566CONFIG_DEFAULT_SECURITY=""
1518CONFIG_CRYPTO=y 1567CONFIG_CRYPTO=y
1519 1568
1520# 1569#
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index 27ff46c13a87..f4b00451dcee 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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:29:23 2009 4# Mon Jan 4 13:19:35 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_NUMA=y 24CONFIG_SYS_SUPPORTS_NUMA=y
24CONFIG_SYS_SUPPORTS_PCI=y 25CONFIG_SYS_SUPPORTS_PCI=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
@@ -32,6 +33,7 @@ CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_IO_TRAPPED=y 35CONFIG_IO_TRAPPED=y
36CONFIG_DMA_NONCOHERENT=y
35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 37CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
36CONFIG_CONSTRUCTORS=y 38CONFIG_CONSTRUCTORS=y
37 39
@@ -67,6 +69,7 @@ CONFIG_AUDIT_TREE=y
67# 69#
68CONFIG_TREE_RCU=y 70CONFIG_TREE_RCU=y
69# CONFIG_TREE_PREEMPT_RCU is not set 71# CONFIG_TREE_PREEMPT_RCU is not set
72# CONFIG_TINY_RCU is not set
70CONFIG_RCU_TRACE=y 73CONFIG_RCU_TRACE=y
71CONFIG_RCU_FANOUT=32 74CONFIG_RCU_FANOUT=32
72# CONFIG_RCU_FANOUT_EXACT is not set 75# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,6 +106,7 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -110,6 +114,7 @@ CONFIG_HAVE_PERF_EVENTS=y
110CONFIG_PERF_EVENTS=y 114CONFIG_PERF_EVENTS=y
111CONFIG_EVENT_PROFILE=y 115CONFIG_EVENT_PROFILE=y
112# CONFIG_PERF_COUNTERS is not set 116# CONFIG_PERF_COUNTERS is not set
117# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
113CONFIG_VM_EVENT_COUNTERS=y 118CONFIG_VM_EVENT_COUNTERS=y
114CONFIG_PCI_QUIRKS=y 119CONFIG_PCI_QUIRKS=y
115CONFIG_COMPAT_BRK=y 120CONFIG_COMPAT_BRK=y
@@ -126,6 +131,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
126CONFIG_HAVE_KPROBES=y 131CONFIG_HAVE_KPROBES=y
127CONFIG_HAVE_KRETPROBES=y 132CONFIG_HAVE_KRETPROBES=y
128CONFIG_HAVE_ARCH_TRACEHOOK=y 133CONFIG_HAVE_ARCH_TRACEHOOK=y
134CONFIG_HAVE_DMA_ATTRS=y
129CONFIG_HAVE_CLK=y 135CONFIG_HAVE_CLK=y
130CONFIG_HAVE_DMA_API_DEBUG=y 136CONFIG_HAVE_DMA_API_DEBUG=y
131 137
@@ -153,14 +159,41 @@ CONFIG_LBDAF=y
153# IO Schedulers 159# IO Schedulers
154# 160#
155CONFIG_IOSCHED_NOOP=y 161CONFIG_IOSCHED_NOOP=y
156# CONFIG_IOSCHED_AS is not set
157# CONFIG_IOSCHED_DEADLINE is not set 162# CONFIG_IOSCHED_DEADLINE is not set
158# CONFIG_IOSCHED_CFQ is not set 163# CONFIG_IOSCHED_CFQ is not set
159# CONFIG_DEFAULT_AS is not set
160# CONFIG_DEFAULT_DEADLINE is not set 164# CONFIG_DEFAULT_DEADLINE is not set
161# CONFIG_DEFAULT_CFQ is not set 165# CONFIG_DEFAULT_CFQ is not set
162CONFIG_DEFAULT_NOOP=y 166CONFIG_DEFAULT_NOOP=y
163CONFIG_DEFAULT_IOSCHED="noop" 167CONFIG_DEFAULT_IOSCHED="noop"
168# CONFIG_INLINE_SPIN_TRYLOCK is not set
169# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
170# CONFIG_INLINE_SPIN_LOCK is not set
171# CONFIG_INLINE_SPIN_LOCK_BH is not set
172# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
173# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
174# CONFIG_INLINE_SPIN_UNLOCK is not set
175# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
176# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
177# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
178# CONFIG_INLINE_READ_TRYLOCK is not set
179# CONFIG_INLINE_READ_LOCK is not set
180# CONFIG_INLINE_READ_LOCK_BH is not set
181# CONFIG_INLINE_READ_LOCK_IRQ is not set
182# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
183# CONFIG_INLINE_READ_UNLOCK is not set
184# CONFIG_INLINE_READ_UNLOCK_BH is not set
185# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
186# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
187# CONFIG_INLINE_WRITE_TRYLOCK is not set
188# CONFIG_INLINE_WRITE_LOCK is not set
189# CONFIG_INLINE_WRITE_LOCK_BH is not set
190# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
191# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
192# CONFIG_INLINE_WRITE_UNLOCK is not set
193# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
194# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
195# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
196# CONFIG_MUTEX_SPIN_ON_OWNER is not set
164# CONFIG_FREEZER is not set 197# CONFIG_FREEZER is not set
165 198
166# 199#
@@ -248,13 +281,11 @@ CONFIG_SPARSEMEM=y
248CONFIG_HAVE_MEMORY_PRESENT=y 281CONFIG_HAVE_MEMORY_PRESENT=y
249CONFIG_SPARSEMEM_STATIC=y 282CONFIG_SPARSEMEM_STATIC=y
250# CONFIG_MEMORY_HOTPLUG is not set 283# CONFIG_MEMORY_HOTPLUG is not set
251CONFIG_SPLIT_PTLOCK_CPUS=4 284CONFIG_SPLIT_PTLOCK_CPUS=999999
252CONFIG_MIGRATION=y 285CONFIG_MIGRATION=y
253# CONFIG_PHYS_ADDR_T_64BIT is not set 286# CONFIG_PHYS_ADDR_T_64BIT is not set
254CONFIG_ZONE_DMA_FLAG=0 287CONFIG_ZONE_DMA_FLAG=0
255CONFIG_NR_QUICK=2 288CONFIG_NR_QUICK=2
256CONFIG_HAVE_MLOCK=y
257CONFIG_HAVE_MLOCKED_PAGE_BIT=y
258# CONFIG_KSM is not set 289# CONFIG_KSM is not set
259CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 290CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
260 291
@@ -289,7 +320,6 @@ CONFIG_SH_R7785RP=y
289# Timer and clock configuration 320# Timer and clock configuration
290# 321#
291CONFIG_SH_TIMER_TMU=y 322CONFIG_SH_TIMER_TMU=y
292CONFIG_SH_PCLK_FREQ=33333333
293CONFIG_SH_CLK_CPG=y 323CONFIG_SH_CLK_CPG=y
294CONFIG_TICK_ONESHOT=y 324CONFIG_TICK_ONESHOT=y
295CONFIG_NO_HZ=y 325CONFIG_NO_HZ=y
@@ -363,7 +393,6 @@ CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
363# Bus options 393# Bus options
364# 394#
365CONFIG_PCI=y 395CONFIG_PCI=y
366CONFIG_SH_PCIDMA_NONCOHERENT=y
367# CONFIG_PCIEPORTBUS is not set 396# CONFIG_PCIEPORTBUS is not set
368# CONFIG_ARCH_SUPPORTS_MSI is not set 397# CONFIG_ARCH_SUPPORTS_MSI is not set
369# CONFIG_PCI_LEGACY is not set 398# CONFIG_PCI_LEGACY is not set
@@ -471,10 +500,6 @@ CONFIG_LLC=m
471# CONFIG_AF_RXRPC is not set 500# CONFIG_AF_RXRPC is not set
472CONFIG_WIRELESS=y 501CONFIG_WIRELESS=y
473# CONFIG_CFG80211 is not set 502# CONFIG_CFG80211 is not set
474CONFIG_CFG80211_DEFAULT_PS_VALUE=0
475# CONFIG_WIRELESS_OLD_REGULATORY is not set
476CONFIG_WIRELESS_EXT=y
477CONFIG_WIRELESS_EXT_SYSFS=y
478# CONFIG_LIB80211 is not set 503# CONFIG_LIB80211 is not set
479 504
480# 505#
@@ -510,6 +535,10 @@ CONFIG_BLK_DEV=y
510# CONFIG_BLK_DEV_UMEM is not set 535# CONFIG_BLK_DEV_UMEM is not set
511# CONFIG_BLK_DEV_COW_COMMON is not set 536# CONFIG_BLK_DEV_COW_COMMON is not set
512# CONFIG_BLK_DEV_LOOP is not set 537# CONFIG_BLK_DEV_LOOP is not set
538
539#
540# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
541#
513# CONFIG_BLK_DEV_NBD is not set 542# CONFIG_BLK_DEV_NBD is not set
514# CONFIG_BLK_DEV_SX8 is not set 543# CONFIG_BLK_DEV_SX8 is not set
515CONFIG_BLK_DEV_RAM=y 544CONFIG_BLK_DEV_RAM=y
@@ -520,6 +549,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
520# CONFIG_ATA_OVER_ETH is not set 549# CONFIG_ATA_OVER_ETH is not set
521# CONFIG_BLK_DEV_HD is not set 550# CONFIG_BLK_DEV_HD is not set
522CONFIG_MISC_DEVICES=y 551CONFIG_MISC_DEVICES=y
552# CONFIG_AD525X_DPOT is not set
523# CONFIG_PHANTOM is not set 553# CONFIG_PHANTOM is not set
524# CONFIG_SGI_IOC4 is not set 554# CONFIG_SGI_IOC4 is not set
525# CONFIG_TIFM_CORE is not set 555# CONFIG_TIFM_CORE is not set
@@ -527,6 +557,7 @@ CONFIG_MISC_DEVICES=y
527# CONFIG_ENCLOSURE_SERVICES is not set 557# CONFIG_ENCLOSURE_SERVICES is not set
528# CONFIG_HP_ILO is not set 558# CONFIG_HP_ILO is not set
529# CONFIG_ISL29003 is not set 559# CONFIG_ISL29003 is not set
560# CONFIG_DS1682 is not set
530# CONFIG_C2PORT is not set 561# CONFIG_C2PORT is not set
531 562
532# 563#
@@ -577,8 +608,11 @@ CONFIG_SCSI_LOWLEVEL=y
577# CONFIG_ISCSI_TCP is not set 608# CONFIG_ISCSI_TCP is not set
578# CONFIG_SCSI_CXGB3_ISCSI is not set 609# CONFIG_SCSI_CXGB3_ISCSI is not set
579# CONFIG_SCSI_BNX2_ISCSI is not set 610# CONFIG_SCSI_BNX2_ISCSI is not set
611# CONFIG_BE2ISCSI is not set
580# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 612# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
613# CONFIG_SCSI_HPSA is not set
581# CONFIG_SCSI_3W_9XXX is not set 614# CONFIG_SCSI_3W_9XXX is not set
615# CONFIG_SCSI_3W_SAS is not set
582# CONFIG_SCSI_ACARD is not set 616# CONFIG_SCSI_ACARD is not set
583# CONFIG_SCSI_AACRAID is not set 617# CONFIG_SCSI_AACRAID is not set
584# CONFIG_SCSI_AIC7XXX is not set 618# CONFIG_SCSI_AIC7XXX is not set
@@ -612,7 +646,9 @@ CONFIG_SCSI_LOWLEVEL=y
612# CONFIG_SCSI_NSP32 is not set 646# CONFIG_SCSI_NSP32 is not set
613# CONFIG_SCSI_DEBUG is not set 647# CONFIG_SCSI_DEBUG is not set
614# CONFIG_SCSI_PMCRAID is not set 648# CONFIG_SCSI_PMCRAID is not set
649# CONFIG_SCSI_PM8001 is not set
615# CONFIG_SCSI_SRP is not set 650# CONFIG_SCSI_SRP is not set
651# CONFIG_SCSI_BFA_FC is not set
616# CONFIG_SCSI_DH is not set 652# CONFIG_SCSI_DH is not set
617# CONFIG_SCSI_OSD_INITIATOR is not set 653# CONFIG_SCSI_OSD_INITIATOR is not set
618CONFIG_ATA=y 654CONFIG_ATA=y
@@ -665,15 +701,16 @@ CONFIG_SATA_SIL=y
665# CONFIG_PATA_NS87415 is not set 701# CONFIG_PATA_NS87415 is not set
666# CONFIG_PATA_OPTI is not set 702# CONFIG_PATA_OPTI is not set
667# CONFIG_PATA_OPTIDMA is not set 703# CONFIG_PATA_OPTIDMA is not set
704# CONFIG_PATA_PDC2027X is not set
668# CONFIG_PATA_PDC_OLD is not set 705# CONFIG_PATA_PDC_OLD is not set
669# CONFIG_PATA_RADISYS is not set 706# CONFIG_PATA_RADISYS is not set
670# CONFIG_PATA_RDC is not set 707# CONFIG_PATA_RDC is not set
671# CONFIG_PATA_RZ1000 is not set 708# CONFIG_PATA_RZ1000 is not set
672# CONFIG_PATA_SC1200 is not set 709# CONFIG_PATA_SC1200 is not set
673# CONFIG_PATA_SERVERWORKS is not set 710# CONFIG_PATA_SERVERWORKS is not set
674# CONFIG_PATA_PDC2027X is not set
675# CONFIG_PATA_SIL680 is not set 711# CONFIG_PATA_SIL680 is not set
676# CONFIG_PATA_SIS is not set 712# CONFIG_PATA_SIS is not set
713# CONFIG_PATA_TOSHIBA is not set
677# CONFIG_PATA_VIA is not set 714# CONFIG_PATA_VIA is not set
678# CONFIG_PATA_WINBOND is not set 715# CONFIG_PATA_WINBOND is not set
679CONFIG_PATA_PLATFORM=y 716CONFIG_PATA_PLATFORM=y
@@ -730,6 +767,7 @@ CONFIG_AX88796_93CX6=y
730# CONFIG_NET_PCI is not set 767# CONFIG_NET_PCI is not set
731# CONFIG_B44 is not set 768# CONFIG_B44 is not set
732# CONFIG_KS8842 is not set 769# CONFIG_KS8842 is not set
770# CONFIG_KS8851_MLL is not set
733# CONFIG_ATL2 is not set 771# CONFIG_ATL2 is not set
734CONFIG_NETDEV_1000=y 772CONFIG_NETDEV_1000=y
735# CONFIG_ACENIC is not set 773# CONFIG_ACENIC is not set
@@ -776,8 +814,9 @@ CONFIG_CHELSIO_T3_DEPENDS=y
776# CONFIG_BE2NET is not set 814# CONFIG_BE2NET is not set
777# CONFIG_TR is not set 815# CONFIG_TR is not set
778CONFIG_WLAN=y 816CONFIG_WLAN=y
779# CONFIG_WLAN_PRE80211 is not set 817# CONFIG_ATMEL is not set
780# CONFIG_WLAN_80211 is not set 818# CONFIG_PRISM54 is not set
819# CONFIG_HOSTAP is not set
781 820
782# 821#
783# Enable WiMAX (Networking options) to see the WiMAX drivers 822# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -791,6 +830,7 @@ CONFIG_WLAN=y
791# CONFIG_NETCONSOLE is not set 830# CONFIG_NETCONSOLE is not set
792# CONFIG_NETPOLL is not set 831# CONFIG_NETPOLL is not set
793# CONFIG_NET_POLL_CONTROLLER is not set 832# CONFIG_NET_POLL_CONTROLLER is not set
833# CONFIG_VMXNET3 is not set
794# CONFIG_ISDN is not set 834# CONFIG_ISDN is not set
795# CONFIG_PHONE is not set 835# CONFIG_PHONE is not set
796 836
@@ -800,6 +840,7 @@ CONFIG_WLAN=y
800CONFIG_INPUT=y 840CONFIG_INPUT=y
801# CONFIG_INPUT_FF_MEMLESS is not set 841# CONFIG_INPUT_FF_MEMLESS is not set
802# CONFIG_INPUT_POLLDEV is not set 842# CONFIG_INPUT_POLLDEV is not set
843# CONFIG_INPUT_SPARSEKMAP is not set
803 844
804# 845#
805# Userland interfaces 846# Userland interfaces
@@ -844,6 +885,7 @@ CONFIG_SERIO=y
844# CONFIG_SERIO_PCIPS2 is not set 885# CONFIG_SERIO_PCIPS2 is not set
845CONFIG_SERIO_LIBPS2=y 886CONFIG_SERIO_LIBPS2=y
846# CONFIG_SERIO_RAW is not set 887# CONFIG_SERIO_RAW is not set
888# CONFIG_SERIO_ALTERA_PS2 is not set
847# CONFIG_GAMEPORT is not set 889# CONFIG_GAMEPORT is not set
848 890
849# 891#
@@ -925,11 +967,6 @@ CONFIG_I2C_HIGHLANDER=y
925# CONFIG_I2C_TAOS_EVM is not set 967# CONFIG_I2C_TAOS_EVM is not set
926 968
927# 969#
928# Graphics adapter I2C/DDC channel drivers
929#
930# CONFIG_I2C_VOODOO3 is not set
931
932#
933# Other I2C/SMBus bus drivers 970# Other I2C/SMBus bus drivers
934# 971#
935# CONFIG_I2C_PCA_PLATFORM is not set 972# CONFIG_I2C_PCA_PLATFORM is not set
@@ -938,7 +975,6 @@ CONFIG_I2C_HIGHLANDER=y
938# 975#
939# Miscellaneous I2C Chip support 976# Miscellaneous I2C Chip support
940# 977#
941# CONFIG_DS1682 is not set
942# CONFIG_SENSORS_TSL2550 is not set 978# CONFIG_SENSORS_TSL2550 is not set
943# CONFIG_I2C_DEBUG_CORE is not set 979# CONFIG_I2C_DEBUG_CORE is not set
944# CONFIG_I2C_DEBUG_ALGO is not set 980# CONFIG_I2C_DEBUG_ALGO is not set
@@ -969,6 +1005,7 @@ CONFIG_GPIOLIB=y
969# 1005#
970# PCI GPIO expanders: 1006# PCI GPIO expanders:
971# 1007#
1008# CONFIG_GPIO_CS5535 is not set
972# CONFIG_GPIO_BT8XX is not set 1009# CONFIG_GPIO_BT8XX is not set
973# CONFIG_GPIO_LANGWELL is not set 1010# CONFIG_GPIO_LANGWELL is not set
974 1011
@@ -1011,6 +1048,7 @@ CONFIG_HWMON=y
1011# CONFIG_SENSORS_GL520SM is not set 1048# CONFIG_SENSORS_GL520SM is not set
1012# CONFIG_SENSORS_IT87 is not set 1049# CONFIG_SENSORS_IT87 is not set
1013# CONFIG_SENSORS_LM63 is not set 1050# CONFIG_SENSORS_LM63 is not set
1051# CONFIG_SENSORS_LM73 is not set
1014# CONFIG_SENSORS_LM75 is not set 1052# CONFIG_SENSORS_LM75 is not set
1015# CONFIG_SENSORS_LM77 is not set 1053# CONFIG_SENSORS_LM77 is not set
1016# CONFIG_SENSORS_LM78 is not set 1054# CONFIG_SENSORS_LM78 is not set
@@ -1050,6 +1088,7 @@ CONFIG_HWMON=y
1050# CONFIG_SENSORS_W83L786NG is not set 1088# CONFIG_SENSORS_W83L786NG is not set
1051# CONFIG_SENSORS_W83627HF is not set 1089# CONFIG_SENSORS_W83627HF is not set
1052# CONFIG_SENSORS_W83627EHF is not set 1090# CONFIG_SENSORS_W83627EHF is not set
1091# CONFIG_SENSORS_LIS3_I2C is not set
1053# CONFIG_THERMAL is not set 1092# CONFIG_THERMAL is not set
1054# CONFIG_WATCHDOG is not set 1093# CONFIG_WATCHDOG is not set
1055CONFIG_SSB_POSSIBLE=y 1094CONFIG_SSB_POSSIBLE=y
@@ -1064,16 +1103,19 @@ CONFIG_SSB_POSSIBLE=y
1064# 1103#
1065# CONFIG_MFD_CORE is not set 1104# CONFIG_MFD_CORE is not set
1066# CONFIG_MFD_SM501 is not set 1105# CONFIG_MFD_SM501 is not set
1106# CONFIG_MFD_SH_MOBILE_SDHI is not set
1067# CONFIG_HTC_PASIC3 is not set 1107# CONFIG_HTC_PASIC3 is not set
1068# CONFIG_TPS65010 is not set 1108# CONFIG_TPS65010 is not set
1069# CONFIG_TWL4030_CORE is not set 1109# CONFIG_TWL4030_CORE is not set
1070# CONFIG_MFD_TMIO is not set 1110# CONFIG_MFD_TMIO is not set
1071# CONFIG_PMIC_DA903X is not set 1111# CONFIG_PMIC_DA903X is not set
1112# CONFIG_PMIC_ADP5520 is not set
1072# CONFIG_MFD_WM8400 is not set 1113# CONFIG_MFD_WM8400 is not set
1073# CONFIG_MFD_WM831X is not set 1114# CONFIG_MFD_WM831X is not set
1074# CONFIG_MFD_WM8350_I2C is not set 1115# CONFIG_MFD_WM8350_I2C is not set
1075# CONFIG_MFD_PCF50633 is not set 1116# CONFIG_MFD_PCF50633 is not set
1076# CONFIG_AB3100_CORE is not set 1117# CONFIG_AB3100_CORE is not set
1118# CONFIG_MFD_88PM8607 is not set
1077# CONFIG_REGULATOR is not set 1119# CONFIG_REGULATOR is not set
1078# CONFIG_MEDIA_SUPPORT is not set 1120# CONFIG_MEDIA_SUPPORT is not set
1079 1121
@@ -1211,6 +1253,7 @@ CONFIG_RTC_DRV_RS5C372=y
1211# CONFIG_RTC_DRV_PCF8563 is not set 1253# CONFIG_RTC_DRV_PCF8563 is not set
1212# CONFIG_RTC_DRV_PCF8583 is not set 1254# CONFIG_RTC_DRV_PCF8583 is not set
1213# CONFIG_RTC_DRV_M41T80 is not set 1255# CONFIG_RTC_DRV_M41T80 is not set
1256# CONFIG_RTC_DRV_BQ32K is not set
1214# CONFIG_RTC_DRV_S35390A is not set 1257# CONFIG_RTC_DRV_S35390A is not set
1215# CONFIG_RTC_DRV_FM3130 is not set 1258# CONFIG_RTC_DRV_FM3130 is not set
1216# CONFIG_RTC_DRV_RX8581 is not set 1259# CONFIG_RTC_DRV_RX8581 is not set
@@ -1231,7 +1274,9 @@ CONFIG_RTC_DRV_RS5C372=y
1231# CONFIG_RTC_DRV_M48T86 is not set 1274# CONFIG_RTC_DRV_M48T86 is not set
1232# CONFIG_RTC_DRV_M48T35 is not set 1275# CONFIG_RTC_DRV_M48T35 is not set
1233# CONFIG_RTC_DRV_M48T59 is not set 1276# CONFIG_RTC_DRV_M48T59 is not set
1277# CONFIG_RTC_DRV_MSM6242 is not set
1234# CONFIG_RTC_DRV_BQ4802 is not set 1278# CONFIG_RTC_DRV_BQ4802 is not set
1279# CONFIG_RTC_DRV_RP5C01 is not set
1235# CONFIG_RTC_DRV_V3020 is not set 1280# CONFIG_RTC_DRV_V3020 is not set
1236 1281
1237# 1282#
@@ -1463,6 +1508,7 @@ CONFIG_FRAME_POINTER=y
1463# CONFIG_LKDTM is not set 1508# CONFIG_LKDTM is not set
1464# CONFIG_FAULT_INJECTION is not set 1509# CONFIG_FAULT_INJECTION is not set
1465# CONFIG_LATENCYTOP is not set 1510# CONFIG_LATENCYTOP is not set
1511# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1466# CONFIG_PAGE_POISONING is not set 1512# CONFIG_PAGE_POISONING is not set
1467CONFIG_NOP_TRACER=y 1513CONFIG_NOP_TRACER=y
1468CONFIG_HAVE_FUNCTION_TRACER=y 1514CONFIG_HAVE_FUNCTION_TRACER=y
@@ -1499,8 +1545,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1499CONFIG_HAVE_ARCH_KGDB=y 1545CONFIG_HAVE_ARCH_KGDB=y
1500# CONFIG_KGDB is not set 1546# CONFIG_KGDB is not set
1501CONFIG_SH_STANDARD_BIOS=y 1547CONFIG_SH_STANDARD_BIOS=y
1502# CONFIG_EARLY_SCIF_CONSOLE is not set
1503CONFIG_EARLY_PRINTK=y
1504# CONFIG_STACK_DEBUG is not set 1548# CONFIG_STACK_DEBUG is not set
1505CONFIG_DEBUG_STACK_USAGE=y 1549CONFIG_DEBUG_STACK_USAGE=y
1506CONFIG_4KSTACKS=y 1550CONFIG_4KSTACKS=y
@@ -1514,7 +1558,11 @@ CONFIG_DUMP_CODE=y
1514# CONFIG_KEYS is not set 1558# CONFIG_KEYS is not set
1515# CONFIG_SECURITY is not set 1559# CONFIG_SECURITY is not set
1516# CONFIG_SECURITYFS is not set 1560# CONFIG_SECURITYFS is not set
1517# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1561# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1562# CONFIG_DEFAULT_SECURITY_SMACK is not set
1563# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1564CONFIG_DEFAULT_SECURITY_DAC=y
1565CONFIG_DEFAULT_SECURITY=""
1518CONFIG_CRYPTO=y 1566CONFIG_CRYPTO=y
1519 1567
1520# 1568#
diff --git a/arch/sh/configs/rsk7201_defconfig b/arch/sh/configs/rsk7201_defconfig
index c40db12e9ad7..2fc635a5a8c5 100644
--- a/arch/sh/configs/rsk7201_defconfig
+++ b/arch/sh/configs/rsk7201_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:34:29 2009 4# Mon Jan 4 13:23:12 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -29,6 +29,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 29CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 30CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
32CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 34CONFIG_CONSTRUCTORS=y
34 35
@@ -56,6 +57,7 @@ CONFIG_BSD_PROCESS_ACCT=y
56# 57#
57CONFIG_TREE_RCU=y 58CONFIG_TREE_RCU=y
58# CONFIG_TREE_PREEMPT_RCU is not set 59# CONFIG_TREE_PREEMPT_RCU is not set
60# CONFIG_TINY_RCU is not set
59# CONFIG_RCU_TRACE is not set 61# CONFIG_RCU_TRACE is not set
60CONFIG_RCU_FANOUT=32 62CONFIG_RCU_FANOUT=32
61# CONFIG_RCU_FANOUT_EXACT is not set 63# CONFIG_RCU_FANOUT_EXACT is not set
@@ -97,6 +99,7 @@ CONFIG_TIMERFD=y
97CONFIG_EVENTFD=y 99CONFIG_EVENTFD=y
98# CONFIG_AIO is not set 100# CONFIG_AIO is not set
99CONFIG_HAVE_PERF_EVENTS=y 101CONFIG_HAVE_PERF_EVENTS=y
102CONFIG_PERF_USE_VMALLOC=y
100 103
101# 104#
102# Kernel Performance Events And Counters 105# Kernel Performance Events And Counters
@@ -109,6 +112,7 @@ CONFIG_COMPAT_BRK=y
109# CONFIG_SLAB is not set 112# CONFIG_SLAB is not set
110# CONFIG_SLUB is not set 113# CONFIG_SLUB is not set
111CONFIG_SLOB=y 114CONFIG_SLOB=y
115# CONFIG_MMAP_ALLOW_UNINITIALIZED is not set
112CONFIG_PROFILING=y 116CONFIG_PROFILING=y
113CONFIG_TRACEPOINTS=y 117CONFIG_TRACEPOINTS=y
114CONFIG_OPROFILE=y 118CONFIG_OPROFILE=y
@@ -117,6 +121,7 @@ CONFIG_HAVE_OPROFILE=y
117CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
120CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
121CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
122 127
@@ -142,14 +147,41 @@ CONFIG_LBDAF=y
142# IO Schedulers 147# IO Schedulers
143# 148#
144CONFIG_IOSCHED_NOOP=y 149CONFIG_IOSCHED_NOOP=y
145# CONFIG_IOSCHED_AS is not set
146# CONFIG_IOSCHED_DEADLINE is not set 150# CONFIG_IOSCHED_DEADLINE is not set
147# CONFIG_IOSCHED_CFQ is not set 151# CONFIG_IOSCHED_CFQ is not set
148# CONFIG_DEFAULT_AS is not set
149# CONFIG_DEFAULT_DEADLINE is not set 152# CONFIG_DEFAULT_DEADLINE is not set
150# CONFIG_DEFAULT_CFQ is not set 153# CONFIG_DEFAULT_CFQ is not set
151CONFIG_DEFAULT_NOOP=y 154CONFIG_DEFAULT_NOOP=y
152CONFIG_DEFAULT_IOSCHED="noop" 155CONFIG_DEFAULT_IOSCHED="noop"
156# CONFIG_INLINE_SPIN_TRYLOCK is not set
157# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
158# CONFIG_INLINE_SPIN_LOCK is not set
159# CONFIG_INLINE_SPIN_LOCK_BH is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
162CONFIG_INLINE_SPIN_UNLOCK=y
163# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
164CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
165# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
166# CONFIG_INLINE_READ_TRYLOCK is not set
167# CONFIG_INLINE_READ_LOCK is not set
168# CONFIG_INLINE_READ_LOCK_BH is not set
169# CONFIG_INLINE_READ_LOCK_IRQ is not set
170# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
171CONFIG_INLINE_READ_UNLOCK=y
172# CONFIG_INLINE_READ_UNLOCK_BH is not set
173CONFIG_INLINE_READ_UNLOCK_IRQ=y
174# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
175# CONFIG_INLINE_WRITE_TRYLOCK is not set
176# CONFIG_INLINE_WRITE_LOCK is not set
177# CONFIG_INLINE_WRITE_LOCK_BH is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
180CONFIG_INLINE_WRITE_UNLOCK=y
181# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
182CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
183# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
184# CONFIG_MUTEX_SPIN_ON_OWNER is not set
153# CONFIG_FREEZER is not set 185# CONFIG_FREEZER is not set
154 186
155# 187#
@@ -224,7 +256,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
224# CONFIG_PHYS_ADDR_T_64BIT is not set 256# CONFIG_PHYS_ADDR_T_64BIT is not set
225CONFIG_ZONE_DMA_FLAG=0 257CONFIG_ZONE_DMA_FLAG=0
226CONFIG_NR_QUICK=2 258CONFIG_NR_QUICK=2
227CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
228CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 259CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1
229 260
230# 261#
@@ -433,6 +464,10 @@ CONFIG_MTD_PHYSMAP=y
433CONFIG_BLK_DEV=y 464CONFIG_BLK_DEV=y
434# CONFIG_BLK_DEV_COW_COMMON is not set 465# CONFIG_BLK_DEV_COW_COMMON is not set
435# CONFIG_BLK_DEV_LOOP is not set 466# CONFIG_BLK_DEV_LOOP is not set
467
468#
469# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
470#
436# CONFIG_BLK_DEV_RAM is not set 471# CONFIG_BLK_DEV_RAM is not set
437# CONFIG_CDROM_PKTCDVD is not set 472# CONFIG_CDROM_PKTCDVD is not set
438# CONFIG_BLK_DEV_HD is not set 473# CONFIG_BLK_DEV_HD is not set
@@ -464,6 +499,7 @@ CONFIG_HAVE_IDE=y
464CONFIG_INPUT=y 499CONFIG_INPUT=y
465# CONFIG_INPUT_FF_MEMLESS is not set 500# CONFIG_INPUT_FF_MEMLESS is not set
466# CONFIG_INPUT_POLLDEV is not set 501# CONFIG_INPUT_POLLDEV is not set
502# CONFIG_INPUT_SPARSEKMAP is not set
467 503
468# 504#
469# Userland interfaces 505# Userland interfaces
@@ -540,6 +576,7 @@ CONFIG_SSB_POSSIBLE=y
540# 576#
541# CONFIG_MFD_CORE is not set 577# CONFIG_MFD_CORE is not set
542# CONFIG_MFD_SM501 is not set 578# CONFIG_MFD_SM501 is not set
579# CONFIG_MFD_SH_MOBILE_SDHI is not set
543# CONFIG_HTC_PASIC3 is not set 580# CONFIG_HTC_PASIC3 is not set
544# CONFIG_MFD_TMIO is not set 581# CONFIG_MFD_TMIO is not set
545# CONFIG_REGULATOR is not set 582# CONFIG_REGULATOR is not set
@@ -594,7 +631,9 @@ CONFIG_RTC_INTF_DEV=y
594# CONFIG_RTC_DRV_M48T86 is not set 631# CONFIG_RTC_DRV_M48T86 is not set
595# CONFIG_RTC_DRV_M48T35 is not set 632# CONFIG_RTC_DRV_M48T35 is not set
596# CONFIG_RTC_DRV_M48T59 is not set 633# CONFIG_RTC_DRV_M48T59 is not set
634# CONFIG_RTC_DRV_MSM6242 is not set
597# CONFIG_RTC_DRV_BQ4802 is not set 635# CONFIG_RTC_DRV_BQ4802 is not set
636# CONFIG_RTC_DRV_RP5C01 is not set
598# CONFIG_RTC_DRV_V3020 is not set 637# CONFIG_RTC_DRV_V3020 is not set
599 638
600# 639#
@@ -618,6 +657,7 @@ CONFIG_EXT2_FS=y
618# CONFIG_EXT2_FS_XATTR is not set 657# CONFIG_EXT2_FS_XATTR is not set
619# CONFIG_EXT3_FS is not set 658# CONFIG_EXT3_FS is not set
620# CONFIG_EXT4_FS is not set 659# CONFIG_EXT4_FS is not set
660CONFIG_EXT4_USE_FOR_EXT23=y
621# CONFIG_REISERFS_FS is not set 661# CONFIG_REISERFS_FS is not set
622# CONFIG_JFS_FS is not set 662# CONFIG_JFS_FS is not set
623# CONFIG_FS_POSIX_ACL is not set 663# CONFIG_FS_POSIX_ACL is not set
@@ -717,7 +757,7 @@ CONFIG_DEBUG_FS=y
717# CONFIG_HEADERS_CHECK is not set 757# CONFIG_HEADERS_CHECK is not set
718# CONFIG_DEBUG_KERNEL is not set 758# CONFIG_DEBUG_KERNEL is not set
719CONFIG_STACKTRACE=y 759CONFIG_STACKTRACE=y
720# CONFIG_DEBUG_BUGVERBOSE is not set 760CONFIG_DEBUG_BUGVERBOSE=y
721# CONFIG_DEBUG_MEMORY_INIT is not set 761# CONFIG_DEBUG_MEMORY_INIT is not set
722# CONFIG_RCU_CPU_STALL_DETECTOR is not set 762# CONFIG_RCU_CPU_STALL_DETECTOR is not set
723# CONFIG_LATENCYTOP is not set 763# CONFIG_LATENCYTOP is not set
@@ -741,7 +781,6 @@ CONFIG_TRACING_SUPPORT=y
741# CONFIG_SAMPLES is not set 781# CONFIG_SAMPLES is not set
742CONFIG_HAVE_ARCH_KGDB=y 782CONFIG_HAVE_ARCH_KGDB=y
743# CONFIG_SH_STANDARD_BIOS is not set 783# CONFIG_SH_STANDARD_BIOS is not set
744# CONFIG_EARLY_SCIF_CONSOLE is not set
745# CONFIG_DWARF_UNWINDER is not set 784# CONFIG_DWARF_UNWINDER is not set
746 785
747# 786#
@@ -750,7 +789,11 @@ CONFIG_HAVE_ARCH_KGDB=y
750# CONFIG_KEYS is not set 789# CONFIG_KEYS is not set
751# CONFIG_SECURITY is not set 790# CONFIG_SECURITY is not set
752# CONFIG_SECURITYFS is not set 791# CONFIG_SECURITYFS is not set
753# CONFIG_SECURITY_FILE_CAPABILITIES is not set 792# CONFIG_DEFAULT_SECURITY_SELINUX is not set
793# CONFIG_DEFAULT_SECURITY_SMACK is not set
794# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
795CONFIG_DEFAULT_SECURITY_DAC=y
796CONFIG_DEFAULT_SECURITY=""
754# CONFIG_CRYPTO is not set 797# CONFIG_CRYPTO is not set
755CONFIG_BINARY_PRINTF=y 798CONFIG_BINARY_PRINTF=y
756 799
diff --git a/arch/sh/configs/rsk7203_defconfig b/arch/sh/configs/rsk7203_defconfig
index 5cabdb3a84fb..0169e60e0947 100644
--- a/arch/sh/configs/rsk7203_defconfig
+++ b/arch/sh/configs/rsk7203_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:35:04 2009 4# Mon Jan 4 13:23:54 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -30,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
35 36
@@ -61,6 +62,7 @@ CONFIG_BSD_PROCESS_ACCT=y
61# 62#
62CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -104,6 +106,7 @@ CONFIG_TIMERFD=y
104CONFIG_EVENTFD=y 106CONFIG_EVENTFD=y
105CONFIG_AIO=y 107CONFIG_AIO=y
106CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
107 110
108# 111#
109# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -111,11 +114,13 @@ CONFIG_HAVE_PERF_EVENTS=y
111CONFIG_PERF_EVENTS=y 114CONFIG_PERF_EVENTS=y
112CONFIG_EVENT_PROFILE=y 115CONFIG_EVENT_PROFILE=y
113# CONFIG_PERF_COUNTERS is not set 116# CONFIG_PERF_COUNTERS is not set
117# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
114CONFIG_VM_EVENT_COUNTERS=y 118CONFIG_VM_EVENT_COUNTERS=y
115CONFIG_COMPAT_BRK=y 119CONFIG_COMPAT_BRK=y
116# CONFIG_SLAB is not set 120# CONFIG_SLAB is not set
117# CONFIG_SLUB is not set 121# CONFIG_SLUB is not set
118CONFIG_SLOB=y 122CONFIG_SLOB=y
123# CONFIG_MMAP_ALLOW_UNINITIALIZED is not set
119CONFIG_PROFILING=y 124CONFIG_PROFILING=y
120CONFIG_TRACEPOINTS=y 125CONFIG_TRACEPOINTS=y
121CONFIG_OPROFILE=y 126CONFIG_OPROFILE=y
@@ -124,6 +129,7 @@ CONFIG_HAVE_OPROFILE=y
124CONFIG_HAVE_KPROBES=y 129CONFIG_HAVE_KPROBES=y
125CONFIG_HAVE_KRETPROBES=y 130CONFIG_HAVE_KRETPROBES=y
126CONFIG_HAVE_ARCH_TRACEHOOK=y 131CONFIG_HAVE_ARCH_TRACEHOOK=y
132CONFIG_HAVE_DMA_ATTRS=y
127CONFIG_HAVE_CLK=y 133CONFIG_HAVE_CLK=y
128CONFIG_HAVE_DMA_API_DEBUG=y 134CONFIG_HAVE_DMA_API_DEBUG=y
129 135
@@ -149,14 +155,41 @@ CONFIG_LBDAF=y
149# IO Schedulers 155# IO Schedulers
150# 156#
151CONFIG_IOSCHED_NOOP=y 157CONFIG_IOSCHED_NOOP=y
152# CONFIG_IOSCHED_AS is not set
153# CONFIG_IOSCHED_DEADLINE is not set 158# CONFIG_IOSCHED_DEADLINE is not set
154# CONFIG_IOSCHED_CFQ is not set 159# CONFIG_IOSCHED_CFQ is not set
155# CONFIG_DEFAULT_AS is not set
156# CONFIG_DEFAULT_DEADLINE is not set 160# CONFIG_DEFAULT_DEADLINE is not set
157# CONFIG_DEFAULT_CFQ is not set 161# CONFIG_DEFAULT_CFQ is not set
158CONFIG_DEFAULT_NOOP=y 162CONFIG_DEFAULT_NOOP=y
159CONFIG_DEFAULT_IOSCHED="noop" 163CONFIG_DEFAULT_IOSCHED="noop"
164# CONFIG_INLINE_SPIN_TRYLOCK is not set
165# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
166# CONFIG_INLINE_SPIN_LOCK is not set
167# CONFIG_INLINE_SPIN_LOCK_BH is not set
168# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
169# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
170CONFIG_INLINE_SPIN_UNLOCK=y
171# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
172CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
173# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
174# CONFIG_INLINE_READ_TRYLOCK is not set
175# CONFIG_INLINE_READ_LOCK is not set
176# CONFIG_INLINE_READ_LOCK_BH is not set
177# CONFIG_INLINE_READ_LOCK_IRQ is not set
178# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
179CONFIG_INLINE_READ_UNLOCK=y
180# CONFIG_INLINE_READ_UNLOCK_BH is not set
181CONFIG_INLINE_READ_UNLOCK_IRQ=y
182# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
183# CONFIG_INLINE_WRITE_TRYLOCK is not set
184# CONFIG_INLINE_WRITE_LOCK is not set
185# CONFIG_INLINE_WRITE_LOCK_BH is not set
186# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
187# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
188CONFIG_INLINE_WRITE_UNLOCK=y
189# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
190CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
191# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
192# CONFIG_MUTEX_SPIN_ON_OWNER is not set
160# CONFIG_FREEZER is not set 193# CONFIG_FREEZER is not set
161 194
162# 195#
@@ -231,7 +264,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
231# CONFIG_PHYS_ADDR_T_64BIT is not set 264# CONFIG_PHYS_ADDR_T_64BIT is not set
232CONFIG_ZONE_DMA_FLAG=0 265CONFIG_ZONE_DMA_FLAG=0
233CONFIG_NR_QUICK=2 266CONFIG_NR_QUICK=2
234CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
235CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 267CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1
236 268
237# 269#
@@ -424,9 +456,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
424# CONFIG_AF_RXRPC is not set 456# CONFIG_AF_RXRPC is not set
425CONFIG_WIRELESS=y 457CONFIG_WIRELESS=y
426# CONFIG_CFG80211 is not set 458# CONFIG_CFG80211 is not set
427CONFIG_CFG80211_DEFAULT_PS_VALUE=0
428# CONFIG_WIRELESS_OLD_REGULATORY is not set
429# CONFIG_WIRELESS_EXT is not set
430# CONFIG_LIB80211 is not set 459# CONFIG_LIB80211 is not set
431 460
432# 461#
@@ -539,6 +568,10 @@ CONFIG_MTD_PHYSMAP=y
539CONFIG_BLK_DEV=y 568CONFIG_BLK_DEV=y
540# CONFIG_BLK_DEV_COW_COMMON is not set 569# CONFIG_BLK_DEV_COW_COMMON is not set
541# CONFIG_BLK_DEV_LOOP is not set 570# CONFIG_BLK_DEV_LOOP is not set
571
572#
573# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
574#
542# CONFIG_BLK_DEV_NBD is not set 575# CONFIG_BLK_DEV_NBD is not set
543# CONFIG_BLK_DEV_UB is not set 576# CONFIG_BLK_DEV_UB is not set
544# CONFIG_BLK_DEV_RAM is not set 577# CONFIG_BLK_DEV_RAM is not set
@@ -610,11 +643,12 @@ CONFIG_SMSC911X=y
610# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 643# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
611# CONFIG_B44 is not set 644# CONFIG_B44 is not set
612# CONFIG_KS8842 is not set 645# CONFIG_KS8842 is not set
646# CONFIG_KS8851_MLL is not set
613# CONFIG_NETDEV_1000 is not set 647# CONFIG_NETDEV_1000 is not set
614# CONFIG_NETDEV_10000 is not set 648# CONFIG_NETDEV_10000 is not set
615CONFIG_WLAN=y 649CONFIG_WLAN=y
616# CONFIG_WLAN_PRE80211 is not set 650# CONFIG_USB_ZD1201 is not set
617# CONFIG_WLAN_80211 is not set 651# CONFIG_HOSTAP is not set
618 652
619# 653#
620# Enable WiMAX (Networking options) to see the WiMAX drivers 654# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -643,6 +677,7 @@ CONFIG_WLAN=y
643CONFIG_INPUT=y 677CONFIG_INPUT=y
644CONFIG_INPUT_FF_MEMLESS=m 678CONFIG_INPUT_FF_MEMLESS=m
645# CONFIG_INPUT_POLLDEV is not set 679# CONFIG_INPUT_POLLDEV is not set
680# CONFIG_INPUT_SPARSEKMAP is not set
646 681
647# 682#
648# Userland interfaces 683# Userland interfaces
@@ -743,6 +778,7 @@ CONFIG_SSB_POSSIBLE=y
743# 778#
744# CONFIG_MFD_CORE is not set 779# CONFIG_MFD_CORE is not set
745# CONFIG_MFD_SM501 is not set 780# CONFIG_MFD_SM501 is not set
781# CONFIG_MFD_SH_MOBILE_SDHI is not set
746# CONFIG_HTC_PASIC3 is not set 782# CONFIG_HTC_PASIC3 is not set
747# CONFIG_MFD_TMIO is not set 783# CONFIG_MFD_TMIO is not set
748CONFIG_REGULATOR=y 784CONFIG_REGULATOR=y
@@ -910,6 +946,8 @@ CONFIG_LEDS_CLASS=y
910# 946#
911CONFIG_LEDS_GPIO=y 947CONFIG_LEDS_GPIO=y
912CONFIG_LEDS_GPIO_PLATFORM=y 948CONFIG_LEDS_GPIO_PLATFORM=y
949# CONFIG_LEDS_REGULATOR is not set
950# CONFIG_LEDS_LT3593 is not set
913 951
914# 952#
915# LED Triggers 953# LED Triggers
@@ -955,7 +993,9 @@ CONFIG_RTC_INTF_DEV=y
955# CONFIG_RTC_DRV_M48T86 is not set 993# CONFIG_RTC_DRV_M48T86 is not set
956# CONFIG_RTC_DRV_M48T35 is not set 994# CONFIG_RTC_DRV_M48T35 is not set
957# CONFIG_RTC_DRV_M48T59 is not set 995# CONFIG_RTC_DRV_M48T59 is not set
996# CONFIG_RTC_DRV_MSM6242 is not set
958# CONFIG_RTC_DRV_BQ4802 is not set 997# CONFIG_RTC_DRV_BQ4802 is not set
998# CONFIG_RTC_DRV_RP5C01 is not set
959# CONFIG_RTC_DRV_V3020 is not set 999# CONFIG_RTC_DRV_V3020 is not set
960 1000
961# 1001#
@@ -978,6 +1018,7 @@ CONFIG_RTC_DRV_SH=y
978# CONFIG_EXT2_FS is not set 1018# CONFIG_EXT2_FS is not set
979# CONFIG_EXT3_FS is not set 1019# CONFIG_EXT3_FS is not set
980# CONFIG_EXT4_FS is not set 1020# CONFIG_EXT4_FS is not set
1021CONFIG_EXT4_USE_FOR_EXT23=y
981# CONFIG_REISERFS_FS is not set 1022# CONFIG_REISERFS_FS is not set
982# CONFIG_JFS_FS is not set 1023# CONFIG_JFS_FS is not set
983# CONFIG_FS_POSIX_ACL is not set 1024# CONFIG_FS_POSIX_ACL is not set
@@ -1137,6 +1178,7 @@ CONFIG_DEBUG_OBJECTS=y
1137# CONFIG_DEBUG_OBJECTS_SELFTEST is not set 1178# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
1138# CONFIG_DEBUG_OBJECTS_FREE is not set 1179# CONFIG_DEBUG_OBJECTS_FREE is not set
1139# CONFIG_DEBUG_OBJECTS_TIMERS is not set 1180# CONFIG_DEBUG_OBJECTS_TIMERS is not set
1181# CONFIG_DEBUG_OBJECTS_WORK is not set
1140CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1 1182CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
1141# CONFIG_DEBUG_RT_MUTEXES is not set 1183# CONFIG_DEBUG_RT_MUTEXES is not set
1142# CONFIG_RT_MUTEX_TESTER is not set 1184# CONFIG_RT_MUTEX_TESTER is not set
@@ -1203,9 +1245,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1203CONFIG_HAVE_ARCH_KGDB=y 1245CONFIG_HAVE_ARCH_KGDB=y
1204# CONFIG_KGDB is not set 1246# CONFIG_KGDB is not set
1205# CONFIG_SH_STANDARD_BIOS is not set 1247# CONFIG_SH_STANDARD_BIOS is not set
1206CONFIG_EARLY_SCIF_CONSOLE=y
1207CONFIG_EARLY_SCIF_CONSOLE_PORT=0xfffe8000
1208CONFIG_EARLY_PRINTK=y
1209# CONFIG_STACK_DEBUG is not set 1248# CONFIG_STACK_DEBUG is not set
1210CONFIG_DEBUG_STACK_USAGE=y 1249CONFIG_DEBUG_STACK_USAGE=y
1211CONFIG_DUMP_CODE=y 1250CONFIG_DUMP_CODE=y
@@ -1218,7 +1257,11 @@ CONFIG_DUMP_CODE=y
1218# CONFIG_KEYS is not set 1257# CONFIG_KEYS is not set
1219# CONFIG_SECURITY is not set 1258# CONFIG_SECURITY is not set
1220# CONFIG_SECURITYFS is not set 1259# CONFIG_SECURITYFS is not set
1221# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1260# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1261# CONFIG_DEFAULT_SECURITY_SMACK is not set
1262# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1263CONFIG_DEFAULT_SECURITY_DAC=y
1264CONFIG_DEFAULT_SECURITY=""
1222# CONFIG_CRYPTO is not set 1265# CONFIG_CRYPTO is not set
1223CONFIG_BINARY_PRINTF=y 1266CONFIG_BINARY_PRINTF=y
1224 1267
diff --git a/arch/sh/configs/rts7751r2d1_defconfig b/arch/sh/configs/rts7751r2d1_defconfig
index 6f1126b3e487..fba1f62d56e7 100644
--- a/arch/sh/configs/rts7751r2d1_defconfig
+++ b/arch/sh/configs/rts7751r2d1_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:36:25 2009 4# Mon Jan 4 13:25:36 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -31,6 +32,7 @@ CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_IO_TRAPPED=y 34CONFIG_IO_TRAPPED=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -61,6 +63,7 @@ CONFIG_SYSVIPC_SYSCTL=y
61# 63#
62CONFIG_TREE_RCU=y 64CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
66# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 67# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 68CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 69# CONFIG_RCU_FANOUT_EXACT is not set
@@ -95,6 +98,7 @@ CONFIG_EVENTFD=y
95CONFIG_SHMEM=y 98CONFIG_SHMEM=y
96CONFIG_AIO=y 99CONFIG_AIO=y
97CONFIG_HAVE_PERF_EVENTS=y 100CONFIG_HAVE_PERF_EVENTS=y
101CONFIG_PERF_USE_VMALLOC=y
98 102
99# 103#
100# Kernel Performance Events And Counters 104# Kernel Performance Events And Counters
@@ -117,6 +121,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
117CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
120CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
121CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
122 127
@@ -143,14 +148,41 @@ CONFIG_LBDAF=y
143# IO Schedulers 148# IO Schedulers
144# 149#
145CONFIG_IOSCHED_NOOP=y 150CONFIG_IOSCHED_NOOP=y
146CONFIG_IOSCHED_AS=y
147CONFIG_IOSCHED_DEADLINE=y 151CONFIG_IOSCHED_DEADLINE=y
148CONFIG_IOSCHED_CFQ=y 152CONFIG_IOSCHED_CFQ=y
149CONFIG_DEFAULT_AS=y
150# CONFIG_DEFAULT_DEADLINE is not set 153# CONFIG_DEFAULT_DEADLINE is not set
151# CONFIG_DEFAULT_CFQ is not set 154CONFIG_DEFAULT_CFQ=y
152# CONFIG_DEFAULT_NOOP is not set 155# CONFIG_DEFAULT_NOOP is not set
153CONFIG_DEFAULT_IOSCHED="anticipatory" 156CONFIG_DEFAULT_IOSCHED="cfq"
157# CONFIG_INLINE_SPIN_TRYLOCK is not set
158# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK is not set
160# CONFIG_INLINE_SPIN_LOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
162# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
163CONFIG_INLINE_SPIN_UNLOCK=y
164# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
165CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
166# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
167# CONFIG_INLINE_READ_TRYLOCK is not set
168# CONFIG_INLINE_READ_LOCK is not set
169# CONFIG_INLINE_READ_LOCK_BH is not set
170# CONFIG_INLINE_READ_LOCK_IRQ is not set
171# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
172CONFIG_INLINE_READ_UNLOCK=y
173# CONFIG_INLINE_READ_UNLOCK_BH is not set
174CONFIG_INLINE_READ_UNLOCK_IRQ=y
175# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
176# CONFIG_INLINE_WRITE_TRYLOCK is not set
177# CONFIG_INLINE_WRITE_LOCK is not set
178# CONFIG_INLINE_WRITE_LOCK_BH is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
180# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
181CONFIG_INLINE_WRITE_UNLOCK=y
182# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
183CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
184# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
185# CONFIG_MUTEX_SPIN_ON_OWNER is not set
154# CONFIG_FREEZER is not set 186# CONFIG_FREEZER is not set
155 187
156# 188#
@@ -226,8 +258,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
226# CONFIG_PHYS_ADDR_T_64BIT is not set 258# CONFIG_PHYS_ADDR_T_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=0 259CONFIG_ZONE_DMA_FLAG=0
228CONFIG_NR_QUICK=2 260CONFIG_NR_QUICK=2
229CONFIG_HAVE_MLOCK=y
230CONFIG_HAVE_MLOCKED_PAGE_BIT=y
231# CONFIG_KSM is not set 261# CONFIG_KSM is not set
232CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 262CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
233 263
@@ -321,7 +351,6 @@ CONFIG_GUSA=y
321CONFIG_ZERO_PAGE_OFFSET=0x00010000 351CONFIG_ZERO_PAGE_OFFSET=0x00010000
322CONFIG_BOOT_LINK_OFFSET=0x00800000 352CONFIG_BOOT_LINK_OFFSET=0x00800000
323CONFIG_ENTRY_OFFSET=0x00001000 353CONFIG_ENTRY_OFFSET=0x00001000
324# CONFIG_UBC_WAKEUP is not set
325CONFIG_CMDLINE_OVERWRITE=y 354CONFIG_CMDLINE_OVERWRITE=y
326# CONFIG_CMDLINE_EXTEND is not set 355# CONFIG_CMDLINE_EXTEND is not set
327CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1" 356CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
@@ -330,7 +359,6 @@ CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
330# Bus options 359# Bus options
331# 360#
332CONFIG_PCI=y 361CONFIG_PCI=y
333CONFIG_SH_PCIDMA_NONCOHERENT=y
334# CONFIG_PCIEPORTBUS is not set 362# CONFIG_PCIEPORTBUS is not set
335# CONFIG_ARCH_SUPPORTS_MSI is not set 363# CONFIG_ARCH_SUPPORTS_MSI is not set
336CONFIG_PCI_LEGACY=y 364CONFIG_PCI_LEGACY=y
@@ -429,10 +457,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
429# CONFIG_AF_RXRPC is not set 457# CONFIG_AF_RXRPC is not set
430CONFIG_WIRELESS=y 458CONFIG_WIRELESS=y
431# CONFIG_CFG80211 is not set 459# CONFIG_CFG80211 is not set
432CONFIG_CFG80211_DEFAULT_PS_VALUE=0
433# CONFIG_WIRELESS_OLD_REGULATORY is not set
434CONFIG_WIRELESS_EXT=y
435CONFIG_WIRELESS_EXT_SYSFS=y
436# CONFIG_LIB80211 is not set 460# CONFIG_LIB80211 is not set
437 461
438# 462#
@@ -466,6 +490,10 @@ CONFIG_BLK_DEV=y
466# CONFIG_BLK_DEV_UMEM is not set 490# CONFIG_BLK_DEV_UMEM is not set
467# CONFIG_BLK_DEV_COW_COMMON is not set 491# CONFIG_BLK_DEV_COW_COMMON is not set
468# CONFIG_BLK_DEV_LOOP is not set 492# CONFIG_BLK_DEV_LOOP is not set
493
494#
495# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
496#
469# CONFIG_BLK_DEV_NBD is not set 497# CONFIG_BLK_DEV_NBD is not set
470# CONFIG_BLK_DEV_SX8 is not set 498# CONFIG_BLK_DEV_SX8 is not set
471# CONFIG_BLK_DEV_UB is not set 499# CONFIG_BLK_DEV_UB is not set
@@ -482,6 +510,7 @@ CONFIG_MISC_DEVICES=y
482# CONFIG_TIFM_CORE is not set 510# CONFIG_TIFM_CORE is not set
483# CONFIG_ENCLOSURE_SERVICES is not set 511# CONFIG_ENCLOSURE_SERVICES is not set
484# CONFIG_HP_ILO is not set 512# CONFIG_HP_ILO is not set
513# CONFIG_TI_DAC7512 is not set
485# CONFIG_C2PORT is not set 514# CONFIG_C2PORT is not set
486 515
487# 516#
@@ -530,8 +559,11 @@ CONFIG_SCSI_LOWLEVEL=y
530# CONFIG_ISCSI_TCP is not set 559# CONFIG_ISCSI_TCP is not set
531# CONFIG_SCSI_CXGB3_ISCSI is not set 560# CONFIG_SCSI_CXGB3_ISCSI is not set
532# CONFIG_SCSI_BNX2_ISCSI is not set 561# CONFIG_SCSI_BNX2_ISCSI is not set
562# CONFIG_BE2ISCSI is not set
533# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 563# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
564# CONFIG_SCSI_HPSA is not set
534# CONFIG_SCSI_3W_9XXX is not set 565# CONFIG_SCSI_3W_9XXX is not set
566# CONFIG_SCSI_3W_SAS is not set
535# CONFIG_SCSI_ACARD is not set 567# CONFIG_SCSI_ACARD is not set
536# CONFIG_SCSI_AACRAID is not set 568# CONFIG_SCSI_AACRAID is not set
537# CONFIG_SCSI_AIC7XXX is not set 569# CONFIG_SCSI_AIC7XXX is not set
@@ -565,7 +597,9 @@ CONFIG_SCSI_LOWLEVEL=y
565# CONFIG_SCSI_NSP32 is not set 597# CONFIG_SCSI_NSP32 is not set
566# CONFIG_SCSI_DEBUG is not set 598# CONFIG_SCSI_DEBUG is not set
567# CONFIG_SCSI_PMCRAID is not set 599# CONFIG_SCSI_PMCRAID is not set
600# CONFIG_SCSI_PM8001 is not set
568# CONFIG_SCSI_SRP is not set 601# CONFIG_SCSI_SRP is not set
602# CONFIG_SCSI_BFA_FC is not set
569# CONFIG_SCSI_DH is not set 603# CONFIG_SCSI_DH is not set
570# CONFIG_SCSI_OSD_INITIATOR is not set 604# CONFIG_SCSI_OSD_INITIATOR is not set
571CONFIG_ATA=y 605CONFIG_ATA=y
@@ -618,15 +652,16 @@ CONFIG_ATA_SFF=y
618# CONFIG_PATA_NS87415 is not set 652# CONFIG_PATA_NS87415 is not set
619# CONFIG_PATA_OPTI is not set 653# CONFIG_PATA_OPTI is not set
620# CONFIG_PATA_OPTIDMA is not set 654# CONFIG_PATA_OPTIDMA is not set
655# CONFIG_PATA_PDC2027X is not set
621# CONFIG_PATA_PDC_OLD is not set 656# CONFIG_PATA_PDC_OLD is not set
622# CONFIG_PATA_RADISYS is not set 657# CONFIG_PATA_RADISYS is not set
623# CONFIG_PATA_RDC is not set 658# CONFIG_PATA_RDC is not set
624# CONFIG_PATA_RZ1000 is not set 659# CONFIG_PATA_RZ1000 is not set
625# CONFIG_PATA_SC1200 is not set 660# CONFIG_PATA_SC1200 is not set
626# CONFIG_PATA_SERVERWORKS is not set 661# CONFIG_PATA_SERVERWORKS is not set
627# CONFIG_PATA_PDC2027X is not set
628# CONFIG_PATA_SIL680 is not set 662# CONFIG_PATA_SIL680 is not set
629# CONFIG_PATA_SIS is not set 663# CONFIG_PATA_SIS is not set
664# CONFIG_PATA_TOSHIBA is not set
630# CONFIG_PATA_VIA is not set 665# CONFIG_PATA_VIA is not set
631# CONFIG_PATA_WINBOND is not set 666# CONFIG_PATA_WINBOND is not set
632CONFIG_PATA_PLATFORM=y 667CONFIG_PATA_PLATFORM=y
@@ -704,6 +739,7 @@ CONFIG_8139TOO=y
704# CONFIG_TLAN is not set 739# CONFIG_TLAN is not set
705# CONFIG_KS8842 is not set 740# CONFIG_KS8842 is not set
706# CONFIG_KS8851 is not set 741# CONFIG_KS8851 is not set
742# CONFIG_KS8851_MLL is not set
707# CONFIG_VIA_RHINE is not set 743# CONFIG_VIA_RHINE is not set
708# CONFIG_SC92031 is not set 744# CONFIG_SC92031 is not set
709# CONFIG_ATL2 is not set 745# CONFIG_ATL2 is not set
@@ -752,8 +788,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
752# CONFIG_BE2NET is not set 788# CONFIG_BE2NET is not set
753# CONFIG_TR is not set 789# CONFIG_TR is not set
754CONFIG_WLAN=y 790CONFIG_WLAN=y
755# CONFIG_WLAN_PRE80211 is not set 791# CONFIG_ATMEL is not set
756# CONFIG_WLAN_80211 is not set 792# CONFIG_PRISM54 is not set
793# CONFIG_USB_ZD1201 is not set
794# CONFIG_HOSTAP is not set
757 795
758# 796#
759# Enable WiMAX (Networking options) to see the WiMAX drivers 797# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -776,6 +814,7 @@ CONFIG_WLAN=y
776# CONFIG_NETCONSOLE is not set 814# CONFIG_NETCONSOLE is not set
777# CONFIG_NETPOLL is not set 815# CONFIG_NETPOLL is not set
778# CONFIG_NET_POLL_CONTROLLER is not set 816# CONFIG_NET_POLL_CONTROLLER is not set
817# CONFIG_VMXNET3 is not set
779# CONFIG_ISDN is not set 818# CONFIG_ISDN is not set
780# CONFIG_PHONE is not set 819# CONFIG_PHONE is not set
781 820
@@ -785,6 +824,7 @@ CONFIG_WLAN=y
785CONFIG_INPUT=y 824CONFIG_INPUT=y
786CONFIG_INPUT_FF_MEMLESS=m 825CONFIG_INPUT_FF_MEMLESS=m
787# CONFIG_INPUT_POLLDEV is not set 826# CONFIG_INPUT_POLLDEV is not set
827# CONFIG_INPUT_SPARSEKMAP is not set
788 828
789# 829#
790# Userland interfaces 830# Userland interfaces
@@ -862,7 +902,10 @@ CONFIG_SPI_MASTER=y
862# SPI Master Controller Drivers 902# SPI Master Controller Drivers
863# 903#
864CONFIG_SPI_BITBANG=y 904CONFIG_SPI_BITBANG=y
905# CONFIG_SPI_SH_MSIOF is not set
865CONFIG_SPI_SH_SCI=y 906CONFIG_SPI_SH_SCI=y
907# CONFIG_SPI_XILINX is not set
908# CONFIG_SPI_DESIGNWARE is not set
866 909
867# 910#
868# SPI Protocol Masters 911# SPI Protocol Masters
@@ -915,10 +958,12 @@ CONFIG_SSB_POSSIBLE=y
915# 958#
916# CONFIG_MFD_CORE is not set 959# CONFIG_MFD_CORE is not set
917CONFIG_MFD_SM501=y 960CONFIG_MFD_SM501=y
961# CONFIG_MFD_SH_MOBILE_SDHI is not set
918# CONFIG_HTC_PASIC3 is not set 962# CONFIG_HTC_PASIC3 is not set
919# CONFIG_MFD_TMIO is not set 963# CONFIG_MFD_TMIO is not set
920# CONFIG_MFD_MC13783 is not set 964# CONFIG_MFD_MC13783 is not set
921# CONFIG_EZX_PCAP is not set 965# CONFIG_EZX_PCAP is not set
966# CONFIG_AB4500_CORE is not set
922# CONFIG_REGULATOR is not set 967# CONFIG_REGULATOR is not set
923# CONFIG_MEDIA_SUPPORT is not set 968# CONFIG_MEDIA_SUPPORT is not set
924 969
@@ -1055,6 +1100,7 @@ CONFIG_SND_PCI=y
1055# CONFIG_SND_OXYGEN is not set 1100# CONFIG_SND_OXYGEN is not set
1056# CONFIG_SND_CS4281 is not set 1101# CONFIG_SND_CS4281 is not set
1057# CONFIG_SND_CS46XX is not set 1102# CONFIG_SND_CS46XX is not set
1103# CONFIG_SND_CS5535AUDIO is not set
1058# CONFIG_SND_CTXFI is not set 1104# CONFIG_SND_CTXFI is not set
1059# CONFIG_SND_DARLA20 is not set 1105# CONFIG_SND_DARLA20 is not set
1060# CONFIG_SND_GINA20 is not set 1106# CONFIG_SND_GINA20 is not set
@@ -1308,7 +1354,9 @@ CONFIG_RTC_DRV_R9701=y
1308# CONFIG_RTC_DRV_M48T86 is not set 1354# CONFIG_RTC_DRV_M48T86 is not set
1309# CONFIG_RTC_DRV_M48T35 is not set 1355# CONFIG_RTC_DRV_M48T35 is not set
1310# CONFIG_RTC_DRV_M48T59 is not set 1356# CONFIG_RTC_DRV_M48T59 is not set
1357# CONFIG_RTC_DRV_MSM6242 is not set
1311# CONFIG_RTC_DRV_BQ4802 is not set 1358# CONFIG_RTC_DRV_BQ4802 is not set
1359# CONFIG_RTC_DRV_RP5C01 is not set
1312# CONFIG_RTC_DRV_V3020 is not set 1360# CONFIG_RTC_DRV_V3020 is not set
1313 1361
1314# 1362#
@@ -1333,6 +1381,7 @@ CONFIG_EXT2_FS=y
1333# CONFIG_EXT2_FS_XIP is not set 1381# CONFIG_EXT2_FS_XIP is not set
1334# CONFIG_EXT3_FS is not set 1382# CONFIG_EXT3_FS is not set
1335# CONFIG_EXT4_FS is not set 1383# CONFIG_EXT4_FS is not set
1384CONFIG_EXT4_USE_FOR_EXT23=y
1336# CONFIG_REISERFS_FS is not set 1385# CONFIG_REISERFS_FS is not set
1337# CONFIG_JFS_FS is not set 1386# CONFIG_JFS_FS is not set
1338# CONFIG_FS_POSIX_ACL is not set 1387# CONFIG_FS_POSIX_ACL is not set
@@ -1474,10 +1523,11 @@ CONFIG_DEBUG_FS=y
1474# CONFIG_HEADERS_CHECK is not set 1523# CONFIG_HEADERS_CHECK is not set
1475# CONFIG_DEBUG_KERNEL is not set 1524# CONFIG_DEBUG_KERNEL is not set
1476CONFIG_STACKTRACE=y 1525CONFIG_STACKTRACE=y
1477# CONFIG_DEBUG_BUGVERBOSE is not set 1526CONFIG_DEBUG_BUGVERBOSE=y
1478# CONFIG_DEBUG_MEMORY_INIT is not set 1527# CONFIG_DEBUG_MEMORY_INIT is not set
1479# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1528# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1480# CONFIG_LATENCYTOP is not set 1529# CONFIG_LATENCYTOP is not set
1530# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1481CONFIG_NOP_TRACER=y 1531CONFIG_NOP_TRACER=y
1482CONFIG_HAVE_FUNCTION_TRACER=y 1532CONFIG_HAVE_FUNCTION_TRACER=y
1483CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1533CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1497,9 +1547,6 @@ CONFIG_TRACING_SUPPORT=y
1497# CONFIG_SAMPLES is not set 1547# CONFIG_SAMPLES is not set
1498CONFIG_HAVE_ARCH_KGDB=y 1548CONFIG_HAVE_ARCH_KGDB=y
1499# CONFIG_SH_STANDARD_BIOS is not set 1549# CONFIG_SH_STANDARD_BIOS is not set
1500CONFIG_EARLY_SCIF_CONSOLE=y
1501CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1502CONFIG_EARLY_PRINTK=y
1503# CONFIG_DWARF_UNWINDER is not set 1550# CONFIG_DWARF_UNWINDER is not set
1504 1551
1505# 1552#
@@ -1508,7 +1555,11 @@ CONFIG_EARLY_PRINTK=y
1508# CONFIG_KEYS is not set 1555# CONFIG_KEYS is not set
1509# CONFIG_SECURITY is not set 1556# CONFIG_SECURITY is not set
1510# CONFIG_SECURITYFS is not set 1557# CONFIG_SECURITYFS is not set
1511# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1558# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1559# CONFIG_DEFAULT_SECURITY_SMACK is not set
1560# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1561CONFIG_DEFAULT_SECURITY_DAC=y
1562CONFIG_DEFAULT_SECURITY=""
1512CONFIG_CRYPTO=y 1563CONFIG_CRYPTO=y
1513 1564
1514# 1565#
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
index 9215bbb13d6f..a8d538f06e67 100644
--- a/arch/sh/configs/rts7751r2dplus_defconfig
+++ b/arch/sh/configs/rts7751r2dplus_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:39:48 2009 4# Mon Jan 4 13:26:39 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -31,6 +32,7 @@ CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_IO_TRAPPED=y 34CONFIG_IO_TRAPPED=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -61,6 +63,7 @@ CONFIG_SYSVIPC_SYSCTL=y
61# 63#
62CONFIG_TREE_RCU=y 64CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
66# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 67# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 68CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 69# CONFIG_RCU_FANOUT_EXACT is not set
@@ -95,6 +98,7 @@ CONFIG_EVENTFD=y
95CONFIG_SHMEM=y 98CONFIG_SHMEM=y
96CONFIG_AIO=y 99CONFIG_AIO=y
97CONFIG_HAVE_PERF_EVENTS=y 100CONFIG_HAVE_PERF_EVENTS=y
101CONFIG_PERF_USE_VMALLOC=y
98 102
99# 103#
100# Kernel Performance Events And Counters 104# Kernel Performance Events And Counters
@@ -117,6 +121,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
117CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
120CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
121CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
122 127
@@ -143,14 +148,41 @@ CONFIG_LBDAF=y
143# IO Schedulers 148# IO Schedulers
144# 149#
145CONFIG_IOSCHED_NOOP=y 150CONFIG_IOSCHED_NOOP=y
146CONFIG_IOSCHED_AS=y
147CONFIG_IOSCHED_DEADLINE=y 151CONFIG_IOSCHED_DEADLINE=y
148CONFIG_IOSCHED_CFQ=y 152CONFIG_IOSCHED_CFQ=y
149CONFIG_DEFAULT_AS=y
150# CONFIG_DEFAULT_DEADLINE is not set 153# CONFIG_DEFAULT_DEADLINE is not set
151# CONFIG_DEFAULT_CFQ is not set 154CONFIG_DEFAULT_CFQ=y
152# CONFIG_DEFAULT_NOOP is not set 155# CONFIG_DEFAULT_NOOP is not set
153CONFIG_DEFAULT_IOSCHED="anticipatory" 156CONFIG_DEFAULT_IOSCHED="cfq"
157# CONFIG_INLINE_SPIN_TRYLOCK is not set
158# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK is not set
160# CONFIG_INLINE_SPIN_LOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
162# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
163CONFIG_INLINE_SPIN_UNLOCK=y
164# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
165CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
166# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
167# CONFIG_INLINE_READ_TRYLOCK is not set
168# CONFIG_INLINE_READ_LOCK is not set
169# CONFIG_INLINE_READ_LOCK_BH is not set
170# CONFIG_INLINE_READ_LOCK_IRQ is not set
171# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
172CONFIG_INLINE_READ_UNLOCK=y
173# CONFIG_INLINE_READ_UNLOCK_BH is not set
174CONFIG_INLINE_READ_UNLOCK_IRQ=y
175# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
176# CONFIG_INLINE_WRITE_TRYLOCK is not set
177# CONFIG_INLINE_WRITE_LOCK is not set
178# CONFIG_INLINE_WRITE_LOCK_BH is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
180# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
181CONFIG_INLINE_WRITE_UNLOCK=y
182# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
183CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
184# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
185# CONFIG_MUTEX_SPIN_ON_OWNER is not set
154# CONFIG_FREEZER is not set 186# CONFIG_FREEZER is not set
155 187
156# 188#
@@ -226,8 +258,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
226# CONFIG_PHYS_ADDR_T_64BIT is not set 258# CONFIG_PHYS_ADDR_T_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=0 259CONFIG_ZONE_DMA_FLAG=0
228CONFIG_NR_QUICK=2 260CONFIG_NR_QUICK=2
229CONFIG_HAVE_MLOCK=y
230CONFIG_HAVE_MLOCKED_PAGE_BIT=y
231# CONFIG_KSM is not set 261# CONFIG_KSM is not set
232CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 262CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
233 263
@@ -321,7 +351,6 @@ CONFIG_GUSA=y
321CONFIG_ZERO_PAGE_OFFSET=0x00010000 351CONFIG_ZERO_PAGE_OFFSET=0x00010000
322CONFIG_BOOT_LINK_OFFSET=0x00800000 352CONFIG_BOOT_LINK_OFFSET=0x00800000
323CONFIG_ENTRY_OFFSET=0x00001000 353CONFIG_ENTRY_OFFSET=0x00001000
324# CONFIG_UBC_WAKEUP is not set
325CONFIG_CMDLINE_OVERWRITE=y 354CONFIG_CMDLINE_OVERWRITE=y
326# CONFIG_CMDLINE_EXTEND is not set 355# CONFIG_CMDLINE_EXTEND is not set
327CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1" 356CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
@@ -330,7 +359,6 @@ CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
330# Bus options 359# Bus options
331# 360#
332CONFIG_PCI=y 361CONFIG_PCI=y
333CONFIG_SH_PCIDMA_NONCOHERENT=y
334# CONFIG_PCIEPORTBUS is not set 362# CONFIG_PCIEPORTBUS is not set
335# CONFIG_ARCH_SUPPORTS_MSI is not set 363# CONFIG_ARCH_SUPPORTS_MSI is not set
336CONFIG_PCI_LEGACY=y 364CONFIG_PCI_LEGACY=y
@@ -429,10 +457,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
429# CONFIG_AF_RXRPC is not set 457# CONFIG_AF_RXRPC is not set
430CONFIG_WIRELESS=y 458CONFIG_WIRELESS=y
431# CONFIG_CFG80211 is not set 459# CONFIG_CFG80211 is not set
432CONFIG_CFG80211_DEFAULT_PS_VALUE=0
433# CONFIG_WIRELESS_OLD_REGULATORY is not set
434CONFIG_WIRELESS_EXT=y
435CONFIG_WIRELESS_EXT_SYSFS=y
436# CONFIG_LIB80211 is not set 460# CONFIG_LIB80211 is not set
437 461
438# 462#
@@ -552,6 +576,10 @@ CONFIG_BLK_DEV=y
552# CONFIG_BLK_DEV_UMEM is not set 576# CONFIG_BLK_DEV_UMEM is not set
553# CONFIG_BLK_DEV_COW_COMMON is not set 577# CONFIG_BLK_DEV_COW_COMMON is not set
554# CONFIG_BLK_DEV_LOOP is not set 578# CONFIG_BLK_DEV_LOOP is not set
579
580#
581# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
582#
555# CONFIG_BLK_DEV_NBD is not set 583# CONFIG_BLK_DEV_NBD is not set
556# CONFIG_BLK_DEV_SX8 is not set 584# CONFIG_BLK_DEV_SX8 is not set
557# CONFIG_BLK_DEV_UB is not set 585# CONFIG_BLK_DEV_UB is not set
@@ -568,6 +596,7 @@ CONFIG_MISC_DEVICES=y
568# CONFIG_TIFM_CORE is not set 596# CONFIG_TIFM_CORE is not set
569# CONFIG_ENCLOSURE_SERVICES is not set 597# CONFIG_ENCLOSURE_SERVICES is not set
570# CONFIG_HP_ILO is not set 598# CONFIG_HP_ILO is not set
599# CONFIG_TI_DAC7512 is not set
571# CONFIG_C2PORT is not set 600# CONFIG_C2PORT is not set
572 601
573# 602#
@@ -616,8 +645,11 @@ CONFIG_SCSI_LOWLEVEL=y
616# CONFIG_ISCSI_TCP is not set 645# CONFIG_ISCSI_TCP is not set
617# CONFIG_SCSI_CXGB3_ISCSI is not set 646# CONFIG_SCSI_CXGB3_ISCSI is not set
618# CONFIG_SCSI_BNX2_ISCSI is not set 647# CONFIG_SCSI_BNX2_ISCSI is not set
648# CONFIG_BE2ISCSI is not set
619# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 649# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
650# CONFIG_SCSI_HPSA is not set
620# CONFIG_SCSI_3W_9XXX is not set 651# CONFIG_SCSI_3W_9XXX is not set
652# CONFIG_SCSI_3W_SAS is not set
621# CONFIG_SCSI_ACARD is not set 653# CONFIG_SCSI_ACARD is not set
622# CONFIG_SCSI_AACRAID is not set 654# CONFIG_SCSI_AACRAID is not set
623# CONFIG_SCSI_AIC7XXX is not set 655# CONFIG_SCSI_AIC7XXX is not set
@@ -651,7 +683,9 @@ CONFIG_SCSI_LOWLEVEL=y
651# CONFIG_SCSI_NSP32 is not set 683# CONFIG_SCSI_NSP32 is not set
652# CONFIG_SCSI_DEBUG is not set 684# CONFIG_SCSI_DEBUG is not set
653# CONFIG_SCSI_PMCRAID is not set 685# CONFIG_SCSI_PMCRAID is not set
686# CONFIG_SCSI_PM8001 is not set
654# CONFIG_SCSI_SRP is not set 687# CONFIG_SCSI_SRP is not set
688# CONFIG_SCSI_BFA_FC is not set
655# CONFIG_SCSI_DH is not set 689# CONFIG_SCSI_DH is not set
656# CONFIG_SCSI_OSD_INITIATOR is not set 690# CONFIG_SCSI_OSD_INITIATOR is not set
657CONFIG_ATA=y 691CONFIG_ATA=y
@@ -704,15 +738,16 @@ CONFIG_ATA_SFF=y
704# CONFIG_PATA_NS87415 is not set 738# CONFIG_PATA_NS87415 is not set
705# CONFIG_PATA_OPTI is not set 739# CONFIG_PATA_OPTI is not set
706# CONFIG_PATA_OPTIDMA is not set 740# CONFIG_PATA_OPTIDMA is not set
741# CONFIG_PATA_PDC2027X is not set
707# CONFIG_PATA_PDC_OLD is not set 742# CONFIG_PATA_PDC_OLD is not set
708# CONFIG_PATA_RADISYS is not set 743# CONFIG_PATA_RADISYS is not set
709# CONFIG_PATA_RDC is not set 744# CONFIG_PATA_RDC is not set
710# CONFIG_PATA_RZ1000 is not set 745# CONFIG_PATA_RZ1000 is not set
711# CONFIG_PATA_SC1200 is not set 746# CONFIG_PATA_SC1200 is not set
712# CONFIG_PATA_SERVERWORKS is not set 747# CONFIG_PATA_SERVERWORKS is not set
713# CONFIG_PATA_PDC2027X is not set
714# CONFIG_PATA_SIL680 is not set 748# CONFIG_PATA_SIL680 is not set
715# CONFIG_PATA_SIS is not set 749# CONFIG_PATA_SIS is not set
750# CONFIG_PATA_TOSHIBA is not set
716# CONFIG_PATA_VIA is not set 751# CONFIG_PATA_VIA is not set
717# CONFIG_PATA_WINBOND is not set 752# CONFIG_PATA_WINBOND is not set
718CONFIG_PATA_PLATFORM=y 753CONFIG_PATA_PLATFORM=y
@@ -790,6 +825,7 @@ CONFIG_8139TOO=y
790# CONFIG_TLAN is not set 825# CONFIG_TLAN is not set
791# CONFIG_KS8842 is not set 826# CONFIG_KS8842 is not set
792# CONFIG_KS8851 is not set 827# CONFIG_KS8851 is not set
828# CONFIG_KS8851_MLL is not set
793# CONFIG_VIA_RHINE is not set 829# CONFIG_VIA_RHINE is not set
794# CONFIG_SC92031 is not set 830# CONFIG_SC92031 is not set
795# CONFIG_ATL2 is not set 831# CONFIG_ATL2 is not set
@@ -838,8 +874,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
838# CONFIG_BE2NET is not set 874# CONFIG_BE2NET is not set
839# CONFIG_TR is not set 875# CONFIG_TR is not set
840CONFIG_WLAN=y 876CONFIG_WLAN=y
841# CONFIG_WLAN_PRE80211 is not set 877# CONFIG_ATMEL is not set
842# CONFIG_WLAN_80211 is not set 878# CONFIG_PRISM54 is not set
879# CONFIG_USB_ZD1201 is not set
880# CONFIG_HOSTAP is not set
843 881
844# 882#
845# Enable WiMAX (Networking options) to see the WiMAX drivers 883# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -862,6 +900,7 @@ CONFIG_WLAN=y
862# CONFIG_NETCONSOLE is not set 900# CONFIG_NETCONSOLE is not set
863# CONFIG_NETPOLL is not set 901# CONFIG_NETPOLL is not set
864# CONFIG_NET_POLL_CONTROLLER is not set 902# CONFIG_NET_POLL_CONTROLLER is not set
903# CONFIG_VMXNET3 is not set
865# CONFIG_ISDN is not set 904# CONFIG_ISDN is not set
866# CONFIG_PHONE is not set 905# CONFIG_PHONE is not set
867 906
@@ -871,6 +910,7 @@ CONFIG_WLAN=y
871CONFIG_INPUT=y 910CONFIG_INPUT=y
872CONFIG_INPUT_FF_MEMLESS=m 911CONFIG_INPUT_FF_MEMLESS=m
873# CONFIG_INPUT_POLLDEV is not set 912# CONFIG_INPUT_POLLDEV is not set
913# CONFIG_INPUT_SPARSEKMAP is not set
874 914
875# 915#
876# Userland interfaces 916# Userland interfaces
@@ -948,7 +988,10 @@ CONFIG_SPI_MASTER=y
948# SPI Master Controller Drivers 988# SPI Master Controller Drivers
949# 989#
950CONFIG_SPI_BITBANG=y 990CONFIG_SPI_BITBANG=y
991# CONFIG_SPI_SH_MSIOF is not set
951CONFIG_SPI_SH_SCI=y 992CONFIG_SPI_SH_SCI=y
993# CONFIG_SPI_XILINX is not set
994# CONFIG_SPI_DESIGNWARE is not set
952 995
953# 996#
954# SPI Protocol Masters 997# SPI Protocol Masters
@@ -1001,10 +1044,12 @@ CONFIG_SSB_POSSIBLE=y
1001# 1044#
1002# CONFIG_MFD_CORE is not set 1045# CONFIG_MFD_CORE is not set
1003CONFIG_MFD_SM501=y 1046CONFIG_MFD_SM501=y
1047# CONFIG_MFD_SH_MOBILE_SDHI is not set
1004# CONFIG_HTC_PASIC3 is not set 1048# CONFIG_HTC_PASIC3 is not set
1005# CONFIG_MFD_TMIO is not set 1049# CONFIG_MFD_TMIO is not set
1006# CONFIG_MFD_MC13783 is not set 1050# CONFIG_MFD_MC13783 is not set
1007# CONFIG_EZX_PCAP is not set 1051# CONFIG_EZX_PCAP is not set
1052# CONFIG_AB4500_CORE is not set
1008# CONFIG_REGULATOR is not set 1053# CONFIG_REGULATOR is not set
1009# CONFIG_MEDIA_SUPPORT is not set 1054# CONFIG_MEDIA_SUPPORT is not set
1010 1055
@@ -1141,6 +1186,7 @@ CONFIG_SND_PCI=y
1141# CONFIG_SND_OXYGEN is not set 1186# CONFIG_SND_OXYGEN is not set
1142# CONFIG_SND_CS4281 is not set 1187# CONFIG_SND_CS4281 is not set
1143# CONFIG_SND_CS46XX is not set 1188# CONFIG_SND_CS46XX is not set
1189# CONFIG_SND_CS5535AUDIO is not set
1144# CONFIG_SND_CTXFI is not set 1190# CONFIG_SND_CTXFI is not set
1145# CONFIG_SND_DARLA20 is not set 1191# CONFIG_SND_DARLA20 is not set
1146# CONFIG_SND_GINA20 is not set 1192# CONFIG_SND_GINA20 is not set
@@ -1394,7 +1440,9 @@ CONFIG_RTC_DRV_R9701=y
1394# CONFIG_RTC_DRV_M48T86 is not set 1440# CONFIG_RTC_DRV_M48T86 is not set
1395# CONFIG_RTC_DRV_M48T35 is not set 1441# CONFIG_RTC_DRV_M48T35 is not set
1396# CONFIG_RTC_DRV_M48T59 is not set 1442# CONFIG_RTC_DRV_M48T59 is not set
1443# CONFIG_RTC_DRV_MSM6242 is not set
1397# CONFIG_RTC_DRV_BQ4802 is not set 1444# CONFIG_RTC_DRV_BQ4802 is not set
1445# CONFIG_RTC_DRV_RP5C01 is not set
1398# CONFIG_RTC_DRV_V3020 is not set 1446# CONFIG_RTC_DRV_V3020 is not set
1399 1447
1400# 1448#
@@ -1419,6 +1467,7 @@ CONFIG_EXT2_FS=y
1419# CONFIG_EXT2_FS_XIP is not set 1467# CONFIG_EXT2_FS_XIP is not set
1420# CONFIG_EXT3_FS is not set 1468# CONFIG_EXT3_FS is not set
1421# CONFIG_EXT4_FS is not set 1469# CONFIG_EXT4_FS is not set
1470CONFIG_EXT4_USE_FOR_EXT23=y
1422# CONFIG_REISERFS_FS is not set 1471# CONFIG_REISERFS_FS is not set
1423# CONFIG_JFS_FS is not set 1472# CONFIG_JFS_FS is not set
1424# CONFIG_FS_POSIX_ACL is not set 1473# CONFIG_FS_POSIX_ACL is not set
@@ -1561,10 +1610,11 @@ CONFIG_DEBUG_FS=y
1561# CONFIG_HEADERS_CHECK is not set 1610# CONFIG_HEADERS_CHECK is not set
1562# CONFIG_DEBUG_KERNEL is not set 1611# CONFIG_DEBUG_KERNEL is not set
1563CONFIG_STACKTRACE=y 1612CONFIG_STACKTRACE=y
1564# CONFIG_DEBUG_BUGVERBOSE is not set 1613CONFIG_DEBUG_BUGVERBOSE=y
1565# CONFIG_DEBUG_MEMORY_INIT is not set 1614# CONFIG_DEBUG_MEMORY_INIT is not set
1566# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1615# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1567# CONFIG_LATENCYTOP is not set 1616# CONFIG_LATENCYTOP is not set
1617# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1568CONFIG_NOP_TRACER=y 1618CONFIG_NOP_TRACER=y
1569CONFIG_HAVE_FUNCTION_TRACER=y 1619CONFIG_HAVE_FUNCTION_TRACER=y
1570CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1620CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1584,9 +1634,6 @@ CONFIG_TRACING_SUPPORT=y
1584# CONFIG_SAMPLES is not set 1634# CONFIG_SAMPLES is not set
1585CONFIG_HAVE_ARCH_KGDB=y 1635CONFIG_HAVE_ARCH_KGDB=y
1586# CONFIG_SH_STANDARD_BIOS is not set 1636# CONFIG_SH_STANDARD_BIOS is not set
1587CONFIG_EARLY_SCIF_CONSOLE=y
1588CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
1589CONFIG_EARLY_PRINTK=y
1590# CONFIG_DWARF_UNWINDER is not set 1637# CONFIG_DWARF_UNWINDER is not set
1591 1638
1592# 1639#
@@ -1595,7 +1642,11 @@ CONFIG_EARLY_PRINTK=y
1595# CONFIG_KEYS is not set 1642# CONFIG_KEYS is not set
1596# CONFIG_SECURITY is not set 1643# CONFIG_SECURITY is not set
1597# CONFIG_SECURITYFS is not set 1644# CONFIG_SECURITYFS is not set
1598# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1645# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1646# CONFIG_DEFAULT_SECURITY_SMACK is not set
1647# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1648CONFIG_DEFAULT_SECURITY_DAC=y
1649CONFIG_DEFAULT_SECURITY=""
1599CONFIG_CRYPTO=y 1650CONFIG_CRYPTO=y
1600 1651
1601# 1652#
diff --git a/arch/sh/configs/sdk7780_defconfig b/arch/sh/configs/sdk7780_defconfig
index 055536b5c5cd..1859ba099945 100644
--- a/arch/sh/configs/sdk7780_defconfig
+++ b/arch/sh/configs/sdk7780_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:40:25 2009 4# Mon Jan 4 13:27:20 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -63,6 +65,7 @@ CONFIG_BSD_PROCESS_ACCT=y
63# 65#
64CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 69# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -99,6 +102,7 @@ CONFIG_EVENTFD=y
99CONFIG_SHMEM=y 102CONFIG_SHMEM=y
100CONFIG_AIO=y 103CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y 104CONFIG_HAVE_PERF_EVENTS=y
105CONFIG_PERF_USE_VMALLOC=y
102 106
103# 107#
104# Kernel Performance Events And Counters 108# Kernel Performance Events And Counters
@@ -119,6 +123,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
119CONFIG_HAVE_KPROBES=y 123CONFIG_HAVE_KPROBES=y
120CONFIG_HAVE_KRETPROBES=y 124CONFIG_HAVE_KRETPROBES=y
121CONFIG_HAVE_ARCH_TRACEHOOK=y 125CONFIG_HAVE_ARCH_TRACEHOOK=y
126CONFIG_HAVE_DMA_ATTRS=y
122CONFIG_HAVE_CLK=y 127CONFIG_HAVE_CLK=y
123CONFIG_HAVE_DMA_API_DEBUG=y 128CONFIG_HAVE_DMA_API_DEBUG=y
124 129
@@ -145,14 +150,41 @@ CONFIG_LBDAF=y
145# IO Schedulers 150# IO Schedulers
146# 151#
147CONFIG_IOSCHED_NOOP=y 152CONFIG_IOSCHED_NOOP=y
148CONFIG_IOSCHED_AS=y
149CONFIG_IOSCHED_DEADLINE=y 153CONFIG_IOSCHED_DEADLINE=y
150CONFIG_IOSCHED_CFQ=y 154CONFIG_IOSCHED_CFQ=y
151CONFIG_DEFAULT_AS=y
152# CONFIG_DEFAULT_DEADLINE is not set 155# CONFIG_DEFAULT_DEADLINE is not set
153# CONFIG_DEFAULT_CFQ is not set 156CONFIG_DEFAULT_CFQ=y
154# CONFIG_DEFAULT_NOOP is not set 157# CONFIG_DEFAULT_NOOP is not set
155CONFIG_DEFAULT_IOSCHED="anticipatory" 158CONFIG_DEFAULT_IOSCHED="cfq"
159# CONFIG_INLINE_SPIN_TRYLOCK is not set
160# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK is not set
162# CONFIG_INLINE_SPIN_LOCK_BH is not set
163# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
164# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
165# CONFIG_INLINE_SPIN_UNLOCK is not set
166# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
167# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
168# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
169# CONFIG_INLINE_READ_TRYLOCK is not set
170# CONFIG_INLINE_READ_LOCK is not set
171# CONFIG_INLINE_READ_LOCK_BH is not set
172# CONFIG_INLINE_READ_LOCK_IRQ is not set
173# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
174# CONFIG_INLINE_READ_UNLOCK is not set
175# CONFIG_INLINE_READ_UNLOCK_BH is not set
176# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
177# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
178# CONFIG_INLINE_WRITE_TRYLOCK is not set
179# CONFIG_INLINE_WRITE_LOCK is not set
180# CONFIG_INLINE_WRITE_LOCK_BH is not set
181# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
182# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
183# CONFIG_INLINE_WRITE_UNLOCK is not set
184# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
185# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
186# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
187# CONFIG_MUTEX_SPIN_ON_OWNER is not set
156# CONFIG_FREEZER is not set 188# CONFIG_FREEZER is not set
157 189
158# 190#
@@ -239,8 +271,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
239# CONFIG_PHYS_ADDR_T_64BIT is not set 271# CONFIG_PHYS_ADDR_T_64BIT is not set
240CONFIG_ZONE_DMA_FLAG=0 272CONFIG_ZONE_DMA_FLAG=0
241CONFIG_NR_QUICK=2 273CONFIG_NR_QUICK=2
242CONFIG_HAVE_MLOCK=y
243CONFIG_HAVE_MLOCKED_PAGE_BIT=y
244# CONFIG_KSM is not set 274# CONFIG_KSM is not set
245CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 275CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
246 276
@@ -291,9 +321,9 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
291# 321#
292# DMA support 322# DMA support
293# 323#
294CONFIG_SH_DMA_API=y
295CONFIG_SH_DMA=y 324CONFIG_SH_DMA=y
296CONFIG_SH_DMA_IRQ_MULTI=y 325CONFIG_SH_DMA_IRQ_MULTI=y
326CONFIG_SH_DMA_API=y
297CONFIG_NR_ONCHIP_DMA_CHANNELS=12 327CONFIG_NR_ONCHIP_DMA_CHANNELS=12
298# CONFIG_NR_DMA_CHANNELS_BOOL is not set 328# CONFIG_NR_DMA_CHANNELS_BOOL is not set
299 329
@@ -339,7 +369,6 @@ CONFIG_CMDLINE="mem=128M console=tty0 console=ttySC0,115200 ip=bootp root=/dev/n
339# Bus options 369# Bus options
340# 370#
341CONFIG_PCI=y 371CONFIG_PCI=y
342CONFIG_SH_PCIDMA_NONCOHERENT=y
343# CONFIG_PCIEPORTBUS is not set 372# CONFIG_PCIEPORTBUS is not set
344# CONFIG_ARCH_SUPPORTS_MSI is not set 373# CONFIG_ARCH_SUPPORTS_MSI is not set
345# CONFIG_PCI_LEGACY is not set 374# CONFIG_PCI_LEGACY is not set
@@ -347,7 +376,6 @@ CONFIG_PCI_DEBUG=y
347# CONFIG_PCI_STUB is not set 376# CONFIG_PCI_STUB is not set
348# CONFIG_PCI_IOV is not set 377# CONFIG_PCI_IOV is not set
349CONFIG_PCCARD=y 378CONFIG_PCCARD=y
350# CONFIG_PCMCIA_DEBUG is not set
351CONFIG_PCMCIA=y 379CONFIG_PCMCIA=y
352CONFIG_PCMCIA_LOAD_CIS=y 380CONFIG_PCMCIA_LOAD_CIS=y
353CONFIG_PCMCIA_IOCTL=y 381CONFIG_PCMCIA_IOCTL=y
@@ -445,6 +473,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
445# CONFIG_INET6_XFRM_MODE_BEET is not set 473# CONFIG_INET6_XFRM_MODE_BEET is not set
446# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 474# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
447CONFIG_IPV6_SIT=y 475CONFIG_IPV6_SIT=y
476# CONFIG_IPV6_SIT_6RD is not set
448CONFIG_IPV6_NDISC_NODETYPE=y 477CONFIG_IPV6_NDISC_NODETYPE=y
449# CONFIG_IPV6_TUNNEL is not set 478# CONFIG_IPV6_TUNNEL is not set
450# CONFIG_IPV6_MULTIPLE_TABLES is not set 479# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -515,9 +544,6 @@ CONFIG_NET_SCH_FIFO=y
515# CONFIG_AF_RXRPC is not set 544# CONFIG_AF_RXRPC is not set
516CONFIG_WIRELESS=y 545CONFIG_WIRELESS=y
517# CONFIG_CFG80211 is not set 546# CONFIG_CFG80211 is not set
518CONFIG_CFG80211_DEFAULT_PS_VALUE=0
519# CONFIG_WIRELESS_OLD_REGULATORY is not set
520# CONFIG_WIRELESS_EXT is not set
521# CONFIG_LIB80211 is not set 547# CONFIG_LIB80211 is not set
522 548
523# 549#
@@ -558,6 +584,10 @@ CONFIG_BLK_DEV=y
558# CONFIG_BLK_DEV_COW_COMMON is not set 584# CONFIG_BLK_DEV_COW_COMMON is not set
559CONFIG_BLK_DEV_LOOP=y 585CONFIG_BLK_DEV_LOOP=y
560# CONFIG_BLK_DEV_CRYPTOLOOP is not set 586# CONFIG_BLK_DEV_CRYPTOLOOP is not set
587
588#
589# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
590#
561# CONFIG_BLK_DEV_NBD is not set 591# CONFIG_BLK_DEV_NBD is not set
562# CONFIG_BLK_DEV_SX8 is not set 592# CONFIG_BLK_DEV_SX8 is not set
563# CONFIG_BLK_DEV_UB is not set 593# CONFIG_BLK_DEV_UB is not set
@@ -663,8 +693,11 @@ CONFIG_SCSI_FC_ATTRS=y
663CONFIG_SCSI_LOWLEVEL=y 693CONFIG_SCSI_LOWLEVEL=y
664# CONFIG_ISCSI_TCP is not set 694# CONFIG_ISCSI_TCP is not set
665# CONFIG_SCSI_BNX2_ISCSI is not set 695# CONFIG_SCSI_BNX2_ISCSI is not set
696# CONFIG_BE2ISCSI is not set
666# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 697# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
698# CONFIG_SCSI_HPSA is not set
667# CONFIG_SCSI_3W_9XXX is not set 699# CONFIG_SCSI_3W_9XXX is not set
700# CONFIG_SCSI_3W_SAS is not set
668# CONFIG_SCSI_ACARD is not set 701# CONFIG_SCSI_ACARD is not set
669# CONFIG_SCSI_AACRAID is not set 702# CONFIG_SCSI_AACRAID is not set
670# CONFIG_SCSI_AIC7XXX is not set 703# CONFIG_SCSI_AIC7XXX is not set
@@ -698,7 +731,9 @@ CONFIG_SCSI_LOWLEVEL=y
698# CONFIG_SCSI_NSP32 is not set 731# CONFIG_SCSI_NSP32 is not set
699# CONFIG_SCSI_DEBUG is not set 732# CONFIG_SCSI_DEBUG is not set
700# CONFIG_SCSI_PMCRAID is not set 733# CONFIG_SCSI_PMCRAID is not set
734# CONFIG_SCSI_PM8001 is not set
701# CONFIG_SCSI_SRP is not set 735# CONFIG_SCSI_SRP is not set
736# CONFIG_SCSI_BFA_FC is not set
702# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 737# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
703# CONFIG_SCSI_DH is not set 738# CONFIG_SCSI_DH is not set
704# CONFIG_SCSI_OSD_INITIATOR is not set 739# CONFIG_SCSI_OSD_INITIATOR is not set
@@ -753,15 +788,16 @@ CONFIG_ATA_SFF=y
753# CONFIG_PATA_OPTI is not set 788# CONFIG_PATA_OPTI is not set
754# CONFIG_PATA_OPTIDMA is not set 789# CONFIG_PATA_OPTIDMA is not set
755# CONFIG_PATA_PCMCIA is not set 790# CONFIG_PATA_PCMCIA is not set
791# CONFIG_PATA_PDC2027X is not set
756# CONFIG_PATA_PDC_OLD is not set 792# CONFIG_PATA_PDC_OLD is not set
757# CONFIG_PATA_RADISYS is not set 793# CONFIG_PATA_RADISYS is not set
758# CONFIG_PATA_RDC is not set 794# CONFIG_PATA_RDC is not set
759# CONFIG_PATA_RZ1000 is not set 795# CONFIG_PATA_RZ1000 is not set
760# CONFIG_PATA_SC1200 is not set 796# CONFIG_PATA_SC1200 is not set
761# CONFIG_PATA_SERVERWORKS is not set 797# CONFIG_PATA_SERVERWORKS is not set
762# CONFIG_PATA_PDC2027X is not set
763# CONFIG_PATA_SIL680 is not set 798# CONFIG_PATA_SIL680 is not set
764# CONFIG_PATA_SIS is not set 799# CONFIG_PATA_SIS is not set
800# CONFIG_PATA_TOSHIBA is not set
765# CONFIG_PATA_VIA is not set 801# CONFIG_PATA_VIA is not set
766# CONFIG_PATA_WINBOND is not set 802# CONFIG_PATA_WINBOND is not set
767# CONFIG_PATA_PLATFORM is not set 803# CONFIG_PATA_PLATFORM is not set
@@ -827,14 +863,20 @@ CONFIG_SMC91X=y
827# CONFIG_NET_PCI is not set 863# CONFIG_NET_PCI is not set
828# CONFIG_B44 is not set 864# CONFIG_B44 is not set
829# CONFIG_KS8842 is not set 865# CONFIG_KS8842 is not set
866# CONFIG_KS8851_MLL is not set
830# CONFIG_NET_POCKET is not set 867# CONFIG_NET_POCKET is not set
831# CONFIG_ATL2 is not set 868# CONFIG_ATL2 is not set
832# CONFIG_NETDEV_1000 is not set 869# CONFIG_NETDEV_1000 is not set
833# CONFIG_NETDEV_10000 is not set 870# CONFIG_NETDEV_10000 is not set
834# CONFIG_TR is not set 871# CONFIG_TR is not set
835CONFIG_WLAN=y 872CONFIG_WLAN=y
836# CONFIG_WLAN_PRE80211 is not set 873# CONFIG_PCMCIA_RAYCS is not set
837# CONFIG_WLAN_80211 is not set 874# CONFIG_ATMEL is not set
875# CONFIG_AIRO_CS is not set
876# CONFIG_PCMCIA_WL3501 is not set
877# CONFIG_PRISM54 is not set
878# CONFIG_USB_ZD1201 is not set
879# CONFIG_HOSTAP is not set
838 880
839# 881#
840# Enable WiMAX (Networking options) to see the WiMAX drivers 882# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -861,6 +903,7 @@ CONFIG_NETCONSOLE=y
861CONFIG_NETPOLL=y 903CONFIG_NETPOLL=y
862# CONFIG_NETPOLL_TRAP is not set 904# CONFIG_NETPOLL_TRAP is not set
863CONFIG_NET_POLL_CONTROLLER=y 905CONFIG_NET_POLL_CONTROLLER=y
906# CONFIG_VMXNET3 is not set
864# CONFIG_ISDN is not set 907# CONFIG_ISDN is not set
865# CONFIG_PHONE is not set 908# CONFIG_PHONE is not set
866 909
@@ -870,6 +913,7 @@ CONFIG_NET_POLL_CONTROLLER=y
870CONFIG_INPUT=y 913CONFIG_INPUT=y
871CONFIG_INPUT_FF_MEMLESS=m 914CONFIG_INPUT_FF_MEMLESS=m
872# CONFIG_INPUT_POLLDEV is not set 915# CONFIG_INPUT_POLLDEV is not set
916# CONFIG_INPUT_SPARSEKMAP is not set
873 917
874# 918#
875# Userland interfaces 919# Userland interfaces
@@ -922,6 +966,7 @@ CONFIG_SERIO=y
922# CONFIG_SERIO_PCIPS2 is not set 966# CONFIG_SERIO_PCIPS2 is not set
923CONFIG_SERIO_LIBPS2=y 967CONFIG_SERIO_LIBPS2=y
924# CONFIG_SERIO_RAW is not set 968# CONFIG_SERIO_RAW is not set
969# CONFIG_SERIO_ALTERA_PS2 is not set
925# CONFIG_GAMEPORT is not set 970# CONFIG_GAMEPORT is not set
926 971
927# 972#
@@ -1009,6 +1054,7 @@ CONFIG_SSB_DRIVER_PCICORE=y
1009# 1054#
1010# CONFIG_MFD_CORE is not set 1055# CONFIG_MFD_CORE is not set
1011# CONFIG_MFD_SM501 is not set 1056# CONFIG_MFD_SM501 is not set
1057# CONFIG_MFD_SH_MOBILE_SDHI is not set
1012# CONFIG_HTC_PASIC3 is not set 1058# CONFIG_HTC_PASIC3 is not set
1013# CONFIG_MFD_TMIO is not set 1059# CONFIG_MFD_TMIO is not set
1014# CONFIG_REGULATOR is not set 1060# CONFIG_REGULATOR is not set
@@ -1534,8 +1580,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1534CONFIG_HAVE_ARCH_KGDB=y 1580CONFIG_HAVE_ARCH_KGDB=y
1535# CONFIG_KGDB is not set 1581# CONFIG_KGDB is not set
1536CONFIG_SH_STANDARD_BIOS=y 1582CONFIG_SH_STANDARD_BIOS=y
1537# CONFIG_EARLY_SCIF_CONSOLE is not set
1538# CONFIG_EARLY_PRINTK is not set
1539# CONFIG_STACK_DEBUG is not set 1583# CONFIG_STACK_DEBUG is not set
1540# CONFIG_DEBUG_STACK_USAGE is not set 1584# CONFIG_DEBUG_STACK_USAGE is not set
1541# CONFIG_4KSTACKS is not set 1585# CONFIG_4KSTACKS is not set
@@ -1549,7 +1593,11 @@ CONFIG_DUMP_CODE=y
1549# CONFIG_KEYS is not set 1593# CONFIG_KEYS is not set
1550# CONFIG_SECURITY is not set 1594# CONFIG_SECURITY is not set
1551# CONFIG_SECURITYFS is not set 1595# CONFIG_SECURITYFS is not set
1552# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1596# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1597# CONFIG_DEFAULT_SECURITY_SMACK is not set
1598# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1599CONFIG_DEFAULT_SECURITY_DAC=y
1600CONFIG_DEFAULT_SECURITY=""
1553CONFIG_CRYPTO=y 1601CONFIG_CRYPTO=y
1554 1602
1555# 1603#
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index 1cd1777aa436..43e6780a89d1 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:45:28 2009 4# Mon Jan 4 13:30:00 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -30,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
35 36
@@ -64,6 +65,7 @@ CONFIG_AUDIT_TREE=y
64# 65#
65CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
66# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
67CONFIG_RCU_TRACE=y 69CONFIG_RCU_TRACE=y
68CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
69# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -115,6 +117,7 @@ CONFIG_TIMERFD=y
115CONFIG_EVENTFD=y 117CONFIG_EVENTFD=y
116CONFIG_AIO=y 118CONFIG_AIO=y
117CONFIG_HAVE_PERF_EVENTS=y 119CONFIG_HAVE_PERF_EVENTS=y
120CONFIG_PERF_USE_VMALLOC=y
118 121
119# 122#
120# Kernel Performance Events And Counters 123# Kernel Performance Events And Counters
@@ -122,11 +125,13 @@ CONFIG_HAVE_PERF_EVENTS=y
122CONFIG_PERF_EVENTS=y 125CONFIG_PERF_EVENTS=y
123CONFIG_EVENT_PROFILE=y 126CONFIG_EVENT_PROFILE=y
124# CONFIG_PERF_COUNTERS is not set 127# CONFIG_PERF_COUNTERS is not set
128# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
125CONFIG_VM_EVENT_COUNTERS=y 129CONFIG_VM_EVENT_COUNTERS=y
126# CONFIG_COMPAT_BRK is not set 130# CONFIG_COMPAT_BRK is not set
127# CONFIG_SLAB is not set 131# CONFIG_SLAB is not set
128# CONFIG_SLUB is not set 132# CONFIG_SLUB is not set
129CONFIG_SLOB=y 133CONFIG_SLOB=y
134# CONFIG_MMAP_ALLOW_UNINITIALIZED is not set
130CONFIG_PROFILING=y 135CONFIG_PROFILING=y
131CONFIG_TRACEPOINTS=y 136CONFIG_TRACEPOINTS=y
132CONFIG_OPROFILE=y 137CONFIG_OPROFILE=y
@@ -135,6 +140,7 @@ CONFIG_HAVE_OPROFILE=y
135CONFIG_HAVE_KPROBES=y 140CONFIG_HAVE_KPROBES=y
136CONFIG_HAVE_KRETPROBES=y 141CONFIG_HAVE_KRETPROBES=y
137CONFIG_HAVE_ARCH_TRACEHOOK=y 142CONFIG_HAVE_ARCH_TRACEHOOK=y
143CONFIG_HAVE_DMA_ATTRS=y
138CONFIG_HAVE_CLK=y 144CONFIG_HAVE_CLK=y
139CONFIG_HAVE_DMA_API_DEBUG=y 145CONFIG_HAVE_DMA_API_DEBUG=y
140 146
@@ -156,19 +162,47 @@ CONFIG_BLOCK=y
156CONFIG_LBDAF=y 162CONFIG_LBDAF=y
157# CONFIG_BLK_DEV_BSG is not set 163# CONFIG_BLK_DEV_BSG is not set
158# CONFIG_BLK_DEV_INTEGRITY is not set 164# CONFIG_BLK_DEV_INTEGRITY is not set
165# CONFIG_BLK_CGROUP is not set
159 166
160# 167#
161# IO Schedulers 168# IO Schedulers
162# 169#
163CONFIG_IOSCHED_NOOP=y 170CONFIG_IOSCHED_NOOP=y
164# CONFIG_IOSCHED_AS is not set
165# CONFIG_IOSCHED_DEADLINE is not set 171# CONFIG_IOSCHED_DEADLINE is not set
166# CONFIG_IOSCHED_CFQ is not set 172# CONFIG_IOSCHED_CFQ is not set
167# CONFIG_DEFAULT_AS is not set
168# CONFIG_DEFAULT_DEADLINE is not set 173# CONFIG_DEFAULT_DEADLINE is not set
169# CONFIG_DEFAULT_CFQ is not set 174# CONFIG_DEFAULT_CFQ is not set
170CONFIG_DEFAULT_NOOP=y 175CONFIG_DEFAULT_NOOP=y
171CONFIG_DEFAULT_IOSCHED="noop" 176CONFIG_DEFAULT_IOSCHED="noop"
177# CONFIG_INLINE_SPIN_TRYLOCK is not set
178# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
179# CONFIG_INLINE_SPIN_LOCK is not set
180# CONFIG_INLINE_SPIN_LOCK_BH is not set
181# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
182# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
183# CONFIG_INLINE_SPIN_UNLOCK is not set
184# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
185# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
186# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
187# CONFIG_INLINE_READ_TRYLOCK is not set
188# CONFIG_INLINE_READ_LOCK is not set
189# CONFIG_INLINE_READ_LOCK_BH is not set
190# CONFIG_INLINE_READ_LOCK_IRQ is not set
191# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
192# CONFIG_INLINE_READ_UNLOCK is not set
193# CONFIG_INLINE_READ_UNLOCK_BH is not set
194# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
195# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
196# CONFIG_INLINE_WRITE_TRYLOCK is not set
197# CONFIG_INLINE_WRITE_LOCK is not set
198# CONFIG_INLINE_WRITE_LOCK_BH is not set
199# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
200# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
201# CONFIG_INLINE_WRITE_UNLOCK is not set
202# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
203# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
204# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
205# CONFIG_MUTEX_SPIN_ON_OWNER is not set
172# CONFIG_FREEZER is not set 206# CONFIG_FREEZER is not set
173 207
174# 208#
@@ -243,7 +277,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
243# CONFIG_PHYS_ADDR_T_64BIT is not set 277# CONFIG_PHYS_ADDR_T_64BIT is not set
244CONFIG_ZONE_DMA_FLAG=0 278CONFIG_ZONE_DMA_FLAG=0
245CONFIG_NR_QUICK=2 279CONFIG_NR_QUICK=2
246CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
247CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 280CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1
248 281
249# 282#
@@ -438,9 +471,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
438# CONFIG_AF_RXRPC is not set 471# CONFIG_AF_RXRPC is not set
439CONFIG_WIRELESS=y 472CONFIG_WIRELESS=y
440# CONFIG_CFG80211 is not set 473# CONFIG_CFG80211 is not set
441CONFIG_CFG80211_DEFAULT_PS_VALUE=0
442# CONFIG_WIRELESS_OLD_REGULATORY is not set
443# CONFIG_WIRELESS_EXT is not set
444# CONFIG_LIB80211 is not set 474# CONFIG_LIB80211 is not set
445 475
446# 476#
@@ -551,6 +581,10 @@ CONFIG_BLK_DEV=y
551# CONFIG_BLK_DEV_COW_COMMON is not set 581# CONFIG_BLK_DEV_COW_COMMON is not set
552CONFIG_BLK_DEV_LOOP=y 582CONFIG_BLK_DEV_LOOP=y
553# CONFIG_BLK_DEV_CRYPTOLOOP is not set 583# CONFIG_BLK_DEV_CRYPTOLOOP is not set
584
585#
586# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
587#
554# CONFIG_BLK_DEV_NBD is not set 588# CONFIG_BLK_DEV_NBD is not set
555CONFIG_BLK_DEV_RAM=y 589CONFIG_BLK_DEV_RAM=y
556CONFIG_BLK_DEV_RAM_COUNT=16 590CONFIG_BLK_DEV_RAM_COUNT=16
@@ -605,11 +639,11 @@ CONFIG_SMC91X=y
605# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 639# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
606# CONFIG_B44 is not set 640# CONFIG_B44 is not set
607# CONFIG_KS8842 is not set 641# CONFIG_KS8842 is not set
642# CONFIG_KS8851_MLL is not set
608# CONFIG_NETDEV_1000 is not set 643# CONFIG_NETDEV_1000 is not set
609# CONFIG_NETDEV_10000 is not set 644# CONFIG_NETDEV_10000 is not set
610CONFIG_WLAN=y 645CONFIG_WLAN=y
611# CONFIG_WLAN_PRE80211 is not set 646# CONFIG_HOSTAP is not set
612# CONFIG_WLAN_80211 is not set
613 647
614# 648#
615# Enable WiMAX (Networking options) to see the WiMAX drivers 649# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -685,6 +719,7 @@ CONFIG_SSB_POSSIBLE=y
685# 719#
686# CONFIG_MFD_CORE is not set 720# CONFIG_MFD_CORE is not set
687# CONFIG_MFD_SM501 is not set 721# CONFIG_MFD_SM501 is not set
722# CONFIG_MFD_SH_MOBILE_SDHI is not set
688# CONFIG_HTC_PASIC3 is not set 723# CONFIG_HTC_PASIC3 is not set
689# CONFIG_MFD_TMIO is not set 724# CONFIG_MFD_TMIO is not set
690# CONFIG_REGULATOR is not set 725# CONFIG_REGULATOR is not set
@@ -738,7 +773,9 @@ CONFIG_RTC_INTF_DEV=y
738# CONFIG_RTC_DRV_M48T86 is not set 773# CONFIG_RTC_DRV_M48T86 is not set
739# CONFIG_RTC_DRV_M48T35 is not set 774# CONFIG_RTC_DRV_M48T35 is not set
740# CONFIG_RTC_DRV_M48T59 is not set 775# CONFIG_RTC_DRV_M48T59 is not set
776# CONFIG_RTC_DRV_MSM6242 is not set
741# CONFIG_RTC_DRV_BQ4802 is not set 777# CONFIG_RTC_DRV_BQ4802 is not set
778# CONFIG_RTC_DRV_RP5C01 is not set
742# CONFIG_RTC_DRV_V3020 is not set 779# CONFIG_RTC_DRV_V3020 is not set
743 780
744# 781#
@@ -762,6 +799,7 @@ CONFIG_EXT2_FS=y
762# CONFIG_EXT2_FS_XATTR is not set 799# CONFIG_EXT2_FS_XATTR is not set
763# CONFIG_EXT3_FS is not set 800# CONFIG_EXT3_FS is not set
764# CONFIG_EXT4_FS is not set 801# CONFIG_EXT4_FS is not set
802CONFIG_EXT4_USE_FOR_EXT23=y
765# CONFIG_REISERFS_FS is not set 803# CONFIG_REISERFS_FS is not set
766# CONFIG_JFS_FS is not set 804# CONFIG_JFS_FS is not set
767# CONFIG_FS_POSIX_ACL is not set 805# CONFIG_FS_POSIX_ACL is not set
@@ -911,6 +949,7 @@ CONFIG_FRAME_POINTER=y
911# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set 949# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
912# CONFIG_FAULT_INJECTION is not set 950# CONFIG_FAULT_INJECTION is not set
913# CONFIG_LATENCYTOP is not set 951# CONFIG_LATENCYTOP is not set
952# CONFIG_SYSCTL_SYSCALL_CHECK is not set
914# CONFIG_PAGE_POISONING is not set 953# CONFIG_PAGE_POISONING is not set
915CONFIG_NOP_TRACER=y 954CONFIG_NOP_TRACER=y
916CONFIG_HAVE_FUNCTION_TRACER=y 955CONFIG_HAVE_FUNCTION_TRACER=y
@@ -947,7 +986,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
947CONFIG_HAVE_ARCH_KGDB=y 986CONFIG_HAVE_ARCH_KGDB=y
948# CONFIG_KGDB is not set 987# CONFIG_KGDB is not set
949# CONFIG_SH_STANDARD_BIOS is not set 988# CONFIG_SH_STANDARD_BIOS is not set
950# CONFIG_EARLY_SCIF_CONSOLE is not set
951# CONFIG_STACK_DEBUG is not set 989# CONFIG_STACK_DEBUG is not set
952CONFIG_DEBUG_STACK_USAGE=y 990CONFIG_DEBUG_STACK_USAGE=y
953CONFIG_DUMP_CODE=y 991CONFIG_DUMP_CODE=y
@@ -960,7 +998,11 @@ CONFIG_DUMP_CODE=y
960# CONFIG_KEYS is not set 998# CONFIG_KEYS is not set
961# CONFIG_SECURITY is not set 999# CONFIG_SECURITY is not set
962# CONFIG_SECURITYFS is not set 1000# CONFIG_SECURITYFS is not set
963# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1001# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1002# CONFIG_DEFAULT_SECURITY_SMACK is not set
1003# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1004CONFIG_DEFAULT_SECURITY_DAC=y
1005CONFIG_DEFAULT_SECURITY=""
964CONFIG_CRYPTO=y 1006CONFIG_CRYPTO=y
965 1007
966# 1008#
diff --git a/arch/sh/configs/se7343_defconfig b/arch/sh/configs/se7343_defconfig
index 5531444b808c..ec494e32fa2e 100644
--- a/arch/sh/configs/se7343_defconfig
+++ b/arch/sh/configs/se7343_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:46:55 2009 4# Mon Jan 4 13:30:41 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -61,6 +63,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
61# 63#
62CONFIG_TREE_RCU=y 64CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
66# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 67# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 68CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 69# CONFIG_RCU_FANOUT_EXACT is not set
@@ -99,6 +102,7 @@ CONFIG_EVENTFD=y
99# CONFIG_SHMEM is not set 102# CONFIG_SHMEM is not set
100CONFIG_AIO=y 103CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y 104CONFIG_HAVE_PERF_EVENTS=y
105CONFIG_PERF_USE_VMALLOC=y
102 106
103# 107#
104# Kernel Performance Events And Counters 108# Kernel Performance Events And Counters
@@ -117,6 +121,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
117CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
120CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
121CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
122 127
@@ -126,6 +131,7 @@ CONFIG_HAVE_DMA_API_DEBUG=y
126# CONFIG_SLOW_WORK is not set 131# CONFIG_SLOW_WORK is not set
127CONFIG_HAVE_GENERIC_DMA_COHERENT=y 132CONFIG_HAVE_GENERIC_DMA_COHERENT=y
128CONFIG_SLABINFO=y 133CONFIG_SLABINFO=y
134CONFIG_RT_MUTEXES=y
129CONFIG_BASE_SMALL=0 135CONFIG_BASE_SMALL=0
130CONFIG_MODULES=y 136CONFIG_MODULES=y
131# CONFIG_MODULE_FORCE_LOAD is not set 137# CONFIG_MODULE_FORCE_LOAD is not set
@@ -142,14 +148,41 @@ CONFIG_LBDAF=y
142# IO Schedulers 148# IO Schedulers
143# 149#
144CONFIG_IOSCHED_NOOP=y 150CONFIG_IOSCHED_NOOP=y
145# CONFIG_IOSCHED_AS is not set
146CONFIG_IOSCHED_DEADLINE=y 151CONFIG_IOSCHED_DEADLINE=y
147# CONFIG_IOSCHED_CFQ is not set 152# CONFIG_IOSCHED_CFQ is not set
148# CONFIG_DEFAULT_AS is not set
149CONFIG_DEFAULT_DEADLINE=y 153CONFIG_DEFAULT_DEADLINE=y
150# CONFIG_DEFAULT_CFQ is not set 154# CONFIG_DEFAULT_CFQ is not set
151# CONFIG_DEFAULT_NOOP is not set 155# CONFIG_DEFAULT_NOOP is not set
152CONFIG_DEFAULT_IOSCHED="deadline" 156CONFIG_DEFAULT_IOSCHED="deadline"
157# CONFIG_INLINE_SPIN_TRYLOCK is not set
158# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK is not set
160# CONFIG_INLINE_SPIN_LOCK_BH is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
162# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
163CONFIG_INLINE_SPIN_UNLOCK=y
164# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
165CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
166# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
167# CONFIG_INLINE_READ_TRYLOCK is not set
168# CONFIG_INLINE_READ_LOCK is not set
169# CONFIG_INLINE_READ_LOCK_BH is not set
170# CONFIG_INLINE_READ_LOCK_IRQ is not set
171# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
172CONFIG_INLINE_READ_UNLOCK=y
173# CONFIG_INLINE_READ_UNLOCK_BH is not set
174CONFIG_INLINE_READ_UNLOCK_IRQ=y
175# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
176# CONFIG_INLINE_WRITE_TRYLOCK is not set
177# CONFIG_INLINE_WRITE_LOCK is not set
178# CONFIG_INLINE_WRITE_LOCK_BH is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
180# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
181CONFIG_INLINE_WRITE_UNLOCK=y
182# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
183CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
184# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
185# CONFIG_MUTEX_SPIN_ON_OWNER is not set
153CONFIG_FREEZER=y 186CONFIG_FREEZER=y
154 187
155# 188#
@@ -228,8 +261,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
228# CONFIG_PHYS_ADDR_T_64BIT is not set 261# CONFIG_PHYS_ADDR_T_64BIT is not set
229CONFIG_ZONE_DMA_FLAG=0 262CONFIG_ZONE_DMA_FLAG=0
230CONFIG_NR_QUICK=2 263CONFIG_NR_QUICK=2
231CONFIG_HAVE_MLOCK=y
232CONFIG_HAVE_MLOCKED_PAGE_BIT=y
233# CONFIG_KSM is not set 264# CONFIG_KSM is not set
234CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 265CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
235 266
@@ -263,7 +294,6 @@ CONFIG_SH_7343_SOLUTION_ENGINE=y
263# 294#
264CONFIG_SH_TIMER_TMU=y 295CONFIG_SH_TIMER_TMU=y
265# CONFIG_SH_TIMER_CMT is not set 296# CONFIG_SH_TIMER_CMT is not set
266CONFIG_SH_PCLK_FREQ=33333333
267CONFIG_SH_CLK_CPG=y 297CONFIG_SH_CLK_CPG=y
268# CONFIG_NO_HZ is not set 298# CONFIG_NO_HZ is not set
269# CONFIG_HIGH_RES_TIMERS is not set 299# CONFIG_HIGH_RES_TIMERS is not set
@@ -413,9 +443,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
413# CONFIG_AF_RXRPC is not set 443# CONFIG_AF_RXRPC is not set
414CONFIG_WIRELESS=y 444CONFIG_WIRELESS=y
415# CONFIG_CFG80211 is not set 445# CONFIG_CFG80211 is not set
416CONFIG_CFG80211_DEFAULT_PS_VALUE=0
417# CONFIG_WIRELESS_OLD_REGULATORY is not set
418# CONFIG_WIRELESS_EXT is not set
419# CONFIG_LIB80211 is not set 446# CONFIG_LIB80211 is not set
420 447
421# 448#
@@ -525,6 +552,10 @@ CONFIG_MTD_PHYSMAP=y
525CONFIG_BLK_DEV=y 552CONFIG_BLK_DEV=y
526# CONFIG_BLK_DEV_COW_COMMON is not set 553# CONFIG_BLK_DEV_COW_COMMON is not set
527# CONFIG_BLK_DEV_LOOP is not set 554# CONFIG_BLK_DEV_LOOP is not set
555
556#
557# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
558#
528# CONFIG_BLK_DEV_NBD is not set 559# CONFIG_BLK_DEV_NBD is not set
529# CONFIG_BLK_DEV_UB is not set 560# CONFIG_BLK_DEV_UB is not set
530# CONFIG_BLK_DEV_RAM is not set 561# CONFIG_BLK_DEV_RAM is not set
@@ -585,8 +616,8 @@ CONFIG_MII=y
585# CONFIG_NETDEV_1000 is not set 616# CONFIG_NETDEV_1000 is not set
586# CONFIG_NETDEV_10000 is not set 617# CONFIG_NETDEV_10000 is not set
587CONFIG_WLAN=y 618CONFIG_WLAN=y
588# CONFIG_WLAN_PRE80211 is not set 619# CONFIG_USB_ZD1201 is not set
589# CONFIG_WLAN_80211 is not set 620# CONFIG_HOSTAP is not set
590 621
591# 622#
592# Enable WiMAX (Networking options) to see the WiMAX drivers 623# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -628,6 +659,7 @@ CONFIG_USB_NET_DM9601=y
628CONFIG_INPUT=y 659CONFIG_INPUT=y
629# CONFIG_INPUT_FF_MEMLESS is not set 660# CONFIG_INPUT_FF_MEMLESS is not set
630# CONFIG_INPUT_POLLDEV is not set 661# CONFIG_INPUT_POLLDEV is not set
662# CONFIG_INPUT_SPARSEKMAP is not set
631 663
632# 664#
633# Userland interfaces 665# Userland interfaces
@@ -724,7 +756,6 @@ CONFIG_I2C_SH_MOBILE=y
724# 756#
725# Miscellaneous I2C Chip support 757# Miscellaneous I2C Chip support
726# 758#
727# CONFIG_DS1682 is not set
728# CONFIG_SENSORS_TSL2550 is not set 759# CONFIG_SENSORS_TSL2550 is not set
729# CONFIG_I2C_DEBUG_CORE is not set 760# CONFIG_I2C_DEBUG_CORE is not set
730# CONFIG_I2C_DEBUG_ALGO is not set 761# CONFIG_I2C_DEBUG_ALGO is not set
@@ -753,15 +784,18 @@ CONFIG_SSB_POSSIBLE=y
753# 784#
754# CONFIG_MFD_CORE is not set 785# CONFIG_MFD_CORE is not set
755# CONFIG_MFD_SM501 is not set 786# CONFIG_MFD_SM501 is not set
787# CONFIG_MFD_SH_MOBILE_SDHI is not set
756# CONFIG_HTC_PASIC3 is not set 788# CONFIG_HTC_PASIC3 is not set
757# CONFIG_TWL4030_CORE is not set 789# CONFIG_TWL4030_CORE is not set
758# CONFIG_MFD_TMIO is not set 790# CONFIG_MFD_TMIO is not set
759# CONFIG_PMIC_DA903X is not set 791# CONFIG_PMIC_DA903X is not set
792# CONFIG_PMIC_ADP5520 is not set
760# CONFIG_MFD_WM8400 is not set 793# CONFIG_MFD_WM8400 is not set
761# CONFIG_MFD_WM831X is not set 794# CONFIG_MFD_WM831X is not set
762# CONFIG_MFD_WM8350_I2C is not set 795# CONFIG_MFD_WM8350_I2C is not set
763# CONFIG_MFD_PCF50633 is not set 796# CONFIG_MFD_PCF50633 is not set
764# CONFIG_AB3100_CORE is not set 797# CONFIG_AB3100_CORE is not set
798# CONFIG_MFD_88PM8607 is not set
765# CONFIG_REGULATOR is not set 799# CONFIG_REGULATOR is not set
766# CONFIG_MEDIA_SUPPORT is not set 800# CONFIG_MEDIA_SUPPORT is not set
767 801
@@ -1173,10 +1207,11 @@ CONFIG_FRAME_WARN=1024
1173# CONFIG_DEBUG_FS is not set 1207# CONFIG_DEBUG_FS is not set
1174# CONFIG_HEADERS_CHECK is not set 1208# CONFIG_HEADERS_CHECK is not set
1175# CONFIG_DEBUG_KERNEL is not set 1209# CONFIG_DEBUG_KERNEL is not set
1176# CONFIG_DEBUG_BUGVERBOSE is not set 1210CONFIG_DEBUG_BUGVERBOSE=y
1177# CONFIG_DEBUG_MEMORY_INIT is not set 1211# CONFIG_DEBUG_MEMORY_INIT is not set
1178# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1212# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1179# CONFIG_LATENCYTOP is not set 1213# CONFIG_LATENCYTOP is not set
1214# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1180CONFIG_HAVE_FUNCTION_TRACER=y 1215CONFIG_HAVE_FUNCTION_TRACER=y
1181CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1216CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1182CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 1217CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -1189,9 +1224,6 @@ CONFIG_TRACING_SUPPORT=y
1189# CONFIG_SAMPLES is not set 1224# CONFIG_SAMPLES is not set
1190CONFIG_HAVE_ARCH_KGDB=y 1225CONFIG_HAVE_ARCH_KGDB=y
1191# CONFIG_SH_STANDARD_BIOS is not set 1226# CONFIG_SH_STANDARD_BIOS is not set
1192CONFIG_EARLY_SCIF_CONSOLE=y
1193CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe00000
1194CONFIG_EARLY_PRINTK=y
1195# CONFIG_DWARF_UNWINDER is not set 1227# CONFIG_DWARF_UNWINDER is not set
1196 1228
1197# 1229#
@@ -1200,7 +1232,11 @@ CONFIG_EARLY_PRINTK=y
1200# CONFIG_KEYS is not set 1232# CONFIG_KEYS is not set
1201# CONFIG_SECURITY is not set 1233# CONFIG_SECURITY is not set
1202# CONFIG_SECURITYFS is not set 1234# CONFIG_SECURITYFS is not set
1203# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1235# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1236# CONFIG_DEFAULT_SECURITY_SMACK is not set
1237# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1238CONFIG_DEFAULT_SECURITY_DAC=y
1239CONFIG_DEFAULT_SECURITY=""
1204CONFIG_CRYPTO=y 1240CONFIG_CRYPTO=y
1205 1241
1206# 1242#
diff --git a/arch/sh/configs/se7619_defconfig b/arch/sh/configs/se7619_defconfig
index 6921b199b1d6..ee87e2b2168f 100644
--- a/arch/sh/configs/se7619_defconfig
+++ b/arch/sh/configs/se7619_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:50:05 2009 4# Mon Jan 4 13:34:15 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -29,6 +29,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 29CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 30CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
32CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 34CONFIG_CONSTRUCTORS=y
34 35
@@ -54,6 +55,7 @@ CONFIG_KERNEL_GZIP=y
54# 55#
55CONFIG_TREE_RCU=y 56CONFIG_TREE_RCU=y
56# CONFIG_TREE_PREEMPT_RCU is not set 57# CONFIG_TREE_PREEMPT_RCU is not set
58# CONFIG_TINY_RCU is not set
57# CONFIG_RCU_TRACE is not set 59# CONFIG_RCU_TRACE is not set
58CONFIG_RCU_FANOUT=32 60CONFIG_RCU_FANOUT=32
59# CONFIG_RCU_FANOUT_EXACT is not set 61# CONFIG_RCU_FANOUT_EXACT is not set
@@ -84,6 +86,7 @@ CONFIG_TIMERFD=y
84CONFIG_EVENTFD=y 86CONFIG_EVENTFD=y
85CONFIG_AIO=y 87CONFIG_AIO=y
86CONFIG_HAVE_PERF_EVENTS=y 88CONFIG_HAVE_PERF_EVENTS=y
89CONFIG_PERF_USE_VMALLOC=y
87 90
88# 91#
89# Kernel Performance Events And Counters 92# Kernel Performance Events And Counters
@@ -95,11 +98,13 @@ CONFIG_COMPAT_BRK=y
95CONFIG_SLAB=y 98CONFIG_SLAB=y
96# CONFIG_SLUB is not set 99# CONFIG_SLUB is not set
97# CONFIG_SLOB is not set 100# CONFIG_SLOB is not set
101# CONFIG_MMAP_ALLOW_UNINITIALIZED is not set
98# CONFIG_PROFILING is not set 102# CONFIG_PROFILING is not set
99CONFIG_HAVE_OPROFILE=y 103CONFIG_HAVE_OPROFILE=y
100CONFIG_HAVE_KPROBES=y 104CONFIG_HAVE_KPROBES=y
101CONFIG_HAVE_KRETPROBES=y 105CONFIG_HAVE_KRETPROBES=y
102CONFIG_HAVE_ARCH_TRACEHOOK=y 106CONFIG_HAVE_ARCH_TRACEHOOK=y
107CONFIG_HAVE_DMA_ATTRS=y
103CONFIG_HAVE_CLK=y 108CONFIG_HAVE_CLK=y
104CONFIG_HAVE_DMA_API_DEBUG=y 109CONFIG_HAVE_DMA_API_DEBUG=y
105 110
@@ -120,14 +125,41 @@ CONFIG_LBDAF=y
120# IO Schedulers 125# IO Schedulers
121# 126#
122CONFIG_IOSCHED_NOOP=y 127CONFIG_IOSCHED_NOOP=y
123# CONFIG_IOSCHED_AS is not set
124# CONFIG_IOSCHED_DEADLINE is not set 128# CONFIG_IOSCHED_DEADLINE is not set
125# CONFIG_IOSCHED_CFQ is not set 129# CONFIG_IOSCHED_CFQ is not set
126# CONFIG_DEFAULT_AS is not set
127# CONFIG_DEFAULT_DEADLINE is not set 130# CONFIG_DEFAULT_DEADLINE is not set
128# CONFIG_DEFAULT_CFQ is not set 131# CONFIG_DEFAULT_CFQ is not set
129CONFIG_DEFAULT_NOOP=y 132CONFIG_DEFAULT_NOOP=y
130CONFIG_DEFAULT_IOSCHED="noop" 133CONFIG_DEFAULT_IOSCHED="noop"
134# CONFIG_INLINE_SPIN_TRYLOCK is not set
135# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
136# CONFIG_INLINE_SPIN_LOCK is not set
137# CONFIG_INLINE_SPIN_LOCK_BH is not set
138# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
139# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
140CONFIG_INLINE_SPIN_UNLOCK=y
141# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
142CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
143# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
144# CONFIG_INLINE_READ_TRYLOCK is not set
145# CONFIG_INLINE_READ_LOCK is not set
146# CONFIG_INLINE_READ_LOCK_BH is not set
147# CONFIG_INLINE_READ_LOCK_IRQ is not set
148# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
149CONFIG_INLINE_READ_UNLOCK=y
150# CONFIG_INLINE_READ_UNLOCK_BH is not set
151CONFIG_INLINE_READ_UNLOCK_IRQ=y
152# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
153# CONFIG_INLINE_WRITE_TRYLOCK is not set
154# CONFIG_INLINE_WRITE_LOCK is not set
155# CONFIG_INLINE_WRITE_LOCK_BH is not set
156# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
157# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
158CONFIG_INLINE_WRITE_UNLOCK=y
159# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
160CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
161# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
162# CONFIG_MUTEX_SPIN_ON_OWNER is not set
131# CONFIG_FREEZER is not set 163# CONFIG_FREEZER is not set
132 164
133# 165#
@@ -201,7 +233,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
201# CONFIG_PHYS_ADDR_T_64BIT is not set 233# CONFIG_PHYS_ADDR_T_64BIT is not set
202CONFIG_ZONE_DMA_FLAG=0 234CONFIG_ZONE_DMA_FLAG=0
203CONFIG_NR_QUICK=2 235CONFIG_NR_QUICK=2
204CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
205CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 236CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1
206 237
207# 238#
@@ -401,6 +432,10 @@ CONFIG_MTD_PHYSMAP=y
401CONFIG_BLK_DEV=y 432CONFIG_BLK_DEV=y
402# CONFIG_BLK_DEV_COW_COMMON is not set 433# CONFIG_BLK_DEV_COW_COMMON is not set
403# CONFIG_BLK_DEV_LOOP is not set 434# CONFIG_BLK_DEV_LOOP is not set
435
436#
437# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
438#
404# CONFIG_BLK_DEV_RAM is not set 439# CONFIG_BLK_DEV_RAM is not set
405# CONFIG_CDROM_PKTCDVD is not set 440# CONFIG_CDROM_PKTCDVD is not set
406# CONFIG_BLK_DEV_HD is not set 441# CONFIG_BLK_DEV_HD is not set
@@ -432,6 +467,7 @@ CONFIG_HAVE_IDE=y
432CONFIG_INPUT=y 467CONFIG_INPUT=y
433# CONFIG_INPUT_FF_MEMLESS is not set 468# CONFIG_INPUT_FF_MEMLESS is not set
434# CONFIG_INPUT_POLLDEV is not set 469# CONFIG_INPUT_POLLDEV is not set
470# CONFIG_INPUT_SPARSEKMAP is not set
435 471
436# 472#
437# Userland interfaces 473# Userland interfaces
@@ -508,6 +544,7 @@ CONFIG_SSB_POSSIBLE=y
508# 544#
509# CONFIG_MFD_CORE is not set 545# CONFIG_MFD_CORE is not set
510# CONFIG_MFD_SM501 is not set 546# CONFIG_MFD_SM501 is not set
547# CONFIG_MFD_SH_MOBILE_SDHI is not set
511# CONFIG_HTC_PASIC3 is not set 548# CONFIG_HTC_PASIC3 is not set
512# CONFIG_MFD_TMIO is not set 549# CONFIG_MFD_TMIO is not set
513# CONFIG_REGULATOR is not set 550# CONFIG_REGULATOR is not set
@@ -575,6 +612,7 @@ CONFIG_RTC_LIB=y
575# CONFIG_EXT2_FS is not set 612# CONFIG_EXT2_FS is not set
576# CONFIG_EXT3_FS is not set 613# CONFIG_EXT3_FS is not set
577# CONFIG_EXT4_FS is not set 614# CONFIG_EXT4_FS is not set
615CONFIG_EXT4_USE_FOR_EXT23=y
578# CONFIG_REISERFS_FS is not set 616# CONFIG_REISERFS_FS is not set
579# CONFIG_JFS_FS is not set 617# CONFIG_JFS_FS is not set
580# CONFIG_FS_POSIX_ACL is not set 618# CONFIG_FS_POSIX_ACL is not set
@@ -661,10 +699,11 @@ CONFIG_FRAME_WARN=1024
661# CONFIG_UNUSED_SYMBOLS is not set 699# CONFIG_UNUSED_SYMBOLS is not set
662# CONFIG_HEADERS_CHECK is not set 700# CONFIG_HEADERS_CHECK is not set
663# CONFIG_DEBUG_KERNEL is not set 701# CONFIG_DEBUG_KERNEL is not set
664# CONFIG_DEBUG_BUGVERBOSE is not set 702CONFIG_DEBUG_BUGVERBOSE=y
665# CONFIG_DEBUG_MEMORY_INIT is not set 703# CONFIG_DEBUG_MEMORY_INIT is not set
666# CONFIG_RCU_CPU_STALL_DETECTOR is not set 704# CONFIG_RCU_CPU_STALL_DETECTOR is not set
667# CONFIG_LATENCYTOP is not set 705# CONFIG_LATENCYTOP is not set
706# CONFIG_SYSCTL_SYSCALL_CHECK is not set
668CONFIG_HAVE_FUNCTION_TRACER=y 707CONFIG_HAVE_FUNCTION_TRACER=y
669CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 708CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
670CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 709CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -677,7 +716,6 @@ CONFIG_TRACING_SUPPORT=y
677# CONFIG_SAMPLES is not set 716# CONFIG_SAMPLES is not set
678CONFIG_HAVE_ARCH_KGDB=y 717CONFIG_HAVE_ARCH_KGDB=y
679# CONFIG_SH_STANDARD_BIOS is not set 718# CONFIG_SH_STANDARD_BIOS is not set
680# CONFIG_EARLY_SCIF_CONSOLE is not set
681# CONFIG_DWARF_UNWINDER is not set 719# CONFIG_DWARF_UNWINDER is not set
682 720
683# 721#
@@ -685,7 +723,11 @@ CONFIG_HAVE_ARCH_KGDB=y
685# 723#
686# CONFIG_KEYS is not set 724# CONFIG_KEYS is not set
687# CONFIG_SECURITYFS is not set 725# CONFIG_SECURITYFS is not set
688# CONFIG_SECURITY_FILE_CAPABILITIES is not set 726# CONFIG_DEFAULT_SECURITY_SELINUX is not set
727# CONFIG_DEFAULT_SECURITY_SMACK is not set
728# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
729CONFIG_DEFAULT_SECURITY_DAC=y
730CONFIG_DEFAULT_SECURITY=""
689# CONFIG_CRYPTO is not set 731# CONFIG_CRYPTO is not set
690# CONFIG_BINARY_PRINTF is not set 732# CONFIG_BINARY_PRINTF is not set
691 733
diff --git a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
index 3abb06879f02..03f4219f2086 100644
--- a/arch/sh/configs/se7705_defconfig
+++ b/arch/sh/configs/se7705_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:50:52 2009 4# Mon Jan 4 13:34:37 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -29,6 +29,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 29CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 30CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
32CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 34CONFIG_CONSTRUCTORS=y
34 35
@@ -59,6 +60,7 @@ CONFIG_KERNEL_GZIP=y
59# 60#
60CONFIG_TREE_RCU=y 61CONFIG_TREE_RCU=y
61# CONFIG_TREE_PREEMPT_RCU is not set 62# CONFIG_TREE_PREEMPT_RCU is not set
63# CONFIG_TINY_RCU is not set
62# CONFIG_RCU_TRACE is not set 64# CONFIG_RCU_TRACE is not set
63CONFIG_RCU_FANOUT=32 65CONFIG_RCU_FANOUT=32
64# CONFIG_RCU_FANOUT_EXACT is not set 66# CONFIG_RCU_FANOUT_EXACT is not set
@@ -94,6 +96,7 @@ CONFIG_EVENTFD=y
94CONFIG_SHMEM=y 96CONFIG_SHMEM=y
95CONFIG_AIO=y 97CONFIG_AIO=y
96CONFIG_HAVE_PERF_EVENTS=y 98CONFIG_HAVE_PERF_EVENTS=y
99CONFIG_PERF_USE_VMALLOC=y
97 100
98# 101#
99# Kernel Performance Events And Counters 102# Kernel Performance Events And Counters
@@ -111,6 +114,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
111CONFIG_HAVE_KPROBES=y 114CONFIG_HAVE_KPROBES=y
112CONFIG_HAVE_KRETPROBES=y 115CONFIG_HAVE_KRETPROBES=y
113CONFIG_HAVE_ARCH_TRACEHOOK=y 116CONFIG_HAVE_ARCH_TRACEHOOK=y
117CONFIG_HAVE_DMA_ATTRS=y
114CONFIG_HAVE_CLK=y 118CONFIG_HAVE_CLK=y
115CONFIG_HAVE_DMA_API_DEBUG=y 119CONFIG_HAVE_DMA_API_DEBUG=y
116 120
@@ -136,14 +140,41 @@ CONFIG_LBDAF=y
136# IO Schedulers 140# IO Schedulers
137# 141#
138CONFIG_IOSCHED_NOOP=y 142CONFIG_IOSCHED_NOOP=y
139CONFIG_IOSCHED_AS=y
140# CONFIG_IOSCHED_DEADLINE is not set 143# CONFIG_IOSCHED_DEADLINE is not set
141# CONFIG_IOSCHED_CFQ is not set 144# CONFIG_IOSCHED_CFQ is not set
142CONFIG_DEFAULT_AS=y
143# CONFIG_DEFAULT_DEADLINE is not set 145# CONFIG_DEFAULT_DEADLINE is not set
144# CONFIG_DEFAULT_CFQ is not set 146# CONFIG_DEFAULT_CFQ is not set
145# CONFIG_DEFAULT_NOOP is not set 147CONFIG_DEFAULT_NOOP=y
146CONFIG_DEFAULT_IOSCHED="anticipatory" 148CONFIG_DEFAULT_IOSCHED="noop"
149# CONFIG_INLINE_SPIN_TRYLOCK is not set
150# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
151# CONFIG_INLINE_SPIN_LOCK is not set
152# CONFIG_INLINE_SPIN_LOCK_BH is not set
153# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
154# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
155# CONFIG_INLINE_SPIN_UNLOCK is not set
156# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
157# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
158# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
159# CONFIG_INLINE_READ_TRYLOCK is not set
160# CONFIG_INLINE_READ_LOCK is not set
161# CONFIG_INLINE_READ_LOCK_BH is not set
162# CONFIG_INLINE_READ_LOCK_IRQ is not set
163# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
164# CONFIG_INLINE_READ_UNLOCK is not set
165# CONFIG_INLINE_READ_UNLOCK_BH is not set
166# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
167# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
168# CONFIG_INLINE_WRITE_TRYLOCK is not set
169# CONFIG_INLINE_WRITE_LOCK is not set
170# CONFIG_INLINE_WRITE_LOCK_BH is not set
171# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
172# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
173# CONFIG_INLINE_WRITE_UNLOCK is not set
174# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
175# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
176# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
177# CONFIG_MUTEX_SPIN_ON_OWNER is not set
147# CONFIG_FREEZER is not set 178# CONFIG_FREEZER is not set
148 179
149# 180#
@@ -219,8 +250,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
219# CONFIG_PHYS_ADDR_T_64BIT is not set 250# CONFIG_PHYS_ADDR_T_64BIT is not set
220CONFIG_ZONE_DMA_FLAG=0 251CONFIG_ZONE_DMA_FLAG=0
221CONFIG_NR_QUICK=2 252CONFIG_NR_QUICK=2
222CONFIG_HAVE_MLOCK=y
223CONFIG_HAVE_MLOCKED_PAGE_BIT=y
224# CONFIG_KSM is not set 253# CONFIG_KSM is not set
225CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 254CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
226 255
@@ -403,9 +432,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
403# CONFIG_AF_RXRPC is not set 432# CONFIG_AF_RXRPC is not set
404CONFIG_WIRELESS=y 433CONFIG_WIRELESS=y
405# CONFIG_CFG80211 is not set 434# CONFIG_CFG80211 is not set
406CONFIG_CFG80211_DEFAULT_PS_VALUE=0
407# CONFIG_WIRELESS_OLD_REGULATORY is not set
408# CONFIG_WIRELESS_EXT is not set
409# CONFIG_LIB80211 is not set 435# CONFIG_LIB80211 is not set
410 436
411# 437#
@@ -510,6 +536,10 @@ CONFIG_MTD_CFI_UTIL=y
510CONFIG_BLK_DEV=y 536CONFIG_BLK_DEV=y
511# CONFIG_BLK_DEV_COW_COMMON is not set 537# CONFIG_BLK_DEV_COW_COMMON is not set
512# CONFIG_BLK_DEV_LOOP is not set 538# CONFIG_BLK_DEV_LOOP is not set
539
540#
541# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
542#
513# CONFIG_BLK_DEV_NBD is not set 543# CONFIG_BLK_DEV_NBD is not set
514CONFIG_BLK_DEV_RAM=y 544CONFIG_BLK_DEV_RAM=y
515CONFIG_BLK_DEV_RAM_COUNT=16 545CONFIG_BLK_DEV_RAM_COUNT=16
@@ -564,11 +594,11 @@ CONFIG_STNIC=y
564# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 594# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
565# CONFIG_B44 is not set 595# CONFIG_B44 is not set
566# CONFIG_KS8842 is not set 596# CONFIG_KS8842 is not set
597# CONFIG_KS8851_MLL is not set
567CONFIG_NETDEV_1000=y 598CONFIG_NETDEV_1000=y
568CONFIG_NETDEV_10000=y 599CONFIG_NETDEV_10000=y
569CONFIG_WLAN=y 600CONFIG_WLAN=y
570# CONFIG_WLAN_PRE80211 is not set 601# CONFIG_HOSTAP is not set
571# CONFIG_WLAN_80211 is not set
572 602
573# 603#
574# Enable WiMAX (Networking options) to see the WiMAX drivers 604# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -598,6 +628,7 @@ CONFIG_SLHC=y
598CONFIG_INPUT=y 628CONFIG_INPUT=y
599# CONFIG_INPUT_FF_MEMLESS is not set 629# CONFIG_INPUT_FF_MEMLESS is not set
600# CONFIG_INPUT_POLLDEV is not set 630# CONFIG_INPUT_POLLDEV is not set
631# CONFIG_INPUT_SPARSEKMAP is not set
601 632
602# 633#
603# Userland interfaces 634# Userland interfaces
@@ -625,6 +656,7 @@ CONFIG_SERIO=y
625# CONFIG_SERIO_SERPORT is not set 656# CONFIG_SERIO_SERPORT is not set
626# CONFIG_SERIO_LIBPS2 is not set 657# CONFIG_SERIO_LIBPS2 is not set
627# CONFIG_SERIO_RAW is not set 658# CONFIG_SERIO_RAW is not set
659# CONFIG_SERIO_ALTERA_PS2 is not set
628# CONFIG_GAMEPORT is not set 660# CONFIG_GAMEPORT is not set
629 661
630# 662#
@@ -696,6 +728,7 @@ CONFIG_SSB_POSSIBLE=y
696# 728#
697# CONFIG_MFD_CORE is not set 729# CONFIG_MFD_CORE is not set
698# CONFIG_MFD_SM501 is not set 730# CONFIG_MFD_SM501 is not set
731# CONFIG_MFD_SH_MOBILE_SDHI is not set
699# CONFIG_HTC_PASIC3 is not set 732# CONFIG_HTC_PASIC3 is not set
700# CONFIG_MFD_TMIO is not set 733# CONFIG_MFD_TMIO is not set
701# CONFIG_REGULATOR is not set 734# CONFIG_REGULATOR is not set
@@ -765,6 +798,7 @@ CONFIG_EXT2_FS=y
765# CONFIG_EXT2_FS_XIP is not set 798# CONFIG_EXT2_FS_XIP is not set
766# CONFIG_EXT3_FS is not set 799# CONFIG_EXT3_FS is not set
767# CONFIG_EXT4_FS is not set 800# CONFIG_EXT4_FS is not set
801CONFIG_EXT4_USE_FOR_EXT23=y
768# CONFIG_REISERFS_FS is not set 802# CONFIG_REISERFS_FS is not set
769# CONFIG_JFS_FS is not set 803# CONFIG_JFS_FS is not set
770# CONFIG_FS_POSIX_ACL is not set 804# CONFIG_FS_POSIX_ACL is not set
@@ -809,7 +843,6 @@ CONFIG_PROC_SYSCTL=y
809CONFIG_PROC_PAGE_MONITOR=y 843CONFIG_PROC_PAGE_MONITOR=y
810# CONFIG_SYSFS is not set 844# CONFIG_SYSFS is not set
811# CONFIG_TMPFS is not set 845# CONFIG_TMPFS is not set
812# CONFIG_HUGETLBFS is not set
813# CONFIG_HUGETLB_PAGE is not set 846# CONFIG_HUGETLB_PAGE is not set
814CONFIG_MISC_FILESYSTEMS=y 847CONFIG_MISC_FILESYSTEMS=y
815# CONFIG_ADFS_FS is not set 848# CONFIG_ADFS_FS is not set
@@ -877,10 +910,11 @@ CONFIG_FRAME_WARN=1024
877# CONFIG_UNUSED_SYMBOLS is not set 910# CONFIG_UNUSED_SYMBOLS is not set
878# CONFIG_HEADERS_CHECK is not set 911# CONFIG_HEADERS_CHECK is not set
879# CONFIG_DEBUG_KERNEL is not set 912# CONFIG_DEBUG_KERNEL is not set
880# CONFIG_DEBUG_BUGVERBOSE is not set 913CONFIG_DEBUG_BUGVERBOSE=y
881# CONFIG_DEBUG_MEMORY_INIT is not set 914# CONFIG_DEBUG_MEMORY_INIT is not set
882# CONFIG_RCU_CPU_STALL_DETECTOR is not set 915# CONFIG_RCU_CPU_STALL_DETECTOR is not set
883# CONFIG_LATENCYTOP is not set 916# CONFIG_LATENCYTOP is not set
917# CONFIG_SYSCTL_SYSCALL_CHECK is not set
884CONFIG_HAVE_FUNCTION_TRACER=y 918CONFIG_HAVE_FUNCTION_TRACER=y
885CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 919CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
886CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 920CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -893,7 +927,6 @@ CONFIG_TRACING_SUPPORT=y
893# CONFIG_SAMPLES is not set 927# CONFIG_SAMPLES is not set
894CONFIG_HAVE_ARCH_KGDB=y 928CONFIG_HAVE_ARCH_KGDB=y
895# CONFIG_SH_STANDARD_BIOS is not set 929# CONFIG_SH_STANDARD_BIOS is not set
896# CONFIG_EARLY_SCIF_CONSOLE is not set
897# CONFIG_DWARF_UNWINDER is not set 930# CONFIG_DWARF_UNWINDER is not set
898 931
899# 932#
@@ -901,7 +934,11 @@ CONFIG_HAVE_ARCH_KGDB=y
901# 934#
902# CONFIG_KEYS is not set 935# CONFIG_KEYS is not set
903# CONFIG_SECURITYFS is not set 936# CONFIG_SECURITYFS is not set
904# CONFIG_SECURITY_FILE_CAPABILITIES is not set 937# CONFIG_DEFAULT_SECURITY_SELINUX is not set
938# CONFIG_DEFAULT_SECURITY_SMACK is not set
939# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
940CONFIG_DEFAULT_SECURITY_DAC=y
941CONFIG_DEFAULT_SECURITY=""
905CONFIG_CRYPTO=y 942CONFIG_CRYPTO=y
906 943
907# 944#
diff --git a/arch/sh/configs/se7712_defconfig b/arch/sh/configs/se7712_defconfig
index 1a43cfecb392..cfa58199a368 100644
--- a/arch/sh/configs/se7712_defconfig
+++ b/arch/sh/configs/se7712_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:53:32 2009 4# Mon Jan 4 13:44:56 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -28,6 +28,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28CONFIG_ARCH_NO_VIRT_TO_BUS=y 28CONFIG_ARCH_NO_VIRT_TO_BUS=y
29CONFIG_ARCH_HAS_DEFAULT_IDLE=y 29CONFIG_ARCH_HAS_DEFAULT_IDLE=y
30CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 30CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
31CONFIG_DMA_NONCOHERENT=y
31CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
32CONFIG_CONSTRUCTORS=y 33CONFIG_CONSTRUCTORS=y
33 34
@@ -60,6 +61,7 @@ CONFIG_BSD_PROCESS_ACCT=y
60# 61#
61CONFIG_TREE_RCU=y 62CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 63# CONFIG_TREE_PREEMPT_RCU is not set
64# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 65# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 66CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 67# CONFIG_RCU_FANOUT_EXACT is not set
@@ -95,6 +97,7 @@ CONFIG_EVENTFD=y
95# CONFIG_SHMEM is not set 97# CONFIG_SHMEM is not set
96CONFIG_AIO=y 98CONFIG_AIO=y
97CONFIG_HAVE_PERF_EVENTS=y 99CONFIG_HAVE_PERF_EVENTS=y
100CONFIG_PERF_USE_VMALLOC=y
98 101
99# 102#
100# Kernel Performance Events And Counters 103# Kernel Performance Events And Counters
@@ -113,6 +116,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
113CONFIG_HAVE_KPROBES=y 116CONFIG_HAVE_KPROBES=y
114CONFIG_HAVE_KRETPROBES=y 117CONFIG_HAVE_KRETPROBES=y
115CONFIG_HAVE_ARCH_TRACEHOOK=y 118CONFIG_HAVE_ARCH_TRACEHOOK=y
119CONFIG_HAVE_DMA_ATTRS=y
116CONFIG_HAVE_CLK=y 120CONFIG_HAVE_CLK=y
117CONFIG_HAVE_DMA_API_DEBUG=y 121CONFIG_HAVE_DMA_API_DEBUG=y
118 122
@@ -138,14 +142,41 @@ CONFIG_LBDAF=y
138# IO Schedulers 142# IO Schedulers
139# 143#
140CONFIG_IOSCHED_NOOP=y 144CONFIG_IOSCHED_NOOP=y
141# CONFIG_IOSCHED_AS is not set
142# CONFIG_IOSCHED_DEADLINE is not set 145# CONFIG_IOSCHED_DEADLINE is not set
143# CONFIG_IOSCHED_CFQ is not set 146# CONFIG_IOSCHED_CFQ is not set
144# CONFIG_DEFAULT_AS is not set
145# CONFIG_DEFAULT_DEADLINE is not set 147# CONFIG_DEFAULT_DEADLINE is not set
146# CONFIG_DEFAULT_CFQ is not set 148# CONFIG_DEFAULT_CFQ is not set
147CONFIG_DEFAULT_NOOP=y 149CONFIG_DEFAULT_NOOP=y
148CONFIG_DEFAULT_IOSCHED="noop" 150CONFIG_DEFAULT_IOSCHED="noop"
151# CONFIG_INLINE_SPIN_TRYLOCK is not set
152# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
153# CONFIG_INLINE_SPIN_LOCK is not set
154# CONFIG_INLINE_SPIN_LOCK_BH is not set
155# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
156# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
157CONFIG_INLINE_SPIN_UNLOCK=y
158# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
159CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
160# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
161# CONFIG_INLINE_READ_TRYLOCK is not set
162# CONFIG_INLINE_READ_LOCK is not set
163# CONFIG_INLINE_READ_LOCK_BH is not set
164# CONFIG_INLINE_READ_LOCK_IRQ is not set
165# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
166CONFIG_INLINE_READ_UNLOCK=y
167# CONFIG_INLINE_READ_UNLOCK_BH is not set
168CONFIG_INLINE_READ_UNLOCK_IRQ=y
169# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
170# CONFIG_INLINE_WRITE_TRYLOCK is not set
171# CONFIG_INLINE_WRITE_LOCK is not set
172# CONFIG_INLINE_WRITE_LOCK_BH is not set
173# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
174# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
175CONFIG_INLINE_WRITE_UNLOCK=y
176# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
177CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
178# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
179# CONFIG_MUTEX_SPIN_ON_OWNER is not set
149# CONFIG_FREEZER is not set 180# CONFIG_FREEZER is not set
150 181
151# 182#
@@ -221,8 +252,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
221# CONFIG_PHYS_ADDR_T_64BIT is not set 252# CONFIG_PHYS_ADDR_T_64BIT is not set
222CONFIG_ZONE_DMA_FLAG=0 253CONFIG_ZONE_DMA_FLAG=0
223CONFIG_NR_QUICK=2 254CONFIG_NR_QUICK=2
224CONFIG_HAVE_MLOCK=y
225CONFIG_HAVE_MLOCKED_PAGE_BIT=y
226# CONFIG_KSM is not set 255# CONFIG_KSM is not set
227CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 256CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
228 257
@@ -452,9 +481,6 @@ CONFIG_NET_SCH_FIFO=y
452CONFIG_FIB_RULES=y 481CONFIG_FIB_RULES=y
453CONFIG_WIRELESS=y 482CONFIG_WIRELESS=y
454# CONFIG_CFG80211 is not set 483# CONFIG_CFG80211 is not set
455CONFIG_CFG80211_DEFAULT_PS_VALUE=0
456# CONFIG_WIRELESS_OLD_REGULATORY is not set
457# CONFIG_WIRELESS_EXT is not set
458# CONFIG_LIB80211 is not set 484# CONFIG_LIB80211 is not set
459 485
460# 486#
@@ -565,6 +591,10 @@ CONFIG_MTD_CFI_UTIL=y
565CONFIG_BLK_DEV=y 591CONFIG_BLK_DEV=y
566# CONFIG_BLK_DEV_COW_COMMON is not set 592# CONFIG_BLK_DEV_COW_COMMON is not set
567# CONFIG_BLK_DEV_LOOP is not set 593# CONFIG_BLK_DEV_LOOP is not set
594
595#
596# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
597#
568# CONFIG_BLK_DEV_NBD is not set 598# CONFIG_BLK_DEV_NBD is not set
569# CONFIG_BLK_DEV_RAM is not set 599# CONFIG_BLK_DEV_RAM is not set
570# CONFIG_CDROM_PKTCDVD is not set 600# CONFIG_CDROM_PKTCDVD is not set
@@ -675,11 +705,11 @@ CONFIG_SH_ETH=y
675# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 705# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
676# CONFIG_B44 is not set 706# CONFIG_B44 is not set
677# CONFIG_KS8842 is not set 707# CONFIG_KS8842 is not set
708# CONFIG_KS8851_MLL is not set
678CONFIG_NETDEV_1000=y 709CONFIG_NETDEV_1000=y
679CONFIG_NETDEV_10000=y 710CONFIG_NETDEV_10000=y
680CONFIG_WLAN=y 711CONFIG_WLAN=y
681# CONFIG_WLAN_PRE80211 is not set 712# CONFIG_HOSTAP is not set
682# CONFIG_WLAN_80211 is not set
683 713
684# 714#
685# Enable WiMAX (Networking options) to see the WiMAX drivers 715# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -757,6 +787,7 @@ CONFIG_SSB_POSSIBLE=y
757# 787#
758# CONFIG_MFD_CORE is not set 788# CONFIG_MFD_CORE is not set
759# CONFIG_MFD_SM501 is not set 789# CONFIG_MFD_SM501 is not set
790# CONFIG_MFD_SH_MOBILE_SDHI is not set
760# CONFIG_HTC_PASIC3 is not set 791# CONFIG_HTC_PASIC3 is not set
761# CONFIG_MFD_TMIO is not set 792# CONFIG_MFD_TMIO is not set
762# CONFIG_REGULATOR is not set 793# CONFIG_REGULATOR is not set
@@ -888,7 +919,6 @@ CONFIG_PROC_FS=y
888CONFIG_PROC_SYSCTL=y 919CONFIG_PROC_SYSCTL=y
889CONFIG_PROC_PAGE_MONITOR=y 920CONFIG_PROC_PAGE_MONITOR=y
890CONFIG_SYSFS=y 921CONFIG_SYSFS=y
891# CONFIG_HUGETLBFS is not set
892# CONFIG_HUGETLB_PAGE is not set 922# CONFIG_HUGETLB_PAGE is not set
893# CONFIG_CONFIGFS_FS is not set 923# CONFIG_CONFIGFS_FS is not set
894CONFIG_MISC_FILESYSTEMS=y 924CONFIG_MISC_FILESYSTEMS=y
@@ -1021,7 +1051,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1021CONFIG_HAVE_ARCH_KGDB=y 1051CONFIG_HAVE_ARCH_KGDB=y
1022# CONFIG_KGDB is not set 1052# CONFIG_KGDB is not set
1023# CONFIG_SH_STANDARD_BIOS is not set 1053# CONFIG_SH_STANDARD_BIOS is not set
1024# CONFIG_EARLY_SCIF_CONSOLE is not set
1025# CONFIG_STACK_DEBUG is not set 1054# CONFIG_STACK_DEBUG is not set
1026# CONFIG_DEBUG_STACK_USAGE is not set 1055# CONFIG_DEBUG_STACK_USAGE is not set
1027# CONFIG_4KSTACKS is not set 1056# CONFIG_4KSTACKS is not set
@@ -1035,7 +1064,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1035# CONFIG_KEYS is not set 1064# CONFIG_KEYS is not set
1036# CONFIG_SECURITY is not set 1065# CONFIG_SECURITY is not set
1037# CONFIG_SECURITYFS is not set 1066# CONFIG_SECURITYFS is not set
1038# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1067# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1068# CONFIG_DEFAULT_SECURITY_SMACK is not set
1069# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1070CONFIG_DEFAULT_SECURITY_DAC=y
1071CONFIG_DEFAULT_SECURITY=""
1039CONFIG_CRYPTO=y 1072CONFIG_CRYPTO=y
1040 1073
1041# 1074#
diff --git a/arch/sh/configs/se7721_defconfig b/arch/sh/configs/se7721_defconfig
index b8a3c8c4bac3..201283c829a1 100644
--- a/arch/sh/configs/se7721_defconfig
+++ b/arch/sh/configs/se7721_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:57:11 2009 4# Mon Jan 4 13:46:58 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -29,6 +29,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 29CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 30CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
32CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 34CONFIG_CONSTRUCTORS=y
34 35
@@ -61,6 +62,7 @@ CONFIG_BSD_PROCESS_ACCT=y
61# 62#
62CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -100,6 +102,7 @@ CONFIG_EVENTFD=y
100# CONFIG_SHMEM is not set 102# CONFIG_SHMEM is not set
101CONFIG_AIO=y 103CONFIG_AIO=y
102CONFIG_HAVE_PERF_EVENTS=y 104CONFIG_HAVE_PERF_EVENTS=y
105CONFIG_PERF_USE_VMALLOC=y
103 106
104# 107#
105# Kernel Performance Events And Counters 108# Kernel Performance Events And Counters
@@ -118,6 +121,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
118CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
119CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
120CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
121CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
122CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
123 127
@@ -143,14 +147,41 @@ CONFIG_LBDAF=y
143# IO Schedulers 147# IO Schedulers
144# 148#
145CONFIG_IOSCHED_NOOP=y 149CONFIG_IOSCHED_NOOP=y
146# CONFIG_IOSCHED_AS is not set
147# CONFIG_IOSCHED_DEADLINE is not set 150# CONFIG_IOSCHED_DEADLINE is not set
148# CONFIG_IOSCHED_CFQ is not set 151# CONFIG_IOSCHED_CFQ is not set
149# CONFIG_DEFAULT_AS is not set
150# CONFIG_DEFAULT_DEADLINE is not set 152# CONFIG_DEFAULT_DEADLINE is not set
151# CONFIG_DEFAULT_CFQ is not set 153# CONFIG_DEFAULT_CFQ is not set
152CONFIG_DEFAULT_NOOP=y 154CONFIG_DEFAULT_NOOP=y
153CONFIG_DEFAULT_IOSCHED="noop" 155CONFIG_DEFAULT_IOSCHED="noop"
156# CONFIG_INLINE_SPIN_TRYLOCK is not set
157# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
158# CONFIG_INLINE_SPIN_LOCK is not set
159# CONFIG_INLINE_SPIN_LOCK_BH is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
162CONFIG_INLINE_SPIN_UNLOCK=y
163# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
164CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
165# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
166# CONFIG_INLINE_READ_TRYLOCK is not set
167# CONFIG_INLINE_READ_LOCK is not set
168# CONFIG_INLINE_READ_LOCK_BH is not set
169# CONFIG_INLINE_READ_LOCK_IRQ is not set
170# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
171CONFIG_INLINE_READ_UNLOCK=y
172# CONFIG_INLINE_READ_UNLOCK_BH is not set
173CONFIG_INLINE_READ_UNLOCK_IRQ=y
174# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
175# CONFIG_INLINE_WRITE_TRYLOCK is not set
176# CONFIG_INLINE_WRITE_LOCK is not set
177# CONFIG_INLINE_WRITE_LOCK_BH is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
180CONFIG_INLINE_WRITE_UNLOCK=y
181# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
182CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
183# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
184# CONFIG_MUTEX_SPIN_ON_OWNER is not set
154# CONFIG_FREEZER is not set 185# CONFIG_FREEZER is not set
155 186
156# 187#
@@ -226,8 +257,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
226# CONFIG_PHYS_ADDR_T_64BIT is not set 257# CONFIG_PHYS_ADDR_T_64BIT is not set
227CONFIG_ZONE_DMA_FLAG=0 258CONFIG_ZONE_DMA_FLAG=0
228CONFIG_NR_QUICK=2 259CONFIG_NR_QUICK=2
229CONFIG_HAVE_MLOCK=y
230CONFIG_HAVE_MLOCKED_PAGE_BIT=y
231# CONFIG_KSM is not set 260# CONFIG_KSM is not set
232CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 261CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
233 262
@@ -457,9 +486,6 @@ CONFIG_NET_SCH_FIFO=y
457CONFIG_FIB_RULES=y 486CONFIG_FIB_RULES=y
458CONFIG_WIRELESS=y 487CONFIG_WIRELESS=y
459# CONFIG_CFG80211 is not set 488# CONFIG_CFG80211 is not set
460CONFIG_CFG80211_DEFAULT_PS_VALUE=0
461# CONFIG_WIRELESS_OLD_REGULATORY is not set
462# CONFIG_WIRELESS_EXT is not set
463# CONFIG_LIB80211 is not set 489# CONFIG_LIB80211 is not set
464 490
465# 491#
@@ -570,6 +596,10 @@ CONFIG_MTD_CFI_UTIL=y
570CONFIG_BLK_DEV=y 596CONFIG_BLK_DEV=y
571# CONFIG_BLK_DEV_COW_COMMON is not set 597# CONFIG_BLK_DEV_COW_COMMON is not set
572# CONFIG_BLK_DEV_LOOP is not set 598# CONFIG_BLK_DEV_LOOP is not set
599
600#
601# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
602#
573# CONFIG_BLK_DEV_NBD is not set 603# CONFIG_BLK_DEV_NBD is not set
574# CONFIG_BLK_DEV_UB is not set 604# CONFIG_BLK_DEV_UB is not set
575# CONFIG_BLK_DEV_RAM is not set 605# CONFIG_BLK_DEV_RAM is not set
@@ -642,8 +672,8 @@ CONFIG_NETDEVICES=y
642CONFIG_NETDEV_1000=y 672CONFIG_NETDEV_1000=y
643CONFIG_NETDEV_10000=y 673CONFIG_NETDEV_10000=y
644CONFIG_WLAN=y 674CONFIG_WLAN=y
645# CONFIG_WLAN_PRE80211 is not set 675# CONFIG_USB_ZD1201 is not set
646# CONFIG_WLAN_80211 is not set 676# CONFIG_HOSTAP is not set
647 677
648# 678#
649# Enable WiMAX (Networking options) to see the WiMAX drivers 679# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -672,6 +702,7 @@ CONFIG_WLAN=y
672CONFIG_INPUT=y 702CONFIG_INPUT=y
673CONFIG_INPUT_FF_MEMLESS=m 703CONFIG_INPUT_FF_MEMLESS=m
674# CONFIG_INPUT_POLLDEV is not set 704# CONFIG_INPUT_POLLDEV is not set
705# CONFIG_INPUT_SPARSEKMAP is not set
675 706
676# 707#
677# Userland interfaces 708# Userland interfaces
@@ -765,6 +796,7 @@ CONFIG_SSB_POSSIBLE=y
765# 796#
766# CONFIG_MFD_CORE is not set 797# CONFIG_MFD_CORE is not set
767# CONFIG_MFD_SM501 is not set 798# CONFIG_MFD_SM501 is not set
799# CONFIG_MFD_SH_MOBILE_SDHI is not set
768# CONFIG_HTC_PASIC3 is not set 800# CONFIG_HTC_PASIC3 is not set
769# CONFIG_MFD_TMIO is not set 801# CONFIG_MFD_TMIO is not set
770# CONFIG_REGULATOR is not set 802# CONFIG_REGULATOR is not set
@@ -1029,7 +1061,6 @@ CONFIG_PROC_FS=y
1029CONFIG_PROC_SYSCTL=y 1061CONFIG_PROC_SYSCTL=y
1030CONFIG_PROC_PAGE_MONITOR=y 1062CONFIG_PROC_PAGE_MONITOR=y
1031CONFIG_SYSFS=y 1063CONFIG_SYSFS=y
1032# CONFIG_HUGETLBFS is not set
1033# CONFIG_HUGETLB_PAGE is not set 1064# CONFIG_HUGETLB_PAGE is not set
1034# CONFIG_CONFIGFS_FS is not set 1065# CONFIG_CONFIGFS_FS is not set
1035CONFIG_MISC_FILESYSTEMS=y 1066CONFIG_MISC_FILESYSTEMS=y
@@ -1186,7 +1217,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1186CONFIG_HAVE_ARCH_KGDB=y 1217CONFIG_HAVE_ARCH_KGDB=y
1187# CONFIG_KGDB is not set 1218# CONFIG_KGDB is not set
1188# CONFIG_SH_STANDARD_BIOS is not set 1219# CONFIG_SH_STANDARD_BIOS is not set
1189# CONFIG_EARLY_SCIF_CONSOLE is not set
1190# CONFIG_STACK_DEBUG is not set 1220# CONFIG_STACK_DEBUG is not set
1191# CONFIG_DEBUG_STACK_USAGE is not set 1221# CONFIG_DEBUG_STACK_USAGE is not set
1192# CONFIG_4KSTACKS is not set 1222# CONFIG_4KSTACKS is not set
@@ -1200,7 +1230,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1200# CONFIG_KEYS is not set 1230# CONFIG_KEYS is not set
1201# CONFIG_SECURITY is not set 1231# CONFIG_SECURITY is not set
1202# CONFIG_SECURITYFS is not set 1232# CONFIG_SECURITYFS is not set
1203# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1233# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1234# CONFIG_DEFAULT_SECURITY_SMACK is not set
1235# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1236CONFIG_DEFAULT_SECURITY_DAC=y
1237CONFIG_DEFAULT_SECURITY=""
1204CONFIG_CRYPTO=y 1238CONFIG_CRYPTO=y
1205 1239
1206# 1240#
diff --git a/arch/sh/configs/se7722_defconfig b/arch/sh/configs/se7722_defconfig
index d709b7f35ace..4a4efd261d03 100644
--- a/arch/sh/configs/se7722_defconfig
+++ b/arch/sh/configs/se7722_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:57:41 2009 4# Mon Jan 4 13:49:15 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_NUMA=y 24CONFIG_SYS_SUPPORTS_NUMA=y
24CONFIG_SYS_SUPPORTS_CMT=y 25CONFIG_SYS_SUPPORTS_CMT=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -63,6 +65,7 @@ CONFIG_BSD_PROCESS_ACCT=y
63# 65#
64CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 69# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +105,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 105CONFIG_SHMEM=y
103CONFIG_AIO=y 106CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 107CONFIG_HAVE_PERF_EVENTS=y
108CONFIG_PERF_USE_VMALLOC=y
105 109
106# 110#
107# Kernel Performance Events And Counters 111# Kernel Performance Events And Counters
@@ -122,6 +126,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
122CONFIG_HAVE_KPROBES=y 126CONFIG_HAVE_KPROBES=y
123CONFIG_HAVE_KRETPROBES=y 127CONFIG_HAVE_KRETPROBES=y
124CONFIG_HAVE_ARCH_TRACEHOOK=y 128CONFIG_HAVE_ARCH_TRACEHOOK=y
129CONFIG_HAVE_DMA_ATTRS=y
125CONFIG_HAVE_CLK=y 130CONFIG_HAVE_CLK=y
126CONFIG_HAVE_DMA_API_DEBUG=y 131CONFIG_HAVE_DMA_API_DEBUG=y
127 132
@@ -149,14 +154,41 @@ CONFIG_LBDAF=y
149# IO Schedulers 154# IO Schedulers
150# 155#
151CONFIG_IOSCHED_NOOP=y 156CONFIG_IOSCHED_NOOP=y
152# CONFIG_IOSCHED_AS is not set
153# CONFIG_IOSCHED_DEADLINE is not set 157# CONFIG_IOSCHED_DEADLINE is not set
154# CONFIG_IOSCHED_CFQ is not set 158# CONFIG_IOSCHED_CFQ is not set
155# CONFIG_DEFAULT_AS is not set
156# CONFIG_DEFAULT_DEADLINE is not set 159# CONFIG_DEFAULT_DEADLINE is not set
157# CONFIG_DEFAULT_CFQ is not set 160# CONFIG_DEFAULT_CFQ is not set
158CONFIG_DEFAULT_NOOP=y 161CONFIG_DEFAULT_NOOP=y
159CONFIG_DEFAULT_IOSCHED="noop" 162CONFIG_DEFAULT_IOSCHED="noop"
163# CONFIG_INLINE_SPIN_TRYLOCK is not set
164# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
165# CONFIG_INLINE_SPIN_LOCK is not set
166# CONFIG_INLINE_SPIN_LOCK_BH is not set
167# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
168# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
169# CONFIG_INLINE_SPIN_UNLOCK is not set
170# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
171# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
172# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
173# CONFIG_INLINE_READ_TRYLOCK is not set
174# CONFIG_INLINE_READ_LOCK is not set
175# CONFIG_INLINE_READ_LOCK_BH is not set
176# CONFIG_INLINE_READ_LOCK_IRQ is not set
177# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
178# CONFIG_INLINE_READ_UNLOCK is not set
179# CONFIG_INLINE_READ_UNLOCK_BH is not set
180# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
181# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
182# CONFIG_INLINE_WRITE_TRYLOCK is not set
183# CONFIG_INLINE_WRITE_LOCK is not set
184# CONFIG_INLINE_WRITE_LOCK_BH is not set
185# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
186# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
187# CONFIG_INLINE_WRITE_UNLOCK is not set
188# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
189# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
190# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
191# CONFIG_MUTEX_SPIN_ON_OWNER is not set
160CONFIG_FREEZER=y 192CONFIG_FREEZER=y
161 193
162# 194#
@@ -248,8 +280,6 @@ CONFIG_MIGRATION=y
248# CONFIG_PHYS_ADDR_T_64BIT is not set 280# CONFIG_PHYS_ADDR_T_64BIT is not set
249CONFIG_ZONE_DMA_FLAG=0 281CONFIG_ZONE_DMA_FLAG=0
250CONFIG_NR_QUICK=2 282CONFIG_NR_QUICK=2
251CONFIG_HAVE_MLOCK=y
252CONFIG_HAVE_MLOCKED_PAGE_BIT=y
253# CONFIG_KSM is not set 283# CONFIG_KSM is not set
254CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 284CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
255 285
@@ -284,7 +314,6 @@ CONFIG_SH_7722_SOLUTION_ENGINE=y
284# 314#
285CONFIG_SH_TIMER_TMU=y 315CONFIG_SH_TIMER_TMU=y
286# CONFIG_SH_TIMER_CMT is not set 316# CONFIG_SH_TIMER_CMT is not set
287CONFIG_SH_PCLK_FREQ=33333333
288CONFIG_SH_CLK_CPG=y 317CONFIG_SH_CLK_CPG=y
289CONFIG_TICK_ONESHOT=y 318CONFIG_TICK_ONESHOT=y
290CONFIG_NO_HZ=y 319CONFIG_NO_HZ=y
@@ -436,9 +465,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
436# CONFIG_AF_RXRPC is not set 465# CONFIG_AF_RXRPC is not set
437CONFIG_WIRELESS=y 466CONFIG_WIRELESS=y
438# CONFIG_CFG80211 is not set 467# CONFIG_CFG80211 is not set
439CONFIG_CFG80211_DEFAULT_PS_VALUE=0
440# CONFIG_WIRELESS_OLD_REGULATORY is not set
441# CONFIG_WIRELESS_EXT is not set
442# CONFIG_LIB80211 is not set 468# CONFIG_LIB80211 is not set
443 469
444# 470#
@@ -467,6 +493,10 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
467CONFIG_BLK_DEV=y 493CONFIG_BLK_DEV=y
468# CONFIG_BLK_DEV_COW_COMMON is not set 494# CONFIG_BLK_DEV_COW_COMMON is not set
469# CONFIG_BLK_DEV_LOOP is not set 495# CONFIG_BLK_DEV_LOOP is not set
496
497#
498# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
499#
470# CONFIG_BLK_DEV_NBD is not set 500# CONFIG_BLK_DEV_NBD is not set
471CONFIG_BLK_DEV_RAM=y 501CONFIG_BLK_DEV_RAM=y
472CONFIG_BLK_DEV_RAM_COUNT=16 502CONFIG_BLK_DEV_RAM_COUNT=16
@@ -560,11 +590,11 @@ CONFIG_SMC91X=y
560# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 590# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
561# CONFIG_B44 is not set 591# CONFIG_B44 is not set
562# CONFIG_KS8842 is not set 592# CONFIG_KS8842 is not set
593# CONFIG_KS8851_MLL is not set
563CONFIG_NETDEV_1000=y 594CONFIG_NETDEV_1000=y
564CONFIG_NETDEV_10000=y 595CONFIG_NETDEV_10000=y
565CONFIG_WLAN=y 596CONFIG_WLAN=y
566# CONFIG_WLAN_PRE80211 is not set 597# CONFIG_HOSTAP is not set
567# CONFIG_WLAN_80211 is not set
568 598
569# 599#
570# Enable WiMAX (Networking options) to see the WiMAX drivers 600# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -584,6 +614,7 @@ CONFIG_WLAN=y
584CONFIG_INPUT=y 614CONFIG_INPUT=y
585# CONFIG_INPUT_FF_MEMLESS is not set 615# CONFIG_INPUT_FF_MEMLESS is not set
586# CONFIG_INPUT_POLLDEV is not set 616# CONFIG_INPUT_POLLDEV is not set
617# CONFIG_INPUT_SPARSEKMAP is not set
587 618
588# 619#
589# Userland interfaces 620# Userland interfaces
@@ -622,6 +653,7 @@ CONFIG_SERIO=y
622# CONFIG_SERIO_SERPORT is not set 653# CONFIG_SERIO_SERPORT is not set
623CONFIG_SERIO_LIBPS2=y 654CONFIG_SERIO_LIBPS2=y
624# CONFIG_SERIO_RAW is not set 655# CONFIG_SERIO_RAW is not set
656# CONFIG_SERIO_ALTERA_PS2 is not set
625# CONFIG_GAMEPORT is not set 657# CONFIG_GAMEPORT is not set
626 658
627# 659#
@@ -694,6 +726,7 @@ CONFIG_SSB_POSSIBLE=y
694# 726#
695# CONFIG_MFD_CORE is not set 727# CONFIG_MFD_CORE is not set
696# CONFIG_MFD_SM501 is not set 728# CONFIG_MFD_SM501 is not set
729# CONFIG_MFD_SH_MOBILE_SDHI is not set
697# CONFIG_HTC_PASIC3 is not set 730# CONFIG_HTC_PASIC3 is not set
698# CONFIG_MFD_TMIO is not set 731# CONFIG_MFD_TMIO is not set
699# CONFIG_REGULATOR is not set 732# CONFIG_REGULATOR is not set
@@ -774,7 +807,9 @@ CONFIG_RTC_INTF_DEV=y
774# CONFIG_RTC_DRV_M48T86 is not set 807# CONFIG_RTC_DRV_M48T86 is not set
775# CONFIG_RTC_DRV_M48T35 is not set 808# CONFIG_RTC_DRV_M48T35 is not set
776# CONFIG_RTC_DRV_M48T59 is not set 809# CONFIG_RTC_DRV_M48T59 is not set
810# CONFIG_RTC_DRV_MSM6242 is not set
777# CONFIG_RTC_DRV_BQ4802 is not set 811# CONFIG_RTC_DRV_BQ4802 is not set
812# CONFIG_RTC_DRV_RP5C01 is not set
778# CONFIG_RTC_DRV_V3020 is not set 813# CONFIG_RTC_DRV_V3020 is not set
779 814
780# 815#
@@ -906,7 +941,7 @@ CONFIG_DEBUG_FS=y
906# CONFIG_DEBUG_KERNEL is not set 941# CONFIG_DEBUG_KERNEL is not set
907# CONFIG_SLUB_DEBUG_ON is not set 942# CONFIG_SLUB_DEBUG_ON is not set
908# CONFIG_SLUB_STATS is not set 943# CONFIG_SLUB_STATS is not set
909# CONFIG_DEBUG_BUGVERBOSE is not set 944CONFIG_DEBUG_BUGVERBOSE=y
910# CONFIG_DEBUG_MEMORY_INIT is not set 945# CONFIG_DEBUG_MEMORY_INIT is not set
911# CONFIG_RCU_CPU_STALL_DETECTOR is not set 946# CONFIG_RCU_CPU_STALL_DETECTOR is not set
912# CONFIG_LATENCYTOP is not set 947# CONFIG_LATENCYTOP is not set
@@ -924,8 +959,6 @@ CONFIG_TRACING_SUPPORT=y
924# CONFIG_SAMPLES is not set 959# CONFIG_SAMPLES is not set
925CONFIG_HAVE_ARCH_KGDB=y 960CONFIG_HAVE_ARCH_KGDB=y
926CONFIG_SH_STANDARD_BIOS=y 961CONFIG_SH_STANDARD_BIOS=y
927# CONFIG_EARLY_SCIF_CONSOLE is not set
928# CONFIG_EARLY_PRINTK is not set
929# CONFIG_DWARF_UNWINDER is not set 962# CONFIG_DWARF_UNWINDER is not set
930 963
931# 964#
@@ -934,7 +967,11 @@ CONFIG_SH_STANDARD_BIOS=y
934# CONFIG_KEYS is not set 967# CONFIG_KEYS is not set
935# CONFIG_SECURITY is not set 968# CONFIG_SECURITY is not set
936# CONFIG_SECURITYFS is not set 969# CONFIG_SECURITYFS is not set
937# CONFIG_SECURITY_FILE_CAPABILITIES is not set 970# CONFIG_DEFAULT_SECURITY_SELINUX is not set
971# CONFIG_DEFAULT_SECURITY_SMACK is not set
972# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
973CONFIG_DEFAULT_SECURITY_DAC=y
974CONFIG_DEFAULT_SECURITY=""
938CONFIG_CRYPTO=y 975CONFIG_CRYPTO=y
939 976
940# 977#
diff --git a/arch/sh/configs/se7724_defconfig b/arch/sh/configs/se7724_defconfig
index 56b0b9ff9e05..ab371afe3595 100644
--- a/arch/sh/configs/se7724_defconfig
+++ b/arch/sh/configs/se7724_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.31 3# Linux kernel version: 2.6.33-rc2
4# Fri Sep 25 11:50:59 2009 4# Mon Jan 4 14:36:56 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -62,6 +64,7 @@ CONFIG_BSD_PROCESS_ACCT=y
62# 64#
63CONFIG_TREE_RCU=y 65CONFIG_TREE_RCU=y
64# CONFIG_TREE_PREEMPT_RCU is not set 66# CONFIG_TREE_PREEMPT_RCU is not set
67# CONFIG_TINY_RCU is not set
65# CONFIG_RCU_TRACE is not set 68# CONFIG_RCU_TRACE is not set
66CONFIG_RCU_FANOUT=32 69CONFIG_RCU_FANOUT=32
67# CONFIG_RCU_FANOUT_EXACT is not set 70# CONFIG_RCU_FANOUT_EXACT is not set
@@ -99,6 +102,7 @@ CONFIG_EVENTFD=y
99CONFIG_SHMEM=y 102CONFIG_SHMEM=y
100CONFIG_AIO=y 103CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y 104CONFIG_HAVE_PERF_EVENTS=y
105CONFIG_PERF_USE_VMALLOC=y
102 106
103# 107#
104# Kernel Performance Events And Counters 108# Kernel Performance Events And Counters
@@ -116,6 +120,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
116CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
118CONFIG_HAVE_ARCH_TRACEHOOK=y 122CONFIG_HAVE_ARCH_TRACEHOOK=y
123CONFIG_HAVE_DMA_ATTRS=y
119CONFIG_HAVE_CLK=y 124CONFIG_HAVE_CLK=y
120CONFIG_HAVE_DMA_API_DEBUG=y 125CONFIG_HAVE_DMA_API_DEBUG=y
121 126
@@ -142,14 +147,41 @@ CONFIG_LBDAF=y
142# IO Schedulers 147# IO Schedulers
143# 148#
144CONFIG_IOSCHED_NOOP=y 149CONFIG_IOSCHED_NOOP=y
145CONFIG_IOSCHED_AS=y
146CONFIG_IOSCHED_DEADLINE=y 150CONFIG_IOSCHED_DEADLINE=y
147CONFIG_IOSCHED_CFQ=y 151CONFIG_IOSCHED_CFQ=y
148# CONFIG_DEFAULT_AS is not set
149# CONFIG_DEFAULT_DEADLINE is not set 152# CONFIG_DEFAULT_DEADLINE is not set
150CONFIG_DEFAULT_CFQ=y 153CONFIG_DEFAULT_CFQ=y
151# CONFIG_DEFAULT_NOOP is not set 154# CONFIG_DEFAULT_NOOP is not set
152CONFIG_DEFAULT_IOSCHED="cfq" 155CONFIG_DEFAULT_IOSCHED="cfq"
156# CONFIG_INLINE_SPIN_TRYLOCK is not set
157# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
158# CONFIG_INLINE_SPIN_LOCK is not set
159# CONFIG_INLINE_SPIN_LOCK_BH is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
161# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
162# CONFIG_INLINE_SPIN_UNLOCK is not set
163# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
164# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
165# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
166# CONFIG_INLINE_READ_TRYLOCK is not set
167# CONFIG_INLINE_READ_LOCK is not set
168# CONFIG_INLINE_READ_LOCK_BH is not set
169# CONFIG_INLINE_READ_LOCK_IRQ is not set
170# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
171# CONFIG_INLINE_READ_UNLOCK is not set
172# CONFIG_INLINE_READ_UNLOCK_BH is not set
173# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
174# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
175# CONFIG_INLINE_WRITE_TRYLOCK is not set
176# CONFIG_INLINE_WRITE_LOCK is not set
177# CONFIG_INLINE_WRITE_LOCK_BH is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
179# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
180# CONFIG_INLINE_WRITE_UNLOCK is not set
181# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
182# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
183# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
184# CONFIG_MUTEX_SPIN_ON_OWNER is not set
153CONFIG_FREEZER=y 185CONFIG_FREEZER=y
154 186
155# 187#
@@ -205,6 +237,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
205CONFIG_MEMORY_START=0x08000000 237CONFIG_MEMORY_START=0x08000000
206CONFIG_MEMORY_SIZE=0x08000000 238CONFIG_MEMORY_SIZE=0x08000000
207CONFIG_29BIT=y 239CONFIG_29BIT=y
240# CONFIG_PMB_ENABLE is not set
208# CONFIG_X2TLB is not set 241# CONFIG_X2TLB is not set
209CONFIG_VSYSCALL=y 242CONFIG_VSYSCALL=y
210CONFIG_ARCH_FLATMEM_ENABLE=y 243CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -229,8 +262,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
229# CONFIG_PHYS_ADDR_T_64BIT is not set 262# CONFIG_PHYS_ADDR_T_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=0 263CONFIG_ZONE_DMA_FLAG=0
231CONFIG_NR_QUICK=2 264CONFIG_NR_QUICK=2
232CONFIG_HAVE_MLOCK=y
233CONFIG_HAVE_MLOCKED_PAGE_BIT=y
234# CONFIG_KSM is not set 265# CONFIG_KSM is not set
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 266CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236 267
@@ -265,7 +296,6 @@ CONFIG_SH_7724_SOLUTION_ENGINE=y
265# 296#
266CONFIG_SH_TIMER_TMU=y 297CONFIG_SH_TIMER_TMU=y
267# CONFIG_SH_TIMER_CMT is not set 298# CONFIG_SH_TIMER_CMT is not set
268CONFIG_SH_PCLK_FREQ=33333333
269CONFIG_SH_CLK_CPG=y 299CONFIG_SH_CLK_CPG=y
270# CONFIG_NO_HZ is not set 300# CONFIG_NO_HZ is not set
271# CONFIG_HIGH_RES_TIMERS is not set 301# CONFIG_HIGH_RES_TIMERS is not set
@@ -279,8 +309,8 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
279# 309#
280# DMA support 310# DMA support
281# 311#
282CONFIG_SH_DMA_API=y
283CONFIG_SH_DMA=y 312CONFIG_SH_DMA=y
313CONFIG_SH_DMA_API=y
284CONFIG_NR_ONCHIP_DMA_CHANNELS=12 314CONFIG_NR_ONCHIP_DMA_CHANNELS=12
285# CONFIG_NR_DMA_CHANNELS_BOOL is not set 315# CONFIG_NR_DMA_CHANNELS_BOOL is not set
286 316
@@ -423,9 +453,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
423# CONFIG_AF_RXRPC is not set 453# CONFIG_AF_RXRPC is not set
424CONFIG_WIRELESS=y 454CONFIG_WIRELESS=y
425# CONFIG_CFG80211 is not set 455# CONFIG_CFG80211 is not set
426CONFIG_CFG80211_DEFAULT_PS_VALUE=0
427# CONFIG_WIRELESS_OLD_REGULATORY is not set
428# CONFIG_WIRELESS_EXT is not set
429# CONFIG_LIB80211 is not set 456# CONFIG_LIB80211 is not set
430 457
431# 458#
@@ -555,6 +582,10 @@ CONFIG_MTD_UBI_BEB_RESERVE=1
555CONFIG_BLK_DEV=y 582CONFIG_BLK_DEV=y
556# CONFIG_BLK_DEV_COW_COMMON is not set 583# CONFIG_BLK_DEV_COW_COMMON is not set
557# CONFIG_BLK_DEV_LOOP is not set 584# CONFIG_BLK_DEV_LOOP is not set
585
586#
587# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
588#
558# CONFIG_BLK_DEV_NBD is not set 589# CONFIG_BLK_DEV_NBD is not set
559# CONFIG_BLK_DEV_UB is not set 590# CONFIG_BLK_DEV_UB is not set
560CONFIG_BLK_DEV_RAM=y 591CONFIG_BLK_DEV_RAM=y
@@ -565,9 +596,12 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
565# CONFIG_ATA_OVER_ETH is not set 596# CONFIG_ATA_OVER_ETH is not set
566# CONFIG_BLK_DEV_HD is not set 597# CONFIG_BLK_DEV_HD is not set
567CONFIG_MISC_DEVICES=y 598CONFIG_MISC_DEVICES=y
599# CONFIG_AD525X_DPOT is not set
568# CONFIG_ICS932S401 is not set 600# CONFIG_ICS932S401 is not set
569# CONFIG_ENCLOSURE_SERVICES is not set 601# CONFIG_ENCLOSURE_SERVICES is not set
570# CONFIG_ISL29003 is not set 602# CONFIG_ISL29003 is not set
603# CONFIG_DS1682 is not set
604# CONFIG_TI_DAC7512 is not set
571# CONFIG_C2PORT is not set 605# CONFIG_C2PORT is not set
572 606
573# 607#
@@ -578,6 +612,7 @@ CONFIG_MISC_DEVICES=y
578# CONFIG_EEPROM_LEGACY is not set 612# CONFIG_EEPROM_LEGACY is not set
579# CONFIG_EEPROM_MAX6875 is not set 613# CONFIG_EEPROM_MAX6875 is not set
580# CONFIG_EEPROM_93CX6 is not set 614# CONFIG_EEPROM_93CX6 is not set
615# CONFIG_IWMC3200TOP is not set
581CONFIG_HAVE_IDE=y 616CONFIG_HAVE_IDE=y
582# CONFIG_IDE is not set 617# CONFIG_IDE is not set
583 618
@@ -672,11 +707,12 @@ CONFIG_SMC91X=y
672# CONFIG_B44 is not set 707# CONFIG_B44 is not set
673# CONFIG_KS8842 is not set 708# CONFIG_KS8842 is not set
674# CONFIG_KS8851 is not set 709# CONFIG_KS8851 is not set
710# CONFIG_KS8851_MLL is not set
675# CONFIG_NETDEV_1000 is not set 711# CONFIG_NETDEV_1000 is not set
676# CONFIG_NETDEV_10000 is not set 712# CONFIG_NETDEV_10000 is not set
677CONFIG_WLAN=y 713CONFIG_WLAN=y
678# CONFIG_WLAN_PRE80211 is not set 714# CONFIG_USB_ZD1201 is not set
679# CONFIG_WLAN_80211 is not set 715# CONFIG_HOSTAP is not set
680 716
681# 717#
682# Enable WiMAX (Networking options) to see the WiMAX drivers 718# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -705,6 +741,7 @@ CONFIG_WLAN=y
705CONFIG_INPUT=y 741CONFIG_INPUT=y
706# CONFIG_INPUT_FF_MEMLESS is not set 742# CONFIG_INPUT_FF_MEMLESS is not set
707# CONFIG_INPUT_POLLDEV is not set 743# CONFIG_INPUT_POLLDEV is not set
744# CONFIG_INPUT_SPARSEKMAP is not set
708 745
709# 746#
710# Userland interfaces 747# Userland interfaces
@@ -813,7 +850,6 @@ CONFIG_I2C_SH_MOBILE=y
813# 850#
814# Miscellaneous I2C Chip support 851# Miscellaneous I2C Chip support
815# 852#
816# CONFIG_DS1682 is not set
817# CONFIG_SENSORS_TSL2550 is not set 853# CONFIG_SENSORS_TSL2550 is not set
818# CONFIG_I2C_DEBUG_CORE is not set 854# CONFIG_I2C_DEBUG_CORE is not set
819# CONFIG_I2C_DEBUG_ALGO is not set 855# CONFIG_I2C_DEBUG_ALGO is not set
@@ -827,7 +863,10 @@ CONFIG_SPI_MASTER=y
827# 863#
828CONFIG_SPI_BITBANG=y 864CONFIG_SPI_BITBANG=y
829# CONFIG_SPI_GPIO is not set 865# CONFIG_SPI_GPIO is not set
866# CONFIG_SPI_SH_MSIOF is not set
830# CONFIG_SPI_SH_SCI is not set 867# CONFIG_SPI_SH_SCI is not set
868# CONFIG_SPI_XILINX is not set
869# CONFIG_SPI_DESIGNWARE is not set
831 870
832# 871#
833# SPI Protocol Masters 872# SPI Protocol Masters
@@ -885,11 +924,13 @@ CONFIG_SSB_POSSIBLE=y
885# 924#
886# CONFIG_MFD_CORE is not set 925# CONFIG_MFD_CORE is not set
887# CONFIG_MFD_SM501 is not set 926# CONFIG_MFD_SM501 is not set
927# CONFIG_MFD_SH_MOBILE_SDHI is not set
888# CONFIG_HTC_PASIC3 is not set 928# CONFIG_HTC_PASIC3 is not set
889# CONFIG_TPS65010 is not set 929# CONFIG_TPS65010 is not set
890# CONFIG_TWL4030_CORE is not set 930# CONFIG_TWL4030_CORE is not set
891# CONFIG_MFD_TMIO is not set 931# CONFIG_MFD_TMIO is not set
892# CONFIG_PMIC_DA903X is not set 932# CONFIG_PMIC_DA903X is not set
933# CONFIG_PMIC_ADP5520 is not set
893# CONFIG_MFD_WM8400 is not set 934# CONFIG_MFD_WM8400 is not set
894# CONFIG_MFD_WM831X is not set 935# CONFIG_MFD_WM831X is not set
895# CONFIG_MFD_WM8350_I2C is not set 936# CONFIG_MFD_WM8350_I2C is not set
@@ -897,6 +938,8 @@ CONFIG_SSB_POSSIBLE=y
897# CONFIG_MFD_MC13783 is not set 938# CONFIG_MFD_MC13783 is not set
898# CONFIG_AB3100_CORE is not set 939# CONFIG_AB3100_CORE is not set
899# CONFIG_EZX_PCAP is not set 940# CONFIG_EZX_PCAP is not set
941# CONFIG_MFD_88PM8607 is not set
942# CONFIG_AB4500_CORE is not set
900# CONFIG_REGULATOR is not set 943# CONFIG_REGULATOR is not set
901CONFIG_MEDIA_SUPPORT=y 944CONFIG_MEDIA_SUPPORT=y
902 945
@@ -913,6 +956,8 @@ CONFIG_VIDEO_MEDIA=m
913# 956#
914# Multimedia drivers 957# Multimedia drivers
915# 958#
959CONFIG_IR_CORE=y
960CONFIG_VIDEO_IR=y
916# CONFIG_MEDIA_ATTACH is not set 961# CONFIG_MEDIA_ATTACH is not set
917CONFIG_MEDIA_TUNER=m 962CONFIG_MEDIA_TUNER=m
918# CONFIG_MEDIA_TUNER_CUSTOMISE is not set 963# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
@@ -932,6 +977,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
932# CONFIG_VIDEO_ADV_DEBUG is not set 977# CONFIG_VIDEO_ADV_DEBUG is not set
933# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set 978# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
934CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 979CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
980CONFIG_VIDEO_IR_I2C=y
935# CONFIG_VIDEO_VIVI is not set 981# CONFIG_VIDEO_VIVI is not set
936# CONFIG_VIDEO_SAA5246A is not set 982# CONFIG_VIDEO_SAA5246A is not set
937# CONFIG_VIDEO_SAA5249 is not set 983# CONFIG_VIDEO_SAA5249 is not set
@@ -940,10 +986,13 @@ CONFIG_SOC_CAMERA=y
940# CONFIG_SOC_CAMERA_MT9M001 is not set 986# CONFIG_SOC_CAMERA_MT9M001 is not set
941# CONFIG_SOC_CAMERA_MT9M111 is not set 987# CONFIG_SOC_CAMERA_MT9M111 is not set
942# CONFIG_SOC_CAMERA_MT9T031 is not set 988# CONFIG_SOC_CAMERA_MT9T031 is not set
989# CONFIG_SOC_CAMERA_MT9T112 is not set
943# CONFIG_SOC_CAMERA_MT9V022 is not set 990# CONFIG_SOC_CAMERA_MT9V022 is not set
991# CONFIG_SOC_CAMERA_RJ54N1 is not set
944# CONFIG_SOC_CAMERA_TW9910 is not set 992# CONFIG_SOC_CAMERA_TW9910 is not set
945# CONFIG_SOC_CAMERA_PLATFORM is not set 993# CONFIG_SOC_CAMERA_PLATFORM is not set
946CONFIG_SOC_CAMERA_OV772X=y 994CONFIG_SOC_CAMERA_OV772X=y
995# CONFIG_SOC_CAMERA_OV9640 is not set
947CONFIG_VIDEO_SH_MOBILE_CEU=y 996CONFIG_VIDEO_SH_MOBILE_CEU=y
948CONFIG_V4L_USB_DRIVERS=y 997CONFIG_V4L_USB_DRIVERS=y
949# CONFIG_USB_VIDEO_CLASS is not set 998# CONFIG_USB_VIDEO_CLASS is not set
@@ -961,6 +1010,7 @@ CONFIG_USB_GSPCA=m
961# CONFIG_USB_GSPCA_OV519 is not set 1010# CONFIG_USB_GSPCA_OV519 is not set
962# CONFIG_USB_GSPCA_OV534 is not set 1011# CONFIG_USB_GSPCA_OV534 is not set
963# CONFIG_USB_GSPCA_PAC207 is not set 1012# CONFIG_USB_GSPCA_PAC207 is not set
1013# CONFIG_USB_GSPCA_PAC7302 is not set
964# CONFIG_USB_GSPCA_PAC7311 is not set 1014# CONFIG_USB_GSPCA_PAC7311 is not set
965# CONFIG_USB_GSPCA_SN9C20X is not set 1015# CONFIG_USB_GSPCA_SN9C20X is not set
966# CONFIG_USB_GSPCA_SONIXB is not set 1016# CONFIG_USB_GSPCA_SONIXB is not set
@@ -974,6 +1024,7 @@ CONFIG_USB_GSPCA=m
974# CONFIG_USB_GSPCA_SQ905 is not set 1024# CONFIG_USB_GSPCA_SQ905 is not set
975# CONFIG_USB_GSPCA_SQ905C is not set 1025# CONFIG_USB_GSPCA_SQ905C is not set
976# CONFIG_USB_GSPCA_STK014 is not set 1026# CONFIG_USB_GSPCA_STK014 is not set
1027# CONFIG_USB_GSPCA_STV0680 is not set
977# CONFIG_USB_GSPCA_SUNPLUS is not set 1028# CONFIG_USB_GSPCA_SUNPLUS is not set
978# CONFIG_USB_GSPCA_T613 is not set 1029# CONFIG_USB_GSPCA_T613 is not set
979# CONFIG_USB_GSPCA_TV8532 is not set 1030# CONFIG_USB_GSPCA_TV8532 is not set
@@ -1110,9 +1161,11 @@ CONFIG_SND_SOC_WM_HUBS=m
1110CONFIG_SND_SOC_AD1836=m 1161CONFIG_SND_SOC_AD1836=m
1111CONFIG_SND_SOC_AD1938=m 1162CONFIG_SND_SOC_AD1938=m
1112CONFIG_SND_SOC_AD73311=m 1163CONFIG_SND_SOC_AD73311=m
1164CONFIG_SND_SOC_ADS117X=m
1113CONFIG_SND_SOC_AK4104=m 1165CONFIG_SND_SOC_AK4104=m
1114CONFIG_SND_SOC_AK4535=m 1166CONFIG_SND_SOC_AK4535=m
1115CONFIG_SND_SOC_AK4642=m 1167CONFIG_SND_SOC_AK4642=m
1168CONFIG_SND_SOC_AK4671=m
1116CONFIG_SND_SOC_CS4270=m 1169CONFIG_SND_SOC_CS4270=m
1117CONFIG_SND_SOC_L3=m 1170CONFIG_SND_SOC_L3=m
1118CONFIG_SND_SOC_PCM3008=m 1171CONFIG_SND_SOC_PCM3008=m
@@ -1121,11 +1174,14 @@ CONFIG_SND_SOC_SSM2602=m
1121CONFIG_SND_SOC_TLV320AIC23=m 1174CONFIG_SND_SOC_TLV320AIC23=m
1122CONFIG_SND_SOC_TLV320AIC26=m 1175CONFIG_SND_SOC_TLV320AIC26=m
1123CONFIG_SND_SOC_TLV320AIC3X=m 1176CONFIG_SND_SOC_TLV320AIC3X=m
1177CONFIG_SND_SOC_TLV320DAC33=m
1124CONFIG_SND_SOC_UDA134X=m 1178CONFIG_SND_SOC_UDA134X=m
1125CONFIG_SND_SOC_UDA1380=m 1179CONFIG_SND_SOC_UDA1380=m
1126CONFIG_SND_SOC_WM8510=m 1180CONFIG_SND_SOC_WM8510=m
1127CONFIG_SND_SOC_WM8523=m 1181CONFIG_SND_SOC_WM8523=m
1128CONFIG_SND_SOC_WM8580=m 1182CONFIG_SND_SOC_WM8580=m
1183CONFIG_SND_SOC_WM8711=m
1184CONFIG_SND_SOC_WM8727=m
1129CONFIG_SND_SOC_WM8728=m 1185CONFIG_SND_SOC_WM8728=m
1130CONFIG_SND_SOC_WM8731=m 1186CONFIG_SND_SOC_WM8731=m
1131CONFIG_SND_SOC_WM8750=m 1187CONFIG_SND_SOC_WM8750=m
@@ -1143,6 +1199,7 @@ CONFIG_SND_SOC_WM8990=m
1143CONFIG_SND_SOC_WM8993=m 1199CONFIG_SND_SOC_WM8993=m
1144CONFIG_SND_SOC_WM9081=m 1200CONFIG_SND_SOC_WM9081=m
1145CONFIG_SND_SOC_MAX9877=m 1201CONFIG_SND_SOC_MAX9877=m
1202CONFIG_SND_SOC_TPA6130A2=m
1146# CONFIG_SOUND_PRIME is not set 1203# CONFIG_SOUND_PRIME is not set
1147CONFIG_HID_SUPPORT=y 1204CONFIG_HID_SUPPORT=y
1148CONFIG_HID=y 1205CONFIG_HID=y
@@ -1316,10 +1373,12 @@ CONFIG_USB_ETH_RNDIS=y
1316CONFIG_USB_GADGETFS=m 1373CONFIG_USB_GADGETFS=m
1317CONFIG_USB_FILE_STORAGE=m 1374CONFIG_USB_FILE_STORAGE=m
1318# CONFIG_USB_FILE_STORAGE_TEST is not set 1375# CONFIG_USB_FILE_STORAGE_TEST is not set
1376# CONFIG_USB_MASS_STORAGE is not set
1319CONFIG_USB_G_SERIAL=m 1377CONFIG_USB_G_SERIAL=m
1320# CONFIG_USB_MIDI_GADGET is not set 1378# CONFIG_USB_MIDI_GADGET is not set
1321# CONFIG_USB_G_PRINTER is not set 1379# CONFIG_USB_G_PRINTER is not set
1322# CONFIG_USB_CDC_COMPOSITE is not set 1380# CONFIG_USB_CDC_COMPOSITE is not set
1381# CONFIG_USB_G_MULTI is not set
1323 1382
1324# 1383#
1325# OTG and related infrastructure 1384# OTG and related infrastructure
@@ -1345,6 +1404,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
1345# CONFIG_MMC_AT91 is not set 1404# CONFIG_MMC_AT91 is not set
1346# CONFIG_MMC_ATMELMCI is not set 1405# CONFIG_MMC_ATMELMCI is not set
1347CONFIG_MMC_SPI=y 1406CONFIG_MMC_SPI=y
1407# CONFIG_MMC_TMIO is not set
1348# CONFIG_MEMSTICK is not set 1408# CONFIG_MEMSTICK is not set
1349# CONFIG_NEW_LEDS is not set 1409# CONFIG_NEW_LEDS is not set
1350# CONFIG_ACCESSIBILITY is not set 1410# CONFIG_ACCESSIBILITY is not set
@@ -1376,6 +1436,7 @@ CONFIG_RTC_INTF_DEV=y
1376CONFIG_RTC_DRV_PCF8563=y 1436CONFIG_RTC_DRV_PCF8563=y
1377# CONFIG_RTC_DRV_PCF8583 is not set 1437# CONFIG_RTC_DRV_PCF8583 is not set
1378# CONFIG_RTC_DRV_M41T80 is not set 1438# CONFIG_RTC_DRV_M41T80 is not set
1439# CONFIG_RTC_DRV_BQ32K is not set
1379# CONFIG_RTC_DRV_S35390A is not set 1440# CONFIG_RTC_DRV_S35390A is not set
1380# CONFIG_RTC_DRV_FM3130 is not set 1441# CONFIG_RTC_DRV_FM3130 is not set
1381# CONFIG_RTC_DRV_RX8581 is not set 1442# CONFIG_RTC_DRV_RX8581 is not set
@@ -1404,7 +1465,9 @@ CONFIG_RTC_DRV_PCF8563=y
1404# CONFIG_RTC_DRV_M48T86 is not set 1465# CONFIG_RTC_DRV_M48T86 is not set
1405# CONFIG_RTC_DRV_M48T35 is not set 1466# CONFIG_RTC_DRV_M48T35 is not set
1406# CONFIG_RTC_DRV_M48T59 is not set 1467# CONFIG_RTC_DRV_M48T59 is not set
1468# CONFIG_RTC_DRV_MSM6242 is not set
1407# CONFIG_RTC_DRV_BQ4802 is not set 1469# CONFIG_RTC_DRV_BQ4802 is not set
1470# CONFIG_RTC_DRV_RP5C01 is not set
1408# CONFIG_RTC_DRV_V3020 is not set 1471# CONFIG_RTC_DRV_V3020 is not set
1409 1472
1410# 1473#
@@ -1597,7 +1660,7 @@ CONFIG_FRAME_WARN=1024
1597# CONFIG_DEBUG_FS is not set 1660# CONFIG_DEBUG_FS is not set
1598# CONFIG_HEADERS_CHECK is not set 1661# CONFIG_HEADERS_CHECK is not set
1599# CONFIG_DEBUG_KERNEL is not set 1662# CONFIG_DEBUG_KERNEL is not set
1600# CONFIG_DEBUG_BUGVERBOSE is not set 1663CONFIG_DEBUG_BUGVERBOSE=y
1601# CONFIG_DEBUG_MEMORY_INIT is not set 1664# CONFIG_DEBUG_MEMORY_INIT is not set
1602# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1665# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1603# CONFIG_LATENCYTOP is not set 1666# CONFIG_LATENCYTOP is not set
@@ -1614,7 +1677,6 @@ CONFIG_TRACING_SUPPORT=y
1614# CONFIG_SAMPLES is not set 1677# CONFIG_SAMPLES is not set
1615CONFIG_HAVE_ARCH_KGDB=y 1678CONFIG_HAVE_ARCH_KGDB=y
1616# CONFIG_SH_STANDARD_BIOS is not set 1679# CONFIG_SH_STANDARD_BIOS is not set
1617# CONFIG_EARLY_SCIF_CONSOLE is not set
1618# CONFIG_DWARF_UNWINDER is not set 1680# CONFIG_DWARF_UNWINDER is not set
1619 1681
1620# 1682#
@@ -1623,7 +1685,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1623# CONFIG_KEYS is not set 1685# CONFIG_KEYS is not set
1624# CONFIG_SECURITY is not set 1686# CONFIG_SECURITY is not set
1625# CONFIG_SECURITYFS is not set 1687# CONFIG_SECURITYFS is not set
1626# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1688# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1689# CONFIG_DEFAULT_SECURITY_SMACK is not set
1690# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1691CONFIG_DEFAULT_SECURITY_DAC=y
1692CONFIG_DEFAULT_SECURITY=""
1627CONFIG_CRYPTO=y 1693CONFIG_CRYPTO=y
1628 1694
1629# 1695#
diff --git a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
index 7bc926c17b79..b15a44e2ec43 100644
--- a/arch/sh/configs/se7750_defconfig
+++ b/arch/sh/configs/se7750_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 18:58:58 2009 4# Mon Jan 4 14:39:10 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -60,6 +62,7 @@ CONFIG_BSD_PROCESS_ACCT=y
60# 62#
61CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -95,6 +98,7 @@ CONFIG_EVENTFD=y
95CONFIG_SHMEM=y 98CONFIG_SHMEM=y
96CONFIG_AIO=y 99CONFIG_AIO=y
97CONFIG_HAVE_PERF_EVENTS=y 100CONFIG_HAVE_PERF_EVENTS=y
101CONFIG_PERF_USE_VMALLOC=y
98 102
99# 103#
100# Kernel Performance Events And Counters 104# Kernel Performance Events And Counters
@@ -113,6 +117,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
113CONFIG_HAVE_KPROBES=y 117CONFIG_HAVE_KPROBES=y
114CONFIG_HAVE_KRETPROBES=y 118CONFIG_HAVE_KRETPROBES=y
115CONFIG_HAVE_ARCH_TRACEHOOK=y 119CONFIG_HAVE_ARCH_TRACEHOOK=y
120CONFIG_HAVE_DMA_ATTRS=y
116CONFIG_HAVE_CLK=y 121CONFIG_HAVE_CLK=y
117CONFIG_HAVE_DMA_API_DEBUG=y 122CONFIG_HAVE_DMA_API_DEBUG=y
118 123
@@ -138,14 +143,41 @@ CONFIG_LBDAF=y
138# IO Schedulers 143# IO Schedulers
139# 144#
140CONFIG_IOSCHED_NOOP=y 145CONFIG_IOSCHED_NOOP=y
141CONFIG_IOSCHED_AS=y
142CONFIG_IOSCHED_DEADLINE=y 146CONFIG_IOSCHED_DEADLINE=y
143CONFIG_IOSCHED_CFQ=y 147CONFIG_IOSCHED_CFQ=y
144CONFIG_DEFAULT_AS=y
145# CONFIG_DEFAULT_DEADLINE is not set 148# CONFIG_DEFAULT_DEADLINE is not set
146# CONFIG_DEFAULT_CFQ is not set 149CONFIG_DEFAULT_CFQ=y
147# CONFIG_DEFAULT_NOOP is not set 150# CONFIG_DEFAULT_NOOP is not set
148CONFIG_DEFAULT_IOSCHED="anticipatory" 151CONFIG_DEFAULT_IOSCHED="cfq"
152# CONFIG_INLINE_SPIN_TRYLOCK is not set
153# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
154# CONFIG_INLINE_SPIN_LOCK is not set
155# CONFIG_INLINE_SPIN_LOCK_BH is not set
156# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
157# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
158CONFIG_INLINE_SPIN_UNLOCK=y
159# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
160CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
161# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
162# CONFIG_INLINE_READ_TRYLOCK is not set
163# CONFIG_INLINE_READ_LOCK is not set
164# CONFIG_INLINE_READ_LOCK_BH is not set
165# CONFIG_INLINE_READ_LOCK_IRQ is not set
166# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
167CONFIG_INLINE_READ_UNLOCK=y
168# CONFIG_INLINE_READ_UNLOCK_BH is not set
169CONFIG_INLINE_READ_UNLOCK_IRQ=y
170# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
171# CONFIG_INLINE_WRITE_TRYLOCK is not set
172# CONFIG_INLINE_WRITE_LOCK is not set
173# CONFIG_INLINE_WRITE_LOCK_BH is not set
174# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
175# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
176CONFIG_INLINE_WRITE_UNLOCK=y
177# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
178CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
179# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
180# CONFIG_MUTEX_SPIN_ON_OWNER is not set
149# CONFIG_FREEZER is not set 181# CONFIG_FREEZER is not set
150 182
151# 183#
@@ -221,8 +253,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
221# CONFIG_PHYS_ADDR_T_64BIT is not set 253# CONFIG_PHYS_ADDR_T_64BIT is not set
222CONFIG_ZONE_DMA_FLAG=0 254CONFIG_ZONE_DMA_FLAG=0
223CONFIG_NR_QUICK=2 255CONFIG_NR_QUICK=2
224CONFIG_HAVE_MLOCK=y
225CONFIG_HAVE_MLOCKED_PAGE_BIT=y
226# CONFIG_KSM is not set 256# CONFIG_KSM is not set
227CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 257CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
228 258
@@ -307,7 +337,6 @@ CONFIG_GUSA=y
307CONFIG_ZERO_PAGE_OFFSET=0x00001000 337CONFIG_ZERO_PAGE_OFFSET=0x00001000
308CONFIG_BOOT_LINK_OFFSET=0x00800000 338CONFIG_BOOT_LINK_OFFSET=0x00800000
309CONFIG_ENTRY_OFFSET=0x00001000 339CONFIG_ENTRY_OFFSET=0x00001000
310# CONFIG_UBC_WAKEUP is not set
311# CONFIG_CMDLINE_OVERWRITE is not set 340# CONFIG_CMDLINE_OVERWRITE is not set
312# CONFIG_CMDLINE_EXTEND is not set 341# CONFIG_CMDLINE_EXTEND is not set
313 342
@@ -406,9 +435,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
406# CONFIG_AF_RXRPC is not set 435# CONFIG_AF_RXRPC is not set
407CONFIG_WIRELESS=y 436CONFIG_WIRELESS=y
408# CONFIG_CFG80211 is not set 437# CONFIG_CFG80211 is not set
409CONFIG_CFG80211_DEFAULT_PS_VALUE=0
410# CONFIG_WIRELESS_OLD_REGULATORY is not set
411# CONFIG_WIRELESS_EXT is not set
412# CONFIG_LIB80211 is not set 438# CONFIG_LIB80211 is not set
413 439
414# 440#
@@ -513,6 +539,10 @@ CONFIG_MTD_ROM=y
513CONFIG_BLK_DEV=y 539CONFIG_BLK_DEV=y
514# CONFIG_BLK_DEV_COW_COMMON is not set 540# CONFIG_BLK_DEV_COW_COMMON is not set
515# CONFIG_BLK_DEV_LOOP is not set 541# CONFIG_BLK_DEV_LOOP is not set
542
543#
544# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
545#
516# CONFIG_BLK_DEV_NBD is not set 546# CONFIG_BLK_DEV_NBD is not set
517# CONFIG_BLK_DEV_RAM is not set 547# CONFIG_BLK_DEV_RAM is not set
518# CONFIG_CDROM_PKTCDVD is not set 548# CONFIG_CDROM_PKTCDVD is not set
@@ -615,11 +645,11 @@ CONFIG_STNIC=y
615# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 645# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
616# CONFIG_B44 is not set 646# CONFIG_B44 is not set
617# CONFIG_KS8842 is not set 647# CONFIG_KS8842 is not set
648# CONFIG_KS8851_MLL is not set
618CONFIG_NETDEV_1000=y 649CONFIG_NETDEV_1000=y
619CONFIG_NETDEV_10000=y 650CONFIG_NETDEV_10000=y
620CONFIG_WLAN=y 651CONFIG_WLAN=y
621# CONFIG_WLAN_PRE80211 is not set 652# CONFIG_HOSTAP is not set
622# CONFIG_WLAN_80211 is not set
623 653
624# 654#
625# Enable WiMAX (Networking options) to see the WiMAX drivers 655# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -726,6 +756,7 @@ CONFIG_SSB_POSSIBLE=y
726# 756#
727# CONFIG_MFD_CORE is not set 757# CONFIG_MFD_CORE is not set
728# CONFIG_MFD_SM501 is not set 758# CONFIG_MFD_SM501 is not set
759# CONFIG_MFD_SH_MOBILE_SDHI is not set
729# CONFIG_HTC_PASIC3 is not set 760# CONFIG_HTC_PASIC3 is not set
730# CONFIG_MFD_TMIO is not set 761# CONFIG_MFD_TMIO is not set
731# CONFIG_REGULATOR is not set 762# CONFIG_REGULATOR is not set
@@ -785,6 +816,7 @@ CONFIG_RTC_LIB=y
785# CONFIG_EXT2_FS is not set 816# CONFIG_EXT2_FS is not set
786# CONFIG_EXT3_FS is not set 817# CONFIG_EXT3_FS is not set
787# CONFIG_EXT4_FS is not set 818# CONFIG_EXT4_FS is not set
819CONFIG_EXT4_USE_FOR_EXT23=y
788# CONFIG_REISERFS_FS is not set 820# CONFIG_REISERFS_FS is not set
789# CONFIG_JFS_FS is not set 821# CONFIG_JFS_FS is not set
790# CONFIG_FS_POSIX_ACL is not set 822# CONFIG_FS_POSIX_ACL is not set
@@ -914,10 +946,11 @@ CONFIG_FRAME_WARN=1024
914# CONFIG_DEBUG_FS is not set 946# CONFIG_DEBUG_FS is not set
915# CONFIG_HEADERS_CHECK is not set 947# CONFIG_HEADERS_CHECK is not set
916# CONFIG_DEBUG_KERNEL is not set 948# CONFIG_DEBUG_KERNEL is not set
917# CONFIG_DEBUG_BUGVERBOSE is not set 949CONFIG_DEBUG_BUGVERBOSE=y
918# CONFIG_DEBUG_MEMORY_INIT is not set 950# CONFIG_DEBUG_MEMORY_INIT is not set
919# CONFIG_RCU_CPU_STALL_DETECTOR is not set 951# CONFIG_RCU_CPU_STALL_DETECTOR is not set
920# CONFIG_LATENCYTOP is not set 952# CONFIG_LATENCYTOP is not set
953# CONFIG_SYSCTL_SYSCALL_CHECK is not set
921CONFIG_HAVE_FUNCTION_TRACER=y 954CONFIG_HAVE_FUNCTION_TRACER=y
922CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 955CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
923CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 956CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -930,7 +963,6 @@ CONFIG_TRACING_SUPPORT=y
930# CONFIG_SAMPLES is not set 963# CONFIG_SAMPLES is not set
931CONFIG_HAVE_ARCH_KGDB=y 964CONFIG_HAVE_ARCH_KGDB=y
932# CONFIG_SH_STANDARD_BIOS is not set 965# CONFIG_SH_STANDARD_BIOS is not set
933# CONFIG_EARLY_SCIF_CONSOLE is not set
934# CONFIG_DWARF_UNWINDER is not set 966# CONFIG_DWARF_UNWINDER is not set
935 967
936# 968#
@@ -939,7 +971,11 @@ CONFIG_HAVE_ARCH_KGDB=y
939# CONFIG_KEYS is not set 971# CONFIG_KEYS is not set
940# CONFIG_SECURITY is not set 972# CONFIG_SECURITY is not set
941# CONFIG_SECURITYFS is not set 973# CONFIG_SECURITYFS is not set
942# CONFIG_SECURITY_FILE_CAPABILITIES is not set 974# CONFIG_DEFAULT_SECURITY_SELINUX is not set
975# CONFIG_DEFAULT_SECURITY_SMACK is not set
976# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
977CONFIG_DEFAULT_SECURITY_DAC=y
978CONFIG_DEFAULT_SECURITY=""
943CONFIG_CRYPTO=y 979CONFIG_CRYPTO=y
944 980
945# 981#
diff --git a/arch/sh/configs/se7751_defconfig b/arch/sh/configs/se7751_defconfig
index c20ae5e35c81..d1effdeaa416 100644
--- a/arch/sh/configs/se7751_defconfig
+++ b/arch/sh/configs/se7751_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:01:41 2009 4# Mon Jan 4 14:39:56 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -60,6 +62,7 @@ CONFIG_BSD_PROCESS_ACCT=y
60# 62#
61CONFIG_TREE_RCU=y 63CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 64# CONFIG_TREE_PREEMPT_RCU is not set
65# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 66# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 67CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 68# CONFIG_RCU_FANOUT_EXACT is not set
@@ -98,6 +101,7 @@ CONFIG_EVENTFD=y
98CONFIG_SHMEM=y 101CONFIG_SHMEM=y
99CONFIG_AIO=y 102CONFIG_AIO=y
100CONFIG_HAVE_PERF_EVENTS=y 103CONFIG_HAVE_PERF_EVENTS=y
104CONFIG_PERF_USE_VMALLOC=y
101 105
102# 106#
103# Kernel Performance Events And Counters 107# Kernel Performance Events And Counters
@@ -116,6 +120,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
116CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
118CONFIG_HAVE_ARCH_TRACEHOOK=y 122CONFIG_HAVE_ARCH_TRACEHOOK=y
123CONFIG_HAVE_DMA_ATTRS=y
119CONFIG_HAVE_CLK=y 124CONFIG_HAVE_CLK=y
120CONFIG_HAVE_DMA_API_DEBUG=y 125CONFIG_HAVE_DMA_API_DEBUG=y
121 126
@@ -141,14 +146,41 @@ CONFIG_LBDAF=y
141# IO Schedulers 146# IO Schedulers
142# 147#
143CONFIG_IOSCHED_NOOP=y 148CONFIG_IOSCHED_NOOP=y
144CONFIG_IOSCHED_AS=y
145CONFIG_IOSCHED_DEADLINE=y 149CONFIG_IOSCHED_DEADLINE=y
146CONFIG_IOSCHED_CFQ=y 150CONFIG_IOSCHED_CFQ=y
147CONFIG_DEFAULT_AS=y
148# CONFIG_DEFAULT_DEADLINE is not set 151# CONFIG_DEFAULT_DEADLINE is not set
149# CONFIG_DEFAULT_CFQ is not set 152CONFIG_DEFAULT_CFQ=y
150# CONFIG_DEFAULT_NOOP is not set 153# CONFIG_DEFAULT_NOOP is not set
151CONFIG_DEFAULT_IOSCHED="anticipatory" 154CONFIG_DEFAULT_IOSCHED="cfq"
155# CONFIG_INLINE_SPIN_TRYLOCK is not set
156# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
157# CONFIG_INLINE_SPIN_LOCK is not set
158# CONFIG_INLINE_SPIN_LOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
161CONFIG_INLINE_SPIN_UNLOCK=y
162# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
163CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
164# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
165# CONFIG_INLINE_READ_TRYLOCK is not set
166# CONFIG_INLINE_READ_LOCK is not set
167# CONFIG_INLINE_READ_LOCK_BH is not set
168# CONFIG_INLINE_READ_LOCK_IRQ is not set
169# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
170CONFIG_INLINE_READ_UNLOCK=y
171# CONFIG_INLINE_READ_UNLOCK_BH is not set
172CONFIG_INLINE_READ_UNLOCK_IRQ=y
173# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
174# CONFIG_INLINE_WRITE_TRYLOCK is not set
175# CONFIG_INLINE_WRITE_LOCK is not set
176# CONFIG_INLINE_WRITE_LOCK_BH is not set
177# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
179CONFIG_INLINE_WRITE_UNLOCK=y
180# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
181CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
182# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
183# CONFIG_MUTEX_SPIN_ON_OWNER is not set
152# CONFIG_FREEZER is not set 184# CONFIG_FREEZER is not set
153 185
154# 186#
@@ -224,8 +256,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
224# CONFIG_PHYS_ADDR_T_64BIT is not set 256# CONFIG_PHYS_ADDR_T_64BIT is not set
225CONFIG_ZONE_DMA_FLAG=0 257CONFIG_ZONE_DMA_FLAG=0
226CONFIG_NR_QUICK=2 258CONFIG_NR_QUICK=2
227CONFIG_HAVE_MLOCK=y
228CONFIG_HAVE_MLOCKED_PAGE_BIT=y
229# CONFIG_KSM is not set 259# CONFIG_KSM is not set
230CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 260CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
231 261
@@ -311,7 +341,6 @@ CONFIG_GUSA=y
311CONFIG_ZERO_PAGE_OFFSET=0x00010000 341CONFIG_ZERO_PAGE_OFFSET=0x00010000
312CONFIG_BOOT_LINK_OFFSET=0x00800000 342CONFIG_BOOT_LINK_OFFSET=0x00800000
313CONFIG_ENTRY_OFFSET=0x00001000 343CONFIG_ENTRY_OFFSET=0x00001000
314# CONFIG_UBC_WAKEUP is not set
315CONFIG_CMDLINE_OVERWRITE=y 344CONFIG_CMDLINE_OVERWRITE=y
316# CONFIG_CMDLINE_EXTEND is not set 345# CONFIG_CMDLINE_EXTEND is not set
317CONFIG_CMDLINE="console=ttySC1,38400" 346CONFIG_CMDLINE="console=ttySC1,38400"
@@ -430,9 +459,6 @@ CONFIG_IP_NF_QUEUE=y
430# CONFIG_AF_RXRPC is not set 459# CONFIG_AF_RXRPC is not set
431CONFIG_WIRELESS=y 460CONFIG_WIRELESS=y
432# CONFIG_CFG80211 is not set 461# CONFIG_CFG80211 is not set
433CONFIG_CFG80211_DEFAULT_PS_VALUE=0
434# CONFIG_WIRELESS_OLD_REGULATORY is not set
435# CONFIG_WIRELESS_EXT is not set
436# CONFIG_LIB80211 is not set 462# CONFIG_LIB80211 is not set
437 463
438# 464#
@@ -537,6 +563,10 @@ CONFIG_MTD_RAM=y
537CONFIG_BLK_DEV=y 563CONFIG_BLK_DEV=y
538# CONFIG_BLK_DEV_COW_COMMON is not set 564# CONFIG_BLK_DEV_COW_COMMON is not set
539# CONFIG_BLK_DEV_LOOP is not set 565# CONFIG_BLK_DEV_LOOP is not set
566
567#
568# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
569#
540# CONFIG_BLK_DEV_NBD is not set 570# CONFIG_BLK_DEV_NBD is not set
541CONFIG_BLK_DEV_RAM=y 571CONFIG_BLK_DEV_RAM=y
542CONFIG_BLK_DEV_RAM_COUNT=16 572CONFIG_BLK_DEV_RAM_COUNT=16
@@ -591,11 +621,11 @@ CONFIG_MII=y
591# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 621# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
592# CONFIG_B44 is not set 622# CONFIG_B44 is not set
593# CONFIG_KS8842 is not set 623# CONFIG_KS8842 is not set
624# CONFIG_KS8851_MLL is not set
594CONFIG_NETDEV_1000=y 625CONFIG_NETDEV_1000=y
595CONFIG_NETDEV_10000=y 626CONFIG_NETDEV_10000=y
596CONFIG_WLAN=y 627CONFIG_WLAN=y
597# CONFIG_WLAN_PRE80211 is not set 628# CONFIG_HOSTAP is not set
598# CONFIG_WLAN_80211 is not set
599 629
600# 630#
601# Enable WiMAX (Networking options) to see the WiMAX drivers 631# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -693,6 +723,7 @@ CONFIG_SSB_POSSIBLE=y
693# 723#
694# CONFIG_MFD_CORE is not set 724# CONFIG_MFD_CORE is not set
695# CONFIG_MFD_SM501 is not set 725# CONFIG_MFD_SM501 is not set
726# CONFIG_MFD_SH_MOBILE_SDHI is not set
696# CONFIG_HTC_PASIC3 is not set 727# CONFIG_HTC_PASIC3 is not set
697# CONFIG_MFD_TMIO is not set 728# CONFIG_MFD_TMIO is not set
698# CONFIG_REGULATOR is not set 729# CONFIG_REGULATOR is not set
@@ -754,6 +785,7 @@ CONFIG_EXT2_FS=y
754# CONFIG_EXT2_FS_XIP is not set 785# CONFIG_EXT2_FS_XIP is not set
755# CONFIG_EXT3_FS is not set 786# CONFIG_EXT3_FS is not set
756# CONFIG_EXT4_FS is not set 787# CONFIG_EXT4_FS is not set
788CONFIG_EXT4_USE_FOR_EXT23=y
757# CONFIG_REISERFS_FS is not set 789# CONFIG_REISERFS_FS is not set
758# CONFIG_JFS_FS is not set 790# CONFIG_JFS_FS is not set
759# CONFIG_FS_POSIX_ACL is not set 791# CONFIG_FS_POSIX_ACL is not set
@@ -863,10 +895,11 @@ CONFIG_FRAME_WARN=1024
863# CONFIG_DEBUG_FS is not set 895# CONFIG_DEBUG_FS is not set
864# CONFIG_HEADERS_CHECK is not set 896# CONFIG_HEADERS_CHECK is not set
865# CONFIG_DEBUG_KERNEL is not set 897# CONFIG_DEBUG_KERNEL is not set
866# CONFIG_DEBUG_BUGVERBOSE is not set 898CONFIG_DEBUG_BUGVERBOSE=y
867# CONFIG_DEBUG_MEMORY_INIT is not set 899# CONFIG_DEBUG_MEMORY_INIT is not set
868# CONFIG_RCU_CPU_STALL_DETECTOR is not set 900# CONFIG_RCU_CPU_STALL_DETECTOR is not set
869# CONFIG_LATENCYTOP is not set 901# CONFIG_LATENCYTOP is not set
902# CONFIG_SYSCTL_SYSCALL_CHECK is not set
870CONFIG_HAVE_FUNCTION_TRACER=y 903CONFIG_HAVE_FUNCTION_TRACER=y
871CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 904CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
872CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 905CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -879,7 +912,6 @@ CONFIG_TRACING_SUPPORT=y
879# CONFIG_SAMPLES is not set 912# CONFIG_SAMPLES is not set
880CONFIG_HAVE_ARCH_KGDB=y 913CONFIG_HAVE_ARCH_KGDB=y
881# CONFIG_SH_STANDARD_BIOS is not set 914# CONFIG_SH_STANDARD_BIOS is not set
882# CONFIG_EARLY_SCIF_CONSOLE is not set
883# CONFIG_DWARF_UNWINDER is not set 915# CONFIG_DWARF_UNWINDER is not set
884 916
885# 917#
@@ -888,7 +920,11 @@ CONFIG_HAVE_ARCH_KGDB=y
888# CONFIG_KEYS is not set 920# CONFIG_KEYS is not set
889# CONFIG_SECURITY is not set 921# CONFIG_SECURITY is not set
890# CONFIG_SECURITYFS is not set 922# CONFIG_SECURITYFS is not set
891# CONFIG_SECURITY_FILE_CAPABILITIES is not set 923# CONFIG_DEFAULT_SECURITY_SELINUX is not set
924# CONFIG_DEFAULT_SECURITY_SMACK is not set
925# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
926CONFIG_DEFAULT_SECURITY_DAC=y
927CONFIG_DEFAULT_SECURITY=""
892CONFIG_CRYPTO=y 928CONFIG_CRYPTO=y
893 929
894# 930#
diff --git a/arch/sh/configs/se7780_defconfig b/arch/sh/configs/se7780_defconfig
index 82baeef40a96..58533d50f06e 100644
--- a/arch/sh/configs/se7780_defconfig
+++ b/arch/sh/configs/se7780_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:03:59 2009 4# Mon Jan 4 14:40:32 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -59,6 +61,7 @@ CONFIG_SYSVIPC_SYSCTL=y
59# 61#
60CONFIG_TREE_RCU=y 62CONFIG_TREE_RCU=y
61# CONFIG_TREE_PREEMPT_RCU is not set 63# CONFIG_TREE_PREEMPT_RCU is not set
64# CONFIG_TINY_RCU is not set
62# CONFIG_RCU_TRACE is not set 65# CONFIG_RCU_TRACE is not set
63CONFIG_RCU_FANOUT=32 66CONFIG_RCU_FANOUT=32
64# CONFIG_RCU_FANOUT_EXACT is not set 67# CONFIG_RCU_FANOUT_EXACT is not set
@@ -92,6 +95,7 @@ CONFIG_EVENTFD=y
92CONFIG_SHMEM=y 95CONFIG_SHMEM=y
93CONFIG_AIO=y 96CONFIG_AIO=y
94CONFIG_HAVE_PERF_EVENTS=y 97CONFIG_HAVE_PERF_EVENTS=y
98CONFIG_PERF_USE_VMALLOC=y
95 99
96# 100#
97# Kernel Performance Events And Counters 101# Kernel Performance Events And Counters
@@ -110,6 +114,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
110CONFIG_HAVE_KPROBES=y 114CONFIG_HAVE_KPROBES=y
111CONFIG_HAVE_KRETPROBES=y 115CONFIG_HAVE_KRETPROBES=y
112CONFIG_HAVE_ARCH_TRACEHOOK=y 116CONFIG_HAVE_ARCH_TRACEHOOK=y
117CONFIG_HAVE_DMA_ATTRS=y
113CONFIG_HAVE_CLK=y 118CONFIG_HAVE_CLK=y
114CONFIG_HAVE_DMA_API_DEBUG=y 119CONFIG_HAVE_DMA_API_DEBUG=y
115 120
@@ -136,14 +141,41 @@ CONFIG_BLK_DEV_BSG=y
136# IO Schedulers 141# IO Schedulers
137# 142#
138CONFIG_IOSCHED_NOOP=y 143CONFIG_IOSCHED_NOOP=y
139# CONFIG_IOSCHED_AS is not set
140CONFIG_IOSCHED_DEADLINE=y 144CONFIG_IOSCHED_DEADLINE=y
141# CONFIG_IOSCHED_CFQ is not set 145# CONFIG_IOSCHED_CFQ is not set
142# CONFIG_DEFAULT_AS is not set
143CONFIG_DEFAULT_DEADLINE=y 146CONFIG_DEFAULT_DEADLINE=y
144# CONFIG_DEFAULT_CFQ is not set 147# CONFIG_DEFAULT_CFQ is not set
145# CONFIG_DEFAULT_NOOP is not set 148# CONFIG_DEFAULT_NOOP is not set
146CONFIG_DEFAULT_IOSCHED="deadline" 149CONFIG_DEFAULT_IOSCHED="deadline"
150# CONFIG_INLINE_SPIN_TRYLOCK is not set
151# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
152# CONFIG_INLINE_SPIN_LOCK is not set
153# CONFIG_INLINE_SPIN_LOCK_BH is not set
154# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
155# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
156CONFIG_INLINE_SPIN_UNLOCK=y
157# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
158CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
159# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
160# CONFIG_INLINE_READ_TRYLOCK is not set
161# CONFIG_INLINE_READ_LOCK is not set
162# CONFIG_INLINE_READ_LOCK_BH is not set
163# CONFIG_INLINE_READ_LOCK_IRQ is not set
164# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
165CONFIG_INLINE_READ_UNLOCK=y
166# CONFIG_INLINE_READ_UNLOCK_BH is not set
167CONFIG_INLINE_READ_UNLOCK_IRQ=y
168# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
169# CONFIG_INLINE_WRITE_TRYLOCK is not set
170# CONFIG_INLINE_WRITE_LOCK is not set
171# CONFIG_INLINE_WRITE_LOCK_BH is not set
172# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
173# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
174CONFIG_INLINE_WRITE_UNLOCK=y
175# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
176CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
177# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
178# CONFIG_MUTEX_SPIN_ON_OWNER is not set
147# CONFIG_FREEZER is not set 179# CONFIG_FREEZER is not set
148 180
149# 181#
@@ -222,8 +254,6 @@ CONFIG_MIGRATION=y
222# CONFIG_PHYS_ADDR_T_64BIT is not set 254# CONFIG_PHYS_ADDR_T_64BIT is not set
223CONFIG_ZONE_DMA_FLAG=0 255CONFIG_ZONE_DMA_FLAG=0
224CONFIG_NR_QUICK=2 256CONFIG_NR_QUICK=2
225CONFIG_HAVE_MLOCK=y
226CONFIG_HAVE_MLOCKED_PAGE_BIT=y
227# CONFIG_KSM is not set 257# CONFIG_KSM is not set
228CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 258CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
229 259
@@ -313,7 +343,6 @@ CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
313# Bus options 343# Bus options
314# 344#
315CONFIG_PCI=y 345CONFIG_PCI=y
316CONFIG_SH_PCIDMA_NONCOHERENT=y
317# CONFIG_PCIEPORTBUS is not set 346# CONFIG_PCIEPORTBUS is not set
318# CONFIG_ARCH_SUPPORTS_MSI is not set 347# CONFIG_ARCH_SUPPORTS_MSI is not set
319CONFIG_PCI_LEGACY=y 348CONFIG_PCI_LEGACY=y
@@ -401,9 +430,6 @@ CONFIG_IPV6=y
401# CONFIG_BT is not set 430# CONFIG_BT is not set
402CONFIG_WIRELESS=y 431CONFIG_WIRELESS=y
403# CONFIG_CFG80211 is not set 432# CONFIG_CFG80211 is not set
404CONFIG_CFG80211_DEFAULT_PS_VALUE=0
405# CONFIG_WIRELESS_OLD_REGULATORY is not set
406# CONFIG_WIRELESS_EXT is not set
407# CONFIG_LIB80211 is not set 433# CONFIG_LIB80211 is not set
408 434
409# 435#
@@ -517,6 +543,10 @@ CONFIG_BLK_DEV=y
517# CONFIG_BLK_DEV_COW_COMMON is not set 543# CONFIG_BLK_DEV_COW_COMMON is not set
518CONFIG_BLK_DEV_LOOP=y 544CONFIG_BLK_DEV_LOOP=y
519# CONFIG_BLK_DEV_CRYPTOLOOP is not set 545# CONFIG_BLK_DEV_CRYPTOLOOP is not set
546
547#
548# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
549#
520# CONFIG_BLK_DEV_NBD is not set 550# CONFIG_BLK_DEV_NBD is not set
521# CONFIG_BLK_DEV_SX8 is not set 551# CONFIG_BLK_DEV_SX8 is not set
522# CONFIG_BLK_DEV_UB is not set 552# CONFIG_BLK_DEV_UB is not set
@@ -574,8 +604,11 @@ CONFIG_SCSI_WAIT_SCAN=m
574CONFIG_SCSI_LOWLEVEL=y 604CONFIG_SCSI_LOWLEVEL=y
575# CONFIG_ISCSI_TCP is not set 605# CONFIG_ISCSI_TCP is not set
576# CONFIG_SCSI_BNX2_ISCSI is not set 606# CONFIG_SCSI_BNX2_ISCSI is not set
607# CONFIG_BE2ISCSI is not set
577# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 608# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
609# CONFIG_SCSI_HPSA is not set
578# CONFIG_SCSI_3W_9XXX is not set 610# CONFIG_SCSI_3W_9XXX is not set
611# CONFIG_SCSI_3W_SAS is not set
579# CONFIG_SCSI_ACARD is not set 612# CONFIG_SCSI_ACARD is not set
580# CONFIG_SCSI_AACRAID is not set 613# CONFIG_SCSI_AACRAID is not set
581# CONFIG_SCSI_AIC7XXX is not set 614# CONFIG_SCSI_AIC7XXX is not set
@@ -608,7 +641,9 @@ CONFIG_SCSI_LOWLEVEL=y
608# CONFIG_SCSI_NSP32 is not set 641# CONFIG_SCSI_NSP32 is not set
609# CONFIG_SCSI_DEBUG is not set 642# CONFIG_SCSI_DEBUG is not set
610# CONFIG_SCSI_PMCRAID is not set 643# CONFIG_SCSI_PMCRAID is not set
644# CONFIG_SCSI_PM8001 is not set
611# CONFIG_SCSI_SRP is not set 645# CONFIG_SCSI_SRP is not set
646# CONFIG_SCSI_BFA_FC is not set
612# CONFIG_SCSI_DH is not set 647# CONFIG_SCSI_DH is not set
613# CONFIG_SCSI_OSD_INITIATOR is not set 648# CONFIG_SCSI_OSD_INITIATOR is not set
614CONFIG_ATA=y 649CONFIG_ATA=y
@@ -642,6 +677,8 @@ CONFIG_SATA_SIL=y
642# CONFIG_PATA_EFAR is not set 677# CONFIG_PATA_EFAR is not set
643# CONFIG_ATA_GENERIC is not set 678# CONFIG_ATA_GENERIC is not set
644# CONFIG_PATA_HPT366 is not set 679# CONFIG_PATA_HPT366 is not set
680# CONFIG_PATA_HPT37X is not set
681# CONFIG_PATA_HPT3X2N is not set
645# CONFIG_PATA_HPT3X3 is not set 682# CONFIG_PATA_HPT3X3 is not set
646# CONFIG_PATA_IT821X is not set 683# CONFIG_PATA_IT821X is not set
647# CONFIG_PATA_JMICRON is not set 684# CONFIG_PATA_JMICRON is not set
@@ -650,14 +687,15 @@ CONFIG_SATA_SIL=y
650# CONFIG_PATA_MPIIX is not set 687# CONFIG_PATA_MPIIX is not set
651# CONFIG_PATA_OLDPIIX is not set 688# CONFIG_PATA_OLDPIIX is not set
652# CONFIG_PATA_NETCELL is not set 689# CONFIG_PATA_NETCELL is not set
690# CONFIG_PATA_NINJA32 is not set
653# CONFIG_PATA_NS87410 is not set 691# CONFIG_PATA_NS87410 is not set
654# CONFIG_PATA_NS87415 is not set 692# CONFIG_PATA_NS87415 is not set
693# CONFIG_PATA_PDC2027X is not set
655# CONFIG_PATA_PDC_OLD is not set 694# CONFIG_PATA_PDC_OLD is not set
656# CONFIG_PATA_RDC is not set 695# CONFIG_PATA_RDC is not set
657# CONFIG_PATA_RZ1000 is not set 696# CONFIG_PATA_RZ1000 is not set
658# CONFIG_PATA_SC1200 is not set 697# CONFIG_PATA_SC1200 is not set
659# CONFIG_PATA_SERVERWORKS is not set 698# CONFIG_PATA_SERVERWORKS is not set
660# CONFIG_PATA_PDC2027X is not set
661# CONFIG_PATA_SIL680 is not set 699# CONFIG_PATA_SIL680 is not set
662# CONFIG_PATA_SIS is not set 700# CONFIG_PATA_SIS is not set
663# CONFIG_PATA_VIA is not set 701# CONFIG_PATA_VIA is not set
@@ -748,14 +786,16 @@ CONFIG_NET_PCI=y
748# CONFIG_SUNDANCE is not set 786# CONFIG_SUNDANCE is not set
749# CONFIG_TLAN is not set 787# CONFIG_TLAN is not set
750# CONFIG_KS8842 is not set 788# CONFIG_KS8842 is not set
789# CONFIG_KS8851_MLL is not set
751# CONFIG_VIA_RHINE is not set 790# CONFIG_VIA_RHINE is not set
752# CONFIG_ATL2 is not set 791# CONFIG_ATL2 is not set
753# CONFIG_NETDEV_1000 is not set 792# CONFIG_NETDEV_1000 is not set
754# CONFIG_NETDEV_10000 is not set 793# CONFIG_NETDEV_10000 is not set
755# CONFIG_TR is not set 794# CONFIG_TR is not set
756CONFIG_WLAN=y 795CONFIG_WLAN=y
757# CONFIG_WLAN_PRE80211 is not set 796# CONFIG_ATMEL is not set
758# CONFIG_WLAN_80211 is not set 797# CONFIG_USB_ZD1201 is not set
798# CONFIG_HOSTAP is not set
759 799
760# 800#
761# Enable WiMAX (Networking options) to see the WiMAX drivers 801# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -774,6 +814,7 @@ CONFIG_WLAN=y
774# CONFIG_NET_FC is not set 814# CONFIG_NET_FC is not set
775# CONFIG_NETPOLL is not set 815# CONFIG_NETPOLL is not set
776# CONFIG_NET_POLL_CONTROLLER is not set 816# CONFIG_NET_POLL_CONTROLLER is not set
817# CONFIG_VMXNET3 is not set
777# CONFIG_ISDN is not set 818# CONFIG_ISDN is not set
778# CONFIG_PHONE is not set 819# CONFIG_PHONE is not set
779 820
@@ -783,6 +824,7 @@ CONFIG_WLAN=y
783CONFIG_INPUT=y 824CONFIG_INPUT=y
784CONFIG_INPUT_FF_MEMLESS=m 825CONFIG_INPUT_FF_MEMLESS=m
785# CONFIG_INPUT_POLLDEV is not set 826# CONFIG_INPUT_POLLDEV is not set
827# CONFIG_INPUT_SPARSEKMAP is not set
786 828
787# 829#
788# Userland interfaces 830# Userland interfaces
@@ -883,6 +925,7 @@ CONFIG_SSB_POSSIBLE=y
883# 925#
884# CONFIG_MFD_CORE is not set 926# CONFIG_MFD_CORE is not set
885# CONFIG_MFD_SM501 is not set 927# CONFIG_MFD_SM501 is not set
928# CONFIG_MFD_SH_MOBILE_SDHI is not set
886# CONFIG_HTC_PASIC3 is not set 929# CONFIG_HTC_PASIC3 is not set
887# CONFIG_MFD_TMIO is not set 930# CONFIG_MFD_TMIO is not set
888# CONFIG_REGULATOR is not set 931# CONFIG_REGULATOR is not set
@@ -1149,6 +1192,7 @@ CONFIG_EXT2_FS=y
1149# CONFIG_EXT2_FS_XIP is not set 1192# CONFIG_EXT2_FS_XIP is not set
1150# CONFIG_EXT3_FS is not set 1193# CONFIG_EXT3_FS is not set
1151# CONFIG_EXT4_FS is not set 1194# CONFIG_EXT4_FS is not set
1195CONFIG_EXT4_USE_FOR_EXT23=y
1152# CONFIG_REISERFS_FS is not set 1196# CONFIG_REISERFS_FS is not set
1153# CONFIG_JFS_FS is not set 1197# CONFIG_JFS_FS is not set
1154# CONFIG_FS_POSIX_ACL is not set 1198# CONFIG_FS_POSIX_ACL is not set
@@ -1285,7 +1329,7 @@ CONFIG_FRAME_WARN=1024
1285CONFIG_DEBUG_FS=y 1329CONFIG_DEBUG_FS=y
1286# CONFIG_HEADERS_CHECK is not set 1330# CONFIG_HEADERS_CHECK is not set
1287# CONFIG_DEBUG_KERNEL is not set 1331# CONFIG_DEBUG_KERNEL is not set
1288# CONFIG_DEBUG_BUGVERBOSE is not set 1332CONFIG_DEBUG_BUGVERBOSE=y
1289# CONFIG_DEBUG_MEMORY_INIT is not set 1333# CONFIG_DEBUG_MEMORY_INIT is not set
1290# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1334# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1291# CONFIG_LATENCYTOP is not set 1335# CONFIG_LATENCYTOP is not set
@@ -1303,7 +1347,6 @@ CONFIG_TRACING_SUPPORT=y
1303# CONFIG_SAMPLES is not set 1347# CONFIG_SAMPLES is not set
1304CONFIG_HAVE_ARCH_KGDB=y 1348CONFIG_HAVE_ARCH_KGDB=y
1305# CONFIG_SH_STANDARD_BIOS is not set 1349# CONFIG_SH_STANDARD_BIOS is not set
1306# CONFIG_EARLY_SCIF_CONSOLE is not set
1307# CONFIG_DWARF_UNWINDER is not set 1350# CONFIG_DWARF_UNWINDER is not set
1308 1351
1309# 1352#
@@ -1312,7 +1355,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1312# CONFIG_KEYS is not set 1355# CONFIG_KEYS is not set
1313# CONFIG_SECURITY is not set 1356# CONFIG_SECURITY is not set
1314# CONFIG_SECURITYFS is not set 1357# CONFIG_SECURITYFS is not set
1315# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1358# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1359# CONFIG_DEFAULT_SECURITY_SMACK is not set
1360# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1361CONFIG_DEFAULT_SECURITY_DAC=y
1362CONFIG_DEFAULT_SECURITY=""
1316CONFIG_CRYPTO=y 1363CONFIG_CRYPTO=y
1317 1364
1318# 1365#
diff --git a/arch/sh/configs/sh03_defconfig b/arch/sh/configs/sh03_defconfig
index dd0e8900afb7..666fde110b27 100644
--- a/arch/sh/configs/sh03_defconfig
+++ b/arch/sh/configs/sh03_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:07:14 2009 4# Mon Jan 4 14:41:25 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -21,6 +21,7 @@ CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_GENERIC_CMOS_UPDATE=y 21CONFIG_GENERIC_CMOS_UPDATE=y
22# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 22# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
23CONFIG_ARCH_HIBERNATION_POSSIBLE=y 23CONFIG_ARCH_HIBERNATION_POSSIBLE=y
24CONFIG_SYS_SUPPORTS_HUGETLBFS=y
24CONFIG_SYS_SUPPORTS_PCI=y 25CONFIG_SYS_SUPPORTS_PCI=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
26CONFIG_STACKTRACE_SUPPORT=y 27CONFIG_STACKTRACE_SUPPORT=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -64,6 +66,7 @@ CONFIG_BSD_PROCESS_ACCT=y
64# 66#
65CONFIG_TREE_RCU=y 67CONFIG_TREE_RCU=y
66# CONFIG_TREE_PREEMPT_RCU is not set 68# CONFIG_TREE_PREEMPT_RCU is not set
69# CONFIG_TINY_RCU is not set
67# CONFIG_RCU_TRACE is not set 70# CONFIG_RCU_TRACE is not set
68CONFIG_RCU_FANOUT=32 71CONFIG_RCU_FANOUT=32
69# CONFIG_RCU_FANOUT_EXACT is not set 72# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +105,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 105CONFIG_SHMEM=y
103CONFIG_AIO=y 106CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 107CONFIG_HAVE_PERF_EVENTS=y
108CONFIG_PERF_USE_VMALLOC=y
105 109
106# 110#
107# Kernel Performance Events And Counters 111# Kernel Performance Events And Counters
@@ -124,6 +128,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
124CONFIG_HAVE_KPROBES=y 128CONFIG_HAVE_KPROBES=y
125CONFIG_HAVE_KRETPROBES=y 129CONFIG_HAVE_KRETPROBES=y
126CONFIG_HAVE_ARCH_TRACEHOOK=y 130CONFIG_HAVE_ARCH_TRACEHOOK=y
131CONFIG_HAVE_DMA_ATTRS=y
127CONFIG_HAVE_CLK=y 132CONFIG_HAVE_CLK=y
128CONFIG_HAVE_DMA_API_DEBUG=y 133CONFIG_HAVE_DMA_API_DEBUG=y
129 134
@@ -151,14 +156,41 @@ CONFIG_LBDAF=y
151# IO Schedulers 156# IO Schedulers
152# 157#
153CONFIG_IOSCHED_NOOP=y 158CONFIG_IOSCHED_NOOP=y
154CONFIG_IOSCHED_AS=y
155CONFIG_IOSCHED_DEADLINE=y 159CONFIG_IOSCHED_DEADLINE=y
156CONFIG_IOSCHED_CFQ=y 160CONFIG_IOSCHED_CFQ=y
157CONFIG_DEFAULT_AS=y
158# CONFIG_DEFAULT_DEADLINE is not set 161# CONFIG_DEFAULT_DEADLINE is not set
159# CONFIG_DEFAULT_CFQ is not set 162CONFIG_DEFAULT_CFQ=y
160# CONFIG_DEFAULT_NOOP is not set 163# CONFIG_DEFAULT_NOOP is not set
161CONFIG_DEFAULT_IOSCHED="anticipatory" 164CONFIG_DEFAULT_IOSCHED="cfq"
165# CONFIG_INLINE_SPIN_TRYLOCK is not set
166# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
167# CONFIG_INLINE_SPIN_LOCK is not set
168# CONFIG_INLINE_SPIN_LOCK_BH is not set
169# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
170# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
171# CONFIG_INLINE_SPIN_UNLOCK is not set
172# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
173# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
174# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
175# CONFIG_INLINE_READ_TRYLOCK is not set
176# CONFIG_INLINE_READ_LOCK is not set
177# CONFIG_INLINE_READ_LOCK_BH is not set
178# CONFIG_INLINE_READ_LOCK_IRQ is not set
179# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
180# CONFIG_INLINE_READ_UNLOCK is not set
181# CONFIG_INLINE_READ_UNLOCK_BH is not set
182# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
183# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
184# CONFIG_INLINE_WRITE_TRYLOCK is not set
185# CONFIG_INLINE_WRITE_LOCK is not set
186# CONFIG_INLINE_WRITE_LOCK_BH is not set
187# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
188# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
189# CONFIG_INLINE_WRITE_UNLOCK is not set
190# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
191# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
192# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
193# CONFIG_MUTEX_SPIN_ON_OWNER is not set
162# CONFIG_FREEZER is not set 194# CONFIG_FREEZER is not set
163 195
164# 196#
@@ -234,8 +266,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
234# CONFIG_PHYS_ADDR_T_64BIT is not set 266# CONFIG_PHYS_ADDR_T_64BIT is not set
235CONFIG_ZONE_DMA_FLAG=0 267CONFIG_ZONE_DMA_FLAG=0
236CONFIG_NR_QUICK=2 268CONFIG_NR_QUICK=2
237CONFIG_HAVE_MLOCK=y
238CONFIG_HAVE_MLOCKED_PAGE_BIT=y
239# CONFIG_KSM is not set 269# CONFIG_KSM is not set
240CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 270CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
241 271
@@ -320,7 +350,6 @@ CONFIG_GUSA=y
320CONFIG_ZERO_PAGE_OFFSET=0x00004000 350CONFIG_ZERO_PAGE_OFFSET=0x00004000
321CONFIG_BOOT_LINK_OFFSET=0x00800000 351CONFIG_BOOT_LINK_OFFSET=0x00800000
322CONFIG_ENTRY_OFFSET=0x00001000 352CONFIG_ENTRY_OFFSET=0x00001000
323# CONFIG_UBC_WAKEUP is not set
324CONFIG_CMDLINE_OVERWRITE=y 353CONFIG_CMDLINE_OVERWRITE=y
325# CONFIG_CMDLINE_EXTEND is not set 354# CONFIG_CMDLINE_EXTEND is not set
326CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs" 355CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs"
@@ -329,7 +358,6 @@ CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs"
329# Bus options 358# Bus options
330# 359#
331CONFIG_PCI=y 360CONFIG_PCI=y
332CONFIG_SH_PCIDMA_NONCOHERENT=y
333# CONFIG_PCIEPORTBUS is not set 361# CONFIG_PCIEPORTBUS is not set
334# CONFIG_ARCH_SUPPORTS_MSI is not set 362# CONFIG_ARCH_SUPPORTS_MSI is not set
335CONFIG_PCI_LEGACY=y 363CONFIG_PCI_LEGACY=y
@@ -433,9 +461,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
433# CONFIG_AF_RXRPC is not set 461# CONFIG_AF_RXRPC is not set
434CONFIG_WIRELESS=y 462CONFIG_WIRELESS=y
435# CONFIG_CFG80211 is not set 463# CONFIG_CFG80211 is not set
436CONFIG_CFG80211_DEFAULT_PS_VALUE=0
437# CONFIG_WIRELESS_OLD_REGULATORY is not set
438# CONFIG_WIRELESS_EXT is not set
439# CONFIG_LIB80211 is not set 464# CONFIG_LIB80211 is not set
440 465
441# 466#
@@ -468,6 +493,10 @@ CONFIG_BLK_DEV=y
468# CONFIG_BLK_DEV_COW_COMMON is not set 493# CONFIG_BLK_DEV_COW_COMMON is not set
469CONFIG_BLK_DEV_LOOP=y 494CONFIG_BLK_DEV_LOOP=y
470# CONFIG_BLK_DEV_CRYPTOLOOP is not set 495# CONFIG_BLK_DEV_CRYPTOLOOP is not set
496
497#
498# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
499#
471CONFIG_BLK_DEV_NBD=y 500CONFIG_BLK_DEV_NBD=y
472# CONFIG_BLK_DEV_SX8 is not set 501# CONFIG_BLK_DEV_SX8 is not set
473CONFIG_BLK_DEV_RAM=y 502CONFIG_BLK_DEV_RAM=y
@@ -580,8 +609,11 @@ CONFIG_SCSI_LOWLEVEL=y
580# CONFIG_ISCSI_TCP is not set 609# CONFIG_ISCSI_TCP is not set
581# CONFIG_SCSI_CXGB3_ISCSI is not set 610# CONFIG_SCSI_CXGB3_ISCSI is not set
582# CONFIG_SCSI_BNX2_ISCSI is not set 611# CONFIG_SCSI_BNX2_ISCSI is not set
612# CONFIG_BE2ISCSI is not set
583# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 613# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
614# CONFIG_SCSI_HPSA is not set
584# CONFIG_SCSI_3W_9XXX is not set 615# CONFIG_SCSI_3W_9XXX is not set
616# CONFIG_SCSI_3W_SAS is not set
585# CONFIG_SCSI_ACARD is not set 617# CONFIG_SCSI_ACARD is not set
586# CONFIG_SCSI_AACRAID is not set 618# CONFIG_SCSI_AACRAID is not set
587# CONFIG_SCSI_AIC7XXX is not set 619# CONFIG_SCSI_AIC7XXX is not set
@@ -614,7 +646,9 @@ CONFIG_SCSI_LOWLEVEL=y
614# CONFIG_SCSI_NSP32 is not set 646# CONFIG_SCSI_NSP32 is not set
615# CONFIG_SCSI_DEBUG is not set 647# CONFIG_SCSI_DEBUG is not set
616# CONFIG_SCSI_PMCRAID is not set 648# CONFIG_SCSI_PMCRAID is not set
649# CONFIG_SCSI_PM8001 is not set
617# CONFIG_SCSI_SRP is not set 650# CONFIG_SCSI_SRP is not set
651# CONFIG_SCSI_BFA_FC is not set
618# CONFIG_SCSI_DH is not set 652# CONFIG_SCSI_DH is not set
619# CONFIG_SCSI_OSD_INITIATOR is not set 653# CONFIG_SCSI_OSD_INITIATOR is not set
620# CONFIG_ATA is not set 654# CONFIG_ATA is not set
@@ -685,6 +719,7 @@ CONFIG_8139CP=y
685# CONFIG_SUNDANCE is not set 719# CONFIG_SUNDANCE is not set
686# CONFIG_TLAN is not set 720# CONFIG_TLAN is not set
687# CONFIG_KS8842 is not set 721# CONFIG_KS8842 is not set
722# CONFIG_KS8851_MLL is not set
688# CONFIG_VIA_RHINE is not set 723# CONFIG_VIA_RHINE is not set
689# CONFIG_SC92031 is not set 724# CONFIG_SC92031 is not set
690# CONFIG_ATL2 is not set 725# CONFIG_ATL2 is not set
@@ -733,8 +768,9 @@ CONFIG_CHELSIO_T3_DEPENDS=y
733# CONFIG_BE2NET is not set 768# CONFIG_BE2NET is not set
734# CONFIG_TR is not set 769# CONFIG_TR is not set
735CONFIG_WLAN=y 770CONFIG_WLAN=y
736# CONFIG_WLAN_PRE80211 is not set 771# CONFIG_ATMEL is not set
737# CONFIG_WLAN_80211 is not set 772# CONFIG_PRISM54 is not set
773# CONFIG_HOSTAP is not set
738 774
739# 775#
740# Enable WiMAX (Networking options) to see the WiMAX drivers 776# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -748,6 +784,7 @@ CONFIG_WLAN=y
748# CONFIG_NETCONSOLE is not set 784# CONFIG_NETCONSOLE is not set
749# CONFIG_NETPOLL is not set 785# CONFIG_NETPOLL is not set
750# CONFIG_NET_POLL_CONTROLLER is not set 786# CONFIG_NET_POLL_CONTROLLER is not set
787# CONFIG_VMXNET3 is not set
751# CONFIG_ISDN is not set 788# CONFIG_ISDN is not set
752# CONFIG_PHONE is not set 789# CONFIG_PHONE is not set
753 790
@@ -757,6 +794,7 @@ CONFIG_WLAN=y
757CONFIG_INPUT=y 794CONFIG_INPUT=y
758# CONFIG_INPUT_FF_MEMLESS is not set 795# CONFIG_INPUT_FF_MEMLESS is not set
759# CONFIG_INPUT_POLLDEV is not set 796# CONFIG_INPUT_POLLDEV is not set
797# CONFIG_INPUT_SPARSEKMAP is not set
760 798
761# 799#
762# Userland interfaces 800# Userland interfaces
@@ -886,6 +924,7 @@ CONFIG_SSB_POSSIBLE=y
886# 924#
887# CONFIG_MFD_CORE is not set 925# CONFIG_MFD_CORE is not set
888# CONFIG_MFD_SM501 is not set 926# CONFIG_MFD_SM501 is not set
927# CONFIG_MFD_SH_MOBILE_SDHI is not set
889# CONFIG_HTC_PASIC3 is not set 928# CONFIG_HTC_PASIC3 is not set
890# CONFIG_MFD_TMIO is not set 929# CONFIG_MFD_TMIO is not set
891# CONFIG_REGULATOR is not set 930# CONFIG_REGULATOR is not set
@@ -1149,10 +1188,11 @@ CONFIG_DEBUG_FS=y
1149# CONFIG_HEADERS_CHECK is not set 1188# CONFIG_HEADERS_CHECK is not set
1150# CONFIG_DEBUG_KERNEL is not set 1189# CONFIG_DEBUG_KERNEL is not set
1151CONFIG_STACKTRACE=y 1190CONFIG_STACKTRACE=y
1152# CONFIG_DEBUG_BUGVERBOSE is not set 1191CONFIG_DEBUG_BUGVERBOSE=y
1153# CONFIG_DEBUG_MEMORY_INIT is not set 1192# CONFIG_DEBUG_MEMORY_INIT is not set
1154# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1193# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1155# CONFIG_LATENCYTOP is not set 1194# CONFIG_LATENCYTOP is not set
1195# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1156CONFIG_NOP_TRACER=y 1196CONFIG_NOP_TRACER=y
1157CONFIG_HAVE_FUNCTION_TRACER=y 1197CONFIG_HAVE_FUNCTION_TRACER=y
1158CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1198CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1172,8 +1212,6 @@ CONFIG_TRACING_SUPPORT=y
1172# CONFIG_SAMPLES is not set 1212# CONFIG_SAMPLES is not set
1173CONFIG_HAVE_ARCH_KGDB=y 1213CONFIG_HAVE_ARCH_KGDB=y
1174CONFIG_SH_STANDARD_BIOS=y 1214CONFIG_SH_STANDARD_BIOS=y
1175# CONFIG_EARLY_SCIF_CONSOLE is not set
1176# CONFIG_EARLY_PRINTK is not set
1177# CONFIG_DWARF_UNWINDER is not set 1215# CONFIG_DWARF_UNWINDER is not set
1178 1216
1179# 1217#
@@ -1182,7 +1220,11 @@ CONFIG_SH_STANDARD_BIOS=y
1182# CONFIG_KEYS is not set 1220# CONFIG_KEYS is not set
1183# CONFIG_SECURITY is not set 1221# CONFIG_SECURITY is not set
1184# CONFIG_SECURITYFS is not set 1222# CONFIG_SECURITYFS is not set
1185# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1223# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1224# CONFIG_DEFAULT_SECURITY_SMACK is not set
1225# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1226CONFIG_DEFAULT_SECURITY_DAC=y
1227CONFIG_DEFAULT_SECURITY=""
1186CONFIG_CRYPTO=y 1228CONFIG_CRYPTO=y
1187 1229
1188# 1230#
diff --git a/arch/sh/configs/sh7710voipgw_defconfig b/arch/sh/configs/sh7710voipgw_defconfig
index 662156ec9211..35a3beeba182 100644
--- a/arch/sh/configs/sh7710voipgw_defconfig
+++ b/arch/sh/configs/sh7710voipgw_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:11:49 2009 4# Mon Jan 4 14:43:04 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -29,6 +29,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 29CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 30CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
32CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 34CONFIG_CONSTRUCTORS=y
34 35
@@ -60,6 +61,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
60# 61#
61CONFIG_TREE_RCU=y 62CONFIG_TREE_RCU=y
62# CONFIG_TREE_PREEMPT_RCU is not set 63# CONFIG_TREE_PREEMPT_RCU is not set
64# CONFIG_TINY_RCU is not set
63# CONFIG_RCU_TRACE is not set 65# CONFIG_RCU_TRACE is not set
64CONFIG_RCU_FANOUT=32 66CONFIG_RCU_FANOUT=32
65# CONFIG_RCU_FANOUT_EXACT is not set 67# CONFIG_RCU_FANOUT_EXACT is not set
@@ -98,6 +100,7 @@ CONFIG_EVENTFD=y
98# CONFIG_SHMEM is not set 100# CONFIG_SHMEM is not set
99CONFIG_AIO=y 101CONFIG_AIO=y
100CONFIG_HAVE_PERF_EVENTS=y 102CONFIG_HAVE_PERF_EVENTS=y
103CONFIG_PERF_USE_VMALLOC=y
101 104
102# 105#
103# Kernel Performance Events And Counters 106# Kernel Performance Events And Counters
@@ -116,6 +119,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
116CONFIG_HAVE_KPROBES=y 119CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y 120CONFIG_HAVE_KRETPROBES=y
118CONFIG_HAVE_ARCH_TRACEHOOK=y 121CONFIG_HAVE_ARCH_TRACEHOOK=y
122CONFIG_HAVE_DMA_ATTRS=y
119CONFIG_HAVE_CLK=y 123CONFIG_HAVE_CLK=y
120CONFIG_HAVE_DMA_API_DEBUG=y 124CONFIG_HAVE_DMA_API_DEBUG=y
121 125
@@ -142,14 +146,41 @@ CONFIG_LBDAF=y
142# IO Schedulers 146# IO Schedulers
143# 147#
144CONFIG_IOSCHED_NOOP=y 148CONFIG_IOSCHED_NOOP=y
145# CONFIG_IOSCHED_AS is not set
146CONFIG_IOSCHED_DEADLINE=y 149CONFIG_IOSCHED_DEADLINE=y
147# CONFIG_IOSCHED_CFQ is not set 150# CONFIG_IOSCHED_CFQ is not set
148# CONFIG_DEFAULT_AS is not set
149CONFIG_DEFAULT_DEADLINE=y 151CONFIG_DEFAULT_DEADLINE=y
150# CONFIG_DEFAULT_CFQ is not set 152# CONFIG_DEFAULT_CFQ is not set
151# CONFIG_DEFAULT_NOOP is not set 153# CONFIG_DEFAULT_NOOP is not set
152CONFIG_DEFAULT_IOSCHED="deadline" 154CONFIG_DEFAULT_IOSCHED="deadline"
155# CONFIG_INLINE_SPIN_TRYLOCK is not set
156# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
157# CONFIG_INLINE_SPIN_LOCK is not set
158# CONFIG_INLINE_SPIN_LOCK_BH is not set
159# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
160# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
161CONFIG_INLINE_SPIN_UNLOCK=y
162# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
163CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
164# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
165# CONFIG_INLINE_READ_TRYLOCK is not set
166# CONFIG_INLINE_READ_LOCK is not set
167# CONFIG_INLINE_READ_LOCK_BH is not set
168# CONFIG_INLINE_READ_LOCK_IRQ is not set
169# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
170CONFIG_INLINE_READ_UNLOCK=y
171# CONFIG_INLINE_READ_UNLOCK_BH is not set
172CONFIG_INLINE_READ_UNLOCK_IRQ=y
173# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
174# CONFIG_INLINE_WRITE_TRYLOCK is not set
175# CONFIG_INLINE_WRITE_LOCK is not set
176# CONFIG_INLINE_WRITE_LOCK_BH is not set
177# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
178# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
179CONFIG_INLINE_WRITE_UNLOCK=y
180# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
181CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
182# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
183# CONFIG_MUTEX_SPIN_ON_OWNER is not set
153# CONFIG_FREEZER is not set 184# CONFIG_FREEZER is not set
154 185
155# 186#
@@ -225,8 +256,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
225# CONFIG_PHYS_ADDR_T_64BIT is not set 256# CONFIG_PHYS_ADDR_T_64BIT is not set
226CONFIG_ZONE_DMA_FLAG=0 257CONFIG_ZONE_DMA_FLAG=0
227CONFIG_NR_QUICK=2 258CONFIG_NR_QUICK=2
228CONFIG_HAVE_MLOCK=y
229CONFIG_HAVE_MLOCKED_PAGE_BIT=y
230# CONFIG_KSM is not set 259# CONFIG_KSM is not set
231CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 260CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
232 261
@@ -460,9 +489,6 @@ CONFIG_NET_SCH_FIFO=y
460# CONFIG_AF_RXRPC is not set 489# CONFIG_AF_RXRPC is not set
461CONFIG_WIRELESS=y 490CONFIG_WIRELESS=y
462# CONFIG_CFG80211 is not set 491# CONFIG_CFG80211 is not set
463CONFIG_CFG80211_DEFAULT_PS_VALUE=0
464# CONFIG_WIRELESS_OLD_REGULATORY is not set
465# CONFIG_WIRELESS_EXT is not set
466# CONFIG_LIB80211 is not set 492# CONFIG_LIB80211 is not set
467 493
468# 494#
@@ -571,6 +597,10 @@ CONFIG_MTD_RAM=y
571CONFIG_BLK_DEV=y 597CONFIG_BLK_DEV=y
572# CONFIG_BLK_DEV_COW_COMMON is not set 598# CONFIG_BLK_DEV_COW_COMMON is not set
573# CONFIG_BLK_DEV_LOOP is not set 599# CONFIG_BLK_DEV_LOOP is not set
600
601#
602# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
603#
574# CONFIG_BLK_DEV_NBD is not set 604# CONFIG_BLK_DEV_NBD is not set
575# CONFIG_BLK_DEV_RAM is not set 605# CONFIG_BLK_DEV_RAM is not set
576# CONFIG_CDROM_PKTCDVD is not set 606# CONFIG_CDROM_PKTCDVD is not set
@@ -623,11 +653,11 @@ CONFIG_NET_ETHERNET=y
623# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 653# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
624# CONFIG_B44 is not set 654# CONFIG_B44 is not set
625# CONFIG_KS8842 is not set 655# CONFIG_KS8842 is not set
656# CONFIG_KS8851_MLL is not set
626CONFIG_NETDEV_1000=y 657CONFIG_NETDEV_1000=y
627CONFIG_NETDEV_10000=y 658CONFIG_NETDEV_10000=y
628CONFIG_WLAN=y 659CONFIG_WLAN=y
629# CONFIG_WLAN_PRE80211 is not set 660# CONFIG_HOSTAP is not set
630# CONFIG_WLAN_80211 is not set
631 661
632# 662#
633# Enable WiMAX (Networking options) to see the WiMAX drivers 663# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -647,6 +677,7 @@ CONFIG_PHONE=y
647CONFIG_INPUT=y 677CONFIG_INPUT=y
648# CONFIG_INPUT_FF_MEMLESS is not set 678# CONFIG_INPUT_FF_MEMLESS is not set
649# CONFIG_INPUT_POLLDEV is not set 679# CONFIG_INPUT_POLLDEV is not set
680# CONFIG_INPUT_SPARSEKMAP is not set
650 681
651# 682#
652# Userland interfaces 683# Userland interfaces
@@ -725,6 +756,7 @@ CONFIG_SSB_POSSIBLE=y
725# 756#
726# CONFIG_MFD_CORE is not set 757# CONFIG_MFD_CORE is not set
727# CONFIG_MFD_SM501 is not set 758# CONFIG_MFD_SM501 is not set
759# CONFIG_MFD_SH_MOBILE_SDHI is not set
728# CONFIG_HTC_PASIC3 is not set 760# CONFIG_HTC_PASIC3 is not set
729# CONFIG_MFD_TMIO is not set 761# CONFIG_MFD_TMIO is not set
730# CONFIG_REGULATOR is not set 762# CONFIG_REGULATOR is not set
@@ -792,6 +824,7 @@ CONFIG_RTC_LIB=y
792# CONFIG_EXT2_FS is not set 824# CONFIG_EXT2_FS is not set
793# CONFIG_EXT3_FS is not set 825# CONFIG_EXT3_FS is not set
794# CONFIG_EXT4_FS is not set 826# CONFIG_EXT4_FS is not set
827CONFIG_EXT4_USE_FOR_EXT23=y
795# CONFIG_REISERFS_FS is not set 828# CONFIG_REISERFS_FS is not set
796# CONFIG_JFS_FS is not set 829# CONFIG_JFS_FS is not set
797# CONFIG_FS_POSIX_ACL is not set 830# CONFIG_FS_POSIX_ACL is not set
@@ -836,7 +869,6 @@ CONFIG_PROC_FS=y
836CONFIG_PROC_SYSCTL=y 869CONFIG_PROC_SYSCTL=y
837CONFIG_PROC_PAGE_MONITOR=y 870CONFIG_PROC_PAGE_MONITOR=y
838CONFIG_SYSFS=y 871CONFIG_SYSFS=y
839# CONFIG_HUGETLBFS is not set
840# CONFIG_HUGETLB_PAGE is not set 872# CONFIG_HUGETLB_PAGE is not set
841# CONFIG_CONFIGFS_FS is not set 873# CONFIG_CONFIGFS_FS is not set
842CONFIG_MISC_FILESYSTEMS=y 874CONFIG_MISC_FILESYSTEMS=y
@@ -899,10 +931,11 @@ CONFIG_FRAME_WARN=1024
899CONFIG_DEBUG_FS=y 931CONFIG_DEBUG_FS=y
900# CONFIG_HEADERS_CHECK is not set 932# CONFIG_HEADERS_CHECK is not set
901# CONFIG_DEBUG_KERNEL is not set 933# CONFIG_DEBUG_KERNEL is not set
902# CONFIG_DEBUG_BUGVERBOSE is not set 934CONFIG_DEBUG_BUGVERBOSE=y
903# CONFIG_DEBUG_MEMORY_INIT is not set 935# CONFIG_DEBUG_MEMORY_INIT is not set
904# CONFIG_RCU_CPU_STALL_DETECTOR is not set 936# CONFIG_RCU_CPU_STALL_DETECTOR is not set
905# CONFIG_LATENCYTOP is not set 937# CONFIG_LATENCYTOP is not set
938# CONFIG_SYSCTL_SYSCALL_CHECK is not set
906CONFIG_HAVE_FUNCTION_TRACER=y 939CONFIG_HAVE_FUNCTION_TRACER=y
907CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 940CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
908CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 941CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -916,7 +949,6 @@ CONFIG_TRACING_SUPPORT=y
916# CONFIG_SAMPLES is not set 949# CONFIG_SAMPLES is not set
917CONFIG_HAVE_ARCH_KGDB=y 950CONFIG_HAVE_ARCH_KGDB=y
918# CONFIG_SH_STANDARD_BIOS is not set 951# CONFIG_SH_STANDARD_BIOS is not set
919# CONFIG_EARLY_SCIF_CONSOLE is not set
920# CONFIG_DWARF_UNWINDER is not set 952# CONFIG_DWARF_UNWINDER is not set
921 953
922# 954#
@@ -925,7 +957,11 @@ CONFIG_HAVE_ARCH_KGDB=y
925# CONFIG_KEYS is not set 957# CONFIG_KEYS is not set
926# CONFIG_SECURITY is not set 958# CONFIG_SECURITY is not set
927# CONFIG_SECURITYFS is not set 959# CONFIG_SECURITYFS is not set
928# CONFIG_SECURITY_FILE_CAPABILITIES is not set 960# CONFIG_DEFAULT_SECURITY_SELINUX is not set
961# CONFIG_DEFAULT_SECURITY_SMACK is not set
962# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
963CONFIG_DEFAULT_SECURITY_DAC=y
964CONFIG_DEFAULT_SECURITY=""
929CONFIG_CRYPTO=y 965CONFIG_CRYPTO=y
930 966
931# 967#
diff --git a/arch/sh/configs/sh7724_generic_defconfig b/arch/sh/configs/sh7724_generic_defconfig
index e06719a30ba1..a3056b69d2ba 100644
--- a/arch/sh/configs/sh7724_generic_defconfig
+++ b/arch/sh/configs/sh7724_generic_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:14:00 2009 4# Mon Jan 4 15:03:45 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_CMT=y 24CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -49,7 +51,6 @@ CONFIG_KERNEL_GZIP=y
49# CONFIG_KERNEL_LZMA is not set 51# CONFIG_KERNEL_LZMA is not set
50CONFIG_SWAP=y 52CONFIG_SWAP=y
51CONFIG_SYSVIPC=y 53CONFIG_SYSVIPC=y
52CONFIG_SYSVIPC_SYSCTL=y
53# CONFIG_BSD_PROCESS_ACCT is not set 54# CONFIG_BSD_PROCESS_ACCT is not set
54 55
55# 56#
@@ -57,6 +58,7 @@ CONFIG_SYSVIPC_SYSCTL=y
57# 58#
58CONFIG_TREE_RCU=y 59CONFIG_TREE_RCU=y
59# CONFIG_TREE_PREEMPT_RCU is not set 60# CONFIG_TREE_PREEMPT_RCU is not set
61# CONFIG_TINY_RCU is not set
60# CONFIG_RCU_TRACE is not set 62# CONFIG_RCU_TRACE is not set
61CONFIG_RCU_FANOUT=32 63CONFIG_RCU_FANOUT=32
62# CONFIG_RCU_FANOUT_EXACT is not set 64# CONFIG_RCU_FANOUT_EXACT is not set
@@ -80,11 +82,9 @@ CONFIG_CGROUPS=y
80# CONFIG_NAMESPACES is not set 82# CONFIG_NAMESPACES is not set
81# CONFIG_BLK_DEV_INITRD is not set 83# CONFIG_BLK_DEV_INITRD is not set
82CONFIG_CC_OPTIMIZE_FOR_SIZE=y 84CONFIG_CC_OPTIMIZE_FOR_SIZE=y
83CONFIG_SYSCTL=y
84CONFIG_ANON_INODES=y 85CONFIG_ANON_INODES=y
85CONFIG_EMBEDDED=y 86CONFIG_EMBEDDED=y
86# CONFIG_UID16 is not set 87# CONFIG_UID16 is not set
87CONFIG_SYSCTL_SYSCALL=y
88CONFIG_KALLSYMS=y 88CONFIG_KALLSYMS=y
89# CONFIG_KALLSYMS_EXTRA_PASS is not set 89# CONFIG_KALLSYMS_EXTRA_PASS is not set
90CONFIG_HOTPLUG=y 90CONFIG_HOTPLUG=y
@@ -100,6 +100,7 @@ CONFIG_EVENTFD=y
100CONFIG_SHMEM=y 100CONFIG_SHMEM=y
101CONFIG_AIO=y 101CONFIG_AIO=y
102CONFIG_HAVE_PERF_EVENTS=y 102CONFIG_HAVE_PERF_EVENTS=y
103CONFIG_PERF_USE_VMALLOC=y
103 104
104# 105#
105# Kernel Performance Events And Counters 106# Kernel Performance Events And Counters
@@ -120,6 +121,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
120CONFIG_HAVE_KPROBES=y 121CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 122CONFIG_HAVE_KRETPROBES=y
122CONFIG_HAVE_ARCH_TRACEHOOK=y 123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_DMA_ATTRS=y
123CONFIG_HAVE_CLK=y 125CONFIG_HAVE_CLK=y
124CONFIG_HAVE_DMA_API_DEBUG=y 126CONFIG_HAVE_DMA_API_DEBUG=y
125 127
@@ -136,19 +138,48 @@ CONFIG_BLOCK=y
136CONFIG_LBDAF=y 138CONFIG_LBDAF=y
137# CONFIG_BLK_DEV_BSG is not set 139# CONFIG_BLK_DEV_BSG is not set
138# CONFIG_BLK_DEV_INTEGRITY is not set 140# CONFIG_BLK_DEV_INTEGRITY is not set
141# CONFIG_BLK_CGROUP is not set
139 142
140# 143#
141# IO Schedulers 144# IO Schedulers
142# 145#
143CONFIG_IOSCHED_NOOP=y 146CONFIG_IOSCHED_NOOP=y
144CONFIG_IOSCHED_AS=y
145CONFIG_IOSCHED_DEADLINE=y 147CONFIG_IOSCHED_DEADLINE=y
146CONFIG_IOSCHED_CFQ=y 148CONFIG_IOSCHED_CFQ=y
147CONFIG_DEFAULT_AS=y 149# CONFIG_CFQ_GROUP_IOSCHED is not set
148# CONFIG_DEFAULT_DEADLINE is not set 150# CONFIG_DEFAULT_DEADLINE is not set
149# CONFIG_DEFAULT_CFQ is not set 151CONFIG_DEFAULT_CFQ=y
150# CONFIG_DEFAULT_NOOP is not set 152# CONFIG_DEFAULT_NOOP is not set
151CONFIG_DEFAULT_IOSCHED="anticipatory" 153CONFIG_DEFAULT_IOSCHED="cfq"
154# CONFIG_INLINE_SPIN_TRYLOCK is not set
155# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
156# CONFIG_INLINE_SPIN_LOCK is not set
157# CONFIG_INLINE_SPIN_LOCK_BH is not set
158# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
159# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
160CONFIG_INLINE_SPIN_UNLOCK=y
161# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
162CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
163# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
164# CONFIG_INLINE_READ_TRYLOCK is not set
165# CONFIG_INLINE_READ_LOCK is not set
166# CONFIG_INLINE_READ_LOCK_BH is not set
167# CONFIG_INLINE_READ_LOCK_IRQ is not set
168# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
169CONFIG_INLINE_READ_UNLOCK=y
170# CONFIG_INLINE_READ_UNLOCK_BH is not set
171CONFIG_INLINE_READ_UNLOCK_IRQ=y
172# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
173# CONFIG_INLINE_WRITE_TRYLOCK is not set
174# CONFIG_INLINE_WRITE_LOCK is not set
175# CONFIG_INLINE_WRITE_LOCK_BH is not set
176# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
177# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
178CONFIG_INLINE_WRITE_UNLOCK=y
179# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
180CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
181# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
182# CONFIG_MUTEX_SPIN_ON_OWNER is not set
152CONFIG_FREEZER=y 183CONFIG_FREEZER=y
153 184
154# 185#
@@ -204,6 +235,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
204CONFIG_MEMORY_START=0x08000000 235CONFIG_MEMORY_START=0x08000000
205CONFIG_MEMORY_SIZE=0x04000000 236CONFIG_MEMORY_SIZE=0x04000000
206CONFIG_29BIT=y 237CONFIG_29BIT=y
238# CONFIG_PMB_ENABLE is not set
207# CONFIG_X2TLB is not set 239# CONFIG_X2TLB is not set
208CONFIG_VSYSCALL=y 240CONFIG_VSYSCALL=y
209CONFIG_ARCH_FLATMEM_ENABLE=y 241CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -225,17 +257,12 @@ CONFIG_SPARSEMEM_MANUAL=y
225CONFIG_SPARSEMEM=y 257CONFIG_SPARSEMEM=y
226CONFIG_HAVE_MEMORY_PRESENT=y 258CONFIG_HAVE_MEMORY_PRESENT=y
227CONFIG_SPARSEMEM_STATIC=y 259CONFIG_SPARSEMEM_STATIC=y
228 260# CONFIG_MEMORY_HOTPLUG is not set
229#
230# Memory hotplug is currently incompatible with Software Suspend
231#
232CONFIG_SPLIT_PTLOCK_CPUS=4 261CONFIG_SPLIT_PTLOCK_CPUS=4
233CONFIG_MIGRATION=y 262CONFIG_MIGRATION=y
234# CONFIG_PHYS_ADDR_T_64BIT is not set 263# CONFIG_PHYS_ADDR_T_64BIT is not set
235CONFIG_ZONE_DMA_FLAG=0 264CONFIG_ZONE_DMA_FLAG=0
236CONFIG_NR_QUICK=2 265CONFIG_NR_QUICK=2
237CONFIG_HAVE_MLOCK=y
238CONFIG_HAVE_MLOCKED_PAGE_BIT=y
239# CONFIG_KSM is not set 266# CONFIG_KSM is not set
240CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 267CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
241 268
@@ -269,7 +296,6 @@ CONFIG_CPU_HAS_FPU=y
269# 296#
270CONFIG_SH_TIMER_TMU=y 297CONFIG_SH_TIMER_TMU=y
271CONFIG_SH_TIMER_CMT=y 298CONFIG_SH_TIMER_CMT=y
272CONFIG_SH_PCLK_FREQ=41666666
273CONFIG_SH_CLK_CPG=y 299CONFIG_SH_CLK_CPG=y
274CONFIG_TICK_ONESHOT=y 300CONFIG_TICK_ONESHOT=y
275CONFIG_NO_HZ=y 301CONFIG_NO_HZ=y
@@ -388,6 +414,10 @@ CONFIG_EXTRA_FIRMWARE=""
388CONFIG_BLK_DEV=y 414CONFIG_BLK_DEV=y
389# CONFIG_BLK_DEV_COW_COMMON is not set 415# CONFIG_BLK_DEV_COW_COMMON is not set
390# CONFIG_BLK_DEV_LOOP is not set 416# CONFIG_BLK_DEV_LOOP is not set
417
418#
419# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
420#
391# CONFIG_BLK_DEV_RAM is not set 421# CONFIG_BLK_DEV_RAM is not set
392# CONFIG_CDROM_PKTCDVD is not set 422# CONFIG_CDROM_PKTCDVD is not set
393# CONFIG_BLK_DEV_HD is not set 423# CONFIG_BLK_DEV_HD is not set
@@ -476,7 +506,6 @@ CONFIG_I2C_SH_MOBILE=y
476# 506#
477# Miscellaneous I2C Chip support 507# Miscellaneous I2C Chip support
478# 508#
479# CONFIG_DS1682 is not set
480# CONFIG_SENSORS_TSL2550 is not set 509# CONFIG_SENSORS_TSL2550 is not set
481# CONFIG_I2C_DEBUG_CORE is not set 510# CONFIG_I2C_DEBUG_CORE is not set
482# CONFIG_I2C_DEBUG_ALGO is not set 511# CONFIG_I2C_DEBUG_ALGO is not set
@@ -505,15 +534,18 @@ CONFIG_SSB_POSSIBLE=y
505# 534#
506# CONFIG_MFD_CORE is not set 535# CONFIG_MFD_CORE is not set
507# CONFIG_MFD_SM501 is not set 536# CONFIG_MFD_SM501 is not set
537# CONFIG_MFD_SH_MOBILE_SDHI is not set
508# CONFIG_HTC_PASIC3 is not set 538# CONFIG_HTC_PASIC3 is not set
509# CONFIG_TWL4030_CORE is not set 539# CONFIG_TWL4030_CORE is not set
510# CONFIG_MFD_TMIO is not set 540# CONFIG_MFD_TMIO is not set
511# CONFIG_PMIC_DA903X is not set 541# CONFIG_PMIC_DA903X is not set
542# CONFIG_PMIC_ADP5520 is not set
512# CONFIG_MFD_WM8400 is not set 543# CONFIG_MFD_WM8400 is not set
513# CONFIG_MFD_WM831X is not set 544# CONFIG_MFD_WM831X is not set
514# CONFIG_MFD_WM8350_I2C is not set 545# CONFIG_MFD_WM8350_I2C is not set
515# CONFIG_MFD_PCF50633 is not set 546# CONFIG_MFD_PCF50633 is not set
516# CONFIG_AB3100_CORE is not set 547# CONFIG_AB3100_CORE is not set
548# CONFIG_MFD_88PM8607 is not set
517# CONFIG_REGULATOR is not set 549# CONFIG_REGULATOR is not set
518# CONFIG_MEDIA_SUPPORT is not set 550# CONFIG_MEDIA_SUPPORT is not set
519 551
@@ -561,6 +593,7 @@ CONFIG_RTC_INTF_DEV=y
561# CONFIG_RTC_DRV_PCF8563 is not set 593# CONFIG_RTC_DRV_PCF8563 is not set
562# CONFIG_RTC_DRV_PCF8583 is not set 594# CONFIG_RTC_DRV_PCF8583 is not set
563# CONFIG_RTC_DRV_M41T80 is not set 595# CONFIG_RTC_DRV_M41T80 is not set
596# CONFIG_RTC_DRV_BQ32K is not set
564# CONFIG_RTC_DRV_S35390A is not set 597# CONFIG_RTC_DRV_S35390A is not set
565# CONFIG_RTC_DRV_FM3130 is not set 598# CONFIG_RTC_DRV_FM3130 is not set
566# CONFIG_RTC_DRV_RX8581 is not set 599# CONFIG_RTC_DRV_RX8581 is not set
@@ -581,7 +614,9 @@ CONFIG_RTC_INTF_DEV=y
581# CONFIG_RTC_DRV_M48T86 is not set 614# CONFIG_RTC_DRV_M48T86 is not set
582# CONFIG_RTC_DRV_M48T35 is not set 615# CONFIG_RTC_DRV_M48T35 is not set
583# CONFIG_RTC_DRV_M48T59 is not set 616# CONFIG_RTC_DRV_M48T59 is not set
617# CONFIG_RTC_DRV_MSM6242 is not set
584# CONFIG_RTC_DRV_BQ4802 is not set 618# CONFIG_RTC_DRV_BQ4802 is not set
619# CONFIG_RTC_DRV_RP5C01 is not set
585# CONFIG_RTC_DRV_V3020 is not set 620# CONFIG_RTC_DRV_V3020 is not set
586 621
587# 622#
@@ -608,6 +643,7 @@ CONFIG_UIO_PDRV_GENIRQ=y
608# CONFIG_EXT2_FS is not set 643# CONFIG_EXT2_FS is not set
609# CONFIG_EXT3_FS is not set 644# CONFIG_EXT3_FS is not set
610# CONFIG_EXT4_FS is not set 645# CONFIG_EXT4_FS is not set
646CONFIG_EXT4_USE_FOR_EXT23=y
611# CONFIG_REISERFS_FS is not set 647# CONFIG_REISERFS_FS is not set
612# CONFIG_JFS_FS is not set 648# CONFIG_JFS_FS is not set
613# CONFIG_FS_POSIX_ACL is not set 649# CONFIG_FS_POSIX_ACL is not set
@@ -675,11 +711,10 @@ CONFIG_DEBUG_FS=y
675# CONFIG_HEADERS_CHECK is not set 711# CONFIG_HEADERS_CHECK is not set
676# CONFIG_DEBUG_KERNEL is not set 712# CONFIG_DEBUG_KERNEL is not set
677CONFIG_STACKTRACE=y 713CONFIG_STACKTRACE=y
678# CONFIG_DEBUG_BUGVERBOSE is not set 714CONFIG_DEBUG_BUGVERBOSE=y
679# CONFIG_DEBUG_MEMORY_INIT is not set 715# CONFIG_DEBUG_MEMORY_INIT is not set
680# CONFIG_RCU_CPU_STALL_DETECTOR is not set 716# CONFIG_RCU_CPU_STALL_DETECTOR is not set
681# CONFIG_LATENCYTOP is not set 717# CONFIG_LATENCYTOP is not set
682# CONFIG_SYSCTL_SYSCALL_CHECK is not set
683CONFIG_NOP_TRACER=y 718CONFIG_NOP_TRACER=y
684CONFIG_HAVE_FUNCTION_TRACER=y 719CONFIG_HAVE_FUNCTION_TRACER=y
685CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 720CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -699,7 +734,6 @@ CONFIG_TRACING_SUPPORT=y
699# CONFIG_SAMPLES is not set 734# CONFIG_SAMPLES is not set
700CONFIG_HAVE_ARCH_KGDB=y 735CONFIG_HAVE_ARCH_KGDB=y
701# CONFIG_SH_STANDARD_BIOS is not set 736# CONFIG_SH_STANDARD_BIOS is not set
702# CONFIG_EARLY_SCIF_CONSOLE is not set
703# CONFIG_DWARF_UNWINDER is not set 737# CONFIG_DWARF_UNWINDER is not set
704 738
705# 739#
@@ -707,7 +741,11 @@ CONFIG_HAVE_ARCH_KGDB=y
707# 741#
708# CONFIG_KEYS is not set 742# CONFIG_KEYS is not set
709# CONFIG_SECURITYFS is not set 743# CONFIG_SECURITYFS is not set
710# CONFIG_SECURITY_FILE_CAPABILITIES is not set 744# CONFIG_DEFAULT_SECURITY_SELINUX is not set
745# CONFIG_DEFAULT_SECURITY_SMACK is not set
746# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
747CONFIG_DEFAULT_SECURITY_DAC=y
748CONFIG_DEFAULT_SECURITY=""
711# CONFIG_CRYPTO is not set 749# CONFIG_CRYPTO is not set
712CONFIG_BINARY_PRINTF=y 750CONFIG_BINARY_PRINTF=y
713 751
diff --git a/arch/sh/configs/sh7763rdp_defconfig b/arch/sh/configs/sh7763rdp_defconfig
index 194ff703e23d..04b841b29427 100644
--- a/arch/sh/configs/sh7763rdp_defconfig
+++ b/arch/sh/configs/sh7763rdp_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:15:37 2009 4# Mon Jan 4 15:05:29 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -59,6 +61,7 @@ CONFIG_SYSVIPC_SYSCTL=y
59# 61#
60CONFIG_TREE_RCU=y 62CONFIG_TREE_RCU=y
61# CONFIG_TREE_PREEMPT_RCU is not set 63# CONFIG_TREE_PREEMPT_RCU is not set
64# CONFIG_TINY_RCU is not set
62# CONFIG_RCU_TRACE is not set 65# CONFIG_RCU_TRACE is not set
63CONFIG_RCU_FANOUT=32 66CONFIG_RCU_FANOUT=32
64# CONFIG_RCU_FANOUT_EXACT is not set 67# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,6 +106,7 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -124,6 +128,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
124CONFIG_HAVE_KPROBES=y 128CONFIG_HAVE_KPROBES=y
125CONFIG_HAVE_KRETPROBES=y 129CONFIG_HAVE_KRETPROBES=y
126CONFIG_HAVE_ARCH_TRACEHOOK=y 130CONFIG_HAVE_ARCH_TRACEHOOK=y
131CONFIG_HAVE_DMA_ATTRS=y
127CONFIG_HAVE_CLK=y 132CONFIG_HAVE_CLK=y
128CONFIG_HAVE_DMA_API_DEBUG=y 133CONFIG_HAVE_DMA_API_DEBUG=y
129 134
@@ -150,14 +155,41 @@ CONFIG_LBDAF=y
150# IO Schedulers 155# IO Schedulers
151# 156#
152CONFIG_IOSCHED_NOOP=y 157CONFIG_IOSCHED_NOOP=y
153CONFIG_IOSCHED_AS=y
154CONFIG_IOSCHED_DEADLINE=y 158CONFIG_IOSCHED_DEADLINE=y
155CONFIG_IOSCHED_CFQ=y 159CONFIG_IOSCHED_CFQ=y
156CONFIG_DEFAULT_AS=y
157# CONFIG_DEFAULT_DEADLINE is not set 160# CONFIG_DEFAULT_DEADLINE is not set
158# CONFIG_DEFAULT_CFQ is not set 161CONFIG_DEFAULT_CFQ=y
159# CONFIG_DEFAULT_NOOP is not set 162# CONFIG_DEFAULT_NOOP is not set
160CONFIG_DEFAULT_IOSCHED="anticipatory" 163CONFIG_DEFAULT_IOSCHED="cfq"
164# CONFIG_INLINE_SPIN_TRYLOCK is not set
165# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
166# CONFIG_INLINE_SPIN_LOCK is not set
167# CONFIG_INLINE_SPIN_LOCK_BH is not set
168# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
169# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
170CONFIG_INLINE_SPIN_UNLOCK=y
171# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
172CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
173# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
174# CONFIG_INLINE_READ_TRYLOCK is not set
175# CONFIG_INLINE_READ_LOCK is not set
176# CONFIG_INLINE_READ_LOCK_BH is not set
177# CONFIG_INLINE_READ_LOCK_IRQ is not set
178# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
179CONFIG_INLINE_READ_UNLOCK=y
180# CONFIG_INLINE_READ_UNLOCK_BH is not set
181CONFIG_INLINE_READ_UNLOCK_IRQ=y
182# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
183# CONFIG_INLINE_WRITE_TRYLOCK is not set
184# CONFIG_INLINE_WRITE_LOCK is not set
185# CONFIG_INLINE_WRITE_LOCK_BH is not set
186# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
187# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
188CONFIG_INLINE_WRITE_UNLOCK=y
189# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
190CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
191# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
192# CONFIG_MUTEX_SPIN_ON_OWNER is not set
161# CONFIG_FREEZER is not set 193# CONFIG_FREEZER is not set
162 194
163# 195#
@@ -211,6 +243,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
211CONFIG_MEMORY_START=0x0c000000 243CONFIG_MEMORY_START=0x0c000000
212CONFIG_MEMORY_SIZE=0x04000000 244CONFIG_MEMORY_SIZE=0x04000000
213CONFIG_29BIT=y 245CONFIG_29BIT=y
246# CONFIG_PMB_ENABLE is not set
214CONFIG_VSYSCALL=y 247CONFIG_VSYSCALL=y
215CONFIG_ARCH_FLATMEM_ENABLE=y 248CONFIG_ARCH_FLATMEM_ENABLE=y
216CONFIG_ARCH_SPARSEMEM_ENABLE=y 249CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -237,8 +270,6 @@ CONFIG_MIGRATION=y
237# CONFIG_PHYS_ADDR_T_64BIT is not set 270# CONFIG_PHYS_ADDR_T_64BIT is not set
238CONFIG_ZONE_DMA_FLAG=0 271CONFIG_ZONE_DMA_FLAG=0
239CONFIG_NR_QUICK=2 272CONFIG_NR_QUICK=2
240CONFIG_HAVE_MLOCK=y
241CONFIG_HAVE_MLOCKED_PAGE_BIT=y
242# CONFIG_KSM is not set 273# CONFIG_KSM is not set
243CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 274CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
244 275
@@ -421,10 +452,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
421# CONFIG_AF_RXRPC is not set 452# CONFIG_AF_RXRPC is not set
422CONFIG_WIRELESS=y 453CONFIG_WIRELESS=y
423# CONFIG_CFG80211 is not set 454# CONFIG_CFG80211 is not set
424CONFIG_CFG80211_DEFAULT_PS_VALUE=0
425# CONFIG_WIRELESS_OLD_REGULATORY is not set
426CONFIG_WIRELESS_EXT=y
427CONFIG_WIRELESS_EXT_SYSFS=y
428# CONFIG_LIB80211 is not set 455# CONFIG_LIB80211 is not set
429 456
430# 457#
@@ -509,7 +536,6 @@ CONFIG_MTD_CFI_UTIL=y
509CONFIG_MTD_COMPLEX_MAPPINGS=y 536CONFIG_MTD_COMPLEX_MAPPINGS=y
510CONFIG_MTD_PHYSMAP=y 537CONFIG_MTD_PHYSMAP=y
511# CONFIG_MTD_PHYSMAP_COMPAT is not set 538# CONFIG_MTD_PHYSMAP_COMPAT is not set
512# CONFIG_MTD_GPIO_ADDR is not set
513# CONFIG_MTD_PLATRAM is not set 539# CONFIG_MTD_PLATRAM is not set
514 540
515# 541#
@@ -542,6 +568,10 @@ CONFIG_MTD_PHYSMAP=y
542CONFIG_BLK_DEV=y 568CONFIG_BLK_DEV=y
543# CONFIG_BLK_DEV_COW_COMMON is not set 569# CONFIG_BLK_DEV_COW_COMMON is not set
544# CONFIG_BLK_DEV_LOOP is not set 570# CONFIG_BLK_DEV_LOOP is not set
571
572#
573# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
574#
545# CONFIG_BLK_DEV_NBD is not set 575# CONFIG_BLK_DEV_NBD is not set
546# CONFIG_BLK_DEV_UB is not set 576# CONFIG_BLK_DEV_UB is not set
547# CONFIG_BLK_DEV_RAM is not set 577# CONFIG_BLK_DEV_RAM is not set
@@ -640,11 +670,12 @@ CONFIG_SH_ETH=y
640# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 670# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
641# CONFIG_B44 is not set 671# CONFIG_B44 is not set
642# CONFIG_KS8842 is not set 672# CONFIG_KS8842 is not set
673# CONFIG_KS8851_MLL is not set
643# CONFIG_NETDEV_1000 is not set 674# CONFIG_NETDEV_1000 is not set
644# CONFIG_NETDEV_10000 is not set 675# CONFIG_NETDEV_10000 is not set
645CONFIG_WLAN=y 676CONFIG_WLAN=y
646# CONFIG_WLAN_PRE80211 is not set 677# CONFIG_USB_ZD1201 is not set
647# CONFIG_WLAN_80211 is not set 678# CONFIG_HOSTAP is not set
648 679
649# 680#
650# Enable WiMAX (Networking options) to see the WiMAX drivers 681# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -673,6 +704,7 @@ CONFIG_WLAN=y
673CONFIG_INPUT=y 704CONFIG_INPUT=y
674# CONFIG_INPUT_FF_MEMLESS is not set 705# CONFIG_INPUT_FF_MEMLESS is not set
675# CONFIG_INPUT_POLLDEV is not set 706# CONFIG_INPUT_POLLDEV is not set
707# CONFIG_INPUT_SPARSEKMAP is not set
676 708
677# 709#
678# Userland interfaces 710# Userland interfaces
@@ -756,6 +788,7 @@ CONFIG_SSB_POSSIBLE=y
756# 788#
757# CONFIG_MFD_CORE is not set 789# CONFIG_MFD_CORE is not set
758# CONFIG_MFD_SM501 is not set 790# CONFIG_MFD_SM501 is not set
791# CONFIG_MFD_SH_MOBILE_SDHI is not set
759# CONFIG_HTC_PASIC3 is not set 792# CONFIG_HTC_PASIC3 is not set
760# CONFIG_MFD_TMIO is not set 793# CONFIG_MFD_TMIO is not set
761# CONFIG_REGULATOR is not set 794# CONFIG_REGULATOR is not set
@@ -949,6 +982,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
949# CONFIG_MMC_SDHCI is not set 982# CONFIG_MMC_SDHCI is not set
950# CONFIG_MMC_AT91 is not set 983# CONFIG_MMC_AT91 is not set
951# CONFIG_MMC_ATMELMCI is not set 984# CONFIG_MMC_ATMELMCI is not set
985# CONFIG_MMC_TMIO is not set
952# CONFIG_MEMSTICK is not set 986# CONFIG_MEMSTICK is not set
953# CONFIG_NEW_LEDS is not set 987# CONFIG_NEW_LEDS is not set
954# CONFIG_ACCESSIBILITY is not set 988# CONFIG_ACCESSIBILITY is not set
@@ -1129,10 +1163,11 @@ CONFIG_DEBUG_FS=y
1129# CONFIG_HEADERS_CHECK is not set 1163# CONFIG_HEADERS_CHECK is not set
1130# CONFIG_DEBUG_KERNEL is not set 1164# CONFIG_DEBUG_KERNEL is not set
1131CONFIG_STACKTRACE=y 1165CONFIG_STACKTRACE=y
1132# CONFIG_DEBUG_BUGVERBOSE is not set 1166CONFIG_DEBUG_BUGVERBOSE=y
1133# CONFIG_DEBUG_MEMORY_INIT is not set 1167# CONFIG_DEBUG_MEMORY_INIT is not set
1134# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1168# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1135# CONFIG_LATENCYTOP is not set 1169# CONFIG_LATENCYTOP is not set
1170# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1136CONFIG_NOP_TRACER=y 1171CONFIG_NOP_TRACER=y
1137CONFIG_HAVE_FUNCTION_TRACER=y 1172CONFIG_HAVE_FUNCTION_TRACER=y
1138CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1173CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1152,7 +1187,6 @@ CONFIG_TRACING_SUPPORT=y
1152# CONFIG_SAMPLES is not set 1187# CONFIG_SAMPLES is not set
1153CONFIG_HAVE_ARCH_KGDB=y 1188CONFIG_HAVE_ARCH_KGDB=y
1154# CONFIG_SH_STANDARD_BIOS is not set 1189# CONFIG_SH_STANDARD_BIOS is not set
1155# CONFIG_EARLY_SCIF_CONSOLE is not set
1156# CONFIG_DWARF_UNWINDER is not set 1190# CONFIG_DWARF_UNWINDER is not set
1157 1191
1158# 1192#
@@ -1161,7 +1195,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1161# CONFIG_KEYS is not set 1195# CONFIG_KEYS is not set
1162# CONFIG_SECURITY is not set 1196# CONFIG_SECURITY is not set
1163# CONFIG_SECURITYFS is not set 1197# CONFIG_SECURITYFS is not set
1164# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1198# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1199# CONFIG_DEFAULT_SECURITY_SMACK is not set
1200# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1201CONFIG_DEFAULT_SECURITY_DAC=y
1202CONFIG_DEFAULT_SECURITY=""
1165CONFIG_CRYPTO=y 1203CONFIG_CRYPTO=y
1166 1204
1167# 1205#
diff --git a/arch/sh/configs/sh7770_generic_defconfig b/arch/sh/configs/sh7770_generic_defconfig
index 34bed5541f31..7b247053ece6 100644
--- a/arch/sh/configs/sh7770_generic_defconfig
+++ b/arch/sh/configs/sh7770_generic_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:17:16 2009 4# Mon Jan 4 15:06:28 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -48,7 +50,6 @@ CONFIG_KERNEL_GZIP=y
48# CONFIG_KERNEL_LZMA is not set 50# CONFIG_KERNEL_LZMA is not set
49CONFIG_SWAP=y 51CONFIG_SWAP=y
50CONFIG_SYSVIPC=y 52CONFIG_SYSVIPC=y
51CONFIG_SYSVIPC_SYSCTL=y
52# CONFIG_BSD_PROCESS_ACCT is not set 53# CONFIG_BSD_PROCESS_ACCT is not set
53 54
54# 55#
@@ -56,6 +57,7 @@ CONFIG_SYSVIPC_SYSCTL=y
56# 57#
57CONFIG_TREE_RCU=y 58CONFIG_TREE_RCU=y
58# CONFIG_TREE_PREEMPT_RCU is not set 59# CONFIG_TREE_PREEMPT_RCU is not set
60# CONFIG_TINY_RCU is not set
59# CONFIG_RCU_TRACE is not set 61# CONFIG_RCU_TRACE is not set
60CONFIG_RCU_FANOUT=32 62CONFIG_RCU_FANOUT=32
61# CONFIG_RCU_FANOUT_EXACT is not set 63# CONFIG_RCU_FANOUT_EXACT is not set
@@ -79,11 +81,9 @@ CONFIG_CGROUPS=y
79# CONFIG_NAMESPACES is not set 81# CONFIG_NAMESPACES is not set
80# CONFIG_BLK_DEV_INITRD is not set 82# CONFIG_BLK_DEV_INITRD is not set
81CONFIG_CC_OPTIMIZE_FOR_SIZE=y 83CONFIG_CC_OPTIMIZE_FOR_SIZE=y
82CONFIG_SYSCTL=y
83CONFIG_ANON_INODES=y 84CONFIG_ANON_INODES=y
84CONFIG_EMBEDDED=y 85CONFIG_EMBEDDED=y
85# CONFIG_UID16 is not set 86# CONFIG_UID16 is not set
86CONFIG_SYSCTL_SYSCALL=y
87CONFIG_KALLSYMS=y 87CONFIG_KALLSYMS=y
88# CONFIG_KALLSYMS_EXTRA_PASS is not set 88# CONFIG_KALLSYMS_EXTRA_PASS is not set
89CONFIG_HOTPLUG=y 89CONFIG_HOTPLUG=y
@@ -99,6 +99,7 @@ CONFIG_EVENTFD=y
99CONFIG_SHMEM=y 99CONFIG_SHMEM=y
100CONFIG_AIO=y 100CONFIG_AIO=y
101CONFIG_HAVE_PERF_EVENTS=y 101CONFIG_HAVE_PERF_EVENTS=y
102CONFIG_PERF_USE_VMALLOC=y
102 103
103# 104#
104# Kernel Performance Events And Counters 105# Kernel Performance Events And Counters
@@ -119,6 +120,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
119CONFIG_HAVE_KPROBES=y 120CONFIG_HAVE_KPROBES=y
120CONFIG_HAVE_KRETPROBES=y 121CONFIG_HAVE_KRETPROBES=y
121CONFIG_HAVE_ARCH_TRACEHOOK=y 122CONFIG_HAVE_ARCH_TRACEHOOK=y
123CONFIG_HAVE_DMA_ATTRS=y
122CONFIG_HAVE_CLK=y 124CONFIG_HAVE_CLK=y
123CONFIG_HAVE_DMA_API_DEBUG=y 125CONFIG_HAVE_DMA_API_DEBUG=y
124 126
@@ -135,19 +137,48 @@ CONFIG_BLOCK=y
135CONFIG_LBDAF=y 137CONFIG_LBDAF=y
136# CONFIG_BLK_DEV_BSG is not set 138# CONFIG_BLK_DEV_BSG is not set
137# CONFIG_BLK_DEV_INTEGRITY is not set 139# CONFIG_BLK_DEV_INTEGRITY is not set
140# CONFIG_BLK_CGROUP is not set
138 141
139# 142#
140# IO Schedulers 143# IO Schedulers
141# 144#
142CONFIG_IOSCHED_NOOP=y 145CONFIG_IOSCHED_NOOP=y
143CONFIG_IOSCHED_AS=y
144CONFIG_IOSCHED_DEADLINE=y 146CONFIG_IOSCHED_DEADLINE=y
145CONFIG_IOSCHED_CFQ=y 147CONFIG_IOSCHED_CFQ=y
146CONFIG_DEFAULT_AS=y 148# CONFIG_CFQ_GROUP_IOSCHED is not set
147# CONFIG_DEFAULT_DEADLINE is not set 149# CONFIG_DEFAULT_DEADLINE is not set
148# CONFIG_DEFAULT_CFQ is not set 150CONFIG_DEFAULT_CFQ=y
149# CONFIG_DEFAULT_NOOP is not set 151# CONFIG_DEFAULT_NOOP is not set
150CONFIG_DEFAULT_IOSCHED="anticipatory" 152CONFIG_DEFAULT_IOSCHED="cfq"
153# CONFIG_INLINE_SPIN_TRYLOCK is not set
154# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
155# CONFIG_INLINE_SPIN_LOCK is not set
156# CONFIG_INLINE_SPIN_LOCK_BH is not set
157# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
158# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
159CONFIG_INLINE_SPIN_UNLOCK=y
160# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
161CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
162# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
163# CONFIG_INLINE_READ_TRYLOCK is not set
164# CONFIG_INLINE_READ_LOCK is not set
165# CONFIG_INLINE_READ_LOCK_BH is not set
166# CONFIG_INLINE_READ_LOCK_IRQ is not set
167# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
168CONFIG_INLINE_READ_UNLOCK=y
169# CONFIG_INLINE_READ_UNLOCK_BH is not set
170CONFIG_INLINE_READ_UNLOCK_IRQ=y
171# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
172# CONFIG_INLINE_WRITE_TRYLOCK is not set
173# CONFIG_INLINE_WRITE_LOCK is not set
174# CONFIG_INLINE_WRITE_LOCK_BH is not set
175# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
176# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
177CONFIG_INLINE_WRITE_UNLOCK=y
178# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
179CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
180# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
181# CONFIG_MUTEX_SPIN_ON_OWNER is not set
151CONFIG_FREEZER=y 182CONFIG_FREEZER=y
152 183
153# 184#
@@ -201,6 +232,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
201CONFIG_MEMORY_START=0x08000000 232CONFIG_MEMORY_START=0x08000000
202CONFIG_MEMORY_SIZE=0x04000000 233CONFIG_MEMORY_SIZE=0x04000000
203CONFIG_29BIT=y 234CONFIG_29BIT=y
235# CONFIG_PMB_ENABLE is not set
204CONFIG_VSYSCALL=y 236CONFIG_VSYSCALL=y
205CONFIG_ARCH_FLATMEM_ENABLE=y 237CONFIG_ARCH_FLATMEM_ENABLE=y
206CONFIG_ARCH_SPARSEMEM_ENABLE=y 238CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -221,17 +253,12 @@ CONFIG_SPARSEMEM_MANUAL=y
221CONFIG_SPARSEMEM=y 253CONFIG_SPARSEMEM=y
222CONFIG_HAVE_MEMORY_PRESENT=y 254CONFIG_HAVE_MEMORY_PRESENT=y
223CONFIG_SPARSEMEM_STATIC=y 255CONFIG_SPARSEMEM_STATIC=y
224 256# CONFIG_MEMORY_HOTPLUG is not set
225#
226# Memory hotplug is currently incompatible with Software Suspend
227#
228CONFIG_SPLIT_PTLOCK_CPUS=4 257CONFIG_SPLIT_PTLOCK_CPUS=4
229CONFIG_MIGRATION=y 258CONFIG_MIGRATION=y
230# CONFIG_PHYS_ADDR_T_64BIT is not set 259# CONFIG_PHYS_ADDR_T_64BIT is not set
231CONFIG_ZONE_DMA_FLAG=0 260CONFIG_ZONE_DMA_FLAG=0
232CONFIG_NR_QUICK=2 261CONFIG_NR_QUICK=2
233CONFIG_HAVE_MLOCK=y
234CONFIG_HAVE_MLOCKED_PAGE_BIT=y
235# CONFIG_KSM is not set 262# CONFIG_KSM is not set
236CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 263CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
237 264
@@ -379,6 +406,10 @@ CONFIG_EXTRA_FIRMWARE=""
379CONFIG_BLK_DEV=y 406CONFIG_BLK_DEV=y
380# CONFIG_BLK_DEV_COW_COMMON is not set 407# CONFIG_BLK_DEV_COW_COMMON is not set
381# CONFIG_BLK_DEV_LOOP is not set 408# CONFIG_BLK_DEV_LOOP is not set
409
410#
411# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
412#
382# CONFIG_BLK_DEV_RAM is not set 413# CONFIG_BLK_DEV_RAM is not set
383# CONFIG_CDROM_PKTCDVD is not set 414# CONFIG_CDROM_PKTCDVD is not set
384# CONFIG_BLK_DEV_HD is not set 415# CONFIG_BLK_DEV_HD is not set
@@ -467,7 +498,6 @@ CONFIG_I2C_SH_MOBILE=y
467# 498#
468# Miscellaneous I2C Chip support 499# Miscellaneous I2C Chip support
469# 500#
470# CONFIG_DS1682 is not set
471# CONFIG_SENSORS_TSL2550 is not set 501# CONFIG_SENSORS_TSL2550 is not set
472# CONFIG_I2C_DEBUG_CORE is not set 502# CONFIG_I2C_DEBUG_CORE is not set
473# CONFIG_I2C_DEBUG_ALGO is not set 503# CONFIG_I2C_DEBUG_ALGO is not set
@@ -496,15 +526,18 @@ CONFIG_SSB_POSSIBLE=y
496# 526#
497# CONFIG_MFD_CORE is not set 527# CONFIG_MFD_CORE is not set
498# CONFIG_MFD_SM501 is not set 528# CONFIG_MFD_SM501 is not set
529# CONFIG_MFD_SH_MOBILE_SDHI is not set
499# CONFIG_HTC_PASIC3 is not set 530# CONFIG_HTC_PASIC3 is not set
500# CONFIG_TWL4030_CORE is not set 531# CONFIG_TWL4030_CORE is not set
501# CONFIG_MFD_TMIO is not set 532# CONFIG_MFD_TMIO is not set
502# CONFIG_PMIC_DA903X is not set 533# CONFIG_PMIC_DA903X is not set
534# CONFIG_PMIC_ADP5520 is not set
503# CONFIG_MFD_WM8400 is not set 535# CONFIG_MFD_WM8400 is not set
504# CONFIG_MFD_WM831X is not set 536# CONFIG_MFD_WM831X is not set
505# CONFIG_MFD_WM8350_I2C is not set 537# CONFIG_MFD_WM8350_I2C is not set
506# CONFIG_MFD_PCF50633 is not set 538# CONFIG_MFD_PCF50633 is not set
507# CONFIG_AB3100_CORE is not set 539# CONFIG_AB3100_CORE is not set
540# CONFIG_MFD_88PM8607 is not set
508# CONFIG_REGULATOR is not set 541# CONFIG_REGULATOR is not set
509# CONFIG_MEDIA_SUPPORT is not set 542# CONFIG_MEDIA_SUPPORT is not set
510 543
@@ -552,6 +585,7 @@ CONFIG_RTC_INTF_DEV=y
552# CONFIG_RTC_DRV_PCF8563 is not set 585# CONFIG_RTC_DRV_PCF8563 is not set
553# CONFIG_RTC_DRV_PCF8583 is not set 586# CONFIG_RTC_DRV_PCF8583 is not set
554# CONFIG_RTC_DRV_M41T80 is not set 587# CONFIG_RTC_DRV_M41T80 is not set
588# CONFIG_RTC_DRV_BQ32K is not set
555# CONFIG_RTC_DRV_S35390A is not set 589# CONFIG_RTC_DRV_S35390A is not set
556# CONFIG_RTC_DRV_FM3130 is not set 590# CONFIG_RTC_DRV_FM3130 is not set
557# CONFIG_RTC_DRV_RX8581 is not set 591# CONFIG_RTC_DRV_RX8581 is not set
@@ -572,7 +606,9 @@ CONFIG_RTC_INTF_DEV=y
572# CONFIG_RTC_DRV_M48T86 is not set 606# CONFIG_RTC_DRV_M48T86 is not set
573# CONFIG_RTC_DRV_M48T35 is not set 607# CONFIG_RTC_DRV_M48T35 is not set
574# CONFIG_RTC_DRV_M48T59 is not set 608# CONFIG_RTC_DRV_M48T59 is not set
609# CONFIG_RTC_DRV_MSM6242 is not set
575# CONFIG_RTC_DRV_BQ4802 is not set 610# CONFIG_RTC_DRV_BQ4802 is not set
611# CONFIG_RTC_DRV_RP5C01 is not set
576# CONFIG_RTC_DRV_V3020 is not set 612# CONFIG_RTC_DRV_V3020 is not set
577 613
578# 614#
@@ -599,6 +635,7 @@ CONFIG_UIO_PDRV_GENIRQ=y
599# CONFIG_EXT2_FS is not set 635# CONFIG_EXT2_FS is not set
600# CONFIG_EXT3_FS is not set 636# CONFIG_EXT3_FS is not set
601# CONFIG_EXT4_FS is not set 637# CONFIG_EXT4_FS is not set
638CONFIG_EXT4_USE_FOR_EXT23=y
602# CONFIG_REISERFS_FS is not set 639# CONFIG_REISERFS_FS is not set
603# CONFIG_JFS_FS is not set 640# CONFIG_JFS_FS is not set
604# CONFIG_FS_POSIX_ACL is not set 641# CONFIG_FS_POSIX_ACL is not set
@@ -666,11 +703,10 @@ CONFIG_DEBUG_FS=y
666# CONFIG_HEADERS_CHECK is not set 703# CONFIG_HEADERS_CHECK is not set
667# CONFIG_DEBUG_KERNEL is not set 704# CONFIG_DEBUG_KERNEL is not set
668CONFIG_STACKTRACE=y 705CONFIG_STACKTRACE=y
669# CONFIG_DEBUG_BUGVERBOSE is not set 706CONFIG_DEBUG_BUGVERBOSE=y
670# CONFIG_DEBUG_MEMORY_INIT is not set 707# CONFIG_DEBUG_MEMORY_INIT is not set
671# CONFIG_RCU_CPU_STALL_DETECTOR is not set 708# CONFIG_RCU_CPU_STALL_DETECTOR is not set
672# CONFIG_LATENCYTOP is not set 709# CONFIG_LATENCYTOP is not set
673# CONFIG_SYSCTL_SYSCALL_CHECK is not set
674CONFIG_NOP_TRACER=y 710CONFIG_NOP_TRACER=y
675CONFIG_HAVE_FUNCTION_TRACER=y 711CONFIG_HAVE_FUNCTION_TRACER=y
676CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 712CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -690,7 +726,6 @@ CONFIG_TRACING_SUPPORT=y
690# CONFIG_SAMPLES is not set 726# CONFIG_SAMPLES is not set
691CONFIG_HAVE_ARCH_KGDB=y 727CONFIG_HAVE_ARCH_KGDB=y
692# CONFIG_SH_STANDARD_BIOS is not set 728# CONFIG_SH_STANDARD_BIOS is not set
693# CONFIG_EARLY_SCIF_CONSOLE is not set
694# CONFIG_DWARF_UNWINDER is not set 729# CONFIG_DWARF_UNWINDER is not set
695 730
696# 731#
@@ -698,7 +733,11 @@ CONFIG_HAVE_ARCH_KGDB=y
698# 733#
699# CONFIG_KEYS is not set 734# CONFIG_KEYS is not set
700# CONFIG_SECURITYFS is not set 735# CONFIG_SECURITYFS is not set
701# CONFIG_SECURITY_FILE_CAPABILITIES is not set 736# CONFIG_DEFAULT_SECURITY_SELINUX is not set
737# CONFIG_DEFAULT_SECURITY_SMACK is not set
738# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
739CONFIG_DEFAULT_SECURITY_DAC=y
740CONFIG_DEFAULT_SECURITY=""
702# CONFIG_CRYPTO is not set 741# CONFIG_CRYPTO is not set
703CONFIG_BINARY_PRINTF=y 742CONFIG_BINARY_PRINTF=y
704 743
diff --git a/arch/sh/configs/sh7785lcr_32bit_defconfig b/arch/sh/configs/sh7785lcr_32bit_defconfig
index 51cbaedf7a56..8330813b0c1d 100644
--- a/arch/sh/configs/sh7785lcr_32bit_defconfig
+++ b/arch/sh/configs/sh7785lcr_32bit_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.31 3# Linux kernel version: 2.6.33-rc2
4# Fri Sep 25 11:39:20 2009 4# Mon Jan 4 15:07:40 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_NUMA=y 24CONFIG_SYS_SUPPORTS_NUMA=y
24CONFIG_SYS_SUPPORTS_PCI=y 25CONFIG_SYS_SUPPORTS_PCI=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -64,6 +66,7 @@ CONFIG_BSD_PROCESS_ACCT=y
64# 66#
65CONFIG_TREE_RCU=y 67CONFIG_TREE_RCU=y
66# CONFIG_TREE_PREEMPT_RCU is not set 68# CONFIG_TREE_PREEMPT_RCU is not set
69# CONFIG_TINY_RCU is not set
67# CONFIG_RCU_TRACE is not set 70# CONFIG_RCU_TRACE is not set
68CONFIG_RCU_FANOUT=32 71CONFIG_RCU_FANOUT=32
69# CONFIG_RCU_FANOUT_EXACT is not set 72# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,6 +106,7 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
@@ -126,6 +130,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
126CONFIG_HAVE_KPROBES=y 130CONFIG_HAVE_KPROBES=y
127CONFIG_HAVE_KRETPROBES=y 131CONFIG_HAVE_KRETPROBES=y
128CONFIG_HAVE_ARCH_TRACEHOOK=y 132CONFIG_HAVE_ARCH_TRACEHOOK=y
133CONFIG_HAVE_DMA_ATTRS=y
129CONFIG_HAVE_CLK=y 134CONFIG_HAVE_CLK=y
130CONFIG_HAVE_DMA_API_DEBUG=y 135CONFIG_HAVE_DMA_API_DEBUG=y
131 136
@@ -153,14 +158,41 @@ CONFIG_BLOCK=y
153# IO Schedulers 158# IO Schedulers
154# 159#
155CONFIG_IOSCHED_NOOP=y 160CONFIG_IOSCHED_NOOP=y
156CONFIG_IOSCHED_AS=y
157CONFIG_IOSCHED_DEADLINE=y 161CONFIG_IOSCHED_DEADLINE=y
158CONFIG_IOSCHED_CFQ=y 162CONFIG_IOSCHED_CFQ=y
159# CONFIG_DEFAULT_AS is not set
160# CONFIG_DEFAULT_DEADLINE is not set 163# CONFIG_DEFAULT_DEADLINE is not set
161CONFIG_DEFAULT_CFQ=y 164CONFIG_DEFAULT_CFQ=y
162# CONFIG_DEFAULT_NOOP is not set 165# CONFIG_DEFAULT_NOOP is not set
163CONFIG_DEFAULT_IOSCHED="cfq" 166CONFIG_DEFAULT_IOSCHED="cfq"
167# CONFIG_INLINE_SPIN_TRYLOCK is not set
168# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
169# CONFIG_INLINE_SPIN_LOCK is not set
170# CONFIG_INLINE_SPIN_LOCK_BH is not set
171# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
172# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
173# CONFIG_INLINE_SPIN_UNLOCK is not set
174# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
175# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
176# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
177# CONFIG_INLINE_READ_TRYLOCK is not set
178# CONFIG_INLINE_READ_LOCK is not set
179# CONFIG_INLINE_READ_LOCK_BH is not set
180# CONFIG_INLINE_READ_LOCK_IRQ is not set
181# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
182# CONFIG_INLINE_READ_UNLOCK is not set
183# CONFIG_INLINE_READ_UNLOCK_BH is not set
184# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
185# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
186# CONFIG_INLINE_WRITE_TRYLOCK is not set
187# CONFIG_INLINE_WRITE_LOCK is not set
188# CONFIG_INLINE_WRITE_LOCK_BH is not set
189# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
190# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
191# CONFIG_INLINE_WRITE_UNLOCK is not set
192# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
193# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
194# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
195# CONFIG_MUTEX_SPIN_ON_OWNER is not set
164# CONFIG_FREEZER is not set 196# CONFIG_FREEZER is not set
165 197
166# 198#
@@ -253,8 +285,6 @@ CONFIG_MIGRATION=y
253# CONFIG_PHYS_ADDR_T_64BIT is not set 285# CONFIG_PHYS_ADDR_T_64BIT is not set
254CONFIG_ZONE_DMA_FLAG=0 286CONFIG_ZONE_DMA_FLAG=0
255CONFIG_NR_QUICK=2 287CONFIG_NR_QUICK=2
256CONFIG_HAVE_MLOCK=y
257CONFIG_HAVE_MLOCKED_PAGE_BIT=y
258# CONFIG_KSM is not set 288# CONFIG_KSM is not set
259CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 289CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
260 290
@@ -287,7 +317,6 @@ CONFIG_SH_SH7785LCR=y
287# Timer and clock configuration 317# Timer and clock configuration
288# 318#
289CONFIG_SH_TIMER_TMU=y 319CONFIG_SH_TIMER_TMU=y
290CONFIG_SH_PCLK_FREQ=50000000
291CONFIG_SH_CLK_CPG=y 320CONFIG_SH_CLK_CPG=y
292CONFIG_TICK_ONESHOT=y 321CONFIG_TICK_ONESHOT=y
293CONFIG_NO_HZ=y 322CONFIG_NO_HZ=y
@@ -360,7 +389,6 @@ CONFIG_ENTRY_OFFSET=0x00001000
360# Bus options 389# Bus options
361# 390#
362CONFIG_PCI=y 391CONFIG_PCI=y
363CONFIG_SH_PCIDMA_NONCOHERENT=y
364# CONFIG_PCIEPORTBUS is not set 392# CONFIG_PCIEPORTBUS is not set
365# CONFIG_ARCH_SUPPORTS_MSI is not set 393# CONFIG_ARCH_SUPPORTS_MSI is not set
366# CONFIG_PCI_LEGACY is not set 394# CONFIG_PCI_LEGACY is not set
@@ -470,10 +498,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
470# CONFIG_AF_RXRPC is not set 498# CONFIG_AF_RXRPC is not set
471CONFIG_WIRELESS=y 499CONFIG_WIRELESS=y
472# CONFIG_CFG80211 is not set 500# CONFIG_CFG80211 is not set
473CONFIG_CFG80211_DEFAULT_PS_VALUE=0
474# CONFIG_WIRELESS_OLD_REGULATORY is not set
475CONFIG_WIRELESS_EXT=y
476CONFIG_WIRELESS_EXT_SYSFS=y
477# CONFIG_LIB80211 is not set 501# CONFIG_LIB80211 is not set
478 502
479# 503#
@@ -588,6 +612,10 @@ CONFIG_BLK_DEV=y
588# CONFIG_BLK_DEV_COW_COMMON is not set 612# CONFIG_BLK_DEV_COW_COMMON is not set
589CONFIG_BLK_DEV_LOOP=y 613CONFIG_BLK_DEV_LOOP=y
590CONFIG_BLK_DEV_CRYPTOLOOP=m 614CONFIG_BLK_DEV_CRYPTOLOOP=m
615
616#
617# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
618#
591# CONFIG_BLK_DEV_NBD is not set 619# CONFIG_BLK_DEV_NBD is not set
592# CONFIG_BLK_DEV_SX8 is not set 620# CONFIG_BLK_DEV_SX8 is not set
593# CONFIG_BLK_DEV_UB is not set 621# CONFIG_BLK_DEV_UB is not set
@@ -688,15 +716,16 @@ CONFIG_SATA_SIL=y
688# CONFIG_PATA_NS87415 is not set 716# CONFIG_PATA_NS87415 is not set
689# CONFIG_PATA_OPTI is not set 717# CONFIG_PATA_OPTI is not set
690# CONFIG_PATA_OPTIDMA is not set 718# CONFIG_PATA_OPTIDMA is not set
719# CONFIG_PATA_PDC2027X is not set
691# CONFIG_PATA_PDC_OLD is not set 720# CONFIG_PATA_PDC_OLD is not set
692# CONFIG_PATA_RADISYS is not set 721# CONFIG_PATA_RADISYS is not set
693# CONFIG_PATA_RDC is not set 722# CONFIG_PATA_RDC is not set
694# CONFIG_PATA_RZ1000 is not set 723# CONFIG_PATA_RZ1000 is not set
695# CONFIG_PATA_SC1200 is not set 724# CONFIG_PATA_SC1200 is not set
696# CONFIG_PATA_SERVERWORKS is not set 725# CONFIG_PATA_SERVERWORKS is not set
697# CONFIG_PATA_PDC2027X is not set
698# CONFIG_PATA_SIL680 is not set 726# CONFIG_PATA_SIL680 is not set
699# CONFIG_PATA_SIS is not set 727# CONFIG_PATA_SIS is not set
728# CONFIG_PATA_TOSHIBA is not set
700# CONFIG_PATA_VIA is not set 729# CONFIG_PATA_VIA is not set
701# CONFIG_PATA_WINBOND is not set 730# CONFIG_PATA_WINBOND is not set
702# CONFIG_PATA_PLATFORM is not set 731# CONFIG_PATA_PLATFORM is not set
@@ -777,6 +806,7 @@ CONFIG_R8169=y
777# CONFIG_NETCONSOLE is not set 806# CONFIG_NETCONSOLE is not set
778# CONFIG_NETPOLL is not set 807# CONFIG_NETPOLL is not set
779# CONFIG_NET_POLL_CONTROLLER is not set 808# CONFIG_NET_POLL_CONTROLLER is not set
809# CONFIG_VMXNET3 is not set
780# CONFIG_ISDN is not set 810# CONFIG_ISDN is not set
781# CONFIG_PHONE is not set 811# CONFIG_PHONE is not set
782 812
@@ -786,6 +816,7 @@ CONFIG_R8169=y
786CONFIG_INPUT=y 816CONFIG_INPUT=y
787CONFIG_INPUT_FF_MEMLESS=m 817CONFIG_INPUT_FF_MEMLESS=m
788# CONFIG_INPUT_POLLDEV is not set 818# CONFIG_INPUT_POLLDEV is not set
819# CONFIG_INPUT_SPARSEKMAP is not set
789 820
790# 821#
791# Userland interfaces 822# Userland interfaces
@@ -841,6 +872,7 @@ CONFIG_SERIO_SERPORT=y
841# CONFIG_SERIO_PCIPS2 is not set 872# CONFIG_SERIO_PCIPS2 is not set
842CONFIG_SERIO_LIBPS2=y 873CONFIG_SERIO_LIBPS2=y
843# CONFIG_SERIO_RAW is not set 874# CONFIG_SERIO_RAW is not set
875# CONFIG_SERIO_ALTERA_PS2 is not set
844# CONFIG_GAMEPORT is not set 876# CONFIG_GAMEPORT is not set
845 877
846# 878#
@@ -924,11 +956,6 @@ CONFIG_I2C_ALGOPCA=y
924# CONFIG_I2C_TINY_USB is not set 956# CONFIG_I2C_TINY_USB is not set
925 957
926# 958#
927# Graphics adapter I2C/DDC channel drivers
928#
929# CONFIG_I2C_VOODOO3 is not set
930
931#
932# Other I2C/SMBus bus drivers 959# Other I2C/SMBus bus drivers
933# 960#
934CONFIG_I2C_PCA_PLATFORM=y 961CONFIG_I2C_PCA_PLATFORM=y
@@ -937,7 +964,6 @@ CONFIG_I2C_PCA_PLATFORM=y
937# 964#
938# Miscellaneous I2C Chip support 965# Miscellaneous I2C Chip support
939# 966#
940# CONFIG_DS1682 is not set
941# CONFIG_SENSORS_TSL2550 is not set 967# CONFIG_SENSORS_TSL2550 is not set
942# CONFIG_I2C_DEBUG_CORE is not set 968# CONFIG_I2C_DEBUG_CORE is not set
943# CONFIG_I2C_DEBUG_ALGO is not set 969# CONFIG_I2C_DEBUG_ALGO is not set
@@ -986,15 +1012,18 @@ CONFIG_SSB_POSSIBLE=y
986# 1012#
987# CONFIG_MFD_CORE is not set 1013# CONFIG_MFD_CORE is not set
988CONFIG_MFD_SM501=y 1014CONFIG_MFD_SM501=y
1015# CONFIG_MFD_SH_MOBILE_SDHI is not set
989# CONFIG_HTC_PASIC3 is not set 1016# CONFIG_HTC_PASIC3 is not set
990# CONFIG_TWL4030_CORE is not set 1017# CONFIG_TWL4030_CORE is not set
991# CONFIG_MFD_TMIO is not set 1018# CONFIG_MFD_TMIO is not set
992# CONFIG_PMIC_DA903X is not set 1019# CONFIG_PMIC_DA903X is not set
1020# CONFIG_PMIC_ADP5520 is not set
993# CONFIG_MFD_WM8400 is not set 1021# CONFIG_MFD_WM8400 is not set
994# CONFIG_MFD_WM831X is not set 1022# CONFIG_MFD_WM831X is not set
995# CONFIG_MFD_WM8350_I2C is not set 1023# CONFIG_MFD_WM8350_I2C is not set
996# CONFIG_MFD_PCF50633 is not set 1024# CONFIG_MFD_PCF50633 is not set
997# CONFIG_AB3100_CORE is not set 1025# CONFIG_AB3100_CORE is not set
1026# CONFIG_MFD_88PM8607 is not set
998# CONFIG_REGULATOR is not set 1027# CONFIG_REGULATOR is not set
999# CONFIG_MEDIA_SUPPORT is not set 1028# CONFIG_MEDIA_SUPPORT is not set
1000 1029
@@ -1129,6 +1158,7 @@ CONFIG_SND_CMIPCI=y
1129# CONFIG_SND_OXYGEN is not set 1158# CONFIG_SND_OXYGEN is not set
1130# CONFIG_SND_CS4281 is not set 1159# CONFIG_SND_CS4281 is not set
1131# CONFIG_SND_CS46XX is not set 1160# CONFIG_SND_CS46XX is not set
1161# CONFIG_SND_CS5535AUDIO is not set
1132# CONFIG_SND_CTXFI is not set 1162# CONFIG_SND_CTXFI is not set
1133# CONFIG_SND_DARLA20 is not set 1163# CONFIG_SND_DARLA20 is not set
1134# CONFIG_SND_GINA20 is not set 1164# CONFIG_SND_GINA20 is not set
@@ -1363,6 +1393,7 @@ CONFIG_MMC_SDHCI_PLTFM=m
1363# CONFIG_MMC_AT91 is not set 1393# CONFIG_MMC_AT91 is not set
1364# CONFIG_MMC_ATMELMCI is not set 1394# CONFIG_MMC_ATMELMCI is not set
1365# CONFIG_MMC_TIFM_SD is not set 1395# CONFIG_MMC_TIFM_SD is not set
1396# CONFIG_MMC_TMIO is not set
1366# CONFIG_MMC_CB710 is not set 1397# CONFIG_MMC_CB710 is not set
1367# CONFIG_MMC_VIA_SDMMC is not set 1398# CONFIG_MMC_VIA_SDMMC is not set
1368# CONFIG_MEMSTICK is not set 1399# CONFIG_MEMSTICK is not set
@@ -1397,6 +1428,7 @@ CONFIG_RTC_DRV_RS5C372=y
1397# CONFIG_RTC_DRV_PCF8563 is not set 1428# CONFIG_RTC_DRV_PCF8563 is not set
1398# CONFIG_RTC_DRV_PCF8583 is not set 1429# CONFIG_RTC_DRV_PCF8583 is not set
1399# CONFIG_RTC_DRV_M41T80 is not set 1430# CONFIG_RTC_DRV_M41T80 is not set
1431# CONFIG_RTC_DRV_BQ32K is not set
1400# CONFIG_RTC_DRV_S35390A is not set 1432# CONFIG_RTC_DRV_S35390A is not set
1401# CONFIG_RTC_DRV_FM3130 is not set 1433# CONFIG_RTC_DRV_FM3130 is not set
1402# CONFIG_RTC_DRV_RX8581 is not set 1434# CONFIG_RTC_DRV_RX8581 is not set
@@ -1417,7 +1449,9 @@ CONFIG_RTC_DRV_RS5C372=y
1417# CONFIG_RTC_DRV_M48T86 is not set 1449# CONFIG_RTC_DRV_M48T86 is not set
1418# CONFIG_RTC_DRV_M48T35 is not set 1450# CONFIG_RTC_DRV_M48T35 is not set
1419# CONFIG_RTC_DRV_M48T59 is not set 1451# CONFIG_RTC_DRV_M48T59 is not set
1452# CONFIG_RTC_DRV_MSM6242 is not set
1420# CONFIG_RTC_DRV_BQ4802 is not set 1453# CONFIG_RTC_DRV_BQ4802 is not set
1454# CONFIG_RTC_DRV_RP5C01 is not set
1421# CONFIG_RTC_DRV_V3020 is not set 1455# CONFIG_RTC_DRV_V3020 is not set
1422 1456
1423# 1457#
@@ -1622,13 +1656,14 @@ CONFIG_SCHED_DEBUG=y
1622CONFIG_SCHEDSTATS=y 1656CONFIG_SCHEDSTATS=y
1623CONFIG_TRACE_IRQFLAGS=y 1657CONFIG_TRACE_IRQFLAGS=y
1624CONFIG_STACKTRACE=y 1658CONFIG_STACKTRACE=y
1625# CONFIG_DEBUG_BUGVERBOSE is not set 1659CONFIG_DEBUG_BUGVERBOSE=y
1626# CONFIG_DEBUG_MEMORY_INIT is not set 1660# CONFIG_DEBUG_MEMORY_INIT is not set
1627CONFIG_FRAME_POINTER=y 1661CONFIG_FRAME_POINTER=y
1628# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1662# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1629CONFIG_LATENCYTOP=y 1663CONFIG_LATENCYTOP=y
1630CONFIG_SYSCTL_SYSCALL_CHECK=y 1664CONFIG_SYSCTL_SYSCALL_CHECK=y
1631CONFIG_NOP_TRACER=y 1665CONFIG_NOP_TRACER=y
1666CONFIG_HAVE_FTRACE_NMI_ENTER=y
1632CONFIG_HAVE_FUNCTION_TRACER=y 1667CONFIG_HAVE_FUNCTION_TRACER=y
1633CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1668CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1634CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 1669CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -1637,6 +1672,7 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1637CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 1672CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
1638CONFIG_TRACER_MAX_TRACE=y 1673CONFIG_TRACER_MAX_TRACE=y
1639CONFIG_RING_BUFFER=y 1674CONFIG_RING_BUFFER=y
1675CONFIG_FTRACE_NMI_ENTER=y
1640CONFIG_EVENT_TRACING=y 1676CONFIG_EVENT_TRACING=y
1641CONFIG_CONTEXT_SWITCH_TRACER=y 1677CONFIG_CONTEXT_SWITCH_TRACER=y
1642CONFIG_RING_BUFFER_ALLOW_SWAP=y 1678CONFIG_RING_BUFFER_ALLOW_SWAP=y
@@ -1668,7 +1704,6 @@ CONFIG_FTRACE_MCOUNT_RECORD=y
1668# CONFIG_SAMPLES is not set 1704# CONFIG_SAMPLES is not set
1669CONFIG_HAVE_ARCH_KGDB=y 1705CONFIG_HAVE_ARCH_KGDB=y
1670# CONFIG_SH_STANDARD_BIOS is not set 1706# CONFIG_SH_STANDARD_BIOS is not set
1671# CONFIG_EARLY_SCIF_CONSOLE is not set
1672CONFIG_DWARF_UNWINDER=y 1707CONFIG_DWARF_UNWINDER=y
1673CONFIG_MCOUNT=y 1708CONFIG_MCOUNT=y
1674 1709
@@ -1678,7 +1713,11 @@ CONFIG_MCOUNT=y
1678# CONFIG_KEYS is not set 1713# CONFIG_KEYS is not set
1679# CONFIG_SECURITY is not set 1714# CONFIG_SECURITY is not set
1680# CONFIG_SECURITYFS is not set 1715# CONFIG_SECURITYFS is not set
1681# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1716# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1717# CONFIG_DEFAULT_SECURITY_SMACK is not set
1718# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1719CONFIG_DEFAULT_SECURITY_DAC=y
1720CONFIG_DEFAULT_SECURITY=""
1682CONFIG_CRYPTO=y 1721CONFIG_CRYPTO=y
1683 1722
1684# 1723#
diff --git a/arch/sh/configs/sh7785lcr_defconfig b/arch/sh/configs/sh7785lcr_defconfig
index 8c2c47ed3991..f196e87c7665 100644
--- a/arch/sh/configs/sh7785lcr_defconfig
+++ b/arch/sh/configs/sh7785lcr_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:23:18 2009 4# Mon Jan 4 15:09:09 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_NUMA=y 24CONFIG_SYS_SUPPORTS_NUMA=y
24CONFIG_SYS_SUPPORTS_PCI=y 25CONFIG_SYS_SUPPORTS_PCI=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -63,6 +65,7 @@ CONFIG_BSD_PROCESS_ACCT=y
63# 65#
64CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 69# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -103,12 +106,14 @@ CONFIG_EVENTFD=y
103CONFIG_SHMEM=y 106CONFIG_SHMEM=y
104CONFIG_AIO=y 107CONFIG_AIO=y
105CONFIG_HAVE_PERF_EVENTS=y 108CONFIG_HAVE_PERF_EVENTS=y
109CONFIG_PERF_USE_VMALLOC=y
106 110
107# 111#
108# Kernel Performance Events And Counters 112# Kernel Performance Events And Counters
109# 113#
110CONFIG_PERF_EVENTS=y 114CONFIG_PERF_EVENTS=y
111# CONFIG_PERF_COUNTERS is not set 115# CONFIG_PERF_COUNTERS is not set
116# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
112CONFIG_VM_EVENT_COUNTERS=y 117CONFIG_VM_EVENT_COUNTERS=y
113CONFIG_PCI_QUIRKS=y 118CONFIG_PCI_QUIRKS=y
114CONFIG_COMPAT_BRK=y 119CONFIG_COMPAT_BRK=y
@@ -123,6 +128,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
123CONFIG_HAVE_KPROBES=y 128CONFIG_HAVE_KPROBES=y
124CONFIG_HAVE_KRETPROBES=y 129CONFIG_HAVE_KRETPROBES=y
125CONFIG_HAVE_ARCH_TRACEHOOK=y 130CONFIG_HAVE_ARCH_TRACEHOOK=y
131CONFIG_HAVE_DMA_ATTRS=y
126CONFIG_HAVE_CLK=y 132CONFIG_HAVE_CLK=y
127CONFIG_HAVE_DMA_API_DEBUG=y 133CONFIG_HAVE_DMA_API_DEBUG=y
128 134
@@ -149,14 +155,41 @@ CONFIG_LBDAF=y
149# IO Schedulers 155# IO Schedulers
150# 156#
151CONFIG_IOSCHED_NOOP=y 157CONFIG_IOSCHED_NOOP=y
152CONFIG_IOSCHED_AS=y
153CONFIG_IOSCHED_DEADLINE=y 158CONFIG_IOSCHED_DEADLINE=y
154CONFIG_IOSCHED_CFQ=y 159CONFIG_IOSCHED_CFQ=y
155# CONFIG_DEFAULT_AS is not set
156# CONFIG_DEFAULT_DEADLINE is not set 160# CONFIG_DEFAULT_DEADLINE is not set
157CONFIG_DEFAULT_CFQ=y 161CONFIG_DEFAULT_CFQ=y
158# CONFIG_DEFAULT_NOOP is not set 162# CONFIG_DEFAULT_NOOP is not set
159CONFIG_DEFAULT_IOSCHED="cfq" 163CONFIG_DEFAULT_IOSCHED="cfq"
164# CONFIG_INLINE_SPIN_TRYLOCK is not set
165# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
166# CONFIG_INLINE_SPIN_LOCK is not set
167# CONFIG_INLINE_SPIN_LOCK_BH is not set
168# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
169# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
170# CONFIG_INLINE_SPIN_UNLOCK is not set
171# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
172# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
173# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
174# CONFIG_INLINE_READ_TRYLOCK is not set
175# CONFIG_INLINE_READ_LOCK is not set
176# CONFIG_INLINE_READ_LOCK_BH is not set
177# CONFIG_INLINE_READ_LOCK_IRQ is not set
178# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
179# CONFIG_INLINE_READ_UNLOCK is not set
180# CONFIG_INLINE_READ_UNLOCK_BH is not set
181# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
182# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
183# CONFIG_INLINE_WRITE_TRYLOCK is not set
184# CONFIG_INLINE_WRITE_LOCK is not set
185# CONFIG_INLINE_WRITE_LOCK_BH is not set
186# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
187# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
188# CONFIG_INLINE_WRITE_UNLOCK is not set
189# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
190# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
191# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
192# CONFIG_MUTEX_SPIN_ON_OWNER is not set
160# CONFIG_FREEZER is not set 193# CONFIG_FREEZER is not set
161 194
162# 195#
@@ -237,8 +270,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
237# CONFIG_PHYS_ADDR_T_64BIT is not set 270# CONFIG_PHYS_ADDR_T_64BIT is not set
238CONFIG_ZONE_DMA_FLAG=0 271CONFIG_ZONE_DMA_FLAG=0
239CONFIG_NR_QUICK=2 272CONFIG_NR_QUICK=2
240CONFIG_HAVE_MLOCK=y
241CONFIG_HAVE_MLOCKED_PAGE_BIT=y
242# CONFIG_KSM is not set 273# CONFIG_KSM is not set
243CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 274CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
244 275
@@ -271,7 +302,6 @@ CONFIG_SH_SH7785LCR_29BIT_PHYSMAPS=y
271# Timer and clock configuration 302# Timer and clock configuration
272# 303#
273CONFIG_SH_TIMER_TMU=y 304CONFIG_SH_TIMER_TMU=y
274CONFIG_SH_PCLK_FREQ=50000000
275CONFIG_SH_CLK_CPG=y 305CONFIG_SH_CLK_CPG=y
276CONFIG_TICK_ONESHOT=y 306CONFIG_TICK_ONESHOT=y
277# CONFIG_NO_HZ is not set 307# CONFIG_NO_HZ is not set
@@ -329,7 +359,6 @@ CONFIG_ENTRY_OFFSET=0x00001000
329# Bus options 359# Bus options
330# 360#
331CONFIG_PCI=y 361CONFIG_PCI=y
332CONFIG_SH_PCIDMA_NONCOHERENT=y
333# CONFIG_PCIEPORTBUS is not set 362# CONFIG_PCIEPORTBUS is not set
334# CONFIG_ARCH_SUPPORTS_MSI is not set 363# CONFIG_ARCH_SUPPORTS_MSI is not set
335CONFIG_PCI_LEGACY=y 364CONFIG_PCI_LEGACY=y
@@ -433,10 +462,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
433# CONFIG_AF_RXRPC is not set 462# CONFIG_AF_RXRPC is not set
434CONFIG_WIRELESS=y 463CONFIG_WIRELESS=y
435# CONFIG_CFG80211 is not set 464# CONFIG_CFG80211 is not set
436CONFIG_CFG80211_DEFAULT_PS_VALUE=0
437# CONFIG_WIRELESS_OLD_REGULATORY is not set
438CONFIG_WIRELESS_EXT=y
439CONFIG_WIRELESS_EXT_SYSFS=y
440# CONFIG_LIB80211 is not set 465# CONFIG_LIB80211 is not set
441 466
442# 467#
@@ -552,6 +577,10 @@ CONFIG_BLK_DEV=y
552# CONFIG_BLK_DEV_UMEM is not set 577# CONFIG_BLK_DEV_UMEM is not set
553# CONFIG_BLK_DEV_COW_COMMON is not set 578# CONFIG_BLK_DEV_COW_COMMON is not set
554# CONFIG_BLK_DEV_LOOP is not set 579# CONFIG_BLK_DEV_LOOP is not set
580
581#
582# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
583#
555# CONFIG_BLK_DEV_NBD is not set 584# CONFIG_BLK_DEV_NBD is not set
556# CONFIG_BLK_DEV_SX8 is not set 585# CONFIG_BLK_DEV_SX8 is not set
557# CONFIG_BLK_DEV_UB is not set 586# CONFIG_BLK_DEV_UB is not set
@@ -652,15 +681,16 @@ CONFIG_SATA_SIL=y
652# CONFIG_PATA_NS87415 is not set 681# CONFIG_PATA_NS87415 is not set
653# CONFIG_PATA_OPTI is not set 682# CONFIG_PATA_OPTI is not set
654# CONFIG_PATA_OPTIDMA is not set 683# CONFIG_PATA_OPTIDMA is not set
684# CONFIG_PATA_PDC2027X is not set
655# CONFIG_PATA_PDC_OLD is not set 685# CONFIG_PATA_PDC_OLD is not set
656# CONFIG_PATA_RADISYS is not set 686# CONFIG_PATA_RADISYS is not set
657# CONFIG_PATA_RDC is not set 687# CONFIG_PATA_RDC is not set
658# CONFIG_PATA_RZ1000 is not set 688# CONFIG_PATA_RZ1000 is not set
659# CONFIG_PATA_SC1200 is not set 689# CONFIG_PATA_SC1200 is not set
660# CONFIG_PATA_SERVERWORKS is not set 690# CONFIG_PATA_SERVERWORKS is not set
661# CONFIG_PATA_PDC2027X is not set
662# CONFIG_PATA_SIL680 is not set 691# CONFIG_PATA_SIL680 is not set
663# CONFIG_PATA_SIS is not set 692# CONFIG_PATA_SIS is not set
693# CONFIG_PATA_TOSHIBA is not set
664# CONFIG_PATA_VIA is not set 694# CONFIG_PATA_VIA is not set
665# CONFIG_PATA_WINBOND is not set 695# CONFIG_PATA_WINBOND is not set
666# CONFIG_PATA_PLATFORM is not set 696# CONFIG_PATA_PLATFORM is not set
@@ -719,8 +749,10 @@ CONFIG_R8169=y
719# CONFIG_NETDEV_10000 is not set 749# CONFIG_NETDEV_10000 is not set
720# CONFIG_TR is not set 750# CONFIG_TR is not set
721CONFIG_WLAN=y 751CONFIG_WLAN=y
722# CONFIG_WLAN_PRE80211 is not set 752# CONFIG_ATMEL is not set
723# CONFIG_WLAN_80211 is not set 753# CONFIG_PRISM54 is not set
754# CONFIG_USB_ZD1201 is not set
755# CONFIG_HOSTAP is not set
724 756
725# 757#
726# Enable WiMAX (Networking options) to see the WiMAX drivers 758# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -743,6 +775,7 @@ CONFIG_WLAN=y
743# CONFIG_NETCONSOLE is not set 775# CONFIG_NETCONSOLE is not set
744# CONFIG_NETPOLL is not set 776# CONFIG_NETPOLL is not set
745# CONFIG_NET_POLL_CONTROLLER is not set 777# CONFIG_NET_POLL_CONTROLLER is not set
778# CONFIG_VMXNET3 is not set
746# CONFIG_ISDN is not set 779# CONFIG_ISDN is not set
747# CONFIG_PHONE is not set 780# CONFIG_PHONE is not set
748 781
@@ -752,6 +785,7 @@ CONFIG_WLAN=y
752CONFIG_INPUT=y 785CONFIG_INPUT=y
753CONFIG_INPUT_FF_MEMLESS=m 786CONFIG_INPUT_FF_MEMLESS=m
754# CONFIG_INPUT_POLLDEV is not set 787# CONFIG_INPUT_POLLDEV is not set
788# CONFIG_INPUT_SPARSEKMAP is not set
755 789
756# 790#
757# Userland interfaces 791# Userland interfaces
@@ -874,11 +908,6 @@ CONFIG_I2C_ALGOPCA=y
874# CONFIG_I2C_TINY_USB is not set 908# CONFIG_I2C_TINY_USB is not set
875 909
876# 910#
877# Graphics adapter I2C/DDC channel drivers
878#
879# CONFIG_I2C_VOODOO3 is not set
880
881#
882# Other I2C/SMBus bus drivers 911# Other I2C/SMBus bus drivers
883# 912#
884CONFIG_I2C_PCA_PLATFORM=y 913CONFIG_I2C_PCA_PLATFORM=y
@@ -887,7 +916,6 @@ CONFIG_I2C_PCA_PLATFORM=y
887# 916#
888# Miscellaneous I2C Chip support 917# Miscellaneous I2C Chip support
889# 918#
890# CONFIG_DS1682 is not set
891# CONFIG_SENSORS_TSL2550 is not set 919# CONFIG_SENSORS_TSL2550 is not set
892# CONFIG_I2C_DEBUG_CORE is not set 920# CONFIG_I2C_DEBUG_CORE is not set
893# CONFIG_I2C_DEBUG_ALGO is not set 921# CONFIG_I2C_DEBUG_ALGO is not set
@@ -916,15 +944,18 @@ CONFIG_SSB_POSSIBLE=y
916# 944#
917# CONFIG_MFD_CORE is not set 945# CONFIG_MFD_CORE is not set
918CONFIG_MFD_SM501=y 946CONFIG_MFD_SM501=y
947# CONFIG_MFD_SH_MOBILE_SDHI is not set
919# CONFIG_HTC_PASIC3 is not set 948# CONFIG_HTC_PASIC3 is not set
920# CONFIG_TWL4030_CORE is not set 949# CONFIG_TWL4030_CORE is not set
921# CONFIG_MFD_TMIO is not set 950# CONFIG_MFD_TMIO is not set
922# CONFIG_PMIC_DA903X is not set 951# CONFIG_PMIC_DA903X is not set
952# CONFIG_PMIC_ADP5520 is not set
923# CONFIG_MFD_WM8400 is not set 953# CONFIG_MFD_WM8400 is not set
924# CONFIG_MFD_WM831X is not set 954# CONFIG_MFD_WM831X is not set
925# CONFIG_MFD_WM8350_I2C is not set 955# CONFIG_MFD_WM8350_I2C is not set
926# CONFIG_MFD_PCF50633 is not set 956# CONFIG_MFD_PCF50633 is not set
927# CONFIG_AB3100_CORE is not set 957# CONFIG_AB3100_CORE is not set
958# CONFIG_MFD_88PM8607 is not set
928# CONFIG_REGULATOR is not set 959# CONFIG_REGULATOR is not set
929# CONFIG_MEDIA_SUPPORT is not set 960# CONFIG_MEDIA_SUPPORT is not set
930 961
@@ -1205,6 +1236,7 @@ CONFIG_RTC_DRV_RS5C372=y
1205# CONFIG_RTC_DRV_PCF8563 is not set 1236# CONFIG_RTC_DRV_PCF8563 is not set
1206# CONFIG_RTC_DRV_PCF8583 is not set 1237# CONFIG_RTC_DRV_PCF8583 is not set
1207# CONFIG_RTC_DRV_M41T80 is not set 1238# CONFIG_RTC_DRV_M41T80 is not set
1239# CONFIG_RTC_DRV_BQ32K is not set
1208# CONFIG_RTC_DRV_S35390A is not set 1240# CONFIG_RTC_DRV_S35390A is not set
1209# CONFIG_RTC_DRV_FM3130 is not set 1241# CONFIG_RTC_DRV_FM3130 is not set
1210# CONFIG_RTC_DRV_RX8581 is not set 1242# CONFIG_RTC_DRV_RX8581 is not set
@@ -1225,7 +1257,9 @@ CONFIG_RTC_DRV_RS5C372=y
1225# CONFIG_RTC_DRV_M48T86 is not set 1257# CONFIG_RTC_DRV_M48T86 is not set
1226# CONFIG_RTC_DRV_M48T35 is not set 1258# CONFIG_RTC_DRV_M48T35 is not set
1227# CONFIG_RTC_DRV_M48T59 is not set 1259# CONFIG_RTC_DRV_M48T59 is not set
1260# CONFIG_RTC_DRV_MSM6242 is not set
1228# CONFIG_RTC_DRV_BQ4802 is not set 1261# CONFIG_RTC_DRV_BQ4802 is not set
1262# CONFIG_RTC_DRV_RP5C01 is not set
1229# CONFIG_RTC_DRV_V3020 is not set 1263# CONFIG_RTC_DRV_V3020 is not set
1230 1264
1231# 1265#
@@ -1484,7 +1518,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1484CONFIG_HAVE_ARCH_KGDB=y 1518CONFIG_HAVE_ARCH_KGDB=y
1485# CONFIG_KGDB is not set 1519# CONFIG_KGDB is not set
1486# CONFIG_SH_STANDARD_BIOS is not set 1520# CONFIG_SH_STANDARD_BIOS is not set
1487# CONFIG_EARLY_SCIF_CONSOLE is not set
1488# CONFIG_STACK_DEBUG is not set 1521# CONFIG_STACK_DEBUG is not set
1489# CONFIG_DEBUG_STACK_USAGE is not set 1522# CONFIG_DEBUG_STACK_USAGE is not set
1490# CONFIG_4KSTACKS is not set 1523# CONFIG_4KSTACKS is not set
@@ -1498,7 +1531,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1498# CONFIG_KEYS is not set 1531# CONFIG_KEYS is not set
1499# CONFIG_SECURITY is not set 1532# CONFIG_SECURITY is not set
1500# CONFIG_SECURITYFS is not set 1533# CONFIG_SECURITYFS is not set
1501# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1534# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1535# CONFIG_DEFAULT_SECURITY_SMACK is not set
1536# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1537CONFIG_DEFAULT_SECURITY_DAC=y
1538CONFIG_DEFAULT_SECURITY=""
1502CONFIG_CRYPTO=y 1539CONFIG_CRYPTO=y
1503 1540
1504# 1541#
diff --git a/arch/sh/configs/shmin_defconfig b/arch/sh/configs/shmin_defconfig
index 92115e612750..45441c0ab30c 100644
--- a/arch/sh/configs/shmin_defconfig
+++ b/arch/sh/configs/shmin_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:27:17 2009 4# Mon Jan 4 15:10:09 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -28,6 +28,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28CONFIG_ARCH_NO_VIRT_TO_BUS=y 28CONFIG_ARCH_NO_VIRT_TO_BUS=y
29CONFIG_ARCH_HAS_DEFAULT_IDLE=y 29CONFIG_ARCH_HAS_DEFAULT_IDLE=y
30CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 30CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
31CONFIG_DMA_NONCOHERENT=y
31CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
32CONFIG_CONSTRUCTORS=y 33CONFIG_CONSTRUCTORS=y
33 34
@@ -57,6 +58,7 @@ CONFIG_KERNEL_GZIP=y
57# 58#
58CONFIG_TREE_RCU=y 59CONFIG_TREE_RCU=y
59# CONFIG_TREE_PREEMPT_RCU is not set 60# CONFIG_TREE_PREEMPT_RCU is not set
61# CONFIG_TINY_RCU is not set
60# CONFIG_RCU_TRACE is not set 62# CONFIG_RCU_TRACE is not set
61CONFIG_RCU_FANOUT=32 63CONFIG_RCU_FANOUT=32
62# CONFIG_RCU_FANOUT_EXACT is not set 64# CONFIG_RCU_FANOUT_EXACT is not set
@@ -88,6 +90,7 @@ CONFIG_EVENTFD=y
88# CONFIG_SHMEM is not set 90# CONFIG_SHMEM is not set
89CONFIG_AIO=y 91CONFIG_AIO=y
90CONFIG_HAVE_PERF_EVENTS=y 92CONFIG_HAVE_PERF_EVENTS=y
93CONFIG_PERF_USE_VMALLOC=y
91 94
92# 95#
93# Kernel Performance Events And Counters 96# Kernel Performance Events And Counters
@@ -105,6 +108,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
105CONFIG_HAVE_KPROBES=y 108CONFIG_HAVE_KPROBES=y
106CONFIG_HAVE_KRETPROBES=y 109CONFIG_HAVE_KRETPROBES=y
107CONFIG_HAVE_ARCH_TRACEHOOK=y 110CONFIG_HAVE_ARCH_TRACEHOOK=y
111CONFIG_HAVE_DMA_ATTRS=y
108CONFIG_HAVE_CLK=y 112CONFIG_HAVE_CLK=y
109CONFIG_HAVE_DMA_API_DEBUG=y 113CONFIG_HAVE_DMA_API_DEBUG=y
110 114
@@ -124,14 +128,41 @@ CONFIG_LBDAF=y
124# IO Schedulers 128# IO Schedulers
125# 129#
126CONFIG_IOSCHED_NOOP=y 130CONFIG_IOSCHED_NOOP=y
127# CONFIG_IOSCHED_AS is not set
128# CONFIG_IOSCHED_DEADLINE is not set 131# CONFIG_IOSCHED_DEADLINE is not set
129# CONFIG_IOSCHED_CFQ is not set 132# CONFIG_IOSCHED_CFQ is not set
130# CONFIG_DEFAULT_AS is not set
131# CONFIG_DEFAULT_DEADLINE is not set 133# CONFIG_DEFAULT_DEADLINE is not set
132# CONFIG_DEFAULT_CFQ is not set 134# CONFIG_DEFAULT_CFQ is not set
133CONFIG_DEFAULT_NOOP=y 135CONFIG_DEFAULT_NOOP=y
134CONFIG_DEFAULT_IOSCHED="noop" 136CONFIG_DEFAULT_IOSCHED="noop"
137# CONFIG_INLINE_SPIN_TRYLOCK is not set
138# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
139# CONFIG_INLINE_SPIN_LOCK is not set
140# CONFIG_INLINE_SPIN_LOCK_BH is not set
141# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
142# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
143CONFIG_INLINE_SPIN_UNLOCK=y
144# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
145CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
146# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
147# CONFIG_INLINE_READ_TRYLOCK is not set
148# CONFIG_INLINE_READ_LOCK is not set
149# CONFIG_INLINE_READ_LOCK_BH is not set
150# CONFIG_INLINE_READ_LOCK_IRQ is not set
151# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
152CONFIG_INLINE_READ_UNLOCK=y
153# CONFIG_INLINE_READ_UNLOCK_BH is not set
154CONFIG_INLINE_READ_UNLOCK_IRQ=y
155# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
156# CONFIG_INLINE_WRITE_TRYLOCK is not set
157# CONFIG_INLINE_WRITE_LOCK is not set
158# CONFIG_INLINE_WRITE_LOCK_BH is not set
159# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
160# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
161CONFIG_INLINE_WRITE_UNLOCK=y
162# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
163CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
164# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
165# CONFIG_MUTEX_SPIN_ON_OWNER is not set
135# CONFIG_FREEZER is not set 166# CONFIG_FREEZER is not set
136 167
137# 168#
@@ -207,8 +238,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
207# CONFIG_PHYS_ADDR_T_64BIT is not set 238# CONFIG_PHYS_ADDR_T_64BIT is not set
208CONFIG_ZONE_DMA_FLAG=0 239CONFIG_ZONE_DMA_FLAG=0
209CONFIG_NR_QUICK=2 240CONFIG_NR_QUICK=2
210CONFIG_HAVE_MLOCK=y
211CONFIG_HAVE_MLOCKED_PAGE_BIT=y
212# CONFIG_KSM is not set 241# CONFIG_KSM is not set
213CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 242CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
214 243
@@ -387,9 +416,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
387# CONFIG_AF_RXRPC is not set 416# CONFIG_AF_RXRPC is not set
388CONFIG_WIRELESS=y 417CONFIG_WIRELESS=y
389# CONFIG_CFG80211 is not set 418# CONFIG_CFG80211 is not set
390CONFIG_CFG80211_DEFAULT_PS_VALUE=0
391# CONFIG_WIRELESS_OLD_REGULATORY is not set
392# CONFIG_WIRELESS_EXT is not set
393# CONFIG_LIB80211 is not set 419# CONFIG_LIB80211 is not set
394 420
395# 421#
@@ -495,6 +521,10 @@ CONFIG_BLK_DEV=y
495# CONFIG_BLK_DEV_COW_COMMON is not set 521# CONFIG_BLK_DEV_COW_COMMON is not set
496CONFIG_BLK_DEV_LOOP=y 522CONFIG_BLK_DEV_LOOP=y
497# CONFIG_BLK_DEV_CRYPTOLOOP is not set 523# CONFIG_BLK_DEV_CRYPTOLOOP is not set
524
525#
526# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
527#
498# CONFIG_BLK_DEV_NBD is not set 528# CONFIG_BLK_DEV_NBD is not set
499# CONFIG_BLK_DEV_RAM is not set 529# CONFIG_BLK_DEV_RAM is not set
500# CONFIG_CDROM_PKTCDVD is not set 530# CONFIG_CDROM_PKTCDVD is not set
@@ -546,11 +576,11 @@ CONFIG_NET_ETHERNET=y
546# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 576# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
547# CONFIG_B44 is not set 577# CONFIG_B44 is not set
548# CONFIG_KS8842 is not set 578# CONFIG_KS8842 is not set
579# CONFIG_KS8851_MLL is not set
549CONFIG_NETDEV_1000=y 580CONFIG_NETDEV_1000=y
550CONFIG_NETDEV_10000=y 581CONFIG_NETDEV_10000=y
551CONFIG_WLAN=y 582CONFIG_WLAN=y
552# CONFIG_WLAN_PRE80211 is not set 583# CONFIG_HOSTAP is not set
553# CONFIG_WLAN_80211 is not set
554 584
555# 585#
556# Enable WiMAX (Networking options) to see the WiMAX drivers 586# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -629,6 +659,7 @@ CONFIG_SSB_POSSIBLE=y
629# 659#
630# CONFIG_MFD_CORE is not set 660# CONFIG_MFD_CORE is not set
631# CONFIG_MFD_SM501 is not set 661# CONFIG_MFD_SM501 is not set
662# CONFIG_MFD_SH_MOBILE_SDHI is not set
632# CONFIG_HTC_PASIC3 is not set 663# CONFIG_HTC_PASIC3 is not set
633# CONFIG_MFD_TMIO is not set 664# CONFIG_MFD_TMIO is not set
634# CONFIG_REGULATOR is not set 665# CONFIG_REGULATOR is not set
@@ -688,6 +719,7 @@ CONFIG_RTC_LIB=y
688# CONFIG_EXT2_FS is not set 719# CONFIG_EXT2_FS is not set
689# CONFIG_EXT3_FS is not set 720# CONFIG_EXT3_FS is not set
690# CONFIG_EXT4_FS is not set 721# CONFIG_EXT4_FS is not set
722CONFIG_EXT4_USE_FOR_EXT23=y
691# CONFIG_REISERFS_FS is not set 723# CONFIG_REISERFS_FS is not set
692# CONFIG_JFS_FS is not set 724# CONFIG_JFS_FS is not set
693# CONFIG_FS_POSIX_ACL is not set 725# CONFIG_FS_POSIX_ACL is not set
@@ -731,7 +763,6 @@ CONFIG_PROC_FS=y
731CONFIG_PROC_SYSCTL=y 763CONFIG_PROC_SYSCTL=y
732CONFIG_PROC_PAGE_MONITOR=y 764CONFIG_PROC_PAGE_MONITOR=y
733# CONFIG_SYSFS is not set 765# CONFIG_SYSFS is not set
734# CONFIG_HUGETLBFS is not set
735# CONFIG_HUGETLB_PAGE is not set 766# CONFIG_HUGETLB_PAGE is not set
736CONFIG_MISC_FILESYSTEMS=y 767CONFIG_MISC_FILESYSTEMS=y
737# CONFIG_ADFS_FS is not set 768# CONFIG_ADFS_FS is not set
@@ -794,6 +825,7 @@ CONFIG_FRAME_WARN=1024
794# CONFIG_DEBUG_MEMORY_INIT is not set 825# CONFIG_DEBUG_MEMORY_INIT is not set
795# CONFIG_RCU_CPU_STALL_DETECTOR is not set 826# CONFIG_RCU_CPU_STALL_DETECTOR is not set
796# CONFIG_LATENCYTOP is not set 827# CONFIG_LATENCYTOP is not set
828# CONFIG_SYSCTL_SYSCALL_CHECK is not set
797CONFIG_HAVE_FUNCTION_TRACER=y 829CONFIG_HAVE_FUNCTION_TRACER=y
798CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 830CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
799CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 831CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -806,8 +838,6 @@ CONFIG_TRACING_SUPPORT=y
806# CONFIG_SAMPLES is not set 838# CONFIG_SAMPLES is not set
807CONFIG_HAVE_ARCH_KGDB=y 839CONFIG_HAVE_ARCH_KGDB=y
808CONFIG_SH_STANDARD_BIOS=y 840CONFIG_SH_STANDARD_BIOS=y
809# CONFIG_EARLY_SCIF_CONSOLE is not set
810CONFIG_EARLY_PRINTK=y
811# CONFIG_DWARF_UNWINDER is not set 841# CONFIG_DWARF_UNWINDER is not set
812 842
813# 843#
@@ -815,7 +845,11 @@ CONFIG_EARLY_PRINTK=y
815# 845#
816# CONFIG_KEYS is not set 846# CONFIG_KEYS is not set
817# CONFIG_SECURITYFS is not set 847# CONFIG_SECURITYFS is not set
818# CONFIG_SECURITY_FILE_CAPABILITIES is not set 848# CONFIG_DEFAULT_SECURITY_SELINUX is not set
849# CONFIG_DEFAULT_SECURITY_SMACK is not set
850# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
851CONFIG_DEFAULT_SECURITY_DAC=y
852CONFIG_DEFAULT_SECURITY=""
819CONFIG_CRYPTO=y 853CONFIG_CRYPTO=y
820 854
821# 855#
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index e3858d757d5e..ecf50cda4cbc 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:29:26 2009 4# Mon Jan 4 15:10:45 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -22,6 +22,7 @@ CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
22CONFIG_GENERIC_LOCKBREAK=y 22CONFIG_GENERIC_LOCKBREAK=y
23# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 23# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
24CONFIG_ARCH_HIBERNATION_POSSIBLE=y 24CONFIG_ARCH_HIBERNATION_POSSIBLE=y
25CONFIG_SYS_SUPPORTS_HUGETLBFS=y
25CONFIG_SYS_SUPPORTS_SMP=y 26CONFIG_SYS_SUPPORTS_SMP=y
26CONFIG_SYS_SUPPORTS_NUMA=y 27CONFIG_SYS_SUPPORTS_NUMA=y
27CONFIG_SYS_SUPPORTS_TMU=y 28CONFIG_SYS_SUPPORTS_TMU=y
@@ -32,6 +33,8 @@ CONFIG_LOCKDEP_SUPPORT=y
32CONFIG_ARCH_NO_VIRT_TO_BUS=y 33CONFIG_ARCH_NO_VIRT_TO_BUS=y
33CONFIG_ARCH_HAS_DEFAULT_IDLE=y 34CONFIG_ARCH_HAS_DEFAULT_IDLE=y
34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 35CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
36CONFIG_DMA_COHERENT=y
37# CONFIG_DMA_NONCOHERENT is not set
35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 38CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
36CONFIG_CONSTRUCTORS=y 39CONFIG_CONSTRUCTORS=y
37 40
@@ -66,6 +69,7 @@ CONFIG_AUDIT_TREE=y
66# 69#
67CONFIG_TREE_RCU=y 70CONFIG_TREE_RCU=y
68# CONFIG_TREE_PREEMPT_RCU is not set 71# CONFIG_TREE_PREEMPT_RCU is not set
72# CONFIG_TINY_RCU is not set
69CONFIG_RCU_TRACE=y 73CONFIG_RCU_TRACE=y
70CONFIG_RCU_FANOUT=32 74CONFIG_RCU_FANOUT=32
71# CONFIG_RCU_FANOUT_EXACT is not set 75# CONFIG_RCU_FANOUT_EXACT is not set
@@ -121,6 +125,7 @@ CONFIG_EVENTFD=y
121CONFIG_SHMEM=y 125CONFIG_SHMEM=y
122CONFIG_AIO=y 126CONFIG_AIO=y
123CONFIG_HAVE_PERF_EVENTS=y 127CONFIG_HAVE_PERF_EVENTS=y
128CONFIG_PERF_USE_VMALLOC=y
124 129
125# 130#
126# Kernel Performance Events And Counters 131# Kernel Performance Events And Counters
@@ -128,6 +133,7 @@ CONFIG_HAVE_PERF_EVENTS=y
128CONFIG_PERF_EVENTS=y 133CONFIG_PERF_EVENTS=y
129CONFIG_EVENT_PROFILE=y 134CONFIG_EVENT_PROFILE=y
130# CONFIG_PERF_COUNTERS is not set 135# CONFIG_PERF_COUNTERS is not set
136# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
131CONFIG_VM_EVENT_COUNTERS=y 137CONFIG_VM_EVENT_COUNTERS=y
132CONFIG_COMPAT_BRK=y 138CONFIG_COMPAT_BRK=y
133# CONFIG_SLAB is not set 139# CONFIG_SLAB is not set
@@ -143,6 +149,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
143CONFIG_HAVE_KPROBES=y 149CONFIG_HAVE_KPROBES=y
144CONFIG_HAVE_KRETPROBES=y 150CONFIG_HAVE_KRETPROBES=y
145CONFIG_HAVE_ARCH_TRACEHOOK=y 151CONFIG_HAVE_ARCH_TRACEHOOK=y
152CONFIG_HAVE_DMA_ATTRS=y
146CONFIG_USE_GENERIC_SMP_HELPERS=y 153CONFIG_USE_GENERIC_SMP_HELPERS=y
147CONFIG_HAVE_CLK=y 154CONFIG_HAVE_CLK=y
148CONFIG_HAVE_DMA_API_DEBUG=y 155CONFIG_HAVE_DMA_API_DEBUG=y
@@ -166,19 +173,48 @@ CONFIG_BLOCK=y
166CONFIG_LBDAF=y 173CONFIG_LBDAF=y
167# CONFIG_BLK_DEV_BSG is not set 174# CONFIG_BLK_DEV_BSG is not set
168# CONFIG_BLK_DEV_INTEGRITY is not set 175# CONFIG_BLK_DEV_INTEGRITY is not set
176# CONFIG_BLK_CGROUP is not set
169 177
170# 178#
171# IO Schedulers 179# IO Schedulers
172# 180#
173CONFIG_IOSCHED_NOOP=y 181CONFIG_IOSCHED_NOOP=y
174CONFIG_IOSCHED_AS=y
175CONFIG_IOSCHED_DEADLINE=y 182CONFIG_IOSCHED_DEADLINE=y
176CONFIG_IOSCHED_CFQ=y 183CONFIG_IOSCHED_CFQ=y
177CONFIG_DEFAULT_AS=y 184# CONFIG_CFQ_GROUP_IOSCHED is not set
178# CONFIG_DEFAULT_DEADLINE is not set 185# CONFIG_DEFAULT_DEADLINE is not set
179# CONFIG_DEFAULT_CFQ is not set 186CONFIG_DEFAULT_CFQ=y
180# CONFIG_DEFAULT_NOOP is not set 187# CONFIG_DEFAULT_NOOP is not set
181CONFIG_DEFAULT_IOSCHED="anticipatory" 188CONFIG_DEFAULT_IOSCHED="cfq"
189# CONFIG_INLINE_SPIN_TRYLOCK is not set
190# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
191# CONFIG_INLINE_SPIN_LOCK is not set
192# CONFIG_INLINE_SPIN_LOCK_BH is not set
193# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
194# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
195# CONFIG_INLINE_SPIN_UNLOCK is not set
196# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
197# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
198# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
199# CONFIG_INLINE_READ_TRYLOCK is not set
200# CONFIG_INLINE_READ_LOCK is not set
201# CONFIG_INLINE_READ_LOCK_BH is not set
202# CONFIG_INLINE_READ_LOCK_IRQ is not set
203# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
204# CONFIG_INLINE_READ_UNLOCK is not set
205# CONFIG_INLINE_READ_UNLOCK_BH is not set
206# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
207# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
208# CONFIG_INLINE_WRITE_TRYLOCK is not set
209# CONFIG_INLINE_WRITE_LOCK is not set
210# CONFIG_INLINE_WRITE_LOCK_BH is not set
211# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
212# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
213# CONFIG_INLINE_WRITE_UNLOCK is not set
214# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
215# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
216# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
217CONFIG_MUTEX_SPIN_ON_OWNER=y
182CONFIG_FREEZER=y 218CONFIG_FREEZER=y
183 219
184# 220#
@@ -233,6 +269,7 @@ CONFIG_FORCE_MAX_ZONEORDER=7
233CONFIG_MEMORY_START=0x0c000000 269CONFIG_MEMORY_START=0x0c000000
234CONFIG_MEMORY_SIZE=0x04000000 270CONFIG_MEMORY_SIZE=0x04000000
235CONFIG_29BIT=y 271CONFIG_29BIT=y
272# CONFIG_PMB_ENABLE is not set
236# CONFIG_X2TLB is not set 273# CONFIG_X2TLB is not set
237CONFIG_VSYSCALL=y 274CONFIG_VSYSCALL=y
238CONFIG_NUMA=y 275CONFIG_NUMA=y
@@ -271,10 +308,9 @@ CONFIG_MIGRATION=y
271# CONFIG_PHYS_ADDR_T_64BIT is not set 308# CONFIG_PHYS_ADDR_T_64BIT is not set
272CONFIG_ZONE_DMA_FLAG=0 309CONFIG_ZONE_DMA_FLAG=0
273CONFIG_NR_QUICK=2 310CONFIG_NR_QUICK=2
274CONFIG_HAVE_MLOCK=y
275CONFIG_HAVE_MLOCKED_PAGE_BIT=y
276# CONFIG_KSM is not set 311# CONFIG_KSM is not set
277CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 312CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
313CONFIG_SCHED_MC=y
278 314
279# 315#
280# Cache configuration 316# Cache configuration
@@ -449,6 +485,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
449CONFIG_INET6_XFRM_MODE_BEET=m 485CONFIG_INET6_XFRM_MODE_BEET=m
450# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 486# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
451CONFIG_IPV6_SIT=m 487CONFIG_IPV6_SIT=m
488# CONFIG_IPV6_SIT_6RD is not set
452CONFIG_IPV6_NDISC_NODETYPE=y 489CONFIG_IPV6_NDISC_NODETYPE=y
453# CONFIG_IPV6_TUNNEL is not set 490# CONFIG_IPV6_TUNNEL is not set
454# CONFIG_IPV6_MULTIPLE_TABLES is not set 491# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -496,7 +533,13 @@ CONFIG_CAN_VCAN=m
496# CONFIG_IRDA is not set 533# CONFIG_IRDA is not set
497# CONFIG_BT is not set 534# CONFIG_BT is not set
498# CONFIG_AF_RXRPC is not set 535# CONFIG_AF_RXRPC is not set
499# CONFIG_WIRELESS is not set 536CONFIG_WIRELESS=y
537# CONFIG_CFG80211 is not set
538# CONFIG_LIB80211 is not set
539
540#
541# CFG80211 needs to be enabled for MAC80211
542#
500# CONFIG_WIMAX is not set 543# CONFIG_WIMAX is not set
501# CONFIG_RFKILL is not set 544# CONFIG_RFKILL is not set
502# CONFIG_NET_9P is not set 545# CONFIG_NET_9P is not set
@@ -522,6 +565,10 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
522CONFIG_BLK_DEV=y 565CONFIG_BLK_DEV=y
523# CONFIG_BLK_DEV_COW_COMMON is not set 566# CONFIG_BLK_DEV_COW_COMMON is not set
524# CONFIG_BLK_DEV_LOOP is not set 567# CONFIG_BLK_DEV_LOOP is not set
568
569#
570# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
571#
525# CONFIG_BLK_DEV_NBD is not set 572# CONFIG_BLK_DEV_NBD is not set
526# CONFIG_BLK_DEV_UB is not set 573# CONFIG_BLK_DEV_UB is not set
527CONFIG_BLK_DEV_RAM=y 574CONFIG_BLK_DEV_RAM=y
@@ -532,9 +579,12 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
532# CONFIG_ATA_OVER_ETH is not set 579# CONFIG_ATA_OVER_ETH is not set
533# CONFIG_BLK_DEV_HD is not set 580# CONFIG_BLK_DEV_HD is not set
534CONFIG_MISC_DEVICES=y 581CONFIG_MISC_DEVICES=y
582# CONFIG_AD525X_DPOT is not set
535# CONFIG_ICS932S401 is not set 583# CONFIG_ICS932S401 is not set
536# CONFIG_ENCLOSURE_SERVICES is not set 584# CONFIG_ENCLOSURE_SERVICES is not set
537# CONFIG_ISL29003 is not set 585# CONFIG_ISL29003 is not set
586# CONFIG_DS1682 is not set
587# CONFIG_TI_DAC7512 is not set
538# CONFIG_C2PORT is not set 588# CONFIG_C2PORT is not set
539 589
540# 590#
@@ -624,11 +674,12 @@ CONFIG_SMC91X=y
624# CONFIG_B44 is not set 674# CONFIG_B44 is not set
625# CONFIG_KS8842 is not set 675# CONFIG_KS8842 is not set
626# CONFIG_KS8851 is not set 676# CONFIG_KS8851 is not set
677# CONFIG_KS8851_MLL is not set
627# CONFIG_NETDEV_1000 is not set 678# CONFIG_NETDEV_1000 is not set
628# CONFIG_NETDEV_10000 is not set 679# CONFIG_NETDEV_10000 is not set
629CONFIG_WLAN=y 680CONFIG_WLAN=y
630# CONFIG_WLAN_PRE80211 is not set 681# CONFIG_USB_ZD1201 is not set
631# CONFIG_WLAN_80211 is not set 682# CONFIG_HOSTAP is not set
632 683
633# 684#
634# Enable WiMAX (Networking options) to see the WiMAX drivers 685# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -726,7 +777,6 @@ CONFIG_I2C_HELPER_AUTO=y
726# 777#
727# Miscellaneous I2C Chip support 778# Miscellaneous I2C Chip support
728# 779#
729# CONFIG_DS1682 is not set
730# CONFIG_SENSORS_TSL2550 is not set 780# CONFIG_SENSORS_TSL2550 is not set
731# CONFIG_I2C_DEBUG_CORE is not set 781# CONFIG_I2C_DEBUG_CORE is not set
732# CONFIG_I2C_DEBUG_ALGO is not set 782# CONFIG_I2C_DEBUG_ALGO is not set
@@ -740,7 +790,10 @@ CONFIG_SPI_MASTER=y
740# SPI Master Controller Drivers 790# SPI Master Controller Drivers
741# 791#
742# CONFIG_SPI_BITBANG is not set 792# CONFIG_SPI_BITBANG is not set
793# CONFIG_SPI_SH_MSIOF is not set
743# CONFIG_SPI_SH_SCI is not set 794# CONFIG_SPI_SH_SCI is not set
795# CONFIG_SPI_XILINX is not set
796# CONFIG_SPI_DESIGNWARE is not set
744 797
745# 798#
746# SPI Protocol Masters 799# SPI Protocol Masters
@@ -781,15 +834,16 @@ CONFIG_SSB_POSSIBLE=y
781# 834#
782# CONFIG_MFD_CORE is not set 835# CONFIG_MFD_CORE is not set
783# CONFIG_MFD_SM501 is not set 836# CONFIG_MFD_SM501 is not set
837# CONFIG_MFD_SH_MOBILE_SDHI is not set
784# CONFIG_HTC_PASIC3 is not set 838# CONFIG_HTC_PASIC3 is not set
785# CONFIG_MFD_TMIO is not set 839# CONFIG_MFD_TMIO is not set
786# CONFIG_MFD_WM8400 is not set 840# CONFIG_MFD_WM8400 is not set
787# CONFIG_MFD_WM831X is not set
788# CONFIG_MFD_WM8350_I2C is not set 841# CONFIG_MFD_WM8350_I2C is not set
789# CONFIG_MFD_PCF50633 is not set 842# CONFIG_MFD_PCF50633 is not set
790# CONFIG_MFD_MC13783 is not set 843# CONFIG_MFD_MC13783 is not set
791# CONFIG_AB3100_CORE is not set 844# CONFIG_AB3100_CORE is not set
792# CONFIG_EZX_PCAP is not set 845# CONFIG_EZX_PCAP is not set
846# CONFIG_AB4500_CORE is not set
793# CONFIG_REGULATOR is not set 847# CONFIG_REGULATOR is not set
794# CONFIG_MEDIA_SUPPORT is not set 848# CONFIG_MEDIA_SUPPORT is not set
795 849
@@ -924,10 +978,12 @@ CONFIG_USB_GADGET_DUALSPEED=y
924# CONFIG_USB_ETH is not set 978# CONFIG_USB_ETH is not set
925# CONFIG_USB_GADGETFS is not set 979# CONFIG_USB_GADGETFS is not set
926# CONFIG_USB_FILE_STORAGE is not set 980# CONFIG_USB_FILE_STORAGE is not set
981# CONFIG_USB_MASS_STORAGE is not set
927# CONFIG_USB_G_SERIAL is not set 982# CONFIG_USB_G_SERIAL is not set
928# CONFIG_USB_MIDI_GADGET is not set 983# CONFIG_USB_MIDI_GADGET is not set
929# CONFIG_USB_G_PRINTER is not set 984# CONFIG_USB_G_PRINTER is not set
930# CONFIG_USB_CDC_COMPOSITE is not set 985# CONFIG_USB_CDC_COMPOSITE is not set
986# CONFIG_USB_G_MULTI is not set
931 987
932# 988#
933# OTG and related infrastructure 989# OTG and related infrastructure
@@ -965,6 +1021,7 @@ CONFIG_RTC_INTF_DEV=y
965# CONFIG_RTC_DRV_PCF8563 is not set 1021# CONFIG_RTC_DRV_PCF8563 is not set
966# CONFIG_RTC_DRV_PCF8583 is not set 1022# CONFIG_RTC_DRV_PCF8583 is not set
967# CONFIG_RTC_DRV_M41T80 is not set 1023# CONFIG_RTC_DRV_M41T80 is not set
1024# CONFIG_RTC_DRV_BQ32K is not set
968# CONFIG_RTC_DRV_S35390A is not set 1025# CONFIG_RTC_DRV_S35390A is not set
969# CONFIG_RTC_DRV_FM3130 is not set 1026# CONFIG_RTC_DRV_FM3130 is not set
970# CONFIG_RTC_DRV_RX8581 is not set 1027# CONFIG_RTC_DRV_RX8581 is not set
@@ -993,7 +1050,9 @@ CONFIG_RTC_INTF_DEV=y
993# CONFIG_RTC_DRV_M48T86 is not set 1050# CONFIG_RTC_DRV_M48T86 is not set
994# CONFIG_RTC_DRV_M48T35 is not set 1051# CONFIG_RTC_DRV_M48T35 is not set
995# CONFIG_RTC_DRV_M48T59 is not set 1052# CONFIG_RTC_DRV_M48T59 is not set
1053# CONFIG_RTC_DRV_MSM6242 is not set
996# CONFIG_RTC_DRV_BQ4802 is not set 1054# CONFIG_RTC_DRV_BQ4802 is not set
1055# CONFIG_RTC_DRV_RP5C01 is not set
997# CONFIG_RTC_DRV_V3020 is not set 1056# CONFIG_RTC_DRV_V3020 is not set
998 1057
999# 1058#
@@ -1244,8 +1303,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1244CONFIG_HAVE_ARCH_KGDB=y 1303CONFIG_HAVE_ARCH_KGDB=y
1245# CONFIG_KGDB is not set 1304# CONFIG_KGDB is not set
1246CONFIG_SH_STANDARD_BIOS=y 1305CONFIG_SH_STANDARD_BIOS=y
1247# CONFIG_EARLY_SCIF_CONSOLE is not set
1248CONFIG_EARLY_PRINTK=y
1249# CONFIG_STACK_DEBUG is not set 1306# CONFIG_STACK_DEBUG is not set
1250CONFIG_DEBUG_STACK_USAGE=y 1307CONFIG_DEBUG_STACK_USAGE=y
1251CONFIG_DUMP_CODE=y 1308CONFIG_DUMP_CODE=y
@@ -1258,7 +1315,11 @@ CONFIG_DUMP_CODE=y
1258# CONFIG_KEYS is not set 1315# CONFIG_KEYS is not set
1259# CONFIG_SECURITY is not set 1316# CONFIG_SECURITY is not set
1260# CONFIG_SECURITYFS is not set 1317# CONFIG_SECURITYFS is not set
1261# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1318# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1319# CONFIG_DEFAULT_SECURITY_SMACK is not set
1320# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1321CONFIG_DEFAULT_SECURITY_DAC=y
1322CONFIG_DEFAULT_SECURITY=""
1262CONFIG_CRYPTO=y 1323CONFIG_CRYPTO=y
1263 1324
1264# 1325#
diff --git a/arch/sh/configs/snapgear_defconfig b/arch/sh/configs/snapgear_defconfig
index cb919a0de4b2..98352d757851 100644
--- a/arch/sh/configs/snapgear_defconfig
+++ b/arch/sh/configs/snapgear_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:33:00 2009 4# Mon Jan 4 15:14:18 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -59,6 +61,7 @@ CONFIG_KERNEL_GZIP=y
59# 61#
60CONFIG_TREE_RCU=y 62CONFIG_TREE_RCU=y
61# CONFIG_TREE_PREEMPT_RCU is not set 63# CONFIG_TREE_PREEMPT_RCU is not set
64# CONFIG_TINY_RCU is not set
62# CONFIG_RCU_TRACE is not set 65# CONFIG_RCU_TRACE is not set
63CONFIG_RCU_FANOUT=32 66CONFIG_RCU_FANOUT=32
64# CONFIG_RCU_FANOUT_EXACT is not set 67# CONFIG_RCU_FANOUT_EXACT is not set
@@ -97,6 +100,7 @@ CONFIG_EVENTFD=y
97CONFIG_SHMEM=y 100CONFIG_SHMEM=y
98CONFIG_AIO=y 101CONFIG_AIO=y
99CONFIG_HAVE_PERF_EVENTS=y 102CONFIG_HAVE_PERF_EVENTS=y
103CONFIG_PERF_USE_VMALLOC=y
100 104
101# 105#
102# Kernel Performance Events And Counters 106# Kernel Performance Events And Counters
@@ -115,6 +119,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
115CONFIG_HAVE_KPROBES=y 119CONFIG_HAVE_KPROBES=y
116CONFIG_HAVE_KRETPROBES=y 120CONFIG_HAVE_KRETPROBES=y
117CONFIG_HAVE_ARCH_TRACEHOOK=y 121CONFIG_HAVE_ARCH_TRACEHOOK=y
122CONFIG_HAVE_DMA_ATTRS=y
118CONFIG_HAVE_CLK=y 123CONFIG_HAVE_CLK=y
119CONFIG_HAVE_DMA_API_DEBUG=y 124CONFIG_HAVE_DMA_API_DEBUG=y
120 125
@@ -136,14 +141,41 @@ CONFIG_LBDAF=y
136# IO Schedulers 141# IO Schedulers
137# 142#
138CONFIG_IOSCHED_NOOP=y 143CONFIG_IOSCHED_NOOP=y
139CONFIG_IOSCHED_AS=y
140CONFIG_IOSCHED_DEADLINE=y 144CONFIG_IOSCHED_DEADLINE=y
141CONFIG_IOSCHED_CFQ=y 145CONFIG_IOSCHED_CFQ=y
142CONFIG_DEFAULT_AS=y
143# CONFIG_DEFAULT_DEADLINE is not set 146# CONFIG_DEFAULT_DEADLINE is not set
144# CONFIG_DEFAULT_CFQ is not set 147CONFIG_DEFAULT_CFQ=y
145# CONFIG_DEFAULT_NOOP is not set 148# CONFIG_DEFAULT_NOOP is not set
146CONFIG_DEFAULT_IOSCHED="anticipatory" 149CONFIG_DEFAULT_IOSCHED="cfq"
150# CONFIG_INLINE_SPIN_TRYLOCK is not set
151# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
152# CONFIG_INLINE_SPIN_LOCK is not set
153# CONFIG_INLINE_SPIN_LOCK_BH is not set
154# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
155# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
156CONFIG_INLINE_SPIN_UNLOCK=y
157# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
158CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
159# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
160# CONFIG_INLINE_READ_TRYLOCK is not set
161# CONFIG_INLINE_READ_LOCK is not set
162# CONFIG_INLINE_READ_LOCK_BH is not set
163# CONFIG_INLINE_READ_LOCK_IRQ is not set
164# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
165CONFIG_INLINE_READ_UNLOCK=y
166# CONFIG_INLINE_READ_UNLOCK_BH is not set
167CONFIG_INLINE_READ_UNLOCK_IRQ=y
168# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
169# CONFIG_INLINE_WRITE_TRYLOCK is not set
170# CONFIG_INLINE_WRITE_LOCK is not set
171# CONFIG_INLINE_WRITE_LOCK_BH is not set
172# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
173# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
174CONFIG_INLINE_WRITE_UNLOCK=y
175# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
176CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
177# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
178# CONFIG_MUTEX_SPIN_ON_OWNER is not set
147# CONFIG_FREEZER is not set 179# CONFIG_FREEZER is not set
148 180
149# 181#
@@ -219,8 +251,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
219# CONFIG_PHYS_ADDR_T_64BIT is not set 251# CONFIG_PHYS_ADDR_T_64BIT is not set
220CONFIG_ZONE_DMA_FLAG=0 252CONFIG_ZONE_DMA_FLAG=0
221CONFIG_NR_QUICK=2 253CONFIG_NR_QUICK=2
222CONFIG_HAVE_MLOCK=y
223CONFIG_HAVE_MLOCKED_PAGE_BIT=y
224# CONFIG_KSM is not set 254# CONFIG_KSM is not set
225CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 255CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
226 256
@@ -272,9 +302,9 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
272# 302#
273# DMA support 303# DMA support
274# 304#
275CONFIG_SH_DMA_API=y
276CONFIG_SH_DMA=y 305CONFIG_SH_DMA=y
277CONFIG_SH_DMA_IRQ_MULTI=y 306CONFIG_SH_DMA_IRQ_MULTI=y
307CONFIG_SH_DMA_API=y
278CONFIG_NR_ONCHIP_DMA_CHANNELS=8 308CONFIG_NR_ONCHIP_DMA_CHANNELS=8
279# CONFIG_NR_DMA_CHANNELS_BOOL is not set 309# CONFIG_NR_DMA_CHANNELS_BOOL is not set
280 310
@@ -313,7 +343,6 @@ CONFIG_GUSA=y
313CONFIG_ZERO_PAGE_OFFSET=0x00001000 343CONFIG_ZERO_PAGE_OFFSET=0x00001000
314CONFIG_BOOT_LINK_OFFSET=0x00800000 344CONFIG_BOOT_LINK_OFFSET=0x00800000
315CONFIG_ENTRY_OFFSET=0x00001000 345CONFIG_ENTRY_OFFSET=0x00001000
316# CONFIG_UBC_WAKEUP is not set
317# CONFIG_CMDLINE_OVERWRITE is not set 346# CONFIG_CMDLINE_OVERWRITE is not set
318# CONFIG_CMDLINE_EXTEND is not set 347# CONFIG_CMDLINE_EXTEND is not set
319 348
@@ -321,7 +350,6 @@ CONFIG_ENTRY_OFFSET=0x00001000
321# Bus options 350# Bus options
322# 351#
323CONFIG_PCI=y 352CONFIG_PCI=y
324CONFIG_SH_PCIDMA_NONCOHERENT=y
325# CONFIG_PCIEPORTBUS is not set 353# CONFIG_PCIEPORTBUS is not set
326# CONFIG_ARCH_SUPPORTS_MSI is not set 354# CONFIG_ARCH_SUPPORTS_MSI is not set
327CONFIG_PCI_LEGACY=y 355CONFIG_PCI_LEGACY=y
@@ -407,9 +435,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
407# CONFIG_AF_RXRPC is not set 435# CONFIG_AF_RXRPC is not set
408CONFIG_WIRELESS=y 436CONFIG_WIRELESS=y
409# CONFIG_CFG80211 is not set 437# CONFIG_CFG80211 is not set
410CONFIG_CFG80211_DEFAULT_PS_VALUE=0
411# CONFIG_WIRELESS_OLD_REGULATORY is not set
412# CONFIG_WIRELESS_EXT is not set
413# CONFIG_LIB80211 is not set 438# CONFIG_LIB80211 is not set
414 439
415# 440#
@@ -524,6 +549,10 @@ CONFIG_BLK_DEV=y
524# CONFIG_BLK_DEV_UMEM is not set 549# CONFIG_BLK_DEV_UMEM is not set
525# CONFIG_BLK_DEV_COW_COMMON is not set 550# CONFIG_BLK_DEV_COW_COMMON is not set
526# CONFIG_BLK_DEV_LOOP is not set 551# CONFIG_BLK_DEV_LOOP is not set
552
553#
554# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
555#
527# CONFIG_BLK_DEV_NBD is not set 556# CONFIG_BLK_DEV_NBD is not set
528# CONFIG_BLK_DEV_SX8 is not set 557# CONFIG_BLK_DEV_SX8 is not set
529CONFIG_BLK_DEV_RAM=y 558CONFIG_BLK_DEV_RAM=y
@@ -616,6 +645,7 @@ CONFIG_8139TOO_PIO=y
616# CONFIG_SUNDANCE is not set 645# CONFIG_SUNDANCE is not set
617# CONFIG_TLAN is not set 646# CONFIG_TLAN is not set
618# CONFIG_KS8842 is not set 647# CONFIG_KS8842 is not set
648# CONFIG_KS8851_MLL is not set
619# CONFIG_VIA_RHINE is not set 649# CONFIG_VIA_RHINE is not set
620# CONFIG_SC92031 is not set 650# CONFIG_SC92031 is not set
621# CONFIG_ATL2 is not set 651# CONFIG_ATL2 is not set
@@ -623,8 +653,9 @@ CONFIG_8139TOO_PIO=y
623# CONFIG_NETDEV_10000 is not set 653# CONFIG_NETDEV_10000 is not set
624# CONFIG_TR is not set 654# CONFIG_TR is not set
625CONFIG_WLAN=y 655CONFIG_WLAN=y
626# CONFIG_WLAN_PRE80211 is not set 656# CONFIG_ATMEL is not set
627# CONFIG_WLAN_80211 is not set 657# CONFIG_PRISM54 is not set
658# CONFIG_HOSTAP is not set
628 659
629# 660#
630# Enable WiMAX (Networking options) to see the WiMAX drivers 661# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -637,6 +668,7 @@ CONFIG_WLAN=y
637# CONFIG_NETCONSOLE is not set 668# CONFIG_NETCONSOLE is not set
638# CONFIG_NETPOLL is not set 669# CONFIG_NETPOLL is not set
639# CONFIG_NET_POLL_CONTROLLER is not set 670# CONFIG_NET_POLL_CONTROLLER is not set
671# CONFIG_VMXNET3 is not set
640# CONFIG_ISDN is not set 672# CONFIG_ISDN is not set
641# CONFIG_PHONE is not set 673# CONFIG_PHONE is not set
642 674
@@ -646,6 +678,7 @@ CONFIG_WLAN=y
646CONFIG_INPUT=y 678CONFIG_INPUT=y
647# CONFIG_INPUT_FF_MEMLESS is not set 679# CONFIG_INPUT_FF_MEMLESS is not set
648# CONFIG_INPUT_POLLDEV is not set 680# CONFIG_INPUT_POLLDEV is not set
681# CONFIG_INPUT_SPARSEKMAP is not set
649 682
650# 683#
651# Userland interfaces 684# Userland interfaces
@@ -728,6 +761,7 @@ CONFIG_SSB_POSSIBLE=y
728# 761#
729# CONFIG_MFD_CORE is not set 762# CONFIG_MFD_CORE is not set
730# CONFIG_MFD_SM501 is not set 763# CONFIG_MFD_SM501 is not set
764# CONFIG_MFD_SH_MOBILE_SDHI is not set
731# CONFIG_HTC_PASIC3 is not set 765# CONFIG_HTC_PASIC3 is not set
732# CONFIG_MFD_TMIO is not set 766# CONFIG_MFD_TMIO is not set
733# CONFIG_REGULATOR is not set 767# CONFIG_REGULATOR is not set
@@ -787,7 +821,9 @@ CONFIG_RTC_DRV_DS1302=y
787# CONFIG_RTC_DRV_M48T86 is not set 821# CONFIG_RTC_DRV_M48T86 is not set
788# CONFIG_RTC_DRV_M48T35 is not set 822# CONFIG_RTC_DRV_M48T35 is not set
789# CONFIG_RTC_DRV_M48T59 is not set 823# CONFIG_RTC_DRV_M48T59 is not set
824# CONFIG_RTC_DRV_MSM6242 is not set
790# CONFIG_RTC_DRV_BQ4802 is not set 825# CONFIG_RTC_DRV_BQ4802 is not set
826# CONFIG_RTC_DRV_RP5C01 is not set
791# CONFIG_RTC_DRV_V3020 is not set 827# CONFIG_RTC_DRV_V3020 is not set
792 828
793# 829#
@@ -812,6 +848,7 @@ CONFIG_EXT2_FS=y
812# CONFIG_EXT2_FS_XIP is not set 848# CONFIG_EXT2_FS_XIP is not set
813# CONFIG_EXT3_FS is not set 849# CONFIG_EXT3_FS is not set
814# CONFIG_EXT4_FS is not set 850# CONFIG_EXT4_FS is not set
851CONFIG_EXT4_USE_FOR_EXT23=y
815# CONFIG_REISERFS_FS is not set 852# CONFIG_REISERFS_FS is not set
816# CONFIG_JFS_FS is not set 853# CONFIG_JFS_FS is not set
817# CONFIG_FS_POSIX_ACL is not set 854# CONFIG_FS_POSIX_ACL is not set
@@ -915,10 +952,11 @@ CONFIG_FRAME_WARN=1024
915# CONFIG_DEBUG_FS is not set 952# CONFIG_DEBUG_FS is not set
916# CONFIG_HEADERS_CHECK is not set 953# CONFIG_HEADERS_CHECK is not set
917# CONFIG_DEBUG_KERNEL is not set 954# CONFIG_DEBUG_KERNEL is not set
918# CONFIG_DEBUG_BUGVERBOSE is not set 955CONFIG_DEBUG_BUGVERBOSE=y
919# CONFIG_DEBUG_MEMORY_INIT is not set 956# CONFIG_DEBUG_MEMORY_INIT is not set
920# CONFIG_RCU_CPU_STALL_DETECTOR is not set 957# CONFIG_RCU_CPU_STALL_DETECTOR is not set
921# CONFIG_LATENCYTOP is not set 958# CONFIG_LATENCYTOP is not set
959# CONFIG_SYSCTL_SYSCALL_CHECK is not set
922CONFIG_HAVE_FUNCTION_TRACER=y 960CONFIG_HAVE_FUNCTION_TRACER=y
923CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 961CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
924CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 962CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -931,7 +969,6 @@ CONFIG_TRACING_SUPPORT=y
931# CONFIG_SAMPLES is not set 969# CONFIG_SAMPLES is not set
932CONFIG_HAVE_ARCH_KGDB=y 970CONFIG_HAVE_ARCH_KGDB=y
933# CONFIG_SH_STANDARD_BIOS is not set 971# CONFIG_SH_STANDARD_BIOS is not set
934# CONFIG_EARLY_SCIF_CONSOLE is not set
935# CONFIG_DWARF_UNWINDER is not set 972# CONFIG_DWARF_UNWINDER is not set
936 973
937# 974#
@@ -940,7 +977,11 @@ CONFIG_HAVE_ARCH_KGDB=y
940# CONFIG_KEYS is not set 977# CONFIG_KEYS is not set
941# CONFIG_SECURITY is not set 978# CONFIG_SECURITY is not set
942# CONFIG_SECURITYFS is not set 979# CONFIG_SECURITYFS is not set
943# CONFIG_SECURITY_FILE_CAPABILITIES is not set 980# CONFIG_DEFAULT_SECURITY_SELINUX is not set
981# CONFIG_DEFAULT_SECURITY_SMACK is not set
982# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
983CONFIG_DEFAULT_SECURITY_DAC=y
984CONFIG_DEFAULT_SECURITY=""
944# CONFIG_CRYPTO is not set 985# CONFIG_CRYPTO is not set
945# CONFIG_BINARY_PRINTF is not set 986# CONFIG_BINARY_PRINTF is not set
946 987
diff --git a/arch/sh/configs/systemh_defconfig b/arch/sh/configs/systemh_defconfig
index b9fe960309f5..72982e360e3f 100644
--- a/arch/sh/configs/systemh_defconfig
+++ b/arch/sh/configs/systemh_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:35:03 2009 4# Mon Jan 4 15:14:50 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_TMU=y 24CONFIG_SYS_SUPPORTS_TMU=y
24CONFIG_STACKTRACE_SUPPORT=y 25CONFIG_STACKTRACE_SUPPORT=y
25CONFIG_LOCKDEP_SUPPORT=y 26CONFIG_LOCKDEP_SUPPORT=y
@@ -29,6 +30,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
31CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DMA_NONCOHERENT=y
32CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
33CONFIG_CONSTRUCTORS=y 35CONFIG_CONSTRUCTORS=y
34 36
@@ -56,6 +58,7 @@ CONFIG_SWAP=y
56# 58#
57CONFIG_TREE_RCU=y 59CONFIG_TREE_RCU=y
58# CONFIG_TREE_PREEMPT_RCU is not set 60# CONFIG_TREE_PREEMPT_RCU is not set
61# CONFIG_TINY_RCU is not set
59# CONFIG_RCU_TRACE is not set 62# CONFIG_RCU_TRACE is not set
60CONFIG_RCU_FANOUT=32 63CONFIG_RCU_FANOUT=32
61# CONFIG_RCU_FANOUT_EXACT is not set 64# CONFIG_RCU_FANOUT_EXACT is not set
@@ -94,6 +97,7 @@ CONFIG_EVENTFD=y
94CONFIG_SHMEM=y 97CONFIG_SHMEM=y
95CONFIG_AIO=y 98CONFIG_AIO=y
96CONFIG_HAVE_PERF_EVENTS=y 99CONFIG_HAVE_PERF_EVENTS=y
100CONFIG_PERF_USE_VMALLOC=y
97 101
98# 102#
99# Kernel Performance Events And Counters 103# Kernel Performance Events And Counters
@@ -112,6 +116,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
112CONFIG_HAVE_KPROBES=y 116CONFIG_HAVE_KPROBES=y
113CONFIG_HAVE_KRETPROBES=y 117CONFIG_HAVE_KRETPROBES=y
114CONFIG_HAVE_ARCH_TRACEHOOK=y 118CONFIG_HAVE_ARCH_TRACEHOOK=y
119CONFIG_HAVE_DMA_ATTRS=y
115CONFIG_HAVE_CLK=y 120CONFIG_HAVE_CLK=y
116CONFIG_HAVE_DMA_API_DEBUG=y 121CONFIG_HAVE_DMA_API_DEBUG=y
117 122
@@ -138,14 +143,41 @@ CONFIG_LBDAF=y
138# IO Schedulers 143# IO Schedulers
139# 144#
140CONFIG_IOSCHED_NOOP=y 145CONFIG_IOSCHED_NOOP=y
141CONFIG_IOSCHED_AS=y
142CONFIG_IOSCHED_DEADLINE=y 146CONFIG_IOSCHED_DEADLINE=y
143CONFIG_IOSCHED_CFQ=y 147CONFIG_IOSCHED_CFQ=y
144CONFIG_DEFAULT_AS=y
145# CONFIG_DEFAULT_DEADLINE is not set 148# CONFIG_DEFAULT_DEADLINE is not set
146# CONFIG_DEFAULT_CFQ is not set 149CONFIG_DEFAULT_CFQ=y
147# CONFIG_DEFAULT_NOOP is not set 150# CONFIG_DEFAULT_NOOP is not set
148CONFIG_DEFAULT_IOSCHED="anticipatory" 151CONFIG_DEFAULT_IOSCHED="cfq"
152# CONFIG_INLINE_SPIN_TRYLOCK is not set
153# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
154# CONFIG_INLINE_SPIN_LOCK is not set
155# CONFIG_INLINE_SPIN_LOCK_BH is not set
156# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
157# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
158# CONFIG_INLINE_SPIN_UNLOCK is not set
159# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
160# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
161# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
162# CONFIG_INLINE_READ_TRYLOCK is not set
163# CONFIG_INLINE_READ_LOCK is not set
164# CONFIG_INLINE_READ_LOCK_BH is not set
165# CONFIG_INLINE_READ_LOCK_IRQ is not set
166# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
167# CONFIG_INLINE_READ_UNLOCK is not set
168# CONFIG_INLINE_READ_UNLOCK_BH is not set
169# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
170# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
171# CONFIG_INLINE_WRITE_TRYLOCK is not set
172# CONFIG_INLINE_WRITE_LOCK is not set
173# CONFIG_INLINE_WRITE_LOCK_BH is not set
174# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
175# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
176# CONFIG_INLINE_WRITE_UNLOCK is not set
177# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
178# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
179# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
180# CONFIG_MUTEX_SPIN_ON_OWNER is not set
149# CONFIG_FREEZER is not set 181# CONFIG_FREEZER is not set
150 182
151# 183#
@@ -221,8 +253,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
221# CONFIG_PHYS_ADDR_T_64BIT is not set 253# CONFIG_PHYS_ADDR_T_64BIT is not set
222CONFIG_ZONE_DMA_FLAG=0 254CONFIG_ZONE_DMA_FLAG=0
223CONFIG_NR_QUICK=2 255CONFIG_NR_QUICK=2
224CONFIG_HAVE_MLOCK=y
225CONFIG_HAVE_MLOCKED_PAGE_BIT=y
226# CONFIG_KSM is not set 256# CONFIG_KSM is not set
227CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 257CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
228 258
@@ -310,7 +340,6 @@ CONFIG_GUSA=y
310CONFIG_ZERO_PAGE_OFFSET=0x00001000 340CONFIG_ZERO_PAGE_OFFSET=0x00001000
311CONFIG_BOOT_LINK_OFFSET=0x00800000 341CONFIG_BOOT_LINK_OFFSET=0x00800000
312CONFIG_ENTRY_OFFSET=0x00001000 342CONFIG_ENTRY_OFFSET=0x00001000
313# CONFIG_UBC_WAKEUP is not set
314# CONFIG_CMDLINE_OVERWRITE is not set 343# CONFIG_CMDLINE_OVERWRITE is not set
315# CONFIG_CMDLINE_EXTEND is not set 344# CONFIG_CMDLINE_EXTEND is not set
316 345
@@ -349,6 +378,10 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
349CONFIG_BLK_DEV=y 378CONFIG_BLK_DEV=y
350# CONFIG_BLK_DEV_COW_COMMON is not set 379# CONFIG_BLK_DEV_COW_COMMON is not set
351# CONFIG_BLK_DEV_LOOP is not set 380# CONFIG_BLK_DEV_LOOP is not set
381
382#
383# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
384#
352CONFIG_BLK_DEV_RAM=y 385CONFIG_BLK_DEV_RAM=y
353CONFIG_BLK_DEV_RAM_COUNT=16 386CONFIG_BLK_DEV_RAM_COUNT=16
354CONFIG_BLK_DEV_RAM_SIZE=1024 387CONFIG_BLK_DEV_RAM_SIZE=1024
@@ -390,6 +423,7 @@ CONFIG_SERIO=y
390# CONFIG_SERIO_SERPORT is not set 423# CONFIG_SERIO_SERPORT is not set
391# CONFIG_SERIO_LIBPS2 is not set 424# CONFIG_SERIO_LIBPS2 is not set
392# CONFIG_SERIO_RAW is not set 425# CONFIG_SERIO_RAW is not set
426# CONFIG_SERIO_ALTERA_PS2 is not set
393# CONFIG_GAMEPORT is not set 427# CONFIG_GAMEPORT is not set
394 428
395# 429#
@@ -458,6 +492,7 @@ CONFIG_SSB_POSSIBLE=y
458# 492#
459# CONFIG_MFD_CORE is not set 493# CONFIG_MFD_CORE is not set
460# CONFIG_MFD_SM501 is not set 494# CONFIG_MFD_SM501 is not set
495# CONFIG_MFD_SH_MOBILE_SDHI is not set
461# CONFIG_HTC_PASIC3 is not set 496# CONFIG_HTC_PASIC3 is not set
462# CONFIG_MFD_TMIO is not set 497# CONFIG_MFD_TMIO is not set
463# CONFIG_REGULATOR is not set 498# CONFIG_REGULATOR is not set
@@ -517,6 +552,7 @@ CONFIG_RTC_LIB=y
517# CONFIG_EXT2_FS is not set 552# CONFIG_EXT2_FS is not set
518# CONFIG_EXT3_FS is not set 553# CONFIG_EXT3_FS is not set
519# CONFIG_EXT4_FS is not set 554# CONFIG_EXT4_FS is not set
555CONFIG_EXT4_USE_FOR_EXT23=y
520# CONFIG_REISERFS_FS is not set 556# CONFIG_REISERFS_FS is not set
521# CONFIG_JFS_FS is not set 557# CONFIG_JFS_FS is not set
522# CONFIG_FS_POSIX_ACL is not set 558# CONFIG_FS_POSIX_ACL is not set
@@ -609,10 +645,11 @@ CONFIG_FRAME_WARN=1024
609# CONFIG_DEBUG_FS is not set 645# CONFIG_DEBUG_FS is not set
610# CONFIG_HEADERS_CHECK is not set 646# CONFIG_HEADERS_CHECK is not set
611# CONFIG_DEBUG_KERNEL is not set 647# CONFIG_DEBUG_KERNEL is not set
612# CONFIG_DEBUG_BUGVERBOSE is not set 648CONFIG_DEBUG_BUGVERBOSE=y
613# CONFIG_DEBUG_MEMORY_INIT is not set 649# CONFIG_DEBUG_MEMORY_INIT is not set
614# CONFIG_RCU_CPU_STALL_DETECTOR is not set 650# CONFIG_RCU_CPU_STALL_DETECTOR is not set
615# CONFIG_LATENCYTOP is not set 651# CONFIG_LATENCYTOP is not set
652# CONFIG_SYSCTL_SYSCALL_CHECK is not set
616CONFIG_HAVE_FUNCTION_TRACER=y 653CONFIG_HAVE_FUNCTION_TRACER=y
617CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 654CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
618CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 655CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
@@ -625,7 +662,6 @@ CONFIG_TRACING_SUPPORT=y
625# CONFIG_SAMPLES is not set 662# CONFIG_SAMPLES is not set
626CONFIG_HAVE_ARCH_KGDB=y 663CONFIG_HAVE_ARCH_KGDB=y
627# CONFIG_SH_STANDARD_BIOS is not set 664# CONFIG_SH_STANDARD_BIOS is not set
628# CONFIG_EARLY_SCIF_CONSOLE is not set
629# CONFIG_DWARF_UNWINDER is not set 665# CONFIG_DWARF_UNWINDER is not set
630 666
631# 667#
@@ -634,7 +670,11 @@ CONFIG_HAVE_ARCH_KGDB=y
634# CONFIG_KEYS is not set 670# CONFIG_KEYS is not set
635# CONFIG_SECURITY is not set 671# CONFIG_SECURITY is not set
636# CONFIG_SECURITYFS is not set 672# CONFIG_SECURITYFS is not set
637# CONFIG_SECURITY_FILE_CAPABILITIES is not set 673# CONFIG_DEFAULT_SECURITY_SELINUX is not set
674# CONFIG_DEFAULT_SECURITY_SMACK is not set
675# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
676CONFIG_DEFAULT_SECURITY_DAC=y
677CONFIG_DEFAULT_SECURITY=""
638# CONFIG_CRYPTO is not set 678# CONFIG_CRYPTO is not set
639# CONFIG_BINARY_PRINTF is not set 679# CONFIG_BINARY_PRINTF is not set
640 680
diff --git a/arch/sh/configs/titan_defconfig b/arch/sh/configs/titan_defconfig
index 2ca79ed9fb62..78c257053c79 100644
--- a/arch/sh/configs/titan_defconfig
+++ b/arch/sh/configs/titan_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:36:36 2009 4# Mon Jan 4 15:17:20 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_PCI=y 24CONFIG_SYS_SUPPORTS_PCI=y
24CONFIG_SYS_SUPPORTS_TMU=y 25CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y 26CONFIG_STACKTRACE_SUPPORT=y
@@ -30,6 +31,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
30CONFIG_ARCH_NO_VIRT_TO_BUS=y 31CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y 32CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
34CONFIG_DMA_NONCOHERENT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y 36CONFIG_CONSTRUCTORS=y
35 37
@@ -61,6 +63,7 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
61# 63#
62CONFIG_TREE_RCU=y 64CONFIG_TREE_RCU=y
63# CONFIG_TREE_PREEMPT_RCU is not set 65# CONFIG_TREE_PREEMPT_RCU is not set
66# CONFIG_TINY_RCU is not set
64# CONFIG_RCU_TRACE is not set 67# CONFIG_RCU_TRACE is not set
65CONFIG_RCU_FANOUT=32 68CONFIG_RCU_FANOUT=32
66# CONFIG_RCU_FANOUT_EXACT is not set 69# CONFIG_RCU_FANOUT_EXACT is not set
@@ -101,6 +104,7 @@ CONFIG_EVENTFD=y
101CONFIG_SHMEM=y 104CONFIG_SHMEM=y
102CONFIG_AIO=y 105CONFIG_AIO=y
103CONFIG_HAVE_PERF_EVENTS=y 106CONFIG_HAVE_PERF_EVENTS=y
107CONFIG_PERF_USE_VMALLOC=y
104 108
105# 109#
106# Kernel Performance Events And Counters 110# Kernel Performance Events And Counters
@@ -120,13 +124,14 @@ CONFIG_HAVE_IOREMAP_PROT=y
120CONFIG_HAVE_KPROBES=y 124CONFIG_HAVE_KPROBES=y
121CONFIG_HAVE_KRETPROBES=y 125CONFIG_HAVE_KRETPROBES=y
122CONFIG_HAVE_ARCH_TRACEHOOK=y 126CONFIG_HAVE_ARCH_TRACEHOOK=y
127CONFIG_HAVE_DMA_ATTRS=y
123CONFIG_HAVE_CLK=y 128CONFIG_HAVE_CLK=y
124CONFIG_HAVE_DMA_API_DEBUG=y 129CONFIG_HAVE_DMA_API_DEBUG=y
125 130
126# 131#
127# GCOV-based kernel profiling 132# GCOV-based kernel profiling
128# 133#
129# CONFIG_SLOW_WORK is not set 134CONFIG_SLOW_WORK=y
130CONFIG_HAVE_GENERIC_DMA_COHERENT=y 135CONFIG_HAVE_GENERIC_DMA_COHERENT=y
131CONFIG_SLABINFO=y 136CONFIG_SLABINFO=y
132CONFIG_RT_MUTEXES=y 137CONFIG_RT_MUTEXES=y
@@ -146,14 +151,41 @@ CONFIG_LBDAF=y
146# IO Schedulers 151# IO Schedulers
147# 152#
148CONFIG_IOSCHED_NOOP=y 153CONFIG_IOSCHED_NOOP=y
149CONFIG_IOSCHED_AS=y
150CONFIG_IOSCHED_DEADLINE=y 154CONFIG_IOSCHED_DEADLINE=y
151CONFIG_IOSCHED_CFQ=y 155CONFIG_IOSCHED_CFQ=y
152CONFIG_DEFAULT_AS=y
153# CONFIG_DEFAULT_DEADLINE is not set 156# CONFIG_DEFAULT_DEADLINE is not set
154# CONFIG_DEFAULT_CFQ is not set 157CONFIG_DEFAULT_CFQ=y
155# CONFIG_DEFAULT_NOOP is not set 158# CONFIG_DEFAULT_NOOP is not set
156CONFIG_DEFAULT_IOSCHED="anticipatory" 159CONFIG_DEFAULT_IOSCHED="cfq"
160# CONFIG_INLINE_SPIN_TRYLOCK is not set
161# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
162# CONFIG_INLINE_SPIN_LOCK is not set
163# CONFIG_INLINE_SPIN_LOCK_BH is not set
164# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
165# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
166CONFIG_INLINE_SPIN_UNLOCK=y
167# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
168CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
169# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
170# CONFIG_INLINE_READ_TRYLOCK is not set
171# CONFIG_INLINE_READ_LOCK is not set
172# CONFIG_INLINE_READ_LOCK_BH is not set
173# CONFIG_INLINE_READ_LOCK_IRQ is not set
174# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
175CONFIG_INLINE_READ_UNLOCK=y
176# CONFIG_INLINE_READ_UNLOCK_BH is not set
177CONFIG_INLINE_READ_UNLOCK_IRQ=y
178# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
179# CONFIG_INLINE_WRITE_TRYLOCK is not set
180# CONFIG_INLINE_WRITE_LOCK is not set
181# CONFIG_INLINE_WRITE_LOCK_BH is not set
182# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
183# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
184CONFIG_INLINE_WRITE_UNLOCK=y
185# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
186CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
187# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
188# CONFIG_MUTEX_SPIN_ON_OWNER is not set
157# CONFIG_FREEZER is not set 189# CONFIG_FREEZER is not set
158 190
159# 191#
@@ -229,8 +261,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
229# CONFIG_PHYS_ADDR_T_64BIT is not set 261# CONFIG_PHYS_ADDR_T_64BIT is not set
230CONFIG_ZONE_DMA_FLAG=0 262CONFIG_ZONE_DMA_FLAG=0
231CONFIG_NR_QUICK=2 263CONFIG_NR_QUICK=2
232CONFIG_HAVE_MLOCK=y
233CONFIG_HAVE_MLOCKED_PAGE_BIT=y
234# CONFIG_KSM is not set 264# CONFIG_KSM is not set
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 265CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236 266
@@ -282,9 +312,9 @@ CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
282# 312#
283# DMA support 313# DMA support
284# 314#
285CONFIG_SH_DMA_API=y
286CONFIG_SH_DMA=y 315CONFIG_SH_DMA=y
287CONFIG_SH_DMA_IRQ_MULTI=y 316CONFIG_SH_DMA_IRQ_MULTI=y
317CONFIG_SH_DMA_API=y
288CONFIG_NR_ONCHIP_DMA_CHANNELS=8 318CONFIG_NR_ONCHIP_DMA_CHANNELS=8
289# CONFIG_NR_DMA_CHANNELS_BOOL is not set 319# CONFIG_NR_DMA_CHANNELS_BOOL is not set
290 320
@@ -323,7 +353,6 @@ CONFIG_GUSA=y
323CONFIG_ZERO_PAGE_OFFSET=0x00001000 353CONFIG_ZERO_PAGE_OFFSET=0x00001000
324CONFIG_BOOT_LINK_OFFSET=0x009e0000 354CONFIG_BOOT_LINK_OFFSET=0x009e0000
325CONFIG_ENTRY_OFFSET=0x00001000 355CONFIG_ENTRY_OFFSET=0x00001000
326# CONFIG_UBC_WAKEUP is not set
327CONFIG_CMDLINE_OVERWRITE=y 356CONFIG_CMDLINE_OVERWRITE=y
328# CONFIG_CMDLINE_EXTEND is not set 357# CONFIG_CMDLINE_EXTEND is not set
329CONFIG_CMDLINE="console=ttySC1,38400N81 root=/dev/nfs ip=:::::eth1:autoconf rw" 358CONFIG_CMDLINE="console=ttySC1,38400N81 root=/dev/nfs ip=:::::eth1:autoconf rw"
@@ -332,7 +361,6 @@ CONFIG_CMDLINE="console=ttySC1,38400N81 root=/dev/nfs ip=:::::eth1:autoconf rw"
332# Bus options 361# Bus options
333# 362#
334CONFIG_PCI=y 363CONFIG_PCI=y
335CONFIG_SH_PCIDMA_NONCOHERENT=y
336# CONFIG_PCIEPORTBUS is not set 364# CONFIG_PCIEPORTBUS is not set
337# CONFIG_ARCH_SUPPORTS_MSI is not set 365# CONFIG_ARCH_SUPPORTS_MSI is not set
338CONFIG_PCI_LEGACY=y 366CONFIG_PCI_LEGACY=y
@@ -425,6 +453,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
425CONFIG_INET6_XFRM_MODE_BEET=y 453CONFIG_INET6_XFRM_MODE_BEET=y
426# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 454# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
427CONFIG_IPV6_SIT=m 455CONFIG_IPV6_SIT=m
456# CONFIG_IPV6_SIT_6RD is not set
428CONFIG_IPV6_NDISC_NODETYPE=y 457CONFIG_IPV6_NDISC_NODETYPE=y
429CONFIG_IPV6_TUNNEL=y 458CONFIG_IPV6_TUNNEL=y
430# CONFIG_IPV6_MULTIPLE_TABLES is not set 459# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -614,10 +643,6 @@ CONFIG_NET_SCH_FIFO=y
614CONFIG_FIB_RULES=y 643CONFIG_FIB_RULES=y
615CONFIG_WIRELESS=y 644CONFIG_WIRELESS=y
616# CONFIG_CFG80211 is not set 645# CONFIG_CFG80211 is not set
617CONFIG_CFG80211_DEFAULT_PS_VALUE=0
618# CONFIG_WIRELESS_OLD_REGULATORY is not set
619CONFIG_WIRELESS_EXT=y
620CONFIG_WIRELESS_EXT_SYSFS=y
621# CONFIG_LIB80211 is not set 646# CONFIG_LIB80211 is not set
622 647
623# 648#
@@ -743,6 +768,11 @@ CONFIG_BLK_DEV=y
743# CONFIG_BLK_DEV_COW_COMMON is not set 768# CONFIG_BLK_DEV_COW_COMMON is not set
744CONFIG_BLK_DEV_LOOP=m 769CONFIG_BLK_DEV_LOOP=m
745CONFIG_BLK_DEV_CRYPTOLOOP=m 770CONFIG_BLK_DEV_CRYPTOLOOP=m
771
772#
773# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
774#
775# CONFIG_BLK_DEV_DRBD is not set
746# CONFIG_BLK_DEV_NBD is not set 776# CONFIG_BLK_DEV_NBD is not set
747# CONFIG_BLK_DEV_SX8 is not set 777# CONFIG_BLK_DEV_SX8 is not set
748# CONFIG_BLK_DEV_UB is not set 778# CONFIG_BLK_DEV_UB is not set
@@ -807,8 +837,11 @@ CONFIG_SCSI_LOWLEVEL=y
807# CONFIG_ISCSI_TCP is not set 837# CONFIG_ISCSI_TCP is not set
808# CONFIG_SCSI_CXGB3_ISCSI is not set 838# CONFIG_SCSI_CXGB3_ISCSI is not set
809# CONFIG_SCSI_BNX2_ISCSI is not set 839# CONFIG_SCSI_BNX2_ISCSI is not set
840# CONFIG_BE2ISCSI is not set
810# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 841# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
842# CONFIG_SCSI_HPSA is not set
811# CONFIG_SCSI_3W_9XXX is not set 843# CONFIG_SCSI_3W_9XXX is not set
844# CONFIG_SCSI_3W_SAS is not set
812# CONFIG_SCSI_ACARD is not set 845# CONFIG_SCSI_ACARD is not set
813# CONFIG_SCSI_AACRAID is not set 846# CONFIG_SCSI_AACRAID is not set
814# CONFIG_SCSI_AIC7XXX is not set 847# CONFIG_SCSI_AIC7XXX is not set
@@ -841,7 +874,9 @@ CONFIG_SCSI_LOWLEVEL=y
841# CONFIG_SCSI_NSP32 is not set 874# CONFIG_SCSI_NSP32 is not set
842# CONFIG_SCSI_DEBUG is not set 875# CONFIG_SCSI_DEBUG is not set
843# CONFIG_SCSI_PMCRAID is not set 876# CONFIG_SCSI_PMCRAID is not set
877# CONFIG_SCSI_PM8001 is not set
844# CONFIG_SCSI_SRP is not set 878# CONFIG_SCSI_SRP is not set
879# CONFIG_SCSI_BFA_FC is not set
845# CONFIG_SCSI_DH is not set 880# CONFIG_SCSI_DH is not set
846# CONFIG_SCSI_OSD_INITIATOR is not set 881# CONFIG_SCSI_OSD_INITIATOR is not set
847# CONFIG_ATA is not set 882# CONFIG_ATA is not set
@@ -935,6 +970,7 @@ CONFIG_8139_OLD_RX_RESET=y
935# CONFIG_SUNDANCE is not set 970# CONFIG_SUNDANCE is not set
936# CONFIG_TLAN is not set 971# CONFIG_TLAN is not set
937# CONFIG_KS8842 is not set 972# CONFIG_KS8842 is not set
973# CONFIG_KS8851_MLL is not set
938# CONFIG_VIA_RHINE is not set 974# CONFIG_VIA_RHINE is not set
939# CONFIG_SC92031 is not set 975# CONFIG_SC92031 is not set
940# CONFIG_ATL2 is not set 976# CONFIG_ATL2 is not set
@@ -983,8 +1019,10 @@ CONFIG_CHELSIO_T3_DEPENDS=y
983# CONFIG_BE2NET is not set 1019# CONFIG_BE2NET is not set
984# CONFIG_TR is not set 1020# CONFIG_TR is not set
985CONFIG_WLAN=y 1021CONFIG_WLAN=y
986# CONFIG_WLAN_PRE80211 is not set 1022# CONFIG_ATMEL is not set
987# CONFIG_WLAN_80211 is not set 1023# CONFIG_PRISM54 is not set
1024# CONFIG_USB_ZD1201 is not set
1025# CONFIG_HOSTAP is not set
988 1026
989# 1027#
990# Enable WiMAX (Networking options) to see the WiMAX drivers 1028# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -1033,6 +1071,7 @@ CONFIG_SLIP_SMART=y
1033# CONFIG_NETCONSOLE is not set 1071# CONFIG_NETCONSOLE is not set
1034# CONFIG_NETPOLL is not set 1072# CONFIG_NETPOLL is not set
1035# CONFIG_NET_POLL_CONTROLLER is not set 1073# CONFIG_NET_POLL_CONTROLLER is not set
1074# CONFIG_VMXNET3 is not set
1036# CONFIG_ISDN is not set 1075# CONFIG_ISDN is not set
1037# CONFIG_PHONE is not set 1076# CONFIG_PHONE is not set
1038 1077
@@ -1042,6 +1081,7 @@ CONFIG_SLIP_SMART=y
1042CONFIG_INPUT=y 1081CONFIG_INPUT=y
1043# CONFIG_INPUT_FF_MEMLESS is not set 1082# CONFIG_INPUT_FF_MEMLESS is not set
1044# CONFIG_INPUT_POLLDEV is not set 1083# CONFIG_INPUT_POLLDEV is not set
1084# CONFIG_INPUT_SPARSEKMAP is not set
1045 1085
1046# 1086#
1047# Userland interfaces 1087# Userland interfaces
@@ -1172,6 +1212,7 @@ CONFIG_SSB_POSSIBLE=y
1172# 1212#
1173# CONFIG_MFD_CORE is not set 1213# CONFIG_MFD_CORE is not set
1174# CONFIG_MFD_SM501 is not set 1214# CONFIG_MFD_SM501 is not set
1215# CONFIG_MFD_SH_MOBILE_SDHI is not set
1175# CONFIG_HTC_PASIC3 is not set 1216# CONFIG_HTC_PASIC3 is not set
1176# CONFIG_MFD_TMIO is not set 1217# CONFIG_MFD_TMIO is not set
1177# CONFIG_REGULATOR is not set 1218# CONFIG_REGULATOR is not set
@@ -1409,7 +1450,9 @@ CONFIG_RTC_INTF_DEV=y
1409# CONFIG_RTC_DRV_M48T86 is not set 1450# CONFIG_RTC_DRV_M48T86 is not set
1410# CONFIG_RTC_DRV_M48T35 is not set 1451# CONFIG_RTC_DRV_M48T35 is not set
1411# CONFIG_RTC_DRV_M48T59 is not set 1452# CONFIG_RTC_DRV_M48T59 is not set
1453# CONFIG_RTC_DRV_MSM6242 is not set
1412# CONFIG_RTC_DRV_BQ4802 is not set 1454# CONFIG_RTC_DRV_BQ4802 is not set
1455# CONFIG_RTC_DRV_RP5C01 is not set
1413# CONFIG_RTC_DRV_V3020 is not set 1456# CONFIG_RTC_DRV_V3020 is not set
1414 1457
1415# 1458#
@@ -1664,6 +1707,7 @@ CONFIG_SCHED_DEBUG=y
1664# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set 1707# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1665# CONFIG_FAULT_INJECTION is not set 1708# CONFIG_FAULT_INJECTION is not set
1666# CONFIG_LATENCYTOP is not set 1709# CONFIG_LATENCYTOP is not set
1710# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1667# CONFIG_PAGE_POISONING is not set 1711# CONFIG_PAGE_POISONING is not set
1668CONFIG_HAVE_FUNCTION_TRACER=y 1712CONFIG_HAVE_FUNCTION_TRACER=y
1669CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 1713CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
@@ -1691,7 +1735,6 @@ CONFIG_BRANCH_PROFILE_NONE=y
1691CONFIG_HAVE_ARCH_KGDB=y 1735CONFIG_HAVE_ARCH_KGDB=y
1692# CONFIG_KGDB is not set 1736# CONFIG_KGDB is not set
1693# CONFIG_SH_STANDARD_BIOS is not set 1737# CONFIG_SH_STANDARD_BIOS is not set
1694# CONFIG_EARLY_SCIF_CONSOLE is not set
1695# CONFIG_STACK_DEBUG is not set 1738# CONFIG_STACK_DEBUG is not set
1696# CONFIG_DEBUG_STACK_USAGE is not set 1739# CONFIG_DEBUG_STACK_USAGE is not set
1697# CONFIG_4KSTACKS is not set 1740# CONFIG_4KSTACKS is not set
@@ -1705,7 +1748,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1705# CONFIG_KEYS is not set 1748# CONFIG_KEYS is not set
1706# CONFIG_SECURITY is not set 1749# CONFIG_SECURITY is not set
1707# CONFIG_SECURITYFS is not set 1750# CONFIG_SECURITYFS is not set
1708# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1751# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1752# CONFIG_DEFAULT_SECURITY_SMACK is not set
1753# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1754CONFIG_DEFAULT_SECURITY_DAC=y
1755CONFIG_DEFAULT_SECURITY=""
1709CONFIG_CRYPTO=y 1756CONFIG_CRYPTO=y
1710 1757
1711# 1758#
diff --git a/arch/sh/configs/ul2_defconfig b/arch/sh/configs/ul2_defconfig
index b012ca77f029..4fa03bf086dd 100644
--- a/arch/sh/configs/ul2_defconfig
+++ b/arch/sh/configs/ul2_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:42:33 2009 4# Mon Jan 4 15:18:53 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y 21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_NUMA=y 24CONFIG_SYS_SUPPORTS_NUMA=y
24CONFIG_SYS_SUPPORTS_CMT=y 25CONFIG_SYS_SUPPORTS_CMT=y
25CONFIG_SYS_SUPPORTS_TMU=y 26CONFIG_SYS_SUPPORTS_TMU=y
@@ -31,6 +32,7 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
31CONFIG_ARCH_NO_VIRT_TO_BUS=y 32CONFIG_ARCH_NO_VIRT_TO_BUS=y
32CONFIG_ARCH_HAS_DEFAULT_IDLE=y 33CONFIG_ARCH_HAS_DEFAULT_IDLE=y
33CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
35CONFIG_DMA_NONCOHERENT=y
34CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 36CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
35CONFIG_CONSTRUCTORS=y 37CONFIG_CONSTRUCTORS=y
36 38
@@ -63,6 +65,7 @@ CONFIG_BSD_PROCESS_ACCT=y
63# 65#
64CONFIG_TREE_RCU=y 66CONFIG_TREE_RCU=y
65# CONFIG_TREE_PREEMPT_RCU is not set 67# CONFIG_TREE_PREEMPT_RCU is not set
68# CONFIG_TINY_RCU is not set
66# CONFIG_RCU_TRACE is not set 69# CONFIG_RCU_TRACE is not set
67CONFIG_RCU_FANOUT=32 70CONFIG_RCU_FANOUT=32
68# CONFIG_RCU_FANOUT_EXACT is not set 71# CONFIG_RCU_FANOUT_EXACT is not set
@@ -102,6 +105,7 @@ CONFIG_EVENTFD=y
102CONFIG_SHMEM=y 105CONFIG_SHMEM=y
103CONFIG_AIO=y 106CONFIG_AIO=y
104CONFIG_HAVE_PERF_EVENTS=y 107CONFIG_HAVE_PERF_EVENTS=y
108CONFIG_PERF_USE_VMALLOC=y
105 109
106# 110#
107# Kernel Performance Events And Counters 111# Kernel Performance Events And Counters
@@ -122,6 +126,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
122CONFIG_HAVE_KPROBES=y 126CONFIG_HAVE_KPROBES=y
123CONFIG_HAVE_KRETPROBES=y 127CONFIG_HAVE_KRETPROBES=y
124CONFIG_HAVE_ARCH_TRACEHOOK=y 128CONFIG_HAVE_ARCH_TRACEHOOK=y
129CONFIG_HAVE_DMA_ATTRS=y
125CONFIG_HAVE_CLK=y 130CONFIG_HAVE_CLK=y
126CONFIG_HAVE_DMA_API_DEBUG=y 131CONFIG_HAVE_DMA_API_DEBUG=y
127 132
@@ -148,14 +153,41 @@ CONFIG_LBDAF=y
148# IO Schedulers 153# IO Schedulers
149# 154#
150CONFIG_IOSCHED_NOOP=y 155CONFIG_IOSCHED_NOOP=y
151# CONFIG_IOSCHED_AS is not set
152# CONFIG_IOSCHED_DEADLINE is not set 156# CONFIG_IOSCHED_DEADLINE is not set
153# CONFIG_IOSCHED_CFQ is not set 157# CONFIG_IOSCHED_CFQ is not set
154# CONFIG_DEFAULT_AS is not set
155# CONFIG_DEFAULT_DEADLINE is not set 158# CONFIG_DEFAULT_DEADLINE is not set
156# CONFIG_DEFAULT_CFQ is not set 159# CONFIG_DEFAULT_CFQ is not set
157CONFIG_DEFAULT_NOOP=y 160CONFIG_DEFAULT_NOOP=y
158CONFIG_DEFAULT_IOSCHED="noop" 161CONFIG_DEFAULT_IOSCHED="noop"
162# CONFIG_INLINE_SPIN_TRYLOCK is not set
163# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
164# CONFIG_INLINE_SPIN_LOCK is not set
165# CONFIG_INLINE_SPIN_LOCK_BH is not set
166# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
167# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
168# CONFIG_INLINE_SPIN_UNLOCK is not set
169# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
170# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
171# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
172# CONFIG_INLINE_READ_TRYLOCK is not set
173# CONFIG_INLINE_READ_LOCK is not set
174# CONFIG_INLINE_READ_LOCK_BH is not set
175# CONFIG_INLINE_READ_LOCK_IRQ is not set
176# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
177# CONFIG_INLINE_READ_UNLOCK is not set
178# CONFIG_INLINE_READ_UNLOCK_BH is not set
179# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
180# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
181# CONFIG_INLINE_WRITE_TRYLOCK is not set
182# CONFIG_INLINE_WRITE_LOCK is not set
183# CONFIG_INLINE_WRITE_LOCK_BH is not set
184# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
185# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
186# CONFIG_INLINE_WRITE_UNLOCK is not set
187# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
188# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
189# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
190# CONFIG_MUTEX_SPIN_ON_OWNER is not set
159CONFIG_FREEZER=y 191CONFIG_FREEZER=y
160 192
161# 193#
@@ -247,8 +279,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
247# CONFIG_PHYS_ADDR_T_64BIT is not set 279# CONFIG_PHYS_ADDR_T_64BIT is not set
248CONFIG_ZONE_DMA_FLAG=0 280CONFIG_ZONE_DMA_FLAG=0
249CONFIG_NR_QUICK=2 281CONFIG_NR_QUICK=2
250CONFIG_HAVE_MLOCK=y
251CONFIG_HAVE_MLOCKED_PAGE_BIT=y
252# CONFIG_KSM is not set 282# CONFIG_KSM is not set
253CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 283CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
254 284
@@ -280,7 +310,6 @@ CONFIG_CPU_HAS_DSP=y
280# 310#
281CONFIG_SH_TIMER_TMU=y 311CONFIG_SH_TIMER_TMU=y
282# CONFIG_SH_TIMER_CMT is not set 312# CONFIG_SH_TIMER_CMT is not set
283CONFIG_SH_PCLK_FREQ=33333333
284CONFIG_SH_CLK_CPG=y 313CONFIG_SH_CLK_CPG=y
285CONFIG_TICK_ONESHOT=y 314CONFIG_TICK_ONESHOT=y
286# CONFIG_NO_HZ is not set 315# CONFIG_NO_HZ is not set
@@ -435,14 +464,17 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
435# CONFIG_BT is not set 464# CONFIG_BT is not set
436# CONFIG_AF_RXRPC is not set 465# CONFIG_AF_RXRPC is not set
437CONFIG_WIRELESS=y 466CONFIG_WIRELESS=y
467CONFIG_WIRELESS_EXT=y
468CONFIG_WEXT_CORE=y
469CONFIG_WEXT_PROC=y
470CONFIG_WEXT_SPY=y
438CONFIG_CFG80211=y 471CONFIG_CFG80211=y
439# CONFIG_NL80211_TESTMODE is not set 472# CONFIG_NL80211_TESTMODE is not set
440# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set 473# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
441# CONFIG_CFG80211_REG_DEBUG is not set 474# CONFIG_CFG80211_REG_DEBUG is not set
442CONFIG_CFG80211_DEFAULT_PS=y 475CONFIG_CFG80211_DEFAULT_PS=y
443CONFIG_CFG80211_DEFAULT_PS_VALUE=1
444# CONFIG_WIRELESS_OLD_REGULATORY is not set 476# CONFIG_WIRELESS_OLD_REGULATORY is not set
445CONFIG_WIRELESS_EXT=y 477CONFIG_CFG80211_WEXT=y
446CONFIG_WIRELESS_EXT_SYSFS=y 478CONFIG_WIRELESS_EXT_SYSFS=y
447CONFIG_LIB80211=m 479CONFIG_LIB80211=m
448# CONFIG_LIB80211_DEBUG is not set 480# CONFIG_LIB80211_DEBUG is not set
@@ -559,6 +591,10 @@ CONFIG_MTD_RAM=y
559CONFIG_BLK_DEV=y 591CONFIG_BLK_DEV=y
560# CONFIG_BLK_DEV_COW_COMMON is not set 592# CONFIG_BLK_DEV_COW_COMMON is not set
561# CONFIG_BLK_DEV_LOOP is not set 593# CONFIG_BLK_DEV_LOOP is not set
594
595#
596# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
597#
562# CONFIG_BLK_DEV_NBD is not set 598# CONFIG_BLK_DEV_NBD is not set
563# CONFIG_BLK_DEV_UB is not set 599# CONFIG_BLK_DEV_UB is not set
564CONFIG_BLK_DEV_RAM=y 600CONFIG_BLK_DEV_RAM=y
@@ -576,6 +612,7 @@ CONFIG_MISC_DEVICES=y
576# EEPROM support 612# EEPROM support
577# 613#
578# CONFIG_EEPROM_93CX6 is not set 614# CONFIG_EEPROM_93CX6 is not set
615# CONFIG_IWMC3200TOP is not set
579CONFIG_HAVE_IDE=y 616CONFIG_HAVE_IDE=y
580# CONFIG_IDE is not set 617# CONFIG_IDE is not set
581 618
@@ -653,30 +690,29 @@ CONFIG_MII=y
653# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 690# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
654# CONFIG_B44 is not set 691# CONFIG_B44 is not set
655# CONFIG_KS8842 is not set 692# CONFIG_KS8842 is not set
693# CONFIG_KS8851_MLL is not set
656# CONFIG_NETDEV_1000 is not set 694# CONFIG_NETDEV_1000 is not set
657# CONFIG_NETDEV_10000 is not set 695# CONFIG_NETDEV_10000 is not set
658CONFIG_WLAN=y 696CONFIG_WLAN=y
659# CONFIG_WLAN_PRE80211 is not set
660CONFIG_WLAN_80211=y
661CONFIG_LIBERTAS=m
662# CONFIG_LIBERTAS_USB is not set
663CONFIG_LIBERTAS_SDIO=m
664CONFIG_LIBERTAS_DEBUG=y
665# CONFIG_LIBERTAS_THINFIRM is not set 697# CONFIG_LIBERTAS_THINFIRM is not set
666# CONFIG_AT76C50X_USB is not set 698# CONFIG_AT76C50X_USB is not set
667# CONFIG_USB_ZD1201 is not set 699# CONFIG_USB_ZD1201 is not set
668# CONFIG_USB_NET_RNDIS_WLAN is not set 700# CONFIG_USB_NET_RNDIS_WLAN is not set
669# CONFIG_RTL8187 is not set 701# CONFIG_RTL8187 is not set
670# CONFIG_MAC80211_HWSIM is not set 702# CONFIG_MAC80211_HWSIM is not set
671# CONFIG_P54_COMMON is not set
672# CONFIG_ATH_COMMON is not set 703# CONFIG_ATH_COMMON is not set
673# CONFIG_HOSTAP is not set
674# CONFIG_B43 is not set 704# CONFIG_B43 is not set
675# CONFIG_B43LEGACY is not set 705# CONFIG_B43LEGACY is not set
676# CONFIG_ZD1211RW is not set 706# CONFIG_HOSTAP is not set
707# CONFIG_IWM is not set
708CONFIG_LIBERTAS=m
709# CONFIG_LIBERTAS_USB is not set
710CONFIG_LIBERTAS_SDIO=m
711CONFIG_LIBERTAS_DEBUG=y
712# CONFIG_P54_COMMON is not set
677# CONFIG_RT2X00 is not set 713# CONFIG_RT2X00 is not set
678# CONFIG_WL12XX is not set 714# CONFIG_WL12XX is not set
679# CONFIG_IWM is not set 715# CONFIG_ZD1211RW is not set
680 716
681# 717#
682# Enable WiMAX (Networking options) to see the WiMAX drivers 718# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -718,6 +754,7 @@ CONFIG_USB_NET_CDCETHER=y
718CONFIG_INPUT=y 754CONFIG_INPUT=y
719# CONFIG_INPUT_FF_MEMLESS is not set 755# CONFIG_INPUT_FF_MEMLESS is not set
720# CONFIG_INPUT_POLLDEV is not set 756# CONFIG_INPUT_POLLDEV is not set
757# CONFIG_INPUT_SPARSEKMAP is not set
721 758
722# 759#
723# Userland interfaces 760# Userland interfaces
@@ -810,6 +847,7 @@ CONFIG_SSB_POSSIBLE=y
810# 847#
811# CONFIG_MFD_CORE is not set 848# CONFIG_MFD_CORE is not set
812# CONFIG_MFD_SM501 is not set 849# CONFIG_MFD_SM501 is not set
850# CONFIG_MFD_SH_MOBILE_SDHI is not set
813# CONFIG_HTC_PASIC3 is not set 851# CONFIG_HTC_PASIC3 is not set
814# CONFIG_MFD_TMIO is not set 852# CONFIG_MFD_TMIO is not set
815# CONFIG_REGULATOR is not set 853# CONFIG_REGULATOR is not set
@@ -951,6 +989,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y
951# CONFIG_MMC_SDHCI is not set 989# CONFIG_MMC_SDHCI is not set
952# CONFIG_MMC_AT91 is not set 990# CONFIG_MMC_AT91 is not set
953# CONFIG_MMC_ATMELMCI is not set 991# CONFIG_MMC_ATMELMCI is not set
992# CONFIG_MMC_TMIO is not set
954# CONFIG_MEMSTICK is not set 993# CONFIG_MEMSTICK is not set
955# CONFIG_NEW_LEDS is not set 994# CONFIG_NEW_LEDS is not set
956# CONFIG_ACCESSIBILITY is not set 995# CONFIG_ACCESSIBILITY is not set
@@ -1133,7 +1172,7 @@ CONFIG_FRAME_WARN=1024
1133# CONFIG_DEBUG_KERNEL is not set 1172# CONFIG_DEBUG_KERNEL is not set
1134# CONFIG_SLUB_DEBUG_ON is not set 1173# CONFIG_SLUB_DEBUG_ON is not set
1135# CONFIG_SLUB_STATS is not set 1174# CONFIG_SLUB_STATS is not set
1136# CONFIG_DEBUG_BUGVERBOSE is not set 1175CONFIG_DEBUG_BUGVERBOSE=y
1137# CONFIG_DEBUG_MEMORY_INIT is not set 1176# CONFIG_DEBUG_MEMORY_INIT is not set
1138# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1177# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1139# CONFIG_LATENCYTOP is not set 1178# CONFIG_LATENCYTOP is not set
@@ -1150,7 +1189,6 @@ CONFIG_TRACING_SUPPORT=y
1150# CONFIG_SAMPLES is not set 1189# CONFIG_SAMPLES is not set
1151CONFIG_HAVE_ARCH_KGDB=y 1190CONFIG_HAVE_ARCH_KGDB=y
1152# CONFIG_SH_STANDARD_BIOS is not set 1191# CONFIG_SH_STANDARD_BIOS is not set
1153# CONFIG_EARLY_SCIF_CONSOLE is not set
1154# CONFIG_DWARF_UNWINDER is not set 1192# CONFIG_DWARF_UNWINDER is not set
1155 1193
1156# 1194#
@@ -1159,7 +1197,11 @@ CONFIG_HAVE_ARCH_KGDB=y
1159# CONFIG_KEYS is not set 1197# CONFIG_KEYS is not set
1160# CONFIG_SECURITY is not set 1198# CONFIG_SECURITY is not set
1161# CONFIG_SECURITYFS is not set 1199# CONFIG_SECURITYFS is not set
1162# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1200# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1201# CONFIG_DEFAULT_SECURITY_SMACK is not set
1202# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1203CONFIG_DEFAULT_SECURITY_DAC=y
1204CONFIG_DEFAULT_SECURITY=""
1163CONFIG_CRYPTO=y 1205CONFIG_CRYPTO=y
1164 1206
1165# 1207#
diff --git a/arch/sh/configs/urquell_defconfig b/arch/sh/configs/urquell_defconfig
index 9f8aee5bc559..23bda1916f4d 100644
--- a/arch/sh/configs/urquell_defconfig
+++ b/arch/sh/configs/urquell_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.31 3# Linux kernel version: 2.6.33-rc2
4# Thu Sep 24 19:46:13 2009 4# Mon Jan 4 15:27:53 2010
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 21# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y 22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_HUGETLBFS=y
23CONFIG_SYS_SUPPORTS_SMP=y 24CONFIG_SYS_SUPPORTS_SMP=y
24CONFIG_SYS_SUPPORTS_NUMA=y 25CONFIG_SYS_SUPPORTS_NUMA=y
25CONFIG_SYS_SUPPORTS_PCI=y 26CONFIG_SYS_SUPPORTS_PCI=y
@@ -32,6 +33,8 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
32CONFIG_ARCH_NO_VIRT_TO_BUS=y 33CONFIG_ARCH_NO_VIRT_TO_BUS=y
33CONFIG_ARCH_HAS_DEFAULT_IDLE=y 34CONFIG_ARCH_HAS_DEFAULT_IDLE=y
34CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y 35CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
36CONFIG_DMA_COHERENT=y
37# CONFIG_DMA_NONCOHERENT is not set
35CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 38CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
36CONFIG_CONSTRUCTORS=y 39CONFIG_CONSTRUCTORS=y
37 40
@@ -66,6 +69,7 @@ CONFIG_AUDIT_TREE=y
66# 69#
67CONFIG_TREE_RCU=y 70CONFIG_TREE_RCU=y
68# CONFIG_TREE_PREEMPT_RCU is not set 71# CONFIG_TREE_PREEMPT_RCU is not set
72# CONFIG_TINY_RCU is not set
69# CONFIG_RCU_TRACE is not set 73# CONFIG_RCU_TRACE is not set
70CONFIG_RCU_FANOUT=32 74CONFIG_RCU_FANOUT=32
71# CONFIG_RCU_FANOUT_EXACT is not set 75# CONFIG_RCU_FANOUT_EXACT is not set
@@ -120,12 +124,14 @@ CONFIG_EVENTFD=y
120CONFIG_SHMEM=y 124CONFIG_SHMEM=y
121CONFIG_AIO=y 125CONFIG_AIO=y
122CONFIG_HAVE_PERF_EVENTS=y 126CONFIG_HAVE_PERF_EVENTS=y
127CONFIG_PERF_USE_VMALLOC=y
123 128
124# 129#
125# Kernel Performance Events And Counters 130# Kernel Performance Events And Counters
126# 131#
127CONFIG_PERF_EVENTS=y 132CONFIG_PERF_EVENTS=y
128# CONFIG_PERF_COUNTERS is not set 133# CONFIG_PERF_COUNTERS is not set
134# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
129CONFIG_VM_EVENT_COUNTERS=y 135CONFIG_VM_EVENT_COUNTERS=y
130CONFIG_PCI_QUIRKS=y 136CONFIG_PCI_QUIRKS=y
131CONFIG_COMPAT_BRK=y 137CONFIG_COMPAT_BRK=y
@@ -140,6 +146,7 @@ CONFIG_HAVE_IOREMAP_PROT=y
140CONFIG_HAVE_KPROBES=y 146CONFIG_HAVE_KPROBES=y
141CONFIG_HAVE_KRETPROBES=y 147CONFIG_HAVE_KRETPROBES=y
142CONFIG_HAVE_ARCH_TRACEHOOK=y 148CONFIG_HAVE_ARCH_TRACEHOOK=y
149CONFIG_HAVE_DMA_ATTRS=y
143CONFIG_HAVE_CLK=y 150CONFIG_HAVE_CLK=y
144CONFIG_HAVE_DMA_API_DEBUG=y 151CONFIG_HAVE_DMA_API_DEBUG=y
145 152
@@ -162,19 +169,48 @@ CONFIG_BLOCK=y
162CONFIG_LBDAF=y 169CONFIG_LBDAF=y
163# CONFIG_BLK_DEV_BSG is not set 170# CONFIG_BLK_DEV_BSG is not set
164# CONFIG_BLK_DEV_INTEGRITY is not set 171# CONFIG_BLK_DEV_INTEGRITY is not set
172# CONFIG_BLK_CGROUP is not set
165 173
166# 174#
167# IO Schedulers 175# IO Schedulers
168# 176#
169CONFIG_IOSCHED_NOOP=y 177CONFIG_IOSCHED_NOOP=y
170CONFIG_IOSCHED_AS=y
171CONFIG_IOSCHED_DEADLINE=y 178CONFIG_IOSCHED_DEADLINE=y
172CONFIG_IOSCHED_CFQ=y 179CONFIG_IOSCHED_CFQ=y
173CONFIG_DEFAULT_AS=y 180# CONFIG_CFQ_GROUP_IOSCHED is not set
174# CONFIG_DEFAULT_DEADLINE is not set 181# CONFIG_DEFAULT_DEADLINE is not set
175# CONFIG_DEFAULT_CFQ is not set 182CONFIG_DEFAULT_CFQ=y
176# CONFIG_DEFAULT_NOOP is not set 183# CONFIG_DEFAULT_NOOP is not set
177CONFIG_DEFAULT_IOSCHED="anticipatory" 184CONFIG_DEFAULT_IOSCHED="cfq"
185# CONFIG_INLINE_SPIN_TRYLOCK is not set
186# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
187# CONFIG_INLINE_SPIN_LOCK is not set
188# CONFIG_INLINE_SPIN_LOCK_BH is not set
189# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
190# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
191CONFIG_INLINE_SPIN_UNLOCK=y
192# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
193CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
194# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
195# CONFIG_INLINE_READ_TRYLOCK is not set
196# CONFIG_INLINE_READ_LOCK is not set
197# CONFIG_INLINE_READ_LOCK_BH is not set
198# CONFIG_INLINE_READ_LOCK_IRQ is not set
199# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
200CONFIG_INLINE_READ_UNLOCK=y
201# CONFIG_INLINE_READ_UNLOCK_BH is not set
202CONFIG_INLINE_READ_UNLOCK_IRQ=y
203# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
204# CONFIG_INLINE_WRITE_TRYLOCK is not set
205# CONFIG_INLINE_WRITE_LOCK is not set
206# CONFIG_INLINE_WRITE_LOCK_BH is not set
207# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
208# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
209CONFIG_INLINE_WRITE_UNLOCK=y
210# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
211CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
212# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
213# CONFIG_MUTEX_SPIN_ON_OWNER is not set
178CONFIG_FREEZER=y 214CONFIG_FREEZER=y
179 215
180# 216#
@@ -229,6 +265,7 @@ CONFIG_FORCE_MAX_ZONEORDER=11
229CONFIG_MEMORY_START=0x08000000 265CONFIG_MEMORY_START=0x08000000
230CONFIG_MEMORY_SIZE=0x08000000 266CONFIG_MEMORY_SIZE=0x08000000
231CONFIG_29BIT=y 267CONFIG_29BIT=y
268# CONFIG_PMB_ENABLE is not set
232# CONFIG_X2TLB is not set 269# CONFIG_X2TLB is not set
233CONFIG_VSYSCALL=y 270CONFIG_VSYSCALL=y
234# CONFIG_NUMA is not set 271# CONFIG_NUMA is not set
@@ -263,8 +300,6 @@ CONFIG_MIGRATION=y
263# CONFIG_PHYS_ADDR_T_64BIT is not set 300# CONFIG_PHYS_ADDR_T_64BIT is not set
264CONFIG_ZONE_DMA_FLAG=0 301CONFIG_ZONE_DMA_FLAG=0
265CONFIG_NR_QUICK=2 302CONFIG_NR_QUICK=2
266CONFIG_HAVE_MLOCK=y
267CONFIG_HAVE_MLOCKED_PAGE_BIT=y
268# CONFIG_KSM is not set 303# CONFIG_KSM is not set
269CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 304CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
270 305
@@ -356,7 +391,6 @@ CONFIG_ENTRY_OFFSET=0x00001000
356# Bus options 391# Bus options
357# 392#
358CONFIG_PCI=y 393CONFIG_PCI=y
359# CONFIG_SH_PCIDMA_NONCOHERENT is not set
360CONFIG_PCIEPORTBUS=y 394CONFIG_PCIEPORTBUS=y
361CONFIG_PCIEAER=y 395CONFIG_PCIEAER=y
362# CONFIG_PCIE_ECRC is not set 396# CONFIG_PCIE_ECRC is not set
@@ -469,10 +503,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
469# CONFIG_AF_RXRPC is not set 503# CONFIG_AF_RXRPC is not set
470CONFIG_WIRELESS=y 504CONFIG_WIRELESS=y
471# CONFIG_CFG80211 is not set 505# CONFIG_CFG80211 is not set
472CONFIG_CFG80211_DEFAULT_PS_VALUE=0
473# CONFIG_WIRELESS_OLD_REGULATORY is not set
474CONFIG_WIRELESS_EXT=y
475CONFIG_WIRELESS_EXT_SYSFS=y
476# CONFIG_LIB80211 is not set 506# CONFIG_LIB80211 is not set
477 507
478# 508#
@@ -588,6 +618,10 @@ CONFIG_BLK_DEV=y
588# CONFIG_BLK_DEV_UMEM is not set 618# CONFIG_BLK_DEV_UMEM is not set
589# CONFIG_BLK_DEV_COW_COMMON is not set 619# CONFIG_BLK_DEV_COW_COMMON is not set
590# CONFIG_BLK_DEV_LOOP is not set 620# CONFIG_BLK_DEV_LOOP is not set
621
622#
623# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
624#
591# CONFIG_BLK_DEV_NBD is not set 625# CONFIG_BLK_DEV_NBD is not set
592# CONFIG_BLK_DEV_SX8 is not set 626# CONFIG_BLK_DEV_SX8 is not set
593# CONFIG_BLK_DEV_UB is not set 627# CONFIG_BLK_DEV_UB is not set
@@ -688,15 +722,16 @@ CONFIG_ATA_SFF=y
688# CONFIG_PATA_NS87415 is not set 722# CONFIG_PATA_NS87415 is not set
689# CONFIG_PATA_OPTI is not set 723# CONFIG_PATA_OPTI is not set
690# CONFIG_PATA_OPTIDMA is not set 724# CONFIG_PATA_OPTIDMA is not set
725# CONFIG_PATA_PDC2027X is not set
691# CONFIG_PATA_PDC_OLD is not set 726# CONFIG_PATA_PDC_OLD is not set
692# CONFIG_PATA_RADISYS is not set 727# CONFIG_PATA_RADISYS is not set
693# CONFIG_PATA_RDC is not set 728# CONFIG_PATA_RDC is not set
694# CONFIG_PATA_RZ1000 is not set 729# CONFIG_PATA_RZ1000 is not set
695# CONFIG_PATA_SC1200 is not set 730# CONFIG_PATA_SC1200 is not set
696# CONFIG_PATA_SERVERWORKS is not set 731# CONFIG_PATA_SERVERWORKS is not set
697# CONFIG_PATA_PDC2027X is not set
698# CONFIG_PATA_SIL680 is not set 732# CONFIG_PATA_SIL680 is not set
699# CONFIG_PATA_SIS is not set 733# CONFIG_PATA_SIS is not set
734# CONFIG_PATA_TOSHIBA is not set
700# CONFIG_PATA_VIA is not set 735# CONFIG_PATA_VIA is not set
701# CONFIG_PATA_WINBOND is not set 736# CONFIG_PATA_WINBOND is not set
702# CONFIG_PATA_PLATFORM is not set 737# CONFIG_PATA_PLATFORM is not set
@@ -787,6 +822,7 @@ CONFIG_8139CP=y
787# CONFIG_SUNDANCE is not set 822# CONFIG_SUNDANCE is not set
788# CONFIG_TLAN is not set 823# CONFIG_TLAN is not set
789# CONFIG_KS8842 is not set 824# CONFIG_KS8842 is not set
825# CONFIG_KS8851_MLL is not set
790# CONFIG_VIA_RHINE is not set 826# CONFIG_VIA_RHINE is not set
791# CONFIG_SC92031 is not set 827# CONFIG_SC92031 is not set
792# CONFIG_ATL2 is not set 828# CONFIG_ATL2 is not set
@@ -818,8 +854,10 @@ CONFIG_SKY2_DEBUG=y
818# CONFIG_NETDEV_10000 is not set 854# CONFIG_NETDEV_10000 is not set
819# CONFIG_TR is not set 855# CONFIG_TR is not set
820CONFIG_WLAN=y 856CONFIG_WLAN=y
821# CONFIG_WLAN_PRE80211 is not set 857# CONFIG_ATMEL is not set
822# CONFIG_WLAN_80211 is not set 858# CONFIG_PRISM54 is not set
859# CONFIG_USB_ZD1201 is not set
860# CONFIG_HOSTAP is not set
823 861
824# 862#
825# Enable WiMAX (Networking options) to see the WiMAX drivers 863# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -842,6 +880,7 @@ CONFIG_WLAN=y
842# CONFIG_NETCONSOLE is not set 880# CONFIG_NETCONSOLE is not set
843# CONFIG_NETPOLL is not set 881# CONFIG_NETPOLL is not set
844# CONFIG_NET_POLL_CONTROLLER is not set 882# CONFIG_NET_POLL_CONTROLLER is not set
883# CONFIG_VMXNET3 is not set
845# CONFIG_ISDN is not set 884# CONFIG_ISDN is not set
846# CONFIG_PHONE is not set 885# CONFIG_PHONE is not set
847 886
@@ -851,6 +890,7 @@ CONFIG_WLAN=y
851CONFIG_INPUT=y 890CONFIG_INPUT=y
852CONFIG_INPUT_FF_MEMLESS=m 891CONFIG_INPUT_FF_MEMLESS=m
853# CONFIG_INPUT_POLLDEV is not set 892# CONFIG_INPUT_POLLDEV is not set
893# CONFIG_INPUT_SPARSEKMAP is not set
854 894
855# 895#
856# Userland interfaces 896# Userland interfaces
@@ -976,11 +1016,6 @@ CONFIG_I2C_ALGOPCA=y
976# CONFIG_I2C_TINY_USB is not set 1016# CONFIG_I2C_TINY_USB is not set
977 1017
978# 1018#
979# Graphics adapter I2C/DDC channel drivers
980#
981# CONFIG_I2C_VOODOO3 is not set
982
983#
984# Other I2C/SMBus bus drivers 1019# Other I2C/SMBus bus drivers
985# 1020#
986CONFIG_I2C_PCA_PLATFORM=y 1021CONFIG_I2C_PCA_PLATFORM=y
@@ -989,7 +1024,6 @@ CONFIG_I2C_PCA_PLATFORM=y
989# 1024#
990# Miscellaneous I2C Chip support 1025# Miscellaneous I2C Chip support
991# 1026#
992# CONFIG_DS1682 is not set
993# CONFIG_SENSORS_TSL2550 is not set 1027# CONFIG_SENSORS_TSL2550 is not set
994# CONFIG_I2C_DEBUG_CORE is not set 1028# CONFIG_I2C_DEBUG_CORE is not set
995# CONFIG_I2C_DEBUG_ALGO is not set 1029# CONFIG_I2C_DEBUG_ALGO is not set
@@ -1020,6 +1054,7 @@ CONFIG_GPIOLIB=y
1020# 1054#
1021# PCI GPIO expanders: 1055# PCI GPIO expanders:
1022# 1056#
1057# CONFIG_GPIO_CS5535 is not set
1023# CONFIG_GPIO_BT8XX is not set 1058# CONFIG_GPIO_BT8XX is not set
1024# CONFIG_GPIO_LANGWELL is not set 1059# CONFIG_GPIO_LANGWELL is not set
1025 1060
@@ -1062,6 +1097,7 @@ CONFIG_HWMON=y
1062# CONFIG_SENSORS_GL520SM is not set 1097# CONFIG_SENSORS_GL520SM is not set
1063# CONFIG_SENSORS_IT87 is not set 1098# CONFIG_SENSORS_IT87 is not set
1064# CONFIG_SENSORS_LM63 is not set 1099# CONFIG_SENSORS_LM63 is not set
1100# CONFIG_SENSORS_LM73 is not set
1065# CONFIG_SENSORS_LM75 is not set 1101# CONFIG_SENSORS_LM75 is not set
1066# CONFIG_SENSORS_LM77 is not set 1102# CONFIG_SENSORS_LM77 is not set
1067# CONFIG_SENSORS_LM78 is not set 1103# CONFIG_SENSORS_LM78 is not set
@@ -1101,6 +1137,7 @@ CONFIG_HWMON=y
1101# CONFIG_SENSORS_W83L786NG is not set 1137# CONFIG_SENSORS_W83L786NG is not set
1102# CONFIG_SENSORS_W83627HF is not set 1138# CONFIG_SENSORS_W83627HF is not set
1103# CONFIG_SENSORS_W83627EHF is not set 1139# CONFIG_SENSORS_W83627EHF is not set
1140# CONFIG_SENSORS_LIS3_I2C is not set
1104# CONFIG_THERMAL is not set 1141# CONFIG_THERMAL is not set
1105# CONFIG_WATCHDOG is not set 1142# CONFIG_WATCHDOG is not set
1106CONFIG_SSB_POSSIBLE=y 1143CONFIG_SSB_POSSIBLE=y
@@ -1116,16 +1153,19 @@ CONFIG_SSB_POSSIBLE=y
1116# CONFIG_MFD_CORE is not set 1153# CONFIG_MFD_CORE is not set
1117CONFIG_MFD_SM501=y 1154CONFIG_MFD_SM501=y
1118# CONFIG_MFD_SM501_GPIO is not set 1155# CONFIG_MFD_SM501_GPIO is not set
1156# CONFIG_MFD_SH_MOBILE_SDHI is not set
1119# CONFIG_HTC_PASIC3 is not set 1157# CONFIG_HTC_PASIC3 is not set
1120# CONFIG_TPS65010 is not set 1158# CONFIG_TPS65010 is not set
1121# CONFIG_TWL4030_CORE is not set 1159# CONFIG_TWL4030_CORE is not set
1122# CONFIG_MFD_TMIO is not set 1160# CONFIG_MFD_TMIO is not set
1123# CONFIG_PMIC_DA903X is not set 1161# CONFIG_PMIC_DA903X is not set
1162# CONFIG_PMIC_ADP5520 is not set
1124# CONFIG_MFD_WM8400 is not set 1163# CONFIG_MFD_WM8400 is not set
1125# CONFIG_MFD_WM831X is not set 1164# CONFIG_MFD_WM831X is not set
1126# CONFIG_MFD_WM8350_I2C is not set 1165# CONFIG_MFD_WM8350_I2C is not set
1127# CONFIG_MFD_PCF50633 is not set 1166# CONFIG_MFD_PCF50633 is not set
1128# CONFIG_AB3100_CORE is not set 1167# CONFIG_AB3100_CORE is not set
1168# CONFIG_MFD_88PM8607 is not set
1129# CONFIG_REGULATOR is not set 1169# CONFIG_REGULATOR is not set
1130CONFIG_MEDIA_SUPPORT=y 1170CONFIG_MEDIA_SUPPORT=y
1131 1171
@@ -1139,6 +1179,8 @@ CONFIG_MEDIA_SUPPORT=y
1139# 1179#
1140# Multimedia drivers 1180# Multimedia drivers
1141# 1181#
1182CONFIG_IR_CORE=y
1183CONFIG_VIDEO_IR=y
1142# CONFIG_DAB is not set 1184# CONFIG_DAB is not set
1143 1185
1144# 1186#
@@ -1417,6 +1459,7 @@ CONFIG_RTC_INTF_DEV=y
1417# CONFIG_RTC_DRV_PCF8563 is not set 1459# CONFIG_RTC_DRV_PCF8563 is not set
1418# CONFIG_RTC_DRV_PCF8583 is not set 1460# CONFIG_RTC_DRV_PCF8583 is not set
1419# CONFIG_RTC_DRV_M41T80 is not set 1461# CONFIG_RTC_DRV_M41T80 is not set
1462# CONFIG_RTC_DRV_BQ32K is not set
1420# CONFIG_RTC_DRV_S35390A is not set 1463# CONFIG_RTC_DRV_S35390A is not set
1421# CONFIG_RTC_DRV_FM3130 is not set 1464# CONFIG_RTC_DRV_FM3130 is not set
1422# CONFIG_RTC_DRV_RX8581 is not set 1465# CONFIG_RTC_DRV_RX8581 is not set
@@ -1437,7 +1480,9 @@ CONFIG_RTC_INTF_DEV=y
1437# CONFIG_RTC_DRV_M48T86 is not set 1480# CONFIG_RTC_DRV_M48T86 is not set
1438# CONFIG_RTC_DRV_M48T35 is not set 1481# CONFIG_RTC_DRV_M48T35 is not set
1439# CONFIG_RTC_DRV_M48T59 is not set 1482# CONFIG_RTC_DRV_M48T59 is not set
1483# CONFIG_RTC_DRV_MSM6242 is not set
1440# CONFIG_RTC_DRV_BQ4802 is not set 1484# CONFIG_RTC_DRV_BQ4802 is not set
1485# CONFIG_RTC_DRV_RP5C01 is not set
1441# CONFIG_RTC_DRV_V3020 is not set 1486# CONFIG_RTC_DRV_V3020 is not set
1442 1487
1443# 1488#
@@ -1466,7 +1511,6 @@ CONFIG_EXT3_FS_XATTR=y
1466# CONFIG_EXT3_FS_POSIX_ACL is not set 1511# CONFIG_EXT3_FS_POSIX_ACL is not set
1467# CONFIG_EXT3_FS_SECURITY is not set 1512# CONFIG_EXT3_FS_SECURITY is not set
1468CONFIG_EXT4_FS=y 1513CONFIG_EXT4_FS=y
1469# CONFIG_EXT4DEV_COMPAT is not set
1470CONFIG_EXT4_FS_XATTR=y 1514CONFIG_EXT4_FS_XATTR=y
1471# CONFIG_EXT4_FS_POSIX_ACL is not set 1515# CONFIG_EXT4_FS_POSIX_ACL is not set
1472# CONFIG_EXT4_FS_SECURITY is not set 1516# CONFIG_EXT4_FS_SECURITY is not set
@@ -1687,9 +1731,6 @@ CONFIG_TRACING_SUPPORT=y
1687CONFIG_HAVE_ARCH_KGDB=y 1731CONFIG_HAVE_ARCH_KGDB=y
1688# CONFIG_KGDB is not set 1732# CONFIG_KGDB is not set
1689# CONFIG_SH_STANDARD_BIOS is not set 1733# CONFIG_SH_STANDARD_BIOS is not set
1690CONFIG_EARLY_SCIF_CONSOLE=y
1691CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffeb0000
1692CONFIG_EARLY_PRINTK=y
1693# CONFIG_STACK_DEBUG is not set 1734# CONFIG_STACK_DEBUG is not set
1694# CONFIG_DEBUG_STACK_USAGE is not set 1735# CONFIG_DEBUG_STACK_USAGE is not set
1695# CONFIG_4KSTACKS is not set 1736# CONFIG_4KSTACKS is not set
@@ -1703,7 +1744,11 @@ CONFIG_EARLY_PRINTK=y
1703# CONFIG_KEYS is not set 1744# CONFIG_KEYS is not set
1704# CONFIG_SECURITY is not set 1745# CONFIG_SECURITY is not set
1705# CONFIG_SECURITYFS is not set 1746# CONFIG_SECURITYFS is not set
1706# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1747# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1748# CONFIG_DEFAULT_SECURITY_SMACK is not set
1749# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1750CONFIG_DEFAULT_SECURITY_DAC=y
1751CONFIG_DEFAULT_SECURITY=""
1707CONFIG_CRYPTO=y 1752CONFIG_CRYPTO=y
1708 1753
1709# 1754#
diff --git a/arch/sh/drivers/pci/fixups-rts7751r2d.c b/arch/sh/drivers/pci/fixups-rts7751r2d.c
index 052b354236dc..7898f14d6641 100644
--- a/arch/sh/drivers/pci/fixups-rts7751r2d.c
+++ b/arch/sh/drivers/pci/fixups-rts7751r2d.c
@@ -15,7 +15,7 @@
15#include <mach/lboxre2.h> 15#include <mach/lboxre2.h>
16#include <mach/r2d.h> 16#include <mach/r2d.h>
17#include "pci-sh4.h" 17#include "pci-sh4.h"
18#include <asm/machtypes.h> 18#include <generated/machtypes.h>
19 19
20#define PCIMCR_MRSET_OFF 0xBFFFFFFF 20#define PCIMCR_MRSET_OFF 0xBFFFFFFF
21#define PCIMCR_RFSH_OFF 0xFFFFFFFB 21#define PCIMCR_RFSH_OFF 0xFFFFFFFB
diff --git a/arch/sh/include/asm/.gitignore b/arch/sh/include/asm/.gitignore
deleted file mode 100644
index 378db779fb6c..000000000000
--- a/arch/sh/include/asm/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1machtypes.h
diff --git a/arch/sh/include/asm/asm-offsets.h b/arch/sh/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/sh/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index 04ad0e1e637e..07373a074090 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -19,9 +19,11 @@
19#include <asm-generic/dma.h> 19#include <asm-generic/dma.h>
20 20
21#ifdef CONFIG_NR_DMA_CHANNELS 21#ifdef CONFIG_NR_DMA_CHANNELS
22# define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS) 22# define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS)
23#elif defined(CONFIG_NR_ONCHIP_DMA_CHANNELS)
24# define MAX_DMA_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS)
23#else 25#else
24# define MAX_DMA_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS) 26# define MAX_DMA_CHANNELS 0
25#endif 27#endif
26 28
27/* 29/*
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h
index 84dd37761f56..9c30955630ff 100644
--- a/arch/sh/include/asm/machvec.h
+++ b/arch/sh/include/asm/machvec.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/time.h> 14#include <linux/time.h>
15#include <asm/machtypes.h> 15#include <generated/machtypes.h>
16 16
17struct sh_machine_vector { 17struct sh_machine_vector {
18 void (*mv_setup)(char **cmdline_p); 18 void (*mv_setup)(char **cmdline_p);
diff --git a/arch/sh/include/asm/timex.h b/arch/sh/include/asm/timex.h
index b556d49e5f2b..18bf06d9c764 100644
--- a/arch/sh/include/asm/timex.h
+++ b/arch/sh/include/asm/timex.h
@@ -6,7 +6,17 @@
6#ifndef __ASM_SH_TIMEX_H 6#ifndef __ASM_SH_TIMEX_H
7#define __ASM_SH_TIMEX_H 7#define __ASM_SH_TIMEX_H
8 8
9/*
10 * Only parts using the legacy CPG code for their clock framework
11 * implementation need to define their own Pclk value. If provided, this
12 * can be used for accurately setting CLOCK_TICK_RATE, otherwise we
13 * simply fall back on the i8253 PIT value.
14 */
15#ifdef CONFIG_SH_PCLK_FREQ
9#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */ 16#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */
17#else
18#define CLOCK_TICK_RATE 1193180
19#endif
10 20
11#include <asm-generic/timex.h> 21#include <asm-generic/timex.h>
12 22
diff --git a/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h b/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
index f0886bc880e0..c4ed660c14cf 100644
--- a/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
+++ b/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
@@ -19,10 +19,10 @@
19#elif defined(CONFIG_CPU_SUBTYPE_SH7723) || \ 19#elif defined(CONFIG_CPU_SUBTYPE_SH7723) || \
20 defined(CONFIG_CPU_SUBTYPE_SH7724) 20 defined(CONFIG_CPU_SUBTYPE_SH7724)
21#define DMTE0_IRQ 48 /* DMAC0A*/ 21#define DMTE0_IRQ 48 /* DMAC0A*/
22#define DMTE4_IRQ 40 /* DMAC0B */ 22#define DMTE4_IRQ 76 /* DMAC0B */
23#define DMTE6_IRQ 42 23#define DMTE6_IRQ 40
24#define DMTE8_IRQ 76 /* DMAC1A */ 24#define DMTE8_IRQ 42 /* DMAC1A */
25#define DMTE9_IRQ 77 25#define DMTE9_IRQ 43
26#define DMTE10_IRQ 72 /* DMAC1B */ 26#define DMTE10_IRQ 72 /* DMAC1B */
27#define DMTE11_IRQ 73 27#define DMTE11_IRQ 73
28#define DMAE0_IRQ 78 /* DMA Error IRQ*/ 28#define DMAE0_IRQ 78 /* DMA Error IRQ*/
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index a52f35117e82..d32f96c1cc15 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -23,9 +23,23 @@
23#include <linux/notifier.h> 23#include <linux/notifier.h>
24#include <asm/suspend.h> 24#include <asm/suspend.h>
25#include <asm/clock.h> 25#include <asm/clock.h>
26#include <asm/dma-sh.h>
26#include <asm/mmzone.h> 27#include <asm/mmzone.h>
27#include <cpu/sh7724.h> 28#include <cpu/sh7724.h>
28 29
30/* DMA */
31static struct sh_dmae_pdata dma_platform_data = {
32 .mode = SHDMA_DMAOR1,
33};
34
35static struct platform_device dma_device = {
36 .name = "sh-dma-engine",
37 .id = -1,
38 .dev = {
39 .platform_data = &dma_platform_data,
40 },
41};
42
29/* Serial */ 43/* Serial */
30static struct plat_sci_port scif0_platform_data = { 44static struct plat_sci_port scif0_platform_data = {
31 .mapbase = 0xffe00000, 45 .mapbase = 0xffe00000,
@@ -649,6 +663,7 @@ static struct platform_device *sh7724_devices[] __initdata = {
649 &tmu3_device, 663 &tmu3_device,
650 &tmu4_device, 664 &tmu4_device,
651 &tmu5_device, 665 &tmu5_device,
666 &dma_device,
652 &rtc_device, 667 &rtc_device,
653 &iic0_device, 668 &iic0_device,
654 &iic1_device, 669 &iic1_device,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index ef26ebda6e8b..f685b9b21999 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/sh_timer.h> 16#include <linux/sh_timer.h>
17#include <asm/dma-sh.h>
17#include <asm/mmzone.h> 18#include <asm/mmzone.h>
18 19
19static struct plat_sci_port scif0_platform_data = { 20static struct plat_sci_port scif0_platform_data = {
@@ -294,6 +295,18 @@ static struct platform_device tmu5_device = {
294 .num_resources = ARRAY_SIZE(tmu5_resources), 295 .num_resources = ARRAY_SIZE(tmu5_resources),
295}; 296};
296 297
298static struct sh_dmae_pdata dma_platform_data = {
299 .mode = (SHDMA_MIX_IRQ | SHDMA_DMAOR1),
300};
301
302static struct platform_device dma_device = {
303 .name = "sh-dma-engine",
304 .id = -1,
305 .dev = {
306 .platform_data = &dma_platform_data,
307 },
308};
309
297static struct platform_device *sh7785_devices[] __initdata = { 310static struct platform_device *sh7785_devices[] __initdata = {
298 &scif0_device, 311 &scif0_device,
299 &scif1_device, 312 &scif1_device,
@@ -307,6 +320,7 @@ static struct platform_device *sh7785_devices[] __initdata = {
307 &tmu3_device, 320 &tmu3_device,
308 &tmu4_device, 321 &tmu4_device,
309 &tmu5_device, 322 &tmu5_device,
323 &dma_device,
310}; 324};
311 325
312static int __init sh7785_devices_setup(void) 326static int __init sh7785_devices_setup(void)
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index aaff0037fcd7..6b3d706deac1 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -62,6 +62,7 @@ void default_idle(void)
62 clear_thread_flag(TIF_POLLING_NRFLAG); 62 clear_thread_flag(TIF_POLLING_NRFLAG);
63 smp_mb__after_clear_bit(); 63 smp_mb__after_clear_bit();
64 64
65 set_bl_bit();
65 if (!need_resched()) { 66 if (!need_resched()) {
66 local_irq_enable(); 67 local_irq_enable();
67 cpu_sleep(); 68 cpu_sleep();
@@ -69,6 +70,7 @@ void default_idle(void)
69 local_irq_enable(); 70 local_irq_enable();
70 71
71 set_thread_flag(TIF_POLLING_NRFLAG); 72 set_thread_flag(TIF_POLLING_NRFLAG);
73 clear_bl_bit();
72 } else 74 } else
73 poll_idle(); 75 poll_idle();
74} 76}
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 0e7ba8e891cf..986a71b88ca3 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -82,8 +82,7 @@ config 32BIT
82 82
83config PMB_ENABLE 83config PMB_ENABLE
84 bool "Support 32-bit physical addressing through PMB" 84 bool "Support 32-bit physical addressing through PMB"
85 depends on MMU && EXPERIMENTAL && CPU_SH4A 85 depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
86 default y
87 help 86 help
88 If you say Y here, physical addressing will be extended to 87 If you say Y here, physical addressing will be extended to
89 32-bits through the SH-4A PMB. If this is not set, legacy 88 32-bits through the SH-4A PMB. If this is not set, legacy
@@ -96,7 +95,7 @@ choice
96 95
97config PMB 96config PMB
98 bool "PMB" 97 bool "PMB"
99 depends on MMU && EXPERIMENTAL && CPU_SH4A 98 depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
100 help 99 help
101 If you say Y here, physical addressing will be extended to 100 If you say Y here, physical addressing will be extended to
102 32-bits through the SH-4A PMB. If this is not set, legacy 101 32-bits through the SH-4A PMB. If this is not set, legacy
@@ -104,7 +103,7 @@ config PMB
104 103
105config PMB_FIXED 104config PMB_FIXED
106 bool "fixed PMB" 105 bool "fixed PMB"
107 depends on MMU && EXPERIMENTAL && CPU_SH4A 106 depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
108 select 32BIT 107 select 32BIT
109 help 108 help
110 If this option is enabled, fixed PMB mappings are inherited 109 If this option is enabled, fixed PMB mappings are inherited
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index e9415d3ea94a..b8607fa7ae12 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -133,12 +133,8 @@ void __update_cache(struct vm_area_struct *vma,
133 page = pfn_to_page(pfn); 133 page = pfn_to_page(pfn);
134 if (pfn_valid(pfn)) { 134 if (pfn_valid(pfn)) {
135 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); 135 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
136 if (dirty) { 136 if (dirty)
137 unsigned long addr = (unsigned long)page_address(page); 137 __flush_purge_region(page_address(page), PAGE_SIZE);
138
139 if (pages_do_alias(addr, address & PAGE_MASK))
140 __flush_purge_region((void *)addr, PAGE_SIZE);
141 }
142 } 138 }
143} 139}
144 140
diff --git a/arch/sh/tools/Makefile b/arch/sh/tools/Makefile
index 567516b58acc..558a56bcc7cf 100644
--- a/arch/sh/tools/Makefile
+++ b/arch/sh/tools/Makefile
@@ -10,7 +10,7 @@
10# Shamelessly cloned from ARM. 10# Shamelessly cloned from ARM.
11# 11#
12 12
13include/asm-sh/machtypes.h: $(src)/gen-mach-types $(src)/mach-types 13include/generated/machtypes.h: $(src)/gen-mach-types $(src)/mach-types
14 @echo ' Generating $@' 14 @echo ' Generating $@'
15 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi 15 $(Q)mkdir -p $(dir $@)
16 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 16 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/sh/tools/gen-mach-types b/arch/sh/tools/gen-mach-types
index 65161e368353..f5ff7c5d8913 100644
--- a/arch/sh/tools/gen-mach-types
+++ b/arch/sh/tools/gen-mach-types
@@ -1,6 +1,6 @@
1#!/bin/awk 1#!/bin/awk
2# 2#
3# Awk script to generate include/asm-sh/machtypes.h 3# Awk script to generate include/generated/machtypes.h
4# Heavily based on arch/arm/tools/gen-mach-types 4# Heavily based on arch/arm/tools/gen-mach-types
5# 5#
6BEGIN { nr = 0 } 6BEGIN { nr = 0 }
diff --git a/arch/sparc/include/asm/asm-offsets.h b/arch/sparc/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/sparc/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/sparc/include/asm/fcntl.h b/arch/sparc/include/asm/fcntl.h
index 3b9cfb39175e..38f37b333cc7 100644
--- a/arch/sparc/include/asm/fcntl.h
+++ b/arch/sparc/include/asm/fcntl.h
@@ -19,7 +19,7 @@
19#define O_NOATIME 0x200000 19#define O_NOATIME 0x200000
20#define O_CLOEXEC 0x400000 20#define O_CLOEXEC 0x400000
21/* 21/*
22 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using 22 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
23 * the O_SYNC flag. We continue to use the existing numerical value 23 * the O_SYNC flag. We continue to use the existing numerical value
24 * for O_DSYNC semantics now, but using the correct symbolic name for it. 24 * for O_DSYNC semantics now, but using the correct symbolic name for it.
25 * This new value is used to request true Posix O_SYNC semantics. It is 25 * This new value is used to request true Posix O_SYNC semantics. It is
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index f30f4a1ead23..d242a7340541 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -96,7 +96,6 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
96 int cpu = smp_processor_id(); 96 int cpu = smp_processor_id();
97 97
98 clear_softint(1 << irq); 98 clear_softint(1 << irq);
99 pcr_ops->write(PCR_PIC_PRIV);
100 99
101 local_cpu_data().__nmi_count++; 100 local_cpu_data().__nmi_count++;
102 101
@@ -105,6 +104,8 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
105 if (notify_die(DIE_NMI, "nmi", regs, 0, 104 if (notify_die(DIE_NMI, "nmi", regs, 0,
106 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) 105 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
107 touched = 1; 106 touched = 1;
107 else
108 pcr_ops->write(PCR_PIC_PRIV);
108 109
109 sum = kstat_irqs_cpu(0, cpu); 110 sum = kstat_irqs_cpu(0, cpu);
110 if (__get_cpu_var(nmi_touch)) { 111 if (__get_cpu_var(nmi_touch)) {
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index fa5936e1c3b9..198fb4e79ba2 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -986,6 +986,17 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
986 data.addr = 0; 986 data.addr = 0;
987 987
988 cpuc = &__get_cpu_var(cpu_hw_events); 988 cpuc = &__get_cpu_var(cpu_hw_events);
989
990 /* If the PMU has the TOE IRQ enable bits, we need to do a
991 * dummy write to the %pcr to clear the overflow bits and thus
992 * the interrupt.
993 *
994 * Do this before we peek at the counters to determine
995 * overflow so we don't lose any events.
996 */
997 if (sparc_pmu->irq_bit)
998 pcr_ops->write(cpuc->pcr);
999
989 for (idx = 0; idx < MAX_HWEVENTS; idx++) { 1000 for (idx = 0; idx < MAX_HWEVENTS; idx++) {
990 struct perf_event *event = cpuc->events[idx]; 1001 struct perf_event *event = cpuc->events[idx];
991 struct hw_perf_event *hwc; 1002 struct hw_perf_event *hwc;
diff --git a/arch/um/Makefile b/arch/um/Makefile
index fc633dbacf84..fab8121d2b32 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -149,6 +149,6 @@ $(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s
149 149
150$(SHARED_HEADERS)/kern_constants.h: 150$(SHARED_HEADERS)/kern_constants.h:
151 $(Q)mkdir -p $(dir $@) 151 $(Q)mkdir -p $(dir $@)
152 $(Q)echo '#include "../../../../include/asm/asm-offsets.h"' >$@ 152 $(Q)echo '#include "../../../../include/generated/asm-offsets.h"' >$@
153 153
154export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH 154export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH
diff --git a/arch/um/include/asm/asm-offsets.h b/arch/um/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/um/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 55298e891571..cbcbfdee3ee0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -49,6 +49,7 @@ config X86
49 select HAVE_KERNEL_GZIP 49 select HAVE_KERNEL_GZIP
50 select HAVE_KERNEL_BZIP2 50 select HAVE_KERNEL_BZIP2
51 select HAVE_KERNEL_LZMA 51 select HAVE_KERNEL_LZMA
52 select HAVE_KERNEL_LZO
52 select HAVE_HW_BREAKPOINT 53 select HAVE_HW_BREAKPOINT
53 select PERF_EVENTS 54 select PERF_EVENTS
54 select ANON_INODES 55 select ANON_INODES
@@ -1246,6 +1247,11 @@ config ARCH_MEMORY_PROBE
1246 def_bool X86_64 1247 def_bool X86_64
1247 depends on MEMORY_HOTPLUG 1248 depends on MEMORY_HOTPLUG
1248 1249
1250config ILLEGAL_POINTER_VALUE
1251 hex
1252 default 0 if X86_32
1253 default 0xdead000000000000 if X86_64
1254
1249source "mm/Kconfig" 1255source "mm/Kconfig"
1250 1256
1251config HIGHPTE 1257config HIGHPTE
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 08e442bc3ab9..f20ddf84a893 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -396,7 +396,7 @@ config X86_TSC
396 396
397config X86_CMPXCHG64 397config X86_CMPXCHG64
398 def_bool y 398 def_bool y
399 depends on !M386 && !M486 399 depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM
400 400
401# this should be set for all -march=.. options where the compiler 401# this should be set for all -march=.. options where the compiler
402# generates cmov. 402# generates cmov.
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index f8ed0658404c..fbb47daf2459 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -4,11 +4,12 @@
4# create a compressed vmlinux image from the original vmlinux 4# create a compressed vmlinux image from the original vmlinux
5# 5#
6 6
7targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o 7targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o piggy.o
8 8
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
11KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 11KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
12cflags-$(CONFIG_X86_32) := -march=i386
12cflags-$(CONFIG_X86_64) := -mcmodel=small 13cflags-$(CONFIG_X86_64) := -mcmodel=small
13KBUILD_CFLAGS += $(cflags-y) 14KBUILD_CFLAGS += $(cflags-y)
14KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 15KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
@@ -48,10 +49,13 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
48 $(call if_changed,bzip2) 49 $(call if_changed,bzip2)
49$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE 50$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
50 $(call if_changed,lzma) 51 $(call if_changed,lzma)
52$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
53 $(call if_changed,lzo)
51 54
52suffix-$(CONFIG_KERNEL_GZIP) := gz 55suffix-$(CONFIG_KERNEL_GZIP) := gz
53suffix-$(CONFIG_KERNEL_BZIP2) := bz2 56suffix-$(CONFIG_KERNEL_BZIP2) := bz2
54suffix-$(CONFIG_KERNEL_LZMA) := lzma 57suffix-$(CONFIG_KERNEL_LZMA) := lzma
58suffix-$(CONFIG_KERNEL_LZO) := lzo
55 59
56quiet_cmd_mkpiggy = MKPIGGY $@ 60quiet_cmd_mkpiggy = MKPIGGY $@
57 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) 61 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 842b2a36174a..3b22fe8ab91b 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -162,6 +162,10 @@ static int lines, cols;
162#include "../../../../lib/decompress_unlzma.c" 162#include "../../../../lib/decompress_unlzma.c"
163#endif 163#endif
164 164
165#ifdef CONFIG_KERNEL_LZO
166#include "../../../../lib/decompress_unlzo.c"
167#endif
168
165static void scroll(void) 169static void scroll(void)
166{ 170{
167 int i; 171 int i;
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index b31cc54b4641..93e689f4bd86 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -16,7 +16,7 @@
16 */ 16 */
17 17
18#include <asm/segment.h> 18#include <asm/segment.h>
19#include <linux/utsrelease.h> 19#include <generated/utsrelease.h>
20#include <asm/boot.h> 20#include <asm/boot.h>
21#include <asm/e820.h> 21#include <asm/e820.h>
22#include <asm/page_types.h> 22#include <asm/page_types.h>
diff --git a/arch/x86/boot/version.c b/arch/x86/boot/version.c
index 2723d9b5ce43..2b15aa488ffb 100644
--- a/arch/x86/boot/version.c
+++ b/arch/x86/boot/version.c
@@ -13,8 +13,8 @@
13 */ 13 */
14 14
15#include "boot.h" 15#include "boot.h"
16#include <linux/utsrelease.h> 16#include <generated/utsrelease.h>
17#include <linux/compile.h> 17#include <generated/compile.h>
18 18
19const char kernel_version[] = 19const char kernel_version[] =
20 UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " 20 UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 60d2b2db0bc5..56f462cf22d2 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -142,6 +142,32 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
142 return max_cstate; 142 return max_cstate;
143} 143}
144 144
145static inline bool arch_has_acpi_pdc(void)
146{
147 struct cpuinfo_x86 *c = &cpu_data(0);
148 return (c->x86_vendor == X86_VENDOR_INTEL ||
149 c->x86_vendor == X86_VENDOR_CENTAUR);
150}
151
152static inline void arch_acpi_set_pdc_bits(u32 *buf)
153{
154 struct cpuinfo_x86 *c = &cpu_data(0);
155
156 buf[2] |= ACPI_PDC_C_CAPABILITY_SMP;
157
158 if (cpu_has(c, X86_FEATURE_EST))
159 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
160
161 if (cpu_has(c, X86_FEATURE_ACPI))
162 buf[2] |= ACPI_PDC_T_FFH;
163
164 /*
165 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
166 */
167 if (!cpu_has(c, X86_FEATURE_MWAIT))
168 buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
169}
170
145#else /* !CONFIG_ACPI */ 171#else /* !CONFIG_ACPI */
146 172
147#define acpi_lapic 0 173#define acpi_lapic 0
diff --git a/arch/x86/include/asm/asm-offsets.h b/arch/x86/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/x86/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 613700f27a4a..637e1ec963c3 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -153,6 +153,7 @@
153#define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */ 153#define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */
154#define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */ 154#define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */
155#define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */ 155#define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */
156#define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */
156 157
157/* 158/*
158 * Auxiliary flags: Linux defined - For features scattered in various 159 * Auxiliary flags: Linux defined - For features scattered in various
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 08c48a81841f..eeac829a0f44 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -103,7 +103,8 @@ extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
103extern void send_cleanup_vector(struct irq_cfg *); 103extern void send_cleanup_vector(struct irq_cfg *);
104 104
105struct irq_desc; 105struct irq_desc;
106extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *); 106extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *,
107 unsigned int *dest_id);
107extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr); 108extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr);
108extern void setup_ioapic_dest(void); 109extern void setup_ioapic_dest(void);
109 110
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
index 950df434763f..f46b79f6c16c 100644
--- a/arch/x86/include/asm/kvm.h
+++ b/arch/x86/include/asm/kvm.h
@@ -254,6 +254,10 @@ struct kvm_reinject_control {
254 __u8 reserved[31]; 254 __u8 reserved[31];
255}; 255};
256 256
257/* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */
258#define KVM_VCPUEVENT_VALID_NMI_PENDING 0x00000001
259#define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
260
257/* for KVM_GET/SET_VCPU_EVENTS */ 261/* for KVM_GET/SET_VCPU_EVENTS */
258struct kvm_vcpu_events { 262struct kvm_vcpu_events {
259 struct { 263 struct {
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 4ffe09b2ad75..1cd58cdbc03f 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -12,6 +12,7 @@
12#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */ 12#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */
13#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */ 13#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */
14#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */ 14#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */
15#define MSR_TSC_AUX 0xc0000103 /* Auxiliary TSC */
15 16
16/* EFER bits: */ 17/* EFER bits: */
17#define _EFER_SCE 0 /* SYSCALL/SYSRET */ 18#define _EFER_SCE 0 /* SYSCALL/SYSRET */
@@ -123,6 +124,7 @@
123#define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2 124#define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2
124#define FAM10H_MMIO_CONF_BASE_MASK 0xfffffff 125#define FAM10H_MMIO_CONF_BASE_MASK 0xfffffff
125#define FAM10H_MMIO_CONF_BASE_SHIFT 20 126#define FAM10H_MMIO_CONF_BASE_SHIFT 20
127#define MSR_FAM10H_NODE_ID 0xc001100c
126 128
127/* K8 MSRs */ 129/* K8 MSRs */
128#define MSR_K8_TOP_MEM1 0xc001001a 130#define MSR_K8_TOP_MEM1 0xc001001a
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 2d228fc9b4b7..c5bc4c2d33f5 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -27,6 +27,18 @@ struct msr {
27 }; 27 };
28}; 28};
29 29
30struct msr_info {
31 u32 msr_no;
32 struct msr reg;
33 struct msr *msrs;
34 int err;
35};
36
37struct msr_regs_info {
38 u32 *regs;
39 int err;
40};
41
30static inline unsigned long long native_read_tscp(unsigned int *aux) 42static inline unsigned long long native_read_tscp(unsigned int *aux)
31{ 43{
32 unsigned long low, high; 44 unsigned long low, high;
@@ -240,9 +252,9 @@ do { \
240#define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \ 252#define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \
241 (u32)((val) >> 32)) 253 (u32)((val) >> 32))
242 254
243#define write_tsc(val1, val2) wrmsr(0x10, (val1), (val2)) 255#define write_tsc(val1, val2) wrmsr(MSR_IA32_TSC, (val1), (val2))
244 256
245#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0) 257#define write_rdtscp_aux(val) wrmsr(MSR_TSC_AUX, (val), 0)
246 258
247struct msr *msrs_alloc(void); 259struct msr *msrs_alloc(void);
248void msrs_free(struct msr *msrs); 260void msrs_free(struct msr *msrs);
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 6f8ec1c37e0a..fc801bab1b3b 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -181,7 +181,7 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
181 unsigned int *ecx, unsigned int *edx) 181 unsigned int *ecx, unsigned int *edx)
182{ 182{
183 /* ecx is often an input as well as an output. */ 183 /* ecx is often an input as well as an output. */
184 asm("cpuid" 184 asm volatile("cpuid"
185 : "=a" (*eax), 185 : "=a" (*eax),
186 "=b" (*ebx), 186 "=b" (*ebx),
187 "=c" (*ecx), 187 "=c" (*ecx),
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index 0c9825e97f36..088d09fb1615 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
@@ -205,14 +205,13 @@ static inline unsigned long __must_check copy_from_user(void *to,
205 unsigned long n) 205 unsigned long n)
206{ 206{
207 int sz = __compiletime_object_size(to); 207 int sz = __compiletime_object_size(to);
208 int ret = -EFAULT;
209 208
210 if (likely(sz == -1 || sz >= n)) 209 if (likely(sz == -1 || sz >= n))
211 ret = _copy_from_user(to, from, n); 210 n = _copy_from_user(to, from, n);
212 else 211 else
213 copy_from_user_overflow(); 212 copy_from_user_overflow();
214 213
215 return ret; 214 return n;
216} 215}
217 216
218long __must_check strncpy_from_user(char *dst, const char __user *src, 217long __must_check strncpy_from_user(char *dst, const char __user *src,
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 46324c6a4f6e..535e421498f6 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -30,16 +30,15 @@ static inline unsigned long __must_check copy_from_user(void *to,
30 unsigned long n) 30 unsigned long n)
31{ 31{
32 int sz = __compiletime_object_size(to); 32 int sz = __compiletime_object_size(to);
33 int ret = -EFAULT;
34 33
35 might_fault(); 34 might_fault();
36 if (likely(sz == -1 || sz >= n)) 35 if (likely(sz == -1 || sz >= n))
37 ret = _copy_from_user(to, from, n); 36 n = _copy_from_user(to, from, n);
38#ifdef CONFIG_DEBUG_VM 37#ifdef CONFIG_DEBUG_VM
39 else 38 else
40 WARN(1, "Buffer overflow detected!\n"); 39 WARN(1, "Buffer overflow detected!\n");
41#endif 40#endif
42 return ret; 41 return n;
43} 42}
44 43
45static __always_inline __must_check 44static __always_inline __must_check
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 811bfabc80b7..bc54fa965af3 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -31,20 +31,20 @@
31 * contiguous (although various IO spaces may punch holes in 31 * contiguous (although various IO spaces may punch holes in
32 * it).. 32 * it)..
33 * 33 *
34 * N - Number of bits in the node portion of a socket physical 34 * N - Number of bits in the node portion of a socket physical
35 * address. 35 * address.
36 * 36 *
37 * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of 37 * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of
38 * routers always have low bit of 1, C/MBricks have low bit 38 * routers always have low bit of 1, C/MBricks have low bit
39 * equal to 0. Most addressing macros that target UV hub chips 39 * equal to 0. Most addressing macros that target UV hub chips
40 * right shift the NASID by 1 to exclude the always-zero bit. 40 * right shift the NASID by 1 to exclude the always-zero bit.
41 * NASIDs contain up to 15 bits. 41 * NASIDs contain up to 15 bits.
42 * 42 *
43 * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead 43 * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead
44 * of nasids. 44 * of nasids.
45 * 45 *
46 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant 46 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
47 * of the nasid for socket usage. 47 * of the nasid for socket usage.
48 * 48 *
49 * 49 *
50 * NumaLink Global Physical Address Format: 50 * NumaLink Global Physical Address Format:
@@ -71,12 +71,12 @@
71 * 71 *
72 * 72 *
73 * APICID format 73 * APICID format
74 * NOTE!!!!!! This is the current format of the APICID. However, code 74 * NOTE!!!!!! This is the current format of the APICID. However, code
75 * should assume that this will change in the future. Use functions 75 * should assume that this will change in the future. Use functions
76 * in this file for all APICID bit manipulations and conversion. 76 * in this file for all APICID bit manipulations and conversion.
77 * 77 *
78 * 1111110000000000 78 * 1111110000000000
79 * 5432109876543210 79 * 5432109876543210
80 * pppppppppplc0cch 80 * pppppppppplc0cch
81 * sssssssssss 81 * sssssssssss
82 * 82 *
@@ -89,9 +89,9 @@
89 * Note: Processor only supports 12 bits in the APICID register. The ACPI 89 * Note: Processor only supports 12 bits in the APICID register. The ACPI
90 * tables hold all 16 bits. Software needs to be aware of this. 90 * tables hold all 16 bits. Software needs to be aware of this.
91 * 91 *
92 * Unless otherwise specified, all references to APICID refer to 92 * Unless otherwise specified, all references to APICID refer to
93 * the FULL value contained in ACPI tables, not the subset in the 93 * the FULL value contained in ACPI tables, not the subset in the
94 * processor APICID register. 94 * processor APICID register.
95 */ 95 */
96 96
97 97
@@ -151,16 +151,16 @@ struct uv_hub_info_s {
151}; 151};
152 152
153DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); 153DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
154#define uv_hub_info (&__get_cpu_var(__uv_hub_info)) 154#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
155#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) 155#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
156 156
157/* 157/*
158 * Local & Global MMR space macros. 158 * Local & Global MMR space macros.
159 * Note: macros are intended to be used ONLY by inline functions 159 * Note: macros are intended to be used ONLY by inline functions
160 * in this file - not by other kernel code. 160 * in this file - not by other kernel code.
161 * n - NASID (full 15-bit global nasid) 161 * n - NASID (full 15-bit global nasid)
162 * g - GNODE (full 15-bit global nasid, right shifted 1) 162 * g - GNODE (full 15-bit global nasid, right shifted 1)
163 * p - PNODE (local part of nsids, right shifted 1) 163 * p - PNODE (local part of nsids, right shifted 1)
164 */ 164 */
165#define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask) 165#define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
166#define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra) 166#define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra)
@@ -215,8 +215,8 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
215/* 215/*
216 * Macros for converting between kernel virtual addresses, socket local physical 216 * Macros for converting between kernel virtual addresses, socket local physical
217 * addresses, and UV global physical addresses. 217 * addresses, and UV global physical addresses.
218 * Note: use the standard __pa() & __va() macros for converting 218 * Note: use the standard __pa() & __va() macros for converting
219 * between socket virtual and socket physical addresses. 219 * between socket virtual and socket physical addresses.
220 */ 220 */
221 221
222/* socket phys RAM --> UV global physical address */ 222/* socket phys RAM --> UV global physical address */
@@ -287,21 +287,18 @@ static inline int uv_apicid_to_pnode(int apicid)
287 * Access global MMRs using the low memory MMR32 space. This region supports 287 * Access global MMRs using the low memory MMR32 space. This region supports
288 * faster MMR access but not all MMRs are accessible in this space. 288 * faster MMR access but not all MMRs are accessible in this space.
289 */ 289 */
290static inline unsigned long *uv_global_mmr32_address(int pnode, 290static inline unsigned long *uv_global_mmr32_address(int pnode, unsigned long offset)
291 unsigned long offset)
292{ 291{
293 return __va(UV_GLOBAL_MMR32_BASE | 292 return __va(UV_GLOBAL_MMR32_BASE |
294 UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset); 293 UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset);
295} 294}
296 295
297static inline void uv_write_global_mmr32(int pnode, unsigned long offset, 296static inline void uv_write_global_mmr32(int pnode, unsigned long offset, unsigned long val)
298 unsigned long val)
299{ 297{
300 writeq(val, uv_global_mmr32_address(pnode, offset)); 298 writeq(val, uv_global_mmr32_address(pnode, offset));
301} 299}
302 300
303static inline unsigned long uv_read_global_mmr32(int pnode, 301static inline unsigned long uv_read_global_mmr32(int pnode, unsigned long offset)
304 unsigned long offset)
305{ 302{
306 return readq(uv_global_mmr32_address(pnode, offset)); 303 return readq(uv_global_mmr32_address(pnode, offset));
307} 304}
@@ -310,21 +307,18 @@ static inline unsigned long uv_read_global_mmr32(int pnode,
310 * Access Global MMR space using the MMR space located at the top of physical 307 * Access Global MMR space using the MMR space located at the top of physical
311 * memory. 308 * memory.
312 */ 309 */
313static inline unsigned long *uv_global_mmr64_address(int pnode, 310static inline unsigned long *uv_global_mmr64_address(int pnode, unsigned long offset)
314 unsigned long offset)
315{ 311{
316 return __va(UV_GLOBAL_MMR64_BASE | 312 return __va(UV_GLOBAL_MMR64_BASE |
317 UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset); 313 UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset);
318} 314}
319 315
320static inline void uv_write_global_mmr64(int pnode, unsigned long offset, 316static inline void uv_write_global_mmr64(int pnode, unsigned long offset, unsigned long val)
321 unsigned long val)
322{ 317{
323 writeq(val, uv_global_mmr64_address(pnode, offset)); 318 writeq(val, uv_global_mmr64_address(pnode, offset));
324} 319}
325 320
326static inline unsigned long uv_read_global_mmr64(int pnode, 321static inline unsigned long uv_read_global_mmr64(int pnode, unsigned long offset)
327 unsigned long offset)
328{ 322{
329 return readq(uv_global_mmr64_address(pnode, offset)); 323 return readq(uv_global_mmr64_address(pnode, offset));
330} 324}
@@ -338,6 +332,16 @@ static inline unsigned long uv_global_gru_mmr_address(int pnode, unsigned long o
338 return UV_GLOBAL_GRU_MMR_BASE | offset | (pnode << uv_hub_info->m_val); 332 return UV_GLOBAL_GRU_MMR_BASE | offset | (pnode << uv_hub_info->m_val);
339} 333}
340 334
335static inline void uv_write_global_mmr8(int pnode, unsigned long offset, unsigned char val)
336{
337 writeb(val, uv_global_mmr64_address(pnode, offset));
338}
339
340static inline unsigned char uv_read_global_mmr8(int pnode, unsigned long offset)
341{
342 return readb(uv_global_mmr64_address(pnode, offset));
343}
344
341/* 345/*
342 * Access hub local MMRs. Faster than using global space but only local MMRs 346 * Access hub local MMRs. Faster than using global space but only local MMRs
343 * are accessible. 347 * are accessible.
@@ -457,11 +461,17 @@ static inline void uv_set_scir_bits(unsigned char value)
457 } 461 }
458} 462}
459 463
464static inline unsigned long uv_scir_offset(int apicid)
465{
466 return SCIR_LOCAL_MMR_BASE | (apicid & 0x3f);
467}
468
460static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value) 469static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
461{ 470{
462 if (uv_cpu_hub_info(cpu)->scir.state != value) { 471 if (uv_cpu_hub_info(cpu)->scir.state != value) {
472 uv_write_global_mmr8(uv_cpu_to_pnode(cpu),
473 uv_cpu_hub_info(cpu)->scir.offset, value);
463 uv_cpu_hub_info(cpu)->scir.state = value; 474 uv_cpu_hub_info(cpu)->scir.state = value;
464 uv_write_local_mmr8(uv_cpu_hub_info(cpu)->scir.offset, value);
465 } 475 }
466} 476}
467 477
diff --git a/arch/x86/kernel/acpi/Makefile b/arch/x86/kernel/acpi/Makefile
index fd5ca97a2ad5..6f35260bb3ef 100644
--- a/arch/x86/kernel/acpi/Makefile
+++ b/arch/x86/kernel/acpi/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_ACPI) += boot.o
4obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o 4obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_rm.o wakeup_$(BITS).o
5 5
6ifneq ($(CONFIG_ACPI_PROCESSOR),) 6ifneq ($(CONFIG_ACPI_PROCESSOR),)
7obj-y += cstate.o processor.o 7obj-y += cstate.o
8endif 8endif
9 9
10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin 10$(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
deleted file mode 100644
index d85d1b2432ba..000000000000
--- a/arch/x86/kernel/acpi/processor.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Copyright (C) 2005 Intel Corporation
3 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
4 * - Added _PDC for platforms with Intel CPUs
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/init.h>
10#include <linux/acpi.h>
11
12#include <acpi/processor.h>
13#include <asm/acpi.h>
14
15static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
16{
17 struct acpi_object_list *obj_list;
18 union acpi_object *obj;
19 u32 *buf;
20
21 /* allocate and initialize pdc. It will be used later. */
22 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
23 if (!obj_list) {
24 printk(KERN_ERR "Memory allocation error\n");
25 return;
26 }
27
28 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
29 if (!obj) {
30 printk(KERN_ERR "Memory allocation error\n");
31 kfree(obj_list);
32 return;
33 }
34
35 buf = kmalloc(12, GFP_KERNEL);
36 if (!buf) {
37 printk(KERN_ERR "Memory allocation error\n");
38 kfree(obj);
39 kfree(obj_list);
40 return;
41 }
42
43 buf[0] = ACPI_PDC_REVISION_ID;
44 buf[1] = 1;
45 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
46
47 /*
48 * The default of PDC_SMP_T_SWCOORD bit is set for intel x86 cpu so
49 * that OSPM is capable of native ACPI throttling software
50 * coordination using BIOS supplied _TSD info.
51 */
52 buf[2] |= ACPI_PDC_SMP_T_SWCOORD;
53 if (cpu_has(c, X86_FEATURE_EST))
54 buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
55
56 if (cpu_has(c, X86_FEATURE_ACPI))
57 buf[2] |= ACPI_PDC_T_FFH;
58
59 /*
60 * If mwait/monitor is unsupported, C2/C3_FFH will be disabled
61 */
62 if (!cpu_has(c, X86_FEATURE_MWAIT))
63 buf[2] &= ~(ACPI_PDC_C_C2C3_FFH);
64
65 obj->type = ACPI_TYPE_BUFFER;
66 obj->buffer.length = 12;
67 obj->buffer.pointer = (u8 *) buf;
68 obj_list->count = 1;
69 obj_list->pointer = obj;
70 pr->pdc = obj_list;
71
72 return;
73}
74
75
76/* Initialize _PDC data based on the CPU vendor */
77void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
78{
79 struct cpuinfo_x86 *c = &cpu_data(pr->id);
80
81 pr->pdc = NULL;
82 if (c->x86_vendor == X86_VENDOR_INTEL ||
83 c->x86_vendor == X86_VENDOR_CENTAUR)
84 init_intel_pdc(pr, c);
85
86 return;
87}
88
89EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
90
91void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
92{
93 if (pr->pdc) {
94 kfree(pr->pdc->pointer->buffer.pointer);
95 kfree(pr->pdc->pointer);
96 kfree(pr->pdc);
97 pr->pdc = NULL;
98 }
99}
100
101EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 82e508677b91..f9961034e557 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -162,6 +162,8 @@ static int __init acpi_sleep_setup(char *str)
162#endif 162#endif
163 if (strncmp(str, "old_ordering", 12) == 0) 163 if (strncmp(str, "old_ordering", 12) == 0)
164 acpi_old_suspend_ordering(); 164 acpi_old_suspend_ordering();
165 if (strncmp(str, "sci_force_enable", 16) == 0)
166 acpi_set_sci_en_on_resume();
165 str = strchr(str, ','); 167 str = strchr(str, ',');
166 if (str != NULL) 168 if (str != NULL)
167 str += strspn(str, ", \t"); 169 str += strspn(str, ", \t");
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 1dca9c34eaeb..fb490ce7dd55 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -138,6 +138,11 @@ int amd_iommus_present;
138bool amd_iommu_np_cache __read_mostly; 138bool amd_iommu_np_cache __read_mostly;
139 139
140/* 140/*
141 * Set to true if ACPI table parsing and hardware intialization went properly
142 */
143static bool amd_iommu_initialized;
144
145/*
141 * List of protection domains - used during resume 146 * List of protection domains - used during resume
142 */ 147 */
143LIST_HEAD(amd_iommu_pd_list); 148LIST_HEAD(amd_iommu_pd_list);
@@ -929,6 +934,8 @@ static int __init init_iommu_all(struct acpi_table_header *table)
929 } 934 }
930 WARN_ON(p != end); 935 WARN_ON(p != end);
931 936
937 amd_iommu_initialized = true;
938
932 return 0; 939 return 0;
933} 940}
934 941
@@ -1263,6 +1270,9 @@ static int __init amd_iommu_init(void)
1263 if (acpi_table_parse("IVRS", init_iommu_all) != 0) 1270 if (acpi_table_parse("IVRS", init_iommu_all) != 0)
1264 goto free; 1271 goto free;
1265 1272
1273 if (!amd_iommu_initialized)
1274 goto free;
1275
1266 if (acpi_table_parse("IVRS", init_memory_definitions) != 0) 1276 if (acpi_table_parse("IVRS", init_memory_definitions) != 0)
1267 goto free; 1277 goto free;
1268 1278
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index aa57c079c98f..e80f291472a4 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -62,7 +62,7 @@ unsigned int boot_cpu_physical_apicid = -1U;
62/* 62/*
63 * The highest APIC ID seen during enumeration. 63 * The highest APIC ID seen during enumeration.
64 * 64 *
65 * On AMD, this determines the messaging protocol we can use: if all APIC IDs 65 * This determines the messaging protocol we can use: if all APIC IDs
66 * are in the 0 ... 7 range, then we can use logical addressing which 66 * are in the 0 ... 7 range, then we can use logical addressing which
67 * has some performance advantages (better broadcasting). 67 * has some performance advantages (better broadcasting).
68 * 68 *
@@ -1898,14 +1898,24 @@ void __cpuinit generic_processor_info(int apicid, int version)
1898 max_physical_apicid = apicid; 1898 max_physical_apicid = apicid;
1899 1899
1900#ifdef CONFIG_X86_32 1900#ifdef CONFIG_X86_32
1901 switch (boot_cpu_data.x86_vendor) { 1901 /*
1902 case X86_VENDOR_INTEL: 1902 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
1903 if (num_processors > 8) 1903 * but we need to work other dependencies like SMP_SUSPEND etc
1904 def_to_bigsmp = 1; 1904 * before this can be done without some confusion.
1905 break; 1905 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
1906 case X86_VENDOR_AMD: 1906 * - Ashok Raj <ashok.raj@intel.com>
1907 if (max_physical_apicid >= 8) 1907 */
1908 if (max_physical_apicid >= 8) {
1909 switch (boot_cpu_data.x86_vendor) {
1910 case X86_VENDOR_INTEL:
1911 if (!APIC_XAPIC(version)) {
1912 def_to_bigsmp = 0;
1913 break;
1914 }
1915 /* If P4 and above fall through */
1916 case X86_VENDOR_AMD:
1908 def_to_bigsmp = 1; 1917 def_to_bigsmp = 1;
1918 }
1909 } 1919 }
1910#endif 1920#endif
1911 1921
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index d0c99abc26c3..eacbd2b31d27 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -306,10 +306,7 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
306 if (cpumask_test_cpu(cpu, cpu_online_mask)) 306 if (cpumask_test_cpu(cpu, cpu_online_mask))
307 break; 307 break;
308 } 308 }
309 if (cpu < nr_cpu_ids) 309 return per_cpu(x86_cpu_to_apicid, cpu);
310 return per_cpu(x86_cpu_to_apicid, cpu);
311
312 return BAD_APICID;
313} 310}
314 311
315struct apic apic_physflat = { 312struct apic apic_physflat = {
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index 38dcecfa5818..cb804c5091b9 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -131,10 +131,7 @@ static unsigned int bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
131 if (cpumask_test_cpu(cpu, cpu_online_mask)) 131 if (cpumask_test_cpu(cpu, cpu_online_mask))
132 break; 132 break;
133 } 133 }
134 if (cpu < nr_cpu_ids) 134 return bigsmp_cpu_to_logical_apicid(cpu);
135 return bigsmp_cpu_to_logical_apicid(cpu);
136
137 return BAD_APICID;
138} 135}
139 136
140static int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb) 137static int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 11a5851f1f50..53243ca7816d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2276,26 +2276,28 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
2276 2276
2277/* 2277/*
2278 * Either sets desc->affinity to a valid value, and returns 2278 * Either sets desc->affinity to a valid value, and returns
2279 * ->cpu_mask_to_apicid of that, or returns BAD_APICID and 2279 * ->cpu_mask_to_apicid of that in dest_id, or returns -1 and
2280 * leaves desc->affinity untouched. 2280 * leaves desc->affinity untouched.
2281 */ 2281 */
2282unsigned int 2282unsigned int
2283set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask) 2283set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask,
2284 unsigned int *dest_id)
2284{ 2285{
2285 struct irq_cfg *cfg; 2286 struct irq_cfg *cfg;
2286 unsigned int irq; 2287 unsigned int irq;
2287 2288
2288 if (!cpumask_intersects(mask, cpu_online_mask)) 2289 if (!cpumask_intersects(mask, cpu_online_mask))
2289 return BAD_APICID; 2290 return -1;
2290 2291
2291 irq = desc->irq; 2292 irq = desc->irq;
2292 cfg = desc->chip_data; 2293 cfg = desc->chip_data;
2293 if (assign_irq_vector(irq, cfg, mask)) 2294 if (assign_irq_vector(irq, cfg, mask))
2294 return BAD_APICID; 2295 return -1;
2295 2296
2296 cpumask_copy(desc->affinity, mask); 2297 cpumask_copy(desc->affinity, mask);
2297 2298
2298 return apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain); 2299 *dest_id = apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain);
2300 return 0;
2299} 2301}
2300 2302
2301static int 2303static int
@@ -2311,12 +2313,11 @@ set_ioapic_affinity_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
2311 cfg = desc->chip_data; 2313 cfg = desc->chip_data;
2312 2314
2313 spin_lock_irqsave(&ioapic_lock, flags); 2315 spin_lock_irqsave(&ioapic_lock, flags);
2314 dest = set_desc_affinity(desc, mask); 2316 ret = set_desc_affinity(desc, mask, &dest);
2315 if (dest != BAD_APICID) { 2317 if (!ret) {
2316 /* Only the high 8 bits are valid. */ 2318 /* Only the high 8 bits are valid. */
2317 dest = SET_APIC_LOGICAL_ID(dest); 2319 dest = SET_APIC_LOGICAL_ID(dest);
2318 __target_IO_APIC_irq(irq, dest, cfg); 2320 __target_IO_APIC_irq(irq, dest, cfg);
2319 ret = 0;
2320 } 2321 }
2321 spin_unlock_irqrestore(&ioapic_lock, flags); 2322 spin_unlock_irqrestore(&ioapic_lock, flags);
2322 2323
@@ -2433,6 +2434,13 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void)
2433 cfg = irq_cfg(irq); 2434 cfg = irq_cfg(irq);
2434 raw_spin_lock(&desc->lock); 2435 raw_spin_lock(&desc->lock);
2435 2436
2437 /*
2438 * Check if the irq migration is in progress. If so, we
2439 * haven't received the cleanup request yet for this irq.
2440 */
2441 if (cfg->move_in_progress)
2442 goto unlock;
2443
2436 if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) 2444 if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain))
2437 goto unlock; 2445 goto unlock;
2438 2446
@@ -3351,8 +3359,7 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
3351 struct msi_msg msg; 3359 struct msi_msg msg;
3352 unsigned int dest; 3360 unsigned int dest;
3353 3361
3354 dest = set_desc_affinity(desc, mask); 3362 if (set_desc_affinity(desc, mask, &dest))
3355 if (dest == BAD_APICID)
3356 return -1; 3363 return -1;
3357 3364
3358 cfg = desc->chip_data; 3365 cfg = desc->chip_data;
@@ -3384,8 +3391,7 @@ ir_set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
3384 if (get_irte(irq, &irte)) 3391 if (get_irte(irq, &irte))
3385 return -1; 3392 return -1;
3386 3393
3387 dest = set_desc_affinity(desc, mask); 3394 if (set_desc_affinity(desc, mask, &dest))
3388 if (dest == BAD_APICID)
3389 return -1; 3395 return -1;
3390 3396
3391 irte.vector = cfg->vector; 3397 irte.vector = cfg->vector;
@@ -3567,8 +3573,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
3567 struct msi_msg msg; 3573 struct msi_msg msg;
3568 unsigned int dest; 3574 unsigned int dest;
3569 3575
3570 dest = set_desc_affinity(desc, mask); 3576 if (set_desc_affinity(desc, mask, &dest))
3571 if (dest == BAD_APICID)
3572 return -1; 3577 return -1;
3573 3578
3574 cfg = desc->chip_data; 3579 cfg = desc->chip_data;
@@ -3623,8 +3628,7 @@ static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
3623 struct msi_msg msg; 3628 struct msi_msg msg;
3624 unsigned int dest; 3629 unsigned int dest;
3625 3630
3626 dest = set_desc_affinity(desc, mask); 3631 if (set_desc_affinity(desc, mask, &dest))
3627 if (dest == BAD_APICID)
3628 return -1; 3632 return -1;
3629 3633
3630 cfg = desc->chip_data; 3634 cfg = desc->chip_data;
@@ -3730,8 +3734,7 @@ static int set_ht_irq_affinity(unsigned int irq, const struct cpumask *mask)
3730 struct irq_cfg *cfg; 3734 struct irq_cfg *cfg;
3731 unsigned int dest; 3735 unsigned int dest;
3732 3736
3733 dest = set_desc_affinity(desc, mask); 3737 if (set_desc_affinity(desc, mask, &dest))
3734 if (dest == BAD_APICID)
3735 return -1; 3738 return -1;
3736 3739
3737 cfg = desc->chip_data; 3740 cfg = desc->chip_data;
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index c4cbd3080c1c..65edc180fc82 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -64,23 +64,16 @@ void __init default_setup_apic_routing(void)
64 apic = &apic_x2apic_phys; 64 apic = &apic_x2apic_phys;
65 else 65 else
66 apic = &apic_x2apic_cluster; 66 apic = &apic_x2apic_cluster;
67 printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
67 } 68 }
68#endif 69#endif
69 70
70 if (apic == &apic_flat) { 71 if (apic == &apic_flat) {
71 switch (boot_cpu_data.x86_vendor) { 72 if (max_physical_apicid >= 8)
72 case X86_VENDOR_INTEL: 73 apic = &apic_physflat;
73 if (num_processors > 8) 74 printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
74 apic = &apic_physflat;
75 break;
76 case X86_VENDOR_AMD:
77 if (max_physical_apicid >= 8)
78 apic = &apic_physflat;
79 }
80 } 75 }
81 76
82 printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
83
84 if (is_vsmp_box()) { 77 if (is_vsmp_box()) {
85 /* need to update phys_pkg_id */ 78 /* need to update phys_pkg_id */
86 apic->phys_pkg_id = apicid_phys_pkg_id; 79 apic->phys_pkg_id = apicid_phys_pkg_id;
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index a5371ec36776..cf69c59f4910 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -148,10 +148,7 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
148 break; 148 break;
149 } 149 }
150 150
151 if (cpu < nr_cpu_ids) 151 return per_cpu(x86_cpu_to_logical_apicid, cpu);
152 return per_cpu(x86_cpu_to_logical_apicid, cpu);
153
154 return BAD_APICID;
155} 152}
156 153
157static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x) 154static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x)
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index a8989aadc99a..8972f38c5ced 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -146,10 +146,7 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
146 break; 146 break;
147 } 147 }
148 148
149 if (cpu < nr_cpu_ids) 149 return per_cpu(x86_cpu_to_apicid, cpu);
150 return per_cpu(x86_cpu_to_apicid, cpu);
151
152 return BAD_APICID;
153} 150}
154 151
155static unsigned int x2apic_phys_get_apic_id(unsigned long x) 152static unsigned int x2apic_phys_get_apic_id(unsigned long x)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index b684bb303cbf..5f92494dab61 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -225,10 +225,7 @@ uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
225 if (cpumask_test_cpu(cpu, cpu_online_mask)) 225 if (cpumask_test_cpu(cpu, cpu_online_mask))
226 break; 226 break;
227 } 227 }
228 if (cpu < nr_cpu_ids) 228 return per_cpu(x86_cpu_to_apicid, cpu);
229 return per_cpu(x86_cpu_to_apicid, cpu);
230
231 return BAD_APICID;
232} 229}
233 230
234static unsigned int x2apic_get_apic_id(unsigned long x) 231static unsigned int x2apic_get_apic_id(unsigned long x)
@@ -632,8 +629,10 @@ void __init uv_system_init(void)
632 uv_rtc_init(); 629 uv_rtc_init();
633 630
634 for_each_present_cpu(cpu) { 631 for_each_present_cpu(cpu) {
632 int apicid = per_cpu(x86_cpu_to_apicid, cpu);
633
635 nid = cpu_to_node(cpu); 634 nid = cpu_to_node(cpu);
636 pnode = uv_apicid_to_pnode(per_cpu(x86_cpu_to_apicid, cpu)); 635 pnode = uv_apicid_to_pnode(apicid);
637 blade = boot_pnode_to_blade(pnode); 636 blade = boot_pnode_to_blade(pnode);
638 lcpu = uv_blade_info[blade].nr_possible_cpus; 637 lcpu = uv_blade_info[blade].nr_possible_cpus;
639 uv_blade_info[blade].nr_possible_cpus++; 638 uv_blade_info[blade].nr_possible_cpus++;
@@ -654,15 +653,13 @@ void __init uv_system_init(void)
654 uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra; 653 uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
655 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base; 654 uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
656 uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id; 655 uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id;
657 uv_cpu_hub_info(cpu)->scir.offset = SCIR_LOCAL_MMR_BASE + lcpu; 656 uv_cpu_hub_info(cpu)->scir.offset = uv_scir_offset(apicid);
658 uv_node_to_blade[nid] = blade; 657 uv_node_to_blade[nid] = blade;
659 uv_cpu_to_blade[cpu] = blade; 658 uv_cpu_to_blade[cpu] = blade;
660 max_pnode = max(pnode, max_pnode); 659 max_pnode = max(pnode, max_pnode);
661 660
662 printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, " 661 printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, lcpu %d, blade %d\n",
663 "lcpu %d, blade %d\n", 662 cpu, apicid, pnode, nid, lcpu, blade);
664 cpu, per_cpu(x86_cpu_to_apicid, cpu), pnode, nid,
665 lcpu, blade);
666 } 663 }
667 664
668 /* Add blade/pnode info for nodes without cpus */ 665 /* Add blade/pnode info for nodes without cpus */
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 8dc3ea145c97..e485825130d2 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -254,59 +254,36 @@ static int __cpuinit nearby_node(int apicid)
254 254
255/* 255/*
256 * Fixup core topology information for AMD multi-node processors. 256 * Fixup core topology information for AMD multi-node processors.
257 * Assumption 1: Number of cores in each internal node is the same. 257 * Assumption: Number of cores in each internal node is the same.
258 * Assumption 2: Mixed systems with both single-node and dual-node
259 * processors are not supported.
260 */ 258 */
261#ifdef CONFIG_X86_HT 259#ifdef CONFIG_X86_HT
262static void __cpuinit amd_fixup_dcm(struct cpuinfo_x86 *c) 260static void __cpuinit amd_fixup_dcm(struct cpuinfo_x86 *c)
263{ 261{
264#ifdef CONFIG_PCI 262 unsigned long long value;
265 u32 t, cpn; 263 u32 nodes, cores_per_node;
266 u8 n, n_id;
267 int cpu = smp_processor_id(); 264 int cpu = smp_processor_id();
268 265
266 if (!cpu_has(c, X86_FEATURE_NODEID_MSR))
267 return;
268
269 /* fixup topology information only once for a core */ 269 /* fixup topology information only once for a core */
270 if (cpu_has(c, X86_FEATURE_AMD_DCM)) 270 if (cpu_has(c, X86_FEATURE_AMD_DCM))
271 return; 271 return;
272 272
273 /* check for multi-node processor on boot cpu */ 273 rdmsrl(MSR_FAM10H_NODE_ID, value);
274 t = read_pci_config(0, 24, 3, 0xe8); 274
275 if (!(t & (1 << 29))) 275 nodes = ((value >> 3) & 7) + 1;
276 if (nodes == 1)
276 return; 277 return;
277 278
278 set_cpu_cap(c, X86_FEATURE_AMD_DCM); 279 set_cpu_cap(c, X86_FEATURE_AMD_DCM);
280 cores_per_node = c->x86_max_cores / nodes;
279 281
280 /* cores per node: each internal node has half the number of cores */ 282 /* store NodeID, use llc_shared_map to store sibling info */
281 cpn = c->x86_max_cores >> 1; 283 per_cpu(cpu_llc_id, cpu) = value & 7;
282 284
283 /* even-numbered NB_id of this dual-node processor */ 285 /* fixup core id to be in range from 0 to (cores_per_node - 1) */
284 n = c->phys_proc_id << 1; 286 c->cpu_core_id = c->cpu_core_id % cores_per_node;
285
286 /*
287 * determine internal node id and assign cores fifty-fifty to
288 * each node of the dual-node processor
289 */
290 t = read_pci_config(0, 24 + n, 3, 0xe8);
291 n = (t>>30) & 0x3;
292 if (n == 0) {
293 if (c->cpu_core_id < cpn)
294 n_id = 0;
295 else
296 n_id = 1;
297 } else {
298 if (c->cpu_core_id < cpn)
299 n_id = 1;
300 else
301 n_id = 0;
302 }
303
304 /* compute entire NodeID, use llc_shared_map to store sibling info */
305 per_cpu(cpu_llc_id, cpu) = (c->phys_proc_id << 1) + n_id;
306
307 /* fixup core id to be in range from 0 to cpn */
308 c->cpu_core_id = c->cpu_core_id % cpn;
309#endif
310} 287}
311#endif 288#endif
312 289
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index f28decf8dde3..1b1920fa7c80 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -190,9 +190,11 @@ static void do_drv_write(void *_cmd)
190 190
191static void drv_read(struct drv_cmd *cmd) 191static void drv_read(struct drv_cmd *cmd)
192{ 192{
193 int err;
193 cmd->val = 0; 194 cmd->val = 0;
194 195
195 smp_call_function_single(cpumask_any(cmd->mask), do_drv_read, cmd, 1); 196 err = smp_call_function_any(cmd->mask, do_drv_read, cmd, 1);
197 WARN_ON_ONCE(err); /* smp_call_function_any() was buggy? */
196} 198}
197 199
198static void drv_write(struct drv_cmd *cmd) 200static void drv_write(struct drv_cmd *cmd)
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index a9df9441a9a2..f125e5c551c0 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1136,7 +1136,7 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1136 if (!alloc_cpumask_var(&oldmask, GFP_KERNEL)) 1136 if (!alloc_cpumask_var(&oldmask, GFP_KERNEL))
1137 return -ENOMEM; 1137 return -ENOMEM;
1138 1138
1139 cpumask_copy(oldmask, tsk_cpumask(current)); 1139 cpumask_copy(oldmask, tsk_cpus_allowed(current));
1140 set_cpus_allowed_ptr(current, cpumask_of(pol->cpu)); 1140 set_cpus_allowed_ptr(current, cpumask_of(pol->cpu));
1141 1141
1142 if (smp_processor_id() != pol->cpu) { 1142 if (smp_processor_id() != pol->cpu) {
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9c31e8b09d2c..879666f4d871 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -70,7 +70,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
70 if (c->x86_power & (1 << 8)) { 70 if (c->x86_power & (1 << 8)) {
71 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); 71 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
72 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); 72 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
73 set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
74 sched_clock_stable = 1; 73 sched_clock_stable = 1;
75 } 74 }
76 75
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index c223b7e895d9..d616c06e99b4 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -2347,7 +2347,7 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
2347 callchain_store(entry, PERF_CONTEXT_KERNEL); 2347 callchain_store(entry, PERF_CONTEXT_KERNEL);
2348 callchain_store(entry, regs->ip); 2348 callchain_store(entry, regs->ip);
2349 2349
2350 dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry); 2350 dump_trace(NULL, regs, NULL, regs->bp, &backtrace_ops, entry);
2351} 2351}
2352 2352
2353/* 2353/*
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 7ef24a796992..cb27fd6136c9 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -187,7 +187,8 @@ static int __init cpuid_init(void)
187 int i, err = 0; 187 int i, err = 0;
188 i = 0; 188 i = 0;
189 189
190 if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) { 190 if (__register_chrdev(CPUID_MAJOR, 0, NR_CPUS,
191 "cpu/cpuid", &cpuid_fops)) {
191 printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n", 192 printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n",
192 CPUID_MAJOR); 193 CPUID_MAJOR);
193 err = -EBUSY; 194 err = -EBUSY;
@@ -216,7 +217,7 @@ out_class:
216 } 217 }
217 class_destroy(cpuid_class); 218 class_destroy(cpuid_class);
218out_chrdev: 219out_chrdev:
219 unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); 220 __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
220out: 221out:
221 return err; 222 return err;
222} 223}
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index c56bc2873030..6d817554780a 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -123,13 +123,15 @@ print_context_stack_bp(struct thread_info *tinfo,
123 while (valid_stack_ptr(tinfo, ret_addr, sizeof(*ret_addr), end)) { 123 while (valid_stack_ptr(tinfo, ret_addr, sizeof(*ret_addr), end)) {
124 unsigned long addr = *ret_addr; 124 unsigned long addr = *ret_addr;
125 125
126 if (__kernel_text_address(addr)) { 126 if (!__kernel_text_address(addr))
127 ops->address(data, addr, 1); 127 break;
128 frame = frame->next_frame; 128
129 ret_addr = &frame->return_address; 129 ops->address(data, addr, 1);
130 print_ftrace_graph_addr(addr, data, ops, tinfo, graph); 130 frame = frame->next_frame;
131 } 131 ret_addr = &frame->return_address;
132 print_ftrace_graph_addr(addr, data, ops, tinfo, graph);
132 } 133 }
134
133 return (unsigned long)frame; 135 return (unsigned long)frame;
134} 136}
135EXPORT_SYMBOL_GPL(print_context_stack_bp); 137EXPORT_SYMBOL_GPL(print_context_stack_bp);
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index f50447d961c0..a1a7876cadcb 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -724,7 +724,7 @@ core_initcall(e820_mark_nvs_memory);
724/* 724/*
725 * Early reserved memory areas. 725 * Early reserved memory areas.
726 */ 726 */
727#define MAX_EARLY_RES 20 727#define MAX_EARLY_RES 32
728 728
729struct early_res { 729struct early_res {
730 u64 start, end; 730 u64 start, end;
@@ -733,13 +733,13 @@ struct early_res {
733}; 733};
734static struct early_res early_res[MAX_EARLY_RES] __initdata = { 734static struct early_res early_res[MAX_EARLY_RES] __initdata = {
735 { 0, PAGE_SIZE, "BIOS data page", 1 }, /* BIOS data page */ 735 { 0, PAGE_SIZE, "BIOS data page", 1 }, /* BIOS data page */
736#ifdef CONFIG_X86_32 736#if defined(CONFIG_X86_32) && defined(CONFIG_X86_TRAMPOLINE)
737 /* 737 /*
738 * But first pinch a few for the stack/trampoline stuff 738 * But first pinch a few for the stack/trampoline stuff
739 * FIXME: Don't need the extra page at 4K, but need to fix 739 * FIXME: Don't need the extra page at 4K, but need to fix
740 * trampoline before removing it. (see the GDT stuff) 740 * trampoline before removing it. (see the GDT stuff)
741 */ 741 */
742 { PAGE_SIZE, PAGE_SIZE, "EX TRAMPOLINE", 1 }, 742 { PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE", 1 },
743#endif 743#endif
744 744
745 {} 745 {}
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 844c02c65fcb..0c8632433090 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -394,7 +394,7 @@ static enum ucode_state microcode_update_cpu(int cpu)
394 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 394 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
395 enum ucode_state ustate; 395 enum ucode_state ustate;
396 396
397 if (uci->valid && uci->mc) 397 if (uci->valid)
398 ustate = microcode_resume_cpu(cpu); 398 ustate = microcode_resume_cpu(cpu);
399 else 399 else
400 ustate = microcode_init_cpu(cpu); 400 ustate = microcode_init_cpu(cpu);
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 572b07eee3f4..4bd93c9b2b27 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -246,7 +246,7 @@ static int __init msr_init(void)
246 int i, err = 0; 246 int i, err = 0;
247 i = 0; 247 i = 0;
248 248
249 if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) { 249 if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) {
250 printk(KERN_ERR "msr: unable to get major %d for msr\n", 250 printk(KERN_ERR "msr: unable to get major %d for msr\n",
251 MSR_MAJOR); 251 MSR_MAJOR);
252 err = -EBUSY; 252 err = -EBUSY;
@@ -274,7 +274,7 @@ out_class:
274 msr_device_destroy(i); 274 msr_device_destroy(i);
275 class_destroy(msr_class); 275 class_destroy(msr_class);
276out_chrdev: 276out_chrdev:
277 unregister_chrdev(MSR_MAJOR, "cpu/msr"); 277 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
278out: 278out:
279 return err; 279 return err;
280} 280}
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 98c2cdeb599e..c6ee241c8a98 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -103,8 +103,8 @@ void show_regs_common(void)
103 if (!product) 103 if (!product)
104 product = ""; 104 product = "";
105 105
106 printk("\n"); 106 printk(KERN_CONT "\n");
107 printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n", 107 printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n",
108 current->pid, current->comm, print_tainted(), 108 current->pid, current->comm, print_tainted(),
109 init_utsname()->release, 109 init_utsname()->release,
110 (int)strcspn(init_utsname()->version, " "), 110 (int)strcspn(init_utsname()->version, " "),
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 9c517b5858f0..37ad1e046aae 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -139,16 +139,16 @@ void __show_regs(struct pt_regs *regs, int all)
139 139
140 show_regs_common(); 140 show_regs_common();
141 141
142 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", 142 printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
143 (u16)regs->cs, regs->ip, regs->flags, 143 (u16)regs->cs, regs->ip, regs->flags,
144 smp_processor_id()); 144 smp_processor_id());
145 print_symbol("EIP is at %s\n", regs->ip); 145 print_symbol("EIP is at %s\n", regs->ip);
146 146
147 printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", 147 printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
148 regs->ax, regs->bx, regs->cx, regs->dx); 148 regs->ax, regs->bx, regs->cx, regs->dx);
149 printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", 149 printk(KERN_DEFAULT "ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
150 regs->si, regs->di, regs->bp, sp); 150 regs->si, regs->di, regs->bp, sp);
151 printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", 151 printk(KERN_DEFAULT " DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
152 (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss); 152 (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss);
153 153
154 if (!all) 154 if (!all)
@@ -158,19 +158,19 @@ void __show_regs(struct pt_regs *regs, int all)
158 cr2 = read_cr2(); 158 cr2 = read_cr2();
159 cr3 = read_cr3(); 159 cr3 = read_cr3();
160 cr4 = read_cr4_safe(); 160 cr4 = read_cr4_safe();
161 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", 161 printk(KERN_DEFAULT "CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
162 cr0, cr2, cr3, cr4); 162 cr0, cr2, cr3, cr4);
163 163
164 get_debugreg(d0, 0); 164 get_debugreg(d0, 0);
165 get_debugreg(d1, 1); 165 get_debugreg(d1, 1);
166 get_debugreg(d2, 2); 166 get_debugreg(d2, 2);
167 get_debugreg(d3, 3); 167 get_debugreg(d3, 3);
168 printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", 168 printk(KERN_DEFAULT "DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
169 d0, d1, d2, d3); 169 d0, d1, d2, d3);
170 170
171 get_debugreg(d6, 6); 171 get_debugreg(d6, 6);
172 get_debugreg(d7, 7); 172 get_debugreg(d7, 7);
173 printk("DR6: %08lx DR7: %08lx\n", 173 printk(KERN_DEFAULT "DR6: %08lx DR7: %08lx\n",
174 d6, d7); 174 d6, d7);
175} 175}
176 176
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 52fbd0c60198..f9e033150cdf 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -161,19 +161,19 @@ void __show_regs(struct pt_regs *regs, int all)
161 unsigned int ds, cs, es; 161 unsigned int ds, cs, es;
162 162
163 show_regs_common(); 163 show_regs_common();
164 printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); 164 printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
165 printk_address(regs->ip, 1); 165 printk_address(regs->ip, 1);
166 printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, 166 printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
167 regs->sp, regs->flags); 167 regs->sp, regs->flags);
168 printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n", 168 printk(KERN_DEFAULT "RAX: %016lx RBX: %016lx RCX: %016lx\n",
169 regs->ax, regs->bx, regs->cx); 169 regs->ax, regs->bx, regs->cx);
170 printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n", 170 printk(KERN_DEFAULT "RDX: %016lx RSI: %016lx RDI: %016lx\n",
171 regs->dx, regs->si, regs->di); 171 regs->dx, regs->si, regs->di);
172 printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n", 172 printk(KERN_DEFAULT "RBP: %016lx R08: %016lx R09: %016lx\n",
173 regs->bp, regs->r8, regs->r9); 173 regs->bp, regs->r8, regs->r9);
174 printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n", 174 printk(KERN_DEFAULT "R10: %016lx R11: %016lx R12: %016lx\n",
175 regs->r10, regs->r11, regs->r12); 175 regs->r10, regs->r11, regs->r12);
176 printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n", 176 printk(KERN_DEFAULT "R13: %016lx R14: %016lx R15: %016lx\n",
177 regs->r13, regs->r14, regs->r15); 177 regs->r13, regs->r14, regs->r15);
178 178
179 asm("movl %%ds,%0" : "=r" (ds)); 179 asm("movl %%ds,%0" : "=r" (ds));
@@ -194,21 +194,21 @@ void __show_regs(struct pt_regs *regs, int all)
194 cr3 = read_cr3(); 194 cr3 = read_cr3();
195 cr4 = read_cr4(); 195 cr4 = read_cr4();
196 196
197 printk(KERN_INFO "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", 197 printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
198 fs, fsindex, gs, gsindex, shadowgs); 198 fs, fsindex, gs, gsindex, shadowgs);
199 printk(KERN_INFO "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, 199 printk(KERN_DEFAULT "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
200 es, cr0); 200 es, cr0);
201 printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, 201 printk(KERN_DEFAULT "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
202 cr4); 202 cr4);
203 203
204 get_debugreg(d0, 0); 204 get_debugreg(d0, 0);
205 get_debugreg(d1, 1); 205 get_debugreg(d1, 1);
206 get_debugreg(d2, 2); 206 get_debugreg(d2, 2);
207 printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); 207 printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
208 get_debugreg(d3, 3); 208 get_debugreg(d3, 3);
209 get_debugreg(d6, 6); 209 get_debugreg(d6, 6);
210 get_debugreg(d7, 7); 210 get_debugreg(d7, 7);
211 printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); 211 printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
212} 212}
213 213
214void show_regs(struct pt_regs *regs) 214void show_regs(struct pt_regs *regs)
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 2779321046bd..017d937639fe 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -509,14 +509,14 @@ static int genregs_get(struct task_struct *target,
509{ 509{
510 if (kbuf) { 510 if (kbuf) {
511 unsigned long *k = kbuf; 511 unsigned long *k = kbuf;
512 while (count > 0) { 512 while (count >= sizeof(*k)) {
513 *k++ = getreg(target, pos); 513 *k++ = getreg(target, pos);
514 count -= sizeof(*k); 514 count -= sizeof(*k);
515 pos += sizeof(*k); 515 pos += sizeof(*k);
516 } 516 }
517 } else { 517 } else {
518 unsigned long __user *u = ubuf; 518 unsigned long __user *u = ubuf;
519 while (count > 0) { 519 while (count >= sizeof(*u)) {
520 if (__put_user(getreg(target, pos), u++)) 520 if (__put_user(getreg(target, pos), u++))
521 return -EFAULT; 521 return -EFAULT;
522 count -= sizeof(*u); 522 count -= sizeof(*u);
@@ -535,14 +535,14 @@ static int genregs_set(struct task_struct *target,
535 int ret = 0; 535 int ret = 0;
536 if (kbuf) { 536 if (kbuf) {
537 const unsigned long *k = kbuf; 537 const unsigned long *k = kbuf;
538 while (count > 0 && !ret) { 538 while (count >= sizeof(*k) && !ret) {
539 ret = putreg(target, pos, *k++); 539 ret = putreg(target, pos, *k++);
540 count -= sizeof(*k); 540 count -= sizeof(*k);
541 pos += sizeof(*k); 541 pos += sizeof(*k);
542 } 542 }
543 } else { 543 } else {
544 const unsigned long __user *u = ubuf; 544 const unsigned long __user *u = ubuf;
545 while (count > 0 && !ret) { 545 while (count >= sizeof(*u) && !ret) {
546 unsigned long word; 546 unsigned long word;
547 ret = __get_user(word, u++); 547 ret = __get_user(word, u++);
548 if (ret) 548 if (ret)
@@ -1458,14 +1458,14 @@ static int genregs32_get(struct task_struct *target,
1458{ 1458{
1459 if (kbuf) { 1459 if (kbuf) {
1460 compat_ulong_t *k = kbuf; 1460 compat_ulong_t *k = kbuf;
1461 while (count > 0) { 1461 while (count >= sizeof(*k)) {
1462 getreg32(target, pos, k++); 1462 getreg32(target, pos, k++);
1463 count -= sizeof(*k); 1463 count -= sizeof(*k);
1464 pos += sizeof(*k); 1464 pos += sizeof(*k);
1465 } 1465 }
1466 } else { 1466 } else {
1467 compat_ulong_t __user *u = ubuf; 1467 compat_ulong_t __user *u = ubuf;
1468 while (count > 0) { 1468 while (count >= sizeof(*u)) {
1469 compat_ulong_t word; 1469 compat_ulong_t word;
1470 getreg32(target, pos, &word); 1470 getreg32(target, pos, &word);
1471 if (__put_user(word, u++)) 1471 if (__put_user(word, u++))
@@ -1486,14 +1486,14 @@ static int genregs32_set(struct task_struct *target,
1486 int ret = 0; 1486 int ret = 0;
1487 if (kbuf) { 1487 if (kbuf) {
1488 const compat_ulong_t *k = kbuf; 1488 const compat_ulong_t *k = kbuf;
1489 while (count > 0 && !ret) { 1489 while (count >= sizeof(*k) && !ret) {
1490 ret = putreg32(target, pos, *k++); 1490 ret = putreg32(target, pos, *k++);
1491 count -= sizeof(*k); 1491 count -= sizeof(*k);
1492 pos += sizeof(*k); 1492 pos += sizeof(*k);
1493 } 1493 }
1494 } else { 1494 } else {
1495 const compat_ulong_t __user *u = ubuf; 1495 const compat_ulong_t __user *u = ubuf;
1496 while (count > 0 && !ret) { 1496 while (count >= sizeof(*u) && !ret) {
1497 compat_ulong_t word; 1497 compat_ulong_t word;
1498 ret = __get_user(word, u++); 1498 ret = __get_user(word, u++);
1499 if (ret) 1499 if (ret)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index cd982f48e23e..597683aa5ba0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -763,6 +763,7 @@ void mark_tsc_unstable(char *reason)
763{ 763{
764 if (!tsc_unstable) { 764 if (!tsc_unstable) {
765 tsc_unstable = 1; 765 tsc_unstable = 1;
766 sched_clock_stable = 0;
766 printk(KERN_INFO "Marking TSC unstable due to %s\n", reason); 767 printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
767 /* Change only the rating, when not registered */ 768 /* Change only the rating, when not registered */
768 if (clocksource_tsc.mult) 769 if (clocksource_tsc.mult)
diff --git a/arch/x86/kernel/uv_irq.c b/arch/x86/kernel/uv_irq.c
index 61d805df4c91..ece73d8e3240 100644
--- a/arch/x86/kernel/uv_irq.c
+++ b/arch/x86/kernel/uv_irq.c
@@ -215,8 +215,7 @@ static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask)
215 unsigned long mmr_offset; 215 unsigned long mmr_offset;
216 unsigned mmr_pnode; 216 unsigned mmr_pnode;
217 217
218 dest = set_desc_affinity(desc, mask); 218 if (set_desc_affinity(desc, mask, &dest))
219 if (dest == BAD_APICID)
220 return -1; 219 return -1;
221 220
222 mmr_value = 0; 221 mmr_value = 0;
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index cd60c0bd1b32..3063a0c4858b 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1150,6 +1150,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu)
1150 hrtimer_cancel(&apic->lapic_timer.timer); 1150 hrtimer_cancel(&apic->lapic_timer.timer);
1151 update_divide_count(apic); 1151 update_divide_count(apic);
1152 start_apic_timer(apic); 1152 start_apic_timer(apic);
1153 apic->irr_pending = true;
1153} 1154}
1154 1155
1155void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) 1156void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index a6017132fba8..58a0f1e88596 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -455,8 +455,6 @@ out_unlock:
455static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) 455static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
456{ 456{
457 struct kvm_shadow_walk_iterator iterator; 457 struct kvm_shadow_walk_iterator iterator;
458 pt_element_t gpte;
459 gpa_t pte_gpa = -1;
460 int level; 458 int level;
461 u64 *sptep; 459 u64 *sptep;
462 int need_flush = 0; 460 int need_flush = 0;
@@ -470,10 +468,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
470 if (level == PT_PAGE_TABLE_LEVEL || 468 if (level == PT_PAGE_TABLE_LEVEL ||
471 ((level == PT_DIRECTORY_LEVEL && is_large_pte(*sptep))) || 469 ((level == PT_DIRECTORY_LEVEL && is_large_pte(*sptep))) ||
472 ((level == PT_PDPE_LEVEL && is_large_pte(*sptep)))) { 470 ((level == PT_PDPE_LEVEL && is_large_pte(*sptep)))) {
473 struct kvm_mmu_page *sp = page_header(__pa(sptep));
474
475 pte_gpa = (sp->gfn << PAGE_SHIFT);
476 pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
477 471
478 if (is_shadow_present_pte(*sptep)) { 472 if (is_shadow_present_pte(*sptep)) {
479 rmap_remove(vcpu->kvm, sptep); 473 rmap_remove(vcpu->kvm, sptep);
@@ -492,18 +486,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
492 if (need_flush) 486 if (need_flush)
493 kvm_flush_remote_tlbs(vcpu->kvm); 487 kvm_flush_remote_tlbs(vcpu->kvm);
494 spin_unlock(&vcpu->kvm->mmu_lock); 488 spin_unlock(&vcpu->kvm->mmu_lock);
495
496 if (pte_gpa == -1)
497 return;
498 if (kvm_read_guest_atomic(vcpu->kvm, pte_gpa, &gpte,
499 sizeof(pt_element_t)))
500 return;
501 if (is_present_gpte(gpte) && (gpte & PT_ACCESSED_MASK)) {
502 if (mmu_topup_memory_caches(vcpu))
503 return;
504 kvm_mmu_pte_write(vcpu, pte_gpa, (const u8 *)&gpte,
505 sizeof(pt_element_t), 0);
506 }
507} 489}
508 490
509static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) 491static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9d068966fb2a..6651dbf58675 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1913,7 +1913,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
1913 1913
1914 events->sipi_vector = vcpu->arch.sipi_vector; 1914 events->sipi_vector = vcpu->arch.sipi_vector;
1915 1915
1916 events->flags = 0; 1916 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING
1917 | KVM_VCPUEVENT_VALID_SIPI_VECTOR);
1917 1918
1918 vcpu_put(vcpu); 1919 vcpu_put(vcpu);
1919} 1920}
@@ -1921,7 +1922,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
1921static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, 1922static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
1922 struct kvm_vcpu_events *events) 1923 struct kvm_vcpu_events *events)
1923{ 1924{
1924 if (events->flags) 1925 if (events->flags & ~(KVM_VCPUEVENT_VALID_NMI_PENDING
1926 | KVM_VCPUEVENT_VALID_SIPI_VECTOR))
1925 return -EINVAL; 1927 return -EINVAL;
1926 1928
1927 vcpu_load(vcpu); 1929 vcpu_load(vcpu);
@@ -1938,10 +1940,12 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
1938 kvm_pic_clear_isr_ack(vcpu->kvm); 1940 kvm_pic_clear_isr_ack(vcpu->kvm);
1939 1941
1940 vcpu->arch.nmi_injected = events->nmi.injected; 1942 vcpu->arch.nmi_injected = events->nmi.injected;
1941 vcpu->arch.nmi_pending = events->nmi.pending; 1943 if (events->flags & KVM_VCPUEVENT_VALID_NMI_PENDING)
1944 vcpu->arch.nmi_pending = events->nmi.pending;
1942 kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked); 1945 kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked);
1943 1946
1944 vcpu->arch.sipi_vector = events->sipi_vector; 1947 if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR)
1948 vcpu->arch.sipi_vector = events->sipi_vector;
1945 1949
1946 vcpu_put(vcpu); 1950 vcpu_put(vcpu);
1947 1951
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 45b20e486c2f..cffd754f3039 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c
14 14
15clean-files := inat-tables.c 15clean-files := inat-tables.c
16 16
17obj-$(CONFIG_SMP) := msr.o 17obj-$(CONFIG_SMP) += msr-smp.o
18 18
19lib-y := delay.o 19lib-y := delay.o
20lib-y += thunk_$(BITS).o 20lib-y += thunk_$(BITS).o
@@ -22,7 +22,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o
22lib-y += memcpy_$(BITS).o 22lib-y += memcpy_$(BITS).o
23lib-$(CONFIG_KPROBES) += insn.o inat.o 23lib-$(CONFIG_KPROBES) += insn.o inat.o
24 24
25obj-y += msr-reg.o msr-reg-export.o 25obj-y += msr.o msr-reg.o msr-reg-export.o
26 26
27ifeq ($(CONFIG_X86_32),y) 27ifeq ($(CONFIG_X86_32),y)
28 obj-y += atomic64_32.o 28 obj-y += atomic64_32.o
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
new file mode 100644
index 000000000000..a6b1b86d2253
--- /dev/null
+++ b/arch/x86/lib/msr-smp.c
@@ -0,0 +1,204 @@
1#include <linux/module.h>
2#include <linux/preempt.h>
3#include <linux/smp.h>
4#include <asm/msr.h>
5
6static void __rdmsr_on_cpu(void *info)
7{
8 struct msr_info *rv = info;
9 struct msr *reg;
10 int this_cpu = raw_smp_processor_id();
11
12 if (rv->msrs)
13 reg = per_cpu_ptr(rv->msrs, this_cpu);
14 else
15 reg = &rv->reg;
16
17 rdmsr(rv->msr_no, reg->l, reg->h);
18}
19
20static void __wrmsr_on_cpu(void *info)
21{
22 struct msr_info *rv = info;
23 struct msr *reg;
24 int this_cpu = raw_smp_processor_id();
25
26 if (rv->msrs)
27 reg = per_cpu_ptr(rv->msrs, this_cpu);
28 else
29 reg = &rv->reg;
30
31 wrmsr(rv->msr_no, reg->l, reg->h);
32}
33
34int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
35{
36 int err;
37 struct msr_info rv;
38
39 memset(&rv, 0, sizeof(rv));
40
41 rv.msr_no = msr_no;
42 err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
43 *l = rv.reg.l;
44 *h = rv.reg.h;
45
46 return err;
47}
48EXPORT_SYMBOL(rdmsr_on_cpu);
49
50int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
51{
52 int err;
53 struct msr_info rv;
54
55 memset(&rv, 0, sizeof(rv));
56
57 rv.msr_no = msr_no;
58 rv.reg.l = l;
59 rv.reg.h = h;
60 err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
61
62 return err;
63}
64EXPORT_SYMBOL(wrmsr_on_cpu);
65
66static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
67 struct msr *msrs,
68 void (*msr_func) (void *info))
69{
70 struct msr_info rv;
71 int this_cpu;
72
73 memset(&rv, 0, sizeof(rv));
74
75 rv.msrs = msrs;
76 rv.msr_no = msr_no;
77
78 this_cpu = get_cpu();
79
80 if (cpumask_test_cpu(this_cpu, mask))
81 msr_func(&rv);
82
83 smp_call_function_many(mask, msr_func, &rv, 1);
84 put_cpu();
85}
86
87/* rdmsr on a bunch of CPUs
88 *
89 * @mask: which CPUs
90 * @msr_no: which MSR
91 * @msrs: array of MSR values
92 *
93 */
94void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
95{
96 __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
97}
98EXPORT_SYMBOL(rdmsr_on_cpus);
99
100/*
101 * wrmsr on a bunch of CPUs
102 *
103 * @mask: which CPUs
104 * @msr_no: which MSR
105 * @msrs: array of MSR values
106 *
107 */
108void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
109{
110 __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
111}
112EXPORT_SYMBOL(wrmsr_on_cpus);
113
114/* These "safe" variants are slower and should be used when the target MSR
115 may not actually exist. */
116static void __rdmsr_safe_on_cpu(void *info)
117{
118 struct msr_info *rv = info;
119
120 rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
121}
122
123static void __wrmsr_safe_on_cpu(void *info)
124{
125 struct msr_info *rv = info;
126
127 rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
128}
129
130int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
131{
132 int err;
133 struct msr_info rv;
134
135 memset(&rv, 0, sizeof(rv));
136
137 rv.msr_no = msr_no;
138 err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
139 *l = rv.reg.l;
140 *h = rv.reg.h;
141
142 return err ? err : rv.err;
143}
144EXPORT_SYMBOL(rdmsr_safe_on_cpu);
145
146int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
147{
148 int err;
149 struct msr_info rv;
150
151 memset(&rv, 0, sizeof(rv));
152
153 rv.msr_no = msr_no;
154 rv.reg.l = l;
155 rv.reg.h = h;
156 err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
157
158 return err ? err : rv.err;
159}
160EXPORT_SYMBOL(wrmsr_safe_on_cpu);
161
162/*
163 * These variants are significantly slower, but allows control over
164 * the entire 32-bit GPR set.
165 */
166static void __rdmsr_safe_regs_on_cpu(void *info)
167{
168 struct msr_regs_info *rv = info;
169
170 rv->err = rdmsr_safe_regs(rv->regs);
171}
172
173static void __wrmsr_safe_regs_on_cpu(void *info)
174{
175 struct msr_regs_info *rv = info;
176
177 rv->err = wrmsr_safe_regs(rv->regs);
178}
179
180int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
181{
182 int err;
183 struct msr_regs_info rv;
184
185 rv.regs = regs;
186 rv.err = -EIO;
187 err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
188
189 return err ? err : rv.err;
190}
191EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
192
193int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
194{
195 int err;
196 struct msr_regs_info rv;
197
198 rv.regs = regs;
199 rv.err = -EIO;
200 err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
201
202 return err ? err : rv.err;
203}
204EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 872834177937..8f8eebdca7d4 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -1,123 +1,7 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/preempt.h> 2#include <linux/preempt.h>
3#include <linux/smp.h>
4#include <asm/msr.h> 3#include <asm/msr.h>
5 4
6struct msr_info {
7 u32 msr_no;
8 struct msr reg;
9 struct msr *msrs;
10 int err;
11};
12
13static void __rdmsr_on_cpu(void *info)
14{
15 struct msr_info *rv = info;
16 struct msr *reg;
17 int this_cpu = raw_smp_processor_id();
18
19 if (rv->msrs)
20 reg = per_cpu_ptr(rv->msrs, this_cpu);
21 else
22 reg = &rv->reg;
23
24 rdmsr(rv->msr_no, reg->l, reg->h);
25}
26
27static void __wrmsr_on_cpu(void *info)
28{
29 struct msr_info *rv = info;
30 struct msr *reg;
31 int this_cpu = raw_smp_processor_id();
32
33 if (rv->msrs)
34 reg = per_cpu_ptr(rv->msrs, this_cpu);
35 else
36 reg = &rv->reg;
37
38 wrmsr(rv->msr_no, reg->l, reg->h);
39}
40
41int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
42{
43 int err;
44 struct msr_info rv;
45
46 memset(&rv, 0, sizeof(rv));
47
48 rv.msr_no = msr_no;
49 err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
50 *l = rv.reg.l;
51 *h = rv.reg.h;
52
53 return err;
54}
55EXPORT_SYMBOL(rdmsr_on_cpu);
56
57int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
58{
59 int err;
60 struct msr_info rv;
61
62 memset(&rv, 0, sizeof(rv));
63
64 rv.msr_no = msr_no;
65 rv.reg.l = l;
66 rv.reg.h = h;
67 err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
68
69 return err;
70}
71EXPORT_SYMBOL(wrmsr_on_cpu);
72
73static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
74 struct msr *msrs,
75 void (*msr_func) (void *info))
76{
77 struct msr_info rv;
78 int this_cpu;
79
80 memset(&rv, 0, sizeof(rv));
81
82 rv.msrs = msrs;
83 rv.msr_no = msr_no;
84
85 this_cpu = get_cpu();
86
87 if (cpumask_test_cpu(this_cpu, mask))
88 msr_func(&rv);
89
90 smp_call_function_many(mask, msr_func, &rv, 1);
91 put_cpu();
92}
93
94/* rdmsr on a bunch of CPUs
95 *
96 * @mask: which CPUs
97 * @msr_no: which MSR
98 * @msrs: array of MSR values
99 *
100 */
101void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
102{
103 __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
104}
105EXPORT_SYMBOL(rdmsr_on_cpus);
106
107/*
108 * wrmsr on a bunch of CPUs
109 *
110 * @mask: which CPUs
111 * @msr_no: which MSR
112 * @msrs: array of MSR values
113 *
114 */
115void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
116{
117 __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
118}
119EXPORT_SYMBOL(wrmsr_on_cpus);
120
121struct msr *msrs_alloc(void) 5struct msr *msrs_alloc(void)
122{ 6{
123 struct msr *msrs = NULL; 7 struct msr *msrs = NULL;
@@ -137,100 +21,3 @@ void msrs_free(struct msr *msrs)
137 free_percpu(msrs); 21 free_percpu(msrs);
138} 22}
139EXPORT_SYMBOL(msrs_free); 23EXPORT_SYMBOL(msrs_free);
140
141/* These "safe" variants are slower and should be used when the target MSR
142 may not actually exist. */
143static void __rdmsr_safe_on_cpu(void *info)
144{
145 struct msr_info *rv = info;
146
147 rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
148}
149
150static void __wrmsr_safe_on_cpu(void *info)
151{
152 struct msr_info *rv = info;
153
154 rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
155}
156
157int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
158{
159 int err;
160 struct msr_info rv;
161
162 memset(&rv, 0, sizeof(rv));
163
164 rv.msr_no = msr_no;
165 err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
166 *l = rv.reg.l;
167 *h = rv.reg.h;
168
169 return err ? err : rv.err;
170}
171EXPORT_SYMBOL(rdmsr_safe_on_cpu);
172
173int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
174{
175 int err;
176 struct msr_info rv;
177
178 memset(&rv, 0, sizeof(rv));
179
180 rv.msr_no = msr_no;
181 rv.reg.l = l;
182 rv.reg.h = h;
183 err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
184
185 return err ? err : rv.err;
186}
187EXPORT_SYMBOL(wrmsr_safe_on_cpu);
188
189/*
190 * These variants are significantly slower, but allows control over
191 * the entire 32-bit GPR set.
192 */
193struct msr_regs_info {
194 u32 *regs;
195 int err;
196};
197
198static void __rdmsr_safe_regs_on_cpu(void *info)
199{
200 struct msr_regs_info *rv = info;
201
202 rv->err = rdmsr_safe_regs(rv->regs);
203}
204
205static void __wrmsr_safe_regs_on_cpu(void *info)
206{
207 struct msr_regs_info *rv = info;
208
209 rv->err = wrmsr_safe_regs(rv->regs);
210}
211
212int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
213{
214 int err;
215 struct msr_regs_info rv;
216
217 rv.regs = regs;
218 rv.err = -EIO;
219 err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
220
221 return err ? err : rv.err;
222}
223EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
224
225int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
226{
227 int err;
228 struct msr_regs_info rv;
229
230 rv.regs = regs;
231 rv.err = -EIO;
232 err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
233
234 return err ? err : rv.err;
235}
236EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c973f8e2a6cf..9a0c258a86be 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -892,8 +892,7 @@ void __init mem_init(void)
892 reservedpages << (PAGE_SHIFT-10), 892 reservedpages << (PAGE_SHIFT-10),
893 datasize >> 10, 893 datasize >> 10,
894 initsize >> 10, 894 initsize >> 10,
895 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) 895 totalhigh_pages << (PAGE_SHIFT-10));
896 );
897 896
898 printk(KERN_INFO "virtual kernel memory layout:\n" 897 printk(KERN_INFO "virtual kernel memory layout:\n"
899 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 898 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
diff --git a/arch/x86/mm/kmemcheck/error.c b/arch/x86/mm/kmemcheck/error.c
index 4901d0dafda6..af3b6c8a436f 100644
--- a/arch/x86/mm/kmemcheck/error.c
+++ b/arch/x86/mm/kmemcheck/error.c
@@ -106,26 +106,25 @@ void kmemcheck_error_recall(void)
106 106
107 switch (e->type) { 107 switch (e->type) {
108 case KMEMCHECK_ERROR_INVALID_ACCESS: 108 case KMEMCHECK_ERROR_INVALID_ACCESS:
109 printk(KERN_ERR "WARNING: kmemcheck: Caught %d-bit read " 109 printk(KERN_WARNING "WARNING: kmemcheck: Caught %d-bit read from %s memory (%p)\n",
110 "from %s memory (%p)\n",
111 8 * e->size, e->state < ARRAY_SIZE(desc) ? 110 8 * e->size, e->state < ARRAY_SIZE(desc) ?
112 desc[e->state] : "(invalid shadow state)", 111 desc[e->state] : "(invalid shadow state)",
113 (void *) e->address); 112 (void *) e->address);
114 113
115 printk(KERN_INFO); 114 printk(KERN_WARNING);
116 for (i = 0; i < SHADOW_COPY_SIZE; ++i) 115 for (i = 0; i < SHADOW_COPY_SIZE; ++i)
117 printk("%02x", e->memory_copy[i]); 116 printk(KERN_CONT "%02x", e->memory_copy[i]);
118 printk("\n"); 117 printk(KERN_CONT "\n");
119 118
120 printk(KERN_INFO); 119 printk(KERN_WARNING);
121 for (i = 0; i < SHADOW_COPY_SIZE; ++i) { 120 for (i = 0; i < SHADOW_COPY_SIZE; ++i) {
122 if (e->shadow_copy[i] < ARRAY_SIZE(short_desc)) 121 if (e->shadow_copy[i] < ARRAY_SIZE(short_desc))
123 printk(" %c", short_desc[e->shadow_copy[i]]); 122 printk(KERN_CONT " %c", short_desc[e->shadow_copy[i]]);
124 else 123 else
125 printk(" ?"); 124 printk(KERN_CONT " ?");
126 } 125 }
127 printk("\n"); 126 printk(KERN_CONT "\n");
128 printk(KERN_INFO "%*c\n", 2 + 2 127 printk(KERN_WARNING "%*c\n", 2 + 2
129 * (int) (e->address & (SHADOW_COPY_SIZE - 1)), '^'); 128 * (int) (e->address & (SHADOW_COPY_SIZE - 1)), '^');
130 break; 129 break;
131 case KMEMCHECK_ERROR_BUG: 130 case KMEMCHECK_ERROR_BUG:
diff --git a/arch/x86/mm/srat_32.c b/arch/x86/mm/srat_32.c
index 6f8aa33031c7..9324f13492d5 100644
--- a/arch/x86/mm/srat_32.c
+++ b/arch/x86/mm/srat_32.c
@@ -267,6 +267,8 @@ int __init get_memcfg_from_srat(void)
267 e820_register_active_regions(chunk->nid, chunk->start_pfn, 267 e820_register_active_regions(chunk->nid, chunk->start_pfn,
268 min(chunk->end_pfn, max_pfn)); 268 min(chunk->end_pfn, max_pfn));
269 } 269 }
270 /* for out of order entries in SRAT */
271 sort_node_map();
270 272
271 for_each_online_node(nid) { 273 for_each_online_node(nid) {
272 unsigned long start = node_start_pfn[nid]; 274 unsigned long start = node_start_pfn[nid];
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index d89075489664..a27124185fc1 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -317,7 +317,7 @@ static int __init nodes_cover_memory(const struct bootnode *nodes)
317 unsigned long s = nodes[i].start >> PAGE_SHIFT; 317 unsigned long s = nodes[i].start >> PAGE_SHIFT;
318 unsigned long e = nodes[i].end >> PAGE_SHIFT; 318 unsigned long e = nodes[i].end >> PAGE_SHIFT;
319 pxmram += e - s; 319 pxmram += e - s;
320 pxmram -= absent_pages_in_range(s, e); 320 pxmram -= __absent_pages_in_range(i, s, e);
321 if ((long)pxmram < 0) 321 if ((long)pxmram < 0)
322 pxmram = 0; 322 pxmram = 0;
323 } 323 }
@@ -373,6 +373,8 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
373 for_each_node_mask(i, nodes_parsed) 373 for_each_node_mask(i, nodes_parsed)
374 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, 374 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT,
375 nodes[i].end >> PAGE_SHIFT); 375 nodes[i].end >> PAGE_SHIFT);
376 /* for out of order entries in SRAT */
377 sort_node_map();
376 if (!nodes_cover_memory(nodes)) { 378 if (!nodes_cover_memory(nodes)) {
377 bad_srat(); 379 bad_srat();
378 return -1; 380 return -1;
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index 145df00e0387..f939d603adfa 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -51,7 +51,7 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
51 } 51 }
52} 52}
53 53
54void __init update_res(struct pci_root_info *info, size_t start, 54void __devinit update_res(struct pci_root_info *info, size_t start,
55 size_t end, unsigned long flags, int merge) 55 size_t end, unsigned long flags, int merge)
56{ 56{
57 int i; 57 int i;
diff --git a/arch/x86/pci/intel_bus.c b/arch/x86/pci/intel_bus.c
index b7a55dc55d13..f81a2fa8fe25 100644
--- a/arch/x86/pci/intel_bus.c
+++ b/arch/x86/pci/intel_bus.c
@@ -49,6 +49,10 @@ static void __devinit pci_root_bus_res(struct pci_dev *dev)
49 u64 mmioh_base, mmioh_end; 49 u64 mmioh_base, mmioh_end;
50 int bus_base, bus_end; 50 int bus_base, bus_end;
51 51
52 /* some sys doesn't get mmconf enabled */
53 if (dev->cfg_size < 0x120)
54 return;
55
52 if (pci_root_num >= PCI_ROOT_NR) { 56 if (pci_root_num >= PCI_ROOT_NR) {
53 printk(KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n"); 57 printk(KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n");
54 return; 58 return;
diff --git a/arch/x86/tools/chkobjdump.awk b/arch/x86/tools/chkobjdump.awk
index 0d13cd9fdcff..fd1ab80be0de 100644
--- a/arch/x86/tools/chkobjdump.awk
+++ b/arch/x86/tools/chkobjdump.awk
@@ -8,14 +8,24 @@ BEGIN {
8 od_sver = 19; 8 od_sver = 19;
9} 9}
10 10
11/^GNU/ { 11/^GNU objdump/ {
12 split($4, ver, "."); 12 verstr = ""
13 for (i = 3; i <= NF; i++)
14 if (match($(i), "^[0-9]")) {
15 verstr = $(i);
16 break;
17 }
18 if (verstr == "") {
19 printf("Warning: Failed to find objdump version number.\n");
20 exit 0;
21 }
22 split(verstr, ver, ".");
13 if (ver[1] > od_ver || 23 if (ver[1] > od_ver ||
14 (ver[1] == od_ver && ver[2] >= od_sver)) { 24 (ver[1] == od_ver && ver[2] >= od_sver)) {
15 exit 1; 25 exit 1;
16 } else { 26 } else {
17 printf("Warning: objdump version %s is older than %d.%d\n", 27 printf("Warning: objdump version %s is older than %d.%d\n",
18 $4, od_ver, od_sver); 28 verstr, od_ver, od_sver);
19 print("Warning: Skipping posttest."); 29 print("Warning: Skipping posttest.");
20 # Logic is inverted, because we just skip test without error. 30 # Logic is inverted, because we just skip test without error.
21 exit 0; 31 exit 0;
diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk
index 7a6850683c34..eaf11f52fc0b 100644
--- a/arch/x86/tools/gen-insn-attr-x86.awk
+++ b/arch/x86/tools/gen-insn-attr-x86.awk
@@ -6,8 +6,6 @@
6 6
7# Awk implementation sanity check 7# Awk implementation sanity check
8function check_awk_implement() { 8function check_awk_implement() {
9 if (!match("abc", "[[:lower:]]+"))
10 return "Your awk doesn't support charactor-class."
11 if (sprintf("%x", 0) != "0") 9 if (sprintf("%x", 0) != "0")
12 return "Your awk has a printf-format problem." 10 return "Your awk has a printf-format problem."
13 return "" 11 return ""
@@ -44,12 +42,12 @@ BEGIN {
44 delete gtable 42 delete gtable
45 delete atable 43 delete atable
46 44
47 opnd_expr = "^[[:alpha:]/]" 45 opnd_expr = "^[A-Za-z/]"
48 ext_expr = "^\\(" 46 ext_expr = "^\\("
49 sep_expr = "^\\|$" 47 sep_expr = "^\\|$"
50 group_expr = "^Grp[[:alnum:]]+" 48 group_expr = "^Grp[0-9A-Za-z]+"
51 49
52 imm_expr = "^[IJAO][[:lower:]]" 50 imm_expr = "^[IJAO][a-z]"
53 imm_flag["Ib"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)" 51 imm_flag["Ib"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)"
54 imm_flag["Jb"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)" 52 imm_flag["Jb"] = "INAT_MAKE_IMM(INAT_IMM_BYTE)"
55 imm_flag["Iw"] = "INAT_MAKE_IMM(INAT_IMM_WORD)" 53 imm_flag["Iw"] = "INAT_MAKE_IMM(INAT_IMM_WORD)"
@@ -62,7 +60,7 @@ BEGIN {
62 imm_flag["Ob"] = "INAT_MOFFSET" 60 imm_flag["Ob"] = "INAT_MOFFSET"
63 imm_flag["Ov"] = "INAT_MOFFSET" 61 imm_flag["Ov"] = "INAT_MOFFSET"
64 62
65 modrm_expr = "^([CDEGMNPQRSUVW/][[:lower:]]+|NTA|T[012])" 63 modrm_expr = "^([CDEGMNPQRSUVW/][a-z]+|NTA|T[012])"
66 force64_expr = "\\([df]64\\)" 64 force64_expr = "\\([df]64\\)"
67 rex_expr = "^REX(\\.[XRWB]+)*" 65 rex_expr = "^REX(\\.[XRWB]+)*"
68 fpu_expr = "^ESC" # TODO 66 fpu_expr = "^ESC" # TODO
diff --git a/arch/xtensa/include/asm/asm-offsets.h b/arch/xtensa/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/xtensa/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index 8873b9b439ff..8618d8996fea 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -402,7 +402,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
402 * our current implementations need. If we'll ever need 402 * our current implementations need. If we'll ever need
403 * more the interface will need revisiting. 403 * more the interface will need revisiting.
404 */ 404 */
405 page = alloc_page(GFP_KERNEL | __GFP_ZERO); 405 page = alloc_page(gfp_mask | __GFP_ZERO);
406 if (!page) 406 if (!page)
407 goto out_free_bio; 407 goto out_free_bio;
408 if (bio_add_pc_page(q, bio, page, sector_size, 0) < sector_size) 408 if (bio_add_pc_page(q, bio, page, sector_size, 0) < sector_size)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 6ae118d6e193..d52d4adc440b 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -505,21 +505,30 @@ static unsigned int lcm(unsigned int a, unsigned int b)
505 505
506/** 506/**
507 * blk_stack_limits - adjust queue_limits for stacked devices 507 * blk_stack_limits - adjust queue_limits for stacked devices
508 * @t: the stacking driver limits (top) 508 * @t: the stacking driver limits (top device)
509 * @b: the underlying queue limits (bottom) 509 * @b: the underlying queue limits (bottom, component device)
510 * @offset: offset to beginning of data within component device 510 * @offset: offset to beginning of data within component device
511 * 511 *
512 * Description: 512 * Description:
513 * Merges two queue_limit structs. Returns 0 if alignment didn't 513 * This function is used by stacking drivers like MD and DM to ensure
514 * change. Returns -1 if adding the bottom device caused 514 * that all component devices have compatible block sizes and
515 * misalignment. 515 * alignments. The stacking driver must provide a queue_limits
516 * struct (top) and then iteratively call the stacking function for
517 * all component (bottom) devices. The stacking function will
518 * attempt to combine the values and ensure proper alignment.
519 *
520 * Returns 0 if the top and bottom queue_limits are compatible. The
521 * top device's block sizes and alignment offsets may be adjusted to
522 * ensure alignment with the bottom device. If no compatible sizes
523 * and alignments exist, -1 is returned and the resulting top
524 * queue_limits will have the misaligned flag set to indicate that
525 * the alignment_offset is undefined.
516 */ 526 */
517int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 527int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
518 sector_t offset) 528 sector_t offset)
519{ 529{
520 int ret; 530 sector_t alignment;
521 531 unsigned int top, bottom;
522 ret = 0;
523 532
524 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); 533 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
525 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); 534 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);
@@ -537,6 +546,22 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
537 t->max_segment_size = min_not_zero(t->max_segment_size, 546 t->max_segment_size = min_not_zero(t->max_segment_size,
538 b->max_segment_size); 547 b->max_segment_size);
539 548
549 alignment = queue_limit_alignment_offset(b, offset);
550
551 /* Bottom device has different alignment. Check that it is
552 * compatible with the current top alignment.
553 */
554 if (t->alignment_offset != alignment) {
555
556 top = max(t->physical_block_size, t->io_min)
557 + t->alignment_offset;
558 bottom = max(b->physical_block_size, b->io_min) + alignment;
559
560 /* Verify that top and bottom intervals line up */
561 if (max(top, bottom) & (min(top, bottom) - 1))
562 t->misaligned = 1;
563 }
564
540 t->logical_block_size = max(t->logical_block_size, 565 t->logical_block_size = max(t->logical_block_size,
541 b->logical_block_size); 566 b->logical_block_size);
542 567
@@ -544,54 +569,64 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
544 b->physical_block_size); 569 b->physical_block_size);
545 570
546 t->io_min = max(t->io_min, b->io_min); 571 t->io_min = max(t->io_min, b->io_min);
572 t->io_opt = lcm(t->io_opt, b->io_opt);
573
547 t->no_cluster |= b->no_cluster; 574 t->no_cluster |= b->no_cluster;
548 t->discard_zeroes_data &= b->discard_zeroes_data; 575 t->discard_zeroes_data &= b->discard_zeroes_data;
549 576
550 /* Bottom device offset aligned? */ 577 /* Physical block size a multiple of the logical block size? */
551 if (offset && 578 if (t->physical_block_size & (t->logical_block_size - 1)) {
552 (offset & (b->physical_block_size - 1)) != b->alignment_offset) { 579 t->physical_block_size = t->logical_block_size;
553 t->misaligned = 1; 580 t->misaligned = 1;
554 ret = -1;
555 } 581 }
556 582
557 /* 583 /* Minimum I/O a multiple of the physical block size? */
558 * Temporarily disable discard granularity. It's currently buggy 584 if (t->io_min & (t->physical_block_size - 1)) {
559 * since we default to 0 for discard_granularity, hence this 585 t->io_min = t->physical_block_size;
560 * "failure" will always trigger for non-zero offsets. 586 t->misaligned = 1;
561 */
562#if 0
563 if (offset &&
564 (offset & (b->discard_granularity - 1)) != b->discard_alignment) {
565 t->discard_misaligned = 1;
566 ret = -1;
567 } 587 }
568#endif
569
570 /* If top has no alignment offset, inherit from bottom */
571 if (!t->alignment_offset)
572 t->alignment_offset =
573 b->alignment_offset & (b->physical_block_size - 1);
574 588
575 if (!t->discard_alignment) 589 /* Optimal I/O a multiple of the physical block size? */
576 t->discard_alignment = 590 if (t->io_opt & (t->physical_block_size - 1)) {
577 b->discard_alignment & (b->discard_granularity - 1); 591 t->io_opt = 0;
578
579 /* Top device aligned on logical block boundary? */
580 if (t->alignment_offset & (t->logical_block_size - 1)) {
581 t->misaligned = 1; 592 t->misaligned = 1;
582 ret = -1;
583 } 593 }
584 594
585 /* Find lcm() of optimal I/O size and granularity */ 595 /* Find lowest common alignment_offset */
586 t->io_opt = lcm(t->io_opt, b->io_opt); 596 t->alignment_offset = lcm(t->alignment_offset, alignment)
587 t->discard_granularity = lcm(t->discard_granularity, 597 & (max(t->physical_block_size, t->io_min) - 1);
588 b->discard_granularity);
589 598
590 /* Verify that optimal I/O size is a multiple of io_min */ 599 /* Verify that new alignment_offset is on a logical block boundary */
591 if (t->io_min && t->io_opt % t->io_min) 600 if (t->alignment_offset & (t->logical_block_size - 1))
592 ret = -1; 601 t->misaligned = 1;
602
603 /* Discard alignment and granularity */
604 if (b->discard_granularity) {
605 unsigned int granularity = b->discard_granularity;
606 offset &= granularity - 1;
607
608 alignment = (granularity + b->discard_alignment - offset)
609 & (granularity - 1);
610
611 if (t->discard_granularity != 0 &&
612 t->discard_alignment != alignment) {
613 top = t->discard_granularity + t->discard_alignment;
614 bottom = b->discard_granularity + alignment;
615
616 /* Verify that top and bottom intervals line up */
617 if (max(top, bottom) & (min(top, bottom) - 1))
618 t->discard_misaligned = 1;
619 }
620
621 t->max_discard_sectors = min_not_zero(t->max_discard_sectors,
622 b->max_discard_sectors);
623 t->discard_granularity = max(t->discard_granularity,
624 b->discard_granularity);
625 t->discard_alignment = lcm(t->discard_alignment, alignment) &
626 (t->discard_granularity - 1);
627 }
593 628
594 return ret; 629 return t->misaligned ? -1 : 0;
595} 630}
596EXPORT_SYMBOL(blk_stack_limits); 631EXPORT_SYMBOL(blk_stack_limits);
597 632
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index e2f80463ed0d..918c7fd9aeb1 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -208,8 +208,6 @@ struct cfq_data {
208 /* Root service tree for cfq_groups */ 208 /* Root service tree for cfq_groups */
209 struct cfq_rb_root grp_service_tree; 209 struct cfq_rb_root grp_service_tree;
210 struct cfq_group root_group; 210 struct cfq_group root_group;
211 /* Number of active cfq groups on group service tree */
212 int nr_groups;
213 211
214 /* 212 /*
215 * The priority currently being served 213 * The priority currently being served
@@ -294,8 +292,7 @@ static struct cfq_group *cfq_get_next_cfqg(struct cfq_data *cfqd);
294 292
295static struct cfq_rb_root *service_tree_for(struct cfq_group *cfqg, 293static struct cfq_rb_root *service_tree_for(struct cfq_group *cfqg,
296 enum wl_prio_t prio, 294 enum wl_prio_t prio,
297 enum wl_type_t type, 295 enum wl_type_t type)
298 struct cfq_data *cfqd)
299{ 296{
300 if (!cfqg) 297 if (!cfqg)
301 return NULL; 298 return NULL;
@@ -842,7 +839,6 @@ cfq_group_service_tree_add(struct cfq_data *cfqd, struct cfq_group *cfqg)
842 839
843 __cfq_group_service_tree_add(st, cfqg); 840 __cfq_group_service_tree_add(st, cfqg);
844 cfqg->on_st = true; 841 cfqg->on_st = true;
845 cfqd->nr_groups++;
846 st->total_weight += cfqg->weight; 842 st->total_weight += cfqg->weight;
847} 843}
848 844
@@ -863,7 +859,6 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg)
863 859
864 cfq_log_cfqg(cfqd, cfqg, "del_from_rr group"); 860 cfq_log_cfqg(cfqd, cfqg, "del_from_rr group");
865 cfqg->on_st = false; 861 cfqg->on_st = false;
866 cfqd->nr_groups--;
867 st->total_weight -= cfqg->weight; 862 st->total_weight -= cfqg->weight;
868 if (!RB_EMPTY_NODE(&cfqg->rb_node)) 863 if (!RB_EMPTY_NODE(&cfqg->rb_node))
869 cfq_rb_erase(&cfqg->rb_node, st); 864 cfq_rb_erase(&cfqg->rb_node, st);
@@ -1150,7 +1145,7 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1150#endif 1145#endif
1151 1146
1152 service_tree = service_tree_for(cfqq->cfqg, cfqq_prio(cfqq), 1147 service_tree = service_tree_for(cfqq->cfqg, cfqq_prio(cfqq),
1153 cfqq_type(cfqq), cfqd); 1148 cfqq_type(cfqq));
1154 if (cfq_class_idle(cfqq)) { 1149 if (cfq_class_idle(cfqq)) {
1155 rb_key = CFQ_IDLE_DELAY; 1150 rb_key = CFQ_IDLE_DELAY;
1156 parent = rb_last(&service_tree->rb); 1151 parent = rb_last(&service_tree->rb);
@@ -1513,9 +1508,6 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
1513 struct cfq_io_context *cic; 1508 struct cfq_io_context *cic;
1514 struct cfq_queue *cfqq; 1509 struct cfq_queue *cfqq;
1515 1510
1516 /* Deny merge if bio and rq don't belong to same cfq group */
1517 if ((RQ_CFQQ(rq))->cfqg != cfq_get_cfqg(cfqd, 0))
1518 return false;
1519 /* 1511 /*
1520 * Disallow merge of a sync bio into an async request. 1512 * Disallow merge of a sync bio into an async request.
1521 */ 1513 */
@@ -1616,7 +1608,7 @@ static struct cfq_queue *cfq_get_next_queue(struct cfq_data *cfqd)
1616{ 1608{
1617 struct cfq_rb_root *service_tree = 1609 struct cfq_rb_root *service_tree =
1618 service_tree_for(cfqd->serving_group, cfqd->serving_prio, 1610 service_tree_for(cfqd->serving_group, cfqd->serving_prio,
1619 cfqd->serving_type, cfqd); 1611 cfqd->serving_type);
1620 1612
1621 if (!cfqd->rq_queued) 1613 if (!cfqd->rq_queued)
1622 return NULL; 1614 return NULL;
@@ -1675,13 +1667,17 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
1675#define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR) 1667#define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR)
1676 1668
1677static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1669static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1678 struct request *rq) 1670 struct request *rq, bool for_preempt)
1679{ 1671{
1680 sector_t sdist = cfqq->seek_mean; 1672 sector_t sdist = cfqq->seek_mean;
1681 1673
1682 if (!sample_valid(cfqq->seek_samples)) 1674 if (!sample_valid(cfqq->seek_samples))
1683 sdist = CFQQ_SEEK_THR; 1675 sdist = CFQQ_SEEK_THR;
1684 1676
1677 /* if seek_mean is big, using it as close criteria is meaningless */
1678 if (sdist > CFQQ_SEEK_THR && !for_preempt)
1679 sdist = CFQQ_SEEK_THR;
1680
1685 return cfq_dist_from_last(cfqd, rq) <= sdist; 1681 return cfq_dist_from_last(cfqd, rq) <= sdist;
1686} 1682}
1687 1683
@@ -1709,7 +1705,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1709 * will contain the closest sector. 1705 * will contain the closest sector.
1710 */ 1706 */
1711 __cfqq = rb_entry(parent, struct cfq_queue, p_node); 1707 __cfqq = rb_entry(parent, struct cfq_queue, p_node);
1712 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) 1708 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false))
1713 return __cfqq; 1709 return __cfqq;
1714 1710
1715 if (blk_rq_pos(__cfqq->next_rq) < sector) 1711 if (blk_rq_pos(__cfqq->next_rq) < sector)
@@ -1720,7 +1716,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1720 return NULL; 1716 return NULL;
1721 1717
1722 __cfqq = rb_entry(node, struct cfq_queue, p_node); 1718 __cfqq = rb_entry(node, struct cfq_queue, p_node);
1723 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) 1719 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false))
1724 return __cfqq; 1720 return __cfqq;
1725 1721
1726 return NULL; 1722 return NULL;
@@ -1963,8 +1959,7 @@ static void cfq_setup_merge(struct cfq_queue *cfqq, struct cfq_queue *new_cfqq)
1963} 1959}
1964 1960
1965static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd, 1961static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd,
1966 struct cfq_group *cfqg, enum wl_prio_t prio, 1962 struct cfq_group *cfqg, enum wl_prio_t prio)
1967 bool prio_changed)
1968{ 1963{
1969 struct cfq_queue *queue; 1964 struct cfq_queue *queue;
1970 int i; 1965 int i;
@@ -1972,24 +1967,9 @@ static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd,
1972 unsigned long lowest_key = 0; 1967 unsigned long lowest_key = 0;
1973 enum wl_type_t cur_best = SYNC_NOIDLE_WORKLOAD; 1968 enum wl_type_t cur_best = SYNC_NOIDLE_WORKLOAD;
1974 1969
1975 if (prio_changed) { 1970 for (i = 0; i <= SYNC_WORKLOAD; ++i) {
1976 /* 1971 /* select the one with lowest rb_key */
1977 * When priorities switched, we prefer starting 1972 queue = cfq_rb_first(service_tree_for(cfqg, prio, i));
1978 * from SYNC_NOIDLE (first choice), or just SYNC
1979 * over ASYNC
1980 */
1981 if (service_tree_for(cfqg, prio, cur_best, cfqd)->count)
1982 return cur_best;
1983 cur_best = SYNC_WORKLOAD;
1984 if (service_tree_for(cfqg, prio, cur_best, cfqd)->count)
1985 return cur_best;
1986
1987 return ASYNC_WORKLOAD;
1988 }
1989
1990 for (i = 0; i < 3; ++i) {
1991 /* otherwise, select the one with lowest rb_key */
1992 queue = cfq_rb_first(service_tree_for(cfqg, prio, i, cfqd));
1993 if (queue && 1973 if (queue &&
1994 (!key_valid || time_before(queue->rb_key, lowest_key))) { 1974 (!key_valid || time_before(queue->rb_key, lowest_key))) {
1995 lowest_key = queue->rb_key; 1975 lowest_key = queue->rb_key;
@@ -2003,8 +1983,6 @@ static enum wl_type_t cfq_choose_wl(struct cfq_data *cfqd,
2003 1983
2004static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg) 1984static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg)
2005{ 1985{
2006 enum wl_prio_t previous_prio = cfqd->serving_prio;
2007 bool prio_changed;
2008 unsigned slice; 1986 unsigned slice;
2009 unsigned count; 1987 unsigned count;
2010 struct cfq_rb_root *st; 1988 struct cfq_rb_root *st;
@@ -2032,24 +2010,19 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg)
2032 * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload 2010 * (SYNC, SYNC_NOIDLE, ASYNC), and to compute a workload
2033 * expiration time 2011 * expiration time
2034 */ 2012 */
2035 prio_changed = (cfqd->serving_prio != previous_prio); 2013 st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type);
2036 st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type,
2037 cfqd);
2038 count = st->count; 2014 count = st->count;
2039 2015
2040 /* 2016 /*
2041 * If priority didn't change, check workload expiration, 2017 * check workload expiration, and that we still have other queues ready
2042 * and that we still have other queues ready
2043 */ 2018 */
2044 if (!prio_changed && count && 2019 if (count && !time_after(jiffies, cfqd->workload_expires))
2045 !time_after(jiffies, cfqd->workload_expires))
2046 return; 2020 return;
2047 2021
2048 /* otherwise select new workload type */ 2022 /* otherwise select new workload type */
2049 cfqd->serving_type = 2023 cfqd->serving_type =
2050 cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio, prio_changed); 2024 cfq_choose_wl(cfqd, cfqg, cfqd->serving_prio);
2051 st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type, 2025 st = service_tree_for(cfqg, cfqd->serving_prio, cfqd->serving_type);
2052 cfqd);
2053 count = st->count; 2026 count = st->count;
2054 2027
2055 /* 2028 /*
@@ -3143,7 +3116,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3143 * if this request is as-good as one we would expect from the 3116 * if this request is as-good as one we would expect from the
3144 * current cfqq, let it preempt 3117 * current cfqq, let it preempt
3145 */ 3118 */
3146 if (cfq_rq_close(cfqd, cfqq, rq)) 3119 if (cfq_rq_close(cfqd, cfqq, rq, true))
3147 return true; 3120 return true;
3148 3121
3149 return false; 3122 return false;
diff --git a/crypto/async_tx/raid6test.c b/crypto/async_tx/raid6test.c
index 3ec27c7e62ea..f84f6b4301d9 100644
--- a/crypto/async_tx/raid6test.c
+++ b/crypto/async_tx/raid6test.c
@@ -214,6 +214,13 @@ static int raid6_test(void)
214 err += test(4, &tests); 214 err += test(4, &tests);
215 if (NDISKS > 5) 215 if (NDISKS > 5)
216 err += test(5, &tests); 216 err += test(5, &tests);
217 /* the 11 and 12 disk cases are special for ioatdma (p-disabled
218 * q-continuation without extended descriptor)
219 */
220 if (NDISKS > 12) {
221 err += test(11, &tests);
222 err += test(12, &tests);
223 }
217 err += test(NDISKS, &tests); 224 err += test(NDISKS, &tests);
218 225
219 pr("\n"); 226 pr("\n");
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 8a07363417ed..368ae6d3a096 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -28,7 +28,7 @@ source "drivers/md/Kconfig"
28 28
29source "drivers/message/fusion/Kconfig" 29source "drivers/message/fusion/Kconfig"
30 30
31source "drivers/ieee1394/Kconfig" 31source "drivers/firewire/Kconfig"
32 32
33source "drivers/message/i2o/Kconfig" 33source "drivers/message/i2o/Kconfig"
34 34
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c
index d672cfe7ca59..cb423f5aef24 100644
--- a/drivers/accessibility/braille/braille_console.c
+++ b/drivers/accessibility/braille/braille_console.c
@@ -21,7 +21,6 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24#include <linux/autoconf.h>
25#include <linux/kernel.h> 24#include <linux/kernel.h>
26#include <linux/module.h> 25#include <linux/module.h>
27#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index c7b10b4298e9..66cc3f36a954 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -32,6 +32,7 @@ acpi-$(CONFIG_ACPI_SLEEP) += proc.o
32# 32#
33acpi-y += bus.o glue.o 33acpi-y += bus.o glue.o
34acpi-y += scan.o 34acpi-y += scan.o
35acpi-y += processor_pdc.o
35acpi-y += ec.o 36acpi-y += ec.o
36acpi-$(CONFIG_ACPI_DOCK) += dock.o 37acpi-$(CONFIG_ACPI_DOCK) += dock.o
37acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o 38acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 23e5a0519af5..2815df66f6f7 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -185,6 +185,12 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
185 acpi_osi_setup("!Windows 2006"); 185 acpi_osi_setup("!Windows 2006");
186 return 0; 186 return 0;
187} 187}
188static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
189{
190 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
191 acpi_osi_setup("!Windows 2009");
192 return 0;
193}
188 194
189static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { 195static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
190 { 196 {
@@ -211,6 +217,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
211 DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"), 217 DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"),
212 }, 218 },
213 }, 219 },
220 {
221 .callback = dmi_disable_osi_win7,
222 .ident = "ASUS K50IJ",
223 .matches = {
224 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
225 DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
226 },
227 },
214 228
215 /* 229 /*
216 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. 230 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 65f7e335f122..cf761b904e4a 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -397,6 +397,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
397 union acpi_object *out_obj; 397 union acpi_object *out_obj;
398 u8 uuid[16]; 398 u8 uuid[16];
399 u32 errors; 399 u32 errors;
400 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
400 401
401 if (!context) 402 if (!context)
402 return AE_ERROR; 403 return AE_ERROR;
@@ -419,16 +420,16 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
419 in_params[3].buffer.length = context->cap.length; 420 in_params[3].buffer.length = context->cap.length;
420 in_params[3].buffer.pointer = context->cap.pointer; 421 in_params[3].buffer.pointer = context->cap.pointer;
421 422
422 status = acpi_evaluate_object(handle, "_OSC", &input, &context->ret); 423 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
423 if (ACPI_FAILURE(status)) 424 if (ACPI_FAILURE(status))
424 return status; 425 return status;
425 426
426 /* return buffer should have the same length as cap buffer */ 427 if (!output.length)
427 if (context->ret.length != context->cap.length)
428 return AE_NULL_OBJECT; 428 return AE_NULL_OBJECT;
429 429
430 out_obj = context->ret.pointer; 430 out_obj = output.pointer;
431 if (out_obj->type != ACPI_TYPE_BUFFER) { 431 if (out_obj->type != ACPI_TYPE_BUFFER
432 || out_obj->buffer.length != context->cap.length) {
432 acpi_print_osc_error(handle, context, 433 acpi_print_osc_error(handle, context,
433 "_OSC evaluation returned wrong type"); 434 "_OSC evaluation returned wrong type");
434 status = AE_TYPE; 435 status = AE_TYPE;
@@ -457,11 +458,20 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
457 goto out_kfree; 458 goto out_kfree;
458 } 459 }
459out_success: 460out_success:
460 return AE_OK; 461 context->ret.length = out_obj->buffer.length;
462 context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL);
463 if (!context->ret.pointer) {
464 status = AE_NO_MEMORY;
465 goto out_kfree;
466 }
467 memcpy(context->ret.pointer, out_obj->buffer.pointer,
468 context->ret.length);
469 status = AE_OK;
461 470
462out_kfree: 471out_kfree:
463 kfree(context->ret.pointer); 472 kfree(output.pointer);
464 context->ret.pointer = NULL; 473 if (status != AE_OK)
474 context->ret.pointer = NULL;
465 return status; 475 return status;
466} 476}
467EXPORT_SYMBOL(acpi_run_osc); 477EXPORT_SYMBOL(acpi_run_osc);
@@ -888,6 +898,8 @@ static int __init acpi_bus_init(void)
888 goto error1; 898 goto error1;
889 } 899 }
890 900
901 acpi_early_processor_set_pdc();
902
891 /* 903 /*
892 * Maybe EC region is required at bus_scan/acpi_get_devices. So it 904 * Maybe EC region is required at bus_scan/acpi_get_devices. So it
893 * is necessary to enable it as early as possible. 905 * is necessary to enable it as early as possible.
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 75b147f5c8fd..fd1801bdee66 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -916,6 +916,7 @@ static int ec_validate_ecdt(const struct dmi_system_id *id)
916/* MSI EC needs special treatment, enable it */ 916/* MSI EC needs special treatment, enable it */
917static int ec_flag_msi(const struct dmi_system_id *id) 917static int ec_flag_msi(const struct dmi_system_id *id)
918{ 918{
919 printk(KERN_DEBUG PREFIX "Detected MSI hardware, enabling workarounds.\n");
919 EC_FLAGS_MSI = 1; 920 EC_FLAGS_MSI = 1;
920 EC_FLAGS_VALIDATE_ECDT = 1; 921 EC_FLAGS_VALIDATE_ECDT = 1;
921 return 0; 922 return 0;
@@ -928,8 +929,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
928 DMI_MATCH(DMI_BOARD_NAME, "JFL92") }, NULL}, 929 DMI_MATCH(DMI_BOARD_NAME, "JFL92") }, NULL},
929 { 930 {
930 ec_flag_msi, "MSI hardware", { 931 ec_flag_msi, "MSI hardware", {
931 DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star"), 932 DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star")}, NULL},
932 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star") }, NULL}, 933 {
934 ec_flag_msi, "MSI hardware", {
935 DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star")}, NULL},
936 {
937 ec_flag_msi, "MSI hardware", {
938 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL},
933 { 939 {
934 ec_validate_ecdt, "ASUS hardware", { 940 ec_validate_ecdt, "ASUS hardware", {
935 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, 941 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 074cf8682d52..cb28e0502acc 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -43,6 +43,7 @@ int acpi_power_transition(struct acpi_device *device, int state);
43extern int acpi_power_nocheck; 43extern int acpi_power_nocheck;
44 44
45int acpi_wakeup_device_init(void); 45int acpi_wakeup_device_init(void);
46void acpi_early_processor_set_pdc(void);
46 47
47/* -------------------------------------------------------------------------- 48/* --------------------------------------------------------------------------
48 Embedded Controller 49 Embedded Controller
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 41731236f9a1..9863c98c81ba 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -124,29 +124,6 @@ static const struct file_operations acpi_processor_info_fops = {
124 124
125DEFINE_PER_CPU(struct acpi_processor *, processors); 125DEFINE_PER_CPU(struct acpi_processor *, processors);
126struct acpi_processor_errata errata __read_mostly; 126struct acpi_processor_errata errata __read_mostly;
127static int set_no_mwait(const struct dmi_system_id *id)
128{
129 printk(KERN_NOTICE PREFIX "%s detected - "
130 "disabling mwait for CPU C-states\n", id->ident);
131 idle_nomwait = 1;
132 return 0;
133}
134
135static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
136 {
137 set_no_mwait, "IFL91 board", {
138 DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
139 DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"),
140 DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"),
141 DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL},
142 {
143 set_no_mwait, "Extensa 5220", {
144 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
145 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
146 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
147 DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
148 {},
149};
150 127
151/* -------------------------------------------------------------------------- 128/* --------------------------------------------------------------------------
152 Errata Handling 129 Errata Handling
@@ -277,45 +254,6 @@ static int acpi_processor_errata(struct acpi_processor *pr)
277} 254}
278 255
279/* -------------------------------------------------------------------------- 256/* --------------------------------------------------------------------------
280 Common ACPI processor functions
281 -------------------------------------------------------------------------- */
282
283/*
284 * _PDC is required for a BIOS-OS handshake for most of the newer
285 * ACPI processor features.
286 */
287static int acpi_processor_set_pdc(struct acpi_processor *pr)
288{
289 struct acpi_object_list *pdc_in = pr->pdc;
290 acpi_status status = AE_OK;
291
292
293 if (!pdc_in)
294 return status;
295 if (idle_nomwait) {
296 /*
297 * If mwait is disabled for CPU C-states, the C2C3_FFH access
298 * mode will be disabled in the parameter of _PDC object.
299 * Of course C1_FFH access mode will also be disabled.
300 */
301 union acpi_object *obj;
302 u32 *buffer = NULL;
303
304 obj = pdc_in->pointer;
305 buffer = (u32 *)(obj->buffer.pointer);
306 buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
307
308 }
309 status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL);
310
311 if (ACPI_FAILURE(status))
312 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
313 "Could not evaluate _PDC, using legacy perf. control...\n"));
314
315 return status;
316}
317
318/* --------------------------------------------------------------------------
319 FS Interface (/proc) 257 FS Interface (/proc)
320 -------------------------------------------------------------------------- */ 258 -------------------------------------------------------------------------- */
321 259
@@ -825,9 +763,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
825 } 763 }
826 764
827 /* _PDC call should be done before doing anything else (if reqd.). */ 765 /* _PDC call should be done before doing anything else (if reqd.). */
828 arch_acpi_processor_init_pdc(pr); 766 acpi_processor_set_pdc(pr->handle);
829 acpi_processor_set_pdc(pr);
830 arch_acpi_processor_cleanup_pdc(pr);
831 767
832#ifdef CONFIG_CPU_FREQ 768#ifdef CONFIG_CPU_FREQ
833 acpi_processor_ppc_has_changed(pr, 0); 769 acpi_processor_ppc_has_changed(pr, 0);
@@ -1145,11 +1081,6 @@ static int __init acpi_processor_init(void)
1145 if (!acpi_processor_dir) 1081 if (!acpi_processor_dir)
1146 return -ENOMEM; 1082 return -ENOMEM;
1147#endif 1083#endif
1148 /*
1149 * Check whether the system is DMI table. If yes, OSPM
1150 * should not use mwait for CPU-states.
1151 */
1152 dmi_check_system(processor_idle_dmi_table);
1153 result = cpuidle_register_driver(&acpi_idle_driver); 1084 result = cpuidle_register_driver(&acpi_idle_driver);
1154 if (result < 0) 1085 if (result < 0)
1155 goto out_proc; 1086 goto out_proc;
diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c
new file mode 100644
index 000000000000..30e4dc0cdf30
--- /dev/null
+++ b/drivers/acpi/processor_pdc.c
@@ -0,0 +1,165 @@
1/*
2 * Copyright (C) 2005 Intel Corporation
3 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
4 *
5 * Alex Chiang <achiang@hp.com>
6 * - Unified x86/ia64 implementations
7 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
8 * - Added _PDC for platforms with Intel CPUs
9 */
10#include <linux/dmi.h>
11
12#include <acpi/acpi_drivers.h>
13#include <acpi/processor.h>
14
15#include "internal.h"
16
17#define PREFIX "ACPI: "
18#define _COMPONENT ACPI_PROCESSOR_COMPONENT
19ACPI_MODULE_NAME("processor_pdc");
20
21static int set_no_mwait(const struct dmi_system_id *id)
22{
23 printk(KERN_NOTICE PREFIX "%s detected - "
24 "disabling mwait for CPU C-states\n", id->ident);
25 idle_nomwait = 1;
26 return 0;
27}
28
29static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = {
30 {
31 set_no_mwait, "IFL91 board", {
32 DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
33 DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"),
34 DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"),
35 DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL},
36 {
37 set_no_mwait, "Extensa 5220", {
38 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
39 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
40 DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
41 DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL},
42 {},
43};
44
45static void acpi_set_pdc_bits(u32 *buf)
46{
47 buf[0] = ACPI_PDC_REVISION_ID;
48 buf[1] = 1;
49
50 /* Enable coordination with firmware's _TSD info */
51 buf[2] = ACPI_PDC_SMP_T_SWCOORD;
52
53 /* Twiddle arch-specific bits needed for _PDC */
54 arch_acpi_set_pdc_bits(buf);
55}
56
57static struct acpi_object_list *acpi_processor_alloc_pdc(void)
58{
59 struct acpi_object_list *obj_list;
60 union acpi_object *obj;
61 u32 *buf;
62
63 /* allocate and initialize pdc. It will be used later. */
64 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
65 if (!obj_list) {
66 printk(KERN_ERR "Memory allocation error\n");
67 return NULL;
68 }
69
70 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
71 if (!obj) {
72 printk(KERN_ERR "Memory allocation error\n");
73 kfree(obj_list);
74 return NULL;
75 }
76
77 buf = kmalloc(12, GFP_KERNEL);
78 if (!buf) {
79 printk(KERN_ERR "Memory allocation error\n");
80 kfree(obj);
81 kfree(obj_list);
82 return NULL;
83 }
84
85 acpi_set_pdc_bits(buf);
86
87 obj->type = ACPI_TYPE_BUFFER;
88 obj->buffer.length = 12;
89 obj->buffer.pointer = (u8 *) buf;
90 obj_list->count = 1;
91 obj_list->pointer = obj;
92
93 return obj_list;
94}
95
96/*
97 * _PDC is required for a BIOS-OS handshake for most of the newer
98 * ACPI processor features.
99 */
100static int
101acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
102{
103 acpi_status status = AE_OK;
104
105 if (idle_nomwait) {
106 /*
107 * If mwait is disabled for CPU C-states, the C2C3_FFH access
108 * mode will be disabled in the parameter of _PDC object.
109 * Of course C1_FFH access mode will also be disabled.
110 */
111 union acpi_object *obj;
112 u32 *buffer = NULL;
113
114 obj = pdc_in->pointer;
115 buffer = (u32 *)(obj->buffer.pointer);
116 buffer[2] &= ~(ACPI_PDC_C_C2C3_FFH | ACPI_PDC_C_C1_FFH);
117
118 }
119 status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL);
120
121 if (ACPI_FAILURE(status))
122 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
123 "Could not evaluate _PDC, using legacy perf. control.\n"));
124
125 return status;
126}
127
128void acpi_processor_set_pdc(acpi_handle handle)
129{
130 struct acpi_object_list *obj_list;
131
132 if (arch_has_acpi_pdc() == false)
133 return;
134
135 obj_list = acpi_processor_alloc_pdc();
136 if (!obj_list)
137 return;
138
139 acpi_processor_eval_pdc(handle, obj_list);
140
141 kfree(obj_list->pointer->buffer.pointer);
142 kfree(obj_list->pointer);
143 kfree(obj_list);
144}
145EXPORT_SYMBOL_GPL(acpi_processor_set_pdc);
146
147static acpi_status
148early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv)
149{
150 acpi_processor_set_pdc(handle);
151 return AE_OK;
152}
153
154void acpi_early_processor_set_pdc(void)
155{
156 /*
157 * Check whether the system is DMI table. If yes, OSPM
158 * should not use mwait for CPU-states.
159 */
160 dmi_check_system(processor_idle_dmi_table);
161
162 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
163 ACPI_UINT32_MAX,
164 early_init_pdc, NULL, NULL, NULL);
165}
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 5f2c379ab7bf..79d33d908b5a 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -81,6 +81,23 @@ static int acpi_sleep_prepare(u32 acpi_state)
81#ifdef CONFIG_ACPI_SLEEP 81#ifdef CONFIG_ACPI_SLEEP
82static u32 acpi_target_sleep_state = ACPI_STATE_S0; 82static u32 acpi_target_sleep_state = ACPI_STATE_S0;
83/* 83/*
84 * According to the ACPI specification the BIOS should make sure that ACPI is
85 * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
86 * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
87 * on such systems during resume. Unfortunately that doesn't help in
88 * particularly pathological cases in which SCI_EN has to be set directly on
89 * resume, although the specification states very clearly that this flag is
90 * owned by the hardware. The set_sci_en_on_resume variable will be set in such
91 * cases.
92 */
93static bool set_sci_en_on_resume;
94
95void __init acpi_set_sci_en_on_resume(void)
96{
97 set_sci_en_on_resume = true;
98}
99
100/*
84 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the 101 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
85 * user to request that behavior by using the 'acpi_old_suspend_ordering' 102 * user to request that behavior by using the 'acpi_old_suspend_ordering'
86 * kernel command line option that causes the following variable to be set. 103 * kernel command line option that causes the following variable to be set.
@@ -170,18 +187,6 @@ static void acpi_pm_end(void)
170#endif /* CONFIG_ACPI_SLEEP */ 187#endif /* CONFIG_ACPI_SLEEP */
171 188
172#ifdef CONFIG_SUSPEND 189#ifdef CONFIG_SUSPEND
173/*
174 * According to the ACPI specification the BIOS should make sure that ACPI is
175 * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
176 * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
177 * on such systems during resume. Unfortunately that doesn't help in
178 * particularly pathological cases in which SCI_EN has to be set directly on
179 * resume, although the specification states very clearly that this flag is
180 * owned by the hardware. The set_sci_en_on_resume variable will be set in such
181 * cases.
182 */
183static bool set_sci_en_on_resume;
184
185extern void do_suspend_lowlevel(void); 190extern void do_suspend_lowlevel(void);
186 191
187static u32 acpi_suspend_states[] = { 192static u32 acpi_suspend_states[] = {
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 05dff631591c..72e76b4b6538 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -999,8 +999,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
999 sprintf(name, "acpi_video%d", count++); 999 sprintf(name, "acpi_video%d", count++);
1000 device->backlight = backlight_device_register(name, 1000 device->backlight = backlight_device_register(name,
1001 NULL, device, &acpi_backlight_ops); 1001 NULL, device, &acpi_backlight_ops);
1002 device->backlight->props.max_brightness = device->brightness->count-3;
1003 kfree(name); 1002 kfree(name);
1003 if (IS_ERR(device->backlight))
1004 return;
1005 device->backlight->props.max_brightness = device->brightness->count-3;
1004 1006
1005 result = sysfs_create_link(&device->backlight->dev.kobj, 1007 result = sysfs_create_link(&device->backlight->dev.kobj,
1006 &device->dev->dev.kobj, "device"); 1008 &device->dev->dev.kobj, "device");
@@ -1979,6 +1981,10 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
1979 unsigned long long level_current, level_next; 1981 unsigned long long level_current, level_next;
1980 int result = -EINVAL; 1982 int result = -EINVAL;
1981 1983
1984 /* no warning message if acpi_backlight=vendor is used */
1985 if (!acpi_video_backlight_support())
1986 return 0;
1987
1982 if (!device->brightness) 1988 if (!device->brightness)
1983 goto out; 1989 goto out;
1984 1990
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 85844d053846..56c6374a3989 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -40,7 +40,6 @@ config ATA_VERBOSE_ERROR
40config ATA_ACPI 40config ATA_ACPI
41 bool "ATA ACPI Support" 41 bool "ATA ACPI Support"
42 depends on ACPI && PCI 42 depends on ACPI && PCI
43 select ACPI_DOCK
44 default y 43 default y
45 help 44 help
46 This option adds support for ATA-related ACPI objects. 45 This option adds support for ATA-related ACPI objects.
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 19136a7e1064..6f3f2257d0f0 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -329,7 +329,7 @@ static struct ata_port_operations ich_pata_ops = {
329}; 329};
330 330
331static struct ata_port_operations piix_sata_ops = { 331static struct ata_port_operations piix_sata_ops = {
332 .inherits = &ata_bmdma_port_ops, 332 .inherits = &ata_bmdma32_port_ops,
333}; 333};
334 334
335static struct ata_port_operations piix_sidpr_sata_ops = { 335static struct ata_port_operations piix_sidpr_sata_ops = {
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 22ff51bdbc8a..6728328f3bea 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3790,21 +3790,45 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params,
3790int sata_link_resume(struct ata_link *link, const unsigned long *params, 3790int sata_link_resume(struct ata_link *link, const unsigned long *params,
3791 unsigned long deadline) 3791 unsigned long deadline)
3792{ 3792{
3793 int tries = ATA_LINK_RESUME_TRIES;
3793 u32 scontrol, serror; 3794 u32 scontrol, serror;
3794 int rc; 3795 int rc;
3795 3796
3796 if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol))) 3797 if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
3797 return rc; 3798 return rc;
3798 3799
3799 scontrol = (scontrol & 0x0f0) | 0x300; 3800 /*
3801 * Writes to SControl sometimes get ignored under certain
3802 * controllers (ata_piix SIDPR). Make sure DET actually is
3803 * cleared.
3804 */
3805 do {
3806 scontrol = (scontrol & 0x0f0) | 0x300;
3807 if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol)))
3808 return rc;
3809 /*
3810 * Some PHYs react badly if SStatus is pounded
3811 * immediately after resuming. Delay 200ms before
3812 * debouncing.
3813 */
3814 msleep(200);
3800 3815
3801 if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol))) 3816 /* is SControl restored correctly? */
3802 return rc; 3817 if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
3818 return rc;
3819 } while ((scontrol & 0xf0f) != 0x300 && --tries);
3803 3820
3804 /* Some PHYs react badly if SStatus is pounded immediately 3821 if ((scontrol & 0xf0f) != 0x300) {
3805 * after resuming. Delay 200ms before debouncing. 3822 ata_link_printk(link, KERN_ERR,
3806 */ 3823 "failed to resume link (SControl %X)\n",
3807 msleep(200); 3824 scontrol);
3825 return 0;
3826 }
3827
3828 if (tries < ATA_LINK_RESUME_TRIES)
3829 ata_link_printk(link, KERN_WARNING,
3830 "link resume succeeded after %d retries\n",
3831 ATA_LINK_RESUME_TRIES - tries);
3808 3832
3809 if ((rc = sata_link_debounce(link, params, deadline))) 3833 if ((rc = sata_link_debounce(link, params, deadline)))
3810 return rc; 3834 return rc;
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1683ebda900b..f4ea5a8c325b 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3022,7 +3022,7 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
3022 case WRITE_16: 3022 case WRITE_16:
3023 return ata_scsi_rw_xlat; 3023 return ata_scsi_rw_xlat;
3024 3024
3025 case 0x93 /*WRITE_SAME_16*/: 3025 case WRITE_SAME_16:
3026 return ata_scsi_write_same_xlat; 3026 return ata_scsi_write_same_xlat;
3027 3027
3028 case SYNCHRONIZE_CACHE: 3028 case SYNCHRONIZE_CACHE:
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index efa8773bef5a..741065c9da67 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -2275,7 +2275,7 @@ void ata_sff_drain_fifo(struct ata_queued_cmd *qc)
2275 ap = qc->ap; 2275 ap = qc->ap;
2276 /* Drain up to 64K of data before we give up this recovery method */ 2276 /* Drain up to 64K of data before we give up this recovery method */
2277 for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ) 2277 for (count = 0; (ap->ops->sff_check_status(ap) & ATA_DRQ)
2278 && count < 32768; count++) 2278 && count < 65536; count += 2)
2279 ioread16(ap->ioaddr.data_addr); 2279 ioread16(ap->ioaddr.data_addr);
2280 2280
2281 /* Can become DEBUG later */ 2281 /* Can become DEBUG later */
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index c4b47a3e5446..02c81f12c702 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1557,6 +1557,25 @@ static unsigned short atapi_io_port[] = {
1557 P_ATAPI_DMARQ, 1557 P_ATAPI_DMARQ,
1558 P_ATAPI_INTRQ, 1558 P_ATAPI_INTRQ,
1559 P_ATAPI_IORDY, 1559 P_ATAPI_IORDY,
1560 P_ATAPI_D0A,
1561 P_ATAPI_D1A,
1562 P_ATAPI_D2A,
1563 P_ATAPI_D3A,
1564 P_ATAPI_D4A,
1565 P_ATAPI_D5A,
1566 P_ATAPI_D6A,
1567 P_ATAPI_D7A,
1568 P_ATAPI_D8A,
1569 P_ATAPI_D9A,
1570 P_ATAPI_D10A,
1571 P_ATAPI_D11A,
1572 P_ATAPI_D12A,
1573 P_ATAPI_D13A,
1574 P_ATAPI_D14A,
1575 P_ATAPI_D15A,
1576 P_ATAPI_A0A,
1577 P_ATAPI_A1A,
1578 P_ATAPI_A2A,
1560 0 1579 0
1561}; 1580};
1562 1581
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index dadfc358ba1c..0efb1f58f255 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -31,7 +31,7 @@
31#include <linux/libata.h> 31#include <linux/libata.h>
32 32
33#define DRV_NAME "pata_cmd64x" 33#define DRV_NAME "pata_cmd64x"
34#define DRV_VERSION "0.3.1" 34#define DRV_VERSION "0.2.5"
35 35
36/* 36/*
37 * CMD64x specific registers definition. 37 * CMD64x specific registers definition.
@@ -219,7 +219,7 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
219 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; 219 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
220 /* Merge the control bits */ 220 /* Merge the control bits */
221 regU |= 1 << adev->devno; /* UDMA on */ 221 regU |= 1 << adev->devno; /* UDMA on */
222 if (adev->dma_mode > 2) /* 15nS timing */ 222 if (adev->dma_mode > XFER_UDMA_2) /* 15nS timing */
223 regU |= 4 << adev->devno; 223 regU |= 4 << adev->devno;
224 } else { 224 } else {
225 regU &= ~ (1 << adev->devno); /* UDMA off */ 225 regU &= ~ (1 << adev->devno); /* UDMA off */
@@ -254,109 +254,17 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc)
254} 254}
255 255
256/** 256/**
257 * cmd64x_bmdma_stop - DMA stop callback 257 * cmd646r1_dma_stop - DMA stop callback
258 * @qc: Command in progress 258 * @qc: Command in progress
259 * 259 *
260 * Track the completion of live DMA commands and clear the 260 * Stub for now while investigating the r1 quirk in the old driver.
261 * host->private_data DMA tracking flag as we do.
262 */ 261 */
263 262
264static void cmd64x_bmdma_stop(struct ata_queued_cmd *qc) 263static void cmd646r1_bmdma_stop(struct ata_queued_cmd *qc)
265{ 264{
266 struct ata_port *ap = qc->ap;
267 ata_bmdma_stop(qc); 265 ata_bmdma_stop(qc);
268 WARN_ON(ap->host->private_data != ap);
269 ap->host->private_data = NULL;
270}
271
272/**
273 * cmd64x_qc_defer - Defer logic for chip limits
274 * @qc: queued command
275 *
276 * Decide whether we can issue the command. Called under the host lock.
277 */
278
279static int cmd64x_qc_defer(struct ata_queued_cmd *qc)
280{
281 struct ata_host *host = qc->ap->host;
282 struct ata_port *alt = host->ports[1 ^ qc->ap->port_no];
283 int rc;
284 int dma = 0;
285
286 /* Apply the ATA rules first */
287 rc = ata_std_qc_defer(qc);
288 if (rc)
289 return rc;
290
291 if (qc->tf.protocol == ATAPI_PROT_DMA ||
292 qc->tf.protocol == ATA_PROT_DMA)
293 dma = 1;
294
295 /* If the other port is not live then issue the command */
296 if (alt == NULL || !alt->qc_active) {
297 if (dma)
298 host->private_data = qc->ap;
299 return 0;
300 }
301 /* If there is a live DMA command then wait */
302 if (host->private_data != NULL)
303 return ATA_DEFER_PORT;
304 if (dma)
305 /* Cannot overlap our DMA command */
306 return ATA_DEFER_PORT;
307 return 0;
308} 266}
309 267
310/**
311 * cmd64x_interrupt - ATA host interrupt handler
312 * @irq: irq line (unused)
313 * @dev_instance: pointer to our ata_host information structure
314 *
315 * Our interrupt handler for PCI IDE devices. Calls
316 * ata_sff_host_intr() for each port that is flagging an IRQ. We cannot
317 * use the defaults as we need to avoid touching status/altstatus during
318 * a DMA.
319 *
320 * LOCKING:
321 * Obtains host lock during operation.
322 *
323 * RETURNS:
324 * IRQ_NONE or IRQ_HANDLED.
325 */
326irqreturn_t cmd64x_interrupt(int irq, void *dev_instance)
327{
328 struct ata_host *host = dev_instance;
329 struct pci_dev *pdev = to_pci_dev(host->dev);
330 unsigned int i;
331 unsigned int handled = 0;
332 unsigned long flags;
333 static const u8 irq_reg[2] = { CFR, ARTTIM23 };
334 static const u8 irq_mask[2] = { 1 << 2, 1 << 4 };
335
336 /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
337 spin_lock_irqsave(&host->lock, flags);
338
339 for (i = 0; i < host->n_ports; i++) {
340 struct ata_port *ap;
341 u8 reg;
342
343 pci_read_config_byte(pdev, irq_reg[i], &reg);
344 ap = host->ports[i];
345 if (ap && (reg & irq_mask[i]) &&
346 !(ap->flags & ATA_FLAG_DISABLED)) {
347 struct ata_queued_cmd *qc;
348
349 qc = ata_qc_from_tag(ap, ap->link.active_tag);
350 if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
351 (qc->flags & ATA_QCFLAG_ACTIVE))
352 handled |= ata_sff_host_intr(ap, qc);
353 }
354 }
355
356 spin_unlock_irqrestore(&host->lock, flags);
357
358 return IRQ_RETVAL(handled);
359}
360static struct scsi_host_template cmd64x_sht = { 268static struct scsi_host_template cmd64x_sht = {
361 ATA_BMDMA_SHT(DRV_NAME), 269 ATA_BMDMA_SHT(DRV_NAME),
362}; 270};
@@ -365,8 +273,6 @@ static const struct ata_port_operations cmd64x_base_ops = {
365 .inherits = &ata_bmdma_port_ops, 273 .inherits = &ata_bmdma_port_ops,
366 .set_piomode = cmd64x_set_piomode, 274 .set_piomode = cmd64x_set_piomode,
367 .set_dmamode = cmd64x_set_dmamode, 275 .set_dmamode = cmd64x_set_dmamode,
368 .bmdma_stop = cmd64x_bmdma_stop,
369 .qc_defer = cmd64x_qc_defer,
370}; 276};
371 277
372static struct ata_port_operations cmd64x_port_ops = { 278static struct ata_port_operations cmd64x_port_ops = {
@@ -376,6 +282,7 @@ static struct ata_port_operations cmd64x_port_ops = {
376 282
377static struct ata_port_operations cmd646r1_port_ops = { 283static struct ata_port_operations cmd646r1_port_ops = {
378 .inherits = &cmd64x_base_ops, 284 .inherits = &cmd64x_base_ops,
285 .bmdma_stop = cmd646r1_bmdma_stop,
379 .cable_detect = ata_cable_40wire, 286 .cable_detect = ata_cable_40wire,
380}; 287};
381 288
@@ -383,7 +290,6 @@ static struct ata_port_operations cmd648_port_ops = {
383 .inherits = &cmd64x_base_ops, 290 .inherits = &cmd64x_base_ops,
384 .bmdma_stop = cmd648_bmdma_stop, 291 .bmdma_stop = cmd648_bmdma_stop,
385 .cable_detect = cmd648_cable_detect, 292 .cable_detect = cmd648_cable_detect,
386 .qc_defer = ata_std_qc_defer
387}; 293};
388 294
389static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 295static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -432,7 +338,6 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
432 const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL }; 338 const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL };
433 u8 mrdmode; 339 u8 mrdmode;
434 int rc; 340 int rc;
435 struct ata_host *host;
436 341
437 rc = pcim_enable_device(pdev); 342 rc = pcim_enable_device(pdev);
438 if (rc) 343 if (rc)
@@ -450,25 +355,20 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
450 ppi[0] = &cmd_info[3]; 355 ppi[0] = &cmd_info[3];
451 } 356 }
452 357
453
454 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); 358 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64);
455 pci_read_config_byte(pdev, MRDMODE, &mrdmode); 359 pci_read_config_byte(pdev, MRDMODE, &mrdmode);
456 mrdmode &= ~ 0x30; /* IRQ set up */ 360 mrdmode &= ~ 0x30; /* IRQ set up */
457 mrdmode |= 0x02; /* Memory read line enable */ 361 mrdmode |= 0x02; /* Memory read line enable */
458 pci_write_config_byte(pdev, MRDMODE, mrdmode); 362 pci_write_config_byte(pdev, MRDMODE, mrdmode);
459 363
364 /* Force PIO 0 here.. */
365
460 /* PPC specific fixup copied from old driver */ 366 /* PPC specific fixup copied from old driver */
461#ifdef CONFIG_PPC 367#ifdef CONFIG_PPC
462 pci_write_config_byte(pdev, UDIDETCR0, 0xF0); 368 pci_write_config_byte(pdev, UDIDETCR0, 0xF0);
463#endif 369#endif
464 rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
465 if (rc)
466 return rc;
467 /* We use this pointer to track the AP which has DMA running */
468 host->private_data = NULL;
469 370
470 pci_set_master(pdev); 371 return ata_pci_sff_init_one(pdev, ppi, &cmd64x_sht, NULL);
471 return ata_pci_sff_activate_host(host, cmd64x_interrupt, &cmd64x_sht);
472} 372}
473 373
474#ifdef CONFIG_PM 374#ifdef CONFIG_PM
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 9a09a1b11ca5..dd26bc73bd9a 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -8,7 +8,7 @@
8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
9 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 9 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
10 * Portions Copyright (C) 2003 Red Hat Inc 10 * Portions Copyright (C) 2003 Red Hat Inc
11 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. 11 * Portions Copyright (C) 2005-2009 MontaVista Software, Inc.
12 * 12 *
13 * 13 *
14 * TODO 14 * TODO
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3.7" 28#define DRV_VERSION "0.3.8"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -264,7 +264,7 @@ static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc)
264 264
265static void hpt3x2n_set_clock(struct ata_port *ap, int source) 265static void hpt3x2n_set_clock(struct ata_port *ap, int source)
266{ 266{
267 void __iomem *bmdma = ap->ioaddr.bmdma_addr; 267 void __iomem *bmdma = ap->ioaddr.bmdma_addr - ap->port_no * 8;
268 268
269 /* Tristate the bus */ 269 /* Tristate the bus */
270 iowrite8(0x80, bmdma+0x73); 270 iowrite8(0x80, bmdma+0x73);
@@ -274,9 +274,9 @@ static void hpt3x2n_set_clock(struct ata_port *ap, int source)
274 iowrite8(source, bmdma+0x7B); 274 iowrite8(source, bmdma+0x7B);
275 iowrite8(0xC0, bmdma+0x79); 275 iowrite8(0xC0, bmdma+0x79);
276 276
277 /* Reset state machines */ 277 /* Reset state machines, avoid enabling the disabled channels */
278 iowrite8(0x37, bmdma+0x70); 278 iowrite8(ioread8(bmdma+0x70) | 0x32, bmdma+0x70);
279 iowrite8(0x37, bmdma+0x74); 279 iowrite8(ioread8(bmdma+0x74) | 0x32, bmdma+0x74);
280 280
281 /* Complete reset */ 281 /* Complete reset */
282 iowrite8(0x00, bmdma+0x79); 282 iowrite8(0x00, bmdma+0x79);
@@ -286,21 +286,10 @@ static void hpt3x2n_set_clock(struct ata_port *ap, int source)
286 iowrite8(0x00, bmdma+0x77); 286 iowrite8(0x00, bmdma+0x77);
287} 287}
288 288
289/* Check if our partner interface is busy */
290
291static int hpt3x2n_pair_idle(struct ata_port *ap)
292{
293 struct ata_host *host = ap->host;
294 struct ata_port *pair = host->ports[ap->port_no ^ 1];
295
296 if (pair->hsm_task_state == HSM_ST_IDLE)
297 return 1;
298 return 0;
299}
300
301static int hpt3x2n_use_dpll(struct ata_port *ap, int writing) 289static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
302{ 290{
303 long flags = (long)ap->host->private_data; 291 long flags = (long)ap->host->private_data;
292
304 /* See if we should use the DPLL */ 293 /* See if we should use the DPLL */
305 if (writing) 294 if (writing)
306 return USE_DPLL; /* Needed for write */ 295 return USE_DPLL; /* Needed for write */
@@ -309,20 +298,35 @@ static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
309 return 0; 298 return 0;
310} 299}
311 300
301static int hpt3x2n_qc_defer(struct ata_queued_cmd *qc)
302{
303 struct ata_port *ap = qc->ap;
304 struct ata_port *alt = ap->host->ports[ap->port_no ^ 1];
305 int rc, flags = (long)ap->host->private_data;
306 int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE);
307
308 /* First apply the usual rules */
309 rc = ata_std_qc_defer(qc);
310 if (rc != 0)
311 return rc;
312
313 if ((flags & USE_DPLL) != dpll && alt->qc_active)
314 return ATA_DEFER_PORT;
315 return 0;
316}
317
312static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc) 318static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc)
313{ 319{
314 struct ata_taskfile *tf = &qc->tf;
315 struct ata_port *ap = qc->ap; 320 struct ata_port *ap = qc->ap;
316 int flags = (long)ap->host->private_data; 321 int flags = (long)ap->host->private_data;
322 int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE);
317 323
318 if (hpt3x2n_pair_idle(ap)) { 324 if ((flags & USE_DPLL) != dpll) {
319 int dpll = hpt3x2n_use_dpll(ap, (tf->flags & ATA_TFLAG_WRITE)); 325 flags &= ~USE_DPLL;
320 if ((flags & USE_DPLL) != dpll) { 326 flags |= dpll;
321 if (dpll == 1) 327 ap->host->private_data = (void *)(long)flags;
322 hpt3x2n_set_clock(ap, 0x21); 328
323 else 329 hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23);
324 hpt3x2n_set_clock(ap, 0x23);
325 }
326 } 330 }
327 return ata_sff_qc_issue(qc); 331 return ata_sff_qc_issue(qc);
328} 332}
@@ -339,6 +343,8 @@ static struct ata_port_operations hpt3x2n_port_ops = {
339 .inherits = &ata_bmdma_port_ops, 343 .inherits = &ata_bmdma_port_ops,
340 344
341 .bmdma_stop = hpt3x2n_bmdma_stop, 345 .bmdma_stop = hpt3x2n_bmdma_stop,
346
347 .qc_defer = hpt3x2n_qc_defer,
342 .qc_issue = hpt3x2n_qc_issue, 348 .qc_issue = hpt3x2n_qc_issue,
343 349
344 .cable_detect = hpt3x2n_cable_detect, 350 .cable_detect = hpt3x2n_cable_detect,
@@ -454,7 +460,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
454 unsigned int f_low, f_high; 460 unsigned int f_low, f_high;
455 int adjust; 461 int adjust;
456 unsigned long iobase = pci_resource_start(dev, 4); 462 unsigned long iobase = pci_resource_start(dev, 4);
457 void *hpriv = NULL; 463 void *hpriv = (void *)USE_DPLL;
458 int rc; 464 int rc;
459 465
460 rc = pcim_enable_device(dev); 466 rc = pcim_enable_device(dev);
@@ -539,7 +545,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
539 /* Set our private data up. We only need a few flags so we use 545 /* Set our private data up. We only need a few flags so we use
540 it directly */ 546 it directly */
541 if (pci_mhz > 60) { 547 if (pci_mhz > 60) {
542 hpriv = (void *)PCI66; 548 hpriv = (void *)(PCI66 | USE_DPLL);
543 /* 549 /*
544 * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in 550 * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in
545 * the MISC. register to stretch the UltraDMA Tss timing. 551 * the MISC. register to stretch the UltraDMA Tss timing.
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index d6f69561dc86..37ef416c1242 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -853,7 +853,7 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev)
853 return -EINVAL; 853 return -EINVAL;
854 854
855 cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start, 855 cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start,
856 res_cs0->end - res_cs1->start + 1); 856 resource_size(res_cs1));
857 857
858 if (!cs1) 858 if (!cs1)
859 return -ENOMEM; 859 return -ENOMEM;
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index a8a7be0d06ff..df8ee325d3ca 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -59,6 +59,7 @@
59#include <linux/dmapool.h> 59#include <linux/dmapool.h>
60#include <linux/dma-mapping.h> 60#include <linux/dma-mapping.h>
61#include <linux/device.h> 61#include <linux/device.h>
62#include <linux/clk.h>
62#include <linux/platform_device.h> 63#include <linux/platform_device.h>
63#include <linux/ata_platform.h> 64#include <linux/ata_platform.h>
64#include <linux/mbus.h> 65#include <linux/mbus.h>
@@ -538,6 +539,7 @@ struct mv_port_signal {
538 539
539struct mv_host_priv { 540struct mv_host_priv {
540 u32 hp_flags; 541 u32 hp_flags;
542 unsigned int board_idx;
541 u32 main_irq_mask; 543 u32 main_irq_mask;
542 struct mv_port_signal signal[8]; 544 struct mv_port_signal signal[8];
543 const struct mv_hw_ops *ops; 545 const struct mv_hw_ops *ops;
@@ -548,6 +550,10 @@ struct mv_host_priv {
548 u32 irq_cause_offset; 550 u32 irq_cause_offset;
549 u32 irq_mask_offset; 551 u32 irq_mask_offset;
550 u32 unmask_all_irqs; 552 u32 unmask_all_irqs;
553
554#if defined(CONFIG_HAVE_CLK)
555 struct clk *clk;
556#endif
551 /* 557 /*
552 * These consistent DMA memory pools give us guaranteed 558 * These consistent DMA memory pools give us guaranteed
553 * alignment for hardware-accessed data structures, 559 * alignment for hardware-accessed data structures,
@@ -2775,7 +2781,7 @@ static void mv_port_intr(struct ata_port *ap, u32 port_cause)
2775 struct mv_port_priv *pp; 2781 struct mv_port_priv *pp;
2776 int edma_was_enabled; 2782 int edma_was_enabled;
2777 2783
2778 if (!ap || (ap->flags & ATA_FLAG_DISABLED)) { 2784 if (ap->flags & ATA_FLAG_DISABLED) {
2779 mv_unexpected_intr(ap, 0); 2785 mv_unexpected_intr(ap, 0);
2780 return; 2786 return;
2781 } 2787 }
@@ -3393,7 +3399,7 @@ static void mv_soc_reset_hc_port(struct mv_host_priv *hpriv,
3393 ZERO(0x024); /* respq outp */ 3399 ZERO(0x024); /* respq outp */
3394 ZERO(0x020); /* respq inp */ 3400 ZERO(0x020); /* respq inp */
3395 ZERO(0x02c); /* test control */ 3401 ZERO(0x02c); /* test control */
3396 writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); 3402 writel(0x800, port_mmio + EDMA_IORDY_TMOUT);
3397} 3403}
3398 3404
3399#undef ZERO 3405#undef ZERO
@@ -3854,7 +3860,6 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3854/** 3860/**
3855 * mv_init_host - Perform some early initialization of the host. 3861 * mv_init_host - Perform some early initialization of the host.
3856 * @host: ATA host to initialize 3862 * @host: ATA host to initialize
3857 * @board_idx: controller index
3858 * 3863 *
3859 * If possible, do an early global reset of the host. Then do 3864 * If possible, do an early global reset of the host. Then do
3860 * our port init and clear/unmask all/relevant host interrupts. 3865 * our port init and clear/unmask all/relevant host interrupts.
@@ -3862,13 +3867,13 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3862 * LOCKING: 3867 * LOCKING:
3863 * Inherited from caller. 3868 * Inherited from caller.
3864 */ 3869 */
3865static int mv_init_host(struct ata_host *host, unsigned int board_idx) 3870static int mv_init_host(struct ata_host *host)
3866{ 3871{
3867 int rc = 0, n_hc, port, hc; 3872 int rc = 0, n_hc, port, hc;
3868 struct mv_host_priv *hpriv = host->private_data; 3873 struct mv_host_priv *hpriv = host->private_data;
3869 void __iomem *mmio = hpriv->base; 3874 void __iomem *mmio = hpriv->base;
3870 3875
3871 rc = mv_chip_id(host, board_idx); 3876 rc = mv_chip_id(host, hpriv->board_idx);
3872 if (rc) 3877 if (rc)
3873 goto done; 3878 goto done;
3874 3879
@@ -3905,14 +3910,6 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3905 void __iomem *port_mmio = mv_port_base(mmio, port); 3910 void __iomem *port_mmio = mv_port_base(mmio, port);
3906 3911
3907 mv_port_init(&ap->ioaddr, port_mmio); 3912 mv_port_init(&ap->ioaddr, port_mmio);
3908
3909#ifdef CONFIG_PCI
3910 if (!IS_SOC(hpriv)) {
3911 unsigned int offset = port_mmio - mmio;
3912 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio");
3913 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port");
3914 }
3915#endif
3916 } 3913 }
3917 3914
3918 for (hc = 0; hc < n_hc; hc++) { 3915 for (hc = 0; hc < n_hc; hc++) {
@@ -4035,12 +4032,21 @@ static int mv_platform_probe(struct platform_device *pdev)
4035 return -ENOMEM; 4032 return -ENOMEM;
4036 host->private_data = hpriv; 4033 host->private_data = hpriv;
4037 hpriv->n_ports = n_ports; 4034 hpriv->n_ports = n_ports;
4035 hpriv->board_idx = chip_soc;
4038 4036
4039 host->iomap = NULL; 4037 host->iomap = NULL;
4040 hpriv->base = devm_ioremap(&pdev->dev, res->start, 4038 hpriv->base = devm_ioremap(&pdev->dev, res->start,
4041 resource_size(res)); 4039 resource_size(res));
4042 hpriv->base -= SATAHC0_REG_BASE; 4040 hpriv->base -= SATAHC0_REG_BASE;
4043 4041
4042#if defined(CONFIG_HAVE_CLK)
4043 hpriv->clk = clk_get(&pdev->dev, NULL);
4044 if (IS_ERR(hpriv->clk))
4045 dev_notice(&pdev->dev, "cannot get clkdev\n");
4046 else
4047 clk_enable(hpriv->clk);
4048#endif
4049
4044 /* 4050 /*
4045 * (Re-)program MBUS remapping windows if we are asked to. 4051 * (Re-)program MBUS remapping windows if we are asked to.
4046 */ 4052 */
@@ -4049,12 +4055,12 @@ static int mv_platform_probe(struct platform_device *pdev)
4049 4055
4050 rc = mv_create_dma_pools(hpriv, &pdev->dev); 4056 rc = mv_create_dma_pools(hpriv, &pdev->dev);
4051 if (rc) 4057 if (rc)
4052 return rc; 4058 goto err;
4053 4059
4054 /* initialize adapter */ 4060 /* initialize adapter */
4055 rc = mv_init_host(host, chip_soc); 4061 rc = mv_init_host(host);
4056 if (rc) 4062 if (rc)
4057 return rc; 4063 goto err;
4058 4064
4059 dev_printk(KERN_INFO, &pdev->dev, 4065 dev_printk(KERN_INFO, &pdev->dev,
4060 "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH, 4066 "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH,
@@ -4062,6 +4068,15 @@ static int mv_platform_probe(struct platform_device *pdev)
4062 4068
4063 return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, 4069 return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt,
4064 IRQF_SHARED, &mv6_sht); 4070 IRQF_SHARED, &mv6_sht);
4071err:
4072#if defined(CONFIG_HAVE_CLK)
4073 if (!IS_ERR(hpriv->clk)) {
4074 clk_disable(hpriv->clk);
4075 clk_put(hpriv->clk);
4076 }
4077#endif
4078
4079 return rc;
4065} 4080}
4066 4081
4067/* 4082/*
@@ -4076,14 +4091,66 @@ static int __devexit mv_platform_remove(struct platform_device *pdev)
4076{ 4091{
4077 struct device *dev = &pdev->dev; 4092 struct device *dev = &pdev->dev;
4078 struct ata_host *host = dev_get_drvdata(dev); 4093 struct ata_host *host = dev_get_drvdata(dev);
4079 4094#if defined(CONFIG_HAVE_CLK)
4095 struct mv_host_priv *hpriv = host->private_data;
4096#endif
4080 ata_host_detach(host); 4097 ata_host_detach(host);
4098
4099#if defined(CONFIG_HAVE_CLK)
4100 if (!IS_ERR(hpriv->clk)) {
4101 clk_disable(hpriv->clk);
4102 clk_put(hpriv->clk);
4103 }
4104#endif
4081 return 0; 4105 return 0;
4082} 4106}
4083 4107
4108#ifdef CONFIG_PM
4109static int mv_platform_suspend(struct platform_device *pdev, pm_message_t state)
4110{
4111 struct ata_host *host = dev_get_drvdata(&pdev->dev);
4112 if (host)
4113 return ata_host_suspend(host, state);
4114 else
4115 return 0;
4116}
4117
4118static int mv_platform_resume(struct platform_device *pdev)
4119{
4120 struct ata_host *host = dev_get_drvdata(&pdev->dev);
4121 int ret;
4122
4123 if (host) {
4124 struct mv_host_priv *hpriv = host->private_data;
4125 const struct mv_sata_platform_data *mv_platform_data = \
4126 pdev->dev.platform_data;
4127 /*
4128 * (Re-)program MBUS remapping windows if we are asked to.
4129 */
4130 if (mv_platform_data->dram != NULL)
4131 mv_conf_mbus_windows(hpriv, mv_platform_data->dram);
4132
4133 /* initialize adapter */
4134 ret = mv_init_host(host);
4135 if (ret) {
4136 printk(KERN_ERR DRV_NAME ": Error during HW init\n");
4137 return ret;
4138 }
4139 ata_host_resume(host);
4140 }
4141
4142 return 0;
4143}
4144#else
4145#define mv_platform_suspend NULL
4146#define mv_platform_resume NULL
4147#endif
4148
4084static struct platform_driver mv_platform_driver = { 4149static struct platform_driver mv_platform_driver = {
4085 .probe = mv_platform_probe, 4150 .probe = mv_platform_probe,
4086 .remove = __devexit_p(mv_platform_remove), 4151 .remove = __devexit_p(mv_platform_remove),
4152 .suspend = mv_platform_suspend,
4153 .resume = mv_platform_resume,
4087 .driver = { 4154 .driver = {
4088 .name = DRV_NAME, 4155 .name = DRV_NAME,
4089 .owner = THIS_MODULE, 4156 .owner = THIS_MODULE,
@@ -4094,6 +4161,9 @@ static struct platform_driver mv_platform_driver = {
4094#ifdef CONFIG_PCI 4161#ifdef CONFIG_PCI
4095static int mv_pci_init_one(struct pci_dev *pdev, 4162static int mv_pci_init_one(struct pci_dev *pdev,
4096 const struct pci_device_id *ent); 4163 const struct pci_device_id *ent);
4164#ifdef CONFIG_PM
4165static int mv_pci_device_resume(struct pci_dev *pdev);
4166#endif
4097 4167
4098 4168
4099static struct pci_driver mv_pci_driver = { 4169static struct pci_driver mv_pci_driver = {
@@ -4101,6 +4171,11 @@ static struct pci_driver mv_pci_driver = {
4101 .id_table = mv_pci_tbl, 4171 .id_table = mv_pci_tbl,
4102 .probe = mv_pci_init_one, 4172 .probe = mv_pci_init_one,
4103 .remove = ata_pci_remove_one, 4173 .remove = ata_pci_remove_one,
4174#ifdef CONFIG_PM
4175 .suspend = ata_pci_device_suspend,
4176 .resume = mv_pci_device_resume,
4177#endif
4178
4104}; 4179};
4105 4180
4106/* move to PCI layer or libata core? */ 4181/* move to PCI layer or libata core? */
@@ -4194,7 +4269,7 @@ static int mv_pci_init_one(struct pci_dev *pdev,
4194 const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL }; 4269 const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL };
4195 struct ata_host *host; 4270 struct ata_host *host;
4196 struct mv_host_priv *hpriv; 4271 struct mv_host_priv *hpriv;
4197 int n_ports, rc; 4272 int n_ports, port, rc;
4198 4273
4199 if (!printed_version++) 4274 if (!printed_version++)
4200 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 4275 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
@@ -4208,6 +4283,7 @@ static int mv_pci_init_one(struct pci_dev *pdev,
4208 return -ENOMEM; 4283 return -ENOMEM;
4209 host->private_data = hpriv; 4284 host->private_data = hpriv;
4210 hpriv->n_ports = n_ports; 4285 hpriv->n_ports = n_ports;
4286 hpriv->board_idx = board_idx;
4211 4287
4212 /* acquire resources */ 4288 /* acquire resources */
4213 rc = pcim_enable_device(pdev); 4289 rc = pcim_enable_device(pdev);
@@ -4230,8 +4306,17 @@ static int mv_pci_init_one(struct pci_dev *pdev,
4230 if (rc) 4306 if (rc)
4231 return rc; 4307 return rc;
4232 4308
4309 for (port = 0; port < host->n_ports; port++) {
4310 struct ata_port *ap = host->ports[port];
4311 void __iomem *port_mmio = mv_port_base(hpriv->base, port);
4312 unsigned int offset = port_mmio - hpriv->base;
4313
4314 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio");
4315 ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port");
4316 }
4317
4233 /* initialize adapter */ 4318 /* initialize adapter */
4234 rc = mv_init_host(host, board_idx); 4319 rc = mv_init_host(host);
4235 if (rc) 4320 if (rc)
4236 return rc; 4321 return rc;
4237 4322
@@ -4247,6 +4332,27 @@ static int mv_pci_init_one(struct pci_dev *pdev,
4247 return ata_host_activate(host, pdev->irq, mv_interrupt, IRQF_SHARED, 4332 return ata_host_activate(host, pdev->irq, mv_interrupt, IRQF_SHARED,
4248 IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht); 4333 IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht);
4249} 4334}
4335
4336#ifdef CONFIG_PM
4337static int mv_pci_device_resume(struct pci_dev *pdev)
4338{
4339 struct ata_host *host = dev_get_drvdata(&pdev->dev);
4340 int rc;
4341
4342 rc = ata_pci_device_do_resume(pdev);
4343 if (rc)
4344 return rc;
4345
4346 /* initialize adapter */
4347 rc = mv_init_host(host);
4348 if (rc)
4349 return rc;
4350
4351 ata_host_resume(host);
4352
4353 return 0;
4354}
4355#endif
4250#endif 4356#endif
4251 4357
4252static int mv_platform_probe(struct platform_device *pdev); 4358static int mv_platform_probe(struct platform_device *pdev);
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 07d8d00b4d34..63306285c843 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -862,7 +862,7 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
862 if (port_status & PDC_DRIVE_ERR) 862 if (port_status & PDC_DRIVE_ERR)
863 ac_err_mask |= AC_ERR_DEV; 863 ac_err_mask |= AC_ERR_DEV;
864 if (port_status & (PDC_OVERRUN_ERR | PDC_UNDERRUN_ERR)) 864 if (port_status & (PDC_OVERRUN_ERR | PDC_UNDERRUN_ERR))
865 ac_err_mask |= AC_ERR_HSM; 865 ac_err_mask |= AC_ERR_OTHER;
866 if (port_status & (PDC2_ATA_HBA_ERR | PDC2_ATA_DMA_CNT_ERR)) 866 if (port_status & (PDC2_ATA_HBA_ERR | PDC2_ATA_DMA_CNT_ERR))
867 ac_err_mask |= AC_ERR_ATA_BUS; 867 ac_err_mask |= AC_ERR_ATA_BUS;
868 if (port_status & (PDC_PH_ERR | PDC_SH_ERR | PDC_DH_ERR | PDC2_HTO_ERR 868 if (port_status & (PDC_PH_ERR | PDC_SH_ERR | PDC_DH_ERR | PDC2_HTO_ERR
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 63c143e54a57..c0c5a43d9fb3 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -703,9 +703,9 @@ int bus_add_driver(struct device_driver *drv)
703 return 0; 703 return 0;
704 704
705out_unregister: 705out_unregister:
706 kobject_put(&priv->kobj);
706 kfree(drv->p); 707 kfree(drv->p);
707 drv->p = NULL; 708 drv->p = NULL;
708 kobject_put(&priv->kobj);
709out_put_bus: 709out_put_bus:
710 bus_put(bus); 710 bus_put(bus);
711 return error; 711 return error;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f1290cbd1350..282025770429 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -446,7 +446,8 @@ struct kset *devices_kset;
446 * @dev: device. 446 * @dev: device.
447 * @attr: device attribute descriptor. 447 * @attr: device attribute descriptor.
448 */ 448 */
449int device_create_file(struct device *dev, struct device_attribute *attr) 449int device_create_file(struct device *dev,
450 const struct device_attribute *attr)
450{ 451{
451 int error = 0; 452 int error = 0;
452 if (dev) 453 if (dev)
@@ -459,7 +460,8 @@ int device_create_file(struct device *dev, struct device_attribute *attr)
459 * @dev: device. 460 * @dev: device.
460 * @attr: device attribute descriptor. 461 * @attr: device attribute descriptor.
461 */ 462 */
462void device_remove_file(struct device *dev, struct device_attribute *attr) 463void device_remove_file(struct device *dev,
464 const struct device_attribute *attr)
463{ 465{
464 if (dev) 466 if (dev)
465 sysfs_remove_file(&dev->kobj, &attr->attr); 467 sysfs_remove_file(&dev->kobj, &attr->attr);
@@ -470,7 +472,8 @@ void device_remove_file(struct device *dev, struct device_attribute *attr)
470 * @dev: device. 472 * @dev: device.
471 * @attr: device binary attribute descriptor. 473 * @attr: device binary attribute descriptor.
472 */ 474 */
473int device_create_bin_file(struct device *dev, struct bin_attribute *attr) 475int device_create_bin_file(struct device *dev,
476 const struct bin_attribute *attr)
474{ 477{
475 int error = -EINVAL; 478 int error = -EINVAL;
476 if (dev) 479 if (dev)
@@ -484,7 +487,8 @@ EXPORT_SYMBOL_GPL(device_create_bin_file);
484 * @dev: device. 487 * @dev: device.
485 * @attr: device binary attribute descriptor. 488 * @attr: device binary attribute descriptor.
486 */ 489 */
487void device_remove_bin_file(struct device *dev, struct bin_attribute *attr) 490void device_remove_bin_file(struct device *dev,
491 const struct bin_attribute *attr)
488{ 492{
489 if (dev) 493 if (dev)
490 sysfs_remove_bin_file(&dev->kobj, attr); 494 sysfs_remove_bin_file(&dev->kobj, attr);
@@ -905,8 +909,10 @@ int device_add(struct device *dev)
905 dev->init_name = NULL; 909 dev->init_name = NULL;
906 } 910 }
907 911
908 if (!dev_name(dev)) 912 if (!dev_name(dev)) {
913 error = -EINVAL;
909 goto name_error; 914 goto name_error;
915 }
910 916
911 pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 917 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
912 918
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 50375bb8e51d..090dd4851301 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -32,7 +32,7 @@ static int dev_mount = 1;
32static int dev_mount; 32static int dev_mount;
33#endif 33#endif
34 34
35static rwlock_t dirlock; 35static DEFINE_MUTEX(dirlock);
36 36
37static int __init mount_param(char *str) 37static int __init mount_param(char *str)
38{ 38{
@@ -93,7 +93,7 @@ static int create_path(const char *nodepath)
93{ 93{
94 int err; 94 int err;
95 95
96 read_lock(&dirlock); 96 mutex_lock(&dirlock);
97 err = dev_mkdir(nodepath, 0755); 97 err = dev_mkdir(nodepath, 0755);
98 if (err == -ENOENT) { 98 if (err == -ENOENT) {
99 char *path; 99 char *path;
@@ -101,8 +101,10 @@ static int create_path(const char *nodepath)
101 101
102 /* parent directories do not exist, create them */ 102 /* parent directories do not exist, create them */
103 path = kstrdup(nodepath, GFP_KERNEL); 103 path = kstrdup(nodepath, GFP_KERNEL);
104 if (!path) 104 if (!path) {
105 return -ENOMEM; 105 err = -ENOMEM;
106 goto out;
107 }
106 s = path; 108 s = path;
107 for (;;) { 109 for (;;) {
108 s = strchr(s, '/'); 110 s = strchr(s, '/');
@@ -117,7 +119,8 @@ static int create_path(const char *nodepath)
117 } 119 }
118 kfree(path); 120 kfree(path);
119 } 121 }
120 read_unlock(&dirlock); 122out:
123 mutex_unlock(&dirlock);
121 return err; 124 return err;
122} 125}
123 126
@@ -229,7 +232,7 @@ static int delete_path(const char *nodepath)
229 if (!path) 232 if (!path)
230 return -ENOMEM; 233 return -ENOMEM;
231 234
232 write_lock(&dirlock); 235 mutex_lock(&dirlock);
233 for (;;) { 236 for (;;) {
234 char *base; 237 char *base;
235 238
@@ -241,7 +244,7 @@ static int delete_path(const char *nodepath)
241 if (err) 244 if (err)
242 break; 245 break;
243 } 246 }
244 write_unlock(&dirlock); 247 mutex_unlock(&dirlock);
245 248
246 kfree(path); 249 kfree(path);
247 return err; 250 return err;
@@ -352,8 +355,6 @@ int __init devtmpfs_init(void)
352 int err; 355 int err;
353 struct vfsmount *mnt; 356 struct vfsmount *mnt;
354 357
355 rwlock_init(&dirlock);
356
357 err = register_filesystem(&dev_fs_type); 358 err = register_filesystem(&dev_fs_type);
358 if (err) { 359 if (err) {
359 printk(KERN_ERR "devtmpfs: unable to register devtmpfs " 360 printk(KERN_ERR "devtmpfs: unable to register devtmpfs "
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index f367885a7646..90c9fff09ead 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -98,7 +98,7 @@ EXPORT_SYMBOL_GPL(driver_find_device);
98 * @attr: driver attribute descriptor. 98 * @attr: driver attribute descriptor.
99 */ 99 */
100int driver_create_file(struct device_driver *drv, 100int driver_create_file(struct device_driver *drv,
101 struct driver_attribute *attr) 101 const struct driver_attribute *attr)
102{ 102{
103 int error; 103 int error;
104 if (drv) 104 if (drv)
@@ -115,7 +115,7 @@ EXPORT_SYMBOL_GPL(driver_create_file);
115 * @attr: driver attribute descriptor. 115 * @attr: driver attribute descriptor.
116 */ 116 */
117void driver_remove_file(struct device_driver *drv, 117void driver_remove_file(struct device_driver *drv,
118 struct driver_attribute *attr) 118 const struct driver_attribute *attr)
119{ 119{
120 if (drv) 120 if (drv)
121 sysfs_remove_file(&drv->p->kobj, &attr->attr); 121 sysfs_remove_file(&drv->p->kobj, &attr->attr);
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index c4c8f2e1dd15..d7d77d4a402c 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -63,6 +63,20 @@ void unregister_memory_notifier(struct notifier_block *nb)
63} 63}
64EXPORT_SYMBOL(unregister_memory_notifier); 64EXPORT_SYMBOL(unregister_memory_notifier);
65 65
66static ATOMIC_NOTIFIER_HEAD(memory_isolate_chain);
67
68int register_memory_isolate_notifier(struct notifier_block *nb)
69{
70 return atomic_notifier_chain_register(&memory_isolate_chain, nb);
71}
72EXPORT_SYMBOL(register_memory_isolate_notifier);
73
74void unregister_memory_isolate_notifier(struct notifier_block *nb)
75{
76 atomic_notifier_chain_unregister(&memory_isolate_chain, nb);
77}
78EXPORT_SYMBOL(unregister_memory_isolate_notifier);
79
66/* 80/*
67 * register_memory - Setup a sysfs device for a memory block 81 * register_memory - Setup a sysfs device for a memory block
68 */ 82 */
@@ -157,6 +171,11 @@ int memory_notify(unsigned long val, void *v)
157 return blocking_notifier_call_chain(&memory_chain, val, v); 171 return blocking_notifier_call_chain(&memory_chain, val, v);
158} 172}
159 173
174int memory_isolate_notify(unsigned long val, void *v)
175{
176 return atomic_notifier_call_chain(&memory_isolate_chain, val, v);
177}
178
160/* 179/*
161 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is 180 * MEMORY_HOTPLUG depends on SPARSEMEM in mm/Kconfig, so it is
162 * OK to have direct references to sparsemem variables in here. 181 * OK to have direct references to sparsemem variables in here.
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 9d2ee25deaf5..58efaf2f1259 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -441,6 +441,7 @@ error:
441 platform_device_put(pdev); 441 platform_device_put(pdev);
442 return ERR_PTR(retval); 442 return ERR_PTR(retval);
443} 443}
444EXPORT_SYMBOL_GPL(platform_device_register_data);
444 445
445static int platform_drv_probe(struct device *_dev) 446static int platform_drv_probe(struct device *_dev)
446{ 447{
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 1a216c114a0f..a5142bddef41 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -161,6 +161,32 @@ void device_pm_move_last(struct device *dev)
161 list_move_tail(&dev->power.entry, &dpm_list); 161 list_move_tail(&dev->power.entry, &dpm_list);
162} 162}
163 163
164static ktime_t initcall_debug_start(struct device *dev)
165{
166 ktime_t calltime = ktime_set(0, 0);
167
168 if (initcall_debug) {
169 pr_info("calling %s+ @ %i\n",
170 dev_name(dev), task_pid_nr(current));
171 calltime = ktime_get();
172 }
173
174 return calltime;
175}
176
177static void initcall_debug_report(struct device *dev, ktime_t calltime,
178 int error)
179{
180 ktime_t delta, rettime;
181
182 if (initcall_debug) {
183 rettime = ktime_get();
184 delta = ktime_sub(rettime, calltime);
185 pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
186 error, (unsigned long long)ktime_to_ns(delta) >> 10);
187 }
188}
189
164/** 190/**
165 * pm_op - Execute the PM operation appropriate for given PM event. 191 * pm_op - Execute the PM operation appropriate for given PM event.
166 * @dev: Device to handle. 192 * @dev: Device to handle.
@@ -172,13 +198,9 @@ static int pm_op(struct device *dev,
172 pm_message_t state) 198 pm_message_t state)
173{ 199{
174 int error = 0; 200 int error = 0;
175 ktime_t calltime, delta, rettime; 201 ktime_t calltime;
176 202
177 if (initcall_debug) { 203 calltime = initcall_debug_start(dev);
178 pr_info("calling %s+ @ %i\n",
179 dev_name(dev), task_pid_nr(current));
180 calltime = ktime_get();
181 }
182 204
183 switch (state.event) { 205 switch (state.event) {
184#ifdef CONFIG_SUSPEND 206#ifdef CONFIG_SUSPEND
@@ -227,12 +249,7 @@ static int pm_op(struct device *dev,
227 error = -EINVAL; 249 error = -EINVAL;
228 } 250 }
229 251
230 if (initcall_debug) { 252 initcall_debug_report(dev, calltime, error);
231 rettime = ktime_get();
232 delta = ktime_sub(rettime, calltime);
233 pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
234 error, (unsigned long long)ktime_to_ns(delta) >> 10);
235 }
236 253
237 return error; 254 return error;
238} 255}
@@ -309,8 +326,9 @@ static int pm_noirq_op(struct device *dev,
309 if (initcall_debug) { 326 if (initcall_debug) {
310 rettime = ktime_get(); 327 rettime = ktime_get();
311 delta = ktime_sub(rettime, calltime); 328 delta = ktime_sub(rettime, calltime);
312 printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev), 329 printk("initcall %s_i+ returned %d after %Ld usecs\n",
313 error, (unsigned long long)ktime_to_ns(delta) >> 10); 330 dev_name(dev), error,
331 (unsigned long long)ktime_to_ns(delta) >> 10);
314 } 332 }
315 333
316 return error; 334 return error;
@@ -354,6 +372,23 @@ static void pm_dev_err(struct device *dev, pm_message_t state, char *info,
354 kobject_name(&dev->kobj), pm_verb(state.event), info, error); 372 kobject_name(&dev->kobj), pm_verb(state.event), info, error);
355} 373}
356 374
375static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info)
376{
377 ktime_t calltime;
378 s64 usecs64;
379 int usecs;
380
381 calltime = ktime_get();
382 usecs64 = ktime_to_ns(ktime_sub(calltime, starttime));
383 do_div(usecs64, NSEC_PER_USEC);
384 usecs = usecs64;
385 if (usecs == 0)
386 usecs = 1;
387 pr_info("PM: %s%s%s of devices complete after %ld.%03ld msecs\n",
388 info ?: "", info ? " " : "", pm_verb(state.event),
389 usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC);
390}
391
357/*------------------------- Resume routines -------------------------*/ 392/*------------------------- Resume routines -------------------------*/
358 393
359/** 394/**
@@ -390,6 +425,7 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
390void dpm_resume_noirq(pm_message_t state) 425void dpm_resume_noirq(pm_message_t state)
391{ 426{
392 struct device *dev; 427 struct device *dev;
428 ktime_t starttime = ktime_get();
393 429
394 mutex_lock(&dpm_list_mtx); 430 mutex_lock(&dpm_list_mtx);
395 transition_started = false; 431 transition_started = false;
@@ -403,11 +439,32 @@ void dpm_resume_noirq(pm_message_t state)
403 pm_dev_err(dev, state, " early", error); 439 pm_dev_err(dev, state, " early", error);
404 } 440 }
405 mutex_unlock(&dpm_list_mtx); 441 mutex_unlock(&dpm_list_mtx);
442 dpm_show_time(starttime, state, "early");
406 resume_device_irqs(); 443 resume_device_irqs();
407} 444}
408EXPORT_SYMBOL_GPL(dpm_resume_noirq); 445EXPORT_SYMBOL_GPL(dpm_resume_noirq);
409 446
410/** 447/**
448 * legacy_resume - Execute a legacy (bus or class) resume callback for device.
449 * @dev: Device to resume.
450 * @cb: Resume callback to execute.
451 */
452static int legacy_resume(struct device *dev, int (*cb)(struct device *dev))
453{
454 int error;
455 ktime_t calltime;
456
457 calltime = initcall_debug_start(dev);
458
459 error = cb(dev);
460 suspend_report_result(cb, error);
461
462 initcall_debug_report(dev, calltime, error);
463
464 return error;
465}
466
467/**
411 * device_resume - Execute "resume" callbacks for given device. 468 * device_resume - Execute "resume" callbacks for given device.
412 * @dev: Device to handle. 469 * @dev: Device to handle.
413 * @state: PM transition of the system being carried out. 470 * @state: PM transition of the system being carried out.
@@ -427,7 +484,7 @@ static int device_resume(struct device *dev, pm_message_t state)
427 error = pm_op(dev, dev->bus->pm, state); 484 error = pm_op(dev, dev->bus->pm, state);
428 } else if (dev->bus->resume) { 485 } else if (dev->bus->resume) {
429 pm_dev_dbg(dev, state, "legacy "); 486 pm_dev_dbg(dev, state, "legacy ");
430 error = dev->bus->resume(dev); 487 error = legacy_resume(dev, dev->bus->resume);
431 } 488 }
432 if (error) 489 if (error)
433 goto End; 490 goto End;
@@ -448,7 +505,7 @@ static int device_resume(struct device *dev, pm_message_t state)
448 error = pm_op(dev, dev->class->pm, state); 505 error = pm_op(dev, dev->class->pm, state);
449 } else if (dev->class->resume) { 506 } else if (dev->class->resume) {
450 pm_dev_dbg(dev, state, "legacy class "); 507 pm_dev_dbg(dev, state, "legacy class ");
451 error = dev->class->resume(dev); 508 error = legacy_resume(dev, dev->class->resume);
452 } 509 }
453 } 510 }
454 End: 511 End:
@@ -468,6 +525,7 @@ static int device_resume(struct device *dev, pm_message_t state)
468static void dpm_resume(pm_message_t state) 525static void dpm_resume(pm_message_t state)
469{ 526{
470 struct list_head list; 527 struct list_head list;
528 ktime_t starttime = ktime_get();
471 529
472 INIT_LIST_HEAD(&list); 530 INIT_LIST_HEAD(&list);
473 mutex_lock(&dpm_list_mtx); 531 mutex_lock(&dpm_list_mtx);
@@ -496,6 +554,7 @@ static void dpm_resume(pm_message_t state)
496 } 554 }
497 list_splice(&list, &dpm_list); 555 list_splice(&list, &dpm_list);
498 mutex_unlock(&dpm_list_mtx); 556 mutex_unlock(&dpm_list_mtx);
557 dpm_show_time(starttime, state, NULL);
499} 558}
500 559
501/** 560/**
@@ -548,7 +607,7 @@ static void dpm_complete(pm_message_t state)
548 mutex_unlock(&dpm_list_mtx); 607 mutex_unlock(&dpm_list_mtx);
549 608
550 device_complete(dev, state); 609 device_complete(dev, state);
551 pm_runtime_put_noidle(dev); 610 pm_runtime_put_sync(dev);
552 611
553 mutex_lock(&dpm_list_mtx); 612 mutex_lock(&dpm_list_mtx);
554 } 613 }
@@ -628,6 +687,7 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
628int dpm_suspend_noirq(pm_message_t state) 687int dpm_suspend_noirq(pm_message_t state)
629{ 688{
630 struct device *dev; 689 struct device *dev;
690 ktime_t starttime = ktime_get();
631 int error = 0; 691 int error = 0;
632 692
633 suspend_device_irqs(); 693 suspend_device_irqs();
@@ -643,11 +703,35 @@ int dpm_suspend_noirq(pm_message_t state)
643 mutex_unlock(&dpm_list_mtx); 703 mutex_unlock(&dpm_list_mtx);
644 if (error) 704 if (error)
645 dpm_resume_noirq(resume_event(state)); 705 dpm_resume_noirq(resume_event(state));
706 else
707 dpm_show_time(starttime, state, "late");
646 return error; 708 return error;
647} 709}
648EXPORT_SYMBOL_GPL(dpm_suspend_noirq); 710EXPORT_SYMBOL_GPL(dpm_suspend_noirq);
649 711
650/** 712/**
713 * legacy_suspend - Execute a legacy (bus or class) suspend callback for device.
714 * @dev: Device to suspend.
715 * @state: PM transition of the system being carried out.
716 * @cb: Suspend callback to execute.
717 */
718static int legacy_suspend(struct device *dev, pm_message_t state,
719 int (*cb)(struct device *dev, pm_message_t state))
720{
721 int error;
722 ktime_t calltime;
723
724 calltime = initcall_debug_start(dev);
725
726 error = cb(dev, state);
727 suspend_report_result(cb, error);
728
729 initcall_debug_report(dev, calltime, error);
730
731 return error;
732}
733
734/**
651 * device_suspend - Execute "suspend" callbacks for given device. 735 * device_suspend - Execute "suspend" callbacks for given device.
652 * @dev: Device to handle. 736 * @dev: Device to handle.
653 * @state: PM transition of the system being carried out. 737 * @state: PM transition of the system being carried out.
@@ -664,8 +748,7 @@ static int device_suspend(struct device *dev, pm_message_t state)
664 error = pm_op(dev, dev->class->pm, state); 748 error = pm_op(dev, dev->class->pm, state);
665 } else if (dev->class->suspend) { 749 } else if (dev->class->suspend) {
666 pm_dev_dbg(dev, state, "legacy class "); 750 pm_dev_dbg(dev, state, "legacy class ");
667 error = dev->class->suspend(dev, state); 751 error = legacy_suspend(dev, state, dev->class->suspend);
668 suspend_report_result(dev->class->suspend, error);
669 } 752 }
670 if (error) 753 if (error)
671 goto End; 754 goto End;
@@ -686,8 +769,7 @@ static int device_suspend(struct device *dev, pm_message_t state)
686 error = pm_op(dev, dev->bus->pm, state); 769 error = pm_op(dev, dev->bus->pm, state);
687 } else if (dev->bus->suspend) { 770 } else if (dev->bus->suspend) {
688 pm_dev_dbg(dev, state, "legacy "); 771 pm_dev_dbg(dev, state, "legacy ");
689 error = dev->bus->suspend(dev, state); 772 error = legacy_suspend(dev, state, dev->bus->suspend);
690 suspend_report_result(dev->bus->suspend, error);
691 } 773 }
692 } 774 }
693 End: 775 End:
@@ -703,6 +785,7 @@ static int device_suspend(struct device *dev, pm_message_t state)
703static int dpm_suspend(pm_message_t state) 785static int dpm_suspend(pm_message_t state)
704{ 786{
705 struct list_head list; 787 struct list_head list;
788 ktime_t starttime = ktime_get();
706 int error = 0; 789 int error = 0;
707 790
708 INIT_LIST_HEAD(&list); 791 INIT_LIST_HEAD(&list);
@@ -728,6 +811,8 @@ static int dpm_suspend(pm_message_t state)
728 } 811 }
729 list_splice(&list, dpm_list.prev); 812 list_splice(&list, dpm_list.prev);
730 mutex_unlock(&dpm_list_mtx); 813 mutex_unlock(&dpm_list_mtx);
814 if (!error)
815 dpm_show_time(starttime, state, NULL);
731 return error; 816 return error;
732} 817}
733 818
@@ -796,7 +881,7 @@ static int dpm_prepare(pm_message_t state)
796 pm_runtime_get_noresume(dev); 881 pm_runtime_get_noresume(dev);
797 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) { 882 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) {
798 /* Wake-up requested during system sleep transition. */ 883 /* Wake-up requested during system sleep transition. */
799 pm_runtime_put_noidle(dev); 884 pm_runtime_put_sync(dev);
800 error = -EBUSY; 885 error = -EBUSY;
801 } else { 886 } else {
802 error = device_prepare(dev, state); 887 error = device_prepare(dev, state);
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 40d7720a4b21..f8b044e8aef7 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -85,6 +85,19 @@ static int __pm_runtime_idle(struct device *dev)
85 dev->bus->pm->runtime_idle(dev); 85 dev->bus->pm->runtime_idle(dev);
86 86
87 spin_lock_irq(&dev->power.lock); 87 spin_lock_irq(&dev->power.lock);
88 } else if (dev->type && dev->type->pm && dev->type->pm->runtime_idle) {
89 spin_unlock_irq(&dev->power.lock);
90
91 dev->type->pm->runtime_idle(dev);
92
93 spin_lock_irq(&dev->power.lock);
94 } else if (dev->class && dev->class->pm
95 && dev->class->pm->runtime_idle) {
96 spin_unlock_irq(&dev->power.lock);
97
98 dev->class->pm->runtime_idle(dev);
99
100 spin_lock_irq(&dev->power.lock);
88 } 101 }
89 102
90 dev->power.idle_notification = false; 103 dev->power.idle_notification = false;
@@ -194,6 +207,22 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq)
194 207
195 spin_lock_irq(&dev->power.lock); 208 spin_lock_irq(&dev->power.lock);
196 dev->power.runtime_error = retval; 209 dev->power.runtime_error = retval;
210 } else if (dev->type && dev->type->pm
211 && dev->type->pm->runtime_suspend) {
212 spin_unlock_irq(&dev->power.lock);
213
214 retval = dev->type->pm->runtime_suspend(dev);
215
216 spin_lock_irq(&dev->power.lock);
217 dev->power.runtime_error = retval;
218 } else if (dev->class && dev->class->pm
219 && dev->class->pm->runtime_suspend) {
220 spin_unlock_irq(&dev->power.lock);
221
222 retval = dev->class->pm->runtime_suspend(dev);
223
224 spin_lock_irq(&dev->power.lock);
225 dev->power.runtime_error = retval;
197 } else { 226 } else {
198 retval = -ENOSYS; 227 retval = -ENOSYS;
199 } 228 }
@@ -359,6 +388,22 @@ int __pm_runtime_resume(struct device *dev, bool from_wq)
359 388
360 spin_lock_irq(&dev->power.lock); 389 spin_lock_irq(&dev->power.lock);
361 dev->power.runtime_error = retval; 390 dev->power.runtime_error = retval;
391 } else if (dev->type && dev->type->pm
392 && dev->type->pm->runtime_resume) {
393 spin_unlock_irq(&dev->power.lock);
394
395 retval = dev->type->pm->runtime_resume(dev);
396
397 spin_lock_irq(&dev->power.lock);
398 dev->power.runtime_error = retval;
399 } else if (dev->class && dev->class->pm
400 && dev->class->pm->runtime_resume) {
401 spin_unlock_irq(&dev->power.lock);
402
403 retval = dev->class->pm->runtime_resume(dev);
404
405 spin_lock_irq(&dev->power.lock);
406 dev->power.runtime_error = retval;
362 } else { 407 } else {
363 retval = -ENOSYS; 408 retval = -ENOSYS;
364 } 409 }
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index eb4fa1943944..ce1fa923c414 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -7101,7 +7101,7 @@ static struct DAC960_privdata DAC960_BA_privdata = {
7101 7101
7102static struct DAC960_privdata DAC960_LP_privdata = { 7102static struct DAC960_privdata DAC960_LP_privdata = {
7103 .HardwareType = DAC960_LP_Controller, 7103 .HardwareType = DAC960_LP_Controller,
7104 .FirmwareType = DAC960_LP_Controller, 7104 .FirmwareType = DAC960_V2_Controller,
7105 .InterruptHandler = DAC960_LP_InterruptHandler, 7105 .InterruptHandler = DAC960_LP_InterruptHandler,
7106 .MemoryWindowSize = DAC960_LP_RegisterWindowSize, 7106 .MemoryWindowSize = DAC960_LP_RegisterWindowSize,
7107}; 7107};
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 13bb69d2abb3..64a223b0cc22 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -735,21 +735,6 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector
735 part_stat_unlock(); 735 part_stat_unlock();
736} 736}
737 737
738/*
739 * Ensure we don't create aliases in VI caches
740 */
741static inline void
742killalias(struct bio *bio)
743{
744 struct bio_vec *bv;
745 int i;
746
747 if (bio_data_dir(bio) == READ)
748 __bio_for_each_segment(bv, bio, i, 0) {
749 flush_dcache_page(bv->bv_page);
750 }
751}
752
753void 738void
754aoecmd_ata_rsp(struct sk_buff *skb) 739aoecmd_ata_rsp(struct sk_buff *skb)
755{ 740{
@@ -871,7 +856,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
871 if (buf->flags & BUFFL_FAIL) 856 if (buf->flags & BUFFL_FAIL)
872 bio_endio(buf->bio, -EIO); 857 bio_endio(buf->bio, -EIO);
873 else { 858 else {
874 killalias(buf->bio); 859 bio_flush_dcache_pages(buf->bio);
875 bio_endio(buf->bio, 0); 860 bio_endio(buf->bio, 0);
876 } 861 }
877 mempool_free(buf, d->bufpool); 862 mempool_free(buf, d->bufpool);
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 2312d782fe99..c97558763430 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1490,7 +1490,7 @@ void drbd_bump_write_ordering(struct drbd_conf *mdev, enum write_ordering_e wo);
1490 1490
1491/* drbd_proc.c */ 1491/* drbd_proc.c */
1492extern struct proc_dir_entry *drbd_proc; 1492extern struct proc_dir_entry *drbd_proc;
1493extern struct file_operations drbd_proc_fops; 1493extern const struct file_operations drbd_proc_fops;
1494extern const char *drbd_conn_str(enum drbd_conns s); 1494extern const char *drbd_conn_str(enum drbd_conns s);
1495extern const char *drbd_role_str(enum drbd_role s); 1495extern const char *drbd_role_str(enum drbd_role s);
1496 1496
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 157d1e4343c2..9348f33f6242 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -27,7 +27,6 @@
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/version.h>
31#include <linux/drbd.h> 30#include <linux/drbd.h>
32#include <asm/uaccess.h> 31#include <asm/uaccess.h>
33#include <asm/types.h> 32#include <asm/types.h>
@@ -151,7 +150,7 @@ wait_queue_head_t drbd_pp_wait;
151 150
152DEFINE_RATELIMIT_STATE(drbd_ratelimit_state, 5 * HZ, 5); 151DEFINE_RATELIMIT_STATE(drbd_ratelimit_state, 5 * HZ, 5);
153 152
154static struct block_device_operations drbd_ops = { 153static const struct block_device_operations drbd_ops = {
155 .owner = THIS_MODULE, 154 .owner = THIS_MODULE,
156 .open = drbd_open, 155 .open = drbd_open,
157 .release = drbd_release, 156 .release = drbd_release,
@@ -3623,7 +3622,7 @@ _drbd_fault_random(struct fault_random_state *rsp)
3623{ 3622{
3624 long refresh; 3623 long refresh;
3625 3624
3626 if (--rsp->count < 0) { 3625 if (!rsp->count--) {
3627 get_random_bytes(&refresh, sizeof(refresh)); 3626 get_random_bytes(&refresh, sizeof(refresh));
3628 rsp->state += refresh; 3627 rsp->state += refresh;
3629 rsp->count = FAULT_RANDOM_REFRESH; 3628 rsp->count = FAULT_RANDOM_REFRESH;
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c
index bdd0b4943b10..df8ad9660d8f 100644
--- a/drivers/block/drbd/drbd_proc.c
+++ b/drivers/block/drbd/drbd_proc.c
@@ -38,7 +38,7 @@ static int drbd_proc_open(struct inode *inode, struct file *file);
38 38
39 39
40struct proc_dir_entry *drbd_proc; 40struct proc_dir_entry *drbd_proc;
41struct file_operations drbd_proc_fops = { 41const struct file_operations drbd_proc_fops = {
42 .owner = THIS_MODULE, 42 .owner = THIS_MODULE,
43 .open = drbd_proc_open, 43 .open = drbd_proc_open,
44 .read = seq_read, 44 .read = seq_read,
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index c548f24f54a1..259c1351b152 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -28,7 +28,6 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <net/sock.h> 29#include <net/sock.h>
30 30
31#include <linux/version.h>
32#include <linux/drbd.h> 31#include <linux/drbd.h>
33#include <linux/fs.h> 32#include <linux/fs.h>
34#include <linux/file.h> 33#include <linux/file.h>
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index ed8796f1112d..b453c2bca3be 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -24,7 +24,6 @@
24 */ 24 */
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/version.h>
28#include <linux/drbd.h> 27#include <linux/drbd.h>
29#include <linux/sched.h> 28#include <linux/sched.h>
30#include <linux/smp_lock.h> 29#include <linux/smp_lock.h>
@@ -34,7 +33,6 @@
34#include <linux/mm_inline.h> 33#include <linux/mm_inline.h>
35#include <linux/slab.h> 34#include <linux/slab.h>
36#include <linux/random.h> 35#include <linux/random.h>
37#include <linux/mm.h>
38#include <linux/string.h> 36#include <linux/string.h>
39#include <linux/scatterlist.h> 37#include <linux/scatterlist.h>
40 38
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index e0339aaa1815..02b2583df7fc 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -860,7 +860,7 @@ static int mg_probe(struct platform_device *plat_dev)
860 err = -EINVAL; 860 err = -EINVAL;
861 goto probe_err_2; 861 goto probe_err_2;
862 } 862 }
863 host->dev_base = ioremap(rsc->start , rsc->end + 1); 863 host->dev_base = ioremap(rsc->start, resource_size(rsc));
864 if (!host->dev_base) { 864 if (!host->dev_base) {
865 printk(KERN_ERR "%s:%d ioremap fail\n", 865 printk(KERN_ERR "%s:%d ioremap fail\n",
866 __func__, __LINE__); 866 __func__, __LINE__);
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4d2905996751..a699f09ddf7c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -307,6 +307,7 @@ static void btusb_bulk_complete(struct urb *urb)
307 return; 307 return;
308 308
309 usb_anchor_urb(urb, &data->bulk_anchor); 309 usb_anchor_urb(urb, &data->bulk_anchor);
310 usb_mark_last_busy(data->udev);
310 311
311 err = usb_submit_urb(urb, GFP_ATOMIC); 312 err = usb_submit_urb(urb, GFP_ATOMIC);
312 if (err < 0) { 313 if (err < 0) {
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 2fb2e6cc322a..5aa7a586a7ff 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -725,9 +725,14 @@ static struct pci_driver agp_amd64_pci_driver = {
725int __init agp_amd64_init(void) 725int __init agp_amd64_init(void)
726{ 726{
727 int err = 0; 727 int err = 0;
728 static int done = 0;
728 729
729 if (agp_off) 730 if (agp_off)
730 return -EINVAL; 731 return -EINVAL;
732
733 if (done++)
734 return agp_bridges_found ? 0 : -ENODEV;
735
731 err = pci_register_driver(&agp_amd64_pci_driver); 736 err = pci_register_driver(&agp_amd64_pci_driver);
732 if (err < 0) 737 if (err < 0)
733 return err; 738 return err;
@@ -771,12 +776,8 @@ static void __exit agp_amd64_cleanup(void)
771 pci_unregister_driver(&agp_amd64_pci_driver); 776 pci_unregister_driver(&agp_amd64_pci_driver);
772} 777}
773 778
774/* On AMD64 the PCI driver needs to initialize this driver early
775 for the IOMMU, so it has to be called via a backdoor. */
776#ifndef CONFIG_GART_IOMMU
777module_init(agp_amd64_init); 779module_init(agp_amd64_init);
778module_exit(agp_amd64_cleanup); 780module_exit(agp_amd64_cleanup);
779#endif
780 781
781MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); 782MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen");
782module_param(agp_try_unsupported, bool, 0); 783module_param(agp_try_unsupported, bool, 0);
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index a56ca080e108..c3ab46da51a3 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -285,18 +285,22 @@ int agp_add_bridge(struct agp_bridge_data *bridge)
285{ 285{
286 int error; 286 int error;
287 287
288 if (agp_off) 288 if (agp_off) {
289 return -ENODEV; 289 error = -ENODEV;
290 goto err_put_bridge;
291 }
290 292
291 if (!bridge->dev) { 293 if (!bridge->dev) {
292 printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n"); 294 printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n");
293 return -EINVAL; 295 error = -EINVAL;
296 goto err_put_bridge;
294 } 297 }
295 298
296 /* Grab reference on the chipset driver. */ 299 /* Grab reference on the chipset driver. */
297 if (!try_module_get(bridge->driver->owner)) { 300 if (!try_module_get(bridge->driver->owner)) {
298 dev_info(&bridge->dev->dev, "can't lock chipset driver\n"); 301 dev_info(&bridge->dev->dev, "can't lock chipset driver\n");
299 return -EINVAL; 302 error = -EINVAL;
303 goto err_put_bridge;
300 } 304 }
301 305
302 error = agp_backend_initialize(bridge); 306 error = agp_backend_initialize(bridge);
@@ -326,6 +330,7 @@ frontend_err:
326 agp_backend_cleanup(bridge); 330 agp_backend_cleanup(bridge);
327err_out: 331err_out:
328 module_put(bridge->driver->owner); 332 module_put(bridge->driver->owner);
333err_put_bridge:
329 agp_put_bridge(bridge); 334 agp_put_bridge(bridge);
330 return error; 335 return error;
331} 336}
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 9047b2714653..58752b70efea 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -488,9 +488,8 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
488 handle = obj; 488 handle = obj;
489 do { 489 do {
490 status = acpi_get_object_info(handle, &info); 490 status = acpi_get_object_info(handle, &info);
491 if (ACPI_SUCCESS(status)) { 491 if (ACPI_SUCCESS(status) && (info->valid & ACPI_VALID_HID)) {
492 /* TBD check _CID also */ 492 /* TBD check _CID also */
493 info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0';
494 match = (strcmp(info->hardware_id.string, "HWP0001") == 0); 493 match = (strcmp(info->hardware_id.string, "HWP0001") == 0);
495 kfree(info); 494 kfree(info);
496 if (match) { 495 if (match) {
@@ -509,6 +508,9 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
509 handle = parent; 508 handle = parent;
510 } while (ACPI_SUCCESS(status)); 509 } while (ACPI_SUCCESS(status));
511 510
511 if (ACPI_FAILURE(status))
512 return AE_OK; /* found no enclosing IOC */
513
512 if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa)) 514 if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa))
513 return AE_OK; 515 return AE_OK;
514 516
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index e989f67bb61f..3d9c61e5acbf 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -158,10 +158,11 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
158 goto out; 158 goto out;
159 } 159 }
160 } 160 }
161out_unlock:
162 mutex_unlock(&rng_mutex);
163out: 161out:
164 return ret ? : err; 162 return ret ? : err;
163out_unlock:
164 mutex_unlock(&rng_mutex);
165 goto out;
165} 166}
166 167
167 168
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 679cd08b80b4..176f1751237f 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -3204,7 +3204,7 @@ static __devinit int init_ipmi_si(void)
3204#ifdef CONFIG_ACPI 3204#ifdef CONFIG_ACPI
3205 spmi_find_bmc(); 3205 spmi_find_bmc();
3206#endif 3206#endif
3207#ifdef CONFIG_PNP 3207#ifdef CONFIG_ACPI
3208 pnp_register_driver(&ipmi_pnp_driver); 3208 pnp_register_driver(&ipmi_pnp_driver);
3209#endif 3209#endif
3210 3210
@@ -3330,7 +3330,7 @@ static __exit void cleanup_ipmi_si(void)
3330#ifdef CONFIG_PCI 3330#ifdef CONFIG_PCI
3331 pci_unregister_driver(&ipmi_pci_driver); 3331 pci_unregister_driver(&ipmi_pci_driver);
3332#endif 3332#endif
3333#ifdef CONFIG_PNP 3333#ifdef CONFIG_ACPI
3334 pnp_unregister_driver(&ipmi_pnp_driver); 3334 pnp_unregister_driver(&ipmi_pnp_driver);
3335#endif 3335#endif
3336 3336
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index d3400b20444f..7d73cd430340 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -358,7 +358,7 @@ struct port {
358 u8 update_flow_control; 358 u8 update_flow_control;
359 struct ctrl_ul ctrl_ul; 359 struct ctrl_ul ctrl_ul;
360 struct ctrl_dl ctrl_dl; 360 struct ctrl_dl ctrl_dl;
361 struct kfifo *fifo_ul; 361 struct kfifo fifo_ul;
362 void __iomem *dl_addr[2]; 362 void __iomem *dl_addr[2];
363 u32 dl_size[2]; 363 u32 dl_size[2];
364 u8 toggle_dl; 364 u8 toggle_dl;
@@ -685,8 +685,6 @@ static int nozomi_read_config_table(struct nozomi *dc)
685 dump_table(dc); 685 dump_table(dc);
686 686
687 for (i = PORT_MDM; i < MAX_PORT; i++) { 687 for (i = PORT_MDM; i < MAX_PORT; i++) {
688 dc->port[i].fifo_ul =
689 kfifo_alloc(FIFO_BUFFER_SIZE_UL, GFP_ATOMIC, NULL);
690 memset(&dc->port[i].ctrl_dl, 0, sizeof(struct ctrl_dl)); 688 memset(&dc->port[i].ctrl_dl, 0, sizeof(struct ctrl_dl));
691 memset(&dc->port[i].ctrl_ul, 0, sizeof(struct ctrl_ul)); 689 memset(&dc->port[i].ctrl_ul, 0, sizeof(struct ctrl_ul));
692 } 690 }
@@ -798,7 +796,7 @@ static int send_data(enum port_type index, struct nozomi *dc)
798 struct tty_struct *tty = tty_port_tty_get(&port->port); 796 struct tty_struct *tty = tty_port_tty_get(&port->port);
799 797
800 /* Get data from tty and place in buf for now */ 798 /* Get data from tty and place in buf for now */
801 size = __kfifo_get(port->fifo_ul, dc->send_buf, 799 size = kfifo_out(&port->fifo_ul, dc->send_buf,
802 ul_size < SEND_BUF_MAX ? ul_size : SEND_BUF_MAX); 800 ul_size < SEND_BUF_MAX ? ul_size : SEND_BUF_MAX);
803 801
804 if (size == 0) { 802 if (size == 0) {
@@ -988,11 +986,11 @@ static int receive_flow_control(struct nozomi *dc)
988 986
989 } else if (old_ctrl.CTS == 0 && ctrl_dl.CTS == 1) { 987 } else if (old_ctrl.CTS == 0 && ctrl_dl.CTS == 1) {
990 988
991 if (__kfifo_len(dc->port[port].fifo_ul)) { 989 if (kfifo_len(&dc->port[port].fifo_ul)) {
992 DBG1("Enable interrupt (0x%04X) on port: %d", 990 DBG1("Enable interrupt (0x%04X) on port: %d",
993 enable_ier, port); 991 enable_ier, port);
994 DBG1("Data in buffer [%d], enable transmit! ", 992 DBG1("Data in buffer [%d], enable transmit! ",
995 __kfifo_len(dc->port[port].fifo_ul)); 993 kfifo_len(&dc->port[port].fifo_ul));
996 enable_transmit_ul(port, dc); 994 enable_transmit_ul(port, dc);
997 } else { 995 } else {
998 DBG1("No data in buffer..."); 996 DBG1("No data in buffer...");
@@ -1433,6 +1431,16 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1433 goto err_free_sbuf; 1431 goto err_free_sbuf;
1434 } 1432 }
1435 1433
1434 for (i = PORT_MDM; i < MAX_PORT; i++) {
1435 if (kfifo_alloc(&dc->port[i].fifo_ul,
1436 FIFO_BUFFER_SIZE_UL, GFP_ATOMIC)) {
1437 dev_err(&pdev->dev,
1438 "Could not allocate kfifo buffer\n");
1439 ret = -ENOMEM;
1440 goto err_free_kfifo;
1441 }
1442 }
1443
1436 spin_lock_init(&dc->spin_mutex); 1444 spin_lock_init(&dc->spin_mutex);
1437 1445
1438 nozomi_setup_private_data(dc); 1446 nozomi_setup_private_data(dc);
@@ -1445,7 +1453,7 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1445 NOZOMI_NAME, dc); 1453 NOZOMI_NAME, dc);
1446 if (unlikely(ret)) { 1454 if (unlikely(ret)) {
1447 dev_err(&pdev->dev, "can't request irq %d\n", pdev->irq); 1455 dev_err(&pdev->dev, "can't request irq %d\n", pdev->irq);
1448 goto err_free_sbuf; 1456 goto err_free_kfifo;
1449 } 1457 }
1450 1458
1451 DBG1("base_addr: %p", dc->base_addr); 1459 DBG1("base_addr: %p", dc->base_addr);
@@ -1464,13 +1472,28 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
1464 dc->state = NOZOMI_STATE_ENABLED; 1472 dc->state = NOZOMI_STATE_ENABLED;
1465 1473
1466 for (i = 0; i < MAX_PORT; i++) { 1474 for (i = 0; i < MAX_PORT; i++) {
1475 struct device *tty_dev;
1476
1467 mutex_init(&dc->port[i].tty_sem); 1477 mutex_init(&dc->port[i].tty_sem);
1468 tty_port_init(&dc->port[i].port); 1478 tty_port_init(&dc->port[i].port);
1469 tty_register_device(ntty_driver, dc->index_start + i, 1479 tty_dev = tty_register_device(ntty_driver, dc->index_start + i,
1470 &pdev->dev); 1480 &pdev->dev);
1481
1482 if (IS_ERR(tty_dev)) {
1483 ret = PTR_ERR(tty_dev);
1484 dev_err(&pdev->dev, "Could not allocate tty?\n");
1485 goto err_free_tty;
1486 }
1471 } 1487 }
1488
1472 return 0; 1489 return 0;
1473 1490
1491err_free_tty:
1492 for (i = dc->index_start; i < dc->index_start + MAX_PORT; ++i)
1493 tty_unregister_device(ntty_driver, i);
1494err_free_kfifo:
1495 for (i = 0; i < MAX_PORT; i++)
1496 kfifo_free(&dc->port[i].fifo_ul);
1474err_free_sbuf: 1497err_free_sbuf:
1475 kfree(dc->send_buf); 1498 kfree(dc->send_buf);
1476 iounmap(dc->base_addr); 1499 iounmap(dc->base_addr);
@@ -1536,8 +1559,7 @@ static void __devexit nozomi_card_exit(struct pci_dev *pdev)
1536 free_irq(pdev->irq, dc); 1559 free_irq(pdev->irq, dc);
1537 1560
1538 for (i = 0; i < MAX_PORT; i++) 1561 for (i = 0; i < MAX_PORT; i++)
1539 if (dc->port[i].fifo_ul) 1562 kfifo_free(&dc->port[i].fifo_ul);
1540 kfifo_free(dc->port[i].fifo_ul);
1541 1563
1542 kfree(dc->send_buf); 1564 kfree(dc->send_buf);
1543 1565
@@ -1673,7 +1695,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
1673 goto exit; 1695 goto exit;
1674 } 1696 }
1675 1697
1676 rval = __kfifo_put(port->fifo_ul, (unsigned char *)buffer, count); 1698 rval = kfifo_in(&port->fifo_ul, (unsigned char *)buffer, count);
1677 1699
1678 /* notify card */ 1700 /* notify card */
1679 if (unlikely(dc == NULL)) { 1701 if (unlikely(dc == NULL)) {
@@ -1721,7 +1743,7 @@ static int ntty_write_room(struct tty_struct *tty)
1721 if (!port->port.count) 1743 if (!port->port.count)
1722 goto exit; 1744 goto exit;
1723 1745
1724 room = port->fifo_ul->size - __kfifo_len(port->fifo_ul); 1746 room = port->fifo_ul.size - kfifo_len(&port->fifo_ul);
1725 1747
1726exit: 1748exit:
1727 mutex_unlock(&port->tty_sem); 1749 mutex_unlock(&port->tty_sem);
@@ -1878,7 +1900,7 @@ static s32 ntty_chars_in_buffer(struct tty_struct *tty)
1878 goto exit_in_buffer; 1900 goto exit_in_buffer;
1879 } 1901 }
1880 1902
1881 rval = __kfifo_len(port->fifo_ul); 1903 rval = kfifo_len(&port->fifo_ul);
1882 1904
1883exit_in_buffer: 1905exit_in_buffer:
1884 return rval; 1906 return rval;
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index 8c7df5ba088f..f80810901db6 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/smp_lock.h> 28#include <linux/smp_lock.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/jiffies.h>
30 31
31#include <asm/hardware/dec21285.h> 32#include <asm/hardware/dec21285.h>
32#include <asm/io.h> 33#include <asm/io.h>
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 8c262aaf7c26..bba727c3807e 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -50,7 +50,6 @@
50#include <linux/err.h> 50#include <linux/err.h>
51#include <linux/kfifo.h> 51#include <linux/kfifo.h>
52#include <linux/platform_device.h> 52#include <linux/platform_device.h>
53#include <linux/smp_lock.h>
54 53
55#include <asm/uaccess.h> 54#include <asm/uaccess.h>
56#include <asm/io.h> 55#include <asm/io.h>
@@ -487,7 +486,7 @@ static struct sonypi_device {
487 int camera_power; 486 int camera_power;
488 int bluetooth_power; 487 int bluetooth_power;
489 struct mutex lock; 488 struct mutex lock;
490 struct kfifo *fifo; 489 struct kfifo fifo;
491 spinlock_t fifo_lock; 490 spinlock_t fifo_lock;
492 wait_queue_head_t fifo_proc_list; 491 wait_queue_head_t fifo_proc_list;
493 struct fasync_struct *fifo_async; 492 struct fasync_struct *fifo_async;
@@ -496,7 +495,7 @@ static struct sonypi_device {
496 struct input_dev *input_jog_dev; 495 struct input_dev *input_jog_dev;
497 struct input_dev *input_key_dev; 496 struct input_dev *input_key_dev;
498 struct work_struct input_work; 497 struct work_struct input_work;
499 struct kfifo *input_fifo; 498 struct kfifo input_fifo;
500 spinlock_t input_fifo_lock; 499 spinlock_t input_fifo_lock;
501} sonypi_device; 500} sonypi_device;
502 501
@@ -777,8 +776,9 @@ static void input_keyrelease(struct work_struct *work)
777{ 776{
778 struct sonypi_keypress kp; 777 struct sonypi_keypress kp;
779 778
780 while (kfifo_get(sonypi_device.input_fifo, (unsigned char *)&kp, 779 while (kfifo_out_locked(&sonypi_device.input_fifo, (unsigned char *)&kp,
781 sizeof(kp)) == sizeof(kp)) { 780 sizeof(kp), &sonypi_device.input_fifo_lock)
781 == sizeof(kp)) {
782 msleep(10); 782 msleep(10);
783 input_report_key(kp.dev, kp.key, 0); 783 input_report_key(kp.dev, kp.key, 0);
784 input_sync(kp.dev); 784 input_sync(kp.dev);
@@ -827,8 +827,9 @@ static void sonypi_report_input_event(u8 event)
827 if (kp.dev) { 827 if (kp.dev) {
828 input_report_key(kp.dev, kp.key, 1); 828 input_report_key(kp.dev, kp.key, 1);
829 input_sync(kp.dev); 829 input_sync(kp.dev);
830 kfifo_put(sonypi_device.input_fifo, 830 kfifo_in_locked(&sonypi_device.input_fifo,
831 (unsigned char *)&kp, sizeof(kp)); 831 (unsigned char *)&kp, sizeof(kp),
832 &sonypi_device.input_fifo_lock);
832 schedule_work(&sonypi_device.input_work); 833 schedule_work(&sonypi_device.input_work);
833 } 834 }
834} 835}
@@ -880,7 +881,8 @@ found:
880 acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event); 881 acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event);
881#endif 882#endif
882 883
883 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); 884 kfifo_in_locked(&sonypi_device.fifo, (unsigned char *)&event,
885 sizeof(event), &sonypi_device.fifo_lock);
884 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); 886 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
885 wake_up_interruptible(&sonypi_device.fifo_proc_list); 887 wake_up_interruptible(&sonypi_device.fifo_proc_list);
886 888
@@ -902,14 +904,13 @@ static int sonypi_misc_release(struct inode *inode, struct file *file)
902 904
903static int sonypi_misc_open(struct inode *inode, struct file *file) 905static int sonypi_misc_open(struct inode *inode, struct file *file)
904{ 906{
905 lock_kernel();
906 mutex_lock(&sonypi_device.lock); 907 mutex_lock(&sonypi_device.lock);
907 /* Flush input queue on first open */ 908 /* Flush input queue on first open */
908 if (!sonypi_device.open_count) 909 if (!sonypi_device.open_count)
909 kfifo_reset(sonypi_device.fifo); 910 kfifo_reset(&sonypi_device.fifo);
910 sonypi_device.open_count++; 911 sonypi_device.open_count++;
911 mutex_unlock(&sonypi_device.lock); 912 mutex_unlock(&sonypi_device.lock);
912 unlock_kernel(); 913
913 return 0; 914 return 0;
914} 915}
915 916
@@ -919,17 +920,18 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
919 ssize_t ret; 920 ssize_t ret;
920 unsigned char c; 921 unsigned char c;
921 922
922 if ((kfifo_len(sonypi_device.fifo) == 0) && 923 if ((kfifo_len(&sonypi_device.fifo) == 0) &&
923 (file->f_flags & O_NONBLOCK)) 924 (file->f_flags & O_NONBLOCK))
924 return -EAGAIN; 925 return -EAGAIN;
925 926
926 ret = wait_event_interruptible(sonypi_device.fifo_proc_list, 927 ret = wait_event_interruptible(sonypi_device.fifo_proc_list,
927 kfifo_len(sonypi_device.fifo) != 0); 928 kfifo_len(&sonypi_device.fifo) != 0);
928 if (ret) 929 if (ret)
929 return ret; 930 return ret;
930 931
931 while (ret < count && 932 while (ret < count &&
932 (kfifo_get(sonypi_device.fifo, &c, sizeof(c)) == sizeof(c))) { 933 (kfifo_out_locked(&sonypi_device.fifo, &c, sizeof(c),
934 &sonypi_device.fifo_lock) == sizeof(c))) {
933 if (put_user(c, buf++)) 935 if (put_user(c, buf++))
934 return -EFAULT; 936 return -EFAULT;
935 ret++; 937 ret++;
@@ -946,15 +948,15 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
946static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait) 948static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait)
947{ 949{
948 poll_wait(file, &sonypi_device.fifo_proc_list, wait); 950 poll_wait(file, &sonypi_device.fifo_proc_list, wait);
949 if (kfifo_len(sonypi_device.fifo)) 951 if (kfifo_len(&sonypi_device.fifo))
950 return POLLIN | POLLRDNORM; 952 return POLLIN | POLLRDNORM;
951 return 0; 953 return 0;
952} 954}
953 955
954static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, 956static long sonypi_misc_ioctl(struct file *fp,
955 unsigned int cmd, unsigned long arg) 957 unsigned int cmd, unsigned long arg)
956{ 958{
957 int ret = 0; 959 long ret = 0;
958 void __user *argp = (void __user *)arg; 960 void __user *argp = (void __user *)arg;
959 u8 val8; 961 u8 val8;
960 u16 val16; 962 u16 val16;
@@ -1070,7 +1072,8 @@ static const struct file_operations sonypi_misc_fops = {
1070 .open = sonypi_misc_open, 1072 .open = sonypi_misc_open,
1071 .release = sonypi_misc_release, 1073 .release = sonypi_misc_release,
1072 .fasync = sonypi_misc_fasync, 1074 .fasync = sonypi_misc_fasync,
1073 .ioctl = sonypi_misc_ioctl, 1075 .unlocked_ioctl = sonypi_misc_ioctl,
1076 .llseek = no_llseek,
1074}; 1077};
1075 1078
1076static struct miscdevice sonypi_misc_device = { 1079static struct miscdevice sonypi_misc_device = {
@@ -1313,11 +1316,10 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1313 "http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n"); 1316 "http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n");
1314 1317
1315 spin_lock_init(&sonypi_device.fifo_lock); 1318 spin_lock_init(&sonypi_device.fifo_lock);
1316 sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL, 1319 error = kfifo_alloc(&sonypi_device.fifo, SONYPI_BUF_SIZE, GFP_KERNEL);
1317 &sonypi_device.fifo_lock); 1320 if (error) {
1318 if (IS_ERR(sonypi_device.fifo)) {
1319 printk(KERN_ERR "sonypi: kfifo_alloc failed\n"); 1321 printk(KERN_ERR "sonypi: kfifo_alloc failed\n");
1320 return PTR_ERR(sonypi_device.fifo); 1322 return error;
1321 } 1323 }
1322 1324
1323 init_waitqueue_head(&sonypi_device.fifo_proc_list); 1325 init_waitqueue_head(&sonypi_device.fifo_proc_list);
@@ -1393,12 +1395,10 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1393 } 1395 }
1394 1396
1395 spin_lock_init(&sonypi_device.input_fifo_lock); 1397 spin_lock_init(&sonypi_device.input_fifo_lock);
1396 sonypi_device.input_fifo = 1398 error = kfifo_alloc(&sonypi_device.input_fifo, SONYPI_BUF_SIZE,
1397 kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL, 1399 GFP_KERNEL);
1398 &sonypi_device.input_fifo_lock); 1400 if (error) {
1399 if (IS_ERR(sonypi_device.input_fifo)) {
1400 printk(KERN_ERR "sonypi: kfifo_alloc failed\n"); 1401 printk(KERN_ERR "sonypi: kfifo_alloc failed\n");
1401 error = PTR_ERR(sonypi_device.input_fifo);
1402 goto err_inpdev_unregister; 1402 goto err_inpdev_unregister;
1403 } 1403 }
1404 1404
@@ -1423,7 +1423,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1423 pci_disable_device(pcidev); 1423 pci_disable_device(pcidev);
1424 err_put_pcidev: 1424 err_put_pcidev:
1425 pci_dev_put(pcidev); 1425 pci_dev_put(pcidev);
1426 kfifo_free(sonypi_device.fifo); 1426 kfifo_free(&sonypi_device.fifo);
1427 1427
1428 return error; 1428 return error;
1429} 1429}
@@ -1438,7 +1438,7 @@ static int __devexit sonypi_remove(struct platform_device *dev)
1438 if (useinput) { 1438 if (useinput) {
1439 input_unregister_device(sonypi_device.input_key_dev); 1439 input_unregister_device(sonypi_device.input_key_dev);
1440 input_unregister_device(sonypi_device.input_jog_dev); 1440 input_unregister_device(sonypi_device.input_jog_dev);
1441 kfifo_free(sonypi_device.input_fifo); 1441 kfifo_free(&sonypi_device.input_fifo);
1442 } 1442 }
1443 1443
1444 misc_deregister(&sonypi_misc_device); 1444 misc_deregister(&sonypi_misc_device);
@@ -1451,7 +1451,7 @@ static int __devexit sonypi_remove(struct platform_device *dev)
1451 pci_dev_put(sonypi_device.dev); 1451 pci_dev_put(sonypi_device.dev);
1452 } 1452 }
1453 1453
1454 kfifo_free(sonypi_device.fifo); 1454 kfifo_free(&sonypi_device.fifo);
1455 1455
1456 return 0; 1456 return 0;
1457} 1457}
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 663cd15d7c78..f8bc79f6de34 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -68,7 +68,7 @@
68#include <linux/stat.h> 68#include <linux/stat.h>
69#include <linux/proc_fs.h> 69#include <linux/proc_fs.h>
70#include <linux/seq_file.h> 70#include <linux/seq_file.h>
71 71#include <linux/smp_lock.h>
72#include <linux/toshiba.h> 72#include <linux/toshiba.h>
73 73
74#define TOSH_MINOR_DEV 181 74#define TOSH_MINOR_DEV 181
@@ -88,13 +88,13 @@ static int tosh_date;
88static int tosh_sci; 88static int tosh_sci;
89static int tosh_fan; 89static int tosh_fan;
90 90
91static int tosh_ioctl(struct inode *, struct file *, unsigned int, 91static long tosh_ioctl(struct file *, unsigned int,
92 unsigned long); 92 unsigned long);
93 93
94 94
95static const struct file_operations tosh_fops = { 95static const struct file_operations tosh_fops = {
96 .owner = THIS_MODULE, 96 .owner = THIS_MODULE,
97 .ioctl = tosh_ioctl, 97 .unlocked_ioctl = tosh_ioctl,
98}; 98};
99 99
100static struct miscdevice tosh_device = { 100static struct miscdevice tosh_device = {
@@ -252,8 +252,7 @@ int tosh_smm(SMMRegisters *regs)
252EXPORT_SYMBOL(tosh_smm); 252EXPORT_SYMBOL(tosh_smm);
253 253
254 254
255static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, 255static long tosh_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
256 unsigned long arg)
257{ 256{
258 SMMRegisters regs; 257 SMMRegisters regs;
259 SMMRegisters __user *argp = (SMMRegisters __user *)arg; 258 SMMRegisters __user *argp = (SMMRegisters __user *)arg;
@@ -275,13 +274,16 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
275 return -EINVAL; 274 return -EINVAL;
276 275
277 /* do we need to emulate the fan ? */ 276 /* do we need to emulate the fan ? */
277 lock_kernel();
278 if (tosh_fan==1) { 278 if (tosh_fan==1) {
279 if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { 279 if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) {
280 err = tosh_emulate_fan(&regs); 280 err = tosh_emulate_fan(&regs);
281 unlock_kernel();
281 break; 282 break;
282 } 283 }
283 } 284 }
284 err = tosh_smm(&regs); 285 err = tosh_smm(&regs);
286 unlock_kernel();
285 break; 287 break;
286 default: 288 default:
287 return -EINVAL; 289 return -EINVAL;
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 68104434ebb5..73655aeb3a60 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -18,6 +18,7 @@
18#include <linux/hrtimer.h> 18#include <linux/hrtimer.h>
19#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/math64.h>
21 22
22#define BUCKETS 12 23#define BUCKETS 12
23#define RESOLUTION 1024 24#define RESOLUTION 1024
@@ -169,6 +170,12 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices);
169 170
170static void menu_update(struct cpuidle_device *dev); 171static void menu_update(struct cpuidle_device *dev);
171 172
173/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */
174static u64 div_round64(u64 dividend, u32 divisor)
175{
176 return div_u64(dividend + (divisor / 2), divisor);
177}
178
172/** 179/**
173 * menu_select - selects the next idle state to enter 180 * menu_select - selects the next idle state to enter
174 * @dev: the CPU 181 * @dev: the CPU
@@ -209,9 +216,8 @@ static int menu_select(struct cpuidle_device *dev)
209 data->correction_factor[data->bucket] = RESOLUTION * DECAY; 216 data->correction_factor[data->bucket] = RESOLUTION * DECAY;
210 217
211 /* Make sure to round up for half microseconds */ 218 /* Make sure to round up for half microseconds */
212 data->predicted_us = DIV_ROUND_CLOSEST( 219 data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket],
213 data->expected_us * data->correction_factor[data->bucket], 220 RESOLUTION * DECAY);
214 RESOLUTION * DECAY);
215 221
216 /* 222 /*
217 * We want to default to C1 (hlt), not to busy polling 223 * We want to default to C1 (hlt), not to busy polling
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index f15112569c1d..efc1a61ca231 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -815,7 +815,7 @@ atc_is_tx_complete(struct dma_chan *chan,
815 dev_vdbg(chan2dev(chan), "is_tx_complete: %d (d%d, u%d)\n", 815 dev_vdbg(chan2dev(chan), "is_tx_complete: %d (d%d, u%d)\n",
816 cookie, done ? *done : 0, used ? *used : 0); 816 cookie, done ? *done : 0, used ? *used : 0);
817 817
818 spin_lock_bh(atchan->lock); 818 spin_lock_bh(&atchan->lock);
819 819
820 last_complete = atchan->completed_cookie; 820 last_complete = atchan->completed_cookie;
821 last_used = chan->cookie; 821 last_used = chan->cookie;
@@ -830,7 +830,7 @@ atc_is_tx_complete(struct dma_chan *chan,
830 ret = dma_async_is_complete(cookie, last_complete, last_used); 830 ret = dma_async_is_complete(cookie, last_complete, last_used);
831 } 831 }
832 832
833 spin_unlock_bh(atchan->lock); 833 spin_unlock_bh(&atchan->lock);
834 834
835 if (done) 835 if (done)
836 *done = last_complete; 836 *done = last_complete;
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 4a99cd94536b..b5f2ee0f8e2c 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -1294,8 +1294,8 @@ static int __exit coh901318_remove(struct platform_device *pdev)
1294 dma_async_device_unregister(&base->dma_slave); 1294 dma_async_device_unregister(&base->dma_slave);
1295 coh901318_pool_destroy(&base->pool); 1295 coh901318_pool_destroy(&base->pool);
1296 free_irq(platform_get_irq(pdev, 0), base); 1296 free_irq(platform_get_irq(pdev, 0), base);
1297 kfree(base);
1298 iounmap(base->virtbase); 1297 iounmap(base->virtbase);
1298 kfree(base);
1299 release_mem_region(pdev->resource->start, 1299 release_mem_region(pdev->resource->start,
1300 resource_size(pdev->resource)); 1300 resource_size(pdev->resource));
1301 return 0; 1301 return 0;
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 285bed0fe17b..d28369f7afd2 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1270,8 +1270,6 @@ static int __init dw_probe(struct platform_device *pdev)
1270 goto err_kfree; 1270 goto err_kfree;
1271 } 1271 }
1272 1272
1273 memset(dw, 0, sizeof *dw);
1274
1275 dw->regs = ioremap(io->start, DW_REGLEN); 1273 dw->regs = ioremap(io->start, DW_REGLEN);
1276 if (!dw->regs) { 1274 if (!dw->regs) {
1277 err = -ENOMEM; 1275 err = -ENOMEM;
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index c524d36d3c2e..dcc4ab78b32b 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -1032,7 +1032,7 @@ int __devinit ioat_probe(struct ioatdma_device *device)
1032 dma->dev = &pdev->dev; 1032 dma->dev = &pdev->dev;
1033 1033
1034 if (!dma->chancnt) { 1034 if (!dma->chancnt) {
1035 dev_err(dev, "zero channels detected\n"); 1035 dev_err(dev, "channel enumeration error\n");
1036 goto err_setup_interrupts; 1036 goto err_setup_interrupts;
1037 } 1037 }
1038 1038
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 45edde996480..bbc3e78ef333 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -60,6 +60,7 @@
60 * @dca: direct cache access context 60 * @dca: direct cache access context
61 * @intr_quirk: interrupt setup quirk (for ioat_v1 devices) 61 * @intr_quirk: interrupt setup quirk (for ioat_v1 devices)
62 * @enumerate_channels: hw version specific channel enumeration 62 * @enumerate_channels: hw version specific channel enumeration
63 * @reset_hw: hw version specific channel (re)initialization
63 * @cleanup_tasklet: select between the v2 and v3 cleanup routines 64 * @cleanup_tasklet: select between the v2 and v3 cleanup routines
64 * @timer_fn: select between the v2 and v3 timer watchdog routines 65 * @timer_fn: select between the v2 and v3 timer watchdog routines
65 * @self_test: hardware version specific self test for each supported op type 66 * @self_test: hardware version specific self test for each supported op type
@@ -78,6 +79,7 @@ struct ioatdma_device {
78 struct dca_provider *dca; 79 struct dca_provider *dca;
79 void (*intr_quirk)(struct ioatdma_device *device); 80 void (*intr_quirk)(struct ioatdma_device *device);
80 int (*enumerate_channels)(struct ioatdma_device *device); 81 int (*enumerate_channels)(struct ioatdma_device *device);
82 int (*reset_hw)(struct ioat_chan_common *chan);
81 void (*cleanup_tasklet)(unsigned long data); 83 void (*cleanup_tasklet)(unsigned long data);
82 void (*timer_fn)(unsigned long data); 84 void (*timer_fn)(unsigned long data);
83 int (*self_test)(struct ioatdma_device *device); 85 int (*self_test)(struct ioatdma_device *device);
@@ -264,6 +266,22 @@ static inline void ioat_suspend(struct ioat_chan_common *chan)
264 writeb(IOAT_CHANCMD_SUSPEND, chan->reg_base + IOAT_CHANCMD_OFFSET(ver)); 266 writeb(IOAT_CHANCMD_SUSPEND, chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
265} 267}
266 268
269static inline void ioat_reset(struct ioat_chan_common *chan)
270{
271 u8 ver = chan->device->version;
272
273 writeb(IOAT_CHANCMD_RESET, chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
274}
275
276static inline bool ioat_reset_pending(struct ioat_chan_common *chan)
277{
278 u8 ver = chan->device->version;
279 u8 cmd;
280
281 cmd = readb(chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
282 return (cmd & IOAT_CHANCMD_RESET) == IOAT_CHANCMD_RESET;
283}
284
267static inline void ioat_set_chainaddr(struct ioat_dma_chan *ioat, u64 addr) 285static inline void ioat_set_chainaddr(struct ioat_dma_chan *ioat, u64 addr)
268{ 286{
269 struct ioat_chan_common *chan = &ioat->base; 287 struct ioat_chan_common *chan = &ioat->base;
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 8f1f7f05deaa..5f7a500e18d0 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -239,20 +239,50 @@ void __ioat2_restart_chan(struct ioat2_dma_chan *ioat)
239 __ioat2_start_null_desc(ioat); 239 __ioat2_start_null_desc(ioat);
240} 240}
241 241
242static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) 242int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo)
243{ 243{
244 struct ioat_chan_common *chan = &ioat->base; 244 unsigned long end = jiffies + tmo;
245 unsigned long phys_complete; 245 int err = 0;
246 u32 status; 246 u32 status;
247 247
248 status = ioat_chansts(chan); 248 status = ioat_chansts(chan);
249 if (is_ioat_active(status) || is_ioat_idle(status)) 249 if (is_ioat_active(status) || is_ioat_idle(status))
250 ioat_suspend(chan); 250 ioat_suspend(chan);
251 while (is_ioat_active(status) || is_ioat_idle(status)) { 251 while (is_ioat_active(status) || is_ioat_idle(status)) {
252 if (end && time_after(jiffies, end)) {
253 err = -ETIMEDOUT;
254 break;
255 }
252 status = ioat_chansts(chan); 256 status = ioat_chansts(chan);
253 cpu_relax(); 257 cpu_relax();
254 } 258 }
255 259
260 return err;
261}
262
263int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo)
264{
265 unsigned long end = jiffies + tmo;
266 int err = 0;
267
268 ioat_reset(chan);
269 while (ioat_reset_pending(chan)) {
270 if (end && time_after(jiffies, end)) {
271 err = -ETIMEDOUT;
272 break;
273 }
274 cpu_relax();
275 }
276
277 return err;
278}
279
280static void ioat2_restart_channel(struct ioat2_dma_chan *ioat)
281{
282 struct ioat_chan_common *chan = &ioat->base;
283 unsigned long phys_complete;
284
285 ioat2_quiesce(chan, 0);
256 if (ioat_cleanup_preamble(chan, &phys_complete)) 286 if (ioat_cleanup_preamble(chan, &phys_complete))
257 __cleanup(ioat, phys_complete); 287 __cleanup(ioat, phys_complete);
258 288
@@ -318,6 +348,19 @@ void ioat2_timer_event(unsigned long data)
318 spin_unlock_bh(&chan->cleanup_lock); 348 spin_unlock_bh(&chan->cleanup_lock);
319} 349}
320 350
351static int ioat2_reset_hw(struct ioat_chan_common *chan)
352{
353 /* throw away whatever the channel was doing and get it initialized */
354 u32 chanerr;
355
356 ioat2_quiesce(chan, msecs_to_jiffies(100));
357
358 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
359 writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET);
360
361 return ioat2_reset_sync(chan, msecs_to_jiffies(200));
362}
363
321/** 364/**
322 * ioat2_enumerate_channels - find and initialize the device's channels 365 * ioat2_enumerate_channels - find and initialize the device's channels
323 * @device: the device to be enumerated 366 * @device: the device to be enumerated
@@ -360,6 +403,10 @@ int ioat2_enumerate_channels(struct ioatdma_device *device)
360 (unsigned long) ioat); 403 (unsigned long) ioat);
361 ioat->xfercap_log = xfercap_log; 404 ioat->xfercap_log = xfercap_log;
362 spin_lock_init(&ioat->ring_lock); 405 spin_lock_init(&ioat->ring_lock);
406 if (device->reset_hw(&ioat->base)) {
407 i = 0;
408 break;
409 }
363 } 410 }
364 dma->chancnt = i; 411 dma->chancnt = i;
365 return i; 412 return i;
@@ -467,7 +514,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
467 struct ioat2_dma_chan *ioat = to_ioat2_chan(c); 514 struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
468 struct ioat_chan_common *chan = &ioat->base; 515 struct ioat_chan_common *chan = &ioat->base;
469 struct ioat_ring_ent **ring; 516 struct ioat_ring_ent **ring;
470 u32 chanerr;
471 int order; 517 int order;
472 518
473 /* have we already been set up? */ 519 /* have we already been set up? */
@@ -477,12 +523,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
477 /* Setup register to interrupt and write completion status on error */ 523 /* Setup register to interrupt and write completion status on error */
478 writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET); 524 writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET);
479 525
480 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
481 if (chanerr) {
482 dev_err(to_dev(chan), "CHANERR = %x, clearing\n", chanerr);
483 writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET);
484 }
485
486 /* allocate a completion writeback area */ 526 /* allocate a completion writeback area */
487 /* doing 2 32bit writes to mmio since 1 64b write doesn't work */ 527 /* doing 2 32bit writes to mmio since 1 64b write doesn't work */
488 chan->completion = pci_pool_alloc(chan->device->completion_pool, 528 chan->completion = pci_pool_alloc(chan->device->completion_pool,
@@ -746,13 +786,7 @@ void ioat2_free_chan_resources(struct dma_chan *c)
746 tasklet_disable(&chan->cleanup_task); 786 tasklet_disable(&chan->cleanup_task);
747 del_timer_sync(&chan->timer); 787 del_timer_sync(&chan->timer);
748 device->cleanup_tasklet((unsigned long) ioat); 788 device->cleanup_tasklet((unsigned long) ioat);
749 789 device->reset_hw(chan);
750 /* Delay 100ms after reset to allow internal DMA logic to quiesce
751 * before removing DMA descriptor resources.
752 */
753 writeb(IOAT_CHANCMD_RESET,
754 chan->reg_base + IOAT_CHANCMD_OFFSET(chan->device->version));
755 mdelay(100);
756 790
757 spin_lock_bh(&ioat->ring_lock); 791 spin_lock_bh(&ioat->ring_lock);
758 descs = ioat2_ring_space(ioat); 792 descs = ioat2_ring_space(ioat);
@@ -839,6 +873,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca)
839 int err; 873 int err;
840 874
841 device->enumerate_channels = ioat2_enumerate_channels; 875 device->enumerate_channels = ioat2_enumerate_channels;
876 device->reset_hw = ioat2_reset_hw;
842 device->cleanup_tasklet = ioat2_cleanup_tasklet; 877 device->cleanup_tasklet = ioat2_cleanup_tasklet;
843 device->timer_fn = ioat2_timer_event; 878 device->timer_fn = ioat2_timer_event;
844 device->self_test = ioat_dma_self_test; 879 device->self_test = ioat_dma_self_test;
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h
index 1d849ef74d5f..3afad8da43cc 100644
--- a/drivers/dma/ioat/dma_v2.h
+++ b/drivers/dma/ioat/dma_v2.h
@@ -185,6 +185,8 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order);
185void __ioat2_issue_pending(struct ioat2_dma_chan *ioat); 185void __ioat2_issue_pending(struct ioat2_dma_chan *ioat);
186void ioat2_cleanup_tasklet(unsigned long data); 186void ioat2_cleanup_tasklet(unsigned long data);
187void ioat2_timer_event(unsigned long data); 187void ioat2_timer_event(unsigned long data);
188int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo);
189int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo);
188extern struct kobj_type ioat2_ktype; 190extern struct kobj_type ioat2_ktype;
189extern struct kmem_cache *ioat2_cache; 191extern struct kmem_cache *ioat2_cache;
190#endif /* IOATDMA_V2_H */ 192#endif /* IOATDMA_V2_H */
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index 42f6f10fb0cc..9908c9e94b2d 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -650,9 +650,11 @@ __ioat3_prep_pq_lock(struct dma_chan *c, enum sum_check_flags *result,
650 650
651 num_descs = ioat2_xferlen_to_descs(ioat, len); 651 num_descs = ioat2_xferlen_to_descs(ioat, len);
652 /* we need 2x the number of descriptors to cover greater than 3 652 /* we need 2x the number of descriptors to cover greater than 3
653 * sources 653 * sources (we need 1 extra source in the q-only continuation
654 * case and 3 extra sources in the p+q continuation case.
654 */ 655 */
655 if (src_cnt > 3 || flags & DMA_PREP_CONTINUE) { 656 if (src_cnt + dmaf_p_disabled_continue(flags) > 3 ||
657 (dmaf_continue(flags) && !dmaf_p_disabled_continue(flags))) {
656 with_ext = 1; 658 with_ext = 1;
657 num_descs *= 2; 659 num_descs *= 2;
658 } else 660 } else
@@ -1128,6 +1130,45 @@ static int __devinit ioat3_dma_self_test(struct ioatdma_device *device)
1128 return 0; 1130 return 0;
1129} 1131}
1130 1132
1133static int ioat3_reset_hw(struct ioat_chan_common *chan)
1134{
1135 /* throw away whatever the channel was doing and get it
1136 * initialized, with ioat3 specific workarounds
1137 */
1138 struct ioatdma_device *device = chan->device;
1139 struct pci_dev *pdev = device->pdev;
1140 u32 chanerr;
1141 u16 dev_id;
1142 int err;
1143
1144 ioat2_quiesce(chan, msecs_to_jiffies(100));
1145
1146 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
1147 writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET);
1148
1149 /* -= IOAT ver.3 workarounds =- */
1150 /* Write CHANERRMSK_INT with 3E07h to mask out the errors
1151 * that can cause stability issues for IOAT ver.3, and clear any
1152 * pending errors
1153 */
1154 pci_write_config_dword(pdev, IOAT_PCI_CHANERRMASK_INT_OFFSET, 0x3e07);
1155 err = pci_read_config_dword(pdev, IOAT_PCI_CHANERR_INT_OFFSET, &chanerr);
1156 if (err) {
1157 dev_err(&pdev->dev, "channel error register unreachable\n");
1158 return err;
1159 }
1160 pci_write_config_dword(pdev, IOAT_PCI_CHANERR_INT_OFFSET, chanerr);
1161
1162 /* Clear DMAUNCERRSTS Cfg-Reg Parity Error status bit
1163 * (workaround for spurious config parity error after restart)
1164 */
1165 pci_read_config_word(pdev, IOAT_PCI_DEVICE_ID_OFFSET, &dev_id);
1166 if (dev_id == PCI_DEVICE_ID_INTEL_IOAT_TBG0)
1167 pci_write_config_dword(pdev, IOAT_PCI_DMAUNCERRSTS_OFFSET, 0x10);
1168
1169 return ioat2_reset_sync(chan, msecs_to_jiffies(200));
1170}
1171
1131int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) 1172int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
1132{ 1173{
1133 struct pci_dev *pdev = device->pdev; 1174 struct pci_dev *pdev = device->pdev;
@@ -1137,10 +1178,10 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
1137 struct ioat_chan_common *chan; 1178 struct ioat_chan_common *chan;
1138 bool is_raid_device = false; 1179 bool is_raid_device = false;
1139 int err; 1180 int err;
1140 u16 dev_id;
1141 u32 cap; 1181 u32 cap;
1142 1182
1143 device->enumerate_channels = ioat2_enumerate_channels; 1183 device->enumerate_channels = ioat2_enumerate_channels;
1184 device->reset_hw = ioat3_reset_hw;
1144 device->self_test = ioat3_dma_self_test; 1185 device->self_test = ioat3_dma_self_test;
1145 dma = &device->common; 1186 dma = &device->common;
1146 dma->device_prep_dma_memcpy = ioat2_dma_prep_memcpy_lock; 1187 dma->device_prep_dma_memcpy = ioat2_dma_prep_memcpy_lock;
@@ -1216,19 +1257,6 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
1216 dma->device_prep_dma_xor_val = NULL; 1257 dma->device_prep_dma_xor_val = NULL;
1217 #endif 1258 #endif
1218 1259
1219 /* -= IOAT ver.3 workarounds =- */
1220 /* Write CHANERRMSK_INT with 3E07h to mask out the errors
1221 * that can cause stability issues for IOAT ver.3
1222 */
1223 pci_write_config_dword(pdev, IOAT_PCI_CHANERRMASK_INT_OFFSET, 0x3e07);
1224
1225 /* Clear DMAUNCERRSTS Cfg-Reg Parity Error status bit
1226 * (workaround for spurious config parity error after restart)
1227 */
1228 pci_read_config_word(pdev, IOAT_PCI_DEVICE_ID_OFFSET, &dev_id);
1229 if (dev_id == PCI_DEVICE_ID_INTEL_IOAT_TBG0)
1230 pci_write_config_dword(pdev, IOAT_PCI_DMAUNCERRSTS_OFFSET, 0x10);
1231
1232 err = ioat_probe(device); 1260 err = ioat_probe(device);
1233 if (err) 1261 if (err)
1234 return err; 1262 return err;
diff --git a/drivers/dma/ioat/registers.h b/drivers/dma/ioat/registers.h
index f015ec196700..e8ae63baf588 100644
--- a/drivers/dma/ioat/registers.h
+++ b/drivers/dma/ioat/registers.h
@@ -27,6 +27,7 @@
27 27
28#define IOAT_PCI_DEVICE_ID_OFFSET 0x02 28#define IOAT_PCI_DEVICE_ID_OFFSET 0x02
29#define IOAT_PCI_DMAUNCERRSTS_OFFSET 0x148 29#define IOAT_PCI_DMAUNCERRSTS_OFFSET 0x148
30#define IOAT_PCI_CHANERR_INT_OFFSET 0x180
30#define IOAT_PCI_CHANERRMASK_INT_OFFSET 0x184 31#define IOAT_PCI_CHANERRMASK_INT_OFFSET 0x184
31 32
32/* MMIO Device Registers */ 33/* MMIO Device Registers */
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 2e4a54c8afeb..d10cc899c460 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -23,16 +23,19 @@
23#include <linux/dmaengine.h> 23#include <linux/dmaengine.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/dmapool.h>
27#include <linux/platform_device.h> 26#include <linux/platform_device.h>
28#include <cpu/dma.h> 27#include <cpu/dma.h>
29#include <asm/dma-sh.h> 28#include <asm/dma-sh.h>
30#include "shdma.h" 29#include "shdma.h"
31 30
32/* DMA descriptor control */ 31/* DMA descriptor control */
33#define DESC_LAST (-1) 32enum sh_dmae_desc_status {
34#define DESC_COMP (1) 33 DESC_IDLE,
35#define DESC_NCOMP (0) 34 DESC_PREPARED,
35 DESC_SUBMITTED,
36 DESC_COMPLETED, /* completed, have to call callback */
37 DESC_WAITING, /* callback called, waiting for ack / re-submit */
38};
36 39
37#define NR_DESCS_PER_CHANNEL 32 40#define NR_DESCS_PER_CHANNEL 32
38/* 41/*
@@ -45,6 +48,8 @@
45 */ 48 */
46#define RS_DEFAULT (RS_DUAL) 49#define RS_DEFAULT (RS_DUAL)
47 50
51static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all);
52
48#define SH_DMAC_CHAN_BASE(id) (dma_base_addr[id]) 53#define SH_DMAC_CHAN_BASE(id) (dma_base_addr[id])
49static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg) 54static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg)
50{ 55{
@@ -106,11 +111,11 @@ static inline unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan)
106 return ts_shift[(chcr & CHCR_TS_MASK) >> CHCR_TS_SHIFT]; 111 return ts_shift[(chcr & CHCR_TS_MASK) >> CHCR_TS_SHIFT];
107} 112}
108 113
109static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs hw) 114static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw)
110{ 115{
111 sh_dmae_writel(sh_chan, hw.sar, SAR); 116 sh_dmae_writel(sh_chan, hw->sar, SAR);
112 sh_dmae_writel(sh_chan, hw.dar, DAR); 117 sh_dmae_writel(sh_chan, hw->dar, DAR);
113 sh_dmae_writel(sh_chan, hw.tcr >> calc_xmit_shift(sh_chan), TCR); 118 sh_dmae_writel(sh_chan, hw->tcr >> calc_xmit_shift(sh_chan), TCR);
114} 119}
115 120
116static void dmae_start(struct sh_dmae_chan *sh_chan) 121static void dmae_start(struct sh_dmae_chan *sh_chan)
@@ -184,8 +189,9 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
184 189
185static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx) 190static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx)
186{ 191{
187 struct sh_desc *desc = tx_to_sh_desc(tx); 192 struct sh_desc *desc = tx_to_sh_desc(tx), *chunk, *last = desc, *c;
188 struct sh_dmae_chan *sh_chan = to_sh_chan(tx->chan); 193 struct sh_dmae_chan *sh_chan = to_sh_chan(tx->chan);
194 dma_async_tx_callback callback = tx->callback;
189 dma_cookie_t cookie; 195 dma_cookie_t cookie;
190 196
191 spin_lock_bh(&sh_chan->desc_lock); 197 spin_lock_bh(&sh_chan->desc_lock);
@@ -195,45 +201,53 @@ static dma_cookie_t sh_dmae_tx_submit(struct dma_async_tx_descriptor *tx)
195 if (cookie < 0) 201 if (cookie < 0)
196 cookie = 1; 202 cookie = 1;
197 203
198 /* If desc only in the case of 1 */ 204 sh_chan->common.cookie = cookie;
199 if (desc->async_tx.cookie != -EBUSY) 205 tx->cookie = cookie;
200 desc->async_tx.cookie = cookie; 206
201 sh_chan->common.cookie = desc->async_tx.cookie; 207 /* Mark all chunks of this descriptor as submitted, move to the queue */
208 list_for_each_entry_safe(chunk, c, desc->node.prev, node) {
209 /*
210 * All chunks are on the global ld_free, so, we have to find
211 * the end of the chain ourselves
212 */
213 if (chunk != desc && (chunk->mark == DESC_IDLE ||
214 chunk->async_tx.cookie > 0 ||
215 chunk->async_tx.cookie == -EBUSY ||
216 &chunk->node == &sh_chan->ld_free))
217 break;
218 chunk->mark = DESC_SUBMITTED;
219 /* Callback goes to the last chunk */
220 chunk->async_tx.callback = NULL;
221 chunk->cookie = cookie;
222 list_move_tail(&chunk->node, &sh_chan->ld_queue);
223 last = chunk;
224 }
225
226 last->async_tx.callback = callback;
227 last->async_tx.callback_param = tx->callback_param;
202 228
203 list_splice_init(&desc->tx_list, sh_chan->ld_queue.prev); 229 dev_dbg(sh_chan->dev, "submit #%d@%p on %d: %x[%d] -> %x\n",
230 tx->cookie, &last->async_tx, sh_chan->id,
231 desc->hw.sar, desc->hw.tcr, desc->hw.dar);
204 232
205 spin_unlock_bh(&sh_chan->desc_lock); 233 spin_unlock_bh(&sh_chan->desc_lock);
206 234
207 return cookie; 235 return cookie;
208} 236}
209 237
238/* Called with desc_lock held */
210static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan) 239static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
211{ 240{
212 struct sh_desc *desc, *_desc, *ret = NULL; 241 struct sh_desc *desc;
213 242
214 spin_lock_bh(&sh_chan->desc_lock); 243 list_for_each_entry(desc, &sh_chan->ld_free, node)
215 list_for_each_entry_safe(desc, _desc, &sh_chan->ld_free, node) { 244 if (desc->mark != DESC_PREPARED) {
216 if (async_tx_test_ack(&desc->async_tx)) { 245 BUG_ON(desc->mark != DESC_IDLE);
217 list_del(&desc->node); 246 list_del(&desc->node);
218 ret = desc; 247 return desc;
219 break;
220 } 248 }
221 }
222 spin_unlock_bh(&sh_chan->desc_lock);
223
224 return ret;
225}
226
227static void sh_dmae_put_desc(struct sh_dmae_chan *sh_chan, struct sh_desc *desc)
228{
229 if (desc) {
230 spin_lock_bh(&sh_chan->desc_lock);
231
232 list_splice_init(&desc->tx_list, &sh_chan->ld_free);
233 list_add(&desc->node, &sh_chan->ld_free);
234 249
235 spin_unlock_bh(&sh_chan->desc_lock); 250 return NULL;
236 }
237} 251}
238 252
239static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) 253static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
@@ -252,11 +266,10 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
252 dma_async_tx_descriptor_init(&desc->async_tx, 266 dma_async_tx_descriptor_init(&desc->async_tx,
253 &sh_chan->common); 267 &sh_chan->common);
254 desc->async_tx.tx_submit = sh_dmae_tx_submit; 268 desc->async_tx.tx_submit = sh_dmae_tx_submit;
255 desc->async_tx.flags = DMA_CTRL_ACK; 269 desc->mark = DESC_IDLE;
256 INIT_LIST_HEAD(&desc->tx_list);
257 sh_dmae_put_desc(sh_chan, desc);
258 270
259 spin_lock_bh(&sh_chan->desc_lock); 271 spin_lock_bh(&sh_chan->desc_lock);
272 list_add(&desc->node, &sh_chan->ld_free);
260 sh_chan->descs_allocated++; 273 sh_chan->descs_allocated++;
261 } 274 }
262 spin_unlock_bh(&sh_chan->desc_lock); 275 spin_unlock_bh(&sh_chan->desc_lock);
@@ -273,7 +286,10 @@ static void sh_dmae_free_chan_resources(struct dma_chan *chan)
273 struct sh_desc *desc, *_desc; 286 struct sh_desc *desc, *_desc;
274 LIST_HEAD(list); 287 LIST_HEAD(list);
275 288
276 BUG_ON(!list_empty(&sh_chan->ld_queue)); 289 /* Prepared and not submitted descriptors can still be on the queue */
290 if (!list_empty(&sh_chan->ld_queue))
291 sh_dmae_chan_ld_cleanup(sh_chan, true);
292
277 spin_lock_bh(&sh_chan->desc_lock); 293 spin_lock_bh(&sh_chan->desc_lock);
278 294
279 list_splice_init(&sh_chan->ld_free, &list); 295 list_splice_init(&sh_chan->ld_free, &list);
@@ -292,6 +308,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
292 struct sh_dmae_chan *sh_chan; 308 struct sh_dmae_chan *sh_chan;
293 struct sh_desc *first = NULL, *prev = NULL, *new; 309 struct sh_desc *first = NULL, *prev = NULL, *new;
294 size_t copy_size; 310 size_t copy_size;
311 LIST_HEAD(tx_list);
312 int chunks = (len + SH_DMA_TCR_MAX) / (SH_DMA_TCR_MAX + 1);
295 313
296 if (!chan) 314 if (!chan)
297 return NULL; 315 return NULL;
@@ -301,108 +319,189 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
301 319
302 sh_chan = to_sh_chan(chan); 320 sh_chan = to_sh_chan(chan);
303 321
322 /* Have to lock the whole loop to protect against concurrent release */
323 spin_lock_bh(&sh_chan->desc_lock);
324
325 /*
326 * Chaining:
327 * first descriptor is what user is dealing with in all API calls, its
328 * cookie is at first set to -EBUSY, at tx-submit to a positive
329 * number
330 * if more than one chunk is needed further chunks have cookie = -EINVAL
331 * the last chunk, if not equal to the first, has cookie = -ENOSPC
332 * all chunks are linked onto the tx_list head with their .node heads
333 * only during this function, then they are immediately spliced
334 * back onto the free list in form of a chain
335 */
304 do { 336 do {
305 /* Allocate the link descriptor from DMA pool */ 337 /* Allocate the link descriptor from the free list */
306 new = sh_dmae_get_desc(sh_chan); 338 new = sh_dmae_get_desc(sh_chan);
307 if (!new) { 339 if (!new) {
308 dev_err(sh_chan->dev, 340 dev_err(sh_chan->dev,
309 "No free memory for link descriptor\n"); 341 "No free memory for link descriptor\n");
310 goto err_get_desc; 342 list_for_each_entry(new, &tx_list, node)
343 new->mark = DESC_IDLE;
344 list_splice(&tx_list, &sh_chan->ld_free);
345 spin_unlock_bh(&sh_chan->desc_lock);
346 return NULL;
311 } 347 }
312 348
313 copy_size = min(len, (size_t)SH_DMA_TCR_MAX); 349 copy_size = min(len, (size_t)SH_DMA_TCR_MAX + 1);
314 350
315 new->hw.sar = dma_src; 351 new->hw.sar = dma_src;
316 new->hw.dar = dma_dest; 352 new->hw.dar = dma_dest;
317 new->hw.tcr = copy_size; 353 new->hw.tcr = copy_size;
318 if (!first) 354 if (!first) {
355 /* First desc */
356 new->async_tx.cookie = -EBUSY;
319 first = new; 357 first = new;
358 } else {
359 /* Other desc - invisible to the user */
360 new->async_tx.cookie = -EINVAL;
361 }
320 362
321 new->mark = DESC_NCOMP; 363 dev_dbg(sh_chan->dev,
322 async_tx_ack(&new->async_tx); 364 "chaining %u of %u with %p, dst %x, cookie %d\n",
365 copy_size, len, &new->async_tx, dma_dest,
366 new->async_tx.cookie);
367
368 new->mark = DESC_PREPARED;
369 new->async_tx.flags = flags;
370 new->chunks = chunks--;
323 371
324 prev = new; 372 prev = new;
325 len -= copy_size; 373 len -= copy_size;
326 dma_src += copy_size; 374 dma_src += copy_size;
327 dma_dest += copy_size; 375 dma_dest += copy_size;
328 /* Insert the link descriptor to the LD ring */ 376 /* Insert the link descriptor to the LD ring */
329 list_add_tail(&new->node, &first->tx_list); 377 list_add_tail(&new->node, &tx_list);
330 } while (len); 378 } while (len);
331 379
332 new->async_tx.flags = flags; /* client is in control of this ack */ 380 if (new != first)
333 new->async_tx.cookie = -EBUSY; /* Last desc */ 381 new->async_tx.cookie = -ENOSPC;
334 382
335 return &first->async_tx; 383 /* Put them back on the free list, so, they don't get lost */
384 list_splice_tail(&tx_list, &sh_chan->ld_free);
336 385
337err_get_desc: 386 spin_unlock_bh(&sh_chan->desc_lock);
338 sh_dmae_put_desc(sh_chan, first);
339 return NULL;
340 387
388 return &first->async_tx;
341} 389}
342 390
343/* 391static dma_async_tx_callback __ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
344 * sh_chan_ld_cleanup - Clean up link descriptors
345 *
346 * This function clean up the ld_queue of DMA channel.
347 */
348static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan)
349{ 392{
350 struct sh_desc *desc, *_desc; 393 struct sh_desc *desc, *_desc;
394 /* Is the "exposed" head of a chain acked? */
395 bool head_acked = false;
396 dma_cookie_t cookie = 0;
397 dma_async_tx_callback callback = NULL;
398 void *param = NULL;
351 399
352 spin_lock_bh(&sh_chan->desc_lock); 400 spin_lock_bh(&sh_chan->desc_lock);
353 list_for_each_entry_safe(desc, _desc, &sh_chan->ld_queue, node) { 401 list_for_each_entry_safe(desc, _desc, &sh_chan->ld_queue, node) {
354 dma_async_tx_callback callback; 402 struct dma_async_tx_descriptor *tx = &desc->async_tx;
355 void *callback_param; 403
356 404 BUG_ON(tx->cookie > 0 && tx->cookie != desc->cookie);
357 /* non send data */ 405 BUG_ON(desc->mark != DESC_SUBMITTED &&
358 if (desc->mark == DESC_NCOMP) 406 desc->mark != DESC_COMPLETED &&
407 desc->mark != DESC_WAITING);
408
409 /*
410 * queue is ordered, and we use this loop to (1) clean up all
411 * completed descriptors, and to (2) update descriptor flags of
412 * any chunks in a (partially) completed chain
413 */
414 if (!all && desc->mark == DESC_SUBMITTED &&
415 desc->cookie != cookie)
359 break; 416 break;
360 417
361 /* send data sesc */ 418 if (tx->cookie > 0)
362 callback = desc->async_tx.callback; 419 cookie = tx->cookie;
363 callback_param = desc->async_tx.callback_param;
364 420
365 /* Remove from ld_queue list */ 421 if (desc->mark == DESC_COMPLETED && desc->chunks == 1) {
366 list_splice_init(&desc->tx_list, &sh_chan->ld_free); 422 BUG_ON(sh_chan->completed_cookie != desc->cookie - 1);
423 sh_chan->completed_cookie = desc->cookie;
424 }
367 425
368 dev_dbg(sh_chan->dev, "link descriptor %p will be recycle.\n", 426 /* Call callback on the last chunk */
369 desc); 427 if (desc->mark == DESC_COMPLETED && tx->callback) {
428 desc->mark = DESC_WAITING;
429 callback = tx->callback;
430 param = tx->callback_param;
431 dev_dbg(sh_chan->dev, "descriptor #%d@%p on %d callback\n",
432 tx->cookie, tx, sh_chan->id);
433 BUG_ON(desc->chunks != 1);
434 break;
435 }
370 436
371 list_move(&desc->node, &sh_chan->ld_free); 437 if (tx->cookie > 0 || tx->cookie == -EBUSY) {
372 /* Run the link descriptor callback function */ 438 if (desc->mark == DESC_COMPLETED) {
373 if (callback) { 439 BUG_ON(tx->cookie < 0);
374 spin_unlock_bh(&sh_chan->desc_lock); 440 desc->mark = DESC_WAITING;
375 dev_dbg(sh_chan->dev, "link descriptor %p callback\n", 441 }
376 desc); 442 head_acked = async_tx_test_ack(tx);
377 callback(callback_param); 443 } else {
378 spin_lock_bh(&sh_chan->desc_lock); 444 switch (desc->mark) {
445 case DESC_COMPLETED:
446 desc->mark = DESC_WAITING;
447 /* Fall through */
448 case DESC_WAITING:
449 if (head_acked)
450 async_tx_ack(&desc->async_tx);
451 }
452 }
453
454 dev_dbg(sh_chan->dev, "descriptor %p #%d completed.\n",
455 tx, tx->cookie);
456
457 if (((desc->mark == DESC_COMPLETED ||
458 desc->mark == DESC_WAITING) &&
459 async_tx_test_ack(&desc->async_tx)) || all) {
460 /* Remove from ld_queue list */
461 desc->mark = DESC_IDLE;
462 list_move(&desc->node, &sh_chan->ld_free);
379 } 463 }
380 } 464 }
381 spin_unlock_bh(&sh_chan->desc_lock); 465 spin_unlock_bh(&sh_chan->desc_lock);
466
467 if (callback)
468 callback(param);
469
470 return callback;
471}
472
473/*
474 * sh_chan_ld_cleanup - Clean up link descriptors
475 *
476 * This function cleans up the ld_queue of DMA channel.
477 */
478static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
479{
480 while (__ld_cleanup(sh_chan, all))
481 ;
382} 482}
383 483
384static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan) 484static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan)
385{ 485{
386 struct list_head *ld_node; 486 struct sh_desc *sd;
387 struct sh_dmae_regs hw;
388 487
488 spin_lock_bh(&sh_chan->desc_lock);
389 /* DMA work check */ 489 /* DMA work check */
390 if (dmae_is_busy(sh_chan)) 490 if (dmae_is_busy(sh_chan)) {
491 spin_unlock_bh(&sh_chan->desc_lock);
391 return; 492 return;
493 }
392 494
393 /* Find the first un-transfer desciptor */ 495 /* Find the first un-transfer desciptor */
394 for (ld_node = sh_chan->ld_queue.next; 496 list_for_each_entry(sd, &sh_chan->ld_queue, node)
395 (ld_node != &sh_chan->ld_queue) 497 if (sd->mark == DESC_SUBMITTED) {
396 && (to_sh_desc(ld_node)->mark == DESC_COMP); 498 /* Get the ld start address from ld_queue */
397 ld_node = ld_node->next) 499 dmae_set_reg(sh_chan, &sd->hw);
398 cpu_relax(); 500 dmae_start(sh_chan);
399 501 break;
400 if (ld_node != &sh_chan->ld_queue) { 502 }
401 /* Get the ld start address from ld_queue */ 503
402 hw = to_sh_desc(ld_node)->hw; 504 spin_unlock_bh(&sh_chan->desc_lock);
403 dmae_set_reg(sh_chan, hw);
404 dmae_start(sh_chan);
405 }
406} 505}
407 506
408static void sh_dmae_memcpy_issue_pending(struct dma_chan *chan) 507static void sh_dmae_memcpy_issue_pending(struct dma_chan *chan)
@@ -420,12 +519,11 @@ static enum dma_status sh_dmae_is_complete(struct dma_chan *chan,
420 dma_cookie_t last_used; 519 dma_cookie_t last_used;
421 dma_cookie_t last_complete; 520 dma_cookie_t last_complete;
422 521
423 sh_dmae_chan_ld_cleanup(sh_chan); 522 sh_dmae_chan_ld_cleanup(sh_chan, false);
424 523
425 last_used = chan->cookie; 524 last_used = chan->cookie;
426 last_complete = sh_chan->completed_cookie; 525 last_complete = sh_chan->completed_cookie;
427 if (last_complete == -EBUSY) 526 BUG_ON(last_complete < 0);
428 last_complete = last_used;
429 527
430 if (done) 528 if (done)
431 *done = last_complete; 529 *done = last_complete;
@@ -480,11 +578,13 @@ static irqreturn_t sh_dmae_err(int irq, void *data)
480 err = sh_dmae_rst(0); 578 err = sh_dmae_rst(0);
481 if (err) 579 if (err)
482 return err; 580 return err;
581#ifdef SH_DMAC_BASE1
483 if (shdev->pdata.mode & SHDMA_DMAOR1) { 582 if (shdev->pdata.mode & SHDMA_DMAOR1) {
484 err = sh_dmae_rst(1); 583 err = sh_dmae_rst(1);
485 if (err) 584 if (err)
486 return err; 585 return err;
487 } 586 }
587#endif
488 disable_irq(irq); 588 disable_irq(irq);
489 return IRQ_HANDLED; 589 return IRQ_HANDLED;
490 } 590 }
@@ -494,35 +594,25 @@ static irqreturn_t sh_dmae_err(int irq, void *data)
494static void dmae_do_tasklet(unsigned long data) 594static void dmae_do_tasklet(unsigned long data)
495{ 595{
496 struct sh_dmae_chan *sh_chan = (struct sh_dmae_chan *)data; 596 struct sh_dmae_chan *sh_chan = (struct sh_dmae_chan *)data;
497 struct sh_desc *desc, *_desc, *cur_desc = NULL; 597 struct sh_desc *desc;
498 u32 sar_buf = sh_dmae_readl(sh_chan, SAR); 598 u32 sar_buf = sh_dmae_readl(sh_chan, SAR);
499 599
500 list_for_each_entry_safe(desc, _desc, 600 spin_lock(&sh_chan->desc_lock);
501 &sh_chan->ld_queue, node) { 601 list_for_each_entry(desc, &sh_chan->ld_queue, node) {
502 if ((desc->hw.sar + desc->hw.tcr) == sar_buf) { 602 if ((desc->hw.sar + desc->hw.tcr) == sar_buf &&
503 cur_desc = desc; 603 desc->mark == DESC_SUBMITTED) {
604 dev_dbg(sh_chan->dev, "done #%d@%p dst %u\n",
605 desc->async_tx.cookie, &desc->async_tx,
606 desc->hw.dar);
607 desc->mark = DESC_COMPLETED;
504 break; 608 break;
505 } 609 }
506 } 610 }
611 spin_unlock(&sh_chan->desc_lock);
507 612
508 if (cur_desc) {
509 switch (cur_desc->async_tx.cookie) {
510 case 0: /* other desc data */
511 break;
512 case -EBUSY: /* last desc */
513 sh_chan->completed_cookie =
514 cur_desc->async_tx.cookie;
515 break;
516 default: /* first desc ( 0 < )*/
517 sh_chan->completed_cookie =
518 cur_desc->async_tx.cookie - 1;
519 break;
520 }
521 cur_desc->mark = DESC_COMP;
522 }
523 /* Next desc */ 613 /* Next desc */
524 sh_chan_xfer_ld_queue(sh_chan); 614 sh_chan_xfer_ld_queue(sh_chan);
525 sh_dmae_chan_ld_cleanup(sh_chan); 615 sh_dmae_chan_ld_cleanup(sh_chan, false);
526} 616}
527 617
528static unsigned int get_dmae_irq(unsigned int id) 618static unsigned int get_dmae_irq(unsigned int id)
diff --git a/drivers/dma/shdma.h b/drivers/dma/shdma.h
index 60b81e529b42..108f1cffb6f5 100644
--- a/drivers/dma/shdma.h
+++ b/drivers/dma/shdma.h
@@ -13,9 +13,9 @@
13#ifndef __DMA_SHDMA_H 13#ifndef __DMA_SHDMA_H
14#define __DMA_SHDMA_H 14#define __DMA_SHDMA_H
15 15
16#include <linux/device.h>
17#include <linux/dmapool.h>
18#include <linux/dmaengine.h> 16#include <linux/dmaengine.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19 19
20#define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ 20#define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */
21 21
@@ -26,13 +26,16 @@ struct sh_dmae_regs {
26}; 26};
27 27
28struct sh_desc { 28struct sh_desc {
29 struct list_head tx_list;
30 struct sh_dmae_regs hw; 29 struct sh_dmae_regs hw;
31 struct list_head node; 30 struct list_head node;
32 struct dma_async_tx_descriptor async_tx; 31 struct dma_async_tx_descriptor async_tx;
32 dma_cookie_t cookie;
33 int chunks;
33 int mark; 34 int mark;
34}; 35};
35 36
37struct device;
38
36struct sh_dmae_chan { 39struct sh_dmae_chan {
37 dma_cookie_t completed_cookie; /* The maximum cookie completed */ 40 dma_cookie_t completed_cookie; /* The maximum cookie completed */
38 spinlock_t desc_lock; /* Descriptor operation lock */ 41 spinlock_t desc_lock; /* Descriptor operation lock */
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index df5b68433f34..c5facd951dda 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1700,11 +1700,14 @@ static void f10_map_sysaddr_to_csrow(struct mem_ctl_info *mci,
1700 */ 1700 */
1701static void amd64_debug_display_dimm_sizes(int ctrl, struct amd64_pvt *pvt) 1701static void amd64_debug_display_dimm_sizes(int ctrl, struct amd64_pvt *pvt)
1702{ 1702{
1703 int dimm, size0, size1; 1703 int dimm, size0, size1, factor = 0;
1704 u32 dbam; 1704 u32 dbam;
1705 u32 *dcsb; 1705 u32 *dcsb;
1706 1706
1707 if (boot_cpu_data.x86 == 0xf) { 1707 if (boot_cpu_data.x86 == 0xf) {
1708 if (pvt->dclr0 & F10_WIDTH_128)
1709 factor = 1;
1710
1708 /* K8 families < revF not supported yet */ 1711 /* K8 families < revF not supported yet */
1709 if (pvt->ext_model < K8_REV_F) 1712 if (pvt->ext_model < K8_REV_F)
1710 return; 1713 return;
@@ -1732,7 +1735,8 @@ static void amd64_debug_display_dimm_sizes(int ctrl, struct amd64_pvt *pvt)
1732 size1 = pvt->ops->dbam_to_cs(pvt, DBAM_DIMM(dimm, dbam)); 1735 size1 = pvt->ops->dbam_to_cs(pvt, DBAM_DIMM(dimm, dbam));
1733 1736
1734 edac_printk(KERN_DEBUG, EDAC_MC, " %d: %5dMB %d: %5dMB\n", 1737 edac_printk(KERN_DEBUG, EDAC_MC, " %d: %5dMB %d: %5dMB\n",
1735 dimm * 2, size0, dimm * 2 + 1, size1); 1738 dimm * 2, size0 << factor,
1739 dimm * 2 + 1, size1 << factor);
1736 } 1740 }
1737} 1741}
1738 1742
@@ -2345,7 +2349,7 @@ static void amd64_read_mc_registers(struct amd64_pvt *pvt)
2345 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCLR_0, &pvt->dclr0); 2349 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCLR_0, &pvt->dclr0);
2346 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCHR_0, &pvt->dchr0); 2350 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCHR_0, &pvt->dchr0);
2347 2351
2348 if (!dct_ganging_enabled(pvt)) { 2352 if (!dct_ganging_enabled(pvt) && boot_cpu_data.x86 >= 0x10) {
2349 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCLR_1, &pvt->dclr1); 2353 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCLR_1, &pvt->dclr1);
2350 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCHR_1, &pvt->dchr1); 2354 amd64_read_pci_cfg(pvt->dram_f2_ctl, F10_DCHR_1, &pvt->dchr1);
2351 } 2355 }
@@ -2686,9 +2690,8 @@ static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
2686 amd64_printk(KERN_WARNING, "%s", ecc_warning); 2690 amd64_printk(KERN_WARNING, "%s", ecc_warning);
2687 return -ENODEV; 2691 return -ENODEV;
2688 } 2692 }
2689 } else
2690 /* CLEAR the override, since BIOS controlled it */
2691 ecc_enable_override = 0; 2693 ecc_enable_override = 0;
2694 }
2692 2695
2693 return 0; 2696 return 0;
2694} 2697}
@@ -2925,16 +2928,15 @@ static void __devexit amd64_remove_one_instance(struct pci_dev *pdev)
2925 2928
2926 amd64_free_mc_sibling_devices(pvt); 2929 amd64_free_mc_sibling_devices(pvt);
2927 2930
2928 kfree(pvt);
2929 mci->pvt_info = NULL;
2930
2931 mci_lookup[pvt->mc_node_id] = NULL;
2932
2933 /* unregister from EDAC MCE */ 2931 /* unregister from EDAC MCE */
2934 amd_report_gart_errors(false); 2932 amd_report_gart_errors(false);
2935 amd_unregister_ecc_decoder(amd64_decode_bus_error); 2933 amd_unregister_ecc_decoder(amd64_decode_bus_error);
2936 2934
2937 /* Free the EDAC CORE resources */ 2935 /* Free the EDAC CORE resources */
2936 mci->pvt_info = NULL;
2937 mci_lookup[pvt->mc_node_id] = NULL;
2938
2939 kfree(pvt);
2938 edac_mc_free(mci); 2940 edac_mc_free(mci);
2939} 2941}
2940 2942
@@ -3011,25 +3013,29 @@ static void amd64_setup_pci_device(void)
3011static int __init amd64_edac_init(void) 3013static int __init amd64_edac_init(void)
3012{ 3014{
3013 int nb, err = -ENODEV; 3015 int nb, err = -ENODEV;
3016 bool load_ok = false;
3014 3017
3015 edac_printk(KERN_INFO, EDAC_MOD_STR, EDAC_AMD64_VERSION "\n"); 3018 edac_printk(KERN_INFO, EDAC_MOD_STR, EDAC_AMD64_VERSION "\n");
3016 3019
3017 opstate_init(); 3020 opstate_init();
3018 3021
3019 if (cache_k8_northbridges() < 0) 3022 if (cache_k8_northbridges() < 0)
3020 return err; 3023 goto err_ret;
3021 3024
3022 msrs = msrs_alloc(); 3025 msrs = msrs_alloc();
3026 if (!msrs)
3027 goto err_ret;
3023 3028
3024 err = pci_register_driver(&amd64_pci_driver); 3029 err = pci_register_driver(&amd64_pci_driver);
3025 if (err) 3030 if (err)
3026 return err; 3031 goto err_pci;
3027 3032
3028 /* 3033 /*
3029 * At this point, the array 'pvt_lookup[]' contains pointers to alloc'd 3034 * At this point, the array 'pvt_lookup[]' contains pointers to alloc'd
3030 * amd64_pvt structs. These will be used in the 2nd stage init function 3035 * amd64_pvt structs. These will be used in the 2nd stage init function
3031 * to finish initialization of the MC instances. 3036 * to finish initialization of the MC instances.
3032 */ 3037 */
3038 err = -ENODEV;
3033 for (nb = 0; nb < num_k8_northbridges; nb++) { 3039 for (nb = 0; nb < num_k8_northbridges; nb++) {
3034 if (!pvt_lookup[nb]) 3040 if (!pvt_lookup[nb])
3035 continue; 3041 continue;
@@ -3037,16 +3043,21 @@ static int __init amd64_edac_init(void)
3037 err = amd64_init_2nd_stage(pvt_lookup[nb]); 3043 err = amd64_init_2nd_stage(pvt_lookup[nb]);
3038 if (err) 3044 if (err)
3039 goto err_2nd_stage; 3045 goto err_2nd_stage;
3040 }
3041 3046
3042 amd64_setup_pci_device(); 3047 load_ok = true;
3048 }
3043 3049
3044 return 0; 3050 if (load_ok) {
3051 amd64_setup_pci_device();
3052 return 0;
3053 }
3045 3054
3046err_2nd_stage: 3055err_2nd_stage:
3047 debugf0("2nd stage failed\n");
3048 pci_unregister_driver(&amd64_pci_driver); 3056 pci_unregister_driver(&amd64_pci_driver);
3049 3057err_pci:
3058 msrs_free(msrs);
3059 msrs = NULL;
3060err_ret:
3050 return err; 3061 return err;
3051} 3062}
3052 3063
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index 422728cfe994..fb60a877d768 100644
--- a/drivers/edac/edac_pci_sysfs.c
+++ b/drivers/edac/edac_pci_sysfs.c
@@ -534,8 +534,6 @@ static void edac_pci_dev_parity_clear(struct pci_dev *dev)
534{ 534{
535 u8 header_type; 535 u8 header_type;
536 536
537 debugf0("%s()\n", __func__);
538
539 get_pci_parity_status(dev, 0); 537 get_pci_parity_status(dev, 0);
540 538
541 /* read the device TYPE, looking for bridges */ 539 /* read the device TYPE, looking for bridges */
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index 13efcd362072..a9371b36a9b9 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -1,5 +1,10 @@
1menu "IEEE 1394 (FireWire) support"
2 depends on PCI || BROKEN
3 # firewire-core does not depend on PCI but is
4 # not useful without PCI controller driver
5
1comment "You can enable one or both FireWire driver stacks." 6comment "You can enable one or both FireWire driver stacks."
2comment "See the help texts for more information." 7comment "The newer stack is recommended."
3 8
4config FIREWIRE 9config FIREWIRE
5 tristate "FireWire driver stack" 10 tristate "FireWire driver stack"
@@ -15,16 +20,6 @@ config FIREWIRE
15 To compile this driver as a module, say M here: the module will be 20 To compile this driver as a module, say M here: the module will be
16 called firewire-core. 21 called firewire-core.
17 22
18 This module functionally replaces ieee1394, raw1394, and video1394.
19 To access it from application programs, you generally need at least
20 libraw1394 v2. IIDC/DCAM applications need libdc1394 v2.
21 No libraries are required to access storage devices through the
22 firewire-sbp2 driver.
23
24 NOTE:
25 FireWire audio devices currently require the old drivers (ieee1394,
26 ohci1394, raw1394).
27
28config FIREWIRE_OHCI 23config FIREWIRE_OHCI
29 tristate "OHCI-1394 controllers" 24 tristate "OHCI-1394 controllers"
30 depends on PCI && FIREWIRE 25 depends on PCI && FIREWIRE
@@ -34,22 +29,7 @@ config FIREWIRE_OHCI
34 is the only chipset in use, so say Y here. 29 is the only chipset in use, so say Y here.
35 30
36 To compile this driver as a module, say M here: The module will be 31 To compile this driver as a module, say M here: The module will be
37 called firewire-ohci. It replaces ohci1394 of the classic IEEE 1394 32 called firewire-ohci.
38 stack.
39
40 NOTE:
41 If you want to install firewire-ohci and ohci1394 together, you
42 should configure them only as modules and blacklist the driver(s)
43 which you don't want to have auto-loaded. Add either
44
45 blacklist firewire-ohci
46 or
47 blacklist ohci1394
48 blacklist video1394
49 blacklist dv1394
50
51 to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf
52 depending on your distribution.
53 33
54config FIREWIRE_OHCI_DEBUG 34config FIREWIRE_OHCI_DEBUG
55 bool 35 bool
@@ -66,8 +46,7 @@ config FIREWIRE_SBP2
66 like scanners. 46 like scanners.
67 47
68 To compile this driver as a module, say M here: The module will be 48 To compile this driver as a module, say M here: The module will be
69 called firewire-sbp2. It replaces sbp2 of the classic IEEE 1394 49 called firewire-sbp2.
70 stack.
71 50
72 You should also enable support for disks, CD-ROMs, etc. in the SCSI 51 You should also enable support for disks, CD-ROMs, etc. in the SCSI
73 configuration section. 52 configuration section.
@@ -83,5 +62,8 @@ config FIREWIRE_NET
83 NOTE, this driver is not stable yet! 62 NOTE, this driver is not stable yet!
84 63
85 To compile this driver as a module, say M here: The module will be 64 To compile this driver as a module, say M here: The module will be
86 called firewire-net. It replaces eth1394 of the classic IEEE 1394 65 called firewire-net.
87 stack. 66
67source "drivers/ieee1394/Kconfig"
68
69endmenu
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 231e6ee5ba43..e6d63849e78e 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -601,8 +601,9 @@ static void release_request(struct client *client,
601 struct inbound_transaction_resource *r = container_of(resource, 601 struct inbound_transaction_resource *r = container_of(resource,
602 struct inbound_transaction_resource, resource); 602 struct inbound_transaction_resource, resource);
603 603
604 fw_send_response(client->device->card, r->request, 604 if (r->request)
605 RCODE_CONFLICT_ERROR); 605 fw_send_response(client->device->card, r->request,
606 RCODE_CONFLICT_ERROR);
606 kfree(r); 607 kfree(r);
607} 608}
608 609
@@ -645,7 +646,8 @@ static void handle_request(struct fw_card *card, struct fw_request *request,
645 failed: 646 failed:
646 kfree(r); 647 kfree(r);
647 kfree(e); 648 kfree(e);
648 fw_send_response(card, request, RCODE_CONFLICT_ERROR); 649 if (request)
650 fw_send_response(card, request, RCODE_CONFLICT_ERROR);
649} 651}
650 652
651static void release_address_handler(struct client *client, 653static void release_address_handler(struct client *client,
@@ -715,15 +717,18 @@ static int ioctl_send_response(struct client *client, void *buffer)
715 717
716 r = container_of(resource, struct inbound_transaction_resource, 718 r = container_of(resource, struct inbound_transaction_resource,
717 resource); 719 resource);
718 if (request->length < r->length) 720 if (r->request) {
719 r->length = request->length; 721 if (request->length < r->length)
720 722 r->length = request->length;
721 if (copy_from_user(r->data, u64_to_uptr(request->data), r->length)) { 723 if (copy_from_user(r->data, u64_to_uptr(request->data),
722 ret = -EFAULT; 724 r->length)) {
723 goto out; 725 ret = -EFAULT;
726 kfree(r->request);
727 goto out;
728 }
729 fw_send_response(client->device->card, r->request,
730 request->rcode);
724 } 731 }
725
726 fw_send_response(client->device->card, r->request, request->rcode);
727 out: 732 out:
728 kfree(r); 733 kfree(r);
729 734
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 842739df23e2..495849eb13cc 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -432,14 +432,20 @@ static struct fw_address_handler *lookup_overlapping_address_handler(
432 return NULL; 432 return NULL;
433} 433}
434 434
435static bool is_enclosing_handler(struct fw_address_handler *handler,
436 unsigned long long offset, size_t length)
437{
438 return handler->offset <= offset &&
439 offset + length <= handler->offset + handler->length;
440}
441
435static struct fw_address_handler *lookup_enclosing_address_handler( 442static struct fw_address_handler *lookup_enclosing_address_handler(
436 struct list_head *list, unsigned long long offset, size_t length) 443 struct list_head *list, unsigned long long offset, size_t length)
437{ 444{
438 struct fw_address_handler *handler; 445 struct fw_address_handler *handler;
439 446
440 list_for_each_entry(handler, list, link) { 447 list_for_each_entry(handler, list, link) {
441 if (handler->offset <= offset && 448 if (is_enclosing_handler(handler, offset, length))
442 offset + length <= handler->offset + handler->length)
443 return handler; 449 return handler;
444 } 450 }
445 451
@@ -465,6 +471,12 @@ const struct fw_address_region fw_unit_space_region =
465 { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, }; 471 { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, };
466#endif /* 0 */ 472#endif /* 0 */
467 473
474static bool is_in_fcp_region(u64 offset, size_t length)
475{
476 return offset >= (CSR_REGISTER_BASE | CSR_FCP_COMMAND) &&
477 offset + length <= (CSR_REGISTER_BASE | CSR_FCP_END);
478}
479
468/** 480/**
469 * fw_core_add_address_handler - register for incoming requests 481 * fw_core_add_address_handler - register for incoming requests
470 * @handler: callback 482 * @handler: callback
@@ -477,8 +489,11 @@ const struct fw_address_region fw_unit_space_region =
477 * give the details of the particular request. 489 * give the details of the particular request.
478 * 490 *
479 * Return value: 0 on success, non-zero otherwise. 491 * Return value: 0 on success, non-zero otherwise.
492 *
480 * The start offset of the handler's address region is determined by 493 * The start offset of the handler's address region is determined by
481 * fw_core_add_address_handler() and is returned in handler->offset. 494 * fw_core_add_address_handler() and is returned in handler->offset.
495 *
496 * Address allocations are exclusive, except for the FCP registers.
482 */ 497 */
483int fw_core_add_address_handler(struct fw_address_handler *handler, 498int fw_core_add_address_handler(struct fw_address_handler *handler,
484 const struct fw_address_region *region) 499 const struct fw_address_region *region)
@@ -498,10 +513,12 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
498 513
499 handler->offset = region->start; 514 handler->offset = region->start;
500 while (handler->offset + handler->length <= region->end) { 515 while (handler->offset + handler->length <= region->end) {
501 other = 516 if (is_in_fcp_region(handler->offset, handler->length))
502 lookup_overlapping_address_handler(&address_handler_list, 517 other = NULL;
503 handler->offset, 518 else
504 handler->length); 519 other = lookup_overlapping_address_handler
520 (&address_handler_list,
521 handler->offset, handler->length);
505 if (other != NULL) { 522 if (other != NULL) {
506 handler->offset += other->length; 523 handler->offset += other->length;
507 } else { 524 } else {
@@ -668,6 +685,9 @@ static struct fw_request *allocate_request(struct fw_packet *p)
668void fw_send_response(struct fw_card *card, 685void fw_send_response(struct fw_card *card,
669 struct fw_request *request, int rcode) 686 struct fw_request *request, int rcode)
670{ 687{
688 if (WARN_ONCE(!request, "invalid for FCP address handlers"))
689 return;
690
671 /* unified transaction or broadcast transaction: don't respond */ 691 /* unified transaction or broadcast transaction: don't respond */
672 if (request->ack != ACK_PENDING || 692 if (request->ack != ACK_PENDING ||
673 HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) { 693 HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) {
@@ -686,26 +706,15 @@ void fw_send_response(struct fw_card *card,
686} 706}
687EXPORT_SYMBOL(fw_send_response); 707EXPORT_SYMBOL(fw_send_response);
688 708
689void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) 709static void handle_exclusive_region_request(struct fw_card *card,
710 struct fw_packet *p,
711 struct fw_request *request,
712 unsigned long long offset)
690{ 713{
691 struct fw_address_handler *handler; 714 struct fw_address_handler *handler;
692 struct fw_request *request;
693 unsigned long long offset;
694 unsigned long flags; 715 unsigned long flags;
695 int tcode, destination, source; 716 int tcode, destination, source;
696 717
697 if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE)
698 return;
699
700 request = allocate_request(p);
701 if (request == NULL) {
702 /* FIXME: send statically allocated busy packet. */
703 return;
704 }
705
706 offset =
707 ((unsigned long long)
708 HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | p->header[2];
709 tcode = HEADER_GET_TCODE(p->header[0]); 718 tcode = HEADER_GET_TCODE(p->header[0]);
710 destination = HEADER_GET_DESTINATION(p->header[0]); 719 destination = HEADER_GET_DESTINATION(p->header[0]);
711 source = HEADER_GET_SOURCE(p->header[1]); 720 source = HEADER_GET_SOURCE(p->header[1]);
@@ -732,6 +741,73 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
732 request->data, request->length, 741 request->data, request->length,
733 handler->callback_data); 742 handler->callback_data);
734} 743}
744
745static void handle_fcp_region_request(struct fw_card *card,
746 struct fw_packet *p,
747 struct fw_request *request,
748 unsigned long long offset)
749{
750 struct fw_address_handler *handler;
751 unsigned long flags;
752 int tcode, destination, source;
753
754 if ((offset != (CSR_REGISTER_BASE | CSR_FCP_COMMAND) &&
755 offset != (CSR_REGISTER_BASE | CSR_FCP_RESPONSE)) ||
756 request->length > 0x200) {
757 fw_send_response(card, request, RCODE_ADDRESS_ERROR);
758
759 return;
760 }
761
762 tcode = HEADER_GET_TCODE(p->header[0]);
763 destination = HEADER_GET_DESTINATION(p->header[0]);
764 source = HEADER_GET_SOURCE(p->header[1]);
765
766 if (tcode != TCODE_WRITE_QUADLET_REQUEST &&
767 tcode != TCODE_WRITE_BLOCK_REQUEST) {
768 fw_send_response(card, request, RCODE_TYPE_ERROR);
769
770 return;
771 }
772
773 spin_lock_irqsave(&address_handler_lock, flags);
774 list_for_each_entry(handler, &address_handler_list, link) {
775 if (is_enclosing_handler(handler, offset, request->length))
776 handler->address_callback(card, NULL, tcode,
777 destination, source,
778 p->generation, p->speed,
779 offset, request->data,
780 request->length,
781 handler->callback_data);
782 }
783 spin_unlock_irqrestore(&address_handler_lock, flags);
784
785 fw_send_response(card, request, RCODE_COMPLETE);
786}
787
788void fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
789{
790 struct fw_request *request;
791 unsigned long long offset;
792
793 if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE)
794 return;
795
796 request = allocate_request(p);
797 if (request == NULL) {
798 /* FIXME: send statically allocated busy packet. */
799 return;
800 }
801
802 offset = ((u64)HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) |
803 p->header[2];
804
805 if (!is_in_fcp_region(offset, request->length))
806 handle_exclusive_region_request(card, p, request, offset);
807 else
808 handle_fcp_region_request(card, p, request, offset);
809
810}
735EXPORT_SYMBOL(fw_core_handle_request); 811EXPORT_SYMBOL(fw_core_handle_request);
736 812
737void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) 813void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 96768e160866..a61571c63c59 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -2226,7 +2226,6 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
2226 if (rest == 0) 2226 if (rest == 0)
2227 return -EINVAL; 2227 return -EINVAL;
2228 2228
2229 /* FIXME: make packet-per-buffer/dual-buffer a context option */
2230 while (rest > 0) { 2229 while (rest > 0) {
2231 d = context_get_descriptors(&ctx->context, 2230 d = context_get_descriptors(&ctx->context,
2232 z + header_z, &d_bus); 2231 z + header_z, &d_bus);
@@ -2470,7 +2469,10 @@ static int __devinit pci_probe(struct pci_dev *dev,
2470 } 2469 }
2471 2470
2472 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; 2471 version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff;
2472#if 0
2473 /* FIXME: make it a context option or remove dual-buffer mode */
2473 ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; 2474 ohci->use_dualbuffer = version >= OHCI_VERSION_1_1;
2475#endif
2474 2476
2475 /* dual-buffer mode is broken if more than one IR context is active */ 2477 /* dual-buffer mode is broken if more than one IR context is active */
2476 if (dev->vendor == PCI_VENDOR_ID_AGERE && 2478 if (dev->vendor == PCI_VENDOR_ID_AGERE &&
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index a019b49ecc9b..1f1d88ae68d6 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -172,6 +172,15 @@ config GPIO_ADP5520
172 To compile this driver as a module, choose M here: the module will 172 To compile this driver as a module, choose M here: the module will
173 be called adp5520-gpio. 173 be called adp5520-gpio.
174 174
175config GPIO_ADP5588
176 tristate "ADP5588 I2C GPIO expander"
177 depends on I2C
178 help
179 This option enables support for 18 GPIOs found
180 on Analog Devices ADP5588 GPIO Expanders.
181 To compile this driver as a module, choose M here: the module will be
182 called adp5588-gpio.
183
175comment "PCI GPIO expanders:" 184comment "PCI GPIO expanders:"
176 185
177config GPIO_CS5535 186config GPIO_CS5535
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 52fe4cf734c7..48687238edb1 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -5,6 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG
5obj-$(CONFIG_GPIOLIB) += gpiolib.o 5obj-$(CONFIG_GPIOLIB) += gpiolib.o
6 6
7obj-$(CONFIG_GPIO_ADP5520) += adp5520-gpio.o 7obj-$(CONFIG_GPIO_ADP5520) += adp5520-gpio.o
8obj-$(CONFIG_GPIO_ADP5588) += adp5588-gpio.o
8obj-$(CONFIG_GPIO_LANGWELL) += langwell_gpio.o 9obj-$(CONFIG_GPIO_LANGWELL) += langwell_gpio.o
9obj-$(CONFIG_GPIO_MAX7301) += max7301.o 10obj-$(CONFIG_GPIO_MAX7301) += max7301.o
10obj-$(CONFIG_GPIO_MAX732X) += max732x.o 11obj-$(CONFIG_GPIO_MAX732X) += max732x.o
diff --git a/drivers/gpio/adp5588-gpio.c b/drivers/gpio/adp5588-gpio.c
new file mode 100644
index 000000000000..afc097a16b33
--- /dev/null
+++ b/drivers/gpio/adp5588-gpio.c
@@ -0,0 +1,266 @@
1/*
2 * GPIO Chip driver for Analog Devices
3 * ADP5588 I/O Expander and QWERTY Keypad Controller
4 *
5 * Copyright 2009 Analog Devices Inc.
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/i2c.h>
14#include <linux/gpio.h>
15
16#include <linux/i2c/adp5588.h>
17
18#define DRV_NAME "adp5588-gpio"
19#define MAXGPIO 18
20#define ADP_BANK(offs) ((offs) >> 3)
21#define ADP_BIT(offs) (1u << ((offs) & 0x7))
22
23struct adp5588_gpio {
24 struct i2c_client *client;
25 struct gpio_chip gpio_chip;
26 struct mutex lock; /* protect cached dir, dat_out */
27 unsigned gpio_start;
28 uint8_t dat_out[3];
29 uint8_t dir[3];
30};
31
32static int adp5588_gpio_read(struct i2c_client *client, u8 reg)
33{
34 int ret = i2c_smbus_read_byte_data(client, reg);
35
36 if (ret < 0)
37 dev_err(&client->dev, "Read Error\n");
38
39 return ret;
40}
41
42static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val)
43{
44 int ret = i2c_smbus_write_byte_data(client, reg, val);
45
46 if (ret < 0)
47 dev_err(&client->dev, "Write Error\n");
48
49 return ret;
50}
51
52static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
53{
54 struct adp5588_gpio *dev =
55 container_of(chip, struct adp5588_gpio, gpio_chip);
56
57 return !!(adp5588_gpio_read(dev->client, GPIO_DAT_STAT1 + ADP_BANK(off))
58 & ADP_BIT(off));
59}
60
61static void adp5588_gpio_set_value(struct gpio_chip *chip,
62 unsigned off, int val)
63{
64 unsigned bank, bit;
65 struct adp5588_gpio *dev =
66 container_of(chip, struct adp5588_gpio, gpio_chip);
67
68 bank = ADP_BANK(off);
69 bit = ADP_BIT(off);
70
71 mutex_lock(&dev->lock);
72 if (val)
73 dev->dat_out[bank] |= bit;
74 else
75 dev->dat_out[bank] &= ~bit;
76
77 adp5588_gpio_write(dev->client, GPIO_DAT_OUT1 + bank,
78 dev->dat_out[bank]);
79 mutex_unlock(&dev->lock);
80}
81
82static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
83{
84 int ret;
85 unsigned bank;
86 struct adp5588_gpio *dev =
87 container_of(chip, struct adp5588_gpio, gpio_chip);
88
89 bank = ADP_BANK(off);
90
91 mutex_lock(&dev->lock);
92 dev->dir[bank] &= ~ADP_BIT(off);
93 ret = adp5588_gpio_write(dev->client, GPIO_DIR1 + bank, dev->dir[bank]);
94 mutex_unlock(&dev->lock);
95
96 return ret;
97}
98
99static int adp5588_gpio_direction_output(struct gpio_chip *chip,
100 unsigned off, int val)
101{
102 int ret;
103 unsigned bank, bit;
104 struct adp5588_gpio *dev =
105 container_of(chip, struct adp5588_gpio, gpio_chip);
106
107 bank = ADP_BANK(off);
108 bit = ADP_BIT(off);
109
110 mutex_lock(&dev->lock);
111 dev->dir[bank] |= bit;
112
113 if (val)
114 dev->dat_out[bank] |= bit;
115 else
116 dev->dat_out[bank] &= ~bit;
117
118 ret = adp5588_gpio_write(dev->client, GPIO_DAT_OUT1 + bank,
119 dev->dat_out[bank]);
120 ret |= adp5588_gpio_write(dev->client, GPIO_DIR1 + bank,
121 dev->dir[bank]);
122 mutex_unlock(&dev->lock);
123
124 return ret;
125}
126
127static int __devinit adp5588_gpio_probe(struct i2c_client *client,
128 const struct i2c_device_id *id)
129{
130 struct adp5588_gpio_platform_data *pdata = client->dev.platform_data;
131 struct adp5588_gpio *dev;
132 struct gpio_chip *gc;
133 int ret, i, revid;
134
135 if (pdata == NULL) {
136 dev_err(&client->dev, "missing platform data\n");
137 return -ENODEV;
138 }
139
140 if (!i2c_check_functionality(client->adapter,
141 I2C_FUNC_SMBUS_BYTE_DATA)) {
142 dev_err(&client->dev, "SMBUS Byte Data not Supported\n");
143 return -EIO;
144 }
145
146 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
147 if (dev == NULL) {
148 dev_err(&client->dev, "failed to alloc memory\n");
149 return -ENOMEM;
150 }
151
152 dev->client = client;
153
154 gc = &dev->gpio_chip;
155 gc->direction_input = adp5588_gpio_direction_input;
156 gc->direction_output = adp5588_gpio_direction_output;
157 gc->get = adp5588_gpio_get_value;
158 gc->set = adp5588_gpio_set_value;
159 gc->can_sleep = 1;
160
161 gc->base = pdata->gpio_start;
162 gc->ngpio = MAXGPIO;
163 gc->label = client->name;
164 gc->owner = THIS_MODULE;
165
166 mutex_init(&dev->lock);
167
168
169 ret = adp5588_gpio_read(dev->client, DEV_ID);
170 if (ret < 0)
171 goto err;
172
173 revid = ret & ADP5588_DEVICE_ID_MASK;
174
175 for (i = 0, ret = 0; i <= ADP_BANK(MAXGPIO); i++) {
176 dev->dat_out[i] = adp5588_gpio_read(client, GPIO_DAT_OUT1 + i);
177 dev->dir[i] = adp5588_gpio_read(client, GPIO_DIR1 + i);
178 ret |= adp5588_gpio_write(client, KP_GPIO1 + i, 0);
179 ret |= adp5588_gpio_write(client, GPIO_PULL1 + i,
180 (pdata->pullup_dis_mask >> (8 * i)) & 0xFF);
181
182 if (ret)
183 goto err;
184 }
185
186 ret = gpiochip_add(&dev->gpio_chip);
187 if (ret)
188 goto err;
189
190 dev_info(&client->dev, "gpios %d..%d on a %s Rev. %d\n",
191 gc->base, gc->base + gc->ngpio - 1,
192 client->name, revid);
193
194 if (pdata->setup) {
195 ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context);
196 if (ret < 0)
197 dev_warn(&client->dev, "setup failed, %d\n", ret);
198 }
199
200 i2c_set_clientdata(client, dev);
201 return 0;
202
203err:
204 kfree(dev);
205 return ret;
206}
207
208static int __devexit adp5588_gpio_remove(struct i2c_client *client)
209{
210 struct adp5588_gpio_platform_data *pdata = client->dev.platform_data;
211 struct adp5588_gpio *dev = i2c_get_clientdata(client);
212 int ret;
213
214 if (pdata->teardown) {
215 ret = pdata->teardown(client,
216 dev->gpio_chip.base, dev->gpio_chip.ngpio,
217 pdata->context);
218 if (ret < 0) {
219 dev_err(&client->dev, "teardown failed %d\n", ret);
220 return ret;
221 }
222 }
223
224 ret = gpiochip_remove(&dev->gpio_chip);
225 if (ret) {
226 dev_err(&client->dev, "gpiochip_remove failed %d\n", ret);
227 return ret;
228 }
229
230 kfree(dev);
231 return 0;
232}
233
234static const struct i2c_device_id adp5588_gpio_id[] = {
235 {DRV_NAME, 0},
236 {}
237};
238
239MODULE_DEVICE_TABLE(i2c, adp5588_gpio_id);
240
241static struct i2c_driver adp5588_gpio_driver = {
242 .driver = {
243 .name = DRV_NAME,
244 },
245 .probe = adp5588_gpio_probe,
246 .remove = __devexit_p(adp5588_gpio_remove),
247 .id_table = adp5588_gpio_id,
248};
249
250static int __init adp5588_gpio_init(void)
251{
252 return i2c_add_driver(&adp5588_gpio_driver);
253}
254
255module_init(adp5588_gpio_init);
256
257static void __exit adp5588_gpio_exit(void)
258{
259 i2c_del_driver(&adp5588_gpio_driver);
260}
261
262module_exit(adp5588_gpio_exit);
263
264MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
265MODULE_DESCRIPTION("GPIO ADP5588 Driver");
266MODULE_LICENSE("GPL");
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a25ad284a272..350842ad3632 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -858,8 +858,6 @@ int gpio_sysfs_set_active_low(unsigned gpio, int value)
858 desc = &gpio_desc[gpio]; 858 desc = &gpio_desc[gpio];
859 859
860 if (test_bit(FLAG_EXPORT, &desc->flags)) { 860 if (test_bit(FLAG_EXPORT, &desc->flags)) {
861 struct device *dev;
862
863 dev = class_find_device(&gpio_class, NULL, desc, match_export); 861 dev = class_find_device(&gpio_class, NULL, desc, match_export);
864 if (dev == NULL) { 862 if (dev == NULL) {
865 status = -ENODEV; 863 status = -ENODEV;
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c
index 628eae3e9b83..a1fce68e3bbe 100644
--- a/drivers/gpu/drm/ati_pcigart.c
+++ b/drivers/gpu/drm/ati_pcigart.c
@@ -39,8 +39,7 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
39 struct drm_ati_pcigart_info *gart_info) 39 struct drm_ati_pcigart_info *gart_info)
40{ 40{
41 gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, 41 gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
42 PAGE_SIZE, 42 PAGE_SIZE);
43 gart_info->table_mask);
44 if (gart_info->table_handle == NULL) 43 if (gart_info->table_handle == NULL)
45 return -ENOMEM; 44 return -ENOMEM;
46 45
@@ -112,6 +111,13 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
112 if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { 111 if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
113 DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); 112 DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
114 113
114 if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
115 DRM_ERROR("fail to set dma mask to 0x%Lx\n",
116 gart_info->table_mask);
117 ret = 1;
118 goto done;
119 }
120
115 ret = drm_ati_alloc_pcigart_table(dev, gart_info); 121 ret = drm_ati_alloc_pcigart_table(dev, gart_info);
116 if (ret) { 122 if (ret) {
117 DRM_ERROR("cannot allocate PCI GART page!\n"); 123 DRM_ERROR("cannot allocate PCI GART page!\n");
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 3d09e304f6f4..8417cc4c43f1 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
326 * As we're limiting the address to 2^32-1 (or less), 326 * As we're limiting the address to 2^32-1 (or less),
327 * casting it down to 32 bits is no problem, but we 327 * casting it down to 32 bits is no problem, but we
328 * need to point to a 64bit variable first. */ 328 * need to point to a 64bit variable first. */
329 dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL); 329 dmah = drm_pci_alloc(dev, map->size, map->size);
330 if (!dmah) { 330 if (!dmah) {
331 kfree(map); 331 kfree(map);
332 return -ENOMEM; 332 return -ENOMEM;
@@ -885,7 +885,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
885 885
886 while (entry->buf_count < count) { 886 while (entry->buf_count < count) {
887 887
888 dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful); 888 dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000);
889 889
890 if (!dmah) { 890 if (!dmah) {
891 /* Set count correctly so we free the proper amount. */ 891 /* Set count correctly so we free the proper amount. */
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 5124401f266a..d91fb8c0b7b3 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -158,6 +158,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] =
158 { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, 158 { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 },
159 { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, 159 { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 },
160 { DRM_MODE_CONNECTOR_TV, "TV", 0 }, 160 { DRM_MODE_CONNECTOR_TV, "TV", 0 },
161 { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 },
161}; 162};
162 163
163static struct drm_prop_enum_list drm_encoder_enum_list[] = 164static struct drm_prop_enum_list drm_encoder_enum_list[] =
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 4231d6db72ec..077313f0d47f 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -216,7 +216,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
216EXPORT_SYMBOL(drm_helper_crtc_in_use); 216EXPORT_SYMBOL(drm_helper_crtc_in_use);
217 217
218/** 218/**
219 * drm_disable_unused_functions - disable unused objects 219 * drm_helper_disable_unused_functions - disable unused objects
220 * @dev: DRM device 220 * @dev: DRM device
221 * 221 *
222 * LOCKING: 222 * LOCKING:
@@ -1032,7 +1032,7 @@ bool drm_helper_initial_config(struct drm_device *dev)
1032 /* 1032 /*
1033 * we shouldn't end up with no modes here. 1033 * we shouldn't end up with no modes here.
1034 */ 1034 */
1035 WARN(!count, "No connectors reported connected with modes\n"); 1035 printk(KERN_INFO "No connectors reported conncted with modes\n");
1036 1036
1037 drm_setup_crtcs(dev); 1037 drm_setup_crtcs(dev);
1038 1038
@@ -1162,6 +1162,9 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
1162int drm_helper_resume_force_mode(struct drm_device *dev) 1162int drm_helper_resume_force_mode(struct drm_device *dev)
1163{ 1163{
1164 struct drm_crtc *crtc; 1164 struct drm_crtc *crtc;
1165 struct drm_encoder *encoder;
1166 struct drm_encoder_helper_funcs *encoder_funcs;
1167 struct drm_crtc_helper_funcs *crtc_funcs;
1165 int ret; 1168 int ret;
1166 1169
1167 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 1170 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -1174,6 +1177,25 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
1174 1177
1175 if (ret == false) 1178 if (ret == false)
1176 DRM_ERROR("failed to set mode on crtc %p\n", crtc); 1179 DRM_ERROR("failed to set mode on crtc %p\n", crtc);
1180
1181 /* Turn off outputs that were already powered off */
1182 if (drm_helper_choose_crtc_dpms(crtc)) {
1183 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
1184
1185 if(encoder->crtc != crtc)
1186 continue;
1187
1188 encoder_funcs = encoder->helper_private;
1189 if (encoder_funcs->dpms)
1190 (*encoder_funcs->dpms) (encoder,
1191 drm_helper_choose_encoder_dpms(encoder));
1192
1193 crtc_funcs = crtc->helper_private;
1194 if (crtc_funcs->dpms)
1195 (*crtc_funcs->dpms) (crtc,
1196 drm_helper_choose_crtc_dpms(crtc));
1197 }
1198 }
1177 } 1199 }
1178 /* disable the unused connectors while restoring the modesetting */ 1200 /* disable the unused connectors while restoring the modesetting */
1179 drm_helper_disable_unused_functions(dev); 1201 drm_helper_disable_unused_functions(dev);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index ff2f1042cb44..766c46875a20 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -434,11 +434,11 @@ static int drm_version(struct drm_device *dev, void *data,
434 * Looks up the ioctl function in the ::ioctls table, checking for root 434 * Looks up the ioctl function in the ::ioctls table, checking for root
435 * previleges if so required, and dispatches to the respective function. 435 * previleges if so required, and dispatches to the respective function.
436 */ 436 */
437int drm_ioctl(struct inode *inode, struct file *filp, 437long drm_ioctl(struct file *filp,
438 unsigned int cmd, unsigned long arg) 438 unsigned int cmd, unsigned long arg)
439{ 439{
440 struct drm_file *file_priv = filp->private_data; 440 struct drm_file *file_priv = filp->private_data;
441 struct drm_device *dev = file_priv->minor->dev; 441 struct drm_device *dev;
442 struct drm_ioctl_desc *ioctl; 442 struct drm_ioctl_desc *ioctl;
443 drm_ioctl_t *func; 443 drm_ioctl_t *func;
444 unsigned int nr = DRM_IOCTL_NR(cmd); 444 unsigned int nr = DRM_IOCTL_NR(cmd);
@@ -446,6 +446,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
446 char stack_kdata[128]; 446 char stack_kdata[128];
447 char *kdata = NULL; 447 char *kdata = NULL;
448 448
449 dev = file_priv->minor->dev;
449 atomic_inc(&dev->ioctl_count); 450 atomic_inc(&dev->ioctl_count);
450 atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); 451 atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
451 ++file_priv->ioctl_count; 452 ++file_priv->ioctl_count;
@@ -501,7 +502,13 @@ int drm_ioctl(struct inode *inode, struct file *filp,
501 goto err_i1; 502 goto err_i1;
502 } 503 }
503 } 504 }
504 retcode = func(dev, kdata, file_priv); 505 if (ioctl->flags & DRM_UNLOCKED)
506 retcode = func(dev, kdata, file_priv);
507 else {
508 lock_kernel();
509 retcode = func(dev, kdata, file_priv);
510 unlock_kernel();
511 }
505 512
506 if (cmd & IOC_OUT) { 513 if (cmd & IOC_OUT) {
507 if (copy_to_user((void __user *)arg, kdata, 514 if (copy_to_user((void __user *)arg, kdata,
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index c39b26f1abed..defcaf108460 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -911,23 +911,27 @@ static int drm_cvt_modes(struct drm_connector *connector,
911 struct drm_device *dev = connector->dev; 911 struct drm_device *dev = connector->dev;
912 struct cvt_timing *cvt; 912 struct cvt_timing *cvt;
913 const int rates[] = { 60, 85, 75, 60, 50 }; 913 const int rates[] = { 60, 85, 75, 60, 50 };
914 const u8 empty[3] = { 0, 0, 0 };
914 915
915 for (i = 0; i < 4; i++) { 916 for (i = 0; i < 4; i++) {
916 int width, height; 917 int uninitialized_var(width), height;
917 cvt = &(timing->data.other_data.data.cvt[i]); 918 cvt = &(timing->data.other_data.data.cvt[i]);
918 919
919 height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2; 920 if (!memcmp(cvt->code, empty, 3))
920 switch (cvt->code[1] & 0xc0) { 921 continue;
922
923 height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2;
924 switch (cvt->code[1] & 0x0c) {
921 case 0x00: 925 case 0x00:
922 width = height * 4 / 3; 926 width = height * 4 / 3;
923 break; 927 break;
924 case 0x40: 928 case 0x04:
925 width = height * 16 / 9; 929 width = height * 16 / 9;
926 break; 930 break;
927 case 0x80: 931 case 0x08:
928 width = height * 16 / 10; 932 width = height * 16 / 10;
929 break; 933 break;
930 case 0xc0: 934 case 0x0c:
931 width = height * 15 / 9; 935 width = height * 15 / 9;
932 break; 936 break;
933 } 937 }
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1b49fa055f4f..1c2b7d44ec05 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -156,7 +156,7 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_connector *con
156 force = DRM_FORCE_ON; 156 force = DRM_FORCE_ON;
157 break; 157 break;
158 case 'D': 158 case 'D':
159 if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) || 159 if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) &&
160 (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) 160 (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB))
161 force = DRM_FORCE_ON; 161 force = DRM_FORCE_ON;
162 else 162 else
@@ -606,11 +606,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
606 return -EINVAL; 606 return -EINVAL;
607 607
608 /* Need to resize the fb object !!! */ 608 /* Need to resize the fb object !!! */
609 if (var->xres > fb->width || var->yres > fb->height) { 609 if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) {
610 DRM_ERROR("Requested width/height is greater than current fb " 610 DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb "
611 "object %dx%d > %dx%d\n", var->xres, var->yres, 611 "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel,
612 fb->width, fb->height); 612 fb->width, fb->height, fb->bits_per_pixel);
613 DRM_ERROR("Need resizing code.\n");
614 return -EINVAL; 613 return -EINVAL;
615 } 614 }
616 615
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index 282d9fdf9f4e..d61d185cf040 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -104,7 +104,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
104 &version->desc)) 104 &version->desc))
105 return -EFAULT; 105 return -EFAULT;
106 106
107 err = drm_ioctl(file->f_path.dentry->d_inode, file, 107 err = drm_ioctl(file,
108 DRM_IOCTL_VERSION, (unsigned long)version); 108 DRM_IOCTL_VERSION, (unsigned long)version);
109 if (err) 109 if (err)
110 return err; 110 return err;
@@ -145,8 +145,7 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd,
145 &u->unique)) 145 &u->unique))
146 return -EFAULT; 146 return -EFAULT;
147 147
148 err = drm_ioctl(file->f_path.dentry->d_inode, file, 148 err = drm_ioctl(file, DRM_IOCTL_GET_UNIQUE, (unsigned long)u);
149 DRM_IOCTL_GET_UNIQUE, (unsigned long)u);
150 if (err) 149 if (err)
151 return err; 150 return err;
152 151
@@ -174,8 +173,7 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
174 &u->unique)) 173 &u->unique))
175 return -EFAULT; 174 return -EFAULT;
176 175
177 return drm_ioctl(file->f_path.dentry->d_inode, file, 176 return drm_ioctl(file, DRM_IOCTL_SET_UNIQUE, (unsigned long)u);
178 DRM_IOCTL_SET_UNIQUE, (unsigned long)u);
179} 177}
180 178
181typedef struct drm_map32 { 179typedef struct drm_map32 {
@@ -205,8 +203,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
205 if (__put_user(idx, &map->offset)) 203 if (__put_user(idx, &map->offset))
206 return -EFAULT; 204 return -EFAULT;
207 205
208 err = drm_ioctl(file->f_path.dentry->d_inode, file, 206 err = drm_ioctl(file, DRM_IOCTL_GET_MAP, (unsigned long)map);
209 DRM_IOCTL_GET_MAP, (unsigned long)map);
210 if (err) 207 if (err)
211 return err; 208 return err;
212 209
@@ -246,8 +243,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
246 || __put_user(m32.flags, &map->flags)) 243 || __put_user(m32.flags, &map->flags))
247 return -EFAULT; 244 return -EFAULT;
248 245
249 err = drm_ioctl(file->f_path.dentry->d_inode, file, 246 err = drm_ioctl(file, DRM_IOCTL_ADD_MAP, (unsigned long)map);
250 DRM_IOCTL_ADD_MAP, (unsigned long)map);
251 if (err) 247 if (err)
252 return err; 248 return err;
253 249
@@ -284,8 +280,7 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd,
284 if (__put_user((void *)(unsigned long)handle, &map->handle)) 280 if (__put_user((void *)(unsigned long)handle, &map->handle))
285 return -EFAULT; 281 return -EFAULT;
286 282
287 return drm_ioctl(file->f_path.dentry->d_inode, file, 283 return drm_ioctl(file, DRM_IOCTL_RM_MAP, (unsigned long)map);
288 DRM_IOCTL_RM_MAP, (unsigned long)map);
289} 284}
290 285
291typedef struct drm_client32 { 286typedef struct drm_client32 {
@@ -314,8 +309,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd,
314 if (__put_user(idx, &client->idx)) 309 if (__put_user(idx, &client->idx))
315 return -EFAULT; 310 return -EFAULT;
316 311
317 err = drm_ioctl(file->f_path.dentry->d_inode, file, 312 err = drm_ioctl(file, DRM_IOCTL_GET_CLIENT, (unsigned long)client);
318 DRM_IOCTL_GET_CLIENT, (unsigned long)client);
319 if (err) 313 if (err)
320 return err; 314 return err;
321 315
@@ -351,8 +345,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
351 if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats))) 345 if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats)))
352 return -EFAULT; 346 return -EFAULT;
353 347
354 err = drm_ioctl(file->f_path.dentry->d_inode, file, 348 err = drm_ioctl(file, DRM_IOCTL_GET_STATS, (unsigned long)stats);
355 DRM_IOCTL_GET_STATS, (unsigned long)stats);
356 if (err) 349 if (err)
357 return err; 350 return err;
358 351
@@ -395,8 +388,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd,
395 || __put_user(agp_start, &buf->agp_start)) 388 || __put_user(agp_start, &buf->agp_start))
396 return -EFAULT; 389 return -EFAULT;
397 390
398 err = drm_ioctl(file->f_path.dentry->d_inode, file, 391 err = drm_ioctl(file, DRM_IOCTL_ADD_BUFS, (unsigned long)buf);
399 DRM_IOCTL_ADD_BUFS, (unsigned long)buf);
400 if (err) 392 if (err)
401 return err; 393 return err;
402 394
@@ -427,8 +419,7 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd,
427 || __put_user(b32.high_mark, &buf->high_mark)) 419 || __put_user(b32.high_mark, &buf->high_mark))
428 return -EFAULT; 420 return -EFAULT;
429 421
430 return drm_ioctl(file->f_path.dentry->d_inode, file, 422 return drm_ioctl(file, DRM_IOCTL_MARK_BUFS, (unsigned long)buf);
431 DRM_IOCTL_MARK_BUFS, (unsigned long)buf);
432} 423}
433 424
434typedef struct drm_buf_info32 { 425typedef struct drm_buf_info32 {
@@ -469,8 +460,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
469 || __put_user(list, &request->list)) 460 || __put_user(list, &request->list))
470 return -EFAULT; 461 return -EFAULT;
471 462
472 err = drm_ioctl(file->f_path.dentry->d_inode, file, 463 err = drm_ioctl(file, DRM_IOCTL_INFO_BUFS, (unsigned long)request);
473 DRM_IOCTL_INFO_BUFS, (unsigned long)request);
474 if (err) 464 if (err)
475 return err; 465 return err;
476 466
@@ -531,8 +521,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
531 || __put_user(list, &request->list)) 521 || __put_user(list, &request->list))
532 return -EFAULT; 522 return -EFAULT;
533 523
534 err = drm_ioctl(file->f_path.dentry->d_inode, file, 524 err = drm_ioctl(file, DRM_IOCTL_MAP_BUFS, (unsigned long)request);
535 DRM_IOCTL_MAP_BUFS, (unsigned long)request);
536 if (err) 525 if (err)
537 return err; 526 return err;
538 527
@@ -578,8 +567,7 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd,
578 &request->list)) 567 &request->list))
579 return -EFAULT; 568 return -EFAULT;
580 569
581 return drm_ioctl(file->f_path.dentry->d_inode, file, 570 return drm_ioctl(file, DRM_IOCTL_FREE_BUFS, (unsigned long)request);
582 DRM_IOCTL_FREE_BUFS, (unsigned long)request);
583} 571}
584 572
585typedef struct drm_ctx_priv_map32 { 573typedef struct drm_ctx_priv_map32 {
@@ -605,8 +593,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
605 &request->handle)) 593 &request->handle))
606 return -EFAULT; 594 return -EFAULT;
607 595
608 return drm_ioctl(file->f_path.dentry->d_inode, file, 596 return drm_ioctl(file, DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request);
609 DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request);
610} 597}
611 598
612static int compat_drm_getsareactx(struct file *file, unsigned int cmd, 599static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
@@ -628,8 +615,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
628 if (__put_user(ctx_id, &request->ctx_id)) 615 if (__put_user(ctx_id, &request->ctx_id))
629 return -EFAULT; 616 return -EFAULT;
630 617
631 err = drm_ioctl(file->f_path.dentry->d_inode, file, 618 err = drm_ioctl(file, DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request);
632 DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request);
633 if (err) 619 if (err)
634 return err; 620 return err;
635 621
@@ -664,8 +650,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
664 &res->contexts)) 650 &res->contexts))
665 return -EFAULT; 651 return -EFAULT;
666 652
667 err = drm_ioctl(file->f_path.dentry->d_inode, file, 653 err = drm_ioctl(file, DRM_IOCTL_RES_CTX, (unsigned long)res);
668 DRM_IOCTL_RES_CTX, (unsigned long)res);
669 if (err) 654 if (err)
670 return err; 655 return err;
671 656
@@ -718,8 +703,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd,
718 &d->request_sizes)) 703 &d->request_sizes))
719 return -EFAULT; 704 return -EFAULT;
720 705
721 err = drm_ioctl(file->f_path.dentry->d_inode, file, 706 err = drm_ioctl(file, DRM_IOCTL_DMA, (unsigned long)d);
722 DRM_IOCTL_DMA, (unsigned long)d);
723 if (err) 707 if (err)
724 return err; 708 return err;
725 709
@@ -751,8 +735,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
751 if (put_user(m32.mode, &mode->mode)) 735 if (put_user(m32.mode, &mode->mode))
752 return -EFAULT; 736 return -EFAULT;
753 737
754 return drm_ioctl(file->f_path.dentry->d_inode, file, 738 return drm_ioctl(file, DRM_IOCTL_AGP_ENABLE, (unsigned long)mode);
755 DRM_IOCTL_AGP_ENABLE, (unsigned long)mode);
756} 739}
757 740
758typedef struct drm_agp_info32 { 741typedef struct drm_agp_info32 {
@@ -781,8 +764,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd,
781 if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) 764 if (!access_ok(VERIFY_WRITE, info, sizeof(*info)))
782 return -EFAULT; 765 return -EFAULT;
783 766
784 err = drm_ioctl(file->f_path.dentry->d_inode, file, 767 err = drm_ioctl(file, DRM_IOCTL_AGP_INFO, (unsigned long)info);
785 DRM_IOCTL_AGP_INFO, (unsigned long)info);
786 if (err) 768 if (err)
787 return err; 769 return err;
788 770
@@ -827,16 +809,14 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
827 || __put_user(req32.type, &request->type)) 809 || __put_user(req32.type, &request->type))
828 return -EFAULT; 810 return -EFAULT;
829 811
830 err = drm_ioctl(file->f_path.dentry->d_inode, file, 812 err = drm_ioctl(file, DRM_IOCTL_AGP_ALLOC, (unsigned long)request);
831 DRM_IOCTL_AGP_ALLOC, (unsigned long)request);
832 if (err) 813 if (err)
833 return err; 814 return err;
834 815
835 if (__get_user(req32.handle, &request->handle) 816 if (__get_user(req32.handle, &request->handle)
836 || __get_user(req32.physical, &request->physical) 817 || __get_user(req32.physical, &request->physical)
837 || copy_to_user(argp, &req32, sizeof(req32))) { 818 || copy_to_user(argp, &req32, sizeof(req32))) {
838 drm_ioctl(file->f_path.dentry->d_inode, file, 819 drm_ioctl(file, DRM_IOCTL_AGP_FREE, (unsigned long)request);
839 DRM_IOCTL_AGP_FREE, (unsigned long)request);
840 return -EFAULT; 820 return -EFAULT;
841 } 821 }
842 822
@@ -856,8 +836,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd,
856 || __put_user(handle, &request->handle)) 836 || __put_user(handle, &request->handle))
857 return -EFAULT; 837 return -EFAULT;
858 838
859 return drm_ioctl(file->f_path.dentry->d_inode, file, 839 return drm_ioctl(file, DRM_IOCTL_AGP_FREE, (unsigned long)request);
860 DRM_IOCTL_AGP_FREE, (unsigned long)request);
861} 840}
862 841
863typedef struct drm_agp_binding32 { 842typedef struct drm_agp_binding32 {
@@ -881,8 +860,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
881 || __put_user(req32.offset, &request->offset)) 860 || __put_user(req32.offset, &request->offset))
882 return -EFAULT; 861 return -EFAULT;
883 862
884 return drm_ioctl(file->f_path.dentry->d_inode, file, 863 return drm_ioctl(file, DRM_IOCTL_AGP_BIND, (unsigned long)request);
885 DRM_IOCTL_AGP_BIND, (unsigned long)request);
886} 864}
887 865
888static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, 866static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
@@ -898,8 +876,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
898 || __put_user(handle, &request->handle)) 876 || __put_user(handle, &request->handle))
899 return -EFAULT; 877 return -EFAULT;
900 878
901 return drm_ioctl(file->f_path.dentry->d_inode, file, 879 return drm_ioctl(file, DRM_IOCTL_AGP_UNBIND, (unsigned long)request);
902 DRM_IOCTL_AGP_UNBIND, (unsigned long)request);
903} 880}
904#endif /* __OS_HAS_AGP */ 881#endif /* __OS_HAS_AGP */
905 882
@@ -923,8 +900,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
923 || __put_user(x, &request->size)) 900 || __put_user(x, &request->size))
924 return -EFAULT; 901 return -EFAULT;
925 902
926 err = drm_ioctl(file->f_path.dentry->d_inode, file, 903 err = drm_ioctl(file, DRM_IOCTL_SG_ALLOC, (unsigned long)request);
927 DRM_IOCTL_SG_ALLOC, (unsigned long)request);
928 if (err) 904 if (err)
929 return err; 905 return err;
930 906
@@ -950,8 +926,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
950 || __put_user(x << PAGE_SHIFT, &request->handle)) 926 || __put_user(x << PAGE_SHIFT, &request->handle))
951 return -EFAULT; 927 return -EFAULT;
952 928
953 return drm_ioctl(file->f_path.dentry->d_inode, file, 929 return drm_ioctl(file, DRM_IOCTL_SG_FREE, (unsigned long)request);
954 DRM_IOCTL_SG_FREE, (unsigned long)request);
955} 930}
956 931
957#if defined(CONFIG_X86) || defined(CONFIG_IA64) 932#if defined(CONFIG_X86) || defined(CONFIG_IA64)
@@ -981,8 +956,7 @@ static int compat_drm_update_draw(struct file *file, unsigned int cmd,
981 __put_user(update32.data, &request->data)) 956 __put_user(update32.data, &request->data))
982 return -EFAULT; 957 return -EFAULT;
983 958
984 err = drm_ioctl(file->f_path.dentry->d_inode, file, 959 err = drm_ioctl(file, DRM_IOCTL_UPDATE_DRAW, (unsigned long)request);
985 DRM_IOCTL_UPDATE_DRAW, (unsigned long)request);
986 return err; 960 return err;
987} 961}
988#endif 962#endif
@@ -1023,8 +997,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
1023 || __put_user(req32.request.signal, &request->request.signal)) 997 || __put_user(req32.request.signal, &request->request.signal))
1024 return -EFAULT; 998 return -EFAULT;
1025 999
1026 err = drm_ioctl(file->f_path.dentry->d_inode, file, 1000 err = drm_ioctl(file, DRM_IOCTL_WAIT_VBLANK, (unsigned long)request);
1027 DRM_IOCTL_WAIT_VBLANK, (unsigned long)request);
1028 if (err) 1001 if (err)
1029 return err; 1002 return err;
1030 1003
@@ -1094,16 +1067,14 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1094 * than always failing. 1067 * than always failing.
1095 */ 1068 */
1096 if (nr >= ARRAY_SIZE(drm_compat_ioctls)) 1069 if (nr >= ARRAY_SIZE(drm_compat_ioctls))
1097 return drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); 1070 return drm_ioctl(filp, cmd, arg);
1098 1071
1099 fn = drm_compat_ioctls[nr]; 1072 fn = drm_compat_ioctls[nr];
1100 1073
1101 lock_kernel(); /* XXX for now */
1102 if (fn != NULL) 1074 if (fn != NULL)
1103 ret = (*fn) (filp, cmd, arg); 1075 ret = (*fn) (filp, cmd, arg);
1104 else 1076 else
1105 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); 1077 ret = drm_ioctl(filp, cmd, arg);
1106 unlock_kernel();
1107 1078
1108 return ret; 1079 return ret;
1109} 1080}
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 7998ee66b317..b98384dbd9a7 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -115,6 +115,7 @@ void drm_vblank_cleanup(struct drm_device *dev)
115 115
116 dev->num_crtcs = 0; 116 dev->num_crtcs = 0;
117} 117}
118EXPORT_SYMBOL(drm_vblank_cleanup);
118 119
119int drm_vblank_init(struct drm_device *dev, int num_crtcs) 120int drm_vblank_init(struct drm_device *dev, int num_crtcs)
120{ 121{
@@ -163,7 +164,6 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
163 } 164 }
164 165
165 dev->vblank_disable_allowed = 0; 166 dev->vblank_disable_allowed = 0;
166
167 return 0; 167 return 0;
168 168
169err: 169err:
@@ -493,6 +493,9 @@ EXPORT_SYMBOL(drm_vblank_off);
493 */ 493 */
494void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) 494void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
495{ 495{
496 /* vblank is not initialized (IRQ not installed ?) */
497 if (!dev->num_crtcs)
498 return;
496 /* 499 /*
497 * To avoid all the problems that might happen if interrupts 500 * To avoid all the problems that might happen if interrupts
498 * were enabled/disabled around or between these calls, we just 501 * were enabled/disabled around or between these calls, we just
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index d7d7eac3ddd2..cdec32977129 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -358,7 +358,7 @@ struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
358 if (entry->size >= size + wasted) { 358 if (entry->size >= size + wasted) {
359 if (!best_match) 359 if (!best_match)
360 return entry; 360 return entry;
361 if (size < best_size) { 361 if (entry->size < best_size) {
362 best = entry; 362 best = entry;
363 best_size = entry->size; 363 best_size = entry->size;
364 } 364 }
@@ -408,7 +408,7 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
408 if (entry->size >= size + wasted) { 408 if (entry->size >= size + wasted) {
409 if (!best_match) 409 if (!best_match)
410 return entry; 410 return entry;
411 if (size < best_size) { 411 if (entry->size < best_size) {
412 best = entry; 412 best = entry;
413 best_size = entry->size; 413 best_size = entry->size;
414 } 414 }
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 6d81a02463a3..76d63394c776 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1,9 +1,4 @@
1/* 1/*
2 * The list_sort function is (presumably) licensed under the GPL (see the
3 * top level "COPYING" file for details).
4 *
5 * The remainder of this file is:
6 *
7 * Copyright © 1997-2003 by The XFree86 Project, Inc. 2 * Copyright © 1997-2003 by The XFree86 Project, Inc.
8 * Copyright © 2007 Dave Airlie 3 * Copyright © 2007 Dave Airlie
9 * Copyright © 2007-2008 Intel Corporation 4 * Copyright © 2007-2008 Intel Corporation
@@ -36,6 +31,7 @@
36 */ 31 */
37 32
38#include <linux/list.h> 33#include <linux/list.h>
34#include <linux/list_sort.h>
39#include "drmP.h" 35#include "drmP.h"
40#include "drm.h" 36#include "drm.h"
41#include "drm_crtc.h" 37#include "drm_crtc.h"
@@ -855,6 +851,7 @@ EXPORT_SYMBOL(drm_mode_prune_invalid);
855 851
856/** 852/**
857 * drm_mode_compare - compare modes for favorability 853 * drm_mode_compare - compare modes for favorability
854 * @priv: unused
858 * @lh_a: list_head for first mode 855 * @lh_a: list_head for first mode
859 * @lh_b: list_head for second mode 856 * @lh_b: list_head for second mode
860 * 857 *
@@ -868,7 +865,7 @@ EXPORT_SYMBOL(drm_mode_prune_invalid);
868 * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or 865 * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or
869 * positive if @lh_b is better than @lh_a. 866 * positive if @lh_b is better than @lh_a.
870 */ 867 */
871static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b) 868static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b)
872{ 869{
873 struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); 870 struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head);
874 struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); 871 struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head);
@@ -885,85 +882,6 @@ static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b)
885 return diff; 882 return diff;
886} 883}
887 884
888/* FIXME: what we don't have a list sort function? */
889/* list sort from Mark J Roberts (mjr@znex.org) */
890void list_sort(struct list_head *head,
891 int (*cmp)(struct list_head *a, struct list_head *b))
892{
893 struct list_head *p, *q, *e, *list, *tail, *oldhead;
894 int insize, nmerges, psize, qsize, i;
895
896 list = head->next;
897 list_del(head);
898 insize = 1;
899 for (;;) {
900 p = oldhead = list;
901 list = tail = NULL;
902 nmerges = 0;
903
904 while (p) {
905 nmerges++;
906 q = p;
907 psize = 0;
908 for (i = 0; i < insize; i++) {
909 psize++;
910 q = q->next == oldhead ? NULL : q->next;
911 if (!q)
912 break;
913 }
914
915 qsize = insize;
916 while (psize > 0 || (qsize > 0 && q)) {
917 if (!psize) {
918 e = q;
919 q = q->next;
920 qsize--;
921 if (q == oldhead)
922 q = NULL;
923 } else if (!qsize || !q) {
924 e = p;
925 p = p->next;
926 psize--;
927 if (p == oldhead)
928 p = NULL;
929 } else if (cmp(p, q) <= 0) {
930 e = p;
931 p = p->next;
932 psize--;
933 if (p == oldhead)
934 p = NULL;
935 } else {
936 e = q;
937 q = q->next;
938 qsize--;
939 if (q == oldhead)
940 q = NULL;
941 }
942 if (tail)
943 tail->next = e;
944 else
945 list = e;
946 e->prev = tail;
947 tail = e;
948 }
949 p = q;
950 }
951
952 tail->next = list;
953 list->prev = tail;
954
955 if (nmerges <= 1)
956 break;
957
958 insize *= 2;
959 }
960
961 head->next = list;
962 head->prev = list->prev;
963 list->prev->next = head;
964 list->prev = head;
965}
966
967/** 885/**
968 * drm_mode_sort - sort mode list 886 * drm_mode_sort - sort mode list
969 * @mode_list: list to sort 887 * @mode_list: list to sort
@@ -975,7 +893,7 @@ void list_sort(struct list_head *head,
975 */ 893 */
976void drm_mode_sort(struct list_head *mode_list) 894void drm_mode_sort(struct list_head *mode_list)
977{ 895{
978 list_sort(mode_list, drm_mode_compare); 896 list_sort(NULL, mode_list, drm_mode_compare);
979} 897}
980EXPORT_SYMBOL(drm_mode_sort); 898EXPORT_SYMBOL(drm_mode_sort);
981 899
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 577094fb1995..e68ebf92fa2a 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -47,8 +47,7 @@
47/** 47/**
48 * \brief Allocate a PCI consistent memory block, for DMA. 48 * \brief Allocate a PCI consistent memory block, for DMA.
49 */ 49 */
50drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align, 50drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
51 dma_addr_t maxaddr)
52{ 51{
53 drm_dma_handle_t *dmah; 52 drm_dma_handle_t *dmah;
54#if 1 53#if 1
@@ -63,11 +62,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
63 if (align > size) 62 if (align > size)
64 return NULL; 63 return NULL;
65 64
66 if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {
67 DRM_ERROR("Setting pci dma mask failed\n");
68 return NULL;
69 }
70
71 dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); 65 dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);
72 if (!dmah) 66 if (!dmah)
73 return NULL; 67 return NULL;
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c
index 9422a74c8b54..81681a07a806 100644
--- a/drivers/gpu/drm/i2c/ch7006_drv.c
+++ b/drivers/gpu/drm/i2c/ch7006_drv.c
@@ -408,6 +408,11 @@ static int ch7006_probe(struct i2c_client *client, const struct i2c_device_id *i
408 408
409 ch7006_info(client, "Detected version ID: %x\n", val); 409 ch7006_info(client, "Detected version ID: %x\n", val);
410 410
411 /* I don't know what this is for, but otherwise I get no
412 * signal.
413 */
414 ch7006_write(client, 0x3d, 0x0);
415
411 return 0; 416 return 0;
412 417
413fail: 418fail:
diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c
index 87f5445092e8..e447dfb63890 100644
--- a/drivers/gpu/drm/i2c/ch7006_mode.c
+++ b/drivers/gpu/drm/i2c/ch7006_mode.c
@@ -427,11 +427,6 @@ void ch7006_state_load(struct i2c_client *client,
427 ch7006_load_reg(client, state, CH7006_SUBC_INC7); 427 ch7006_load_reg(client, state, CH7006_SUBC_INC7);
428 ch7006_load_reg(client, state, CH7006_PLL_CONTROL); 428 ch7006_load_reg(client, state, CH7006_PLL_CONTROL);
429 ch7006_load_reg(client, state, CH7006_CALC_SUBC_INC0); 429 ch7006_load_reg(client, state, CH7006_CALC_SUBC_INC0);
430
431 /* I don't know what this is for, but otherwise I get no
432 * signal.
433 */
434 ch7006_write(client, 0x3d, 0x0);
435} 430}
436 431
437void ch7006_state_save(struct i2c_client *client, 432void ch7006_state_save(struct i2c_client *client,
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 7d1d88cdf2dc..de32d22a8c39 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -115,7 +115,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
115static const struct file_operations i810_buffer_fops = { 115static const struct file_operations i810_buffer_fops = {
116 .open = drm_open, 116 .open = drm_open,
117 .release = drm_release, 117 .release = drm_release,
118 .ioctl = drm_ioctl, 118 .unlocked_ioctl = drm_ioctl,
119 .mmap = i810_mmap_buffers, 119 .mmap = i810_mmap_buffers,
120 .fasync = drm_fasync, 120 .fasync = drm_fasync,
121}; 121};
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index fabb9a817966..c1e02752e023 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -59,7 +59,7 @@ static struct drm_driver driver = {
59 .owner = THIS_MODULE, 59 .owner = THIS_MODULE,
60 .open = drm_open, 60 .open = drm_open,
61 .release = drm_release, 61 .release = drm_release,
62 .ioctl = drm_ioctl, 62 .unlocked_ioctl = drm_ioctl,
63 .mmap = drm_mmap, 63 .mmap = drm_mmap,
64 .poll = drm_poll, 64 .poll = drm_poll,
65 .fasync = drm_fasync, 65 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/i830/i830_dma.c b/drivers/gpu/drm/i830/i830_dma.c
index 877bf6cb14a4..06bd732e6463 100644
--- a/drivers/gpu/drm/i830/i830_dma.c
+++ b/drivers/gpu/drm/i830/i830_dma.c
@@ -117,7 +117,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
117static const struct file_operations i830_buffer_fops = { 117static const struct file_operations i830_buffer_fops = {
118 .open = drm_open, 118 .open = drm_open,
119 .release = drm_release, 119 .release = drm_release,
120 .ioctl = drm_ioctl, 120 .unlocked_ioctl = drm_ioctl,
121 .mmap = i830_mmap_buffers, 121 .mmap = i830_mmap_buffers,
122 .fasync = drm_fasync, 122 .fasync = drm_fasync,
123}; 123};
diff --git a/drivers/gpu/drm/i830/i830_drv.c b/drivers/gpu/drm/i830/i830_drv.c
index 389597e4a623..44f990bed8f4 100644
--- a/drivers/gpu/drm/i830/i830_drv.c
+++ b/drivers/gpu/drm/i830/i830_drv.c
@@ -70,7 +70,7 @@ static struct drm_driver driver = {
70 .owner = THIS_MODULE, 70 .owner = THIS_MODULE,
71 .open = drm_open, 71 .open = drm_open,
72 .release = drm_release, 72 .release = drm_release,
73 .ioctl = drm_ioctl, 73 .unlocked_ioctl = drm_ioctl,
74 .mmap = drm_mmap, 74 .mmap = drm_mmap,
75 .poll = drm_poll, 75 .poll = drm_poll,
76 .fasync = drm_fasync, 76 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 18476bf0b580..9c9998c4dceb 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -272,7 +272,7 @@ static void i915_dump_pages(struct seq_file *m, struct page **pages, int page_co
272 mem = kmap_atomic(pages[page], KM_USER0); 272 mem = kmap_atomic(pages[page], KM_USER0);
273 for (i = 0; i < PAGE_SIZE; i += 4) 273 for (i = 0; i < PAGE_SIZE; i += 4)
274 seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); 274 seq_printf(m, "%08x : %08x\n", i, mem[i / 4]);
275 kunmap_atomic(pages[page], KM_USER0); 275 kunmap_atomic(mem, KM_USER0);
276 } 276 }
277} 277}
278 278
@@ -386,34 +386,6 @@ out:
386 return 0; 386 return 0;
387} 387}
388 388
389static int i915_registers_info(struct seq_file *m, void *data) {
390 struct drm_info_node *node = (struct drm_info_node *) m->private;
391 struct drm_device *dev = node->minor->dev;
392 drm_i915_private_t *dev_priv = dev->dev_private;
393 uint32_t reg;
394
395#define DUMP_RANGE(start, end) \
396 for (reg=start; reg < end; reg += 4) \
397 seq_printf(m, "%08x\t%08x\n", reg, I915_READ(reg));
398
399 DUMP_RANGE(0x00000, 0x00fff); /* VGA registers */
400 DUMP_RANGE(0x02000, 0x02fff); /* instruction, memory, interrupt control registers */
401 DUMP_RANGE(0x03000, 0x031ff); /* FENCE and PPGTT control registers */
402 DUMP_RANGE(0x03200, 0x03fff); /* frame buffer compression registers */
403 DUMP_RANGE(0x05000, 0x05fff); /* I/O control registers */
404 DUMP_RANGE(0x06000, 0x06fff); /* clock control registers */
405 DUMP_RANGE(0x07000, 0x07fff); /* 3D internal debug registers */
406 DUMP_RANGE(0x07400, 0x088ff); /* GPE debug registers */
407 DUMP_RANGE(0x0a000, 0x0afff); /* display palette registers */
408 DUMP_RANGE(0x10000, 0x13fff); /* MMIO MCHBAR */
409 DUMP_RANGE(0x30000, 0x3ffff); /* overlay registers */
410 DUMP_RANGE(0x60000, 0x6ffff); /* display engine pipeline registers */
411 DUMP_RANGE(0x70000, 0x72fff); /* display and cursor registers */
412 DUMP_RANGE(0x73000, 0x73fff); /* performance counters */
413
414 return 0;
415}
416
417static int 389static int
418i915_wedged_open(struct inode *inode, 390i915_wedged_open(struct inode *inode,
419 struct file *filp) 391 struct file *filp)
@@ -519,7 +491,6 @@ static int i915_wedged_create(struct dentry *root, struct drm_minor *minor)
519} 491}
520 492
521static struct drm_info_list i915_debugfs_list[] = { 493static struct drm_info_list i915_debugfs_list[] = {
522 {"i915_regs", i915_registers_info, 0},
523 {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, 494 {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
524 {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, 495 {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
525 {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, 496 {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 701bfeac7f57..bbe47812e4b6 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -123,7 +123,7 @@ static int i915_init_phys_hws(struct drm_device *dev)
123 drm_i915_private_t *dev_priv = dev->dev_private; 123 drm_i915_private_t *dev_priv = dev->dev_private;
124 /* Program Hardware Status Page */ 124 /* Program Hardware Status Page */
125 dev_priv->status_page_dmah = 125 dev_priv->status_page_dmah =
126 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); 126 drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE);
127 127
128 if (!dev_priv->status_page_dmah) { 128 if (!dev_priv->status_page_dmah) {
129 DRM_ERROR("Can not allocate hardware status page\n"); 129 DRM_ERROR("Can not allocate hardware status page\n");
@@ -813,9 +813,13 @@ static int i915_getparam(struct drm_device *dev, void *data,
813 case I915_PARAM_HAS_PAGEFLIPPING: 813 case I915_PARAM_HAS_PAGEFLIPPING:
814 value = 1; 814 value = 1;
815 break; 815 break;
816 case I915_PARAM_HAS_EXECBUF2:
817 /* depends on GEM */
818 value = dev_priv->has_gem;
819 break;
816 default: 820 default:
817 DRM_DEBUG_DRIVER("Unknown parameter %d\n", 821 DRM_DEBUG_DRIVER("Unknown parameter %d\n",
818 param->param); 822 param->param);
819 return -EINVAL; 823 return -EINVAL;
820 } 824 }
821 825
@@ -1117,7 +1121,8 @@ static void i915_setup_compression(struct drm_device *dev, int size)
1117{ 1121{
1118 struct drm_i915_private *dev_priv = dev->dev_private; 1122 struct drm_i915_private *dev_priv = dev->dev_private;
1119 struct drm_mm_node *compressed_fb, *compressed_llb; 1123 struct drm_mm_node *compressed_fb, *compressed_llb;
1120 unsigned long cfb_base, ll_base; 1124 unsigned long cfb_base;
1125 unsigned long ll_base = 0;
1121 1126
1122 /* Leave 1M for line length buffer & misc. */ 1127 /* Leave 1M for line length buffer & misc. */
1123 compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); 1128 compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0);
@@ -1200,14 +1205,6 @@ static int i915_load_modeset_init(struct drm_device *dev,
1200 dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & 1205 dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) &
1201 0xff000000; 1206 0xff000000;
1202 1207
1203 if (IS_MOBILE(dev) || IS_I9XX(dev))
1204 dev_priv->cursor_needs_physical = true;
1205 else
1206 dev_priv->cursor_needs_physical = false;
1207
1208 if (IS_I965G(dev) || IS_G33(dev))
1209 dev_priv->cursor_needs_physical = false;
1210
1211 /* Basic memrange allocator for stolen space (aka vram) */ 1208 /* Basic memrange allocator for stolen space (aka vram) */
1212 drm_mm_init(&dev_priv->vram, 0, prealloc_size); 1209 drm_mm_init(&dev_priv->vram, 0, prealloc_size);
1213 DRM_INFO("set up %ldM of stolen space\n", prealloc_size / (1024*1024)); 1210 DRM_INFO("set up %ldM of stolen space\n", prealloc_size / (1024*1024));
@@ -1257,6 +1254,8 @@ static int i915_load_modeset_init(struct drm_device *dev,
1257 if (ret) 1254 if (ret)
1258 goto destroy_ringbuffer; 1255 goto destroy_ringbuffer;
1259 1256
1257 intel_modeset_init(dev);
1258
1260 ret = drm_irq_install(dev); 1259 ret = drm_irq_install(dev);
1261 if (ret) 1260 if (ret)
1262 goto destroy_ringbuffer; 1261 goto destroy_ringbuffer;
@@ -1271,8 +1270,6 @@ static int i915_load_modeset_init(struct drm_device *dev,
1271 1270
1272 I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); 1271 I915_WRITE(INSTPM, (1 << 5) | (1 << 21));
1273 1272
1274 intel_modeset_init(dev);
1275
1276 drm_helper_initial_config(dev); 1273 drm_helper_initial_config(dev);
1277 1274
1278 return 0; 1275 return 0;
@@ -1360,7 +1357,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1360{ 1357{
1361 struct drm_i915_private *dev_priv = dev->dev_private; 1358 struct drm_i915_private *dev_priv = dev->dev_private;
1362 resource_size_t base, size; 1359 resource_size_t base, size;
1363 int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; 1360 int ret = 0, mmio_bar;
1364 uint32_t agp_size, prealloc_size, prealloc_start; 1361 uint32_t agp_size, prealloc_size, prealloc_start;
1365 1362
1366 /* i915 has 4 more counters */ 1363 /* i915 has 4 more counters */
@@ -1376,8 +1373,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1376 1373
1377 dev->dev_private = (void *)dev_priv; 1374 dev->dev_private = (void *)dev_priv;
1378 dev_priv->dev = dev; 1375 dev_priv->dev = dev;
1376 dev_priv->info = (struct intel_device_info *) flags;
1379 1377
1380 /* Add register map (needed for suspend/resume) */ 1378 /* Add register map (needed for suspend/resume) */
1379 mmio_bar = IS_I9XX(dev) ? 0 : 1;
1381 base = drm_get_resource_start(dev, mmio_bar); 1380 base = drm_get_resource_start(dev, mmio_bar);
1382 size = drm_get_resource_len(dev, mmio_bar); 1381 size = drm_get_resource_len(dev, mmio_bar);
1383 1382
@@ -1652,6 +1651,7 @@ struct drm_ioctl_desc i915_ioctls[] = {
1652 DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 1651 DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
1653 DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 1652 DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
1654 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), 1653 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH),
1654 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER2, i915_gem_execbuffer2, DRM_AUTH),
1655 DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), 1655 DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY),
1656 DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), 1656 DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY),
1657 DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH), 1657 DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH),
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 2fa217862058..be631cc3e4dc 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -33,7 +33,6 @@
33#include "i915_drm.h" 33#include "i915_drm.h"
34#include "i915_drv.h" 34#include "i915_drv.h"
35 35
36#include "drm_pciids.h"
37#include <linux/console.h> 36#include <linux/console.h>
38#include "drm_crtc_helper.h" 37#include "drm_crtc_helper.h"
39 38
@@ -48,8 +47,124 @@ module_param_named(powersave, i915_powersave, int, 0400);
48 47
49static struct drm_driver driver; 48static struct drm_driver driver;
50 49
51static struct pci_device_id pciidlist[] = { 50#define INTEL_VGA_DEVICE(id, info) { \
52 i915_PCI_IDS 51 .class = PCI_CLASS_DISPLAY_VGA << 8, \
52 .class_mask = 0xffff00, \
53 .vendor = 0x8086, \
54 .device = id, \
55 .subvendor = PCI_ANY_ID, \
56 .subdevice = PCI_ANY_ID, \
57 .driver_data = (unsigned long) info }
58
59const static struct intel_device_info intel_i830_info = {
60 .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1,
61};
62
63const static struct intel_device_info intel_845g_info = {
64 .is_i8xx = 1,
65};
66
67const static struct intel_device_info intel_i85x_info = {
68 .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1,
69};
70
71const static struct intel_device_info intel_i865g_info = {
72 .is_i8xx = 1,
73};
74
75const static struct intel_device_info intel_i915g_info = {
76 .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1,
77};
78const static struct intel_device_info intel_i915gm_info = {
79 .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
80 .cursor_needs_physical = 1,
81};
82const static struct intel_device_info intel_i945g_info = {
83 .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1,
84};
85const static struct intel_device_info intel_i945gm_info = {
86 .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
87 .has_hotplug = 1, .cursor_needs_physical = 1,
88};
89
90const static struct intel_device_info intel_i965g_info = {
91 .is_i965g = 1, .is_i9xx = 1, .has_hotplug = 1,
92};
93
94const static struct intel_device_info intel_i965gm_info = {
95 .is_i965g = 1, .is_mobile = 1, .is_i965gm = 1, .is_i9xx = 1,
96 .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1,
97 .has_hotplug = 1,
98};
99
100const static struct intel_device_info intel_g33_info = {
101 .is_g33 = 1, .is_i9xx = 1, .need_gfx_hws = 1,
102 .has_hotplug = 1,
103};
104
105const static struct intel_device_info intel_g45_info = {
106 .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1,
107 .has_pipe_cxsr = 1,
108 .has_hotplug = 1,
109};
110
111const static struct intel_device_info intel_gm45_info = {
112 .is_i965g = 1, .is_mobile = 1, .is_g4x = 1, .is_i9xx = 1,
113 .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1,
114 .has_pipe_cxsr = 1,
115 .has_hotplug = 1,
116};
117
118const static struct intel_device_info intel_pineview_info = {
119 .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1,
120 .has_pipe_cxsr = 1,
121 .has_hotplug = 1,
122};
123
124const static struct intel_device_info intel_ironlake_d_info = {
125 .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1,
126 .has_pipe_cxsr = 1,
127 .has_hotplug = 1,
128};
129
130const static struct intel_device_info intel_ironlake_m_info = {
131 .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1,
132 .need_gfx_hws = 1, .has_rc6 = 1,
133 .has_hotplug = 1,
134};
135
136const static struct pci_device_id pciidlist[] = {
137 INTEL_VGA_DEVICE(0x3577, &intel_i830_info),
138 INTEL_VGA_DEVICE(0x2562, &intel_845g_info),
139 INTEL_VGA_DEVICE(0x3582, &intel_i85x_info),
140 INTEL_VGA_DEVICE(0x35e8, &intel_i85x_info),
141 INTEL_VGA_DEVICE(0x2572, &intel_i865g_info),
142 INTEL_VGA_DEVICE(0x2582, &intel_i915g_info),
143 INTEL_VGA_DEVICE(0x258a, &intel_i915g_info),
144 INTEL_VGA_DEVICE(0x2592, &intel_i915gm_info),
145 INTEL_VGA_DEVICE(0x2772, &intel_i945g_info),
146 INTEL_VGA_DEVICE(0x27a2, &intel_i945gm_info),
147 INTEL_VGA_DEVICE(0x27ae, &intel_i945gm_info),
148 INTEL_VGA_DEVICE(0x2972, &intel_i965g_info),
149 INTEL_VGA_DEVICE(0x2982, &intel_i965g_info),
150 INTEL_VGA_DEVICE(0x2992, &intel_i965g_info),
151 INTEL_VGA_DEVICE(0x29a2, &intel_i965g_info),
152 INTEL_VGA_DEVICE(0x29b2, &intel_g33_info),
153 INTEL_VGA_DEVICE(0x29c2, &intel_g33_info),
154 INTEL_VGA_DEVICE(0x29d2, &intel_g33_info),
155 INTEL_VGA_DEVICE(0x2a02, &intel_i965gm_info),
156 INTEL_VGA_DEVICE(0x2a12, &intel_i965gm_info),
157 INTEL_VGA_DEVICE(0x2a42, &intel_gm45_info),
158 INTEL_VGA_DEVICE(0x2e02, &intel_g45_info),
159 INTEL_VGA_DEVICE(0x2e12, &intel_g45_info),
160 INTEL_VGA_DEVICE(0x2e22, &intel_g45_info),
161 INTEL_VGA_DEVICE(0x2e32, &intel_g45_info),
162 INTEL_VGA_DEVICE(0x2e42, &intel_g45_info),
163 INTEL_VGA_DEVICE(0xa001, &intel_pineview_info),
164 INTEL_VGA_DEVICE(0xa011, &intel_pineview_info),
165 INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info),
166 INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info),
167 {0, 0, 0}
53}; 168};
54 169
55#if defined(CONFIG_DRM_I915_KMS) 170#if defined(CONFIG_DRM_I915_KMS)
@@ -284,6 +399,52 @@ i915_pci_resume(struct pci_dev *pdev)
284 return i915_resume(dev); 399 return i915_resume(dev);
285} 400}
286 401
402static int
403i915_pm_suspend(struct device *dev)
404{
405 return i915_pci_suspend(to_pci_dev(dev), PMSG_SUSPEND);
406}
407
408static int
409i915_pm_resume(struct device *dev)
410{
411 return i915_pci_resume(to_pci_dev(dev));
412}
413
414static int
415i915_pm_freeze(struct device *dev)
416{
417 return i915_pci_suspend(to_pci_dev(dev), PMSG_FREEZE);
418}
419
420static int
421i915_pm_thaw(struct device *dev)
422{
423 /* thaw during hibernate, do nothing! */
424 return 0;
425}
426
427static int
428i915_pm_poweroff(struct device *dev)
429{
430 return i915_pci_suspend(to_pci_dev(dev), PMSG_HIBERNATE);
431}
432
433static int
434i915_pm_restore(struct device *dev)
435{
436 return i915_pci_resume(to_pci_dev(dev));
437}
438
439const struct dev_pm_ops i915_pm_ops = {
440 .suspend = i915_pm_suspend,
441 .resume = i915_pm_resume,
442 .freeze = i915_pm_freeze,
443 .thaw = i915_pm_thaw,
444 .poweroff = i915_pm_poweroff,
445 .restore = i915_pm_restore,
446};
447
287static struct vm_operations_struct i915_gem_vm_ops = { 448static struct vm_operations_struct i915_gem_vm_ops = {
288 .fault = i915_gem_fault, 449 .fault = i915_gem_fault,
289 .open = drm_gem_vm_open, 450 .open = drm_gem_vm_open,
@@ -329,7 +490,7 @@ static struct drm_driver driver = {
329 .owner = THIS_MODULE, 490 .owner = THIS_MODULE,
330 .open = drm_open, 491 .open = drm_open,
331 .release = drm_release, 492 .release = drm_release,
332 .ioctl = drm_ioctl, 493 .unlocked_ioctl = drm_ioctl,
333 .mmap = drm_gem_mmap, 494 .mmap = drm_gem_mmap,
334 .poll = drm_poll, 495 .poll = drm_poll,
335 .fasync = drm_fasync, 496 .fasync = drm_fasync,
@@ -344,10 +505,7 @@ static struct drm_driver driver = {
344 .id_table = pciidlist, 505 .id_table = pciidlist,
345 .probe = i915_pci_probe, 506 .probe = i915_pci_probe,
346 .remove = i915_pci_remove, 507 .remove = i915_pci_remove,
347#ifdef CONFIG_PM 508 .driver.pm = &i915_pm_ops,
348 .resume = i915_pci_resume,
349 .suspend = i915_pci_suspend,
350#endif
351 }, 509 },
352 510
353 .name = DRIVER_NAME, 511 .name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index fbecac72f5bb..29dd67626967 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -172,9 +172,31 @@ struct drm_i915_display_funcs {
172 172
173struct intel_overlay; 173struct intel_overlay;
174 174
175struct intel_device_info {
176 u8 is_mobile : 1;
177 u8 is_i8xx : 1;
178 u8 is_i915g : 1;
179 u8 is_i9xx : 1;
180 u8 is_i945gm : 1;
181 u8 is_i965g : 1;
182 u8 is_i965gm : 1;
183 u8 is_g33 : 1;
184 u8 need_gfx_hws : 1;
185 u8 is_g4x : 1;
186 u8 is_pineview : 1;
187 u8 is_ironlake : 1;
188 u8 has_fbc : 1;
189 u8 has_rc6 : 1;
190 u8 has_pipe_cxsr : 1;
191 u8 has_hotplug : 1;
192 u8 cursor_needs_physical : 1;
193};
194
175typedef struct drm_i915_private { 195typedef struct drm_i915_private {
176 struct drm_device *dev; 196 struct drm_device *dev;
177 197
198 const struct intel_device_info *info;
199
178 int has_gem; 200 int has_gem;
179 201
180 void __iomem *regs; 202 void __iomem *regs;
@@ -232,8 +254,6 @@ typedef struct drm_i915_private {
232 int hangcheck_count; 254 int hangcheck_count;
233 uint32_t last_acthd; 255 uint32_t last_acthd;
234 256
235 bool cursor_needs_physical;
236
237 struct drm_mm vram; 257 struct drm_mm vram;
238 258
239 unsigned long cfb_size; 259 unsigned long cfb_size;
@@ -287,8 +307,6 @@ typedef struct drm_i915_private {
287 u32 saveDSPACNTR; 307 u32 saveDSPACNTR;
288 u32 saveDSPBCNTR; 308 u32 saveDSPBCNTR;
289 u32 saveDSPARB; 309 u32 saveDSPARB;
290 u32 saveRENDERSTANDBY;
291 u32 savePWRCTXA;
292 u32 saveHWS; 310 u32 saveHWS;
293 u32 savePIPEACONF; 311 u32 savePIPEACONF;
294 u32 savePIPEBCONF; 312 u32 savePIPEBCONF;
@@ -561,6 +579,7 @@ typedef struct drm_i915_private {
561 u16 orig_clock; 579 u16 orig_clock;
562 int child_dev_num; 580 int child_dev_num;
563 struct child_device_config *child_dev; 581 struct child_device_config *child_dev;
582 struct drm_connector *int_lvds_connector;
564} drm_i915_private_t; 583} drm_i915_private_t;
565 584
566/** driver private structure attached to each drm_gem_object */ 585/** driver private structure attached to each drm_gem_object */
@@ -794,6 +813,8 @@ int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
794 struct drm_file *file_priv); 813 struct drm_file *file_priv);
795int i915_gem_execbuffer(struct drm_device *dev, void *data, 814int i915_gem_execbuffer(struct drm_device *dev, void *data,
796 struct drm_file *file_priv); 815 struct drm_file *file_priv);
816int i915_gem_execbuffer2(struct drm_device *dev, void *data,
817 struct drm_file *file_priv);
797int i915_gem_pin_ioctl(struct drm_device *dev, void *data, 818int i915_gem_pin_ioctl(struct drm_device *dev, void *data,
798 struct drm_file *file_priv); 819 struct drm_file *file_priv);
799int i915_gem_unpin_ioctl(struct drm_device *dev, void *data, 820int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
@@ -860,6 +881,9 @@ void i915_gem_shrinker_exit(void);
860void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); 881void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
861void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj); 882void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj);
862void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj); 883void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj);
884bool i915_tiling_ok(struct drm_device *dev, int stride, int size,
885 int tiling_mode);
886bool i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj);
863 887
864/* i915_gem_debug.c */ 888/* i915_gem_debug.c */
865void i915_gem_dump_object(struct drm_gem_object *obj, int len, 889void i915_gem_dump_object(struct drm_gem_object *obj, int len,
@@ -982,67 +1006,33 @@ extern void g4x_disable_fbc(struct drm_device *dev);
982extern int i915_wrap_ring(struct drm_device * dev); 1006extern int i915_wrap_ring(struct drm_device * dev);
983extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); 1007extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
984 1008
985#define IS_I830(dev) ((dev)->pci_device == 0x3577) 1009#define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info)
986#define IS_845G(dev) ((dev)->pci_device == 0x2562) 1010
987#define IS_I85X(dev) ((dev)->pci_device == 0x3582) 1011#define IS_I830(dev) ((dev)->pci_device == 0x3577)
988#define IS_I865G(dev) ((dev)->pci_device == 0x2572) 1012#define IS_845G(dev) ((dev)->pci_device == 0x2562)
989#define IS_I8XX(dev) (IS_I830(dev) || IS_845G(dev) || IS_I85X(dev) || IS_I865G(dev)) 1013#define IS_I85X(dev) ((dev)->pci_device == 0x3582)
990 1014#define IS_I865G(dev) ((dev)->pci_device == 0x2572)
991#define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a) 1015#define IS_I8XX(dev) (INTEL_INFO(dev)->is_i8xx)
992#define IS_I915GM(dev) ((dev)->pci_device == 0x2592) 1016#define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
993#define IS_I945G(dev) ((dev)->pci_device == 0x2772) 1017#define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
994#define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\ 1018#define IS_I945G(dev) ((dev)->pci_device == 0x2772)
995 (dev)->pci_device == 0x27AE) 1019#define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm)
996#define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \ 1020#define IS_I965G(dev) (INTEL_INFO(dev)->is_i965g)
997 (dev)->pci_device == 0x2982 || \ 1021#define IS_I965GM(dev) (INTEL_INFO(dev)->is_i965gm)
998 (dev)->pci_device == 0x2992 || \ 1022#define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
999 (dev)->pci_device == 0x29A2 || \ 1023#define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x)
1000 (dev)->pci_device == 0x2A02 || \ 1024#define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001)
1001 (dev)->pci_device == 0x2A12 || \ 1025#define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011)
1002 (dev)->pci_device == 0x2A42 || \ 1026#define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview)
1003 (dev)->pci_device == 0x2E02 || \ 1027#define IS_G33(dev) (INTEL_INFO(dev)->is_g33)
1004 (dev)->pci_device == 0x2E12 || \
1005 (dev)->pci_device == 0x2E22 || \
1006 (dev)->pci_device == 0x2E32 || \
1007 (dev)->pci_device == 0x2E42 || \
1008 (dev)->pci_device == 0x0042 || \
1009 (dev)->pci_device == 0x0046)
1010
1011#define IS_I965GM(dev) ((dev)->pci_device == 0x2A02 || \
1012 (dev)->pci_device == 0x2A12)
1013
1014#define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
1015
1016#define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \
1017 (dev)->pci_device == 0x2E12 || \
1018 (dev)->pci_device == 0x2E22 || \
1019 (dev)->pci_device == 0x2E32 || \
1020 (dev)->pci_device == 0x2E42 || \
1021 IS_GM45(dev))
1022
1023#define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001)
1024#define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011)
1025#define IS_PINEVIEW(dev) (IS_PINEVIEW_G(dev) || IS_PINEVIEW_M(dev))
1026
1027#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
1028 (dev)->pci_device == 0x29B2 || \
1029 (dev)->pci_device == 0x29D2 || \
1030 (IS_PINEVIEW(dev)))
1031
1032#define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042) 1028#define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042)
1033#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) 1029#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046)
1034#define IS_IRONLAKE(dev) (IS_IRONLAKE_D(dev) || IS_IRONLAKE_M(dev)) 1030#define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake)
1035 1031#define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx)
1036#define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \ 1032#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
1037 IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev) || \
1038 IS_IRONLAKE(dev))
1039 1033
1040#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \ 1034#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
1041 IS_I945GM(dev) || IS_I965GM(dev) || IS_GM45(dev) || \
1042 IS_PINEVIEW(dev) || IS_IRONLAKE_M(dev))
1043 1035
1044#define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_GM45(dev) || IS_G4X(dev) || \
1045 IS_IRONLAKE(dev))
1046/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte 1036/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1047 * rows, which changed the alignment requirements and fence programming. 1037 * rows, which changed the alignment requirements and fence programming.
1048 */ 1038 */
@@ -1054,17 +1044,14 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1054#define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev)) 1044#define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev))
1055#define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \ 1045#define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \
1056 !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev)) 1046 !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev))
1057#define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev) || IS_I965G(dev)) 1047#define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug)
1058/* dsparb controlled by hw only */ 1048/* dsparb controlled by hw only */
1059#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) 1049#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
1060 1050
1061#define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev)) 1051#define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev))
1062#define HAS_PIPE_CXSR(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) 1052#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
1063#define I915_HAS_FBC(dev) (IS_MOBILE(dev) && \ 1053#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
1064 (IS_I9XX(dev) || IS_GM45(dev)) && \ 1054#define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6)
1065 !IS_PINEVIEW(dev) && \
1066 !IS_IRONLAKE(dev))
1067#define I915_HAS_RC6(dev) (IS_I965GM(dev) || IS_GM45(dev) || IS_IRONLAKE_M(dev))
1068 1055
1069#define PRIMARY_RINGBUFFER_SIZE (128*1024) 1056#define PRIMARY_RINGBUFFER_SIZE (128*1024)
1070 1057
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8c463cf2050a..2748609f05b3 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2021,9 +2021,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
2021 /* blow away mappings if mapped through GTT */ 2021 /* blow away mappings if mapped through GTT */
2022 i915_gem_release_mmap(obj); 2022 i915_gem_release_mmap(obj);
2023 2023
2024 if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
2025 i915_gem_clear_fence_reg(obj);
2026
2027 /* Move the object to the CPU domain to ensure that 2024 /* Move the object to the CPU domain to ensure that
2028 * any possible CPU writes while it's not in the GTT 2025 * any possible CPU writes while it's not in the GTT
2029 * are flushed when we go to remap it. This will 2026 * are flushed when we go to remap it. This will
@@ -2039,6 +2036,10 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
2039 2036
2040 BUG_ON(obj_priv->active); 2037 BUG_ON(obj_priv->active);
2041 2038
2039 /* release the fence reg _after_ flushing */
2040 if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
2041 i915_gem_clear_fence_reg(obj);
2042
2042 if (obj_priv->agp_mem != NULL) { 2043 if (obj_priv->agp_mem != NULL) {
2043 drm_unbind_agp(obj_priv->agp_mem); 2044 drm_unbind_agp(obj_priv->agp_mem);
2044 drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); 2045 drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE);
@@ -2581,9 +2582,6 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
2581 bool retry_alloc = false; 2582 bool retry_alloc = false;
2582 int ret; 2583 int ret;
2583 2584
2584 if (dev_priv->mm.suspended)
2585 return -EBUSY;
2586
2587 if (obj_priv->madv != I915_MADV_WILLNEED) { 2585 if (obj_priv->madv != I915_MADV_WILLNEED) {
2588 DRM_ERROR("Attempting to bind a purgeable object\n"); 2586 DRM_ERROR("Attempting to bind a purgeable object\n");
2589 return -EINVAL; 2587 return -EINVAL;
@@ -3198,7 +3196,7 @@ i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj,
3198static int 3196static int
3199i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, 3197i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3200 struct drm_file *file_priv, 3198 struct drm_file *file_priv,
3201 struct drm_i915_gem_exec_object *entry, 3199 struct drm_i915_gem_exec_object2 *entry,
3202 struct drm_i915_gem_relocation_entry *relocs) 3200 struct drm_i915_gem_relocation_entry *relocs)
3203{ 3201{
3204 struct drm_device *dev = obj->dev; 3202 struct drm_device *dev = obj->dev;
@@ -3206,12 +3204,35 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3206 struct drm_i915_gem_object *obj_priv = obj->driver_private; 3204 struct drm_i915_gem_object *obj_priv = obj->driver_private;
3207 int i, ret; 3205 int i, ret;
3208 void __iomem *reloc_page; 3206 void __iomem *reloc_page;
3207 bool need_fence;
3208
3209 need_fence = entry->flags & EXEC_OBJECT_NEEDS_FENCE &&
3210 obj_priv->tiling_mode != I915_TILING_NONE;
3211
3212 /* Check fence reg constraints and rebind if necessary */
3213 if (need_fence && !i915_obj_fenceable(dev, obj))
3214 i915_gem_object_unbind(obj);
3209 3215
3210 /* Choose the GTT offset for our buffer and put it there. */ 3216 /* Choose the GTT offset for our buffer and put it there. */
3211 ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); 3217 ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment);
3212 if (ret) 3218 if (ret)
3213 return ret; 3219 return ret;
3214 3220
3221 /*
3222 * Pre-965 chips need a fence register set up in order to
3223 * properly handle blits to/from tiled surfaces.
3224 */
3225 if (need_fence) {
3226 ret = i915_gem_object_get_fence_reg(obj);
3227 if (ret != 0) {
3228 if (ret != -EBUSY && ret != -ERESTARTSYS)
3229 DRM_ERROR("Failure to install fence: %d\n",
3230 ret);
3231 i915_gem_object_unpin(obj);
3232 return ret;
3233 }
3234 }
3235
3215 entry->offset = obj_priv->gtt_offset; 3236 entry->offset = obj_priv->gtt_offset;
3216 3237
3217 /* Apply the relocations, using the GTT aperture to avoid cache 3238 /* Apply the relocations, using the GTT aperture to avoid cache
@@ -3373,7 +3394,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3373 */ 3394 */
3374static int 3395static int
3375i915_dispatch_gem_execbuffer(struct drm_device *dev, 3396i915_dispatch_gem_execbuffer(struct drm_device *dev,
3376 struct drm_i915_gem_execbuffer *exec, 3397 struct drm_i915_gem_execbuffer2 *exec,
3377 struct drm_clip_rect *cliprects, 3398 struct drm_clip_rect *cliprects,
3378 uint64_t exec_offset) 3399 uint64_t exec_offset)
3379{ 3400{
@@ -3463,7 +3484,7 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file_priv)
3463} 3484}
3464 3485
3465static int 3486static int
3466i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, 3487i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object2 *exec_list,
3467 uint32_t buffer_count, 3488 uint32_t buffer_count,
3468 struct drm_i915_gem_relocation_entry **relocs) 3489 struct drm_i915_gem_relocation_entry **relocs)
3469{ 3490{
@@ -3478,8 +3499,10 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list,
3478 } 3499 }
3479 3500
3480 *relocs = drm_calloc_large(reloc_count, sizeof(**relocs)); 3501 *relocs = drm_calloc_large(reloc_count, sizeof(**relocs));
3481 if (*relocs == NULL) 3502 if (*relocs == NULL) {
3503 DRM_ERROR("failed to alloc relocs, count %d\n", reloc_count);
3482 return -ENOMEM; 3504 return -ENOMEM;
3505 }
3483 3506
3484 for (i = 0; i < buffer_count; i++) { 3507 for (i = 0; i < buffer_count; i++) {
3485 struct drm_i915_gem_relocation_entry __user *user_relocs; 3508 struct drm_i915_gem_relocation_entry __user *user_relocs;
@@ -3503,7 +3526,7 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list,
3503} 3526}
3504 3527
3505static int 3528static int
3506i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object *exec_list, 3529i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object2 *exec_list,
3507 uint32_t buffer_count, 3530 uint32_t buffer_count,
3508 struct drm_i915_gem_relocation_entry *relocs) 3531 struct drm_i915_gem_relocation_entry *relocs)
3509{ 3532{
@@ -3536,7 +3559,7 @@ err:
3536} 3559}
3537 3560
3538static int 3561static int
3539i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer *exec, 3562i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer2 *exec,
3540 uint64_t exec_offset) 3563 uint64_t exec_offset)
3541{ 3564{
3542 uint32_t exec_start, exec_len; 3565 uint32_t exec_start, exec_len;
@@ -3589,18 +3612,18 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev,
3589} 3612}
3590 3613
3591int 3614int
3592i915_gem_execbuffer(struct drm_device *dev, void *data, 3615i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3593 struct drm_file *file_priv) 3616 struct drm_file *file_priv,
3617 struct drm_i915_gem_execbuffer2 *args,
3618 struct drm_i915_gem_exec_object2 *exec_list)
3594{ 3619{
3595 drm_i915_private_t *dev_priv = dev->dev_private; 3620 drm_i915_private_t *dev_priv = dev->dev_private;
3596 struct drm_i915_gem_execbuffer *args = data;
3597 struct drm_i915_gem_exec_object *exec_list = NULL;
3598 struct drm_gem_object **object_list = NULL; 3621 struct drm_gem_object **object_list = NULL;
3599 struct drm_gem_object *batch_obj; 3622 struct drm_gem_object *batch_obj;
3600 struct drm_i915_gem_object *obj_priv; 3623 struct drm_i915_gem_object *obj_priv;
3601 struct drm_clip_rect *cliprects = NULL; 3624 struct drm_clip_rect *cliprects = NULL;
3602 struct drm_i915_gem_relocation_entry *relocs; 3625 struct drm_i915_gem_relocation_entry *relocs;
3603 int ret, ret2, i, pinned = 0; 3626 int ret = 0, ret2, i, pinned = 0;
3604 uint64_t exec_offset; 3627 uint64_t exec_offset;
3605 uint32_t seqno, flush_domains, reloc_index; 3628 uint32_t seqno, flush_domains, reloc_index;
3606 int pin_tries, flips; 3629 int pin_tries, flips;
@@ -3614,25 +3637,13 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
3614 DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); 3637 DRM_ERROR("execbuf with %d buffers\n", args->buffer_count);
3615 return -EINVAL; 3638 return -EINVAL;
3616 } 3639 }
3617 /* Copy in the exec list from userland */
3618 exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count);
3619 object_list = drm_malloc_ab(sizeof(*object_list), args->buffer_count); 3640 object_list = drm_malloc_ab(sizeof(*object_list), args->buffer_count);
3620 if (exec_list == NULL || object_list == NULL) { 3641 if (object_list == NULL) {
3621 DRM_ERROR("Failed to allocate exec or object list " 3642 DRM_ERROR("Failed to allocate object list for %d buffers\n",
3622 "for %d buffers\n",
3623 args->buffer_count); 3643 args->buffer_count);
3624 ret = -ENOMEM; 3644 ret = -ENOMEM;
3625 goto pre_mutex_err; 3645 goto pre_mutex_err;
3626 } 3646 }
3627 ret = copy_from_user(exec_list,
3628 (struct drm_i915_relocation_entry __user *)
3629 (uintptr_t) args->buffers_ptr,
3630 sizeof(*exec_list) * args->buffer_count);
3631 if (ret != 0) {
3632 DRM_ERROR("copy %d exec entries failed %d\n",
3633 args->buffer_count, ret);
3634 goto pre_mutex_err;
3635 }
3636 3647
3637 if (args->num_cliprects != 0) { 3648 if (args->num_cliprects != 0) {
3638 cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), 3649 cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects),
@@ -3884,20 +3895,6 @@ err:
3884 3895
3885 mutex_unlock(&dev->struct_mutex); 3896 mutex_unlock(&dev->struct_mutex);
3886 3897
3887 if (!ret) {
3888 /* Copy the new buffer offsets back to the user's exec list. */
3889 ret = copy_to_user((struct drm_i915_relocation_entry __user *)
3890 (uintptr_t) args->buffers_ptr,
3891 exec_list,
3892 sizeof(*exec_list) * args->buffer_count);
3893 if (ret) {
3894 ret = -EFAULT;
3895 DRM_ERROR("failed to copy %d exec entries "
3896 "back to user (%d)\n",
3897 args->buffer_count, ret);
3898 }
3899 }
3900
3901 /* Copy the updated relocations out regardless of current error 3898 /* Copy the updated relocations out regardless of current error
3902 * state. Failure to update the relocs would mean that the next 3899 * state. Failure to update the relocs would mean that the next
3903 * time userland calls execbuf, it would do so with presumed offset 3900 * time userland calls execbuf, it would do so with presumed offset
@@ -3914,12 +3911,158 @@ err:
3914 3911
3915pre_mutex_err: 3912pre_mutex_err:
3916 drm_free_large(object_list); 3913 drm_free_large(object_list);
3917 drm_free_large(exec_list);
3918 kfree(cliprects); 3914 kfree(cliprects);
3919 3915
3920 return ret; 3916 return ret;
3921} 3917}
3922 3918
3919/*
3920 * Legacy execbuffer just creates an exec2 list from the original exec object
3921 * list array and passes it to the real function.
3922 */
3923int
3924i915_gem_execbuffer(struct drm_device *dev, void *data,
3925 struct drm_file *file_priv)
3926{
3927 struct drm_i915_gem_execbuffer *args = data;
3928 struct drm_i915_gem_execbuffer2 exec2;
3929 struct drm_i915_gem_exec_object *exec_list = NULL;
3930 struct drm_i915_gem_exec_object2 *exec2_list = NULL;
3931 int ret, i;
3932
3933#if WATCH_EXEC
3934 DRM_INFO("buffers_ptr %d buffer_count %d len %08x\n",
3935 (int) args->buffers_ptr, args->buffer_count, args->batch_len);
3936#endif
3937
3938 if (args->buffer_count < 1) {
3939 DRM_ERROR("execbuf with %d buffers\n", args->buffer_count);
3940 return -EINVAL;
3941 }
3942
3943 /* Copy in the exec list from userland */
3944 exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count);
3945 exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count);
3946 if (exec_list == NULL || exec2_list == NULL) {
3947 DRM_ERROR("Failed to allocate exec list for %d buffers\n",
3948 args->buffer_count);
3949 drm_free_large(exec_list);
3950 drm_free_large(exec2_list);
3951 return -ENOMEM;
3952 }
3953 ret = copy_from_user(exec_list,
3954 (struct drm_i915_relocation_entry __user *)
3955 (uintptr_t) args->buffers_ptr,
3956 sizeof(*exec_list) * args->buffer_count);
3957 if (ret != 0) {
3958 DRM_ERROR("copy %d exec entries failed %d\n",
3959 args->buffer_count, ret);
3960 drm_free_large(exec_list);
3961 drm_free_large(exec2_list);
3962 return -EFAULT;
3963 }
3964
3965 for (i = 0; i < args->buffer_count; i++) {
3966 exec2_list[i].handle = exec_list[i].handle;
3967 exec2_list[i].relocation_count = exec_list[i].relocation_count;
3968 exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr;
3969 exec2_list[i].alignment = exec_list[i].alignment;
3970 exec2_list[i].offset = exec_list[i].offset;
3971 if (!IS_I965G(dev))
3972 exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE;
3973 else
3974 exec2_list[i].flags = 0;
3975 }
3976
3977 exec2.buffers_ptr = args->buffers_ptr;
3978 exec2.buffer_count = args->buffer_count;
3979 exec2.batch_start_offset = args->batch_start_offset;
3980 exec2.batch_len = args->batch_len;
3981 exec2.DR1 = args->DR1;
3982 exec2.DR4 = args->DR4;
3983 exec2.num_cliprects = args->num_cliprects;
3984 exec2.cliprects_ptr = args->cliprects_ptr;
3985 exec2.flags = 0;
3986
3987 ret = i915_gem_do_execbuffer(dev, data, file_priv, &exec2, exec2_list);
3988 if (!ret) {
3989 /* Copy the new buffer offsets back to the user's exec list. */
3990 for (i = 0; i < args->buffer_count; i++)
3991 exec_list[i].offset = exec2_list[i].offset;
3992 /* ... and back out to userspace */
3993 ret = copy_to_user((struct drm_i915_relocation_entry __user *)
3994 (uintptr_t) args->buffers_ptr,
3995 exec_list,
3996 sizeof(*exec_list) * args->buffer_count);
3997 if (ret) {
3998 ret = -EFAULT;
3999 DRM_ERROR("failed to copy %d exec entries "
4000 "back to user (%d)\n",
4001 args->buffer_count, ret);
4002 }
4003 } else {
4004 DRM_ERROR("i915_gem_do_execbuffer returns %d\n", ret);
4005 }
4006
4007 drm_free_large(exec_list);
4008 drm_free_large(exec2_list);
4009 return ret;
4010}
4011
4012int
4013i915_gem_execbuffer2(struct drm_device *dev, void *data,
4014 struct drm_file *file_priv)
4015{
4016 struct drm_i915_gem_execbuffer2 *args = data;
4017 struct drm_i915_gem_exec_object2 *exec2_list = NULL;
4018 int ret;
4019
4020#if WATCH_EXEC
4021 DRM_INFO("buffers_ptr %d buffer_count %d len %08x\n",
4022 (int) args->buffers_ptr, args->buffer_count, args->batch_len);
4023#endif
4024
4025 if (args->buffer_count < 1) {
4026 DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count);
4027 return -EINVAL;
4028 }
4029
4030 exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count);
4031 if (exec2_list == NULL) {
4032 DRM_ERROR("Failed to allocate exec list for %d buffers\n",
4033 args->buffer_count);
4034 return -ENOMEM;
4035 }
4036 ret = copy_from_user(exec2_list,
4037 (struct drm_i915_relocation_entry __user *)
4038 (uintptr_t) args->buffers_ptr,
4039 sizeof(*exec2_list) * args->buffer_count);
4040 if (ret != 0) {
4041 DRM_ERROR("copy %d exec entries failed %d\n",
4042 args->buffer_count, ret);
4043 drm_free_large(exec2_list);
4044 return -EFAULT;
4045 }
4046
4047 ret = i915_gem_do_execbuffer(dev, data, file_priv, args, exec2_list);
4048 if (!ret) {
4049 /* Copy the new buffer offsets back to the user's exec list. */
4050 ret = copy_to_user((struct drm_i915_relocation_entry __user *)
4051 (uintptr_t) args->buffers_ptr,
4052 exec2_list,
4053 sizeof(*exec2_list) * args->buffer_count);
4054 if (ret) {
4055 ret = -EFAULT;
4056 DRM_ERROR("failed to copy %d exec entries "
4057 "back to user (%d)\n",
4058 args->buffer_count, ret);
4059 }
4060 }
4061
4062 drm_free_large(exec2_list);
4063 return ret;
4064}
4065
3923int 4066int
3924i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) 4067i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
3925{ 4068{
@@ -3933,19 +4076,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
3933 if (ret) 4076 if (ret)
3934 return ret; 4077 return ret;
3935 } 4078 }
3936 /* 4079
3937 * Pre-965 chips need a fence register set up in order to
3938 * properly handle tiled surfaces.
3939 */
3940 if (!IS_I965G(dev) && obj_priv->tiling_mode != I915_TILING_NONE) {
3941 ret = i915_gem_object_get_fence_reg(obj);
3942 if (ret != 0) {
3943 if (ret != -EBUSY && ret != -ERESTARTSYS)
3944 DRM_ERROR("Failure to install fence: %d\n",
3945 ret);
3946 return ret;
3947 }
3948 }
3949 obj_priv->pin_count++; 4080 obj_priv->pin_count++;
3950 4081
3951 /* If the object is not active and not pending a flush, 4082 /* If the object is not active and not pending a flush,
@@ -4708,7 +4839,7 @@ int i915_gem_init_phys_object(struct drm_device *dev,
4708 4839
4709 phys_obj->id = id; 4840 phys_obj->id = id;
4710 4841
4711 phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff); 4842 phys_obj->handle = drm_pci_alloc(dev, size, 0);
4712 if (!phys_obj->handle) { 4843 if (!phys_obj->handle) {
4713 ret = -ENOMEM; 4844 ret = -ENOMEM;
4714 goto kfree_obj; 4845 goto kfree_obj;
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index 30d6af6c09bb..df278b2685bf 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -304,35 +304,39 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
304 304
305 305
306/** 306/**
307 * Returns the size of the fence for a tiled object of the given size. 307 * Returns whether an object is currently fenceable. If not, it may need
308 * to be unbound and have its pitch adjusted.
308 */ 309 */
309static int 310bool
310i915_get_fence_size(struct drm_device *dev, int size) 311i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj)
311{ 312{
312 int i; 313 struct drm_i915_gem_object *obj_priv = obj->driver_private;
313 int start;
314 314
315 if (IS_I965G(dev)) { 315 if (IS_I965G(dev)) {
316 /* The 965 can have fences at any page boundary. */ 316 /* The 965 can have fences at any page boundary. */
317 return ALIGN(size, 4096); 317 if (obj->size & 4095)
318 return false;
319 return true;
320 } else if (IS_I9XX(dev)) {
321 if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK)
322 return false;
318 } else { 323 } else {
319 /* Align the size to a power of two greater than the smallest 324 if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK)
320 * fence size. 325 return false;
321 */ 326 }
322 if (IS_I9XX(dev))
323 start = 1024 * 1024;
324 else
325 start = 512 * 1024;
326 327
327 for (i = start; i < size; i <<= 1) 328 /* Power of two sized... */
328 ; 329 if (obj->size & (obj->size - 1))
330 return false;
329 331
330 return i; 332 /* Objects must be size aligned as well */
331 } 333 if (obj_priv->gtt_offset & (obj->size - 1))
334 return false;
335 return true;
332} 336}
333 337
334/* Check pitch constriants for all chips & tiling formats */ 338/* Check pitch constriants for all chips & tiling formats */
335static bool 339bool
336i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) 340i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
337{ 341{
338 int tile_width; 342 int tile_width;
@@ -384,12 +388,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
384 if (stride & (stride - 1)) 388 if (stride & (stride - 1))
385 return false; 389 return false;
386 390
387 /* We don't 0handle the aperture area covered by the fence being bigger
388 * than the object size.
389 */
390 if (i915_get_fence_size(dev, size) != size)
391 return false;
392
393 return true; 391 return true;
394} 392}
395 393
diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c
index 1fe68a251b75..13b028994b2b 100644
--- a/drivers/gpu/drm/i915/i915_ioc32.c
+++ b/drivers/gpu/drm/i915/i915_ioc32.c
@@ -66,8 +66,7 @@ static int compat_i915_batchbuffer(struct file *file, unsigned int cmd,
66 &batchbuffer->cliprects)) 66 &batchbuffer->cliprects))
67 return -EFAULT; 67 return -EFAULT;
68 68
69 return drm_ioctl(file->f_path.dentry->d_inode, file, 69 return drm_ioctl(file, DRM_IOCTL_I915_BATCHBUFFER,
70 DRM_IOCTL_I915_BATCHBUFFER,
71 (unsigned long)batchbuffer); 70 (unsigned long)batchbuffer);
72} 71}
73 72
@@ -102,8 +101,8 @@ static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd,
102 &cmdbuffer->cliprects)) 101 &cmdbuffer->cliprects))
103 return -EFAULT; 102 return -EFAULT;
104 103
105 return drm_ioctl(file->f_path.dentry->d_inode, file, 104 return drm_ioctl(file, DRM_IOCTL_I915_CMDBUFFER,
106 DRM_IOCTL_I915_CMDBUFFER, (unsigned long)cmdbuffer); 105 (unsigned long)cmdbuffer);
107} 106}
108 107
109typedef struct drm_i915_irq_emit32 { 108typedef struct drm_i915_irq_emit32 {
@@ -125,8 +124,8 @@ static int compat_i915_irq_emit(struct file *file, unsigned int cmd,
125 &request->irq_seq)) 124 &request->irq_seq))
126 return -EFAULT; 125 return -EFAULT;
127 126
128 return drm_ioctl(file->f_path.dentry->d_inode, file, 127 return drm_ioctl(file, DRM_IOCTL_I915_IRQ_EMIT,
129 DRM_IOCTL_I915_IRQ_EMIT, (unsigned long)request); 128 (unsigned long)request);
130} 129}
131typedef struct drm_i915_getparam32 { 130typedef struct drm_i915_getparam32 {
132 int param; 131 int param;
@@ -149,8 +148,8 @@ static int compat_i915_getparam(struct file *file, unsigned int cmd,
149 &request->value)) 148 &request->value))
150 return -EFAULT; 149 return -EFAULT;
151 150
152 return drm_ioctl(file->f_path.dentry->d_inode, file, 151 return drm_ioctl(file, DRM_IOCTL_I915_GETPARAM,
153 DRM_IOCTL_I915_GETPARAM, (unsigned long)request); 152 (unsigned long)request);
154} 153}
155 154
156typedef struct drm_i915_mem_alloc32 { 155typedef struct drm_i915_mem_alloc32 {
@@ -178,8 +177,8 @@ static int compat_i915_alloc(struct file *file, unsigned int cmd,
178 &request->region_offset)) 177 &request->region_offset))
179 return -EFAULT; 178 return -EFAULT;
180 179
181 return drm_ioctl(file->f_path.dentry->d_inode, file, 180 return drm_ioctl(file, DRM_IOCTL_I915_ALLOC,
182 DRM_IOCTL_I915_ALLOC, (unsigned long)request); 181 (unsigned long)request);
183} 182}
184 183
185drm_ioctl_compat_t *i915_compat_ioctls[] = { 184drm_ioctl_compat_t *i915_compat_ioctls[] = {
@@ -211,12 +210,10 @@ long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
211 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls)) 210 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls))
212 fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE]; 211 fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE];
213 212
214 lock_kernel(); /* XXX for now */
215 if (fn != NULL) 213 if (fn != NULL)
216 ret = (*fn) (filp, cmd, arg); 214 ret = (*fn) (filp, cmd, arg);
217 else 215 else
218 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); 216 ret = drm_ioctl(filp, cmd, arg);
219 unlock_kernel();
220 217
221 return ret; 218 return ret;
222} 219}
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 85f4c5de97e2..7cd8110051b6 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -313,6 +313,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
313 dev_priv->mm.irq_gem_seqno = seqno; 313 dev_priv->mm.irq_gem_seqno = seqno;
314 trace_i915_gem_request_complete(dev, seqno); 314 trace_i915_gem_request_complete(dev, seqno);
315 DRM_WAKEUP(&dev_priv->irq_queue); 315 DRM_WAKEUP(&dev_priv->irq_queue);
316 dev_priv->hangcheck_count = 0;
317 mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
316 } 318 }
317 319
318 if (de_iir & DE_GSE) 320 if (de_iir & DE_GSE)
@@ -1084,6 +1086,10 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
1084 (void) I915_READ(IER); 1086 (void) I915_READ(IER);
1085} 1087}
1086 1088
1089/*
1090 * Must be called after intel_modeset_init or hotplug interrupts won't be
1091 * enabled correctly.
1092 */
1087int i915_driver_irq_postinstall(struct drm_device *dev) 1093int i915_driver_irq_postinstall(struct drm_device *dev)
1088{ 1094{
1089 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 1095 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -1106,19 +1112,23 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
1106 if (I915_HAS_HOTPLUG(dev)) { 1112 if (I915_HAS_HOTPLUG(dev)) {
1107 u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN); 1113 u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN);
1108 1114
1109 /* Leave other bits alone */ 1115 /* Note HDMI and DP share bits */
1110 hotplug_en |= HOTPLUG_EN_MASK; 1116 if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS)
1117 hotplug_en |= HDMIB_HOTPLUG_INT_EN;
1118 if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS)
1119 hotplug_en |= HDMIC_HOTPLUG_INT_EN;
1120 if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS)
1121 hotplug_en |= HDMID_HOTPLUG_INT_EN;
1122 if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS)
1123 hotplug_en |= SDVOC_HOTPLUG_INT_EN;
1124 if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS)
1125 hotplug_en |= SDVOB_HOTPLUG_INT_EN;
1126 if (dev_priv->hotplug_supported_mask & CRT_HOTPLUG_INT_STATUS)
1127 hotplug_en |= CRT_HOTPLUG_INT_EN;
1128 /* Ignore TV since it's buggy */
1129
1111 I915_WRITE(PORT_HOTPLUG_EN, hotplug_en); 1130 I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
1112 1131
1113 dev_priv->hotplug_supported_mask = CRT_HOTPLUG_INT_STATUS |
1114 TV_HOTPLUG_INT_STATUS | SDVOC_HOTPLUG_INT_STATUS |
1115 SDVOB_HOTPLUG_INT_STATUS;
1116 if (IS_G4X(dev)) {
1117 dev_priv->hotplug_supported_mask |=
1118 HDMIB_HOTPLUG_INT_STATUS |
1119 HDMIC_HOTPLUG_INT_STATUS |
1120 HDMID_HOTPLUG_INT_STATUS;
1121 }
1122 /* Enable in IER... */ 1132 /* Enable in IER... */
1123 enable_mask |= I915_DISPLAY_PORT_INTERRUPT; 1133 enable_mask |= I915_DISPLAY_PORT_INTERRUPT;
1124 /* and unmask in IMR */ 1134 /* and unmask in IMR */
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 974b3cf70618..149d360d64a3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -879,13 +879,6 @@
879#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) 879#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
880#define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ 880#define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */
881#define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f 881#define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f
882#define HOTPLUG_EN_MASK (HDMIB_HOTPLUG_INT_EN | \
883 HDMIC_HOTPLUG_INT_EN | \
884 HDMID_HOTPLUG_INT_EN | \
885 SDVOB_HOTPLUG_INT_EN | \
886 SDVOC_HOTPLUG_INT_EN | \
887 CRT_HOTPLUG_INT_EN)
888
889 882
890#define PORT_HOTPLUG_STAT 0x61114 883#define PORT_HOTPLUG_STAT 0x61114
891#define HDMIB_HOTPLUG_INT_STATUS (1 << 29) 884#define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
@@ -982,6 +975,8 @@
982#define LVDS_PORT_EN (1 << 31) 975#define LVDS_PORT_EN (1 << 31)
983/* Selects pipe B for LVDS data. Must be set on pre-965. */ 976/* Selects pipe B for LVDS data. Must be set on pre-965. */
984#define LVDS_PIPEB_SELECT (1 << 30) 977#define LVDS_PIPEB_SELECT (1 << 30)
978/* LVDS dithering flag on 965/g4x platform */
979#define LVDS_ENABLE_DITHER (1 << 25)
985/* Enable border for unscaled (or aspect-scaled) display */ 980/* Enable border for unscaled (or aspect-scaled) display */
986#define LVDS_BORDER_ENABLE (1 << 15) 981#define LVDS_BORDER_ENABLE (1 << 15)
987/* 982/*
@@ -1751,6 +1746,8 @@
1751 1746
1752/* Display & cursor control */ 1747/* Display & cursor control */
1753 1748
1749/* dithering flag on Ironlake */
1750#define PIPE_ENABLE_DITHER (1 << 4)
1754/* Pipe A */ 1751/* Pipe A */
1755#define PIPEADSL 0x70000 1752#define PIPEADSL 0x70000
1756#define PIPEACONF 0x70008 1753#define PIPEACONF 0x70008
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index d5ebb00a9d49..a3b90c9561dc 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -732,12 +732,6 @@ int i915_save_state(struct drm_device *dev)
732 732
733 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); 733 pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
734 734
735 /* Render Standby */
736 if (I915_HAS_RC6(dev)) {
737 dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY);
738 dev_priv->savePWRCTXA = I915_READ(PWRCTXA);
739 }
740
741 /* Hardware status page */ 735 /* Hardware status page */
742 dev_priv->saveHWS = I915_READ(HWS_PGA); 736 dev_priv->saveHWS = I915_READ(HWS_PGA);
743 737
@@ -793,12 +787,6 @@ int i915_restore_state(struct drm_device *dev)
793 787
794 pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); 788 pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
795 789
796 /* Render Standby */
797 if (I915_HAS_RC6(dev)) {
798 I915_WRITE(MCHBAR_RENDER_STANDBY, dev_priv->saveRENDERSTANDBY);
799 I915_WRITE(PWRCTXA, dev_priv->savePWRCTXA);
800 }
801
802 /* Hardware status page */ 790 /* Hardware status page */
803 I915_WRITE(HWS_PGA, dev_priv->saveHWS); 791 I915_WRITE(HWS_PGA, dev_priv->saveHWS);
804 792
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 9f3d3e563414..ddefc871edfe 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -548,4 +548,6 @@ void intel_crt_init(struct drm_device *dev)
548 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); 548 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
549 549
550 drm_sysfs_connector_add(connector); 550 drm_sysfs_connector_add(connector);
551
552 dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
551} 553}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 52cd9b006da2..002612fae717 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -262,6 +262,14 @@ struct intel_limit {
262#define IRONLAKE_P2_LVDS_FAST 7 /* double channel */ 262#define IRONLAKE_P2_LVDS_FAST 7 /* double channel */
263#define IRONLAKE_P2_DOT_LIMIT 225000 /* 225Mhz */ 263#define IRONLAKE_P2_DOT_LIMIT 225000 /* 225Mhz */
264 264
265#define IRONLAKE_P_DISPLAY_PORT_MIN 10
266#define IRONLAKE_P_DISPLAY_PORT_MAX 20
267#define IRONLAKE_P2_DISPLAY_PORT_FAST 10
268#define IRONLAKE_P2_DISPLAY_PORT_SLOW 10
269#define IRONLAKE_P2_DISPLAY_PORT_LIMIT 0
270#define IRONLAKE_P1_DISPLAY_PORT_MIN 1
271#define IRONLAKE_P1_DISPLAY_PORT_MAX 2
272
265static bool 273static bool
266intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, 274intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
267 int target, int refclk, intel_clock_t *best_clock); 275 int target, int refclk, intel_clock_t *best_clock);
@@ -271,9 +279,6 @@ intel_find_best_reduced_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
271static bool 279static bool
272intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, 280intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
273 int target, int refclk, intel_clock_t *best_clock); 281 int target, int refclk, intel_clock_t *best_clock);
274static bool
275intel_ironlake_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
276 int target, int refclk, intel_clock_t *best_clock);
277 282
278static bool 283static bool
279intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc, 284intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc,
@@ -496,7 +501,7 @@ static const intel_limit_t intel_limits_ironlake_sdvo = {
496 .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, 501 .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
497 .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW, 502 .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW,
498 .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST }, 503 .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST },
499 .find_pll = intel_ironlake_find_best_PLL, 504 .find_pll = intel_g4x_find_best_PLL,
500}; 505};
501 506
502static const intel_limit_t intel_limits_ironlake_lvds = { 507static const intel_limit_t intel_limits_ironlake_lvds = {
@@ -511,7 +516,30 @@ static const intel_limit_t intel_limits_ironlake_lvds = {
511 .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, 516 .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT,
512 .p2_slow = IRONLAKE_P2_LVDS_SLOW, 517 .p2_slow = IRONLAKE_P2_LVDS_SLOW,
513 .p2_fast = IRONLAKE_P2_LVDS_FAST }, 518 .p2_fast = IRONLAKE_P2_LVDS_FAST },
514 .find_pll = intel_ironlake_find_best_PLL, 519 .find_pll = intel_g4x_find_best_PLL,
520};
521
522static const intel_limit_t intel_limits_ironlake_display_port = {
523 .dot = { .min = IRONLAKE_DOT_MIN,
524 .max = IRONLAKE_DOT_MAX },
525 .vco = { .min = IRONLAKE_VCO_MIN,
526 .max = IRONLAKE_VCO_MAX},
527 .n = { .min = IRONLAKE_N_MIN,
528 .max = IRONLAKE_N_MAX },
529 .m = { .min = IRONLAKE_M_MIN,
530 .max = IRONLAKE_M_MAX },
531 .m1 = { .min = IRONLAKE_M1_MIN,
532 .max = IRONLAKE_M1_MAX },
533 .m2 = { .min = IRONLAKE_M2_MIN,
534 .max = IRONLAKE_M2_MAX },
535 .p = { .min = IRONLAKE_P_DISPLAY_PORT_MIN,
536 .max = IRONLAKE_P_DISPLAY_PORT_MAX },
537 .p1 = { .min = IRONLAKE_P1_DISPLAY_PORT_MIN,
538 .max = IRONLAKE_P1_DISPLAY_PORT_MAX},
539 .p2 = { .dot_limit = IRONLAKE_P2_DISPLAY_PORT_LIMIT,
540 .p2_slow = IRONLAKE_P2_DISPLAY_PORT_SLOW,
541 .p2_fast = IRONLAKE_P2_DISPLAY_PORT_FAST },
542 .find_pll = intel_find_pll_ironlake_dp,
515}; 543};
516 544
517static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) 545static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
@@ -519,6 +547,9 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
519 const intel_limit_t *limit; 547 const intel_limit_t *limit;
520 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) 548 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
521 limit = &intel_limits_ironlake_lvds; 549 limit = &intel_limits_ironlake_lvds;
550 else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
551 HAS_eDP)
552 limit = &intel_limits_ironlake_display_port;
522 else 553 else
523 limit = &intel_limits_ironlake_sdvo; 554 limit = &intel_limits_ironlake_sdvo;
524 555
@@ -791,7 +822,13 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
791 found = false; 822 found = false;
792 823
793 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 824 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
794 if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) == 825 int lvds_reg;
826
827 if (IS_IRONLAKE(dev))
828 lvds_reg = PCH_LVDS;
829 else
830 lvds_reg = LVDS;
831 if ((I915_READ(lvds_reg) & LVDS_CLKB_POWER_MASK) ==
795 LVDS_CLKB_POWER_UP) 832 LVDS_CLKB_POWER_UP)
796 clock.p2 = limit->p2.p2_fast; 833 clock.p2 = limit->p2.p2_fast;
797 else 834 else
@@ -839,6 +876,11 @@ intel_find_pll_ironlake_dp(const intel_limit_t *limit, struct drm_crtc *crtc,
839{ 876{
840 struct drm_device *dev = crtc->dev; 877 struct drm_device *dev = crtc->dev;
841 intel_clock_t clock; 878 intel_clock_t clock;
879
880 /* return directly when it is eDP */
881 if (HAS_eDP)
882 return true;
883
842 if (target < 200000) { 884 if (target < 200000) {
843 clock.n = 1; 885 clock.n = 1;
844 clock.p1 = 2; 886 clock.p1 = 2;
@@ -857,68 +899,6 @@ intel_find_pll_ironlake_dp(const intel_limit_t *limit, struct drm_crtc *crtc,
857 return true; 899 return true;
858} 900}
859 901
860static bool
861intel_ironlake_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
862 int target, int refclk, intel_clock_t *best_clock)
863{
864 struct drm_device *dev = crtc->dev;
865 struct drm_i915_private *dev_priv = dev->dev_private;
866 intel_clock_t clock;
867 int err_most = 47;
868 int err_min = 10000;
869
870 /* eDP has only 2 clock choice, no n/m/p setting */
871 if (HAS_eDP)
872 return true;
873
874 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
875 return intel_find_pll_ironlake_dp(limit, crtc, target,
876 refclk, best_clock);
877
878 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
879 if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) ==
880 LVDS_CLKB_POWER_UP)
881 clock.p2 = limit->p2.p2_fast;
882 else
883 clock.p2 = limit->p2.p2_slow;
884 } else {
885 if (target < limit->p2.dot_limit)
886 clock.p2 = limit->p2.p2_slow;
887 else
888 clock.p2 = limit->p2.p2_fast;
889 }
890
891 memset(best_clock, 0, sizeof(*best_clock));
892 for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) {
893 /* based on hardware requriment prefer smaller n to precision */
894 for (clock.n = limit->n.min; clock.n <= limit->n.max; clock.n++) {
895 /* based on hardware requirment prefere larger m1,m2 */
896 for (clock.m1 = limit->m1.max;
897 clock.m1 >= limit->m1.min; clock.m1--) {
898 for (clock.m2 = limit->m2.max;
899 clock.m2 >= limit->m2.min; clock.m2--) {
900 int this_err;
901
902 intel_clock(dev, refclk, &clock);
903 if (!intel_PLL_is_valid(crtc, &clock))
904 continue;
905 this_err = abs((10000 - (target*10000/clock.dot)));
906 if (this_err < err_most) {
907 *best_clock = clock;
908 /* found on first matching */
909 goto out;
910 } else if (this_err < err_min) {
911 *best_clock = clock;
912 err_min = this_err;
913 }
914 }
915 }
916 }
917 }
918out:
919 return true;
920}
921
922/* DisplayPort has only two frequencies, 162MHz and 270MHz */ 902/* DisplayPort has only two frequencies, 162MHz and 270MHz */
923static bool 903static bool
924intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, 904intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc,
@@ -1493,6 +1473,10 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
1493 int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B; 1473 int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B;
1494 u32 temp; 1474 u32 temp;
1495 int tries = 5, j, n; 1475 int tries = 5, j, n;
1476 u32 pipe_bpc;
1477
1478 temp = I915_READ(pipeconf_reg);
1479 pipe_bpc = temp & PIPE_BPC_MASK;
1496 1480
1497 /* XXX: When our outputs are all unaware of DPMS modes other than off 1481 /* XXX: When our outputs are all unaware of DPMS modes other than off
1498 * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. 1482 * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
@@ -1524,6 +1508,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
1524 1508
1525 /* enable PCH FDI RX PLL, wait warmup plus DMI latency */ 1509 /* enable PCH FDI RX PLL, wait warmup plus DMI latency */
1526 temp = I915_READ(fdi_rx_reg); 1510 temp = I915_READ(fdi_rx_reg);
1511 /*
1512 * make the BPC in FDI Rx be consistent with that in
1513 * pipeconf reg.
1514 */
1515 temp &= ~(0x7 << 16);
1516 temp |= (pipe_bpc << 11);
1527 I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE | 1517 I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE |
1528 FDI_SEL_PCDCLK | 1518 FDI_SEL_PCDCLK |
1529 FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */ 1519 FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */
@@ -1666,6 +1656,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
1666 1656
1667 /* enable PCH transcoder */ 1657 /* enable PCH transcoder */
1668 temp = I915_READ(transconf_reg); 1658 temp = I915_READ(transconf_reg);
1659 /*
1660 * make the BPC in transcoder be consistent with
1661 * that in pipeconf reg.
1662 */
1663 temp &= ~PIPE_BPC_MASK;
1664 temp |= pipe_bpc;
1669 I915_WRITE(transconf_reg, temp | TRANS_ENABLE); 1665 I915_WRITE(transconf_reg, temp | TRANS_ENABLE);
1670 I915_READ(transconf_reg); 1666 I915_READ(transconf_reg);
1671 1667
@@ -1745,6 +1741,9 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
1745 I915_READ(fdi_tx_reg); 1741 I915_READ(fdi_tx_reg);
1746 1742
1747 temp = I915_READ(fdi_rx_reg); 1743 temp = I915_READ(fdi_rx_reg);
1744 /* BPC in FDI rx is consistent with that in pipeconf */
1745 temp &= ~(0x07 << 16);
1746 temp |= (pipe_bpc << 11);
1748 I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE); 1747 I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE);
1749 I915_READ(fdi_rx_reg); 1748 I915_READ(fdi_rx_reg);
1750 1749
@@ -1789,7 +1788,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
1789 } 1788 }
1790 } 1789 }
1791 } 1790 }
1792 1791 temp = I915_READ(transconf_reg);
1792 /* BPC in transcoder is consistent with that in pipeconf */
1793 temp &= ~PIPE_BPC_MASK;
1794 temp |= pipe_bpc;
1795 I915_WRITE(transconf_reg, temp);
1796 I915_READ(transconf_reg);
1793 udelay(100); 1797 udelay(100);
1794 1798
1795 /* disable PCH DPLL */ 1799 /* disable PCH DPLL */
@@ -2448,7 +2452,7 @@ static void pineview_enable_cxsr(struct drm_device *dev, unsigned long clock,
2448 * A value of 5us seems to be a good balance; safe for very low end 2452 * A value of 5us seems to be a good balance; safe for very low end
2449 * platforms but not overly aggressive on lower latency configs. 2453 * platforms but not overly aggressive on lower latency configs.
2450 */ 2454 */
2451const static int latency_ns = 5000; 2455static const int latency_ns = 5000;
2452 2456
2453static int i9xx_get_fifo_size(struct drm_device *dev, int plane) 2457static int i9xx_get_fifo_size(struct drm_device *dev, int plane)
2454{ 2458{
@@ -2559,7 +2563,7 @@ static void g4x_update_wm(struct drm_device *dev, int planea_clock,
2559 /* Calc sr entries for one plane configs */ 2563 /* Calc sr entries for one plane configs */
2560 if (sr_hdisplay && (!planea_clock || !planeb_clock)) { 2564 if (sr_hdisplay && (!planea_clock || !planeb_clock)) {
2561 /* self-refresh has much higher latency */ 2565 /* self-refresh has much higher latency */
2562 const static int sr_latency_ns = 12000; 2566 static const int sr_latency_ns = 12000;
2563 2567
2564 sr_clock = planea_clock ? planea_clock : planeb_clock; 2568 sr_clock = planea_clock ? planea_clock : planeb_clock;
2565 line_time_us = ((sr_hdisplay * 1000) / sr_clock); 2569 line_time_us = ((sr_hdisplay * 1000) / sr_clock);
@@ -2598,7 +2602,7 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
2598 /* Calc sr entries for one plane configs */ 2602 /* Calc sr entries for one plane configs */
2599 if (sr_hdisplay && (!planea_clock || !planeb_clock)) { 2603 if (sr_hdisplay && (!planea_clock || !planeb_clock)) {
2600 /* self-refresh has much higher latency */ 2604 /* self-refresh has much higher latency */
2601 const static int sr_latency_ns = 12000; 2605 static const int sr_latency_ns = 12000;
2602 2606
2603 sr_clock = planea_clock ? planea_clock : planeb_clock; 2607 sr_clock = planea_clock ? planea_clock : planeb_clock;
2604 line_time_us = ((sr_hdisplay * 1000) / sr_clock); 2608 line_time_us = ((sr_hdisplay * 1000) / sr_clock);
@@ -2667,7 +2671,7 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock,
2667 if (HAS_FW_BLC(dev) && sr_hdisplay && 2671 if (HAS_FW_BLC(dev) && sr_hdisplay &&
2668 (!planea_clock || !planeb_clock)) { 2672 (!planea_clock || !planeb_clock)) {
2669 /* self-refresh has much higher latency */ 2673 /* self-refresh has much higher latency */
2670 const static int sr_latency_ns = 6000; 2674 static const int sr_latency_ns = 6000;
2671 2675
2672 sr_clock = planea_clock ? planea_clock : planeb_clock; 2676 sr_clock = planea_clock ? planea_clock : planeb_clock;
2673 line_time_us = ((sr_hdisplay * 1000) / sr_clock); 2677 line_time_us = ((sr_hdisplay * 1000) / sr_clock);
@@ -2969,6 +2973,18 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
2969 2973
2970 /* determine panel color depth */ 2974 /* determine panel color depth */
2971 temp = I915_READ(pipeconf_reg); 2975 temp = I915_READ(pipeconf_reg);
2976 temp &= ~PIPE_BPC_MASK;
2977 if (is_lvds) {
2978 int lvds_reg = I915_READ(PCH_LVDS);
2979 /* the BPC will be 6 if it is 18-bit LVDS panel */
2980 if ((lvds_reg & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP)
2981 temp |= PIPE_8BPC;
2982 else
2983 temp |= PIPE_6BPC;
2984 } else
2985 temp |= PIPE_8BPC;
2986 I915_WRITE(pipeconf_reg, temp);
2987 I915_READ(pipeconf_reg);
2972 2988
2973 switch (temp & PIPE_BPC_MASK) { 2989 switch (temp & PIPE_BPC_MASK) {
2974 case PIPE_8BPC: 2990 case PIPE_8BPC:
@@ -3195,7 +3211,20 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3195 * appropriately here, but we need to look more thoroughly into how 3211 * appropriately here, but we need to look more thoroughly into how
3196 * panels behave in the two modes. 3212 * panels behave in the two modes.
3197 */ 3213 */
3198 3214 /* set the dithering flag */
3215 if (IS_I965G(dev)) {
3216 if (dev_priv->lvds_dither) {
3217 if (IS_IRONLAKE(dev))
3218 pipeconf |= PIPE_ENABLE_DITHER;
3219 else
3220 lvds |= LVDS_ENABLE_DITHER;
3221 } else {
3222 if (IS_IRONLAKE(dev))
3223 pipeconf &= ~PIPE_ENABLE_DITHER;
3224 else
3225 lvds &= ~LVDS_ENABLE_DITHER;
3226 }
3227 }
3199 I915_WRITE(lvds_reg, lvds); 3228 I915_WRITE(lvds_reg, lvds);
3200 I915_READ(lvds_reg); 3229 I915_READ(lvds_reg);
3201 } 3230 }
@@ -3385,7 +3414,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
3385 3414
3386 /* we only need to pin inside GTT if cursor is non-phy */ 3415 /* we only need to pin inside GTT if cursor is non-phy */
3387 mutex_lock(&dev->struct_mutex); 3416 mutex_lock(&dev->struct_mutex);
3388 if (!dev_priv->cursor_needs_physical) { 3417 if (!dev_priv->info->cursor_needs_physical) {
3389 ret = i915_gem_object_pin(bo, PAGE_SIZE); 3418 ret = i915_gem_object_pin(bo, PAGE_SIZE);
3390 if (ret) { 3419 if (ret) {
3391 DRM_ERROR("failed to pin cursor bo\n"); 3420 DRM_ERROR("failed to pin cursor bo\n");
@@ -3420,7 +3449,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
3420 I915_WRITE(base, addr); 3449 I915_WRITE(base, addr);
3421 3450
3422 if (intel_crtc->cursor_bo) { 3451 if (intel_crtc->cursor_bo) {
3423 if (dev_priv->cursor_needs_physical) { 3452 if (dev_priv->info->cursor_needs_physical) {
3424 if (intel_crtc->cursor_bo != bo) 3453 if (intel_crtc->cursor_bo != bo)
3425 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); 3454 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
3426 } else 3455 } else
@@ -3779,125 +3808,6 @@ static void intel_gpu_idle_timer(unsigned long arg)
3779 queue_work(dev_priv->wq, &dev_priv->idle_work); 3808 queue_work(dev_priv->wq, &dev_priv->idle_work);
3780} 3809}
3781 3810
3782void intel_increase_renderclock(struct drm_device *dev, bool schedule)
3783{
3784 drm_i915_private_t *dev_priv = dev->dev_private;
3785
3786 if (IS_IRONLAKE(dev))
3787 return;
3788
3789 if (!dev_priv->render_reclock_avail) {
3790 DRM_DEBUG_DRIVER("not reclocking render clock\n");
3791 return;
3792 }
3793
3794 /* Restore render clock frequency to original value */
3795 if (IS_G4X(dev) || IS_I9XX(dev))
3796 pci_write_config_word(dev->pdev, GCFGC, dev_priv->orig_clock);
3797 else if (IS_I85X(dev))
3798 pci_write_config_word(dev->pdev, HPLLCC, dev_priv->orig_clock);
3799 DRM_DEBUG_DRIVER("increasing render clock frequency\n");
3800
3801 /* Schedule downclock */
3802 if (schedule)
3803 mod_timer(&dev_priv->idle_timer, jiffies +
3804 msecs_to_jiffies(GPU_IDLE_TIMEOUT));
3805}
3806
3807void intel_decrease_renderclock(struct drm_device *dev)
3808{
3809 drm_i915_private_t *dev_priv = dev->dev_private;
3810
3811 if (IS_IRONLAKE(dev))
3812 return;
3813
3814 if (!dev_priv->render_reclock_avail) {
3815 DRM_DEBUG_DRIVER("not reclocking render clock\n");
3816 return;
3817 }
3818
3819 if (IS_G4X(dev)) {
3820 u16 gcfgc;
3821
3822 /* Adjust render clock... */
3823 pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
3824
3825 /* Down to minimum... */
3826 gcfgc &= ~GM45_GC_RENDER_CLOCK_MASK;
3827 gcfgc |= GM45_GC_RENDER_CLOCK_266_MHZ;
3828
3829 pci_write_config_word(dev->pdev, GCFGC, gcfgc);
3830 } else if (IS_I965G(dev)) {
3831 u16 gcfgc;
3832
3833 /* Adjust render clock... */
3834 pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
3835
3836 /* Down to minimum... */
3837 gcfgc &= ~I965_GC_RENDER_CLOCK_MASK;
3838 gcfgc |= I965_GC_RENDER_CLOCK_267_MHZ;
3839
3840 pci_write_config_word(dev->pdev, GCFGC, gcfgc);
3841 } else if (IS_I945G(dev) || IS_I945GM(dev)) {
3842 u16 gcfgc;
3843
3844 /* Adjust render clock... */
3845 pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
3846
3847 /* Down to minimum... */
3848 gcfgc &= ~I945_GC_RENDER_CLOCK_MASK;
3849 gcfgc |= I945_GC_RENDER_CLOCK_166_MHZ;
3850
3851 pci_write_config_word(dev->pdev, GCFGC, gcfgc);
3852 } else if (IS_I915G(dev)) {
3853 u16 gcfgc;
3854
3855 /* Adjust render clock... */
3856 pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
3857
3858 /* Down to minimum... */
3859 gcfgc &= ~I915_GC_RENDER_CLOCK_MASK;
3860 gcfgc |= I915_GC_RENDER_CLOCK_166_MHZ;
3861
3862 pci_write_config_word(dev->pdev, GCFGC, gcfgc);
3863 } else if (IS_I85X(dev)) {
3864 u16 hpllcc;
3865
3866 /* Adjust render clock... */
3867 pci_read_config_word(dev->pdev, HPLLCC, &hpllcc);
3868
3869 /* Up to maximum... */
3870 hpllcc &= ~GC_CLOCK_CONTROL_MASK;
3871 hpllcc |= GC_CLOCK_133_200;
3872
3873 pci_write_config_word(dev->pdev, HPLLCC, hpllcc);
3874 }
3875 DRM_DEBUG_DRIVER("decreasing render clock frequency\n");
3876}
3877
3878/* Note that no increase function is needed for this - increase_renderclock()
3879 * will also rewrite these bits
3880 */
3881void intel_decrease_displayclock(struct drm_device *dev)
3882{
3883 if (IS_IRONLAKE(dev))
3884 return;
3885
3886 if (IS_I945G(dev) || IS_I945GM(dev) || IS_I915G(dev) ||
3887 IS_I915GM(dev)) {
3888 u16 gcfgc;
3889
3890 /* Adjust render clock... */
3891 pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
3892
3893 /* Down to minimum... */
3894 gcfgc &= ~0xf0;
3895 gcfgc |= 0x80;
3896
3897 pci_write_config_word(dev->pdev, GCFGC, gcfgc);
3898 }
3899}
3900
3901#define CRTC_IDLE_TIMEOUT 1000 /* ms */ 3811#define CRTC_IDLE_TIMEOUT 1000 /* ms */
3902 3812
3903static void intel_crtc_idle_timer(unsigned long arg) 3813static void intel_crtc_idle_timer(unsigned long arg)
@@ -4011,12 +3921,6 @@ static void intel_idle_update(struct work_struct *work)
4011 3921
4012 mutex_lock(&dev->struct_mutex); 3922 mutex_lock(&dev->struct_mutex);
4013 3923
4014 /* GPU isn't processing, downclock it. */
4015 if (!dev_priv->busy) {
4016 intel_decrease_renderclock(dev);
4017 intel_decrease_displayclock(dev);
4018 }
4019
4020 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 3924 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
4021 /* Skip inactive CRTCs */ 3925 /* Skip inactive CRTCs */
4022 if (!crtc->fb) 3926 if (!crtc->fb)
@@ -4050,13 +3954,11 @@ void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj)
4050 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 3954 if (!drm_core_check_feature(dev, DRIVER_MODESET))
4051 return; 3955 return;
4052 3956
4053 if (!dev_priv->busy) { 3957 if (!dev_priv->busy)
4054 dev_priv->busy = true; 3958 dev_priv->busy = true;
4055 intel_increase_renderclock(dev, true); 3959 else
4056 } else {
4057 mod_timer(&dev_priv->idle_timer, jiffies + 3960 mod_timer(&dev_priv->idle_timer, jiffies +
4058 msecs_to_jiffies(GPU_IDLE_TIMEOUT)); 3961 msecs_to_jiffies(GPU_IDLE_TIMEOUT));
4059 }
4060 3962
4061 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 3963 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
4062 if (!crtc->fb) 3964 if (!crtc->fb)
@@ -4400,29 +4302,43 @@ static void intel_setup_outputs(struct drm_device *dev)
4400 bool found = false; 4302 bool found = false;
4401 4303
4402 if (I915_READ(SDVOB) & SDVO_DETECTED) { 4304 if (I915_READ(SDVOB) & SDVO_DETECTED) {
4305 DRM_DEBUG_KMS("probing SDVOB\n");
4403 found = intel_sdvo_init(dev, SDVOB); 4306 found = intel_sdvo_init(dev, SDVOB);
4404 if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) 4307 if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) {
4308 DRM_DEBUG_KMS("probing HDMI on SDVOB\n");
4405 intel_hdmi_init(dev, SDVOB); 4309 intel_hdmi_init(dev, SDVOB);
4310 }
4406 4311
4407 if (!found && SUPPORTS_INTEGRATED_DP(dev)) 4312 if (!found && SUPPORTS_INTEGRATED_DP(dev)) {
4313 DRM_DEBUG_KMS("probing DP_B\n");
4408 intel_dp_init(dev, DP_B); 4314 intel_dp_init(dev, DP_B);
4315 }
4409 } 4316 }
4410 4317
4411 /* Before G4X SDVOC doesn't have its own detect register */ 4318 /* Before G4X SDVOC doesn't have its own detect register */
4412 4319
4413 if (I915_READ(SDVOB) & SDVO_DETECTED) 4320 if (I915_READ(SDVOB) & SDVO_DETECTED) {
4321 DRM_DEBUG_KMS("probing SDVOC\n");
4414 found = intel_sdvo_init(dev, SDVOC); 4322 found = intel_sdvo_init(dev, SDVOC);
4323 }
4415 4324
4416 if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { 4325 if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) {
4417 4326
4418 if (SUPPORTS_INTEGRATED_HDMI(dev)) 4327 if (SUPPORTS_INTEGRATED_HDMI(dev)) {
4328 DRM_DEBUG_KMS("probing HDMI on SDVOC\n");
4419 intel_hdmi_init(dev, SDVOC); 4329 intel_hdmi_init(dev, SDVOC);
4420 if (SUPPORTS_INTEGRATED_DP(dev)) 4330 }
4331 if (SUPPORTS_INTEGRATED_DP(dev)) {
4332 DRM_DEBUG_KMS("probing DP_C\n");
4421 intel_dp_init(dev, DP_C); 4333 intel_dp_init(dev, DP_C);
4334 }
4422 } 4335 }
4423 4336
4424 if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED)) 4337 if (SUPPORTS_INTEGRATED_DP(dev) &&
4338 (I915_READ(DP_D) & DP_DETECTED)) {
4339 DRM_DEBUG_KMS("probing DP_D\n");
4425 intel_dp_init(dev, DP_D); 4340 intel_dp_init(dev, DP_D);
4341 }
4426 } else if (IS_I8XX(dev)) 4342 } else if (IS_I8XX(dev))
4427 intel_dvo_init(dev); 4343 intel_dvo_init(dev);
4428 4344
@@ -4527,6 +4443,42 @@ static const struct drm_mode_config_funcs intel_mode_funcs = {
4527 .fb_changed = intelfb_probe, 4443 .fb_changed = intelfb_probe,
4528}; 4444};
4529 4445
4446static struct drm_gem_object *
4447intel_alloc_power_context(struct drm_device *dev)
4448{
4449 struct drm_gem_object *pwrctx;
4450 int ret;
4451
4452 pwrctx = drm_gem_object_alloc(dev, 4096);
4453 if (!pwrctx) {
4454 DRM_DEBUG("failed to alloc power context, RC6 disabled\n");
4455 return NULL;
4456 }
4457
4458 mutex_lock(&dev->struct_mutex);
4459 ret = i915_gem_object_pin(pwrctx, 4096);
4460 if (ret) {
4461 DRM_ERROR("failed to pin power context: %d\n", ret);
4462 goto err_unref;
4463 }
4464
4465 ret = i915_gem_object_set_to_gtt_domain(pwrctx, 1);
4466 if (ret) {
4467 DRM_ERROR("failed to set-domain on power context: %d\n", ret);
4468 goto err_unpin;
4469 }
4470 mutex_unlock(&dev->struct_mutex);
4471
4472 return pwrctx;
4473
4474err_unpin:
4475 i915_gem_object_unpin(pwrctx);
4476err_unref:
4477 drm_gem_object_unreference(pwrctx);
4478 mutex_unlock(&dev->struct_mutex);
4479 return NULL;
4480}
4481
4530void intel_init_clock_gating(struct drm_device *dev) 4482void intel_init_clock_gating(struct drm_device *dev)
4531{ 4483{
4532 struct drm_i915_private *dev_priv = dev->dev_private; 4484 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4579,42 +4531,27 @@ void intel_init_clock_gating(struct drm_device *dev)
4579 * GPU can automatically power down the render unit if given a page 4531 * GPU can automatically power down the render unit if given a page
4580 * to save state. 4532 * to save state.
4581 */ 4533 */
4582 if (I915_HAS_RC6(dev)) { 4534 if (I915_HAS_RC6(dev) && drm_core_check_feature(dev, DRIVER_MODESET)) {
4583 struct drm_gem_object *pwrctx; 4535 struct drm_i915_gem_object *obj_priv = NULL;
4584 struct drm_i915_gem_object *obj_priv;
4585 int ret;
4586 4536
4587 if (dev_priv->pwrctx) { 4537 if (dev_priv->pwrctx) {
4588 obj_priv = dev_priv->pwrctx->driver_private; 4538 obj_priv = dev_priv->pwrctx->driver_private;
4589 } else { 4539 } else {
4590 pwrctx = drm_gem_object_alloc(dev, 4096); 4540 struct drm_gem_object *pwrctx;
4591 if (!pwrctx) {
4592 DRM_DEBUG("failed to alloc power context, "
4593 "RC6 disabled\n");
4594 goto out;
4595 }
4596 4541
4597 ret = i915_gem_object_pin(pwrctx, 4096); 4542 pwrctx = intel_alloc_power_context(dev);
4598 if (ret) { 4543 if (pwrctx) {
4599 DRM_ERROR("failed to pin power context: %d\n", 4544 dev_priv->pwrctx = pwrctx;
4600 ret); 4545 obj_priv = pwrctx->driver_private;
4601 drm_gem_object_unreference(pwrctx);
4602 goto out;
4603 } 4546 }
4604
4605 i915_gem_object_set_to_gtt_domain(pwrctx, 1);
4606
4607 dev_priv->pwrctx = pwrctx;
4608 obj_priv = pwrctx->driver_private;
4609 } 4547 }
4610 4548
4611 I915_WRITE(PWRCTXA, obj_priv->gtt_offset | PWRCTX_EN); 4549 if (obj_priv) {
4612 I915_WRITE(MCHBAR_RENDER_STANDBY, 4550 I915_WRITE(PWRCTXA, obj_priv->gtt_offset | PWRCTX_EN);
4613 I915_READ(MCHBAR_RENDER_STANDBY) & ~RCX_SW_EXIT); 4551 I915_WRITE(MCHBAR_RENDER_STANDBY,
4552 I915_READ(MCHBAR_RENDER_STANDBY) & ~RCX_SW_EXIT);
4553 }
4614 } 4554 }
4615
4616out:
4617 return;
4618} 4555}
4619 4556
4620/* Set up chip specific display functions */ 4557/* Set up chip specific display functions */
@@ -4770,7 +4707,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
4770 del_timer_sync(&intel_crtc->idle_timer); 4707 del_timer_sync(&intel_crtc->idle_timer);
4771 } 4708 }
4772 4709
4773 intel_increase_renderclock(dev, false);
4774 del_timer_sync(&dev_priv->idle_timer); 4710 del_timer_sync(&dev_priv->idle_timer);
4775 4711
4776 if (dev_priv->display.disable_fbc) 4712 if (dev_priv->display.disable_fbc)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 4e7aa8b7b938..1349d9fd01c4 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1402,14 +1402,20 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1402 break; 1402 break;
1403 case DP_B: 1403 case DP_B:
1404 case PCH_DP_B: 1404 case PCH_DP_B:
1405 dev_priv->hotplug_supported_mask |=
1406 HDMIB_HOTPLUG_INT_STATUS;
1405 name = "DPDDC-B"; 1407 name = "DPDDC-B";
1406 break; 1408 break;
1407 case DP_C: 1409 case DP_C:
1408 case PCH_DP_C: 1410 case PCH_DP_C:
1411 dev_priv->hotplug_supported_mask |=
1412 HDMIC_HOTPLUG_INT_STATUS;
1409 name = "DPDDC-C"; 1413 name = "DPDDC-C";
1410 break; 1414 break;
1411 case DP_D: 1415 case DP_D:
1412 case PCH_DP_D: 1416 case PCH_DP_D:
1417 dev_priv->hotplug_supported_mask |=
1418 HDMID_HOTPLUG_INT_STATUS;
1413 name = "DPDDC-D"; 1419 name = "DPDDC-D";
1414 break; 1420 break;
1415 } 1421 }
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index f04dbbe7d400..06431941b233 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -303,21 +303,26 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
303 if (sdvox_reg == SDVOB) { 303 if (sdvox_reg == SDVOB) {
304 intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); 304 intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT);
305 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); 305 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
306 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
306 } else if (sdvox_reg == SDVOC) { 307 } else if (sdvox_reg == SDVOC) {
307 intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); 308 intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT);
308 intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); 309 intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
310 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
309 } else if (sdvox_reg == HDMIB) { 311 } else if (sdvox_reg == HDMIB) {
310 intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); 312 intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT);
311 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, 313 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
312 "HDMIB"); 314 "HDMIB");
315 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
313 } else if (sdvox_reg == HDMIC) { 316 } else if (sdvox_reg == HDMIC) {
314 intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); 317 intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT);
315 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, 318 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
316 "HDMIC"); 319 "HDMIC");
320 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
317 } else if (sdvox_reg == HDMID) { 321 } else if (sdvox_reg == HDMID) {
318 intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); 322 intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT);
319 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, 323 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
320 "HDMID"); 324 "HDMID");
325 dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
321 } 326 }
322 if (!intel_output->ddc_bus) 327 if (!intel_output->ddc_bus)
323 goto err_connector; 328 goto err_connector;
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 3118ce274e67..f4b4aa242df1 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -608,6 +608,13 @@ static const struct dmi_system_id bad_lid_status[] = {
608 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"), 608 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"),
609 }, 609 },
610 }, 610 },
611 {
612 .ident = "PC-81005",
613 .matches = {
614 DMI_MATCH(DMI_SYS_VENDOR, "MALATA"),
615 DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"),
616 },
617 },
611 { } 618 { }
612}; 619};
613 620
@@ -679,7 +686,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
679 struct drm_i915_private *dev_priv = 686 struct drm_i915_private *dev_priv =
680 container_of(nb, struct drm_i915_private, lid_notifier); 687 container_of(nb, struct drm_i915_private, lid_notifier);
681 struct drm_device *dev = dev_priv->dev; 688 struct drm_device *dev = dev_priv->dev;
689 struct drm_connector *connector = dev_priv->int_lvds_connector;
682 690
691 /*
692 * check and update the status of LVDS connector after receiving
693 * the LID nofication event.
694 */
695 if (connector)
696 connector->status = connector->funcs->detect(connector);
683 if (!acpi_lid_open()) { 697 if (!acpi_lid_open()) {
684 dev_priv->modeset_on_lid = 1; 698 dev_priv->modeset_on_lid = 1;
685 return NOTIFY_OK; 699 return NOTIFY_OK;
@@ -854,65 +868,6 @@ static const struct dmi_system_id intel_no_lvds[] = {
854 { } /* terminating entry */ 868 { } /* terminating entry */
855}; 869};
856 870
857#ifdef CONFIG_ACPI
858/*
859 * check_lid_device -- check whether @handle is an ACPI LID device.
860 * @handle: ACPI device handle
861 * @level : depth in the ACPI namespace tree
862 * @context: the number of LID device when we find the device
863 * @rv: a return value to fill if desired (Not use)
864 */
865static acpi_status
866check_lid_device(acpi_handle handle, u32 level, void *context,
867 void **return_value)
868{
869 struct acpi_device *acpi_dev;
870 int *lid_present = context;
871
872 acpi_dev = NULL;
873 /* Get the acpi device for device handle */
874 if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) {
875 /* If there is no ACPI device for handle, return */
876 return AE_OK;
877 }
878
879 if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7))
880 *lid_present = 1;
881
882 return AE_OK;
883}
884
885/**
886 * check whether there exists the ACPI LID device by enumerating the ACPI
887 * device tree.
888 */
889static int intel_lid_present(void)
890{
891 int lid_present = 0;
892
893 if (acpi_disabled) {
894 /* If ACPI is disabled, there is no ACPI device tree to
895 * check, so assume the LID device would have been present.
896 */
897 return 1;
898 }
899
900 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
901 ACPI_UINT32_MAX,
902 check_lid_device, NULL, &lid_present, NULL);
903
904 return lid_present;
905}
906#else
907static int intel_lid_present(void)
908{
909 /* In the absence of ACPI built in, assume that the LID device would
910 * have been present.
911 */
912 return 1;
913}
914#endif
915
916/** 871/**
917 * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID 872 * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID
918 * @dev: drm device 873 * @dev: drm device
@@ -1031,12 +986,8 @@ void intel_lvds_init(struct drm_device *dev)
1031 if (dmi_check_system(intel_no_lvds)) 986 if (dmi_check_system(intel_no_lvds))
1032 return; 987 return;
1033 988
1034 /* 989 if (!lvds_is_present_in_vbt(dev)) {
1035 * Assume LVDS is present if there's an ACPI lid device or if the 990 DRM_DEBUG_KMS("LVDS is not present in VBT\n");
1036 * device is present in the VBT.
1037 */
1038 if (!lvds_is_present_in_vbt(dev) && !intel_lid_present()) {
1039 DRM_DEBUG_KMS("LVDS is not present in VBT and no lid detected\n");
1040 return; 991 return;
1041 } 992 }
1042 993
@@ -1180,6 +1131,8 @@ out:
1180 DRM_DEBUG_KMS("lid notifier registration failed\n"); 1131 DRM_DEBUG_KMS("lid notifier registration failed\n");
1181 dev_priv->lid_notifier.notifier_call = NULL; 1132 dev_priv->lid_notifier.notifier_call = NULL;
1182 } 1133 }
1134 /* keep the LVDS connector */
1135 dev_priv->int_lvds_connector = connector;
1183 drm_sysfs_connector_add(connector); 1136 drm_sysfs_connector_add(connector);
1184 return; 1137 return;
1185 1138
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 24a3dc99716c..de5144c8c153 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2662,6 +2662,7 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2662 2662
2663bool intel_sdvo_init(struct drm_device *dev, int output_device) 2663bool intel_sdvo_init(struct drm_device *dev, int output_device)
2664{ 2664{
2665 struct drm_i915_private *dev_priv = dev->dev_private;
2665 struct drm_connector *connector; 2666 struct drm_connector *connector;
2666 struct intel_output *intel_output; 2667 struct intel_output *intel_output;
2667 struct intel_sdvo_priv *sdvo_priv; 2668 struct intel_sdvo_priv *sdvo_priv;
@@ -2708,10 +2709,12 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2708 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); 2709 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS");
2709 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, 2710 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA,
2710 "SDVOB/VGA DDC BUS"); 2711 "SDVOB/VGA DDC BUS");
2712 dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS;
2711 } else { 2713 } else {
2712 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); 2714 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS");
2713 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, 2715 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA,
2714 "SDVOC/VGA DDC BUS"); 2716 "SDVOC/VGA DDC BUS");
2717 dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS;
2715 } 2718 }
2716 2719
2717 if (intel_output->ddc_bus == NULL) 2720 if (intel_output->ddc_bus == NULL)
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 552ec110b741..1d5b9b7b033f 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1840,6 +1840,8 @@ intel_tv_init(struct drm_device *dev)
1840 drm_connector_attach_property(connector, 1840 drm_connector_attach_property(connector,
1841 dev->mode_config.tv_bottom_margin_property, 1841 dev->mode_config.tv_bottom_margin_property,
1842 tv_priv->margin[TV_MARGIN_BOTTOM]); 1842 tv_priv->margin[TV_MARGIN_BOTTOM]);
1843
1844 dev_priv->hotplug_supported_mask |= TV_HOTPLUG_INT_STATUS;
1843out: 1845out:
1844 drm_sysfs_connector_add(connector); 1846 drm_sysfs_connector_add(connector);
1845} 1847}
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c
index 97ee566ef749..ddfe16197b59 100644
--- a/drivers/gpu/drm/mga/mga_drv.c
+++ b/drivers/gpu/drm/mga/mga_drv.c
@@ -68,7 +68,7 @@ static struct drm_driver driver = {
68 .owner = THIS_MODULE, 68 .owner = THIS_MODULE,
69 .open = drm_open, 69 .open = drm_open,
70 .release = drm_release, 70 .release = drm_release,
71 .ioctl = drm_ioctl, 71 .unlocked_ioctl = drm_ioctl,
72 .mmap = drm_mmap, 72 .mmap = drm_mmap,
73 .poll = drm_poll, 73 .poll = drm_poll,
74 .fasync = drm_fasync, 74 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c
index 30d00478ddee..c1f877b7bac1 100644
--- a/drivers/gpu/drm/mga/mga_ioc32.c
+++ b/drivers/gpu/drm/mga/mga_ioc32.c
@@ -100,8 +100,7 @@ static int compat_mga_init(struct file *file, unsigned int cmd,
100 if (err) 100 if (err)
101 return -EFAULT; 101 return -EFAULT;
102 102
103 return drm_ioctl(file->f_path.dentry->d_inode, file, 103 return drm_ioctl(file, DRM_IOCTL_MGA_INIT, (unsigned long)init);
104 DRM_IOCTL_MGA_INIT, (unsigned long)init);
105} 104}
106 105
107typedef struct drm_mga_getparam32 { 106typedef struct drm_mga_getparam32 {
@@ -125,8 +124,7 @@ static int compat_mga_getparam(struct file *file, unsigned int cmd,
125 &getparam->value)) 124 &getparam->value))
126 return -EFAULT; 125 return -EFAULT;
127 126
128 return drm_ioctl(file->f_path.dentry->d_inode, file, 127 return drm_ioctl(file, DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam);
129 DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam);
130} 128}
131 129
132typedef struct drm_mga_drm_bootstrap32 { 130typedef struct drm_mga_drm_bootstrap32 {
@@ -166,8 +164,7 @@ static int compat_mga_dma_bootstrap(struct file *file, unsigned int cmd,
166 || __put_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size)) 164 || __put_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size))
167 return -EFAULT; 165 return -EFAULT;
168 166
169 err = drm_ioctl(file->f_path.dentry->d_inode, file, 167 err = drm_ioctl(file, DRM_IOCTL_MGA_DMA_BOOTSTRAP,
170 DRM_IOCTL_MGA_DMA_BOOTSTRAP,
171 (unsigned long)dma_bootstrap); 168 (unsigned long)dma_bootstrap);
172 if (err) 169 if (err)
173 return err; 170 return err;
@@ -220,12 +217,10 @@ long mga_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
220 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) 217 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls))
221 fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; 218 fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE];
222 219
223 lock_kernel(); /* XXX for now */
224 if (fn != NULL) 220 if (fn != NULL)
225 ret = (*fn) (filp, cmd, arg); 221 ret = (*fn) (filp, cmd, arg);
226 else 222 else
227 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); 223 ret = drm_ioctl(filp, cmd, arg);
228 unlock_kernel();
229 224
230 return ret; 225 return ret;
231} 226}
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index b1bc1ea182b8..1175429da102 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -30,12 +30,11 @@ config DRM_NOUVEAU_DEBUG
30 via debugfs. 30 via debugfs.
31 31
32menu "I2C encoder or helper chips" 32menu "I2C encoder or helper chips"
33 depends on DRM && I2C 33 depends on DRM && DRM_KMS_HELPER && I2C
34 34
35config DRM_I2C_CH7006 35config DRM_I2C_CH7006
36 tristate "Chrontel ch7006 TV encoder" 36 tristate "Chrontel ch7006 TV encoder"
37 depends on DRM_NOUVEAU 37 default m if DRM_NOUVEAU
38 default m
39 help 38 help
40 Support for Chrontel ch7006 and similar TV encoders, found 39 Support for Chrontel ch7006 and similar TV encoders, found
41 on some nVidia video cards. 40 on some nVidia video cards.
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
index 1d90d4d0144f..48c290b5da8c 100644
--- a/drivers/gpu/drm/nouveau/Makefile
+++ b/drivers/gpu/drm/nouveau/Makefile
@@ -8,14 +8,15 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
8 nouveau_sgdma.o nouveau_dma.o \ 8 nouveau_sgdma.o nouveau_dma.o \
9 nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \ 9 nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \
10 nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \ 10 nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \
11 nouveau_display.o nouveau_connector.o nouveau_fbcon.o \ 11 nouveau_display.o nouveau_connector.o nouveau_fbcon.o \
12 nouveau_dp.o \ 12 nouveau_dp.o nouveau_grctx.o \
13 nv04_timer.o \ 13 nv04_timer.o \
14 nv04_mc.o nv40_mc.o nv50_mc.o \ 14 nv04_mc.o nv40_mc.o nv50_mc.o \
15 nv04_fb.o nv10_fb.o nv40_fb.o \ 15 nv04_fb.o nv10_fb.o nv40_fb.o \
16 nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ 16 nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \
17 nv04_graph.o nv10_graph.o nv20_graph.o \ 17 nv04_graph.o nv10_graph.o nv20_graph.o \
18 nv40_graph.o nv50_graph.o \ 18 nv40_graph.o nv50_graph.o \
19 nv40_grctx.o \
19 nv04_instmem.o nv50_instmem.o \ 20 nv04_instmem.o nv50_instmem.o \
20 nv50_crtc.o nv50_dac.o nv50_sor.o \ 21 nv50_crtc.o nv50_dac.o nv50_sor.o \
21 nv50_cursor.o nv50_display.o nv50_fbcon.o \ 22 nv50_cursor.o nv50_display.o nv50_fbcon.o \
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index 5eec5ed69489..ba143972769f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -181,43 +181,42 @@ struct methods {
181 const char desc[8]; 181 const char desc[8];
182 void (*loadbios)(struct drm_device *, uint8_t *); 182 void (*loadbios)(struct drm_device *, uint8_t *);
183 const bool rw; 183 const bool rw;
184 int score;
185}; 184};
186 185
187static struct methods nv04_methods[] = { 186static struct methods nv04_methods[] = {
188 { "PROM", load_vbios_prom, false }, 187 { "PROM", load_vbios_prom, false },
189 { "PRAMIN", load_vbios_pramin, true }, 188 { "PRAMIN", load_vbios_pramin, true },
190 { "PCIROM", load_vbios_pci, true }, 189 { "PCIROM", load_vbios_pci, true },
191 { }
192}; 190};
193 191
194static struct methods nv50_methods[] = { 192static struct methods nv50_methods[] = {
195 { "PRAMIN", load_vbios_pramin, true }, 193 { "PRAMIN", load_vbios_pramin, true },
196 { "PROM", load_vbios_prom, false }, 194 { "PROM", load_vbios_prom, false },
197 { "PCIROM", load_vbios_pci, true }, 195 { "PCIROM", load_vbios_pci, true },
198 { }
199}; 196};
200 197
198#define METHODCNT 3
199
201static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) 200static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
202{ 201{
203 struct drm_nouveau_private *dev_priv = dev->dev_private; 202 struct drm_nouveau_private *dev_priv = dev->dev_private;
204 struct methods *methods, *method; 203 struct methods *methods;
204 int i;
205 int testscore = 3; 205 int testscore = 3;
206 int scores[METHODCNT];
206 207
207 if (nouveau_vbios) { 208 if (nouveau_vbios) {
208 method = nv04_methods; 209 methods = nv04_methods;
209 while (method->loadbios) { 210 for (i = 0; i < METHODCNT; i++)
210 if (!strcasecmp(nouveau_vbios, method->desc)) 211 if (!strcasecmp(nouveau_vbios, methods[i].desc))
211 break; 212 break;
212 method++;
213 }
214 213
215 if (method->loadbios) { 214 if (i < METHODCNT) {
216 NV_INFO(dev, "Attempting to use BIOS image from %s\n", 215 NV_INFO(dev, "Attempting to use BIOS image from %s\n",
217 method->desc); 216 methods[i].desc);
218 217
219 method->loadbios(dev, data); 218 methods[i].loadbios(dev, data);
220 if (score_vbios(dev, data, method->rw)) 219 if (score_vbios(dev, data, methods[i].rw))
221 return true; 220 return true;
222 } 221 }
223 222
@@ -229,28 +228,24 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
229 else 228 else
230 methods = nv50_methods; 229 methods = nv50_methods;
231 230
232 method = methods; 231 for (i = 0; i < METHODCNT; i++) {
233 while (method->loadbios) {
234 NV_TRACE(dev, "Attempting to load BIOS image from %s\n", 232 NV_TRACE(dev, "Attempting to load BIOS image from %s\n",
235 method->desc); 233 methods[i].desc);
236 data[0] = data[1] = 0; /* avoid reuse of previous image */ 234 data[0] = data[1] = 0; /* avoid reuse of previous image */
237 method->loadbios(dev, data); 235 methods[i].loadbios(dev, data);
238 method->score = score_vbios(dev, data, method->rw); 236 scores[i] = score_vbios(dev, data, methods[i].rw);
239 if (method->score == testscore) 237 if (scores[i] == testscore)
240 return true; 238 return true;
241 method++;
242 } 239 }
243 240
244 while (--testscore > 0) { 241 while (--testscore > 0) {
245 method = methods; 242 for (i = 0; i < METHODCNT; i++) {
246 while (method->loadbios) { 243 if (scores[i] == testscore) {
247 if (method->score == testscore) {
248 NV_TRACE(dev, "Using BIOS image from %s\n", 244 NV_TRACE(dev, "Using BIOS image from %s\n",
249 method->desc); 245 methods[i].desc);
250 method->loadbios(dev, data); 246 methods[i].loadbios(dev, data);
251 return true; 247 return true;
252 } 248 }
253 method++;
254 } 249 }
255 } 250 }
256 251
@@ -261,10 +256,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
261struct init_tbl_entry { 256struct init_tbl_entry {
262 char *name; 257 char *name;
263 uint8_t id; 258 uint8_t id;
264 int length; 259 int (*handler)(struct nvbios *, uint16_t, struct init_exec *);
265 int length_offset;
266 int length_multiplier;
267 bool (*handler)(struct nvbios *, uint16_t, struct init_exec *);
268}; 260};
269 261
270struct bit_entry { 262struct bit_entry {
@@ -820,7 +812,7 @@ static uint32_t get_tmds_index_reg(struct drm_device *dev, uint8_t mlv)
820 } 812 }
821} 813}
822 814
823static bool 815static int
824init_io_restrict_prog(struct nvbios *bios, uint16_t offset, 816init_io_restrict_prog(struct nvbios *bios, uint16_t offset,
825 struct init_exec *iexec) 817 struct init_exec *iexec)
826{ 818{
@@ -852,9 +844,10 @@ init_io_restrict_prog(struct nvbios *bios, uint16_t offset,
852 uint32_t reg = ROM32(bios->data[offset + 7]); 844 uint32_t reg = ROM32(bios->data[offset + 7]);
853 uint8_t config; 845 uint8_t config;
854 uint32_t configval; 846 uint32_t configval;
847 int len = 11 + count * 4;
855 848
856 if (!iexec->execute) 849 if (!iexec->execute)
857 return true; 850 return len;
858 851
859 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " 852 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, "
860 "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n", 853 "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n",
@@ -865,7 +858,7 @@ init_io_restrict_prog(struct nvbios *bios, uint16_t offset,
865 NV_ERROR(bios->dev, 858 NV_ERROR(bios->dev,
866 "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", 859 "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n",
867 offset, config, count); 860 offset, config, count);
868 return false; 861 return 0;
869 } 862 }
870 863
871 configval = ROM32(bios->data[offset + 11 + config * 4]); 864 configval = ROM32(bios->data[offset + 11 + config * 4]);
@@ -874,10 +867,10 @@ init_io_restrict_prog(struct nvbios *bios, uint16_t offset,
874 867
875 bios_wr32(bios, reg, configval); 868 bios_wr32(bios, reg, configval);
876 869
877 return true; 870 return len;
878} 871}
879 872
880static bool 873static int
881init_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 874init_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
882{ 875{
883 /* 876 /*
@@ -912,10 +905,10 @@ init_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
912 905
913 iexec->repeat = false; 906 iexec->repeat = false;
914 907
915 return true; 908 return 2;
916} 909}
917 910
918static bool 911static int
919init_io_restrict_pll(struct nvbios *bios, uint16_t offset, 912init_io_restrict_pll(struct nvbios *bios, uint16_t offset,
920 struct init_exec *iexec) 913 struct init_exec *iexec)
921{ 914{
@@ -951,9 +944,10 @@ init_io_restrict_pll(struct nvbios *bios, uint16_t offset,
951 uint32_t reg = ROM32(bios->data[offset + 8]); 944 uint32_t reg = ROM32(bios->data[offset + 8]);
952 uint8_t config; 945 uint8_t config;
953 uint16_t freq; 946 uint16_t freq;
947 int len = 12 + count * 2;
954 948
955 if (!iexec->execute) 949 if (!iexec->execute)
956 return true; 950 return len;
957 951
958 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " 952 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, "
959 "Shift: 0x%02X, IO Flag Condition: 0x%02X, " 953 "Shift: 0x%02X, IO Flag Condition: 0x%02X, "
@@ -966,7 +960,7 @@ init_io_restrict_pll(struct nvbios *bios, uint16_t offset,
966 NV_ERROR(bios->dev, 960 NV_ERROR(bios->dev,
967 "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", 961 "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n",
968 offset, config, count); 962 offset, config, count);
969 return false; 963 return 0;
970 } 964 }
971 965
972 freq = ROM16(bios->data[offset + 12 + config * 2]); 966 freq = ROM16(bios->data[offset + 12 + config * 2]);
@@ -986,10 +980,10 @@ init_io_restrict_pll(struct nvbios *bios, uint16_t offset,
986 980
987 setPLL(bios, reg, freq * 10); 981 setPLL(bios, reg, freq * 10);
988 982
989 return true; 983 return len;
990} 984}
991 985
992static bool 986static int
993init_end_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 987init_end_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
994{ 988{
995 /* 989 /*
@@ -1007,12 +1001,12 @@ init_end_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1007 * we're not in repeat mode 1001 * we're not in repeat mode
1008 */ 1002 */
1009 if (iexec->repeat) 1003 if (iexec->repeat)
1010 return false; 1004 return 0;
1011 1005
1012 return true; 1006 return 1;
1013} 1007}
1014 1008
1015static bool 1009static int
1016init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1010init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1017{ 1011{
1018 /* 1012 /*
@@ -1041,7 +1035,7 @@ init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1041 uint8_t crtcdata; 1035 uint8_t crtcdata;
1042 1036
1043 if (!iexec->execute) 1037 if (!iexec->execute)
1044 return true; 1038 return 11;
1045 1039
1046 BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%02X, " 1040 BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%02X, "
1047 "Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X\n", 1041 "Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X\n",
@@ -1060,10 +1054,10 @@ init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1060 crtcdata |= (uint8_t)data; 1054 crtcdata |= (uint8_t)data;
1061 bios_idxprt_wr(bios, crtcport, crtcindex, crtcdata); 1055 bios_idxprt_wr(bios, crtcport, crtcindex, crtcdata);
1062 1056
1063 return true; 1057 return 11;
1064} 1058}
1065 1059
1066static bool 1060static int
1067init_not(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1061init_not(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1068{ 1062{
1069 /* 1063 /*
@@ -1079,10 +1073,10 @@ init_not(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1079 BIOSLOG(bios, "0x%04X: ------ Executing following commands ------\n", offset); 1073 BIOSLOG(bios, "0x%04X: ------ Executing following commands ------\n", offset);
1080 1074
1081 iexec->execute = !iexec->execute; 1075 iexec->execute = !iexec->execute;
1082 return true; 1076 return 1;
1083} 1077}
1084 1078
1085static bool 1079static int
1086init_io_flag_condition(struct nvbios *bios, uint16_t offset, 1080init_io_flag_condition(struct nvbios *bios, uint16_t offset,
1087 struct init_exec *iexec) 1081 struct init_exec *iexec)
1088{ 1082{
@@ -1100,7 +1094,7 @@ init_io_flag_condition(struct nvbios *bios, uint16_t offset,
1100 uint8_t cond = bios->data[offset + 1]; 1094 uint8_t cond = bios->data[offset + 1];
1101 1095
1102 if (!iexec->execute) 1096 if (!iexec->execute)
1103 return true; 1097 return 2;
1104 1098
1105 if (io_flag_condition_met(bios, offset, cond)) 1099 if (io_flag_condition_met(bios, offset, cond))
1106 BIOSLOG(bios, "0x%04X: Condition fulfilled -- continuing to execute\n", offset); 1100 BIOSLOG(bios, "0x%04X: Condition fulfilled -- continuing to execute\n", offset);
@@ -1109,10 +1103,10 @@ init_io_flag_condition(struct nvbios *bios, uint16_t offset,
1109 iexec->execute = false; 1103 iexec->execute = false;
1110 } 1104 }
1111 1105
1112 return true; 1106 return 2;
1113} 1107}
1114 1108
1115static bool 1109static int
1116init_idx_addr_latched(struct nvbios *bios, uint16_t offset, 1110init_idx_addr_latched(struct nvbios *bios, uint16_t offset,
1117 struct init_exec *iexec) 1111 struct init_exec *iexec)
1118{ 1112{
@@ -1140,11 +1134,12 @@ init_idx_addr_latched(struct nvbios *bios, uint16_t offset,
1140 uint32_t mask = ROM32(bios->data[offset + 9]); 1134 uint32_t mask = ROM32(bios->data[offset + 9]);
1141 uint32_t data = ROM32(bios->data[offset + 13]); 1135 uint32_t data = ROM32(bios->data[offset + 13]);
1142 uint8_t count = bios->data[offset + 17]; 1136 uint8_t count = bios->data[offset + 17];
1137 int len = 18 + count * 2;
1143 uint32_t value; 1138 uint32_t value;
1144 int i; 1139 int i;
1145 1140
1146 if (!iexec->execute) 1141 if (!iexec->execute)
1147 return true; 1142 return len;
1148 1143
1149 BIOSLOG(bios, "0x%04X: ControlReg: 0x%08X, DataReg: 0x%08X, " 1144 BIOSLOG(bios, "0x%04X: ControlReg: 0x%08X, DataReg: 0x%08X, "
1150 "Mask: 0x%08X, Data: 0x%08X, Count: 0x%02X\n", 1145 "Mask: 0x%08X, Data: 0x%08X, Count: 0x%02X\n",
@@ -1164,10 +1159,10 @@ init_idx_addr_latched(struct nvbios *bios, uint16_t offset,
1164 bios_wr32(bios, controlreg, value); 1159 bios_wr32(bios, controlreg, value);
1165 } 1160 }
1166 1161
1167 return true; 1162 return len;
1168} 1163}
1169 1164
1170static bool 1165static int
1171init_io_restrict_pll2(struct nvbios *bios, uint16_t offset, 1166init_io_restrict_pll2(struct nvbios *bios, uint16_t offset,
1172 struct init_exec *iexec) 1167 struct init_exec *iexec)
1173{ 1168{
@@ -1196,25 +1191,26 @@ init_io_restrict_pll2(struct nvbios *bios, uint16_t offset,
1196 uint8_t shift = bios->data[offset + 5]; 1191 uint8_t shift = bios->data[offset + 5];
1197 uint8_t count = bios->data[offset + 6]; 1192 uint8_t count = bios->data[offset + 6];
1198 uint32_t reg = ROM32(bios->data[offset + 7]); 1193 uint32_t reg = ROM32(bios->data[offset + 7]);
1194 int len = 11 + count * 4;
1199 uint8_t config; 1195 uint8_t config;
1200 uint32_t freq; 1196 uint32_t freq;
1201 1197
1202 if (!iexec->execute) 1198 if (!iexec->execute)
1203 return true; 1199 return len;
1204 1200
1205 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " 1201 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, "
1206 "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n", 1202 "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n",
1207 offset, crtcport, crtcindex, mask, shift, count, reg); 1203 offset, crtcport, crtcindex, mask, shift, count, reg);
1208 1204
1209 if (!reg) 1205 if (!reg)
1210 return true; 1206 return len;
1211 1207
1212 config = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) >> shift; 1208 config = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) >> shift;
1213 if (config > count) { 1209 if (config > count) {
1214 NV_ERROR(bios->dev, 1210 NV_ERROR(bios->dev,
1215 "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", 1211 "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n",
1216 offset, config, count); 1212 offset, config, count);
1217 return false; 1213 return 0;
1218 } 1214 }
1219 1215
1220 freq = ROM32(bios->data[offset + 11 + config * 4]); 1216 freq = ROM32(bios->data[offset + 11 + config * 4]);
@@ -1224,10 +1220,10 @@ init_io_restrict_pll2(struct nvbios *bios, uint16_t offset,
1224 1220
1225 setPLL(bios, reg, freq); 1221 setPLL(bios, reg, freq);
1226 1222
1227 return true; 1223 return len;
1228} 1224}
1229 1225
1230static bool 1226static int
1231init_pll2(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1227init_pll2(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1232{ 1228{
1233 /* 1229 /*
@@ -1244,16 +1240,16 @@ init_pll2(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1244 uint32_t freq = ROM32(bios->data[offset + 5]); 1240 uint32_t freq = ROM32(bios->data[offset + 5]);
1245 1241
1246 if (!iexec->execute) 1242 if (!iexec->execute)
1247 return true; 1243 return 9;
1248 1244
1249 BIOSLOG(bios, "0x%04X: Reg: 0x%04X, Freq: %dkHz\n", 1245 BIOSLOG(bios, "0x%04X: Reg: 0x%04X, Freq: %dkHz\n",
1250 offset, reg, freq); 1246 offset, reg, freq);
1251 1247
1252 setPLL(bios, reg, freq); 1248 setPLL(bios, reg, freq);
1253 return true; 1249 return 9;
1254} 1250}
1255 1251
1256static bool 1252static int
1257init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1253init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1258{ 1254{
1259 /* 1255 /*
@@ -1277,12 +1273,13 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1277 uint8_t i2c_index = bios->data[offset + 1]; 1273 uint8_t i2c_index = bios->data[offset + 1];
1278 uint8_t i2c_address = bios->data[offset + 2]; 1274 uint8_t i2c_address = bios->data[offset + 2];
1279 uint8_t count = bios->data[offset + 3]; 1275 uint8_t count = bios->data[offset + 3];
1276 int len = 4 + count * 3;
1280 struct nouveau_i2c_chan *chan; 1277 struct nouveau_i2c_chan *chan;
1281 struct i2c_msg msg; 1278 struct i2c_msg msg;
1282 int i; 1279 int i;
1283 1280
1284 if (!iexec->execute) 1281 if (!iexec->execute)
1285 return true; 1282 return len;
1286 1283
1287 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " 1284 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1288 "Count: 0x%02X\n", 1285 "Count: 0x%02X\n",
@@ -1290,7 +1287,7 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1290 1287
1291 chan = init_i2c_device_find(bios->dev, i2c_index); 1288 chan = init_i2c_device_find(bios->dev, i2c_index);
1292 if (!chan) 1289 if (!chan)
1293 return false; 1290 return 0;
1294 1291
1295 for (i = 0; i < count; i++) { 1292 for (i = 0; i < count; i++) {
1296 uint8_t i2c_reg = bios->data[offset + 4 + i * 3]; 1293 uint8_t i2c_reg = bios->data[offset + 4 + i * 3];
@@ -1303,7 +1300,7 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1303 msg.len = 1; 1300 msg.len = 1;
1304 msg.buf = &value; 1301 msg.buf = &value;
1305 if (i2c_transfer(&chan->adapter, &msg, 1) != 1) 1302 if (i2c_transfer(&chan->adapter, &msg, 1) != 1)
1306 return false; 1303 return 0;
1307 1304
1308 BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X, Value: 0x%02X, " 1305 BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X, Value: 0x%02X, "
1309 "Mask: 0x%02X, Data: 0x%02X\n", 1306 "Mask: 0x%02X, Data: 0x%02X\n",
@@ -1317,14 +1314,14 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1317 msg.len = 1; 1314 msg.len = 1;
1318 msg.buf = &value; 1315 msg.buf = &value;
1319 if (i2c_transfer(&chan->adapter, &msg, 1) != 1) 1316 if (i2c_transfer(&chan->adapter, &msg, 1) != 1)
1320 return false; 1317 return 0;
1321 } 1318 }
1322 } 1319 }
1323 1320
1324 return true; 1321 return len;
1325} 1322}
1326 1323
1327static bool 1324static int
1328init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1325init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1329{ 1326{
1330 /* 1327 /*
@@ -1346,12 +1343,13 @@ init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1346 uint8_t i2c_index = bios->data[offset + 1]; 1343 uint8_t i2c_index = bios->data[offset + 1];
1347 uint8_t i2c_address = bios->data[offset + 2]; 1344 uint8_t i2c_address = bios->data[offset + 2];
1348 uint8_t count = bios->data[offset + 3]; 1345 uint8_t count = bios->data[offset + 3];
1346 int len = 4 + count * 2;
1349 struct nouveau_i2c_chan *chan; 1347 struct nouveau_i2c_chan *chan;
1350 struct i2c_msg msg; 1348 struct i2c_msg msg;
1351 int i; 1349 int i;
1352 1350
1353 if (!iexec->execute) 1351 if (!iexec->execute)
1354 return true; 1352 return len;
1355 1353
1356 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " 1354 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1357 "Count: 0x%02X\n", 1355 "Count: 0x%02X\n",
@@ -1359,7 +1357,7 @@ init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1359 1357
1360 chan = init_i2c_device_find(bios->dev, i2c_index); 1358 chan = init_i2c_device_find(bios->dev, i2c_index);
1361 if (!chan) 1359 if (!chan)
1362 return false; 1360 return 0;
1363 1361
1364 for (i = 0; i < count; i++) { 1362 for (i = 0; i < count; i++) {
1365 uint8_t i2c_reg = bios->data[offset + 4 + i * 2]; 1363 uint8_t i2c_reg = bios->data[offset + 4 + i * 2];
@@ -1374,14 +1372,14 @@ init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1374 msg.len = 1; 1372 msg.len = 1;
1375 msg.buf = &data; 1373 msg.buf = &data;
1376 if (i2c_transfer(&chan->adapter, &msg, 1) != 1) 1374 if (i2c_transfer(&chan->adapter, &msg, 1) != 1)
1377 return false; 1375 return 0;
1378 } 1376 }
1379 } 1377 }
1380 1378
1381 return true; 1379 return len;
1382} 1380}
1383 1381
1384static bool 1382static int
1385init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1383init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1386{ 1384{
1387 /* 1385 /*
@@ -1401,13 +1399,14 @@ init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1401 uint8_t i2c_index = bios->data[offset + 1]; 1399 uint8_t i2c_index = bios->data[offset + 1];
1402 uint8_t i2c_address = bios->data[offset + 2]; 1400 uint8_t i2c_address = bios->data[offset + 2];
1403 uint8_t count = bios->data[offset + 3]; 1401 uint8_t count = bios->data[offset + 3];
1402 int len = 4 + count;
1404 struct nouveau_i2c_chan *chan; 1403 struct nouveau_i2c_chan *chan;
1405 struct i2c_msg msg; 1404 struct i2c_msg msg;
1406 uint8_t data[256]; 1405 uint8_t data[256];
1407 int i; 1406 int i;
1408 1407
1409 if (!iexec->execute) 1408 if (!iexec->execute)
1410 return true; 1409 return len;
1411 1410
1412 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " 1411 BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, "
1413 "Count: 0x%02X\n", 1412 "Count: 0x%02X\n",
@@ -1415,7 +1414,7 @@ init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1415 1414
1416 chan = init_i2c_device_find(bios->dev, i2c_index); 1415 chan = init_i2c_device_find(bios->dev, i2c_index);
1417 if (!chan) 1416 if (!chan)
1418 return false; 1417 return 0;
1419 1418
1420 for (i = 0; i < count; i++) { 1419 for (i = 0; i < count; i++) {
1421 data[i] = bios->data[offset + 4 + i]; 1420 data[i] = bios->data[offset + 4 + i];
@@ -1429,13 +1428,13 @@ init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1429 msg.len = count; 1428 msg.len = count;
1430 msg.buf = data; 1429 msg.buf = data;
1431 if (i2c_transfer(&chan->adapter, &msg, 1) != 1) 1430 if (i2c_transfer(&chan->adapter, &msg, 1) != 1)
1432 return false; 1431 return 0;
1433 } 1432 }
1434 1433
1435 return true; 1434 return len;
1436} 1435}
1437 1436
1438static bool 1437static int
1439init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1438init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1440{ 1439{
1441 /* 1440 /*
@@ -1460,7 +1459,7 @@ init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1460 uint32_t reg, value; 1459 uint32_t reg, value;
1461 1460
1462 if (!iexec->execute) 1461 if (!iexec->execute)
1463 return true; 1462 return 5;
1464 1463
1465 BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, TMDSAddr: 0x%02X, " 1464 BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, TMDSAddr: 0x%02X, "
1466 "Mask: 0x%02X, Data: 0x%02X\n", 1465 "Mask: 0x%02X, Data: 0x%02X\n",
@@ -1468,7 +1467,7 @@ init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1468 1467
1469 reg = get_tmds_index_reg(bios->dev, mlv); 1468 reg = get_tmds_index_reg(bios->dev, mlv);
1470 if (!reg) 1469 if (!reg)
1471 return false; 1470 return 0;
1472 1471
1473 bios_wr32(bios, reg, 1472 bios_wr32(bios, reg,
1474 tmdsaddr | NV_PRAMDAC_FP_TMDS_CONTROL_WRITE_DISABLE); 1473 tmdsaddr | NV_PRAMDAC_FP_TMDS_CONTROL_WRITE_DISABLE);
@@ -1476,10 +1475,10 @@ init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1476 bios_wr32(bios, reg + 4, value); 1475 bios_wr32(bios, reg + 4, value);
1477 bios_wr32(bios, reg, tmdsaddr); 1476 bios_wr32(bios, reg, tmdsaddr);
1478 1477
1479 return true; 1478 return 5;
1480} 1479}
1481 1480
1482static bool 1481static int
1483init_zm_tmds_group(struct nvbios *bios, uint16_t offset, 1482init_zm_tmds_group(struct nvbios *bios, uint16_t offset,
1484 struct init_exec *iexec) 1483 struct init_exec *iexec)
1485{ 1484{
@@ -1500,18 +1499,19 @@ init_zm_tmds_group(struct nvbios *bios, uint16_t offset,
1500 1499
1501 uint8_t mlv = bios->data[offset + 1]; 1500 uint8_t mlv = bios->data[offset + 1];
1502 uint8_t count = bios->data[offset + 2]; 1501 uint8_t count = bios->data[offset + 2];
1502 int len = 3 + count * 2;
1503 uint32_t reg; 1503 uint32_t reg;
1504 int i; 1504 int i;
1505 1505
1506 if (!iexec->execute) 1506 if (!iexec->execute)
1507 return true; 1507 return len;
1508 1508
1509 BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, Count: 0x%02X\n", 1509 BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, Count: 0x%02X\n",
1510 offset, mlv, count); 1510 offset, mlv, count);
1511 1511
1512 reg = get_tmds_index_reg(bios->dev, mlv); 1512 reg = get_tmds_index_reg(bios->dev, mlv);
1513 if (!reg) 1513 if (!reg)
1514 return false; 1514 return 0;
1515 1515
1516 for (i = 0; i < count; i++) { 1516 for (i = 0; i < count; i++) {
1517 uint8_t tmdsaddr = bios->data[offset + 3 + i * 2]; 1517 uint8_t tmdsaddr = bios->data[offset + 3 + i * 2];
@@ -1521,10 +1521,10 @@ init_zm_tmds_group(struct nvbios *bios, uint16_t offset,
1521 bios_wr32(bios, reg, tmdsaddr); 1521 bios_wr32(bios, reg, tmdsaddr);
1522 } 1522 }
1523 1523
1524 return true; 1524 return len;
1525} 1525}
1526 1526
1527static bool 1527static int
1528init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset, 1528init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset,
1529 struct init_exec *iexec) 1529 struct init_exec *iexec)
1530{ 1530{
@@ -1547,11 +1547,12 @@ init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset,
1547 uint8_t crtcindex2 = bios->data[offset + 2]; 1547 uint8_t crtcindex2 = bios->data[offset + 2];
1548 uint8_t baseaddr = bios->data[offset + 3]; 1548 uint8_t baseaddr = bios->data[offset + 3];
1549 uint8_t count = bios->data[offset + 4]; 1549 uint8_t count = bios->data[offset + 4];
1550 int len = 5 + count;
1550 uint8_t oldaddr, data; 1551 uint8_t oldaddr, data;
1551 int i; 1552 int i;
1552 1553
1553 if (!iexec->execute) 1554 if (!iexec->execute)
1554 return true; 1555 return len;
1555 1556
1556 BIOSLOG(bios, "0x%04X: Index1: 0x%02X, Index2: 0x%02X, " 1557 BIOSLOG(bios, "0x%04X: Index1: 0x%02X, Index2: 0x%02X, "
1557 "BaseAddr: 0x%02X, Count: 0x%02X\n", 1558 "BaseAddr: 0x%02X, Count: 0x%02X\n",
@@ -1568,10 +1569,10 @@ init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset,
1568 1569
1569 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex1, oldaddr); 1570 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex1, oldaddr);
1570 1571
1571 return true; 1572 return len;
1572} 1573}
1573 1574
1574static bool 1575static int
1575init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1576init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1576{ 1577{
1577 /* 1578 /*
@@ -1592,7 +1593,7 @@ init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1592 uint8_t value; 1593 uint8_t value;
1593 1594
1594 if (!iexec->execute) 1595 if (!iexec->execute)
1595 return true; 1596 return 4;
1596 1597
1597 BIOSLOG(bios, "0x%04X: Index: 0x%02X, Mask: 0x%02X, Data: 0x%02X\n", 1598 BIOSLOG(bios, "0x%04X: Index: 0x%02X, Mask: 0x%02X, Data: 0x%02X\n",
1598 offset, crtcindex, mask, data); 1599 offset, crtcindex, mask, data);
@@ -1601,10 +1602,10 @@ init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1601 value |= data; 1602 value |= data;
1602 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, value); 1603 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, value);
1603 1604
1604 return true; 1605 return 4;
1605} 1606}
1606 1607
1607static bool 1608static int
1608init_zm_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1609init_zm_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1609{ 1610{
1610 /* 1611 /*
@@ -1621,14 +1622,14 @@ init_zm_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1621 uint8_t data = bios->data[offset + 2]; 1622 uint8_t data = bios->data[offset + 2];
1622 1623
1623 if (!iexec->execute) 1624 if (!iexec->execute)
1624 return true; 1625 return 3;
1625 1626
1626 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, data); 1627 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, data);
1627 1628
1628 return true; 1629 return 3;
1629} 1630}
1630 1631
1631static bool 1632static int
1632init_zm_cr_group(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1633init_zm_cr_group(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1633{ 1634{
1634 /* 1635 /*
@@ -1645,18 +1646,19 @@ init_zm_cr_group(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1645 */ 1646 */
1646 1647
1647 uint8_t count = bios->data[offset + 1]; 1648 uint8_t count = bios->data[offset + 1];
1649 int len = 2 + count * 2;
1648 int i; 1650 int i;
1649 1651
1650 if (!iexec->execute) 1652 if (!iexec->execute)
1651 return true; 1653 return len;
1652 1654
1653 for (i = 0; i < count; i++) 1655 for (i = 0; i < count; i++)
1654 init_zm_cr(bios, offset + 2 + 2 * i - 1, iexec); 1656 init_zm_cr(bios, offset + 2 + 2 * i - 1, iexec);
1655 1657
1656 return true; 1658 return len;
1657} 1659}
1658 1660
1659static bool 1661static int
1660init_condition_time(struct nvbios *bios, uint16_t offset, 1662init_condition_time(struct nvbios *bios, uint16_t offset,
1661 struct init_exec *iexec) 1663 struct init_exec *iexec)
1662{ 1664{
@@ -1680,7 +1682,7 @@ init_condition_time(struct nvbios *bios, uint16_t offset,
1680 unsigned cnt; 1682 unsigned cnt;
1681 1683
1682 if (!iexec->execute) 1684 if (!iexec->execute)
1683 return true; 1685 return 3;
1684 1686
1685 if (retries > 100) 1687 if (retries > 100)
1686 retries = 100; 1688 retries = 100;
@@ -1711,10 +1713,10 @@ init_condition_time(struct nvbios *bios, uint16_t offset,
1711 iexec->execute = false; 1713 iexec->execute = false;
1712 } 1714 }
1713 1715
1714 return true; 1716 return 3;
1715} 1717}
1716 1718
1717static bool 1719static int
1718init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, 1720init_zm_reg_sequence(struct nvbios *bios, uint16_t offset,
1719 struct init_exec *iexec) 1721 struct init_exec *iexec)
1720{ 1722{
@@ -1734,10 +1736,11 @@ init_zm_reg_sequence(struct nvbios *bios, uint16_t offset,
1734 1736
1735 uint32_t basereg = ROM32(bios->data[offset + 1]); 1737 uint32_t basereg = ROM32(bios->data[offset + 1]);
1736 uint32_t count = bios->data[offset + 5]; 1738 uint32_t count = bios->data[offset + 5];
1739 int len = 6 + count * 4;
1737 int i; 1740 int i;
1738 1741
1739 if (!iexec->execute) 1742 if (!iexec->execute)
1740 return true; 1743 return len;
1741 1744
1742 BIOSLOG(bios, "0x%04X: BaseReg: 0x%08X, Count: 0x%02X\n", 1745 BIOSLOG(bios, "0x%04X: BaseReg: 0x%08X, Count: 0x%02X\n",
1743 offset, basereg, count); 1746 offset, basereg, count);
@@ -1749,10 +1752,10 @@ init_zm_reg_sequence(struct nvbios *bios, uint16_t offset,
1749 bios_wr32(bios, reg, data); 1752 bios_wr32(bios, reg, data);
1750 } 1753 }
1751 1754
1752 return true; 1755 return len;
1753} 1756}
1754 1757
1755static bool 1758static int
1756init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1759init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1757{ 1760{
1758 /* 1761 /*
@@ -1768,7 +1771,7 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1768 uint16_t sub_offset = ROM16(bios->data[offset + 1]); 1771 uint16_t sub_offset = ROM16(bios->data[offset + 1]);
1769 1772
1770 if (!iexec->execute) 1773 if (!iexec->execute)
1771 return true; 1774 return 3;
1772 1775
1773 BIOSLOG(bios, "0x%04X: Executing subroutine at 0x%04X\n", 1776 BIOSLOG(bios, "0x%04X: Executing subroutine at 0x%04X\n",
1774 offset, sub_offset); 1777 offset, sub_offset);
@@ -1777,10 +1780,10 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1777 1780
1778 BIOSLOG(bios, "0x%04X: End of 0x%04X subroutine\n", offset, sub_offset); 1781 BIOSLOG(bios, "0x%04X: End of 0x%04X subroutine\n", offset, sub_offset);
1779 1782
1780 return true; 1783 return 3;
1781} 1784}
1782 1785
1783static bool 1786static int
1784init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1787init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1785{ 1788{
1786 /* 1789 /*
@@ -1808,7 +1811,7 @@ init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1808 uint32_t srcvalue, dstvalue; 1811 uint32_t srcvalue, dstvalue;
1809 1812
1810 if (!iexec->execute) 1813 if (!iexec->execute)
1811 return true; 1814 return 22;
1812 1815
1813 BIOSLOG(bios, "0x%04X: SrcReg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%08X, " 1816 BIOSLOG(bios, "0x%04X: SrcReg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%08X, "
1814 "Xor: 0x%08X, DstReg: 0x%08X, DstMask: 0x%08X\n", 1817 "Xor: 0x%08X, DstReg: 0x%08X, DstMask: 0x%08X\n",
@@ -1827,10 +1830,10 @@ init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1827 1830
1828 bios_wr32(bios, dstreg, dstvalue | srcvalue); 1831 bios_wr32(bios, dstreg, dstvalue | srcvalue);
1829 1832
1830 return true; 1833 return 22;
1831} 1834}
1832 1835
1833static bool 1836static int
1834init_zm_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1837init_zm_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1835{ 1838{
1836 /* 1839 /*
@@ -1848,14 +1851,14 @@ init_zm_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1848 uint8_t data = bios->data[offset + 4]; 1851 uint8_t data = bios->data[offset + 4];
1849 1852
1850 if (!iexec->execute) 1853 if (!iexec->execute)
1851 return true; 1854 return 5;
1852 1855
1853 bios_idxprt_wr(bios, crtcport, crtcindex, data); 1856 bios_idxprt_wr(bios, crtcport, crtcindex, data);
1854 1857
1855 return true; 1858 return 5;
1856} 1859}
1857 1860
1858static bool 1861static int
1859init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1862init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1860{ 1863{
1861 /* 1864 /*
@@ -1904,7 +1907,7 @@ init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1904 struct drm_nouveau_private *dev_priv = bios->dev->dev_private; 1907 struct drm_nouveau_private *dev_priv = bios->dev->dev_private;
1905 1908
1906 if (dev_priv->card_type >= NV_50) 1909 if (dev_priv->card_type >= NV_50)
1907 return true; 1910 return 1;
1908 1911
1909 /* 1912 /*
1910 * On every card I've seen, this step gets done for us earlier in 1913 * On every card I've seen, this step gets done for us earlier in
@@ -1922,10 +1925,10 @@ init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1922 /* write back the saved configuration value */ 1925 /* write back the saved configuration value */
1923 bios_wr32(bios, NV_PFB_CFG0, bios->state.saved_nv_pfb_cfg0); 1926 bios_wr32(bios, NV_PFB_CFG0, bios->state.saved_nv_pfb_cfg0);
1924 1927
1925 return true; 1928 return 1;
1926} 1929}
1927 1930
1928static bool 1931static int
1929init_reset(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 1932init_reset(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1930{ 1933{
1931 /* 1934 /*
@@ -1959,10 +1962,10 @@ init_reset(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
1959 pci_nv_20 &= ~NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED; /* 0xfffffffe */ 1962 pci_nv_20 &= ~NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED; /* 0xfffffffe */
1960 bios_wr32(bios, NV_PBUS_PCI_NV_20, pci_nv_20); 1963 bios_wr32(bios, NV_PBUS_PCI_NV_20, pci_nv_20);
1961 1964
1962 return true; 1965 return 13;
1963} 1966}
1964 1967
1965static bool 1968static int
1966init_configure_mem(struct nvbios *bios, uint16_t offset, 1969init_configure_mem(struct nvbios *bios, uint16_t offset,
1967 struct init_exec *iexec) 1970 struct init_exec *iexec)
1968{ 1971{
@@ -1983,7 +1986,7 @@ init_configure_mem(struct nvbios *bios, uint16_t offset,
1983 uint32_t reg, data; 1986 uint32_t reg, data;
1984 1987
1985 if (bios->major_version > 2) 1988 if (bios->major_version > 2)
1986 return false; 1989 return 0;
1987 1990
1988 bios_idxprt_wr(bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX, bios_idxprt_rd( 1991 bios_idxprt_wr(bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX, bios_idxprt_rd(
1989 bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX) | 0x20); 1992 bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX) | 0x20);
@@ -2015,10 +2018,10 @@ init_configure_mem(struct nvbios *bios, uint16_t offset,
2015 bios_wr32(bios, reg, data); 2018 bios_wr32(bios, reg, data);
2016 } 2019 }
2017 2020
2018 return true; 2021 return 1;
2019} 2022}
2020 2023
2021static bool 2024static int
2022init_configure_clk(struct nvbios *bios, uint16_t offset, 2025init_configure_clk(struct nvbios *bios, uint16_t offset,
2023 struct init_exec *iexec) 2026 struct init_exec *iexec)
2024{ 2027{
@@ -2038,7 +2041,7 @@ init_configure_clk(struct nvbios *bios, uint16_t offset,
2038 int clock; 2041 int clock;
2039 2042
2040 if (bios->major_version > 2) 2043 if (bios->major_version > 2)
2041 return false; 2044 return 0;
2042 2045
2043 clock = ROM16(bios->data[meminitoffs + 4]) * 10; 2046 clock = ROM16(bios->data[meminitoffs + 4]) * 10;
2044 setPLL(bios, NV_PRAMDAC_NVPLL_COEFF, clock); 2047 setPLL(bios, NV_PRAMDAC_NVPLL_COEFF, clock);
@@ -2048,10 +2051,10 @@ init_configure_clk(struct nvbios *bios, uint16_t offset,
2048 clock *= 2; 2051 clock *= 2;
2049 setPLL(bios, NV_PRAMDAC_MPLL_COEFF, clock); 2052 setPLL(bios, NV_PRAMDAC_MPLL_COEFF, clock);
2050 2053
2051 return true; 2054 return 1;
2052} 2055}
2053 2056
2054static bool 2057static int
2055init_configure_preinit(struct nvbios *bios, uint16_t offset, 2058init_configure_preinit(struct nvbios *bios, uint16_t offset,
2056 struct init_exec *iexec) 2059 struct init_exec *iexec)
2057{ 2060{
@@ -2071,15 +2074,15 @@ init_configure_preinit(struct nvbios *bios, uint16_t offset,
2071 uint8_t cr3c = ((straps << 2) & 0xf0) | (straps & (1 << 6)); 2074 uint8_t cr3c = ((straps << 2) & 0xf0) | (straps & (1 << 6));
2072 2075
2073 if (bios->major_version > 2) 2076 if (bios->major_version > 2)
2074 return false; 2077 return 0;
2075 2078
2076 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, 2079 bios_idxprt_wr(bios, NV_CIO_CRX__COLOR,
2077 NV_CIO_CRE_SCRATCH4__INDEX, cr3c); 2080 NV_CIO_CRE_SCRATCH4__INDEX, cr3c);
2078 2081
2079 return true; 2082 return 1;
2080} 2083}
2081 2084
2082static bool 2085static int
2083init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2086init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2084{ 2087{
2085 /* 2088 /*
@@ -2099,7 +2102,7 @@ init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2099 uint8_t data = bios->data[offset + 4]; 2102 uint8_t data = bios->data[offset + 4];
2100 2103
2101 if (!iexec->execute) 2104 if (!iexec->execute)
2102 return true; 2105 return 5;
2103 2106
2104 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Mask: 0x%02X, Data: 0x%02X\n", 2107 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Mask: 0x%02X, Data: 0x%02X\n",
2105 offset, crtcport, mask, data); 2108 offset, crtcport, mask, data);
@@ -2158,15 +2161,15 @@ init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2158 for (i = 0; i < 2; i++) 2161 for (i = 0; i < 2; i++)
2159 bios_wr32(bios, 0x614108 + (i*0x800), bios_rd32( 2162 bios_wr32(bios, 0x614108 + (i*0x800), bios_rd32(
2160 bios, 0x614108 + (i*0x800)) & 0x0fffffff); 2163 bios, 0x614108 + (i*0x800)) & 0x0fffffff);
2161 return true; 2164 return 5;
2162 } 2165 }
2163 2166
2164 bios_port_wr(bios, crtcport, (bios_port_rd(bios, crtcport) & mask) | 2167 bios_port_wr(bios, crtcport, (bios_port_rd(bios, crtcport) & mask) |
2165 data); 2168 data);
2166 return true; 2169 return 5;
2167} 2170}
2168 2171
2169static bool 2172static int
2170init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2173init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2171{ 2174{
2172 /* 2175 /*
@@ -2181,7 +2184,7 @@ init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2181 uint8_t sub = bios->data[offset + 1]; 2184 uint8_t sub = bios->data[offset + 1];
2182 2185
2183 if (!iexec->execute) 2186 if (!iexec->execute)
2184 return true; 2187 return 2;
2185 2188
2186 BIOSLOG(bios, "0x%04X: Calling script %d\n", offset, sub); 2189 BIOSLOG(bios, "0x%04X: Calling script %d\n", offset, sub);
2187 2190
@@ -2191,10 +2194,10 @@ init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2191 2194
2192 BIOSLOG(bios, "0x%04X: End of script %d\n", offset, sub); 2195 BIOSLOG(bios, "0x%04X: End of script %d\n", offset, sub);
2193 2196
2194 return true; 2197 return 2;
2195} 2198}
2196 2199
2197static bool 2200static int
2198init_ram_condition(struct nvbios *bios, uint16_t offset, 2201init_ram_condition(struct nvbios *bios, uint16_t offset,
2199 struct init_exec *iexec) 2202 struct init_exec *iexec)
2200{ 2203{
@@ -2215,7 +2218,7 @@ init_ram_condition(struct nvbios *bios, uint16_t offset,
2215 uint8_t data; 2218 uint8_t data;
2216 2219
2217 if (!iexec->execute) 2220 if (!iexec->execute)
2218 return true; 2221 return 3;
2219 2222
2220 data = bios_rd32(bios, NV_PFB_BOOT_0) & mask; 2223 data = bios_rd32(bios, NV_PFB_BOOT_0) & mask;
2221 2224
@@ -2229,10 +2232,10 @@ init_ram_condition(struct nvbios *bios, uint16_t offset,
2229 iexec->execute = false; 2232 iexec->execute = false;
2230 } 2233 }
2231 2234
2232 return true; 2235 return 3;
2233} 2236}
2234 2237
2235static bool 2238static int
2236init_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2239init_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2237{ 2240{
2238 /* 2241 /*
@@ -2251,17 +2254,17 @@ init_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2251 uint32_t data = ROM32(bios->data[offset + 9]); 2254 uint32_t data = ROM32(bios->data[offset + 9]);
2252 2255
2253 if (!iexec->execute) 2256 if (!iexec->execute)
2254 return true; 2257 return 13;
2255 2258
2256 BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Mask: 0x%08X, Data: 0x%08X\n", 2259 BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Mask: 0x%08X, Data: 0x%08X\n",
2257 offset, reg, mask, data); 2260 offset, reg, mask, data);
2258 2261
2259 bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | data); 2262 bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | data);
2260 2263
2261 return true; 2264 return 13;
2262} 2265}
2263 2266
2264static bool 2267static int
2265init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2268init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2266{ 2269{
2267 /* 2270 /*
@@ -2285,7 +2288,7 @@ init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2285 int i; 2288 int i;
2286 2289
2287 if (!iexec->execute) 2290 if (!iexec->execute)
2288 return true; 2291 return 2;
2289 2292
2290 BIOSLOG(bios, "0x%04X: Macro: 0x%02X, MacroTableIndex: 0x%02X, " 2293 BIOSLOG(bios, "0x%04X: Macro: 0x%02X, MacroTableIndex: 0x%02X, "
2291 "Count: 0x%02X\n", 2294 "Count: 0x%02X\n",
@@ -2300,10 +2303,10 @@ init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2300 bios_wr32(bios, reg, data); 2303 bios_wr32(bios, reg, data);
2301 } 2304 }
2302 2305
2303 return true; 2306 return 2;
2304} 2307}
2305 2308
2306static bool 2309static int
2307init_done(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2310init_done(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2308{ 2311{
2309 /* 2312 /*
@@ -2315,10 +2318,10 @@ init_done(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2315 */ 2318 */
2316 2319
2317 /* mild retval abuse to stop parsing this table */ 2320 /* mild retval abuse to stop parsing this table */
2318 return false; 2321 return 0;
2319} 2322}
2320 2323
2321static bool 2324static int
2322init_resume(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2325init_resume(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2323{ 2326{
2324 /* 2327 /*
@@ -2330,15 +2333,15 @@ init_resume(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2330 */ 2333 */
2331 2334
2332 if (iexec->execute) 2335 if (iexec->execute)
2333 return true; 2336 return 1;
2334 2337
2335 iexec->execute = true; 2338 iexec->execute = true;
2336 BIOSLOG(bios, "0x%04X: ---- Executing following commands ----\n", offset); 2339 BIOSLOG(bios, "0x%04X: ---- Executing following commands ----\n", offset);
2337 2340
2338 return true; 2341 return 1;
2339} 2342}
2340 2343
2341static bool 2344static int
2342init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2345init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2343{ 2346{
2344 /* 2347 /*
@@ -2353,7 +2356,7 @@ init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2353 unsigned time = ROM16(bios->data[offset + 1]); 2356 unsigned time = ROM16(bios->data[offset + 1]);
2354 2357
2355 if (!iexec->execute) 2358 if (!iexec->execute)
2356 return true; 2359 return 3;
2357 2360
2358 BIOSLOG(bios, "0x%04X: Sleeping for 0x%04X microseconds\n", 2361 BIOSLOG(bios, "0x%04X: Sleeping for 0x%04X microseconds\n",
2359 offset, time); 2362 offset, time);
@@ -2363,10 +2366,10 @@ init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2363 else 2366 else
2364 msleep((time + 900) / 1000); 2367 msleep((time + 900) / 1000);
2365 2368
2366 return true; 2369 return 3;
2367} 2370}
2368 2371
2369static bool 2372static int
2370init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2373init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2371{ 2374{
2372 /* 2375 /*
@@ -2383,7 +2386,7 @@ init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2383 uint8_t cond = bios->data[offset + 1]; 2386 uint8_t cond = bios->data[offset + 1];
2384 2387
2385 if (!iexec->execute) 2388 if (!iexec->execute)
2386 return true; 2389 return 2;
2387 2390
2388 BIOSLOG(bios, "0x%04X: Condition: 0x%02X\n", offset, cond); 2391 BIOSLOG(bios, "0x%04X: Condition: 0x%02X\n", offset, cond);
2389 2392
@@ -2394,10 +2397,10 @@ init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2394 iexec->execute = false; 2397 iexec->execute = false;
2395 } 2398 }
2396 2399
2397 return true; 2400 return 2;
2398} 2401}
2399 2402
2400static bool 2403static int
2401init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2404init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2402{ 2405{
2403 /* 2406 /*
@@ -2414,7 +2417,7 @@ init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2414 uint8_t cond = bios->data[offset + 1]; 2417 uint8_t cond = bios->data[offset + 1];
2415 2418
2416 if (!iexec->execute) 2419 if (!iexec->execute)
2417 return true; 2420 return 2;
2418 2421
2419 BIOSLOG(bios, "0x%04X: IO condition: 0x%02X\n", offset, cond); 2422 BIOSLOG(bios, "0x%04X: IO condition: 0x%02X\n", offset, cond);
2420 2423
@@ -2425,10 +2428,10 @@ init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2425 iexec->execute = false; 2428 iexec->execute = false;
2426 } 2429 }
2427 2430
2428 return true; 2431 return 2;
2429} 2432}
2430 2433
2431static bool 2434static int
2432init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2435init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2433{ 2436{
2434 /* 2437 /*
@@ -2451,7 +2454,7 @@ init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2451 uint8_t value; 2454 uint8_t value;
2452 2455
2453 if (!iexec->execute) 2456 if (!iexec->execute)
2454 return true; 2457 return 6;
2455 2458
2456 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " 2459 BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, "
2457 "Data: 0x%02X\n", 2460 "Data: 0x%02X\n",
@@ -2460,10 +2463,10 @@ init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2460 value = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) | data; 2463 value = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) | data;
2461 bios_idxprt_wr(bios, crtcport, crtcindex, value); 2464 bios_idxprt_wr(bios, crtcport, crtcindex, value);
2462 2465
2463 return true; 2466 return 6;
2464} 2467}
2465 2468
2466static bool 2469static int
2467init_pll(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2470init_pll(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2468{ 2471{
2469 /* 2472 /*
@@ -2481,16 +2484,16 @@ init_pll(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2481 uint16_t freq = ROM16(bios->data[offset + 5]); 2484 uint16_t freq = ROM16(bios->data[offset + 5]);
2482 2485
2483 if (!iexec->execute) 2486 if (!iexec->execute)
2484 return true; 2487 return 7;
2485 2488
2486 BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Freq: %d0kHz\n", offset, reg, freq); 2489 BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Freq: %d0kHz\n", offset, reg, freq);
2487 2490
2488 setPLL(bios, reg, freq * 10); 2491 setPLL(bios, reg, freq * 10);
2489 2492
2490 return true; 2493 return 7;
2491} 2494}
2492 2495
2493static bool 2496static int
2494init_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2497init_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2495{ 2498{
2496 /* 2499 /*
@@ -2507,17 +2510,17 @@ init_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2507 uint32_t value = ROM32(bios->data[offset + 5]); 2510 uint32_t value = ROM32(bios->data[offset + 5]);
2508 2511
2509 if (!iexec->execute) 2512 if (!iexec->execute)
2510 return true; 2513 return 9;
2511 2514
2512 if (reg == 0x000200) 2515 if (reg == 0x000200)
2513 value |= 1; 2516 value |= 1;
2514 2517
2515 bios_wr32(bios, reg, value); 2518 bios_wr32(bios, reg, value);
2516 2519
2517 return true; 2520 return 9;
2518} 2521}
2519 2522
2520static bool 2523static int
2521init_ram_restrict_pll(struct nvbios *bios, uint16_t offset, 2524init_ram_restrict_pll(struct nvbios *bios, uint16_t offset,
2522 struct init_exec *iexec) 2525 struct init_exec *iexec)
2523{ 2526{
@@ -2543,14 +2546,15 @@ init_ram_restrict_pll(struct nvbios *bios, uint16_t offset,
2543 uint8_t type = bios->data[offset + 1]; 2546 uint8_t type = bios->data[offset + 1];
2544 uint32_t freq = ROM32(bios->data[offset + 2 + (index * 4)]); 2547 uint32_t freq = ROM32(bios->data[offset + 2 + (index * 4)]);
2545 uint8_t *pll_limits = &bios->data[bios->pll_limit_tbl_ptr], *entry; 2548 uint8_t *pll_limits = &bios->data[bios->pll_limit_tbl_ptr], *entry;
2549 int len = 2 + bios->ram_restrict_group_count * 4;
2546 int i; 2550 int i;
2547 2551
2548 if (!iexec->execute) 2552 if (!iexec->execute)
2549 return true; 2553 return len;
2550 2554
2551 if (!bios->pll_limit_tbl_ptr || (pll_limits[0] & 0xf0) != 0x30) { 2555 if (!bios->pll_limit_tbl_ptr || (pll_limits[0] & 0xf0) != 0x30) {
2552 NV_ERROR(dev, "PLL limits table not version 3.x\n"); 2556 NV_ERROR(dev, "PLL limits table not version 3.x\n");
2553 return true; /* deliberate, allow default clocks to remain */ 2557 return len; /* deliberate, allow default clocks to remain */
2554 } 2558 }
2555 2559
2556 entry = pll_limits + pll_limits[1]; 2560 entry = pll_limits + pll_limits[1];
@@ -2563,15 +2567,15 @@ init_ram_restrict_pll(struct nvbios *bios, uint16_t offset,
2563 offset, type, reg, freq); 2567 offset, type, reg, freq);
2564 2568
2565 setPLL(bios, reg, freq); 2569 setPLL(bios, reg, freq);
2566 return true; 2570 return len;
2567 } 2571 }
2568 } 2572 }
2569 2573
2570 NV_ERROR(dev, "PLL type 0x%02x not found in PLL limits table", type); 2574 NV_ERROR(dev, "PLL type 0x%02x not found in PLL limits table", type);
2571 return true; 2575 return len;
2572} 2576}
2573 2577
2574static bool 2578static int
2575init_8c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2579init_8c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2576{ 2580{
2577 /* 2581 /*
@@ -2581,10 +2585,10 @@ init_8c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2581 * 2585 *
2582 */ 2586 */
2583 2587
2584 return true; 2588 return 1;
2585} 2589}
2586 2590
2587static bool 2591static int
2588init_8d(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2592init_8d(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2589{ 2593{
2590 /* 2594 /*
@@ -2594,10 +2598,10 @@ init_8d(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2594 * 2598 *
2595 */ 2599 */
2596 2600
2597 return true; 2601 return 1;
2598} 2602}
2599 2603
2600static bool 2604static int
2601init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2605init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2602{ 2606{
2603 /* 2607 /*
@@ -2615,14 +2619,17 @@ init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2615 const uint8_t *gpio_entry; 2619 const uint8_t *gpio_entry;
2616 int i; 2620 int i;
2617 2621
2622 if (!iexec->execute)
2623 return 1;
2624
2618 if (bios->bdcb.version != 0x40) { 2625 if (bios->bdcb.version != 0x40) {
2619 NV_ERROR(bios->dev, "DCB table not version 4.0\n"); 2626 NV_ERROR(bios->dev, "DCB table not version 4.0\n");
2620 return false; 2627 return 0;
2621 } 2628 }
2622 2629
2623 if (!bios->bdcb.gpio_table_ptr) { 2630 if (!bios->bdcb.gpio_table_ptr) {
2624 NV_WARN(bios->dev, "Invalid pointer to INIT_8E table\n"); 2631 NV_WARN(bios->dev, "Invalid pointer to INIT_8E table\n");
2625 return false; 2632 return 0;
2626 } 2633 }
2627 2634
2628 gpio_entry = gpio_table + gpio_table[1]; 2635 gpio_entry = gpio_table + gpio_table[1];
@@ -2660,13 +2667,10 @@ init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2660 bios_wr32(bios, r, v); 2667 bios_wr32(bios, r, v);
2661 } 2668 }
2662 2669
2663 return true; 2670 return 1;
2664} 2671}
2665 2672
2666/* hack to avoid moving the itbl_entry array before this function */ 2673static int
2667int init_ram_restrict_zm_reg_group_blocklen;
2668
2669static bool
2670init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset, 2674init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset,
2671 struct init_exec *iexec) 2675 struct init_exec *iexec)
2672{ 2676{
@@ -2692,21 +2696,21 @@ init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset,
2692 uint8_t regincrement = bios->data[offset + 5]; 2696 uint8_t regincrement = bios->data[offset + 5];
2693 uint8_t count = bios->data[offset + 6]; 2697 uint8_t count = bios->data[offset + 6];
2694 uint32_t strap_ramcfg, data; 2698 uint32_t strap_ramcfg, data;
2695 uint16_t blocklen; 2699 /* previously set by 'M' BIT table */
2700 uint16_t blocklen = bios->ram_restrict_group_count * 4;
2701 int len = 7 + count * blocklen;
2696 uint8_t index; 2702 uint8_t index;
2697 int i; 2703 int i;
2698 2704
2699 /* previously set by 'M' BIT table */
2700 blocklen = init_ram_restrict_zm_reg_group_blocklen;
2701 2705
2702 if (!iexec->execute) 2706 if (!iexec->execute)
2703 return true; 2707 return len;
2704 2708
2705 if (!blocklen) { 2709 if (!blocklen) {
2706 NV_ERROR(bios->dev, 2710 NV_ERROR(bios->dev,
2707 "0x%04X: Zero block length - has the M table " 2711 "0x%04X: Zero block length - has the M table "
2708 "been parsed?\n", offset); 2712 "been parsed?\n", offset);
2709 return false; 2713 return 0;
2710 } 2714 }
2711 2715
2712 strap_ramcfg = (bios_rd32(bios, NV_PEXTDEV_BOOT_0) >> 2) & 0xf; 2716 strap_ramcfg = (bios_rd32(bios, NV_PEXTDEV_BOOT_0) >> 2) & 0xf;
@@ -2724,10 +2728,10 @@ init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset,
2724 reg += regincrement; 2728 reg += regincrement;
2725 } 2729 }
2726 2730
2727 return true; 2731 return len;
2728} 2732}
2729 2733
2730static bool 2734static int
2731init_copy_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2735init_copy_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2732{ 2736{
2733 /* 2737 /*
@@ -2744,14 +2748,14 @@ init_copy_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2744 uint32_t dstreg = ROM32(bios->data[offset + 5]); 2748 uint32_t dstreg = ROM32(bios->data[offset + 5]);
2745 2749
2746 if (!iexec->execute) 2750 if (!iexec->execute)
2747 return true; 2751 return 9;
2748 2752
2749 bios_wr32(bios, dstreg, bios_rd32(bios, srcreg)); 2753 bios_wr32(bios, dstreg, bios_rd32(bios, srcreg));
2750 2754
2751 return true; 2755 return 9;
2752} 2756}
2753 2757
2754static bool 2758static int
2755init_zm_reg_group_addr_latched(struct nvbios *bios, uint16_t offset, 2759init_zm_reg_group_addr_latched(struct nvbios *bios, uint16_t offset,
2756 struct init_exec *iexec) 2760 struct init_exec *iexec)
2757{ 2761{
@@ -2769,20 +2773,21 @@ init_zm_reg_group_addr_latched(struct nvbios *bios, uint16_t offset,
2769 2773
2770 uint32_t reg = ROM32(bios->data[offset + 1]); 2774 uint32_t reg = ROM32(bios->data[offset + 1]);
2771 uint8_t count = bios->data[offset + 5]; 2775 uint8_t count = bios->data[offset + 5];
2776 int len = 6 + count * 4;
2772 int i; 2777 int i;
2773 2778
2774 if (!iexec->execute) 2779 if (!iexec->execute)
2775 return true; 2780 return len;
2776 2781
2777 for (i = 0; i < count; i++) { 2782 for (i = 0; i < count; i++) {
2778 uint32_t data = ROM32(bios->data[offset + 6 + 4 * i]); 2783 uint32_t data = ROM32(bios->data[offset + 6 + 4 * i]);
2779 bios_wr32(bios, reg, data); 2784 bios_wr32(bios, reg, data);
2780 } 2785 }
2781 2786
2782 return true; 2787 return len;
2783} 2788}
2784 2789
2785static bool 2790static int
2786init_reserved(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2791init_reserved(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2787{ 2792{
2788 /* 2793 /*
@@ -2793,10 +2798,10 @@ init_reserved(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2793 * Seemingly does nothing 2798 * Seemingly does nothing
2794 */ 2799 */
2795 2800
2796 return true; 2801 return 1;
2797} 2802}
2798 2803
2799static bool 2804static int
2800init_96(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2805init_96(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2801{ 2806{
2802 /* 2807 /*
@@ -2829,13 +2834,13 @@ init_96(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2829 val <<= bios->data[offset + 16]; 2834 val <<= bios->data[offset + 16];
2830 2835
2831 if (!iexec->execute) 2836 if (!iexec->execute)
2832 return true; 2837 return 17;
2833 2838
2834 bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | val); 2839 bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | val);
2835 return true; 2840 return 17;
2836} 2841}
2837 2842
2838static bool 2843static int
2839init_97(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2844init_97(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2840{ 2845{
2841 /* 2846 /*
@@ -2859,13 +2864,13 @@ init_97(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2859 val = (val & mask) | ((val + add) & ~mask); 2864 val = (val & mask) | ((val + add) & ~mask);
2860 2865
2861 if (!iexec->execute) 2866 if (!iexec->execute)
2862 return true; 2867 return 13;
2863 2868
2864 bios_wr32(bios, reg, val); 2869 bios_wr32(bios, reg, val);
2865 return true; 2870 return 13;
2866} 2871}
2867 2872
2868static bool 2873static int
2869init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2874init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2870{ 2875{
2871 /* 2876 /*
@@ -2883,32 +2888,33 @@ init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2883 struct drm_device *dev = bios->dev; 2888 struct drm_device *dev = bios->dev;
2884 struct nouveau_i2c_chan *auxch; 2889 struct nouveau_i2c_chan *auxch;
2885 uint32_t addr = ROM32(bios->data[offset + 1]); 2890 uint32_t addr = ROM32(bios->data[offset + 1]);
2886 uint8_t len = bios->data[offset + 5]; 2891 uint8_t count = bios->data[offset + 5];
2892 int len = 6 + count * 2;
2887 int ret, i; 2893 int ret, i;
2888 2894
2889 if (!bios->display.output) { 2895 if (!bios->display.output) {
2890 NV_ERROR(dev, "INIT_AUXCH: no active output\n"); 2896 NV_ERROR(dev, "INIT_AUXCH: no active output\n");
2891 return false; 2897 return 0;
2892 } 2898 }
2893 2899
2894 auxch = init_i2c_device_find(dev, bios->display.output->i2c_index); 2900 auxch = init_i2c_device_find(dev, bios->display.output->i2c_index);
2895 if (!auxch) { 2901 if (!auxch) {
2896 NV_ERROR(dev, "INIT_AUXCH: couldn't get auxch %d\n", 2902 NV_ERROR(dev, "INIT_AUXCH: couldn't get auxch %d\n",
2897 bios->display.output->i2c_index); 2903 bios->display.output->i2c_index);
2898 return false; 2904 return 0;
2899 } 2905 }
2900 2906
2901 if (!iexec->execute) 2907 if (!iexec->execute)
2902 return true; 2908 return len;
2903 2909
2904 offset += 6; 2910 offset += 6;
2905 for (i = 0; i < len; i++, offset += 2) { 2911 for (i = 0; i < count; i++, offset += 2) {
2906 uint8_t data; 2912 uint8_t data;
2907 2913
2908 ret = nouveau_dp_auxch(auxch, 9, addr, &data, 1); 2914 ret = nouveau_dp_auxch(auxch, 9, addr, &data, 1);
2909 if (ret) { 2915 if (ret) {
2910 NV_ERROR(dev, "INIT_AUXCH: rd auxch fail %d\n", ret); 2916 NV_ERROR(dev, "INIT_AUXCH: rd auxch fail %d\n", ret);
2911 return false; 2917 return 0;
2912 } 2918 }
2913 2919
2914 data &= bios->data[offset + 0]; 2920 data &= bios->data[offset + 0];
@@ -2917,14 +2923,14 @@ init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2917 ret = nouveau_dp_auxch(auxch, 8, addr, &data, 1); 2923 ret = nouveau_dp_auxch(auxch, 8, addr, &data, 1);
2918 if (ret) { 2924 if (ret) {
2919 NV_ERROR(dev, "INIT_AUXCH: wr auxch fail %d\n", ret); 2925 NV_ERROR(dev, "INIT_AUXCH: wr auxch fail %d\n", ret);
2920 return false; 2926 return 0;
2921 } 2927 }
2922 } 2928 }
2923 2929
2924 return true; 2930 return len;
2925} 2931}
2926 2932
2927static bool 2933static int
2928init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) 2934init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2929{ 2935{
2930 /* 2936 /*
@@ -2941,106 +2947,99 @@ init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec)
2941 struct drm_device *dev = bios->dev; 2947 struct drm_device *dev = bios->dev;
2942 struct nouveau_i2c_chan *auxch; 2948 struct nouveau_i2c_chan *auxch;
2943 uint32_t addr = ROM32(bios->data[offset + 1]); 2949 uint32_t addr = ROM32(bios->data[offset + 1]);
2944 uint8_t len = bios->data[offset + 5]; 2950 uint8_t count = bios->data[offset + 5];
2951 int len = 6 + count;
2945 int ret, i; 2952 int ret, i;
2946 2953
2947 if (!bios->display.output) { 2954 if (!bios->display.output) {
2948 NV_ERROR(dev, "INIT_ZM_AUXCH: no active output\n"); 2955 NV_ERROR(dev, "INIT_ZM_AUXCH: no active output\n");
2949 return false; 2956 return 0;
2950 } 2957 }
2951 2958
2952 auxch = init_i2c_device_find(dev, bios->display.output->i2c_index); 2959 auxch = init_i2c_device_find(dev, bios->display.output->i2c_index);
2953 if (!auxch) { 2960 if (!auxch) {
2954 NV_ERROR(dev, "INIT_ZM_AUXCH: couldn't get auxch %d\n", 2961 NV_ERROR(dev, "INIT_ZM_AUXCH: couldn't get auxch %d\n",
2955 bios->display.output->i2c_index); 2962 bios->display.output->i2c_index);
2956 return false; 2963 return 0;
2957 } 2964 }
2958 2965
2959 if (!iexec->execute) 2966 if (!iexec->execute)
2960 return true; 2967 return len;
2961 2968
2962 offset += 6; 2969 offset += 6;
2963 for (i = 0; i < len; i++, offset++) { 2970 for (i = 0; i < count; i++, offset++) {
2964 ret = nouveau_dp_auxch(auxch, 8, addr, &bios->data[offset], 1); 2971 ret = nouveau_dp_auxch(auxch, 8, addr, &bios->data[offset], 1);
2965 if (ret) { 2972 if (ret) {
2966 NV_ERROR(dev, "INIT_ZM_AUXCH: wr auxch fail %d\n", ret); 2973 NV_ERROR(dev, "INIT_ZM_AUXCH: wr auxch fail %d\n", ret);
2967 return false; 2974 return 0;
2968 } 2975 }
2969 } 2976 }
2970 2977
2971 return true; 2978 return len;
2972} 2979}
2973 2980
2974static struct init_tbl_entry itbl_entry[] = { 2981static struct init_tbl_entry itbl_entry[] = {
2975 /* command name , id , length , offset , mult , command handler */ 2982 /* command name , id , length , offset , mult , command handler */
2976 /* INIT_PROG (0x31, 15, 10, 4) removed due to no example of use */ 2983 /* INIT_PROG (0x31, 15, 10, 4) removed due to no example of use */
2977 { "INIT_IO_RESTRICT_PROG" , 0x32, 11 , 6 , 4 , init_io_restrict_prog }, 2984 { "INIT_IO_RESTRICT_PROG" , 0x32, init_io_restrict_prog },
2978 { "INIT_REPEAT" , 0x33, 2 , 0 , 0 , init_repeat }, 2985 { "INIT_REPEAT" , 0x33, init_repeat },
2979 { "INIT_IO_RESTRICT_PLL" , 0x34, 12 , 7 , 2 , init_io_restrict_pll }, 2986 { "INIT_IO_RESTRICT_PLL" , 0x34, init_io_restrict_pll },
2980 { "INIT_END_REPEAT" , 0x36, 1 , 0 , 0 , init_end_repeat }, 2987 { "INIT_END_REPEAT" , 0x36, init_end_repeat },
2981 { "INIT_COPY" , 0x37, 11 , 0 , 0 , init_copy }, 2988 { "INIT_COPY" , 0x37, init_copy },
2982 { "INIT_NOT" , 0x38, 1 , 0 , 0 , init_not }, 2989 { "INIT_NOT" , 0x38, init_not },
2983 { "INIT_IO_FLAG_CONDITION" , 0x39, 2 , 0 , 0 , init_io_flag_condition }, 2990 { "INIT_IO_FLAG_CONDITION" , 0x39, init_io_flag_condition },
2984 { "INIT_INDEX_ADDRESS_LATCHED" , 0x49, 18 , 17 , 2 , init_idx_addr_latched }, 2991 { "INIT_INDEX_ADDRESS_LATCHED" , 0x49, init_idx_addr_latched },
2985 { "INIT_IO_RESTRICT_PLL2" , 0x4A, 11 , 6 , 4 , init_io_restrict_pll2 }, 2992 { "INIT_IO_RESTRICT_PLL2" , 0x4A, init_io_restrict_pll2 },
2986 { "INIT_PLL2" , 0x4B, 9 , 0 , 0 , init_pll2 }, 2993 { "INIT_PLL2" , 0x4B, init_pll2 },
2987 { "INIT_I2C_BYTE" , 0x4C, 4 , 3 , 3 , init_i2c_byte }, 2994 { "INIT_I2C_BYTE" , 0x4C, init_i2c_byte },
2988 { "INIT_ZM_I2C_BYTE" , 0x4D, 4 , 3 , 2 , init_zm_i2c_byte }, 2995 { "INIT_ZM_I2C_BYTE" , 0x4D, init_zm_i2c_byte },
2989 { "INIT_ZM_I2C" , 0x4E, 4 , 3 , 1 , init_zm_i2c }, 2996 { "INIT_ZM_I2C" , 0x4E, init_zm_i2c },
2990 { "INIT_TMDS" , 0x4F, 5 , 0 , 0 , init_tmds }, 2997 { "INIT_TMDS" , 0x4F, init_tmds },
2991 { "INIT_ZM_TMDS_GROUP" , 0x50, 3 , 2 , 2 , init_zm_tmds_group }, 2998 { "INIT_ZM_TMDS_GROUP" , 0x50, init_zm_tmds_group },
2992 { "INIT_CR_INDEX_ADDRESS_LATCHED" , 0x51, 5 , 4 , 1 , init_cr_idx_adr_latch }, 2999 { "INIT_CR_INDEX_ADDRESS_LATCHED" , 0x51, init_cr_idx_adr_latch },
2993 { "INIT_CR" , 0x52, 4 , 0 , 0 , init_cr }, 3000 { "INIT_CR" , 0x52, init_cr },
2994 { "INIT_ZM_CR" , 0x53, 3 , 0 , 0 , init_zm_cr }, 3001 { "INIT_ZM_CR" , 0x53, init_zm_cr },
2995 { "INIT_ZM_CR_GROUP" , 0x54, 2 , 1 , 2 , init_zm_cr_group }, 3002 { "INIT_ZM_CR_GROUP" , 0x54, init_zm_cr_group },
2996 { "INIT_CONDITION_TIME" , 0x56, 3 , 0 , 0 , init_condition_time }, 3003 { "INIT_CONDITION_TIME" , 0x56, init_condition_time },
2997 { "INIT_ZM_REG_SEQUENCE" , 0x58, 6 , 5 , 4 , init_zm_reg_sequence }, 3004 { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence },
2998 /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ 3005 /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */
2999 { "INIT_SUB_DIRECT" , 0x5B, 3 , 0 , 0 , init_sub_direct }, 3006 { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct },
3000 { "INIT_COPY_NV_REG" , 0x5F, 22 , 0 , 0 , init_copy_nv_reg }, 3007 { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg },
3001 { "INIT_ZM_INDEX_IO" , 0x62, 5 , 0 , 0 , init_zm_index_io }, 3008 { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io },
3002 { "INIT_COMPUTE_MEM" , 0x63, 1 , 0 , 0 , init_compute_mem }, 3009 { "INIT_COMPUTE_MEM" , 0x63, init_compute_mem },
3003 { "INIT_RESET" , 0x65, 13 , 0 , 0 , init_reset }, 3010 { "INIT_RESET" , 0x65, init_reset },
3004 { "INIT_CONFIGURE_MEM" , 0x66, 1 , 0 , 0 , init_configure_mem }, 3011 { "INIT_CONFIGURE_MEM" , 0x66, init_configure_mem },
3005 { "INIT_CONFIGURE_CLK" , 0x67, 1 , 0 , 0 , init_configure_clk }, 3012 { "INIT_CONFIGURE_CLK" , 0x67, init_configure_clk },
3006 { "INIT_CONFIGURE_PREINIT" , 0x68, 1 , 0 , 0 , init_configure_preinit }, 3013 { "INIT_CONFIGURE_PREINIT" , 0x68, init_configure_preinit },
3007 { "INIT_IO" , 0x69, 5 , 0 , 0 , init_io }, 3014 { "INIT_IO" , 0x69, init_io },
3008 { "INIT_SUB" , 0x6B, 2 , 0 , 0 , init_sub }, 3015 { "INIT_SUB" , 0x6B, init_sub },
3009 { "INIT_RAM_CONDITION" , 0x6D, 3 , 0 , 0 , init_ram_condition }, 3016 { "INIT_RAM_CONDITION" , 0x6D, init_ram_condition },
3010 { "INIT_NV_REG" , 0x6E, 13 , 0 , 0 , init_nv_reg }, 3017 { "INIT_NV_REG" , 0x6E, init_nv_reg },
3011 { "INIT_MACRO" , 0x6F, 2 , 0 , 0 , init_macro }, 3018 { "INIT_MACRO" , 0x6F, init_macro },
3012 { "INIT_DONE" , 0x71, 1 , 0 , 0 , init_done }, 3019 { "INIT_DONE" , 0x71, init_done },
3013 { "INIT_RESUME" , 0x72, 1 , 0 , 0 , init_resume }, 3020 { "INIT_RESUME" , 0x72, init_resume },
3014 /* INIT_RAM_CONDITION2 (0x73, 9, 0, 0) removed due to no example of use */ 3021 /* INIT_RAM_CONDITION2 (0x73, 9, 0, 0) removed due to no example of use */
3015 { "INIT_TIME" , 0x74, 3 , 0 , 0 , init_time }, 3022 { "INIT_TIME" , 0x74, init_time },
3016 { "INIT_CONDITION" , 0x75, 2 , 0 , 0 , init_condition }, 3023 { "INIT_CONDITION" , 0x75, init_condition },
3017 { "INIT_IO_CONDITION" , 0x76, 2 , 0 , 0 , init_io_condition }, 3024 { "INIT_IO_CONDITION" , 0x76, init_io_condition },
3018 { "INIT_INDEX_IO" , 0x78, 6 , 0 , 0 , init_index_io }, 3025 { "INIT_INDEX_IO" , 0x78, init_index_io },
3019 { "INIT_PLL" , 0x79, 7 , 0 , 0 , init_pll }, 3026 { "INIT_PLL" , 0x79, init_pll },
3020 { "INIT_ZM_REG" , 0x7A, 9 , 0 , 0 , init_zm_reg }, 3027 { "INIT_ZM_REG" , 0x7A, init_zm_reg },
3021 /* INIT_RAM_RESTRICT_PLL's length is adjusted by the BIT M table */ 3028 { "INIT_RAM_RESTRICT_PLL" , 0x87, init_ram_restrict_pll },
3022 { "INIT_RAM_RESTRICT_PLL" , 0x87, 2 , 0 , 0 , init_ram_restrict_pll }, 3029 { "INIT_8C" , 0x8C, init_8c },
3023 { "INIT_8C" , 0x8C, 1 , 0 , 0 , init_8c }, 3030 { "INIT_8D" , 0x8D, init_8d },
3024 { "INIT_8D" , 0x8D, 1 , 0 , 0 , init_8d }, 3031 { "INIT_GPIO" , 0x8E, init_gpio },
3025 { "INIT_GPIO" , 0x8E, 1 , 0 , 0 , init_gpio }, 3032 { "INIT_RAM_RESTRICT_ZM_REG_GROUP" , 0x8F, init_ram_restrict_zm_reg_group },
3026 /* INIT_RAM_RESTRICT_ZM_REG_GROUP's mult is loaded by M table in BIT */ 3033 { "INIT_COPY_ZM_REG" , 0x90, init_copy_zm_reg },
3027 { "INIT_RAM_RESTRICT_ZM_REG_GROUP" , 0x8F, 7 , 6 , 0 , init_ram_restrict_zm_reg_group }, 3034 { "INIT_ZM_REG_GROUP_ADDRESS_LATCHED" , 0x91, init_zm_reg_group_addr_latched },
3028 { "INIT_COPY_ZM_REG" , 0x90, 9 , 0 , 0 , init_copy_zm_reg }, 3035 { "INIT_RESERVED" , 0x92, init_reserved },
3029 { "INIT_ZM_REG_GROUP_ADDRESS_LATCHED" , 0x91, 6 , 5 , 4 , init_zm_reg_group_addr_latched }, 3036 { "INIT_96" , 0x96, init_96 },
3030 { "INIT_RESERVED" , 0x92, 1 , 0 , 0 , init_reserved }, 3037 { "INIT_97" , 0x97, init_97 },
3031 { "INIT_96" , 0x96, 17 , 0 , 0 , init_96 }, 3038 { "INIT_AUXCH" , 0x98, init_auxch },
3032 { "INIT_97" , 0x97, 13 , 0 , 0 , init_97 }, 3039 { "INIT_ZM_AUXCH" , 0x99, init_zm_auxch },
3033 { "INIT_AUXCH" , 0x98, 6 , 5 , 2 , init_auxch }, 3040 { NULL , 0 , NULL }
3034 { "INIT_ZM_AUXCH" , 0x99, 6 , 5 , 1 , init_zm_auxch },
3035 { NULL , 0 , 0 , 0 , 0 , NULL }
3036}; 3041};
3037 3042
3038static unsigned int get_init_table_entry_length(struct nvbios *bios, unsigned int offset, int i)
3039{
3040 /* Calculates the length of a given init table entry. */
3041 return itbl_entry[i].length + bios->data[offset + itbl_entry[i].length_offset]*itbl_entry[i].length_multiplier;
3042}
3043
3044#define MAX_TABLE_OPS 1000 3043#define MAX_TABLE_OPS 1000
3045 3044
3046static int 3045static int
@@ -3056,7 +3055,7 @@ parse_init_table(struct nvbios *bios, unsigned int offset,
3056 * is changed back to EXECUTE. 3055 * is changed back to EXECUTE.
3057 */ 3056 */
3058 3057
3059 int count = 0, i; 3058 int count = 0, i, res;
3060 uint8_t id; 3059 uint8_t id;
3061 3060
3062 /* 3061 /*
@@ -3076,22 +3075,21 @@ parse_init_table(struct nvbios *bios, unsigned int offset,
3076 offset, itbl_entry[i].id, itbl_entry[i].name); 3075 offset, itbl_entry[i].id, itbl_entry[i].name);
3077 3076
3078 /* execute eventual command handler */ 3077 /* execute eventual command handler */
3079 if (itbl_entry[i].handler) 3078 res = (*itbl_entry[i].handler)(bios, offset, iexec);
3080 if (!(*itbl_entry[i].handler)(bios, offset, iexec)) 3079 if (!res)
3081 break; 3080 break;
3081 /*
3082 * Add the offset of the current command including all data
3083 * of that command. The offset will then be pointing on the
3084 * next op code.
3085 */
3086 offset += res;
3082 } else { 3087 } else {
3083 NV_ERROR(bios->dev, 3088 NV_ERROR(bios->dev,
3084 "0x%04X: Init table command not found: " 3089 "0x%04X: Init table command not found: "
3085 "0x%02X\n", offset, id); 3090 "0x%02X\n", offset, id);
3086 return -ENOENT; 3091 return -ENOENT;
3087 } 3092 }
3088
3089 /*
3090 * Add the offset of the current command including all data
3091 * of that command. The offset will then be pointing on the
3092 * next op code.
3093 */
3094 offset += get_init_table_entry_length(bios, offset, i);
3095 } 3093 }
3096 3094
3097 if (offset >= bios->length) 3095 if (offset >= bios->length)
@@ -3854,7 +3852,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
3854 * script tables is a pointer to the script to execute. 3852 * script tables is a pointer to the script to execute.
3855 */ 3853 */
3856 3854
3857 NV_DEBUG(dev, "Searching for output entry for %d %d %d\n", 3855 NV_DEBUG_KMS(dev, "Searching for output entry for %d %d %d\n",
3858 dcbent->type, dcbent->location, dcbent->or); 3856 dcbent->type, dcbent->location, dcbent->or);
3859 otable = bios_output_config_match(dev, dcbent, table[1] + 3857 otable = bios_output_config_match(dev, dcbent, table[1] +
3860 bios->display.script_table_ptr, 3858 bios->display.script_table_ptr,
@@ -3884,7 +3882,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
3884 if (pxclk == 0) { 3882 if (pxclk == 0) {
3885 script = ROM16(otable[6]); 3883 script = ROM16(otable[6]);
3886 if (!script) { 3884 if (!script) {
3887 NV_DEBUG(dev, "output script 0 not found\n"); 3885 NV_DEBUG_KMS(dev, "output script 0 not found\n");
3888 return 1; 3886 return 1;
3889 } 3887 }
3890 3888
@@ -3894,7 +3892,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
3894 if (pxclk == -1) { 3892 if (pxclk == -1) {
3895 script = ROM16(otable[8]); 3893 script = ROM16(otable[8]);
3896 if (!script) { 3894 if (!script) {
3897 NV_DEBUG(dev, "output script 1 not found\n"); 3895 NV_DEBUG_KMS(dev, "output script 1 not found\n");
3898 return 1; 3896 return 1;
3899 } 3897 }
3900 3898
@@ -3907,7 +3905,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
3907 else 3905 else
3908 script = 0; 3906 script = 0;
3909 if (!script) { 3907 if (!script) {
3910 NV_DEBUG(dev, "output script 2 not found\n"); 3908 NV_DEBUG_KMS(dev, "output script 2 not found\n");
3911 return 1; 3909 return 1;
3912 } 3910 }
3913 3911
@@ -3931,7 +3929,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent,
3931 if (script) 3929 if (script)
3932 script = clkcmptable(bios, script, -pxclk); 3930 script = clkcmptable(bios, script, -pxclk);
3933 if (!script) { 3931 if (!script) {
3934 NV_DEBUG(dev, "clock script 1 not found\n"); 3932 NV_DEBUG_KMS(dev, "clock script 1 not found\n");
3935 return 1; 3933 return 1;
3936 } 3934 }
3937 3935
@@ -4606,10 +4604,6 @@ parse_bit_M_tbl_entry(struct drm_device *dev, struct nvbios *bios,
4606 * stuff that we don't use - their use currently unknown 4604 * stuff that we don't use - their use currently unknown
4607 */ 4605 */
4608 4606
4609 uint16_t rr_strap_xlat;
4610 uint8_t rr_group_count;
4611 int i;
4612
4613 /* 4607 /*
4614 * Older bios versions don't have a sufficiently long table for 4608 * Older bios versions don't have a sufficiently long table for
4615 * what we want 4609 * what we want
@@ -4618,24 +4612,13 @@ parse_bit_M_tbl_entry(struct drm_device *dev, struct nvbios *bios,
4618 return 0; 4612 return 0;
4619 4613
4620 if (bitentry->id[1] < 2) { 4614 if (bitentry->id[1] < 2) {
4621 rr_group_count = bios->data[bitentry->offset + 2]; 4615 bios->ram_restrict_group_count = bios->data[bitentry->offset + 2];
4622 rr_strap_xlat = ROM16(bios->data[bitentry->offset + 3]); 4616 bios->ram_restrict_tbl_ptr = ROM16(bios->data[bitentry->offset + 3]);
4623 } else { 4617 } else {
4624 rr_group_count = bios->data[bitentry->offset + 0]; 4618 bios->ram_restrict_group_count = bios->data[bitentry->offset + 0];
4625 rr_strap_xlat = ROM16(bios->data[bitentry->offset + 1]); 4619 bios->ram_restrict_tbl_ptr = ROM16(bios->data[bitentry->offset + 1]);
4626 } 4620 }
4627 4621
4628 /* adjust length of INIT_87 */
4629 for (i = 0; itbl_entry[i].name && (itbl_entry[i].id != 0x87); i++);
4630 itbl_entry[i].length += rr_group_count * 4;
4631
4632 /* set up multiplier for INIT_RAM_RESTRICT_ZM_REG_GROUP */
4633 for (; itbl_entry[i].name && (itbl_entry[i].id != 0x8f); i++);
4634 itbl_entry[i].length_multiplier = rr_group_count * 4;
4635
4636 init_ram_restrict_zm_reg_group_blocklen = itbl_entry[i].length_multiplier;
4637 bios->ram_restrict_tbl_ptr = rr_strap_xlat;
4638
4639 return 0; 4622 return 0;
4640} 4623}
4641 4624
@@ -5234,7 +5217,7 @@ parse_dcb_connector_table(struct nvbios *bios)
5234 int i; 5217 int i;
5235 5218
5236 if (!bios->bdcb.connector_table_ptr) { 5219 if (!bios->bdcb.connector_table_ptr) {
5237 NV_DEBUG(dev, "No DCB connector table present\n"); 5220 NV_DEBUG_KMS(dev, "No DCB connector table present\n");
5238 return; 5221 return;
5239 } 5222 }
5240 5223
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h
index 1d5f10bd78ed..058e98c76d89 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.h
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.h
@@ -227,6 +227,7 @@ struct nvbios {
227 227
228 uint16_t pll_limit_tbl_ptr; 228 uint16_t pll_limit_tbl_ptr;
229 uint16_t ram_restrict_tbl_ptr; 229 uint16_t ram_restrict_tbl_ptr;
230 uint8_t ram_restrict_group_count;
230 231
231 uint16_t some_script_ptr; /* BIT I + 14 */ 232 uint16_t some_script_ptr; /* BIT I + 14 */
232 uint16_t init96_tbl_ptr; /* BIT I + 16 */ 233 uint16_t init96_tbl_ptr; /* BIT I + 16 */
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index aa2dfbc3e351..e342a418d434 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -33,10 +33,13 @@
33#include "nouveau_drv.h" 33#include "nouveau_drv.h"
34#include "nouveau_dma.h" 34#include "nouveau_dma.h"
35 35
36#include <linux/log2.h>
37
36static void 38static void
37nouveau_bo_del_ttm(struct ttm_buffer_object *bo) 39nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
38{ 40{
39 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); 41 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
42 struct drm_device *dev = dev_priv->dev;
40 struct nouveau_bo *nvbo = nouveau_bo(bo); 43 struct nouveau_bo *nvbo = nouveau_bo(bo);
41 44
42 ttm_bo_kunmap(&nvbo->kmap); 45 ttm_bo_kunmap(&nvbo->kmap);
@@ -44,12 +47,87 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
44 if (unlikely(nvbo->gem)) 47 if (unlikely(nvbo->gem))
45 DRM_ERROR("bo %p still attached to GEM object\n", bo); 48 DRM_ERROR("bo %p still attached to GEM object\n", bo);
46 49
50 if (nvbo->tile)
51 nv10_mem_expire_tiling(dev, nvbo->tile, NULL);
52
47 spin_lock(&dev_priv->ttm.bo_list_lock); 53 spin_lock(&dev_priv->ttm.bo_list_lock);
48 list_del(&nvbo->head); 54 list_del(&nvbo->head);
49 spin_unlock(&dev_priv->ttm.bo_list_lock); 55 spin_unlock(&dev_priv->ttm.bo_list_lock);
50 kfree(nvbo); 56 kfree(nvbo);
51} 57}
52 58
59static void
60nouveau_bo_fixup_align(struct drm_device *dev,
61 uint32_t tile_mode, uint32_t tile_flags,
62 int *align, int *size)
63{
64 struct drm_nouveau_private *dev_priv = dev->dev_private;
65
66 /*
67 * Some of the tile_flags have a periodic structure of N*4096 bytes,
68 * align to to that as well as the page size. Overallocate memory to
69 * avoid corruption of other buffer objects.
70 */
71 if (dev_priv->card_type == NV_50) {
72 uint32_t block_size = nouveau_mem_fb_amount(dev) >> 15;
73 int i;
74
75 switch (tile_flags) {
76 case 0x1800:
77 case 0x2800:
78 case 0x4800:
79 case 0x7a00:
80 *size = roundup(*size, block_size);
81 if (is_power_of_2(block_size)) {
82 *size += 3 * block_size;
83 for (i = 1; i < 10; i++) {
84 *align = 12 * i * block_size;
85 if (!(*align % 65536))
86 break;
87 }
88 } else {
89 *size += 6 * block_size;
90 for (i = 1; i < 10; i++) {
91 *align = 8 * i * block_size;
92 if (!(*align % 65536))
93 break;
94 }
95 }
96 break;
97 default:
98 break;
99 }
100
101 } else {
102 if (tile_mode) {
103 if (dev_priv->chipset >= 0x40) {
104 *align = 65536;
105 *size = roundup(*size, 64 * tile_mode);
106
107 } else if (dev_priv->chipset >= 0x30) {
108 *align = 32768;
109 *size = roundup(*size, 64 * tile_mode);
110
111 } else if (dev_priv->chipset >= 0x20) {
112 *align = 16384;
113 *size = roundup(*size, 64 * tile_mode);
114
115 } else if (dev_priv->chipset >= 0x10) {
116 *align = 16384;
117 *size = roundup(*size, 32 * tile_mode);
118 }
119 }
120 }
121
122 /* ALIGN works only on powers of two. */
123 *size = roundup(*size, PAGE_SIZE);
124
125 if (dev_priv->card_type == NV_50) {
126 *size = roundup(*size, 65536);
127 *align = max(65536, *align);
128 }
129}
130
53int 131int
54nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, 132nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
55 int size, int align, uint32_t flags, uint32_t tile_mode, 133 int size, int align, uint32_t flags, uint32_t tile_mode,
@@ -58,7 +136,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
58{ 136{
59 struct drm_nouveau_private *dev_priv = dev->dev_private; 137 struct drm_nouveau_private *dev_priv = dev->dev_private;
60 struct nouveau_bo *nvbo; 138 struct nouveau_bo *nvbo;
61 int ret, n = 0; 139 int ret = 0;
62 140
63 nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); 141 nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL);
64 if (!nvbo) 142 if (!nvbo)
@@ -70,59 +148,14 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
70 nvbo->tile_mode = tile_mode; 148 nvbo->tile_mode = tile_mode;
71 nvbo->tile_flags = tile_flags; 149 nvbo->tile_flags = tile_flags;
72 150
73 /* 151 nouveau_bo_fixup_align(dev, tile_mode, tile_flags, &align, &size);
74 * Some of the tile_flags have a periodic structure of N*4096 bytes,
75 * align to to that as well as the page size. Overallocate memory to
76 * avoid corruption of other buffer objects.
77 */
78 switch (tile_flags) {
79 case 0x1800:
80 case 0x2800:
81 case 0x4800:
82 case 0x7a00:
83 if (dev_priv->chipset >= 0xA0) {
84 /* This is based on high end cards with 448 bits
85 * memory bus, could be different elsewhere.*/
86 size += 6 * 28672;
87 /* 8 * 28672 is the actual alignment requirement,
88 * but we must also align to page size. */
89 align = 2 * 8 * 28672;
90 } else if (dev_priv->chipset >= 0x90) {
91 size += 3 * 16384;
92 align = 12 * 16834;
93 } else {
94 size += 3 * 8192;
95 /* 12 * 8192 is the actual alignment requirement,
96 * but we must also align to page size. */
97 align = 2 * 12 * 8192;
98 }
99 break;
100 default:
101 break;
102 }
103
104 align >>= PAGE_SHIFT; 152 align >>= PAGE_SHIFT;
105 153
106 size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
107 if (dev_priv->card_type == NV_50) {
108 size = (size + 65535) & ~65535;
109 if (align < (65536 / PAGE_SIZE))
110 align = (65536 / PAGE_SIZE);
111 }
112
113 if (flags & TTM_PL_FLAG_VRAM)
114 nvbo->placements[n++] = TTM_PL_FLAG_VRAM | TTM_PL_MASK_CACHING;
115 if (flags & TTM_PL_FLAG_TT)
116 nvbo->placements[n++] = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING;
117 nvbo->placement.fpfn = 0; 154 nvbo->placement.fpfn = 0;
118 nvbo->placement.lpfn = mappable ? dev_priv->fb_mappable_pages : 0; 155 nvbo->placement.lpfn = mappable ? dev_priv->fb_mappable_pages : 0;
119 nvbo->placement.placement = nvbo->placements; 156 nouveau_bo_placement_set(nvbo, flags);
120 nvbo->placement.busy_placement = nvbo->placements;
121 nvbo->placement.num_placement = n;
122 nvbo->placement.num_busy_placement = n;
123 157
124 nvbo->channel = chan; 158 nvbo->channel = chan;
125 nouveau_bo_placement_set(nvbo, flags);
126 ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, 159 ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size,
127 ttm_bo_type_device, &nvbo->placement, align, 0, 160 ttm_bo_type_device, &nvbo->placement, align, 0,
128 false, NULL, size, nouveau_bo_del_ttm); 161 false, NULL, size, nouveau_bo_del_ttm);
@@ -154,6 +187,11 @@ nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t memtype)
154 nvbo->placement.busy_placement = nvbo->placements; 187 nvbo->placement.busy_placement = nvbo->placements;
155 nvbo->placement.num_placement = n; 188 nvbo->placement.num_placement = n;
156 nvbo->placement.num_busy_placement = n; 189 nvbo->placement.num_busy_placement = n;
190
191 if (nvbo->pin_refcnt) {
192 while (n--)
193 nvbo->placements[n] |= TTM_PL_FLAG_NO_EVICT;
194 }
157} 195}
158 196
159int 197int
@@ -400,16 +438,23 @@ nouveau_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
400 struct nouveau_bo *nvbo = nouveau_bo(bo); 438 struct nouveau_bo *nvbo = nouveau_bo(bo);
401 439
402 switch (bo->mem.mem_type) { 440 switch (bo->mem.mem_type) {
441 case TTM_PL_VRAM:
442 nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_TT |
443 TTM_PL_FLAG_SYSTEM);
444 break;
403 default: 445 default:
404 nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_SYSTEM); 446 nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_SYSTEM);
405 break; 447 break;
406 } 448 }
449
450 *pl = nvbo->placement;
407} 451}
408 452
409 453
410/* GPU-assisted copy using NV_MEMORY_TO_MEMORY_FORMAT, can access 454/* GPU-assisted copy using NV_MEMORY_TO_MEMORY_FORMAT, can access
411 * TTM_PL_{VRAM,TT} directly. 455 * TTM_PL_{VRAM,TT} directly.
412 */ 456 */
457
413static int 458static int
414nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, 459nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
415 struct nouveau_bo *nvbo, bool evict, bool no_wait, 460 struct nouveau_bo *nvbo, bool evict, bool no_wait,
@@ -444,22 +489,20 @@ nouveau_bo_mem_ctxdma(struct nouveau_bo *nvbo, struct nouveau_channel *chan,
444} 489}
445 490
446static int 491static int
447nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, int no_wait, 492nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
448 struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) 493 int no_wait, struct ttm_mem_reg *new_mem)
449{ 494{
450 struct nouveau_bo *nvbo = nouveau_bo(bo); 495 struct nouveau_bo *nvbo = nouveau_bo(bo);
451 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); 496 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
497 struct ttm_mem_reg *old_mem = &bo->mem;
452 struct nouveau_channel *chan; 498 struct nouveau_channel *chan;
453 uint64_t src_offset, dst_offset; 499 uint64_t src_offset, dst_offset;
454 uint32_t page_count; 500 uint32_t page_count;
455 int ret; 501 int ret;
456 502
457 chan = nvbo->channel; 503 chan = nvbo->channel;
458 if (!chan || nvbo->tile_flags || nvbo->no_vm) { 504 if (!chan || nvbo->tile_flags || nvbo->no_vm)
459 chan = dev_priv->channel; 505 chan = dev_priv->channel;
460 if (!chan)
461 return -EINVAL;
462 }
463 506
464 src_offset = old_mem->mm_node->start << PAGE_SHIFT; 507 src_offset = old_mem->mm_node->start << PAGE_SHIFT;
465 dst_offset = new_mem->mm_node->start << PAGE_SHIFT; 508 dst_offset = new_mem->mm_node->start << PAGE_SHIFT;
@@ -539,7 +582,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
539 582
540 placement.fpfn = placement.lpfn = 0; 583 placement.fpfn = placement.lpfn = 0;
541 placement.num_placement = placement.num_busy_placement = 1; 584 placement.num_placement = placement.num_busy_placement = 1;
542 placement.placement = &placement_memtype; 585 placement.placement = placement.busy_placement = &placement_memtype;
543 586
544 tmp_mem = *new_mem; 587 tmp_mem = *new_mem;
545 tmp_mem.mm_node = NULL; 588 tmp_mem.mm_node = NULL;
@@ -551,7 +594,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
551 if (ret) 594 if (ret)
552 goto out; 595 goto out;
553 596
554 ret = nouveau_bo_move_m2mf(bo, true, no_wait, &bo->mem, &tmp_mem); 597 ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait, &tmp_mem);
555 if (ret) 598 if (ret)
556 goto out; 599 goto out;
557 600
@@ -577,7 +620,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
577 620
578 placement.fpfn = placement.lpfn = 0; 621 placement.fpfn = placement.lpfn = 0;
579 placement.num_placement = placement.num_busy_placement = 1; 622 placement.num_placement = placement.num_busy_placement = 1;
580 placement.placement = &placement_memtype; 623 placement.placement = placement.busy_placement = &placement_memtype;
581 624
582 tmp_mem = *new_mem; 625 tmp_mem = *new_mem;
583 tmp_mem.mm_node = NULL; 626 tmp_mem.mm_node = NULL;
@@ -589,7 +632,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
589 if (ret) 632 if (ret)
590 goto out; 633 goto out;
591 634
592 ret = nouveau_bo_move_m2mf(bo, true, no_wait, &bo->mem, new_mem); 635 ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem);
593 if (ret) 636 if (ret)
594 goto out; 637 goto out;
595 638
@@ -604,51 +647,106 @@ out:
604} 647}
605 648
606static int 649static int
607nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, 650nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem,
608 bool no_wait, struct ttm_mem_reg *new_mem) 651 struct nouveau_tile_reg **new_tile)
609{ 652{
610 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); 653 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
611 struct nouveau_bo *nvbo = nouveau_bo(bo);
612 struct drm_device *dev = dev_priv->dev; 654 struct drm_device *dev = dev_priv->dev;
613 struct ttm_mem_reg *old_mem = &bo->mem; 655 struct nouveau_bo *nvbo = nouveau_bo(bo);
656 uint64_t offset;
614 int ret; 657 int ret;
615 658
616 if (dev_priv->card_type == NV_50 && new_mem->mem_type == TTM_PL_VRAM && 659 if (nvbo->no_vm || new_mem->mem_type != TTM_PL_VRAM) {
617 !nvbo->no_vm) { 660 /* Nothing to do. */
618 uint64_t offset = new_mem->mm_node->start << PAGE_SHIFT; 661 *new_tile = NULL;
662 return 0;
663 }
619 664
665 offset = new_mem->mm_node->start << PAGE_SHIFT;
666
667 if (dev_priv->card_type == NV_50) {
620 ret = nv50_mem_vm_bind_linear(dev, 668 ret = nv50_mem_vm_bind_linear(dev,
621 offset + dev_priv->vm_vram_base, 669 offset + dev_priv->vm_vram_base,
622 new_mem->size, nvbo->tile_flags, 670 new_mem->size, nvbo->tile_flags,
623 offset); 671 offset);
624 if (ret) 672 if (ret)
625 return ret; 673 return ret;
674
675 } else if (dev_priv->card_type >= NV_10) {
676 *new_tile = nv10_mem_set_tiling(dev, offset, new_mem->size,
677 nvbo->tile_mode);
626 } 678 }
627 679
628 if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE) 680 return 0;
629 return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); 681}
682
683static void
684nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo,
685 struct nouveau_tile_reg *new_tile,
686 struct nouveau_tile_reg **old_tile)
687{
688 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
689 struct drm_device *dev = dev_priv->dev;
630 690
691 if (dev_priv->card_type >= NV_10 &&
692 dev_priv->card_type < NV_50) {
693 if (*old_tile)
694 nv10_mem_expire_tiling(dev, *old_tile, bo->sync_obj);
695
696 *old_tile = new_tile;
697 }
698}
699
700static int
701nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
702 bool no_wait, struct ttm_mem_reg *new_mem)
703{
704 struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
705 struct nouveau_bo *nvbo = nouveau_bo(bo);
706 struct ttm_mem_reg *old_mem = &bo->mem;
707 struct nouveau_tile_reg *new_tile = NULL;
708 int ret = 0;
709
710 ret = nouveau_bo_vm_bind(bo, new_mem, &new_tile);
711 if (ret)
712 return ret;
713
714 /* Software copy if the card isn't up and running yet. */
715 if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE ||
716 !dev_priv->channel) {
717 ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem);
718 goto out;
719 }
720
721 /* Fake bo copy. */
631 if (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm) { 722 if (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm) {
632 BUG_ON(bo->mem.mm_node != NULL); 723 BUG_ON(bo->mem.mm_node != NULL);
633 bo->mem = *new_mem; 724 bo->mem = *new_mem;
634 new_mem->mm_node = NULL; 725 new_mem->mm_node = NULL;
635 return 0; 726 goto out;
636 } 727 }
637 728
638 if (new_mem->mem_type == TTM_PL_SYSTEM) { 729 /* Hardware assisted copy. */
639 if (old_mem->mem_type == TTM_PL_SYSTEM) 730 if (new_mem->mem_type == TTM_PL_SYSTEM)
640 return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); 731 ret = nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem);
641 if (nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem)) 732 else if (old_mem->mem_type == TTM_PL_SYSTEM)
642 return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); 733 ret = nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem);
643 } else if (old_mem->mem_type == TTM_PL_SYSTEM) { 734 else
644 if (nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem)) 735 ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem);
645 return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem);
646 } else {
647 if (nouveau_bo_move_m2mf(bo, evict, no_wait, old_mem, new_mem))
648 return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem);
649 }
650 736
651 return 0; 737 if (!ret)
738 goto out;
739
740 /* Fallback to software copy. */
741 ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem);
742
743out:
744 if (ret)
745 nouveau_bo_vm_cleanup(bo, NULL, &new_tile);
746 else
747 nouveau_bo_vm_cleanup(bo, new_tile, &nvbo->tile);
748
749 return ret;
652} 750}
653 751
654static int 752static int
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c
index 9aaa972f8822..343d718a9667 100644
--- a/drivers/gpu/drm/nouveau/nouveau_channel.c
+++ b/drivers/gpu/drm/nouveau/nouveau_channel.c
@@ -158,6 +158,8 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
158 return ret; 158 return ret;
159 } 159 }
160 160
161 nouveau_dma_pre_init(chan);
162
161 /* Locate channel's user control regs */ 163 /* Locate channel's user control regs */
162 if (dev_priv->card_type < NV_40) 164 if (dev_priv->card_type < NV_40)
163 user = NV03_USER(channel); 165 user = NV03_USER(channel);
@@ -235,47 +237,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret,
235 return 0; 237 return 0;
236} 238}
237 239
238int
239nouveau_channel_idle(struct nouveau_channel *chan)
240{
241 struct drm_device *dev = chan->dev;
242 struct drm_nouveau_private *dev_priv = dev->dev_private;
243 struct nouveau_engine *engine = &dev_priv->engine;
244 uint32_t caches;
245 int idle;
246
247 if (!chan) {
248 NV_ERROR(dev, "no channel...\n");
249 return 1;
250 }
251
252 caches = nv_rd32(dev, NV03_PFIFO_CACHES);
253 nv_wr32(dev, NV03_PFIFO_CACHES, caches & ~1);
254
255 if (engine->fifo.channel_id(dev) != chan->id) {
256 struct nouveau_gpuobj *ramfc =
257 chan->ramfc ? chan->ramfc->gpuobj : NULL;
258
259 if (!ramfc) {
260 NV_ERROR(dev, "No RAMFC for channel %d\n", chan->id);
261 return 1;
262 }
263
264 engine->instmem.prepare_access(dev, false);
265 if (nv_ro32(dev, ramfc, 0) != nv_ro32(dev, ramfc, 1))
266 idle = 0;
267 else
268 idle = 1;
269 engine->instmem.finish_access(dev);
270 } else {
271 idle = (nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_GET) ==
272 nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUT));
273 }
274
275 nv_wr32(dev, NV03_PFIFO_CACHES, caches);
276 return idle;
277}
278
279/* stops a fifo */ 240/* stops a fifo */
280void 241void
281nouveau_channel_free(struct nouveau_channel *chan) 242nouveau_channel_free(struct nouveau_channel *chan)
@@ -414,7 +375,9 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data,
414 init->subchan[0].grclass = 0x0039; 375 init->subchan[0].grclass = 0x0039;
415 else 376 else
416 init->subchan[0].grclass = 0x5039; 377 init->subchan[0].grclass = 0x5039;
417 init->nr_subchan = 1; 378 init->subchan[1].handle = NvSw;
379 init->subchan[1].grclass = NV_SW;
380 init->nr_subchan = 2;
418 381
419 /* Named memory object area */ 382 /* Named memory object area */
420 ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem, 383 ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem,
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 032cf098fa1c..5a10deb8bdbd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -86,7 +86,7 @@ nouveau_connector_destroy(struct drm_connector *drm_connector)
86 struct nouveau_connector *connector = nouveau_connector(drm_connector); 86 struct nouveau_connector *connector = nouveau_connector(drm_connector);
87 struct drm_device *dev = connector->base.dev; 87 struct drm_device *dev = connector->base.dev;
88 88
89 NV_DEBUG(dev, "\n"); 89 NV_DEBUG_KMS(dev, "\n");
90 90
91 if (!connector) 91 if (!connector)
92 return; 92 return;
@@ -420,7 +420,7 @@ nouveau_connector_native_mode(struct nouveau_connector *connector)
420 /* Use preferred mode if there is one.. */ 420 /* Use preferred mode if there is one.. */
421 list_for_each_entry(mode, &connector->base.probed_modes, head) { 421 list_for_each_entry(mode, &connector->base.probed_modes, head) {
422 if (mode->type & DRM_MODE_TYPE_PREFERRED) { 422 if (mode->type & DRM_MODE_TYPE_PREFERRED) {
423 NV_DEBUG(dev, "native mode from preferred\n"); 423 NV_DEBUG_KMS(dev, "native mode from preferred\n");
424 return drm_mode_duplicate(dev, mode); 424 return drm_mode_duplicate(dev, mode);
425 } 425 }
426 } 426 }
@@ -445,7 +445,7 @@ nouveau_connector_native_mode(struct nouveau_connector *connector)
445 largest = mode; 445 largest = mode;
446 } 446 }
447 447
448 NV_DEBUG(dev, "native mode from largest: %dx%d@%d\n", 448 NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n",
449 high_w, high_h, high_v); 449 high_w, high_h, high_v);
450 return largest ? drm_mode_duplicate(dev, largest) : NULL; 450 return largest ? drm_mode_duplicate(dev, largest) : NULL;
451} 451}
@@ -725,7 +725,7 @@ nouveau_connector_create(struct drm_device *dev, int index, int type)
725 struct drm_encoder *encoder; 725 struct drm_encoder *encoder;
726 int ret; 726 int ret;
727 727
728 NV_DEBUG(dev, "\n"); 728 NV_DEBUG_KMS(dev, "\n");
729 729
730 nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL); 730 nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL);
731 if (!nv_connector) 731 if (!nv_connector)
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c
index 703553687b20..7afbe8b40d51 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.c
@@ -29,12 +29,22 @@
29#include "nouveau_drv.h" 29#include "nouveau_drv.h"
30#include "nouveau_dma.h" 30#include "nouveau_dma.h"
31 31
32void
33nouveau_dma_pre_init(struct nouveau_channel *chan)
34{
35 chan->dma.max = (chan->pushbuf_bo->bo.mem.size >> 2) - 2;
36 chan->dma.put = 0;
37 chan->dma.cur = chan->dma.put;
38 chan->dma.free = chan->dma.max - chan->dma.cur;
39}
40
32int 41int
33nouveau_dma_init(struct nouveau_channel *chan) 42nouveau_dma_init(struct nouveau_channel *chan)
34{ 43{
35 struct drm_device *dev = chan->dev; 44 struct drm_device *dev = chan->dev;
36 struct drm_nouveau_private *dev_priv = dev->dev_private; 45 struct drm_nouveau_private *dev_priv = dev->dev_private;
37 struct nouveau_gpuobj *m2mf = NULL; 46 struct nouveau_gpuobj *m2mf = NULL;
47 struct nouveau_gpuobj *nvsw = NULL;
38 int ret, i; 48 int ret, i;
39 49
40 /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ 50 /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */
@@ -47,6 +57,15 @@ nouveau_dma_init(struct nouveau_channel *chan)
47 if (ret) 57 if (ret)
48 return ret; 58 return ret;
49 59
60 /* Create an NV_SW object for various sync purposes */
61 ret = nouveau_gpuobj_sw_new(chan, NV_SW, &nvsw);
62 if (ret)
63 return ret;
64
65 ret = nouveau_gpuobj_ref_add(dev, chan, NvSw, nvsw, NULL);
66 if (ret)
67 return ret;
68
50 /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ 69 /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */
51 ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy); 70 ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy);
52 if (ret) 71 if (ret)
@@ -64,12 +83,6 @@ nouveau_dma_init(struct nouveau_channel *chan)
64 return ret; 83 return ret;
65 } 84 }
66 85
67 /* Initialise DMA vars */
68 chan->dma.max = (chan->pushbuf_bo->bo.mem.size >> 2) - 2;
69 chan->dma.put = 0;
70 chan->dma.cur = chan->dma.put;
71 chan->dma.free = chan->dma.max - chan->dma.cur;
72
73 /* Insert NOPS for NOUVEAU_DMA_SKIPS */ 86 /* Insert NOPS for NOUVEAU_DMA_SKIPS */
74 ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); 87 ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS);
75 if (ret) 88 if (ret)
@@ -87,6 +100,13 @@ nouveau_dma_init(struct nouveau_channel *chan)
87 BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); 100 BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1);
88 OUT_RING(chan, NvNotify0); 101 OUT_RING(chan, NvNotify0);
89 102
103 /* Initialise NV_SW */
104 ret = RING_SPACE(chan, 2);
105 if (ret)
106 return ret;
107 BEGIN_RING(chan, NvSubSw, 0, 1);
108 OUT_RING(chan, NvSw);
109
90 /* Sit back and pray the channel works.. */ 110 /* Sit back and pray the channel works.. */
91 FIRE_RING(chan); 111 FIRE_RING(chan);
92 112
@@ -113,7 +133,7 @@ READ_GET(struct nouveau_channel *chan, uint32_t *get)
113 133
114 val = nvchan_rd32(chan, chan->user_get); 134 val = nvchan_rd32(chan, chan->user_get);
115 if (val < chan->pushbuf_base || 135 if (val < chan->pushbuf_base ||
116 val >= chan->pushbuf_base + chan->pushbuf_bo->bo.mem.size) { 136 val > chan->pushbuf_base + (chan->dma.max << 2)) {
117 /* meaningless to dma_wait() except to know whether the 137 /* meaningless to dma_wait() except to know whether the
118 * GPU has stalled or not 138 * GPU has stalled or not
119 */ 139 */
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h
index 04e85d8f757e..dabfd655f93e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.h
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.h
@@ -46,10 +46,11 @@
46/* Hardcoded object assignments to subchannels (subchannel id). */ 46/* Hardcoded object assignments to subchannels (subchannel id). */
47enum { 47enum {
48 NvSubM2MF = 0, 48 NvSubM2MF = 0,
49 NvSub2D = 1, 49 NvSubSw = 1,
50 NvSubCtxSurf2D = 1, 50 NvSub2D = 2,
51 NvSubGdiRect = 2, 51 NvSubCtxSurf2D = 2,
52 NvSubImageBlit = 3 52 NvSubGdiRect = 3,
53 NvSubImageBlit = 4
53}; 54};
54 55
55/* Object handles. */ 56/* Object handles. */
@@ -67,6 +68,7 @@ enum {
67 NvClipRect = 0x8000000b, 68 NvClipRect = 0x8000000b,
68 NvGdiRect = 0x8000000c, 69 NvGdiRect = 0x8000000c,
69 NvImageBlit = 0x8000000d, 70 NvImageBlit = 0x8000000d,
71 NvSw = 0x8000000e,
70 72
71 /* G80+ display objects */ 73 /* G80+ display objects */
72 NvEvoVRAM = 0x01000000, 74 NvEvoVRAM = 0x01000000,
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c
index de61f4640e12..9e2926c48579 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dp.c
@@ -187,7 +187,7 @@ nouveau_dp_link_train_adjust(struct drm_encoder *encoder, uint8_t *config)
187 if (ret) 187 if (ret)
188 return false; 188 return false;
189 189
190 NV_DEBUG(dev, "\t\tadjust 0x%02x 0x%02x\n", request[0], request[1]); 190 NV_DEBUG_KMS(dev, "\t\tadjust 0x%02x 0x%02x\n", request[0], request[1]);
191 191
192 /* Keep all lanes at the same level.. */ 192 /* Keep all lanes at the same level.. */
193 for (i = 0; i < nv_encoder->dp.link_nr; i++) { 193 for (i = 0; i < nv_encoder->dp.link_nr; i++) {
@@ -228,7 +228,7 @@ nouveau_dp_link_train_commit(struct drm_encoder *encoder, uint8_t *config)
228 int or = nv_encoder->or, link = !(nv_encoder->dcb->sorconf.link & 1); 228 int or = nv_encoder->or, link = !(nv_encoder->dcb->sorconf.link & 1);
229 int dpe_headerlen, ret, i; 229 int dpe_headerlen, ret, i;
230 230
231 NV_DEBUG(dev, "\t\tconfig 0x%02x 0x%02x 0x%02x 0x%02x\n", 231 NV_DEBUG_KMS(dev, "\t\tconfig 0x%02x 0x%02x 0x%02x 0x%02x\n",
232 config[0], config[1], config[2], config[3]); 232 config[0], config[1], config[2], config[3]);
233 233
234 dpe = nouveau_bios_dp_table(dev, nv_encoder->dcb, &dpe_headerlen); 234 dpe = nouveau_bios_dp_table(dev, nv_encoder->dcb, &dpe_headerlen);
@@ -276,12 +276,12 @@ nouveau_dp_link_train(struct drm_encoder *encoder)
276 bool cr_done, cr_max_vs, eq_done; 276 bool cr_done, cr_max_vs, eq_done;
277 int ret = 0, i, tries, voltage; 277 int ret = 0, i, tries, voltage;
278 278
279 NV_DEBUG(dev, "link training!!\n"); 279 NV_DEBUG_KMS(dev, "link training!!\n");
280train: 280train:
281 cr_done = eq_done = false; 281 cr_done = eq_done = false;
282 282
283 /* set link configuration */ 283 /* set link configuration */
284 NV_DEBUG(dev, "\tbegin train: bw %d, lanes %d\n", 284 NV_DEBUG_KMS(dev, "\tbegin train: bw %d, lanes %d\n",
285 nv_encoder->dp.link_bw, nv_encoder->dp.link_nr); 285 nv_encoder->dp.link_bw, nv_encoder->dp.link_nr);
286 286
287 ret = nouveau_dp_link_bw_set(encoder, nv_encoder->dp.link_bw); 287 ret = nouveau_dp_link_bw_set(encoder, nv_encoder->dp.link_bw);
@@ -297,7 +297,7 @@ train:
297 return false; 297 return false;
298 298
299 /* clock recovery */ 299 /* clock recovery */
300 NV_DEBUG(dev, "\tbegin cr\n"); 300 NV_DEBUG_KMS(dev, "\tbegin cr\n");
301 ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_1); 301 ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_1);
302 if (ret) 302 if (ret)
303 goto stop; 303 goto stop;
@@ -314,7 +314,7 @@ train:
314 ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 2); 314 ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 2);
315 if (ret) 315 if (ret)
316 break; 316 break;
317 NV_DEBUG(dev, "\t\tstatus: 0x%02x 0x%02x\n", 317 NV_DEBUG_KMS(dev, "\t\tstatus: 0x%02x 0x%02x\n",
318 status[0], status[1]); 318 status[0], status[1]);
319 319
320 cr_done = true; 320 cr_done = true;
@@ -346,7 +346,7 @@ train:
346 goto stop; 346 goto stop;
347 347
348 /* channel equalisation */ 348 /* channel equalisation */
349 NV_DEBUG(dev, "\tbegin eq\n"); 349 NV_DEBUG_KMS(dev, "\tbegin eq\n");
350 ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_2); 350 ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_2);
351 if (ret) 351 if (ret)
352 goto stop; 352 goto stop;
@@ -357,7 +357,7 @@ train:
357 ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 3); 357 ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 3);
358 if (ret) 358 if (ret)
359 break; 359 break;
360 NV_DEBUG(dev, "\t\tstatus: 0x%02x 0x%02x\n", 360 NV_DEBUG_KMS(dev, "\t\tstatus: 0x%02x 0x%02x\n",
361 status[0], status[1]); 361 status[0], status[1]);
362 362
363 eq_done = true; 363 eq_done = true;
@@ -395,9 +395,9 @@ stop:
395 395
396 /* retry at a lower setting, if possible */ 396 /* retry at a lower setting, if possible */
397 if (!ret && !(eq_done && cr_done)) { 397 if (!ret && !(eq_done && cr_done)) {
398 NV_DEBUG(dev, "\twe failed\n"); 398 NV_DEBUG_KMS(dev, "\twe failed\n");
399 if (nv_encoder->dp.link_bw != DP_LINK_BW_1_62) { 399 if (nv_encoder->dp.link_bw != DP_LINK_BW_1_62) {
400 NV_DEBUG(dev, "retry link training at low rate\n"); 400 NV_DEBUG_KMS(dev, "retry link training at low rate\n");
401 nv_encoder->dp.link_bw = DP_LINK_BW_1_62; 401 nv_encoder->dp.link_bw = DP_LINK_BW_1_62;
402 goto train; 402 goto train;
403 } 403 }
@@ -418,7 +418,7 @@ nouveau_dp_detect(struct drm_encoder *encoder)
418 if (ret) 418 if (ret)
419 return false; 419 return false;
420 420
421 NV_DEBUG(dev, "encoder: link_bw %d, link_nr %d\n" 421 NV_DEBUG_KMS(dev, "encoder: link_bw %d, link_nr %d\n"
422 "display: link_bw %d, link_nr %d version 0x%02x\n", 422 "display: link_bw %d, link_nr %d version 0x%02x\n",
423 nv_encoder->dcb->dpconf.link_bw, 423 nv_encoder->dcb->dpconf.link_bw,
424 nv_encoder->dcb->dpconf.link_nr, 424 nv_encoder->dcb->dpconf.link_nr,
@@ -446,7 +446,7 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
446 uint32_t tmp, ctrl, stat = 0, data32[4] = {}; 446 uint32_t tmp, ctrl, stat = 0, data32[4] = {};
447 int ret = 0, i, index = auxch->rd; 447 int ret = 0, i, index = auxch->rd;
448 448
449 NV_DEBUG(dev, "ch %d cmd %d addr 0x%x len %d\n", index, cmd, addr, data_nr); 449 NV_DEBUG_KMS(dev, "ch %d cmd %d addr 0x%x len %d\n", index, cmd, addr, data_nr);
450 450
451 tmp = nv_rd32(dev, NV50_AUXCH_CTRL(auxch->rd)); 451 tmp = nv_rd32(dev, NV50_AUXCH_CTRL(auxch->rd));
452 nv_wr32(dev, NV50_AUXCH_CTRL(auxch->rd), tmp | 0x00100000); 452 nv_wr32(dev, NV50_AUXCH_CTRL(auxch->rd), tmp | 0x00100000);
@@ -472,7 +472,7 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
472 if (!(cmd & 1)) { 472 if (!(cmd & 1)) {
473 memcpy(data32, data, data_nr); 473 memcpy(data32, data, data_nr);
474 for (i = 0; i < 4; i++) { 474 for (i = 0; i < 4; i++) {
475 NV_DEBUG(dev, "wr %d: 0x%08x\n", i, data32[i]); 475 NV_DEBUG_KMS(dev, "wr %d: 0x%08x\n", i, data32[i]);
476 nv_wr32(dev, NV50_AUXCH_DATA_OUT(index, i), data32[i]); 476 nv_wr32(dev, NV50_AUXCH_DATA_OUT(index, i), data32[i]);
477 } 477 }
478 } 478 }
@@ -504,7 +504,7 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
504 if (cmd & 1) { 504 if (cmd & 1) {
505 for (i = 0; i < 4; i++) { 505 for (i = 0; i < 4; i++) {
506 data32[i] = nv_rd32(dev, NV50_AUXCH_DATA_IN(index, i)); 506 data32[i] = nv_rd32(dev, NV50_AUXCH_DATA_IN(index, i));
507 NV_DEBUG(dev, "rd %d: 0x%08x\n", i, data32[i]); 507 NV_DEBUG_KMS(dev, "rd %d: 0x%08x\n", i, data32[i]);
508 } 508 }
509 memcpy(data, data32, data_nr); 509 memcpy(data, data32, data_nr);
510 } 510 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index 35249c35118f..06eb993e0883 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -35,6 +35,10 @@
35 35
36#include "drm_pciids.h" 36#include "drm_pciids.h"
37 37
38MODULE_PARM_DESC(ctxfw, "Use external firmware blob for grctx init (NV40)");
39int nouveau_ctxfw = 0;
40module_param_named(ctxfw, nouveau_ctxfw, int, 0400);
41
38MODULE_PARM_DESC(noagp, "Disable AGP"); 42MODULE_PARM_DESC(noagp, "Disable AGP");
39int nouveau_noagp; 43int nouveau_noagp;
40module_param_named(noagp, nouveau_noagp, int, 0400); 44module_param_named(noagp, nouveau_noagp, int, 0400);
@@ -273,7 +277,7 @@ nouveau_pci_resume(struct pci_dev *pdev)
273 277
274 for (i = 0; i < dev_priv->engine.fifo.channels; i++) { 278 for (i = 0; i < dev_priv->engine.fifo.channels; i++) {
275 chan = dev_priv->fifos[i]; 279 chan = dev_priv->fifos[i];
276 if (!chan) 280 if (!chan || !chan->pushbuf_bo)
277 continue; 281 continue;
278 282
279 for (j = 0; j < NOUVEAU_DMA_SKIPS; j++) 283 for (j = 0; j < NOUVEAU_DMA_SKIPS; j++)
@@ -341,7 +345,7 @@ static struct drm_driver driver = {
341 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
342 .open = drm_open, 346 .open = drm_open,
343 .release = drm_release, 347 .release = drm_release,
344 .ioctl = drm_ioctl, 348 .unlocked_ioctl = drm_ioctl,
345 .mmap = nouveau_ttm_mmap, 349 .mmap = nouveau_ttm_mmap,
346 .poll = drm_poll, 350 .poll = drm_poll,
347 .fasync = drm_fasync, 351 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 88b4c7b77e7f..026419fe8791 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -54,15 +54,24 @@ struct nouveau_fpriv {
54#include "nouveau_drm.h" 54#include "nouveau_drm.h"
55#include "nouveau_reg.h" 55#include "nouveau_reg.h"
56#include "nouveau_bios.h" 56#include "nouveau_bios.h"
57struct nouveau_grctx;
57 58
58#define MAX_NUM_DCB_ENTRIES 16 59#define MAX_NUM_DCB_ENTRIES 16
59 60
60#define NOUVEAU_MAX_CHANNEL_NR 128 61#define NOUVEAU_MAX_CHANNEL_NR 128
62#define NOUVEAU_MAX_TILE_NR 15
61 63
62#define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL) 64#define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL)
63#define NV50_VM_BLOCK (512*1024*1024ULL) 65#define NV50_VM_BLOCK (512*1024*1024ULL)
64#define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK) 66#define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK)
65 67
68struct nouveau_tile_reg {
69 struct nouveau_fence *fence;
70 uint32_t addr;
71 uint32_t size;
72 bool used;
73};
74
66struct nouveau_bo { 75struct nouveau_bo {
67 struct ttm_buffer_object bo; 76 struct ttm_buffer_object bo;
68 struct ttm_placement placement; 77 struct ttm_placement placement;
@@ -82,6 +91,7 @@ struct nouveau_bo {
82 91
83 uint32_t tile_mode; 92 uint32_t tile_mode;
84 uint32_t tile_flags; 93 uint32_t tile_flags;
94 struct nouveau_tile_reg *tile;
85 95
86 struct drm_gem_object *gem; 96 struct drm_gem_object *gem;
87 struct drm_file *cpu_filp; 97 struct drm_file *cpu_filp;
@@ -276,8 +286,13 @@ struct nouveau_timer_engine {
276}; 286};
277 287
278struct nouveau_fb_engine { 288struct nouveau_fb_engine {
289 int num_tiles;
290
279 int (*init)(struct drm_device *dev); 291 int (*init)(struct drm_device *dev);
280 void (*takedown)(struct drm_device *dev); 292 void (*takedown)(struct drm_device *dev);
293
294 void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr,
295 uint32_t size, uint32_t pitch);
281}; 296};
282 297
283struct nouveau_fifo_engine { 298struct nouveau_fifo_engine {
@@ -291,6 +306,8 @@ struct nouveau_fifo_engine {
291 void (*disable)(struct drm_device *); 306 void (*disable)(struct drm_device *);
292 void (*enable)(struct drm_device *); 307 void (*enable)(struct drm_device *);
293 bool (*reassign)(struct drm_device *, bool enable); 308 bool (*reassign)(struct drm_device *, bool enable);
309 bool (*cache_flush)(struct drm_device *dev);
310 bool (*cache_pull)(struct drm_device *dev, bool enable);
294 311
295 int (*channel_id)(struct drm_device *); 312 int (*channel_id)(struct drm_device *);
296 313
@@ -317,6 +334,7 @@ struct nouveau_pgraph_engine {
317 bool accel_blocked; 334 bool accel_blocked;
318 void *ctxprog; 335 void *ctxprog;
319 void *ctxvals; 336 void *ctxvals;
337 int grctx_size;
320 338
321 int (*init)(struct drm_device *); 339 int (*init)(struct drm_device *);
322 void (*takedown)(struct drm_device *); 340 void (*takedown)(struct drm_device *);
@@ -328,6 +346,9 @@ struct nouveau_pgraph_engine {
328 void (*destroy_context)(struct nouveau_channel *); 346 void (*destroy_context)(struct nouveau_channel *);
329 int (*load_context)(struct nouveau_channel *); 347 int (*load_context)(struct nouveau_channel *);
330 int (*unload_context)(struct drm_device *); 348 int (*unload_context)(struct drm_device *);
349
350 void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr,
351 uint32_t size, uint32_t pitch);
331}; 352};
332 353
333struct nouveau_engine { 354struct nouveau_engine {
@@ -546,6 +567,12 @@ struct drm_nouveau_private {
546 unsigned long sg_handle; 567 unsigned long sg_handle;
547 } gart_info; 568 } gart_info;
548 569
570 /* nv10-nv40 tiling regions */
571 struct {
572 struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR];
573 spinlock_t lock;
574 } tile;
575
549 /* G8x/G9x virtual address space */ 576 /* G8x/G9x virtual address space */
550 uint64_t vm_gart_base; 577 uint64_t vm_gart_base;
551 uint64_t vm_gart_size; 578 uint64_t vm_gart_size;
@@ -647,6 +674,7 @@ extern int nouveau_fbpercrtc;
647extern char *nouveau_tv_norm; 674extern char *nouveau_tv_norm;
648extern int nouveau_reg_debug; 675extern int nouveau_reg_debug;
649extern char *nouveau_vbios; 676extern char *nouveau_vbios;
677extern int nouveau_ctxfw;
650 678
651/* nouveau_state.c */ 679/* nouveau_state.c */
652extern void nouveau_preclose(struct drm_device *dev, struct drm_file *); 680extern void nouveau_preclose(struct drm_device *dev, struct drm_file *);
@@ -682,6 +710,13 @@ extern void nouveau_mem_release(struct drm_file *, struct mem_block *heap);
682extern int nouveau_mem_init(struct drm_device *); 710extern int nouveau_mem_init(struct drm_device *);
683extern int nouveau_mem_init_agp(struct drm_device *); 711extern int nouveau_mem_init_agp(struct drm_device *);
684extern void nouveau_mem_close(struct drm_device *); 712extern void nouveau_mem_close(struct drm_device *);
713extern struct nouveau_tile_reg *nv10_mem_set_tiling(struct drm_device *dev,
714 uint32_t addr,
715 uint32_t size,
716 uint32_t pitch);
717extern void nv10_mem_expire_tiling(struct drm_device *dev,
718 struct nouveau_tile_reg *tile,
719 struct nouveau_fence *fence);
685extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, 720extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt,
686 uint32_t size, uint32_t flags, 721 uint32_t size, uint32_t flags,
687 uint64_t phys); 722 uint64_t phys);
@@ -710,7 +745,6 @@ extern int nouveau_channel_alloc(struct drm_device *dev,
710 struct drm_file *file_priv, 745 struct drm_file *file_priv,
711 uint32_t fb_ctxdma, uint32_t tt_ctxdma); 746 uint32_t fb_ctxdma, uint32_t tt_ctxdma);
712extern void nouveau_channel_free(struct nouveau_channel *); 747extern void nouveau_channel_free(struct nouveau_channel *);
713extern int nouveau_channel_idle(struct nouveau_channel *chan);
714 748
715/* nouveau_object.c */ 749/* nouveau_object.c */
716extern int nouveau_gpuobj_early_init(struct drm_device *); 750extern int nouveau_gpuobj_early_init(struct drm_device *);
@@ -753,6 +787,8 @@ extern int nouveau_gpuobj_gart_dma_new(struct nouveau_channel *,
753 uint32_t *o_ret); 787 uint32_t *o_ret);
754extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, 788extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class,
755 struct nouveau_gpuobj **); 789 struct nouveau_gpuobj **);
790extern int nouveau_gpuobj_sw_new(struct nouveau_channel *, int class,
791 struct nouveau_gpuobj **);
756extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, 792extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data,
757 struct drm_file *); 793 struct drm_file *);
758extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, 794extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data,
@@ -801,6 +837,7 @@ nouveau_debugfs_channel_fini(struct nouveau_channel *chan)
801#endif 837#endif
802 838
803/* nouveau_dma.c */ 839/* nouveau_dma.c */
840extern void nouveau_dma_pre_init(struct nouveau_channel *);
804extern int nouveau_dma_init(struct nouveau_channel *); 841extern int nouveau_dma_init(struct nouveau_channel *);
805extern int nouveau_dma_wait(struct nouveau_channel *, int size); 842extern int nouveau_dma_wait(struct nouveau_channel *, int size);
806 843
@@ -876,16 +913,22 @@ extern void nv04_fb_takedown(struct drm_device *);
876/* nv10_fb.c */ 913/* nv10_fb.c */
877extern int nv10_fb_init(struct drm_device *); 914extern int nv10_fb_init(struct drm_device *);
878extern void nv10_fb_takedown(struct drm_device *); 915extern void nv10_fb_takedown(struct drm_device *);
916extern void nv10_fb_set_region_tiling(struct drm_device *, int, uint32_t,
917 uint32_t, uint32_t);
879 918
880/* nv40_fb.c */ 919/* nv40_fb.c */
881extern int nv40_fb_init(struct drm_device *); 920extern int nv40_fb_init(struct drm_device *);
882extern void nv40_fb_takedown(struct drm_device *); 921extern void nv40_fb_takedown(struct drm_device *);
922extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t,
923 uint32_t, uint32_t);
883 924
884/* nv04_fifo.c */ 925/* nv04_fifo.c */
885extern int nv04_fifo_init(struct drm_device *); 926extern int nv04_fifo_init(struct drm_device *);
886extern void nv04_fifo_disable(struct drm_device *); 927extern void nv04_fifo_disable(struct drm_device *);
887extern void nv04_fifo_enable(struct drm_device *); 928extern void nv04_fifo_enable(struct drm_device *);
888extern bool nv04_fifo_reassign(struct drm_device *, bool); 929extern bool nv04_fifo_reassign(struct drm_device *, bool);
930extern bool nv04_fifo_cache_flush(struct drm_device *);
931extern bool nv04_fifo_cache_pull(struct drm_device *, bool);
889extern int nv04_fifo_channel_id(struct drm_device *); 932extern int nv04_fifo_channel_id(struct drm_device *);
890extern int nv04_fifo_create_context(struct nouveau_channel *); 933extern int nv04_fifo_create_context(struct nouveau_channel *);
891extern void nv04_fifo_destroy_context(struct nouveau_channel *); 934extern void nv04_fifo_destroy_context(struct nouveau_channel *);
@@ -938,6 +981,8 @@ extern void nv10_graph_destroy_context(struct nouveau_channel *);
938extern int nv10_graph_load_context(struct nouveau_channel *); 981extern int nv10_graph_load_context(struct nouveau_channel *);
939extern int nv10_graph_unload_context(struct drm_device *); 982extern int nv10_graph_unload_context(struct drm_device *);
940extern void nv10_graph_context_switch(struct drm_device *); 983extern void nv10_graph_context_switch(struct drm_device *);
984extern void nv10_graph_set_region_tiling(struct drm_device *, int, uint32_t,
985 uint32_t, uint32_t);
941 986
942/* nv20_graph.c */ 987/* nv20_graph.c */
943extern struct nouveau_pgraph_object_class nv20_graph_grclass[]; 988extern struct nouveau_pgraph_object_class nv20_graph_grclass[];
@@ -949,6 +994,8 @@ extern int nv20_graph_unload_context(struct drm_device *);
949extern int nv20_graph_init(struct drm_device *); 994extern int nv20_graph_init(struct drm_device *);
950extern void nv20_graph_takedown(struct drm_device *); 995extern void nv20_graph_takedown(struct drm_device *);
951extern int nv30_graph_init(struct drm_device *); 996extern int nv30_graph_init(struct drm_device *);
997extern void nv20_graph_set_region_tiling(struct drm_device *, int, uint32_t,
998 uint32_t, uint32_t);
952 999
953/* nv40_graph.c */ 1000/* nv40_graph.c */
954extern struct nouveau_pgraph_object_class nv40_graph_grclass[]; 1001extern struct nouveau_pgraph_object_class nv40_graph_grclass[];
@@ -959,9 +1006,9 @@ extern int nv40_graph_create_context(struct nouveau_channel *);
959extern void nv40_graph_destroy_context(struct nouveau_channel *); 1006extern void nv40_graph_destroy_context(struct nouveau_channel *);
960extern int nv40_graph_load_context(struct nouveau_channel *); 1007extern int nv40_graph_load_context(struct nouveau_channel *);
961extern int nv40_graph_unload_context(struct drm_device *); 1008extern int nv40_graph_unload_context(struct drm_device *);
962extern int nv40_grctx_init(struct drm_device *); 1009extern void nv40_grctx_init(struct nouveau_grctx *);
963extern void nv40_grctx_fini(struct drm_device *); 1010extern void nv40_graph_set_region_tiling(struct drm_device *, int, uint32_t,
964extern void nv40_grctx_vals_load(struct drm_device *, struct nouveau_gpuobj *); 1011 uint32_t, uint32_t);
965 1012
966/* nv50_graph.c */ 1013/* nv50_graph.c */
967extern struct nouveau_pgraph_object_class nv50_graph_grclass[]; 1014extern struct nouveau_pgraph_object_class nv50_graph_grclass[];
@@ -975,6 +1022,12 @@ extern int nv50_graph_load_context(struct nouveau_channel *);
975extern int nv50_graph_unload_context(struct drm_device *); 1022extern int nv50_graph_unload_context(struct drm_device *);
976extern void nv50_graph_context_switch(struct drm_device *); 1023extern void nv50_graph_context_switch(struct drm_device *);
977 1024
1025/* nouveau_grctx.c */
1026extern int nouveau_grctx_prog_load(struct drm_device *);
1027extern void nouveau_grctx_vals_load(struct drm_device *,
1028 struct nouveau_gpuobj *);
1029extern void nouveau_grctx_fini(struct drm_device *);
1030
978/* nv04_instmem.c */ 1031/* nv04_instmem.c */
979extern int nv04_instmem_init(struct drm_device *); 1032extern int nv04_instmem_init(struct drm_device *);
980extern void nv04_instmem_takedown(struct drm_device *); 1033extern void nv04_instmem_takedown(struct drm_device *);
@@ -1023,8 +1076,7 @@ extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd,
1023 1076
1024/* nv04_dac.c */ 1077/* nv04_dac.c */
1025extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry); 1078extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry);
1026extern enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, 1079extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder);
1027 struct drm_connector *connector);
1028extern int nv04_dac_output_offset(struct drm_encoder *encoder); 1080extern int nv04_dac_output_offset(struct drm_encoder *encoder);
1029extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable); 1081extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable);
1030 1082
@@ -1042,9 +1094,6 @@ extern int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry);
1042 1094
1043/* nv17_tv.c */ 1095/* nv17_tv.c */
1044extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry); 1096extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry);
1045extern enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder,
1046 struct drm_connector *connector,
1047 uint32_t pin_mask);
1048 1097
1049/* nv04_display.c */ 1098/* nv04_display.c */
1050extern int nv04_display_create(struct drm_device *); 1099extern int nv04_display_create(struct drm_device *);
@@ -1207,14 +1256,24 @@ static inline void nv_wo32(struct drm_device *dev, struct nouveau_gpuobj *obj,
1207 pci_name(d->pdev), ##arg) 1256 pci_name(d->pdev), ##arg)
1208#ifndef NV_DEBUG_NOTRACE 1257#ifndef NV_DEBUG_NOTRACE
1209#define NV_DEBUG(d, fmt, arg...) do { \ 1258#define NV_DEBUG(d, fmt, arg...) do { \
1210 if (drm_debug) { \ 1259 if (drm_debug & DRM_UT_DRIVER) { \
1260 NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \
1261 __LINE__, ##arg); \
1262 } \
1263} while (0)
1264#define NV_DEBUG_KMS(d, fmt, arg...) do { \
1265 if (drm_debug & DRM_UT_KMS) { \
1211 NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \ 1266 NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \
1212 __LINE__, ##arg); \ 1267 __LINE__, ##arg); \
1213 } \ 1268 } \
1214} while (0) 1269} while (0)
1215#else 1270#else
1216#define NV_DEBUG(d, fmt, arg...) do { \ 1271#define NV_DEBUG(d, fmt, arg...) do { \
1217 if (drm_debug) \ 1272 if (drm_debug & DRM_UT_DRIVER) \
1273 NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \
1274} while (0)
1275#define NV_DEBUG_KMS(d, fmt, arg...) do { \
1276 if (drm_debug & DRM_UT_KMS) \
1218 NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \ 1277 NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \
1219} while (0) 1278} while (0)
1220#endif 1279#endif
@@ -1273,14 +1332,14 @@ nv_two_reg_pll(struct drm_device *dev)
1273 return false; 1332 return false;
1274} 1333}
1275 1334
1276#define NV50_NVSW 0x0000506e 1335#define NV_SW 0x0000506e
1277#define NV50_NVSW_DMA_SEMAPHORE 0x00000060 1336#define NV_SW_DMA_SEMAPHORE 0x00000060
1278#define NV50_NVSW_SEMAPHORE_OFFSET 0x00000064 1337#define NV_SW_SEMAPHORE_OFFSET 0x00000064
1279#define NV50_NVSW_SEMAPHORE_ACQUIRE 0x00000068 1338#define NV_SW_SEMAPHORE_ACQUIRE 0x00000068
1280#define NV50_NVSW_SEMAPHORE_RELEASE 0x0000006c 1339#define NV_SW_SEMAPHORE_RELEASE 0x0000006c
1281#define NV50_NVSW_DMA_VBLSEM 0x0000018c 1340#define NV_SW_DMA_VBLSEM 0x0000018c
1282#define NV50_NVSW_VBLSEM_OFFSET 0x00000400 1341#define NV_SW_VBLSEM_OFFSET 0x00000400
1283#define NV50_NVSW_VBLSEM_RELEASE_VALUE 0x00000404 1342#define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404
1284#define NV50_NVSW_VBLSEM_RELEASE 0x00000408 1343#define NV_SW_VBLSEM_RELEASE 0x00000408
1285 1344
1286#endif /* __NOUVEAU_DRV_H__ */ 1345#endif /* __NOUVEAU_DRV_H__ */
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 36e8c5e4503a..0b05c869e0e7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -58,14 +58,13 @@ nouveau_fbcon_sync(struct fb_info *info)
58 struct nouveau_channel *chan = dev_priv->channel; 58 struct nouveau_channel *chan = dev_priv->channel;
59 int ret, i; 59 int ret, i;
60 60
61 if (!chan->accel_done || 61 if (!chan || !chan->accel_done ||
62 info->state != FBINFO_STATE_RUNNING || 62 info->state != FBINFO_STATE_RUNNING ||
63 info->flags & FBINFO_HWACCEL_DISABLED) 63 info->flags & FBINFO_HWACCEL_DISABLED)
64 return 0; 64 return 0;
65 65
66 if (RING_SPACE(chan, 4)) { 66 if (RING_SPACE(chan, 4)) {
67 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 67 nouveau_fbcon_gpu_lockup(info);
68 info->flags |= FBINFO_HWACCEL_DISABLED;
69 return 0; 68 return 0;
70 } 69 }
71 70
@@ -86,8 +85,7 @@ nouveau_fbcon_sync(struct fb_info *info)
86 } 85 }
87 86
88 if (ret) { 87 if (ret) {
89 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 88 nouveau_fbcon_gpu_lockup(info);
90 info->flags |= FBINFO_HWACCEL_DISABLED;
91 return 0; 89 return 0;
92 } 90 }
93 91
@@ -212,11 +210,11 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width,
212 210
213 mode_cmd.bpp = surface_bpp; 211 mode_cmd.bpp = surface_bpp;
214 mode_cmd.pitch = mode_cmd.width * (mode_cmd.bpp >> 3); 212 mode_cmd.pitch = mode_cmd.width * (mode_cmd.bpp >> 3);
215 mode_cmd.pitch = ALIGN(mode_cmd.pitch, 256); 213 mode_cmd.pitch = roundup(mode_cmd.pitch, 256);
216 mode_cmd.depth = surface_depth; 214 mode_cmd.depth = surface_depth;
217 215
218 size = mode_cmd.pitch * mode_cmd.height; 216 size = mode_cmd.pitch * mode_cmd.height;
219 size = ALIGN(size, PAGE_SIZE); 217 size = roundup(size, PAGE_SIZE);
220 218
221 ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM, 219 ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM,
222 0, 0x0000, false, true, &nvbo); 220 0, 0x0000, false, true, &nvbo);
@@ -318,14 +316,16 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width,
318 par->nouveau_fb = nouveau_fb; 316 par->nouveau_fb = nouveau_fb;
319 par->dev = dev; 317 par->dev = dev;
320 318
321 switch (dev_priv->card_type) { 319 if (dev_priv->channel) {
322 case NV_50: 320 switch (dev_priv->card_type) {
323 nv50_fbcon_accel_init(info); 321 case NV_50:
324 break; 322 nv50_fbcon_accel_init(info);
325 default: 323 break;
326 nv04_fbcon_accel_init(info); 324 default:
327 break; 325 nv04_fbcon_accel_init(info);
328 }; 326 break;
327 };
328 }
329 329
330 nouveau_fbcon_zfill(dev); 330 nouveau_fbcon_zfill(dev);
331 331
@@ -347,7 +347,7 @@ out:
347int 347int
348nouveau_fbcon_probe(struct drm_device *dev) 348nouveau_fbcon_probe(struct drm_device *dev)
349{ 349{
350 NV_DEBUG(dev, "\n"); 350 NV_DEBUG_KMS(dev, "\n");
351 351
352 return drm_fb_helper_single_fb_probe(dev, 32, nouveau_fbcon_create); 352 return drm_fb_helper_single_fb_probe(dev, 32, nouveau_fbcon_create);
353} 353}
@@ -378,3 +378,12 @@ nouveau_fbcon_remove(struct drm_device *dev, struct drm_framebuffer *fb)
378 378
379 return 0; 379 return 0;
380} 380}
381
382void nouveau_fbcon_gpu_lockup(struct fb_info *info)
383{
384 struct nouveau_fbcon_par *par = info->par;
385 struct drm_device *dev = par->dev;
386
387 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n");
388 info->flags |= FBINFO_HWACCEL_DISABLED;
389}
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
index 8531140fedbc..462e0b87b4bd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h
@@ -43,5 +43,6 @@ void nouveau_fbcon_zfill(struct drm_device *dev);
43int nv04_fbcon_accel_init(struct fb_info *info); 43int nv04_fbcon_accel_init(struct fb_info *info);
44int nv50_fbcon_accel_init(struct fb_info *info); 44int nv50_fbcon_accel_init(struct fb_info *info);
45 45
46void nouveau_fbcon_gpu_lockup(struct fb_info *info);
46#endif /* __NV50_FBCON_H__ */ 47#endif /* __NV50_FBCON_H__ */
47 48
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index dacac9a0842a..faddf53ff9ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -142,7 +142,7 @@ nouveau_fence_emit(struct nouveau_fence *fence)
142 list_add_tail(&fence->entry, &chan->fence.pending); 142 list_add_tail(&fence->entry, &chan->fence.pending);
143 spin_unlock_irqrestore(&chan->fence.lock, flags); 143 spin_unlock_irqrestore(&chan->fence.lock, flags);
144 144
145 BEGIN_RING(chan, NvSubM2MF, USE_REFCNT ? 0x0050 : 0x0150, 1); 145 BEGIN_RING(chan, NvSubSw, USE_REFCNT ? 0x0050 : 0x0150, 1);
146 OUT_RING(chan, fence->sequence); 146 OUT_RING(chan, fence->sequence);
147 FIRE_RING(chan); 147 FIRE_RING(chan);
148 148
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 18fd8ac9fca7..2009db2426c3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -220,7 +220,6 @@ nouveau_gem_set_domain(struct drm_gem_object *gem, uint32_t read_domains,
220} 220}
221 221
222struct validate_op { 222struct validate_op {
223 struct nouveau_fence *fence;
224 struct list_head vram_list; 223 struct list_head vram_list;
225 struct list_head gart_list; 224 struct list_head gart_list;
226 struct list_head both_list; 225 struct list_head both_list;
@@ -252,17 +251,11 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence)
252} 251}
253 252
254static void 253static void
255validate_fini(struct validate_op *op, bool success) 254validate_fini(struct validate_op *op, struct nouveau_fence* fence)
256{ 255{
257 struct nouveau_fence *fence = op->fence; 256 validate_fini_list(&op->vram_list, fence);
258 257 validate_fini_list(&op->gart_list, fence);
259 if (unlikely(!success)) 258 validate_fini_list(&op->both_list, fence);
260 op->fence = NULL;
261
262 validate_fini_list(&op->vram_list, op->fence);
263 validate_fini_list(&op->gart_list, op->fence);
264 validate_fini_list(&op->both_list, op->fence);
265 nouveau_fence_unref((void *)&fence);
266} 259}
267 260
268static int 261static int
@@ -420,10 +413,6 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan,
420 INIT_LIST_HEAD(&op->gart_list); 413 INIT_LIST_HEAD(&op->gart_list);
421 INIT_LIST_HEAD(&op->both_list); 414 INIT_LIST_HEAD(&op->both_list);
422 415
423 ret = nouveau_fence_new(chan, &op->fence, false);
424 if (ret)
425 return ret;
426
427 if (nr_buffers == 0) 416 if (nr_buffers == 0)
428 return 0; 417 return 0;
429 418
@@ -541,6 +530,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
541 struct drm_nouveau_gem_pushbuf_bo *bo = NULL; 530 struct drm_nouveau_gem_pushbuf_bo *bo = NULL;
542 struct nouveau_channel *chan; 531 struct nouveau_channel *chan;
543 struct validate_op op; 532 struct validate_op op;
533 struct nouveau_fence* fence = 0;
544 uint32_t *pushbuf = NULL; 534 uint32_t *pushbuf = NULL;
545 int ret = 0, do_reloc = 0, i; 535 int ret = 0, do_reloc = 0, i;
546 536
@@ -597,7 +587,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
597 587
598 OUT_RINGp(chan, pushbuf, req->nr_dwords); 588 OUT_RINGp(chan, pushbuf, req->nr_dwords);
599 589
600 ret = nouveau_fence_emit(op.fence); 590 ret = nouveau_fence_new(chan, &fence, true);
601 if (ret) { 591 if (ret) {
602 NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); 592 NV_ERROR(dev, "error fencing pushbuf: %d\n", ret);
603 WIND_RING(chan); 593 WIND_RING(chan);
@@ -605,7 +595,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
605 } 595 }
606 596
607 if (nouveau_gem_pushbuf_sync(chan)) { 597 if (nouveau_gem_pushbuf_sync(chan)) {
608 ret = nouveau_fence_wait(op.fence, NULL, false, false); 598 ret = nouveau_fence_wait(fence, NULL, false, false);
609 if (ret) { 599 if (ret) {
610 for (i = 0; i < req->nr_dwords; i++) 600 for (i = 0; i < req->nr_dwords; i++)
611 NV_ERROR(dev, "0x%08x\n", pushbuf[i]); 601 NV_ERROR(dev, "0x%08x\n", pushbuf[i]);
@@ -614,7 +604,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
614 } 604 }
615 605
616out: 606out:
617 validate_fini(&op, ret == 0); 607 validate_fini(&op, fence);
608 nouveau_fence_unref((void**)&fence);
618 mutex_unlock(&dev->struct_mutex); 609 mutex_unlock(&dev->struct_mutex);
619 kfree(pushbuf); 610 kfree(pushbuf);
620 kfree(bo); 611 kfree(bo);
@@ -634,6 +625,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
634 struct drm_gem_object *gem; 625 struct drm_gem_object *gem;
635 struct nouveau_bo *pbbo; 626 struct nouveau_bo *pbbo;
636 struct validate_op op; 627 struct validate_op op;
628 struct nouveau_fence* fence = 0;
637 int i, ret = 0, do_reloc = 0; 629 int i, ret = 0, do_reloc = 0;
638 630
639 NOUVEAU_CHECK_INITIALISED_WITH_RETURN; 631 NOUVEAU_CHECK_INITIALISED_WITH_RETURN;
@@ -772,7 +764,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
772 OUT_RING(chan, 0); 764 OUT_RING(chan, 0);
773 } 765 }
774 766
775 ret = nouveau_fence_emit(op.fence); 767 ret = nouveau_fence_new(chan, &fence, true);
776 if (ret) { 768 if (ret) {
777 NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); 769 NV_ERROR(dev, "error fencing pushbuf: %d\n", ret);
778 WIND_RING(chan); 770 WIND_RING(chan);
@@ -780,7 +772,8 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data,
780 } 772 }
781 773
782out: 774out:
783 validate_fini(&op, ret == 0); 775 validate_fini(&op, fence);
776 nouveau_fence_unref((void**)&fence);
784 mutex_unlock(&dev->struct_mutex); 777 mutex_unlock(&dev->struct_mutex);
785 kfree(bo); 778 kfree(bo);
786 779
diff --git a/drivers/gpu/drm/nouveau/nouveau_grctx.c b/drivers/gpu/drm/nouveau/nouveau_grctx.c
new file mode 100644
index 000000000000..419f4c2b3b89
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_grctx.c
@@ -0,0 +1,161 @@
1/*
2 * Copyright 2009 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25#include <linux/firmware.h>
26
27#include "drmP.h"
28#include "nouveau_drv.h"
29
30struct nouveau_ctxprog {
31 uint32_t signature;
32 uint8_t version;
33 uint16_t length;
34 uint32_t data[];
35} __attribute__ ((packed));
36
37struct nouveau_ctxvals {
38 uint32_t signature;
39 uint8_t version;
40 uint32_t length;
41 struct {
42 uint32_t offset;
43 uint32_t value;
44 } data[];
45} __attribute__ ((packed));
46
47int
48nouveau_grctx_prog_load(struct drm_device *dev)
49{
50 struct drm_nouveau_private *dev_priv = dev->dev_private;
51 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
52 const int chipset = dev_priv->chipset;
53 const struct firmware *fw;
54 const struct nouveau_ctxprog *cp;
55 const struct nouveau_ctxvals *cv;
56 char name[32];
57 int ret, i;
58
59 if (pgraph->accel_blocked)
60 return -ENODEV;
61
62 if (!pgraph->ctxprog) {
63 sprintf(name, "nouveau/nv%02x.ctxprog", chipset);
64 ret = request_firmware(&fw, name, &dev->pdev->dev);
65 if (ret) {
66 NV_ERROR(dev, "No ctxprog for NV%02x\n", chipset);
67 return ret;
68 }
69
70 pgraph->ctxprog = kmalloc(fw->size, GFP_KERNEL);
71 if (!pgraph->ctxprog) {
72 NV_ERROR(dev, "OOM copying ctxprog\n");
73 release_firmware(fw);
74 return -ENOMEM;
75 }
76 memcpy(pgraph->ctxprog, fw->data, fw->size);
77
78 cp = pgraph->ctxprog;
79 if (le32_to_cpu(cp->signature) != 0x5043564e ||
80 cp->version != 0 ||
81 le16_to_cpu(cp->length) != ((fw->size - 7) / 4)) {
82 NV_ERROR(dev, "ctxprog invalid\n");
83 release_firmware(fw);
84 nouveau_grctx_fini(dev);
85 return -EINVAL;
86 }
87 release_firmware(fw);
88 }
89
90 if (!pgraph->ctxvals) {
91 sprintf(name, "nouveau/nv%02x.ctxvals", chipset);
92 ret = request_firmware(&fw, name, &dev->pdev->dev);
93 if (ret) {
94 NV_ERROR(dev, "No ctxvals for NV%02x\n", chipset);
95 nouveau_grctx_fini(dev);
96 return ret;
97 }
98
99 pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL);
100 if (!pgraph->ctxprog) {
101 NV_ERROR(dev, "OOM copying ctxprog\n");
102 release_firmware(fw);
103 nouveau_grctx_fini(dev);
104 return -ENOMEM;
105 }
106 memcpy(pgraph->ctxvals, fw->data, fw->size);
107
108 cv = (void *)pgraph->ctxvals;
109 if (le32_to_cpu(cv->signature) != 0x5643564e ||
110 cv->version != 0 ||
111 le32_to_cpu(cv->length) != ((fw->size - 9) / 8)) {
112 NV_ERROR(dev, "ctxvals invalid\n");
113 release_firmware(fw);
114 nouveau_grctx_fini(dev);
115 return -EINVAL;
116 }
117 release_firmware(fw);
118 }
119
120 cp = pgraph->ctxprog;
121
122 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
123 for (i = 0; i < le16_to_cpu(cp->length); i++)
124 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA,
125 le32_to_cpu(cp->data[i]));
126
127 return 0;
128}
129
130void
131nouveau_grctx_fini(struct drm_device *dev)
132{
133 struct drm_nouveau_private *dev_priv = dev->dev_private;
134 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
135
136 if (pgraph->ctxprog) {
137 kfree(pgraph->ctxprog);
138 pgraph->ctxprog = NULL;
139 }
140
141 if (pgraph->ctxvals) {
142 kfree(pgraph->ctxprog);
143 pgraph->ctxvals = NULL;
144 }
145}
146
147void
148nouveau_grctx_vals_load(struct drm_device *dev, struct nouveau_gpuobj *ctx)
149{
150 struct drm_nouveau_private *dev_priv = dev->dev_private;
151 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
152 struct nouveau_ctxvals *cv = pgraph->ctxvals;
153 int i;
154
155 if (!cv)
156 return;
157
158 for (i = 0; i < le32_to_cpu(cv->length); i++)
159 nv_wo32(dev, ctx, le32_to_cpu(cv->data[i].offset),
160 le32_to_cpu(cv->data[i].value));
161}
diff --git a/drivers/gpu/drm/nouveau/nouveau_grctx.h b/drivers/gpu/drm/nouveau/nouveau_grctx.h
new file mode 100644
index 000000000000..5d39c4ce8006
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_grctx.h
@@ -0,0 +1,133 @@
1#ifndef __NOUVEAU_GRCTX_H__
2#define __NOUVEAU_GRCTX_H__
3
4struct nouveau_grctx {
5 struct drm_device *dev;
6
7 enum {
8 NOUVEAU_GRCTX_PROG,
9 NOUVEAU_GRCTX_VALS
10 } mode;
11 void *data;
12
13 uint32_t ctxprog_max;
14 uint32_t ctxprog_len;
15 uint32_t ctxprog_reg;
16 int ctxprog_label[32];
17 uint32_t ctxvals_pos;
18 uint32_t ctxvals_base;
19};
20
21#ifdef CP_CTX
22static inline void
23cp_out(struct nouveau_grctx *ctx, uint32_t inst)
24{
25 uint32_t *ctxprog = ctx->data;
26
27 if (ctx->mode != NOUVEAU_GRCTX_PROG)
28 return;
29
30 BUG_ON(ctx->ctxprog_len == ctx->ctxprog_max);
31 ctxprog[ctx->ctxprog_len++] = inst;
32}
33
34static inline void
35cp_lsr(struct nouveau_grctx *ctx, uint32_t val)
36{
37 cp_out(ctx, CP_LOAD_SR | val);
38}
39
40static inline void
41cp_ctx(struct nouveau_grctx *ctx, uint32_t reg, uint32_t length)
42{
43 ctx->ctxprog_reg = (reg - 0x00400000) >> 2;
44
45 ctx->ctxvals_base = ctx->ctxvals_pos;
46 ctx->ctxvals_pos = ctx->ctxvals_base + length;
47
48 if (length > (CP_CTX_COUNT >> CP_CTX_COUNT_SHIFT)) {
49 cp_lsr(ctx, length);
50 length = 0;
51 }
52
53 cp_out(ctx, CP_CTX | (length << CP_CTX_COUNT_SHIFT) | ctx->ctxprog_reg);
54}
55
56static inline void
57cp_name(struct nouveau_grctx *ctx, int name)
58{
59 uint32_t *ctxprog = ctx->data;
60 int i;
61
62 if (ctx->mode != NOUVEAU_GRCTX_PROG)
63 return;
64
65 ctx->ctxprog_label[name] = ctx->ctxprog_len;
66 for (i = 0; i < ctx->ctxprog_len; i++) {
67 if ((ctxprog[i] & 0xfff00000) != 0xff400000)
68 continue;
69 if ((ctxprog[i] & CP_BRA_IP) != ((name) << CP_BRA_IP_SHIFT))
70 continue;
71 ctxprog[i] = (ctxprog[i] & 0x00ff00ff) |
72 (ctx->ctxprog_len << CP_BRA_IP_SHIFT);
73 }
74}
75
76static inline void
77_cp_bra(struct nouveau_grctx *ctx, u32 mod, int flag, int state, int name)
78{
79 int ip = 0;
80
81 if (mod != 2) {
82 ip = ctx->ctxprog_label[name] << CP_BRA_IP_SHIFT;
83 if (ip == 0)
84 ip = 0xff000000 | (name << CP_BRA_IP_SHIFT);
85 }
86
87 cp_out(ctx, CP_BRA | (mod << 18) | ip | flag |
88 (state ? 0 : CP_BRA_IF_CLEAR));
89}
90#define cp_bra(c,f,s,n) _cp_bra((c), 0, CP_FLAG_##f, CP_FLAG_##f##_##s, n)
91#ifdef CP_BRA_MOD
92#define cp_cal(c,f,s,n) _cp_bra((c), 1, CP_FLAG_##f, CP_FLAG_##f##_##s, n)
93#define cp_ret(c,f,s) _cp_bra((c), 2, CP_FLAG_##f, CP_FLAG_##f##_##s, 0)
94#endif
95
96static inline void
97_cp_wait(struct nouveau_grctx *ctx, int flag, int state)
98{
99 cp_out(ctx, CP_WAIT | flag | (state ? CP_WAIT_SET : 0));
100}
101#define cp_wait(c,f,s) _cp_wait((c), CP_FLAG_##f, CP_FLAG_##f##_##s)
102
103static inline void
104_cp_set(struct nouveau_grctx *ctx, int flag, int state)
105{
106 cp_out(ctx, CP_SET | flag | (state ? CP_SET_1 : 0));
107}
108#define cp_set(c,f,s) _cp_set((c), CP_FLAG_##f, CP_FLAG_##f##_##s)
109
110static inline void
111cp_pos(struct nouveau_grctx *ctx, int offset)
112{
113 ctx->ctxvals_pos = offset;
114 ctx->ctxvals_base = ctx->ctxvals_pos;
115
116 cp_lsr(ctx, ctx->ctxvals_pos);
117 cp_out(ctx, CP_SET_CONTEXT_POINTER);
118}
119
120static inline void
121gr_def(struct nouveau_grctx *ctx, uint32_t reg, uint32_t val)
122{
123 if (ctx->mode != NOUVEAU_GRCTX_VALS)
124 return;
125
126 reg = (reg - 0x00400000) / 4;
127 reg = (reg - ctx->ctxprog_reg) + ctx->ctxvals_base;
128
129 nv_wo32(ctx->dev, ctx->data, reg, val);
130}
131#endif
132
133#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_ioc32.c b/drivers/gpu/drm/nouveau/nouveau_ioc32.c
index a2c30f4611ba..475ba810bba3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ioc32.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ioc32.c
@@ -61,12 +61,10 @@ long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,
61 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) 61 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls))
62 fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE]; 62 fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE];
63#endif 63#endif
64 lock_kernel(); /* XXX for now */
65 if (fn != NULL) 64 if (fn != NULL)
66 ret = (*fn)(filp, cmd, arg); 65 ret = (*fn)(filp, cmd, arg);
67 else 66 else
68 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); 67 ret = drm_ioctl(filp, cmd, arg);
69 unlock_kernel();
70 68
71 return ret; 69 return ret;
72} 70}
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 370c72c968d1..919a619ca7fa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -635,6 +635,7 @@ nv50_pgraph_irq_handler(struct drm_device *dev)
635 635
636 if ((nv_rd32(dev, 0x400500) & isb) != isb) 636 if ((nv_rd32(dev, 0x400500) & isb) != isb)
637 nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb); 637 nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb);
638 nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31));
638 } 639 }
639 640
640 nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); 641 nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING);
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 5158a12f7844..fb9bdd6edf1f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -192,6 +192,92 @@ void nouveau_mem_release(struct drm_file *file_priv, struct mem_block *heap)
192} 192}
193 193
194/* 194/*
195 * NV10-NV40 tiling helpers
196 */
197
198static void
199nv10_mem_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
200 uint32_t size, uint32_t pitch)
201{
202 struct drm_nouveau_private *dev_priv = dev->dev_private;
203 struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
204 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
205 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
206 struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i];
207
208 tile->addr = addr;
209 tile->size = size;
210 tile->used = !!pitch;
211 nouveau_fence_unref((void **)&tile->fence);
212
213 if (!pfifo->cache_flush(dev))
214 return;
215
216 pfifo->reassign(dev, false);
217 pfifo->cache_flush(dev);
218 pfifo->cache_pull(dev, false);
219
220 nouveau_wait_for_idle(dev);
221
222 pgraph->set_region_tiling(dev, i, addr, size, pitch);
223 pfb->set_region_tiling(dev, i, addr, size, pitch);
224
225 pfifo->cache_pull(dev, true);
226 pfifo->reassign(dev, true);
227}
228
229struct nouveau_tile_reg *
230nv10_mem_set_tiling(struct drm_device *dev, uint32_t addr, uint32_t size,
231 uint32_t pitch)
232{
233 struct drm_nouveau_private *dev_priv = dev->dev_private;
234 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
235 struct nouveau_tile_reg *tile = dev_priv->tile.reg, *found = NULL;
236 int i;
237
238 spin_lock(&dev_priv->tile.lock);
239
240 for (i = 0; i < pfb->num_tiles; i++) {
241 if (tile[i].used)
242 /* Tile region in use. */
243 continue;
244
245 if (tile[i].fence &&
246 !nouveau_fence_signalled(tile[i].fence, NULL))
247 /* Pending tile region. */
248 continue;
249
250 if (max(tile[i].addr, addr) <
251 min(tile[i].addr + tile[i].size, addr + size))
252 /* Kill an intersecting tile region. */
253 nv10_mem_set_region_tiling(dev, i, 0, 0, 0);
254
255 if (pitch && !found) {
256 /* Free tile region. */
257 nv10_mem_set_region_tiling(dev, i, addr, size, pitch);
258 found = &tile[i];
259 }
260 }
261
262 spin_unlock(&dev_priv->tile.lock);
263
264 return found;
265}
266
267void
268nv10_mem_expire_tiling(struct drm_device *dev, struct nouveau_tile_reg *tile,
269 struct nouveau_fence *fence)
270{
271 if (fence) {
272 /* Mark it as pending. */
273 tile->fence = fence;
274 nouveau_fence_ref(fence);
275 }
276
277 tile->used = false;
278}
279
280/*
195 * NV50 VM helpers 281 * NV50 VM helpers
196 */ 282 */
197int 283int
@@ -513,6 +599,7 @@ nouveau_mem_init(struct drm_device *dev)
513 599
514 INIT_LIST_HEAD(&dev_priv->ttm.bo_list); 600 INIT_LIST_HEAD(&dev_priv->ttm.bo_list);
515 spin_lock_init(&dev_priv->ttm.bo_list_lock); 601 spin_lock_init(&dev_priv->ttm.bo_list_lock);
602 spin_lock_init(&dev_priv->tile.lock);
516 603
517 dev_priv->fb_available_size = nouveau_mem_fb_amount(dev); 604 dev_priv->fb_available_size = nouveau_mem_fb_amount(dev);
518 605
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c
index 93379bb81bea..6c2cf81716df 100644
--- a/drivers/gpu/drm/nouveau/nouveau_object.c
+++ b/drivers/gpu/drm/nouveau/nouveau_object.c
@@ -881,7 +881,7 @@ nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class,
881 return 0; 881 return 0;
882} 882}
883 883
884static int 884int
885nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, 885nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class,
886 struct nouveau_gpuobj **gpuobj_ret) 886 struct nouveau_gpuobj **gpuobj_ret)
887{ 887{
diff --git a/drivers/gpu/drm/nouveau/nouveau_reg.h b/drivers/gpu/drm/nouveau/nouveau_reg.h
index fa1b0e7165b9..251f1b3b38b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_reg.h
+++ b/drivers/gpu/drm/nouveau/nouveau_reg.h
@@ -349,19 +349,19 @@
349#define NV04_PGRAPH_BLEND 0x00400824 349#define NV04_PGRAPH_BLEND 0x00400824
350#define NV04_PGRAPH_STORED_FMT 0x00400830 350#define NV04_PGRAPH_STORED_FMT 0x00400830
351#define NV04_PGRAPH_PATT_COLORRAM 0x00400900 351#define NV04_PGRAPH_PATT_COLORRAM 0x00400900
352#define NV40_PGRAPH_TILE0(i) (0x00400900 + (i*16)) 352#define NV20_PGRAPH_TILE(i) (0x00400900 + (i*16))
353#define NV40_PGRAPH_TLIMIT0(i) (0x00400904 + (i*16)) 353#define NV20_PGRAPH_TLIMIT(i) (0x00400904 + (i*16))
354#define NV40_PGRAPH_TSIZE0(i) (0x00400908 + (i*16)) 354#define NV20_PGRAPH_TSIZE(i) (0x00400908 + (i*16))
355#define NV40_PGRAPH_TSTATUS0(i) (0x0040090C + (i*16)) 355#define NV20_PGRAPH_TSTATUS(i) (0x0040090C + (i*16))
356#define NV10_PGRAPH_TILE(i) (0x00400B00 + (i*16)) 356#define NV10_PGRAPH_TILE(i) (0x00400B00 + (i*16))
357#define NV10_PGRAPH_TLIMIT(i) (0x00400B04 + (i*16)) 357#define NV10_PGRAPH_TLIMIT(i) (0x00400B04 + (i*16))
358#define NV10_PGRAPH_TSIZE(i) (0x00400B08 + (i*16)) 358#define NV10_PGRAPH_TSIZE(i) (0x00400B08 + (i*16))
359#define NV10_PGRAPH_TSTATUS(i) (0x00400B0C + (i*16)) 359#define NV10_PGRAPH_TSTATUS(i) (0x00400B0C + (i*16))
360#define NV04_PGRAPH_U_RAM 0x00400D00 360#define NV04_PGRAPH_U_RAM 0x00400D00
361#define NV47_PGRAPH_TILE0(i) (0x00400D00 + (i*16)) 361#define NV47_PGRAPH_TILE(i) (0x00400D00 + (i*16))
362#define NV47_PGRAPH_TLIMIT0(i) (0x00400D04 + (i*16)) 362#define NV47_PGRAPH_TLIMIT(i) (0x00400D04 + (i*16))
363#define NV47_PGRAPH_TSIZE0(i) (0x00400D08 + (i*16)) 363#define NV47_PGRAPH_TSIZE(i) (0x00400D08 + (i*16))
364#define NV47_PGRAPH_TSTATUS0(i) (0x00400D0C + (i*16)) 364#define NV47_PGRAPH_TSTATUS(i) (0x00400D0C + (i*16))
365#define NV04_PGRAPH_V_RAM 0x00400D40 365#define NV04_PGRAPH_V_RAM 0x00400D40
366#define NV04_PGRAPH_W_RAM 0x00400D80 366#define NV04_PGRAPH_W_RAM 0x00400D80
367#define NV10_PGRAPH_COMBINER0_IN_ALPHA 0x00400E40 367#define NV10_PGRAPH_COMBINER0_IN_ALPHA 0x00400E40
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 2ed41d339f6a..09b9a46dfc0e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -76,6 +76,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
76 engine->fifo.disable = nv04_fifo_disable; 76 engine->fifo.disable = nv04_fifo_disable;
77 engine->fifo.enable = nv04_fifo_enable; 77 engine->fifo.enable = nv04_fifo_enable;
78 engine->fifo.reassign = nv04_fifo_reassign; 78 engine->fifo.reassign = nv04_fifo_reassign;
79 engine->fifo.cache_flush = nv04_fifo_cache_flush;
80 engine->fifo.cache_pull = nv04_fifo_cache_pull;
79 engine->fifo.channel_id = nv04_fifo_channel_id; 81 engine->fifo.channel_id = nv04_fifo_channel_id;
80 engine->fifo.create_context = nv04_fifo_create_context; 82 engine->fifo.create_context = nv04_fifo_create_context;
81 engine->fifo.destroy_context = nv04_fifo_destroy_context; 83 engine->fifo.destroy_context = nv04_fifo_destroy_context;
@@ -100,6 +102,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
100 engine->timer.takedown = nv04_timer_takedown; 102 engine->timer.takedown = nv04_timer_takedown;
101 engine->fb.init = nv10_fb_init; 103 engine->fb.init = nv10_fb_init;
102 engine->fb.takedown = nv10_fb_takedown; 104 engine->fb.takedown = nv10_fb_takedown;
105 engine->fb.set_region_tiling = nv10_fb_set_region_tiling;
103 engine->graph.grclass = nv10_graph_grclass; 106 engine->graph.grclass = nv10_graph_grclass;
104 engine->graph.init = nv10_graph_init; 107 engine->graph.init = nv10_graph_init;
105 engine->graph.takedown = nv10_graph_takedown; 108 engine->graph.takedown = nv10_graph_takedown;
@@ -109,12 +112,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
109 engine->graph.fifo_access = nv04_graph_fifo_access; 112 engine->graph.fifo_access = nv04_graph_fifo_access;
110 engine->graph.load_context = nv10_graph_load_context; 113 engine->graph.load_context = nv10_graph_load_context;
111 engine->graph.unload_context = nv10_graph_unload_context; 114 engine->graph.unload_context = nv10_graph_unload_context;
115 engine->graph.set_region_tiling = nv10_graph_set_region_tiling;
112 engine->fifo.channels = 32; 116 engine->fifo.channels = 32;
113 engine->fifo.init = nv10_fifo_init; 117 engine->fifo.init = nv10_fifo_init;
114 engine->fifo.takedown = nouveau_stub_takedown; 118 engine->fifo.takedown = nouveau_stub_takedown;
115 engine->fifo.disable = nv04_fifo_disable; 119 engine->fifo.disable = nv04_fifo_disable;
116 engine->fifo.enable = nv04_fifo_enable; 120 engine->fifo.enable = nv04_fifo_enable;
117 engine->fifo.reassign = nv04_fifo_reassign; 121 engine->fifo.reassign = nv04_fifo_reassign;
122 engine->fifo.cache_flush = nv04_fifo_cache_flush;
123 engine->fifo.cache_pull = nv04_fifo_cache_pull;
118 engine->fifo.channel_id = nv10_fifo_channel_id; 124 engine->fifo.channel_id = nv10_fifo_channel_id;
119 engine->fifo.create_context = nv10_fifo_create_context; 125 engine->fifo.create_context = nv10_fifo_create_context;
120 engine->fifo.destroy_context = nv10_fifo_destroy_context; 126 engine->fifo.destroy_context = nv10_fifo_destroy_context;
@@ -139,6 +145,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
139 engine->timer.takedown = nv04_timer_takedown; 145 engine->timer.takedown = nv04_timer_takedown;
140 engine->fb.init = nv10_fb_init; 146 engine->fb.init = nv10_fb_init;
141 engine->fb.takedown = nv10_fb_takedown; 147 engine->fb.takedown = nv10_fb_takedown;
148 engine->fb.set_region_tiling = nv10_fb_set_region_tiling;
142 engine->graph.grclass = nv20_graph_grclass; 149 engine->graph.grclass = nv20_graph_grclass;
143 engine->graph.init = nv20_graph_init; 150 engine->graph.init = nv20_graph_init;
144 engine->graph.takedown = nv20_graph_takedown; 151 engine->graph.takedown = nv20_graph_takedown;
@@ -148,12 +155,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
148 engine->graph.fifo_access = nv04_graph_fifo_access; 155 engine->graph.fifo_access = nv04_graph_fifo_access;
149 engine->graph.load_context = nv20_graph_load_context; 156 engine->graph.load_context = nv20_graph_load_context;
150 engine->graph.unload_context = nv20_graph_unload_context; 157 engine->graph.unload_context = nv20_graph_unload_context;
158 engine->graph.set_region_tiling = nv20_graph_set_region_tiling;
151 engine->fifo.channels = 32; 159 engine->fifo.channels = 32;
152 engine->fifo.init = nv10_fifo_init; 160 engine->fifo.init = nv10_fifo_init;
153 engine->fifo.takedown = nouveau_stub_takedown; 161 engine->fifo.takedown = nouveau_stub_takedown;
154 engine->fifo.disable = nv04_fifo_disable; 162 engine->fifo.disable = nv04_fifo_disable;
155 engine->fifo.enable = nv04_fifo_enable; 163 engine->fifo.enable = nv04_fifo_enable;
156 engine->fifo.reassign = nv04_fifo_reassign; 164 engine->fifo.reassign = nv04_fifo_reassign;
165 engine->fifo.cache_flush = nv04_fifo_cache_flush;
166 engine->fifo.cache_pull = nv04_fifo_cache_pull;
157 engine->fifo.channel_id = nv10_fifo_channel_id; 167 engine->fifo.channel_id = nv10_fifo_channel_id;
158 engine->fifo.create_context = nv10_fifo_create_context; 168 engine->fifo.create_context = nv10_fifo_create_context;
159 engine->fifo.destroy_context = nv10_fifo_destroy_context; 169 engine->fifo.destroy_context = nv10_fifo_destroy_context;
@@ -178,6 +188,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
178 engine->timer.takedown = nv04_timer_takedown; 188 engine->timer.takedown = nv04_timer_takedown;
179 engine->fb.init = nv10_fb_init; 189 engine->fb.init = nv10_fb_init;
180 engine->fb.takedown = nv10_fb_takedown; 190 engine->fb.takedown = nv10_fb_takedown;
191 engine->fb.set_region_tiling = nv10_fb_set_region_tiling;
181 engine->graph.grclass = nv30_graph_grclass; 192 engine->graph.grclass = nv30_graph_grclass;
182 engine->graph.init = nv30_graph_init; 193 engine->graph.init = nv30_graph_init;
183 engine->graph.takedown = nv20_graph_takedown; 194 engine->graph.takedown = nv20_graph_takedown;
@@ -187,12 +198,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
187 engine->graph.destroy_context = nv20_graph_destroy_context; 198 engine->graph.destroy_context = nv20_graph_destroy_context;
188 engine->graph.load_context = nv20_graph_load_context; 199 engine->graph.load_context = nv20_graph_load_context;
189 engine->graph.unload_context = nv20_graph_unload_context; 200 engine->graph.unload_context = nv20_graph_unload_context;
201 engine->graph.set_region_tiling = nv20_graph_set_region_tiling;
190 engine->fifo.channels = 32; 202 engine->fifo.channels = 32;
191 engine->fifo.init = nv10_fifo_init; 203 engine->fifo.init = nv10_fifo_init;
192 engine->fifo.takedown = nouveau_stub_takedown; 204 engine->fifo.takedown = nouveau_stub_takedown;
193 engine->fifo.disable = nv04_fifo_disable; 205 engine->fifo.disable = nv04_fifo_disable;
194 engine->fifo.enable = nv04_fifo_enable; 206 engine->fifo.enable = nv04_fifo_enable;
195 engine->fifo.reassign = nv04_fifo_reassign; 207 engine->fifo.reassign = nv04_fifo_reassign;
208 engine->fifo.cache_flush = nv04_fifo_cache_flush;
209 engine->fifo.cache_pull = nv04_fifo_cache_pull;
196 engine->fifo.channel_id = nv10_fifo_channel_id; 210 engine->fifo.channel_id = nv10_fifo_channel_id;
197 engine->fifo.create_context = nv10_fifo_create_context; 211 engine->fifo.create_context = nv10_fifo_create_context;
198 engine->fifo.destroy_context = nv10_fifo_destroy_context; 212 engine->fifo.destroy_context = nv10_fifo_destroy_context;
@@ -218,6 +232,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
218 engine->timer.takedown = nv04_timer_takedown; 232 engine->timer.takedown = nv04_timer_takedown;
219 engine->fb.init = nv40_fb_init; 233 engine->fb.init = nv40_fb_init;
220 engine->fb.takedown = nv40_fb_takedown; 234 engine->fb.takedown = nv40_fb_takedown;
235 engine->fb.set_region_tiling = nv40_fb_set_region_tiling;
221 engine->graph.grclass = nv40_graph_grclass; 236 engine->graph.grclass = nv40_graph_grclass;
222 engine->graph.init = nv40_graph_init; 237 engine->graph.init = nv40_graph_init;
223 engine->graph.takedown = nv40_graph_takedown; 238 engine->graph.takedown = nv40_graph_takedown;
@@ -227,12 +242,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
227 engine->graph.destroy_context = nv40_graph_destroy_context; 242 engine->graph.destroy_context = nv40_graph_destroy_context;
228 engine->graph.load_context = nv40_graph_load_context; 243 engine->graph.load_context = nv40_graph_load_context;
229 engine->graph.unload_context = nv40_graph_unload_context; 244 engine->graph.unload_context = nv40_graph_unload_context;
245 engine->graph.set_region_tiling = nv40_graph_set_region_tiling;
230 engine->fifo.channels = 32; 246 engine->fifo.channels = 32;
231 engine->fifo.init = nv40_fifo_init; 247 engine->fifo.init = nv40_fifo_init;
232 engine->fifo.takedown = nouveau_stub_takedown; 248 engine->fifo.takedown = nouveau_stub_takedown;
233 engine->fifo.disable = nv04_fifo_disable; 249 engine->fifo.disable = nv04_fifo_disable;
234 engine->fifo.enable = nv04_fifo_enable; 250 engine->fifo.enable = nv04_fifo_enable;
235 engine->fifo.reassign = nv04_fifo_reassign; 251 engine->fifo.reassign = nv04_fifo_reassign;
252 engine->fifo.cache_flush = nv04_fifo_cache_flush;
253 engine->fifo.cache_pull = nv04_fifo_cache_pull;
236 engine->fifo.channel_id = nv10_fifo_channel_id; 254 engine->fifo.channel_id = nv10_fifo_channel_id;
237 engine->fifo.create_context = nv40_fifo_create_context; 255 engine->fifo.create_context = nv40_fifo_create_context;
238 engine->fifo.destroy_context = nv40_fifo_destroy_context; 256 engine->fifo.destroy_context = nv40_fifo_destroy_context;
@@ -299,12 +317,57 @@ nouveau_vga_set_decode(void *priv, bool state)
299 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; 317 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
300} 318}
301 319
320static int
321nouveau_card_init_channel(struct drm_device *dev)
322{
323 struct drm_nouveau_private *dev_priv = dev->dev_private;
324 struct nouveau_gpuobj *gpuobj;
325 int ret;
326
327 ret = nouveau_channel_alloc(dev, &dev_priv->channel,
328 (struct drm_file *)-2,
329 NvDmaFB, NvDmaTT);
330 if (ret)
331 return ret;
332
333 gpuobj = NULL;
334 ret = nouveau_gpuobj_dma_new(dev_priv->channel, NV_CLASS_DMA_IN_MEMORY,
335 0, nouveau_mem_fb_amount(dev),
336 NV_DMA_ACCESS_RW, NV_DMA_TARGET_VIDMEM,
337 &gpuobj);
338 if (ret)
339 goto out_err;
340
341 ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaVRAM,
342 gpuobj, NULL);
343 if (ret)
344 goto out_err;
345
346 gpuobj = NULL;
347 ret = nouveau_gpuobj_gart_dma_new(dev_priv->channel, 0,
348 dev_priv->gart_info.aper_size,
349 NV_DMA_ACCESS_RW, &gpuobj, NULL);
350 if (ret)
351 goto out_err;
352
353 ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaGART,
354 gpuobj, NULL);
355 if (ret)
356 goto out_err;
357
358 return 0;
359out_err:
360 nouveau_gpuobj_del(dev, &gpuobj);
361 nouveau_channel_free(dev_priv->channel);
362 dev_priv->channel = NULL;
363 return ret;
364}
365
302int 366int
303nouveau_card_init(struct drm_device *dev) 367nouveau_card_init(struct drm_device *dev)
304{ 368{
305 struct drm_nouveau_private *dev_priv = dev->dev_private; 369 struct drm_nouveau_private *dev_priv = dev->dev_private;
306 struct nouveau_engine *engine; 370 struct nouveau_engine *engine;
307 struct nouveau_gpuobj *gpuobj;
308 int ret; 371 int ret;
309 372
310 NV_DEBUG(dev, "prev state = %d\n", dev_priv->init_state); 373 NV_DEBUG(dev, "prev state = %d\n", dev_priv->init_state);
@@ -317,7 +380,7 @@ nouveau_card_init(struct drm_device *dev)
317 /* Initialise internal driver API hooks */ 380 /* Initialise internal driver API hooks */
318 ret = nouveau_init_engine_ptrs(dev); 381 ret = nouveau_init_engine_ptrs(dev);
319 if (ret) 382 if (ret)
320 return ret; 383 goto out;
321 engine = &dev_priv->engine; 384 engine = &dev_priv->engine;
322 dev_priv->init_state = NOUVEAU_CARD_INIT_FAILED; 385 dev_priv->init_state = NOUVEAU_CARD_INIT_FAILED;
323 386
@@ -325,12 +388,12 @@ nouveau_card_init(struct drm_device *dev)
325 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 388 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
326 ret = nouveau_bios_init(dev); 389 ret = nouveau_bios_init(dev);
327 if (ret) 390 if (ret)
328 return ret; 391 goto out;
329 } 392 }
330 393
331 ret = nouveau_gpuobj_early_init(dev); 394 ret = nouveau_gpuobj_early_init(dev);
332 if (ret) 395 if (ret)
333 return ret; 396 goto out_bios;
334 397
335 /* Initialise instance memory, must happen before mem_init so we 398 /* Initialise instance memory, must happen before mem_init so we
336 * know exactly how much VRAM we're able to use for "normal" 399 * know exactly how much VRAM we're able to use for "normal"
@@ -338,100 +401,68 @@ nouveau_card_init(struct drm_device *dev)
338 */ 401 */
339 ret = engine->instmem.init(dev); 402 ret = engine->instmem.init(dev);
340 if (ret) 403 if (ret)
341 return ret; 404 goto out_gpuobj_early;
342 405
343 /* Setup the memory manager */ 406 /* Setup the memory manager */
344 ret = nouveau_mem_init(dev); 407 ret = nouveau_mem_init(dev);
345 if (ret) 408 if (ret)
346 return ret; 409 goto out_instmem;
347 410
348 ret = nouveau_gpuobj_init(dev); 411 ret = nouveau_gpuobj_init(dev);
349 if (ret) 412 if (ret)
350 return ret; 413 goto out_mem;
351 414
352 /* PMC */ 415 /* PMC */
353 ret = engine->mc.init(dev); 416 ret = engine->mc.init(dev);
354 if (ret) 417 if (ret)
355 return ret; 418 goto out_gpuobj;
356 419
357 /* PTIMER */ 420 /* PTIMER */
358 ret = engine->timer.init(dev); 421 ret = engine->timer.init(dev);
359 if (ret) 422 if (ret)
360 return ret; 423 goto out_mc;
361 424
362 /* PFB */ 425 /* PFB */
363 ret = engine->fb.init(dev); 426 ret = engine->fb.init(dev);
364 if (ret) 427 if (ret)
365 return ret; 428 goto out_timer;
366 429
367 /* PGRAPH */ 430 /* PGRAPH */
368 ret = engine->graph.init(dev); 431 ret = engine->graph.init(dev);
369 if (ret) 432 if (ret)
370 return ret; 433 goto out_fb;
371 434
372 /* PFIFO */ 435 /* PFIFO */
373 ret = engine->fifo.init(dev); 436 ret = engine->fifo.init(dev);
374 if (ret) 437 if (ret)
375 return ret; 438 goto out_graph;
376 439
377 /* this call irq_preinstall, register irq handler and 440 /* this call irq_preinstall, register irq handler and
378 * call irq_postinstall 441 * call irq_postinstall
379 */ 442 */
380 ret = drm_irq_install(dev); 443 ret = drm_irq_install(dev);
381 if (ret) 444 if (ret)
382 return ret; 445 goto out_fifo;
383 446
384 ret = drm_vblank_init(dev, 0); 447 ret = drm_vblank_init(dev, 0);
385 if (ret) 448 if (ret)
386 return ret; 449 goto out_irq;
387 450
388 /* what about PVIDEO/PCRTC/PRAMDAC etc? */ 451 /* what about PVIDEO/PCRTC/PRAMDAC etc? */
389 452
390 ret = nouveau_channel_alloc(dev, &dev_priv->channel, 453 if (!engine->graph.accel_blocked) {
391 (struct drm_file *)-2, 454 ret = nouveau_card_init_channel(dev);
392 NvDmaFB, NvDmaTT); 455 if (ret)
393 if (ret) 456 goto out_irq;
394 return ret;
395
396 gpuobj = NULL;
397 ret = nouveau_gpuobj_dma_new(dev_priv->channel, NV_CLASS_DMA_IN_MEMORY,
398 0, nouveau_mem_fb_amount(dev),
399 NV_DMA_ACCESS_RW, NV_DMA_TARGET_VIDMEM,
400 &gpuobj);
401 if (ret)
402 return ret;
403
404 ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaVRAM,
405 gpuobj, NULL);
406 if (ret) {
407 nouveau_gpuobj_del(dev, &gpuobj);
408 return ret;
409 }
410
411 gpuobj = NULL;
412 ret = nouveau_gpuobj_gart_dma_new(dev_priv->channel, 0,
413 dev_priv->gart_info.aper_size,
414 NV_DMA_ACCESS_RW, &gpuobj, NULL);
415 if (ret)
416 return ret;
417
418 ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaGART,
419 gpuobj, NULL);
420 if (ret) {
421 nouveau_gpuobj_del(dev, &gpuobj);
422 return ret;
423 } 457 }
424 458
425 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 459 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
426 if (dev_priv->card_type >= NV_50) { 460 if (dev_priv->card_type >= NV_50)
427 ret = nv50_display_create(dev); 461 ret = nv50_display_create(dev);
428 if (ret) 462 else
429 return ret;
430 } else {
431 ret = nv04_display_create(dev); 463 ret = nv04_display_create(dev);
432 if (ret) 464 if (ret)
433 return ret; 465 goto out_irq;
434 }
435 } 466 }
436 467
437 ret = nouveau_backlight_init(dev); 468 ret = nouveau_backlight_init(dev);
@@ -444,6 +475,32 @@ nouveau_card_init(struct drm_device *dev)
444 drm_helper_initial_config(dev); 475 drm_helper_initial_config(dev);
445 476
446 return 0; 477 return 0;
478
479out_irq:
480 drm_irq_uninstall(dev);
481out_fifo:
482 engine->fifo.takedown(dev);
483out_graph:
484 engine->graph.takedown(dev);
485out_fb:
486 engine->fb.takedown(dev);
487out_timer:
488 engine->timer.takedown(dev);
489out_mc:
490 engine->mc.takedown(dev);
491out_gpuobj:
492 nouveau_gpuobj_takedown(dev);
493out_mem:
494 nouveau_mem_close(dev);
495out_instmem:
496 engine->instmem.takedown(dev);
497out_gpuobj_early:
498 nouveau_gpuobj_late_takedown(dev);
499out_bios:
500 nouveau_bios_takedown(dev);
501out:
502 vga_client_register(dev->pdev, NULL, NULL, NULL);
503 return ret;
447} 504}
448 505
449static void nouveau_card_takedown(struct drm_device *dev) 506static void nouveau_card_takedown(struct drm_device *dev)
@@ -585,7 +642,10 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
585 dev_priv->chipset = (reg0 & 0xff00000) >> 20; 642 dev_priv->chipset = (reg0 & 0xff00000) >> 20;
586 /* NV04 or NV05 */ 643 /* NV04 or NV05 */
587 } else if ((reg0 & 0xff00fff0) == 0x20004000) { 644 } else if ((reg0 & 0xff00fff0) == 0x20004000) {
588 dev_priv->chipset = 0x04; 645 if (reg0 & 0x00f00000)
646 dev_priv->chipset = 0x05;
647 else
648 dev_priv->chipset = 0x04;
589 } else 649 } else
590 dev_priv->chipset = 0xff; 650 dev_priv->chipset = 0xff;
591 651
@@ -665,8 +725,8 @@ static void nouveau_close(struct drm_device *dev)
665{ 725{
666 struct drm_nouveau_private *dev_priv = dev->dev_private; 726 struct drm_nouveau_private *dev_priv = dev->dev_private;
667 727
668 /* In the case of an error dev_priv may not be be allocated yet */ 728 /* In the case of an error dev_priv may not be allocated yet */
669 if (dev_priv && dev_priv->card_type) 729 if (dev_priv)
670 nouveau_card_takedown(dev); 730 nouveau_card_takedown(dev);
671} 731}
672 732
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 187eb84e4da5..c385d50f041b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -28,45 +28,17 @@
28 28
29#include "nouveau_drv.h" 29#include "nouveau_drv.h"
30 30
31static struct vm_operations_struct nouveau_ttm_vm_ops;
32static const struct vm_operations_struct *ttm_vm_ops;
33
34static int
35nouveau_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
36{
37 struct ttm_buffer_object *bo = vma->vm_private_data;
38 int ret;
39
40 if (unlikely(bo == NULL))
41 return VM_FAULT_NOPAGE;
42
43 ret = ttm_vm_ops->fault(vma, vmf);
44 return ret;
45}
46
47int 31int
48nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma) 32nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
49{ 33{
50 struct drm_file *file_priv = filp->private_data; 34 struct drm_file *file_priv = filp->private_data;
51 struct drm_nouveau_private *dev_priv = 35 struct drm_nouveau_private *dev_priv =
52 file_priv->minor->dev->dev_private; 36 file_priv->minor->dev->dev_private;
53 int ret;
54 37
55 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) 38 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
56 return drm_mmap(filp, vma); 39 return drm_mmap(filp, vma);
57 40
58 ret = ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev); 41 return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev);
59 if (unlikely(ret != 0))
60 return ret;
61
62 if (unlikely(ttm_vm_ops == NULL)) {
63 ttm_vm_ops = vma->vm_ops;
64 nouveau_ttm_vm_ops = *ttm_vm_ops;
65 nouveau_ttm_vm_ops.fault = &nouveau_ttm_fault;
66 }
67
68 vma->vm_ops = &nouveau_ttm_vm_ops;
69 return 0;
70} 42}
71 43
72static int 44static int
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c
index b91363606055..d2f143ed97c1 100644
--- a/drivers/gpu/drm/nouveau/nv04_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv04_crtc.c
@@ -143,10 +143,10 @@ static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mod
143 state->pllsel |= nv_crtc->index ? PLLSEL_VPLL2_MASK : PLLSEL_VPLL1_MASK; 143 state->pllsel |= nv_crtc->index ? PLLSEL_VPLL2_MASK : PLLSEL_VPLL1_MASK;
144 144
145 if (pv->NM2) 145 if (pv->NM2)
146 NV_TRACE(dev, "vpll: n1 %d n2 %d m1 %d m2 %d log2p %d\n", 146 NV_DEBUG_KMS(dev, "vpll: n1 %d n2 %d m1 %d m2 %d log2p %d\n",
147 pv->N1, pv->N2, pv->M1, pv->M2, pv->log2P); 147 pv->N1, pv->N2, pv->M1, pv->M2, pv->log2P);
148 else 148 else
149 NV_TRACE(dev, "vpll: n %d m %d log2p %d\n", 149 NV_DEBUG_KMS(dev, "vpll: n %d m %d log2p %d\n",
150 pv->N1, pv->M1, pv->log2P); 150 pv->N1, pv->M1, pv->log2P);
151 151
152 nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset); 152 nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset);
@@ -160,7 +160,7 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode)
160 unsigned char seq1 = 0, crtc17 = 0; 160 unsigned char seq1 = 0, crtc17 = 0;
161 unsigned char crtc1A; 161 unsigned char crtc1A;
162 162
163 NV_TRACE(dev, "Setting dpms mode %d on CRTC %d\n", mode, 163 NV_DEBUG_KMS(dev, "Setting dpms mode %d on CRTC %d\n", mode,
164 nv_crtc->index); 164 nv_crtc->index);
165 165
166 if (nv_crtc->last_dpms == mode) /* Don't do unnecesary mode changes. */ 166 if (nv_crtc->last_dpms == mode) /* Don't do unnecesary mode changes. */
@@ -603,7 +603,7 @@ nv_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
603 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 603 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
604 struct drm_nouveau_private *dev_priv = dev->dev_private; 604 struct drm_nouveau_private *dev_priv = dev->dev_private;
605 605
606 NV_DEBUG(dev, "CTRC mode on CRTC %d:\n", nv_crtc->index); 606 NV_DEBUG_KMS(dev, "CTRC mode on CRTC %d:\n", nv_crtc->index);
607 drm_mode_debug_printmodeline(adjusted_mode); 607 drm_mode_debug_printmodeline(adjusted_mode);
608 608
609 /* unlock must come after turning off FP_TG_CONTROL in output_prepare */ 609 /* unlock must come after turning off FP_TG_CONTROL in output_prepare */
@@ -703,7 +703,7 @@ static void nv_crtc_destroy(struct drm_crtc *crtc)
703{ 703{
704 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 704 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
705 705
706 NV_DEBUG(crtc->dev, "\n"); 706 NV_DEBUG_KMS(crtc->dev, "\n");
707 707
708 if (!nv_crtc) 708 if (!nv_crtc)
709 return; 709 return;
diff --git a/drivers/gpu/drm/nouveau/nv04_dac.c b/drivers/gpu/drm/nouveau/nv04_dac.c
index a5fa51714e87..d0e038d28948 100644
--- a/drivers/gpu/drm/nouveau/nv04_dac.c
+++ b/drivers/gpu/drm/nouveau/nv04_dac.c
@@ -205,23 +205,22 @@ out:
205 NVWriteVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX, saved_seq1); 205 NVWriteVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX, saved_seq1);
206 206
207 if (blue == 0x18) { 207 if (blue == 0x18) {
208 NV_TRACE(dev, "Load detected on head A\n"); 208 NV_INFO(dev, "Load detected on head A\n");
209 return connector_status_connected; 209 return connector_status_connected;
210 } 210 }
211 211
212 return connector_status_disconnected; 212 return connector_status_disconnected;
213} 213}
214 214
215enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, 215uint32_t nv17_dac_sample_load(struct drm_encoder *encoder)
216 struct drm_connector *connector)
217{ 216{
218 struct drm_device *dev = encoder->dev; 217 struct drm_device *dev = encoder->dev;
219 struct drm_nouveau_private *dev_priv = dev->dev_private; 218 struct drm_nouveau_private *dev_priv = dev->dev_private;
220 struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; 219 struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb;
221 uint32_t testval, regoffset = nv04_dac_output_offset(encoder); 220 uint32_t sample, testval, regoffset = nv04_dac_output_offset(encoder);
222 uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput, 221 uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput,
223 saved_rtest_ctrl, saved_gpio0, saved_gpio1, temp, routput; 222 saved_rtest_ctrl, saved_gpio0, saved_gpio1, temp, routput;
224 int head, present = 0; 223 int head;
225 224
226#define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) 225#define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20)
227 if (dcb->type == OUTPUT_TV) { 226 if (dcb->type == OUTPUT_TV) {
@@ -287,13 +286,7 @@ enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder,
287 temp | NV_PRAMDAC_TEST_CONTROL_TP_INS_EN_ASSERTED); 286 temp | NV_PRAMDAC_TEST_CONTROL_TP_INS_EN_ASSERTED);
288 msleep(5); 287 msleep(5);
289 288
290 temp = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); 289 sample = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset);
291
292 if (dcb->type == OUTPUT_TV)
293 present = (nv17_tv_detect(encoder, connector, temp)
294 == connector_status_connected);
295 else
296 present = temp & NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI;
297 290
298 temp = NVReadRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL); 291 temp = NVReadRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL);
299 NVWriteRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL, 292 NVWriteRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL,
@@ -310,15 +303,25 @@ enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder,
310 nv17_gpio_set(dev, DCB_GPIO_TVDAC1, saved_gpio1); 303 nv17_gpio_set(dev, DCB_GPIO_TVDAC1, saved_gpio1);
311 nv17_gpio_set(dev, DCB_GPIO_TVDAC0, saved_gpio0); 304 nv17_gpio_set(dev, DCB_GPIO_TVDAC0, saved_gpio0);
312 305
313 if (present) { 306 return sample;
314 NV_INFO(dev, "Load detected on output %c\n", '@' + ffs(dcb->or)); 307}
308
309static enum drm_connector_status
310nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
311{
312 struct drm_device *dev = encoder->dev;
313 struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb;
314 uint32_t sample = nv17_dac_sample_load(encoder);
315
316 if (sample & NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) {
317 NV_INFO(dev, "Load detected on output %c\n",
318 '@' + ffs(dcb->or));
315 return connector_status_connected; 319 return connector_status_connected;
320 } else {
321 return connector_status_disconnected;
316 } 322 }
317
318 return connector_status_disconnected;
319} 323}
320 324
321
322static bool nv04_dac_mode_fixup(struct drm_encoder *encoder, 325static bool nv04_dac_mode_fixup(struct drm_encoder *encoder,
323 struct drm_display_mode *mode, 326 struct drm_display_mode *mode,
324 struct drm_display_mode *adjusted_mode) 327 struct drm_display_mode *adjusted_mode)
@@ -350,14 +353,10 @@ static void nv04_dac_mode_set(struct drm_encoder *encoder,
350 struct drm_display_mode *mode, 353 struct drm_display_mode *mode,
351 struct drm_display_mode *adjusted_mode) 354 struct drm_display_mode *adjusted_mode)
352{ 355{
353 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
354 struct drm_device *dev = encoder->dev; 356 struct drm_device *dev = encoder->dev;
355 struct drm_nouveau_private *dev_priv = dev->dev_private; 357 struct drm_nouveau_private *dev_priv = dev->dev_private;
356 int head = nouveau_crtc(encoder->crtc)->index; 358 int head = nouveau_crtc(encoder->crtc)->index;
357 359
358 NV_TRACE(dev, "%s called for encoder %d\n", __func__,
359 nv_encoder->dcb->index);
360
361 if (nv_gf4_disp_arch(dev)) { 360 if (nv_gf4_disp_arch(dev)) {
362 struct drm_encoder *rebind; 361 struct drm_encoder *rebind;
363 uint32_t dac_offset = nv04_dac_output_offset(encoder); 362 uint32_t dac_offset = nv04_dac_output_offset(encoder);
@@ -466,7 +465,7 @@ static void nv04_dac_destroy(struct drm_encoder *encoder)
466{ 465{
467 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 466 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
468 467
469 NV_DEBUG(encoder->dev, "\n"); 468 NV_DEBUG_KMS(encoder->dev, "\n");
470 469
471 drm_encoder_cleanup(encoder); 470 drm_encoder_cleanup(encoder);
472 kfree(nv_encoder); 471 kfree(nv_encoder);
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c
index e5b33339d595..483f875bdb6a 100644
--- a/drivers/gpu/drm/nouveau/nv04_dfp.c
+++ b/drivers/gpu/drm/nouveau/nv04_dfp.c
@@ -261,7 +261,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,
261 struct drm_display_mode *output_mode = &nv_encoder->mode; 261 struct drm_display_mode *output_mode = &nv_encoder->mode;
262 uint32_t mode_ratio, panel_ratio; 262 uint32_t mode_ratio, panel_ratio;
263 263
264 NV_DEBUG(dev, "Output mode on CRTC %d:\n", nv_crtc->index); 264 NV_DEBUG_KMS(dev, "Output mode on CRTC %d:\n", nv_crtc->index);
265 drm_mode_debug_printmodeline(output_mode); 265 drm_mode_debug_printmodeline(output_mode);
266 266
267 /* Initialize the FP registers in this CRTC. */ 267 /* Initialize the FP registers in this CRTC. */
@@ -413,7 +413,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder)
413 struct dcb_entry *dcbe = nv_encoder->dcb; 413 struct dcb_entry *dcbe = nv_encoder->dcb;
414 int head = nouveau_crtc(encoder->crtc)->index; 414 int head = nouveau_crtc(encoder->crtc)->index;
415 415
416 NV_TRACE(dev, "%s called for encoder %d\n", __func__, nv_encoder->dcb->index); 416 NV_INFO(dev, "Output %s is running on CRTC %d using output %c\n",
417 drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
418 nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
417 419
418 if (dcbe->type == OUTPUT_TMDS) 420 if (dcbe->type == OUTPUT_TMDS)
419 run_tmds_table(dev, dcbe, head, nv_encoder->mode.clock); 421 run_tmds_table(dev, dcbe, head, nv_encoder->mode.clock);
@@ -550,7 +552,7 @@ static void nv04_dfp_destroy(struct drm_encoder *encoder)
550{ 552{
551 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 553 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
552 554
553 NV_DEBUG(encoder->dev, "\n"); 555 NV_DEBUG_KMS(encoder->dev, "\n");
554 556
555 drm_encoder_cleanup(encoder); 557 drm_encoder_cleanup(encoder);
556 kfree(nv_encoder); 558 kfree(nv_encoder);
diff --git a/drivers/gpu/drm/nouveau/nv04_display.c b/drivers/gpu/drm/nouveau/nv04_display.c
index b47c757ff48b..ef77215fa5b9 100644
--- a/drivers/gpu/drm/nouveau/nv04_display.c
+++ b/drivers/gpu/drm/nouveau/nv04_display.c
@@ -99,10 +99,11 @@ nv04_display_create(struct drm_device *dev)
99 uint16_t connector[16] = { 0 }; 99 uint16_t connector[16] = { 0 };
100 int i, ret; 100 int i, ret;
101 101
102 NV_DEBUG(dev, "\n"); 102 NV_DEBUG_KMS(dev, "\n");
103 103
104 if (nv_two_heads(dev)) 104 if (nv_two_heads(dev))
105 nv04_display_store_initial_head_owner(dev); 105 nv04_display_store_initial_head_owner(dev);
106 nouveau_hw_save_vga_fonts(dev, 1);
106 107
107 drm_mode_config_init(dev); 108 drm_mode_config_init(dev);
108 drm_mode_create_scaling_mode_property(dev); 109 drm_mode_create_scaling_mode_property(dev);
@@ -203,8 +204,6 @@ nv04_display_create(struct drm_device *dev)
203 /* Save previous state */ 204 /* Save previous state */
204 NVLockVgaCrtcs(dev, false); 205 NVLockVgaCrtcs(dev, false);
205 206
206 nouveau_hw_save_vga_fonts(dev, 1);
207
208 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 207 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
209 crtc->funcs->save(crtc); 208 crtc->funcs->save(crtc);
210 209
@@ -223,7 +222,7 @@ nv04_display_destroy(struct drm_device *dev)
223 struct drm_encoder *encoder; 222 struct drm_encoder *encoder;
224 struct drm_crtc *crtc; 223 struct drm_crtc *crtc;
225 224
226 NV_DEBUG(dev, "\n"); 225 NV_DEBUG_KMS(dev, "\n");
227 226
228 /* Turn every CRTC off. */ 227 /* Turn every CRTC off. */
229 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 228 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -246,9 +245,9 @@ nv04_display_destroy(struct drm_device *dev)
246 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) 245 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
247 crtc->funcs->restore(crtc); 246 crtc->funcs->restore(crtc);
248 247
249 nouveau_hw_save_vga_fonts(dev, 0);
250
251 drm_mode_config_cleanup(dev); 248 drm_mode_config_cleanup(dev);
249
250 nouveau_hw_save_vga_fonts(dev, 0);
252} 251}
253 252
254void 253void
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c
index 09a31071ee58..d910873c1368 100644
--- a/drivers/gpu/drm/nouveau/nv04_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c
@@ -39,8 +39,7 @@ nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
39 return; 39 return;
40 40
41 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) { 41 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) {
42 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 42 nouveau_fbcon_gpu_lockup(info);
43 info->flags |= FBINFO_HWACCEL_DISABLED;
44 } 43 }
45 44
46 if (info->flags & FBINFO_HWACCEL_DISABLED) { 45 if (info->flags & FBINFO_HWACCEL_DISABLED) {
@@ -62,14 +61,12 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
62 struct drm_device *dev = par->dev; 61 struct drm_device *dev = par->dev;
63 struct drm_nouveau_private *dev_priv = dev->dev_private; 62 struct drm_nouveau_private *dev_priv = dev->dev_private;
64 struct nouveau_channel *chan = dev_priv->channel; 63 struct nouveau_channel *chan = dev_priv->channel;
65 uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color];
66 64
67 if (info->state != FBINFO_STATE_RUNNING) 65 if (info->state != FBINFO_STATE_RUNNING)
68 return; 66 return;
69 67
70 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) { 68 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) {
71 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 69 nouveau_fbcon_gpu_lockup(info);
72 info->flags |= FBINFO_HWACCEL_DISABLED;
73 } 70 }
74 71
75 if (info->flags & FBINFO_HWACCEL_DISABLED) { 72 if (info->flags & FBINFO_HWACCEL_DISABLED) {
@@ -80,7 +77,11 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
80 BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); 77 BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1);
81 OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); 78 OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3);
82 BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1); 79 BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1);
83 OUT_RING(chan, color); 80 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
81 info->fix.visual == FB_VISUAL_DIRECTCOLOR)
82 OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]);
83 else
84 OUT_RING(chan, rect->color);
84 BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2); 85 BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2);
85 OUT_RING(chan, (rect->dx << 16) | rect->dy); 86 OUT_RING(chan, (rect->dx << 16) | rect->dy);
86 OUT_RING(chan, (rect->width << 16) | rect->height); 87 OUT_RING(chan, (rect->width << 16) | rect->height);
@@ -109,8 +110,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
109 } 110 }
110 111
111 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) { 112 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) {
112 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 113 nouveau_fbcon_gpu_lockup(info);
113 info->flags |= FBINFO_HWACCEL_DISABLED;
114 } 114 }
115 115
116 if (info->flags & FBINFO_HWACCEL_DISABLED) { 116 if (info->flags & FBINFO_HWACCEL_DISABLED) {
@@ -144,8 +144,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
144 int iter_len = dsize > 128 ? 128 : dsize; 144 int iter_len = dsize > 128 ? 128 : dsize;
145 145
146 if (RING_SPACE(chan, iter_len + 1)) { 146 if (RING_SPACE(chan, iter_len + 1)) {
147 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 147 nouveau_fbcon_gpu_lockup(info);
148 info->flags |= FBINFO_HWACCEL_DISABLED;
149 cfb_imageblit(info, image); 148 cfb_imageblit(info, image);
150 return; 149 return;
151 } 150 }
@@ -184,6 +183,7 @@ nv04_fbcon_accel_init(struct fb_info *info)
184 struct drm_device *dev = par->dev; 183 struct drm_device *dev = par->dev;
185 struct drm_nouveau_private *dev_priv = dev->dev_private; 184 struct drm_nouveau_private *dev_priv = dev->dev_private;
186 struct nouveau_channel *chan = dev_priv->channel; 185 struct nouveau_channel *chan = dev_priv->channel;
186 const int sub = NvSubCtxSurf2D;
187 int surface_fmt, pattern_fmt, rect_fmt; 187 int surface_fmt, pattern_fmt, rect_fmt;
188 int ret; 188 int ret;
189 189
@@ -242,30 +242,29 @@ nv04_fbcon_accel_init(struct fb_info *info)
242 return ret; 242 return ret;
243 243
244 if (RING_SPACE(chan, 49)) { 244 if (RING_SPACE(chan, 49)) {
245 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 245 nouveau_fbcon_gpu_lockup(info);
246 info->flags |= FBINFO_HWACCEL_DISABLED;
247 return 0; 246 return 0;
248 } 247 }
249 248
250 BEGIN_RING(chan, 1, 0x0000, 1); 249 BEGIN_RING(chan, sub, 0x0000, 1);
251 OUT_RING(chan, NvCtxSurf2D); 250 OUT_RING(chan, NvCtxSurf2D);
252 BEGIN_RING(chan, 1, 0x0184, 2); 251 BEGIN_RING(chan, sub, 0x0184, 2);
253 OUT_RING(chan, NvDmaFB); 252 OUT_RING(chan, NvDmaFB);
254 OUT_RING(chan, NvDmaFB); 253 OUT_RING(chan, NvDmaFB);
255 BEGIN_RING(chan, 1, 0x0300, 4); 254 BEGIN_RING(chan, sub, 0x0300, 4);
256 OUT_RING(chan, surface_fmt); 255 OUT_RING(chan, surface_fmt);
257 OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16)); 256 OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16));
258 OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); 257 OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base);
259 OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); 258 OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base);
260 259
261 BEGIN_RING(chan, 1, 0x0000, 1); 260 BEGIN_RING(chan, sub, 0x0000, 1);
262 OUT_RING(chan, NvRop); 261 OUT_RING(chan, NvRop);
263 BEGIN_RING(chan, 1, 0x0300, 1); 262 BEGIN_RING(chan, sub, 0x0300, 1);
264 OUT_RING(chan, 0x55); 263 OUT_RING(chan, 0x55);
265 264
266 BEGIN_RING(chan, 1, 0x0000, 1); 265 BEGIN_RING(chan, sub, 0x0000, 1);
267 OUT_RING(chan, NvImagePatt); 266 OUT_RING(chan, NvImagePatt);
268 BEGIN_RING(chan, 1, 0x0300, 8); 267 BEGIN_RING(chan, sub, 0x0300, 8);
269 OUT_RING(chan, pattern_fmt); 268 OUT_RING(chan, pattern_fmt);
270#ifdef __BIG_ENDIAN 269#ifdef __BIG_ENDIAN
271 OUT_RING(chan, 2); 270 OUT_RING(chan, 2);
@@ -279,9 +278,9 @@ nv04_fbcon_accel_init(struct fb_info *info)
279 OUT_RING(chan, ~0); 278 OUT_RING(chan, ~0);
280 OUT_RING(chan, ~0); 279 OUT_RING(chan, ~0);
281 280
282 BEGIN_RING(chan, 1, 0x0000, 1); 281 BEGIN_RING(chan, sub, 0x0000, 1);
283 OUT_RING(chan, NvClipRect); 282 OUT_RING(chan, NvClipRect);
284 BEGIN_RING(chan, 1, 0x0300, 2); 283 BEGIN_RING(chan, sub, 0x0300, 2);
285 OUT_RING(chan, 0); 284 OUT_RING(chan, 0);
286 OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual); 285 OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual);
287 286
diff --git a/drivers/gpu/drm/nouveau/nv04_fifo.c b/drivers/gpu/drm/nouveau/nv04_fifo.c
index 0c3cd53c7313..f31347b8c9b0 100644
--- a/drivers/gpu/drm/nouveau/nv04_fifo.c
+++ b/drivers/gpu/drm/nouveau/nv04_fifo.c
@@ -71,6 +71,40 @@ nv04_fifo_reassign(struct drm_device *dev, bool enable)
71 return (reassign == 1); 71 return (reassign == 1);
72} 72}
73 73
74bool
75nv04_fifo_cache_flush(struct drm_device *dev)
76{
77 struct drm_nouveau_private *dev_priv = dev->dev_private;
78 struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer;
79 uint64_t start = ptimer->read(dev);
80
81 do {
82 if (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) ==
83 nv_rd32(dev, NV03_PFIFO_CACHE1_PUT))
84 return true;
85
86 } while (ptimer->read(dev) - start < 100000000);
87
88 NV_ERROR(dev, "Timeout flushing the PFIFO cache.\n");
89
90 return false;
91}
92
93bool
94nv04_fifo_cache_pull(struct drm_device *dev, bool enable)
95{
96 uint32_t pull = nv_rd32(dev, NV04_PFIFO_CACHE1_PULL0);
97
98 if (enable) {
99 nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, pull | 1);
100 } else {
101 nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, pull & ~1);
102 nv_wr32(dev, NV04_PFIFO_CACHE1_HASH, 0);
103 }
104
105 return !!(pull & 1);
106}
107
74int 108int
75nv04_fifo_channel_id(struct drm_device *dev) 109nv04_fifo_channel_id(struct drm_device *dev)
76{ 110{
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c
index 396ee92118f6..e260986ea65a 100644
--- a/drivers/gpu/drm/nouveau/nv04_graph.c
+++ b/drivers/gpu/drm/nouveau/nv04_graph.c
@@ -28,6 +28,10 @@
28#include "nouveau_drv.h" 28#include "nouveau_drv.h"
29 29
30static uint32_t nv04_graph_ctx_regs[] = { 30static uint32_t nv04_graph_ctx_regs[] = {
31 0x0040053c,
32 0x00400544,
33 0x00400540,
34 0x00400548,
31 NV04_PGRAPH_CTX_SWITCH1, 35 NV04_PGRAPH_CTX_SWITCH1,
32 NV04_PGRAPH_CTX_SWITCH2, 36 NV04_PGRAPH_CTX_SWITCH2,
33 NV04_PGRAPH_CTX_SWITCH3, 37 NV04_PGRAPH_CTX_SWITCH3,
@@ -102,69 +106,69 @@ static uint32_t nv04_graph_ctx_regs[] = {
102 NV04_PGRAPH_PATT_COLOR0, 106 NV04_PGRAPH_PATT_COLOR0,
103 NV04_PGRAPH_PATT_COLOR1, 107 NV04_PGRAPH_PATT_COLOR1,
104 NV04_PGRAPH_PATT_COLORRAM+0x00, 108 NV04_PGRAPH_PATT_COLORRAM+0x00,
105 NV04_PGRAPH_PATT_COLORRAM+0x01,
106 NV04_PGRAPH_PATT_COLORRAM+0x02,
107 NV04_PGRAPH_PATT_COLORRAM+0x03,
108 NV04_PGRAPH_PATT_COLORRAM+0x04, 109 NV04_PGRAPH_PATT_COLORRAM+0x04,
109 NV04_PGRAPH_PATT_COLORRAM+0x05,
110 NV04_PGRAPH_PATT_COLORRAM+0x06,
111 NV04_PGRAPH_PATT_COLORRAM+0x07,
112 NV04_PGRAPH_PATT_COLORRAM+0x08, 110 NV04_PGRAPH_PATT_COLORRAM+0x08,
113 NV04_PGRAPH_PATT_COLORRAM+0x09, 111 NV04_PGRAPH_PATT_COLORRAM+0x0c,
114 NV04_PGRAPH_PATT_COLORRAM+0x0A,
115 NV04_PGRAPH_PATT_COLORRAM+0x0B,
116 NV04_PGRAPH_PATT_COLORRAM+0x0C,
117 NV04_PGRAPH_PATT_COLORRAM+0x0D,
118 NV04_PGRAPH_PATT_COLORRAM+0x0E,
119 NV04_PGRAPH_PATT_COLORRAM+0x0F,
120 NV04_PGRAPH_PATT_COLORRAM+0x10, 112 NV04_PGRAPH_PATT_COLORRAM+0x10,
121 NV04_PGRAPH_PATT_COLORRAM+0x11,
122 NV04_PGRAPH_PATT_COLORRAM+0x12,
123 NV04_PGRAPH_PATT_COLORRAM+0x13,
124 NV04_PGRAPH_PATT_COLORRAM+0x14, 113 NV04_PGRAPH_PATT_COLORRAM+0x14,
125 NV04_PGRAPH_PATT_COLORRAM+0x15,
126 NV04_PGRAPH_PATT_COLORRAM+0x16,
127 NV04_PGRAPH_PATT_COLORRAM+0x17,
128 NV04_PGRAPH_PATT_COLORRAM+0x18, 114 NV04_PGRAPH_PATT_COLORRAM+0x18,
129 NV04_PGRAPH_PATT_COLORRAM+0x19, 115 NV04_PGRAPH_PATT_COLORRAM+0x1c,
130 NV04_PGRAPH_PATT_COLORRAM+0x1A,
131 NV04_PGRAPH_PATT_COLORRAM+0x1B,
132 NV04_PGRAPH_PATT_COLORRAM+0x1C,
133 NV04_PGRAPH_PATT_COLORRAM+0x1D,
134 NV04_PGRAPH_PATT_COLORRAM+0x1E,
135 NV04_PGRAPH_PATT_COLORRAM+0x1F,
136 NV04_PGRAPH_PATT_COLORRAM+0x20, 116 NV04_PGRAPH_PATT_COLORRAM+0x20,
137 NV04_PGRAPH_PATT_COLORRAM+0x21,
138 NV04_PGRAPH_PATT_COLORRAM+0x22,
139 NV04_PGRAPH_PATT_COLORRAM+0x23,
140 NV04_PGRAPH_PATT_COLORRAM+0x24, 117 NV04_PGRAPH_PATT_COLORRAM+0x24,
141 NV04_PGRAPH_PATT_COLORRAM+0x25,
142 NV04_PGRAPH_PATT_COLORRAM+0x26,
143 NV04_PGRAPH_PATT_COLORRAM+0x27,
144 NV04_PGRAPH_PATT_COLORRAM+0x28, 118 NV04_PGRAPH_PATT_COLORRAM+0x28,
145 NV04_PGRAPH_PATT_COLORRAM+0x29, 119 NV04_PGRAPH_PATT_COLORRAM+0x2c,
146 NV04_PGRAPH_PATT_COLORRAM+0x2A,
147 NV04_PGRAPH_PATT_COLORRAM+0x2B,
148 NV04_PGRAPH_PATT_COLORRAM+0x2C,
149 NV04_PGRAPH_PATT_COLORRAM+0x2D,
150 NV04_PGRAPH_PATT_COLORRAM+0x2E,
151 NV04_PGRAPH_PATT_COLORRAM+0x2F,
152 NV04_PGRAPH_PATT_COLORRAM+0x30, 120 NV04_PGRAPH_PATT_COLORRAM+0x30,
153 NV04_PGRAPH_PATT_COLORRAM+0x31,
154 NV04_PGRAPH_PATT_COLORRAM+0x32,
155 NV04_PGRAPH_PATT_COLORRAM+0x33,
156 NV04_PGRAPH_PATT_COLORRAM+0x34, 121 NV04_PGRAPH_PATT_COLORRAM+0x34,
157 NV04_PGRAPH_PATT_COLORRAM+0x35,
158 NV04_PGRAPH_PATT_COLORRAM+0x36,
159 NV04_PGRAPH_PATT_COLORRAM+0x37,
160 NV04_PGRAPH_PATT_COLORRAM+0x38, 122 NV04_PGRAPH_PATT_COLORRAM+0x38,
161 NV04_PGRAPH_PATT_COLORRAM+0x39, 123 NV04_PGRAPH_PATT_COLORRAM+0x3c,
162 NV04_PGRAPH_PATT_COLORRAM+0x3A, 124 NV04_PGRAPH_PATT_COLORRAM+0x40,
163 NV04_PGRAPH_PATT_COLORRAM+0x3B, 125 NV04_PGRAPH_PATT_COLORRAM+0x44,
164 NV04_PGRAPH_PATT_COLORRAM+0x3C, 126 NV04_PGRAPH_PATT_COLORRAM+0x48,
165 NV04_PGRAPH_PATT_COLORRAM+0x3D, 127 NV04_PGRAPH_PATT_COLORRAM+0x4c,
166 NV04_PGRAPH_PATT_COLORRAM+0x3E, 128 NV04_PGRAPH_PATT_COLORRAM+0x50,
167 NV04_PGRAPH_PATT_COLORRAM+0x3F, 129 NV04_PGRAPH_PATT_COLORRAM+0x54,
130 NV04_PGRAPH_PATT_COLORRAM+0x58,
131 NV04_PGRAPH_PATT_COLORRAM+0x5c,
132 NV04_PGRAPH_PATT_COLORRAM+0x60,
133 NV04_PGRAPH_PATT_COLORRAM+0x64,
134 NV04_PGRAPH_PATT_COLORRAM+0x68,
135 NV04_PGRAPH_PATT_COLORRAM+0x6c,
136 NV04_PGRAPH_PATT_COLORRAM+0x70,
137 NV04_PGRAPH_PATT_COLORRAM+0x74,
138 NV04_PGRAPH_PATT_COLORRAM+0x78,
139 NV04_PGRAPH_PATT_COLORRAM+0x7c,
140 NV04_PGRAPH_PATT_COLORRAM+0x80,
141 NV04_PGRAPH_PATT_COLORRAM+0x84,
142 NV04_PGRAPH_PATT_COLORRAM+0x88,
143 NV04_PGRAPH_PATT_COLORRAM+0x8c,
144 NV04_PGRAPH_PATT_COLORRAM+0x90,
145 NV04_PGRAPH_PATT_COLORRAM+0x94,
146 NV04_PGRAPH_PATT_COLORRAM+0x98,
147 NV04_PGRAPH_PATT_COLORRAM+0x9c,
148 NV04_PGRAPH_PATT_COLORRAM+0xa0,
149 NV04_PGRAPH_PATT_COLORRAM+0xa4,
150 NV04_PGRAPH_PATT_COLORRAM+0xa8,
151 NV04_PGRAPH_PATT_COLORRAM+0xac,
152 NV04_PGRAPH_PATT_COLORRAM+0xb0,
153 NV04_PGRAPH_PATT_COLORRAM+0xb4,
154 NV04_PGRAPH_PATT_COLORRAM+0xb8,
155 NV04_PGRAPH_PATT_COLORRAM+0xbc,
156 NV04_PGRAPH_PATT_COLORRAM+0xc0,
157 NV04_PGRAPH_PATT_COLORRAM+0xc4,
158 NV04_PGRAPH_PATT_COLORRAM+0xc8,
159 NV04_PGRAPH_PATT_COLORRAM+0xcc,
160 NV04_PGRAPH_PATT_COLORRAM+0xd0,
161 NV04_PGRAPH_PATT_COLORRAM+0xd4,
162 NV04_PGRAPH_PATT_COLORRAM+0xd8,
163 NV04_PGRAPH_PATT_COLORRAM+0xdc,
164 NV04_PGRAPH_PATT_COLORRAM+0xe0,
165 NV04_PGRAPH_PATT_COLORRAM+0xe4,
166 NV04_PGRAPH_PATT_COLORRAM+0xe8,
167 NV04_PGRAPH_PATT_COLORRAM+0xec,
168 NV04_PGRAPH_PATT_COLORRAM+0xf0,
169 NV04_PGRAPH_PATT_COLORRAM+0xf4,
170 NV04_PGRAPH_PATT_COLORRAM+0xf8,
171 NV04_PGRAPH_PATT_COLORRAM+0xfc,
168 NV04_PGRAPH_PATTERN, 172 NV04_PGRAPH_PATTERN,
169 0x0040080c, 173 0x0040080c,
170 NV04_PGRAPH_PATTERN_SHAPE, 174 NV04_PGRAPH_PATTERN_SHAPE,
@@ -247,14 +251,6 @@ static uint32_t nv04_graph_ctx_regs[] = {
247 0x004004f8, 251 0x004004f8,
248 0x0040047c, 252 0x0040047c,
249 0x004004fc, 253 0x004004fc,
250 0x0040053c,
251 0x00400544,
252 0x00400540,
253 0x00400548,
254 0x00400560,
255 0x00400568,
256 0x00400564,
257 0x0040056c,
258 0x00400534, 254 0x00400534,
259 0x00400538, 255 0x00400538,
260 0x00400514, 256 0x00400514,
@@ -341,9 +337,8 @@ static uint32_t nv04_graph_ctx_regs[] = {
341 0x00400500, 337 0x00400500,
342 0x00400504, 338 0x00400504,
343 NV04_PGRAPH_VALID1, 339 NV04_PGRAPH_VALID1,
344 NV04_PGRAPH_VALID2 340 NV04_PGRAPH_VALID2,
345 341 NV04_PGRAPH_DEBUG_3
346
347}; 342};
348 343
349struct graph_state { 344struct graph_state {
@@ -388,6 +383,18 @@ nv04_graph_context_switch(struct drm_device *dev)
388 pgraph->fifo_access(dev, true); 383 pgraph->fifo_access(dev, true);
389} 384}
390 385
386static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg)
387{
388 int i;
389
390 for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++) {
391 if (nv04_graph_ctx_regs[i] == reg)
392 return &ctx->nv04[i];
393 }
394
395 return NULL;
396}
397
391int nv04_graph_create_context(struct nouveau_channel *chan) 398int nv04_graph_create_context(struct nouveau_channel *chan)
392{ 399{
393 struct graph_state *pgraph_ctx; 400 struct graph_state *pgraph_ctx;
@@ -398,15 +405,8 @@ int nv04_graph_create_context(struct nouveau_channel *chan)
398 if (pgraph_ctx == NULL) 405 if (pgraph_ctx == NULL)
399 return -ENOMEM; 406 return -ENOMEM;
400 407
401 /* dev_priv->fifos[channel].pgraph_ctx_user = channel << 24; */ 408 *ctx_reg(pgraph_ctx, NV04_PGRAPH_DEBUG_3) = 0xfad4ff31;
402 pgraph_ctx->nv04[0] = 0x0001ffff; 409
403 /* is it really needed ??? */
404#if 0
405 dev_priv->fifos[channel].pgraph_ctx[1] =
406 nv_rd32(dev, NV_PGRAPH_DEBUG_4);
407 dev_priv->fifos[channel].pgraph_ctx[2] =
408 nv_rd32(dev, 0x004006b0);
409#endif
410 return 0; 410 return 0;
411} 411}
412 412
@@ -429,9 +429,13 @@ int nv04_graph_load_context(struct nouveau_channel *chan)
429 nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]); 429 nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]);
430 430
431 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100); 431 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100);
432 nv_wr32(dev, NV04_PGRAPH_CTX_USER, chan->id << 24); 432
433 tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
434 nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp | chan->id << 24);
435
433 tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2); 436 tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2);
434 nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff); 437 nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff);
438
435 return 0; 439 return 0;
436} 440}
437 441
@@ -494,7 +498,7 @@ int nv04_graph_init(struct drm_device *dev)
494 nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF); 498 nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF);
495 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100); 499 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100);
496 tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; 500 tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
497 tmp |= dev_priv->engine.fifo.channels << 24; 501 tmp |= (dev_priv->engine.fifo.channels - 1) << 24;
498 nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp); 502 nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp);
499 503
500 /* These don't belong here, they're part of a per-channel context */ 504 /* These don't belong here, they're part of a per-channel context */
@@ -533,7 +537,7 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass,
533 int mthd, uint32_t data) 537 int mthd, uint32_t data)
534{ 538{
535 struct drm_device *dev = chan->dev; 539 struct drm_device *dev = chan->dev;
536 uint32_t instance = nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff; 540 uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
537 int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; 541 int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7;
538 uint32_t tmp; 542 uint32_t tmp;
539 543
@@ -543,11 +547,11 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass,
543 547
544 nv_wi32(dev, instance, tmp); 548 nv_wi32(dev, instance, tmp);
545 nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp); 549 nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp);
546 nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + subc, tmp); 550 nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + (subc<<2), tmp);
547 return 0; 551 return 0;
548} 552}
549 553
550static struct nouveau_pgraph_object_method nv04_graph_mthds_m2mf[] = { 554static struct nouveau_pgraph_object_method nv04_graph_mthds_sw[] = {
551 { 0x0150, nv04_graph_mthd_set_ref }, 555 { 0x0150, nv04_graph_mthd_set_ref },
552 {} 556 {}
553}; 557};
@@ -558,7 +562,7 @@ static struct nouveau_pgraph_object_method nv04_graph_mthds_set_operation[] = {
558}; 562};
559 563
560struct nouveau_pgraph_object_class nv04_graph_grclass[] = { 564struct nouveau_pgraph_object_class nv04_graph_grclass[] = {
561 { 0x0039, false, nv04_graph_mthds_m2mf }, 565 { 0x0039, false, NULL },
562 { 0x004a, false, nv04_graph_mthds_set_operation }, /* gdirect */ 566 { 0x004a, false, nv04_graph_mthds_set_operation }, /* gdirect */
563 { 0x005f, false, nv04_graph_mthds_set_operation }, /* imageblit */ 567 { 0x005f, false, nv04_graph_mthds_set_operation }, /* imageblit */
564 { 0x0061, false, nv04_graph_mthds_set_operation }, /* ifc */ 568 { 0x0061, false, nv04_graph_mthds_set_operation }, /* ifc */
@@ -574,6 +578,7 @@ struct nouveau_pgraph_object_class nv04_graph_grclass[] = {
574 { 0x0053, false, NULL }, /* surf3d */ 578 { 0x0053, false, NULL }, /* surf3d */
575 { 0x0054, false, NULL }, /* tex_tri */ 579 { 0x0054, false, NULL }, /* tex_tri */
576 { 0x0055, false, NULL }, /* multitex_tri */ 580 { 0x0055, false, NULL }, /* multitex_tri */
581 { 0x506e, true, nv04_graph_mthds_sw },
577 {} 582 {}
578}; 583};
579 584
diff --git a/drivers/gpu/drm/nouveau/nv10_fb.c b/drivers/gpu/drm/nouveau/nv10_fb.c
index 79e2d104d70a..cc5cda44e501 100644
--- a/drivers/gpu/drm/nouveau/nv10_fb.c
+++ b/drivers/gpu/drm/nouveau/nv10_fb.c
@@ -3,17 +3,37 @@
3#include "nouveau_drv.h" 3#include "nouveau_drv.h"
4#include "nouveau_drm.h" 4#include "nouveau_drm.h"
5 5
6void
7nv10_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
8 uint32_t size, uint32_t pitch)
9{
10 struct drm_nouveau_private *dev_priv = dev->dev_private;
11 uint32_t limit = max(1u, addr + size) - 1;
12
13 if (pitch) {
14 if (dev_priv->card_type >= NV_20)
15 addr |= 1;
16 else
17 addr |= 1 << 31;
18 }
19
20 nv_wr32(dev, NV10_PFB_TLIMIT(i), limit);
21 nv_wr32(dev, NV10_PFB_TSIZE(i), pitch);
22 nv_wr32(dev, NV10_PFB_TILE(i), addr);
23}
24
6int 25int
7nv10_fb_init(struct drm_device *dev) 26nv10_fb_init(struct drm_device *dev)
8{ 27{
9 uint32_t fb_bar_size; 28 struct drm_nouveau_private *dev_priv = dev->dev_private;
29 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
10 int i; 30 int i;
11 31
12 fb_bar_size = drm_get_resource_len(dev, 0) - 1; 32 pfb->num_tiles = NV10_PFB_TILE__SIZE;
13 for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { 33
14 nv_wr32(dev, NV10_PFB_TILE(i), 0); 34 /* Turn all the tiling regions off. */
15 nv_wr32(dev, NV10_PFB_TLIMIT(i), fb_bar_size); 35 for (i = 0; i < pfb->num_tiles; i++)
16 } 36 pfb->set_region_tiling(dev, i, 0, 0, 0);
17 37
18 return 0; 38 return 0;
19} 39}
diff --git a/drivers/gpu/drm/nouveau/nv10_graph.c b/drivers/gpu/drm/nouveau/nv10_graph.c
index 6bf6804bb0ef..fcf2cdd19493 100644
--- a/drivers/gpu/drm/nouveau/nv10_graph.c
+++ b/drivers/gpu/drm/nouveau/nv10_graph.c
@@ -389,49 +389,50 @@ struct graph_state {
389 int nv10[ARRAY_SIZE(nv10_graph_ctx_regs)]; 389 int nv10[ARRAY_SIZE(nv10_graph_ctx_regs)];
390 int nv17[ARRAY_SIZE(nv17_graph_ctx_regs)]; 390 int nv17[ARRAY_SIZE(nv17_graph_ctx_regs)];
391 struct pipe_state pipe_state; 391 struct pipe_state pipe_state;
392 uint32_t lma_window[4];
392}; 393};
393 394
395#define PIPE_SAVE(dev, state, addr) \
396 do { \
397 int __i; \
398 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \
399 for (__i = 0; __i < ARRAY_SIZE(state); __i++) \
400 state[__i] = nv_rd32(dev, NV10_PGRAPH_PIPE_DATA); \
401 } while (0)
402
403#define PIPE_RESTORE(dev, state, addr) \
404 do { \
405 int __i; \
406 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \
407 for (__i = 0; __i < ARRAY_SIZE(state); __i++) \
408 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, state[__i]); \
409 } while (0)
410
394static void nv10_graph_save_pipe(struct nouveau_channel *chan) 411static void nv10_graph_save_pipe(struct nouveau_channel *chan)
395{ 412{
396 struct drm_device *dev = chan->dev; 413 struct drm_device *dev = chan->dev;
397 struct graph_state *pgraph_ctx = chan->pgraph_ctx; 414 struct graph_state *pgraph_ctx = chan->pgraph_ctx;
398 struct pipe_state *fifo_pipe_state = &pgraph_ctx->pipe_state; 415 struct pipe_state *pipe = &pgraph_ctx->pipe_state;
399 int i; 416
400#define PIPE_SAVE(addr) \ 417 PIPE_SAVE(dev, pipe->pipe_0x4400, 0x4400);
401 do { \ 418 PIPE_SAVE(dev, pipe->pipe_0x0200, 0x0200);
402 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \ 419 PIPE_SAVE(dev, pipe->pipe_0x6400, 0x6400);
403 for (i = 0; i < ARRAY_SIZE(fifo_pipe_state->pipe_##addr); i++) \ 420 PIPE_SAVE(dev, pipe->pipe_0x6800, 0x6800);
404 fifo_pipe_state->pipe_##addr[i] = nv_rd32(dev, NV10_PGRAPH_PIPE_DATA); \ 421 PIPE_SAVE(dev, pipe->pipe_0x6c00, 0x6c00);
405 } while (0) 422 PIPE_SAVE(dev, pipe->pipe_0x7000, 0x7000);
406 423 PIPE_SAVE(dev, pipe->pipe_0x7400, 0x7400);
407 PIPE_SAVE(0x4400); 424 PIPE_SAVE(dev, pipe->pipe_0x7800, 0x7800);
408 PIPE_SAVE(0x0200); 425 PIPE_SAVE(dev, pipe->pipe_0x0040, 0x0040);
409 PIPE_SAVE(0x6400); 426 PIPE_SAVE(dev, pipe->pipe_0x0000, 0x0000);
410 PIPE_SAVE(0x6800);
411 PIPE_SAVE(0x6c00);
412 PIPE_SAVE(0x7000);
413 PIPE_SAVE(0x7400);
414 PIPE_SAVE(0x7800);
415 PIPE_SAVE(0x0040);
416 PIPE_SAVE(0x0000);
417
418#undef PIPE_SAVE
419} 427}
420 428
421static void nv10_graph_load_pipe(struct nouveau_channel *chan) 429static void nv10_graph_load_pipe(struct nouveau_channel *chan)
422{ 430{
423 struct drm_device *dev = chan->dev; 431 struct drm_device *dev = chan->dev;
424 struct graph_state *pgraph_ctx = chan->pgraph_ctx; 432 struct graph_state *pgraph_ctx = chan->pgraph_ctx;
425 struct pipe_state *fifo_pipe_state = &pgraph_ctx->pipe_state; 433 struct pipe_state *pipe = &pgraph_ctx->pipe_state;
426 int i;
427 uint32_t xfmode0, xfmode1; 434 uint32_t xfmode0, xfmode1;
428#define PIPE_RESTORE(addr) \ 435 int i;
429 do { \
430 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \
431 for (i = 0; i < ARRAY_SIZE(fifo_pipe_state->pipe_##addr); i++) \
432 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, fifo_pipe_state->pipe_##addr[i]); \
433 } while (0)
434
435 436
436 nouveau_wait_for_idle(dev); 437 nouveau_wait_for_idle(dev);
437 /* XXX check haiku comments */ 438 /* XXX check haiku comments */
@@ -457,24 +458,22 @@ static void nv10_graph_load_pipe(struct nouveau_channel *chan)
457 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008); 458 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008);
458 459
459 460
460 PIPE_RESTORE(0x0200); 461 PIPE_RESTORE(dev, pipe->pipe_0x0200, 0x0200);
461 nouveau_wait_for_idle(dev); 462 nouveau_wait_for_idle(dev);
462 463
463 /* restore XFMODE */ 464 /* restore XFMODE */
464 nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0); 465 nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0);
465 nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1); 466 nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1);
466 PIPE_RESTORE(0x6400); 467 PIPE_RESTORE(dev, pipe->pipe_0x6400, 0x6400);
467 PIPE_RESTORE(0x6800); 468 PIPE_RESTORE(dev, pipe->pipe_0x6800, 0x6800);
468 PIPE_RESTORE(0x6c00); 469 PIPE_RESTORE(dev, pipe->pipe_0x6c00, 0x6c00);
469 PIPE_RESTORE(0x7000); 470 PIPE_RESTORE(dev, pipe->pipe_0x7000, 0x7000);
470 PIPE_RESTORE(0x7400); 471 PIPE_RESTORE(dev, pipe->pipe_0x7400, 0x7400);
471 PIPE_RESTORE(0x7800); 472 PIPE_RESTORE(dev, pipe->pipe_0x7800, 0x7800);
472 PIPE_RESTORE(0x4400); 473 PIPE_RESTORE(dev, pipe->pipe_0x4400, 0x4400);
473 PIPE_RESTORE(0x0000); 474 PIPE_RESTORE(dev, pipe->pipe_0x0000, 0x0000);
474 PIPE_RESTORE(0x0040); 475 PIPE_RESTORE(dev, pipe->pipe_0x0040, 0x0040);
475 nouveau_wait_for_idle(dev); 476 nouveau_wait_for_idle(dev);
476
477#undef PIPE_RESTORE
478} 477}
479 478
480static void nv10_graph_create_pipe(struct nouveau_channel *chan) 479static void nv10_graph_create_pipe(struct nouveau_channel *chan)
@@ -808,6 +807,20 @@ void nv10_graph_destroy_context(struct nouveau_channel *chan)
808 chan->pgraph_ctx = NULL; 807 chan->pgraph_ctx = NULL;
809} 808}
810 809
810void
811nv10_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
812 uint32_t size, uint32_t pitch)
813{
814 uint32_t limit = max(1u, addr + size) - 1;
815
816 if (pitch)
817 addr |= 1 << 31;
818
819 nv_wr32(dev, NV10_PGRAPH_TLIMIT(i), limit);
820 nv_wr32(dev, NV10_PGRAPH_TSIZE(i), pitch);
821 nv_wr32(dev, NV10_PGRAPH_TILE(i), addr);
822}
823
811int nv10_graph_init(struct drm_device *dev) 824int nv10_graph_init(struct drm_device *dev)
812{ 825{
813 struct drm_nouveau_private *dev_priv = dev->dev_private; 826 struct drm_nouveau_private *dev_priv = dev->dev_private;
@@ -832,21 +845,16 @@ int nv10_graph_init(struct drm_device *dev)
832 (1<<31)); 845 (1<<31));
833 if (dev_priv->chipset >= 0x17) { 846 if (dev_priv->chipset >= 0x17) {
834 nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x1f000000); 847 nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x1f000000);
848 nv_wr32(dev, 0x400a10, 0x3ff3fb6);
849 nv_wr32(dev, 0x400838, 0x2f8684);
850 nv_wr32(dev, 0x40083c, 0x115f3f);
835 nv_wr32(dev, 0x004006b0, 0x40000020); 851 nv_wr32(dev, 0x004006b0, 0x40000020);
836 } else 852 } else
837 nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000); 853 nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000);
838 854
839 /* copy tile info from PFB */ 855 /* Turn all the tiling regions off. */
840 for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { 856 for (i = 0; i < NV10_PFB_TILE__SIZE; i++)
841 nv_wr32(dev, NV10_PGRAPH_TILE(i), 857 nv10_graph_set_region_tiling(dev, i, 0, 0, 0);
842 nv_rd32(dev, NV10_PFB_TILE(i)));
843 nv_wr32(dev, NV10_PGRAPH_TLIMIT(i),
844 nv_rd32(dev, NV10_PFB_TLIMIT(i)));
845 nv_wr32(dev, NV10_PGRAPH_TSIZE(i),
846 nv_rd32(dev, NV10_PFB_TSIZE(i)));
847 nv_wr32(dev, NV10_PGRAPH_TSTATUS(i),
848 nv_rd32(dev, NV10_PFB_TSTATUS(i)));
849 }
850 858
851 nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000); 859 nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000);
852 nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000); 860 nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000);
@@ -867,6 +875,115 @@ void nv10_graph_takedown(struct drm_device *dev)
867{ 875{
868} 876}
869 877
878static int
879nv17_graph_mthd_lma_window(struct nouveau_channel *chan, int grclass,
880 int mthd, uint32_t data)
881{
882 struct drm_device *dev = chan->dev;
883 struct graph_state *ctx = chan->pgraph_ctx;
884 struct pipe_state *pipe = &ctx->pipe_state;
885 struct drm_nouveau_private *dev_priv = dev->dev_private;
886 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
887 uint32_t pipe_0x0040[1], pipe_0x64c0[8], pipe_0x6a80[3], pipe_0x6ab0[3];
888 uint32_t xfmode0, xfmode1;
889 int i;
890
891 ctx->lma_window[(mthd - 0x1638) / 4] = data;
892
893 if (mthd != 0x1644)
894 return 0;
895
896 nouveau_wait_for_idle(dev);
897
898 PIPE_SAVE(dev, pipe_0x0040, 0x0040);
899 PIPE_SAVE(dev, pipe->pipe_0x0200, 0x0200);
900
901 PIPE_RESTORE(dev, ctx->lma_window, 0x6790);
902
903 nouveau_wait_for_idle(dev);
904
905 xfmode0 = nv_rd32(dev, NV10_PGRAPH_XFMODE0);
906 xfmode1 = nv_rd32(dev, NV10_PGRAPH_XFMODE1);
907
908 PIPE_SAVE(dev, pipe->pipe_0x4400, 0x4400);
909 PIPE_SAVE(dev, pipe_0x64c0, 0x64c0);
910 PIPE_SAVE(dev, pipe_0x6ab0, 0x6ab0);
911 PIPE_SAVE(dev, pipe_0x6a80, 0x6a80);
912
913 nouveau_wait_for_idle(dev);
914
915 nv_wr32(dev, NV10_PGRAPH_XFMODE0, 0x10000000);
916 nv_wr32(dev, NV10_PGRAPH_XFMODE1, 0x00000000);
917 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000064c0);
918 for (i = 0; i < 4; i++)
919 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000);
920 for (i = 0; i < 4; i++)
921 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
922
923 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006ab0);
924 for (i = 0; i < 3; i++)
925 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000);
926
927 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006a80);
928 for (i = 0; i < 3; i++)
929 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
930
931 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00000040);
932 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008);
933
934 PIPE_RESTORE(dev, pipe->pipe_0x0200, 0x0200);
935
936 nouveau_wait_for_idle(dev);
937
938 PIPE_RESTORE(dev, pipe_0x0040, 0x0040);
939
940 nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0);
941 nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1);
942
943 PIPE_RESTORE(dev, pipe_0x64c0, 0x64c0);
944 PIPE_RESTORE(dev, pipe_0x6ab0, 0x6ab0);
945 PIPE_RESTORE(dev, pipe_0x6a80, 0x6a80);
946 PIPE_RESTORE(dev, pipe->pipe_0x4400, 0x4400);
947
948 nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000000c0);
949 nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000);
950
951 nouveau_wait_for_idle(dev);
952
953 pgraph->fifo_access(dev, true);
954
955 return 0;
956}
957
958static int
959nv17_graph_mthd_lma_enable(struct nouveau_channel *chan, int grclass,
960 int mthd, uint32_t data)
961{
962 struct drm_device *dev = chan->dev;
963 struct drm_nouveau_private *dev_priv = dev->dev_private;
964 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
965
966 nouveau_wait_for_idle(dev);
967
968 nv_wr32(dev, NV10_PGRAPH_DEBUG_4,
969 nv_rd32(dev, NV10_PGRAPH_DEBUG_4) | 0x1 << 8);
970 nv_wr32(dev, 0x004006b0,
971 nv_rd32(dev, 0x004006b0) | 0x8 << 24);
972
973 pgraph->fifo_access(dev, true);
974
975 return 0;
976}
977
978static struct nouveau_pgraph_object_method nv17_graph_celsius_mthds[] = {
979 { 0x1638, nv17_graph_mthd_lma_window },
980 { 0x163c, nv17_graph_mthd_lma_window },
981 { 0x1640, nv17_graph_mthd_lma_window },
982 { 0x1644, nv17_graph_mthd_lma_window },
983 { 0x1658, nv17_graph_mthd_lma_enable },
984 {}
985};
986
870struct nouveau_pgraph_object_class nv10_graph_grclass[] = { 987struct nouveau_pgraph_object_class nv10_graph_grclass[] = {
871 { 0x0030, false, NULL }, /* null */ 988 { 0x0030, false, NULL }, /* null */
872 { 0x0039, false, NULL }, /* m2mf */ 989 { 0x0039, false, NULL }, /* m2mf */
@@ -887,6 +1004,6 @@ struct nouveau_pgraph_object_class nv10_graph_grclass[] = {
887 { 0x0095, false, NULL }, /* multitex_tri */ 1004 { 0x0095, false, NULL }, /* multitex_tri */
888 { 0x0056, false, NULL }, /* celcius (nv10) */ 1005 { 0x0056, false, NULL }, /* celcius (nv10) */
889 { 0x0096, false, NULL }, /* celcius (nv11) */ 1006 { 0x0096, false, NULL }, /* celcius (nv11) */
890 { 0x0099, false, NULL }, /* celcius (nv17) */ 1007 { 0x0099, false, nv17_graph_celsius_mthds }, /* celcius (nv17) */
891 {} 1008 {}
892}; 1009};
diff --git a/drivers/gpu/drm/nouveau/nv17_tv.c b/drivers/gpu/drm/nouveau/nv17_tv.c
index 46cfd9c60478..58b917c3341b 100644
--- a/drivers/gpu/drm/nouveau/nv17_tv.c
+++ b/drivers/gpu/drm/nouveau/nv17_tv.c
@@ -33,13 +33,103 @@
33#include "nouveau_hw.h" 33#include "nouveau_hw.h"
34#include "nv17_tv.h" 34#include "nv17_tv.h"
35 35
36enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, 36static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder)
37 struct drm_connector *connector,
38 uint32_t pin_mask)
39{ 37{
38 struct drm_device *dev = encoder->dev;
39 struct drm_nouveau_private *dev_priv = dev->dev_private;
40 uint32_t testval, regoffset = nv04_dac_output_offset(encoder);
41 uint32_t gpio0, gpio1, fp_htotal, fp_hsync_start, fp_hsync_end,
42 fp_control, test_ctrl, dacclk, ctv_14, ctv_1c, ctv_6c;
43 uint32_t sample = 0;
44 int head;
45
46#define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20)
47 testval = RGB_TEST_DATA(0x82, 0xeb, 0x82);
48 if (dev_priv->vbios->tvdactestval)
49 testval = dev_priv->vbios->tvdactestval;
50
51 dacclk = NVReadRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset);
52 head = (dacclk & 0x100) >> 8;
53
54 /* Save the previous state. */
55 gpio1 = nv17_gpio_get(dev, DCB_GPIO_TVDAC1);
56 gpio0 = nv17_gpio_get(dev, DCB_GPIO_TVDAC0);
57 fp_htotal = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL);
58 fp_hsync_start = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START);
59 fp_hsync_end = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END);
60 fp_control = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL);
61 test_ctrl = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset);
62 ctv_1c = NVReadRAMDAC(dev, head, 0x680c1c);
63 ctv_14 = NVReadRAMDAC(dev, head, 0x680c14);
64 ctv_6c = NVReadRAMDAC(dev, head, 0x680c6c);
65
66 /* Prepare the DAC for load detection. */
67 nv17_gpio_set(dev, DCB_GPIO_TVDAC1, true);
68 nv17_gpio_set(dev, DCB_GPIO_TVDAC0, true);
69
70 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL, 1343);
71 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START, 1047);
72 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END, 1183);
73 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL,
74 NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS |
75 NV_PRAMDAC_FP_TG_CONTROL_WIDTH_12 |
76 NV_PRAMDAC_FP_TG_CONTROL_READ_PROG |
77 NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS |
78 NV_PRAMDAC_FP_TG_CONTROL_VSYNC_POS);
79
80 NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset, 0);
81
82 NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset,
83 (dacclk & ~0xff) | 0x22);
84 msleep(1);
85 NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset,
86 (dacclk & ~0xff) | 0x21);
87
88 NVWriteRAMDAC(dev, head, 0x680c1c, 1 << 20);
89 NVWriteRAMDAC(dev, head, 0x680c14, 4 << 16);
90
91 /* Sample pin 0x4 (usually S-video luma). */
92 NVWriteRAMDAC(dev, head, 0x680c6c, testval >> 10 & 0x3ff);
93 msleep(20);
94 sample |= NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset)
95 & 0x4 << 28;
96
97 /* Sample the remaining pins. */
98 NVWriteRAMDAC(dev, head, 0x680c6c, testval & 0x3ff);
99 msleep(20);
100 sample |= NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset)
101 & 0xa << 28;
102
103 /* Restore the previous state. */
104 NVWriteRAMDAC(dev, head, 0x680c1c, ctv_1c);
105 NVWriteRAMDAC(dev, head, 0x680c14, ctv_14);
106 NVWriteRAMDAC(dev, head, 0x680c6c, ctv_6c);
107 NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, dacclk);
108 NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset, test_ctrl);
109 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL, fp_control);
110 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END, fp_hsync_end);
111 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START, fp_hsync_start);
112 NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL, fp_htotal);
113 nv17_gpio_set(dev, DCB_GPIO_TVDAC1, gpio1);
114 nv17_gpio_set(dev, DCB_GPIO_TVDAC0, gpio0);
115
116 return sample;
117}
118
119static enum drm_connector_status
120nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector)
121{
122 struct drm_device *dev = encoder->dev;
123 struct drm_nouveau_private *dev_priv = dev->dev_private;
124 struct drm_mode_config *conf = &dev->mode_config;
40 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); 125 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder);
126 struct dcb_entry *dcb = tv_enc->base.dcb;
41 127
42 tv_enc->pin_mask = pin_mask >> 28 & 0xe; 128 if (dev_priv->chipset == 0x42 ||
129 dev_priv->chipset == 0x43)
130 tv_enc->pin_mask = nv42_tv_sample_load(encoder) >> 28 & 0xe;
131 else
132 tv_enc->pin_mask = nv17_dac_sample_load(encoder) >> 28 & 0xe;
43 133
44 switch (tv_enc->pin_mask) { 134 switch (tv_enc->pin_mask) {
45 case 0x2: 135 case 0x2:
@@ -50,7 +140,7 @@ enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder,
50 tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SVIDEO; 140 tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SVIDEO;
51 break; 141 break;
52 case 0xe: 142 case 0xe:
53 if (nouveau_encoder(encoder)->dcb->tvconf.has_component_output) 143 if (dcb->tvconf.has_component_output)
54 tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_Component; 144 tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_Component;
55 else 145 else
56 tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SCART; 146 tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SCART;
@@ -61,11 +151,16 @@ enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder,
61 } 151 }
62 152
63 drm_connector_property_set_value(connector, 153 drm_connector_property_set_value(connector,
64 encoder->dev->mode_config.tv_subconnector_property, 154 conf->tv_subconnector_property,
65 tv_enc->subconnector); 155 tv_enc->subconnector);
66 156
67 return tv_enc->subconnector ? connector_status_connected : 157 if (tv_enc->subconnector) {
68 connector_status_disconnected; 158 NV_INFO(dev, "Load detected on output %c\n",
159 '@' + ffs(dcb->or));
160 return connector_status_connected;
161 } else {
162 return connector_status_disconnected;
163 }
69} 164}
70 165
71static const struct { 166static const struct {
@@ -219,7 +314,7 @@ static void nv17_tv_dpms(struct drm_encoder *encoder, int mode)
219 return; 314 return;
220 nouveau_encoder(encoder)->last_dpms = mode; 315 nouveau_encoder(encoder)->last_dpms = mode;
221 316
222 NV_TRACE(dev, "Setting dpms mode %d on TV encoder (output %d)\n", 317 NV_INFO(dev, "Setting dpms mode %d on TV encoder (output %d)\n",
223 mode, nouveau_encoder(encoder)->dcb->index); 318 mode, nouveau_encoder(encoder)->dcb->index);
224 319
225 regs->ptv_200 &= ~1; 320 regs->ptv_200 &= ~1;
@@ -619,7 +714,7 @@ static void nv17_tv_destroy(struct drm_encoder *encoder)
619{ 714{
620 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); 715 struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder);
621 716
622 NV_DEBUG(encoder->dev, "\n"); 717 NV_DEBUG_KMS(encoder->dev, "\n");
623 718
624 drm_encoder_cleanup(encoder); 719 drm_encoder_cleanup(encoder);
625 kfree(tv_enc); 720 kfree(tv_enc);
@@ -633,7 +728,7 @@ static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = {
633 .prepare = nv17_tv_prepare, 728 .prepare = nv17_tv_prepare,
634 .commit = nv17_tv_commit, 729 .commit = nv17_tv_commit,
635 .mode_set = nv17_tv_mode_set, 730 .mode_set = nv17_tv_mode_set,
636 .detect = nv17_dac_detect, 731 .detect = nv17_tv_detect,
637}; 732};
638 733
639static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = { 734static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = {
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c
index 18ba74f19703..d6fc0a82f03d 100644
--- a/drivers/gpu/drm/nouveau/nv20_graph.c
+++ b/drivers/gpu/drm/nouveau/nv20_graph.c
@@ -514,6 +514,27 @@ nv20_graph_rdi(struct drm_device *dev)
514 nouveau_wait_for_idle(dev); 514 nouveau_wait_for_idle(dev);
515} 515}
516 516
517void
518nv20_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
519 uint32_t size, uint32_t pitch)
520{
521 uint32_t limit = max(1u, addr + size) - 1;
522
523 if (pitch)
524 addr |= 1;
525
526 nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit);
527 nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch);
528 nv_wr32(dev, NV20_PGRAPH_TILE(i), addr);
529
530 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + 4 * i);
531 nv_wr32(dev, NV10_PGRAPH_RDI_DATA, limit);
532 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + 4 * i);
533 nv_wr32(dev, NV10_PGRAPH_RDI_DATA, pitch);
534 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + 4 * i);
535 nv_wr32(dev, NV10_PGRAPH_RDI_DATA, addr);
536}
537
517int 538int
518nv20_graph_init(struct drm_device *dev) 539nv20_graph_init(struct drm_device *dev)
519{ 540{
@@ -572,27 +593,10 @@ nv20_graph_init(struct drm_device *dev)
572 nv_wr32(dev, NV10_PGRAPH_RDI_DATA , 0x00000030); 593 nv_wr32(dev, NV10_PGRAPH_RDI_DATA , 0x00000030);
573 } 594 }
574 595
575 /* copy tile info from PFB */ 596 /* Turn all the tiling regions off. */
576 for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { 597 for (i = 0; i < NV10_PFB_TILE__SIZE; i++)
577 nv_wr32(dev, 0x00400904 + i * 0x10, 598 nv20_graph_set_region_tiling(dev, i, 0, 0, 0);
578 nv_rd32(dev, NV10_PFB_TLIMIT(i))); 599
579 /* which is NV40_PGRAPH_TLIMIT0(i) ?? */
580 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + i * 4);
581 nv_wr32(dev, NV10_PGRAPH_RDI_DATA,
582 nv_rd32(dev, NV10_PFB_TLIMIT(i)));
583 nv_wr32(dev, 0x00400908 + i * 0x10,
584 nv_rd32(dev, NV10_PFB_TSIZE(i)));
585 /* which is NV40_PGRAPH_TSIZE0(i) ?? */
586 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + i * 4);
587 nv_wr32(dev, NV10_PGRAPH_RDI_DATA,
588 nv_rd32(dev, NV10_PFB_TSIZE(i)));
589 nv_wr32(dev, 0x00400900 + i * 0x10,
590 nv_rd32(dev, NV10_PFB_TILE(i)));
591 /* which is NV40_PGRAPH_TILE0(i) ?? */
592 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + i * 4);
593 nv_wr32(dev, NV10_PGRAPH_RDI_DATA,
594 nv_rd32(dev, NV10_PFB_TILE(i)));
595 }
596 for (i = 0; i < 8; i++) { 600 for (i = 0; i < 8; i++) {
597 nv_wr32(dev, 0x400980 + i * 4, nv_rd32(dev, 0x100300 + i * 4)); 601 nv_wr32(dev, 0x400980 + i * 4, nv_rd32(dev, 0x100300 + i * 4));
598 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0090 + i * 4); 602 nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0090 + i * 4);
@@ -704,18 +708,9 @@ nv30_graph_init(struct drm_device *dev)
704 708
705 nv_wr32(dev, 0x4000c0, 0x00000016); 709 nv_wr32(dev, 0x4000c0, 0x00000016);
706 710
707 /* copy tile info from PFB */ 711 /* Turn all the tiling regions off. */
708 for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { 712 for (i = 0; i < NV10_PFB_TILE__SIZE; i++)
709 nv_wr32(dev, 0x00400904 + i * 0x10, 713 nv20_graph_set_region_tiling(dev, i, 0, 0, 0);
710 nv_rd32(dev, NV10_PFB_TLIMIT(i)));
711 /* which is NV40_PGRAPH_TLIMIT0(i) ?? */
712 nv_wr32(dev, 0x00400908 + i * 0x10,
713 nv_rd32(dev, NV10_PFB_TSIZE(i)));
714 /* which is NV40_PGRAPH_TSIZE0(i) ?? */
715 nv_wr32(dev, 0x00400900 + i * 0x10,
716 nv_rd32(dev, NV10_PFB_TILE(i)));
717 /* which is NV40_PGRAPH_TILE0(i) ?? */
718 }
719 714
720 nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100); 715 nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100);
721 nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF); 716 nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF);
diff --git a/drivers/gpu/drm/nouveau/nv40_fb.c b/drivers/gpu/drm/nouveau/nv40_fb.c
index ca1d27107a8e..3cd07d8d5bd7 100644
--- a/drivers/gpu/drm/nouveau/nv40_fb.c
+++ b/drivers/gpu/drm/nouveau/nv40_fb.c
@@ -3,12 +3,37 @@
3#include "nouveau_drv.h" 3#include "nouveau_drv.h"
4#include "nouveau_drm.h" 4#include "nouveau_drm.h"
5 5
6void
7nv40_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
8 uint32_t size, uint32_t pitch)
9{
10 struct drm_nouveau_private *dev_priv = dev->dev_private;
11 uint32_t limit = max(1u, addr + size) - 1;
12
13 if (pitch)
14 addr |= 1;
15
16 switch (dev_priv->chipset) {
17 case 0x40:
18 nv_wr32(dev, NV10_PFB_TLIMIT(i), limit);
19 nv_wr32(dev, NV10_PFB_TSIZE(i), pitch);
20 nv_wr32(dev, NV10_PFB_TILE(i), addr);
21 break;
22
23 default:
24 nv_wr32(dev, NV40_PFB_TLIMIT(i), limit);
25 nv_wr32(dev, NV40_PFB_TSIZE(i), pitch);
26 nv_wr32(dev, NV40_PFB_TILE(i), addr);
27 break;
28 }
29}
30
6int 31int
7nv40_fb_init(struct drm_device *dev) 32nv40_fb_init(struct drm_device *dev)
8{ 33{
9 struct drm_nouveau_private *dev_priv = dev->dev_private; 34 struct drm_nouveau_private *dev_priv = dev->dev_private;
10 uint32_t fb_bar_size, tmp; 35 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
11 int num_tiles; 36 uint32_t tmp;
12 int i; 37 int i;
13 38
14 /* This is strictly a NV4x register (don't know about NV5x). */ 39 /* This is strictly a NV4x register (don't know about NV5x). */
@@ -23,35 +48,23 @@ nv40_fb_init(struct drm_device *dev)
23 case 0x45: 48 case 0x45:
24 tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2); 49 tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2);
25 nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15)); 50 nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15));
26 num_tiles = NV10_PFB_TILE__SIZE; 51 pfb->num_tiles = NV10_PFB_TILE__SIZE;
27 break; 52 break;
28 case 0x46: /* G72 */ 53 case 0x46: /* G72 */
29 case 0x47: /* G70 */ 54 case 0x47: /* G70 */
30 case 0x49: /* G71 */ 55 case 0x49: /* G71 */
31 case 0x4b: /* G73 */ 56 case 0x4b: /* G73 */
32 case 0x4c: /* C51 (G7X version) */ 57 case 0x4c: /* C51 (G7X version) */
33 num_tiles = NV40_PFB_TILE__SIZE_1; 58 pfb->num_tiles = NV40_PFB_TILE__SIZE_1;
34 break; 59 break;
35 default: 60 default:
36 num_tiles = NV40_PFB_TILE__SIZE_0; 61 pfb->num_tiles = NV40_PFB_TILE__SIZE_0;
37 break; 62 break;
38 } 63 }
39 64
40 fb_bar_size = drm_get_resource_len(dev, 0) - 1; 65 /* Turn all the tiling regions off. */
41 switch (dev_priv->chipset) { 66 for (i = 0; i < pfb->num_tiles; i++)
42 case 0x40: 67 pfb->set_region_tiling(dev, i, 0, 0, 0);
43 for (i = 0; i < num_tiles; i++) {
44 nv_wr32(dev, NV10_PFB_TILE(i), 0);
45 nv_wr32(dev, NV10_PFB_TLIMIT(i), fb_bar_size);
46 }
47 break;
48 default:
49 for (i = 0; i < num_tiles; i++) {
50 nv_wr32(dev, NV40_PFB_TILE(i), 0);
51 nv_wr32(dev, NV40_PFB_TLIMIT(i), fb_bar_size);
52 }
53 break;
54 }
55 68
56 return 0; 69 return 0;
57} 70}
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c
index 7e8547cb5833..53e8afe1dcd1 100644
--- a/drivers/gpu/drm/nouveau/nv40_graph.c
+++ b/drivers/gpu/drm/nouveau/nv40_graph.c
@@ -24,36 +24,10 @@
24 * 24 *
25 */ 25 */
26 26
27#include <linux/firmware.h>
28
29#include "drmP.h" 27#include "drmP.h"
30#include "drm.h" 28#include "drm.h"
31#include "nouveau_drv.h" 29#include "nouveau_drv.h"
32 30#include "nouveau_grctx.h"
33MODULE_FIRMWARE("nouveau/nv40.ctxprog");
34MODULE_FIRMWARE("nouveau/nv40.ctxvals");
35MODULE_FIRMWARE("nouveau/nv41.ctxprog");
36MODULE_FIRMWARE("nouveau/nv41.ctxvals");
37MODULE_FIRMWARE("nouveau/nv42.ctxprog");
38MODULE_FIRMWARE("nouveau/nv42.ctxvals");
39MODULE_FIRMWARE("nouveau/nv43.ctxprog");
40MODULE_FIRMWARE("nouveau/nv43.ctxvals");
41MODULE_FIRMWARE("nouveau/nv44.ctxprog");
42MODULE_FIRMWARE("nouveau/nv44.ctxvals");
43MODULE_FIRMWARE("nouveau/nv46.ctxprog");
44MODULE_FIRMWARE("nouveau/nv46.ctxvals");
45MODULE_FIRMWARE("nouveau/nv47.ctxprog");
46MODULE_FIRMWARE("nouveau/nv47.ctxvals");
47MODULE_FIRMWARE("nouveau/nv49.ctxprog");
48MODULE_FIRMWARE("nouveau/nv49.ctxvals");
49MODULE_FIRMWARE("nouveau/nv4a.ctxprog");
50MODULE_FIRMWARE("nouveau/nv4a.ctxvals");
51MODULE_FIRMWARE("nouveau/nv4b.ctxprog");
52MODULE_FIRMWARE("nouveau/nv4b.ctxvals");
53MODULE_FIRMWARE("nouveau/nv4c.ctxprog");
54MODULE_FIRMWARE("nouveau/nv4c.ctxvals");
55MODULE_FIRMWARE("nouveau/nv4e.ctxprog");
56MODULE_FIRMWARE("nouveau/nv4e.ctxvals");
57 31
58struct nouveau_channel * 32struct nouveau_channel *
59nv40_graph_channel(struct drm_device *dev) 33nv40_graph_channel(struct drm_device *dev)
@@ -83,27 +57,30 @@ nv40_graph_create_context(struct nouveau_channel *chan)
83{ 57{
84 struct drm_device *dev = chan->dev; 58 struct drm_device *dev = chan->dev;
85 struct drm_nouveau_private *dev_priv = dev->dev_private; 59 struct drm_nouveau_private *dev_priv = dev->dev_private;
86 struct nouveau_gpuobj *ctx; 60 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
87 int ret; 61 int ret;
88 62
89 /* Allocate a 175KiB block of PRAMIN to store the context. This 63 ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, pgraph->grctx_size,
90 * is massive overkill for a lot of chipsets, but it should be safe 64 16, NVOBJ_FLAG_ZERO_ALLOC,
91 * until we're able to implement this properly (will happen at more 65 &chan->ramin_grctx);
92 * or less the same time we're able to write our own context programs.
93 */
94 ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, 175*1024, 16,
95 NVOBJ_FLAG_ZERO_ALLOC,
96 &chan->ramin_grctx);
97 if (ret) 66 if (ret)
98 return ret; 67 return ret;
99 ctx = chan->ramin_grctx->gpuobj;
100 68
101 /* Initialise default context values */ 69 /* Initialise default context values */
102 dev_priv->engine.instmem.prepare_access(dev, true); 70 dev_priv->engine.instmem.prepare_access(dev, true);
103 nv40_grctx_vals_load(dev, ctx); 71 if (!pgraph->ctxprog) {
104 nv_wo32(dev, ctx, 0, ctx->im_pramin->start); 72 struct nouveau_grctx ctx = {};
105 dev_priv->engine.instmem.finish_access(dev);
106 73
74 ctx.dev = chan->dev;
75 ctx.mode = NOUVEAU_GRCTX_VALS;
76 ctx.data = chan->ramin_grctx->gpuobj;
77 nv40_grctx_init(&ctx);
78 } else {
79 nouveau_grctx_vals_load(dev, chan->ramin_grctx->gpuobj);
80 }
81 nv_wo32(dev, chan->ramin_grctx->gpuobj, 0,
82 chan->ramin_grctx->gpuobj->im_pramin->start);
83 dev_priv->engine.instmem.finish_access(dev);
107 return 0; 84 return 0;
108} 85}
109 86
@@ -204,137 +181,46 @@ nv40_graph_unload_context(struct drm_device *dev)
204 return ret; 181 return ret;
205} 182}
206 183
207struct nouveau_ctxprog {
208 uint32_t signature;
209 uint8_t version;
210 uint16_t length;
211 uint32_t data[];
212} __attribute__ ((packed));
213
214struct nouveau_ctxvals {
215 uint32_t signature;
216 uint8_t version;
217 uint32_t length;
218 struct {
219 uint32_t offset;
220 uint32_t value;
221 } data[];
222} __attribute__ ((packed));
223
224int
225nv40_grctx_init(struct drm_device *dev)
226{
227 struct drm_nouveau_private *dev_priv = dev->dev_private;
228 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
229 const int chipset = dev_priv->chipset;
230 const struct firmware *fw;
231 const struct nouveau_ctxprog *cp;
232 const struct nouveau_ctxvals *cv;
233 char name[32];
234 int ret, i;
235
236 pgraph->accel_blocked = true;
237
238 if (!pgraph->ctxprog) {
239 sprintf(name, "nouveau/nv%02x.ctxprog", chipset);
240 ret = request_firmware(&fw, name, &dev->pdev->dev);
241 if (ret) {
242 NV_ERROR(dev, "No ctxprog for NV%02x\n", chipset);
243 return ret;
244 }
245
246 pgraph->ctxprog = kmalloc(fw->size, GFP_KERNEL);
247 if (!pgraph->ctxprog) {
248 NV_ERROR(dev, "OOM copying ctxprog\n");
249 release_firmware(fw);
250 return -ENOMEM;
251 }
252 memcpy(pgraph->ctxprog, fw->data, fw->size);
253
254 cp = pgraph->ctxprog;
255 if (le32_to_cpu(cp->signature) != 0x5043564e ||
256 cp->version != 0 ||
257 le16_to_cpu(cp->length) != ((fw->size - 7) / 4)) {
258 NV_ERROR(dev, "ctxprog invalid\n");
259 release_firmware(fw);
260 nv40_grctx_fini(dev);
261 return -EINVAL;
262 }
263 release_firmware(fw);
264 }
265
266 if (!pgraph->ctxvals) {
267 sprintf(name, "nouveau/nv%02x.ctxvals", chipset);
268 ret = request_firmware(&fw, name, &dev->pdev->dev);
269 if (ret) {
270 NV_ERROR(dev, "No ctxvals for NV%02x\n", chipset);
271 nv40_grctx_fini(dev);
272 return ret;
273 }
274
275 pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL);
276 if (!pgraph->ctxprog) {
277 NV_ERROR(dev, "OOM copying ctxprog\n");
278 release_firmware(fw);
279 nv40_grctx_fini(dev);
280 return -ENOMEM;
281 }
282 memcpy(pgraph->ctxvals, fw->data, fw->size);
283
284 cv = (void *)pgraph->ctxvals;
285 if (le32_to_cpu(cv->signature) != 0x5643564e ||
286 cv->version != 0 ||
287 le32_to_cpu(cv->length) != ((fw->size - 9) / 8)) {
288 NV_ERROR(dev, "ctxvals invalid\n");
289 release_firmware(fw);
290 nv40_grctx_fini(dev);
291 return -EINVAL;
292 }
293 release_firmware(fw);
294 }
295
296 cp = pgraph->ctxprog;
297
298 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
299 for (i = 0; i < le16_to_cpu(cp->length); i++)
300 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA,
301 le32_to_cpu(cp->data[i]));
302
303 pgraph->accel_blocked = false;
304 return 0;
305}
306
307void 184void
308nv40_grctx_fini(struct drm_device *dev) 185nv40_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr,
186 uint32_t size, uint32_t pitch)
309{ 187{
310 struct drm_nouveau_private *dev_priv = dev->dev_private; 188 struct drm_nouveau_private *dev_priv = dev->dev_private;
311 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; 189 uint32_t limit = max(1u, addr + size) - 1;
312
313 if (pgraph->ctxprog) {
314 kfree(pgraph->ctxprog);
315 pgraph->ctxprog = NULL;
316 }
317 190
318 if (pgraph->ctxvals) { 191 if (pitch)
319 kfree(pgraph->ctxprog); 192 addr |= 1;
320 pgraph->ctxvals = NULL;
321 }
322}
323 193
324void 194 switch (dev_priv->chipset) {
325nv40_grctx_vals_load(struct drm_device *dev, struct nouveau_gpuobj *ctx) 195 case 0x44:
326{ 196 case 0x4a:
327 struct drm_nouveau_private *dev_priv = dev->dev_private; 197 case 0x4e:
328 struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; 198 nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch);
329 struct nouveau_ctxvals *cv = pgraph->ctxvals; 199 nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit);
330 int i; 200 nv_wr32(dev, NV20_PGRAPH_TILE(i), addr);
201 break;
331 202
332 if (!cv) 203 case 0x46:
333 return; 204 case 0x47:
205 case 0x49:
206 case 0x4b:
207 nv_wr32(dev, NV47_PGRAPH_TSIZE(i), pitch);
208 nv_wr32(dev, NV47_PGRAPH_TLIMIT(i), limit);
209 nv_wr32(dev, NV47_PGRAPH_TILE(i), addr);
210 nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), pitch);
211 nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), limit);
212 nv_wr32(dev, NV40_PGRAPH_TILE1(i), addr);
213 break;
334 214
335 for (i = 0; i < le32_to_cpu(cv->length); i++) 215 default:
336 nv_wo32(dev, ctx, le32_to_cpu(cv->data[i].offset), 216 nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch);
337 le32_to_cpu(cv->data[i].value)); 217 nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit);
218 nv_wr32(dev, NV20_PGRAPH_TILE(i), addr);
219 nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), pitch);
220 nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), limit);
221 nv_wr32(dev, NV40_PGRAPH_TILE1(i), addr);
222 break;
223 }
338} 224}
339 225
340/* 226/*
@@ -351,7 +237,8 @@ nv40_graph_init(struct drm_device *dev)
351{ 237{
352 struct drm_nouveau_private *dev_priv = 238 struct drm_nouveau_private *dev_priv =
353 (struct drm_nouveau_private *)dev->dev_private; 239 (struct drm_nouveau_private *)dev->dev_private;
354 uint32_t vramsz, tmp; 240 struct nouveau_fb_engine *pfb = &dev_priv->engine.fb;
241 uint32_t vramsz;
355 int i, j; 242 int i, j;
356 243
357 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & 244 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) &
@@ -359,7 +246,26 @@ nv40_graph_init(struct drm_device *dev)
359 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | 246 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) |
360 NV_PMC_ENABLE_PGRAPH); 247 NV_PMC_ENABLE_PGRAPH);
361 248
362 nv40_grctx_init(dev); 249 if (nouveau_ctxfw) {
250 nouveau_grctx_prog_load(dev);
251 dev_priv->engine.graph.grctx_size = 175 * 1024;
252 }
253
254 if (!dev_priv->engine.graph.ctxprog) {
255 struct nouveau_grctx ctx = {};
256 uint32_t cp[256];
257
258 ctx.dev = dev;
259 ctx.mode = NOUVEAU_GRCTX_PROG;
260 ctx.data = cp;
261 ctx.ctxprog_max = 256;
262 nv40_grctx_init(&ctx);
263 dev_priv->engine.graph.grctx_size = ctx.ctxvals_pos * 4;
264
265 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0);
266 for (i = 0; i < ctx.ctxprog_len; i++)
267 nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]);
268 }
363 269
364 /* No context present currently */ 270 /* No context present currently */
365 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); 271 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
@@ -429,74 +335,9 @@ nv40_graph_init(struct drm_device *dev)
429 nv_wr32(dev, 0x400b38, 0x2ffff800); 335 nv_wr32(dev, 0x400b38, 0x2ffff800);
430 nv_wr32(dev, 0x400b3c, 0x00006000); 336 nv_wr32(dev, 0x400b3c, 0x00006000);
431 337
432 /* copy tile info from PFB */ 338 /* Turn all the tiling regions off. */
433 switch (dev_priv->chipset) { 339 for (i = 0; i < pfb->num_tiles; i++)
434 case 0x40: /* vanilla NV40 */ 340 nv40_graph_set_region_tiling(dev, i, 0, 0, 0);
435 for (i = 0; i < NV10_PFB_TILE__SIZE; i++) {
436 tmp = nv_rd32(dev, NV10_PFB_TILE(i));
437 nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp);
438 nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp);
439 tmp = nv_rd32(dev, NV10_PFB_TLIMIT(i));
440 nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp);
441 nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp);
442 tmp = nv_rd32(dev, NV10_PFB_TSIZE(i));
443 nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp);
444 nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp);
445 tmp = nv_rd32(dev, NV10_PFB_TSTATUS(i));
446 nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp);
447 nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp);
448 }
449 break;
450 case 0x44:
451 case 0x4a:
452 case 0x4e: /* NV44-based cores don't have 0x406900? */
453 for (i = 0; i < NV40_PFB_TILE__SIZE_0; i++) {
454 tmp = nv_rd32(dev, NV40_PFB_TILE(i));
455 nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp);
456 tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i));
457 nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp);
458 tmp = nv_rd32(dev, NV40_PFB_TSIZE(i));
459 nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp);
460 tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i));
461 nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp);
462 }
463 break;
464 case 0x46:
465 case 0x47:
466 case 0x49:
467 case 0x4b: /* G7X-based cores */
468 for (i = 0; i < NV40_PFB_TILE__SIZE_1; i++) {
469 tmp = nv_rd32(dev, NV40_PFB_TILE(i));
470 nv_wr32(dev, NV47_PGRAPH_TILE0(i), tmp);
471 nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp);
472 tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i));
473 nv_wr32(dev, NV47_PGRAPH_TLIMIT0(i), tmp);
474 nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp);
475 tmp = nv_rd32(dev, NV40_PFB_TSIZE(i));
476 nv_wr32(dev, NV47_PGRAPH_TSIZE0(i), tmp);
477 nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp);
478 tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i));
479 nv_wr32(dev, NV47_PGRAPH_TSTATUS0(i), tmp);
480 nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp);
481 }
482 break;
483 default: /* everything else */
484 for (i = 0; i < NV40_PFB_TILE__SIZE_0; i++) {
485 tmp = nv_rd32(dev, NV40_PFB_TILE(i));
486 nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp);
487 nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp);
488 tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i));
489 nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp);
490 nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp);
491 tmp = nv_rd32(dev, NV40_PFB_TSIZE(i));
492 nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp);
493 nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp);
494 tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i));
495 nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp);
496 nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp);
497 }
498 break;
499 }
500 341
501 /* begin RAM config */ 342 /* begin RAM config */
502 vramsz = drm_get_resource_len(dev, 0) - 1; 343 vramsz = drm_get_resource_len(dev, 0) - 1;
@@ -539,6 +380,7 @@ nv40_graph_init(struct drm_device *dev)
539 380
540void nv40_graph_takedown(struct drm_device *dev) 381void nv40_graph_takedown(struct drm_device *dev)
541{ 382{
383 nouveau_grctx_fini(dev);
542} 384}
543 385
544struct nouveau_pgraph_object_class nv40_graph_grclass[] = { 386struct nouveau_pgraph_object_class nv40_graph_grclass[] = {
diff --git a/drivers/gpu/drm/nouveau/nv40_grctx.c b/drivers/gpu/drm/nouveau/nv40_grctx.c
new file mode 100644
index 000000000000..11b11c31f543
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nv40_grctx.c
@@ -0,0 +1,678 @@
1/*
2 * Copyright 2009 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
25/* NVIDIA context programs handle a number of other conditions which are
26 * not implemented in our versions. It's not clear why NVIDIA context
27 * programs have this code, nor whether it's strictly necessary for
28 * correct operation. We'll implement additional handling if/when we
29 * discover it's necessary.
30 *
31 * - On context save, NVIDIA set 0x400314 bit 0 to 1 if the "3D state"
32 * flag is set, this gets saved into the context.
33 * - On context save, the context program for all cards load nsource
34 * into a flag register and check for ILLEGAL_MTHD. If it's set,
35 * opcode 0x60000d is called before resuming normal operation.
36 * - Some context programs check more conditions than the above. NV44
37 * checks: ((nsource & 0x0857) || (0x400718 & 0x0100) || (intr & 0x0001))
38 * and calls 0x60000d before resuming normal operation.
39 * - At the very beginning of NVIDIA's context programs, flag 9 is checked
40 * and if true 0x800001 is called with count=0, pos=0, the flag is cleared
41 * and then the ctxprog is aborted. It looks like a complicated NOP,
42 * its purpose is unknown.
43 * - In the section of code that loads the per-vs state, NVIDIA check
44 * flag 10. If it's set, they only transfer the small 0x300 byte block
45 * of state + the state for a single vs as opposed to the state for
46 * all vs units. It doesn't seem likely that it'll occur in normal
47 * operation, especially seeing as it appears NVIDIA may have screwed
48 * up the ctxprogs for some cards and have an invalid instruction
49 * rather than a cp_lsr(ctx, dwords_for_1_vs_unit) instruction.
50 * - There's a number of places where context offset 0 (where we place
51 * the PRAMIN offset of the context) is loaded into either 0x408000,
52 * 0x408004 or 0x408008. Not sure what's up there either.
53 * - The ctxprogs for some cards save 0x400a00 again during the cleanup
54 * path for auto-loadctx.
55 */
56
57#define CP_FLAG_CLEAR 0
58#define CP_FLAG_SET 1
59#define CP_FLAG_SWAP_DIRECTION ((0 * 32) + 0)
60#define CP_FLAG_SWAP_DIRECTION_LOAD 0
61#define CP_FLAG_SWAP_DIRECTION_SAVE 1
62#define CP_FLAG_USER_SAVE ((0 * 32) + 5)
63#define CP_FLAG_USER_SAVE_NOT_PENDING 0
64#define CP_FLAG_USER_SAVE_PENDING 1
65#define CP_FLAG_USER_LOAD ((0 * 32) + 6)
66#define CP_FLAG_USER_LOAD_NOT_PENDING 0
67#define CP_FLAG_USER_LOAD_PENDING 1
68#define CP_FLAG_STATUS ((3 * 32) + 0)
69#define CP_FLAG_STATUS_IDLE 0
70#define CP_FLAG_STATUS_BUSY 1
71#define CP_FLAG_AUTO_SAVE ((3 * 32) + 4)
72#define CP_FLAG_AUTO_SAVE_NOT_PENDING 0
73#define CP_FLAG_AUTO_SAVE_PENDING 1
74#define CP_FLAG_AUTO_LOAD ((3 * 32) + 5)
75#define CP_FLAG_AUTO_LOAD_NOT_PENDING 0
76#define CP_FLAG_AUTO_LOAD_PENDING 1
77#define CP_FLAG_UNK54 ((3 * 32) + 6)
78#define CP_FLAG_UNK54_CLEAR 0
79#define CP_FLAG_UNK54_SET 1
80#define CP_FLAG_ALWAYS ((3 * 32) + 8)
81#define CP_FLAG_ALWAYS_FALSE 0
82#define CP_FLAG_ALWAYS_TRUE 1
83#define CP_FLAG_UNK57 ((3 * 32) + 9)
84#define CP_FLAG_UNK57_CLEAR 0
85#define CP_FLAG_UNK57_SET 1
86
87#define CP_CTX 0x00100000
88#define CP_CTX_COUNT 0x000fc000
89#define CP_CTX_COUNT_SHIFT 14
90#define CP_CTX_REG 0x00003fff
91#define CP_LOAD_SR 0x00200000
92#define CP_LOAD_SR_VALUE 0x000fffff
93#define CP_BRA 0x00400000
94#define CP_BRA_IP 0x0000ff00
95#define CP_BRA_IP_SHIFT 8
96#define CP_BRA_IF_CLEAR 0x00000080
97#define CP_BRA_FLAG 0x0000007f
98#define CP_WAIT 0x00500000
99#define CP_WAIT_SET 0x00000080
100#define CP_WAIT_FLAG 0x0000007f
101#define CP_SET 0x00700000
102#define CP_SET_1 0x00000080
103#define CP_SET_FLAG 0x0000007f
104#define CP_NEXT_TO_SWAP 0x00600007
105#define CP_NEXT_TO_CURRENT 0x00600009
106#define CP_SET_CONTEXT_POINTER 0x0060000a
107#define CP_END 0x0060000e
108#define CP_LOAD_MAGIC_UNK01 0x00800001 /* unknown */
109#define CP_LOAD_MAGIC_NV44TCL 0x00800029 /* per-vs state (0x4497) */
110#define CP_LOAD_MAGIC_NV40TCL 0x00800041 /* per-vs state (0x4097) */
111
112#include "drmP.h"
113#include "nouveau_drv.h"
114#include "nouveau_grctx.h"
115
116/* TODO:
117 * - get vs count from 0x1540
118 * - document unimplemented bits compared to nvidia
119 * - nsource handling
120 * - R0 & 0x0200 handling
121 * - single-vs handling
122 * - 400314 bit 0
123 */
124
125static int
126nv40_graph_4097(struct drm_device *dev)
127{
128 struct drm_nouveau_private *dev_priv = dev->dev_private;
129
130 if ((dev_priv->chipset & 0xf0) == 0x60)
131 return 0;
132
133 return !!(0x0baf & (1 << dev_priv->chipset));
134}
135
136static int
137nv40_graph_vs_count(struct drm_device *dev)
138{
139 struct drm_nouveau_private *dev_priv = dev->dev_private;
140
141 switch (dev_priv->chipset) {
142 case 0x47:
143 case 0x49:
144 case 0x4b:
145 return 8;
146 case 0x40:
147 return 6;
148 case 0x41:
149 case 0x42:
150 return 5;
151 case 0x43:
152 case 0x44:
153 case 0x46:
154 case 0x4a:
155 return 3;
156 case 0x4c:
157 case 0x4e:
158 case 0x67:
159 default:
160 return 1;
161 }
162}
163
164
165enum cp_label {
166 cp_check_load = 1,
167 cp_setup_auto_load,
168 cp_setup_load,
169 cp_setup_save,
170 cp_swap_state,
171 cp_swap_state3d_3_is_save,
172 cp_prepare_exit,
173 cp_exit,
174};
175
176static void
177nv40_graph_construct_general(struct nouveau_grctx *ctx)
178{
179 struct drm_nouveau_private *dev_priv = ctx->dev->dev_private;
180 int i;
181
182 cp_ctx(ctx, 0x4000a4, 1);
183 gr_def(ctx, 0x4000a4, 0x00000008);
184 cp_ctx(ctx, 0x400144, 58);
185 gr_def(ctx, 0x400144, 0x00000001);
186 cp_ctx(ctx, 0x400314, 1);
187 gr_def(ctx, 0x400314, 0x00000000);
188 cp_ctx(ctx, 0x400400, 10);
189 cp_ctx(ctx, 0x400480, 10);
190 cp_ctx(ctx, 0x400500, 19);
191 gr_def(ctx, 0x400514, 0x00040000);
192 gr_def(ctx, 0x400524, 0x55555555);
193 gr_def(ctx, 0x400528, 0x55555555);
194 gr_def(ctx, 0x40052c, 0x55555555);
195 gr_def(ctx, 0x400530, 0x55555555);
196 cp_ctx(ctx, 0x400560, 6);
197 gr_def(ctx, 0x400568, 0x0000ffff);
198 gr_def(ctx, 0x40056c, 0x0000ffff);
199 cp_ctx(ctx, 0x40057c, 5);
200 cp_ctx(ctx, 0x400710, 3);
201 gr_def(ctx, 0x400710, 0x20010001);
202 gr_def(ctx, 0x400714, 0x0f73ef00);
203 cp_ctx(ctx, 0x400724, 1);
204 gr_def(ctx, 0x400724, 0x02008821);
205 cp_ctx(ctx, 0x400770, 3);
206 if (dev_priv->chipset == 0x40) {
207 cp_ctx(ctx, 0x400814, 4);
208 cp_ctx(ctx, 0x400828, 5);
209 cp_ctx(ctx, 0x400840, 5);
210 gr_def(ctx, 0x400850, 0x00000040);
211 cp_ctx(ctx, 0x400858, 4);
212 gr_def(ctx, 0x400858, 0x00000040);
213 gr_def(ctx, 0x40085c, 0x00000040);
214 gr_def(ctx, 0x400864, 0x80000000);
215 cp_ctx(ctx, 0x40086c, 9);
216 gr_def(ctx, 0x40086c, 0x80000000);
217 gr_def(ctx, 0x400870, 0x80000000);
218 gr_def(ctx, 0x400874, 0x80000000);
219 gr_def(ctx, 0x400878, 0x80000000);
220 gr_def(ctx, 0x400888, 0x00000040);
221 gr_def(ctx, 0x40088c, 0x80000000);
222 cp_ctx(ctx, 0x4009c0, 8);
223 gr_def(ctx, 0x4009cc, 0x80000000);
224 gr_def(ctx, 0x4009dc, 0x80000000);
225 } else {
226 cp_ctx(ctx, 0x400840, 20);
227 if (!nv40_graph_4097(ctx->dev)) {
228 for (i = 0; i < 8; i++)
229 gr_def(ctx, 0x400860 + (i * 4), 0x00000001);
230 }
231 gr_def(ctx, 0x400880, 0x00000040);
232 gr_def(ctx, 0x400884, 0x00000040);
233 gr_def(ctx, 0x400888, 0x00000040);
234 cp_ctx(ctx, 0x400894, 11);
235 gr_def(ctx, 0x400894, 0x00000040);
236 if (nv40_graph_4097(ctx->dev)) {
237 for (i = 0; i < 8; i++)
238 gr_def(ctx, 0x4008a0 + (i * 4), 0x80000000);
239 }
240 cp_ctx(ctx, 0x4008e0, 2);
241 cp_ctx(ctx, 0x4008f8, 2);
242 if (dev_priv->chipset == 0x4c ||
243 (dev_priv->chipset & 0xf0) == 0x60)
244 cp_ctx(ctx, 0x4009f8, 1);
245 }
246 cp_ctx(ctx, 0x400a00, 73);
247 gr_def(ctx, 0x400b0c, 0x0b0b0b0c);
248 cp_ctx(ctx, 0x401000, 4);
249 cp_ctx(ctx, 0x405004, 1);
250 switch (dev_priv->chipset) {
251 case 0x47:
252 case 0x49:
253 case 0x4b:
254 cp_ctx(ctx, 0x403448, 1);
255 gr_def(ctx, 0x403448, 0x00001010);
256 break;
257 default:
258 cp_ctx(ctx, 0x403440, 1);
259 switch (dev_priv->chipset) {
260 case 0x40:
261 gr_def(ctx, 0x403440, 0x00000010);
262 break;
263 case 0x44:
264 case 0x46:
265 case 0x4a:
266 gr_def(ctx, 0x403440, 0x00003010);
267 break;
268 case 0x41:
269 case 0x42:
270 case 0x43:
271 case 0x4c:
272 case 0x4e:
273 case 0x67:
274 default:
275 gr_def(ctx, 0x403440, 0x00001010);
276 break;
277 }
278 break;
279 }
280}
281
282static void
283nv40_graph_construct_state3d(struct nouveau_grctx *ctx)
284{
285 struct drm_nouveau_private *dev_priv = ctx->dev->dev_private;
286 int i;
287
288 if (dev_priv->chipset == 0x40) {
289 cp_ctx(ctx, 0x401880, 51);
290 gr_def(ctx, 0x401940, 0x00000100);
291 } else
292 if (dev_priv->chipset == 0x46 || dev_priv->chipset == 0x47 ||
293 dev_priv->chipset == 0x49 || dev_priv->chipset == 0x4b) {
294 cp_ctx(ctx, 0x401880, 32);
295 for (i = 0; i < 16; i++)
296 gr_def(ctx, 0x401880 + (i * 4), 0x00000111);
297 if (dev_priv->chipset == 0x46)
298 cp_ctx(ctx, 0x401900, 16);
299 cp_ctx(ctx, 0x401940, 3);
300 }
301 cp_ctx(ctx, 0x40194c, 18);
302 gr_def(ctx, 0x401954, 0x00000111);
303 gr_def(ctx, 0x401958, 0x00080060);
304 gr_def(ctx, 0x401974, 0x00000080);
305 gr_def(ctx, 0x401978, 0xffff0000);
306 gr_def(ctx, 0x40197c, 0x00000001);
307 gr_def(ctx, 0x401990, 0x46400000);
308 if (dev_priv->chipset == 0x40) {
309 cp_ctx(ctx, 0x4019a0, 2);
310 cp_ctx(ctx, 0x4019ac, 5);
311 } else {
312 cp_ctx(ctx, 0x4019a0, 1);
313 cp_ctx(ctx, 0x4019b4, 3);
314 }
315 gr_def(ctx, 0x4019bc, 0xffff0000);
316 switch (dev_priv->chipset) {
317 case 0x46:
318 case 0x47:
319 case 0x49:
320 case 0x4b:
321 cp_ctx(ctx, 0x4019c0, 18);
322 for (i = 0; i < 16; i++)
323 gr_def(ctx, 0x4019c0 + (i * 4), 0x88888888);
324 break;
325 }
326 cp_ctx(ctx, 0x401a08, 8);
327 gr_def(ctx, 0x401a10, 0x0fff0000);
328 gr_def(ctx, 0x401a14, 0x0fff0000);
329 gr_def(ctx, 0x401a1c, 0x00011100);
330 cp_ctx(ctx, 0x401a2c, 4);
331 cp_ctx(ctx, 0x401a44, 26);
332 for (i = 0; i < 16; i++)
333 gr_def(ctx, 0x401a44 + (i * 4), 0x07ff0000);
334 gr_def(ctx, 0x401a8c, 0x4b7fffff);
335 if (dev_priv->chipset == 0x40) {
336 cp_ctx(ctx, 0x401ab8, 3);
337 } else {
338 cp_ctx(ctx, 0x401ab8, 1);
339 cp_ctx(ctx, 0x401ac0, 1);
340 }
341 cp_ctx(ctx, 0x401ad0, 8);
342 gr_def(ctx, 0x401ad0, 0x30201000);
343 gr_def(ctx, 0x401ad4, 0x70605040);
344 gr_def(ctx, 0x401ad8, 0xb8a89888);
345 gr_def(ctx, 0x401adc, 0xf8e8d8c8);
346 cp_ctx(ctx, 0x401b10, dev_priv->chipset == 0x40 ? 2 : 1);
347 gr_def(ctx, 0x401b10, 0x40100000);
348 cp_ctx(ctx, 0x401b18, dev_priv->chipset == 0x40 ? 6 : 5);
349 gr_def(ctx, 0x401b28, dev_priv->chipset == 0x40 ?
350 0x00000004 : 0x00000000);
351 cp_ctx(ctx, 0x401b30, 25);
352 gr_def(ctx, 0x401b34, 0x0000ffff);
353 gr_def(ctx, 0x401b68, 0x435185d6);
354 gr_def(ctx, 0x401b6c, 0x2155b699);
355 gr_def(ctx, 0x401b70, 0xfedcba98);
356 gr_def(ctx, 0x401b74, 0x00000098);
357 gr_def(ctx, 0x401b84, 0xffffffff);
358 gr_def(ctx, 0x401b88, 0x00ff7000);
359 gr_def(ctx, 0x401b8c, 0x0000ffff);
360 if (dev_priv->chipset != 0x44 && dev_priv->chipset != 0x4a &&
361 dev_priv->chipset != 0x4e)
362 cp_ctx(ctx, 0x401b94, 1);
363 cp_ctx(ctx, 0x401b98, 8);
364 gr_def(ctx, 0x401b9c, 0x00ff0000);
365 cp_ctx(ctx, 0x401bc0, 9);
366 gr_def(ctx, 0x401be0, 0x00ffff00);
367 cp_ctx(ctx, 0x401c00, 192);
368 for (i = 0; i < 16; i++) { /* fragment texture units */
369 gr_def(ctx, 0x401c40 + (i * 4), 0x00018488);
370 gr_def(ctx, 0x401c80 + (i * 4), 0x00028202);
371 gr_def(ctx, 0x401d00 + (i * 4), 0x0000aae4);
372 gr_def(ctx, 0x401d40 + (i * 4), 0x01012000);
373 gr_def(ctx, 0x401d80 + (i * 4), 0x00080008);
374 gr_def(ctx, 0x401e00 + (i * 4), 0x00100008);
375 }
376 for (i = 0; i < 4; i++) { /* vertex texture units */
377 gr_def(ctx, 0x401e90 + (i * 4), 0x0001bc80);
378 gr_def(ctx, 0x401ea0 + (i * 4), 0x00000202);
379 gr_def(ctx, 0x401ec0 + (i * 4), 0x00000008);
380 gr_def(ctx, 0x401ee0 + (i * 4), 0x00080008);
381 }
382 cp_ctx(ctx, 0x400f5c, 3);
383 gr_def(ctx, 0x400f5c, 0x00000002);
384 cp_ctx(ctx, 0x400f84, 1);
385}
386
387static void
388nv40_graph_construct_state3d_2(struct nouveau_grctx *ctx)
389{
390 struct drm_nouveau_private *dev_priv = ctx->dev->dev_private;
391 int i;
392
393 cp_ctx(ctx, 0x402000, 1);
394 cp_ctx(ctx, 0x402404, dev_priv->chipset == 0x40 ? 1 : 2);
395 switch (dev_priv->chipset) {
396 case 0x40:
397 gr_def(ctx, 0x402404, 0x00000001);
398 break;
399 case 0x4c:
400 case 0x4e:
401 case 0x67:
402 gr_def(ctx, 0x402404, 0x00000020);
403 break;
404 case 0x46:
405 case 0x49:
406 case 0x4b:
407 gr_def(ctx, 0x402404, 0x00000421);
408 break;
409 default:
410 gr_def(ctx, 0x402404, 0x00000021);
411 }
412 if (dev_priv->chipset != 0x40)
413 gr_def(ctx, 0x402408, 0x030c30c3);
414 switch (dev_priv->chipset) {
415 case 0x44:
416 case 0x46:
417 case 0x4a:
418 case 0x4c:
419 case 0x4e:
420 case 0x67:
421 cp_ctx(ctx, 0x402440, 1);
422 gr_def(ctx, 0x402440, 0x00011001);
423 break;
424 default:
425 break;
426 }
427 cp_ctx(ctx, 0x402480, dev_priv->chipset == 0x40 ? 8 : 9);
428 gr_def(ctx, 0x402488, 0x3e020200);
429 gr_def(ctx, 0x40248c, 0x00ffffff);
430 switch (dev_priv->chipset) {
431 case 0x40:
432 gr_def(ctx, 0x402490, 0x60103f00);
433 break;
434 case 0x47:
435 gr_def(ctx, 0x402490, 0x40103f00);
436 break;
437 case 0x41:
438 case 0x42:
439 case 0x49:
440 case 0x4b:
441 gr_def(ctx, 0x402490, 0x20103f00);
442 break;
443 default:
444 gr_def(ctx, 0x402490, 0x0c103f00);
445 break;
446 }
447 gr_def(ctx, 0x40249c, dev_priv->chipset <= 0x43 ?
448 0x00020000 : 0x00040000);
449 cp_ctx(ctx, 0x402500, 31);
450 gr_def(ctx, 0x402530, 0x00008100);
451 if (dev_priv->chipset == 0x40)
452 cp_ctx(ctx, 0x40257c, 6);
453 cp_ctx(ctx, 0x402594, 16);
454 cp_ctx(ctx, 0x402800, 17);
455 gr_def(ctx, 0x402800, 0x00000001);
456 switch (dev_priv->chipset) {
457 case 0x47:
458 case 0x49:
459 case 0x4b:
460 cp_ctx(ctx, 0x402864, 1);
461 gr_def(ctx, 0x402864, 0x00001001);
462 cp_ctx(ctx, 0x402870, 3);
463 gr_def(ctx, 0x402878, 0x00000003);
464 if (dev_priv->chipset != 0x47) { /* belong at end!! */
465 cp_ctx(ctx, 0x402900, 1);
466 cp_ctx(ctx, 0x402940, 1);
467 cp_ctx(ctx, 0x402980, 1);
468 cp_ctx(ctx, 0x4029c0, 1);
469 cp_ctx(ctx, 0x402a00, 1);
470 cp_ctx(ctx, 0x402a40, 1);
471 cp_ctx(ctx, 0x402a80, 1);
472 cp_ctx(ctx, 0x402ac0, 1);
473 }
474 break;
475 case 0x40:
476 cp_ctx(ctx, 0x402844, 1);
477 gr_def(ctx, 0x402844, 0x00000001);
478 cp_ctx(ctx, 0x402850, 1);
479 break;
480 default:
481 cp_ctx(ctx, 0x402844, 1);
482 gr_def(ctx, 0x402844, 0x00001001);
483 cp_ctx(ctx, 0x402850, 2);
484 gr_def(ctx, 0x402854, 0x00000003);
485 break;
486 }
487
488 cp_ctx(ctx, 0x402c00, 4);
489 gr_def(ctx, 0x402c00, dev_priv->chipset == 0x40 ?
490 0x80800001 : 0x00888001);
491 switch (dev_priv->chipset) {
492 case 0x47:
493 case 0x49:
494 case 0x4b:
495 cp_ctx(ctx, 0x402c20, 40);
496 for (i = 0; i < 32; i++)
497 gr_def(ctx, 0x402c40 + (i * 4), 0xffffffff);
498 cp_ctx(ctx, 0x4030b8, 13);
499 gr_def(ctx, 0x4030dc, 0x00000005);
500 gr_def(ctx, 0x4030e8, 0x0000ffff);
501 break;
502 default:
503 cp_ctx(ctx, 0x402c10, 4);
504 if (dev_priv->chipset == 0x40)
505 cp_ctx(ctx, 0x402c20, 36);
506 else
507 if (dev_priv->chipset <= 0x42)
508 cp_ctx(ctx, 0x402c20, 24);
509 else
510 if (dev_priv->chipset <= 0x4a)
511 cp_ctx(ctx, 0x402c20, 16);
512 else
513 cp_ctx(ctx, 0x402c20, 8);
514 cp_ctx(ctx, 0x402cb0, dev_priv->chipset == 0x40 ? 12 : 13);
515 gr_def(ctx, 0x402cd4, 0x00000005);
516 if (dev_priv->chipset != 0x40)
517 gr_def(ctx, 0x402ce0, 0x0000ffff);
518 break;
519 }
520
521 cp_ctx(ctx, 0x403400, dev_priv->chipset == 0x40 ? 4 : 3);
522 cp_ctx(ctx, 0x403410, dev_priv->chipset == 0x40 ? 4 : 3);
523 cp_ctx(ctx, 0x403420, nv40_graph_vs_count(ctx->dev));
524 for (i = 0; i < nv40_graph_vs_count(ctx->dev); i++)
525 gr_def(ctx, 0x403420 + (i * 4), 0x00005555);
526
527 if (dev_priv->chipset != 0x40) {
528 cp_ctx(ctx, 0x403600, 1);
529 gr_def(ctx, 0x403600, 0x00000001);
530 }
531 cp_ctx(ctx, 0x403800, 1);
532
533 cp_ctx(ctx, 0x403c18, 1);
534 gr_def(ctx, 0x403c18, 0x00000001);
535 switch (dev_priv->chipset) {
536 case 0x46:
537 case 0x47:
538 case 0x49:
539 case 0x4b:
540 cp_ctx(ctx, 0x405018, 1);
541 gr_def(ctx, 0x405018, 0x08e00001);
542 cp_ctx(ctx, 0x405c24, 1);
543 gr_def(ctx, 0x405c24, 0x000e3000);
544 break;
545 }
546 if (dev_priv->chipset != 0x4e)
547 cp_ctx(ctx, 0x405800, 11);
548 cp_ctx(ctx, 0x407000, 1);
549}
550
551static void
552nv40_graph_construct_state3d_3(struct nouveau_grctx *ctx)
553{
554 int len = nv40_graph_4097(ctx->dev) ? 0x0684 : 0x0084;
555
556 cp_out (ctx, 0x300000);
557 cp_lsr (ctx, len - 4);
558 cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_swap_state3d_3_is_save);
559 cp_lsr (ctx, len);
560 cp_name(ctx, cp_swap_state3d_3_is_save);
561 cp_out (ctx, 0x800001);
562
563 ctx->ctxvals_pos += len;
564}
565
566static void
567nv40_graph_construct_shader(struct nouveau_grctx *ctx)
568{
569 struct drm_device *dev = ctx->dev;
570 struct drm_nouveau_private *dev_priv = dev->dev_private;
571 struct nouveau_gpuobj *obj = ctx->data;
572 int vs, vs_nr, vs_len, vs_nr_b0, vs_nr_b1, b0_offset, b1_offset;
573 int offset, i;
574
575 vs_nr = nv40_graph_vs_count(ctx->dev);
576 vs_nr_b0 = 363;
577 vs_nr_b1 = dev_priv->chipset == 0x40 ? 128 : 64;
578 if (dev_priv->chipset == 0x40) {
579 b0_offset = 0x2200/4; /* 33a0 */
580 b1_offset = 0x55a0/4; /* 1500 */
581 vs_len = 0x6aa0/4;
582 } else
583 if (dev_priv->chipset == 0x41 || dev_priv->chipset == 0x42) {
584 b0_offset = 0x2200/4; /* 2200 */
585 b1_offset = 0x4400/4; /* 0b00 */
586 vs_len = 0x4f00/4;
587 } else {
588 b0_offset = 0x1d40/4; /* 2200 */
589 b1_offset = 0x3f40/4; /* 0b00 : 0a40 */
590 vs_len = nv40_graph_4097(dev) ? 0x4a40/4 : 0x4980/4;
591 }
592
593 cp_lsr(ctx, vs_len * vs_nr + 0x300/4);
594 cp_out(ctx, nv40_graph_4097(dev) ? 0x800041 : 0x800029);
595
596 offset = ctx->ctxvals_pos;
597 ctx->ctxvals_pos += (0x0300/4 + (vs_nr * vs_len));
598
599 if (ctx->mode != NOUVEAU_GRCTX_VALS)
600 return;
601
602 offset += 0x0280/4;
603 for (i = 0; i < 16; i++, offset += 2)
604 nv_wo32(dev, obj, offset, 0x3f800000);
605
606 for (vs = 0; vs < vs_nr; vs++, offset += vs_len) {
607 for (i = 0; i < vs_nr_b0 * 6; i += 6)
608 nv_wo32(dev, obj, offset + b0_offset + i, 0x00000001);
609 for (i = 0; i < vs_nr_b1 * 4; i += 4)
610 nv_wo32(dev, obj, offset + b1_offset + i, 0x3f800000);
611 }
612}
613
614void
615nv40_grctx_init(struct nouveau_grctx *ctx)
616{
617 /* decide whether we're loading/unloading the context */
618 cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save);
619 cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save);
620
621 cp_name(ctx, cp_check_load);
622 cp_bra (ctx, AUTO_LOAD, PENDING, cp_setup_auto_load);
623 cp_bra (ctx, USER_LOAD, PENDING, cp_setup_load);
624 cp_bra (ctx, ALWAYS, TRUE, cp_exit);
625
626 /* setup for context load */
627 cp_name(ctx, cp_setup_auto_load);
628 cp_wait(ctx, STATUS, IDLE);
629 cp_out (ctx, CP_NEXT_TO_SWAP);
630 cp_name(ctx, cp_setup_load);
631 cp_wait(ctx, STATUS, IDLE);
632 cp_set (ctx, SWAP_DIRECTION, LOAD);
633 cp_out (ctx, 0x00910880); /* ?? */
634 cp_out (ctx, 0x00901ffe); /* ?? */
635 cp_out (ctx, 0x01940000); /* ?? */
636 cp_lsr (ctx, 0x20);
637 cp_out (ctx, 0x0060000b); /* ?? */
638 cp_wait(ctx, UNK57, CLEAR);
639 cp_out (ctx, 0x0060000c); /* ?? */
640 cp_bra (ctx, ALWAYS, TRUE, cp_swap_state);
641
642 /* setup for context save */
643 cp_name(ctx, cp_setup_save);
644 cp_set (ctx, SWAP_DIRECTION, SAVE);
645
646 /* general PGRAPH state */
647 cp_name(ctx, cp_swap_state);
648 cp_pos (ctx, 0x00020/4);
649 nv40_graph_construct_general(ctx);
650 cp_wait(ctx, STATUS, IDLE);
651
652 /* 3D state, block 1 */
653 cp_bra (ctx, UNK54, CLEAR, cp_prepare_exit);
654 nv40_graph_construct_state3d(ctx);
655 cp_wait(ctx, STATUS, IDLE);
656
657 /* 3D state, block 2 */
658 nv40_graph_construct_state3d_2(ctx);
659
660 /* Some other block of "random" state */
661 nv40_graph_construct_state3d_3(ctx);
662
663 /* Per-vertex shader state */
664 cp_pos (ctx, ctx->ctxvals_pos);
665 nv40_graph_construct_shader(ctx);
666
667 /* pre-exit state updates */
668 cp_name(ctx, cp_prepare_exit);
669 cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_check_load);
670 cp_bra (ctx, USER_SAVE, PENDING, cp_exit);
671 cp_out (ctx, CP_NEXT_TO_CURRENT);
672
673 cp_name(ctx, cp_exit);
674 cp_set (ctx, USER_SAVE, NOT_PENDING);
675 cp_set (ctx, USER_LOAD, NOT_PENDING);
676 cp_out (ctx, CP_END);
677}
678
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index f8e28a1e44e7..118d3285fd8c 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -45,7 +45,7 @@ nv50_crtc_lut_load(struct drm_crtc *crtc)
45 void __iomem *lut = nvbo_kmap_obj_iovirtual(nv_crtc->lut.nvbo); 45 void __iomem *lut = nvbo_kmap_obj_iovirtual(nv_crtc->lut.nvbo);
46 int i; 46 int i;
47 47
48 NV_DEBUG(crtc->dev, "\n"); 48 NV_DEBUG_KMS(crtc->dev, "\n");
49 49
50 for (i = 0; i < 256; i++) { 50 for (i = 0; i < 256; i++) {
51 writew(nv_crtc->lut.r[i] >> 2, lut + 8*i + 0); 51 writew(nv_crtc->lut.r[i] >> 2, lut + 8*i + 0);
@@ -68,8 +68,8 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked)
68 struct nouveau_channel *evo = dev_priv->evo; 68 struct nouveau_channel *evo = dev_priv->evo;
69 int index = nv_crtc->index, ret; 69 int index = nv_crtc->index, ret;
70 70
71 NV_DEBUG(dev, "index %d\n", nv_crtc->index); 71 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
72 NV_DEBUG(dev, "%s\n", blanked ? "blanked" : "unblanked"); 72 NV_DEBUG_KMS(dev, "%s\n", blanked ? "blanked" : "unblanked");
73 73
74 if (blanked) { 74 if (blanked) {
75 nv_crtc->cursor.hide(nv_crtc, false); 75 nv_crtc->cursor.hide(nv_crtc, false);
@@ -139,7 +139,7 @@ nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update)
139 struct nouveau_channel *evo = dev_priv->evo; 139 struct nouveau_channel *evo = dev_priv->evo;
140 int ret; 140 int ret;
141 141
142 NV_DEBUG(dev, "\n"); 142 NV_DEBUG_KMS(dev, "\n");
143 143
144 ret = RING_SPACE(evo, 2 + (update ? 2 : 0)); 144 ret = RING_SPACE(evo, 2 + (update ? 2 : 0));
145 if (ret) { 145 if (ret) {
@@ -193,7 +193,7 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update)
193 uint32_t outX, outY, horiz, vert; 193 uint32_t outX, outY, horiz, vert;
194 int ret; 194 int ret;
195 195
196 NV_DEBUG(dev, "\n"); 196 NV_DEBUG_KMS(dev, "\n");
197 197
198 switch (scaling_mode) { 198 switch (scaling_mode) {
199 case DRM_MODE_SCALE_NONE: 199 case DRM_MODE_SCALE_NONE:
@@ -301,7 +301,7 @@ nv50_crtc_destroy(struct drm_crtc *crtc)
301 struct drm_device *dev = crtc->dev; 301 struct drm_device *dev = crtc->dev;
302 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 302 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
303 303
304 NV_DEBUG(dev, "\n"); 304 NV_DEBUG_KMS(dev, "\n");
305 305
306 if (!crtc) 306 if (!crtc)
307 return; 307 return;
@@ -433,7 +433,7 @@ nv50_crtc_prepare(struct drm_crtc *crtc)
433 struct drm_device *dev = crtc->dev; 433 struct drm_device *dev = crtc->dev;
434 struct drm_encoder *encoder; 434 struct drm_encoder *encoder;
435 435
436 NV_DEBUG(dev, "index %d\n", nv_crtc->index); 436 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
437 437
438 /* Disconnect all unused encoders. */ 438 /* Disconnect all unused encoders. */
439 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 439 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
@@ -458,7 +458,7 @@ nv50_crtc_commit(struct drm_crtc *crtc)
458 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 458 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
459 int ret; 459 int ret;
460 460
461 NV_DEBUG(dev, "index %d\n", nv_crtc->index); 461 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
462 462
463 nv50_crtc_blank(nv_crtc, false); 463 nv50_crtc_blank(nv_crtc, false);
464 464
@@ -497,7 +497,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, int x, int y,
497 struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); 497 struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
498 int ret, format; 498 int ret, format;
499 499
500 NV_DEBUG(dev, "index %d\n", nv_crtc->index); 500 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
501 501
502 switch (drm_fb->depth) { 502 switch (drm_fb->depth) {
503 case 8: 503 case 8:
@@ -612,7 +612,7 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
612 612
613 *nv_crtc->mode = *adjusted_mode; 613 *nv_crtc->mode = *adjusted_mode;
614 614
615 NV_DEBUG(dev, "index %d\n", nv_crtc->index); 615 NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index);
616 616
617 hsync_dur = adjusted_mode->hsync_end - adjusted_mode->hsync_start; 617 hsync_dur = adjusted_mode->hsync_end - adjusted_mode->hsync_start;
618 vsync_dur = adjusted_mode->vsync_end - adjusted_mode->vsync_start; 618 vsync_dur = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
@@ -706,7 +706,7 @@ nv50_crtc_create(struct drm_device *dev, int index)
706 struct nouveau_crtc *nv_crtc = NULL; 706 struct nouveau_crtc *nv_crtc = NULL;
707 int ret, i; 707 int ret, i;
708 708
709 NV_DEBUG(dev, "\n"); 709 NV_DEBUG_KMS(dev, "\n");
710 710
711 nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL); 711 nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL);
712 if (!nv_crtc) 712 if (!nv_crtc)
diff --git a/drivers/gpu/drm/nouveau/nv50_cursor.c b/drivers/gpu/drm/nouveau/nv50_cursor.c
index e2e79a8f220d..753e723adb3a 100644
--- a/drivers/gpu/drm/nouveau/nv50_cursor.c
+++ b/drivers/gpu/drm/nouveau/nv50_cursor.c
@@ -41,7 +41,7 @@ nv50_cursor_show(struct nouveau_crtc *nv_crtc, bool update)
41 struct drm_device *dev = nv_crtc->base.dev; 41 struct drm_device *dev = nv_crtc->base.dev;
42 int ret; 42 int ret;
43 43
44 NV_DEBUG(dev, "\n"); 44 NV_DEBUG_KMS(dev, "\n");
45 45
46 if (update && nv_crtc->cursor.visible) 46 if (update && nv_crtc->cursor.visible)
47 return; 47 return;
@@ -76,7 +76,7 @@ nv50_cursor_hide(struct nouveau_crtc *nv_crtc, bool update)
76 struct drm_device *dev = nv_crtc->base.dev; 76 struct drm_device *dev = nv_crtc->base.dev;
77 int ret; 77 int ret;
78 78
79 NV_DEBUG(dev, "\n"); 79 NV_DEBUG_KMS(dev, "\n");
80 80
81 if (update && !nv_crtc->cursor.visible) 81 if (update && !nv_crtc->cursor.visible)
82 return; 82 return;
@@ -116,7 +116,7 @@ nv50_cursor_set_pos(struct nouveau_crtc *nv_crtc, int x, int y)
116static void 116static void
117nv50_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset) 117nv50_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset)
118{ 118{
119 NV_DEBUG(nv_crtc->base.dev, "\n"); 119 NV_DEBUG_KMS(nv_crtc->base.dev, "\n");
120 if (offset == nv_crtc->cursor.offset) 120 if (offset == nv_crtc->cursor.offset)
121 return; 121 return;
122 122
@@ -143,7 +143,7 @@ nv50_cursor_fini(struct nouveau_crtc *nv_crtc)
143 struct drm_device *dev = nv_crtc->base.dev; 143 struct drm_device *dev = nv_crtc->base.dev;
144 int idx = nv_crtc->index; 144 int idx = nv_crtc->index;
145 145
146 NV_DEBUG(dev, "\n"); 146 NV_DEBUG_KMS(dev, "\n");
147 147
148 nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 0); 148 nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 0);
149 if (!nv_wait(NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 149 if (!nv_wait(NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx),
diff --git a/drivers/gpu/drm/nouveau/nv50_dac.c b/drivers/gpu/drm/nouveau/nv50_dac.c
index fb5838e3be24..f08f042a8e10 100644
--- a/drivers/gpu/drm/nouveau/nv50_dac.c
+++ b/drivers/gpu/drm/nouveau/nv50_dac.c
@@ -44,7 +44,7 @@ nv50_dac_disconnect(struct nouveau_encoder *nv_encoder)
44 struct nouveau_channel *evo = dev_priv->evo; 44 struct nouveau_channel *evo = dev_priv->evo;
45 int ret; 45 int ret;
46 46
47 NV_DEBUG(dev, "Disconnecting DAC %d\n", nv_encoder->or); 47 NV_DEBUG_KMS(dev, "Disconnecting DAC %d\n", nv_encoder->or);
48 48
49 ret = RING_SPACE(evo, 2); 49 ret = RING_SPACE(evo, 2);
50 if (ret) { 50 if (ret) {
@@ -81,11 +81,11 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
81 /* Use bios provided value if possible. */ 81 /* Use bios provided value if possible. */
82 if (dev_priv->vbios->dactestval) { 82 if (dev_priv->vbios->dactestval) {
83 load_pattern = dev_priv->vbios->dactestval; 83 load_pattern = dev_priv->vbios->dactestval;
84 NV_DEBUG(dev, "Using bios provided load_pattern of %d\n", 84 NV_DEBUG_KMS(dev, "Using bios provided load_pattern of %d\n",
85 load_pattern); 85 load_pattern);
86 } else { 86 } else {
87 load_pattern = 340; 87 load_pattern = 340;
88 NV_DEBUG(dev, "Using default load_pattern of %d\n", 88 NV_DEBUG_KMS(dev, "Using default load_pattern of %d\n",
89 load_pattern); 89 load_pattern);
90 } 90 }
91 91
@@ -103,9 +103,9 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
103 status = connector_status_connected; 103 status = connector_status_connected;
104 104
105 if (status == connector_status_connected) 105 if (status == connector_status_connected)
106 NV_DEBUG(dev, "Load was detected on output with or %d\n", or); 106 NV_DEBUG_KMS(dev, "Load was detected on output with or %d\n", or);
107 else 107 else
108 NV_DEBUG(dev, "Load was not detected on output with or %d\n", or); 108 NV_DEBUG_KMS(dev, "Load was not detected on output with or %d\n", or);
109 109
110 return status; 110 return status;
111} 111}
@@ -118,7 +118,7 @@ nv50_dac_dpms(struct drm_encoder *encoder, int mode)
118 uint32_t val; 118 uint32_t val;
119 int or = nv_encoder->or; 119 int or = nv_encoder->or;
120 120
121 NV_DEBUG(dev, "or %d mode %d\n", or, mode); 121 NV_DEBUG_KMS(dev, "or %d mode %d\n", or, mode);
122 122
123 /* wait for it to be done */ 123 /* wait for it to be done */
124 if (!nv_wait(NV50_PDISPLAY_DAC_DPMS_CTRL(or), 124 if (!nv_wait(NV50_PDISPLAY_DAC_DPMS_CTRL(or),
@@ -173,7 +173,7 @@ nv50_dac_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
173 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 173 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
174 struct nouveau_connector *connector; 174 struct nouveau_connector *connector;
175 175
176 NV_DEBUG(encoder->dev, "or %d\n", nv_encoder->or); 176 NV_DEBUG_KMS(encoder->dev, "or %d\n", nv_encoder->or);
177 177
178 connector = nouveau_encoder_connector_get(nv_encoder); 178 connector = nouveau_encoder_connector_get(nv_encoder);
179 if (!connector) { 179 if (!connector) {
@@ -213,7 +213,7 @@ nv50_dac_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
213 uint32_t mode_ctl = 0, mode_ctl2 = 0; 213 uint32_t mode_ctl = 0, mode_ctl2 = 0;
214 int ret; 214 int ret;
215 215
216 NV_DEBUG(dev, "or %d\n", nv_encoder->or); 216 NV_DEBUG_KMS(dev, "or %d\n", nv_encoder->or);
217 217
218 nv50_dac_dpms(encoder, DRM_MODE_DPMS_ON); 218 nv50_dac_dpms(encoder, DRM_MODE_DPMS_ON);
219 219
@@ -264,7 +264,7 @@ nv50_dac_destroy(struct drm_encoder *encoder)
264 if (!encoder) 264 if (!encoder)
265 return; 265 return;
266 266
267 NV_DEBUG(encoder->dev, "\n"); 267 NV_DEBUG_KMS(encoder->dev, "\n");
268 268
269 drm_encoder_cleanup(encoder); 269 drm_encoder_cleanup(encoder);
270 kfree(nv_encoder); 270 kfree(nv_encoder);
@@ -280,7 +280,7 @@ nv50_dac_create(struct drm_device *dev, struct dcb_entry *entry)
280 struct nouveau_encoder *nv_encoder; 280 struct nouveau_encoder *nv_encoder;
281 struct drm_encoder *encoder; 281 struct drm_encoder *encoder;
282 282
283 NV_DEBUG(dev, "\n"); 283 NV_DEBUG_KMS(dev, "\n");
284 NV_INFO(dev, "Detected a DAC output\n"); 284 NV_INFO(dev, "Detected a DAC output\n");
285 285
286 nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL); 286 nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL);
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 12c5ee63495b..90f0bf59fbcd 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -188,7 +188,7 @@ nv50_display_init(struct drm_device *dev)
188 uint64_t start; 188 uint64_t start;
189 int ret, i; 189 int ret, i;
190 190
191 NV_DEBUG(dev, "\n"); 191 NV_DEBUG_KMS(dev, "\n");
192 192
193 nv_wr32(dev, 0x00610184, nv_rd32(dev, 0x00614004)); 193 nv_wr32(dev, 0x00610184, nv_rd32(dev, 0x00614004));
194 /* 194 /*
@@ -232,7 +232,7 @@ nv50_display_init(struct drm_device *dev)
232 nv_wr32(dev, NV50_PDISPLAY_UNK_380, 0); 232 nv_wr32(dev, NV50_PDISPLAY_UNK_380, 0);
233 /* RAM is clamped to 256 MiB. */ 233 /* RAM is clamped to 256 MiB. */
234 ram_amount = nouveau_mem_fb_amount(dev); 234 ram_amount = nouveau_mem_fb_amount(dev);
235 NV_DEBUG(dev, "ram_amount %d\n", ram_amount); 235 NV_DEBUG_KMS(dev, "ram_amount %d\n", ram_amount);
236 if (ram_amount > 256*1024*1024) 236 if (ram_amount > 256*1024*1024)
237 ram_amount = 256*1024*1024; 237 ram_amount = 256*1024*1024;
238 nv_wr32(dev, NV50_PDISPLAY_RAM_AMOUNT, ram_amount - 1); 238 nv_wr32(dev, NV50_PDISPLAY_RAM_AMOUNT, ram_amount - 1);
@@ -398,7 +398,7 @@ static int nv50_display_disable(struct drm_device *dev)
398 struct drm_crtc *drm_crtc; 398 struct drm_crtc *drm_crtc;
399 int ret, i; 399 int ret, i;
400 400
401 NV_DEBUG(dev, "\n"); 401 NV_DEBUG_KMS(dev, "\n");
402 402
403 list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) { 403 list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) {
404 struct nouveau_crtc *crtc = nouveau_crtc(drm_crtc); 404 struct nouveau_crtc *crtc = nouveau_crtc(drm_crtc);
@@ -469,7 +469,7 @@ int nv50_display_create(struct drm_device *dev)
469 uint32_t connector[16] = {}; 469 uint32_t connector[16] = {};
470 int ret, i; 470 int ret, i;
471 471
472 NV_DEBUG(dev, "\n"); 472 NV_DEBUG_KMS(dev, "\n");
473 473
474 /* init basic kernel modesetting */ 474 /* init basic kernel modesetting */
475 drm_mode_config_init(dev); 475 drm_mode_config_init(dev);
@@ -573,7 +573,7 @@ int nv50_display_destroy(struct drm_device *dev)
573{ 573{
574 struct drm_nouveau_private *dev_priv = dev->dev_private; 574 struct drm_nouveau_private *dev_priv = dev->dev_private;
575 575
576 NV_DEBUG(dev, "\n"); 576 NV_DEBUG_KMS(dev, "\n");
577 577
578 drm_mode_config_cleanup(dev); 578 drm_mode_config_cleanup(dev);
579 579
@@ -617,7 +617,7 @@ nv50_display_irq_head(struct drm_device *dev, int *phead,
617 * CRTC separately, and submission will be blocked by the GPU 617 * CRTC separately, and submission will be blocked by the GPU
618 * until we handle each in turn. 618 * until we handle each in turn.
619 */ 619 */
620 NV_DEBUG(dev, "0x610030: 0x%08x\n", unk30); 620 NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30);
621 head = ffs((unk30 >> 9) & 3) - 1; 621 head = ffs((unk30 >> 9) & 3) - 1;
622 if (head < 0) 622 if (head < 0)
623 return -EINVAL; 623 return -EINVAL;
@@ -661,7 +661,7 @@ nv50_display_irq_head(struct drm_device *dev, int *phead,
661 or = i; 661 or = i;
662 } 662 }
663 663
664 NV_DEBUG(dev, "type %d, or %d\n", type, or); 664 NV_DEBUG_KMS(dev, "type %d, or %d\n", type, or);
665 if (type == OUTPUT_ANY) { 665 if (type == OUTPUT_ANY) {
666 NV_ERROR(dev, "unknown encoder!!\n"); 666 NV_ERROR(dev, "unknown encoder!!\n");
667 return -1; 667 return -1;
@@ -690,9 +690,21 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent,
690 int pxclk) 690 int pxclk)
691{ 691{
692 struct drm_nouveau_private *dev_priv = dev->dev_private; 692 struct drm_nouveau_private *dev_priv = dev->dev_private;
693 struct nouveau_connector *nv_connector = NULL;
694 struct drm_encoder *encoder;
693 struct nvbios *bios = &dev_priv->VBIOS; 695 struct nvbios *bios = &dev_priv->VBIOS;
694 uint32_t mc, script = 0, or; 696 uint32_t mc, script = 0, or;
695 697
698 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
699 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
700
701 if (nv_encoder->dcb != dcbent)
702 continue;
703
704 nv_connector = nouveau_encoder_connector_get(nv_encoder);
705 break;
706 }
707
696 or = ffs(dcbent->or) - 1; 708 or = ffs(dcbent->or) - 1;
697 mc = nv50_display_mode_ctrl(dev, dcbent->type != OUTPUT_ANALOG, or); 709 mc = nv50_display_mode_ctrl(dev, dcbent->type != OUTPUT_ANALOG, or);
698 switch (dcbent->type) { 710 switch (dcbent->type) {
@@ -711,6 +723,11 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent,
711 } else 723 } else
712 if (bios->fp.strapless_is_24bit & 1) 724 if (bios->fp.strapless_is_24bit & 1)
713 script |= 0x0200; 725 script |= 0x0200;
726
727 if (nv_connector && nv_connector->edid &&
728 (nv_connector->edid->revision >= 4) &&
729 (nv_connector->edid->input & 0x70) >= 0x20)
730 script |= 0x0200;
714 } 731 }
715 732
716 if (nouveau_uscript_lvds >= 0) { 733 if (nouveau_uscript_lvds >= 0) {
@@ -811,7 +828,7 @@ nv50_display_unk20_handler(struct drm_device *dev)
811 pclk = nv_rd32(dev, NV50_PDISPLAY_CRTC_P(head, CLOCK)) & 0x3fffff; 828 pclk = nv_rd32(dev, NV50_PDISPLAY_CRTC_P(head, CLOCK)) & 0x3fffff;
812 script = nv50_display_script_select(dev, dcbent, pclk); 829 script = nv50_display_script_select(dev, dcbent, pclk);
813 830
814 NV_DEBUG(dev, "head %d pxclk: %dKHz\n", head, pclk); 831 NV_DEBUG_KMS(dev, "head %d pxclk: %dKHz\n", head, pclk);
815 832
816 if (dcbent->type != OUTPUT_DP) 833 if (dcbent->type != OUTPUT_DP)
817 nouveau_bios_run_display_table(dev, dcbent, 0, -2); 834 nouveau_bios_run_display_table(dev, dcbent, 0, -2);
@@ -870,7 +887,7 @@ nv50_display_irq_handler_bh(struct work_struct *work)
870 uint32_t intr0 = nv_rd32(dev, NV50_PDISPLAY_INTR_0); 887 uint32_t intr0 = nv_rd32(dev, NV50_PDISPLAY_INTR_0);
871 uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1); 888 uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1);
872 889
873 NV_DEBUG(dev, "PDISPLAY_INTR_BH 0x%08x 0x%08x\n", intr0, intr1); 890 NV_DEBUG_KMS(dev, "PDISPLAY_INTR_BH 0x%08x 0x%08x\n", intr0, intr1);
874 891
875 if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK10) 892 if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK10)
876 nv50_display_unk10_handler(dev); 893 nv50_display_unk10_handler(dev);
@@ -974,7 +991,7 @@ nv50_display_irq_handler(struct drm_device *dev)
974 uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1); 991 uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1);
975 uint32_t clock; 992 uint32_t clock;
976 993
977 NV_DEBUG(dev, "PDISPLAY_INTR 0x%08x 0x%08x\n", intr0, intr1); 994 NV_DEBUG_KMS(dev, "PDISPLAY_INTR 0x%08x 0x%08x\n", intr0, intr1);
978 995
979 if (!intr0 && !(intr1 & ~delayed)) 996 if (!intr0 && !(intr1 & ~delayed))
980 break; 997 break;
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c
index 6bcc6d39e9b0..e4f279ee61cf 100644
--- a/drivers/gpu/drm/nouveau/nv50_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c
@@ -16,9 +16,7 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
16 16
17 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && 17 if (!(info->flags & FBINFO_HWACCEL_DISABLED) &&
18 RING_SPACE(chan, rect->rop == ROP_COPY ? 7 : 11)) { 18 RING_SPACE(chan, rect->rop == ROP_COPY ? 7 : 11)) {
19 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 19 nouveau_fbcon_gpu_lockup(info);
20
21 info->flags |= FBINFO_HWACCEL_DISABLED;
22 } 20 }
23 21
24 if (info->flags & FBINFO_HWACCEL_DISABLED) { 22 if (info->flags & FBINFO_HWACCEL_DISABLED) {
@@ -31,7 +29,11 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
31 OUT_RING(chan, 1); 29 OUT_RING(chan, 1);
32 } 30 }
33 BEGIN_RING(chan, NvSub2D, 0x0588, 1); 31 BEGIN_RING(chan, NvSub2D, 0x0588, 1);
34 OUT_RING(chan, rect->color); 32 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
33 info->fix.visual == FB_VISUAL_DIRECTCOLOR)
34 OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]);
35 else
36 OUT_RING(chan, rect->color);
35 BEGIN_RING(chan, NvSub2D, 0x0600, 4); 37 BEGIN_RING(chan, NvSub2D, 0x0600, 4);
36 OUT_RING(chan, rect->dx); 38 OUT_RING(chan, rect->dx);
37 OUT_RING(chan, rect->dy); 39 OUT_RING(chan, rect->dy);
@@ -56,9 +58,7 @@ nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
56 return; 58 return;
57 59
58 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 12)) { 60 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 12)) {
59 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 61 nouveau_fbcon_gpu_lockup(info);
60
61 info->flags |= FBINFO_HWACCEL_DISABLED;
62 } 62 }
63 63
64 if (info->flags & FBINFO_HWACCEL_DISABLED) { 64 if (info->flags & FBINFO_HWACCEL_DISABLED) {
@@ -101,8 +101,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
101 } 101 }
102 102
103 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) { 103 if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) {
104 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 104 nouveau_fbcon_gpu_lockup(info);
105 info->flags |= FBINFO_HWACCEL_DISABLED;
106 } 105 }
107 106
108 if (info->flags & FBINFO_HWACCEL_DISABLED) { 107 if (info->flags & FBINFO_HWACCEL_DISABLED) {
@@ -135,9 +134,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
135 int push = dwords > 2047 ? 2047 : dwords; 134 int push = dwords > 2047 ? 2047 : dwords;
136 135
137 if (RING_SPACE(chan, push + 1)) { 136 if (RING_SPACE(chan, push + 1)) {
138 NV_ERROR(dev, 137 nouveau_fbcon_gpu_lockup(info);
139 "GPU lockup - switching to software fbcon\n");
140 info->flags |= FBINFO_HWACCEL_DISABLED;
141 cfb_imageblit(info, image); 138 cfb_imageblit(info, image);
142 return; 139 return;
143 } 140 }
@@ -199,7 +196,7 @@ nv50_fbcon_accel_init(struct fb_info *info)
199 196
200 ret = RING_SPACE(chan, 59); 197 ret = RING_SPACE(chan, 59);
201 if (ret) { 198 if (ret) {
202 NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); 199 nouveau_fbcon_gpu_lockup(info);
203 return ret; 200 return ret;
204 } 201 }
205 202
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c
index 77ae1aaa0bce..39caf167587d 100644
--- a/drivers/gpu/drm/nouveau/nv50_fifo.c
+++ b/drivers/gpu/drm/nouveau/nv50_fifo.c
@@ -384,8 +384,8 @@ nv50_fifo_load_context(struct nouveau_channel *chan)
384 nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr), 384 nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr),
385 nv_ro32(dev, cache, (ptr * 2) + 1)); 385 nv_ro32(dev, cache, (ptr * 2) + 1));
386 } 386 }
387 nv_wr32(dev, 0x3210, cnt << 2); 387 nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2);
388 nv_wr32(dev, 0x3270, 0); 388 nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0);
389 389
390 /* guessing that all the 0x34xx regs aren't on NV50 */ 390 /* guessing that all the 0x34xx regs aren't on NV50 */
391 if (!IS_G80) { 391 if (!IS_G80) {
@@ -398,8 +398,6 @@ nv50_fifo_load_context(struct nouveau_channel *chan)
398 398
399 dev_priv->engine.instmem.finish_access(dev); 399 dev_priv->engine.instmem.finish_access(dev);
400 400
401 nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0);
402 nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, 0);
403 nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16)); 401 nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16));
404 return 0; 402 return 0;
405} 403}
@@ -416,7 +414,7 @@ nv50_fifo_unload_context(struct drm_device *dev)
416 NV_DEBUG(dev, "\n"); 414 NV_DEBUG(dev, "\n");
417 415
418 chid = pfifo->channel_id(dev); 416 chid = pfifo->channel_id(dev);
419 if (chid < 0 || chid >= dev_priv->engine.fifo.channels) 417 if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1)
420 return 0; 418 return 0;
421 419
422 chan = dev_priv->fifos[chid]; 420 chan = dev_priv->fifos[chid];
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c
index 177d8229336f..ca79f32be44c 100644
--- a/drivers/gpu/drm/nouveau/nv50_graph.c
+++ b/drivers/gpu/drm/nouveau/nv50_graph.c
@@ -107,9 +107,13 @@ nv50_graph_init_regs(struct drm_device *dev)
107static int 107static int
108nv50_graph_init_ctxctl(struct drm_device *dev) 108nv50_graph_init_ctxctl(struct drm_device *dev)
109{ 109{
110 struct drm_nouveau_private *dev_priv = dev->dev_private;
111
110 NV_DEBUG(dev, "\n"); 112 NV_DEBUG(dev, "\n");
111 113
112 nv40_grctx_init(dev); 114 nouveau_grctx_prog_load(dev);
115 if (!dev_priv->engine.graph.ctxprog)
116 dev_priv->engine.graph.accel_blocked = true;
113 117
114 nv_wr32(dev, 0x400320, 4); 118 nv_wr32(dev, 0x400320, 4);
115 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0); 119 nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0);
@@ -140,7 +144,7 @@ void
140nv50_graph_takedown(struct drm_device *dev) 144nv50_graph_takedown(struct drm_device *dev)
141{ 145{
142 NV_DEBUG(dev, "\n"); 146 NV_DEBUG(dev, "\n");
143 nv40_grctx_fini(dev); 147 nouveau_grctx_fini(dev);
144} 148}
145 149
146void 150void
@@ -207,7 +211,7 @@ nv50_graph_create_context(struct nouveau_channel *chan)
207 dev_priv->engine.instmem.finish_access(dev); 211 dev_priv->engine.instmem.finish_access(dev);
208 212
209 dev_priv->engine.instmem.prepare_access(dev, true); 213 dev_priv->engine.instmem.prepare_access(dev, true);
210 nv40_grctx_vals_load(dev, ctx); 214 nouveau_grctx_vals_load(dev, ctx);
211 nv_wo32(dev, ctx, 0x00000/4, chan->ramin->instance >> 12); 215 nv_wo32(dev, ctx, 0x00000/4, chan->ramin->instance >> 12);
212 if ((dev_priv->chipset & 0xf0) == 0xa0) 216 if ((dev_priv->chipset & 0xf0) == 0xa0)
213 nv_wo32(dev, ctx, 0x00004/4, 0x00000000); 217 nv_wo32(dev, ctx, 0x00004/4, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c
index 8c280463a664..e395c16d30f5 100644
--- a/drivers/gpu/drm/nouveau/nv50_sor.c
+++ b/drivers/gpu/drm/nouveau/nv50_sor.c
@@ -44,7 +44,7 @@ nv50_sor_disconnect(struct nouveau_encoder *nv_encoder)
44 struct nouveau_channel *evo = dev_priv->evo; 44 struct nouveau_channel *evo = dev_priv->evo;
45 int ret; 45 int ret;
46 46
47 NV_DEBUG(dev, "Disconnecting SOR %d\n", nv_encoder->or); 47 NV_DEBUG_KMS(dev, "Disconnecting SOR %d\n", nv_encoder->or);
48 48
49 ret = RING_SPACE(evo, 2); 49 ret = RING_SPACE(evo, 2);
50 if (ret) { 50 if (ret) {
@@ -70,7 +70,7 @@ nv50_sor_dp_link_train(struct drm_encoder *encoder)
70 } 70 }
71 71
72 if (dpe->script0) { 72 if (dpe->script0) {
73 NV_DEBUG(dev, "SOR-%d: running DP script 0\n", nv_encoder->or); 73 NV_DEBUG_KMS(dev, "SOR-%d: running DP script 0\n", nv_encoder->or);
74 nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script0), 74 nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script0),
75 nv_encoder->dcb); 75 nv_encoder->dcb);
76 } 76 }
@@ -79,7 +79,7 @@ nv50_sor_dp_link_train(struct drm_encoder *encoder)
79 NV_ERROR(dev, "SOR-%d: link training failed\n", nv_encoder->or); 79 NV_ERROR(dev, "SOR-%d: link training failed\n", nv_encoder->or);
80 80
81 if (dpe->script1) { 81 if (dpe->script1) {
82 NV_DEBUG(dev, "SOR-%d: running DP script 1\n", nv_encoder->or); 82 NV_DEBUG_KMS(dev, "SOR-%d: running DP script 1\n", nv_encoder->or);
83 nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script1), 83 nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script1),
84 nv_encoder->dcb); 84 nv_encoder->dcb);
85 } 85 }
@@ -93,7 +93,7 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode)
93 uint32_t val; 93 uint32_t val;
94 int or = nv_encoder->or; 94 int or = nv_encoder->or;
95 95
96 NV_DEBUG(dev, "or %d mode %d\n", or, mode); 96 NV_DEBUG_KMS(dev, "or %d mode %d\n", or, mode);
97 97
98 /* wait for it to be done */ 98 /* wait for it to be done */
99 if (!nv_wait(NV50_PDISPLAY_SOR_DPMS_CTRL(or), 99 if (!nv_wait(NV50_PDISPLAY_SOR_DPMS_CTRL(or),
@@ -142,7 +142,7 @@ nv50_sor_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
142 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 142 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
143 struct nouveau_connector *connector; 143 struct nouveau_connector *connector;
144 144
145 NV_DEBUG(encoder->dev, "or %d\n", nv_encoder->or); 145 NV_DEBUG_KMS(encoder->dev, "or %d\n", nv_encoder->or);
146 146
147 connector = nouveau_encoder_connector_get(nv_encoder); 147 connector = nouveau_encoder_connector_get(nv_encoder);
148 if (!connector) { 148 if (!connector) {
@@ -182,7 +182,7 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
182 uint32_t mode_ctl = 0; 182 uint32_t mode_ctl = 0;
183 int ret; 183 int ret;
184 184
185 NV_DEBUG(dev, "or %d\n", nv_encoder->or); 185 NV_DEBUG_KMS(dev, "or %d\n", nv_encoder->or);
186 186
187 nv50_sor_dpms(encoder, DRM_MODE_DPMS_ON); 187 nv50_sor_dpms(encoder, DRM_MODE_DPMS_ON);
188 188
@@ -246,7 +246,7 @@ nv50_sor_destroy(struct drm_encoder *encoder)
246 if (!encoder) 246 if (!encoder)
247 return; 247 return;
248 248
249 NV_DEBUG(encoder->dev, "\n"); 249 NV_DEBUG_KMS(encoder->dev, "\n");
250 250
251 drm_encoder_cleanup(encoder); 251 drm_encoder_cleanup(encoder);
252 252
@@ -265,7 +265,7 @@ nv50_sor_create(struct drm_device *dev, struct dcb_entry *entry)
265 bool dum; 265 bool dum;
266 int type; 266 int type;
267 267
268 NV_DEBUG(dev, "\n"); 268 NV_DEBUG_KMS(dev, "\n");
269 269
270 switch (entry->type) { 270 switch (entry->type) {
271 case OUTPUT_TMDS: 271 case OUTPUT_TMDS:
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c
index 601f4c0e5da5..b806fdcc7170 100644
--- a/drivers/gpu/drm/r128/r128_drv.c
+++ b/drivers/gpu/drm/r128/r128_drv.c
@@ -64,7 +64,7 @@ static struct drm_driver driver = {
64 .owner = THIS_MODULE, 64 .owner = THIS_MODULE,
65 .open = drm_open, 65 .open = drm_open,
66 .release = drm_release, 66 .release = drm_release,
67 .ioctl = drm_ioctl, 67 .unlocked_ioctl = drm_ioctl,
68 .mmap = drm_mmap, 68 .mmap = drm_mmap,
69 .poll = drm_poll, 69 .poll = drm_poll,
70 .fasync = drm_fasync, 70 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/r128/r128_ioc32.c b/drivers/gpu/drm/r128/r128_ioc32.c
index d3cb676eee84..51c99fc4dd38 100644
--- a/drivers/gpu/drm/r128/r128_ioc32.c
+++ b/drivers/gpu/drm/r128/r128_ioc32.c
@@ -95,8 +95,7 @@ static int compat_r128_init(struct file *file, unsigned int cmd,
95 &init->agp_textures_offset)) 95 &init->agp_textures_offset))
96 return -EFAULT; 96 return -EFAULT;
97 97
98 return drm_ioctl(file->f_path.dentry->d_inode, file, 98 return drm_ioctl(file, DRM_IOCTL_R128_INIT, (unsigned long)init);
99 DRM_IOCTL_R128_INIT, (unsigned long)init);
100} 99}
101 100
102typedef struct drm_r128_depth32 { 101typedef struct drm_r128_depth32 {
@@ -129,8 +128,7 @@ static int compat_r128_depth(struct file *file, unsigned int cmd,
129 &depth->mask)) 128 &depth->mask))
130 return -EFAULT; 129 return -EFAULT;
131 130
132 return drm_ioctl(file->f_path.dentry->d_inode, file, 131 return drm_ioctl(file, DRM_IOCTL_R128_DEPTH, (unsigned long)depth);
133 DRM_IOCTL_R128_DEPTH, (unsigned long)depth);
134 132
135} 133}
136 134
@@ -153,8 +151,7 @@ static int compat_r128_stipple(struct file *file, unsigned int cmd,
153 &stipple->mask)) 151 &stipple->mask))
154 return -EFAULT; 152 return -EFAULT;
155 153
156 return drm_ioctl(file->f_path.dentry->d_inode, file, 154 return drm_ioctl(file, DRM_IOCTL_R128_STIPPLE, (unsigned long)stipple);
157 DRM_IOCTL_R128_STIPPLE, (unsigned long)stipple);
158} 155}
159 156
160typedef struct drm_r128_getparam32 { 157typedef struct drm_r128_getparam32 {
@@ -178,8 +175,7 @@ static int compat_r128_getparam(struct file *file, unsigned int cmd,
178 &getparam->value)) 175 &getparam->value))
179 return -EFAULT; 176 return -EFAULT;
180 177
181 return drm_ioctl(file->f_path.dentry->d_inode, file, 178 return drm_ioctl(file, DRM_IOCTL_R128_GETPARAM, (unsigned long)getparam);
182 DRM_IOCTL_R128_GETPARAM, (unsigned long)getparam);
183} 179}
184 180
185drm_ioctl_compat_t *r128_compat_ioctls[] = { 181drm_ioctl_compat_t *r128_compat_ioctls[] = {
@@ -210,12 +206,10 @@ long r128_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
210 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(r128_compat_ioctls)) 206 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(r128_compat_ioctls))
211 fn = r128_compat_ioctls[nr - DRM_COMMAND_BASE]; 207 fn = r128_compat_ioctls[nr - DRM_COMMAND_BASE];
212 208
213 lock_kernel(); /* XXX for now */
214 if (fn != NULL) 209 if (fn != NULL)
215 ret = (*fn) (filp, cmd, arg); 210 ret = (*fn) (filp, cmd, arg);
216 else 211 else
217 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); 212 ret = drm_ioctl(filp, cmd, arg);
218 unlock_kernel();
219 213
220 return ret; 214 return ret;
221} 215}
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile
index b5f5fe75e6af..1cc7b937b1ea 100644
--- a/drivers/gpu/drm/radeon/Makefile
+++ b/drivers/gpu/drm/radeon/Makefile
@@ -24,6 +24,9 @@ $(obj)/rv515_reg_safe.h: $(src)/reg_srcs/rv515 $(obj)/mkregtable
24$(obj)/r300_reg_safe.h: $(src)/reg_srcs/r300 $(obj)/mkregtable 24$(obj)/r300_reg_safe.h: $(src)/reg_srcs/r300 $(obj)/mkregtable
25 $(call if_changed,mkregtable) 25 $(call if_changed,mkregtable)
26 26
27$(obj)/r420_reg_safe.h: $(src)/reg_srcs/r420 $(obj)/mkregtable
28 $(call if_changed,mkregtable)
29
27$(obj)/rs600_reg_safe.h: $(src)/reg_srcs/rs600 $(obj)/mkregtable 30$(obj)/rs600_reg_safe.h: $(src)/reg_srcs/rs600 $(obj)/mkregtable
28 $(call if_changed,mkregtable) 31 $(call if_changed,mkregtable)
29 32
@@ -35,6 +38,8 @@ $(obj)/rv515.o: $(obj)/rv515_reg_safe.h
35 38
36$(obj)/r300.o: $(obj)/r300_reg_safe.h 39$(obj)/r300.o: $(obj)/r300_reg_safe.h
37 40
41$(obj)/r420.o: $(obj)/r420_reg_safe.h
42
38$(obj)/rs600.o: $(obj)/rs600_reg_safe.h 43$(obj)/rs600.o: $(obj)/rs600_reg_safe.h
39 44
40radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ 45radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \
diff --git a/drivers/gpu/drm/radeon/ObjectID.h b/drivers/gpu/drm/radeon/ObjectID.h
index 6d0183c61d3b..c714179d1bfa 100644
--- a/drivers/gpu/drm/radeon/ObjectID.h
+++ b/drivers/gpu/drm/radeon/ObjectID.h
@@ -1,5 +1,5 @@
1/* 1/*
2* Copyright 2006-2007 Advanced Micro Devices, Inc. 2* Copyright 2006-2007 Advanced Micro Devices, Inc.
3* 3*
4* Permission is hereby granted, free of charge, to any person obtaining a 4* Permission is hereby granted, free of charge, to any person obtaining a
5* copy of this software and associated documentation files (the "Software"), 5* copy of this software and associated documentation files (the "Software"),
@@ -41,14 +41,14 @@
41/****************************************************/ 41/****************************************************/
42/* Encoder Object ID Definition */ 42/* Encoder Object ID Definition */
43/****************************************************/ 43/****************************************************/
44#define ENCODER_OBJECT_ID_NONE 0x00 44#define ENCODER_OBJECT_ID_NONE 0x00
45 45
46/* Radeon Class Display Hardware */ 46/* Radeon Class Display Hardware */
47#define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 47#define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01
48#define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 48#define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02
49#define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 49#define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03
50#define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 50#define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04
51#define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ 51#define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */
52#define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 52#define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06
53#define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 53#define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07
54 54
@@ -56,11 +56,11 @@
56#define ENCODER_OBJECT_ID_SI170B 0x08 56#define ENCODER_OBJECT_ID_SI170B 0x08
57#define ENCODER_OBJECT_ID_CH7303 0x09 57#define ENCODER_OBJECT_ID_CH7303 0x09
58#define ENCODER_OBJECT_ID_CH7301 0x0A 58#define ENCODER_OBJECT_ID_CH7301 0x0A
59#define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ 59#define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */
60#define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C 60#define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C
61#define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D 61#define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D
62#define ENCODER_OBJECT_ID_TITFP513 0x0E 62#define ENCODER_OBJECT_ID_TITFP513 0x0E
63#define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ 63#define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */
64#define ENCODER_OBJECT_ID_VT1623 0x10 64#define ENCODER_OBJECT_ID_VT1623 0x10
65#define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 65#define ENCODER_OBJECT_ID_HDMI_SI1930 0x11
66#define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 66#define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12
@@ -68,9 +68,9 @@
68#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 68#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13
69#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 69#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14
70#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 70#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15
71#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ 71#define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */
72#define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ 72#define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */
73#define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ 73#define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */
74#define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 74#define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19
75#define ENCODER_OBJECT_ID_VT1625 0x1A 75#define ENCODER_OBJECT_ID_VT1625 0x1A
76#define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B 76#define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B
@@ -86,7 +86,7 @@
86/****************************************************/ 86/****************************************************/
87/* Connector Object ID Definition */ 87/* Connector Object ID Definition */
88/****************************************************/ 88/****************************************************/
89#define CONNECTOR_OBJECT_ID_NONE 0x00 89#define CONNECTOR_OBJECT_ID_NONE 0x00
90#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 90#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01
91#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 91#define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02
92#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 92#define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03
@@ -96,7 +96,7 @@
96#define CONNECTOR_OBJECT_ID_SVIDEO 0x07 96#define CONNECTOR_OBJECT_ID_SVIDEO 0x07
97#define CONNECTOR_OBJECT_ID_YPbPr 0x08 97#define CONNECTOR_OBJECT_ID_YPbPr 0x08
98#define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 98#define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09
99#define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ 99#define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */
100#define CONNECTOR_OBJECT_ID_SCART 0x0B 100#define CONNECTOR_OBJECT_ID_SCART 0x0B
101#define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C 101#define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C
102#define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D 102#define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D
@@ -106,6 +106,8 @@
106#define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 106#define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11
107#define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 107#define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12
108#define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 108#define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13
109#define CONNECTOR_OBJECT_ID_eDP 0x14
110#define CONNECTOR_OBJECT_ID_MXM 0x15
109 111
110/* deleted */ 112/* deleted */
111 113
@@ -116,6 +118,14 @@
116#define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 118#define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01
117 119
118/****************************************************/ 120/****************************************************/
121/* Generic Object ID Definition */
122/****************************************************/
123#define GENERIC_OBJECT_ID_NONE 0x00
124#define GENERIC_OBJECT_ID_GLSYNC 0x01
125#define GENERIC_OBJECT_ID_PX2_NON_DRIVABLE 0x02
126#define GENERIC_OBJECT_ID_MXM_OPM 0x03
127
128/****************************************************/
119/* Graphics Object ENUM ID Definition */ 129/* Graphics Object ENUM ID Definition */
120/****************************************************/ 130/****************************************************/
121#define GRAPH_OBJECT_ENUM_ID1 0x01 131#define GRAPH_OBJECT_ENUM_ID1 0x01
@@ -124,6 +134,7 @@
124#define GRAPH_OBJECT_ENUM_ID4 0x04 134#define GRAPH_OBJECT_ENUM_ID4 0x04
125#define GRAPH_OBJECT_ENUM_ID5 0x05 135#define GRAPH_OBJECT_ENUM_ID5 0x05
126#define GRAPH_OBJECT_ENUM_ID6 0x06 136#define GRAPH_OBJECT_ENUM_ID6 0x06
137#define GRAPH_OBJECT_ENUM_ID7 0x07
127 138
128/****************************************************/ 139/****************************************************/
129/* Graphics Object ID Bit definition */ 140/* Graphics Object ID Bit definition */
@@ -133,35 +144,35 @@
133#define RESERVED1_ID_MASK 0x0800 144#define RESERVED1_ID_MASK 0x0800
134#define OBJECT_TYPE_MASK 0x7000 145#define OBJECT_TYPE_MASK 0x7000
135#define RESERVED2_ID_MASK 0x8000 146#define RESERVED2_ID_MASK 0x8000
136 147
137#define OBJECT_ID_SHIFT 0x00 148#define OBJECT_ID_SHIFT 0x00
138#define ENUM_ID_SHIFT 0x08 149#define ENUM_ID_SHIFT 0x08
139#define OBJECT_TYPE_SHIFT 0x0C 150#define OBJECT_TYPE_SHIFT 0x0C
140 151
152
141/****************************************************/ 153/****************************************************/
142/* Graphics Object family definition */ 154/* Graphics Object family definition */
143/****************************************************/ 155/****************************************************/
144#define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) \ 156#define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \
145 (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ 157 GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT)
146 GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT)
147/****************************************************/ 158/****************************************************/
148/* GPU Object ID definition - Shared with BIOS */ 159/* GPU Object ID definition - Shared with BIOS */
149/****************************************************/ 160/****************************************************/
150#define GPU_ENUM_ID1 (GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ 161#define GPU_ENUM_ID1 ( GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\
151 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) 162 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT)
152 163
153/****************************************************/ 164/****************************************************/
154/* Encoder Object ID definition - Shared with BIOS */ 165/* Encoder Object ID definition - Shared with BIOS */
155/****************************************************/ 166/****************************************************/
156/* 167/*
157#define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 168#define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101
158#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 169#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102
159#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 170#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103
160#define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 171#define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104
161#define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 172#define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105
162#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 173#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106
163#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 174#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107
164#define ENCODER_SIL170B_ENUM_ID1 0x2108 175#define ENCODER_SIL170B_ENUM_ID1 0x2108
165#define ENCODER_CH7303_ENUM_ID1 0x2109 176#define ENCODER_CH7303_ENUM_ID1 0x2109
166#define ENCODER_CH7301_ENUM_ID1 0x210A 177#define ENCODER_CH7301_ENUM_ID1 0x210A
167#define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B 178#define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B
@@ -175,8 +186,8 @@
175#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 186#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113
176#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 187#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114
177#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 188#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115
178#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 189#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116
179#define ENCODER_SI178_ENUM_ID1 0x2117 190#define ENCODER_SI178_ENUM_ID1 0x2117
180#define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 191#define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118
181#define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 192#define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119
182#define ENCODER_VT1625_ENUM_ID1 0x211A 193#define ENCODER_VT1625_ENUM_ID1 0x211A
@@ -185,205 +196,169 @@
185#define ENCODER_DP_DP501_ENUM_ID1 0x211D 196#define ENCODER_DP_DP501_ENUM_ID1 0x211D
186#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E 197#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E
187*/ 198*/
188#define ENCODER_INTERNAL_LVDS_ENUM_ID1 \ 199#define ENCODER_INTERNAL_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
189 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 200 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
190 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 201 ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT)
191 ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) 202
192 203#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
193#define ENCODER_INTERNAL_TMDS1_ENUM_ID1 \ 204 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
194 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 205 ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT)
195 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 206
196 ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) 207#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
197 208 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
198#define ENCODER_INTERNAL_TMDS2_ENUM_ID1 \ 209 ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT)
199 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 210
200 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 211#define ENCODER_INTERNAL_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
201 ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) 212 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
202 213 ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT)
203#define ENCODER_INTERNAL_DAC1_ENUM_ID1 \ 214
204 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 215#define ENCODER_INTERNAL_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
205 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 216 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
206 ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) 217 ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT)
207 218
208#define ENCODER_INTERNAL_DAC2_ENUM_ID1 \ 219#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
209 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 220 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
210 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 221 ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT)
211 ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) 222
212 223#define ENCODER_INTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
213#define ENCODER_INTERNAL_SDVOA_ENUM_ID1 \ 224 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
214 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 225 ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT)
215 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 226
216 ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) 227#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
217 228 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
218#define ENCODER_INTERNAL_SDVOA_ENUM_ID2 \ 229 ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT)
219 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 230
220 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 231#define ENCODER_SIL170B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
221 ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) 232 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
222 233 ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT)
223#define ENCODER_INTERNAL_SDVOB_ENUM_ID1 \ 234
224 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 235#define ENCODER_CH7303_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
225 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 236 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
226 ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) 237 ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT)
227 238
228#define ENCODER_SIL170B_ENUM_ID1 \ 239#define ENCODER_CH7301_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
229 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 240 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
230 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 241 ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT)
231 ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) 242
232 243#define ENCODER_INTERNAL_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
233#define ENCODER_CH7303_ENUM_ID1 \ 244 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
234 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 245 ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT)
235 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 246
236 ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) 247#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
237 248 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
238#define ENCODER_CH7301_ENUM_ID1 \ 249 ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT)
239 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 250
240 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 251#define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
241 ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) 252 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
242 253 ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT)
243#define ENCODER_INTERNAL_DVO1_ENUM_ID1 \ 254
244 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 255
245 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 256#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
246 ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) 257 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
247 258 ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT)
248#define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 \ 259
249 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 260
250 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 261#define ENCODER_TITFP513_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
251 ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) 262 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
252 263 ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT)
253#define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 \ 264
254 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 265#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
255 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 266 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
256 ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) 267 ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT)
257 268
258#define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 \ 269#define ENCODER_VT1623_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
259 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 270 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
260 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 271 ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT)
261 ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) 272
262 273#define ENCODER_HDMI_SI1930_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
263#define ENCODER_TITFP513_ENUM_ID1 \ 274 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
264 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 275 ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT)
265 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 276
266 ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) 277#define ENCODER_HDMI_INTERNAL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
267 278 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
268#define ENCODER_INTERNAL_LVTM1_ENUM_ID1 \ 279 ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT)
269 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 280
270 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 281#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
271 ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) 282 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
272 283 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT)
273#define ENCODER_VT1623_ENUM_ID1 \ 284
274 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 285
275 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 286#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
276 ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) 287 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
277 288 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT)
278#define ENCODER_HDMI_SI1930_ENUM_ID1 \ 289
279 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 290
280 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 291#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
281 ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) 292 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
282 293 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT)
283#define ENCODER_HDMI_INTERNAL_ENUM_ID1 \ 294
284 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 295#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
285 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 296 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
286 ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) 297 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT)
287 298
288#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 \ 299#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
289 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 300 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
290 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 301 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) // Shared with CV/TV and CRT
291 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) 302
292 303#define ENCODER_SI178_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
293#define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 \ 304 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
294 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 305 ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT)
295 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 306
296 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) 307#define ENCODER_MVPU_FPGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
297 308 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
298#define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 \ 309 ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT)
299 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 310
300 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 311#define ENCODER_INTERNAL_DDI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
301 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) 312 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
302 313 ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT)
303#define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 \ 314
304 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 315#define ENCODER_VT1625_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
305 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 316 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
306 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) 317 ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT)
307 318
308#define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 \ 319#define ENCODER_HDMI_SI1932_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
309 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 320 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
310 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 321 ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT)
311 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) /* Shared with CV/TV and CRT */ 322
312 323#define ENCODER_DP_DP501_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
313#define ENCODER_SI178_ENUM_ID1 \ 324 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
314 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 325 ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT)
315 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 326
316 ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) 327#define ENCODER_DP_AN9801_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
317 328 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
318#define ENCODER_MVPU_FPGA_ENUM_ID1 \ 329 ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT)
319 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 330
320 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 331#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
321 ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) 332 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
322 333 ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT)
323#define ENCODER_INTERNAL_DDI_ENUM_ID1 \ 334
324 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 335#define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
325 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 336 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
326 ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) 337 ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT)
327 338
328#define ENCODER_VT1625_ENUM_ID1 \ 339#define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
329 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 340 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
330 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 341 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT)
331 ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) 342
332 343#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
333#define ENCODER_HDMI_SI1932_ENUM_ID1 \ 344 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
334 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 345 ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT)
335 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 346
336 ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) 347#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
337 348 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
338#define ENCODER_DP_DP501_ENUM_ID1 \ 349 ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT)
339 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 350
340 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 351#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
341 ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) 352 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
342 353 ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT)
343#define ENCODER_DP_AN9801_ENUM_ID1 \ 354
344 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 355#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
345 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 356 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
346 ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) 357 ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT)
347 358
348#define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 \ 359#define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
349 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ 360 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
350 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 361 ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT)
351 ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT)
352
353#define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 \
354 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
355 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
356 ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT)
357
358#define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 \
359 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
360 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
361 ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT)
362
363#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 \
364 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
365 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
366 ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT)
367
368#define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 \
369 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
370 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
371 ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT)
372
373#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 \
374 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
375 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
376 ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT)
377
378#define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 \
379 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
380 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
381 ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT)
382
383#define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 \
384 (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\
385 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
386 ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT)
387 362
388/****************************************************/ 363/****************************************************/
389/* Connector Object ID definition - Shared with BIOS */ 364/* Connector Object ID definition - Shared with BIOS */
@@ -406,167 +381,253 @@
406#define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F 381#define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F
407#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 382#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110
408*/ 383*/
409#define CONNECTOR_LVDS_ENUM_ID1 \ 384#define CONNECTOR_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
410 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 385 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
411 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 386 CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT)
412 CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) 387
413 388#define CONNECTOR_LVDS_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
414#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 \ 389 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
415 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 390 CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT)
416 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 391
417 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) 392#define CONNECTOR_eDP_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
418 393 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
419#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 \ 394 CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT)
420 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 395
421 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 396#define CONNECTOR_eDP_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
422 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) 397 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
423 398 CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT)
424#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 \ 399
425 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 400#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
426 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 401 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
427 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) 402 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT)
428 403
429#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 \ 404#define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
430 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 405 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
431 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 406 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT)
432 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) 407
433 408#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
434#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 \ 409 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
435 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 410 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT)
436 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 411
437 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) 412#define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
438 413 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
439#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 \ 414 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT)
440 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 415
441 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 416#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
442 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) 417 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
443 418 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT)
444#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 \ 419
445 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 420#define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
446 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 421 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
447 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) 422 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT)
448 423
449#define CONNECTOR_VGA_ENUM_ID1 \ 424#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
450 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 425 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
451 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 426 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT)
452 CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) 427
453 428#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
454#define CONNECTOR_VGA_ENUM_ID2 \ 429 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
455 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 430 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT)
456 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 431
457 CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) 432#define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
458 433 GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\
459#define CONNECTOR_COMPOSITE_ENUM_ID1 \ 434 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT)
460 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 435
461 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 436#define CONNECTOR_VGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
462 CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) 437 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
463 438 CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT)
464#define CONNECTOR_SVIDEO_ENUM_ID1 \ 439
465 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 440#define CONNECTOR_VGA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
466 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 441 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
467 CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) 442 CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT)
468 443
469#define CONNECTOR_YPbPr_ENUM_ID1 \ 444#define CONNECTOR_COMPOSITE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
470 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 445 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
471 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 446 CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT)
472 CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) 447
473 448#define CONNECTOR_COMPOSITE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
474#define CONNECTOR_D_CONNECTOR_ENUM_ID1 \ 449 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
475 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 450 CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT)
476 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 451
477 CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) 452#define CONNECTOR_SVIDEO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
478 453 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
479#define CONNECTOR_9PIN_DIN_ENUM_ID1 \ 454 CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT)
480 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 455
481 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 456#define CONNECTOR_SVIDEO_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
482 CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) 457 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
483 458 CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT)
484#define CONNECTOR_SCART_ENUM_ID1 \ 459
485 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 460#define CONNECTOR_YPbPr_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
486 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 461 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
487 CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) 462 CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT)
488 463
489#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 \ 464#define CONNECTOR_YPbPr_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
490 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 465 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
491 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 466 CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT)
492 CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) 467
493 468#define CONNECTOR_D_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
494#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 \ 469 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
495 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 470 CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT)
496 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 471
497 CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) 472#define CONNECTOR_D_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
498 473 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
499#define CONNECTOR_7PIN_DIN_ENUM_ID1 \ 474 CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT)
500 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 475
501 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 476#define CONNECTOR_9PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
502 CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) 477 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
503 478 CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT)
504#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 \ 479
505 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 480#define CONNECTOR_9PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
506 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 481 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
507 CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) 482 CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT)
508 483
509#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 \ 484#define CONNECTOR_SCART_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
510 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 485 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
511 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 486 CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT)
512 CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) 487
513 488#define CONNECTOR_SCART_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
514#define CONNECTOR_CROSSFIRE_ENUM_ID1 \ 489 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
515 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 490 CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT)
516 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 491
517 CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) 492#define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
518 493 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
519#define CONNECTOR_CROSSFIRE_ENUM_ID2 \ 494 CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT)
520 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 495
521 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 496#define CONNECTOR_HDMI_TYPE_A_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
522 CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) 497 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
523 498 CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT)
524#define CONNECTOR_HARDCODE_DVI_ENUM_ID1 \ 499
525 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 500#define CONNECTOR_HDMI_TYPE_A_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
526 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 501 GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\
527 CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) 502 CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT)
528 503
529#define CONNECTOR_HARDCODE_DVI_ENUM_ID2 \ 504#define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
530 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 505 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
531 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 506 CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT)
532 CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) 507
533 508#define CONNECTOR_HDMI_TYPE_B_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
534#define CONNECTOR_DISPLAYPORT_ENUM_ID1 \ 509 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
535 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 510 CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT)
536 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 511
537 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) 512#define CONNECTOR_7PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
538 513 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
539#define CONNECTOR_DISPLAYPORT_ENUM_ID2 \ 514 CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT)
540 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 515#define CONNECTOR_7PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
541 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ 516 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
542 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) 517 CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT)
543 518
544#define CONNECTOR_DISPLAYPORT_ENUM_ID3 \ 519#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
545 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 520 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
546 GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ 521 CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT)
547 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) 522
548 523#define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
549#define CONNECTOR_DISPLAYPORT_ENUM_ID4 \ 524 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
550 (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ 525 CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT)
551 GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ 526
552 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) 527#define CONNECTOR_CROSSFIRE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
528 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
529 CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT)
530
531#define CONNECTOR_CROSSFIRE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
532 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
533 CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT)
534
535
536#define CONNECTOR_HARDCODE_DVI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
537 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
538 CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT)
539
540#define CONNECTOR_HARDCODE_DVI_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
541 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
542 CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT)
543
544#define CONNECTOR_DISPLAYPORT_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
545 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
546 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
547
548#define CONNECTOR_DISPLAYPORT_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
549 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
550 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
551
552#define CONNECTOR_DISPLAYPORT_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
553 GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\
554 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
555
556#define CONNECTOR_DISPLAYPORT_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
557 GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\
558 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
559
560#define CONNECTOR_DISPLAYPORT_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
561 GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\
562 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
563
564#define CONNECTOR_DISPLAYPORT_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
565 GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\
566 CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT)
567
568#define CONNECTOR_MXM_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
569 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
570 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_A
571
572#define CONNECTOR_MXM_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
573 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
574 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_B
575
576#define CONNECTOR_MXM_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
577 GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\
578 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_C
579
580#define CONNECTOR_MXM_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
581 GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\
582 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_D
583
584#define CONNECTOR_MXM_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
585 GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\
586 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_TXxx
587
588#define CONNECTOR_MXM_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
589 GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\
590 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_UXxx
591
592#define CONNECTOR_MXM_ENUM_ID7 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\
593 GRAPH_OBJECT_ENUM_ID7 << ENUM_ID_SHIFT |\
594 CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DAC
553 595
554/****************************************************/ 596/****************************************************/
555/* Router Object ID definition - Shared with BIOS */ 597/* Router Object ID definition - Shared with BIOS */
556/****************************************************/ 598/****************************************************/
557#define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 \ 599#define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\
558 (GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ 600 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
559 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ 601 ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT)
560 ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT)
561 602
562/* deleted */ 603/* deleted */
563 604
564/****************************************************/ 605/****************************************************/
606/* Generic Object ID definition - Shared with BIOS */
607/****************************************************/
608#define GENERICOBJECT_GLSYNC_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\
609 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
610 GENERIC_OBJECT_ID_GLSYNC << OBJECT_ID_SHIFT)
611
612#define GENERICOBJECT_PX2_NON_DRIVABLE_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\
613 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
614 GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT)
615
616#define GENERICOBJECT_PX2_NON_DRIVABLE_ID2 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\
617 GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\
618 GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT)
619
620#define GENERICOBJECT_MXM_OPM_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\
621 GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\
622 GENERIC_OBJECT_ID_MXM_OPM << OBJECT_ID_SHIFT)
623
624/****************************************************/
565/* Object Cap definition - Shared with BIOS */ 625/* Object Cap definition - Shared with BIOS */
566/****************************************************/ 626/****************************************************/
567#define GRAPHICS_OBJECT_CAP_I2C 0x00000001L 627#define GRAPHICS_OBJECT_CAP_I2C 0x00000001L
568#define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L 628#define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L
569 629
630
570#define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 631#define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01
571#define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 632#define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02
572#define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 633#define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03
@@ -575,4 +636,8 @@
575#pragma pack() 636#pragma pack()
576#endif 637#endif
577 638
578#endif /*GRAPHICTYPE */ 639#endif /*GRAPHICTYPE */
640
641
642
643
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 6578d19dff93..388140a7e651 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -58,6 +58,7 @@ typedef struct {
58} atom_exec_context; 58} atom_exec_context;
59 59
60int atom_debug = 0; 60int atom_debug = 0;
61static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params);
61void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); 62void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params);
62 63
63static uint32_t atom_arg_mask[8] = 64static uint32_t atom_arg_mask[8] =
@@ -573,7 +574,7 @@ static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg)
573 else 574 else
574 SDEBUG(" table: %d\n", idx); 575 SDEBUG(" table: %d\n", idx);
575 if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) 576 if (U16(ctx->ctx->cmd_table + 4 + 2 * idx))
576 atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift); 577 atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift);
577} 578}
578 579
579static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) 580static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg)
@@ -1040,7 +1041,7 @@ static struct {
1040 atom_op_shr, ATOM_ARG_MC}, { 1041 atom_op_shr, ATOM_ARG_MC}, {
1041atom_op_debug, 0},}; 1042atom_op_debug, 0},};
1042 1043
1043void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1044static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params)
1044{ 1045{
1045 int base = CU16(ctx->cmd_table + 4 + 2 * index); 1046 int base = CU16(ctx->cmd_table + 4 + 2 * index);
1046 int len, ws, ps, ptr; 1047 int len, ws, ps, ptr;
@@ -1092,6 +1093,13 @@ void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
1092 kfree(ectx.ws); 1093 kfree(ectx.ws);
1093} 1094}
1094 1095
1096void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
1097{
1098 mutex_lock(&ctx->mutex);
1099 atom_execute_table_locked(ctx, index, params);
1100 mutex_unlock(&ctx->mutex);
1101}
1102
1095static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; 1103static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
1096 1104
1097static void atom_index_iio(struct atom_context *ctx, int base) 1105static void atom_index_iio(struct atom_context *ctx, int base)
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h
index 6671848e5ea1..47fd943f6d14 100644
--- a/drivers/gpu/drm/radeon/atom.h
+++ b/drivers/gpu/drm/radeon/atom.h
@@ -120,6 +120,7 @@ struct card_info {
120 120
121struct atom_context { 121struct atom_context {
122 struct card_info *card; 122 struct card_info *card;
123 struct mutex mutex;
123 void *bios; 124 void *bios;
124 uint32_t cmd_table, data_table; 125 uint32_t cmd_table, data_table;
125 uint16_t *iio; 126 uint16_t *iio;
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h
index 5f48515c77a7..91ad0d1c1b17 100644
--- a/drivers/gpu/drm/radeon/atombios.h
+++ b/drivers/gpu/drm/radeon/atombios.h
@@ -4690,6 +4690,205 @@ typedef struct _ATOM_POWERPLAY_INFO_V3 {
4690 ATOM_POWERMODE_INFO_V3 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; 4690 ATOM_POWERMODE_INFO_V3 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK];
4691} ATOM_POWERPLAY_INFO_V3; 4691} ATOM_POWERPLAY_INFO_V3;
4692 4692
4693/* New PPlib */
4694/**************************************************************************/
4695typedef struct _ATOM_PPLIB_THERMALCONTROLLER
4696
4697{
4698 UCHAR ucType; // one of ATOM_PP_THERMALCONTROLLER_*
4699 UCHAR ucI2cLine; // as interpreted by DAL I2C
4700 UCHAR ucI2cAddress;
4701 UCHAR ucFanParameters; // Fan Control Parameters.
4702 UCHAR ucFanMinRPM; // Fan Minimum RPM (hundreds) -- for display purposes only.
4703 UCHAR ucFanMaxRPM; // Fan Maximum RPM (hundreds) -- for display purposes only.
4704 UCHAR ucReserved; // ----
4705 UCHAR ucFlags; // to be defined
4706} ATOM_PPLIB_THERMALCONTROLLER;
4707
4708#define ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK 0x0f
4709#define ATOM_PP_FANPARAMETERS_NOFAN 0x80 // No fan is connected to this controller.
4710
4711#define ATOM_PP_THERMALCONTROLLER_NONE 0
4712#define ATOM_PP_THERMALCONTROLLER_LM63 1 // Not used by PPLib
4713#define ATOM_PP_THERMALCONTROLLER_ADM1032 2 // Not used by PPLib
4714#define ATOM_PP_THERMALCONTROLLER_ADM1030 3 // Not used by PPLib
4715#define ATOM_PP_THERMALCONTROLLER_MUA6649 4 // Not used by PPLib
4716#define ATOM_PP_THERMALCONTROLLER_LM64 5
4717#define ATOM_PP_THERMALCONTROLLER_F75375 6 // Not used by PPLib
4718#define ATOM_PP_THERMALCONTROLLER_RV6xx 7
4719#define ATOM_PP_THERMALCONTROLLER_RV770 8
4720#define ATOM_PP_THERMALCONTROLLER_ADT7473 9
4721
4722typedef struct _ATOM_PPLIB_STATE
4723{
4724 UCHAR ucNonClockStateIndex;
4725 UCHAR ucClockStateIndices[1]; // variable-sized
4726} ATOM_PPLIB_STATE;
4727
4728//// ATOM_PPLIB_POWERPLAYTABLE::ulPlatformCaps
4729#define ATOM_PP_PLATFORM_CAP_BACKBIAS 1
4730#define ATOM_PP_PLATFORM_CAP_POWERPLAY 2
4731#define ATOM_PP_PLATFORM_CAP_SBIOSPOWERSOURCE 4
4732#define ATOM_PP_PLATFORM_CAP_ASPM_L0s 8
4733#define ATOM_PP_PLATFORM_CAP_ASPM_L1 16
4734#define ATOM_PP_PLATFORM_CAP_HARDWAREDC 32
4735#define ATOM_PP_PLATFORM_CAP_GEMINIPRIMARY 64
4736#define ATOM_PP_PLATFORM_CAP_STEPVDDC 128
4737#define ATOM_PP_PLATFORM_CAP_VOLTAGECONTROL 256
4738#define ATOM_PP_PLATFORM_CAP_SIDEPORTCONTROL 512
4739#define ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1 1024
4740#define ATOM_PP_PLATFORM_CAP_HTLINKCONTROL 2048
4741
4742typedef struct _ATOM_PPLIB_POWERPLAYTABLE
4743{
4744 ATOM_COMMON_TABLE_HEADER sHeader;
4745
4746 UCHAR ucDataRevision;
4747
4748 UCHAR ucNumStates;
4749 UCHAR ucStateEntrySize;
4750 UCHAR ucClockInfoSize;
4751 UCHAR ucNonClockSize;
4752
4753 // offset from start of this table to array of ucNumStates ATOM_PPLIB_STATE structures
4754 USHORT usStateArrayOffset;
4755
4756 // offset from start of this table to array of ASIC-specific structures,
4757 // currently ATOM_PPLIB_CLOCK_INFO.
4758 USHORT usClockInfoArrayOffset;
4759
4760 // offset from start of this table to array of ATOM_PPLIB_NONCLOCK_INFO
4761 USHORT usNonClockInfoArrayOffset;
4762
4763 USHORT usBackbiasTime; // in microseconds
4764 USHORT usVoltageTime; // in microseconds
4765 USHORT usTableSize; //the size of this structure, or the extended structure
4766
4767 ULONG ulPlatformCaps; // See ATOM_PPLIB_CAPS_*
4768
4769 ATOM_PPLIB_THERMALCONTROLLER sThermalController;
4770
4771 USHORT usBootClockInfoOffset;
4772 USHORT usBootNonClockInfoOffset;
4773
4774} ATOM_PPLIB_POWERPLAYTABLE;
4775
4776//// ATOM_PPLIB_NONCLOCK_INFO::usClassification
4777#define ATOM_PPLIB_CLASSIFICATION_UI_MASK 0x0007
4778#define ATOM_PPLIB_CLASSIFICATION_UI_SHIFT 0
4779#define ATOM_PPLIB_CLASSIFICATION_UI_NONE 0
4780#define ATOM_PPLIB_CLASSIFICATION_UI_BATTERY 1
4781#define ATOM_PPLIB_CLASSIFICATION_UI_BALANCED 3
4782#define ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE 5
4783// 2, 4, 6, 7 are reserved
4784
4785#define ATOM_PPLIB_CLASSIFICATION_BOOT 0x0008
4786#define ATOM_PPLIB_CLASSIFICATION_THERMAL 0x0010
4787#define ATOM_PPLIB_CLASSIFICATION_LIMITEDPOWERSOURCE 0x0020
4788#define ATOM_PPLIB_CLASSIFICATION_REST 0x0040
4789#define ATOM_PPLIB_CLASSIFICATION_FORCED 0x0080
4790#define ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE 0x0100
4791#define ATOM_PPLIB_CLASSIFICATION_OVERDRIVETEMPLATE 0x0200
4792#define ATOM_PPLIB_CLASSIFICATION_UVDSTATE 0x0400
4793#define ATOM_PPLIB_CLASSIFICATION_3DLOW 0x0800
4794#define ATOM_PPLIB_CLASSIFICATION_ACPI 0x1000
4795// remaining 3 bits are reserved
4796
4797//// ATOM_PPLIB_NONCLOCK_INFO::ulCapsAndSettings
4798#define ATOM_PPLIB_SINGLE_DISPLAY_ONLY 0x00000001
4799#define ATOM_PPLIB_SUPPORTS_VIDEO_PLAYBACK 0x00000002
4800
4801// 0 is 2.5Gb/s, 1 is 5Gb/s
4802#define ATOM_PPLIB_PCIE_LINK_SPEED_MASK 0x00000004
4803#define ATOM_PPLIB_PCIE_LINK_SPEED_SHIFT 2
4804
4805// lanes - 1: 1, 2, 4, 8, 12, 16 permitted by PCIE spec
4806#define ATOM_PPLIB_PCIE_LINK_WIDTH_MASK 0x000000F8
4807#define ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT 3
4808
4809// lookup into reduced refresh-rate table
4810#define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_MASK 0x00000F00
4811#define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_SHIFT 8
4812
4813#define ATOM_PPLIB_LIMITED_REFRESHRATE_UNLIMITED 0
4814#define ATOM_PPLIB_LIMITED_REFRESHRATE_50HZ 1
4815// 2-15 TBD as needed.
4816
4817#define ATOM_PPLIB_SOFTWARE_DISABLE_LOADBALANCING 0x00001000
4818#define ATOM_PPLIB_SOFTWARE_ENABLE_SLEEP_FOR_TIMESTAMPS 0x00002000
4819#define ATOM_PPLIB_ENABLE_VARIBRIGHT 0x00008000
4820
4821#define ATOM_PPLIB_DISALLOW_ON_DC 0x00004000
4822
4823// Contained in an array starting at the offset
4824// in ATOM_PPLIB_POWERPLAYTABLE::usNonClockInfoArrayOffset.
4825// referenced from ATOM_PPLIB_STATE_INFO::ucNonClockStateIndex
4826typedef struct _ATOM_PPLIB_NONCLOCK_INFO
4827{
4828 USHORT usClassification;
4829 UCHAR ucMinTemperature;
4830 UCHAR ucMaxTemperature;
4831 ULONG ulCapsAndSettings;
4832 UCHAR ucRequiredPower;
4833 UCHAR ucUnused1[3];
4834} ATOM_PPLIB_NONCLOCK_INFO;
4835
4836// Contained in an array starting at the offset
4837// in ATOM_PPLIB_POWERPLAYTABLE::usClockInfoArrayOffset.
4838// referenced from ATOM_PPLIB_STATE::ucClockStateIndices
4839typedef struct _ATOM_PPLIB_R600_CLOCK_INFO
4840{
4841 USHORT usEngineClockLow;
4842 UCHAR ucEngineClockHigh;
4843
4844 USHORT usMemoryClockLow;
4845 UCHAR ucMemoryClockHigh;
4846
4847 USHORT usVDDC;
4848 USHORT usUnused1;
4849 USHORT usUnused2;
4850
4851 ULONG ulFlags; // ATOM_PPLIB_R600_FLAGS_*
4852
4853} ATOM_PPLIB_R600_CLOCK_INFO;
4854
4855// ulFlags in ATOM_PPLIB_R600_CLOCK_INFO
4856#define ATOM_PPLIB_R600_FLAGS_PCIEGEN2 1
4857#define ATOM_PPLIB_R600_FLAGS_UVDSAFE 2
4858#define ATOM_PPLIB_R600_FLAGS_BACKBIASENABLE 4
4859#define ATOM_PPLIB_R600_FLAGS_MEMORY_ODT_OFF 8
4860#define ATOM_PPLIB_R600_FLAGS_MEMORY_DLL_OFF 16
4861
4862typedef struct _ATOM_PPLIB_RS780_CLOCK_INFO
4863
4864{
4865 USHORT usLowEngineClockLow; // Low Engine clock in MHz (the same way as on the R600).
4866 UCHAR ucLowEngineClockHigh;
4867 USHORT usHighEngineClockLow; // High Engine clock in MHz.
4868 UCHAR ucHighEngineClockHigh;
4869 USHORT usMemoryClockLow; // For now one of the ATOM_PPLIB_RS780_SPMCLK_XXXX constants.
4870 UCHAR ucMemoryClockHigh; // Currentyl unused.
4871 UCHAR ucPadding; // For proper alignment and size.
4872 USHORT usVDDC; // For the 780, use: None, Low, High, Variable
4873 UCHAR ucMaxHTLinkWidth; // From SBIOS - {2, 4, 8, 16}
4874 UCHAR ucMinHTLinkWidth; // From SBIOS - {2, 4, 8, 16}. Effective only if CDLW enabled. Minimum down stream width could be bigger as display BW requriement.
4875 USHORT usHTLinkFreq; // See definition ATOM_PPLIB_RS780_HTLINKFREQ_xxx or in MHz(>=200).
4876 ULONG ulFlags;
4877} ATOM_PPLIB_RS780_CLOCK_INFO;
4878
4879#define ATOM_PPLIB_RS780_VOLTAGE_NONE 0
4880#define ATOM_PPLIB_RS780_VOLTAGE_LOW 1
4881#define ATOM_PPLIB_RS780_VOLTAGE_HIGH 2
4882#define ATOM_PPLIB_RS780_VOLTAGE_VARIABLE 3
4883
4884#define ATOM_PPLIB_RS780_SPMCLK_NONE 0 // We cannot change the side port memory clock, leave it as it is.
4885#define ATOM_PPLIB_RS780_SPMCLK_LOW 1
4886#define ATOM_PPLIB_RS780_SPMCLK_HIGH 2
4887
4888#define ATOM_PPLIB_RS780_HTLINKFREQ_NONE 0
4889#define ATOM_PPLIB_RS780_HTLINKFREQ_LOW 1
4890#define ATOM_PPLIB_RS780_HTLINKFREQ_HIGH 2
4891
4693/**************************************************************************/ 4892/**************************************************************************/
4694 4893
4695/* Following definitions are for compatiblity issue in different SW components. */ 4894/* Following definitions are for compatiblity issue in different SW components. */
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 0d63c4436e7c..3eb0ca5b3d73 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -468,7 +468,8 @@ void radeon_dp_set_link_config(struct drm_connector *connector,
468 struct radeon_connector *radeon_connector; 468 struct radeon_connector *radeon_connector;
469 struct radeon_connector_atom_dig *dig_connector; 469 struct radeon_connector_atom_dig *dig_connector;
470 470
471 if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) 471 if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) ||
472 (connector->connector_type != DRM_MODE_CONNECTOR_eDP))
472 return; 473 return;
473 474
474 radeon_connector = to_radeon_connector(connector); 475 radeon_connector = to_radeon_connector(connector);
@@ -582,7 +583,8 @@ void dp_link_train(struct drm_encoder *encoder,
582 u8 train_set[4]; 583 u8 train_set[4];
583 int i; 584 int i;
584 585
585 if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) 586 if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) ||
587 (connector->connector_type != DRM_MODE_CONNECTOR_eDP))
586 return; 588 return;
587 589
588 if (!radeon_encoder->enc_priv) 590 if (!radeon_encoder->enc_priv)
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c
index 0d79577c1576..607241c6a8a9 100644
--- a/drivers/gpu/drm/radeon/mkregtable.c
+++ b/drivers/gpu/drm/radeon/mkregtable.c
@@ -661,8 +661,10 @@ static int parser_auth(struct table *t, const char *filename)
661 fseek(file, 0, SEEK_SET); 661 fseek(file, 0, SEEK_SET);
662 662
663 /* get header */ 663 /* get header */
664 if (fgets(buf, 1024, file) == NULL) 664 if (fgets(buf, 1024, file) == NULL) {
665 fclose(file);
665 return -1; 666 return -1;
667 }
666 668
667 /* first line will contain the last register 669 /* first line will contain the last register
668 * and gpu name */ 670 * and gpu name */
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 84e5df766d3f..8760d66e058a 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -131,7 +131,8 @@ void r100_hpd_init(struct radeon_device *rdev)
131 break; 131 break;
132 } 132 }
133 } 133 }
134 r100_irq_set(rdev); 134 if (rdev->irq.installed)
135 r100_irq_set(rdev);
135} 136}
136 137
137void r100_hpd_fini(struct radeon_device *rdev) 138void r100_hpd_fini(struct radeon_device *rdev)
@@ -243,6 +244,11 @@ int r100_irq_set(struct radeon_device *rdev)
243{ 244{
244 uint32_t tmp = 0; 245 uint32_t tmp = 0;
245 246
247 if (!rdev->irq.installed) {
248 WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n");
249 WREG32(R_000040_GEN_INT_CNTL, 0);
250 return -EINVAL;
251 }
246 if (rdev->irq.sw_int) { 252 if (rdev->irq.sw_int) {
247 tmp |= RADEON_SW_INT_ENABLE; 253 tmp |= RADEON_SW_INT_ENABLE;
248 } 254 }
@@ -356,6 +362,11 @@ void r100_fence_ring_emit(struct radeon_device *rdev,
356 /* Wait until IDLE & CLEAN */ 362 /* Wait until IDLE & CLEAN */
357 radeon_ring_write(rdev, PACKET0(0x1720, 0)); 363 radeon_ring_write(rdev, PACKET0(0x1720, 0));
358 radeon_ring_write(rdev, (1 << 16) | (1 << 17)); 364 radeon_ring_write(rdev, (1 << 16) | (1 << 17));
365 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0));
366 radeon_ring_write(rdev, rdev->config.r100.hdp_cntl |
367 RADEON_HDP_READ_BUFFER_INVALIDATE);
368 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0));
369 radeon_ring_write(rdev, rdev->config.r100.hdp_cntl);
359 /* Emit fence sequence & fire IRQ */ 370 /* Emit fence sequence & fire IRQ */
360 radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); 371 radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0));
361 radeon_ring_write(rdev, fence->seq); 372 radeon_ring_write(rdev, fence->seq);
@@ -1713,14 +1724,6 @@ void r100_gpu_init(struct radeon_device *rdev)
1713 r100_hdp_reset(rdev); 1724 r100_hdp_reset(rdev);
1714} 1725}
1715 1726
1716void r100_hdp_flush(struct radeon_device *rdev)
1717{
1718 u32 tmp;
1719 tmp = RREG32(RADEON_HOST_PATH_CNTL);
1720 tmp |= RADEON_HDP_READ_BUFFER_INVALIDATE;
1721 WREG32(RADEON_HOST_PATH_CNTL, tmp);
1722}
1723
1724void r100_hdp_reset(struct radeon_device *rdev) 1727void r100_hdp_reset(struct radeon_device *rdev)
1725{ 1728{
1726 uint32_t tmp; 1729 uint32_t tmp;
@@ -2881,6 +2884,10 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track)
2881 2884
2882 for (i = 0; i < track->num_cb; i++) { 2885 for (i = 0; i < track->num_cb; i++) {
2883 if (track->cb[i].robj == NULL) { 2886 if (track->cb[i].robj == NULL) {
2887 if (!(track->fastfill || track->color_channel_mask ||
2888 track->blend_read_enable)) {
2889 continue;
2890 }
2884 DRM_ERROR("[drm] No buffer for color buffer %d !\n", i); 2891 DRM_ERROR("[drm] No buffer for color buffer %d !\n", i);
2885 return -EINVAL; 2892 return -EINVAL;
2886 } 2893 }
@@ -3309,6 +3316,7 @@ static int r100_startup(struct radeon_device *rdev)
3309 } 3316 }
3310 /* Enable IRQ */ 3317 /* Enable IRQ */
3311 r100_irq_set(rdev); 3318 r100_irq_set(rdev);
3319 rdev->config.r100.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
3312 /* 1M ring buffer */ 3320 /* 1M ring buffer */
3313 r = r100_cp_init(rdev, 1024 * 1024); 3321 r = r100_cp_init(rdev, 1024 * 1024);
3314 if (r) { 3322 if (r) {
@@ -3367,6 +3375,7 @@ void r100_fini(struct radeon_device *rdev)
3367 radeon_gem_fini(rdev); 3375 radeon_gem_fini(rdev);
3368 if (rdev->flags & RADEON_IS_PCI) 3376 if (rdev->flags & RADEON_IS_PCI)
3369 r100_pci_gart_fini(rdev); 3377 r100_pci_gart_fini(rdev);
3378 radeon_agp_fini(rdev);
3370 radeon_irq_kms_fini(rdev); 3379 radeon_irq_kms_fini(rdev);
3371 radeon_fence_driver_fini(rdev); 3380 radeon_fence_driver_fini(rdev);
3372 radeon_bo_fini(rdev); 3381 radeon_bo_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
index 7188c3778ee2..b27a6999d219 100644
--- a/drivers/gpu/drm/radeon/r100_track.h
+++ b/drivers/gpu/drm/radeon/r100_track.h
@@ -67,13 +67,15 @@ struct r100_cs_track {
67 unsigned immd_dwords; 67 unsigned immd_dwords;
68 unsigned num_arrays; 68 unsigned num_arrays;
69 unsigned max_indx; 69 unsigned max_indx;
70 unsigned color_channel_mask;
70 struct r100_cs_track_array arrays[11]; 71 struct r100_cs_track_array arrays[11];
71 struct r100_cs_track_cb cb[R300_MAX_CB]; 72 struct r100_cs_track_cb cb[R300_MAX_CB];
72 struct r100_cs_track_cb zb; 73 struct r100_cs_track_cb zb;
73 struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE]; 74 struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE];
74 bool z_enabled; 75 bool z_enabled;
75 bool separate_cube; 76 bool separate_cube;
76 77 bool fastfill;
78 bool blend_read_enable;
77}; 79};
78 80
79int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track); 81int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 83490c2b5061..0051d11b907c 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -36,7 +36,15 @@
36#include "rv350d.h" 36#include "rv350d.h"
37#include "r300_reg_safe.h" 37#include "r300_reg_safe.h"
38 38
39/* This files gather functions specifics to: r300,r350,rv350,rv370,rv380 */ 39/* This files gather functions specifics to: r300,r350,rv350,rv370,rv380
40 *
41 * GPU Errata:
42 * - HOST_PATH_CNTL: r300 family seems to dislike write to HOST_PATH_CNTL
43 * using MMIO to flush host path read cache, this lead to HARDLOCKUP.
44 * However, scheduling such write to the ring seems harmless, i suspect
45 * the CP read collide with the flush somehow, or maybe the MC, hard to
46 * tell. (Jerome Glisse)
47 */
40 48
41/* 49/*
42 * rv370,rv380 PCIE GART 50 * rv370,rv380 PCIE GART
@@ -178,6 +186,11 @@ void r300_fence_ring_emit(struct radeon_device *rdev,
178 /* Wait until IDLE & CLEAN */ 186 /* Wait until IDLE & CLEAN */
179 radeon_ring_write(rdev, PACKET0(0x1720, 0)); 187 radeon_ring_write(rdev, PACKET0(0x1720, 0));
180 radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9)); 188 radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9));
189 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0));
190 radeon_ring_write(rdev, rdev->config.r300.hdp_cntl |
191 RADEON_HDP_READ_BUFFER_INVALIDATE);
192 radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0));
193 radeon_ring_write(rdev, rdev->config.r300.hdp_cntl);
181 /* Emit fence sequence & fire IRQ */ 194 /* Emit fence sequence & fire IRQ */
182 radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); 195 radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0));
183 radeon_ring_write(rdev, fence->seq); 196 radeon_ring_write(rdev, fence->seq);
@@ -887,6 +900,14 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
887 track->textures[i].cpp = 1; 900 track->textures[i].cpp = 1;
888 track->textures[i].compress_format = R100_TRACK_COMP_DXT1; 901 track->textures[i].compress_format = R100_TRACK_COMP_DXT1;
889 break; 902 break;
903 case R300_TX_FORMAT_ATI2N:
904 if (p->rdev->family < CHIP_R420) {
905 DRM_ERROR("Invalid texture format %u\n",
906 (idx_value & 0x1F));
907 return -EINVAL;
908 }
909 /* The same rules apply as for DXT3/5. */
910 /* Pass through. */
890 case R300_TX_FORMAT_DXT3: 911 case R300_TX_FORMAT_DXT3:
891 case R300_TX_FORMAT_DXT5: 912 case R300_TX_FORMAT_DXT5:
892 track->textures[i].cpp = 1; 913 track->textures[i].cpp = 1;
@@ -951,6 +972,16 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
951 track->textures[i].width_11 = tmp; 972 track->textures[i].width_11 = tmp;
952 tmp = ((idx_value >> 16) & 1) << 11; 973 tmp = ((idx_value >> 16) & 1) << 11;
953 track->textures[i].height_11 = tmp; 974 track->textures[i].height_11 = tmp;
975
976 /* ATI1N */
977 if (idx_value & (1 << 14)) {
978 /* The same rules apply as for DXT1. */
979 track->textures[i].compress_format =
980 R100_TRACK_COMP_DXT1;
981 }
982 } else if (idx_value & (1 << 14)) {
983 DRM_ERROR("Forbidden bit TXFORMAT_MSB\n");
984 return -EINVAL;
954 } 985 }
955 break; 986 break;
956 case 0x4480: 987 case 0x4480:
@@ -992,6 +1023,18 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
992 } 1023 }
993 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); 1024 ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset);
994 break; 1025 break;
1026 case 0x4e0c:
1027 /* RB3D_COLOR_CHANNEL_MASK */
1028 track->color_channel_mask = idx_value;
1029 break;
1030 case 0x4d1c:
1031 /* ZB_BW_CNTL */
1032 track->fastfill = !!(idx_value & (1 << 2));
1033 break;
1034 case 0x4e04:
1035 /* RB3D_BLENDCNTL */
1036 track->blend_read_enable = !!(idx_value & (1 << 2));
1037 break;
995 case 0x4be8: 1038 case 0x4be8:
996 /* valid register only on RV530 */ 1039 /* valid register only on RV530 */
997 if (p->rdev->family == CHIP_RV530) 1040 if (p->rdev->family == CHIP_RV530)
@@ -1228,6 +1271,7 @@ static int r300_startup(struct radeon_device *rdev)
1228 } 1271 }
1229 /* Enable IRQ */ 1272 /* Enable IRQ */
1230 r100_irq_set(rdev); 1273 r100_irq_set(rdev);
1274 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
1231 /* 1M ring buffer */ 1275 /* 1M ring buffer */
1232 r = r100_cp_init(rdev, 1024 * 1024); 1276 r = r100_cp_init(rdev, 1024 * 1024);
1233 if (r) { 1277 if (r) {
@@ -1292,6 +1336,7 @@ void r300_fini(struct radeon_device *rdev)
1292 rv370_pcie_gart_fini(rdev); 1336 rv370_pcie_gart_fini(rdev);
1293 if (rdev->flags & RADEON_IS_PCI) 1337 if (rdev->flags & RADEON_IS_PCI)
1294 r100_pci_gart_fini(rdev); 1338 r100_pci_gart_fini(rdev);
1339 radeon_agp_fini(rdev);
1295 radeon_irq_kms_fini(rdev); 1340 radeon_irq_kms_fini(rdev);
1296 radeon_fence_driver_fini(rdev); 1341 radeon_fence_driver_fini(rdev);
1297 radeon_bo_fini(rdev); 1342 radeon_bo_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c
index cb2e470f97d4..34bffa0e4b73 100644
--- a/drivers/gpu/drm/radeon/r300_cmdbuf.c
+++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c
@@ -990,7 +990,7 @@ static inline int r300_emit_r500fp(drm_radeon_private_t *dev_priv,
990 int sz; 990 int sz;
991 int addr; 991 int addr;
992 int type; 992 int type;
993 int clamp; 993 int isclamp;
994 int stride; 994 int stride;
995 RING_LOCALS; 995 RING_LOCALS;
996 996
@@ -999,10 +999,10 @@ static inline int r300_emit_r500fp(drm_radeon_private_t *dev_priv,
999 addr = ((header.r500fp.adrhi_flags & 1) << 8) | header.r500fp.adrlo; 999 addr = ((header.r500fp.adrhi_flags & 1) << 8) | header.r500fp.adrlo;
1000 1000
1001 type = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE); 1001 type = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE);
1002 clamp = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP); 1002 isclamp = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP);
1003 1003
1004 addr |= (type << 16); 1004 addr |= (type << 16);
1005 addr |= (clamp << 17); 1005 addr |= (isclamp << 17);
1006 1006
1007 stride = type ? 4 : 6; 1007 stride = type ? 4 : 6;
1008 1008
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h
index 4b7afef35a65..1735a2b69580 100644
--- a/drivers/gpu/drm/radeon/r300_reg.h
+++ b/drivers/gpu/drm/radeon/r300_reg.h
@@ -900,6 +900,7 @@
900# define R300_TX_FORMAT_FL_I32 0x1B 900# define R300_TX_FORMAT_FL_I32 0x1B
901# define R300_TX_FORMAT_FL_I32A32 0x1C 901# define R300_TX_FORMAT_FL_I32A32 0x1C
902# define R300_TX_FORMAT_FL_R32G32B32A32 0x1D 902# define R300_TX_FORMAT_FL_R32G32B32A32 0x1D
903# define R300_TX_FORMAT_ATI2N 0x1F
903 /* alpha modes, convenience mostly */ 904 /* alpha modes, convenience mostly */
904 /* if you have alpha, pick constant appropriate to the 905 /* if you have alpha, pick constant appropriate to the
905 number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */ 906 number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index c05a7270cf0c..053404e71a9d 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -30,7 +30,15 @@
30#include "radeon_reg.h" 30#include "radeon_reg.h"
31#include "radeon.h" 31#include "radeon.h"
32#include "atom.h" 32#include "atom.h"
33#include "r100d.h"
33#include "r420d.h" 34#include "r420d.h"
35#include "r420_reg_safe.h"
36
37static void r420_set_reg_safe(struct radeon_device *rdev)
38{
39 rdev->config.r300.reg_safe_bm = r420_reg_safe_bm;
40 rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r420_reg_safe_bm);
41}
34 42
35int r420_mc_init(struct radeon_device *rdev) 43int r420_mc_init(struct radeon_device *rdev)
36{ 44{
@@ -165,6 +173,34 @@ static void r420_clock_resume(struct radeon_device *rdev)
165 WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); 173 WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl);
166} 174}
167 175
176static void r420_cp_errata_init(struct radeon_device *rdev)
177{
178 /* RV410 and R420 can lock up if CP DMA to host memory happens
179 * while the 2D engine is busy.
180 *
181 * The proper workaround is to queue a RESYNC at the beginning
182 * of the CP init, apparently.
183 */
184 radeon_scratch_get(rdev, &rdev->config.r300.resync_scratch);
185 radeon_ring_lock(rdev, 8);
186 radeon_ring_write(rdev, PACKET0(R300_CP_RESYNC_ADDR, 1));
187 radeon_ring_write(rdev, rdev->config.r300.resync_scratch);
188 radeon_ring_write(rdev, 0xDEADBEEF);
189 radeon_ring_unlock_commit(rdev);
190}
191
192static void r420_cp_errata_fini(struct radeon_device *rdev)
193{
194 /* Catch the RESYNC we dispatched all the way back,
195 * at the very beginning of the CP init.
196 */
197 radeon_ring_lock(rdev, 8);
198 radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
199 radeon_ring_write(rdev, R300_RB3D_DC_FINISH);
200 radeon_ring_unlock_commit(rdev);
201 radeon_scratch_free(rdev, rdev->config.r300.resync_scratch);
202}
203
168static int r420_startup(struct radeon_device *rdev) 204static int r420_startup(struct radeon_device *rdev)
169{ 205{
170 int r; 206 int r;
@@ -190,12 +226,14 @@ static int r420_startup(struct radeon_device *rdev)
190 r420_pipes_init(rdev); 226 r420_pipes_init(rdev);
191 /* Enable IRQ */ 227 /* Enable IRQ */
192 r100_irq_set(rdev); 228 r100_irq_set(rdev);
229 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
193 /* 1M ring buffer */ 230 /* 1M ring buffer */
194 r = r100_cp_init(rdev, 1024 * 1024); 231 r = r100_cp_init(rdev, 1024 * 1024);
195 if (r) { 232 if (r) {
196 dev_err(rdev->dev, "failled initializing CP (%d).\n", r); 233 dev_err(rdev->dev, "failled initializing CP (%d).\n", r);
197 return r; 234 return r;
198 } 235 }
236 r420_cp_errata_init(rdev);
199 r = r100_wb_init(rdev); 237 r = r100_wb_init(rdev);
200 if (r) { 238 if (r) {
201 dev_err(rdev->dev, "failled initializing WB (%d).\n", r); 239 dev_err(rdev->dev, "failled initializing WB (%d).\n", r);
@@ -238,6 +276,7 @@ int r420_resume(struct radeon_device *rdev)
238 276
239int r420_suspend(struct radeon_device *rdev) 277int r420_suspend(struct radeon_device *rdev)
240{ 278{
279 r420_cp_errata_fini(rdev);
241 r100_cp_disable(rdev); 280 r100_cp_disable(rdev);
242 r100_wb_disable(rdev); 281 r100_wb_disable(rdev);
243 r100_irq_disable(rdev); 282 r100_irq_disable(rdev);
@@ -346,7 +385,7 @@ int r420_init(struct radeon_device *rdev)
346 if (r) 385 if (r)
347 return r; 386 return r;
348 } 387 }
349 r300_set_reg_safe(rdev); 388 r420_set_reg_safe(rdev);
350 rdev->accel_working = true; 389 rdev->accel_working = true;
351 r = r420_startup(rdev); 390 r = r420_startup(rdev);
352 if (r) { 391 if (r) {
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index 0f3843b6dac7..9a189072f2b9 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -186,6 +186,7 @@ static int r520_startup(struct radeon_device *rdev)
186 } 186 }
187 /* Enable IRQ */ 187 /* Enable IRQ */
188 rs600_irq_set(rdev); 188 rs600_irq_set(rdev);
189 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
189 /* 1M ring buffer */ 190 /* 1M ring buffer */
190 r = r100_cp_init(rdev, 1024 * 1024); 191 r = r100_cp_init(rdev, 1024 * 1024);
191 if (r) { 192 if (r) {
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index a0ac3c134b1b..c0651991c3e4 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -285,7 +285,8 @@ void r600_hpd_init(struct radeon_device *rdev)
285 } 285 }
286 } 286 }
287 } 287 }
288 r600_irq_set(rdev); 288 if (rdev->irq.installed)
289 r600_irq_set(rdev);
289} 290}
290 291
291void r600_hpd_fini(struct radeon_device *rdev) 292void r600_hpd_fini(struct radeon_device *rdev)
@@ -726,6 +727,10 @@ int r600_mc_init(struct radeon_device *rdev)
726 a.full = rfixed_const(100); 727 a.full = rfixed_const(100);
727 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); 728 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
728 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 729 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
730
731 if (rdev->flags & RADEON_IS_IGP)
732 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
733
729 return 0; 734 return 0;
730} 735}
731 736
@@ -1384,11 +1389,6 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v)
1384 (void)RREG32(PCIE_PORT_DATA); 1389 (void)RREG32(PCIE_PORT_DATA);
1385} 1390}
1386 1391
1387void r600_hdp_flush(struct radeon_device *rdev)
1388{
1389 WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
1390}
1391
1392/* 1392/*
1393 * CP & Ring 1393 * CP & Ring
1394 */ 1394 */
@@ -1785,6 +1785,8 @@ void r600_fence_ring_emit(struct radeon_device *rdev,
1785 radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); 1785 radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1));
1786 radeon_ring_write(rdev, ((rdev->fence_drv.scratch_reg - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); 1786 radeon_ring_write(rdev, ((rdev->fence_drv.scratch_reg - PACKET3_SET_CONFIG_REG_OFFSET) >> 2));
1787 radeon_ring_write(rdev, fence->seq); 1787 radeon_ring_write(rdev, fence->seq);
1788 radeon_ring_write(rdev, PACKET0(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0));
1789 radeon_ring_write(rdev, 1);
1788 /* CP_INTERRUPT packet 3 no longer exists, use packet 0 */ 1790 /* CP_INTERRUPT packet 3 no longer exists, use packet 0 */
1789 radeon_ring_write(rdev, PACKET0(CP_INT_STATUS, 0)); 1791 radeon_ring_write(rdev, PACKET0(CP_INT_STATUS, 0));
1790 radeon_ring_write(rdev, RB_INT_STAT); 1792 radeon_ring_write(rdev, RB_INT_STAT);
@@ -2089,8 +2091,7 @@ void r600_fini(struct radeon_device *rdev)
2089 radeon_gem_fini(rdev); 2091 radeon_gem_fini(rdev);
2090 radeon_fence_driver_fini(rdev); 2092 radeon_fence_driver_fini(rdev);
2091 radeon_clocks_fini(rdev); 2093 radeon_clocks_fini(rdev);
2092 if (rdev->flags & RADEON_IS_AGP) 2094 radeon_agp_fini(rdev);
2093 radeon_agp_fini(rdev);
2094 radeon_bo_fini(rdev); 2095 radeon_bo_fini(rdev);
2095 radeon_atombios_fini(rdev); 2096 radeon_atombios_fini(rdev);
2096 kfree(rdev->bios); 2097 kfree(rdev->bios);
@@ -2461,6 +2462,10 @@ int r600_irq_set(struct radeon_device *rdev)
2461 u32 mode_int = 0; 2462 u32 mode_int = 0;
2462 u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0; 2463 u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0;
2463 2464
2465 if (!rdev->irq.installed) {
2466 WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n");
2467 return -EINVAL;
2468 }
2464 /* don't enable anything if the ih is disabled */ 2469 /* don't enable anything if the ih is disabled */
2465 if (!rdev->ih.enabled) 2470 if (!rdev->ih.enabled)
2466 return 0; 2471 return 0;
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 9aecafb51b66..8787ea89dc6e 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -577,9 +577,9 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes)
577 ring_size = num_loops * dwords_per_loop; 577 ring_size = num_loops * dwords_per_loop;
578 /* set default + shaders */ 578 /* set default + shaders */
579 ring_size += 40; /* shaders + def state */ 579 ring_size += 40; /* shaders + def state */
580 ring_size += 5; /* fence emit for VB IB */ 580 ring_size += 7; /* fence emit for VB IB */
581 ring_size += 5; /* done copy */ 581 ring_size += 5; /* done copy */
582 ring_size += 5; /* fence emit for done copy */ 582 ring_size += 7; /* fence emit for done copy */
583 r = radeon_ring_lock(rdev, ring_size); 583 r = radeon_ring_lock(rdev, ring_size);
584 WARN_ON(r); 584 WARN_ON(r);
585 585
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0d820764f340..44060b92d9e6 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -170,7 +170,7 @@ static int r600_cs_packet_next_reloc_nomm(struct radeon_cs_parser *p,
170 idx, relocs_chunk->length_dw); 170 idx, relocs_chunk->length_dw);
171 return -EINVAL; 171 return -EINVAL;
172 } 172 }
173 *cs_reloc = &p->relocs[0]; 173 *cs_reloc = p->relocs;
174 (*cs_reloc)->lobj.gpu_offset = (u64)relocs_chunk->kdata[idx + 3] << 32; 174 (*cs_reloc)->lobj.gpu_offset = (u64)relocs_chunk->kdata[idx + 3] << 32;
175 (*cs_reloc)->lobj.gpu_offset |= relocs_chunk->kdata[idx + 0]; 175 (*cs_reloc)->lobj.gpu_offset |= relocs_chunk->kdata[idx + 0];
176 return 0; 176 return 0;
@@ -717,7 +717,7 @@ static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p)
717 if (p->chunk_relocs_idx == -1) { 717 if (p->chunk_relocs_idx == -1) {
718 return 0; 718 return 0;
719 } 719 }
720 p->relocs = kcalloc(1, sizeof(struct radeon_cs_reloc), GFP_KERNEL); 720 p->relocs = kzalloc(sizeof(struct radeon_cs_reloc), GFP_KERNEL);
721 if (p->relocs == NULL) { 721 if (p->relocs == NULL) {
722 return -ENOMEM; 722 return -ENOMEM;
723 } 723 }
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index cd650fd3964e..eb5f99b9469d 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -162,6 +162,7 @@ struct radeon_fence_driver {
162 struct list_head created; 162 struct list_head created;
163 struct list_head emited; 163 struct list_head emited;
164 struct list_head signaled; 164 struct list_head signaled;
165 bool initialized;
165}; 166};
166 167
167struct radeon_fence { 168struct radeon_fence {
@@ -202,8 +203,9 @@ struct radeon_surface_reg {
202struct radeon_mman { 203struct radeon_mman {
203 struct ttm_bo_global_ref bo_global_ref; 204 struct ttm_bo_global_ref bo_global_ref;
204 struct ttm_global_reference mem_global_ref; 205 struct ttm_global_reference mem_global_ref;
205 bool mem_global_referenced;
206 struct ttm_bo_device bdev; 206 struct ttm_bo_device bdev;
207 bool mem_global_referenced;
208 bool initialized;
207}; 209};
208 210
209struct radeon_bo { 211struct radeon_bo {
@@ -317,10 +319,12 @@ struct radeon_mc {
317 u64 real_vram_size; 319 u64 real_vram_size;
318 int vram_mtrr; 320 int vram_mtrr;
319 bool vram_is_ddr; 321 bool vram_is_ddr;
322 bool igp_sideport_enabled;
320}; 323};
321 324
322int radeon_mc_setup(struct radeon_device *rdev); 325int radeon_mc_setup(struct radeon_device *rdev);
323 326bool radeon_combios_sideport_present(struct radeon_device *rdev);
327bool radeon_atombios_sideport_present(struct radeon_device *rdev);
324 328
325/* 329/*
326 * GPU scratch registers structures, functions & helpers 330 * GPU scratch registers structures, functions & helpers
@@ -652,7 +656,6 @@ struct radeon_asic {
652 uint32_t offset, uint32_t obj_size); 656 uint32_t offset, uint32_t obj_size);
653 int (*clear_surface_reg)(struct radeon_device *rdev, int reg); 657 int (*clear_surface_reg)(struct radeon_device *rdev, int reg);
654 void (*bandwidth_update)(struct radeon_device *rdev); 658 void (*bandwidth_update)(struct radeon_device *rdev);
655 void (*hdp_flush)(struct radeon_device *rdev);
656 void (*hpd_init)(struct radeon_device *rdev); 659 void (*hpd_init)(struct radeon_device *rdev);
657 void (*hpd_fini)(struct radeon_device *rdev); 660 void (*hpd_fini)(struct radeon_device *rdev);
658 bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd); 661 bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
@@ -665,11 +668,14 @@ struct radeon_asic {
665struct r100_asic { 668struct r100_asic {
666 const unsigned *reg_safe_bm; 669 const unsigned *reg_safe_bm;
667 unsigned reg_safe_bm_size; 670 unsigned reg_safe_bm_size;
671 u32 hdp_cntl;
668}; 672};
669 673
670struct r300_asic { 674struct r300_asic {
671 const unsigned *reg_safe_bm; 675 const unsigned *reg_safe_bm;
672 unsigned reg_safe_bm_size; 676 unsigned reg_safe_bm_size;
677 u32 resync_scratch;
678 u32 hdp_cntl;
673}; 679};
674 680
675struct r600_asic { 681struct r600_asic {
@@ -1005,7 +1011,6 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
1005#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) 1011#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s)))
1006#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) 1012#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r)))
1007#define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) 1013#define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev))
1008#define radeon_hdp_flush(rdev) (rdev)->asic->hdp_flush((rdev))
1009#define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev)) 1014#define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev))
1010#define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev)) 1015#define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev))
1011#define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) 1016#define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd))
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c
index 54bf49a6d676..220f454ea9fa 100644
--- a/drivers/gpu/drm/radeon/radeon_agp.c
+++ b/drivers/gpu/drm/radeon/radeon_agp.c
@@ -252,10 +252,8 @@ void radeon_agp_resume(struct radeon_device *rdev)
252void radeon_agp_fini(struct radeon_device *rdev) 252void radeon_agp_fini(struct radeon_device *rdev)
253{ 253{
254#if __OS_HAS_AGP 254#if __OS_HAS_AGP
255 if (rdev->flags & RADEON_IS_AGP) { 255 if (rdev->ddev->agp && rdev->ddev->agp->acquired) {
256 if (rdev->ddev->agp && rdev->ddev->agp->acquired) { 256 drm_agp_release(rdev->ddev);
257 drm_agp_release(rdev->ddev);
258 }
259 } 257 }
260#endif 258#endif
261} 259}
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 636116bedcb4..f2fbd2e4e9df 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -33,6 +33,7 @@
33 */ 33 */
34uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev); 34uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev);
35void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); 35void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock);
36uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev);
36void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable); 37void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable);
37 38
38uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev); 39uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev);
@@ -76,7 +77,6 @@ int r100_clear_surface_reg(struct radeon_device *rdev, int reg);
76void r100_bandwidth_update(struct radeon_device *rdev); 77void r100_bandwidth_update(struct radeon_device *rdev);
77void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); 78void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
78int r100_ring_test(struct radeon_device *rdev); 79int r100_ring_test(struct radeon_device *rdev);
79void r100_hdp_flush(struct radeon_device *rdev);
80void r100_hpd_init(struct radeon_device *rdev); 80void r100_hpd_init(struct radeon_device *rdev);
81void r100_hpd_fini(struct radeon_device *rdev); 81void r100_hpd_fini(struct radeon_device *rdev);
82bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); 82bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
@@ -106,14 +106,13 @@ static struct radeon_asic r100_asic = {
106 .copy = &r100_copy_blit, 106 .copy = &r100_copy_blit,
107 .get_engine_clock = &radeon_legacy_get_engine_clock, 107 .get_engine_clock = &radeon_legacy_get_engine_clock,
108 .set_engine_clock = &radeon_legacy_set_engine_clock, 108 .set_engine_clock = &radeon_legacy_set_engine_clock,
109 .get_memory_clock = NULL, 109 .get_memory_clock = &radeon_legacy_get_memory_clock,
110 .set_memory_clock = NULL, 110 .set_memory_clock = NULL,
111 .set_pcie_lanes = NULL, 111 .set_pcie_lanes = NULL,
112 .set_clock_gating = &radeon_legacy_set_clock_gating, 112 .set_clock_gating = &radeon_legacy_set_clock_gating,
113 .set_surface_reg = r100_set_surface_reg, 113 .set_surface_reg = r100_set_surface_reg,
114 .clear_surface_reg = r100_clear_surface_reg, 114 .clear_surface_reg = r100_clear_surface_reg,
115 .bandwidth_update = &r100_bandwidth_update, 115 .bandwidth_update = &r100_bandwidth_update,
116 .hdp_flush = &r100_hdp_flush,
117 .hpd_init = &r100_hpd_init, 116 .hpd_init = &r100_hpd_init,
118 .hpd_fini = &r100_hpd_fini, 117 .hpd_fini = &r100_hpd_fini,
119 .hpd_sense = &r100_hpd_sense, 118 .hpd_sense = &r100_hpd_sense,
@@ -166,14 +165,13 @@ static struct radeon_asic r300_asic = {
166 .copy = &r100_copy_blit, 165 .copy = &r100_copy_blit,
167 .get_engine_clock = &radeon_legacy_get_engine_clock, 166 .get_engine_clock = &radeon_legacy_get_engine_clock,
168 .set_engine_clock = &radeon_legacy_set_engine_clock, 167 .set_engine_clock = &radeon_legacy_set_engine_clock,
169 .get_memory_clock = NULL, 168 .get_memory_clock = &radeon_legacy_get_memory_clock,
170 .set_memory_clock = NULL, 169 .set_memory_clock = NULL,
171 .set_pcie_lanes = &rv370_set_pcie_lanes, 170 .set_pcie_lanes = &rv370_set_pcie_lanes,
172 .set_clock_gating = &radeon_legacy_set_clock_gating, 171 .set_clock_gating = &radeon_legacy_set_clock_gating,
173 .set_surface_reg = r100_set_surface_reg, 172 .set_surface_reg = r100_set_surface_reg,
174 .clear_surface_reg = r100_clear_surface_reg, 173 .clear_surface_reg = r100_clear_surface_reg,
175 .bandwidth_update = &r100_bandwidth_update, 174 .bandwidth_update = &r100_bandwidth_update,
176 .hdp_flush = &r100_hdp_flush,
177 .hpd_init = &r100_hpd_init, 175 .hpd_init = &r100_hpd_init,
178 .hpd_fini = &r100_hpd_fini, 176 .hpd_fini = &r100_hpd_fini,
179 .hpd_sense = &r100_hpd_sense, 177 .hpd_sense = &r100_hpd_sense,
@@ -217,7 +215,6 @@ static struct radeon_asic r420_asic = {
217 .set_surface_reg = r100_set_surface_reg, 215 .set_surface_reg = r100_set_surface_reg,
218 .clear_surface_reg = r100_clear_surface_reg, 216 .clear_surface_reg = r100_clear_surface_reg,
219 .bandwidth_update = &r100_bandwidth_update, 217 .bandwidth_update = &r100_bandwidth_update,
220 .hdp_flush = &r100_hdp_flush,
221 .hpd_init = &r100_hpd_init, 218 .hpd_init = &r100_hpd_init,
222 .hpd_fini = &r100_hpd_fini, 219 .hpd_fini = &r100_hpd_fini,
223 .hpd_sense = &r100_hpd_sense, 220 .hpd_sense = &r100_hpd_sense,
@@ -259,14 +256,13 @@ static struct radeon_asic rs400_asic = {
259 .copy = &r100_copy_blit, 256 .copy = &r100_copy_blit,
260 .get_engine_clock = &radeon_legacy_get_engine_clock, 257 .get_engine_clock = &radeon_legacy_get_engine_clock,
261 .set_engine_clock = &radeon_legacy_set_engine_clock, 258 .set_engine_clock = &radeon_legacy_set_engine_clock,
262 .get_memory_clock = NULL, 259 .get_memory_clock = &radeon_legacy_get_memory_clock,
263 .set_memory_clock = NULL, 260 .set_memory_clock = NULL,
264 .set_pcie_lanes = NULL, 261 .set_pcie_lanes = NULL,
265 .set_clock_gating = &radeon_legacy_set_clock_gating, 262 .set_clock_gating = &radeon_legacy_set_clock_gating,
266 .set_surface_reg = r100_set_surface_reg, 263 .set_surface_reg = r100_set_surface_reg,
267 .clear_surface_reg = r100_clear_surface_reg, 264 .clear_surface_reg = r100_clear_surface_reg,
268 .bandwidth_update = &r100_bandwidth_update, 265 .bandwidth_update = &r100_bandwidth_update,
269 .hdp_flush = &r100_hdp_flush,
270 .hpd_init = &r100_hpd_init, 266 .hpd_init = &r100_hpd_init,
271 .hpd_fini = &r100_hpd_fini, 267 .hpd_fini = &r100_hpd_fini,
272 .hpd_sense = &r100_hpd_sense, 268 .hpd_sense = &r100_hpd_sense,
@@ -323,7 +319,6 @@ static struct radeon_asic rs600_asic = {
323 .set_pcie_lanes = NULL, 319 .set_pcie_lanes = NULL,
324 .set_clock_gating = &radeon_atom_set_clock_gating, 320 .set_clock_gating = &radeon_atom_set_clock_gating,
325 .bandwidth_update = &rs600_bandwidth_update, 321 .bandwidth_update = &rs600_bandwidth_update,
326 .hdp_flush = &r100_hdp_flush,
327 .hpd_init = &rs600_hpd_init, 322 .hpd_init = &rs600_hpd_init,
328 .hpd_fini = &rs600_hpd_fini, 323 .hpd_fini = &rs600_hpd_fini,
329 .hpd_sense = &rs600_hpd_sense, 324 .hpd_sense = &rs600_hpd_sense,
@@ -371,7 +366,6 @@ static struct radeon_asic rs690_asic = {
371 .set_surface_reg = r100_set_surface_reg, 366 .set_surface_reg = r100_set_surface_reg,
372 .clear_surface_reg = r100_clear_surface_reg, 367 .clear_surface_reg = r100_clear_surface_reg,
373 .bandwidth_update = &rs690_bandwidth_update, 368 .bandwidth_update = &rs690_bandwidth_update,
374 .hdp_flush = &r100_hdp_flush,
375 .hpd_init = &rs600_hpd_init, 369 .hpd_init = &rs600_hpd_init,
376 .hpd_fini = &rs600_hpd_fini, 370 .hpd_fini = &rs600_hpd_fini,
377 .hpd_sense = &rs600_hpd_sense, 371 .hpd_sense = &rs600_hpd_sense,
@@ -423,7 +417,6 @@ static struct radeon_asic rv515_asic = {
423 .set_surface_reg = r100_set_surface_reg, 417 .set_surface_reg = r100_set_surface_reg,
424 .clear_surface_reg = r100_clear_surface_reg, 418 .clear_surface_reg = r100_clear_surface_reg,
425 .bandwidth_update = &rv515_bandwidth_update, 419 .bandwidth_update = &rv515_bandwidth_update,
426 .hdp_flush = &r100_hdp_flush,
427 .hpd_init = &rs600_hpd_init, 420 .hpd_init = &rs600_hpd_init,
428 .hpd_fini = &rs600_hpd_fini, 421 .hpd_fini = &rs600_hpd_fini,
429 .hpd_sense = &rs600_hpd_sense, 422 .hpd_sense = &rs600_hpd_sense,
@@ -466,7 +459,6 @@ static struct radeon_asic r520_asic = {
466 .set_surface_reg = r100_set_surface_reg, 459 .set_surface_reg = r100_set_surface_reg,
467 .clear_surface_reg = r100_clear_surface_reg, 460 .clear_surface_reg = r100_clear_surface_reg,
468 .bandwidth_update = &rv515_bandwidth_update, 461 .bandwidth_update = &rv515_bandwidth_update,
469 .hdp_flush = &r100_hdp_flush,
470 .hpd_init = &rs600_hpd_init, 462 .hpd_init = &rs600_hpd_init,
471 .hpd_fini = &rs600_hpd_fini, 463 .hpd_fini = &rs600_hpd_fini,
472 .hpd_sense = &rs600_hpd_sense, 464 .hpd_sense = &rs600_hpd_sense,
@@ -507,7 +499,6 @@ int r600_ring_test(struct radeon_device *rdev);
507int r600_copy_blit(struct radeon_device *rdev, 499int r600_copy_blit(struct radeon_device *rdev,
508 uint64_t src_offset, uint64_t dst_offset, 500 uint64_t src_offset, uint64_t dst_offset,
509 unsigned num_pages, struct radeon_fence *fence); 501 unsigned num_pages, struct radeon_fence *fence);
510void r600_hdp_flush(struct radeon_device *rdev);
511void r600_hpd_init(struct radeon_device *rdev); 502void r600_hpd_init(struct radeon_device *rdev);
512void r600_hpd_fini(struct radeon_device *rdev); 503void r600_hpd_fini(struct radeon_device *rdev);
513bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); 504bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
@@ -543,7 +534,6 @@ static struct radeon_asic r600_asic = {
543 .set_surface_reg = r600_set_surface_reg, 534 .set_surface_reg = r600_set_surface_reg,
544 .clear_surface_reg = r600_clear_surface_reg, 535 .clear_surface_reg = r600_clear_surface_reg,
545 .bandwidth_update = &rv515_bandwidth_update, 536 .bandwidth_update = &rv515_bandwidth_update,
546 .hdp_flush = &r600_hdp_flush,
547 .hpd_init = &r600_hpd_init, 537 .hpd_init = &r600_hpd_init,
548 .hpd_fini = &r600_hpd_fini, 538 .hpd_fini = &r600_hpd_fini,
549 .hpd_sense = &r600_hpd_sense, 539 .hpd_sense = &r600_hpd_sense,
@@ -588,7 +578,6 @@ static struct radeon_asic rv770_asic = {
588 .set_surface_reg = r600_set_surface_reg, 578 .set_surface_reg = r600_set_surface_reg,
589 .clear_surface_reg = r600_clear_surface_reg, 579 .clear_surface_reg = r600_clear_surface_reg,
590 .bandwidth_update = &rv515_bandwidth_update, 580 .bandwidth_update = &rv515_bandwidth_update,
591 .hdp_flush = &r600_hdp_flush,
592 .hpd_init = &r600_hpd_init, 581 .hpd_init = &r600_hpd_init,
593 .hpd_fini = &r600_hpd_fini, 582 .hpd_fini = &r600_hpd_fini,
594 .hpd_sense = &r600_hpd_sense, 583 .hpd_sense = &r600_hpd_sense,
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 12a0c760e7ff..fa82ca74324e 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -114,6 +114,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
114 i2c.i2c_id = gpio->sucI2cId.ucAccess; 114 i2c.i2c_id = gpio->sucI2cId.ucAccess;
115 115
116 i2c.valid = true; 116 i2c.valid = true;
117 break;
117 } 118 }
118 } 119 }
119 120
@@ -345,7 +346,9 @@ const int object_connector_convert[] = {
345 DRM_MODE_CONNECTOR_Unknown, 346 DRM_MODE_CONNECTOR_Unknown,
346 DRM_MODE_CONNECTOR_Unknown, 347 DRM_MODE_CONNECTOR_Unknown,
347 DRM_MODE_CONNECTOR_Unknown, 348 DRM_MODE_CONNECTOR_Unknown,
348 DRM_MODE_CONNECTOR_DisplayPort 349 DRM_MODE_CONNECTOR_DisplayPort,
350 DRM_MODE_CONNECTOR_eDP,
351 DRM_MODE_CONNECTOR_Unknown
349}; 352};
350 353
351bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) 354bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
@@ -745,8 +748,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
745 else 748 else
746 radeon_add_legacy_encoder(dev, 749 radeon_add_legacy_encoder(dev,
747 radeon_get_encoder_id(dev, 750 radeon_get_encoder_id(dev,
748 (1 << 751 (1 << i),
749 i),
750 dac), 752 dac),
751 (1 << i)); 753 (1 << i));
752 } 754 }
@@ -758,32 +760,30 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
758 if (bios_connectors[j].valid && (i != j)) { 760 if (bios_connectors[j].valid && (i != j)) {
759 if (bios_connectors[i].line_mux == 761 if (bios_connectors[i].line_mux ==
760 bios_connectors[j].line_mux) { 762 bios_connectors[j].line_mux) {
761 if (((bios_connectors[i]. 763 /* make sure not to combine LVDS */
762 devices & 764 if (bios_connectors[i].devices & (ATOM_DEVICE_LCD_SUPPORT)) {
763 (ATOM_DEVICE_DFP_SUPPORT)) 765 bios_connectors[i].line_mux = 53;
764 && (bios_connectors[j]. 766 bios_connectors[i].ddc_bus.valid = false;
765 devices & 767 continue;
766 (ATOM_DEVICE_CRT_SUPPORT))) 768 }
767 || 769 if (bios_connectors[j].devices & (ATOM_DEVICE_LCD_SUPPORT)) {
768 ((bios_connectors[j]. 770 bios_connectors[j].line_mux = 53;
769 devices & 771 bios_connectors[j].ddc_bus.valid = false;
770 (ATOM_DEVICE_DFP_SUPPORT)) 772 continue;
771 && (bios_connectors[i]. 773 }
772 devices & 774 /* combine analog and digital for DVI-I */
773 (ATOM_DEVICE_CRT_SUPPORT)))) { 775 if (((bios_connectors[i].devices & (ATOM_DEVICE_DFP_SUPPORT)) &&
774 bios_connectors[i]. 776 (bios_connectors[j].devices & (ATOM_DEVICE_CRT_SUPPORT))) ||
775 devices |= 777 ((bios_connectors[j].devices & (ATOM_DEVICE_DFP_SUPPORT)) &&
776 bios_connectors[j]. 778 (bios_connectors[i].devices & (ATOM_DEVICE_CRT_SUPPORT)))) {
777 devices; 779 bios_connectors[i].devices |=
778 bios_connectors[i]. 780 bios_connectors[j].devices;
779 connector_type = 781 bios_connectors[i].connector_type =
780 DRM_MODE_CONNECTOR_DVII; 782 DRM_MODE_CONNECTOR_DVII;
781 if (bios_connectors[j].devices & 783 if (bios_connectors[j].devices & (ATOM_DEVICE_DFP_SUPPORT))
782 (ATOM_DEVICE_DFP_SUPPORT))
783 bios_connectors[i].hpd = 784 bios_connectors[i].hpd =
784 bios_connectors[j].hpd; 785 bios_connectors[j].hpd;
785 bios_connectors[j]. 786 bios_connectors[j].valid = false;
786 valid = false;
787 } 787 }
788 } 788 }
789 } 789 }
@@ -938,6 +938,43 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)
938 return false; 938 return false;
939} 939}
940 940
941union igp_info {
942 struct _ATOM_INTEGRATED_SYSTEM_INFO info;
943 struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2;
944};
945
946bool radeon_atombios_sideport_present(struct radeon_device *rdev)
947{
948 struct radeon_mode_info *mode_info = &rdev->mode_info;
949 int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo);
950 union igp_info *igp_info;
951 u8 frev, crev;
952 u16 data_offset;
953
954 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev,
955 &crev, &data_offset);
956
957 igp_info = (union igp_info *)(mode_info->atom_context->bios +
958 data_offset);
959
960 if (igp_info) {
961 switch (crev) {
962 case 1:
963 if (igp_info->info.ucMemoryType & 0xf0)
964 return true;
965 break;
966 case 2:
967 if (igp_info->info_2.ucMemoryType & 0x0f)
968 return true;
969 break;
970 default:
971 DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev);
972 break;
973 }
974 }
975 return false;
976}
977
941bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, 978bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder,
942 struct radeon_encoder_int_tmds *tmds) 979 struct radeon_encoder_int_tmds *tmds)
943{ 980{
@@ -1029,6 +1066,7 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct
1029 ss->delay = ss_info->asSS_Info[i].ucSS_Delay; 1066 ss->delay = ss_info->asSS_Info[i].ucSS_Delay;
1030 ss->range = ss_info->asSS_Info[i].ucSS_Range; 1067 ss->range = ss_info->asSS_Info[i].ucSS_Range;
1031 ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div; 1068 ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div;
1069 break;
1032 } 1070 }
1033 } 1071 }
1034 } 1072 }
@@ -1234,6 +1272,61 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index,
1234 return true; 1272 return true;
1235} 1273}
1236 1274
1275enum radeon_tv_std
1276radeon_atombios_get_tv_info(struct radeon_device *rdev)
1277{
1278 struct radeon_mode_info *mode_info = &rdev->mode_info;
1279 int index = GetIndexIntoMasterTable(DATA, AnalogTV_Info);
1280 uint16_t data_offset;
1281 uint8_t frev, crev;
1282 struct _ATOM_ANALOG_TV_INFO *tv_info;
1283 enum radeon_tv_std tv_std = TV_STD_NTSC;
1284
1285 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
1286
1287 tv_info = (struct _ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset);
1288
1289 switch (tv_info->ucTV_BootUpDefaultStandard) {
1290 case ATOM_TV_NTSC:
1291 tv_std = TV_STD_NTSC;
1292 DRM_INFO("Default TV standard: NTSC\n");
1293 break;
1294 case ATOM_TV_NTSCJ:
1295 tv_std = TV_STD_NTSC_J;
1296 DRM_INFO("Default TV standard: NTSC-J\n");
1297 break;
1298 case ATOM_TV_PAL:
1299 tv_std = TV_STD_PAL;
1300 DRM_INFO("Default TV standard: PAL\n");
1301 break;
1302 case ATOM_TV_PALM:
1303 tv_std = TV_STD_PAL_M;
1304 DRM_INFO("Default TV standard: PAL-M\n");
1305 break;
1306 case ATOM_TV_PALN:
1307 tv_std = TV_STD_PAL_N;
1308 DRM_INFO("Default TV standard: PAL-N\n");
1309 break;
1310 case ATOM_TV_PALCN:
1311 tv_std = TV_STD_PAL_CN;
1312 DRM_INFO("Default TV standard: PAL-CN\n");
1313 break;
1314 case ATOM_TV_PAL60:
1315 tv_std = TV_STD_PAL_60;
1316 DRM_INFO("Default TV standard: PAL-60\n");
1317 break;
1318 case ATOM_TV_SECAM:
1319 tv_std = TV_STD_SECAM;
1320 DRM_INFO("Default TV standard: SECAM\n");
1321 break;
1322 default:
1323 tv_std = TV_STD_NTSC;
1324 DRM_INFO("Unknown TV standard; defaulting to NTSC\n");
1325 break;
1326 }
1327 return tv_std;
1328}
1329
1237struct radeon_encoder_tv_dac * 1330struct radeon_encoder_tv_dac *
1238radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) 1331radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
1239{ 1332{
@@ -1269,6 +1362,7 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
1269 dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; 1362 dac = dac_info->ucDAC2_NTSC_DAC_Adjustment;
1270 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); 1363 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
1271 1364
1365 tv_dac->tv_std = radeon_atombios_get_tv_info(rdev);
1272 } 1366 }
1273 return tv_dac; 1367 return tv_dac;
1274} 1368}
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c
index b062109efbee..812f24dbc2a8 100644
--- a/drivers/gpu/drm/radeon/radeon_clocks.c
+++ b/drivers/gpu/drm/radeon/radeon_clocks.c
@@ -62,7 +62,7 @@ uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev)
62} 62}
63 63
64/* 10 khz */ 64/* 10 khz */
65static uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev) 65uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev)
66{ 66{
67 struct radeon_pll *mpll = &rdev->clock.mpll; 67 struct radeon_pll *mpll = &rdev->clock.mpll;
68 uint32_t fb_div, ref_div, post_div, mclk; 68 uint32_t fb_div, ref_div, post_div, mclk;
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index c5021a3445de..7914455c96ca 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -595,6 +595,48 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
595 return false; 595 return false;
596} 596}
597 597
598bool radeon_combios_sideport_present(struct radeon_device *rdev)
599{
600 struct drm_device *dev = rdev->ddev;
601 u16 igp_info;
602
603 igp_info = combios_get_table_offset(dev, COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE);
604
605 if (igp_info) {
606 if (RBIOS16(igp_info + 0x4))
607 return true;
608 }
609 return false;
610}
611
612static const uint32_t default_primarydac_adj[CHIP_LAST] = {
613 0x00000808, /* r100 */
614 0x00000808, /* rv100 */
615 0x00000808, /* rs100 */
616 0x00000808, /* rv200 */
617 0x00000808, /* rs200 */
618 0x00000808, /* r200 */
619 0x00000808, /* rv250 */
620 0x00000000, /* rs300 */
621 0x00000808, /* rv280 */
622 0x00000808, /* r300 */
623 0x00000808, /* r350 */
624 0x00000808, /* rv350 */
625 0x00000808, /* rv380 */
626 0x00000808, /* r420 */
627 0x00000808, /* r423 */
628 0x00000808, /* rv410 */
629 0x00000000, /* rs400 */
630 0x00000000, /* rs480 */
631};
632
633static void radeon_legacy_get_primary_dac_info_from_table(struct radeon_device *rdev,
634 struct radeon_encoder_primary_dac *p_dac)
635{
636 p_dac->ps2_pdac_adj = default_primarydac_adj[rdev->family];
637 return;
638}
639
598struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct 640struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
599 radeon_encoder 641 radeon_encoder
600 *encoder) 642 *encoder)
@@ -604,20 +646,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
604 uint16_t dac_info; 646 uint16_t dac_info;
605 uint8_t rev, bg, dac; 647 uint8_t rev, bg, dac;
606 struct radeon_encoder_primary_dac *p_dac = NULL; 648 struct radeon_encoder_primary_dac *p_dac = NULL;
649 int found = 0;
607 650
608 if (rdev->bios == NULL) 651 p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac),
652 GFP_KERNEL);
653
654 if (!p_dac)
609 return NULL; 655 return NULL;
610 656
657 if (rdev->bios == NULL)
658 goto out;
659
611 /* check CRT table */ 660 /* check CRT table */
612 dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); 661 dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
613 if (dac_info) { 662 if (dac_info) {
614 p_dac =
615 kzalloc(sizeof(struct radeon_encoder_primary_dac),
616 GFP_KERNEL);
617
618 if (!p_dac)
619 return NULL;
620
621 rev = RBIOS8(dac_info) & 0x3; 663 rev = RBIOS8(dac_info) & 0x3;
622 if (rev < 2) { 664 if (rev < 2) {
623 bg = RBIOS8(dac_info + 0x2) & 0xf; 665 bg = RBIOS8(dac_info + 0x2) & 0xf;
@@ -628,17 +670,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
628 dac = RBIOS8(dac_info + 0x3) & 0xf; 670 dac = RBIOS8(dac_info + 0x3) & 0xf;
629 p_dac->ps2_pdac_adj = (bg << 8) | (dac); 671 p_dac->ps2_pdac_adj = (bg << 8) | (dac);
630 } 672 }
631 673 found = 1;
632 } 674 }
633 675
676out:
677 if (!found) /* fallback to defaults */
678 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
679
634 return p_dac; 680 return p_dac;
635} 681}
636 682
637static enum radeon_tv_std 683enum radeon_tv_std
638radeon_combios_get_tv_info(struct radeon_encoder *encoder) 684radeon_combios_get_tv_info(struct radeon_device *rdev)
639{ 685{
640 struct drm_device *dev = encoder->base.dev; 686 struct drm_device *dev = rdev->ddev;
641 struct radeon_device *rdev = dev->dev_private;
642 uint16_t tv_info; 687 uint16_t tv_info;
643 enum radeon_tv_std tv_std = TV_STD_NTSC; 688 enum radeon_tv_std tv_std = TV_STD_NTSC;
644 689
@@ -779,7 +824,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
779 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); 824 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
780 found = 1; 825 found = 1;
781 } 826 }
782 tv_dac->tv_std = radeon_combios_get_tv_info(encoder); 827 tv_dac->tv_std = radeon_combios_get_tv_info(rdev);
783 } 828 }
784 if (!found) { 829 if (!found) {
785 /* then check CRT table */ 830 /* then check CRT table */
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 5eece186e03c..9da10dd5df80 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -49,8 +49,10 @@ void radeon_connector_hotplug(struct drm_connector *connector)
49 if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) 49 if (radeon_connector->hpd.hpd != RADEON_HPD_NONE)
50 radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); 50 radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
51 51
52 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { 52 if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
53 if (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) { 53 (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) {
54 if ((radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
55 (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_eDP)) {
54 if (radeon_dp_needs_link_train(radeon_connector)) { 56 if (radeon_dp_needs_link_train(radeon_connector)) {
55 if (connector->encoder) 57 if (connector->encoder)
56 dp_link_train(connector->encoder, connector); 58 dp_link_train(connector->encoder, connector);
@@ -208,6 +210,18 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode
208 drm_mode_set_name(mode); 210 drm_mode_set_name(mode);
209 211
210 DRM_DEBUG("Adding native panel mode %s\n", mode->name); 212 DRM_DEBUG("Adding native panel mode %s\n", mode->name);
213 } else if (native_mode->hdisplay != 0 &&
214 native_mode->vdisplay != 0) {
215 /* mac laptops without an edid */
216 /* Note that this is not necessarily the exact panel mode,
217 * but an approximation based on the cvt formula. For these
218 * systems we should ideally read the mode info out of the
219 * registers or add a mode table, but this works and is much
220 * simpler.
221 */
222 mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false);
223 mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
224 DRM_DEBUG("Adding cvt approximation of native panel mode %s\n", mode->name);
211 } 225 }
212 return mode; 226 return mode;
213} 227}
@@ -603,7 +617,7 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect
603 ret = connector_status_connected; 617 ret = connector_status_connected;
604 } 618 }
605 } else { 619 } else {
606 if (radeon_connector->dac_load_detect) { 620 if (radeon_connector->dac_load_detect && encoder) {
607 encoder_funcs = encoder->helper_private; 621 encoder_funcs = encoder->helper_private;
608 ret = encoder_funcs->detect(encoder, connector); 622 ret = encoder_funcs->detect(encoder, connector);
609 } 623 }
@@ -955,7 +969,8 @@ static enum drm_connector_status radeon_dp_detect(struct drm_connector *connecto
955 } 969 }
956 970
957 sink_type = radeon_dp_getsinktype(radeon_connector); 971 sink_type = radeon_dp_getsinktype(radeon_connector);
958 if (sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { 972 if ((sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
973 (sink_type == CONNECTOR_OBJECT_ID_eDP)) {
959 if (radeon_dp_getdpcd(radeon_connector)) { 974 if (radeon_dp_getdpcd(radeon_connector)) {
960 radeon_dig_connector->dp_sink_type = sink_type; 975 radeon_dig_connector->dp_sink_type = sink_type;
961 ret = connector_status_connected; 976 ret = connector_status_connected;
@@ -980,7 +995,8 @@ static int radeon_dp_mode_valid(struct drm_connector *connector,
980 995
981 /* XXX check mode bandwidth */ 996 /* XXX check mode bandwidth */
982 997
983 if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) 998 if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
999 (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP))
984 return radeon_dp_mode_valid_helper(radeon_connector, mode); 1000 return radeon_dp_mode_valid_helper(radeon_connector, mode);
985 else 1001 else
986 return MODE_OK; 1002 return MODE_OK;
@@ -1133,6 +1149,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1133 subpixel_order = SubPixelHorizontalRGB; 1149 subpixel_order = SubPixelHorizontalRGB;
1134 break; 1150 break;
1135 case DRM_MODE_CONNECTOR_DisplayPort: 1151 case DRM_MODE_CONNECTOR_DisplayPort:
1152 case DRM_MODE_CONNECTOR_eDP:
1136 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); 1153 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
1137 if (!radeon_dig_connector) 1154 if (!radeon_dig_connector)
1138 goto failed; 1155 goto failed;
@@ -1145,10 +1162,16 @@ radeon_add_atom_connector(struct drm_device *dev,
1145 goto failed; 1162 goto failed;
1146 if (i2c_bus->valid) { 1163 if (i2c_bus->valid) {
1147 /* add DP i2c bus */ 1164 /* add DP i2c bus */
1148 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); 1165 if (connector_type == DRM_MODE_CONNECTOR_eDP)
1166 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch");
1167 else
1168 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch");
1149 if (!radeon_dig_connector->dp_i2c_bus) 1169 if (!radeon_dig_connector->dp_i2c_bus)
1150 goto failed; 1170 goto failed;
1151 radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); 1171 if (connector_type == DRM_MODE_CONNECTOR_eDP)
1172 radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "eDP");
1173 else
1174 radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP");
1152 if (!radeon_connector->ddc_bus) 1175 if (!radeon_connector->ddc_bus)
1153 goto failed; 1176 goto failed;
1154 } 1177 }
@@ -1171,7 +1194,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1171 1); 1194 1);
1172 drm_connector_attach_property(&radeon_connector->base, 1195 drm_connector_attach_property(&radeon_connector->base,
1173 rdev->mode_info.tv_std_property, 1196 rdev->mode_info.tv_std_property,
1174 1); 1197 radeon_atombios_get_tv_info(rdev));
1175 } 1198 }
1176 break; 1199 break;
1177 case DRM_MODE_CONNECTOR_LVDS: 1200 case DRM_MODE_CONNECTOR_LVDS:
@@ -1315,7 +1338,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1315 1); 1338 1);
1316 drm_connector_attach_property(&radeon_connector->base, 1339 drm_connector_attach_property(&radeon_connector->base,
1317 rdev->mode_info.tv_std_property, 1340 rdev->mode_info.tv_std_property,
1318 1); 1341 radeon_combios_get_tv_info(rdev));
1319 } 1342 }
1320 break; 1343 break;
1321 case DRM_MODE_CONNECTOR_LVDS: 1344 case DRM_MODE_CONNECTOR_LVDS:
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 0b2f9c2ad2c1..06123ba31d31 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -2145,6 +2145,7 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master)
2145 &master_priv->sarea); 2145 &master_priv->sarea);
2146 if (ret) { 2146 if (ret) {
2147 DRM_ERROR("SAREA setup failed\n"); 2147 DRM_ERROR("SAREA setup failed\n");
2148 kfree(master_priv);
2148 return ret; 2149 return ret;
2149 } 2150 }
2150 master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea); 2151 master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 02bcdb1240c0..0c51f8e46613 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -391,6 +391,12 @@ int radeon_asic_init(struct radeon_device *rdev)
391 /* FIXME: not supported yet */ 391 /* FIXME: not supported yet */
392 return -EINVAL; 392 return -EINVAL;
393 } 393 }
394
395 if (rdev->flags & RADEON_IS_IGP) {
396 rdev->asic->get_memory_clock = NULL;
397 rdev->asic->set_memory_clock = NULL;
398 }
399
394 return 0; 400 return 0;
395} 401}
396 402
@@ -481,6 +487,7 @@ int radeon_atombios_init(struct radeon_device *rdev)
481 atom_card_info->pll_write = cail_pll_write; 487 atom_card_info->pll_write = cail_pll_write;
482 488
483 rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); 489 rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios);
490 mutex_init(&rdev->mode_info.atom_context->mutex);
484 radeon_atom_initialize_bios_scratch_regs(rdev->ddev); 491 radeon_atom_initialize_bios_scratch_regs(rdev->ddev);
485 atom_allocate_fb_scratch(rdev->mode_info.atom_context); 492 atom_allocate_fb_scratch(rdev->mode_info.atom_context);
486 return 0; 493 return 0;
@@ -539,9 +546,72 @@ void radeon_agp_disable(struct radeon_device *rdev)
539 } 546 }
540} 547}
541 548
542/* 549void radeon_check_arguments(struct radeon_device *rdev)
543 * Radeon device. 550{
544 */ 551 /* vramlimit must be a power of two */
552 switch (radeon_vram_limit) {
553 case 0:
554 case 4:
555 case 8:
556 case 16:
557 case 32:
558 case 64:
559 case 128:
560 case 256:
561 case 512:
562 case 1024:
563 case 2048:
564 case 4096:
565 break;
566 default:
567 dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n",
568 radeon_vram_limit);
569 radeon_vram_limit = 0;
570 break;
571 }
572 radeon_vram_limit = radeon_vram_limit << 20;
573 /* gtt size must be power of two and greater or equal to 32M */
574 switch (radeon_gart_size) {
575 case 4:
576 case 8:
577 case 16:
578 dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n",
579 radeon_gart_size);
580 radeon_gart_size = 512;
581 break;
582 case 32:
583 case 64:
584 case 128:
585 case 256:
586 case 512:
587 case 1024:
588 case 2048:
589 case 4096:
590 break;
591 default:
592 dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n",
593 radeon_gart_size);
594 radeon_gart_size = 512;
595 break;
596 }
597 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
598 /* AGP mode can only be -1, 1, 2, 4, 8 */
599 switch (radeon_agpmode) {
600 case -1:
601 case 0:
602 case 1:
603 case 2:
604 case 4:
605 case 8:
606 break;
607 default:
608 dev_warn(rdev->dev, "invalid AGP mode %d (valid mode: "
609 "-1, 0, 1, 2, 4, 8)\n", radeon_agpmode);
610 radeon_agpmode = 0;
611 break;
612 }
613}
614
545int radeon_device_init(struct radeon_device *rdev, 615int radeon_device_init(struct radeon_device *rdev,
546 struct drm_device *ddev, 616 struct drm_device *ddev,
547 struct pci_dev *pdev, 617 struct pci_dev *pdev,
@@ -580,9 +650,9 @@ int radeon_device_init(struct radeon_device *rdev,
580 650
581 /* Set asic functions */ 651 /* Set asic functions */
582 r = radeon_asic_init(rdev); 652 r = radeon_asic_init(rdev);
583 if (r) { 653 if (r)
584 return r; 654 return r;
585 } 655 radeon_check_arguments(rdev);
586 656
587 if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) { 657 if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) {
588 radeon_agp_disable(rdev); 658 radeon_agp_disable(rdev);
@@ -663,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev)
663 */ 733 */
664int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) 734int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
665{ 735{
666 struct radeon_device *rdev = dev->dev_private; 736 struct radeon_device *rdev;
667 struct drm_crtc *crtc; 737 struct drm_crtc *crtc;
668 int r; 738 int r;
669 739
670 if (dev == NULL || rdev == NULL) { 740 if (dev == NULL || dev->dev_private == NULL) {
671 return -ENODEV; 741 return -ENODEV;
672 } 742 }
673 if (state.event == PM_EVENT_PRETHAW) { 743 if (state.event == PM_EVENT_PRETHAW) {
674 return 0; 744 return 0;
675 } 745 }
746 rdev = dev->dev_private;
747
676 /* unpin the front buffers */ 748 /* unpin the front buffers */
677 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 749 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
678 struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); 750 struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index a133b833e45d..0ec491ead2ff 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -234,7 +234,7 @@ static const char *encoder_names[34] = {
234 "INTERNAL_UNIPHY2", 234 "INTERNAL_UNIPHY2",
235}; 235};
236 236
237static const char *connector_names[13] = { 237static const char *connector_names[15] = {
238 "Unknown", 238 "Unknown",
239 "VGA", 239 "VGA",
240 "DVI-I", 240 "DVI-I",
@@ -248,6 +248,8 @@ static const char *connector_names[13] = {
248 "DisplayPort", 248 "DisplayPort",
249 "HDMI-A", 249 "HDMI-A",
250 "HDMI-B", 250 "HDMI-B",
251 "TV",
252 "eDP",
251}; 253};
252 254
253static const char *hpd_names[7] = { 255static const char *hpd_names[7] = {
@@ -329,8 +331,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev)
329 ret = radeon_get_atom_connector_info_from_object_table(dev); 331 ret = radeon_get_atom_connector_info_from_object_table(dev);
330 else 332 else
331 ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); 333 ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);
332 } else 334 } else {
333 ret = radeon_get_legacy_connector_info_from_bios(dev); 335 ret = radeon_get_legacy_connector_info_from_bios(dev);
336 if (ret == false)
337 ret = radeon_get_legacy_connector_info_from_table(dev);
338 }
334 } else { 339 } else {
335 if (!ASIC_IS_AVIVO(rdev)) 340 if (!ASIC_IS_AVIVO(rdev))
336 ret = radeon_get_legacy_connector_info_from_table(dev); 341 ret = radeon_get_legacy_connector_info_from_table(dev);
@@ -349,7 +354,8 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
349{ 354{
350 int ret = 0; 355 int ret = 0;
351 356
352 if (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) { 357 if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
358 (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {
353 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; 359 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
354 if (dig->dp_i2c_bus) 360 if (dig->dp_i2c_bus)
355 radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); 361 radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter);
@@ -739,7 +745,7 @@ static struct drm_prop_enum_list radeon_tv_std_enum_list[] =
739 { TV_STD_SECAM, "secam" }, 745 { TV_STD_SECAM, "secam" },
740}; 746};
741 747
742int radeon_modeset_create_props(struct radeon_device *rdev) 748static int radeon_modeset_create_props(struct radeon_device *rdev)
743{ 749{
744 int i, sz; 750 int i, sz;
745 751
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index dbd56ef82f9c..8ba3de7994d4 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -196,7 +196,7 @@ static struct drm_driver driver_old = {
196 .owner = THIS_MODULE, 196 .owner = THIS_MODULE,
197 .open = drm_open, 197 .open = drm_open,
198 .release = drm_release, 198 .release = drm_release,
199 .ioctl = drm_ioctl, 199 .unlocked_ioctl = drm_ioctl,
200 .mmap = drm_mmap, 200 .mmap = drm_mmap,
201 .poll = drm_poll, 201 .poll = drm_poll,
202 .fasync = drm_fasync, 202 .fasync = drm_fasync,
@@ -284,7 +284,7 @@ static struct drm_driver kms_driver = {
284 .owner = THIS_MODULE, 284 .owner = THIS_MODULE,
285 .open = drm_open, 285 .open = drm_open,
286 .release = drm_release, 286 .release = drm_release,
287 .ioctl = drm_ioctl, 287 .unlocked_ioctl = drm_ioctl,
288 .mmap = radeon_mmap, 288 .mmap = radeon_mmap,
289 .poll = drm_poll, 289 .poll = drm_poll,
290 .fasync = drm_fasync, 290 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 0d1d908e5225..82eb551970b9 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -233,6 +233,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
233 if (!ASIC_IS_AVIVO(rdev)) { 233 if (!ASIC_IS_AVIVO(rdev)) {
234 adjusted_mode->hdisplay = mode->hdisplay; 234 adjusted_mode->hdisplay = mode->hdisplay;
235 adjusted_mode->vdisplay = mode->vdisplay; 235 adjusted_mode->vdisplay = mode->vdisplay;
236 adjusted_mode->crtc_hdisplay = mode->hdisplay;
237 adjusted_mode->crtc_vdisplay = mode->vdisplay;
236 } 238 }
237 adjusted_mode->base.id = mode_id; 239 adjusted_mode->base.id = mode_id;
238 } 240 }
@@ -495,9 +497,9 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
495 args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; 497 args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE;
496 args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); 498 args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10);
497 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 499 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
498 if (dig->lvds_misc & (1 << 0)) 500 if (dig->lvds_misc & ATOM_PANEL_MISC_DUAL)
499 args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; 501 args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL;
500 if (dig->lvds_misc & (1 << 1)) 502 if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB)
501 args.v1.ucMisc |= (1 << 1); 503 args.v1.ucMisc |= (1 << 1);
502 } else { 504 } else {
503 if (dig_connector->linkb) 505 if (dig_connector->linkb)
@@ -524,18 +526,18 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
524 args.v2.ucTemporal = 0; 526 args.v2.ucTemporal = 0;
525 args.v2.ucFRC = 0; 527 args.v2.ucFRC = 0;
526 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 528 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
527 if (dig->lvds_misc & (1 << 0)) 529 if (dig->lvds_misc & ATOM_PANEL_MISC_DUAL)
528 args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; 530 args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL;
529 if (dig->lvds_misc & (1 << 5)) { 531 if (dig->lvds_misc & ATOM_PANEL_MISC_SPATIAL) {
530 args.v2.ucSpatial = PANEL_ENCODER_SPATIAL_DITHER_EN; 532 args.v2.ucSpatial = PANEL_ENCODER_SPATIAL_DITHER_EN;
531 if (dig->lvds_misc & (1 << 1)) 533 if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB)
532 args.v2.ucSpatial |= PANEL_ENCODER_SPATIAL_DITHER_DEPTH; 534 args.v2.ucSpatial |= PANEL_ENCODER_SPATIAL_DITHER_DEPTH;
533 } 535 }
534 if (dig->lvds_misc & (1 << 6)) { 536 if (dig->lvds_misc & ATOM_PANEL_MISC_TEMPORAL) {
535 args.v2.ucTemporal = PANEL_ENCODER_TEMPORAL_DITHER_EN; 537 args.v2.ucTemporal = PANEL_ENCODER_TEMPORAL_DITHER_EN;
536 if (dig->lvds_misc & (1 << 1)) 538 if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB)
537 args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_DITHER_DEPTH; 539 args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_DITHER_DEPTH;
538 if (((dig->lvds_misc >> 2) & 0x3) == 2) 540 if (((dig->lvds_misc >> ATOM_PANEL_MISC_GREY_LEVEL_SHIFT) & 0x3) == 2)
539 args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_LEVEL_4; 541 args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_LEVEL_4;
540 } 542 }
541 } else { 543 } else {
@@ -594,21 +596,23 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
594 return ATOM_ENCODER_MODE_LVDS; 596 return ATOM_ENCODER_MODE_LVDS;
595 break; 597 break;
596 case DRM_MODE_CONNECTOR_DisplayPort: 598 case DRM_MODE_CONNECTOR_DisplayPort:
599 case DRM_MODE_CONNECTOR_eDP:
597 radeon_dig_connector = radeon_connector->con_priv; 600 radeon_dig_connector = radeon_connector->con_priv;
598 if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) 601 if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
602 (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP))
599 return ATOM_ENCODER_MODE_DP; 603 return ATOM_ENCODER_MODE_DP;
600 else if (drm_detect_hdmi_monitor(radeon_connector->edid)) 604 else if (drm_detect_hdmi_monitor(radeon_connector->edid))
601 return ATOM_ENCODER_MODE_HDMI; 605 return ATOM_ENCODER_MODE_HDMI;
602 else 606 else
603 return ATOM_ENCODER_MODE_DVI; 607 return ATOM_ENCODER_MODE_DVI;
604 break; 608 break;
605 case CONNECTOR_DVI_A: 609 case DRM_MODE_CONNECTOR_DVIA:
606 case CONNECTOR_VGA: 610 case DRM_MODE_CONNECTOR_VGA:
607 return ATOM_ENCODER_MODE_CRT; 611 return ATOM_ENCODER_MODE_CRT;
608 break; 612 break;
609 case CONNECTOR_STV: 613 case DRM_MODE_CONNECTOR_Composite:
610 case CONNECTOR_CTV: 614 case DRM_MODE_CONNECTOR_SVIDEO:
611 case CONNECTOR_DIN: 615 case DRM_MODE_CONNECTOR_9PinDIN:
612 /* fix me */ 616 /* fix me */
613 return ATOM_ENCODER_MODE_TV; 617 return ATOM_ENCODER_MODE_TV;
614 /*return ATOM_ENCODER_MODE_CV;*/ 618 /*return ATOM_ENCODER_MODE_CV;*/
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index cb4cd97ae39f..8495d4e32e18 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -140,16 +140,15 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence)
140 140
141bool radeon_fence_signaled(struct radeon_fence *fence) 141bool radeon_fence_signaled(struct radeon_fence *fence)
142{ 142{
143 struct radeon_device *rdev = fence->rdev;
144 unsigned long irq_flags; 143 unsigned long irq_flags;
145 bool signaled = false; 144 bool signaled = false;
146 145
147 if (rdev->gpu_lockup) { 146 if (!fence)
148 return true; 147 return true;
149 } 148
150 if (fence == NULL) { 149 if (fence->rdev->gpu_lockup)
151 return true; 150 return true;
152 } 151
153 write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); 152 write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags);
154 signaled = fence->signaled; 153 signaled = fence->signaled;
155 /* if we are shuting down report all fence as signaled */ 154 /* if we are shuting down report all fence as signaled */
@@ -324,7 +323,7 @@ int radeon_fence_driver_init(struct radeon_device *rdev)
324 write_lock_irqsave(&rdev->fence_drv.lock, irq_flags); 323 write_lock_irqsave(&rdev->fence_drv.lock, irq_flags);
325 r = radeon_scratch_get(rdev, &rdev->fence_drv.scratch_reg); 324 r = radeon_scratch_get(rdev, &rdev->fence_drv.scratch_reg);
326 if (r) { 325 if (r) {
327 DRM_ERROR("Fence failed to get a scratch register."); 326 dev_err(rdev->dev, "fence failed to get scratch register\n");
328 write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); 327 write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags);
329 return r; 328 return r;
330 } 329 }
@@ -335,9 +334,10 @@ int radeon_fence_driver_init(struct radeon_device *rdev)
335 INIT_LIST_HEAD(&rdev->fence_drv.signaled); 334 INIT_LIST_HEAD(&rdev->fence_drv.signaled);
336 rdev->fence_drv.count_timeout = 0; 335 rdev->fence_drv.count_timeout = 0;
337 init_waitqueue_head(&rdev->fence_drv.queue); 336 init_waitqueue_head(&rdev->fence_drv.queue);
337 rdev->fence_drv.initialized = true;
338 write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); 338 write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags);
339 if (radeon_debugfs_fence_init(rdev)) { 339 if (radeon_debugfs_fence_init(rdev)) {
340 DRM_ERROR("Failed to register debugfs file for fence !\n"); 340 dev_err(rdev->dev, "fence debugfs file creation failed\n");
341 } 341 }
342 return 0; 342 return 0;
343} 343}
@@ -346,11 +346,13 @@ void radeon_fence_driver_fini(struct radeon_device *rdev)
346{ 346{
347 unsigned long irq_flags; 347 unsigned long irq_flags;
348 348
349 if (!rdev->fence_drv.initialized)
350 return;
349 wake_up_all(&rdev->fence_drv.queue); 351 wake_up_all(&rdev->fence_drv.queue);
350 write_lock_irqsave(&rdev->fence_drv.lock, irq_flags); 352 write_lock_irqsave(&rdev->fence_drv.lock, irq_flags);
351 radeon_scratch_free(rdev, rdev->fence_drv.scratch_reg); 353 radeon_scratch_free(rdev, rdev->fence_drv.scratch_reg);
352 write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); 354 write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags);
353 DRM_INFO("radeon: fence finalized\n"); 355 rdev->fence_drv.initialized = false;
354} 356}
355 357
356 358
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 60df2d7e7e4c..0e1325e18534 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -131,7 +131,6 @@ int radeon_gem_set_domain(struct drm_gem_object *gobj,
131 printk(KERN_ERR "Failed to wait for object !\n"); 131 printk(KERN_ERR "Failed to wait for object !\n");
132 return r; 132 return r;
133 } 133 }
134 radeon_hdp_flush(robj->rdev);
135 } 134 }
136 return 0; 135 return 0;
137} 136}
@@ -312,7 +311,6 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
312 mutex_lock(&dev->struct_mutex); 311 mutex_lock(&dev->struct_mutex);
313 drm_gem_object_unreference(gobj); 312 drm_gem_object_unreference(gobj);
314 mutex_unlock(&dev->struct_mutex); 313 mutex_unlock(&dev->struct_mutex);
315 radeon_hdp_flush(robj->rdev);
316 return r; 314 return r;
317} 315}
318 316
diff --git a/drivers/gpu/drm/radeon/radeon_ioc32.c b/drivers/gpu/drm/radeon/radeon_ioc32.c
index a1bf11de308a..48b7cea31e08 100644
--- a/drivers/gpu/drm/radeon/radeon_ioc32.c
+++ b/drivers/gpu/drm/radeon/radeon_ioc32.c
@@ -92,8 +92,7 @@ static int compat_radeon_cp_init(struct file *file, unsigned int cmd,
92 &init->gart_textures_offset)) 92 &init->gart_textures_offset))
93 return -EFAULT; 93 return -EFAULT;
94 94
95 return drm_ioctl(file->f_path.dentry->d_inode, file, 95 return drm_ioctl(file, DRM_IOCTL_RADEON_CP_INIT, (unsigned long)init);
96 DRM_IOCTL_RADEON_CP_INIT, (unsigned long)init);
97} 96}
98 97
99typedef struct drm_radeon_clear32 { 98typedef struct drm_radeon_clear32 {
@@ -125,8 +124,7 @@ static int compat_radeon_cp_clear(struct file *file, unsigned int cmd,
125 &clr->depth_boxes)) 124 &clr->depth_boxes))
126 return -EFAULT; 125 return -EFAULT;
127 126
128 return drm_ioctl(file->f_path.dentry->d_inode, file, 127 return drm_ioctl(file, DRM_IOCTL_RADEON_CLEAR, (unsigned long)clr);
129 DRM_IOCTL_RADEON_CLEAR, (unsigned long)clr);
130} 128}
131 129
132typedef struct drm_radeon_stipple32 { 130typedef struct drm_radeon_stipple32 {
@@ -149,8 +147,7 @@ static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd,
149 &request->mask)) 147 &request->mask))
150 return -EFAULT; 148 return -EFAULT;
151 149
152 return drm_ioctl(file->f_path.dentry->d_inode, file, 150 return drm_ioctl(file, DRM_IOCTL_RADEON_STIPPLE, (unsigned long)request);
153 DRM_IOCTL_RADEON_STIPPLE, (unsigned long)request);
154} 151}
155 152
156typedef struct drm_radeon_tex_image32 { 153typedef struct drm_radeon_tex_image32 {
@@ -204,8 +201,7 @@ static int compat_radeon_cp_texture(struct file *file, unsigned int cmd,
204 &image->data)) 201 &image->data))
205 return -EFAULT; 202 return -EFAULT;
206 203
207 return drm_ioctl(file->f_path.dentry->d_inode, file, 204 return drm_ioctl(file, DRM_IOCTL_RADEON_TEXTURE, (unsigned long)request);
208 DRM_IOCTL_RADEON_TEXTURE, (unsigned long)request);
209} 205}
210 206
211typedef struct drm_radeon_vertex2_32 { 207typedef struct drm_radeon_vertex2_32 {
@@ -238,8 +234,7 @@ static int compat_radeon_cp_vertex2(struct file *file, unsigned int cmd,
238 &request->prim)) 234 &request->prim))
239 return -EFAULT; 235 return -EFAULT;
240 236
241 return drm_ioctl(file->f_path.dentry->d_inode, file, 237 return drm_ioctl(file, DRM_IOCTL_RADEON_VERTEX2, (unsigned long)request);
242 DRM_IOCTL_RADEON_VERTEX2, (unsigned long)request);
243} 238}
244 239
245typedef struct drm_radeon_cmd_buffer32 { 240typedef struct drm_radeon_cmd_buffer32 {
@@ -268,8 +263,7 @@ static int compat_radeon_cp_cmdbuf(struct file *file, unsigned int cmd,
268 &request->boxes)) 263 &request->boxes))
269 return -EFAULT; 264 return -EFAULT;
270 265
271 return drm_ioctl(file->f_path.dentry->d_inode, file, 266 return drm_ioctl(file, DRM_IOCTL_RADEON_CMDBUF, (unsigned long)request);
272 DRM_IOCTL_RADEON_CMDBUF, (unsigned long)request);
273} 267}
274 268
275typedef struct drm_radeon_getparam32 { 269typedef struct drm_radeon_getparam32 {
@@ -293,8 +287,7 @@ static int compat_radeon_cp_getparam(struct file *file, unsigned int cmd,
293 &request->value)) 287 &request->value))
294 return -EFAULT; 288 return -EFAULT;
295 289
296 return drm_ioctl(file->f_path.dentry->d_inode, file, 290 return drm_ioctl(file, DRM_IOCTL_RADEON_GETPARAM, (unsigned long)request);
297 DRM_IOCTL_RADEON_GETPARAM, (unsigned long)request);
298} 291}
299 292
300typedef struct drm_radeon_mem_alloc32 { 293typedef struct drm_radeon_mem_alloc32 {
@@ -322,8 +315,7 @@ static int compat_radeon_mem_alloc(struct file *file, unsigned int cmd,
322 &request->region_offset)) 315 &request->region_offset))
323 return -EFAULT; 316 return -EFAULT;
324 317
325 return drm_ioctl(file->f_path.dentry->d_inode, file, 318 return drm_ioctl(file, DRM_IOCTL_RADEON_ALLOC, (unsigned long)request);
326 DRM_IOCTL_RADEON_ALLOC, (unsigned long)request);
327} 319}
328 320
329typedef struct drm_radeon_irq_emit32 { 321typedef struct drm_radeon_irq_emit32 {
@@ -345,8 +337,7 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
345 &request->irq_seq)) 337 &request->irq_seq))
346 return -EFAULT; 338 return -EFAULT;
347 339
348 return drm_ioctl(file->f_path.dentry->d_inode, file, 340 return drm_ioctl(file, DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request);
349 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request);
350} 341}
351 342
352/* The two 64-bit arches where alignof(u64)==4 in 32-bit code */ 343/* The two 64-bit arches where alignof(u64)==4 in 32-bit code */
@@ -372,8 +363,7 @@ static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd,
372 &request->value)) 363 &request->value))
373 return -EFAULT; 364 return -EFAULT;
374 365
375 return drm_ioctl(file->f_dentry->d_inode, file, 366 return drm_ioctl(file, DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
376 DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
377} 367}
378#else 368#else
379#define compat_radeon_cp_setparam NULL 369#define compat_radeon_cp_setparam NULL
@@ -413,12 +403,10 @@ long radeon_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
413 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(radeon_compat_ioctls)) 403 if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(radeon_compat_ioctls))
414 fn = radeon_compat_ioctls[nr - DRM_COMMAND_BASE]; 404 fn = radeon_compat_ioctls[nr - DRM_COMMAND_BASE];
415 405
416 lock_kernel(); /* XXX for now */
417 if (fn != NULL) 406 if (fn != NULL)
418 ret = (*fn) (filp, cmd, arg); 407 ret = (*fn) (filp, cmd, arg);
419 else 408 else
420 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); 409 ret = drm_ioctl(filp, cmd, arg);
421 unlock_kernel();
422 410
423 return ret; 411 return ret;
424} 412}
@@ -431,9 +419,7 @@ long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long
431 if (nr < DRM_COMMAND_BASE) 419 if (nr < DRM_COMMAND_BASE)
432 return drm_compat_ioctl(filp, cmd, arg); 420 return drm_compat_ioctl(filp, cmd, arg);
433 421
434 lock_kernel(); /* XXX for now */ 422 ret = drm_ioctl(filp, cmd, arg);
435 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg);
436 unlock_kernel();
437 423
438 return ret; 424 return ret;
439} 425}
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c
index b79ecc4a7cc4..2f349a300195 100644
--- a/drivers/gpu/drm/radeon/radeon_irq.c
+++ b/drivers/gpu/drm/radeon/radeon_irq.c
@@ -289,16 +289,16 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr
289 drm_radeon_irq_emit_t *emit = data; 289 drm_radeon_irq_emit_t *emit = data;
290 int result; 290 int result;
291 291
292 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
293 return -EINVAL;
294
295 LOCK_TEST_WITH_RETURN(dev, file_priv);
296
297 if (!dev_priv) { 292 if (!dev_priv) {
298 DRM_ERROR("called with no initialization\n"); 293 DRM_ERROR("called with no initialization\n");
299 return -EINVAL; 294 return -EINVAL;
300 } 295 }
301 296
297 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
298 return -EINVAL;
299
300 LOCK_TEST_WITH_RETURN(dev, file_priv);
301
302 result = radeon_emit_irq(dev); 302 result = radeon_emit_irq(dev);
303 303
304 if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { 304 if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 9223296fe37b..3cfd60fd0083 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -97,6 +97,7 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
97 rdev->irq.sw_int = false; 97 rdev->irq.sw_int = false;
98 for (i = 0; i < 2; i++) { 98 for (i = 0; i < 2; i++) {
99 rdev->irq.crtc_vblank_int[i] = false; 99 rdev->irq.crtc_vblank_int[i] = false;
100 rdev->irq.hpd[i] = false;
100 } 101 }
101 radeon_irq_set(rdev); 102 radeon_irq_set(rdev);
102} 103}
@@ -128,17 +129,22 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
128 DRM_INFO("radeon: using MSI.\n"); 129 DRM_INFO("radeon: using MSI.\n");
129 } 130 }
130 } 131 }
131 drm_irq_install(rdev->ddev);
132 rdev->irq.installed = true; 132 rdev->irq.installed = true;
133 r = drm_irq_install(rdev->ddev);
134 if (r) {
135 rdev->irq.installed = false;
136 return r;
137 }
133 DRM_INFO("radeon: irq initialized.\n"); 138 DRM_INFO("radeon: irq initialized.\n");
134 return 0; 139 return 0;
135} 140}
136 141
137void radeon_irq_kms_fini(struct radeon_device *rdev) 142void radeon_irq_kms_fini(struct radeon_device *rdev)
138{ 143{
144 drm_vblank_cleanup(rdev->ddev);
139 if (rdev->irq.installed) { 145 if (rdev->irq.installed) {
140 rdev->irq.installed = false;
141 drm_irq_uninstall(rdev->ddev); 146 drm_irq_uninstall(rdev->ddev);
147 rdev->irq.installed = false;
142 if (rdev->msi_enabled) 148 if (rdev->msi_enabled)
143 pci_disable_msi(rdev->pdev); 149 pci_disable_msi(rdev->pdev);
144 } 150 }
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index b82ede98e152..cc27485a07ad 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -43,8 +43,7 @@ static void radeon_overscan_setup(struct drm_crtc *crtc,
43} 43}
44 44
45static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, 45static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc,
46 struct drm_display_mode *mode, 46 struct drm_display_mode *mode)
47 struct drm_display_mode *adjusted_mode)
48{ 47{
49 struct drm_device *dev = crtc->dev; 48 struct drm_device *dev = crtc->dev;
50 struct radeon_device *rdev = dev->dev_private; 49 struct radeon_device *rdev = dev->dev_private;
@@ -1059,7 +1058,7 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc,
1059 radeon_set_pll(crtc, adjusted_mode); 1058 radeon_set_pll(crtc, adjusted_mode);
1060 radeon_overscan_setup(crtc, adjusted_mode); 1059 radeon_overscan_setup(crtc, adjusted_mode);
1061 if (radeon_crtc->crtc_id == 0) { 1060 if (radeon_crtc->crtc_id == 0) {
1062 radeon_legacy_rmx_mode_set(crtc, mode, adjusted_mode); 1061 radeon_legacy_rmx_mode_set(crtc, adjusted_mode);
1063 } else { 1062 } else {
1064 if (radeon_crtc->rmx_type != RMX_OFF) { 1063 if (radeon_crtc->rmx_type != RMX_OFF) {
1065 /* FIXME: only first crtc has rmx what should we 1064 /* FIXME: only first crtc has rmx what should we
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index df00515e81fa..981508ff7037 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -207,6 +207,8 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
207 *adjusted_mode = *native_mode; 207 *adjusted_mode = *native_mode;
208 adjusted_mode->hdisplay = mode->hdisplay; 208 adjusted_mode->hdisplay = mode->hdisplay;
209 adjusted_mode->vdisplay = mode->vdisplay; 209 adjusted_mode->vdisplay = mode->vdisplay;
210 adjusted_mode->crtc_hdisplay = mode->hdisplay;
211 adjusted_mode->crtc_vdisplay = mode->vdisplay;
210 adjusted_mode->base.id = mode_id; 212 adjusted_mode->base.id = mode_id;
211 } 213 }
212 214
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_tv.c b/drivers/gpu/drm/radeon/radeon_legacy_tv.c
index 3a12bb0c0563..417684daef4c 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_tv.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_tv.c
@@ -77,7 +77,7 @@ struct radeon_tv_mode_constants {
77 unsigned pix_to_tv; 77 unsigned pix_to_tv;
78}; 78};
79 79
80static const uint16_t hor_timing_NTSC[] = { 80static const uint16_t hor_timing_NTSC[MAX_H_CODE_TIMING_LEN] = {
81 0x0007, 81 0x0007,
82 0x003f, 82 0x003f,
83 0x0263, 83 0x0263,
@@ -98,7 +98,7 @@ static const uint16_t hor_timing_NTSC[] = {
98 0 98 0
99}; 99};
100 100
101static const uint16_t vert_timing_NTSC[] = { 101static const uint16_t vert_timing_NTSC[MAX_V_CODE_TIMING_LEN] = {
102 0x2001, 102 0x2001,
103 0x200d, 103 0x200d,
104 0x1006, 104 0x1006,
@@ -115,7 +115,7 @@ static const uint16_t vert_timing_NTSC[] = {
115 0 115 0
116}; 116};
117 117
118static const uint16_t hor_timing_PAL[] = { 118static const uint16_t hor_timing_PAL[MAX_H_CODE_TIMING_LEN] = {
119 0x0007, 119 0x0007,
120 0x0058, 120 0x0058,
121 0x027c, 121 0x027c,
@@ -136,7 +136,7 @@ static const uint16_t hor_timing_PAL[] = {
136 0 136 0
137}; 137};
138 138
139static const uint16_t vert_timing_PAL[] = { 139static const uint16_t vert_timing_PAL[MAX_V_CODE_TIMING_LEN] = {
140 0x2001, 140 0x2001,
141 0x200c, 141 0x200c,
142 0x1005, 142 0x1005,
@@ -623,9 +623,9 @@ void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,
623 } 623 }
624 flicker_removal = (tmp + 500) / 1000; 624 flicker_removal = (tmp + 500) / 1000;
625 625
626 if (flicker_removal < 3) 626 if (flicker_removal < 2)
627 flicker_removal = 3; 627 flicker_removal = 2;
628 for (i = 0; i < 6; ++i) { 628 for (i = 0; i < ARRAY_SIZE(SLOPE_limit); ++i) {
629 if (flicker_removal == SLOPE_limit[i]) 629 if (flicker_removal == SLOPE_limit[i])
630 break; 630 break;
631 } 631 }
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 3dcbe130c422..91cb041cb40d 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -46,32 +46,6 @@ struct radeon_device;
46#define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) 46#define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base)
47#define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) 47#define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base)
48 48
49enum radeon_connector_type {
50 CONNECTOR_NONE,
51 CONNECTOR_VGA,
52 CONNECTOR_DVI_I,
53 CONNECTOR_DVI_D,
54 CONNECTOR_DVI_A,
55 CONNECTOR_STV,
56 CONNECTOR_CTV,
57 CONNECTOR_LVDS,
58 CONNECTOR_DIGITAL,
59 CONNECTOR_SCART,
60 CONNECTOR_HDMI_TYPE_A,
61 CONNECTOR_HDMI_TYPE_B,
62 CONNECTOR_0XC,
63 CONNECTOR_0XD,
64 CONNECTOR_DIN,
65 CONNECTOR_DISPLAY_PORT,
66 CONNECTOR_UNSUPPORTED
67};
68
69enum radeon_dvi_type {
70 DVI_AUTO,
71 DVI_DIGITAL,
72 DVI_ANALOG
73};
74
75enum radeon_rmx_type { 49enum radeon_rmx_type {
76 RMX_OFF, 50 RMX_OFF,
77 RMX_FULL, 51 RMX_FULL,
@@ -88,6 +62,7 @@ enum radeon_tv_std {
88 TV_STD_SCART_PAL, 62 TV_STD_SCART_PAL,
89 TV_STD_SECAM, 63 TV_STD_SECAM,
90 TV_STD_PAL_CN, 64 TV_STD_PAL_CN,
65 TV_STD_PAL_N,
91}; 66};
92 67
93/* radeon gpio-based i2c 68/* radeon gpio-based i2c
@@ -395,6 +370,11 @@ struct radeon_framebuffer {
395 struct drm_gem_object *obj; 370 struct drm_gem_object *obj;
396}; 371};
397 372
373extern enum radeon_tv_std
374radeon_combios_get_tv_info(struct radeon_device *rdev);
375extern enum radeon_tv_std
376radeon_atombios_get_tv_info(struct radeon_device *rdev);
377
398extern void radeon_connector_hotplug(struct drm_connector *connector); 378extern void radeon_connector_hotplug(struct drm_connector *connector);
399extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector); 379extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
400extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector, 380extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector,
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index d9ffe1f56e8f..4e636de877b2 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -221,8 +221,9 @@ int radeon_bo_unpin(struct radeon_bo *bo)
221int radeon_bo_evict_vram(struct radeon_device *rdev) 221int radeon_bo_evict_vram(struct radeon_device *rdev)
222{ 222{
223 if (rdev->flags & RADEON_IS_IGP) { 223 if (rdev->flags & RADEON_IS_IGP) {
224 /* Useless to evict on IGP chips */ 224 if (rdev->mc.igp_sideport_enabled == false)
225 return 0; 225 /* Useless to evict on IGP chips */
226 return 0;
226 } 227 }
227 return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); 228 return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM);
228} 229}
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
index 391c973ec4db..9f5e2f929da9 100644
--- a/drivers/gpu/drm/radeon/radeon_test.c
+++ b/drivers/gpu/drm/radeon/radeon_test.c
@@ -42,8 +42,8 @@ void radeon_test_moves(struct radeon_device *rdev)
42 /* Number of tests = 42 /* Number of tests =
43 * (Total GTT - IB pool - writeback page - ring buffer) / test size 43 * (Total GTT - IB pool - writeback page - ring buffer) / test size
44 */ 44 */
45 n = (rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE - 45 n = ((u32)(rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE -
46 rdev->cp.ring_size) / size; 46 rdev->cp.ring_size)) / size;
47 47
48 gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); 48 gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
49 if (!gtt_obj) { 49 if (!gtt_obj) {
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index d7fd160cc671..3b0c07b444a2 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -494,6 +494,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
494 DRM_ERROR("failed initializing buffer object driver(%d).\n", r); 494 DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
495 return r; 495 return r;
496 } 496 }
497 rdev->mman.initialized = true;
497 r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM, 498 r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM,
498 rdev->mc.real_vram_size >> PAGE_SHIFT); 499 rdev->mc.real_vram_size >> PAGE_SHIFT);
499 if (r) { 500 if (r) {
@@ -541,6 +542,8 @@ void radeon_ttm_fini(struct radeon_device *rdev)
541{ 542{
542 int r; 543 int r;
543 544
545 if (!rdev->mman.initialized)
546 return;
544 if (rdev->stollen_vga_memory) { 547 if (rdev->stollen_vga_memory) {
545 r = radeon_bo_reserve(rdev->stollen_vga_memory, false); 548 r = radeon_bo_reserve(rdev->stollen_vga_memory, false);
546 if (r == 0) { 549 if (r == 0) {
@@ -554,6 +557,7 @@ void radeon_ttm_fini(struct radeon_device *rdev)
554 ttm_bo_device_release(&rdev->mman.bdev); 557 ttm_bo_device_release(&rdev->mman.bdev);
555 radeon_gart_fini(rdev); 558 radeon_gart_fini(rdev);
556 radeon_ttm_global_fini(rdev); 559 radeon_ttm_global_fini(rdev);
560 rdev->mman.initialized = false;
557 DRM_INFO("radeon: ttm finalized\n"); 561 DRM_INFO("radeon: ttm finalized\n");
558} 562}
559 563
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r420 b/drivers/gpu/drm/radeon/reg_srcs/r420
new file mode 100644
index 000000000000..989f7a020832
--- /dev/null
+++ b/drivers/gpu/drm/radeon/reg_srcs/r420
@@ -0,0 +1,795 @@
1r420 0x4f60
20x1434 SRC_Y_X
30x1438 DST_Y_X
40x143C DST_HEIGHT_WIDTH
50x146C DP_GUI_MASTER_CNTL
60x1474 BRUSH_Y_X
70x1478 DP_BRUSH_BKGD_CLR
80x147C DP_BRUSH_FRGD_CLR
90x1480 BRUSH_DATA0
100x1484 BRUSH_DATA1
110x1598 DST_WIDTH_HEIGHT
120x15C0 CLR_CMP_CNTL
130x15C4 CLR_CMP_CLR_SRC
140x15C8 CLR_CMP_CLR_DST
150x15CC CLR_CMP_MSK
160x15D8 DP_SRC_FRGD_CLR
170x15DC DP_SRC_BKGD_CLR
180x1600 DST_LINE_START
190x1604 DST_LINE_END
200x1608 DST_LINE_PATCOUNT
210x16C0 DP_CNTL
220x16CC DP_WRITE_MSK
230x16D0 DP_CNTL_XDIR_YDIR_YMAJOR
240x16E8 DEFAULT_SC_BOTTOM_RIGHT
250x16EC SC_TOP_LEFT
260x16F0 SC_BOTTOM_RIGHT
270x16F4 SRC_SC_BOTTOM_RIGHT
280x1714 DSTCACHE_CTLSTAT
290x1720 WAIT_UNTIL
300x172C RBBM_GUICNTL
310x1D98 VAP_VPORT_XSCALE
320x1D9C VAP_VPORT_XOFFSET
330x1DA0 VAP_VPORT_YSCALE
340x1DA4 VAP_VPORT_YOFFSET
350x1DA8 VAP_VPORT_ZSCALE
360x1DAC VAP_VPORT_ZOFFSET
370x2080 VAP_CNTL
380x2090 VAP_OUT_VTX_FMT_0
390x2094 VAP_OUT_VTX_FMT_1
400x20B0 VAP_VTE_CNTL
410x2138 VAP_VF_MIN_VTX_INDX
420x2140 VAP_CNTL_STATUS
430x2150 VAP_PROG_STREAM_CNTL_0
440x2154 VAP_PROG_STREAM_CNTL_1
450x2158 VAP_PROG_STREAM_CNTL_2
460x215C VAP_PROG_STREAM_CNTL_3
470x2160 VAP_PROG_STREAM_CNTL_4
480x2164 VAP_PROG_STREAM_CNTL_5
490x2168 VAP_PROG_STREAM_CNTL_6
500x216C VAP_PROG_STREAM_CNTL_7
510x2180 VAP_VTX_STATE_CNTL
520x2184 VAP_VSM_VTX_ASSM
530x2188 VAP_VTX_STATE_IND_REG_0
540x218C VAP_VTX_STATE_IND_REG_1
550x2190 VAP_VTX_STATE_IND_REG_2
560x2194 VAP_VTX_STATE_IND_REG_3
570x2198 VAP_VTX_STATE_IND_REG_4
580x219C VAP_VTX_STATE_IND_REG_5
590x21A0 VAP_VTX_STATE_IND_REG_6
600x21A4 VAP_VTX_STATE_IND_REG_7
610x21A8 VAP_VTX_STATE_IND_REG_8
620x21AC VAP_VTX_STATE_IND_REG_9
630x21B0 VAP_VTX_STATE_IND_REG_10
640x21B4 VAP_VTX_STATE_IND_REG_11
650x21B8 VAP_VTX_STATE_IND_REG_12
660x21BC VAP_VTX_STATE_IND_REG_13
670x21C0 VAP_VTX_STATE_IND_REG_14
680x21C4 VAP_VTX_STATE_IND_REG_15
690x21DC VAP_PSC_SGN_NORM_CNTL
700x21E0 VAP_PROG_STREAM_CNTL_EXT_0
710x21E4 VAP_PROG_STREAM_CNTL_EXT_1
720x21E8 VAP_PROG_STREAM_CNTL_EXT_2
730x21EC VAP_PROG_STREAM_CNTL_EXT_3
740x21F0 VAP_PROG_STREAM_CNTL_EXT_4
750x21F4 VAP_PROG_STREAM_CNTL_EXT_5
760x21F8 VAP_PROG_STREAM_CNTL_EXT_6
770x21FC VAP_PROG_STREAM_CNTL_EXT_7
780x2200 VAP_PVS_VECTOR_INDX_REG
790x2204 VAP_PVS_VECTOR_DATA_REG
800x2208 VAP_PVS_VECTOR_DATA_REG_128
810x221C VAP_CLIP_CNTL
820x2220 VAP_GB_VERT_CLIP_ADJ
830x2224 VAP_GB_VERT_DISC_ADJ
840x2228 VAP_GB_HORZ_CLIP_ADJ
850x222C VAP_GB_HORZ_DISC_ADJ
860x2230 VAP_PVS_FLOW_CNTL_ADDRS_0
870x2234 VAP_PVS_FLOW_CNTL_ADDRS_1
880x2238 VAP_PVS_FLOW_CNTL_ADDRS_2
890x223C VAP_PVS_FLOW_CNTL_ADDRS_3
900x2240 VAP_PVS_FLOW_CNTL_ADDRS_4
910x2244 VAP_PVS_FLOW_CNTL_ADDRS_5
920x2248 VAP_PVS_FLOW_CNTL_ADDRS_6
930x224C VAP_PVS_FLOW_CNTL_ADDRS_7
940x2250 VAP_PVS_FLOW_CNTL_ADDRS_8
950x2254 VAP_PVS_FLOW_CNTL_ADDRS_9
960x2258 VAP_PVS_FLOW_CNTL_ADDRS_10
970x225C VAP_PVS_FLOW_CNTL_ADDRS_11
980x2260 VAP_PVS_FLOW_CNTL_ADDRS_12
990x2264 VAP_PVS_FLOW_CNTL_ADDRS_13
1000x2268 VAP_PVS_FLOW_CNTL_ADDRS_14
1010x226C VAP_PVS_FLOW_CNTL_ADDRS_15
1020x2284 VAP_PVS_STATE_FLUSH_REG
1030x2288 VAP_PVS_VTX_TIMEOUT_REG
1040x2290 VAP_PVS_FLOW_CNTL_LOOP_INDEX_0
1050x2294 VAP_PVS_FLOW_CNTL_LOOP_INDEX_1
1060x2298 VAP_PVS_FLOW_CNTL_LOOP_INDEX_2
1070x229C VAP_PVS_FLOW_CNTL_LOOP_INDEX_3
1080x22A0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_4
1090x22A4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_5
1100x22A8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_6
1110x22AC VAP_PVS_FLOW_CNTL_LOOP_INDEX_7
1120x22B0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_8
1130x22B4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_9
1140x22B8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_10
1150x22BC VAP_PVS_FLOW_CNTL_LOOP_INDEX_11
1160x22C0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_12
1170x22C4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_13
1180x22C8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_14
1190x22CC VAP_PVS_FLOW_CNTL_LOOP_INDEX_15
1200x22D0 VAP_PVS_CODE_CNTL_0
1210x22D4 VAP_PVS_CONST_CNTL
1220x22D8 VAP_PVS_CODE_CNTL_1
1230x22DC VAP_PVS_FLOW_CNTL_OPC
1240x342C RB2D_DSTCACHE_CTLSTAT
1250x4000 GB_VAP_RASTER_VTX_FMT_0
1260x4004 GB_VAP_RASTER_VTX_FMT_1
1270x4008 GB_ENABLE
1280x401C GB_SELECT
1290x4020 GB_AA_CONFIG
1300x4024 GB_FIFO_SIZE
1310x4100 TX_INVALTAGS
1320x4200 GA_POINT_S0
1330x4204 GA_POINT_T0
1340x4208 GA_POINT_S1
1350x420C GA_POINT_T1
1360x4214 GA_TRIANGLE_STIPPLE
1370x421C GA_POINT_SIZE
1380x4230 GA_POINT_MINMAX
1390x4234 GA_LINE_CNTL
1400x4238 GA_LINE_STIPPLE_CONFIG
1410x4260 GA_LINE_STIPPLE_VALUE
1420x4264 GA_LINE_S0
1430x4268 GA_LINE_S1
1440x4278 GA_COLOR_CONTROL
1450x427C GA_SOLID_RG
1460x4280 GA_SOLID_BA
1470x4288 GA_POLY_MODE
1480x428C GA_ROUND_MODE
1490x4290 GA_OFFSET
1500x4294 GA_FOG_SCALE
1510x4298 GA_FOG_OFFSET
1520x42A0 SU_TEX_WRAP
1530x42A4 SU_POLY_OFFSET_FRONT_SCALE
1540x42A8 SU_POLY_OFFSET_FRONT_OFFSET
1550x42AC SU_POLY_OFFSET_BACK_SCALE
1560x42B0 SU_POLY_OFFSET_BACK_OFFSET
1570x42B4 SU_POLY_OFFSET_ENABLE
1580x42B8 SU_CULL_MODE
1590x42C0 SU_DEPTH_SCALE
1600x42C4 SU_DEPTH_OFFSET
1610x42C8 SU_REG_DEST
1620x4300 RS_COUNT
1630x4304 RS_INST_COUNT
1640x4310 RS_IP_0
1650x4314 RS_IP_1
1660x4318 RS_IP_2
1670x431C RS_IP_3
1680x4320 RS_IP_4
1690x4324 RS_IP_5
1700x4328 RS_IP_6
1710x432C RS_IP_7
1720x4330 RS_INST_0
1730x4334 RS_INST_1
1740x4338 RS_INST_2
1750x433C RS_INST_3
1760x4340 RS_INST_4
1770x4344 RS_INST_5
1780x4348 RS_INST_6
1790x434C RS_INST_7
1800x4350 RS_INST_8
1810x4354 RS_INST_9
1820x4358 RS_INST_10
1830x435C RS_INST_11
1840x4360 RS_INST_12
1850x4364 RS_INST_13
1860x4368 RS_INST_14
1870x436C RS_INST_15
1880x43A4 SC_HYPERZ_EN
1890x43A8 SC_EDGERULE
1900x43B0 SC_CLIP_0_A
1910x43B4 SC_CLIP_0_B
1920x43B8 SC_CLIP_1_A
1930x43BC SC_CLIP_1_B
1940x43C0 SC_CLIP_2_A
1950x43C4 SC_CLIP_2_B
1960x43C8 SC_CLIP_3_A
1970x43CC SC_CLIP_3_B
1980x43D0 SC_CLIP_RULE
1990x43E0 SC_SCISSOR0
2000x43E8 SC_SCREENDOOR
2010x4440 TX_FILTER1_0
2020x4444 TX_FILTER1_1
2030x4448 TX_FILTER1_2
2040x444C TX_FILTER1_3
2050x4450 TX_FILTER1_4
2060x4454 TX_FILTER1_5
2070x4458 TX_FILTER1_6
2080x445C TX_FILTER1_7
2090x4460 TX_FILTER1_8
2100x4464 TX_FILTER1_9
2110x4468 TX_FILTER1_10
2120x446C TX_FILTER1_11
2130x4470 TX_FILTER1_12
2140x4474 TX_FILTER1_13
2150x4478 TX_FILTER1_14
2160x447C TX_FILTER1_15
2170x4580 TX_CHROMA_KEY_0
2180x4584 TX_CHROMA_KEY_1
2190x4588 TX_CHROMA_KEY_2
2200x458C TX_CHROMA_KEY_3
2210x4590 TX_CHROMA_KEY_4
2220x4594 TX_CHROMA_KEY_5
2230x4598 TX_CHROMA_KEY_6
2240x459C TX_CHROMA_KEY_7
2250x45A0 TX_CHROMA_KEY_8
2260x45A4 TX_CHROMA_KEY_9
2270x45A8 TX_CHROMA_KEY_10
2280x45AC TX_CHROMA_KEY_11
2290x45B0 TX_CHROMA_KEY_12
2300x45B4 TX_CHROMA_KEY_13
2310x45B8 TX_CHROMA_KEY_14
2320x45BC TX_CHROMA_KEY_15
2330x45C0 TX_BORDER_COLOR_0
2340x45C4 TX_BORDER_COLOR_1
2350x45C8 TX_BORDER_COLOR_2
2360x45CC TX_BORDER_COLOR_3
2370x45D0 TX_BORDER_COLOR_4
2380x45D4 TX_BORDER_COLOR_5
2390x45D8 TX_BORDER_COLOR_6
2400x45DC TX_BORDER_COLOR_7
2410x45E0 TX_BORDER_COLOR_8
2420x45E4 TX_BORDER_COLOR_9
2430x45E8 TX_BORDER_COLOR_10
2440x45EC TX_BORDER_COLOR_11
2450x45F0 TX_BORDER_COLOR_12
2460x45F4 TX_BORDER_COLOR_13
2470x45F8 TX_BORDER_COLOR_14
2480x45FC TX_BORDER_COLOR_15
2490x4600 US_CONFIG
2500x4604 US_PIXSIZE
2510x4608 US_CODE_OFFSET
2520x460C US_RESET
2530x4610 US_CODE_ADDR_0
2540x4614 US_CODE_ADDR_1
2550x4618 US_CODE_ADDR_2
2560x461C US_CODE_ADDR_3
2570x4620 US_TEX_INST_0
2580x4624 US_TEX_INST_1
2590x4628 US_TEX_INST_2
2600x462C US_TEX_INST_3
2610x4630 US_TEX_INST_4
2620x4634 US_TEX_INST_5
2630x4638 US_TEX_INST_6
2640x463C US_TEX_INST_7
2650x4640 US_TEX_INST_8
2660x4644 US_TEX_INST_9
2670x4648 US_TEX_INST_10
2680x464C US_TEX_INST_11
2690x4650 US_TEX_INST_12
2700x4654 US_TEX_INST_13
2710x4658 US_TEX_INST_14
2720x465C US_TEX_INST_15
2730x4660 US_TEX_INST_16
2740x4664 US_TEX_INST_17
2750x4668 US_TEX_INST_18
2760x466C US_TEX_INST_19
2770x4670 US_TEX_INST_20
2780x4674 US_TEX_INST_21
2790x4678 US_TEX_INST_22
2800x467C US_TEX_INST_23
2810x4680 US_TEX_INST_24
2820x4684 US_TEX_INST_25
2830x4688 US_TEX_INST_26
2840x468C US_TEX_INST_27
2850x4690 US_TEX_INST_28
2860x4694 US_TEX_INST_29
2870x4698 US_TEX_INST_30
2880x469C US_TEX_INST_31
2890x46A4 US_OUT_FMT_0
2900x46A8 US_OUT_FMT_1
2910x46AC US_OUT_FMT_2
2920x46B0 US_OUT_FMT_3
2930x46B4 US_W_FMT
2940x46B8 US_CODE_BANK
2950x46BC US_CODE_EXT
2960x46C0 US_ALU_RGB_ADDR_0
2970x46C4 US_ALU_RGB_ADDR_1
2980x46C8 US_ALU_RGB_ADDR_2
2990x46CC US_ALU_RGB_ADDR_3
3000x46D0 US_ALU_RGB_ADDR_4
3010x46D4 US_ALU_RGB_ADDR_5
3020x46D8 US_ALU_RGB_ADDR_6
3030x46DC US_ALU_RGB_ADDR_7
3040x46E0 US_ALU_RGB_ADDR_8
3050x46E4 US_ALU_RGB_ADDR_9
3060x46E8 US_ALU_RGB_ADDR_10
3070x46EC US_ALU_RGB_ADDR_11
3080x46F0 US_ALU_RGB_ADDR_12
3090x46F4 US_ALU_RGB_ADDR_13
3100x46F8 US_ALU_RGB_ADDR_14
3110x46FC US_ALU_RGB_ADDR_15
3120x4700 US_ALU_RGB_ADDR_16
3130x4704 US_ALU_RGB_ADDR_17
3140x4708 US_ALU_RGB_ADDR_18
3150x470C US_ALU_RGB_ADDR_19
3160x4710 US_ALU_RGB_ADDR_20
3170x4714 US_ALU_RGB_ADDR_21
3180x4718 US_ALU_RGB_ADDR_22
3190x471C US_ALU_RGB_ADDR_23
3200x4720 US_ALU_RGB_ADDR_24
3210x4724 US_ALU_RGB_ADDR_25
3220x4728 US_ALU_RGB_ADDR_26
3230x472C US_ALU_RGB_ADDR_27
3240x4730 US_ALU_RGB_ADDR_28
3250x4734 US_ALU_RGB_ADDR_29
3260x4738 US_ALU_RGB_ADDR_30
3270x473C US_ALU_RGB_ADDR_31
3280x4740 US_ALU_RGB_ADDR_32
3290x4744 US_ALU_RGB_ADDR_33
3300x4748 US_ALU_RGB_ADDR_34
3310x474C US_ALU_RGB_ADDR_35
3320x4750 US_ALU_RGB_ADDR_36
3330x4754 US_ALU_RGB_ADDR_37
3340x4758 US_ALU_RGB_ADDR_38
3350x475C US_ALU_RGB_ADDR_39
3360x4760 US_ALU_RGB_ADDR_40
3370x4764 US_ALU_RGB_ADDR_41
3380x4768 US_ALU_RGB_ADDR_42
3390x476C US_ALU_RGB_ADDR_43
3400x4770 US_ALU_RGB_ADDR_44
3410x4774 US_ALU_RGB_ADDR_45
3420x4778 US_ALU_RGB_ADDR_46
3430x477C US_ALU_RGB_ADDR_47
3440x4780 US_ALU_RGB_ADDR_48
3450x4784 US_ALU_RGB_ADDR_49
3460x4788 US_ALU_RGB_ADDR_50
3470x478C US_ALU_RGB_ADDR_51
3480x4790 US_ALU_RGB_ADDR_52
3490x4794 US_ALU_RGB_ADDR_53
3500x4798 US_ALU_RGB_ADDR_54
3510x479C US_ALU_RGB_ADDR_55
3520x47A0 US_ALU_RGB_ADDR_56
3530x47A4 US_ALU_RGB_ADDR_57
3540x47A8 US_ALU_RGB_ADDR_58
3550x47AC US_ALU_RGB_ADDR_59
3560x47B0 US_ALU_RGB_ADDR_60
3570x47B4 US_ALU_RGB_ADDR_61
3580x47B8 US_ALU_RGB_ADDR_62
3590x47BC US_ALU_RGB_ADDR_63
3600x47C0 US_ALU_ALPHA_ADDR_0
3610x47C4 US_ALU_ALPHA_ADDR_1
3620x47C8 US_ALU_ALPHA_ADDR_2
3630x47CC US_ALU_ALPHA_ADDR_3
3640x47D0 US_ALU_ALPHA_ADDR_4
3650x47D4 US_ALU_ALPHA_ADDR_5
3660x47D8 US_ALU_ALPHA_ADDR_6
3670x47DC US_ALU_ALPHA_ADDR_7
3680x47E0 US_ALU_ALPHA_ADDR_8
3690x47E4 US_ALU_ALPHA_ADDR_9
3700x47E8 US_ALU_ALPHA_ADDR_10
3710x47EC US_ALU_ALPHA_ADDR_11
3720x47F0 US_ALU_ALPHA_ADDR_12
3730x47F4 US_ALU_ALPHA_ADDR_13
3740x47F8 US_ALU_ALPHA_ADDR_14
3750x47FC US_ALU_ALPHA_ADDR_15
3760x4800 US_ALU_ALPHA_ADDR_16
3770x4804 US_ALU_ALPHA_ADDR_17
3780x4808 US_ALU_ALPHA_ADDR_18
3790x480C US_ALU_ALPHA_ADDR_19
3800x4810 US_ALU_ALPHA_ADDR_20
3810x4814 US_ALU_ALPHA_ADDR_21
3820x4818 US_ALU_ALPHA_ADDR_22
3830x481C US_ALU_ALPHA_ADDR_23
3840x4820 US_ALU_ALPHA_ADDR_24
3850x4824 US_ALU_ALPHA_ADDR_25
3860x4828 US_ALU_ALPHA_ADDR_26
3870x482C US_ALU_ALPHA_ADDR_27
3880x4830 US_ALU_ALPHA_ADDR_28
3890x4834 US_ALU_ALPHA_ADDR_29
3900x4838 US_ALU_ALPHA_ADDR_30
3910x483C US_ALU_ALPHA_ADDR_31
3920x4840 US_ALU_ALPHA_ADDR_32
3930x4844 US_ALU_ALPHA_ADDR_33
3940x4848 US_ALU_ALPHA_ADDR_34
3950x484C US_ALU_ALPHA_ADDR_35
3960x4850 US_ALU_ALPHA_ADDR_36
3970x4854 US_ALU_ALPHA_ADDR_37
3980x4858 US_ALU_ALPHA_ADDR_38
3990x485C US_ALU_ALPHA_ADDR_39
4000x4860 US_ALU_ALPHA_ADDR_40
4010x4864 US_ALU_ALPHA_ADDR_41
4020x4868 US_ALU_ALPHA_ADDR_42
4030x486C US_ALU_ALPHA_ADDR_43
4040x4870 US_ALU_ALPHA_ADDR_44
4050x4874 US_ALU_ALPHA_ADDR_45
4060x4878 US_ALU_ALPHA_ADDR_46
4070x487C US_ALU_ALPHA_ADDR_47
4080x4880 US_ALU_ALPHA_ADDR_48
4090x4884 US_ALU_ALPHA_ADDR_49
4100x4888 US_ALU_ALPHA_ADDR_50
4110x488C US_ALU_ALPHA_ADDR_51
4120x4890 US_ALU_ALPHA_ADDR_52
4130x4894 US_ALU_ALPHA_ADDR_53
4140x4898 US_ALU_ALPHA_ADDR_54
4150x489C US_ALU_ALPHA_ADDR_55
4160x48A0 US_ALU_ALPHA_ADDR_56
4170x48A4 US_ALU_ALPHA_ADDR_57
4180x48A8 US_ALU_ALPHA_ADDR_58
4190x48AC US_ALU_ALPHA_ADDR_59
4200x48B0 US_ALU_ALPHA_ADDR_60
4210x48B4 US_ALU_ALPHA_ADDR_61
4220x48B8 US_ALU_ALPHA_ADDR_62
4230x48BC US_ALU_ALPHA_ADDR_63
4240x48C0 US_ALU_RGB_INST_0
4250x48C4 US_ALU_RGB_INST_1
4260x48C8 US_ALU_RGB_INST_2
4270x48CC US_ALU_RGB_INST_3
4280x48D0 US_ALU_RGB_INST_4
4290x48D4 US_ALU_RGB_INST_5
4300x48D8 US_ALU_RGB_INST_6
4310x48DC US_ALU_RGB_INST_7
4320x48E0 US_ALU_RGB_INST_8
4330x48E4 US_ALU_RGB_INST_9
4340x48E8 US_ALU_RGB_INST_10
4350x48EC US_ALU_RGB_INST_11
4360x48F0 US_ALU_RGB_INST_12
4370x48F4 US_ALU_RGB_INST_13
4380x48F8 US_ALU_RGB_INST_14
4390x48FC US_ALU_RGB_INST_15
4400x4900 US_ALU_RGB_INST_16
4410x4904 US_ALU_RGB_INST_17
4420x4908 US_ALU_RGB_INST_18
4430x490C US_ALU_RGB_INST_19
4440x4910 US_ALU_RGB_INST_20
4450x4914 US_ALU_RGB_INST_21
4460x4918 US_ALU_RGB_INST_22
4470x491C US_ALU_RGB_INST_23
4480x4920 US_ALU_RGB_INST_24
4490x4924 US_ALU_RGB_INST_25
4500x4928 US_ALU_RGB_INST_26
4510x492C US_ALU_RGB_INST_27
4520x4930 US_ALU_RGB_INST_28
4530x4934 US_ALU_RGB_INST_29
4540x4938 US_ALU_RGB_INST_30
4550x493C US_ALU_RGB_INST_31
4560x4940 US_ALU_RGB_INST_32
4570x4944 US_ALU_RGB_INST_33
4580x4948 US_ALU_RGB_INST_34
4590x494C US_ALU_RGB_INST_35
4600x4950 US_ALU_RGB_INST_36
4610x4954 US_ALU_RGB_INST_37
4620x4958 US_ALU_RGB_INST_38
4630x495C US_ALU_RGB_INST_39
4640x4960 US_ALU_RGB_INST_40
4650x4964 US_ALU_RGB_INST_41
4660x4968 US_ALU_RGB_INST_42
4670x496C US_ALU_RGB_INST_43
4680x4970 US_ALU_RGB_INST_44
4690x4974 US_ALU_RGB_INST_45
4700x4978 US_ALU_RGB_INST_46
4710x497C US_ALU_RGB_INST_47
4720x4980 US_ALU_RGB_INST_48
4730x4984 US_ALU_RGB_INST_49
4740x4988 US_ALU_RGB_INST_50
4750x498C US_ALU_RGB_INST_51
4760x4990 US_ALU_RGB_INST_52
4770x4994 US_ALU_RGB_INST_53
4780x4998 US_ALU_RGB_INST_54
4790x499C US_ALU_RGB_INST_55
4800x49A0 US_ALU_RGB_INST_56
4810x49A4 US_ALU_RGB_INST_57
4820x49A8 US_ALU_RGB_INST_58
4830x49AC US_ALU_RGB_INST_59
4840x49B0 US_ALU_RGB_INST_60
4850x49B4 US_ALU_RGB_INST_61
4860x49B8 US_ALU_RGB_INST_62
4870x49BC US_ALU_RGB_INST_63
4880x49C0 US_ALU_ALPHA_INST_0
4890x49C4 US_ALU_ALPHA_INST_1
4900x49C8 US_ALU_ALPHA_INST_2
4910x49CC US_ALU_ALPHA_INST_3
4920x49D0 US_ALU_ALPHA_INST_4
4930x49D4 US_ALU_ALPHA_INST_5
4940x49D8 US_ALU_ALPHA_INST_6
4950x49DC US_ALU_ALPHA_INST_7
4960x49E0 US_ALU_ALPHA_INST_8
4970x49E4 US_ALU_ALPHA_INST_9
4980x49E8 US_ALU_ALPHA_INST_10
4990x49EC US_ALU_ALPHA_INST_11
5000x49F0 US_ALU_ALPHA_INST_12
5010x49F4 US_ALU_ALPHA_INST_13
5020x49F8 US_ALU_ALPHA_INST_14
5030x49FC US_ALU_ALPHA_INST_15
5040x4A00 US_ALU_ALPHA_INST_16
5050x4A04 US_ALU_ALPHA_INST_17
5060x4A08 US_ALU_ALPHA_INST_18
5070x4A0C US_ALU_ALPHA_INST_19
5080x4A10 US_ALU_ALPHA_INST_20
5090x4A14 US_ALU_ALPHA_INST_21
5100x4A18 US_ALU_ALPHA_INST_22
5110x4A1C US_ALU_ALPHA_INST_23
5120x4A20 US_ALU_ALPHA_INST_24
5130x4A24 US_ALU_ALPHA_INST_25
5140x4A28 US_ALU_ALPHA_INST_26
5150x4A2C US_ALU_ALPHA_INST_27
5160x4A30 US_ALU_ALPHA_INST_28
5170x4A34 US_ALU_ALPHA_INST_29
5180x4A38 US_ALU_ALPHA_INST_30
5190x4A3C US_ALU_ALPHA_INST_31
5200x4A40 US_ALU_ALPHA_INST_32
5210x4A44 US_ALU_ALPHA_INST_33
5220x4A48 US_ALU_ALPHA_INST_34
5230x4A4C US_ALU_ALPHA_INST_35
5240x4A50 US_ALU_ALPHA_INST_36
5250x4A54 US_ALU_ALPHA_INST_37
5260x4A58 US_ALU_ALPHA_INST_38
5270x4A5C US_ALU_ALPHA_INST_39
5280x4A60 US_ALU_ALPHA_INST_40
5290x4A64 US_ALU_ALPHA_INST_41
5300x4A68 US_ALU_ALPHA_INST_42
5310x4A6C US_ALU_ALPHA_INST_43
5320x4A70 US_ALU_ALPHA_INST_44
5330x4A74 US_ALU_ALPHA_INST_45
5340x4A78 US_ALU_ALPHA_INST_46
5350x4A7C US_ALU_ALPHA_INST_47
5360x4A80 US_ALU_ALPHA_INST_48
5370x4A84 US_ALU_ALPHA_INST_49
5380x4A88 US_ALU_ALPHA_INST_50
5390x4A8C US_ALU_ALPHA_INST_51
5400x4A90 US_ALU_ALPHA_INST_52
5410x4A94 US_ALU_ALPHA_INST_53
5420x4A98 US_ALU_ALPHA_INST_54
5430x4A9C US_ALU_ALPHA_INST_55
5440x4AA0 US_ALU_ALPHA_INST_56
5450x4AA4 US_ALU_ALPHA_INST_57
5460x4AA8 US_ALU_ALPHA_INST_58
5470x4AAC US_ALU_ALPHA_INST_59
5480x4AB0 US_ALU_ALPHA_INST_60
5490x4AB4 US_ALU_ALPHA_INST_61
5500x4AB8 US_ALU_ALPHA_INST_62
5510x4ABC US_ALU_ALPHA_INST_63
5520x4AC0 US_ALU_EXT_ADDR_0
5530x4AC4 US_ALU_EXT_ADDR_1
5540x4AC8 US_ALU_EXT_ADDR_2
5550x4ACC US_ALU_EXT_ADDR_3
5560x4AD0 US_ALU_EXT_ADDR_4
5570x4AD4 US_ALU_EXT_ADDR_5
5580x4AD8 US_ALU_EXT_ADDR_6
5590x4ADC US_ALU_EXT_ADDR_7
5600x4AE0 US_ALU_EXT_ADDR_8
5610x4AE4 US_ALU_EXT_ADDR_9
5620x4AE8 US_ALU_EXT_ADDR_10
5630x4AEC US_ALU_EXT_ADDR_11
5640x4AF0 US_ALU_EXT_ADDR_12
5650x4AF4 US_ALU_EXT_ADDR_13
5660x4AF8 US_ALU_EXT_ADDR_14
5670x4AFC US_ALU_EXT_ADDR_15
5680x4B00 US_ALU_EXT_ADDR_16
5690x4B04 US_ALU_EXT_ADDR_17
5700x4B08 US_ALU_EXT_ADDR_18
5710x4B0C US_ALU_EXT_ADDR_19
5720x4B10 US_ALU_EXT_ADDR_20
5730x4B14 US_ALU_EXT_ADDR_21
5740x4B18 US_ALU_EXT_ADDR_22
5750x4B1C US_ALU_EXT_ADDR_23
5760x4B20 US_ALU_EXT_ADDR_24
5770x4B24 US_ALU_EXT_ADDR_25
5780x4B28 US_ALU_EXT_ADDR_26
5790x4B2C US_ALU_EXT_ADDR_27
5800x4B30 US_ALU_EXT_ADDR_28
5810x4B34 US_ALU_EXT_ADDR_29
5820x4B38 US_ALU_EXT_ADDR_30
5830x4B3C US_ALU_EXT_ADDR_31
5840x4B40 US_ALU_EXT_ADDR_32
5850x4B44 US_ALU_EXT_ADDR_33
5860x4B48 US_ALU_EXT_ADDR_34
5870x4B4C US_ALU_EXT_ADDR_35
5880x4B50 US_ALU_EXT_ADDR_36
5890x4B54 US_ALU_EXT_ADDR_37
5900x4B58 US_ALU_EXT_ADDR_38
5910x4B5C US_ALU_EXT_ADDR_39
5920x4B60 US_ALU_EXT_ADDR_40
5930x4B64 US_ALU_EXT_ADDR_41
5940x4B68 US_ALU_EXT_ADDR_42
5950x4B6C US_ALU_EXT_ADDR_43
5960x4B70 US_ALU_EXT_ADDR_44
5970x4B74 US_ALU_EXT_ADDR_45
5980x4B78 US_ALU_EXT_ADDR_46
5990x4B7C US_ALU_EXT_ADDR_47
6000x4B80 US_ALU_EXT_ADDR_48
6010x4B84 US_ALU_EXT_ADDR_49
6020x4B88 US_ALU_EXT_ADDR_50
6030x4B8C US_ALU_EXT_ADDR_51
6040x4B90 US_ALU_EXT_ADDR_52
6050x4B94 US_ALU_EXT_ADDR_53
6060x4B98 US_ALU_EXT_ADDR_54
6070x4B9C US_ALU_EXT_ADDR_55
6080x4BA0 US_ALU_EXT_ADDR_56
6090x4BA4 US_ALU_EXT_ADDR_57
6100x4BA8 US_ALU_EXT_ADDR_58
6110x4BAC US_ALU_EXT_ADDR_59
6120x4BB0 US_ALU_EXT_ADDR_60
6130x4BB4 US_ALU_EXT_ADDR_61
6140x4BB8 US_ALU_EXT_ADDR_62
6150x4BBC US_ALU_EXT_ADDR_63
6160x4BC0 FG_FOG_BLEND
6170x4BC4 FG_FOG_FACTOR
6180x4BC8 FG_FOG_COLOR_R
6190x4BCC FG_FOG_COLOR_G
6200x4BD0 FG_FOG_COLOR_B
6210x4BD4 FG_ALPHA_FUNC
6220x4BD8 FG_DEPTH_SRC
6230x4C00 US_ALU_CONST_R_0
6240x4C04 US_ALU_CONST_G_0
6250x4C08 US_ALU_CONST_B_0
6260x4C0C US_ALU_CONST_A_0
6270x4C10 US_ALU_CONST_R_1
6280x4C14 US_ALU_CONST_G_1
6290x4C18 US_ALU_CONST_B_1
6300x4C1C US_ALU_CONST_A_1
6310x4C20 US_ALU_CONST_R_2
6320x4C24 US_ALU_CONST_G_2
6330x4C28 US_ALU_CONST_B_2
6340x4C2C US_ALU_CONST_A_2
6350x4C30 US_ALU_CONST_R_3
6360x4C34 US_ALU_CONST_G_3
6370x4C38 US_ALU_CONST_B_3
6380x4C3C US_ALU_CONST_A_3
6390x4C40 US_ALU_CONST_R_4
6400x4C44 US_ALU_CONST_G_4
6410x4C48 US_ALU_CONST_B_4
6420x4C4C US_ALU_CONST_A_4
6430x4C50 US_ALU_CONST_R_5
6440x4C54 US_ALU_CONST_G_5
6450x4C58 US_ALU_CONST_B_5
6460x4C5C US_ALU_CONST_A_5
6470x4C60 US_ALU_CONST_R_6
6480x4C64 US_ALU_CONST_G_6
6490x4C68 US_ALU_CONST_B_6
6500x4C6C US_ALU_CONST_A_6
6510x4C70 US_ALU_CONST_R_7
6520x4C74 US_ALU_CONST_G_7
6530x4C78 US_ALU_CONST_B_7
6540x4C7C US_ALU_CONST_A_7
6550x4C80 US_ALU_CONST_R_8
6560x4C84 US_ALU_CONST_G_8
6570x4C88 US_ALU_CONST_B_8
6580x4C8C US_ALU_CONST_A_8
6590x4C90 US_ALU_CONST_R_9
6600x4C94 US_ALU_CONST_G_9
6610x4C98 US_ALU_CONST_B_9
6620x4C9C US_ALU_CONST_A_9
6630x4CA0 US_ALU_CONST_R_10
6640x4CA4 US_ALU_CONST_G_10
6650x4CA8 US_ALU_CONST_B_10
6660x4CAC US_ALU_CONST_A_10
6670x4CB0 US_ALU_CONST_R_11
6680x4CB4 US_ALU_CONST_G_11
6690x4CB8 US_ALU_CONST_B_11
6700x4CBC US_ALU_CONST_A_11
6710x4CC0 US_ALU_CONST_R_12
6720x4CC4 US_ALU_CONST_G_12
6730x4CC8 US_ALU_CONST_B_12
6740x4CCC US_ALU_CONST_A_12
6750x4CD0 US_ALU_CONST_R_13
6760x4CD4 US_ALU_CONST_G_13
6770x4CD8 US_ALU_CONST_B_13
6780x4CDC US_ALU_CONST_A_13
6790x4CE0 US_ALU_CONST_R_14
6800x4CE4 US_ALU_CONST_G_14
6810x4CE8 US_ALU_CONST_B_14
6820x4CEC US_ALU_CONST_A_14
6830x4CF0 US_ALU_CONST_R_15
6840x4CF4 US_ALU_CONST_G_15
6850x4CF8 US_ALU_CONST_B_15
6860x4CFC US_ALU_CONST_A_15
6870x4D00 US_ALU_CONST_R_16
6880x4D04 US_ALU_CONST_G_16
6890x4D08 US_ALU_CONST_B_16
6900x4D0C US_ALU_CONST_A_16
6910x4D10 US_ALU_CONST_R_17
6920x4D14 US_ALU_CONST_G_17
6930x4D18 US_ALU_CONST_B_17
6940x4D1C US_ALU_CONST_A_17
6950x4D20 US_ALU_CONST_R_18
6960x4D24 US_ALU_CONST_G_18
6970x4D28 US_ALU_CONST_B_18
6980x4D2C US_ALU_CONST_A_18
6990x4D30 US_ALU_CONST_R_19
7000x4D34 US_ALU_CONST_G_19
7010x4D38 US_ALU_CONST_B_19
7020x4D3C US_ALU_CONST_A_19
7030x4D40 US_ALU_CONST_R_20
7040x4D44 US_ALU_CONST_G_20
7050x4D48 US_ALU_CONST_B_20
7060x4D4C US_ALU_CONST_A_20
7070x4D50 US_ALU_CONST_R_21
7080x4D54 US_ALU_CONST_G_21
7090x4D58 US_ALU_CONST_B_21
7100x4D5C US_ALU_CONST_A_21
7110x4D60 US_ALU_CONST_R_22
7120x4D64 US_ALU_CONST_G_22
7130x4D68 US_ALU_CONST_B_22
7140x4D6C US_ALU_CONST_A_22
7150x4D70 US_ALU_CONST_R_23
7160x4D74 US_ALU_CONST_G_23
7170x4D78 US_ALU_CONST_B_23
7180x4D7C US_ALU_CONST_A_23
7190x4D80 US_ALU_CONST_R_24
7200x4D84 US_ALU_CONST_G_24
7210x4D88 US_ALU_CONST_B_24
7220x4D8C US_ALU_CONST_A_24
7230x4D90 US_ALU_CONST_R_25
7240x4D94 US_ALU_CONST_G_25
7250x4D98 US_ALU_CONST_B_25
7260x4D9C US_ALU_CONST_A_25
7270x4DA0 US_ALU_CONST_R_26
7280x4DA4 US_ALU_CONST_G_26
7290x4DA8 US_ALU_CONST_B_26
7300x4DAC US_ALU_CONST_A_26
7310x4DB0 US_ALU_CONST_R_27
7320x4DB4 US_ALU_CONST_G_27
7330x4DB8 US_ALU_CONST_B_27
7340x4DBC US_ALU_CONST_A_27
7350x4DC0 US_ALU_CONST_R_28
7360x4DC4 US_ALU_CONST_G_28
7370x4DC8 US_ALU_CONST_B_28
7380x4DCC US_ALU_CONST_A_28
7390x4DD0 US_ALU_CONST_R_29
7400x4DD4 US_ALU_CONST_G_29
7410x4DD8 US_ALU_CONST_B_29
7420x4DDC US_ALU_CONST_A_29
7430x4DE0 US_ALU_CONST_R_30
7440x4DE4 US_ALU_CONST_G_30
7450x4DE8 US_ALU_CONST_B_30
7460x4DEC US_ALU_CONST_A_30
7470x4DF0 US_ALU_CONST_R_31
7480x4DF4 US_ALU_CONST_G_31
7490x4DF8 US_ALU_CONST_B_31
7500x4DFC US_ALU_CONST_A_31
7510x4E04 RB3D_BLENDCNTL_R3
7520x4E08 RB3D_ABLENDCNTL_R3
7530x4E0C RB3D_COLOR_CHANNEL_MASK
7540x4E10 RB3D_CONSTANT_COLOR
7550x4E14 RB3D_COLOR_CLEAR_VALUE
7560x4E18 RB3D_ROPCNTL_R3
7570x4E1C RB3D_CLRCMP_FLIPE_R3
7580x4E20 RB3D_CLRCMP_CLR_R3
7590x4E24 RB3D_CLRCMP_MSK_R3
7600x4E48 RB3D_DEBUG_CTL
7610x4E4C RB3D_DSTCACHE_CTLSTAT_R3
7620x4E50 RB3D_DITHER_CTL
7630x4E54 RB3D_CMASK_OFFSET0
7640x4E58 RB3D_CMASK_OFFSET1
7650x4E5C RB3D_CMASK_OFFSET2
7660x4E60 RB3D_CMASK_OFFSET3
7670x4E64 RB3D_CMASK_PITCH0
7680x4E68 RB3D_CMASK_PITCH1
7690x4E6C RB3D_CMASK_PITCH2
7700x4E70 RB3D_CMASK_PITCH3
7710x4E74 RB3D_CMASK_WRINDEX
7720x4E78 RB3D_CMASK_DWORD
7730x4E7C RB3D_CMASK_RDINDEX
7740x4E80 RB3D_AARESOLVE_OFFSET
7750x4E84 RB3D_AARESOLVE_PITCH
7760x4E88 RB3D_AARESOLVE_CTL
7770x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD
7780x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD
7790x4F04 ZB_ZSTENCILCNTL
7800x4F08 ZB_STENCILREFMASK
7810x4F14 ZB_ZTOP
7820x4F18 ZB_ZCACHE_CTLSTAT
7830x4F1C ZB_BW_CNTL
7840x4F28 ZB_DEPTHCLEARVALUE
7850x4F30 ZB_ZMASK_OFFSET
7860x4F34 ZB_ZMASK_PITCH
7870x4F38 ZB_ZMASK_WRINDEX
7880x4F3C ZB_ZMASK_DWORD
7890x4F40 ZB_ZMASK_RDINDEX
7900x4F44 ZB_HIZ_OFFSET
7910x4F48 ZB_HIZ_WRINDEX
7920x4F4C ZB_HIZ_DWORD
7930x4F50 ZB_HIZ_RDINDEX
7940x4F54 ZB_HIZ_PITCH
7950x4F58 ZB_ZPASS_DATA
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rs600 b/drivers/gpu/drm/radeon/reg_srcs/rs600
index 8e3c0b807add..6801b865d1c4 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/rs600
+++ b/drivers/gpu/drm/radeon/reg_srcs/rs600
@@ -153,7 +153,7 @@ rs600 0x6d40
1530x42A4 SU_POLY_OFFSET_FRONT_SCALE 1530x42A4 SU_POLY_OFFSET_FRONT_SCALE
1540x42A8 SU_POLY_OFFSET_FRONT_OFFSET 1540x42A8 SU_POLY_OFFSET_FRONT_OFFSET
1550x42AC SU_POLY_OFFSET_BACK_SCALE 1550x42AC SU_POLY_OFFSET_BACK_SCALE
1560x42B0 SU_POLY_OFFSET_BACK_OFFSET 1560x42B0 SU_POLY_OFFSET_BACK_OFFSET
1570x42B4 SU_POLY_OFFSET_ENABLE 1570x42B4 SU_POLY_OFFSET_ENABLE
1580x42B8 SU_CULL_MODE 1580x42B8 SU_CULL_MODE
1590x42C0 SU_DEPTH_SCALE 1590x42C0 SU_DEPTH_SCALE
@@ -291,6 +291,8 @@ rs600 0x6d40
2910x46AC US_OUT_FMT_2 2910x46AC US_OUT_FMT_2
2920x46B0 US_OUT_FMT_3 2920x46B0 US_OUT_FMT_3
2930x46B4 US_W_FMT 2930x46B4 US_W_FMT
2940x46B8 US_CODE_BANK
2950x46BC US_CODE_EXT
2940x46C0 US_ALU_RGB_ADDR_0 2960x46C0 US_ALU_RGB_ADDR_0
2950x46C4 US_ALU_RGB_ADDR_1 2970x46C4 US_ALU_RGB_ADDR_1
2960x46C8 US_ALU_RGB_ADDR_2 2980x46C8 US_ALU_RGB_ADDR_2
@@ -547,6 +549,70 @@ rs600 0x6d40
5470x4AB4 US_ALU_ALPHA_INST_61 5490x4AB4 US_ALU_ALPHA_INST_61
5480x4AB8 US_ALU_ALPHA_INST_62 5500x4AB8 US_ALU_ALPHA_INST_62
5490x4ABC US_ALU_ALPHA_INST_63 5510x4ABC US_ALU_ALPHA_INST_63
5520x4AC0 US_ALU_EXT_ADDR_0
5530x4AC4 US_ALU_EXT_ADDR_1
5540x4AC8 US_ALU_EXT_ADDR_2
5550x4ACC US_ALU_EXT_ADDR_3
5560x4AD0 US_ALU_EXT_ADDR_4
5570x4AD4 US_ALU_EXT_ADDR_5
5580x4AD8 US_ALU_EXT_ADDR_6
5590x4ADC US_ALU_EXT_ADDR_7
5600x4AE0 US_ALU_EXT_ADDR_8
5610x4AE4 US_ALU_EXT_ADDR_9
5620x4AE8 US_ALU_EXT_ADDR_10
5630x4AEC US_ALU_EXT_ADDR_11
5640x4AF0 US_ALU_EXT_ADDR_12
5650x4AF4 US_ALU_EXT_ADDR_13
5660x4AF8 US_ALU_EXT_ADDR_14
5670x4AFC US_ALU_EXT_ADDR_15
5680x4B00 US_ALU_EXT_ADDR_16
5690x4B04 US_ALU_EXT_ADDR_17
5700x4B08 US_ALU_EXT_ADDR_18
5710x4B0C US_ALU_EXT_ADDR_19
5720x4B10 US_ALU_EXT_ADDR_20
5730x4B14 US_ALU_EXT_ADDR_21
5740x4B18 US_ALU_EXT_ADDR_22
5750x4B1C US_ALU_EXT_ADDR_23
5760x4B20 US_ALU_EXT_ADDR_24
5770x4B24 US_ALU_EXT_ADDR_25
5780x4B28 US_ALU_EXT_ADDR_26
5790x4B2C US_ALU_EXT_ADDR_27
5800x4B30 US_ALU_EXT_ADDR_28
5810x4B34 US_ALU_EXT_ADDR_29
5820x4B38 US_ALU_EXT_ADDR_30
5830x4B3C US_ALU_EXT_ADDR_31
5840x4B40 US_ALU_EXT_ADDR_32
5850x4B44 US_ALU_EXT_ADDR_33
5860x4B48 US_ALU_EXT_ADDR_34
5870x4B4C US_ALU_EXT_ADDR_35
5880x4B50 US_ALU_EXT_ADDR_36
5890x4B54 US_ALU_EXT_ADDR_37
5900x4B58 US_ALU_EXT_ADDR_38
5910x4B5C US_ALU_EXT_ADDR_39
5920x4B60 US_ALU_EXT_ADDR_40
5930x4B64 US_ALU_EXT_ADDR_41
5940x4B68 US_ALU_EXT_ADDR_42
5950x4B6C US_ALU_EXT_ADDR_43
5960x4B70 US_ALU_EXT_ADDR_44
5970x4B74 US_ALU_EXT_ADDR_45
5980x4B78 US_ALU_EXT_ADDR_46
5990x4B7C US_ALU_EXT_ADDR_47
6000x4B80 US_ALU_EXT_ADDR_48
6010x4B84 US_ALU_EXT_ADDR_49
6020x4B88 US_ALU_EXT_ADDR_50
6030x4B8C US_ALU_EXT_ADDR_51
6040x4B90 US_ALU_EXT_ADDR_52
6050x4B94 US_ALU_EXT_ADDR_53
6060x4B98 US_ALU_EXT_ADDR_54
6070x4B9C US_ALU_EXT_ADDR_55
6080x4BA0 US_ALU_EXT_ADDR_56
6090x4BA4 US_ALU_EXT_ADDR_57
6100x4BA8 US_ALU_EXT_ADDR_58
6110x4BAC US_ALU_EXT_ADDR_59
6120x4BB0 US_ALU_EXT_ADDR_60
6130x4BB4 US_ALU_EXT_ADDR_61
6140x4BB8 US_ALU_EXT_ADDR_62
6150x4BBC US_ALU_EXT_ADDR_63
5500x4BC0 FG_FOG_BLEND 6160x4BC0 FG_FOG_BLEND
5510x4BC4 FG_FOG_FACTOR 6170x4BC4 FG_FOG_FACTOR
5520x4BC8 FG_FOG_COLOR_R 6180x4BC8 FG_FOG_COLOR_R
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 b/drivers/gpu/drm/radeon/reg_srcs/rv515
index 0102a0d5735c..38abf63bf2cd 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/rv515
+++ b/drivers/gpu/drm/radeon/reg_srcs/rv515
@@ -161,7 +161,12 @@ rv515 0x6d40
1610x401C GB_SELECT 1610x401C GB_SELECT
1620x4020 GB_AA_CONFIG 1620x4020 GB_AA_CONFIG
1630x4024 GB_FIFO_SIZE 1630x4024 GB_FIFO_SIZE
1640x4028 GB_Z_PEQ_CONFIG
1640x4100 TX_INVALTAGS 1650x4100 TX_INVALTAGS
1660x4114 SU_TEX_WRAP_PS3
1670x4118 PS3_ENABLE
1680x411c PS3_VTX_FMT
1690x4120 PS3_TEX_SOURCE
1650x4200 GA_POINT_S0 1700x4200 GA_POINT_S0
1660x4204 GA_POINT_T0 1710x4204 GA_POINT_T0
1670x4208 GA_POINT_S1 1720x4208 GA_POINT_S1
@@ -171,6 +176,7 @@ rv515 0x6d40
1710x4230 GA_POINT_MINMAX 1760x4230 GA_POINT_MINMAX
1720x4234 GA_LINE_CNTL 1770x4234 GA_LINE_CNTL
1730x4238 GA_LINE_STIPPLE_CONFIG 1780x4238 GA_LINE_STIPPLE_CONFIG
1790x4258 GA_COLOR_CONTROL_PS3
1740x4260 GA_LINE_STIPPLE_VALUE 1800x4260 GA_LINE_STIPPLE_VALUE
1750x4264 GA_LINE_S0 1810x4264 GA_LINE_S0
1760x4268 GA_LINE_S1 1820x4268 GA_LINE_S1
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 368415df5f3a..9f5418983e2a 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -356,6 +356,7 @@ static int rs400_mc_init(struct radeon_device *rdev)
356 rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; 356 rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16;
357 rdev->mc.gtt_location = 0xFFFFFFFFUL; 357 rdev->mc.gtt_location = 0xFFFFFFFFUL;
358 r = radeon_mc_setup(rdev); 358 r = radeon_mc_setup(rdev);
359 rdev->mc.igp_sideport_enabled = radeon_combios_sideport_present(rdev);
359 if (r) 360 if (r)
360 return r; 361 return r;
361 return 0; 362 return 0;
@@ -395,6 +396,7 @@ static int rs400_startup(struct radeon_device *rdev)
395 return r; 396 return r;
396 /* Enable IRQ */ 397 /* Enable IRQ */
397 r100_irq_set(rdev); 398 r100_irq_set(rdev);
399 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
398 /* 1M ring buffer */ 400 /* 1M ring buffer */
399 r = r100_cp_init(rdev, 1024 * 1024); 401 r = r100_cp_init(rdev, 1024 * 1024);
400 if (r) { 402 if (r) {
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 4f8ea4260572..d5255751e7b3 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -56,6 +56,7 @@ int rs600_mc_init(struct radeon_device *rdev)
56 rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; 56 rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16;
57 rdev->mc.gtt_location = 0xffffffffUL; 57 rdev->mc.gtt_location = 0xffffffffUL;
58 r = radeon_mc_setup(rdev); 58 r = radeon_mc_setup(rdev);
59 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
59 if (r) 60 if (r)
60 return r; 61 return r;
61 return 0; 62 return 0;
@@ -134,7 +135,8 @@ void rs600_hpd_init(struct radeon_device *rdev)
134 break; 135 break;
135 } 136 }
136 } 137 }
137 rs600_irq_set(rdev); 138 if (rdev->irq.installed)
139 rs600_irq_set(rdev);
138} 140}
139 141
140void rs600_hpd_fini(struct radeon_device *rdev) 142void rs600_hpd_fini(struct radeon_device *rdev)
@@ -315,6 +317,11 @@ int rs600_irq_set(struct radeon_device *rdev)
315 u32 hpd2 = RREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL) & 317 u32 hpd2 = RREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL) &
316 ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN(1); 318 ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN(1);
317 319
320 if (!rdev->irq.installed) {
321 WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n");
322 WREG32(R_000040_GEN_INT_CNTL, 0);
323 return -EINVAL;
324 }
318 if (rdev->irq.sw_int) { 325 if (rdev->irq.sw_int) {
319 tmp |= S_000040_SW_INT_EN(1); 326 tmp |= S_000040_SW_INT_EN(1);
320 } 327 }
@@ -396,7 +403,7 @@ int rs600_irq_process(struct radeon_device *rdev)
396 } 403 }
397 while (status || r500_disp_int) { 404 while (status || r500_disp_int) {
398 /* SW interrupt */ 405 /* SW interrupt */
399 if (G_000040_SW_INT_EN(status)) 406 if (G_000044_SW_INT(status))
400 radeon_fence_process(rdev); 407 radeon_fence_process(rdev);
401 /* Vertical blank interrupts */ 408 /* Vertical blank interrupts */
402 if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) 409 if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int))
@@ -553,6 +560,7 @@ static int rs600_startup(struct radeon_device *rdev)
553 return r; 560 return r;
554 /* Enable IRQ */ 561 /* Enable IRQ */
555 rs600_irq_set(rdev); 562 rs600_irq_set(rdev);
563 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
556 /* 1M ring buffer */ 564 /* 1M ring buffer */
557 r = r100_cp_init(rdev, 1024 * 1024); 565 r = r100_cp_init(rdev, 1024 * 1024);
558 if (r) { 566 if (r) {
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 1e22f52d6039..cd31da913771 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -172,6 +172,7 @@ static int rs690_mc_init(struct radeon_device *rdev)
172 rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; 172 rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16;
173 rdev->mc.gtt_location = 0xFFFFFFFFUL; 173 rdev->mc.gtt_location = 0xFFFFFFFFUL;
174 r = radeon_mc_setup(rdev); 174 r = radeon_mc_setup(rdev);
175 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
175 if (r) 176 if (r)
176 return r; 177 return r;
177 return 0; 178 return 0;
@@ -625,6 +626,7 @@ static int rs690_startup(struct radeon_device *rdev)
625 return r; 626 return r;
626 /* Enable IRQ */ 627 /* Enable IRQ */
627 rs600_irq_set(rdev); 628 rs600_irq_set(rdev);
629 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
628 /* 1M ring buffer */ 630 /* 1M ring buffer */
629 r = r100_cp_init(rdev, 1024 * 1024); 631 r = r100_cp_init(rdev, 1024 * 1024);
630 if (r) { 632 if (r) {
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 59632a506b46..62756717b044 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -479,6 +479,7 @@ static int rv515_startup(struct radeon_device *rdev)
479 } 479 }
480 /* Enable IRQ */ 480 /* Enable IRQ */
481 rs600_irq_set(rdev); 481 rs600_irq_set(rdev);
482 rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL);
482 /* 1M ring buffer */ 483 /* 1M ring buffer */
483 r = r100_cp_init(rdev, 1024 * 1024); 484 r = r100_cp_init(rdev, 1024 * 1024);
484 if (r) { 485 if (r) {
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 3bcb66e52786..59c71245fb91 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -1096,8 +1096,7 @@ void rv770_fini(struct radeon_device *rdev)
1096 radeon_gem_fini(rdev); 1096 radeon_gem_fini(rdev);
1097 radeon_fence_driver_fini(rdev); 1097 radeon_fence_driver_fini(rdev);
1098 radeon_clocks_fini(rdev); 1098 radeon_clocks_fini(rdev);
1099 if (rdev->flags & RADEON_IS_AGP) 1099 radeon_agp_fini(rdev);
1100 radeon_agp_fini(rdev);
1101 radeon_bo_fini(rdev); 1100 radeon_bo_fini(rdev);
1102 radeon_atombios_fini(rdev); 1101 radeon_atombios_fini(rdev);
1103 kfree(rdev->bios); 1102 kfree(rdev->bios);
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
index eee52aa92a7c..021de44c15ab 100644
--- a/drivers/gpu/drm/savage/savage_drv.c
+++ b/drivers/gpu/drm/savage/savage_drv.c
@@ -50,7 +50,7 @@ static struct drm_driver driver = {
50 .owner = THIS_MODULE, 50 .owner = THIS_MODULE,
51 .open = drm_open, 51 .open = drm_open,
52 .release = drm_release, 52 .release = drm_release,
53 .ioctl = drm_ioctl, 53 .unlocked_ioctl = drm_ioctl,
54 .mmap = drm_mmap, 54 .mmap = drm_mmap,
55 .poll = drm_poll, 55 .poll = drm_poll,
56 .fasync = drm_fasync, 56 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index e725cc0b1155..4fd1f067d380 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -80,7 +80,7 @@ static struct drm_driver driver = {
80 .owner = THIS_MODULE, 80 .owner = THIS_MODULE,
81 .open = drm_open, 81 .open = drm_open,
82 .release = drm_release, 82 .release = drm_release,
83 .ioctl = drm_ioctl, 83 .unlocked_ioctl = drm_ioctl,
84 .mmap = drm_mmap, 84 .mmap = drm_mmap,
85 .poll = drm_poll, 85 .poll = drm_poll,
86 .fasync = drm_fasync, 86 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
index 012ff2e356b2..ec5a43e65722 100644
--- a/drivers/gpu/drm/tdfx/tdfx_drv.c
+++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
@@ -48,7 +48,7 @@ static struct drm_driver driver = {
48 .owner = THIS_MODULE, 48 .owner = THIS_MODULE,
49 .open = drm_open, 49 .open = drm_open,
50 .release = drm_release, 50 .release = drm_release,
51 .ioctl = drm_ioctl, 51 .unlocked_ioctl = drm_ioctl,
52 .mmap = drm_mmap, 52 .mmap = drm_mmap,
53 .poll = drm_poll, 53 .poll = drm_poll,
54 .fasync = drm_fasync, 54 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
index bc2f51843005..7a1b210401e0 100644
--- a/drivers/gpu/drm/via/via_drv.c
+++ b/drivers/gpu/drm/via/via_drv.c
@@ -58,7 +58,7 @@ static struct drm_driver driver = {
58 .owner = THIS_MODULE, 58 .owner = THIS_MODULE,
59 .open = drm_open, 59 .open = drm_open,
60 .release = drm_release, 60 .release = drm_release,
61 .ioctl = drm_ioctl, 61 .unlocked_ioctl = drm_ioctl,
62 .mmap = drm_mmap, 62 .mmap = drm_mmap,
63 .poll = drm_poll, 63 .poll = drm_poll,
64 .fasync = drm_fasync, 64 .fasync = drm_fasync,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 7b48bb3b63b2..1db1ef30be2b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -103,37 +103,39 @@
103 */ 103 */
104 104
105static struct drm_ioctl_desc vmw_ioctls[] = { 105static struct drm_ioctl_desc vmw_ioctls[] = {
106 VMW_IOCTL_DEF(DRM_IOCTL_VMW_GET_PARAM, vmw_getparam_ioctl, 0), 106 VMW_IOCTL_DEF(DRM_IOCTL_VMW_GET_PARAM, vmw_getparam_ioctl,
107 DRM_AUTH | DRM_UNLOCKED),
107 VMW_IOCTL_DEF(DRM_IOCTL_VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl, 108 VMW_IOCTL_DEF(DRM_IOCTL_VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl,
108 0), 109 DRM_AUTH | DRM_UNLOCKED),
109 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_DMABUF, vmw_dmabuf_unref_ioctl, 110 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_DMABUF, vmw_dmabuf_unref_ioctl,
110 0), 111 DRM_AUTH | DRM_UNLOCKED),
111 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CURSOR_BYPASS, 112 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CURSOR_BYPASS,
112 vmw_kms_cursor_bypass_ioctl, 0), 113 vmw_kms_cursor_bypass_ioctl,
114 DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED),
113 115
114 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CONTROL_STREAM, vmw_overlay_ioctl, 116 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CONTROL_STREAM, vmw_overlay_ioctl,
115 0), 117 DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED),
116 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CLAIM_STREAM, vmw_stream_claim_ioctl, 118 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CLAIM_STREAM, vmw_stream_claim_ioctl,
117 0), 119 DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED),
118 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_STREAM, vmw_stream_unref_ioctl, 120 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_STREAM, vmw_stream_unref_ioctl,
119 0), 121 DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED),
120 122
121 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_CONTEXT, vmw_context_define_ioctl, 123 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_CONTEXT, vmw_context_define_ioctl,
122 0), 124 DRM_AUTH | DRM_UNLOCKED),
123 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl, 125 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl,
124 0), 126 DRM_AUTH | DRM_UNLOCKED),
125 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_SURFACE, vmw_surface_define_ioctl, 127 VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_SURFACE, vmw_surface_define_ioctl,
126 0), 128 DRM_AUTH | DRM_UNLOCKED),
127 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl, 129 VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl,
128 0), 130 DRM_AUTH | DRM_UNLOCKED),
129 VMW_IOCTL_DEF(DRM_IOCTL_VMW_REF_SURFACE, vmw_surface_reference_ioctl, 131 VMW_IOCTL_DEF(DRM_IOCTL_VMW_REF_SURFACE, vmw_surface_reference_ioctl,
130 0), 132 DRM_AUTH | DRM_UNLOCKED),
131 VMW_IOCTL_DEF(DRM_IOCTL_VMW_EXECBUF, vmw_execbuf_ioctl, 133 VMW_IOCTL_DEF(DRM_IOCTL_VMW_EXECBUF, vmw_execbuf_ioctl,
132 0), 134 DRM_AUTH | DRM_UNLOCKED),
133 VMW_IOCTL_DEF(DRM_IOCTL_VMW_FIFO_DEBUG, vmw_fifo_debug_ioctl, 135 VMW_IOCTL_DEF(DRM_IOCTL_VMW_FIFO_DEBUG, vmw_fifo_debug_ioctl,
134 0), 136 DRM_AUTH | DRM_ROOT_ONLY | DRM_MASTER | DRM_UNLOCKED),
135 VMW_IOCTL_DEF(DRM_IOCTL_VMW_FENCE_WAIT, vmw_fence_wait_ioctl, 137 VMW_IOCTL_DEF(DRM_IOCTL_VMW_FENCE_WAIT, vmw_fence_wait_ioctl,
136 0) 138 DRM_AUTH | DRM_UNLOCKED)
137}; 139};
138 140
139static struct pci_device_id vmw_pci_id_list[] = { 141static struct pci_device_id vmw_pci_id_list[] = {
@@ -460,11 +462,9 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd,
460 struct drm_file *file_priv = filp->private_data; 462 struct drm_file *file_priv = filp->private_data;
461 struct drm_device *dev = file_priv->minor->dev; 463 struct drm_device *dev = file_priv->minor->dev;
462 unsigned int nr = DRM_IOCTL_NR(cmd); 464 unsigned int nr = DRM_IOCTL_NR(cmd);
463 long ret;
464 465
465 /* 466 /*
466 * The driver private ioctls and TTM ioctls should be 467 * Do extra checking on driver private ioctls.
467 * thread-safe.
468 */ 468 */
469 469
470 if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END) 470 if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
@@ -477,18 +477,9 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd,
477 nr - DRM_COMMAND_BASE); 477 nr - DRM_COMMAND_BASE);
478 return -EINVAL; 478 return -EINVAL;
479 } 479 }
480 return drm_ioctl(filp->f_path.dentry->d_inode,
481 filp, cmd, arg);
482 } 480 }
483 481
484 /* 482 return drm_ioctl(filp, cmd, arg);
485 * Not all old drm ioctls are thread-safe.
486 */
487
488 lock_kernel();
489 ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg);
490 unlock_kernel();
491 return ret;
492} 483}
493 484
494static int vmw_firstopen(struct drm_device *dev) 485static int vmw_firstopen(struct drm_device *dev)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 43546d09d1b0..e61bd85b6975 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -123,6 +123,7 @@ struct vmw_sw_context{
123 uint32_t last_cid; 123 uint32_t last_cid;
124 bool cid_valid; 124 bool cid_valid;
125 uint32_t last_sid; 125 uint32_t last_sid;
126 uint32_t sid_translation;
126 bool sid_valid; 127 bool sid_valid;
127 struct ttm_object_file *tfile; 128 struct ttm_object_file *tfile;
128 struct list_head validate_nodes; 129 struct list_head validate_nodes;
@@ -317,9 +318,10 @@ extern void vmw_surface_res_free(struct vmw_resource *res);
317extern int vmw_surface_init(struct vmw_private *dev_priv, 318extern int vmw_surface_init(struct vmw_private *dev_priv,
318 struct vmw_surface *srf, 319 struct vmw_surface *srf,
319 void (*res_free) (struct vmw_resource *res)); 320 void (*res_free) (struct vmw_resource *res));
320extern int vmw_user_surface_lookup(struct vmw_private *dev_priv, 321extern int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv,
321 struct ttm_object_file *tfile, 322 struct ttm_object_file *tfile,
322 int sid, struct vmw_surface **out); 323 uint32_t handle,
324 struct vmw_surface **out);
323extern int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, 325extern int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data,
324 struct drm_file *file_priv); 326 struct drm_file *file_priv);
325extern int vmw_surface_define_ioctl(struct drm_device *dev, void *data, 327extern int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
@@ -328,7 +330,7 @@ extern int vmw_surface_reference_ioctl(struct drm_device *dev, void *data,
328 struct drm_file *file_priv); 330 struct drm_file *file_priv);
329extern int vmw_surface_check(struct vmw_private *dev_priv, 331extern int vmw_surface_check(struct vmw_private *dev_priv,
330 struct ttm_object_file *tfile, 332 struct ttm_object_file *tfile,
331 int id); 333 uint32_t handle, int *id);
332extern void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo); 334extern void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo);
333extern int vmw_dmabuf_init(struct vmw_private *dev_priv, 335extern int vmw_dmabuf_init(struct vmw_private *dev_priv,
334 struct vmw_dma_buffer *vmw_bo, 336 struct vmw_dma_buffer *vmw_bo,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 7a39f3e6dc2c..2e92da567403 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -73,21 +73,32 @@ static int vmw_cmd_cid_check(struct vmw_private *dev_priv,
73 73
74static int vmw_cmd_sid_check(struct vmw_private *dev_priv, 74static int vmw_cmd_sid_check(struct vmw_private *dev_priv,
75 struct vmw_sw_context *sw_context, 75 struct vmw_sw_context *sw_context,
76 uint32_t sid) 76 uint32_t *sid)
77{ 77{
78 if (unlikely((!sw_context->sid_valid || sid != sw_context->last_sid) && 78 if (*sid == SVGA3D_INVALID_ID)
79 sid != SVGA3D_INVALID_ID)) { 79 return 0;
80 int ret = vmw_surface_check(dev_priv, sw_context->tfile, sid); 80
81 if (unlikely((!sw_context->sid_valid ||
82 *sid != sw_context->last_sid))) {
83 int real_id;
84 int ret = vmw_surface_check(dev_priv, sw_context->tfile,
85 *sid, &real_id);
81 86
82 if (unlikely(ret != 0)) { 87 if (unlikely(ret != 0)) {
83 DRM_ERROR("Could ot find or use surface %u\n", 88 DRM_ERROR("Could ot find or use surface 0x%08x "
84 (unsigned) sid); 89 "address 0x%08lx\n",
90 (unsigned int) *sid,
91 (unsigned long) sid);
85 return ret; 92 return ret;
86 } 93 }
87 94
88 sw_context->last_sid = sid; 95 sw_context->last_sid = *sid;
89 sw_context->sid_valid = true; 96 sw_context->sid_valid = true;
90 } 97 *sid = real_id;
98 sw_context->sid_translation = real_id;
99 } else
100 *sid = sw_context->sid_translation;
101
91 return 0; 102 return 0;
92} 103}
93 104
@@ -107,7 +118,8 @@ static int vmw_cmd_set_render_target_check(struct vmw_private *dev_priv,
107 return ret; 118 return ret;
108 119
109 cmd = container_of(header, struct vmw_sid_cmd, header); 120 cmd = container_of(header, struct vmw_sid_cmd, header);
110 return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.target.sid); 121 ret = vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.target.sid);
122 return ret;
111} 123}
112 124
113static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv, 125static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv,
@@ -121,10 +133,10 @@ static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv,
121 int ret; 133 int ret;
122 134
123 cmd = container_of(header, struct vmw_sid_cmd, header); 135 cmd = container_of(header, struct vmw_sid_cmd, header);
124 ret = vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.src.sid); 136 ret = vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.src.sid);
125 if (unlikely(ret != 0)) 137 if (unlikely(ret != 0))
126 return ret; 138 return ret;
127 return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.dest.sid); 139 return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.dest.sid);
128} 140}
129 141
130static int vmw_cmd_stretch_blt_check(struct vmw_private *dev_priv, 142static int vmw_cmd_stretch_blt_check(struct vmw_private *dev_priv,
@@ -138,10 +150,10 @@ static int vmw_cmd_stretch_blt_check(struct vmw_private *dev_priv,
138 int ret; 150 int ret;
139 151
140 cmd = container_of(header, struct vmw_sid_cmd, header); 152 cmd = container_of(header, struct vmw_sid_cmd, header);
141 ret = vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.src.sid); 153 ret = vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.src.sid);
142 if (unlikely(ret != 0)) 154 if (unlikely(ret != 0))
143 return ret; 155 return ret;
144 return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.dest.sid); 156 return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.dest.sid);
145} 157}
146 158
147static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv, 159static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv,
@@ -154,7 +166,7 @@ static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv,
154 } *cmd; 166 } *cmd;
155 167
156 cmd = container_of(header, struct vmw_sid_cmd, header); 168 cmd = container_of(header, struct vmw_sid_cmd, header);
157 return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.srcImage.sid); 169 return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.srcImage.sid);
158} 170}
159 171
160static int vmw_cmd_present_check(struct vmw_private *dev_priv, 172static int vmw_cmd_present_check(struct vmw_private *dev_priv,
@@ -167,7 +179,7 @@ static int vmw_cmd_present_check(struct vmw_private *dev_priv,
167 } *cmd; 179 } *cmd;
168 180
169 cmd = container_of(header, struct vmw_sid_cmd, header); 181 cmd = container_of(header, struct vmw_sid_cmd, header);
170 return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.sid); 182 return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.sid);
171} 183}
172 184
173static int vmw_cmd_dma(struct vmw_private *dev_priv, 185static int vmw_cmd_dma(struct vmw_private *dev_priv,
@@ -187,12 +199,7 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
187 uint32_t cur_validate_node; 199 uint32_t cur_validate_node;
188 struct ttm_validate_buffer *val_buf; 200 struct ttm_validate_buffer *val_buf;
189 201
190
191 cmd = container_of(header, struct vmw_dma_cmd, header); 202 cmd = container_of(header, struct vmw_dma_cmd, header);
192 ret = vmw_cmd_sid_check(dev_priv, sw_context, cmd->dma.host.sid);
193 if (unlikely(ret != 0))
194 return ret;
195
196 handle = cmd->dma.guest.ptr.gmrId; 203 handle = cmd->dma.guest.ptr.gmrId;
197 ret = vmw_user_dmabuf_lookup(sw_context->tfile, handle, &vmw_bo); 204 ret = vmw_user_dmabuf_lookup(sw_context->tfile, handle, &vmw_bo);
198 if (unlikely(ret != 0)) { 205 if (unlikely(ret != 0)) {
@@ -228,14 +235,23 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
228 ++sw_context->cur_val_buf; 235 ++sw_context->cur_val_buf;
229 } 236 }
230 237
231 ret = vmw_user_surface_lookup(dev_priv, sw_context->tfile, 238 ret = vmw_user_surface_lookup_handle(dev_priv, sw_context->tfile,
232 cmd->dma.host.sid, &srf); 239 cmd->dma.host.sid, &srf);
233 if (ret) { 240 if (ret) {
234 DRM_ERROR("could not find surface\n"); 241 DRM_ERROR("could not find surface\n");
235 goto out_no_reloc; 242 goto out_no_reloc;
236 } 243 }
237 244
245 /**
246 * Patch command stream with device SID.
247 */
248
249 cmd->dma.host.sid = srf->res.id;
238 vmw_kms_cursor_snoop(srf, sw_context->tfile, bo, header); 250 vmw_kms_cursor_snoop(srf, sw_context->tfile, bo, header);
251 /**
252 * FIXME: May deadlock here when called from the
253 * command parsing code.
254 */
239 vmw_surface_unreference(&srf); 255 vmw_surface_unreference(&srf);
240 256
241out_no_reloc: 257out_no_reloc:
@@ -243,6 +259,90 @@ out_no_reloc:
243 return ret; 259 return ret;
244} 260}
245 261
262static int vmw_cmd_draw(struct vmw_private *dev_priv,
263 struct vmw_sw_context *sw_context,
264 SVGA3dCmdHeader *header)
265{
266 struct vmw_draw_cmd {
267 SVGA3dCmdHeader header;
268 SVGA3dCmdDrawPrimitives body;
269 } *cmd;
270 SVGA3dVertexDecl *decl = (SVGA3dVertexDecl *)(
271 (unsigned long)header + sizeof(*cmd));
272 SVGA3dPrimitiveRange *range;
273 uint32_t i;
274 uint32_t maxnum;
275 int ret;
276
277 ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
278 if (unlikely(ret != 0))
279 return ret;
280
281 cmd = container_of(header, struct vmw_draw_cmd, header);
282 maxnum = (header->size - sizeof(cmd->body)) / sizeof(*decl);
283
284 if (unlikely(cmd->body.numVertexDecls > maxnum)) {
285 DRM_ERROR("Illegal number of vertex declarations.\n");
286 return -EINVAL;
287 }
288
289 for (i = 0; i < cmd->body.numVertexDecls; ++i, ++decl) {
290 ret = vmw_cmd_sid_check(dev_priv, sw_context,
291 &decl->array.surfaceId);
292 if (unlikely(ret != 0))
293 return ret;
294 }
295
296 maxnum = (header->size - sizeof(cmd->body) -
297 cmd->body.numVertexDecls * sizeof(*decl)) / sizeof(*range);
298 if (unlikely(cmd->body.numRanges > maxnum)) {
299 DRM_ERROR("Illegal number of index ranges.\n");
300 return -EINVAL;
301 }
302
303 range = (SVGA3dPrimitiveRange *) decl;
304 for (i = 0; i < cmd->body.numRanges; ++i, ++range) {
305 ret = vmw_cmd_sid_check(dev_priv, sw_context,
306 &range->indexArray.surfaceId);
307 if (unlikely(ret != 0))
308 return ret;
309 }
310 return 0;
311}
312
313
314static int vmw_cmd_tex_state(struct vmw_private *dev_priv,
315 struct vmw_sw_context *sw_context,
316 SVGA3dCmdHeader *header)
317{
318 struct vmw_tex_state_cmd {
319 SVGA3dCmdHeader header;
320 SVGA3dCmdSetTextureState state;
321 };
322
323 SVGA3dTextureState *last_state = (SVGA3dTextureState *)
324 ((unsigned long) header + header->size + sizeof(header));
325 SVGA3dTextureState *cur_state = (SVGA3dTextureState *)
326 ((unsigned long) header + sizeof(struct vmw_tex_state_cmd));
327 int ret;
328
329 ret = vmw_cmd_cid_check(dev_priv, sw_context, header);
330 if (unlikely(ret != 0))
331 return ret;
332
333 for (; cur_state < last_state; ++cur_state) {
334 if (likely(cur_state->name != SVGA3D_TS_BIND_TEXTURE))
335 continue;
336
337 ret = vmw_cmd_sid_check(dev_priv, sw_context,
338 &cur_state->value);
339 if (unlikely(ret != 0))
340 return ret;
341 }
342
343 return 0;
344}
345
246 346
247typedef int (*vmw_cmd_func) (struct vmw_private *, 347typedef int (*vmw_cmd_func) (struct vmw_private *,
248 struct vmw_sw_context *, 348 struct vmw_sw_context *,
@@ -264,7 +364,7 @@ static vmw_cmd_func vmw_cmd_funcs[SVGA_3D_CMD_MAX] = {
264 VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERSTATE, &vmw_cmd_cid_check), 364 VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERSTATE, &vmw_cmd_cid_check),
265 VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERTARGET, 365 VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERTARGET,
266 &vmw_cmd_set_render_target_check), 366 &vmw_cmd_set_render_target_check),
267 VMW_CMD_DEF(SVGA_3D_CMD_SETTEXTURESTATE, &vmw_cmd_cid_check), 367 VMW_CMD_DEF(SVGA_3D_CMD_SETTEXTURESTATE, &vmw_cmd_tex_state),
268 VMW_CMD_DEF(SVGA_3D_CMD_SETMATERIAL, &vmw_cmd_cid_check), 368 VMW_CMD_DEF(SVGA_3D_CMD_SETMATERIAL, &vmw_cmd_cid_check),
269 VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTDATA, &vmw_cmd_cid_check), 369 VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTDATA, &vmw_cmd_cid_check),
270 VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTENABLED, &vmw_cmd_cid_check), 370 VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTENABLED, &vmw_cmd_cid_check),
@@ -276,7 +376,7 @@ static vmw_cmd_func vmw_cmd_funcs[SVGA_3D_CMD_MAX] = {
276 VMW_CMD_DEF(SVGA_3D_CMD_SHADER_DESTROY, &vmw_cmd_cid_check), 376 VMW_CMD_DEF(SVGA_3D_CMD_SHADER_DESTROY, &vmw_cmd_cid_check),
277 VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER, &vmw_cmd_cid_check), 377 VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER, &vmw_cmd_cid_check),
278 VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER_CONST, &vmw_cmd_cid_check), 378 VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER_CONST, &vmw_cmd_cid_check),
279 VMW_CMD_DEF(SVGA_3D_CMD_DRAW_PRIMITIVES, &vmw_cmd_cid_check), 379 VMW_CMD_DEF(SVGA_3D_CMD_DRAW_PRIMITIVES, &vmw_cmd_draw),
280 VMW_CMD_DEF(SVGA_3D_CMD_SETSCISSORRECT, &vmw_cmd_cid_check), 380 VMW_CMD_DEF(SVGA_3D_CMD_SETSCISSORRECT, &vmw_cmd_cid_check),
281 VMW_CMD_DEF(SVGA_3D_CMD_BEGIN_QUERY, &vmw_cmd_cid_check), 381 VMW_CMD_DEF(SVGA_3D_CMD_BEGIN_QUERY, &vmw_cmd_cid_check),
282 VMW_CMD_DEF(SVGA_3D_CMD_END_QUERY, &vmw_cmd_cid_check), 382 VMW_CMD_DEF(SVGA_3D_CMD_END_QUERY, &vmw_cmd_cid_check),
@@ -291,6 +391,7 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
291 void *buf, uint32_t *size) 391 void *buf, uint32_t *size)
292{ 392{
293 uint32_t cmd_id; 393 uint32_t cmd_id;
394 uint32_t size_remaining = *size;
294 SVGA3dCmdHeader *header = (SVGA3dCmdHeader *) buf; 395 SVGA3dCmdHeader *header = (SVGA3dCmdHeader *) buf;
295 int ret; 396 int ret;
296 397
@@ -304,6 +405,9 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
304 *size = le32_to_cpu(header->size) + sizeof(SVGA3dCmdHeader); 405 *size = le32_to_cpu(header->size) + sizeof(SVGA3dCmdHeader);
305 406
306 cmd_id -= SVGA_3D_CMD_BASE; 407 cmd_id -= SVGA_3D_CMD_BASE;
408 if (unlikely(*size > size_remaining))
409 goto out_err;
410
307 if (unlikely(cmd_id >= SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE)) 411 if (unlikely(cmd_id >= SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE))
308 goto out_err; 412 goto out_err;
309 413
@@ -326,6 +430,7 @@ static int vmw_cmd_check_all(struct vmw_private *dev_priv,
326 int ret; 430 int ret;
327 431
328 while (cur_size > 0) { 432 while (cur_size > 0) {
433 size = cur_size;
329 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); 434 ret = vmw_cmd_check(dev_priv, sw_context, buf, &size);
330 if (unlikely(ret != 0)) 435 if (unlikely(ret != 0))
331 return ret; 436 return ret;
@@ -386,7 +491,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
386 return 0; 491 return 0;
387 492
388 ret = vmw_gmr_bind(dev_priv, bo); 493 ret = vmw_gmr_bind(dev_priv, bo);
389 if (likely(ret == 0 || ret == -ERESTART)) 494 if (likely(ret == 0 || ret == -ERESTARTSYS))
390 return ret; 495 return ret;
391 496
392 497
@@ -429,7 +534,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
429 534
430 ret = mutex_lock_interruptible(&dev_priv->cmdbuf_mutex); 535 ret = mutex_lock_interruptible(&dev_priv->cmdbuf_mutex);
431 if (unlikely(ret != 0)) { 536 if (unlikely(ret != 0)) {
432 ret = -ERESTART; 537 ret = -ERESTARTSYS;
433 goto out_no_cmd_mutex; 538 goto out_no_cmd_mutex;
434 } 539 }
435 540
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
index 76b0693e2458..01feb48af333 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
@@ -191,7 +191,7 @@ static int vmw_fifo_wait_noirq(struct vmw_private *dev_priv,
191 } 191 }
192 schedule_timeout(1); 192 schedule_timeout(1);
193 if (interruptible && signal_pending(current)) { 193 if (interruptible && signal_pending(current)) {
194 ret = -ERESTART; 194 ret = -ERESTARTSYS;
195 break; 195 break;
196 } 196 }
197 } 197 }
@@ -237,9 +237,7 @@ static int vmw_fifo_wait(struct vmw_private *dev_priv,
237 (dev_priv->fifo_queue, 237 (dev_priv->fifo_queue,
238 !vmw_fifo_is_full(dev_priv, bytes), timeout); 238 !vmw_fifo_is_full(dev_priv, bytes), timeout);
239 239
240 if (unlikely(ret == -ERESTARTSYS)) 240 if (unlikely(ret == 0))
241 ret = -ERESTART;
242 else if (unlikely(ret == 0))
243 ret = -EBUSY; 241 ret = -EBUSY;
244 else if (likely(ret > 0)) 242 else if (likely(ret > 0))
245 ret = 0; 243 ret = 0;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
index 9e0f0306eedb..d40086fc8647 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
@@ -155,7 +155,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv,
155 TASK_UNINTERRUPTIBLE); 155 TASK_UNINTERRUPTIBLE);
156 } 156 }
157 if (interruptible && signal_pending(current)) { 157 if (interruptible && signal_pending(current)) {
158 ret = -ERESTART; 158 ret = -ERESTARTSYS;
159 break; 159 break;
160 } 160 }
161 } 161 }
@@ -218,9 +218,7 @@ int vmw_wait_fence(struct vmw_private *dev_priv,
218 vmw_fence_signaled(dev_priv, sequence), 218 vmw_fence_signaled(dev_priv, sequence),
219 timeout); 219 timeout);
220 220
221 if (unlikely(ret == -ERESTARTSYS)) 221 if (unlikely(ret == 0))
222 ret = -ERESTART;
223 else if (unlikely(ret == 0))
224 ret = -EBUSY; 222 ret = -EBUSY;
225 else if (likely(ret > 0)) 223 else if (likely(ret > 0))
226 ret = 0; 224 ret = 0;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index e9403be446fe..b1af76e371c3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -106,8 +106,8 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
106 int ret; 106 int ret;
107 107
108 if (handle) { 108 if (handle) {
109 ret = vmw_user_surface_lookup(dev_priv, tfile, 109 ret = vmw_user_surface_lookup_handle(dev_priv, tfile,
110 handle, &surface); 110 handle, &surface);
111 if (!ret) { 111 if (!ret) {
112 if (!surface->snooper.image) { 112 if (!surface->snooper.image) {
113 DRM_ERROR("surface not suitable for cursor\n"); 113 DRM_ERROR("surface not suitable for cursor\n");
@@ -704,8 +704,8 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
704 struct vmw_dma_buffer *bo = NULL; 704 struct vmw_dma_buffer *bo = NULL;
705 int ret; 705 int ret;
706 706
707 ret = vmw_user_surface_lookup(dev_priv, tfile, 707 ret = vmw_user_surface_lookup_handle(dev_priv, tfile,
708 mode_cmd->handle, &surface); 708 mode_cmd->handle, &surface);
709 if (ret) 709 if (ret)
710 goto try_dmabuf; 710 goto try_dmabuf;
711 711
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index a1ceed0c8e07..c012d5927f65 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -488,28 +488,44 @@ static void vmw_user_surface_free(struct vmw_resource *res)
488 kfree(user_srf); 488 kfree(user_srf);
489} 489}
490 490
491int vmw_user_surface_lookup(struct vmw_private *dev_priv, 491int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv,
492 struct ttm_object_file *tfile, 492 struct ttm_object_file *tfile,
493 int sid, struct vmw_surface **out) 493 uint32_t handle, struct vmw_surface **out)
494{ 494{
495 struct vmw_resource *res; 495 struct vmw_resource *res;
496 struct vmw_surface *srf; 496 struct vmw_surface *srf;
497 struct vmw_user_surface *user_srf; 497 struct vmw_user_surface *user_srf;
498 struct ttm_base_object *base;
499 int ret = -EINVAL;
498 500
499 res = vmw_resource_lookup(dev_priv, &dev_priv->surface_idr, sid); 501 base = ttm_base_object_lookup(tfile, handle);
500 if (unlikely(res == NULL)) 502 if (unlikely(base == NULL))
501 return -EINVAL; 503 return -EINVAL;
502 504
503 if (res->res_free != &vmw_user_surface_free) 505 if (unlikely(base->object_type != VMW_RES_SURFACE))
504 return -EINVAL; 506 goto out_bad_resource;
505 507
506 srf = container_of(res, struct vmw_surface, res); 508 user_srf = container_of(base, struct vmw_user_surface, base);
507 user_srf = container_of(srf, struct vmw_user_surface, srf); 509 srf = &user_srf->srf;
508 if (user_srf->base.tfile != tfile && !user_srf->base.shareable) 510 res = &srf->res;
509 return -EPERM; 511
512 read_lock(&dev_priv->resource_lock);
513
514 if (!res->avail || res->res_free != &vmw_user_surface_free) {
515 read_unlock(&dev_priv->resource_lock);
516 goto out_bad_resource;
517 }
518
519 kref_get(&res->kref);
520 read_unlock(&dev_priv->resource_lock);
510 521
511 *out = srf; 522 *out = srf;
512 return 0; 523 ret = 0;
524
525out_bad_resource:
526 ttm_base_object_unref(&base);
527
528 return ret;
513} 529}
514 530
515static void vmw_user_surface_base_release(struct ttm_base_object **p_base) 531static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
@@ -526,35 +542,10 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
526int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, 542int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data,
527 struct drm_file *file_priv) 543 struct drm_file *file_priv)
528{ 544{
529 struct vmw_private *dev_priv = vmw_priv(dev);
530 struct vmw_resource *res;
531 struct vmw_surface *srf;
532 struct vmw_user_surface *user_srf;
533 struct drm_vmw_surface_arg *arg = (struct drm_vmw_surface_arg *)data; 545 struct drm_vmw_surface_arg *arg = (struct drm_vmw_surface_arg *)data;
534 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 546 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
535 int ret = 0;
536
537 res = vmw_resource_lookup(dev_priv, &dev_priv->surface_idr, arg->sid);
538 if (unlikely(res == NULL))
539 return -EINVAL;
540
541 if (res->res_free != &vmw_user_surface_free) {
542 ret = -EINVAL;
543 goto out;
544 }
545 547
546 srf = container_of(res, struct vmw_surface, res); 548 return ttm_ref_object_base_unref(tfile, arg->sid, TTM_REF_USAGE);
547 user_srf = container_of(srf, struct vmw_user_surface, srf);
548 if (user_srf->base.tfile != tfile && !user_srf->base.shareable) {
549 ret = -EPERM;
550 goto out;
551 }
552
553 ttm_ref_object_base_unref(tfile, user_srf->base.hash.key,
554 TTM_REF_USAGE);
555out:
556 vmw_resource_unreference(&res);
557 return ret;
558} 549}
559 550
560int vmw_surface_define_ioctl(struct drm_device *dev, void *data, 551int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
@@ -649,7 +640,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
649 } 640 }
650 srf->snooper.crtc = NULL; 641 srf->snooper.crtc = NULL;
651 642
652 rep->sid = res->id; 643 rep->sid = user_srf->base.hash.key;
644 if (rep->sid == SVGA3D_INVALID_ID)
645 DRM_ERROR("Created bad Surface ID.\n");
646
653 vmw_resource_unreference(&res); 647 vmw_resource_unreference(&res);
654 return 0; 648 return 0;
655out_err1: 649out_err1:
@@ -662,39 +656,33 @@ out_err0:
662int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, 656int vmw_surface_reference_ioctl(struct drm_device *dev, void *data,
663 struct drm_file *file_priv) 657 struct drm_file *file_priv)
664{ 658{
665 struct vmw_private *dev_priv = vmw_priv(dev);
666 union drm_vmw_surface_reference_arg *arg = 659 union drm_vmw_surface_reference_arg *arg =
667 (union drm_vmw_surface_reference_arg *)data; 660 (union drm_vmw_surface_reference_arg *)data;
668 struct drm_vmw_surface_arg *req = &arg->req; 661 struct drm_vmw_surface_arg *req = &arg->req;
669 struct drm_vmw_surface_create_req *rep = &arg->rep; 662 struct drm_vmw_surface_create_req *rep = &arg->rep;
670 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 663 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
671 struct vmw_resource *res;
672 struct vmw_surface *srf; 664 struct vmw_surface *srf;
673 struct vmw_user_surface *user_srf; 665 struct vmw_user_surface *user_srf;
674 struct drm_vmw_size __user *user_sizes; 666 struct drm_vmw_size __user *user_sizes;
675 int ret; 667 struct ttm_base_object *base;
668 int ret = -EINVAL;
676 669
677 res = vmw_resource_lookup(dev_priv, &dev_priv->surface_idr, req->sid); 670 base = ttm_base_object_lookup(tfile, req->sid);
678 if (unlikely(res == NULL)) 671 if (unlikely(base == NULL)) {
672 DRM_ERROR("Could not find surface to reference.\n");
679 return -EINVAL; 673 return -EINVAL;
680
681 if (res->res_free != &vmw_user_surface_free) {
682 ret = -EINVAL;
683 goto out;
684 } 674 }
685 675
686 srf = container_of(res, struct vmw_surface, res); 676 if (unlikely(base->object_type != VMW_RES_SURFACE))
687 user_srf = container_of(srf, struct vmw_user_surface, srf); 677 goto out_bad_resource;
688 if (user_srf->base.tfile != tfile && !user_srf->base.shareable) { 678
689 DRM_ERROR("Tried to reference none shareable surface\n"); 679 user_srf = container_of(base, struct vmw_user_surface, base);
690 ret = -EPERM; 680 srf = &user_srf->srf;
691 goto out;
692 }
693 681
694 ret = ttm_ref_object_add(tfile, &user_srf->base, TTM_REF_USAGE, NULL); 682 ret = ttm_ref_object_add(tfile, &user_srf->base, TTM_REF_USAGE, NULL);
695 if (unlikely(ret != 0)) { 683 if (unlikely(ret != 0)) {
696 DRM_ERROR("Could not add a reference to a surface.\n"); 684 DRM_ERROR("Could not add a reference to a surface.\n");
697 goto out; 685 goto out_no_reference;
698 } 686 }
699 687
700 rep->flags = srf->flags; 688 rep->flags = srf->flags;
@@ -706,40 +694,43 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data,
706 if (user_sizes) 694 if (user_sizes)
707 ret = copy_to_user(user_sizes, srf->sizes, 695 ret = copy_to_user(user_sizes, srf->sizes,
708 srf->num_sizes * sizeof(*srf->sizes)); 696 srf->num_sizes * sizeof(*srf->sizes));
709 if (unlikely(ret != 0)) { 697 if (unlikely(ret != 0))
710 DRM_ERROR("copy_to_user failed %p %u\n", 698 DRM_ERROR("copy_to_user failed %p %u\n",
711 user_sizes, srf->num_sizes); 699 user_sizes, srf->num_sizes);
712 /** 700out_bad_resource:
713 * FIXME: Unreference surface here? 701out_no_reference:
714 */ 702 ttm_base_object_unref(&base);
715 goto out; 703
716 }
717out:
718 vmw_resource_unreference(&res);
719 return ret; 704 return ret;
720} 705}
721 706
722int vmw_surface_check(struct vmw_private *dev_priv, 707int vmw_surface_check(struct vmw_private *dev_priv,
723 struct ttm_object_file *tfile, 708 struct ttm_object_file *tfile,
724 int id) 709 uint32_t handle, int *id)
725{ 710{
726 struct vmw_resource *res; 711 struct ttm_base_object *base;
727 int ret = 0; 712 struct vmw_user_surface *user_srf;
728 713
729 read_lock(&dev_priv->resource_lock); 714 int ret = -EPERM;
730 res = idr_find(&dev_priv->surface_idr, id);
731 if (res && res->avail) {
732 struct vmw_surface *srf =
733 container_of(res, struct vmw_surface, res);
734 struct vmw_user_surface *usrf =
735 container_of(srf, struct vmw_user_surface, srf);
736 715
737 if (usrf->base.tfile != tfile && !usrf->base.shareable) 716 base = ttm_base_object_lookup(tfile, handle);
738 ret = -EPERM; 717 if (unlikely(base == NULL))
739 } else 718 return -EINVAL;
740 ret = -EINVAL; 719
741 read_unlock(&dev_priv->resource_lock); 720 if (unlikely(base->object_type != VMW_RES_SURFACE))
721 goto out_bad_surface;
742 722
723 user_srf = container_of(base, struct vmw_user_surface, base);
724 *id = user_srf->srf.res.id;
725 ret = 0;
726
727out_bad_surface:
728 /**
729 * FIXME: May deadlock here when called from the
730 * command parsing code.
731 */
732
733 ttm_base_object_unref(&base);
743 return ret; 734 return ret;
744} 735}
745 736
diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h
index 27ae750ca878..bf31592eaf79 100644
--- a/drivers/hid/hid-lg.h
+++ b/drivers/hid/hid-lg.h
@@ -1,8 +1,6 @@
1#ifndef __HID_LG_H 1#ifndef __HID_LG_H
2#define __HID_LG_H 2#define __HID_LG_H
3 3
4#include <linux/autoconf.h>
5
6#ifdef CONFIG_LOGITECH_FF 4#ifdef CONFIG_LOGITECH_FF
7int lgff_init(struct hid_device *hdev); 5int lgff_init(struct hid_device *hdev);
8#else 6#else
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 95ccbe377f9c..68cf87749a42 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -228,6 +228,18 @@ config SENSORS_K8TEMP
228 This driver can also be built as a module. If so, the module 228 This driver can also be built as a module. If so, the module
229 will be called k8temp. 229 will be called k8temp.
230 230
231config SENSORS_K10TEMP
232 tristate "AMD Phenom/Sempron/Turion/Opteron temperature sensor"
233 depends on X86 && PCI
234 help
235 If you say yes here you get support for the temperature
236 sensor(s) inside your CPU. Supported are later revisions of
237 the AMD Family 10h and all revisions of the AMD Family 11h
238 microarchitectures.
239
240 This driver can also be built as a module. If so, the module
241 will be called k10temp.
242
231config SENSORS_AMS 243config SENSORS_AMS
232 tristate "Apple Motion Sensor driver" 244 tristate "Apple Motion Sensor driver"
233 depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL 245 depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL
@@ -380,7 +392,7 @@ config SENSORS_GL520SM
380 392
381config SENSORS_CORETEMP 393config SENSORS_CORETEMP
382 tristate "Intel Core/Core2/Atom temperature sensor" 394 tristate "Intel Core/Core2/Atom temperature sensor"
383 depends on X86 && EXPERIMENTAL 395 depends on X86 && PCI && EXPERIMENTAL
384 help 396 help
385 If you say yes here you get support for the temperature 397 If you say yes here you get support for the temperature
386 sensor inside your CPU. Most of the family 6 CPUs 398 sensor inside your CPU. Most of the family 6 CPUs
@@ -780,6 +792,16 @@ config SENSORS_ADS7828
780 This driver can also be built as a module. If so, the module 792 This driver can also be built as a module. If so, the module
781 will be called ads7828. 793 will be called ads7828.
782 794
795config SENSORS_AMC6821
796 tristate "Texas Instruments AMC6821"
797 depends on I2C && EXPERIMENTAL
798 help
799 If you say yes here you get support for the Texas Instruments
800 AMC6821 hardware monitoring chips.
801
802 This driver can also be build as a module. If so, the module
803 will be called amc6821.
804
783config SENSORS_THMC50 805config SENSORS_THMC50
784 tristate "Texas Instruments THMC50 / Analog Devices ADM1022" 806 tristate "Texas Instruments THMC50 / Analog Devices ADM1022"
785 depends on I2C && EXPERIMENTAL 807 depends on I2C && EXPERIMENTAL
@@ -810,6 +832,14 @@ config SENSORS_TMP421
810 This driver can also be built as a module. If so, the module 832 This driver can also be built as a module. If so, the module
811 will be called tmp421. 833 will be called tmp421.
812 834
835config SENSORS_VIA_CPUTEMP
836 tristate "VIA CPU temperature sensor"
837 depends on X86
838 help
839 If you say yes here you get support for the temperature
840 sensor inside your CPU. Supported are all known variants of
841 the VIA C7 and Nano.
842
813config SENSORS_VIA686A 843config SENSORS_VIA686A
814 tristate "VIA686A" 844 tristate "VIA686A"
815 depends on PCI 845 depends on PCI
@@ -998,6 +1028,23 @@ config SENSORS_LIS3_SPI
998 will be called lis3lv02d and a specific module for the SPI transport 1028 will be called lis3lv02d and a specific module for the SPI transport
999 is called lis3lv02d_spi. 1029 is called lis3lv02d_spi.
1000 1030
1031config SENSORS_LIS3_I2C
1032 tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (I2C)"
1033 depends on I2C && INPUT
1034 select INPUT_POLLDEV
1035 default n
1036 help
1037 This driver provides support for the LIS3LV02Dx accelerometer connected
1038 via I2C. The accelerometer data is readable via
1039 /sys/devices/platform/lis3lv02d.
1040
1041 This driver also provides an absolute input class device, allowing
1042 the device to act as a pinball machine-esque joystick.
1043
1044 This driver can also be built as modules. If so, the core module
1045 will be called lis3lv02d and a specific module for the I2C transport
1046 is called lis3lv02d_i2c.
1047
1001config SENSORS_APPLESMC 1048config SENSORS_APPLESMC
1002 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" 1049 tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)"
1003 depends on INPUT && X86 1050 depends on INPUT && X86
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 33c2ee105284..4bc215c0953f 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -53,8 +53,10 @@ obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o
53obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o 53obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o
54obj-$(CONFIG_SENSORS_IT87) += it87.o 54obj-$(CONFIG_SENSORS_IT87) += it87.o
55obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o 55obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o
56obj-$(CONFIG_SENSORS_K10TEMP) += k10temp.o
56obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o 57obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o
57obj-$(CONFIG_SENSORS_LIS3_SPI) += lis3lv02d.o lis3lv02d_spi.o 58obj-$(CONFIG_SENSORS_LIS3_SPI) += lis3lv02d.o lis3lv02d_spi.o
59obj-$(CONFIG_SENSORS_LIS3_I2C) += lis3lv02d.o lis3lv02d_i2c.o
58obj-$(CONFIG_SENSORS_LM63) += lm63.o 60obj-$(CONFIG_SENSORS_LM63) += lm63.o
59obj-$(CONFIG_SENSORS_LM70) += lm70.o 61obj-$(CONFIG_SENSORS_LM70) += lm70.o
60obj-$(CONFIG_SENSORS_LM73) += lm73.o 62obj-$(CONFIG_SENSORS_LM73) += lm73.o
@@ -84,9 +86,11 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
84obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o 86obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
85obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o 87obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
86obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o 88obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
89obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o
87obj-$(CONFIG_SENSORS_THMC50) += thmc50.o 90obj-$(CONFIG_SENSORS_THMC50) += thmc50.o
88obj-$(CONFIG_SENSORS_TMP401) += tmp401.o 91obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
89obj-$(CONFIG_SENSORS_TMP421) += tmp421.o 92obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
93obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
90obj-$(CONFIG_SENSORS_VIA686A) += via686a.o 94obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
91obj-$(CONFIG_SENSORS_VT1211) += vt1211.o 95obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
92obj-$(CONFIG_SENSORS_VT8231) += vt8231.o 96obj-$(CONFIG_SENSORS_VT8231) += vt8231.o
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index a1a7ef14b519..a31e77c776ae 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -94,7 +94,7 @@ static const unsigned short normal_i2c[] = { 0x58, 0x5C, I2C_CLIENT_END };
94#define ADT7462_PIN24_SHIFT 6 94#define ADT7462_PIN24_SHIFT 6
95#define ADT7462_PIN26_VOLT_INPUT 0x08 95#define ADT7462_PIN26_VOLT_INPUT 0x08
96#define ADT7462_PIN25_VOLT_INPUT 0x20 96#define ADT7462_PIN25_VOLT_INPUT 0x20
97#define ADT7462_PIN28_SHIFT 6 /* cfg3 */ 97#define ADT7462_PIN28_SHIFT 4 /* cfg3 */
98#define ADT7462_PIN28_VOLT 0x5 98#define ADT7462_PIN28_VOLT 0x5
99 99
100#define ADT7462_REG_ALARM1 0xB8 100#define ADT7462_REG_ALARM1 0xB8
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
new file mode 100644
index 000000000000..1c89d922d619
--- /dev/null
+++ b/drivers/hwmon/amc6821.c
@@ -0,0 +1,1116 @@
1/*
2 amc6821.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring
4 Copyright (C) 2009 T. Mertelj <tomaz.mertelj@guest.arnes.si>
5
6 Based on max6650.c:
7 Copyright (C) 2007 Hans J. Koch <hjk@linutronix.de>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/
23
24
25#include <linux/kernel.h> /* Needed for KERN_INFO */
26#include <linux/module.h>
27#include <linux/init.h>
28#include <linux/slab.h>
29#include <linux/jiffies.h>
30#include <linux/i2c.h>
31#include <linux/hwmon.h>
32#include <linux/hwmon-sysfs.h>
33#include <linux/err.h>
34#include <linux/mutex.h>
35
36
37/*
38 * Addresses to scan.
39 */
40
41static const unsigned short normal_i2c[] = {0x18, 0x19, 0x1a, 0x2c, 0x2d, 0x2e,
42 0x4c, 0x4d, 0x4e, I2C_CLIENT_END};
43
44
45
46/*
47 * Insmod parameters
48 */
49
50static int pwminv = 0; /*Inverted PWM output. */
51module_param(pwminv, int, S_IRUGO);
52
53static int init = 1; /*Power-on initialization.*/
54module_param(init, int, S_IRUGO);
55
56
57enum chips { amc6821 };
58
59#define AMC6821_REG_DEV_ID 0x3D
60#define AMC6821_REG_COMP_ID 0x3E
61#define AMC6821_REG_CONF1 0x00
62#define AMC6821_REG_CONF2 0x01
63#define AMC6821_REG_CONF3 0x3F
64#define AMC6821_REG_CONF4 0x04
65#define AMC6821_REG_STAT1 0x02
66#define AMC6821_REG_STAT2 0x03
67#define AMC6821_REG_TDATA_LOW 0x08
68#define AMC6821_REG_TDATA_HI 0x09
69#define AMC6821_REG_LTEMP_HI 0x0A
70#define AMC6821_REG_RTEMP_HI 0x0B
71#define AMC6821_REG_LTEMP_LIMIT_MIN 0x15
72#define AMC6821_REG_LTEMP_LIMIT_MAX 0x14
73#define AMC6821_REG_RTEMP_LIMIT_MIN 0x19
74#define AMC6821_REG_RTEMP_LIMIT_MAX 0x18
75#define AMC6821_REG_LTEMP_CRIT 0x1B
76#define AMC6821_REG_RTEMP_CRIT 0x1D
77#define AMC6821_REG_PSV_TEMP 0x1C
78#define AMC6821_REG_DCY 0x22
79#define AMC6821_REG_LTEMP_FAN_CTRL 0x24
80#define AMC6821_REG_RTEMP_FAN_CTRL 0x25
81#define AMC6821_REG_DCY_LOW_TEMP 0x21
82
83#define AMC6821_REG_TACH_LLIMITL 0x10
84#define AMC6821_REG_TACH_LLIMITH 0x11
85#define AMC6821_REG_TACH_HLIMITL 0x12
86#define AMC6821_REG_TACH_HLIMITH 0x13
87
88#define AMC6821_CONF1_START 0x01
89#define AMC6821_CONF1_FAN_INT_EN 0x02
90#define AMC6821_CONF1_FANIE 0x04
91#define AMC6821_CONF1_PWMINV 0x08
92#define AMC6821_CONF1_FAN_FAULT_EN 0x10
93#define AMC6821_CONF1_FDRC0 0x20
94#define AMC6821_CONF1_FDRC1 0x40
95#define AMC6821_CONF1_THERMOVIE 0x80
96
97#define AMC6821_CONF2_PWM_EN 0x01
98#define AMC6821_CONF2_TACH_MODE 0x02
99#define AMC6821_CONF2_TACH_EN 0x04
100#define AMC6821_CONF2_RTFIE 0x08
101#define AMC6821_CONF2_LTOIE 0x10
102#define AMC6821_CONF2_RTOIE 0x20
103#define AMC6821_CONF2_PSVIE 0x40
104#define AMC6821_CONF2_RST 0x80
105
106#define AMC6821_CONF3_THERM_FAN_EN 0x80
107#define AMC6821_CONF3_REV_MASK 0x0F
108
109#define AMC6821_CONF4_OVREN 0x10
110#define AMC6821_CONF4_TACH_FAST 0x20
111#define AMC6821_CONF4_PSPR 0x40
112#define AMC6821_CONF4_MODE 0x80
113
114#define AMC6821_STAT1_RPM_ALARM 0x01
115#define AMC6821_STAT1_FANS 0x02
116#define AMC6821_STAT1_RTH 0x04
117#define AMC6821_STAT1_RTL 0x08
118#define AMC6821_STAT1_R_THERM 0x10
119#define AMC6821_STAT1_RTF 0x20
120#define AMC6821_STAT1_LTH 0x40
121#define AMC6821_STAT1_LTL 0x80
122
123#define AMC6821_STAT2_RTC 0x08
124#define AMC6821_STAT2_LTC 0x10
125#define AMC6821_STAT2_LPSV 0x20
126#define AMC6821_STAT2_L_THERM 0x40
127#define AMC6821_STAT2_THERM_IN 0x80
128
129enum {IDX_TEMP1_INPUT = 0, IDX_TEMP1_MIN, IDX_TEMP1_MAX,
130 IDX_TEMP1_CRIT, IDX_TEMP2_INPUT, IDX_TEMP2_MIN,
131 IDX_TEMP2_MAX, IDX_TEMP2_CRIT,
132 TEMP_IDX_LEN, };
133
134static const u8 temp_reg[] = {AMC6821_REG_LTEMP_HI,
135 AMC6821_REG_LTEMP_LIMIT_MIN,
136 AMC6821_REG_LTEMP_LIMIT_MAX,
137 AMC6821_REG_LTEMP_CRIT,
138 AMC6821_REG_RTEMP_HI,
139 AMC6821_REG_RTEMP_LIMIT_MIN,
140 AMC6821_REG_RTEMP_LIMIT_MAX,
141 AMC6821_REG_RTEMP_CRIT, };
142
143enum {IDX_FAN1_INPUT = 0, IDX_FAN1_MIN, IDX_FAN1_MAX,
144 FAN1_IDX_LEN, };
145
146static const u8 fan_reg_low[] = {AMC6821_REG_TDATA_LOW,
147 AMC6821_REG_TACH_LLIMITL,
148 AMC6821_REG_TACH_HLIMITL, };
149
150
151static const u8 fan_reg_hi[] = {AMC6821_REG_TDATA_HI,
152 AMC6821_REG_TACH_LLIMITH,
153 AMC6821_REG_TACH_HLIMITH, };
154
155static int amc6821_probe(
156 struct i2c_client *client,
157 const struct i2c_device_id *id);
158static int amc6821_detect(
159 struct i2c_client *client,
160 struct i2c_board_info *info);
161static int amc6821_init_client(struct i2c_client *client);
162static int amc6821_remove(struct i2c_client *client);
163static struct amc6821_data *amc6821_update_device(struct device *dev);
164
165/*
166 * Driver data (common to all clients)
167 */
168
169static const struct i2c_device_id amc6821_id[] = {
170 { "amc6821", amc6821 },
171 { }
172};
173
174MODULE_DEVICE_TABLE(i2c, amc6821_id);
175
176static struct i2c_driver amc6821_driver = {
177 .class = I2C_CLASS_HWMON,
178 .driver = {
179 .name = "amc6821",
180 },
181 .probe = amc6821_probe,
182 .remove = amc6821_remove,
183 .id_table = amc6821_id,
184 .detect = amc6821_detect,
185 .address_list = normal_i2c,
186};
187
188
189/*
190 * Client data (each client gets its own)
191 */
192
193struct amc6821_data {
194 struct device *hwmon_dev;
195 struct mutex update_lock;
196 char valid; /* zero until following fields are valid */
197 unsigned long last_updated; /* in jiffies */
198
199 /* register values */
200 int temp[TEMP_IDX_LEN];
201
202 u16 fan[FAN1_IDX_LEN];
203 u8 fan1_div;
204
205 u8 pwm1;
206 u8 temp1_auto_point_temp[3];
207 u8 temp2_auto_point_temp[3];
208 u8 pwm1_auto_point_pwm[3];
209 u8 pwm1_enable;
210 u8 pwm1_auto_channels_temp;
211
212 u8 stat1;
213 u8 stat2;
214};
215
216
217static ssize_t get_temp(
218 struct device *dev,
219 struct device_attribute *devattr,
220 char *buf)
221{
222 struct amc6821_data *data = amc6821_update_device(dev);
223 int ix = to_sensor_dev_attr(devattr)->index;
224
225 return sprintf(buf, "%d\n", data->temp[ix] * 1000);
226}
227
228
229
230static ssize_t set_temp(
231 struct device *dev,
232 struct device_attribute *attr,
233 const char *buf,
234 size_t count)
235{
236 struct i2c_client *client = to_i2c_client(dev);
237 struct amc6821_data *data = i2c_get_clientdata(client);
238 int ix = to_sensor_dev_attr(attr)->index;
239 long val;
240
241 int ret = strict_strtol(buf, 10, &val);
242 if (ret)
243 return ret;
244 val = SENSORS_LIMIT(val / 1000, -128, 127);
245
246 mutex_lock(&data->update_lock);
247 data->temp[ix] = val;
248 if (i2c_smbus_write_byte_data(client, temp_reg[ix], data->temp[ix])) {
249 dev_err(&client->dev, "Register write error, aborting.\n");
250 count = -EIO;
251 }
252 mutex_unlock(&data->update_lock);
253 return count;
254}
255
256
257
258
259static ssize_t get_temp_alarm(
260 struct device *dev,
261 struct device_attribute *devattr,
262 char *buf)
263{
264 struct amc6821_data *data = amc6821_update_device(dev);
265 int ix = to_sensor_dev_attr(devattr)->index;
266 u8 flag;
267
268 switch (ix) {
269 case IDX_TEMP1_MIN:
270 flag = data->stat1 & AMC6821_STAT1_LTL;
271 break;
272 case IDX_TEMP1_MAX:
273 flag = data->stat1 & AMC6821_STAT1_LTH;
274 break;
275 case IDX_TEMP1_CRIT:
276 flag = data->stat2 & AMC6821_STAT2_LTC;
277 break;
278 case IDX_TEMP2_MIN:
279 flag = data->stat1 & AMC6821_STAT1_RTL;
280 break;
281 case IDX_TEMP2_MAX:
282 flag = data->stat1 & AMC6821_STAT1_RTH;
283 break;
284 case IDX_TEMP2_CRIT:
285 flag = data->stat2 & AMC6821_STAT2_RTC;
286 break;
287 default:
288 dev_dbg(dev, "Unknown attr->index (%d).\n", ix);
289 return -EINVAL;
290 }
291 if (flag)
292 return sprintf(buf, "1");
293 else
294 return sprintf(buf, "0");
295}
296
297
298
299
300static ssize_t get_temp2_fault(
301 struct device *dev,
302 struct device_attribute *devattr,
303 char *buf)
304{
305 struct amc6821_data *data = amc6821_update_device(dev);
306 if (data->stat1 & AMC6821_STAT1_RTF)
307 return sprintf(buf, "1");
308 else
309 return sprintf(buf, "0");
310}
311
312static ssize_t get_pwm1(
313 struct device *dev,
314 struct device_attribute *devattr,
315 char *buf)
316{
317 struct amc6821_data *data = amc6821_update_device(dev);
318 return sprintf(buf, "%d\n", data->pwm1);
319}
320
321static ssize_t set_pwm1(
322 struct device *dev,
323 struct device_attribute *devattr,
324 const char *buf,
325 size_t count)
326{
327 struct i2c_client *client = to_i2c_client(dev);
328 struct amc6821_data *data = i2c_get_clientdata(client);
329 long val;
330 int ret = strict_strtol(buf, 10, &val);
331 if (ret)
332 return ret;
333
334 mutex_lock(&data->update_lock);
335 data->pwm1 = SENSORS_LIMIT(val , 0, 255);
336 i2c_smbus_write_byte_data(client, AMC6821_REG_DCY, data->pwm1);
337 mutex_unlock(&data->update_lock);
338 return count;
339}
340
341static ssize_t get_pwm1_enable(
342 struct device *dev,
343 struct device_attribute *devattr,
344 char *buf)
345{
346 struct amc6821_data *data = amc6821_update_device(dev);
347 return sprintf(buf, "%d\n", data->pwm1_enable);
348}
349
350static ssize_t set_pwm1_enable(
351 struct device *dev,
352 struct device_attribute *attr,
353 const char *buf,
354 size_t count)
355{
356 struct i2c_client *client = to_i2c_client(dev);
357 struct amc6821_data *data = i2c_get_clientdata(client);
358 long val;
359 int config = strict_strtol(buf, 10, &val);
360 if (config)
361 return config;
362
363 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1);
364 if (config < 0) {
365 dev_err(&client->dev,
366 "Error reading configuration register, aborting.\n");
367 return -EIO;
368 }
369
370 switch (val) {
371 case 1:
372 config &= ~AMC6821_CONF1_FDRC0;
373 config &= ~AMC6821_CONF1_FDRC1;
374 break;
375 case 2:
376 config &= ~AMC6821_CONF1_FDRC0;
377 config |= AMC6821_CONF1_FDRC1;
378 break;
379 case 3:
380 config |= AMC6821_CONF1_FDRC0;
381 config |= AMC6821_CONF1_FDRC1;
382 break;
383 default:
384 return -EINVAL;
385 }
386 mutex_lock(&data->update_lock);
387 if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF1, config)) {
388 dev_err(&client->dev,
389 "Configuration register write error, aborting.\n");
390 count = -EIO;
391 }
392 mutex_unlock(&data->update_lock);
393 return count;
394}
395
396
397static ssize_t get_pwm1_auto_channels_temp(
398 struct device *dev,
399 struct device_attribute *devattr,
400 char *buf)
401{
402 struct amc6821_data *data = amc6821_update_device(dev);
403 return sprintf(buf, "%d\n", data->pwm1_auto_channels_temp);
404}
405
406
407static ssize_t get_temp_auto_point_temp(
408 struct device *dev,
409 struct device_attribute *devattr,
410 char *buf)
411{
412 int ix = to_sensor_dev_attr_2(devattr)->index;
413 int nr = to_sensor_dev_attr_2(devattr)->nr;
414 struct amc6821_data *data = amc6821_update_device(dev);
415 switch (nr) {
416 case 1:
417 return sprintf(buf, "%d\n",
418 data->temp1_auto_point_temp[ix] * 1000);
419 break;
420 case 2:
421 return sprintf(buf, "%d\n",
422 data->temp2_auto_point_temp[ix] * 1000);
423 break;
424 default:
425 dev_dbg(dev, "Unknown attr->nr (%d).\n", nr);
426 return -EINVAL;
427 }
428}
429
430
431static ssize_t get_pwm1_auto_point_pwm(
432 struct device *dev,
433 struct device_attribute *devattr,
434 char *buf)
435{
436 int ix = to_sensor_dev_attr(devattr)->index;
437 struct amc6821_data *data = amc6821_update_device(dev);
438 return sprintf(buf, "%d\n", data->pwm1_auto_point_pwm[ix]);
439}
440
441
442static inline ssize_t set_slope_register(struct i2c_client *client,
443 u8 reg,
444 u8 dpwm,
445 u8 *ptemp)
446{
447 int dt;
448 u8 tmp;
449
450 dt = ptemp[2]-ptemp[1];
451 for (tmp = 4; tmp > 0; tmp--) {
452 if (dt * (0x20 >> tmp) >= dpwm)
453 break;
454 }
455 tmp |= (ptemp[1] & 0x7C) << 1;
456 if (i2c_smbus_write_byte_data(client,
457 reg, tmp)) {
458 dev_err(&client->dev, "Register write error, aborting.\n");
459 return -EIO;
460 }
461 return 0;
462}
463
464
465
466static ssize_t set_temp_auto_point_temp(
467 struct device *dev,
468 struct device_attribute *attr,
469 const char *buf,
470 size_t count)
471{
472 struct i2c_client *client = to_i2c_client(dev);
473 struct amc6821_data *data = amc6821_update_device(dev);
474 int ix = to_sensor_dev_attr_2(attr)->index;
475 int nr = to_sensor_dev_attr_2(attr)->nr;
476 u8 *ptemp;
477 u8 reg;
478 int dpwm;
479 long val;
480 int ret = strict_strtol(buf, 10, &val);
481 if (ret)
482 return ret;
483
484 switch (nr) {
485 case 1:
486 ptemp = data->temp1_auto_point_temp;
487 reg = AMC6821_REG_LTEMP_FAN_CTRL;
488 break;
489 case 2:
490 ptemp = data->temp2_auto_point_temp;
491 reg = AMC6821_REG_RTEMP_FAN_CTRL;
492 break;
493 default:
494 dev_dbg(dev, "Unknown attr->nr (%d).\n", nr);
495 return -EINVAL;
496 }
497
498 data->valid = 0;
499 mutex_lock(&data->update_lock);
500 switch (ix) {
501 case 0:
502 ptemp[0] = SENSORS_LIMIT(val / 1000, 0,
503 data->temp1_auto_point_temp[1]);
504 ptemp[0] = SENSORS_LIMIT(ptemp[0], 0,
505 data->temp2_auto_point_temp[1]);
506 ptemp[0] = SENSORS_LIMIT(ptemp[0], 0, 63);
507 if (i2c_smbus_write_byte_data(
508 client,
509 AMC6821_REG_PSV_TEMP,
510 ptemp[0])) {
511 dev_err(&client->dev,
512 "Register write error, aborting.\n");
513 count = -EIO;
514 }
515 goto EXIT;
516 break;
517 case 1:
518 ptemp[1] = SENSORS_LIMIT(
519 val / 1000,
520 (ptemp[0] & 0x7C) + 4,
521 124);
522 ptemp[1] &= 0x7C;
523 ptemp[2] = SENSORS_LIMIT(
524 ptemp[2], ptemp[1] + 1,
525 255);
526 break;
527 case 2:
528 ptemp[2] = SENSORS_LIMIT(
529 val / 1000,
530 ptemp[1]+1,
531 255);
532 break;
533 default:
534 dev_dbg(dev, "Unknown attr->index (%d).\n", ix);
535 count = -EINVAL;
536 goto EXIT;
537 }
538 dpwm = data->pwm1_auto_point_pwm[2] - data->pwm1_auto_point_pwm[1];
539 if (set_slope_register(client, reg, dpwm, ptemp))
540 count = -EIO;
541
542EXIT:
543 mutex_unlock(&data->update_lock);
544 return count;
545}
546
547
548
549static ssize_t set_pwm1_auto_point_pwm(
550 struct device *dev,
551 struct device_attribute *attr,
552 const char *buf,
553 size_t count)
554{
555 struct i2c_client *client = to_i2c_client(dev);
556 struct amc6821_data *data = i2c_get_clientdata(client);
557 int dpwm;
558 long val;
559 int ret = strict_strtol(buf, 10, &val);
560 if (ret)
561 return ret;
562
563 mutex_lock(&data->update_lock);
564 data->pwm1_auto_point_pwm[1] = SENSORS_LIMIT(val, 0, 254);
565 if (i2c_smbus_write_byte_data(client, AMC6821_REG_DCY_LOW_TEMP,
566 data->pwm1_auto_point_pwm[1])) {
567 dev_err(&client->dev, "Register write error, aborting.\n");
568 count = -EIO;
569 goto EXIT;
570 }
571 dpwm = data->pwm1_auto_point_pwm[2] - data->pwm1_auto_point_pwm[1];
572 if (set_slope_register(client, AMC6821_REG_LTEMP_FAN_CTRL, dpwm,
573 data->temp1_auto_point_temp)) {
574 count = -EIO;
575 goto EXIT;
576 }
577 if (set_slope_register(client, AMC6821_REG_RTEMP_FAN_CTRL, dpwm,
578 data->temp2_auto_point_temp)) {
579 count = -EIO;
580 goto EXIT;
581 }
582
583EXIT:
584 data->valid = 0;
585 mutex_unlock(&data->update_lock);
586 return count;
587}
588
589static ssize_t get_fan(
590 struct device *dev,
591 struct device_attribute *devattr,
592 char *buf)
593{
594 struct amc6821_data *data = amc6821_update_device(dev);
595 int ix = to_sensor_dev_attr(devattr)->index;
596 if (0 == data->fan[ix])
597 return sprintf(buf, "0");
598 return sprintf(buf, "%d\n", (int)(6000000 / data->fan[ix]));
599}
600
601
602
603static ssize_t get_fan1_fault(
604 struct device *dev,
605 struct device_attribute *devattr,
606 char *buf)
607{
608 struct amc6821_data *data = amc6821_update_device(dev);
609 if (data->stat1 & AMC6821_STAT1_FANS)
610 return sprintf(buf, "1");
611 else
612 return sprintf(buf, "0");
613}
614
615
616
617static ssize_t set_fan(
618 struct device *dev,
619 struct device_attribute *attr,
620 const char *buf, size_t count)
621{
622 struct i2c_client *client = to_i2c_client(dev);
623 struct amc6821_data *data = i2c_get_clientdata(client);
624 long val;
625 int ix = to_sensor_dev_attr(attr)->index;
626 int ret = strict_strtol(buf, 10, &val);
627 if (ret)
628 return ret;
629 val = 1 > val ? 0xFFFF : 6000000/val;
630
631 mutex_lock(&data->update_lock);
632 data->fan[ix] = (u16) SENSORS_LIMIT(val, 1, 0xFFFF);
633 if (i2c_smbus_write_byte_data(client, fan_reg_low[ix],
634 data->fan[ix] & 0xFF)) {
635 dev_err(&client->dev, "Register write error, aborting.\n");
636 count = -EIO;
637 goto EXIT;
638 }
639 if (i2c_smbus_write_byte_data(client,
640 fan_reg_hi[ix], data->fan[ix] >> 8)) {
641 dev_err(&client->dev, "Register write error, aborting.\n");
642 count = -EIO;
643 }
644EXIT:
645 mutex_unlock(&data->update_lock);
646 return count;
647}
648
649
650
651static ssize_t get_fan1_div(
652 struct device *dev,
653 struct device_attribute *devattr,
654 char *buf)
655{
656 struct amc6821_data *data = amc6821_update_device(dev);
657 return sprintf(buf, "%d\n", data->fan1_div);
658}
659
660static ssize_t set_fan1_div(
661 struct device *dev,
662 struct device_attribute *attr,
663 const char *buf, size_t count)
664{
665 struct i2c_client *client = to_i2c_client(dev);
666 struct amc6821_data *data = i2c_get_clientdata(client);
667 long val;
668 int config = strict_strtol(buf, 10, &val);
669 if (config)
670 return config;
671
672 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4);
673 if (config < 0) {
674 dev_err(&client->dev,
675 "Error reading configuration register, aborting.\n");
676 return -EIO;
677 }
678 mutex_lock(&data->update_lock);
679 switch (val) {
680 case 2:
681 config &= ~AMC6821_CONF4_PSPR;
682 data->fan1_div = 2;
683 break;
684 case 4:
685 config |= AMC6821_CONF4_PSPR;
686 data->fan1_div = 4;
687 break;
688 default:
689 mutex_unlock(&data->update_lock);
690 count = -EINVAL;
691 goto EXIT;
692 }
693 if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF4, config)) {
694 dev_err(&client->dev,
695 "Configuration register write error, aborting.\n");
696 count = -EIO;
697 }
698EXIT:
699 mutex_unlock(&data->update_lock);
700 return count;
701}
702
703
704
705static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO,
706 get_temp, NULL, IDX_TEMP1_INPUT);
707static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, get_temp,
708 set_temp, IDX_TEMP1_MIN);
709static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, get_temp,
710 set_temp, IDX_TEMP1_MAX);
711static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO | S_IWUSR, get_temp,
712 set_temp, IDX_TEMP1_CRIT);
713static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO,
714 get_temp_alarm, NULL, IDX_TEMP1_MIN);
715static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO,
716 get_temp_alarm, NULL, IDX_TEMP1_MAX);
717static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO,
718 get_temp_alarm, NULL, IDX_TEMP1_CRIT);
719static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR,
720 get_temp, NULL, IDX_TEMP2_INPUT);
721static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp,
722 set_temp, IDX_TEMP2_MIN);
723static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO | S_IWUSR, get_temp,
724 set_temp, IDX_TEMP2_MAX);
725static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO | S_IWUSR, get_temp,
726 set_temp, IDX_TEMP2_CRIT);
727static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO,
728 get_temp2_fault, NULL, 0);
729static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO,
730 get_temp_alarm, NULL, IDX_TEMP2_MIN);
731static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO,
732 get_temp_alarm, NULL, IDX_TEMP2_MAX);
733static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO,
734 get_temp_alarm, NULL, IDX_TEMP2_CRIT);
735static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, get_fan, NULL, IDX_FAN1_INPUT);
736static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO | S_IWUSR,
737 get_fan, set_fan, IDX_FAN1_MIN);
738static SENSOR_DEVICE_ATTR(fan1_max, S_IRUGO | S_IWUSR,
739 get_fan, set_fan, IDX_FAN1_MAX);
740static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, get_fan1_fault, NULL, 0);
741static SENSOR_DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR,
742 get_fan1_div, set_fan1_div, 0);
743
744static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, get_pwm1, set_pwm1, 0);
745static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
746 get_pwm1_enable, set_pwm1_enable, 0);
747static SENSOR_DEVICE_ATTR(pwm1_auto_point1_pwm, S_IRUGO,
748 get_pwm1_auto_point_pwm, NULL, 0);
749static SENSOR_DEVICE_ATTR(pwm1_auto_point2_pwm, S_IWUSR | S_IRUGO,
750 get_pwm1_auto_point_pwm, set_pwm1_auto_point_pwm, 1);
751static SENSOR_DEVICE_ATTR(pwm1_auto_point3_pwm, S_IRUGO,
752 get_pwm1_auto_point_pwm, NULL, 2);
753static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IRUGO,
754 get_pwm1_auto_channels_temp, NULL, 0);
755static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO,
756 get_temp_auto_point_temp, NULL, 1, 0);
757static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IWUSR | S_IRUGO,
758 get_temp_auto_point_temp, set_temp_auto_point_temp, 1, 1);
759static SENSOR_DEVICE_ATTR_2(temp1_auto_point3_temp, S_IWUSR | S_IRUGO,
760 get_temp_auto_point_temp, set_temp_auto_point_temp, 1, 2);
761
762static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IWUSR | S_IRUGO,
763 get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 0);
764static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IWUSR | S_IRUGO,
765 get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 1);
766static SENSOR_DEVICE_ATTR_2(temp2_auto_point3_temp, S_IWUSR | S_IRUGO,
767 get_temp_auto_point_temp, set_temp_auto_point_temp, 2, 2);
768
769
770
771static struct attribute *amc6821_attrs[] = {
772 &sensor_dev_attr_temp1_input.dev_attr.attr,
773 &sensor_dev_attr_temp1_min.dev_attr.attr,
774 &sensor_dev_attr_temp1_max.dev_attr.attr,
775 &sensor_dev_attr_temp1_crit.dev_attr.attr,
776 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
777 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
778 &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
779 &sensor_dev_attr_temp2_input.dev_attr.attr,
780 &sensor_dev_attr_temp2_min.dev_attr.attr,
781 &sensor_dev_attr_temp2_max.dev_attr.attr,
782 &sensor_dev_attr_temp2_crit.dev_attr.attr,
783 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
784 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
785 &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr,
786 &sensor_dev_attr_temp2_fault.dev_attr.attr,
787 &sensor_dev_attr_fan1_input.dev_attr.attr,
788 &sensor_dev_attr_fan1_min.dev_attr.attr,
789 &sensor_dev_attr_fan1_max.dev_attr.attr,
790 &sensor_dev_attr_fan1_fault.dev_attr.attr,
791 &sensor_dev_attr_fan1_div.dev_attr.attr,
792 &sensor_dev_attr_pwm1.dev_attr.attr,
793 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
794 &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr,
795 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
796 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
797 &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr,
798 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
799 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
800 &sensor_dev_attr_temp1_auto_point3_temp.dev_attr.attr,
801 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
802 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
803 &sensor_dev_attr_temp2_auto_point3_temp.dev_attr.attr,
804 NULL
805};
806
807static struct attribute_group amc6821_attr_grp = {
808 .attrs = amc6821_attrs,
809};
810
811
812
813/* Return 0 if detection is successful, -ENODEV otherwise */
814static int amc6821_detect(
815 struct i2c_client *client,
816 struct i2c_board_info *info)
817{
818 struct i2c_adapter *adapter = client->adapter;
819 int address = client->addr;
820 int dev_id, comp_id;
821
822 dev_dbg(&adapter->dev, "amc6821_detect called.\n");
823
824 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
825 dev_dbg(&adapter->dev,
826 "amc6821: I2C bus doesn't support byte mode, "
827 "skipping.\n");
828 return -ENODEV;
829 }
830
831 dev_id = i2c_smbus_read_byte_data(client, AMC6821_REG_DEV_ID);
832 comp_id = i2c_smbus_read_byte_data(client, AMC6821_REG_COMP_ID);
833 if (dev_id != 0x21 || comp_id != 0x49) {
834 dev_dbg(&adapter->dev,
835 "amc6821: detection failed at 0x%02x.\n",
836 address);
837 return -ENODEV;
838 }
839
840 /* Bit 7 of the address register is ignored, so we can check the
841 ID registers again */
842 dev_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_DEV_ID);
843 comp_id = i2c_smbus_read_byte_data(client, 0x80 | AMC6821_REG_COMP_ID);
844 if (dev_id != 0x21 || comp_id != 0x49) {
845 dev_dbg(&adapter->dev,
846 "amc6821: detection failed at 0x%02x.\n",
847 address);
848 return -ENODEV;
849 }
850
851 dev_info(&adapter->dev, "amc6821: chip found at 0x%02x.\n", address);
852 strlcpy(info->type, "amc6821", I2C_NAME_SIZE);
853
854 return 0;
855}
856
857static int amc6821_probe(
858 struct i2c_client *client,
859 const struct i2c_device_id *id)
860{
861 struct amc6821_data *data;
862 int err;
863
864 data = kzalloc(sizeof(struct amc6821_data), GFP_KERNEL);
865 if (!data) {
866 dev_err(&client->dev, "out of memory.\n");
867 return -ENOMEM;
868 }
869
870
871 i2c_set_clientdata(client, data);
872 mutex_init(&data->update_lock);
873
874 /*
875 * Initialize the amc6821 chip
876 */
877 err = amc6821_init_client(client);
878 if (err)
879 goto err_free;
880
881 err = sysfs_create_group(&client->dev.kobj, &amc6821_attr_grp);
882 if (err)
883 goto err_free;
884
885 data->hwmon_dev = hwmon_device_register(&client->dev);
886 if (!IS_ERR(data->hwmon_dev))
887 return 0;
888
889 err = PTR_ERR(data->hwmon_dev);
890 dev_err(&client->dev, "error registering hwmon device.\n");
891 sysfs_remove_group(&client->dev.kobj, &amc6821_attr_grp);
892err_free:
893 kfree(data);
894 return err;
895}
896
897static int amc6821_remove(struct i2c_client *client)
898{
899 struct amc6821_data *data = i2c_get_clientdata(client);
900
901 hwmon_device_unregister(data->hwmon_dev);
902 sysfs_remove_group(&client->dev.kobj, &amc6821_attr_grp);
903
904 kfree(data);
905
906 return 0;
907}
908
909
910static int amc6821_init_client(struct i2c_client *client)
911{
912 int config;
913 int err = -EIO;
914
915 if (init) {
916 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4);
917
918 if (config < 0) {
919 dev_err(&client->dev,
920 "Error reading configuration register, aborting.\n");
921 return err;
922 }
923
924 config |= AMC6821_CONF4_MODE;
925
926 if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF4,
927 config)) {
928 dev_err(&client->dev,
929 "Configuration register write error, aborting.\n");
930 return err;
931 }
932
933 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF3);
934
935 if (config < 0) {
936 dev_err(&client->dev,
937 "Error reading configuration register, aborting.\n");
938 return err;
939 }
940
941 dev_info(&client->dev, "Revision %d\n", config & 0x0f);
942
943 config &= ~AMC6821_CONF3_THERM_FAN_EN;
944
945 if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF3,
946 config)) {
947 dev_err(&client->dev,
948 "Configuration register write error, aborting.\n");
949 return err;
950 }
951
952 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF2);
953
954 if (config < 0) {
955 dev_err(&client->dev,
956 "Error reading configuration register, aborting.\n");
957 return err;
958 }
959
960 config &= ~AMC6821_CONF2_RTFIE;
961 config &= ~AMC6821_CONF2_LTOIE;
962 config &= ~AMC6821_CONF2_RTOIE;
963 if (i2c_smbus_write_byte_data(client,
964 AMC6821_REG_CONF2, config)) {
965 dev_err(&client->dev,
966 "Configuration register write error, aborting.\n");
967 return err;
968 }
969
970 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1);
971
972 if (config < 0) {
973 dev_err(&client->dev,
974 "Error reading configuration register, aborting.\n");
975 return err;
976 }
977
978 config &= ~AMC6821_CONF1_THERMOVIE;
979 config &= ~AMC6821_CONF1_FANIE;
980 config |= AMC6821_CONF1_START;
981 if (pwminv)
982 config |= AMC6821_CONF1_PWMINV;
983 else
984 config &= ~AMC6821_CONF1_PWMINV;
985
986 if (i2c_smbus_write_byte_data(
987 client, AMC6821_REG_CONF1, config)) {
988 dev_err(&client->dev,
989 "Configuration register write error, aborting.\n");
990 return err;
991 }
992 }
993 return 0;
994}
995
996
997static struct amc6821_data *amc6821_update_device(struct device *dev)
998{
999 struct i2c_client *client = to_i2c_client(dev);
1000 struct amc6821_data *data = i2c_get_clientdata(client);
1001 int timeout = HZ;
1002 u8 reg;
1003 int i;
1004
1005 mutex_lock(&data->update_lock);
1006
1007 if (time_after(jiffies, data->last_updated + timeout) ||
1008 !data->valid) {
1009
1010 for (i = 0; i < TEMP_IDX_LEN; i++)
1011 data->temp[i] = i2c_smbus_read_byte_data(client,
1012 temp_reg[i]);
1013
1014 data->stat1 = i2c_smbus_read_byte_data(client,
1015 AMC6821_REG_STAT1);
1016 data->stat2 = i2c_smbus_read_byte_data(client,
1017 AMC6821_REG_STAT2);
1018
1019 data->pwm1 = i2c_smbus_read_byte_data(client,
1020 AMC6821_REG_DCY);
1021 for (i = 0; i < FAN1_IDX_LEN; i++) {
1022 data->fan[i] = i2c_smbus_read_byte_data(
1023 client,
1024 fan_reg_low[i]);
1025 data->fan[i] += i2c_smbus_read_byte_data(
1026 client,
1027 fan_reg_hi[i]) << 8;
1028 }
1029 data->fan1_div = i2c_smbus_read_byte_data(client,
1030 AMC6821_REG_CONF4);
1031 data->fan1_div = data->fan1_div & AMC6821_CONF4_PSPR ? 4 : 2;
1032
1033 data->pwm1_auto_point_pwm[0] = 0;
1034 data->pwm1_auto_point_pwm[2] = 255;
1035 data->pwm1_auto_point_pwm[1] = i2c_smbus_read_byte_data(client,
1036 AMC6821_REG_DCY_LOW_TEMP);
1037
1038 data->temp1_auto_point_temp[0] =
1039 i2c_smbus_read_byte_data(client,
1040 AMC6821_REG_PSV_TEMP);
1041 data->temp2_auto_point_temp[0] =
1042 data->temp1_auto_point_temp[0];
1043 reg = i2c_smbus_read_byte_data(client,
1044 AMC6821_REG_LTEMP_FAN_CTRL);
1045 data->temp1_auto_point_temp[1] = (reg & 0xF8) >> 1;
1046 reg &= 0x07;
1047 reg = 0x20 >> reg;
1048 if (reg > 0)
1049 data->temp1_auto_point_temp[2] =
1050 data->temp1_auto_point_temp[1] +
1051 (data->pwm1_auto_point_pwm[2] -
1052 data->pwm1_auto_point_pwm[1]) / reg;
1053 else
1054 data->temp1_auto_point_temp[2] = 255;
1055
1056 reg = i2c_smbus_read_byte_data(client,
1057 AMC6821_REG_RTEMP_FAN_CTRL);
1058 data->temp2_auto_point_temp[1] = (reg & 0xF8) >> 1;
1059 reg &= 0x07;
1060 reg = 0x20 >> reg;
1061 if (reg > 0)
1062 data->temp2_auto_point_temp[2] =
1063 data->temp2_auto_point_temp[1] +
1064 (data->pwm1_auto_point_pwm[2] -
1065 data->pwm1_auto_point_pwm[1]) / reg;
1066 else
1067 data->temp2_auto_point_temp[2] = 255;
1068
1069 reg = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1);
1070 reg = (reg >> 5) & 0x3;
1071 switch (reg) {
1072 case 0: /*open loop: software sets pwm1*/
1073 data->pwm1_auto_channels_temp = 0;
1074 data->pwm1_enable = 1;
1075 break;
1076 case 2: /*closed loop: remote T (temp2)*/
1077 data->pwm1_auto_channels_temp = 2;
1078 data->pwm1_enable = 2;
1079 break;
1080 case 3: /*closed loop: local and remote T (temp2)*/
1081 data->pwm1_auto_channels_temp = 3;
1082 data->pwm1_enable = 3;
1083 break;
1084 case 1: /*semi-open loop: software sets rpm, chip controls pwm1,
1085 *currently not implemented
1086 */
1087 data->pwm1_auto_channels_temp = 0;
1088 data->pwm1_enable = 0;
1089 break;
1090 }
1091
1092 data->last_updated = jiffies;
1093 data->valid = 1;
1094 }
1095 mutex_unlock(&data->update_lock);
1096 return data;
1097}
1098
1099
1100static int __init amc6821_init(void)
1101{
1102 return i2c_add_driver(&amc6821_driver);
1103}
1104
1105static void __exit amc6821_exit(void)
1106{
1107 i2c_del_driver(&amc6821_driver);
1108}
1109
1110module_init(amc6821_init);
1111module_exit(amc6821_exit);
1112
1113
1114MODULE_LICENSE("GPL");
1115MODULE_AUTHOR("T. Mertelj <tomaz.mertelj@guest.arnes.si>");
1116MODULE_DESCRIPTION("Texas Instruments amc6821 hwmon driver");
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index 5a3ee00c0e7d..6811346c1c62 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -5,6 +5,7 @@
5 * See COPYING in the top level directory of the kernel tree. 5 * See COPYING in the top level directory of the kernel tree.
6 */ 6 */
7 7
8#include <linux/debugfs.h>
8#include <linux/kernel.h> 9#include <linux/kernel.h>
9#include <linux/hwmon.h> 10#include <linux/hwmon.h>
10#include <linux/list.h> 11#include <linux/list.h>
@@ -101,6 +102,11 @@ struct atk_data {
101 int temperature_count; 102 int temperature_count;
102 int fan_count; 103 int fan_count;
103 struct list_head sensor_list; 104 struct list_head sensor_list;
105
106 struct {
107 struct dentry *root;
108 u32 id;
109 } debugfs;
104}; 110};
105 111
106 112
@@ -624,6 +630,187 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value)
624 return err; 630 return err;
625} 631}
626 632
633#ifdef CONFIG_DEBUG_FS
634static int atk_debugfs_gitm_get(void *p, u64 *val)
635{
636 struct atk_data *data = p;
637 union acpi_object *ret;
638 struct atk_acpi_ret_buffer *buf;
639 int err = 0;
640
641 if (!data->read_handle)
642 return -ENODEV;
643
644 if (!data->debugfs.id)
645 return -EINVAL;
646
647 ret = atk_gitm(data, data->debugfs.id);
648 if (IS_ERR(ret))
649 return PTR_ERR(ret);
650
651 buf = (struct atk_acpi_ret_buffer *)ret->buffer.pointer;
652 if (buf->flags)
653 *val = buf->value;
654 else
655 err = -EIO;
656
657 return err;
658}
659
660DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm,
661 atk_debugfs_gitm_get,
662 NULL,
663 "0x%08llx\n")
664
665static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj)
666{
667 int ret = 0;
668
669 switch (obj->type) {
670 case ACPI_TYPE_INTEGER:
671 ret = snprintf(buf, sz, "0x%08llx\n", obj->integer.value);
672 break;
673 case ACPI_TYPE_STRING:
674 ret = snprintf(buf, sz, "%s\n", obj->string.pointer);
675 break;
676 }
677
678 return ret;
679}
680
681static void atk_pack_print(char *buf, size_t sz, union acpi_object *pack)
682{
683 int ret;
684 int i;
685
686 for (i = 0; i < pack->package.count; i++) {
687 union acpi_object *obj = &pack->package.elements[i];
688
689 ret = atk_acpi_print(buf, sz, obj);
690 if (ret >= sz)
691 break;
692 buf += ret;
693 sz -= ret;
694 }
695}
696
697static int atk_debugfs_ggrp_open(struct inode *inode, struct file *file)
698{
699 struct atk_data *data = inode->i_private;
700 char *buf = NULL;
701 union acpi_object *ret;
702 u8 cls;
703 int i;
704
705 if (!data->enumerate_handle)
706 return -ENODEV;
707 if (!data->debugfs.id)
708 return -EINVAL;
709
710 cls = (data->debugfs.id & 0xff000000) >> 24;
711 ret = atk_ggrp(data, cls);
712 if (IS_ERR(ret))
713 return PTR_ERR(ret);
714
715 for (i = 0; i < ret->package.count; i++) {
716 union acpi_object *pack = &ret->package.elements[i];
717 union acpi_object *id;
718
719 if (pack->type != ACPI_TYPE_PACKAGE)
720 continue;
721 if (!pack->package.count)
722 continue;
723 id = &pack->package.elements[0];
724 if (id->integer.value == data->debugfs.id) {
725 /* Print the package */
726 buf = kzalloc(512, GFP_KERNEL);
727 if (!buf) {
728 ACPI_FREE(ret);
729 return -ENOMEM;
730 }
731 atk_pack_print(buf, 512, pack);
732 break;
733 }
734 }
735 ACPI_FREE(ret);
736
737 if (!buf)
738 return -EINVAL;
739
740 file->private_data = buf;
741
742 return nonseekable_open(inode, file);
743}
744
745static ssize_t atk_debugfs_ggrp_read(struct file *file, char __user *buf,
746 size_t count, loff_t *pos)
747{
748 char *str = file->private_data;
749 size_t len = strlen(str);
750
751 return simple_read_from_buffer(buf, count, pos, str, len);
752}
753
754static int atk_debugfs_ggrp_release(struct inode *inode, struct file *file)
755{
756 kfree(file->private_data);
757 return 0;
758}
759
760static const struct file_operations atk_debugfs_ggrp_fops = {
761 .read = atk_debugfs_ggrp_read,
762 .open = atk_debugfs_ggrp_open,
763 .release = atk_debugfs_ggrp_release,
764};
765
766static void atk_debugfs_init(struct atk_data *data)
767{
768 struct dentry *d;
769 struct dentry *f;
770
771 data->debugfs.id = 0;
772
773 d = debugfs_create_dir("asus_atk0110", NULL);
774 if (!d || IS_ERR(d))
775 return;
776
777 f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id);
778 if (!f || IS_ERR(f))
779 goto cleanup;
780
781 f = debugfs_create_file("gitm", S_IRUSR, d, data,
782 &atk_debugfs_gitm);
783 if (!f || IS_ERR(f))
784 goto cleanup;
785
786 f = debugfs_create_file("ggrp", S_IRUSR, d, data,
787 &atk_debugfs_ggrp_fops);
788 if (!f || IS_ERR(f))
789 goto cleanup;
790
791 data->debugfs.root = d;
792
793 return;
794cleanup:
795 debugfs_remove_recursive(d);
796}
797
798static void atk_debugfs_cleanup(struct atk_data *data)
799{
800 debugfs_remove_recursive(data->debugfs.root);
801}
802
803#else /* CONFIG_DEBUG_FS */
804
805static void atk_debugfs_init(struct atk_data *data)
806{
807}
808
809static void atk_debugfs_cleanup(struct atk_data *data)
810{
811}
812#endif
813
627static int atk_add_sensor(struct atk_data *data, union acpi_object *obj) 814static int atk_add_sensor(struct atk_data *data, union acpi_object *obj)
628{ 815{
629 struct device *dev = &data->acpi_dev->dev; 816 struct device *dev = &data->acpi_dev->dev;
@@ -1047,76 +1234,75 @@ remove:
1047 return err; 1234 return err;
1048} 1235}
1049 1236
1050static int atk_check_old_if(struct atk_data *data) 1237static int atk_probe_if(struct atk_data *data)
1051{ 1238{
1052 struct device *dev = &data->acpi_dev->dev; 1239 struct device *dev = &data->acpi_dev->dev;
1053 acpi_handle ret; 1240 acpi_handle ret;
1054 acpi_status status; 1241 acpi_status status;
1242 int err = 0;
1055 1243
1056 /* RTMP: read temperature */ 1244 /* RTMP: read temperature */
1057 status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret); 1245 status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_TMP, &ret);
1058 if (status != AE_OK) { 1246 if (ACPI_SUCCESS(status))
1247 data->rtmp_handle = ret;
1248 else
1059 dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n", 1249 dev_dbg(dev, "method " METHOD_OLD_READ_TMP " not found: %s\n",
1060 acpi_format_exception(status)); 1250 acpi_format_exception(status));
1061 return -ENODEV;
1062 }
1063 data->rtmp_handle = ret;
1064 1251
1065 /* RVLT: read voltage */ 1252 /* RVLT: read voltage */
1066 status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret); 1253 status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_VLT, &ret);
1067 if (status != AE_OK) { 1254 if (ACPI_SUCCESS(status))
1255 data->rvlt_handle = ret;
1256 else
1068 dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n", 1257 dev_dbg(dev, "method " METHOD_OLD_READ_VLT " not found: %s\n",
1069 acpi_format_exception(status)); 1258 acpi_format_exception(status));
1070 return -ENODEV;
1071 }
1072 data->rvlt_handle = ret;
1073 1259
1074 /* RFAN: read fan status */ 1260 /* RFAN: read fan status */
1075 status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret); 1261 status = acpi_get_handle(data->atk_handle, METHOD_OLD_READ_FAN, &ret);
1076 if (status != AE_OK) { 1262 if (ACPI_SUCCESS(status))
1263 data->rfan_handle = ret;
1264 else
1077 dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n", 1265 dev_dbg(dev, "method " METHOD_OLD_READ_FAN " not found: %s\n",
1078 acpi_format_exception(status)); 1266 acpi_format_exception(status));
1079 return -ENODEV;
1080 }
1081 data->rfan_handle = ret;
1082
1083 return 0;
1084}
1085
1086static int atk_check_new_if(struct atk_data *data)
1087{
1088 struct device *dev = &data->acpi_dev->dev;
1089 acpi_handle ret;
1090 acpi_status status;
1091 1267
1092 /* Enumeration */ 1268 /* Enumeration */
1093 status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret); 1269 status = acpi_get_handle(data->atk_handle, METHOD_ENUMERATE, &ret);
1094 if (status != AE_OK) { 1270 if (ACPI_SUCCESS(status))
1271 data->enumerate_handle = ret;
1272 else
1095 dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n", 1273 dev_dbg(dev, "method " METHOD_ENUMERATE " not found: %s\n",
1096 acpi_format_exception(status)); 1274 acpi_format_exception(status));
1097 return -ENODEV;
1098 }
1099 data->enumerate_handle = ret;
1100 1275
1101 /* De-multiplexer (read) */ 1276 /* De-multiplexer (read) */
1102 status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret); 1277 status = acpi_get_handle(data->atk_handle, METHOD_READ, &ret);
1103 if (status != AE_OK) { 1278 if (ACPI_SUCCESS(status))
1279 data->read_handle = ret;
1280 else
1104 dev_dbg(dev, "method " METHOD_READ " not found: %s\n", 1281 dev_dbg(dev, "method " METHOD_READ " not found: %s\n",
1105 acpi_format_exception(status)); 1282 acpi_format_exception(status));
1106 return -ENODEV;
1107 }
1108 data->read_handle = ret;
1109 1283
1110 /* De-multiplexer (write) */ 1284 /* De-multiplexer (write) */
1111 status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret); 1285 status = acpi_get_handle(data->atk_handle, METHOD_WRITE, &ret);
1112 if (status != AE_OK) { 1286 if (ACPI_SUCCESS(status))
1113 dev_dbg(dev, "method " METHOD_READ " not found: %s\n", 1287 data->write_handle = ret;
1288 else
1289 dev_dbg(dev, "method " METHOD_WRITE " not found: %s\n",
1114 acpi_format_exception(status)); 1290 acpi_format_exception(status));
1115 return -ENODEV;
1116 }
1117 data->write_handle = ret;
1118 1291
1119 return 0; 1292 /* Check for hwmon methods: first check "old" style methods; note that
1293 * both may be present: in this case we stick to the old interface;
1294 * analysis of multiple DSDTs indicates that when both interfaces
1295 * are present the new one (GGRP/GITM) is not functional.
1296 */
1297 if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle)
1298 data->old_interface = true;
1299 else if (data->enumerate_handle && data->read_handle &&
1300 data->write_handle)
1301 data->old_interface = false;
1302 else
1303 err = -ENODEV;
1304
1305 return err;
1120} 1306}
1121 1307
1122static int atk_add(struct acpi_device *device) 1308static int atk_add(struct acpi_device *device)
@@ -1155,28 +1341,19 @@ static int atk_add(struct acpi_device *device)
1155 } 1341 }
1156 ACPI_FREE(buf.pointer); 1342 ACPI_FREE(buf.pointer);
1157 1343
1158 /* Check for hwmon methods: first check "old" style methods; note that 1344 err = atk_probe_if(data);
1159 * both may be present: in this case we stick to the old interface; 1345 if (err) {
1160 * analysis of multiple DSDTs indicates that when both interfaces 1346 dev_err(&device->dev, "No usable hwmon interface detected\n");
1161 * are present the new one (GGRP/GITM) is not functional. 1347 goto out;
1162 */
1163 err = atk_check_old_if(data);
1164 if (!err) {
1165 dev_dbg(&device->dev, "Using old hwmon interface\n");
1166 data->old_interface = true;
1167 } else {
1168 err = atk_check_new_if(data);
1169 if (err)
1170 goto out;
1171
1172 dev_dbg(&device->dev, "Using new hwmon interface\n");
1173 data->old_interface = false;
1174 } 1348 }
1175 1349
1176 if (data->old_interface) 1350 if (data->old_interface) {
1351 dev_dbg(&device->dev, "Using old hwmon interface\n");
1177 err = atk_enumerate_old_hwmon(data); 1352 err = atk_enumerate_old_hwmon(data);
1178 else 1353 } else {
1354 dev_dbg(&device->dev, "Using new hwmon interface\n");
1179 err = atk_enumerate_new_hwmon(data); 1355 err = atk_enumerate_new_hwmon(data);
1356 }
1180 if (err < 0) 1357 if (err < 0)
1181 goto out; 1358 goto out;
1182 if (err == 0) { 1359 if (err == 0) {
@@ -1190,6 +1367,8 @@ static int atk_add(struct acpi_device *device)
1190 if (err) 1367 if (err)
1191 goto cleanup; 1368 goto cleanup;
1192 1369
1370 atk_debugfs_init(data);
1371
1193 device->driver_data = data; 1372 device->driver_data = data;
1194 return 0; 1373 return 0;
1195cleanup: 1374cleanup:
@@ -1208,6 +1387,8 @@ static int atk_remove(struct acpi_device *device, int type)
1208 1387
1209 device->driver_data = NULL; 1388 device->driver_data = NULL;
1210 1389
1390 atk_debugfs_cleanup(data);
1391
1211 atk_remove_files(data); 1392 atk_remove_files(data);
1212 atk_free_sensors(data); 1393 atk_free_sensors(data);
1213 hwmon_device_unregister(data->hwmon_dev); 1394 hwmon_device_unregister(data->hwmon_dev);
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index caef39cda8c8..2d7bceeed0bc 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -33,6 +33,7 @@
33#include <linux/list.h> 33#include <linux/list.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/cpu.h> 35#include <linux/cpu.h>
36#include <linux/pci.h>
36#include <asm/msr.h> 37#include <asm/msr.h>
37#include <asm/processor.h> 38#include <asm/processor.h>
38 39
@@ -161,6 +162,7 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
161 int usemsr_ee = 1; 162 int usemsr_ee = 1;
162 int err; 163 int err;
163 u32 eax, edx; 164 u32 eax, edx;
165 struct pci_dev *host_bridge;
164 166
165 /* Early chips have no MSR for TjMax */ 167 /* Early chips have no MSR for TjMax */
166 168
@@ -168,11 +170,21 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
168 usemsr_ee = 0; 170 usemsr_ee = 0;
169 } 171 }
170 172
171 /* Atoms seems to have TjMax at 90C */ 173 /* Atom CPUs */
172 174
173 if (c->x86_model == 0x1c) { 175 if (c->x86_model == 0x1c) {
174 usemsr_ee = 0; 176 usemsr_ee = 0;
175 tjmax = 90000; 177
178 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
179
180 if (host_bridge && host_bridge->vendor == PCI_VENDOR_ID_INTEL
181 && (host_bridge->device == 0xa000 /* NM10 based nettop */
182 || host_bridge->device == 0xa010)) /* NM10 based netbook */
183 tjmax = 100000;
184 else
185 tjmax = 90000;
186
187 pci_dev_put(host_bridge);
176 } 188 }
177 189
178 if ((c->x86_model > 0xe) && (usemsr_ee)) { 190 if ((c->x86_model > 0xe) && (usemsr_ee)) {
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
new file mode 100644
index 000000000000..099a2138cdf6
--- /dev/null
+++ b/drivers/hwmon/k10temp.c
@@ -0,0 +1,223 @@
1/*
2 * k10temp.c - AMD Family 10h/11h processor hardware monitoring
3 *
4 * Copyright (c) 2009 Clemens Ladisch <clemens@ladisch.de>
5 *
6 *
7 * This driver is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This driver 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.
14 * See the 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 driver; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/err.h>
21#include <linux/hwmon.h>
22#include <linux/hwmon-sysfs.h>
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/pci.h>
26#include <asm/processor.h>
27
28MODULE_DESCRIPTION("AMD Family 10h/11h CPU core temperature monitor");
29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
30MODULE_LICENSE("GPL");
31
32static bool force;
33module_param(force, bool, 0444);
34MODULE_PARM_DESC(force, "force loading on processors with erratum 319");
35
36/* CPUID function 0x80000001, ebx */
37#define CPUID_PKGTYPE_MASK 0xf0000000
38#define CPUID_PKGTYPE_F 0x00000000
39#define CPUID_PKGTYPE_AM2R2_AM3 0x10000000
40
41/* DRAM controller (PCI function 2) */
42#define REG_DCT0_CONFIG_HIGH 0x094
43#define DDR3_MODE 0x00000100
44
45/* miscellaneous (PCI function 3) */
46#define REG_HARDWARE_THERMAL_CONTROL 0x64
47#define HTC_ENABLE 0x00000001
48
49#define REG_REPORTED_TEMPERATURE 0xa4
50
51#define REG_NORTHBRIDGE_CAPABILITIES 0xe8
52#define NB_CAP_HTC 0x00000400
53
54static ssize_t show_temp(struct device *dev,
55 struct device_attribute *attr, char *buf)
56{
57 u32 regval;
58
59 pci_read_config_dword(to_pci_dev(dev),
60 REG_REPORTED_TEMPERATURE, &regval);
61 return sprintf(buf, "%u\n", (regval >> 21) * 125);
62}
63
64static ssize_t show_temp_max(struct device *dev,
65 struct device_attribute *attr, char *buf)
66{
67 return sprintf(buf, "%d\n", 70 * 1000);
68}
69
70static ssize_t show_temp_crit(struct device *dev,
71 struct device_attribute *devattr, char *buf)
72{
73 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
74 int show_hyst = attr->index;
75 u32 regval;
76 int value;
77
78 pci_read_config_dword(to_pci_dev(dev),
79 REG_HARDWARE_THERMAL_CONTROL, &regval);
80 value = ((regval >> 16) & 0x7f) * 500 + 52000;
81 if (show_hyst)
82 value -= ((regval >> 24) & 0xf) * 500;
83 return sprintf(buf, "%d\n", value);
84}
85
86static ssize_t show_name(struct device *dev,
87 struct device_attribute *attr, char *buf)
88{
89 return sprintf(buf, "k10temp\n");
90}
91
92static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
93static DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL);
94static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0);
95static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit, NULL, 1);
96static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
97
98static bool __devinit has_erratum_319(struct pci_dev *pdev)
99{
100 u32 pkg_type, reg_dram_cfg;
101
102 if (boot_cpu_data.x86 != 0x10)
103 return false;
104
105 /*
106 * Erratum 319: The thermal sensor of Socket F/AM2+ processors
107 * may be unreliable.
108 */
109 pkg_type = cpuid_ebx(0x80000001) & CPUID_PKGTYPE_MASK;
110 if (pkg_type == CPUID_PKGTYPE_F)
111 return true;
112 if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3)
113 return false;
114
115 /* Differentiate between AM2+ (bad) and AM3 (good) */
116 pci_bus_read_config_dword(pdev->bus,
117 PCI_DEVFN(PCI_SLOT(pdev->devfn), 2),
118 REG_DCT0_CONFIG_HIGH, &reg_dram_cfg);
119 return !(reg_dram_cfg & DDR3_MODE);
120}
121
122static int __devinit k10temp_probe(struct pci_dev *pdev,
123 const struct pci_device_id *id)
124{
125 struct device *hwmon_dev;
126 u32 reg_caps, reg_htc;
127 int unreliable = has_erratum_319(pdev);
128 int err;
129
130 if (unreliable && !force) {
131 dev_err(&pdev->dev,
132 "unreliable CPU thermal sensor; monitoring disabled\n");
133 err = -ENODEV;
134 goto exit;
135 }
136
137 err = device_create_file(&pdev->dev, &dev_attr_temp1_input);
138 if (err)
139 goto exit;
140 err = device_create_file(&pdev->dev, &dev_attr_temp1_max);
141 if (err)
142 goto exit_remove;
143
144 pci_read_config_dword(pdev, REG_NORTHBRIDGE_CAPABILITIES, &reg_caps);
145 pci_read_config_dword(pdev, REG_HARDWARE_THERMAL_CONTROL, &reg_htc);
146 if ((reg_caps & NB_CAP_HTC) && (reg_htc & HTC_ENABLE)) {
147 err = device_create_file(&pdev->dev,
148 &sensor_dev_attr_temp1_crit.dev_attr);
149 if (err)
150 goto exit_remove;
151 err = device_create_file(&pdev->dev,
152 &sensor_dev_attr_temp1_crit_hyst.dev_attr);
153 if (err)
154 goto exit_remove;
155 }
156
157 err = device_create_file(&pdev->dev, &dev_attr_name);
158 if (err)
159 goto exit_remove;
160
161 hwmon_dev = hwmon_device_register(&pdev->dev);
162 if (IS_ERR(hwmon_dev)) {
163 err = PTR_ERR(hwmon_dev);
164 goto exit_remove;
165 }
166 dev_set_drvdata(&pdev->dev, hwmon_dev);
167
168 if (unreliable && force)
169 dev_warn(&pdev->dev,
170 "unreliable CPU thermal sensor; check erratum 319\n");
171 return 0;
172
173exit_remove:
174 device_remove_file(&pdev->dev, &dev_attr_name);
175 device_remove_file(&pdev->dev, &dev_attr_temp1_input);
176 device_remove_file(&pdev->dev, &dev_attr_temp1_max);
177 device_remove_file(&pdev->dev,
178 &sensor_dev_attr_temp1_crit.dev_attr);
179 device_remove_file(&pdev->dev,
180 &sensor_dev_attr_temp1_crit_hyst.dev_attr);
181exit:
182 return err;
183}
184
185static void __devexit k10temp_remove(struct pci_dev *pdev)
186{
187 hwmon_device_unregister(dev_get_drvdata(&pdev->dev));
188 device_remove_file(&pdev->dev, &dev_attr_name);
189 device_remove_file(&pdev->dev, &dev_attr_temp1_input);
190 device_remove_file(&pdev->dev, &dev_attr_temp1_max);
191 device_remove_file(&pdev->dev,
192 &sensor_dev_attr_temp1_crit.dev_attr);
193 device_remove_file(&pdev->dev,
194 &sensor_dev_attr_temp1_crit_hyst.dev_attr);
195 dev_set_drvdata(&pdev->dev, NULL);
196}
197
198static const struct pci_device_id k10temp_id_table[] = {
199 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
200 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
201 {}
202};
203MODULE_DEVICE_TABLE(pci, k10temp_id_table);
204
205static struct pci_driver k10temp_driver = {
206 .name = "k10temp",
207 .id_table = k10temp_id_table,
208 .probe = k10temp_probe,
209 .remove = __devexit_p(k10temp_remove),
210};
211
212static int __init k10temp_init(void)
213{
214 return pci_register_driver(&k10temp_driver);
215}
216
217static void __exit k10temp_exit(void)
218{
219 pci_unregister_driver(&k10temp_driver);
220}
221
222module_init(k10temp_init)
223module_exit(k10temp_exit)
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index 1fe995111841..0ceb6d6200a3 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -136,7 +136,7 @@ static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 1, 0);
136static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1); 136static SENSOR_DEVICE_ATTR_2(temp4_input, S_IRUGO, show_temp, NULL, 1, 1);
137static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 137static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
138 138
139static struct pci_device_id k8temp_ids[] = { 139static const struct pci_device_id k8temp_ids[] = {
140 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, 140 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
141 { 0 }, 141 { 0 },
142}; 142};
diff --git a/drivers/hwmon/lis3lv02d_i2c.c b/drivers/hwmon/lis3lv02d_i2c.c
new file mode 100644
index 000000000000..dc1f5402c1d7
--- /dev/null
+++ b/drivers/hwmon/lis3lv02d_i2c.c
@@ -0,0 +1,183 @@
1/*
2 * drivers/hwmon/lis3lv02d_i2c.c
3 *
4 * Implements I2C interface for lis3lv02d (STMicroelectronics) accelerometer.
5 * Driver is based on corresponding SPI driver written by Daniel Mack
6 * (lis3lv02d_spi.c (C) 2009 Daniel Mack <daniel@caiaq.de> ).
7 *
8 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
9 *
10 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * version 2 as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 * 02110-1301 USA
25 */
26
27#include <linux/module.h>
28#include <linux/kernel.h>
29#include <linux/init.h>
30#include <linux/err.h>
31#include <linux/i2c.h>
32#include "lis3lv02d.h"
33
34#define DRV_NAME "lis3lv02d_i2c"
35
36static inline s32 lis3_i2c_write(struct lis3lv02d *lis3, int reg, u8 value)
37{
38 struct i2c_client *c = lis3->bus_priv;
39 return i2c_smbus_write_byte_data(c, reg, value);
40}
41
42static inline s32 lis3_i2c_read(struct lis3lv02d *lis3, int reg, u8 *v)
43{
44 struct i2c_client *c = lis3->bus_priv;
45 *v = i2c_smbus_read_byte_data(c, reg);
46 return 0;
47}
48
49static int lis3_i2c_init(struct lis3lv02d *lis3)
50{
51 u8 reg;
52 int ret;
53
54 /* power up the device */
55 ret = lis3->read(lis3, CTRL_REG1, &reg);
56 if (ret < 0)
57 return ret;
58
59 reg |= CTRL1_PD0;
60 return lis3->write(lis3, CTRL_REG1, reg);
61}
62
63/* Default axis mapping but it can be overwritten by platform data */
64static struct axis_conversion lis3lv02d_axis_map = { LIS3_DEV_X,
65 LIS3_DEV_Y,
66 LIS3_DEV_Z };
67
68static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client,
69 const struct i2c_device_id *id)
70{
71 int ret = 0;
72 struct lis3lv02d_platform_data *pdata = client->dev.platform_data;
73
74 if (pdata) {
75 if (pdata->axis_x)
76 lis3lv02d_axis_map.x = pdata->axis_x;
77
78 if (pdata->axis_y)
79 lis3lv02d_axis_map.y = pdata->axis_y;
80
81 if (pdata->axis_z)
82 lis3lv02d_axis_map.z = pdata->axis_z;
83
84 if (pdata->setup_resources)
85 ret = pdata->setup_resources();
86
87 if (ret)
88 goto fail;
89 }
90
91 lis3_dev.pdata = pdata;
92 lis3_dev.bus_priv = client;
93 lis3_dev.init = lis3_i2c_init;
94 lis3_dev.read = lis3_i2c_read;
95 lis3_dev.write = lis3_i2c_write;
96 lis3_dev.irq = client->irq;
97 lis3_dev.ac = lis3lv02d_axis_map;
98
99 i2c_set_clientdata(client, &lis3_dev);
100 ret = lis3lv02d_init_device(&lis3_dev);
101fail:
102 return ret;
103}
104
105static int __devexit lis3lv02d_i2c_remove(struct i2c_client *client)
106{
107 struct lis3lv02d *lis3 = i2c_get_clientdata(client);
108 struct lis3lv02d_platform_data *pdata = client->dev.platform_data;
109
110 if (pdata && pdata->release_resources)
111 pdata->release_resources();
112
113 lis3lv02d_joystick_disable();
114 lis3lv02d_poweroff(lis3);
115
116 return lis3lv02d_remove_fs(&lis3_dev);
117}
118
119#ifdef CONFIG_PM
120static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
121{
122 struct lis3lv02d *lis3 = i2c_get_clientdata(client);
123
124 if (!lis3->pdata->wakeup_flags)
125 lis3lv02d_poweroff(lis3);
126 return 0;
127}
128
129static int lis3lv02d_i2c_resume(struct i2c_client *client)
130{
131 struct lis3lv02d *lis3 = i2c_get_clientdata(client);
132
133 if (!lis3->pdata->wakeup_flags)
134 lis3lv02d_poweron(lis3);
135 return 0;
136}
137
138static void lis3lv02d_i2c_shutdown(struct i2c_client *client)
139{
140 lis3lv02d_i2c_suspend(client, PMSG_SUSPEND);
141}
142#else
143#define lis3lv02d_i2c_suspend NULL
144#define lis3lv02d_i2c_resume NULL
145#define lis3lv02d_i2c_shutdown NULL
146#endif
147
148static const struct i2c_device_id lis3lv02d_id[] = {
149 {"lis3lv02d", 0 },
150 {}
151};
152
153MODULE_DEVICE_TABLE(i2c, lis3lv02d_id);
154
155static struct i2c_driver lis3lv02d_i2c_driver = {
156 .driver = {
157 .name = DRV_NAME,
158 .owner = THIS_MODULE,
159 },
160 .suspend = lis3lv02d_i2c_suspend,
161 .shutdown = lis3lv02d_i2c_shutdown,
162 .resume = lis3lv02d_i2c_resume,
163 .probe = lis3lv02d_i2c_probe,
164 .remove = __devexit_p(lis3lv02d_i2c_remove),
165 .id_table = lis3lv02d_id,
166};
167
168static int __init lis3lv02d_init(void)
169{
170 return i2c_add_driver(&lis3lv02d_i2c_driver);
171}
172
173static void __exit lis3lv02d_exit(void)
174{
175 i2c_del_driver(&lis3lv02d_i2c_driver);
176}
177
178MODULE_AUTHOR("Nokia Corporation");
179MODULE_DESCRIPTION("lis3lv02d I2C interface");
180MODULE_LICENSE("GPL");
181
182module_init(lis3lv02d_init);
183module_exit(lis3lv02d_exit);
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index ebe38b680ee3..864a371f6eb9 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -305,7 +305,7 @@ static inline int sht15_calc_temp(struct sht15_data *data)
305 int d1 = 0; 305 int d1 = 0;
306 int i; 306 int i;
307 307
308 for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++) 308 for (i = 1; i < ARRAY_SIZE(temppoints); i++)
309 /* Find pointer to interpolate */ 309 /* Find pointer to interpolate */
310 if (data->supply_uV > temppoints[i - 1].vdd) { 310 if (data->supply_uV > temppoints[i - 1].vdd) {
311 d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd) 311 d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
@@ -332,12 +332,12 @@ static inline int sht15_calc_humid(struct sht15_data *data)
332 332
333 const int c1 = -4; 333 const int c1 = -4;
334 const int c2 = 40500; /* x 10 ^ -6 */ 334 const int c2 = 40500; /* x 10 ^ -6 */
335 const int c3 = 2800; /* x10 ^ -9 */ 335 const int c3 = -2800; /* x10 ^ -9 */
336 336
337 RHlinear = c1*1000 337 RHlinear = c1*1000
338 + c2 * data->val_humid/1000 338 + c2 * data->val_humid/1000
339 + (data->val_humid * data->val_humid * c3)/1000000; 339 + (data->val_humid * data->val_humid * c3)/1000000;
340 return (temp - 25000) * (10000 + 800 * data->val_humid) 340 return (temp - 25000) * (10000 + 80 * data->val_humid)
341 / 1000000 + RHlinear; 341 / 1000000 + RHlinear;
342} 342}
343 343
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 12f2e7086560..79c2931e3008 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -697,7 +697,7 @@ static struct sis5595_data *sis5595_update_device(struct device *dev)
697 return data; 697 return data;
698} 698}
699 699
700static struct pci_device_id sis5595_pci_ids[] = { 700static const struct pci_device_id sis5595_pci_ids[] = {
701 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) }, 701 { PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) },
702 { 0, } 702 { 0, }
703}; 703};
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 8ad50fdba00d..9ca97818bd4b 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -136,11 +136,11 @@ struct smsc47m1_data {
136 136
137struct smsc47m1_sio_data { 137struct smsc47m1_sio_data {
138 enum chips type; 138 enum chips type;
139 u8 activate; /* Remember initial device state */
139}; 140};
140 141
141 142
142static int smsc47m1_probe(struct platform_device *pdev); 143static int __exit smsc47m1_remove(struct platform_device *pdev);
143static int __devexit smsc47m1_remove(struct platform_device *pdev);
144static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, 144static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
145 int init); 145 int init);
146 146
@@ -160,8 +160,7 @@ static struct platform_driver smsc47m1_driver = {
160 .owner = THIS_MODULE, 160 .owner = THIS_MODULE,
161 .name = DRVNAME, 161 .name = DRVNAME,
162 }, 162 },
163 .probe = smsc47m1_probe, 163 .remove = __exit_p(smsc47m1_remove),
164 .remove = __devexit_p(smsc47m1_remove),
165}; 164};
166 165
167static ssize_t get_fan(struct device *dev, struct device_attribute 166static ssize_t get_fan(struct device *dev, struct device_attribute
@@ -470,24 +469,126 @@ static int __init smsc47m1_find(unsigned short *addr,
470 superio_select(); 469 superio_select();
471 *addr = (superio_inb(SUPERIO_REG_BASE) << 8) 470 *addr = (superio_inb(SUPERIO_REG_BASE) << 8)
472 | superio_inb(SUPERIO_REG_BASE + 1); 471 | superio_inb(SUPERIO_REG_BASE + 1);
473 val = superio_inb(SUPERIO_REG_ACT); 472 if (*addr == 0) {
474 if (*addr == 0 || (val & 0x01) == 0) { 473 pr_info(DRVNAME ": Device address not set, will not use\n");
475 pr_info(DRVNAME ": Device is disabled, will not use\n");
476 superio_exit(); 474 superio_exit();
477 return -ENODEV; 475 return -ENODEV;
478 } 476 }
479 477
478 /* Enable only if address is set (needed at least on the
479 * Compaq Presario S4000NX) */
480 sio_data->activate = superio_inb(SUPERIO_REG_ACT);
481 if ((sio_data->activate & 0x01) == 0) {
482 pr_info(DRVNAME ": Enabling device\n");
483 superio_outb(SUPERIO_REG_ACT, sio_data->activate | 0x01);
484 }
485
480 superio_exit(); 486 superio_exit();
481 return 0; 487 return 0;
482} 488}
483 489
484static int __devinit smsc47m1_probe(struct platform_device *pdev) 490/* Restore device to its initial state */
491static void __init smsc47m1_restore(const struct smsc47m1_sio_data *sio_data)
492{
493 if ((sio_data->activate & 0x01) == 0) {
494 superio_enter();
495 superio_select();
496
497 pr_info(DRVNAME ": Disabling device\n");
498 superio_outb(SUPERIO_REG_ACT, sio_data->activate);
499
500 superio_exit();
501 }
502}
503
504#define CHECK 1
505#define REQUEST 2
506#define RELEASE 3
507
508/*
509 * This function can be used to:
510 * - test for resource conflicts with ACPI
511 * - request the resources
512 * - release the resources
513 * We only allocate the I/O ports we really need, to minimize the risk of
514 * conflicts with ACPI or with other drivers.
515 */
516static int smsc47m1_handle_resources(unsigned short address, enum chips type,
517 int action, struct device *dev)
518{
519 static const u8 ports_m1[] = {
520 /* register, region length */
521 0x04, 1,
522 0x33, 4,
523 0x56, 7,
524 };
525
526 static const u8 ports_m2[] = {
527 /* register, region length */
528 0x04, 1,
529 0x09, 1,
530 0x2c, 2,
531 0x35, 4,
532 0x56, 7,
533 0x69, 4,
534 };
535
536 int i, ports_size, err;
537 const u8 *ports;
538
539 switch (type) {
540 case smsc47m1:
541 default:
542 ports = ports_m1;
543 ports_size = ARRAY_SIZE(ports_m1);
544 break;
545 case smsc47m2:
546 ports = ports_m2;
547 ports_size = ARRAY_SIZE(ports_m2);
548 break;
549 }
550
551 for (i = 0; i + 1 < ports_size; i += 2) {
552 unsigned short start = address + ports[i];
553 unsigned short len = ports[i + 1];
554
555 switch (action) {
556 case CHECK:
557 /* Only check for conflicts */
558 err = acpi_check_region(start, len, DRVNAME);
559 if (err)
560 return err;
561 break;
562 case REQUEST:
563 /* Request the resources */
564 if (!request_region(start, len, DRVNAME)) {
565 dev_err(dev, "Region 0x%hx-0x%hx already in "
566 "use!\n", start, start + len);
567
568 /* Undo all requests */
569 for (i -= 2; i >= 0; i -= 2)
570 release_region(address + ports[i],
571 ports[i + 1]);
572 return -EBUSY;
573 }
574 break;
575 case RELEASE:
576 /* Release the resources */
577 release_region(start, len);
578 break;
579 }
580 }
581
582 return 0;
583}
584
585static int __init smsc47m1_probe(struct platform_device *pdev)
485{ 586{
486 struct device *dev = &pdev->dev; 587 struct device *dev = &pdev->dev;
487 struct smsc47m1_sio_data *sio_data = dev->platform_data; 588 struct smsc47m1_sio_data *sio_data = dev->platform_data;
488 struct smsc47m1_data *data; 589 struct smsc47m1_data *data;
489 struct resource *res; 590 struct resource *res;
490 int err = 0; 591 int err;
491 int fan1, fan2, fan3, pwm1, pwm2, pwm3; 592 int fan1, fan2, fan3, pwm1, pwm2, pwm3;
492 593
493 static const char *names[] = { 594 static const char *names[] = {
@@ -496,12 +597,10 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
496 }; 597 };
497 598
498 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 599 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
499 if (!request_region(res->start, SMSC_EXTENT, DRVNAME)) { 600 err = smsc47m1_handle_resources(res->start, sio_data->type,
500 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", 601 REQUEST, dev);
501 (unsigned long)res->start, 602 if (err < 0)
502 (unsigned long)res->end); 603 return err;
503 return -EBUSY;
504 }
505 604
506 if (!(data = kzalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) { 605 if (!(data = kzalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) {
507 err = -ENOMEM; 606 err = -ENOMEM;
@@ -637,11 +736,11 @@ error_free:
637 platform_set_drvdata(pdev, NULL); 736 platform_set_drvdata(pdev, NULL);
638 kfree(data); 737 kfree(data);
639error_release: 738error_release:
640 release_region(res->start, SMSC_EXTENT); 739 smsc47m1_handle_resources(res->start, sio_data->type, RELEASE, dev);
641 return err; 740 return err;
642} 741}
643 742
644static int __devexit smsc47m1_remove(struct platform_device *pdev) 743static int __exit smsc47m1_remove(struct platform_device *pdev)
645{ 744{
646 struct smsc47m1_data *data = platform_get_drvdata(pdev); 745 struct smsc47m1_data *data = platform_get_drvdata(pdev);
647 struct resource *res; 746 struct resource *res;
@@ -650,7 +749,7 @@ static int __devexit smsc47m1_remove(struct platform_device *pdev)
650 sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group); 749 sysfs_remove_group(&pdev->dev.kobj, &smsc47m1_group);
651 750
652 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 751 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
653 release_region(res->start, SMSC_EXTENT); 752 smsc47m1_handle_resources(res->start, data->type, RELEASE, &pdev->dev);
654 platform_set_drvdata(pdev, NULL); 753 platform_set_drvdata(pdev, NULL);
655 kfree(data); 754 kfree(data);
656 755
@@ -717,7 +816,7 @@ static int __init smsc47m1_device_add(unsigned short address,
717 }; 816 };
718 int err; 817 int err;
719 818
720 err = acpi_check_resource_conflict(&res); 819 err = smsc47m1_handle_resources(address, sio_data->type, CHECK, NULL);
721 if (err) 820 if (err)
722 goto exit; 821 goto exit;
723 822
@@ -766,27 +865,29 @@ static int __init sm_smsc47m1_init(void)
766 if (smsc47m1_find(&address, &sio_data)) 865 if (smsc47m1_find(&address, &sio_data))
767 return -ENODEV; 866 return -ENODEV;
768 867
769 err = platform_driver_register(&smsc47m1_driver); 868 /* Sets global pdev as a side effect */
869 err = smsc47m1_device_add(address, &sio_data);
770 if (err) 870 if (err)
771 goto exit; 871 goto exit;
772 872
773 /* Sets global pdev as a side effect */ 873 err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe);
774 err = smsc47m1_device_add(address, &sio_data);
775 if (err) 874 if (err)
776 goto exit_driver; 875 goto exit_device;
777 876
778 return 0; 877 return 0;
779 878
780exit_driver: 879exit_device:
781 platform_driver_unregister(&smsc47m1_driver); 880 platform_device_unregister(pdev);
881 smsc47m1_restore(&sio_data);
782exit: 882exit:
783 return err; 883 return err;
784} 884}
785 885
786static void __exit sm_smsc47m1_exit(void) 886static void __exit sm_smsc47m1_exit(void)
787{ 887{
788 platform_device_unregister(pdev);
789 platform_driver_unregister(&smsc47m1_driver); 888 platform_driver_unregister(&smsc47m1_driver);
889 smsc47m1_restore(pdev->dev.platform_data);
890 platform_device_unregister(pdev);
790} 891}
791 892
792MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>"); 893MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
new file mode 100644
index 000000000000..7442cf754856
--- /dev/null
+++ b/drivers/hwmon/via-cputemp.c
@@ -0,0 +1,356 @@
1/*
2 * via-cputemp.c - Driver for VIA CPU core temperature monitoring
3 * Copyright (C) 2009 VIA Technologies, Inc.
4 *
5 * based on existing coretemp.c, which is
6 *
7 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA.
22 */
23
24#include <linux/module.h>
25#include <linux/delay.h>
26#include <linux/init.h>
27#include <linux/slab.h>
28#include <linux/jiffies.h>
29#include <linux/hwmon.h>
30#include <linux/sysfs.h>
31#include <linux/hwmon-sysfs.h>
32#include <linux/err.h>
33#include <linux/mutex.h>
34#include <linux/list.h>
35#include <linux/platform_device.h>
36#include <linux/cpu.h>
37#include <asm/msr.h>
38#include <asm/processor.h>
39
40#define DRVNAME "via_cputemp"
41
42enum { SHOW_TEMP, SHOW_LABEL, SHOW_NAME } SHOW;
43
44/*
45 * Functions declaration
46 */
47
48struct via_cputemp_data {
49 struct device *hwmon_dev;
50 const char *name;
51 u32 id;
52 u32 msr;
53};
54
55/*
56 * Sysfs stuff
57 */
58
59static ssize_t show_name(struct device *dev, struct device_attribute
60 *devattr, char *buf)
61{
62 int ret;
63 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
64 struct via_cputemp_data *data = dev_get_drvdata(dev);
65
66 if (attr->index == SHOW_NAME)
67 ret = sprintf(buf, "%s\n", data->name);
68 else /* show label */
69 ret = sprintf(buf, "Core %d\n", data->id);
70 return ret;
71}
72
73static ssize_t show_temp(struct device *dev,
74 struct device_attribute *devattr, char *buf)
75{
76 struct via_cputemp_data *data = dev_get_drvdata(dev);
77 u32 eax, edx;
78 int err;
79
80 err = rdmsr_safe_on_cpu(data->id, data->msr, &eax, &edx);
81 if (err)
82 return -EAGAIN;
83
84 return sprintf(buf, "%lu\n", ((unsigned long)eax & 0xffffff) * 1000);
85}
86
87static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
88 SHOW_TEMP);
89static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
90static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, SHOW_NAME);
91
92static struct attribute *via_cputemp_attributes[] = {
93 &sensor_dev_attr_name.dev_attr.attr,
94 &sensor_dev_attr_temp1_label.dev_attr.attr,
95 &sensor_dev_attr_temp1_input.dev_attr.attr,
96 NULL
97};
98
99static const struct attribute_group via_cputemp_group = {
100 .attrs = via_cputemp_attributes,
101};
102
103static int __devinit via_cputemp_probe(struct platform_device *pdev)
104{
105 struct via_cputemp_data *data;
106 struct cpuinfo_x86 *c = &cpu_data(pdev->id);
107 int err;
108 u32 eax, edx;
109
110 data = kzalloc(sizeof(struct via_cputemp_data), GFP_KERNEL);
111 if (!data) {
112 err = -ENOMEM;
113 dev_err(&pdev->dev, "Out of memory\n");
114 goto exit;
115 }
116
117 data->id = pdev->id;
118 data->name = "via_cputemp";
119
120 switch (c->x86_model) {
121 case 0xA:
122 /* C7 A */
123 case 0xD:
124 /* C7 D */
125 data->msr = 0x1169;
126 break;
127 case 0xF:
128 /* Nano */
129 data->msr = 0x1423;
130 break;
131 default:
132 err = -ENODEV;
133 goto exit_free;
134 }
135
136 /* test if we can access the TEMPERATURE MSR */
137 err = rdmsr_safe_on_cpu(data->id, data->msr, &eax, &edx);
138 if (err) {
139 dev_err(&pdev->dev,
140 "Unable to access TEMPERATURE MSR, giving up\n");
141 goto exit_free;
142 }
143
144 platform_set_drvdata(pdev, data);
145
146 err = sysfs_create_group(&pdev->dev.kobj, &via_cputemp_group);
147 if (err)
148 goto exit_free;
149
150 data->hwmon_dev = hwmon_device_register(&pdev->dev);
151 if (IS_ERR(data->hwmon_dev)) {
152 err = PTR_ERR(data->hwmon_dev);
153 dev_err(&pdev->dev, "Class registration failed (%d)\n",
154 err);
155 goto exit_remove;
156 }
157
158 return 0;
159
160exit_remove:
161 sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group);
162exit_free:
163 platform_set_drvdata(pdev, NULL);
164 kfree(data);
165exit:
166 return err;
167}
168
169static int __devexit via_cputemp_remove(struct platform_device *pdev)
170{
171 struct via_cputemp_data *data = platform_get_drvdata(pdev);
172
173 hwmon_device_unregister(data->hwmon_dev);
174 sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group);
175 platform_set_drvdata(pdev, NULL);
176 kfree(data);
177 return 0;
178}
179
180static struct platform_driver via_cputemp_driver = {
181 .driver = {
182 .owner = THIS_MODULE,
183 .name = DRVNAME,
184 },
185 .probe = via_cputemp_probe,
186 .remove = __devexit_p(via_cputemp_remove),
187};
188
189struct pdev_entry {
190 struct list_head list;
191 struct platform_device *pdev;
192 unsigned int cpu;
193};
194
195static LIST_HEAD(pdev_list);
196static DEFINE_MUTEX(pdev_list_mutex);
197
198static int __cpuinit via_cputemp_device_add(unsigned int cpu)
199{
200 int err;
201 struct platform_device *pdev;
202 struct pdev_entry *pdev_entry;
203
204 pdev = platform_device_alloc(DRVNAME, cpu);
205 if (!pdev) {
206 err = -ENOMEM;
207 printk(KERN_ERR DRVNAME ": Device allocation failed\n");
208 goto exit;
209 }
210
211 pdev_entry = kzalloc(sizeof(struct pdev_entry), GFP_KERNEL);
212 if (!pdev_entry) {
213 err = -ENOMEM;
214 goto exit_device_put;
215 }
216
217 err = platform_device_add(pdev);
218 if (err) {
219 printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n",
220 err);
221 goto exit_device_free;
222 }
223
224 pdev_entry->pdev = pdev;
225 pdev_entry->cpu = cpu;
226 mutex_lock(&pdev_list_mutex);
227 list_add_tail(&pdev_entry->list, &pdev_list);
228 mutex_unlock(&pdev_list_mutex);
229
230 return 0;
231
232exit_device_free:
233 kfree(pdev_entry);
234exit_device_put:
235 platform_device_put(pdev);
236exit:
237 return err;
238}
239
240#ifdef CONFIG_HOTPLUG_CPU
241static void via_cputemp_device_remove(unsigned int cpu)
242{
243 struct pdev_entry *p, *n;
244 mutex_lock(&pdev_list_mutex);
245 list_for_each_entry_safe(p, n, &pdev_list, list) {
246 if (p->cpu == cpu) {
247 platform_device_unregister(p->pdev);
248 list_del(&p->list);
249 kfree(p);
250 }
251 }
252 mutex_unlock(&pdev_list_mutex);
253}
254
255static int __cpuinit via_cputemp_cpu_callback(struct notifier_block *nfb,
256 unsigned long action, void *hcpu)
257{
258 unsigned int cpu = (unsigned long) hcpu;
259
260 switch (action) {
261 case CPU_ONLINE:
262 case CPU_DOWN_FAILED:
263 via_cputemp_device_add(cpu);
264 break;
265 case CPU_DOWN_PREPARE:
266 via_cputemp_device_remove(cpu);
267 break;
268 }
269 return NOTIFY_OK;
270}
271
272static struct notifier_block via_cputemp_cpu_notifier __refdata = {
273 .notifier_call = via_cputemp_cpu_callback,
274};
275#endif /* !CONFIG_HOTPLUG_CPU */
276
277static int __init via_cputemp_init(void)
278{
279 int i, err;
280 struct pdev_entry *p, *n;
281
282 if (cpu_data(0).x86_vendor != X86_VENDOR_CENTAUR) {
283 printk(KERN_DEBUG DRVNAME ": Not a VIA CPU\n");
284 err = -ENODEV;
285 goto exit;
286 }
287
288 err = platform_driver_register(&via_cputemp_driver);
289 if (err)
290 goto exit;
291
292 for_each_online_cpu(i) {
293 struct cpuinfo_x86 *c = &cpu_data(i);
294
295 if (c->x86 != 6)
296 continue;
297
298 if (c->x86_model < 0x0a)
299 continue;
300
301 if (c->x86_model > 0x0f) {
302 printk(KERN_WARNING DRVNAME ": Unknown CPU "
303 "model 0x%x\n", c->x86_model);
304 continue;
305 }
306
307 err = via_cputemp_device_add(i);
308 if (err)
309 goto exit_devices_unreg;
310 }
311 if (list_empty(&pdev_list)) {
312 err = -ENODEV;
313 goto exit_driver_unreg;
314 }
315
316#ifdef CONFIG_HOTPLUG_CPU
317 register_hotcpu_notifier(&via_cputemp_cpu_notifier);
318#endif
319 return 0;
320
321exit_devices_unreg:
322 mutex_lock(&pdev_list_mutex);
323 list_for_each_entry_safe(p, n, &pdev_list, list) {
324 platform_device_unregister(p->pdev);
325 list_del(&p->list);
326 kfree(p);
327 }
328 mutex_unlock(&pdev_list_mutex);
329exit_driver_unreg:
330 platform_driver_unregister(&via_cputemp_driver);
331exit:
332 return err;
333}
334
335static void __exit via_cputemp_exit(void)
336{
337 struct pdev_entry *p, *n;
338#ifdef CONFIG_HOTPLUG_CPU
339 unregister_hotcpu_notifier(&via_cputemp_cpu_notifier);
340#endif
341 mutex_lock(&pdev_list_mutex);
342 list_for_each_entry_safe(p, n, &pdev_list, list) {
343 platform_device_unregister(p->pdev);
344 list_del(&p->list);
345 kfree(p);
346 }
347 mutex_unlock(&pdev_list_mutex);
348 platform_driver_unregister(&via_cputemp_driver);
349}
350
351MODULE_AUTHOR("Harald Welte <HaraldWelte@viatech.com>");
352MODULE_DESCRIPTION("VIA CPU temperature monitor");
353MODULE_LICENSE("GPL");
354
355module_init(via_cputemp_init)
356module_exit(via_cputemp_exit)
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index 39e82a492f26..f397ce7ad598 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -767,7 +767,7 @@ static struct via686a_data *via686a_update_device(struct device *dev)
767 return data; 767 return data;
768} 768}
769 769
770static struct pci_device_id via686a_pci_ids[] = { 770static const struct pci_device_id via686a_pci_ids[] = {
771 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) }, 771 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) },
772 { 0, } 772 { 0, }
773}; 773};
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index 470a1226ba2b..d47b4c9949c2 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -697,7 +697,7 @@ static struct platform_driver vt8231_driver = {
697 .remove = __devexit_p(vt8231_remove), 697 .remove = __devexit_p(vt8231_remove),
698}; 698};
699 699
700static struct pci_device_id vt8231_pci_ids[] = { 700static const struct pci_device_id vt8231_pci_ids[] = {
701 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, 701 { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) },
702 { 0, } 702 { 0, }
703}; 703};
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index b257c7223733..38e280523071 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1135,6 +1135,7 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr,
1135 "W83687THF", 1135 "W83687THF",
1136 }; 1136 };
1137 1137
1138 sio_data->sioaddr = sioaddr;
1138 superio_enter(sio_data); 1139 superio_enter(sio_data);
1139 val = force_id ? force_id : superio_inb(sio_data, DEVID); 1140 val = force_id ? force_id : superio_inb(sio_data, DEVID);
1140 switch (val) { 1141 switch (val) {
@@ -1177,7 +1178,6 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr,
1177 } 1178 }
1178 1179
1179 err = 0; 1180 err = 0;
1180 sio_data->sioaddr = sioaddr;
1181 pr_info(DRVNAME ": Found %s chip at %#x\n", 1181 pr_info(DRVNAME ": Found %s chip at %#x\n",
1182 names[sio_data->type], *addr); 1182 names[sio_data->type], *addr);
1183 1183
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index b309ac2c3d5c..fe3fb567317d 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -693,13 +693,13 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
693 } 693 }
694 694
695 /* Set TWI internal clock as 10MHz */ 695 /* Set TWI internal clock as 10MHz */
696 write_CONTROL(iface, ((get_sclk() / 1024 / 1024 + 5) / 10) & 0x7F); 696 write_CONTROL(iface, ((get_sclk() / 1000 / 1000 + 5) / 10) & 0x7F);
697 697
698 /* 698 /*
699 * We will not end up with a CLKDIV=0 because no one will specify 699 * We will not end up with a CLKDIV=0 because no one will specify
700 * 20kHz SCL or less in Kconfig now. (5 * 1024 / 20 = 0x100) 700 * 20kHz SCL or less in Kconfig now. (5 * 1000 / 20 = 250)
701 */ 701 */
702 clkhilow = 5 * 1024 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ; 702 clkhilow = ((10 * 1000 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ) + 1) / 2;
703 703
704 /* Set Twi interface clock as specified */ 704 /* Set Twi interface clock as specified */
705 write_CLKDIV(iface, (clkhilow << 8) | clkhilow); 705 write_CLKDIV(iface, (clkhilow << 8) | clkhilow);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 75bf3ad18099..0037e31076ba 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -247,7 +247,13 @@ static void omap_i2c_unidle(struct omap_i2c_dev *dev)
247 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN); 247 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
248 } 248 }
249 dev->idle = 0; 249 dev->idle = 0;
250 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate); 250
251 /*
252 * Don't write to this register if the IE state is 0 as it can
253 * cause deadlock.
254 */
255 if (dev->iestate)
256 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
251} 257}
252 258
253static void omap_i2c_idle(struct omap_i2c_dev *dev) 259static void omap_i2c_idle(struct omap_i2c_dev *dev)
@@ -280,6 +286,11 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
280 unsigned long internal_clk = 0; 286 unsigned long internal_clk = 0;
281 287
282 if (dev->rev >= OMAP_I2C_REV_2) { 288 if (dev->rev >= OMAP_I2C_REV_2) {
289 /* Disable I2C controller before soft reset */
290 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
291 omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) &
292 ~(OMAP_I2C_CON_EN));
293
283 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, SYSC_SOFTRESET_MASK); 294 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, SYSC_SOFTRESET_MASK);
284 /* For some reason we need to set the EN bit before the 295 /* For some reason we need to set the EN bit before the
285 * reset done bit gets set. */ 296 * reset done bit gets set. */
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c
index 1f20a042a4f5..dd253002cd50 100644
--- a/drivers/idle/i7300_idle.c
+++ b/drivers/idle/i7300_idle.c
@@ -81,7 +81,7 @@ static u8 i7300_idle_thrtctl_saved;
81static u8 i7300_idle_thrtlow_saved; 81static u8 i7300_idle_thrtlow_saved;
82static u32 i7300_idle_mc_saved; 82static u32 i7300_idle_mc_saved;
83 83
84static cpumask_t idle_cpumask; 84static cpumask_var_t idle_cpumask;
85static ktime_t start_ktime; 85static ktime_t start_ktime;
86static unsigned long avg_idle_us; 86static unsigned long avg_idle_us;
87 87
@@ -459,9 +459,9 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
459 spin_lock_irqsave(&i7300_idle_lock, flags); 459 spin_lock_irqsave(&i7300_idle_lock, flags);
460 if (val == IDLE_START) { 460 if (val == IDLE_START) {
461 461
462 cpu_set(smp_processor_id(), idle_cpumask); 462 cpumask_set_cpu(smp_processor_id(), idle_cpumask);
463 463
464 if (cpus_weight(idle_cpumask) != num_online_cpus()) 464 if (cpumask_weight(idle_cpumask) != num_online_cpus())
465 goto end; 465 goto end;
466 466
467 now_ktime = ktime_get(); 467 now_ktime = ktime_get();
@@ -478,8 +478,8 @@ static int i7300_idle_notifier(struct notifier_block *nb, unsigned long val,
478 i7300_idle_ioat_start(); 478 i7300_idle_ioat_start();
479 479
480 } else if (val == IDLE_END) { 480 } else if (val == IDLE_END) {
481 cpu_clear(smp_processor_id(), idle_cpumask); 481 cpumask_clear_cpu(smp_processor_id(), idle_cpumask);
482 if (cpus_weight(idle_cpumask) == (num_online_cpus() - 1)) { 482 if (cpumask_weight(idle_cpumask) == (num_online_cpus() - 1)) {
483 /* First CPU coming out of idle */ 483 /* First CPU coming out of idle */
484 u64 idle_duration_us; 484 u64 idle_duration_us;
485 485
@@ -553,7 +553,6 @@ struct debugfs_file_info {
553static int __init i7300_idle_init(void) 553static int __init i7300_idle_init(void)
554{ 554{
555 spin_lock_init(&i7300_idle_lock); 555 spin_lock_init(&i7300_idle_lock);
556 cpus_clear(idle_cpumask);
557 total_us = 0; 556 total_us = 0;
558 557
559 if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev, forceload)) 558 if (i7300_idle_platform_probe(&fbd_dev, &ioat_dev, forceload))
@@ -565,6 +564,9 @@ static int __init i7300_idle_init(void)
565 if (i7300_idle_ioat_init()) 564 if (i7300_idle_ioat_init())
566 return -ENODEV; 565 return -ENODEV;
567 566
567 if (!zalloc_cpumask_var(&idle_cpumask, GFP_KERNEL))
568 return -ENOMEM;
569
568 debugfs_dir = debugfs_create_dir("i7300_idle", NULL); 570 debugfs_dir = debugfs_create_dir("i7300_idle", NULL);
569 if (debugfs_dir) { 571 if (debugfs_dir) {
570 int i = 0; 572 int i = 0;
@@ -589,6 +591,7 @@ static int __init i7300_idle_init(void)
589static void __exit i7300_idle_exit(void) 591static void __exit i7300_idle_exit(void)
590{ 592{
591 idle_notifier_unregister(&i7300_idle_nb); 593 idle_notifier_unregister(&i7300_idle_nb);
594 free_cpumask_var(idle_cpumask);
592 595
593 if (debugfs_dir) { 596 if (debugfs_dir) {
594 int i = 0; 597 int i = 0;
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
index f102fcc7e52a..e02096cf7d95 100644
--- a/drivers/ieee1394/Kconfig
+++ b/drivers/ieee1394/Kconfig
@@ -1,8 +1,3 @@
1menu "IEEE 1394 (FireWire) support"
2 depends on PCI || BROKEN
3
4source "drivers/firewire/Kconfig"
5
6config IEEE1394 1config IEEE1394
7 tristate "Legacy alternative FireWire driver stack" 2 tristate "Legacy alternative FireWire driver stack"
8 depends on PCI || BROKEN 3 depends on PCI || BROKEN
@@ -16,8 +11,13 @@ config IEEE1394
16 is the core support only, you will also need to select a driver for 11 is the core support only, you will also need to select a driver for
17 your IEEE 1394 adapter. 12 your IEEE 1394 adapter.
18 13
19 To compile this driver as a module, say M here: the 14 To compile this driver as a module, say M here: the module will be
20 module will be called ieee1394. 15 called ieee1394.
16
17 NOTE:
18 ieee1394 is superseded by the newer firewire-core driver. See
19 http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for
20 further information on how to switch to the new FireWire drivers.
21 21
22config IEEE1394_OHCI1394 22config IEEE1394_OHCI1394
23 tristate "OHCI-1394 controllers" 23 tristate "OHCI-1394 controllers"
@@ -29,19 +29,23 @@ config IEEE1394_OHCI1394
29 use one of these chipsets. It should work with any OHCI-1394 29 use one of these chipsets. It should work with any OHCI-1394
30 compliant card, however. 30 compliant card, however.
31 31
32 To compile this driver as a module, say M here: the 32 To compile this driver as a module, say M here: the module will be
33 module will be called ohci1394. 33 called ohci1394.
34 34
35 NOTE: 35 NOTE:
36 ohci1394 is superseded by the newer firewire-ohci driver. See
37 http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for
38 further information on how to switch to the new FireWire drivers.
39
36 If you want to install firewire-ohci and ohci1394 together, you 40 If you want to install firewire-ohci and ohci1394 together, you
37 should configure them only as modules and blacklist the driver(s) 41 should configure them only as modules and blacklist the driver(s)
38 which you don't want to have auto-loaded. Add either 42 which you don't want to have auto-loaded. Add either
39 43
40 blacklist firewire-ohci
41 or
42 blacklist ohci1394 44 blacklist ohci1394
43 blacklist video1394 45 blacklist video1394
44 blacklist dv1394 46 blacklist dv1394
47 or
48 blacklist firewire-ohci
45 49
46 to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf 50 to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf
47 depending on your distribution. 51 depending on your distribution.
@@ -58,8 +62,8 @@ config IEEE1394_PCILYNX
58 Instruments PCILynx chip. Note: this driver is written for revision 62 Instruments PCILynx chip. Note: this driver is written for revision
59 2 of this chip and may not work with revision 0. 63 2 of this chip and may not work with revision 0.
60 64
61 To compile this driver as a module, say M here: the 65 To compile this driver as a module, say M here: the module will be
62 module will be called pcilynx. 66 called pcilynx.
63 67
64 Only some old and now very rare PCI and CardBus cards and 68 Only some old and now very rare PCI and CardBus cards and
65 PowerMacs G3 B&W contain the PCILynx controller. Therefore 69 PowerMacs G3 B&W contain the PCILynx controller. Therefore
@@ -79,6 +83,14 @@ config IEEE1394_SBP2
79 You should also enable support for disks, CD-ROMs, etc. in the SCSI 83 You should also enable support for disks, CD-ROMs, etc. in the SCSI
80 configuration section. 84 configuration section.
81 85
86 To compile this driver as a module, say M here: the module will be
87 called sbp2.
88
89 NOTE:
90 sbp2 is superseded by the newer firewire-sbp2 driver. See
91 http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for
92 further information on how to switch to the new FireWire drivers.
93
82config IEEE1394_SBP2_PHYS_DMA 94config IEEE1394_SBP2_PHYS_DMA
83 bool "Enable replacement for physical DMA in SBP2" 95 bool "Enable replacement for physical DMA in SBP2"
84 depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL 96 depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL
@@ -111,6 +123,11 @@ config IEEE1394_ETH1394
111 123
112 The module is called eth1394 although it does not emulate Ethernet. 124 The module is called eth1394 although it does not emulate Ethernet.
113 125
126 NOTE:
127 eth1394 is superseded by the newer firewire-net driver. See
128 http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for
129 further information on how to switch to the new FireWire drivers.
130
114config IEEE1394_RAWIO 131config IEEE1394_RAWIO
115 tristate "raw1394 userspace interface" 132 tristate "raw1394 userspace interface"
116 depends on IEEE1394 133 depends on IEEE1394
@@ -123,6 +140,11 @@ config IEEE1394_RAWIO
123 To compile this driver as a module, say M here: the module will be 140 To compile this driver as a module, say M here: the module will be
124 called raw1394. 141 called raw1394.
125 142
143 NOTE:
144 raw1394 is superseded by the newer firewire-core driver. See
145 http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for
146 further information on how to switch to the new FireWire drivers.
147
126config IEEE1394_VIDEO1394 148config IEEE1394_VIDEO1394
127 tristate "video1394 userspace interface" 149 tristate "video1394 userspace interface"
128 depends on IEEE1394 && IEEE1394_OHCI1394 150 depends on IEEE1394 && IEEE1394_OHCI1394
@@ -136,13 +158,18 @@ config IEEE1394_VIDEO1394
136 To compile this driver as a module, say M here: the module will be 158 To compile this driver as a module, say M here: the module will be
137 called video1394. 159 called video1394.
138 160
161 NOTE:
162 video1394 is superseded by the newer firewire-core driver. See
163 http://ieee1394.wiki.kernel.org/index.php/Juju_Migration for
164 further information on how to switch to the new FireWire drivers.
165
139config IEEE1394_DV1394 166config IEEE1394_DV1394
140 tristate "dv1394 userspace interface (deprecated)" 167 tristate "dv1394 userspace interface (deprecated)"
141 depends on IEEE1394 && IEEE1394_OHCI1394 168 depends on IEEE1394 && IEEE1394_OHCI1394
142 help 169 help
143 The dv1394 driver is unsupported and may be removed from Linux in a 170 The dv1394 driver is unsupported and may be removed from Linux in a
144 future release. Its functionality is now provided by raw1394 together 171 future release. Its functionality is now provided by either
145 with libraries such as libiec61883. 172 raw1394 or firewire-core together with libraries such as libiec61883.
146 173
147config IEEE1394_VERBOSEDEBUG 174config IEEE1394_VERBOSEDEBUG
148 bool "Excessive debugging output" 175 bool "Excessive debugging output"
@@ -153,5 +180,3 @@ config IEEE1394_VERBOSEDEBUG
153 will quickly result in large amounts of data sent to the system log. 180 will quickly result in large amounts of data sent to the system log.
154 181
155 Say Y if you really need the debugging output. Everyone else says N. 182 Say Y if you really need the debugging output. Everyone else says N.
156
157endmenu
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index fbdd73106000..cc9b5940fa97 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2083,7 +2083,7 @@ static int cma_get_port(struct rdma_id_private *id_priv)
2083static int cma_check_linklocal(struct rdma_dev_addr *dev_addr, 2083static int cma_check_linklocal(struct rdma_dev_addr *dev_addr,
2084 struct sockaddr *addr) 2084 struct sockaddr *addr)
2085{ 2085{
2086#if defined(CONFIG_IPv6) || defined(CONFIG_IPV6_MODULE) 2086#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
2087 struct sockaddr_in6 *sin6; 2087 struct sockaddr_in6 *sin6;
2088 2088
2089 if (addr->sa_family != AF_INET6) 2089 if (addr->sa_family != AF_INET6)
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.h b/drivers/infiniband/hw/cxgb3/cxio_hal.h
index bfd03bf8be54..f3d440cc68f2 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.h
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h
@@ -34,6 +34,7 @@
34 34
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/kfifo.h>
37 38
38#include "t3_cpl.h" 39#include "t3_cpl.h"
39#include "t3cdev.h" 40#include "t3cdev.h"
@@ -75,13 +76,13 @@ struct cxio_hal_ctrl_qp {
75}; 76};
76 77
77struct cxio_hal_resource { 78struct cxio_hal_resource {
78 struct kfifo *tpt_fifo; 79 struct kfifo tpt_fifo;
79 spinlock_t tpt_fifo_lock; 80 spinlock_t tpt_fifo_lock;
80 struct kfifo *qpid_fifo; 81 struct kfifo qpid_fifo;
81 spinlock_t qpid_fifo_lock; 82 spinlock_t qpid_fifo_lock;
82 struct kfifo *cqid_fifo; 83 struct kfifo cqid_fifo;
83 spinlock_t cqid_fifo_lock; 84 spinlock_t cqid_fifo_lock;
84 struct kfifo *pdid_fifo; 85 struct kfifo pdid_fifo;
85 spinlock_t pdid_fifo_lock; 86 spinlock_t pdid_fifo_lock;
86}; 87};
87 88
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c
index bd233c087653..31f9201b2980 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_resource.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c
@@ -39,12 +39,12 @@
39#include "cxio_resource.h" 39#include "cxio_resource.h"
40#include "cxio_hal.h" 40#include "cxio_hal.h"
41 41
42static struct kfifo *rhdl_fifo; 42static struct kfifo rhdl_fifo;
43static spinlock_t rhdl_fifo_lock; 43static spinlock_t rhdl_fifo_lock;
44 44
45#define RANDOM_SIZE 16 45#define RANDOM_SIZE 16
46 46
47static int __cxio_init_resource_fifo(struct kfifo **fifo, 47static int __cxio_init_resource_fifo(struct kfifo *fifo,
48 spinlock_t *fifo_lock, 48 spinlock_t *fifo_lock,
49 u32 nr, u32 skip_low, 49 u32 nr, u32 skip_low,
50 u32 skip_high, 50 u32 skip_high,
@@ -55,12 +55,11 @@ static int __cxio_init_resource_fifo(struct kfifo **fifo,
55 u32 rarray[16]; 55 u32 rarray[16];
56 spin_lock_init(fifo_lock); 56 spin_lock_init(fifo_lock);
57 57
58 *fifo = kfifo_alloc(nr * sizeof(u32), GFP_KERNEL, fifo_lock); 58 if (kfifo_alloc(fifo, nr * sizeof(u32), GFP_KERNEL))
59 if (IS_ERR(*fifo))
60 return -ENOMEM; 59 return -ENOMEM;
61 60
62 for (i = 0; i < skip_low + skip_high; i++) 61 for (i = 0; i < skip_low + skip_high; i++)
63 __kfifo_put(*fifo, (unsigned char *) &entry, sizeof(u32)); 62 kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32));
64 if (random) { 63 if (random) {
65 j = 0; 64 j = 0;
66 random_bytes = random32(); 65 random_bytes = random32();
@@ -72,33 +71,35 @@ static int __cxio_init_resource_fifo(struct kfifo **fifo,
72 random_bytes = random32(); 71 random_bytes = random32();
73 } 72 }
74 idx = (random_bytes >> (j * 2)) & 0xF; 73 idx = (random_bytes >> (j * 2)) & 0xF;
75 __kfifo_put(*fifo, 74 kfifo_in(fifo,
76 (unsigned char *) &rarray[idx], 75 (unsigned char *) &rarray[idx],
77 sizeof(u32)); 76 sizeof(u32));
78 rarray[idx] = i; 77 rarray[idx] = i;
79 j++; 78 j++;
80 } 79 }
81 for (i = 0; i < RANDOM_SIZE; i++) 80 for (i = 0; i < RANDOM_SIZE; i++)
82 __kfifo_put(*fifo, 81 kfifo_in(fifo,
83 (unsigned char *) &rarray[i], 82 (unsigned char *) &rarray[i],
84 sizeof(u32)); 83 sizeof(u32));
85 } else 84 } else
86 for (i = skip_low; i < nr - skip_high; i++) 85 for (i = skip_low; i < nr - skip_high; i++)
87 __kfifo_put(*fifo, (unsigned char *) &i, sizeof(u32)); 86 kfifo_in(fifo, (unsigned char *) &i, sizeof(u32));
88 87
89 for (i = 0; i < skip_low + skip_high; i++) 88 for (i = 0; i < skip_low + skip_high; i++)
90 kfifo_get(*fifo, (unsigned char *) &entry, sizeof(u32)); 89 if (kfifo_out_locked(fifo, (unsigned char *) &entry,
90 sizeof(u32), fifo_lock) != sizeof(u32))
91 break;
91 return 0; 92 return 0;
92} 93}
93 94
94static int cxio_init_resource_fifo(struct kfifo **fifo, spinlock_t * fifo_lock, 95static int cxio_init_resource_fifo(struct kfifo *fifo, spinlock_t * fifo_lock,
95 u32 nr, u32 skip_low, u32 skip_high) 96 u32 nr, u32 skip_low, u32 skip_high)
96{ 97{
97 return (__cxio_init_resource_fifo(fifo, fifo_lock, nr, skip_low, 98 return (__cxio_init_resource_fifo(fifo, fifo_lock, nr, skip_low,
98 skip_high, 0)); 99 skip_high, 0));
99} 100}
100 101
101static int cxio_init_resource_fifo_random(struct kfifo **fifo, 102static int cxio_init_resource_fifo_random(struct kfifo *fifo,
102 spinlock_t * fifo_lock, 103 spinlock_t * fifo_lock,
103 u32 nr, u32 skip_low, u32 skip_high) 104 u32 nr, u32 skip_low, u32 skip_high)
104{ 105{
@@ -113,15 +114,13 @@ static int cxio_init_qpid_fifo(struct cxio_rdev *rdev_p)
113 114
114 spin_lock_init(&rdev_p->rscp->qpid_fifo_lock); 115 spin_lock_init(&rdev_p->rscp->qpid_fifo_lock);
115 116
116 rdev_p->rscp->qpid_fifo = kfifo_alloc(T3_MAX_NUM_QP * sizeof(u32), 117 if (kfifo_alloc(&rdev_p->rscp->qpid_fifo, T3_MAX_NUM_QP * sizeof(u32),
117 GFP_KERNEL, 118 GFP_KERNEL))
118 &rdev_p->rscp->qpid_fifo_lock);
119 if (IS_ERR(rdev_p->rscp->qpid_fifo))
120 return -ENOMEM; 119 return -ENOMEM;
121 120
122 for (i = 16; i < T3_MAX_NUM_QP; i++) 121 for (i = 16; i < T3_MAX_NUM_QP; i++)
123 if (!(i & rdev_p->qpmask)) 122 if (!(i & rdev_p->qpmask))
124 __kfifo_put(rdev_p->rscp->qpid_fifo, 123 kfifo_in(&rdev_p->rscp->qpid_fifo,
125 (unsigned char *) &i, sizeof(u32)); 124 (unsigned char *) &i, sizeof(u32));
126 return 0; 125 return 0;
127} 126}
@@ -134,7 +133,7 @@ int cxio_hal_init_rhdl_resource(u32 nr_rhdl)
134 133
135void cxio_hal_destroy_rhdl_resource(void) 134void cxio_hal_destroy_rhdl_resource(void)
136{ 135{
137 kfifo_free(rhdl_fifo); 136 kfifo_free(&rhdl_fifo);
138} 137}
139 138
140/* nr_* must be power of 2 */ 139/* nr_* must be power of 2 */
@@ -167,11 +166,11 @@ int cxio_hal_init_resource(struct cxio_rdev *rdev_p,
167 goto pdid_err; 166 goto pdid_err;
168 return 0; 167 return 0;
169pdid_err: 168pdid_err:
170 kfifo_free(rscp->cqid_fifo); 169 kfifo_free(&rscp->cqid_fifo);
171cqid_err: 170cqid_err:
172 kfifo_free(rscp->qpid_fifo); 171 kfifo_free(&rscp->qpid_fifo);
173qpid_err: 172qpid_err:
174 kfifo_free(rscp->tpt_fifo); 173 kfifo_free(&rscp->tpt_fifo);
175tpt_err: 174tpt_err:
176 return -ENOMEM; 175 return -ENOMEM;
177} 176}
@@ -179,33 +178,37 @@ tpt_err:
179/* 178/*
180 * returns 0 if no resource available 179 * returns 0 if no resource available
181 */ 180 */
182static u32 cxio_hal_get_resource(struct kfifo *fifo) 181static u32 cxio_hal_get_resource(struct kfifo *fifo, spinlock_t * lock)
183{ 182{
184 u32 entry; 183 u32 entry;
185 if (kfifo_get(fifo, (unsigned char *) &entry, sizeof(u32))) 184 if (kfifo_out_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock))
186 return entry; 185 return entry;
187 else 186 else
188 return 0; /* fifo emptry */ 187 return 0; /* fifo emptry */
189} 188}
190 189
191static void cxio_hal_put_resource(struct kfifo *fifo, u32 entry) 190static void cxio_hal_put_resource(struct kfifo *fifo, spinlock_t * lock,
191 u32 entry)
192{ 192{
193 BUG_ON(kfifo_put(fifo, (unsigned char *) &entry, sizeof(u32)) == 0); 193 BUG_ON(
194 kfifo_in_locked(fifo, (unsigned char *) &entry, sizeof(u32), lock)
195 == 0);
194} 196}
195 197
196u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp) 198u32 cxio_hal_get_stag(struct cxio_hal_resource *rscp)
197{ 199{
198 return cxio_hal_get_resource(rscp->tpt_fifo); 200 return cxio_hal_get_resource(&rscp->tpt_fifo, &rscp->tpt_fifo_lock);
199} 201}
200 202
201void cxio_hal_put_stag(struct cxio_hal_resource *rscp, u32 stag) 203void cxio_hal_put_stag(struct cxio_hal_resource *rscp, u32 stag)
202{ 204{
203 cxio_hal_put_resource(rscp->tpt_fifo, stag); 205 cxio_hal_put_resource(&rscp->tpt_fifo, &rscp->tpt_fifo_lock, stag);
204} 206}
205 207
206u32 cxio_hal_get_qpid(struct cxio_hal_resource *rscp) 208u32 cxio_hal_get_qpid(struct cxio_hal_resource *rscp)
207{ 209{
208 u32 qpid = cxio_hal_get_resource(rscp->qpid_fifo); 210 u32 qpid = cxio_hal_get_resource(&rscp->qpid_fifo,
211 &rscp->qpid_fifo_lock);
209 PDBG("%s qpid 0x%x\n", __func__, qpid); 212 PDBG("%s qpid 0x%x\n", __func__, qpid);
210 return qpid; 213 return qpid;
211} 214}
@@ -213,35 +216,35 @@ u32 cxio_hal_get_qpid(struct cxio_hal_resource *rscp)
213void cxio_hal_put_qpid(struct cxio_hal_resource *rscp, u32 qpid) 216void cxio_hal_put_qpid(struct cxio_hal_resource *rscp, u32 qpid)
214{ 217{
215 PDBG("%s qpid 0x%x\n", __func__, qpid); 218 PDBG("%s qpid 0x%x\n", __func__, qpid);
216 cxio_hal_put_resource(rscp->qpid_fifo, qpid); 219 cxio_hal_put_resource(&rscp->qpid_fifo, &rscp->qpid_fifo_lock, qpid);
217} 220}
218 221
219u32 cxio_hal_get_cqid(struct cxio_hal_resource *rscp) 222u32 cxio_hal_get_cqid(struct cxio_hal_resource *rscp)
220{ 223{
221 return cxio_hal_get_resource(rscp->cqid_fifo); 224 return cxio_hal_get_resource(&rscp->cqid_fifo, &rscp->cqid_fifo_lock);
222} 225}
223 226
224void cxio_hal_put_cqid(struct cxio_hal_resource *rscp, u32 cqid) 227void cxio_hal_put_cqid(struct cxio_hal_resource *rscp, u32 cqid)
225{ 228{
226 cxio_hal_put_resource(rscp->cqid_fifo, cqid); 229 cxio_hal_put_resource(&rscp->cqid_fifo, &rscp->cqid_fifo_lock, cqid);
227} 230}
228 231
229u32 cxio_hal_get_pdid(struct cxio_hal_resource *rscp) 232u32 cxio_hal_get_pdid(struct cxio_hal_resource *rscp)
230{ 233{
231 return cxio_hal_get_resource(rscp->pdid_fifo); 234 return cxio_hal_get_resource(&rscp->pdid_fifo, &rscp->pdid_fifo_lock);
232} 235}
233 236
234void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid) 237void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid)
235{ 238{
236 cxio_hal_put_resource(rscp->pdid_fifo, pdid); 239 cxio_hal_put_resource(&rscp->pdid_fifo, &rscp->pdid_fifo_lock, pdid);
237} 240}
238 241
239void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp) 242void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp)
240{ 243{
241 kfifo_free(rscp->tpt_fifo); 244 kfifo_free(&rscp->tpt_fifo);
242 kfifo_free(rscp->cqid_fifo); 245 kfifo_free(&rscp->cqid_fifo);
243 kfifo_free(rscp->qpid_fifo); 246 kfifo_free(&rscp->qpid_fifo);
244 kfifo_free(rscp->pdid_fifo); 247 kfifo_free(&rscp->pdid_fifo);
245 kfree(rscp); 248 kfree(rscp);
246} 249}
247 250
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 989555cee883..2a97c964b9ef 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1752,7 +1752,7 @@ int mlx4_ib_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
1752 ind = qp->rq.head & (qp->rq.wqe_cnt - 1); 1752 ind = qp->rq.head & (qp->rq.wqe_cnt - 1);
1753 1753
1754 for (nreq = 0; wr; ++nreq, wr = wr->next) { 1754 for (nreq = 0; wr; ++nreq, wr = wr->next) {
1755 if (mlx4_wq_overflow(&qp->rq, nreq, qp->ibqp.send_cq)) { 1755 if (mlx4_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) {
1756 err = -ENOMEM; 1756 err = -ENOMEM;
1757 *bad_wr = wr; 1757 *bad_wr = wr;
1758 goto out; 1758 goto out;
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index d42565258fb7..cf8085bcbd6d 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -74,6 +74,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
74 struct mlx4_ib_dev *dev = to_mdev(pd->device); 74 struct mlx4_ib_dev *dev = to_mdev(pd->device);
75 struct mlx4_ib_srq *srq; 75 struct mlx4_ib_srq *srq;
76 struct mlx4_wqe_srq_next_seg *next; 76 struct mlx4_wqe_srq_next_seg *next;
77 struct mlx4_wqe_data_seg *scatter;
77 int desc_size; 78 int desc_size;
78 int buf_size; 79 int buf_size;
79 int err; 80 int err;
@@ -149,6 +150,11 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
149 next = get_wqe(srq, i); 150 next = get_wqe(srq, i);
150 next->next_wqe_index = 151 next->next_wqe_index =
151 cpu_to_be16((i + 1) & (srq->msrq.max - 1)); 152 cpu_to_be16((i + 1) & (srq->msrq.max - 1));
153
154 for (scatter = (void *) (next + 1);
155 (void *) scatter < (void *) next + desc_size;
156 ++scatter)
157 scatter->lkey = cpu_to_be32(MLX4_INVALID_LKEY);
152 } 158 }
153 159
154 err = mlx4_mtt_init(dev->dev, srq->buf.npages, srq->buf.page_shift, 160 err = mlx4_mtt_init(dev->dev, srq->buf.npages, srq->buf.page_shift,
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index b483b2995fa9..f967008f332e 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -221,11 +221,27 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
221} 221}
222 222
223/* 223/*
224 * Only left/right direction should be used (under/over 0x8000) for
225 * forward/reverse motor direction (to keep calculation fast & simple).
226 */
227static u16 ml_calculate_direction(u16 direction, u16 force,
228 u16 new_direction, u16 new_force)
229{
230 if (!force)
231 return new_direction;
232 if (!new_force)
233 return direction;
234 return (((u32)(direction >> 1) * force +
235 (new_direction >> 1) * new_force) /
236 (force + new_force)) << 1;
237}
238
239/*
224 * Combine two effects and apply gain. 240 * Combine two effects and apply gain.
225 */ 241 */
226static void ml_combine_effects(struct ff_effect *effect, 242static void ml_combine_effects(struct ff_effect *effect,
227 struct ml_effect_state *state, 243 struct ml_effect_state *state,
228 unsigned int gain) 244 int gain)
229{ 245{
230 struct ff_effect *new = state->effect; 246 struct ff_effect *new = state->effect;
231 unsigned int strong, weak, i; 247 unsigned int strong, weak, i;
@@ -252,8 +268,21 @@ static void ml_combine_effects(struct ff_effect *effect,
252 break; 268 break;
253 269
254 case FF_RUMBLE: 270 case FF_RUMBLE:
255 strong = new->u.rumble.strong_magnitude * gain / 0xffff; 271 strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff;
256 weak = new->u.rumble.weak_magnitude * gain / 0xffff; 272 weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff;
273
274 if (effect->u.rumble.strong_magnitude + strong)
275 effect->direction = ml_calculate_direction(
276 effect->direction,
277 effect->u.rumble.strong_magnitude,
278 new->direction, strong);
279 else if (effect->u.rumble.weak_magnitude + weak)
280 effect->direction = ml_calculate_direction(
281 effect->direction,
282 effect->u.rumble.weak_magnitude,
283 new->direction, weak);
284 else
285 effect->direction = 0;
257 effect->u.rumble.strong_magnitude = 286 effect->u.rumble.strong_magnitude =
258 min(strong + effect->u.rumble.strong_magnitude, 287 min(strong + effect->u.rumble.strong_magnitude,
259 0xffffU); 288 0xffffU);
@@ -268,6 +297,13 @@ static void ml_combine_effects(struct ff_effect *effect,
268 /* here we also scale it 0x7fff => 0xffff */ 297 /* here we also scale it 0x7fff => 0xffff */
269 i = i * gain / 0x7fff; 298 i = i * gain / 0x7fff;
270 299
300 if (effect->u.rumble.strong_magnitude + i)
301 effect->direction = ml_calculate_direction(
302 effect->direction,
303 effect->u.rumble.strong_magnitude,
304 new->direction, i);
305 else
306 effect->direction = 0;
271 effect->u.rumble.strong_magnitude = 307 effect->u.rumble.strong_magnitude =
272 min(i + effect->u.rumble.strong_magnitude, 0xffffU); 308 min(i + effect->u.rumble.strong_magnitude, 0xffffU);
273 effect->u.rumble.weak_magnitude = 309 effect->u.rumble.weak_magnitude =
@@ -411,8 +447,6 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
411 msecs_to_jiffies(state->effect->replay.length); 447 msecs_to_jiffies(state->effect->replay.length);
412 state->adj_at = state->play_at; 448 state->adj_at = state->play_at;
413 449
414 ml_schedule_timer(ml);
415
416 } else { 450 } else {
417 debug("initiated stop"); 451 debug("initiated stop");
418 452
@@ -420,10 +454,10 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
420 __set_bit(FF_EFFECT_ABORTING, &state->flags); 454 __set_bit(FF_EFFECT_ABORTING, &state->flags);
421 else 455 else
422 __clear_bit(FF_EFFECT_STARTED, &state->flags); 456 __clear_bit(FF_EFFECT_STARTED, &state->flags);
423
424 ml_play_effects(ml);
425 } 457 }
426 458
459 ml_play_effects(ml);
460
427 return 0; 461 return 0;
428} 462}
429 463
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index f6c688cae334..b1edd778639c 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev)
210 return 0; 210 return 0;
211} 211}
212 212
213static void iforce_release(struct input_dev *dev) 213static void iforce_close(struct input_dev *dev)
214{ 214{
215 struct iforce *iforce = input_get_drvdata(dev); 215 struct iforce *iforce = input_get_drvdata(dev);
216 int i; 216 int i;
@@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev)
228 228
229 /* Disable force feedback playback */ 229 /* Disable force feedback playback */
230 iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); 230 iforce_send_packet(iforce, FF_CMD_ENABLE, "\001");
231 /* Wait for the command to complete */
232 wait_event_interruptible(iforce->wait,
233 !test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags));
231 } 234 }
232 235
233 switch (iforce->bus) { 236 switch (iforce->bus) {
234#ifdef CONFIG_JOYSTICK_IFORCE_USB 237#ifdef CONFIG_JOYSTICK_IFORCE_USB
235 case IFORCE_USB:
236 usb_kill_urb(iforce->irq);
237
238 /* The device was unplugged before the file
239 * was released */
240 if (iforce->usbdev == NULL) {
241 iforce_delete_device(iforce);
242 kfree(iforce);
243 }
244 break;
245#endif
246 }
247}
248
249void iforce_delete_device(struct iforce *iforce)
250{
251 switch (iforce->bus) {
252#ifdef CONFIG_JOYSTICK_IFORCE_USB
253 case IFORCE_USB: 238 case IFORCE_USB:
254 iforce_usb_delete(iforce); 239 usb_kill_urb(iforce->irq);
240 usb_kill_urb(iforce->out);
241 usb_kill_urb(iforce->ctrl);
255 break; 242 break;
256#endif 243#endif
257#ifdef CONFIG_JOYSTICK_IFORCE_232 244#ifdef CONFIG_JOYSTICK_IFORCE_232
@@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce)
303 290
304 input_dev->name = "Unknown I-Force device"; 291 input_dev->name = "Unknown I-Force device";
305 input_dev->open = iforce_open; 292 input_dev->open = iforce_open;
306 input_dev->close = iforce_release; 293 input_dev->close = iforce_close;
307 294
308/* 295/*
309 * On-device memory allocation. 296 * On-device memory allocation.
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 9f289d8f52c6..b41303d3ec54 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb)
109 struct iforce *iforce = urb->context; 109 struct iforce *iforce = urb->context;
110 110
111 if (urb->status) { 111 if (urb->status) {
112 clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
112 dbg("urb->status %d, exiting", urb->status); 113 dbg("urb->status %d, exiting", urb->status);
113 return; 114 return;
114 } 115 }
@@ -186,33 +187,19 @@ fail:
186 return err; 187 return err;
187} 188}
188 189
189/* Called by iforce_delete() */
190void iforce_usb_delete(struct iforce* iforce)
191{
192 usb_kill_urb(iforce->irq);
193 usb_kill_urb(iforce->out);
194 usb_kill_urb(iforce->ctrl);
195
196 usb_free_urb(iforce->irq);
197 usb_free_urb(iforce->out);
198 usb_free_urb(iforce->ctrl);
199}
200
201static void iforce_usb_disconnect(struct usb_interface *intf) 190static void iforce_usb_disconnect(struct usb_interface *intf)
202{ 191{
203 struct iforce *iforce = usb_get_intfdata(intf); 192 struct iforce *iforce = usb_get_intfdata(intf);
204 int open = 0; /* FIXME! iforce->dev.handle->open; */
205 193
206 usb_set_intfdata(intf, NULL); 194 usb_set_intfdata(intf, NULL);
207 if (iforce) {
208 iforce->usbdev = NULL;
209 input_unregister_device(iforce->dev);
210 195
211 if (!open) { 196 input_unregister_device(iforce->dev);
212 iforce_delete_device(iforce); 197
213 kfree(iforce); 198 usb_free_urb(iforce->irq);
214 } 199 usb_free_urb(iforce->out);
215 } 200 usb_free_urb(iforce->ctrl);
201
202 kfree(iforce);
216} 203}
217 204
218static struct usb_device_id iforce_usb_ids [] = { 205static struct usb_device_id iforce_usb_ids [] = {
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index f2d91f4028ca..9f494b75848a 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -150,11 +150,9 @@ void iforce_serial_xmit(struct iforce *iforce);
150 150
151/* iforce-usb.c */ 151/* iforce-usb.c */
152void iforce_usb_xmit(struct iforce *iforce); 152void iforce_usb_xmit(struct iforce *iforce);
153void iforce_usb_delete(struct iforce *iforce);
154 153
155/* iforce-main.c */ 154/* iforce-main.c */
156int iforce_init_device(struct iforce *iforce); 155int iforce_init_device(struct iforce *iforce);
157void iforce_delete_device(struct iforce *iforce);
158 156
159/* iforce-packets.c */ 157/* iforce-packets.c */
160int iforce_control_playback(struct iforce*, u16 id, unsigned int); 158int iforce_control_playback(struct iforce*, u16 id, unsigned int);
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index a3573570c52f..1f5e2ce327d6 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -134,7 +134,8 @@ static const unsigned short atkbd_unxlate_table[128] = {
134#define ATKBD_CMD_GETID 0x02f2 134#define ATKBD_CMD_GETID 0x02f2
135#define ATKBD_CMD_SETREP 0x10f3 135#define ATKBD_CMD_SETREP 0x10f3
136#define ATKBD_CMD_ENABLE 0x00f4 136#define ATKBD_CMD_ENABLE 0x00f4
137#define ATKBD_CMD_RESET_DIS 0x00f5 137#define ATKBD_CMD_RESET_DIS 0x00f5 /* Reset to defaults and disable */
138#define ATKBD_CMD_RESET_DEF 0x00f6 /* Reset to defaults */
138#define ATKBD_CMD_SETALL_MBR 0x00fa 139#define ATKBD_CMD_SETALL_MBR 0x00fa
139#define ATKBD_CMD_RESET_BAT 0x02ff 140#define ATKBD_CMD_RESET_BAT 0x02ff
140#define ATKBD_CMD_RESEND 0x00fe 141#define ATKBD_CMD_RESEND 0x00fe
@@ -836,7 +837,7 @@ static void atkbd_cleanup(struct serio *serio)
836 struct atkbd *atkbd = serio_get_drvdata(serio); 837 struct atkbd *atkbd = serio_get_drvdata(serio);
837 838
838 atkbd_disable(atkbd); 839 atkbd_disable(atkbd);
839 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); 840 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_DEF);
840} 841}
841 842
842 843
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 34f4a29d4973..d3c8b61a941d 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -29,11 +29,13 @@ struct matrix_keypad {
29 unsigned short *keycodes; 29 unsigned short *keycodes;
30 unsigned int row_shift; 30 unsigned int row_shift;
31 31
32 DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS);
33
32 uint32_t last_key_state[MATRIX_MAX_COLS]; 34 uint32_t last_key_state[MATRIX_MAX_COLS];
33 struct delayed_work work; 35 struct delayed_work work;
36 spinlock_t lock;
34 bool scan_pending; 37 bool scan_pending;
35 bool stopped; 38 bool stopped;
36 spinlock_t lock;
37}; 39};
38 40
39/* 41/*
@@ -222,9 +224,16 @@ static int matrix_keypad_suspend(struct device *dev)
222 224
223 matrix_keypad_stop(keypad->input_dev); 225 matrix_keypad_stop(keypad->input_dev);
224 226
225 if (device_may_wakeup(&pdev->dev)) 227 if (device_may_wakeup(&pdev->dev)) {
226 for (i = 0; i < pdata->num_row_gpios; i++) 228 for (i = 0; i < pdata->num_row_gpios; i++) {
227 enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); 229 if (!test_bit(i, keypad->disabled_gpios)) {
230 unsigned int gpio = pdata->row_gpios[i];
231
232 if (enable_irq_wake(gpio_to_irq(gpio)) == 0)
233 __set_bit(i, keypad->disabled_gpios);
234 }
235 }
236 }
228 237
229 return 0; 238 return 0;
230} 239}
@@ -236,9 +245,15 @@ static int matrix_keypad_resume(struct device *dev)
236 const struct matrix_keypad_platform_data *pdata = keypad->pdata; 245 const struct matrix_keypad_platform_data *pdata = keypad->pdata;
237 int i; 246 int i;
238 247
239 if (device_may_wakeup(&pdev->dev)) 248 if (device_may_wakeup(&pdev->dev)) {
240 for (i = 0; i < pdata->num_row_gpios; i++) 249 for (i = 0; i < pdata->num_row_gpios; i++) {
241 disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); 250 if (test_and_clear_bit(i, keypad->disabled_gpios)) {
251 unsigned int gpio = pdata->row_gpios[i];
252
253 disable_irq_wake(gpio_to_irq(gpio));
254 }
255 }
256 }
242 257
243 matrix_keypad_start(keypad->input_dev); 258 matrix_keypad_start(keypad->input_dev);
244 259
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index eeaa7acb9cfc..21d6184efa96 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -253,14 +253,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
253 u8 reg; 253 u8 reg;
254 int ret; 254 int ret;
255 255
256#ifdef CONFIG_LOCKDEP
257 /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
258 * we don't want and can't tolerate. Although it might be
259 * friendlier not to borrow this thread context...
260 */
261 local_irq_enable();
262#endif
263
264 /* Read & Clear TWL4030 pending interrupt */ 256 /* Read & Clear TWL4030 pending interrupt */
265 ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1); 257 ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1);
266 258
@@ -403,7 +395,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev)
403 * 395 *
404 * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ... 396 * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ...
405 */ 397 */
406 error = request_irq(kp->irq, do_kp_irq, 0, pdev->name, kp); 398 error = request_threaded_irq(kp->irq, NULL, do_kp_irq,
399 0, pdev->name, kp);
407 if (error) { 400 if (error) {
408 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n", 401 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
409 kp->irq); 402 kp->irq);
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index bdde5c889035..e9069b87fde2 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -39,18 +39,8 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
39 int err; 39 int err;
40 u8 value; 40 u8 value;
41 41
42#ifdef CONFIG_LOCKDEP
43 /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
44 * we don't want and can't tolerate since this is a threaded
45 * IRQ and can sleep due to the i2c reads it has to issue.
46 * Although it might be friendlier not to borrow this thread
47 * context...
48 */
49 local_irq_enable();
50#endif
51
52 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, 42 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value,
53 STS_HW_CONDITIONS); 43 STS_HW_CONDITIONS);
54 if (!err) { 44 if (!err) {
55 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); 45 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
56 input_sync(pwr); 46 input_sync(pwr);
@@ -80,7 +70,7 @@ static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev)
80 pwr->phys = "twl4030_pwrbutton/input0"; 70 pwr->phys = "twl4030_pwrbutton/input0";
81 pwr->dev.parent = &pdev->dev; 71 pwr->dev.parent = &pdev->dev;
82 72
83 err = request_irq(irq, powerbutton_irq, 73 err = request_threaded_irq(irq, NULL, powerbutton_irq,
84 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 74 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
85 "twl4030_pwrbutton", pwr); 75 "twl4030_pwrbutton", pwr);
86 if (err < 0) { 76 if (err < 0) {
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 38da6ab04384..c0afb71a3a6d 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1328,7 +1328,7 @@ static struct platform_driver wistron_driver = {
1328 .driver = { 1328 .driver = {
1329 .name = "wistron-bios", 1329 .name = "wistron-bios",
1330 .owner = THIS_MODULE, 1330 .owner = THIS_MODULE,
1331#if CONFIG_PM 1331#ifdef CONFIG_PM
1332 .pm = &wistron_pm_ops, 1332 .pm = &wistron_pm_ops,
1333#endif 1333#endif
1334 }, 1334 },
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 3feeb3af8abd..c714ca2407f8 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS
70config MOUSE_PS2_LIFEBOOK 70config MOUSE_PS2_LIFEBOOK
71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED 71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
72 default y 72 default y
73 depends on MOUSE_PS2 && X86 73 depends on MOUSE_PS2 && X86 && DMI
74 help 74 help
75 Say Y here if you have a Fujitsu B-series Lifebook PS/2 75 Say Y here if you have a Fujitsu B-series Lifebook PS/2
76 TouchScreen connected to your system. 76 TouchScreen connected to your system.
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index b146237266d8..90be30e93556 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -427,7 +427,6 @@ static void hgpk_recalib_work(struct work_struct *work)
427 427
428static int hgpk_register(struct psmouse *psmouse) 428static int hgpk_register(struct psmouse *psmouse)
429{ 429{
430 struct input_dev *dev = psmouse->dev;
431 int err; 430 int err;
432 431
433 /* register handlers */ 432 /* register handlers */
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 2e6bdfea0165..6d7aa10d10f0 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -44,7 +44,6 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
44} 44}
45 45
46static const struct dmi_system_id __initconst lifebook_dmi_table[] = { 46static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
47#if defined(CONFIG_DMI) && defined(CONFIG_X86)
48 { 47 {
49 /* FLORA-ie 55mi */ 48 /* FLORA-ie 55mi */
50 .matches = { 49 .matches = {
@@ -118,7 +117,6 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
118 }, 117 },
119 }, 118 },
120 { } 119 { }
121#endif
122}; 120};
123 121
124void __init lifebook_module_init(void) 122void __init lifebook_module_init(void)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index fd0bc094616a..401ac6b6edd4 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1137,7 +1137,10 @@ static void psmouse_cleanup(struct serio *serio)
1137 if (psmouse->cleanup) 1137 if (psmouse->cleanup)
1138 psmouse->cleanup(psmouse); 1138 psmouse->cleanup(psmouse);
1139 1139
1140 psmouse_reset(psmouse); 1140/*
1141 * Reset the mouse to defaults (bare PS/2 protocol).
1142 */
1143 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
1141 1144
1142/* 1145/*
1143 * Some boxes, such as HP nx7400, get terribly confused if mouse 1146 * Some boxes, such as HP nx7400, get terribly confused if mouse
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 0236f0d5fd91..e0f30186d513 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -284,13 +284,7 @@ static void serio_handle_event(void)
284 284
285 mutex_lock(&serio_mutex); 285 mutex_lock(&serio_mutex);
286 286
287 /* 287 while ((event = serio_get_event())) {
288 * Note that we handle only one event here to give swsusp
289 * a chance to freeze kseriod thread. Serio events should
290 * be pretty rare so we are not concerned about taking
291 * performance hit.
292 */
293 if ((event = serio_get_event())) {
294 288
295 switch (event->type) { 289 switch (event->type) {
296 case SERIO_REGISTER_PORT: 290 case SERIO_REGISTER_PORT:
@@ -380,10 +374,9 @@ static struct serio *serio_get_pending_child(struct serio *parent)
380 374
381static int serio_thread(void *nothing) 375static int serio_thread(void *nothing)
382{ 376{
383 set_freezable();
384 do { 377 do {
385 serio_handle_event(); 378 serio_handle_event();
386 wait_event_freezable(serio_wait, 379 wait_event_interruptible(serio_wait,
387 kthread_should_stop() || !list_empty(&serio_event_list)); 380 kthread_should_stop() || !list_empty(&serio_event_list));
388 } while (!kthread_should_stop()); 381 } while (!kthread_should_stop());
389 382
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index a6624ad252c5..1a1420d7a828 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -3152,7 +3152,7 @@ static void
3152hfcmulti_pcm(struct hfc_multi *hc, int ch, int slot_tx, int bank_tx, 3152hfcmulti_pcm(struct hfc_multi *hc, int ch, int slot_tx, int bank_tx,
3153 int slot_rx, int bank_rx) 3153 int slot_rx, int bank_rx)
3154{ 3154{
3155 if (slot_rx < 0 || slot_rx < 0 || bank_tx < 0 || bank_rx < 0) { 3155 if (slot_tx < 0 || slot_rx < 0 || bank_tx < 0 || bank_rx < 0) {
3156 /* disable PCM */ 3156 /* disable PCM */
3157 mode_hfcmulti(hc, ch, hc->chan[ch].protocol, -1, 0, -1, 0); 3157 mode_hfcmulti(hc, ch, hc->chan[ch].protocol, -1, 0, -1, 0);
3158 return; 3158 return;
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c
index 7e5f30dbc0a0..f1e8af54dff0 100644
--- a/drivers/isdn/mISDN/l1oip_core.c
+++ b/drivers/isdn/mISDN/l1oip_core.c
@@ -661,7 +661,7 @@ l1oip_socket_thread(void *data)
661 size_t recvbuf_size = 1500; 661 size_t recvbuf_size = 1500;
662 int recvlen; 662 int recvlen;
663 struct socket *socket = NULL; 663 struct socket *socket = NULL;
664 DECLARE_COMPLETION(wait); 664 DECLARE_COMPLETION_ONSTACK(wait);
665 665
666 /* allocate buffer memory */ 666 /* allocate buffer memory */
667 recvbuf = kmalloc(recvbuf_size, GFP_KERNEL); 667 recvbuf = kmalloc(recvbuf_size, GFP_KERNEL);
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index e4f599f20e38..8a0e1ec95e4a 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -229,6 +229,12 @@ config LEDS_PWM
229 help 229 help
230 This option enables support for pwm driven LEDs 230 This option enables support for pwm driven LEDs
231 231
232config LEDS_REGULATOR
233 tristate "REGULATOR driven LED support"
234 depends on LEDS_CLASS && REGULATOR
235 help
236 This option enables support for regulator driven LEDs.
237
232config LEDS_BD2802 238config LEDS_BD2802
233 tristate "LED driver for BD2802 RGB LED" 239 tristate "LED driver for BD2802 RGB LED"
234 depends on LEDS_CLASS && I2C 240 depends on LEDS_CLASS && I2C
@@ -236,6 +242,33 @@ config LEDS_BD2802
236 This option enables support for BD2802GU RGB LED driver chips 242 This option enables support for BD2802GU RGB LED driver chips
237 accessed via the I2C bus. 243 accessed via the I2C bus.
238 244
245config LEDS_INTEL_SS4200
246 tristate "LED driver for Intel NAS SS4200 series"
247 depends on LEDS_CLASS && PCI && DMI
248 help
249 This option enables support for the Intel SS4200 series of
250 Network Attached Storage servers. You may control the hard
251 drive or power LEDs on the front panel. Using this driver
252 can stop the front LED from blinking after startup.
253
254config LEDS_LT3593
255 tristate "LED driver for LT3593 controllers"
256 depends on LEDS_CLASS && GENERIC_GPIO
257 help
258 This option enables support for LEDs driven by a Linear Technology
259 LT3593 controller. This controller uses a special one-wire pulse
260 coding protocol to set the brightness.
261
262config LEDS_ADP5520
263 tristate "LED Support for ADP5520/ADP5501 PMIC"
264 depends on LEDS_CLASS && PMIC_ADP5520
265 help
266 This option enables support for on-chip LED drivers found
267 on Analog Devices ADP5520/ADP5501 PMICs.
268
269 To compile this driver as a module, choose M here: the module will
270 be called leds-adp5520.
271
239comment "LED Triggers" 272comment "LED Triggers"
240 273
241config LEDS_TRIGGERS 274config LEDS_TRIGGERS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 46d72704d606..9e63869d7c0d 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -29,6 +29,10 @@ obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
29obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o 29obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
30obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o 30obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
31obj-$(CONFIG_LEDS_PWM) += leds-pwm.o 31obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
32obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o
33obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o
34obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
35obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
32 36
33# LED SPI Drivers 37# LED SPI Drivers
34obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o 38obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
diff --git a/drivers/leds/leds-adp5520.c b/drivers/leds/leds-adp5520.c
new file mode 100644
index 000000000000..a8f315902131
--- /dev/null
+++ b/drivers/leds/leds-adp5520.c
@@ -0,0 +1,230 @@
1/*
2 * LEDs driver for Analog Devices ADP5520/ADP5501 MFD PMICs
3 *
4 * Copyright 2009 Analog Devices Inc.
5 *
6 * Loosely derived from leds-da903x:
7 * Copyright (C) 2008 Compulab, Ltd.
8 * Mike Rapoport <mike@compulab.co.il>
9 *
10 * Copyright (C) 2006-2008 Marvell International Ltd.
11 * Eric Miao <eric.miao@marvell.com>
12 *
13 * Licensed under the GPL-2 or later.
14 */
15
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/platform_device.h>
20#include <linux/leds.h>
21#include <linux/workqueue.h>
22#include <linux/mfd/adp5520.h>
23
24struct adp5520_led {
25 struct led_classdev cdev;
26 struct work_struct work;
27 struct device *master;
28 enum led_brightness new_brightness;
29 int id;
30 int flags;
31};
32
33static void adp5520_led_work(struct work_struct *work)
34{
35 struct adp5520_led *led = container_of(work, struct adp5520_led, work);
36 adp5520_write(led->master, ADP5520_LED1_CURRENT + led->id - 1,
37 led->new_brightness >> 2);
38}
39
40static void adp5520_led_set(struct led_classdev *led_cdev,
41 enum led_brightness value)
42{
43 struct adp5520_led *led;
44
45 led = container_of(led_cdev, struct adp5520_led, cdev);
46 led->new_brightness = value;
47 schedule_work(&led->work);
48}
49
50static int adp5520_led_setup(struct adp5520_led *led)
51{
52 struct device *dev = led->master;
53 int flags = led->flags;
54 int ret = 0;
55
56 switch (led->id) {
57 case FLAG_ID_ADP5520_LED1_ADP5501_LED0:
58 ret |= adp5520_set_bits(dev, ADP5520_LED_TIME,
59 (flags >> ADP5520_FLAG_OFFT_SHIFT) &
60 ADP5520_FLAG_OFFT_MASK);
61 ret |= adp5520_set_bits(dev, ADP5520_LED_CONTROL,
62 ADP5520_LED1_EN);
63 break;
64 case FLAG_ID_ADP5520_LED2_ADP5501_LED1:
65 ret |= adp5520_set_bits(dev, ADP5520_LED_TIME,
66 ((flags >> ADP5520_FLAG_OFFT_SHIFT) &
67 ADP5520_FLAG_OFFT_MASK) << 2);
68 ret |= adp5520_clr_bits(dev, ADP5520_LED_CONTROL,
69 ADP5520_R3_MODE);
70 ret |= adp5520_set_bits(dev, ADP5520_LED_CONTROL,
71 ADP5520_LED2_EN);
72 break;
73 case FLAG_ID_ADP5520_LED3_ADP5501_LED2:
74 ret |= adp5520_set_bits(dev, ADP5520_LED_TIME,
75 ((flags >> ADP5520_FLAG_OFFT_SHIFT) &
76 ADP5520_FLAG_OFFT_MASK) << 4);
77 ret |= adp5520_clr_bits(dev, ADP5520_LED_CONTROL,
78 ADP5520_C3_MODE);
79 ret |= adp5520_set_bits(dev, ADP5520_LED_CONTROL,
80 ADP5520_LED3_EN);
81 break;
82 }
83
84 return ret;
85}
86
87static int __devinit adp5520_led_prepare(struct platform_device *pdev)
88{
89 struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data;
90 struct device *dev = pdev->dev.parent;
91 int ret = 0;
92
93 ret |= adp5520_write(dev, ADP5520_LED1_CURRENT, 0);
94 ret |= adp5520_write(dev, ADP5520_LED2_CURRENT, 0);
95 ret |= adp5520_write(dev, ADP5520_LED3_CURRENT, 0);
96 ret |= adp5520_write(dev, ADP5520_LED_TIME, pdata->led_on_time << 6);
97 ret |= adp5520_write(dev, ADP5520_LED_FADE, FADE_VAL(pdata->fade_in,
98 pdata->fade_out));
99
100 return ret;
101}
102
103static int __devinit adp5520_led_probe(struct platform_device *pdev)
104{
105 struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data;
106 struct adp5520_led *led, *led_dat;
107 struct led_info *cur_led;
108 int ret, i;
109
110 if (pdata == NULL) {
111 dev_err(&pdev->dev, "missing platform data\n");
112 return -ENODEV;
113 }
114
115 if (pdata->num_leds > ADP5520_01_MAXLEDS) {
116 dev_err(&pdev->dev, "can't handle more than %d LEDS\n",
117 ADP5520_01_MAXLEDS);
118 return -EFAULT;
119 }
120
121 led = kzalloc(sizeof(*led) * pdata->num_leds, GFP_KERNEL);
122 if (led == NULL) {
123 dev_err(&pdev->dev, "failed to alloc memory\n");
124 return -ENOMEM;
125 }
126
127 ret = adp5520_led_prepare(pdev);
128
129 if (ret) {
130 dev_err(&pdev->dev, "failed to write\n");
131 goto err_free;
132 }
133
134 for (i = 0; i < pdata->num_leds; ++i) {
135 cur_led = &pdata->leds[i];
136 led_dat = &led[i];
137
138 led_dat->cdev.name = cur_led->name;
139 led_dat->cdev.default_trigger = cur_led->default_trigger;
140 led_dat->cdev.brightness_set = adp5520_led_set;
141 led_dat->cdev.brightness = LED_OFF;
142
143 if (cur_led->flags & ADP5520_FLAG_LED_MASK)
144 led_dat->flags = cur_led->flags;
145 else
146 led_dat->flags = i + 1;
147
148 led_dat->id = led_dat->flags & ADP5520_FLAG_LED_MASK;
149
150 led_dat->master = pdev->dev.parent;
151 led_dat->new_brightness = LED_OFF;
152
153 INIT_WORK(&led_dat->work, adp5520_led_work);
154
155 ret = led_classdev_register(led_dat->master, &led_dat->cdev);
156 if (ret) {
157 dev_err(&pdev->dev, "failed to register LED %d\n",
158 led_dat->id);
159 goto err;
160 }
161
162 ret = adp5520_led_setup(led_dat);
163 if (ret) {
164 dev_err(&pdev->dev, "failed to write\n");
165 i++;
166 goto err;
167 }
168 }
169
170 platform_set_drvdata(pdev, led);
171 return 0;
172
173err:
174 if (i > 0) {
175 for (i = i - 1; i >= 0; i--) {
176 led_classdev_unregister(&led[i].cdev);
177 cancel_work_sync(&led[i].work);
178 }
179 }
180
181err_free:
182 kfree(led);
183 return ret;
184}
185
186static int __devexit adp5520_led_remove(struct platform_device *pdev)
187{
188 struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data;
189 struct adp5520_led *led;
190 int i;
191
192 led = platform_get_drvdata(pdev);
193
194 adp5520_clr_bits(led->master, ADP5520_LED_CONTROL,
195 ADP5520_LED1_EN | ADP5520_LED2_EN | ADP5520_LED3_EN);
196
197 for (i = 0; i < pdata->num_leds; i++) {
198 led_classdev_unregister(&led[i].cdev);
199 cancel_work_sync(&led[i].work);
200 }
201
202 kfree(led);
203 return 0;
204}
205
206static struct platform_driver adp5520_led_driver = {
207 .driver = {
208 .name = "adp5520-led",
209 .owner = THIS_MODULE,
210 },
211 .probe = adp5520_led_probe,
212 .remove = __devexit_p(adp5520_led_remove),
213};
214
215static int __init adp5520_led_init(void)
216{
217 return platform_driver_register(&adp5520_led_driver);
218}
219module_init(adp5520_led_init);
220
221static void __exit adp5520_led_exit(void)
222{
223 platform_driver_unregister(&adp5520_led_driver);
224}
225module_exit(adp5520_led_exit);
226
227MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
228MODULE_DESCRIPTION("LEDS ADP5520(01) Driver");
229MODULE_LICENSE("GPL");
230MODULE_ALIAS("platform:adp5520-led");
diff --git a/drivers/leds/leds-alix2.c b/drivers/leds/leds-alix2.c
index 731d4eef3425..f59ffadf5125 100644
--- a/drivers/leds/leds-alix2.c
+++ b/drivers/leds/leds-alix2.c
@@ -11,11 +11,24 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/pci.h>
14 15
15static int force = 0; 16static int force = 0;
16module_param(force, bool, 0444); 17module_param(force, bool, 0444);
17MODULE_PARM_DESC(force, "Assume system has ALIX.2/ALIX.3 style LEDs"); 18MODULE_PARM_DESC(force, "Assume system has ALIX.2/ALIX.3 style LEDs");
18 19
20#define MSR_LBAR_GPIO 0x5140000C
21#define CS5535_GPIO_SIZE 256
22
23static u32 gpio_base;
24
25static struct pci_device_id divil_pci[] = {
26 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) },
27 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) },
28 { } /* NULL entry */
29};
30MODULE_DEVICE_TABLE(pci, divil_pci);
31
19struct alix_led { 32struct alix_led {
20 struct led_classdev cdev; 33 struct led_classdev cdev;
21 unsigned short port; 34 unsigned short port;
@@ -30,9 +43,9 @@ static void alix_led_set(struct led_classdev *led_cdev,
30 container_of(led_cdev, struct alix_led, cdev); 43 container_of(led_cdev, struct alix_led, cdev);
31 44
32 if (brightness) 45 if (brightness)
33 outl(led_dev->on_value, led_dev->port); 46 outl(led_dev->on_value, gpio_base + led_dev->port);
34 else 47 else
35 outl(led_dev->off_value, led_dev->port); 48 outl(led_dev->off_value, gpio_base + led_dev->port);
36} 49}
37 50
38static struct alix_led alix_leds[] = { 51static struct alix_led alix_leds[] = {
@@ -41,7 +54,7 @@ static struct alix_led alix_leds[] = {
41 .name = "alix:1", 54 .name = "alix:1",
42 .brightness_set = alix_led_set, 55 .brightness_set = alix_led_set,
43 }, 56 },
44 .port = 0x6100, 57 .port = 0x00,
45 .on_value = 1 << 22, 58 .on_value = 1 << 22,
46 .off_value = 1 << 6, 59 .off_value = 1 << 6,
47 }, 60 },
@@ -50,7 +63,7 @@ static struct alix_led alix_leds[] = {
50 .name = "alix:2", 63 .name = "alix:2",
51 .brightness_set = alix_led_set, 64 .brightness_set = alix_led_set,
52 }, 65 },
53 .port = 0x6180, 66 .port = 0x80,
54 .on_value = 1 << 25, 67 .on_value = 1 << 25,
55 .off_value = 1 << 9, 68 .off_value = 1 << 9,
56 }, 69 },
@@ -59,7 +72,7 @@ static struct alix_led alix_leds[] = {
59 .name = "alix:3", 72 .name = "alix:3",
60 .brightness_set = alix_led_set, 73 .brightness_set = alix_led_set,
61 }, 74 },
62 .port = 0x6180, 75 .port = 0x80,
63 .on_value = 1 << 27, 76 .on_value = 1 << 27,
64 .off_value = 1 << 11, 77 .off_value = 1 << 11,
65 }, 78 },
@@ -101,64 +114,104 @@ static struct platform_driver alix_led_driver = {
101 }, 114 },
102}; 115};
103 116
104static int __init alix_present(void) 117static int __init alix_present(unsigned long bios_phys,
118 const char *alix_sig,
119 size_t alix_sig_len)
105{ 120{
106 const unsigned long bios_phys = 0x000f0000;
107 const size_t bios_len = 0x00010000; 121 const size_t bios_len = 0x00010000;
108 const char alix_sig[] = "PC Engines ALIX.";
109 const size_t alix_sig_len = sizeof(alix_sig) - 1;
110
111 const char *bios_virt; 122 const char *bios_virt;
112 const char *scan_end; 123 const char *scan_end;
113 const char *p; 124 const char *p;
114 int ret = 0; 125 char name[64];
115 126
116 if (force) { 127 if (force) {
117 printk(KERN_NOTICE "%s: forced to skip BIOS test, " 128 printk(KERN_NOTICE "%s: forced to skip BIOS test, "
118 "assume system has ALIX.2 style LEDs\n", 129 "assume system has ALIX.2 style LEDs\n",
119 KBUILD_MODNAME); 130 KBUILD_MODNAME);
120 ret = 1; 131 return 1;
121 goto out;
122 } 132 }
123 133
124 bios_virt = phys_to_virt(bios_phys); 134 bios_virt = phys_to_virt(bios_phys);
125 scan_end = bios_virt + bios_len - (alix_sig_len + 2); 135 scan_end = bios_virt + bios_len - (alix_sig_len + 2);
126 for (p = bios_virt; p < scan_end; p++) { 136 for (p = bios_virt; p < scan_end; p++) {
127 const char *tail; 137 const char *tail;
138 char *a;
128 139
129 if (memcmp(p, alix_sig, alix_sig_len) != 0) { 140 if (memcmp(p, alix_sig, alix_sig_len) != 0)
130 continue; 141 continue;
131 } 142
143 memcpy(name, p, sizeof(name));
144
145 /* remove the first \0 character from string */
146 a = strchr(name, '\0');
147 if (a)
148 *a = ' ';
149
150 /* cut the string at a newline */
151 a = strchr(name, '\r');
152 if (a)
153 *a = '\0';
132 154
133 tail = p + alix_sig_len; 155 tail = p + alix_sig_len;
134 if ((tail[0] == '2' || tail[0] == '3') && tail[1] == '\0') { 156 if ((tail[0] == '2' || tail[0] == '3')) {
135 printk(KERN_INFO 157 printk(KERN_INFO
136 "%s: system is recognized as \"%s\"\n", 158 "%s: system is recognized as \"%s\"\n",
137 KBUILD_MODNAME, p); 159 KBUILD_MODNAME, name);
138 ret = 1; 160 return 1;
139 break;
140 } 161 }
141 } 162 }
142 163
143out: 164 return 0;
144 return ret;
145} 165}
146 166
147static struct platform_device *pdev; 167static struct platform_device *pdev;
148 168
149static int __init alix_led_init(void) 169static int __init alix_pci_led_init(void)
150{ 170{
151 int ret; 171 u32 low, hi;
152 172
153 if (!alix_present()) { 173 if (pci_dev_present(divil_pci) == 0) {
154 ret = -ENODEV; 174 printk(KERN_WARNING KBUILD_MODNAME": DIVIL not found\n");
155 goto out; 175 return -ENODEV;
156 } 176 }
157 177
158 /* enable output on GPIO for LED 1,2,3 */ 178 /* Grab the GPIO I/O range */
159 outl(1 << 6, 0x6104); 179 rdmsr(MSR_LBAR_GPIO, low, hi);
160 outl(1 << 9, 0x6184); 180
161 outl(1 << 11, 0x6184); 181 /* Check the mask and whether GPIO is enabled (sanity check) */
182 if (hi != 0x0000f001) {
183 printk(KERN_WARNING KBUILD_MODNAME": GPIO not enabled\n");
184 return -ENODEV;
185 }
186
187 /* Mask off the IO base address */
188 gpio_base = low & 0x0000ff00;
189
190 if (!request_region(gpio_base, CS5535_GPIO_SIZE, KBUILD_MODNAME)) {
191 printk(KERN_ERR KBUILD_MODNAME": can't allocate I/O for GPIO\n");
192 return -ENODEV;
193 }
194
195 /* Set GPIO function to output */
196 outl(1 << 6, gpio_base + 0x04);
197 outl(1 << 9, gpio_base + 0x84);
198 outl(1 << 11, gpio_base + 0x84);
199
200 return 0;
201}
202
203static int __init alix_led_init(void)
204{
205 int ret = -ENODEV;
206 const char tinybios_sig[] = "PC Engines ALIX.";
207 const char coreboot_sig[] = "PC Engines\0ALIX.";
208
209 if (alix_present(0xf0000, tinybios_sig, sizeof(tinybios_sig) - 1) ||
210 alix_present(0x500, coreboot_sig, sizeof(coreboot_sig) - 1))
211 ret = alix_pci_led_init();
212
213 if (ret < 0)
214 return ret;
162 215
163 pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0); 216 pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0);
164 if (!IS_ERR(pdev)) { 217 if (!IS_ERR(pdev)) {
@@ -168,7 +221,6 @@ static int __init alix_led_init(void)
168 } else 221 } else
169 ret = PTR_ERR(pdev); 222 ret = PTR_ERR(pdev);
170 223
171out:
172 return ret; 224 return ret;
173} 225}
174 226
@@ -176,6 +228,7 @@ static void __exit alix_led_exit(void)
176{ 228{
177 platform_device_unregister(pdev); 229 platform_device_unregister(pdev);
178 platform_driver_unregister(&alix_led_driver); 230 platform_driver_unregister(&alix_led_driver);
231 release_region(gpio_base, CS5535_GPIO_SIZE);
179} 232}
180 233
181module_init(alix_led_init); 234module_init(alix_led_init);
diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
index 8816806accd2..da5fb016b1a5 100644
--- a/drivers/leds/leds-cobalt-qube.c
+++ b/drivers/leds/leds-cobalt-qube.c
@@ -31,7 +31,7 @@ static struct led_classdev qube_front_led = {
31 .name = "qube::front", 31 .name = "qube::front",
32 .brightness = LED_FULL, 32 .brightness = LED_FULL,
33 .brightness_set = qube_front_led_set, 33 .brightness_set = qube_front_led_set,
34 .default_trigger = "ide-disk", 34 .default_trigger = "default-on",
35}; 35};
36 36
37static int __devinit cobalt_qube_led_probe(struct platform_device *pdev) 37static int __devinit cobalt_qube_led_probe(struct platform_device *pdev)
@@ -43,7 +43,7 @@ static int __devinit cobalt_qube_led_probe(struct platform_device *pdev)
43 if (!res) 43 if (!res)
44 return -EBUSY; 44 return -EBUSY;
45 45
46 led_port = ioremap(res->start, res->end - res->start + 1); 46 led_port = ioremap(res->start, resource_size(res));
47 if (!led_port) 47 if (!led_port)
48 return -ENOMEM; 48 return -ENOMEM;
49 49
diff --git a/drivers/leds/leds-cobalt-raq.c b/drivers/leds/leds-cobalt-raq.c
index defc212105f3..438d48384636 100644
--- a/drivers/leds/leds-cobalt-raq.c
+++ b/drivers/leds/leds-cobalt-raq.c
@@ -84,7 +84,7 @@ static int __devinit cobalt_raq_led_probe(struct platform_device *pdev)
84 if (!res) 84 if (!res)
85 return -EBUSY; 85 return -EBUSY;
86 86
87 led_port = ioremap(res->start, res->end - res->start + 1); 87 led_port = ioremap(res->start, resource_size(res));
88 if (!led_port) 88 if (!led_port)
89 return -ENOMEM; 89 return -ENOMEM;
90 90
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
new file mode 100644
index 000000000000..fee40a841959
--- /dev/null
+++ b/drivers/leds/leds-lt3593.c
@@ -0,0 +1,217 @@
1/*
2 * LEDs driver for LT3593 controllers
3 *
4 * See the datasheet at http://cds.linear.com/docs/Datasheet/3593f.pdf
5 *
6 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
7 *
8 * Based on leds-gpio.c,
9 *
10 * Copyright (C) 2007 8D Technologies inc.
11 * Raphael Assenat <raph@8d.com>
12 * Copyright (C) 2008 Freescale Semiconductor, Inc.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/leds.h>
23#include <linux/workqueue.h>
24#include <linux/delay.h>
25#include <linux/gpio.h>
26
27struct lt3593_led_data {
28 struct led_classdev cdev;
29 unsigned gpio;
30 struct work_struct work;
31 u8 new_level;
32};
33
34static void lt3593_led_work(struct work_struct *work)
35{
36 int pulses;
37 struct lt3593_led_data *led_dat =
38 container_of(work, struct lt3593_led_data, work);
39
40 /*
41 * The LT3593 resets its internal current level register to the maximum
42 * level on the first falling edge on the control pin. Each following
43 * falling edge decreases the current level by 625uA. Up to 32 pulses
44 * can be sent, so the maximum power reduction is 20mA.
45 * After a timeout of 128us, the value is taken from the register and
46 * applied is to the output driver.
47 */
48
49 if (led_dat->new_level == 0) {
50 gpio_set_value_cansleep(led_dat->gpio, 0);
51 return;
52 }
53
54 pulses = 32 - (led_dat->new_level * 32) / 255;
55
56 if (pulses == 0) {
57 gpio_set_value_cansleep(led_dat->gpio, 0);
58 mdelay(1);
59 gpio_set_value_cansleep(led_dat->gpio, 1);
60 return;
61 }
62
63 gpio_set_value_cansleep(led_dat->gpio, 1);
64
65 while (pulses--) {
66 gpio_set_value_cansleep(led_dat->gpio, 0);
67 udelay(1);
68 gpio_set_value_cansleep(led_dat->gpio, 1);
69 udelay(1);
70 }
71}
72
73static void lt3593_led_set(struct led_classdev *led_cdev,
74 enum led_brightness value)
75{
76 struct lt3593_led_data *led_dat =
77 container_of(led_cdev, struct lt3593_led_data, cdev);
78
79 led_dat->new_level = value;
80 schedule_work(&led_dat->work);
81}
82
83static int __devinit create_lt3593_led(const struct gpio_led *template,
84 struct lt3593_led_data *led_dat, struct device *parent)
85{
86 int ret, state;
87
88 /* skip leds on GPIOs that aren't available */
89 if (!gpio_is_valid(template->gpio)) {
90 printk(KERN_INFO "%s: skipping unavailable LT3593 LED at gpio %d (%s)\n",
91 KBUILD_MODNAME, template->gpio, template->name);
92 return 0;
93 }
94
95 ret = gpio_request(template->gpio, template->name);
96 if (ret < 0)
97 return ret;
98
99 led_dat->cdev.name = template->name;
100 led_dat->cdev.default_trigger = template->default_trigger;
101 led_dat->gpio = template->gpio;
102
103 led_dat->cdev.brightness_set = lt3593_led_set;
104
105 state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
106 led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
107
108 if (!template->retain_state_suspended)
109 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
110
111 ret = gpio_direction_output(led_dat->gpio, state);
112 if (ret < 0)
113 goto err;
114
115 INIT_WORK(&led_dat->work, lt3593_led_work);
116
117 ret = led_classdev_register(parent, &led_dat->cdev);
118 if (ret < 0)
119 goto err;
120
121 printk(KERN_INFO "%s: registered LT3593 LED '%s' at GPIO %d\n",
122 KBUILD_MODNAME, template->name, template->gpio);
123
124 return 0;
125
126err:
127 gpio_free(led_dat->gpio);
128 return ret;
129}
130
131static void delete_lt3593_led(struct lt3593_led_data *led)
132{
133 if (!gpio_is_valid(led->gpio))
134 return;
135
136 led_classdev_unregister(&led->cdev);
137 cancel_work_sync(&led->work);
138 gpio_free(led->gpio);
139}
140
141static int __devinit lt3593_led_probe(struct platform_device *pdev)
142{
143 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
144 struct lt3593_led_data *leds_data;
145 int i, ret = 0;
146
147 if (!pdata)
148 return -EBUSY;
149
150 leds_data = kzalloc(sizeof(struct lt3593_led_data) * pdata->num_leds,
151 GFP_KERNEL);
152 if (!leds_data)
153 return -ENOMEM;
154
155 for (i = 0; i < pdata->num_leds; i++) {
156 ret = create_lt3593_led(&pdata->leds[i], &leds_data[i],
157 &pdev->dev);
158 if (ret < 0)
159 goto err;
160 }
161
162 platform_set_drvdata(pdev, leds_data);
163
164 return 0;
165
166err:
167 for (i = i - 1; i >= 0; i--)
168 delete_lt3593_led(&leds_data[i]);
169
170 kfree(leds_data);
171
172 return ret;
173}
174
175static int __devexit lt3593_led_remove(struct platform_device *pdev)
176{
177 int i;
178 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
179 struct lt3593_led_data *leds_data;
180
181 leds_data = platform_get_drvdata(pdev);
182
183 for (i = 0; i < pdata->num_leds; i++)
184 delete_lt3593_led(&leds_data[i]);
185
186 kfree(leds_data);
187
188 return 0;
189}
190
191static struct platform_driver lt3593_led_driver = {
192 .probe = lt3593_led_probe,
193 .remove = __devexit_p(lt3593_led_remove),
194 .driver = {
195 .name = "leds-lt3593",
196 .owner = THIS_MODULE,
197 },
198};
199
200MODULE_ALIAS("platform:leds-lt3593");
201
202static int __init lt3593_led_init(void)
203{
204 return platform_driver_register(&lt3593_led_driver);
205}
206
207static void __exit lt3593_led_exit(void)
208{
209 platform_driver_unregister(&lt3593_led_driver);
210}
211
212module_init(lt3593_led_init);
213module_exit(lt3593_led_exit);
214
215MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
216MODULE_DESCRIPTION("LED driver for LT3593 controllers");
217MODULE_LICENSE("GPL");
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index cdfdc8714e10..88b1dd091cfb 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -27,7 +27,6 @@ struct led_pwm_data {
27 struct pwm_device *pwm; 27 struct pwm_device *pwm;
28 unsigned int active_low; 28 unsigned int active_low;
29 unsigned int period; 29 unsigned int period;
30 unsigned int max_brightness;
31}; 30};
32 31
33static void led_pwm_set(struct led_classdev *led_cdev, 32static void led_pwm_set(struct led_classdev *led_cdev,
@@ -35,7 +34,7 @@ static void led_pwm_set(struct led_classdev *led_cdev,
35{ 34{
36 struct led_pwm_data *led_dat = 35 struct led_pwm_data *led_dat =
37 container_of(led_cdev, struct led_pwm_data, cdev); 36 container_of(led_cdev, struct led_pwm_data, cdev);
38 unsigned int max = led_dat->max_brightness; 37 unsigned int max = led_dat->cdev.max_brightness;
39 unsigned int period = led_dat->period; 38 unsigned int period = led_dat->period;
40 39
41 if (brightness == 0) { 40 if (brightness == 0) {
@@ -77,10 +76,10 @@ static int led_pwm_probe(struct platform_device *pdev)
77 led_dat->cdev.name = cur_led->name; 76 led_dat->cdev.name = cur_led->name;
78 led_dat->cdev.default_trigger = cur_led->default_trigger; 77 led_dat->cdev.default_trigger = cur_led->default_trigger;
79 led_dat->active_low = cur_led->active_low; 78 led_dat->active_low = cur_led->active_low;
80 led_dat->max_brightness = cur_led->max_brightness;
81 led_dat->period = cur_led->pwm_period_ns; 79 led_dat->period = cur_led->pwm_period_ns;
82 led_dat->cdev.brightness_set = led_pwm_set; 80 led_dat->cdev.brightness_set = led_pwm_set;
83 led_dat->cdev.brightness = LED_OFF; 81 led_dat->cdev.brightness = LED_OFF;
82 led_dat->cdev.max_brightness = cur_led->max_brightness;
84 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 83 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
85 84
86 ret = led_classdev_register(&pdev->dev, &led_dat->cdev); 85 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
new file mode 100644
index 000000000000..7f00de3ef922
--- /dev/null
+++ b/drivers/leds/leds-regulator.c
@@ -0,0 +1,242 @@
1/*
2 * leds-regulator.c - LED class driver for regulator driven LEDs.
3 *
4 * Copyright (C) 2009 Antonio Ospite <ospite@studenti.unina.it>
5 *
6 * Inspired by leds-wm8350 driver.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/module.h>
15#include <linux/err.h>
16#include <linux/workqueue.h>
17#include <linux/leds.h>
18#include <linux/leds-regulator.h>
19#include <linux/platform_device.h>
20#include <linux/regulator/consumer.h>
21
22#define to_regulator_led(led_cdev) \
23 container_of(led_cdev, struct regulator_led, cdev)
24
25struct regulator_led {
26 struct led_classdev cdev;
27 enum led_brightness value;
28 int enabled;
29 struct mutex mutex;
30 struct work_struct work;
31
32 struct regulator *vcc;
33};
34
35static inline int led_regulator_get_max_brightness(struct regulator *supply)
36{
37 int ret;
38 int voltage = regulator_list_voltage(supply, 0);
39
40 if (voltage <= 0)
41 return 1;
42
43 /* even if regulator can't change voltages,
44 * we still assume it can change status
45 * and the LED can be turned on and off.
46 */
47 ret = regulator_set_voltage(supply, voltage, voltage);
48 if (ret < 0)
49 return 1;
50
51 return regulator_count_voltages(supply);
52}
53
54static int led_regulator_get_voltage(struct regulator *supply,
55 enum led_brightness brightness)
56{
57 if (brightness == 0)
58 return -EINVAL;
59
60 return regulator_list_voltage(supply, brightness - 1);
61}
62
63
64static void regulator_led_enable(struct regulator_led *led)
65{
66 int ret;
67
68 if (led->enabled)
69 return;
70
71 ret = regulator_enable(led->vcc);
72 if (ret != 0) {
73 dev_err(led->cdev.dev, "Failed to enable vcc: %d\n", ret);
74 return;
75 }
76
77 led->enabled = 1;
78}
79
80static void regulator_led_disable(struct regulator_led *led)
81{
82 int ret;
83
84 if (!led->enabled)
85 return;
86
87 ret = regulator_disable(led->vcc);
88 if (ret != 0) {
89 dev_err(led->cdev.dev, "Failed to disable vcc: %d\n", ret);
90 return;
91 }
92
93 led->enabled = 0;
94}
95
96static void regulator_led_set_value(struct regulator_led *led)
97{
98 int voltage;
99 int ret;
100
101 mutex_lock(&led->mutex);
102
103 if (led->value == LED_OFF) {
104 regulator_led_disable(led);
105 goto out;
106 }
107
108 if (led->cdev.max_brightness > 1) {
109 voltage = led_regulator_get_voltage(led->vcc, led->value);
110 dev_dbg(led->cdev.dev, "brightness: %d voltage: %d\n",
111 led->value, voltage);
112
113 ret = regulator_set_voltage(led->vcc, voltage, voltage);
114 if (ret != 0)
115 dev_err(led->cdev.dev, "Failed to set voltage %d: %d\n",
116 voltage, ret);
117 }
118
119 regulator_led_enable(led);
120
121out:
122 mutex_unlock(&led->mutex);
123}
124
125static void led_work(struct work_struct *work)
126{
127 struct regulator_led *led;
128
129 led = container_of(work, struct regulator_led, work);
130 regulator_led_set_value(led);
131}
132
133static void regulator_led_brightness_set(struct led_classdev *led_cdev,
134 enum led_brightness value)
135{
136 struct regulator_led *led = to_regulator_led(led_cdev);
137
138 led->value = value;
139 schedule_work(&led->work);
140}
141
142static int __devinit regulator_led_probe(struct platform_device *pdev)
143{
144 struct led_regulator_platform_data *pdata = pdev->dev.platform_data;
145 struct regulator_led *led;
146 struct regulator *vcc;
147 int ret = 0;
148
149 if (pdata == NULL) {
150 dev_err(&pdev->dev, "no platform data\n");
151 return -ENODEV;
152 }
153
154 vcc = regulator_get_exclusive(&pdev->dev, "vled");
155 if (IS_ERR(vcc)) {
156 dev_err(&pdev->dev, "Cannot get vcc for %s\n", pdata->name);
157 return PTR_ERR(vcc);
158 }
159
160 led = kzalloc(sizeof(*led), GFP_KERNEL);
161 if (led == NULL) {
162 ret = -ENOMEM;
163 goto err_vcc;
164 }
165
166 led->cdev.max_brightness = led_regulator_get_max_brightness(vcc);
167 if (pdata->brightness > led->cdev.max_brightness) {
168 dev_err(&pdev->dev, "Invalid default brightness %d\n",
169 pdata->brightness);
170 ret = -EINVAL;
171 goto err_led;
172 }
173 led->value = pdata->brightness;
174
175 led->cdev.brightness_set = regulator_led_brightness_set;
176 led->cdev.name = pdata->name;
177 led->cdev.flags |= LED_CORE_SUSPENDRESUME;
178 led->vcc = vcc;
179
180 mutex_init(&led->mutex);
181 INIT_WORK(&led->work, led_work);
182
183 platform_set_drvdata(pdev, led);
184
185 ret = led_classdev_register(&pdev->dev, &led->cdev);
186 if (ret < 0) {
187 cancel_work_sync(&led->work);
188 goto err_led;
189 }
190
191 /* to expose the default value to userspace */
192 led->cdev.brightness = led->value;
193
194 /* Set the default led status */
195 regulator_led_set_value(led);
196
197 return 0;
198
199err_led:
200 kfree(led);
201err_vcc:
202 regulator_put(vcc);
203 return ret;
204}
205
206static int __devexit regulator_led_remove(struct platform_device *pdev)
207{
208 struct regulator_led *led = platform_get_drvdata(pdev);
209
210 led_classdev_unregister(&led->cdev);
211 cancel_work_sync(&led->work);
212 regulator_led_disable(led);
213 regulator_put(led->vcc);
214 kfree(led);
215 return 0;
216}
217
218static struct platform_driver regulator_led_driver = {
219 .driver = {
220 .name = "leds-regulator",
221 .owner = THIS_MODULE,
222 },
223 .probe = regulator_led_probe,
224 .remove = __devexit_p(regulator_led_remove),
225};
226
227static int __init regulator_led_init(void)
228{
229 return platform_driver_register(&regulator_led_driver);
230}
231module_init(regulator_led_init);
232
233static void __exit regulator_led_exit(void)
234{
235 platform_driver_unregister(&regulator_led_driver);
236}
237module_exit(regulator_led_exit);
238
239MODULE_AUTHOR("Antonio Ospite <ospite@studenti.unina.it>");
240MODULE_DESCRIPTION("Regulator driven LED driver");
241MODULE_LICENSE("GPL");
242MODULE_ALIAS("platform:leds-regulator");
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
new file mode 100644
index 000000000000..97f04984c1ca
--- /dev/null
+++ b/drivers/leds/leds-ss4200.c
@@ -0,0 +1,556 @@
1/*
2 * SS4200-E Hardware API
3 * Copyright (c) 2009, Intel Corporation.
4 * Copyright IBM Corporation, 2009
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Author: Dave Hansen <dave@sr71.net>
20 */
21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
24#include <linux/dmi.h>
25#include <linux/init.h>
26#include <linux/ioport.h>
27#include <linux/kernel.h>
28#include <linux/leds.h>
29#include <linux/module.h>
30#include <linux/pci.h>
31#include <linux/types.h>
32#include <linux/uaccess.h>
33
34MODULE_AUTHOR("Rodney Girod <rgirod@confocus.com>, Dave Hansen <dave@sr71.net>");
35MODULE_DESCRIPTION("Intel NAS/Home Server ICH7 GPIO Driver");
36MODULE_LICENSE("GPL");
37
38/*
39 * ICH7 LPC/GPIO PCI Config register offsets
40 */
41#define PMBASE 0x040
42#define GPIO_BASE 0x048
43#define GPIO_CTRL 0x04c
44#define GPIO_EN 0x010
45
46/*
47 * The ICH7 GPIO register block is 64 bytes in size.
48 */
49#define ICH7_GPIO_SIZE 64
50
51/*
52 * Define register offsets within the ICH7 register block.
53 */
54#define GPIO_USE_SEL 0x000
55#define GP_IO_SEL 0x004
56#define GP_LVL 0x00c
57#define GPO_BLINK 0x018
58#define GPI_INV 0x030
59#define GPIO_USE_SEL2 0x034
60#define GP_IO_SEL2 0x038
61#define GP_LVL2 0x03c
62
63/*
64 * PCI ID of the Intel ICH7 LPC Device within which the GPIO block lives.
65 */
66static struct pci_device_id ich7_lpc_pci_id[] =
67{
68 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0) },
69 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1) },
70 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_30) },
71 { } /* NULL entry */
72};
73
74MODULE_DEVICE_TABLE(pci, ich7_lpc_pci_id);
75
76static int __init ss4200_led_dmi_callback(const struct dmi_system_id *id)
77{
78 pr_info("detected '%s'\n", id->ident);
79 return 1;
80}
81
82static unsigned int __initdata nodetect;
83module_param_named(nodetect, nodetect, bool, 0);
84MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection");
85
86/*
87 * struct nas_led_whitelist - List of known good models
88 *
89 * Contains the known good models this driver is compatible with.
90 * When adding a new model try to be as strict as possible. This
91 * makes it possible to keep the false positives (the model is
92 * detected as working, but in reality it is not) as low as
93 * possible.
94 */
95static struct dmi_system_id __initdata nas_led_whitelist[] = {
96 {
97 .callback = ss4200_led_dmi_callback,
98 .ident = "Intel SS4200-E",
99 .matches = {
100 DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
101 DMI_MATCH(DMI_PRODUCT_NAME, "SS4200-E"),
102 DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00")
103 }
104 },
105};
106
107/*
108 * Base I/O address assigned to the Power Management register block
109 */
110static u32 g_pm_io_base;
111
112/*
113 * Base I/O address assigned to the ICH7 GPIO register block
114 */
115static u32 nas_gpio_io_base;
116
117/*
118 * When we successfully register a region, we are returned a resource.
119 * We use these to identify which regions we need to release on our way
120 * back out.
121 */
122static struct resource *gp_gpio_resource;
123
124struct nasgpio_led {
125 char *name;
126 u32 gpio_bit;
127 struct led_classdev led_cdev;
128};
129
130/*
131 * gpio_bit(s) are the ICH7 GPIO bit assignments
132 */
133static struct nasgpio_led nasgpio_leds[] = {
134 { .name = "hdd1:blue:sata", .gpio_bit = 0 },
135 { .name = "hdd1:amber:sata", .gpio_bit = 1 },
136 { .name = "hdd2:blue:sata", .gpio_bit = 2 },
137 { .name = "hdd2:amber:sata", .gpio_bit = 3 },
138 { .name = "hdd3:blue:sata", .gpio_bit = 4 },
139 { .name = "hdd3:amber:sata", .gpio_bit = 5 },
140 { .name = "hdd4:blue:sata", .gpio_bit = 6 },
141 { .name = "hdd4:amber:sata", .gpio_bit = 7 },
142 { .name = "power:blue:power", .gpio_bit = 27},
143 { .name = "power:amber:power", .gpio_bit = 28},
144};
145
146#define NAS_RECOVERY 0x00000400 /* GPIO10 */
147
148static struct nasgpio_led *
149led_classdev_to_nasgpio_led(struct led_classdev *led_cdev)
150{
151 return container_of(led_cdev, struct nasgpio_led, led_cdev);
152}
153
154static struct nasgpio_led *get_led_named(char *name)
155{
156 int i;
157 for (i = 0; i < ARRAY_SIZE(nasgpio_leds); i++) {
158 if (strcmp(nasgpio_leds[i].name, name))
159 continue;
160 return &nasgpio_leds[i];
161 }
162 return NULL;
163}
164
165/*
166 * This protects access to the gpio ports.
167 */
168static DEFINE_SPINLOCK(nasgpio_gpio_lock);
169
170/*
171 * There are two gpio ports, one for blinking and the other
172 * for power. @port tells us if we're doing blinking or
173 * power control.
174 *
175 * Caller must hold nasgpio_gpio_lock
176 */
177static void __nasgpio_led_set_attr(struct led_classdev *led_cdev,
178 u32 port, u32 value)
179{
180 struct nasgpio_led *led = led_classdev_to_nasgpio_led(led_cdev);
181 u32 gpio_out;
182
183 gpio_out = inl(nas_gpio_io_base + port);
184 if (value)
185 gpio_out |= (1<<led->gpio_bit);
186 else
187 gpio_out &= ~(1<<led->gpio_bit);
188
189 outl(gpio_out, nas_gpio_io_base + port);
190}
191
192static void nasgpio_led_set_attr(struct led_classdev *led_cdev,
193 u32 port, u32 value)
194{
195 spin_lock(&nasgpio_gpio_lock);
196 __nasgpio_led_set_attr(led_cdev, port, value);
197 spin_unlock(&nasgpio_gpio_lock);
198}
199
200u32 nasgpio_led_get_attr(struct led_classdev *led_cdev, u32 port)
201{
202 struct nasgpio_led *led = led_classdev_to_nasgpio_led(led_cdev);
203 u32 gpio_in;
204
205 spin_lock(&nasgpio_gpio_lock);
206 gpio_in = inl(nas_gpio_io_base + port);
207 spin_unlock(&nasgpio_gpio_lock);
208 if (gpio_in & (1<<led->gpio_bit))
209 return 1;
210 return 0;
211}
212
213/*
214 * There is actual brightness control in the hardware,
215 * but it is via smbus commands and not implemented
216 * in this driver.
217 */
218static void nasgpio_led_set_brightness(struct led_classdev *led_cdev,
219 enum led_brightness brightness)
220{
221 u32 setting = 0;
222 if (brightness >= LED_HALF)
223 setting = 1;
224 /*
225 * Hold the lock across both operations. This ensures
226 * consistency so that both the "turn off blinking"
227 * and "turn light off" operations complete as a set.
228 */
229 spin_lock(&nasgpio_gpio_lock);
230 /*
231 * LED class documentation asks that past blink state
232 * be disabled when brightness is turned to zero.
233 */
234 if (brightness == 0)
235 __nasgpio_led_set_attr(led_cdev, GPO_BLINK, 0);
236 __nasgpio_led_set_attr(led_cdev, GP_LVL, setting);
237 spin_unlock(&nasgpio_gpio_lock);
238}
239
240static int nasgpio_led_set_blink(struct led_classdev *led_cdev,
241 unsigned long *delay_on,
242 unsigned long *delay_off)
243{
244 u32 setting = 1;
245 if (!(*delay_on == 0 && *delay_off == 0) &&
246 !(*delay_on == 500 && *delay_off == 500))
247 return -EINVAL;
248 /*
249 * These are very approximate.
250 */
251 *delay_on = 500;
252 *delay_off = 500;
253
254 nasgpio_led_set_attr(led_cdev, GPO_BLINK, setting);
255
256 return 0;
257}
258
259
260/*
261 * Initialize the ICH7 GPIO registers for NAS usage. The BIOS should have
262 * already taken care of this, but we will do so in a non destructive manner
263 * so that we have what we need whether the BIOS did it or not.
264 */
265static int __devinit ich7_gpio_init(struct device *dev)
266{
267 int i;
268 u32 config_data = 0;
269 u32 all_nas_led = 0;
270
271 for (i = 0; i < ARRAY_SIZE(nasgpio_leds); i++)
272 all_nas_led |= (1<<nasgpio_leds[i].gpio_bit);
273
274 spin_lock(&nasgpio_gpio_lock);
275 /*
276 * We need to enable all of the GPIO lines used by the NAS box,
277 * so we will read the current Use Selection and add our usage
278 * to it. This should be benign with regard to the original
279 * BIOS configuration.
280 */
281 config_data = inl(nas_gpio_io_base + GPIO_USE_SEL);
282 dev_dbg(dev, ": Data read from GPIO_USE_SEL = 0x%08x\n", config_data);
283 config_data |= all_nas_led + NAS_RECOVERY;
284 outl(config_data, nas_gpio_io_base + GPIO_USE_SEL);
285 config_data = inl(nas_gpio_io_base + GPIO_USE_SEL);
286 dev_dbg(dev, ": GPIO_USE_SEL = 0x%08x\n\n", config_data);
287
288 /*
289 * The LED GPIO outputs need to be configured for output, so we
290 * will ensure that all LED lines are cleared for output and the
291 * RECOVERY line ready for input. This too should be benign with
292 * regard to BIOS configuration.
293 */
294 config_data = inl(nas_gpio_io_base + GP_IO_SEL);
295 dev_dbg(dev, ": Data read from GP_IO_SEL = 0x%08x\n",
296 config_data);
297 config_data &= ~all_nas_led;
298 config_data |= NAS_RECOVERY;
299 outl(config_data, nas_gpio_io_base + GP_IO_SEL);
300 config_data = inl(nas_gpio_io_base + GP_IO_SEL);
301 dev_dbg(dev, ": GP_IO_SEL = 0x%08x\n", config_data);
302
303 /*
304 * In our final system, the BIOS will initialize the state of all
305 * of the LEDs. For now, we turn them all off (or Low).
306 */
307 config_data = inl(nas_gpio_io_base + GP_LVL);
308 dev_dbg(dev, ": Data read from GP_LVL = 0x%08x\n", config_data);
309 /*
310 * In our final system, the BIOS will initialize the blink state of all
311 * of the LEDs. For now, we turn blink off for all of them.
312 */
313 config_data = inl(nas_gpio_io_base + GPO_BLINK);
314 dev_dbg(dev, ": Data read from GPO_BLINK = 0x%08x\n", config_data);
315
316 /*
317 * At this moment, I am unsure if anything needs to happen with GPI_INV
318 */
319 config_data = inl(nas_gpio_io_base + GPI_INV);
320 dev_dbg(dev, ": Data read from GPI_INV = 0x%08x\n", config_data);
321
322 spin_unlock(&nasgpio_gpio_lock);
323 return 0;
324}
325
326static void ich7_lpc_cleanup(struct device *dev)
327{
328 /*
329 * If we were given exclusive use of the GPIO
330 * I/O Address range, we must return it.
331 */
332 if (gp_gpio_resource) {
333 dev_dbg(dev, ": Releasing GPIO I/O addresses\n");
334 release_region(nas_gpio_io_base, ICH7_GPIO_SIZE);
335 gp_gpio_resource = NULL;
336 }
337}
338
339/*
340 * The OS has determined that the LPC of the Intel ICH7 Southbridge is present
341 * so we can retrive the required operational information and prepare the GPIO.
342 */
343static struct pci_dev *nas_gpio_pci_dev;
344static int __devinit ich7_lpc_probe(struct pci_dev *dev,
345 const struct pci_device_id *id)
346{
347 int status;
348 u32 gc = 0;
349
350 status = pci_enable_device(dev);
351 if (status) {
352 dev_err(&dev->dev, "pci_enable_device failed\n");
353 return -EIO;
354 }
355
356 nas_gpio_pci_dev = dev;
357 status = pci_read_config_dword(dev, PMBASE, &g_pm_io_base);
358 if (status)
359 goto out;
360 g_pm_io_base &= 0x00000ff80;
361
362 status = pci_read_config_dword(dev, GPIO_CTRL, &gc);
363 if (!(GPIO_EN & gc)) {
364 status = -EEXIST;
365 dev_info(&dev->dev,
366 "ERROR: The LPC GPIO Block has not been enabled.\n");
367 goto out;
368 }
369
370 status = pci_read_config_dword(dev, GPIO_BASE, &nas_gpio_io_base);
371 if (0 > status) {
372 dev_info(&dev->dev, "Unable to read GPIOBASE.\n");
373 goto out;
374 }
375 dev_dbg(&dev->dev, ": GPIOBASE = 0x%08x\n", nas_gpio_io_base);
376 nas_gpio_io_base &= 0x00000ffc0;
377
378 /*
379 * Insure that we have exclusive access to the GPIO I/O address range.
380 */
381 gp_gpio_resource = request_region(nas_gpio_io_base, ICH7_GPIO_SIZE,
382 KBUILD_MODNAME);
383 if (NULL == gp_gpio_resource) {
384 dev_info(&dev->dev,
385 "ERROR Unable to register GPIO I/O addresses.\n");
386 status = -1;
387 goto out;
388 }
389
390 /*
391 * Initialize the GPIO for NAS/Home Server Use
392 */
393 ich7_gpio_init(&dev->dev);
394
395out:
396 if (status) {
397 ich7_lpc_cleanup(&dev->dev);
398 pci_disable_device(dev);
399 }
400 return status;
401}
402
403static void ich7_lpc_remove(struct pci_dev *dev)
404{
405 ich7_lpc_cleanup(&dev->dev);
406 pci_disable_device(dev);
407}
408
409/*
410 * pci_driver structure passed to the PCI modules
411 */
412static struct pci_driver nas_gpio_pci_driver = {
413 .name = KBUILD_MODNAME,
414 .id_table = ich7_lpc_pci_id,
415 .probe = ich7_lpc_probe,
416 .remove = ich7_lpc_remove,
417};
418
419static struct led_classdev *get_classdev_for_led_nr(int nr)
420{
421 struct nasgpio_led *nas_led = &nasgpio_leds[nr];
422 struct led_classdev *led = &nas_led->led_cdev;
423 return led;
424}
425
426
427static void set_power_light_amber_noblink(void)
428{
429 struct nasgpio_led *amber = get_led_named("power:amber:power");
430 struct nasgpio_led *blue = get_led_named("power:blue:power");
431
432 if (!amber || !blue)
433 return;
434 /*
435 * LED_OFF implies disabling future blinking
436 */
437 pr_debug("setting blue off and amber on\n");
438
439 nasgpio_led_set_brightness(&blue->led_cdev, LED_OFF);
440 nasgpio_led_set_brightness(&amber->led_cdev, LED_FULL);
441}
442
443static ssize_t nas_led_blink_show(struct device *dev,
444 struct device_attribute *attr, char *buf)
445{
446 struct led_classdev *led = dev_get_drvdata(dev);
447 int blinking = 0;
448 if (nasgpio_led_get_attr(led, GPO_BLINK))
449 blinking = 1;
450 return sprintf(buf, "%u\n", blinking);
451}
452
453static ssize_t nas_led_blink_store(struct device *dev,
454 struct device_attribute *attr,
455 const char *buf, size_t size)
456{
457 int ret;
458 struct led_classdev *led = dev_get_drvdata(dev);
459 unsigned long blink_state;
460
461 ret = strict_strtoul(buf, 10, &blink_state);
462 if (ret)
463 return ret;
464
465 nasgpio_led_set_attr(led, GPO_BLINK, blink_state);
466
467 return size;
468}
469
470static DEVICE_ATTR(blink, 0644, nas_led_blink_show, nas_led_blink_store);
471
472static int register_nasgpio_led(int led_nr)
473{
474 int ret;
475 struct nasgpio_led *nas_led = &nasgpio_leds[led_nr];
476 struct led_classdev *led = get_classdev_for_led_nr(led_nr);
477
478 led->name = nas_led->name;
479 led->brightness = LED_OFF;
480 if (nasgpio_led_get_attr(led, GP_LVL))
481 led->brightness = LED_FULL;
482 led->brightness_set = nasgpio_led_set_brightness;
483 led->blink_set = nasgpio_led_set_blink;
484 ret = led_classdev_register(&nas_gpio_pci_dev->dev, led);
485 if (ret)
486 return ret;
487 ret = device_create_file(led->dev, &dev_attr_blink);
488 if (ret)
489 led_classdev_unregister(led);
490 return ret;
491}
492
493static void unregister_nasgpio_led(int led_nr)
494{
495 struct led_classdev *led = get_classdev_for_led_nr(led_nr);
496 led_classdev_unregister(led);
497 device_remove_file(led->dev, &dev_attr_blink);
498}
499/*
500 * module load/initialization
501 */
502static int __init nas_gpio_init(void)
503{
504 int i;
505 int ret = 0;
506 int nr_devices = 0;
507
508 nr_devices = dmi_check_system(nas_led_whitelist);
509 if (nodetect) {
510 pr_info("skipping hardware autodetection\n");
511 pr_info("Please send 'dmidecode' output to dave@sr71.net\n");
512 nr_devices++;
513 }
514
515 if (nr_devices <= 0) {
516 pr_info("no LED devices found\n");
517 return -ENODEV;
518 }
519
520 pr_info("registering PCI driver\n");
521 ret = pci_register_driver(&nas_gpio_pci_driver);
522 if (ret)
523 return ret;
524 for (i = 0; i < ARRAY_SIZE(nasgpio_leds); i++) {
525 ret = register_nasgpio_led(i);
526 if (ret)
527 goto out_err;
528 }
529 /*
530 * When the system powers on, the BIOS leaves the power
531 * light blue and blinking. This will turn it solid
532 * amber once the driver is loaded.
533 */
534 set_power_light_amber_noblink();
535 return 0;
536out_err:
537 for (; i >= 0; i--)
538 unregister_nasgpio_led(i);
539 pci_unregister_driver(&nas_gpio_pci_driver);
540 return ret;
541}
542
543/*
544 * module unload
545 */
546static void __exit nas_gpio_exit(void)
547{
548 int i;
549 pr_info("Unregistering driver\n");
550 for (i = 0; i < ARRAY_SIZE(nasgpio_leds); i++)
551 unregister_nasgpio_led(i);
552 pci_unregister_driver(&nas_gpio_pci_driver);
553}
554
555module_init(nas_gpio_init);
556module_exit(nas_gpio_exit);
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c
index 951c57b0a7e0..ede46581351a 100644
--- a/drivers/lguest/segments.c
+++ b/drivers/lguest/segments.c
@@ -179,8 +179,10 @@ void load_guest_gdt_entry(struct lg_cpu *cpu, u32 num, u32 lo, u32 hi)
179 * We assume the Guest has the same number of GDT entries as the 179 * We assume the Guest has the same number of GDT entries as the
180 * Host, otherwise we'd have to dynamically allocate the Guest GDT. 180 * Host, otherwise we'd have to dynamically allocate the Guest GDT.
181 */ 181 */
182 if (num >= ARRAY_SIZE(cpu->arch.gdt)) 182 if (num >= ARRAY_SIZE(cpu->arch.gdt)) {
183 kill_guest(cpu, "too many gdt entries %i", num); 183 kill_guest(cpu, "too many gdt entries %i", num);
184 return;
185 }
184 186
185 /* Set it up, then fix it. */ 187 /* Set it up, then fix it. */
186 cpu->arch.gdt[num].a = lo; 188 cpu->arch.gdt[num].a = lo;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f4f5f82f9f53..dd3dfe42d5a9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -386,7 +386,9 @@ static void mddev_put(mddev_t *mddev)
386 if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) 386 if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock))
387 return; 387 return;
388 if (!mddev->raid_disks && list_empty(&mddev->disks) && 388 if (!mddev->raid_disks && list_empty(&mddev->disks) &&
389 !mddev->hold_active) { 389 mddev->ctime == 0 && !mddev->hold_active) {
390 /* Array is not configured at all, and not held active,
391 * so destroy it */
390 list_del(&mddev->all_mddevs); 392 list_del(&mddev->all_mddevs);
391 if (mddev->gendisk) { 393 if (mddev->gendisk) {
392 /* we did a probe so need to clean up. 394 /* we did a probe so need to clean up.
@@ -4355,7 +4357,7 @@ static int do_md_run(mddev_t * mddev)
4355 mddev->barriers_work = 1; 4357 mddev->barriers_work = 1;
4356 mddev->ok_start_degraded = start_dirty_degraded; 4358 mddev->ok_start_degraded = start_dirty_degraded;
4357 4359
4358 if (start_readonly) 4360 if (start_readonly && mddev->ro == 0)
4359 mddev->ro = 2; /* read-only, but switch on first write */ 4361 mddev->ro = 2; /* read-only, but switch on first write */
4360 4362
4361 err = mddev->pers->run(mddev); 4363 err = mddev->pers->run(mddev);
@@ -4419,33 +4421,6 @@ static int do_md_run(mddev_t * mddev)
4419 4421
4420 set_capacity(disk, mddev->array_sectors); 4422 set_capacity(disk, mddev->array_sectors);
4421 4423
4422 /* If there is a partially-recovered drive we need to
4423 * start recovery here. If we leave it to md_check_recovery,
4424 * it will remove the drives and not do the right thing
4425 */
4426 if (mddev->degraded && !mddev->sync_thread) {
4427 int spares = 0;
4428 list_for_each_entry(rdev, &mddev->disks, same_set)
4429 if (rdev->raid_disk >= 0 &&
4430 !test_bit(In_sync, &rdev->flags) &&
4431 !test_bit(Faulty, &rdev->flags))
4432 /* complete an interrupted recovery */
4433 spares++;
4434 if (spares && mddev->pers->sync_request) {
4435 mddev->recovery = 0;
4436 set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
4437 mddev->sync_thread = md_register_thread(md_do_sync,
4438 mddev,
4439 "resync");
4440 if (!mddev->sync_thread) {
4441 printk(KERN_ERR "%s: could not start resync"
4442 " thread...\n",
4443 mdname(mddev));
4444 /* leave the spares where they are, it shouldn't hurt */
4445 mddev->recovery = 0;
4446 }
4447 }
4448 }
4449 md_wakeup_thread(mddev->thread); 4424 md_wakeup_thread(mddev->thread);
4450 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ 4425 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
4451 4426
@@ -5262,6 +5237,10 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
5262 mddev->minor_version = info->minor_version; 5237 mddev->minor_version = info->minor_version;
5263 mddev->patch_version = info->patch_version; 5238 mddev->patch_version = info->patch_version;
5264 mddev->persistent = !info->not_persistent; 5239 mddev->persistent = !info->not_persistent;
5240 /* ensure mddev_put doesn't delete this now that there
5241 * is some minimal configuration.
5242 */
5243 mddev->ctime = get_seconds();
5265 return 0; 5244 return 0;
5266 } 5245 }
5267 mddev->major_version = MD_MAJOR_VERSION; 5246 mddev->major_version = MD_MAJOR_VERSION;
@@ -6494,10 +6473,11 @@ void md_do_sync(mddev_t *mddev)
6494 mddev->curr_resync = 2; 6473 mddev->curr_resync = 2;
6495 6474
6496 try_again: 6475 try_again:
6497 if (kthread_should_stop()) { 6476 if (kthread_should_stop())
6498 set_bit(MD_RECOVERY_INTR, &mddev->recovery); 6477 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
6478
6479 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
6499 goto skip; 6480 goto skip;
6500 }
6501 for_each_mddev(mddev2, tmp) { 6481 for_each_mddev(mddev2, tmp) {
6502 if (mddev2 == mddev) 6482 if (mddev2 == mddev)
6503 continue; 6483 continue;
diff --git a/drivers/media/dvb/firewire/firedtv-fw.c b/drivers/media/dvb/firewire/firedtv-fw.c
index fe44789ab037..6223bf01efe9 100644
--- a/drivers/media/dvb/firewire/firedtv-fw.c
+++ b/drivers/media/dvb/firewire/firedtv-fw.c
@@ -202,14 +202,8 @@ static void handle_fcp(struct fw_card *card, struct fw_request *request,
202 unsigned long flags; 202 unsigned long flags;
203 int su; 203 int su;
204 204
205 if ((tcode != TCODE_WRITE_QUADLET_REQUEST && 205 if (length < 2 || (((u8 *)payload)[0] & 0xf0) != 0)
206 tcode != TCODE_WRITE_BLOCK_REQUEST) ||
207 offset != CSR_REGISTER_BASE + CSR_FCP_RESPONSE ||
208 length == 0 ||
209 (((u8 *)payload)[0] & 0xf0) != 0) {
210 fw_send_response(card, request, RCODE_TYPE_ERROR);
211 return; 206 return;
212 }
213 207
214 su = ((u8 *)payload)[1] & 0x7; 208 su = ((u8 *)payload)[1] & 0x7;
215 209
@@ -230,10 +224,8 @@ static void handle_fcp(struct fw_card *card, struct fw_request *request,
230 } 224 }
231 spin_unlock_irqrestore(&node_list_lock, flags); 225 spin_unlock_irqrestore(&node_list_lock, flags);
232 226
233 if (fdtv) { 227 if (fdtv)
234 avc_recv(fdtv, payload, length); 228 avc_recv(fdtv, payload, length);
235 fw_send_response(card, request, RCODE_COMPLETE);
236 }
237} 229}
238 230
239static struct fw_address_handler fcp_handler = { 231static struct fw_address_handler fcp_handler = {
diff --git a/drivers/media/video/cx23885/cx23888-ir.c b/drivers/media/video/cx23885/cx23888-ir.c
index 3ccc8afeccf3..2bf57a4527d3 100644
--- a/drivers/media/video/cx23885/cx23888-ir.c
+++ b/drivers/media/video/cx23885/cx23888-ir.c
@@ -124,15 +124,12 @@ struct cx23888_ir_state {
124 atomic_t rxclk_divider; 124 atomic_t rxclk_divider;
125 atomic_t rx_invert; 125 atomic_t rx_invert;
126 126
127 struct kfifo *rx_kfifo; 127 struct kfifo rx_kfifo;
128 spinlock_t rx_kfifo_lock; 128 spinlock_t rx_kfifo_lock;
129 129
130 struct v4l2_subdev_ir_parameters tx_params; 130 struct v4l2_subdev_ir_parameters tx_params;
131 struct mutex tx_params_lock; 131 struct mutex tx_params_lock;
132 atomic_t txclk_divider; 132 atomic_t txclk_divider;
133
134 struct kfifo *tx_kfifo;
135 spinlock_t tx_kfifo_lock;
136}; 133};
137 134
138static inline struct cx23888_ir_state *to_state(struct v4l2_subdev *sd) 135static inline struct cx23888_ir_state *to_state(struct v4l2_subdev *sd)
@@ -522,6 +519,7 @@ static int cx23888_ir_irq_handler(struct v4l2_subdev *sd, u32 status,
522{ 519{
523 struct cx23888_ir_state *state = to_state(sd); 520 struct cx23888_ir_state *state = to_state(sd);
524 struct cx23885_dev *dev = state->dev; 521 struct cx23885_dev *dev = state->dev;
522 unsigned long flags;
525 523
526 u32 cntrl = cx23888_ir_read4(dev, CX23888_IR_CNTRL_REG); 524 u32 cntrl = cx23888_ir_read4(dev, CX23888_IR_CNTRL_REG);
527 u32 irqen = cx23888_ir_read4(dev, CX23888_IR_IRQEN_REG); 525 u32 irqen = cx23888_ir_read4(dev, CX23888_IR_IRQEN_REG);
@@ -594,8 +592,9 @@ static int cx23888_ir_irq_handler(struct v4l2_subdev *sd, u32 status,
594 if (i == 0) 592 if (i == 0)
595 break; 593 break;
596 j = i * sizeof(u32); 594 j = i * sizeof(u32);
597 k = kfifo_put(state->rx_kfifo, 595 k = kfifo_in_locked(&state->rx_kfifo,
598 (unsigned char *) rx_data, j); 596 (unsigned char *) rx_data, j,
597 &state->rx_kfifo_lock);
599 if (k != j) 598 if (k != j)
600 kror++; /* rx_kfifo over run */ 599 kror++; /* rx_kfifo over run */
601 } 600 }
@@ -631,8 +630,11 @@ static int cx23888_ir_irq_handler(struct v4l2_subdev *sd, u32 status,
631 cx23888_ir_write4(dev, CX23888_IR_CNTRL_REG, cntrl); 630 cx23888_ir_write4(dev, CX23888_IR_CNTRL_REG, cntrl);
632 *handled = true; 631 *handled = true;
633 } 632 }
634 if (kfifo_len(state->rx_kfifo) >= CX23888_IR_RX_KFIFO_SIZE / 2) 633
634 spin_lock_irqsave(&state->rx_kfifo_lock, flags);
635 if (kfifo_len(&state->rx_kfifo) >= CX23888_IR_RX_KFIFO_SIZE / 2)
635 events |= V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ; 636 events |= V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ;
637 spin_unlock_irqrestore(&state->rx_kfifo_lock, flags);
636 638
637 if (events) 639 if (events)
638 v4l2_subdev_notify(sd, V4L2_SUBDEV_IR_RX_NOTIFY, &events); 640 v4l2_subdev_notify(sd, V4L2_SUBDEV_IR_RX_NOTIFY, &events);
@@ -657,7 +659,7 @@ static int cx23888_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,
657 return 0; 659 return 0;
658 } 660 }
659 661
660 n = kfifo_get(state->rx_kfifo, buf, n); 662 n = kfifo_out_locked(&state->rx_kfifo, buf, n, &state->rx_kfifo_lock);
661 663
662 n /= sizeof(u32); 664 n /= sizeof(u32);
663 *num = n * sizeof(u32); 665 *num = n * sizeof(u32);
@@ -785,7 +787,12 @@ static int cx23888_ir_rx_s_parameters(struct v4l2_subdev *sd,
785 o->interrupt_enable = p->interrupt_enable; 787 o->interrupt_enable = p->interrupt_enable;
786 o->enable = p->enable; 788 o->enable = p->enable;
787 if (p->enable) { 789 if (p->enable) {
788 kfifo_reset(state->rx_kfifo); 790 unsigned long flags;
791
792 spin_lock_irqsave(&state->rx_kfifo_lock, flags);
793 kfifo_reset(&state->rx_kfifo);
794 /* reset tx_fifo too if there is one... */
795 spin_unlock_irqrestore(&state->rx_kfifo_lock, flags);
789 if (p->interrupt_enable) 796 if (p->interrupt_enable)
790 irqenable_rx(dev, IRQEN_RSE | IRQEN_RTE | IRQEN_ROE); 797 irqenable_rx(dev, IRQEN_RSE | IRQEN_RTE | IRQEN_ROE);
791 control_rx_enable(dev, p->enable); 798 control_rx_enable(dev, p->enable);
@@ -892,7 +899,6 @@ static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd,
892 o->interrupt_enable = p->interrupt_enable; 899 o->interrupt_enable = p->interrupt_enable;
893 o->enable = p->enable; 900 o->enable = p->enable;
894 if (p->enable) { 901 if (p->enable) {
895 kfifo_reset(state->tx_kfifo);
896 if (p->interrupt_enable) 902 if (p->interrupt_enable)
897 irqenable_tx(dev, IRQEN_TSE); 903 irqenable_tx(dev, IRQEN_TSE);
898 control_tx_enable(dev, p->enable); 904 control_tx_enable(dev, p->enable);
@@ -1168,18 +1174,8 @@ int cx23888_ir_probe(struct cx23885_dev *dev)
1168 return -ENOMEM; 1174 return -ENOMEM;
1169 1175
1170 spin_lock_init(&state->rx_kfifo_lock); 1176 spin_lock_init(&state->rx_kfifo_lock);
1171 state->rx_kfifo = kfifo_alloc(CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL, 1177 if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL))
1172 &state->rx_kfifo_lock);
1173 if (state->rx_kfifo == NULL)
1174 return -ENOMEM;
1175
1176 spin_lock_init(&state->tx_kfifo_lock);
1177 state->tx_kfifo = kfifo_alloc(CX23888_IR_TX_KFIFO_SIZE, GFP_KERNEL,
1178 &state->tx_kfifo_lock);
1179 if (state->tx_kfifo == NULL) {
1180 kfifo_free(state->rx_kfifo);
1181 return -ENOMEM; 1178 return -ENOMEM;
1182 }
1183 1179
1184 state->dev = dev; 1180 state->dev = dev;
1185 state->id = V4L2_IDENT_CX23888_IR; 1181 state->id = V4L2_IDENT_CX23888_IR;
@@ -1211,8 +1207,7 @@ int cx23888_ir_probe(struct cx23885_dev *dev)
1211 sizeof(struct v4l2_subdev_ir_parameters)); 1207 sizeof(struct v4l2_subdev_ir_parameters));
1212 v4l2_subdev_call(sd, ir, tx_s_parameters, &default_params); 1208 v4l2_subdev_call(sd, ir, tx_s_parameters, &default_params);
1213 } else { 1209 } else {
1214 kfifo_free(state->rx_kfifo); 1210 kfifo_free(&state->rx_kfifo);
1215 kfifo_free(state->tx_kfifo);
1216 } 1211 }
1217 return ret; 1212 return ret;
1218} 1213}
@@ -1231,8 +1226,7 @@ int cx23888_ir_remove(struct cx23885_dev *dev)
1231 1226
1232 state = to_state(sd); 1227 state = to_state(sd);
1233 v4l2_device_unregister_subdev(sd); 1228 v4l2_device_unregister_subdev(sd);
1234 kfifo_free(state->rx_kfifo); 1229 kfifo_free(&state->rx_kfifo);
1235 kfifo_free(state->tx_kfifo);
1236 kfree(state); 1230 kfree(state);
1237 /* Nothing more to free() as state held the actual v4l2_subdev object */ 1231 /* Nothing more to free() as state held the actual v4l2_subdev object */
1238 return 0; 1232 return 0;
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 6ffa64cd1c6d..b421858ccf90 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -800,8 +800,8 @@ again:
800 return IRQ_HANDLED; 800 return IRQ_HANDLED;
801 801
802 if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) { 802 if (meye.mchip_mode == MCHIP_HIC_MODE_CONT_OUT) {
803 if (kfifo_get(meye.grabq, (unsigned char *)&reqnr, 803 if (kfifo_out_locked(&meye.grabq, (unsigned char *)&reqnr,
804 sizeof(int)) != sizeof(int)) { 804 sizeof(int), &meye.grabq_lock) != sizeof(int)) {
805 mchip_free_frame(); 805 mchip_free_frame();
806 return IRQ_HANDLED; 806 return IRQ_HANDLED;
807 } 807 }
@@ -811,7 +811,8 @@ again:
811 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; 811 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
812 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); 812 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
813 meye.grab_buffer[reqnr].sequence = sequence++; 813 meye.grab_buffer[reqnr].sequence = sequence++;
814 kfifo_put(meye.doneq, (unsigned char *)&reqnr, sizeof(int)); 814 kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr,
815 sizeof(int), &meye.doneq_lock);
815 wake_up_interruptible(&meye.proc_list); 816 wake_up_interruptible(&meye.proc_list);
816 } else { 817 } else {
817 int size; 818 int size;
@@ -820,8 +821,8 @@ again:
820 mchip_free_frame(); 821 mchip_free_frame();
821 goto again; 822 goto again;
822 } 823 }
823 if (kfifo_get(meye.grabq, (unsigned char *)&reqnr, 824 if (kfifo_out_locked(&meye.grabq, (unsigned char *)&reqnr,
824 sizeof(int)) != sizeof(int)) { 825 sizeof(int), &meye.grabq_lock) != sizeof(int)) {
825 mchip_free_frame(); 826 mchip_free_frame();
826 goto again; 827 goto again;
827 } 828 }
@@ -831,7 +832,8 @@ again:
831 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; 832 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE;
832 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp); 833 do_gettimeofday(&meye.grab_buffer[reqnr].timestamp);
833 meye.grab_buffer[reqnr].sequence = sequence++; 834 meye.grab_buffer[reqnr].sequence = sequence++;
834 kfifo_put(meye.doneq, (unsigned char *)&reqnr, sizeof(int)); 835 kfifo_in_locked(&meye.doneq, (unsigned char *)&reqnr,
836 sizeof(int), &meye.doneq_lock);
835 wake_up_interruptible(&meye.proc_list); 837 wake_up_interruptible(&meye.proc_list);
836 } 838 }
837 mchip_free_frame(); 839 mchip_free_frame();
@@ -859,8 +861,8 @@ static int meye_open(struct file *file)
859 861
860 for (i = 0; i < MEYE_MAX_BUFNBRS; i++) 862 for (i = 0; i < MEYE_MAX_BUFNBRS; i++)
861 meye.grab_buffer[i].state = MEYE_BUF_UNUSED; 863 meye.grab_buffer[i].state = MEYE_BUF_UNUSED;
862 kfifo_reset(meye.grabq); 864 kfifo_reset(&meye.grabq);
863 kfifo_reset(meye.doneq); 865 kfifo_reset(&meye.doneq);
864 return 0; 866 return 0;
865} 867}
866 868
@@ -933,7 +935,8 @@ static int meyeioc_qbuf_capt(int *nb)
933 mchip_cont_compression_start(); 935 mchip_cont_compression_start();
934 936
935 meye.grab_buffer[*nb].state = MEYE_BUF_USING; 937 meye.grab_buffer[*nb].state = MEYE_BUF_USING;
936 kfifo_put(meye.grabq, (unsigned char *)nb, sizeof(int)); 938 kfifo_in_locked(&meye.grabq, (unsigned char *)nb, sizeof(int),
939 &meye.grabq_lock);
937 mutex_unlock(&meye.lock); 940 mutex_unlock(&meye.lock);
938 941
939 return 0; 942 return 0;
@@ -965,7 +968,9 @@ static int meyeioc_sync(struct file *file, void *fh, int *i)
965 /* fall through */ 968 /* fall through */
966 case MEYE_BUF_DONE: 969 case MEYE_BUF_DONE:
967 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; 970 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
968 kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int)); 971 if (kfifo_out_locked(&meye.doneq, (unsigned char *)&unused,
972 sizeof(int), &meye.doneq_lock) != sizeof(int))
973 break;
969 } 974 }
970 *i = meye.grab_buffer[*i].size; 975 *i = meye.grab_buffer[*i].size;
971 mutex_unlock(&meye.lock); 976 mutex_unlock(&meye.lock);
@@ -1452,7 +1457,8 @@ static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
1452 buf->flags |= V4L2_BUF_FLAG_QUEUED; 1457 buf->flags |= V4L2_BUF_FLAG_QUEUED;
1453 buf->flags &= ~V4L2_BUF_FLAG_DONE; 1458 buf->flags &= ~V4L2_BUF_FLAG_DONE;
1454 meye.grab_buffer[buf->index].state = MEYE_BUF_USING; 1459 meye.grab_buffer[buf->index].state = MEYE_BUF_USING;
1455 kfifo_put(meye.grabq, (unsigned char *)&buf->index, sizeof(int)); 1460 kfifo_in_locked(&meye.grabq, (unsigned char *)&buf->index,
1461 sizeof(int), &meye.grabq_lock);
1456 mutex_unlock(&meye.lock); 1462 mutex_unlock(&meye.lock);
1457 1463
1458 return 0; 1464 return 0;
@@ -1467,19 +1473,19 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
1467 1473
1468 mutex_lock(&meye.lock); 1474 mutex_lock(&meye.lock);
1469 1475
1470 if (kfifo_len(meye.doneq) == 0 && file->f_flags & O_NONBLOCK) { 1476 if (kfifo_len(&meye.doneq) == 0 && file->f_flags & O_NONBLOCK) {
1471 mutex_unlock(&meye.lock); 1477 mutex_unlock(&meye.lock);
1472 return -EAGAIN; 1478 return -EAGAIN;
1473 } 1479 }
1474 1480
1475 if (wait_event_interruptible(meye.proc_list, 1481 if (wait_event_interruptible(meye.proc_list,
1476 kfifo_len(meye.doneq) != 0) < 0) { 1482 kfifo_len(&meye.doneq) != 0) < 0) {
1477 mutex_unlock(&meye.lock); 1483 mutex_unlock(&meye.lock);
1478 return -EINTR; 1484 return -EINTR;
1479 } 1485 }
1480 1486
1481 if (!kfifo_get(meye.doneq, (unsigned char *)&reqnr, 1487 if (!kfifo_out_locked(&meye.doneq, (unsigned char *)&reqnr,
1482 sizeof(int))) { 1488 sizeof(int), &meye.doneq_lock)) {
1483 mutex_unlock(&meye.lock); 1489 mutex_unlock(&meye.lock);
1484 return -EBUSY; 1490 return -EBUSY;
1485 } 1491 }
@@ -1529,8 +1535,8 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i)
1529{ 1535{
1530 mutex_lock(&meye.lock); 1536 mutex_lock(&meye.lock);
1531 mchip_hic_stop(); 1537 mchip_hic_stop();
1532 kfifo_reset(meye.grabq); 1538 kfifo_reset(&meye.grabq);
1533 kfifo_reset(meye.doneq); 1539 kfifo_reset(&meye.doneq);
1534 1540
1535 for (i = 0; i < MEYE_MAX_BUFNBRS; i++) 1541 for (i = 0; i < MEYE_MAX_BUFNBRS; i++)
1536 meye.grab_buffer[i].state = MEYE_BUF_UNUSED; 1542 meye.grab_buffer[i].state = MEYE_BUF_UNUSED;
@@ -1572,7 +1578,7 @@ static unsigned int meye_poll(struct file *file, poll_table *wait)
1572 1578
1573 mutex_lock(&meye.lock); 1579 mutex_lock(&meye.lock);
1574 poll_wait(file, &meye.proc_list, wait); 1580 poll_wait(file, &meye.proc_list, wait);
1575 if (kfifo_len(meye.doneq)) 1581 if (kfifo_len(&meye.doneq))
1576 res = POLLIN | POLLRDNORM; 1582 res = POLLIN | POLLRDNORM;
1577 mutex_unlock(&meye.lock); 1583 mutex_unlock(&meye.lock);
1578 return res; 1584 return res;
@@ -1745,16 +1751,14 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1745 } 1751 }
1746 1752
1747 spin_lock_init(&meye.grabq_lock); 1753 spin_lock_init(&meye.grabq_lock);
1748 meye.grabq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL, 1754 if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS,
1749 &meye.grabq_lock); 1755 GFP_KERNEL)) {
1750 if (IS_ERR(meye.grabq)) {
1751 printk(KERN_ERR "meye: fifo allocation failed\n"); 1756 printk(KERN_ERR "meye: fifo allocation failed\n");
1752 goto outkfifoalloc1; 1757 goto outkfifoalloc1;
1753 } 1758 }
1754 spin_lock_init(&meye.doneq_lock); 1759 spin_lock_init(&meye.doneq_lock);
1755 meye.doneq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL, 1760 if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS,
1756 &meye.doneq_lock); 1761 GFP_KERNEL)) {
1757 if (IS_ERR(meye.doneq)) {
1758 printk(KERN_ERR "meye: fifo allocation failed\n"); 1762 printk(KERN_ERR "meye: fifo allocation failed\n");
1759 goto outkfifoalloc2; 1763 goto outkfifoalloc2;
1760 } 1764 }
@@ -1868,9 +1872,9 @@ outregions:
1868outenabledev: 1872outenabledev:
1869 sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0); 1873 sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0);
1870outsonypienable: 1874outsonypienable:
1871 kfifo_free(meye.doneq); 1875 kfifo_free(&meye.doneq);
1872outkfifoalloc2: 1876outkfifoalloc2:
1873 kfifo_free(meye.grabq); 1877 kfifo_free(&meye.grabq);
1874outkfifoalloc1: 1878outkfifoalloc1:
1875 vfree(meye.grab_temp); 1879 vfree(meye.grab_temp);
1876outvmalloc: 1880outvmalloc:
@@ -1901,8 +1905,8 @@ static void __devexit meye_remove(struct pci_dev *pcidev)
1901 1905
1902 sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0); 1906 sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 0);
1903 1907
1904 kfifo_free(meye.doneq); 1908 kfifo_free(&meye.doneq);
1905 kfifo_free(meye.grabq); 1909 kfifo_free(&meye.grabq);
1906 1910
1907 vfree(meye.grab_temp); 1911 vfree(meye.grab_temp);
1908 1912
diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h
index 5f70a106ba2b..1321ad5d6597 100644
--- a/drivers/media/video/meye.h
+++ b/drivers/media/video/meye.h
@@ -303,9 +303,9 @@ struct meye {
303 struct meye_grab_buffer grab_buffer[MEYE_MAX_BUFNBRS]; 303 struct meye_grab_buffer grab_buffer[MEYE_MAX_BUFNBRS];
304 int vma_use_count[MEYE_MAX_BUFNBRS]; /* mmap count */ 304 int vma_use_count[MEYE_MAX_BUFNBRS]; /* mmap count */
305 struct mutex lock; /* mutex for open/mmap... */ 305 struct mutex lock; /* mutex for open/mmap... */
306 struct kfifo *grabq; /* queue for buffers to be grabbed */ 306 struct kfifo grabq; /* queue for buffers to be grabbed */
307 spinlock_t grabq_lock; /* lock protecting the queue */ 307 spinlock_t grabq_lock; /* lock protecting the queue */
308 struct kfifo *doneq; /* queue for grabbed buffers */ 308 struct kfifo doneq; /* queue for grabbed buffers */
309 spinlock_t doneq_lock; /* lock protecting the queue */ 309 spinlock_t doneq_lock; /* lock protecting the queue */
310 wait_queue_head_t proc_list; /* wait queue */ 310 wait_queue_head_t proc_list; /* wait queue */
311 struct video_device *video_dev; /* video device parameters */ 311 struct video_device *video_dev; /* video device parameters */
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 610e914abe6c..85bc6a685e36 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1587,7 +1587,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1587{ 1587{
1588 u8 __iomem *mem; 1588 u8 __iomem *mem;
1589 int ii; 1589 int ii;
1590 unsigned long mem_phys; 1590 resource_size_t mem_phys;
1591 unsigned long port; 1591 unsigned long port;
1592 u32 msize; 1592 u32 msize;
1593 u32 psize; 1593 u32 psize;
@@ -1677,8 +1677,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1677 return -EINVAL; 1677 return -EINVAL;
1678 } 1678 }
1679 ioc->memmap = mem; 1679 ioc->memmap = mem;
1680 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %lx\n", 1680 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n",
1681 ioc->name, mem, mem_phys)); 1681 ioc->name, mem, (unsigned long long)mem_phys));
1682 1682
1683 ioc->mem_phys = mem_phys; 1683 ioc->mem_phys = mem_phys;
1684 ioc->chip = (SYSIF_REGS __iomem *)mem; 1684 ioc->chip = (SYSIF_REGS __iomem *)mem;
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index efba7021948a..3d5f40cd69df 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -40,8 +40,7 @@
40 40
41#define SG_TABLESIZE 30 41#define SG_TABLESIZE 30
42 42
43static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int, 43static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long);
44 unsigned long);
45 44
46static spinlock_t i2o_config_lock; 45static spinlock_t i2o_config_lock;
47 46
@@ -751,7 +750,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
751 lock_kernel(); 750 lock_kernel();
752 switch (cmd) { 751 switch (cmd) {
753 case I2OGETIOPS: 752 case I2OGETIOPS:
754 ret = i2o_cfg_ioctl(NULL, file, cmd, arg); 753 ret = i2o_cfg_ioctl(file, cmd, arg);
755 break; 754 break;
756 case I2OPASSTHRU32: 755 case I2OPASSTHRU32:
757 ret = i2o_cfg_passthru32(file, cmd, arg); 756 ret = i2o_cfg_passthru32(file, cmd, arg);
@@ -984,11 +983,11 @@ out:
984/* 983/*
985 * IOCTL Handler 984 * IOCTL Handler
986 */ 985 */
987static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, 986static long i2o_cfg_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
988 unsigned long arg)
989{ 987{
990 int ret; 988 int ret;
991 989
990 lock_kernel();
992 switch (cmd) { 991 switch (cmd) {
993 case I2OGETIOPS: 992 case I2OGETIOPS:
994 ret = i2o_cfg_getiops(arg); 993 ret = i2o_cfg_getiops(arg);
@@ -1044,7 +1043,7 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
1044 osm_debug("unknown ioctl called!\n"); 1043 osm_debug("unknown ioctl called!\n");
1045 ret = -EINVAL; 1044 ret = -EINVAL;
1046 } 1045 }
1047 1046 unlock_kernel();
1048 return ret; 1047 return ret;
1049} 1048}
1050 1049
@@ -1118,7 +1117,7 @@ static int cfg_release(struct inode *inode, struct file *file)
1118static const struct file_operations config_fops = { 1117static const struct file_operations config_fops = {
1119 .owner = THIS_MODULE, 1118 .owner = THIS_MODULE,
1120 .llseek = no_llseek, 1119 .llseek = no_llseek,
1121 .ioctl = i2o_cfg_ioctl, 1120 .unlocked_ioctl = i2o_cfg_ioctl,
1122#ifdef CONFIG_COMPAT 1121#ifdef CONFIG_COMPAT
1123 .compat_ioctl = i2o_cfg_compat_ioctl, 1122 .compat_ioctl = i2o_cfg_compat_ioctl,
1124#endif 1123#endif
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 20d29bafc9f5..9df9a5ad38f9 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -568,12 +568,12 @@ static void twl4030_sih_do_edge(struct work_struct *work)
568 568
569 bytes[byte] &= ~(0x03 << off); 569 bytes[byte] &= ~(0x03 << off);
570 570
571 spin_lock_irq(&d->lock); 571 raw_spin_lock_irq(&d->lock);
572 if (d->status & IRQ_TYPE_EDGE_RISING) 572 if (d->status & IRQ_TYPE_EDGE_RISING)
573 bytes[byte] |= BIT(off + 1); 573 bytes[byte] |= BIT(off + 1);
574 if (d->status & IRQ_TYPE_EDGE_FALLING) 574 if (d->status & IRQ_TYPE_EDGE_FALLING)
575 bytes[byte] |= BIT(off + 0); 575 bytes[byte] |= BIT(off + 0);
576 spin_unlock_irq(&d->lock); 576 raw_spin_unlock_irq(&d->lock);
577 577
578 edge_change &= ~BIT(i); 578 edge_change &= ~BIT(i);
579 } 579 }
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 1a7a9fc50ea1..e3551d20464f 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -203,6 +203,7 @@ config CS5535_MFGPT
203 203
204config CS5535_MFGPT_DEFAULT_IRQ 204config CS5535_MFGPT_DEFAULT_IRQ
205 int 205 int
206 depends on CS5535_MFGPT
206 default 7 207 default 7
207 help 208 help
208 MFGPTs on the CS5535 require an interrupt. The selected IRQ 209 MFGPTs on the CS5535 require an interrupt. The selected IRQ
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index e9eae4a78402..1eac626e710a 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -391,6 +391,7 @@ static const char *const enclosure_status [] = {
391 [ENCLOSURE_STATUS_NOT_INSTALLED] = "not installed", 391 [ENCLOSURE_STATUS_NOT_INSTALLED] = "not installed",
392 [ENCLOSURE_STATUS_UNKNOWN] = "unknown", 392 [ENCLOSURE_STATUS_UNKNOWN] = "unknown",
393 [ENCLOSURE_STATUS_UNAVAILABLE] = "unavailable", 393 [ENCLOSURE_STATUS_UNAVAILABLE] = "unavailable",
394 [ENCLOSURE_STATUS_MAX] = NULL,
394}; 395};
395 396
396static const char *const enclosure_type [] = { 397static const char *const enclosure_type [] = {
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 85f0e8cd875b..1f552c6e7579 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -85,7 +85,14 @@ static void mmc_blk_put(struct mmc_blk_data *md)
85 mutex_lock(&open_lock); 85 mutex_lock(&open_lock);
86 md->usage--; 86 md->usage--;
87 if (md->usage == 0) { 87 if (md->usage == 0) {
88 int devmaj = MAJOR(disk_devt(md->disk));
88 int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT; 89 int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT;
90
91 if (!devmaj)
92 devidx = md->disk->first_minor >> MMC_SHIFT;
93
94 blk_cleanup_queue(md->queue.queue);
95
89 __clear_bit(devidx, dev_use); 96 __clear_bit(devidx, dev_use);
90 97
91 put_disk(md->disk); 98 put_disk(md->disk);
@@ -613,6 +620,7 @@ static int mmc_blk_probe(struct mmc_card *card)
613 return 0; 620 return 0;
614 621
615 out: 622 out:
623 mmc_cleanup_queue(&md->queue);
616 mmc_blk_put(md); 624 mmc_blk_put(md);
617 625
618 return err; 626 return err;
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 49e582356c65..c5a7a855f4b1 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -90,9 +90,10 @@ static void mmc_request(struct request_queue *q)
90 struct request *req; 90 struct request *req;
91 91
92 if (!mq) { 92 if (!mq) {
93 printk(KERN_ERR "MMC: killing requests for dead queue\n"); 93 while ((req = blk_fetch_request(q)) != NULL) {
94 while ((req = blk_fetch_request(q)) != NULL) 94 req->cmd_flags |= REQ_QUIET;
95 __blk_end_request_all(req, -EIO); 95 __blk_end_request_all(req, -EIO);
96 }
96 return; 97 return;
97 } 98 }
98 99
@@ -223,17 +224,18 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
223 struct request_queue *q = mq->queue; 224 struct request_queue *q = mq->queue;
224 unsigned long flags; 225 unsigned long flags;
225 226
226 /* Mark that we should start throwing out stragglers */
227 spin_lock_irqsave(q->queue_lock, flags);
228 q->queuedata = NULL;
229 spin_unlock_irqrestore(q->queue_lock, flags);
230
231 /* Make sure the queue isn't suspended, as that will deadlock */ 227 /* Make sure the queue isn't suspended, as that will deadlock */
232 mmc_queue_resume(mq); 228 mmc_queue_resume(mq);
233 229
234 /* Then terminate our worker thread */ 230 /* Then terminate our worker thread */
235 kthread_stop(mq->thread); 231 kthread_stop(mq->thread);
236 232
233 /* Empty the queue */
234 spin_lock_irqsave(q->queue_lock, flags);
235 q->queuedata = NULL;
236 blk_start_queue(q);
237 spin_unlock_irqrestore(q->queue_lock, flags);
238
237 if (mq->bounce_sg) 239 if (mq->bounce_sg)
238 kfree(mq->bounce_sg); 240 kfree(mq->bounce_sg);
239 mq->bounce_sg = NULL; 241 mq->bounce_sg = NULL;
@@ -245,8 +247,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
245 kfree(mq->bounce_buf); 247 kfree(mq->bounce_buf);
246 mq->bounce_buf = NULL; 248 mq->bounce_buf = NULL;
247 249
248 blk_cleanup_queue(mq->queue);
249
250 mq->card = NULL; 250 mq->card = NULL;
251} 251}
252EXPORT_SYMBOL(mmc_cleanup_queue); 252EXPORT_SYMBOL(mmc_cleanup_queue);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index c11189446a1f..0eac6c814904 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -207,7 +207,7 @@ static int mmc_read_ext_csd(struct mmc_card *card)
207 } 207 }
208 208
209 card->ext_csd.rev = ext_csd[EXT_CSD_REV]; 209 card->ext_csd.rev = ext_csd[EXT_CSD_REV];
210 if (card->ext_csd.rev > 3) { 210 if (card->ext_csd.rev > 5) {
211 printk(KERN_ERR "%s: unrecognised EXT_CSD structure " 211 printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
212 "version %d\n", mmc_hostname(card->host), 212 "version %d\n", mmc_hostname(card->host),
213 card->ext_csd.rev); 213 card->ext_csd.rev);
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index cdb845b68ab5..06b64085a355 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -516,7 +516,8 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
516 * The number of functions on the card is encoded inside 516 * The number of functions on the card is encoded inside
517 * the ocr. 517 * the ocr.
518 */ 518 */
519 card->sdio_funcs = funcs = (ocr & 0x70000000) >> 28; 519 funcs = (ocr & 0x70000000) >> 28;
520 card->sdio_funcs = 0;
520 521
521 /* 522 /*
522 * If needed, disconnect card detection pull-up resistor. 523 * If needed, disconnect card detection pull-up resistor.
@@ -528,7 +529,7 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
528 /* 529 /*
529 * Initialize (but don't add) all present functions. 530 * Initialize (but don't add) all present functions.
530 */ 531 */
531 for (i = 0;i < funcs;i++) { 532 for (i = 0; i < funcs; i++, card->sdio_funcs++) {
532 err = sdio_init_func(host->card, i + 1); 533 err = sdio_init_func(host->card, i + 1);
533 if (err) 534 if (err)
534 goto remove; 535 goto remove;
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index d37464e296a5..9e060c87e64d 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -248,12 +248,15 @@ int sdio_add_func(struct sdio_func *func)
248/* 248/*
249 * Unregister a SDIO function with the driver model, and 249 * Unregister a SDIO function with the driver model, and
250 * (eventually) free it. 250 * (eventually) free it.
251 * This function can be called through error paths where sdio_add_func() was
252 * never executed (because a failure occurred at an earlier point).
251 */ 253 */
252void sdio_remove_func(struct sdio_func *func) 254void sdio_remove_func(struct sdio_func *func)
253{ 255{
254 if (sdio_func_present(func)) 256 if (!sdio_func_present(func))
255 device_del(&func->dev); 257 return;
256 258
259 device_del(&func->dev);
257 put_device(&func->dev); 260 put_device(&func->dev);
258} 261}
259 262
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 9d405b181781..ce1d28884e29 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -44,6 +44,19 @@ config MMC_SDHCI_IO_ACCESSORS
44 This is silent Kconfig symbol that is selected by the drivers that 44 This is silent Kconfig symbol that is selected by the drivers that
45 need to overwrite SDHCI IO memory accessors. 45 need to overwrite SDHCI IO memory accessors.
46 46
47config MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
48 bool
49 select MMC_SDHCI_IO_ACCESSORS
50 help
51 This option is selected by drivers running on big endian hosts
52 and performing I/O to a SDHCI controller through a bus that
53 implements a hardware byte swapper using a 32-bit datum.
54 This endian mapping mode is called "data invariance" and
55 has the effect of scrambling the addresses and formats of data
56 accessed in sizes other than the datum size.
57
58 This is the case for the Freescale eSDHC and Nintendo Wii SDHCI.
59
47config MMC_SDHCI_PCI 60config MMC_SDHCI_PCI
48 tristate "SDHCI support on PCI bus" 61 tristate "SDHCI support on PCI bus"
49 depends on MMC_SDHCI && PCI 62 depends on MMC_SDHCI && PCI
@@ -75,11 +88,29 @@ config MMC_RICOH_MMC
75config MMC_SDHCI_OF 88config MMC_SDHCI_OF
76 tristate "SDHCI support on OpenFirmware platforms" 89 tristate "SDHCI support on OpenFirmware platforms"
77 depends on MMC_SDHCI && PPC_OF 90 depends on MMC_SDHCI && PPC_OF
78 select MMC_SDHCI_IO_ACCESSORS
79 help 91 help
80 This selects the OF support for Secure Digital Host Controller 92 This selects the OF support for Secure Digital Host Controller
81 Interfaces. So far, only the Freescale eSDHC controller is known 93 Interfaces.
82 to exist on OF platforms. 94
95 If unsure, say N.
96
97config MMC_SDHCI_OF_ESDHC
98 bool "SDHCI OF support for the Freescale eSDHC controller"
99 depends on MMC_SDHCI_OF
100 select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
101 help
102 This selects the Freescale eSDHC controller support.
103
104 If unsure, say N.
105
106config MMC_SDHCI_OF_HLWD
107 bool "SDHCI OF support for the Nintendo Wii SDHCI controllers"
108 depends on MMC_SDHCI_OF
109 select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
110 help
111 This selects the Secure Digital Host Controller Interface (SDHCI)
112 found in the "Hollywood" chipset of the Nintendo Wii video game
113 console.
83 114
84 If unsure, say N. 115 If unsure, say N.
85 116
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index ded4d8cdd9d7..3d253dd4240f 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_MMC_MXC) += mxcmmc.o
13obj-$(CONFIG_MMC_SDHCI) += sdhci.o 13obj-$(CONFIG_MMC_SDHCI) += sdhci.o
14obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o 14obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o
15obj-$(CONFIG_MMC_RICOH_MMC) += ricoh_mmc.o 15obj-$(CONFIG_MMC_RICOH_MMC) += ricoh_mmc.o
16obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
17obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o 16obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o
18obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o 17obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o
19obj-$(CONFIG_MMC_WBSD) += wbsd.o 18obj-$(CONFIG_MMC_WBSD) += wbsd.o
@@ -37,6 +36,11 @@ obj-$(CONFIG_MMC_CB710) += cb710-mmc.o
37obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o 36obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o
38obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o 37obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o
39 38
39obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o
40sdhci-of-y := sdhci-of-core.o
41sdhci-of-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o
42sdhci-of-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o
43
40ifeq ($(CONFIG_CB710_DEBUG),y) 44ifeq ($(CONFIG_CB710_DEBUG),y)
41 CFLAGS-cb710-mmc += -DDEBUG 45 CFLAGS-cb710-mmc += -DDEBUG
42endif 46endif
diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of-core.c
index 01ab916c2802..55e33135edb4 100644
--- a/drivers/mmc/host/sdhci-of.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -22,62 +22,37 @@
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/mmc/host.h> 23#include <linux/mmc/host.h>
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include "sdhci-of.h"
25#include "sdhci.h" 26#include "sdhci.h"
26 27
27struct sdhci_of_data { 28#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER
28 unsigned int quirks;
29 struct sdhci_ops ops;
30};
31
32struct sdhci_of_host {
33 unsigned int clock;
34 u16 xfer_mode_shadow;
35};
36 29
37/* 30/*
38 * Ops and quirks for the Freescale eSDHC controller. 31 * These accessors are designed for big endian hosts doing I/O to
32 * little endian controllers incorporating a 32-bit hardware byte swapper.
39 */ 33 */
40 34
41#define ESDHC_DMA_SYSCTL 0x40c 35u32 sdhci_be32bs_readl(struct sdhci_host *host, int reg)
42#define ESDHC_DMA_SNOOP 0x00000040
43
44#define ESDHC_SYSTEM_CONTROL 0x2c
45#define ESDHC_CLOCK_MASK 0x0000fff0
46#define ESDHC_PREDIV_SHIFT 8
47#define ESDHC_DIVIDER_SHIFT 4
48#define ESDHC_CLOCK_PEREN 0x00000004
49#define ESDHC_CLOCK_HCKEN 0x00000002
50#define ESDHC_CLOCK_IPGEN 0x00000001
51
52#define ESDHC_HOST_CONTROL_RES 0x05
53
54static u32 esdhc_readl(struct sdhci_host *host, int reg)
55{ 36{
56 return in_be32(host->ioaddr + reg); 37 return in_be32(host->ioaddr + reg);
57} 38}
58 39
59static u16 esdhc_readw(struct sdhci_host *host, int reg) 40u16 sdhci_be32bs_readw(struct sdhci_host *host, int reg)
60{ 41{
61 u16 ret; 42 return in_be16(host->ioaddr + (reg ^ 0x2));
62
63 if (unlikely(reg == SDHCI_HOST_VERSION))
64 ret = in_be16(host->ioaddr + reg);
65 else
66 ret = in_be16(host->ioaddr + (reg ^ 0x2));
67 return ret;
68} 43}
69 44
70static u8 esdhc_readb(struct sdhci_host *host, int reg) 45u8 sdhci_be32bs_readb(struct sdhci_host *host, int reg)
71{ 46{
72 return in_8(host->ioaddr + (reg ^ 0x3)); 47 return in_8(host->ioaddr + (reg ^ 0x3));
73} 48}
74 49
75static void esdhc_writel(struct sdhci_host *host, u32 val, int reg) 50void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg)
76{ 51{
77 out_be32(host->ioaddr + reg, val); 52 out_be32(host->ioaddr + reg, val);
78} 53}
79 54
80static void esdhc_writew(struct sdhci_host *host, u16 val, int reg) 55void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg)
81{ 56{
82 struct sdhci_of_host *of_host = sdhci_priv(host); 57 struct sdhci_of_host *of_host = sdhci_priv(host);
83 int base = reg & ~0x3; 58 int base = reg & ~0x3;
@@ -92,106 +67,21 @@ static void esdhc_writew(struct sdhci_host *host, u16 val, int reg)
92 of_host->xfer_mode_shadow = val; 67 of_host->xfer_mode_shadow = val;
93 return; 68 return;
94 case SDHCI_COMMAND: 69 case SDHCI_COMMAND:
95 esdhc_writel(host, val << 16 | of_host->xfer_mode_shadow, 70 sdhci_be32bs_writel(host, val << 16 | of_host->xfer_mode_shadow,
96 SDHCI_TRANSFER_MODE); 71 SDHCI_TRANSFER_MODE);
97 return; 72 return;
98 case SDHCI_BLOCK_SIZE:
99 /*
100 * Two last DMA bits are reserved, and first one is used for
101 * non-standard blksz of 4096 bytes that we don't support
102 * yet. So clear the DMA boundary bits.
103 */
104 val &= ~SDHCI_MAKE_BLKSZ(0x7, 0);
105 /* fall through */
106 } 73 }
107 clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift); 74 clrsetbits_be32(host->ioaddr + base, 0xffff << shift, val << shift);
108} 75}
109 76
110static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg) 77void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg)
111{ 78{
112 int base = reg & ~0x3; 79 int base = reg & ~0x3;
113 int shift = (reg & 0x3) * 8; 80 int shift = (reg & 0x3) * 8;
114 81
115 /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */
116 if (reg == SDHCI_HOST_CONTROL)
117 val &= ~ESDHC_HOST_CONTROL_RES;
118
119 clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift); 82 clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift);
120} 83}
121 84#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */
122static void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
123{
124 int pre_div = 2;
125 int div = 1;
126
127 clrbits32(host->ioaddr + ESDHC_SYSTEM_CONTROL, ESDHC_CLOCK_IPGEN |
128 ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN | ESDHC_CLOCK_MASK);
129
130 if (clock == 0)
131 goto out;
132
133 while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
134 pre_div *= 2;
135
136 while (host->max_clk / pre_div / div > clock && div < 16)
137 div++;
138
139 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n",
140 clock, host->max_clk / pre_div / div);
141
142 pre_div >>= 1;
143 div--;
144
145 setbits32(host->ioaddr + ESDHC_SYSTEM_CONTROL, ESDHC_CLOCK_IPGEN |
146 ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN |
147 div << ESDHC_DIVIDER_SHIFT | pre_div << ESDHC_PREDIV_SHIFT);
148 mdelay(100);
149out:
150 host->clock = clock;
151}
152
153static int esdhc_enable_dma(struct sdhci_host *host)
154{
155 setbits32(host->ioaddr + ESDHC_DMA_SYSCTL, ESDHC_DMA_SNOOP);
156 return 0;
157}
158
159static unsigned int esdhc_get_max_clock(struct sdhci_host *host)
160{
161 struct sdhci_of_host *of_host = sdhci_priv(host);
162
163 return of_host->clock;
164}
165
166static unsigned int esdhc_get_min_clock(struct sdhci_host *host)
167{
168 struct sdhci_of_host *of_host = sdhci_priv(host);
169
170 return of_host->clock / 256 / 16;
171}
172
173static struct sdhci_of_data sdhci_esdhc = {
174 .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 |
175 SDHCI_QUIRK_BROKEN_CARD_DETECTION |
176 SDHCI_QUIRK_NO_BUSY_IRQ |
177 SDHCI_QUIRK_NONSTANDARD_CLOCK |
178 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
179 SDHCI_QUIRK_PIO_NEEDS_DELAY |
180 SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET |
181 SDHCI_QUIRK_NO_CARD_NO_RESET,
182 .ops = {
183 .readl = esdhc_readl,
184 .readw = esdhc_readw,
185 .readb = esdhc_readb,
186 .writel = esdhc_writel,
187 .writew = esdhc_writew,
188 .writeb = esdhc_writeb,
189 .set_clock = esdhc_set_clock,
190 .enable_dma = esdhc_enable_dma,
191 .get_max_clock = esdhc_get_max_clock,
192 .get_min_clock = esdhc_get_min_clock,
193 },
194};
195 85
196#ifdef CONFIG_PM 86#ifdef CONFIG_PM
197 87
@@ -301,9 +191,14 @@ static int __devexit sdhci_of_remove(struct of_device *ofdev)
301} 191}
302 192
303static const struct of_device_id sdhci_of_match[] = { 193static const struct of_device_id sdhci_of_match[] = {
194#ifdef CONFIG_MMC_SDHCI_OF_ESDHC
304 { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc, }, 195 { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc, },
305 { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc, }, 196 { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc, },
306 { .compatible = "fsl,esdhc", .data = &sdhci_esdhc, }, 197 { .compatible = "fsl,esdhc", .data = &sdhci_esdhc, },
198#endif
199#ifdef CONFIG_MMC_SDHCI_OF_HLWD
200 { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd, },
201#endif
307 { .compatible = "generic-sdhci", }, 202 { .compatible = "generic-sdhci", },
308 {}, 203 {},
309}; 204};
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
new file mode 100644
index 000000000000..d5b11a17e648
--- /dev/null
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -0,0 +1,143 @@
1/*
2 * Freescale eSDHC controller driver.
3 *
4 * Copyright (c) 2007 Freescale Semiconductor, Inc.
5 * Copyright (c) 2009 MontaVista Software, Inc.
6 *
7 * Authors: Xiaobo Xie <X.Xie@freescale.com>
8 * Anton Vorontsov <avorontsov@ru.mvista.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
14 */
15
16#include <linux/io.h>
17#include <linux/delay.h>
18#include <linux/mmc/host.h>
19#include "sdhci-of.h"
20#include "sdhci.h"
21
22/*
23 * Ops and quirks for the Freescale eSDHC controller.
24 */
25
26#define ESDHC_DMA_SYSCTL 0x40c
27#define ESDHC_DMA_SNOOP 0x00000040
28
29#define ESDHC_SYSTEM_CONTROL 0x2c
30#define ESDHC_CLOCK_MASK 0x0000fff0
31#define ESDHC_PREDIV_SHIFT 8
32#define ESDHC_DIVIDER_SHIFT 4
33#define ESDHC_CLOCK_PEREN 0x00000004
34#define ESDHC_CLOCK_HCKEN 0x00000002
35#define ESDHC_CLOCK_IPGEN 0x00000001
36
37#define ESDHC_HOST_CONTROL_RES 0x05
38
39static u16 esdhc_readw(struct sdhci_host *host, int reg)
40{
41 u16 ret;
42
43 if (unlikely(reg == SDHCI_HOST_VERSION))
44 ret = in_be16(host->ioaddr + reg);
45 else
46 ret = sdhci_be32bs_readw(host, reg);
47 return ret;
48}
49
50static void esdhc_writew(struct sdhci_host *host, u16 val, int reg)
51{
52 if (reg == SDHCI_BLOCK_SIZE) {
53 /*
54 * Two last DMA bits are reserved, and first one is used for
55 * non-standard blksz of 4096 bytes that we don't support
56 * yet. So clear the DMA boundary bits.
57 */
58 val &= ~SDHCI_MAKE_BLKSZ(0x7, 0);
59 }
60 sdhci_be32bs_writew(host, val, reg);
61}
62
63static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg)
64{
65 /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */
66 if (reg == SDHCI_HOST_CONTROL)
67 val &= ~ESDHC_HOST_CONTROL_RES;
68 sdhci_be32bs_writeb(host, val, reg);
69}
70
71static void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
72{
73 int pre_div = 2;
74 int div = 1;
75
76 clrbits32(host->ioaddr + ESDHC_SYSTEM_CONTROL, ESDHC_CLOCK_IPGEN |
77 ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN | ESDHC_CLOCK_MASK);
78
79 if (clock == 0)
80 goto out;
81
82 while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
83 pre_div *= 2;
84
85 while (host->max_clk / pre_div / div > clock && div < 16)
86 div++;
87
88 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n",
89 clock, host->max_clk / pre_div / div);
90
91 pre_div >>= 1;
92 div--;
93
94 setbits32(host->ioaddr + ESDHC_SYSTEM_CONTROL, ESDHC_CLOCK_IPGEN |
95 ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN |
96 div << ESDHC_DIVIDER_SHIFT | pre_div << ESDHC_PREDIV_SHIFT);
97 mdelay(100);
98out:
99 host->clock = clock;
100}
101
102static int esdhc_enable_dma(struct sdhci_host *host)
103{
104 setbits32(host->ioaddr + ESDHC_DMA_SYSCTL, ESDHC_DMA_SNOOP);
105 return 0;
106}
107
108static unsigned int esdhc_get_max_clock(struct sdhci_host *host)
109{
110 struct sdhci_of_host *of_host = sdhci_priv(host);
111
112 return of_host->clock;
113}
114
115static unsigned int esdhc_get_min_clock(struct sdhci_host *host)
116{
117 struct sdhci_of_host *of_host = sdhci_priv(host);
118
119 return of_host->clock / 256 / 16;
120}
121
122struct sdhci_of_data sdhci_esdhc = {
123 .quirks = SDHCI_QUIRK_FORCE_BLK_SZ_2048 |
124 SDHCI_QUIRK_BROKEN_CARD_DETECTION |
125 SDHCI_QUIRK_NO_BUSY_IRQ |
126 SDHCI_QUIRK_NONSTANDARD_CLOCK |
127 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
128 SDHCI_QUIRK_PIO_NEEDS_DELAY |
129 SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET |
130 SDHCI_QUIRK_NO_CARD_NO_RESET,
131 .ops = {
132 .readl = sdhci_be32bs_readl,
133 .readw = esdhc_readw,
134 .readb = sdhci_be32bs_readb,
135 .writel = sdhci_be32bs_writel,
136 .writew = esdhc_writew,
137 .writeb = esdhc_writeb,
138 .set_clock = esdhc_set_clock,
139 .enable_dma = esdhc_enable_dma,
140 .get_max_clock = esdhc_get_max_clock,
141 .get_min_clock = esdhc_get_min_clock,
142 },
143};
diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
new file mode 100644
index 000000000000..35117f3ed757
--- /dev/null
+++ b/drivers/mmc/host/sdhci-of-hlwd.c
@@ -0,0 +1,65 @@
1/*
2 * drivers/mmc/host/sdhci-of-hlwd.c
3 *
4 * Nintendo Wii Secure Digital Host Controller Interface.
5 * Copyright (C) 2009 The GameCube Linux Team
6 * Copyright (C) 2009 Albert Herranz
7 *
8 * Based on sdhci-of-esdhc.c
9 *
10 * Copyright (c) 2007 Freescale Semiconductor, Inc.
11 * Copyright (c) 2009 MontaVista Software, Inc.
12 *
13 * Authors: Xiaobo Xie <X.Xie@freescale.com>
14 * Anton Vorontsov <avorontsov@ru.mvista.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or (at
19 * your option) any later version.
20 */
21
22#include <linux/delay.h>
23#include <linux/mmc/host.h>
24#include "sdhci-of.h"
25#include "sdhci.h"
26
27/*
28 * Ops and quirks for the Nintendo Wii SDHCI controllers.
29 */
30
31/*
32 * We need a small delay after each write, or things go horribly wrong.
33 */
34#define SDHCI_HLWD_WRITE_DELAY 5 /* usecs */
35
36static void sdhci_hlwd_writel(struct sdhci_host *host, u32 val, int reg)
37{
38 sdhci_be32bs_writel(host, val, reg);
39 udelay(SDHCI_HLWD_WRITE_DELAY);
40}
41
42static void sdhci_hlwd_writew(struct sdhci_host *host, u16 val, int reg)
43{
44 sdhci_be32bs_writew(host, val, reg);
45 udelay(SDHCI_HLWD_WRITE_DELAY);
46}
47
48static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg)
49{
50 sdhci_be32bs_writeb(host, val, reg);
51 udelay(SDHCI_HLWD_WRITE_DELAY);
52}
53
54struct sdhci_of_data sdhci_hlwd = {
55 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR |
56 SDHCI_QUIRK_32BIT_DMA_SIZE,
57 .ops = {
58 .readl = sdhci_be32bs_readl,
59 .readw = sdhci_be32bs_readw,
60 .readb = sdhci_be32bs_readb,
61 .writel = sdhci_hlwd_writel,
62 .writew = sdhci_hlwd_writew,
63 .writeb = sdhci_hlwd_writeb,
64 },
65};
diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h
new file mode 100644
index 000000000000..ad09ad9915d8
--- /dev/null
+++ b/drivers/mmc/host/sdhci-of.h
@@ -0,0 +1,42 @@
1/*
2 * OpenFirmware bindings for Secure Digital Host Controller Interface.
3 *
4 * Copyright (c) 2007 Freescale Semiconductor, Inc.
5 * Copyright (c) 2009 MontaVista Software, Inc.
6 *
7 * Authors: Xiaobo Xie <X.Xie@freescale.com>
8 * Anton Vorontsov <avorontsov@ru.mvista.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
14 */
15
16#ifndef __SDHCI_OF_H
17#define __SDHCI_OF_H
18
19#include <linux/types.h>
20#include "sdhci.h"
21
22struct sdhci_of_data {
23 unsigned int quirks;
24 struct sdhci_ops ops;
25};
26
27struct sdhci_of_host {
28 unsigned int clock;
29 u16 xfer_mode_shadow;
30};
31
32extern u32 sdhci_be32bs_readl(struct sdhci_host *host, int reg);
33extern u16 sdhci_be32bs_readw(struct sdhci_host *host, int reg);
34extern u8 sdhci_be32bs_readb(struct sdhci_host *host, int reg);
35extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg);
36extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg);
37extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg);
38
39extern struct sdhci_of_data sdhci_esdhc;
40extern struct sdhci_of_data sdhci_hlwd;
41
42#endif /* __SDHCI_OF_H */
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index ce5f1d73dc04..842f46f94284 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -8,6 +8,8 @@
8 * the Free Software Foundation; either version 2 of the License, or (at 8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11#ifndef __SDHCI_H
12#define __SDHCI_H
11 13
12#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
13#include <linux/compiler.h> 15#include <linux/compiler.h>
@@ -408,3 +410,5 @@ extern void sdhci_remove_host(struct sdhci_host *host, int dead);
408extern int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state); 410extern int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state);
409extern int sdhci_resume_host(struct sdhci_host *host); 411extern int sdhci_resume_host(struct sdhci_host *host);
410#endif 412#endif
413
414#endif /* __SDHCI_H */
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 74fa075c838a..b13f6417b5b2 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -20,14 +20,23 @@
20 20
21#include <asm/io.h> 21#include <asm/io.h>
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <asm/cacheflush.h>
24 23
25#include <asm/mach/flash.h> 24#include <asm/mach/flash.h>
26 25
26#define CACHELINESIZE 32
27
27static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from, 28static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from,
28 ssize_t len) 29 ssize_t len)
29{ 30{
30 flush_ioremap_region(map->phys, map->cached, from, len); 31 unsigned long start = (unsigned long)map->cached + from;
32 unsigned long end = start + len;
33
34 start &= ~(CACHELINESIZE - 1);
35 while (start < end) {
36 /* invalidate D cache line */
37 asm volatile ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start));
38 start += CACHELINESIZE;
39 }
31} 40}
32 41
33struct pxa2xx_flash_info { 42struct pxa2xx_flash_info {
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 7678538344f4..677cd53f18c3 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -291,14 +291,6 @@ config MTD_NAND_SHARPSL
291 tristate "Support for NAND Flash on Sharp SL Series (C7xx + others)" 291 tristate "Support for NAND Flash on Sharp SL Series (C7xx + others)"
292 depends on ARCH_PXA 292 depends on ARCH_PXA
293 293
294config MTD_NAND_BASLER_EXCITE
295 tristate "Support for NAND Flash on Basler eXcite"
296 depends on BASLER_EXCITE
297 help
298 This enables the driver for the NAND flash device found on the
299 Basler eXcite Smart Camera. If built as a module, the driver
300 will be named excite_nandflash.
301
302config MTD_NAND_CAFE 294config MTD_NAND_CAFE
303 tristate "NAND support for OLPC CAFÉ chip" 295 tristate "NAND support for OLPC CAFÉ chip"
304 depends on PCI 296 depends on PCI
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 460a1f39a8d1..1407bd144015 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_MTD_NAND_ATMEL) += atmel_nand.o
27obj-$(CONFIG_MTD_NAND_GPIO) += gpio.o 27obj-$(CONFIG_MTD_NAND_GPIO) += gpio.o
28obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o 28obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o
29obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o 29obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o
30obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o
31obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o 30obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o
32obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o 31obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o
33obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o 32obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o
diff --git a/drivers/mtd/nand/excite_nandflash.c b/drivers/mtd/nand/excite_nandflash.c
deleted file mode 100644
index af6a6a5399e1..000000000000
--- a/drivers/mtd/nand/excite_nandflash.c
+++ /dev/null
@@ -1,248 +0,0 @@
1/*
2* Copyright (C) 2005 - 2007 by Basler Vision Technologies AG
3* Author: Thomas Koeller <thomas.koeller.qbaslerweb.com>
4* Original code by Thies Moeller <thies.moeller@baslerweb.com>
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
21#include <linux/module.h>
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/kernel.h>
25#include <linux/string.h>
26#include <linux/ioport.h>
27#include <linux/platform_device.h>
28#include <linux/delay.h>
29#include <linux/err.h>
30
31#include <linux/mtd/mtd.h>
32#include <linux/mtd/nand.h>
33#include <linux/mtd/nand_ecc.h>
34#include <linux/mtd/partitions.h>
35
36#include <asm/io.h>
37#include <asm/rm9k-ocd.h>
38
39#include <excite_nandflash.h>
40
41#define EXCITE_NANDFLASH_VERSION "0.1"
42
43/* I/O register offsets */
44#define EXCITE_NANDFLASH_DATA_BYTE 0x00
45#define EXCITE_NANDFLASH_STATUS_BYTE 0x0c
46#define EXCITE_NANDFLASH_ADDR_BYTE 0x10
47#define EXCITE_NANDFLASH_CMD_BYTE 0x14
48
49/* prefix for debug output */
50static const char module_id[] = "excite_nandflash";
51
52/*
53 * partition definition
54 */
55static const struct mtd_partition partition_info[] = {
56 {
57 .name = "eXcite RootFS",
58 .offset = 0,
59 .size = MTDPART_SIZ_FULL
60 }
61};
62
63static inline const struct resource *
64excite_nand_get_resource(struct platform_device *d, unsigned long flags,
65 const char *basename)
66{
67 char buf[80];
68
69 if (snprintf(buf, sizeof buf, "%s_%u", basename, d->id) >= sizeof buf)
70 return NULL;
71 return platform_get_resource_byname(d, flags, buf);
72}
73
74static inline void __iomem *
75excite_nand_map_regs(struct platform_device *d, const char *basename)
76{
77 void *result = NULL;
78 const struct resource *const r =
79 excite_nand_get_resource(d, IORESOURCE_MEM, basename);
80
81 if (r)
82 result = ioremap_nocache(r->start, r->end + 1 - r->start);
83 return result;
84}
85
86/* controller and mtd information */
87struct excite_nand_drvdata {
88 struct mtd_info board_mtd;
89 struct nand_chip board_chip;
90 void __iomem *regs;
91 void __iomem *tgt;
92};
93
94/* Control function */
95static void excite_nand_control(struct mtd_info *mtd, int cmd,
96 unsigned int ctrl)
97{
98 struct excite_nand_drvdata * const d =
99 container_of(mtd, struct excite_nand_drvdata, board_mtd);
100
101 switch (ctrl) {
102 case NAND_CTRL_CHANGE | NAND_CTRL_CLE:
103 d->tgt = d->regs + EXCITE_NANDFLASH_CMD_BYTE;
104 break;
105 case NAND_CTRL_CHANGE | NAND_CTRL_ALE:
106 d->tgt = d->regs + EXCITE_NANDFLASH_ADDR_BYTE;
107 break;
108 case NAND_CTRL_CHANGE | NAND_NCE:
109 d->tgt = d->regs + EXCITE_NANDFLASH_DATA_BYTE;
110 break;
111 }
112
113 if (cmd != NAND_CMD_NONE)
114 __raw_writeb(cmd, d->tgt);
115}
116
117/* Return 0 if flash is busy, 1 if ready */
118static int excite_nand_devready(struct mtd_info *mtd)
119{
120 struct excite_nand_drvdata * const drvdata =
121 container_of(mtd, struct excite_nand_drvdata, board_mtd);
122
123 return __raw_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS_BYTE);
124}
125
126/*
127 * Called by device layer to remove the driver.
128 * The binding to the mtd and all allocated
129 * resources are released.
130 */
131static int __devexit excite_nand_remove(struct platform_device *dev)
132{
133 struct excite_nand_drvdata * const this = platform_get_drvdata(dev);
134
135 platform_set_drvdata(dev, NULL);
136
137 if (unlikely(!this)) {
138 printk(KERN_ERR "%s: called %s without private data!!",
139 module_id, __func__);
140 return -EINVAL;
141 }
142
143 /* first thing we need to do is release our mtd
144 * then go through freeing the resource used
145 */
146 nand_release(&this->board_mtd);
147
148 /* free the common resources */
149 iounmap(this->regs);
150 kfree(this);
151
152 DEBUG(MTD_DEBUG_LEVEL1, "%s: removed\n", module_id);
153 return 0;
154}
155
156/*
157 * Called by device layer when it finds a device matching
158 * one our driver can handle. This code checks to see if
159 * it can allocate all necessary resources then calls the
160 * nand layer to look for devices.
161*/
162static int __init excite_nand_probe(struct platform_device *pdev)
163{
164 struct excite_nand_drvdata *drvdata; /* private driver data */
165 struct nand_chip *board_chip; /* private flash chip data */
166 struct mtd_info *board_mtd; /* mtd info for this board */
167 int scan_res;
168
169 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
170 if (unlikely(!drvdata)) {
171 printk(KERN_ERR "%s: no memory for drvdata\n",
172 module_id);
173 return -ENOMEM;
174 }
175
176 /* bind private data into driver */
177 platform_set_drvdata(pdev, drvdata);
178
179 /* allocate and map the resource */
180 drvdata->regs =
181 excite_nand_map_regs(pdev, EXCITE_NANDFLASH_RESOURCE_REGS);
182
183 if (unlikely(!drvdata->regs)) {
184 printk(KERN_ERR "%s: cannot reserve register region\n",
185 module_id);
186 kfree(drvdata);
187 return -ENXIO;
188 }
189
190 drvdata->tgt = drvdata->regs + EXCITE_NANDFLASH_DATA_BYTE;
191
192 /* initialise our chip */
193 board_chip = &drvdata->board_chip;
194 board_chip->IO_ADDR_R = board_chip->IO_ADDR_W =
195 drvdata->regs + EXCITE_NANDFLASH_DATA_BYTE;
196 board_chip->cmd_ctrl = excite_nand_control;
197 board_chip->dev_ready = excite_nand_devready;
198 board_chip->chip_delay = 25;
199 board_chip->ecc.mode = NAND_ECC_SOFT;
200
201 /* link chip to mtd */
202 board_mtd = &drvdata->board_mtd;
203 board_mtd->priv = board_chip;
204
205 DEBUG(MTD_DEBUG_LEVEL2, "%s: device scan\n", module_id);
206 scan_res = nand_scan(&drvdata->board_mtd, 1);
207
208 if (likely(!scan_res)) {
209 DEBUG(MTD_DEBUG_LEVEL2, "%s: register partitions\n", module_id);
210 add_mtd_partitions(&drvdata->board_mtd, partition_info,
211 ARRAY_SIZE(partition_info));
212 } else {
213 iounmap(drvdata->regs);
214 kfree(drvdata);
215 printk(KERN_ERR "%s: device scan failed\n", module_id);
216 return -EIO;
217 }
218 return 0;
219}
220
221static struct platform_driver excite_nand_driver = {
222 .driver = {
223 .name = "excite_nand",
224 .owner = THIS_MODULE,
225 },
226 .probe = excite_nand_probe,
227 .remove = __devexit_p(excite_nand_remove)
228};
229
230static int __init excite_nand_init(void)
231{
232 pr_info("Basler eXcite nand flash driver Version "
233 EXCITE_NANDFLASH_VERSION "\n");
234 return platform_driver_register(&excite_nand_driver);
235}
236
237static void __exit excite_nand_exit(void)
238{
239 platform_driver_unregister(&excite_nand_driver);
240}
241
242module_init(excite_nand_init);
243module_exit(excite_nand_exit);
244
245MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
246MODULE_DESCRIPTION("Basler eXcite NAND-Flash driver");
247MODULE_LICENSE("GPL");
248MODULE_VERSION(EXCITE_NANDFLASH_VERSION)
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c
index fbc231153e55..77cf0901a441 100644
--- a/drivers/net/3c507.c
+++ b/drivers/net/3c507.c
@@ -56,6 +56,7 @@ static const char version[] =
56#include <linux/errno.h> 56#include <linux/errno.h>
57#include <linux/netdevice.h> 57#include <linux/netdevice.h>
58#include <linux/etherdevice.h> 58#include <linux/etherdevice.h>
59#include <linux/if_ether.h>
59#include <linux/skbuff.h> 60#include <linux/skbuff.h>
60#include <linux/slab.h> 61#include <linux/slab.h>
61#include <linux/init.h> 62#include <linux/init.h>
@@ -734,8 +735,7 @@ static void init_82586_mem(struct net_device *dev)
734 memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); 735 memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10);
735 736
736 /* Fill in the station address. */ 737 /* Fill in the station address. */
737 memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, 738 memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, ETH_ALEN);
738 sizeof(dev->dev_addr));
739 739
740 /* The Tx-block list is written as needed. We just set up the values. */ 740 /* The Tx-block list is written as needed. We just set up the values. */
741 lp->tx_cmd_link = IDLELOOP + 4; 741 lp->tx_cmd_link = IDLELOOP + 4;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index a5be9ac6405c..dd9a09c72dff 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1953,6 +1953,8 @@ config BCM63XX_ENET
1953 1953
1954source "drivers/net/fs_enet/Kconfig" 1954source "drivers/net/fs_enet/Kconfig"
1955 1955
1956source "drivers/net/octeon/Kconfig"
1957
1956endif # NET_ETHERNET 1958endif # NET_ETHERNET
1957 1959
1958# 1960#
@@ -2344,6 +2346,7 @@ config GELIC_NET
2344 2346
2345config GELIC_WIRELESS 2347config GELIC_WIRELESS
2346 bool "PS3 Wireless support" 2348 bool "PS3 Wireless support"
2349 depends on WLAN
2347 depends on GELIC_NET 2350 depends on GELIC_NET
2348 select WIRELESS_EXT 2351 select WIRELESS_EXT
2349 help 2352 help
@@ -2356,6 +2359,7 @@ config GELIC_WIRELESS
2356config GELIC_WIRELESS_OLD_PSK_INTERFACE 2359config GELIC_WIRELESS_OLD_PSK_INTERFACE
2357 bool "PS3 Wireless private PSK interface (OBSOLETE)" 2360 bool "PS3 Wireless private PSK interface (OBSOLETE)"
2358 depends on GELIC_WIRELESS 2361 depends on GELIC_WIRELESS
2362 select WEXT_PRIV
2359 help 2363 help
2360 This option retains the obsolete private interface to pass 2364 This option retains the obsolete private interface to pass
2361 the PSK from user space programs to the driver. The PSK 2365 the PSK from user space programs to the driver. The PSK
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 246323d7f161..ad1346dd9da9 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -285,3 +285,5 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
285obj-$(CONFIG_SFC) += sfc/ 285obj-$(CONFIG_SFC) += sfc/
286 286
287obj-$(CONFIG_WIMAX) += wimax/ 287obj-$(CONFIG_WIMAX) += wimax/
288
289obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon/
diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig
index c37ee9e6b67b..39e1c0d39476 100644
--- a/drivers/net/arm/Kconfig
+++ b/drivers/net/arm/Kconfig
@@ -68,6 +68,7 @@ config W90P910_ETH
68 tristate "Nuvoton w90p910 Ethernet support" 68 tristate "Nuvoton w90p910 Ethernet support"
69 depends on ARM && ARCH_W90X900 69 depends on ARM && ARCH_W90X900
70 select PHYLIB 70 select PHYLIB
71 select MII
71 help 72 help
72 Say Y here if you want to use built-in Ethernet ports 73 Say Y here if you want to use built-in Ethernet ports
73 on w90p910 processor. 74 on w90p910 processor.
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index c5721cb38265..cc9ed8643910 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -663,7 +663,7 @@ static int lance_open( struct net_device *dev )
663 while (--i > 0) 663 while (--i > 0)
664 if (DREG & CSR0_IDON) 664 if (DREG & CSR0_IDON)
665 break; 665 break;
666 if (i < 0 || (DREG & CSR0_ERR)) { 666 if (i <= 0 || (DREG & CSR0_ERR)) {
667 DPRINTK( 2, ( "lance_open(): opening %s failed, i=%d, csr0=%04x\n", 667 DPRINTK( 2, ( "lance_open(): opening %s failed, i=%d, csr0=%04x\n",
668 dev->name, i, DREG )); 668 dev->name, i, DREG ));
669 DREG = CSR0_STOP; 669 DREG = CSR0_STOP;
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index c0451d75cdcf..ec52529394ad 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1959,12 +1959,15 @@ static int atl2_get_eeprom(struct net_device *netdev,
1959 return -ENOMEM; 1959 return -ENOMEM;
1960 1960
1961 for (i = first_dword; i < last_dword; i++) { 1961 for (i = first_dword; i < last_dword; i++) {
1962 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) 1962 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) {
1963 return -EIO; 1963 ret_val = -EIO;
1964 goto free;
1965 }
1964 } 1966 }
1965 1967
1966 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), 1968 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
1967 eeprom->len); 1969 eeprom->len);
1970free:
1968 kfree(eeprom_buff); 1971 kfree(eeprom_buff);
1969 1972
1970 return ret_val; 1973 return ret_val;
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 9e56014d27ed..9fd8e5ecd5d7 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -275,6 +275,7 @@ struct be_adapter {
275 u32 tx_fc; /* Tx flow control */ 275 u32 tx_fc; /* Tx flow control */
276 int link_speed; 276 int link_speed;
277 u8 port_type; 277 u8 port_type;
278 u8 transceiver;
278}; 279};
279 280
280extern const struct ethtool_ops be_ethtool_ops; 281extern const struct ethtool_ops be_ethtool_ops;
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 1b68bd98dc0c..102ade134165 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1479,6 +1479,41 @@ err:
1479 return status; 1479 return status;
1480} 1480}
1481 1481
1482int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
1483 u8 loopback_type, u8 enable)
1484{
1485 struct be_mcc_wrb *wrb;
1486 struct be_cmd_req_set_lmode *req;
1487 int status;
1488
1489 spin_lock_bh(&adapter->mcc_lock);
1490
1491 wrb = wrb_from_mccq(adapter);
1492 if (!wrb) {
1493 status = -EBUSY;
1494 goto err;
1495 }
1496
1497 req = embedded_payload(wrb);
1498
1499 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
1500 OPCODE_LOWLEVEL_SET_LOOPBACK_MODE);
1501
1502 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
1503 OPCODE_LOWLEVEL_SET_LOOPBACK_MODE,
1504 sizeof(*req));
1505
1506 req->src_port = port_num;
1507 req->dest_port = port_num;
1508 req->loopback_type = loopback_type;
1509 req->loopback_state = enable;
1510
1511 status = be_mcc_notify_wait(adapter);
1512err:
1513 spin_unlock_bh(&adapter->mcc_lock);
1514 return status;
1515}
1516
1482int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, 1517int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
1483 u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) 1518 u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern)
1484{ 1519{
@@ -1501,6 +1536,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
1501 1536
1502 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, 1537 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
1503 OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req)); 1538 OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req));
1539 req->hdr.timeout = 4;
1504 1540
1505 req->pattern = cpu_to_le64(pattern); 1541 req->pattern = cpu_to_le64(pattern);
1506 req->src_port = cpu_to_le32(port_num); 1542 req->src_port = cpu_to_le32(port_num);
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 92b87ef156ed..c002b8391b4d 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -155,6 +155,7 @@ struct be_mcc_mailbox {
155 155
156#define OPCODE_LOWLEVEL_HOST_DDR_DMA 17 156#define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
157#define OPCODE_LOWLEVEL_LOOPBACK_TEST 18 157#define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
158#define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
158 159
159struct be_cmd_req_hdr { 160struct be_cmd_req_hdr {
160 u8 opcode; /* dword 0 */ 161 u8 opcode; /* dword 0 */
@@ -821,6 +822,19 @@ struct be_cmd_resp_loopback_test {
821 u32 ticks_compl; 822 u32 ticks_compl;
822}; 823};
823 824
825struct be_cmd_req_set_lmode {
826 struct be_cmd_req_hdr hdr;
827 u8 src_port;
828 u8 dest_port;
829 u8 loopback_type;
830 u8 loopback_state;
831};
832
833struct be_cmd_resp_set_lmode {
834 struct be_cmd_resp_hdr resp_hdr;
835 u8 rsvd0[4];
836};
837
824/********************** DDR DMA test *********************/ 838/********************** DDR DMA test *********************/
825struct be_cmd_req_ddrdma_test { 839struct be_cmd_req_ddrdma_test {
826 struct be_cmd_req_hdr hdr; 840 struct be_cmd_req_hdr hdr;
@@ -912,3 +926,5 @@ extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
912 u32 num_pkts, u64 pattern); 926 u32 num_pkts, u64 pattern);
913extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, 927extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern,
914 u32 byte_cnt, struct be_dma_mem *cmd); 928 u32 byte_cnt, struct be_dma_mem *cmd);
929extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
930 u8 loopback_type, u8 enable);
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index 298b92cbd689..5d001c4deac1 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -118,6 +118,7 @@ static const char et_self_tests[][ETH_GSTRING_LEN] = {
118#define BE_MAC_LOOPBACK 0x0 118#define BE_MAC_LOOPBACK 0x0
119#define BE_PHY_LOOPBACK 0x1 119#define BE_PHY_LOOPBACK 0x1
120#define BE_ONE_PORT_EXT_LOOPBACK 0x2 120#define BE_ONE_PORT_EXT_LOOPBACK 0x2
121#define BE_NO_LOOPBACK 0xff
121 122
122static void 123static void
123be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) 124be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
@@ -339,28 +340,50 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
339 340
340 status = be_cmd_read_port_type(adapter, adapter->port_num, 341 status = be_cmd_read_port_type(adapter, adapter->port_num,
341 &connector); 342 &connector);
342 switch (connector) { 343 if (!status) {
343 case 7: 344 switch (connector) {
344 ecmd->port = PORT_FIBRE; 345 case 7:
345 break; 346 ecmd->port = PORT_FIBRE;
346 default: 347 ecmd->transceiver = XCVR_EXTERNAL;
347 ecmd->port = PORT_TP; 348 break;
348 break; 349 case 0:
350 ecmd->port = PORT_TP;
351 ecmd->transceiver = XCVR_EXTERNAL;
352 break;
353 default:
354 ecmd->port = PORT_TP;
355 ecmd->transceiver = XCVR_INTERNAL;
356 break;
357 }
358 } else {
359 ecmd->port = PORT_AUI;
360 ecmd->transceiver = XCVR_INTERNAL;
349 } 361 }
350 362
351 /* Save for future use */ 363 /* Save for future use */
352 adapter->link_speed = ecmd->speed; 364 adapter->link_speed = ecmd->speed;
353 adapter->port_type = ecmd->port; 365 adapter->port_type = ecmd->port;
366 adapter->transceiver = ecmd->transceiver;
354 } else { 367 } else {
355 ecmd->speed = adapter->link_speed; 368 ecmd->speed = adapter->link_speed;
356 ecmd->port = adapter->port_type; 369 ecmd->port = adapter->port_type;
370 ecmd->transceiver = adapter->transceiver;
357 } 371 }
358 372
359 ecmd->duplex = DUPLEX_FULL; 373 ecmd->duplex = DUPLEX_FULL;
360 ecmd->autoneg = AUTONEG_DISABLE; 374 ecmd->autoneg = AUTONEG_DISABLE;
361 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP);
362 ecmd->phy_address = adapter->port_num; 375 ecmd->phy_address = adapter->port_num;
363 ecmd->transceiver = XCVR_INTERNAL; 376 switch (ecmd->port) {
377 case PORT_FIBRE:
378 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
379 break;
380 case PORT_TP:
381 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP);
382 break;
383 case PORT_AUI:
384 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_AUI);
385 break;
386 }
364 387
365 return 0; 388 return 0;
366} 389}
@@ -489,6 +512,19 @@ err:
489 return ret; 512 return ret;
490} 513}
491 514
515static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
516 u64 *status)
517{
518 be_cmd_set_loopback(adapter, adapter->port_num,
519 loopback_type, 1);
520 *status = be_cmd_loopback_test(adapter, adapter->port_num,
521 loopback_type, 1500,
522 2, 0xabc);
523 be_cmd_set_loopback(adapter, adapter->port_num,
524 BE_NO_LOOPBACK, 1);
525 return *status;
526}
527
492static void 528static void
493be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) 529be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
494{ 530{
@@ -497,23 +533,18 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
497 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); 533 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
498 534
499 if (test->flags & ETH_TEST_FL_OFFLINE) { 535 if (test->flags & ETH_TEST_FL_OFFLINE) {
500 data[0] = be_cmd_loopback_test(adapter, adapter->port_num, 536 if (be_loopback_test(adapter, BE_MAC_LOOPBACK,
501 BE_MAC_LOOPBACK, 1500, 537 &data[0]) != 0) {
502 2, 0xabc);
503 if (data[0] != 0)
504 test->flags |= ETH_TEST_FL_FAILED; 538 test->flags |= ETH_TEST_FL_FAILED;
505 539 }
506 data[1] = be_cmd_loopback_test(adapter, adapter->port_num, 540 if (be_loopback_test(adapter, BE_PHY_LOOPBACK,
507 BE_PHY_LOOPBACK, 1500, 541 &data[1]) != 0) {
508 2, 0xabc);
509 if (data[1] != 0)
510 test->flags |= ETH_TEST_FL_FAILED; 542 test->flags |= ETH_TEST_FL_FAILED;
511 543 }
512 data[2] = be_cmd_loopback_test(adapter, adapter->port_num, 544 if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
513 BE_ONE_PORT_EXT_LOOPBACK, 545 &data[2]) != 0) {
514 1500, 2, 0xabc);
515 if (data[2] != 0)
516 test->flags |= ETH_TEST_FL_FAILED; 546 test->flags |= ETH_TEST_FL_FAILED;
547 }
517 548
518 data[3] = be_test_ddr_dma(adapter); 549 data[3] = be_test_ddr_dma(adapter);
519 if (data[3] != 0) 550 if (data[3] != 0)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 4bfc80812926..65df1de447e4 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -653,12 +653,20 @@ static void
653bnx2_netif_stop(struct bnx2 *bp) 653bnx2_netif_stop(struct bnx2 *bp)
654{ 654{
655 bnx2_cnic_stop(bp); 655 bnx2_cnic_stop(bp);
656 bnx2_disable_int_sync(bp);
657 if (netif_running(bp->dev)) { 656 if (netif_running(bp->dev)) {
657 int i;
658
658 bnx2_napi_disable(bp); 659 bnx2_napi_disable(bp);
659 netif_tx_disable(bp->dev); 660 netif_tx_disable(bp->dev);
660 bp->dev->trans_start = jiffies; /* prevent tx timeout */ 661 /* prevent tx timeout */
662 for (i = 0; i < bp->dev->num_tx_queues; i++) {
663 struct netdev_queue *txq;
664
665 txq = netdev_get_tx_queue(bp->dev, i);
666 txq->trans_start = jiffies;
667 }
661 } 668 }
669 bnx2_disable_int_sync(bp);
662} 670}
663 671
664static void 672static void
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 77ba13520d87..306c2b8165e2 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -7593,6 +7593,8 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
7593 if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD) { 7593 if (bp->cnic_eth_dev.drv_state & CNIC_DRV_STATE_REGD) {
7594 bnx2x_set_iscsi_eth_mac_addr(bp, 1); 7594 bnx2x_set_iscsi_eth_mac_addr(bp, 1);
7595 bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET; 7595 bp->cnic_flags |= BNX2X_CNIC_FLAG_MAC_SET;
7596 bnx2x_init_sb(bp, bp->cnic_sb, bp->cnic_sb_mapping,
7597 CNIC_SB_ID(bp));
7596 } 7598 }
7597 mutex_unlock(&bp->cnic_mutex); 7599 mutex_unlock(&bp->cnic_mutex);
7598#endif 7600#endif
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 0fb7a4964e75..822f586d72af 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1580,7 +1580,7 @@ static void ad_agg_selection_logic(struct aggregator *agg)
1580 // check if any partner replys 1580 // check if any partner replys
1581 if (best->is_individual) { 1581 if (best->is_individual) {
1582 pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n", 1582 pr_warning("%s: Warning: No 802.3ad response from the link partner for any adapters in the bond\n",
1583 best->slave->dev->master->name); 1583 best->slave ? best->slave->dev->master->name : "NULL");
1584 } 1584 }
1585 1585
1586 best->is_active = 1; 1586 best->is_active = 1;
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index d0ec17878ffc..166cc7e579c0 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1037,7 +1037,7 @@ static int __init at91_can_probe(struct platform_device *pdev)
1037 1037
1038 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1038 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1039 irq = platform_get_irq(pdev, 0); 1039 irq = platform_get_irq(pdev, 0);
1040 if (!res || !irq) { 1040 if (!res || irq <= 0) {
1041 err = -ENODEV; 1041 err = -ENODEV;
1042 goto exit_put; 1042 goto exit_put;
1043 } 1043 }
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 9c5a1537939c..1a72ca066a17 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -990,7 +990,7 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
990 goto error_tx_buf; 990 goto error_tx_buf;
991 } 991 }
992 priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL); 992 priv->spi_rx_buf = kmalloc(SPI_TRANSFER_BUF_LEN, GFP_KERNEL);
993 if (!priv->spi_tx_buf) { 993 if (!priv->spi_rx_buf) {
994 ret = -ENOMEM; 994 ret = -ENOMEM;
995 goto error_rx_buf; 995 goto error_rx_buf;
996 } 996 }
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index af9321617ce4..0e79cef95c0a 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1325,8 +1325,7 @@ net_open(struct net_device *dev)
1325 write_irq(dev, lp->chip_type, dev->irq); 1325 write_irq(dev, lp->chip_type, dev->irq);
1326 ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev); 1326 ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev);
1327 if (ret) { 1327 if (ret) {
1328 if (net_debug) 1328 printk(KERN_ERR "cs89x0: request_irq(%d) failed\n", dev->irq);
1329 printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
1330 goto bad_out; 1329 goto bad_out;
1331 } 1330 }
1332 } 1331 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 8edac8915ea8..33c4fe26178c 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2272,7 +2272,7 @@ static int emac_mii_reset(struct mii_bus *bus)
2272 unsigned int clk_div; 2272 unsigned int clk_div;
2273 int mdio_bus_freq = emac_bus_frequency; 2273 int mdio_bus_freq = emac_bus_frequency;
2274 2274
2275 if (mdio_max_freq & mdio_bus_freq) 2275 if (mdio_max_freq && mdio_bus_freq)
2276 clk_div = ((mdio_bus_freq / mdio_max_freq) - 1); 2276 clk_div = ((mdio_bus_freq / mdio_max_freq) - 1);
2277 else 2277 else
2278 clk_div = 0xFF; 2278 clk_div = 0xFF;
@@ -2711,6 +2711,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
2711 SET_ETHTOOL_OPS(ndev, &ethtool_ops); 2711 SET_ETHTOOL_OPS(ndev, &ethtool_ops);
2712 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); 2712 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
2713 2713
2714 clk_enable(emac_clk);
2715
2714 /* register the network device */ 2716 /* register the network device */
2715 SET_NETDEV_DEV(ndev, &pdev->dev); 2717 SET_NETDEV_DEV(ndev, &pdev->dev);
2716 rc = register_netdev(ndev); 2718 rc = register_netdev(ndev);
@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
2720 goto netdev_reg_err; 2722 goto netdev_reg_err;
2721 } 2723 }
2722 2724
2723 clk_enable(emac_clk);
2724 2725
2725 /* MII/Phy intialisation, mdio bus registration */ 2726 /* MII/Phy intialisation, mdio bus registration */
2726 emac_mii = mdiobus_alloc(); 2727 emac_mii = mdiobus_alloc();
@@ -2760,6 +2761,7 @@ mdiobus_quit:
2760 2761
2761netdev_reg_err: 2762netdev_reg_err:
2762mdio_alloc_err: 2763mdio_alloc_err:
2764 clk_disable(emac_clk);
2763no_irq_res: 2765no_irq_res:
2764 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2766 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2765 release_mem_region(res->start, res->end - res->start + 1); 2767 release_mem_region(res->start, res->end - res->start + 1);
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 929701ca07d3..839fb2b136d3 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1829,6 +1829,7 @@ static int e100_alloc_cbs(struct nic *nic)
1829 &nic->cbs_dma_addr); 1829 &nic->cbs_dma_addr);
1830 if (!nic->cbs) 1830 if (!nic->cbs)
1831 return -ENOMEM; 1831 return -ENOMEM;
1832 memset(nic->cbs, 0, count * sizeof(struct cb));
1832 1833
1833 for (cb = nic->cbs, i = 0; i < count; cb++, i++) { 1834 for (cb = nic->cbs, i = 0; i < count; cb++, i++) {
1834 cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; 1835 cb->next = (i + 1 < count) ? cb + 1 : nic->cbs;
@@ -1837,7 +1838,6 @@ static int e100_alloc_cbs(struct nic *nic)
1837 cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb); 1838 cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb);
1838 cb->link = cpu_to_le32(nic->cbs_dma_addr + 1839 cb->link = cpu_to_le32(nic->cbs_dma_addr +
1839 ((i+1) % count) * sizeof(struct cb)); 1840 ((i+1) % count) * sizeof(struct cb));
1840 cb->skb = NULL;
1841 } 1841 }
1842 1842
1843 nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; 1843 nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs;
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index c1a42cfc80ba..02d67d047d96 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -237,6 +237,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
237 /* Set if manageability features are enabled. */ 237 /* Set if manageability features are enabled. */
238 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) 238 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
239 ? true : false; 239 ? true : false;
240 /* Adaptive IFS supported */
241 mac->adaptive_ifs = true;
240 242
241 /* check for link */ 243 /* check for link */
242 switch (hw->phy.media_type) { 244 switch (hw->phy.media_type) {
@@ -1290,7 +1292,6 @@ static s32 e1000_setup_link_82571(struct e1000_hw *hw)
1290static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) 1292static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
1291{ 1293{
1292 u32 ctrl; 1294 u32 ctrl;
1293 u32 led_ctrl;
1294 s32 ret_val; 1295 s32 ret_val;
1295 1296
1296 ctrl = er32(CTRL); 1297 ctrl = er32(CTRL);
@@ -1305,11 +1306,6 @@ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
1305 break; 1306 break;
1306 case e1000_phy_igp_2: 1307 case e1000_phy_igp_2:
1307 ret_val = e1000e_copper_link_setup_igp(hw); 1308 ret_val = e1000e_copper_link_setup_igp(hw);
1308 /* Setup activity LED */
1309 led_ctrl = er32(LEDCTL);
1310 led_ctrl &= IGP_ACTIVITY_LED_MASK;
1311 led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE);
1312 ew32(LEDCTL, led_ctrl);
1313 break; 1309 break;
1314 default: 1310 default:
1315 return -E1000_ERR_PHY; 1311 return -E1000_ERR_PHY;
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 3028f23da891..e2aa3b788564 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -224,6 +224,8 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
224 /* Set if manageability features are enabled. */ 224 /* Set if manageability features are enabled. */
225 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK) 225 mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
226 ? true : false; 226 ? true : false;
227 /* Adaptive IFS not supported */
228 mac->adaptive_ifs = false;
227 229
228 /* check for link */ 230 /* check for link */
229 switch (hw->phy.media_type) { 231 switch (hw->phy.media_type) {
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 2784cf44a6f3..eccf29b75c41 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -818,6 +818,7 @@ struct e1000_mac_info {
818 818
819 u8 forced_speed_duplex; 819 u8 forced_speed_duplex;
820 820
821 bool adaptive_ifs;
821 bool arc_subsystem_valid; 822 bool arc_subsystem_valid;
822 bool autoneg; 823 bool autoneg;
823 bool autoneg_failed; 824 bool autoneg_failed;
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 9b09246af064..ad08cf3f40c0 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -454,6 +454,8 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter)
454 mac->rar_entry_count--; 454 mac->rar_entry_count--;
455 /* Set if manageability features are enabled. */ 455 /* Set if manageability features are enabled. */
456 mac->arc_subsystem_valid = true; 456 mac->arc_subsystem_valid = true;
457 /* Adaptive IFS supported */
458 mac->adaptive_ifs = true;
457 459
458 /* LED operations */ 460 /* LED operations */
459 switch (mac->type) { 461 switch (mac->type) {
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index a86c17548c1e..2fa9b36a2c5a 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -125,6 +125,7 @@ void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value)
125void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count) 125void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
126{ 126{
127 u32 i; 127 u32 i;
128 u8 mac_addr[ETH_ALEN] = {0};
128 129
129 /* Setup the receive address */ 130 /* Setup the receive address */
130 e_dbg("Programming MAC Address into RAR[0]\n"); 131 e_dbg("Programming MAC Address into RAR[0]\n");
@@ -133,12 +134,8 @@ void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
133 134
134 /* Zero out the other (rar_entry_count - 1) receive addresses */ 135 /* Zero out the other (rar_entry_count - 1) receive addresses */
135 e_dbg("Clearing RAR[1-%u]\n", rar_count-1); 136 e_dbg("Clearing RAR[1-%u]\n", rar_count-1);
136 for (i = 1; i < rar_count; i++) { 137 for (i = 1; i < rar_count; i++)
137 E1000_WRITE_REG_ARRAY(hw, E1000_RA, (i << 1), 0); 138 e1000e_rar_set(hw, mac_addr, i);
138 e1e_flush();
139 E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((i << 1) + 1), 0);
140 e1e_flush();
141 }
142} 139}
143 140
144/** 141/**
@@ -164,10 +161,19 @@ void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
164 161
165 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8)); 162 rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
166 163
167 rar_high |= E1000_RAH_AV; 164 /* If MAC address zero, no need to set the AV bit */
165 if (rar_low || rar_high)
166 rar_high |= E1000_RAH_AV;
168 167
169 E1000_WRITE_REG_ARRAY(hw, E1000_RA, (index << 1), rar_low); 168 /*
170 E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((index << 1) + 1), rar_high); 169 * Some bridges will combine consecutive 32-bit writes into
170 * a single burst write, which will malfunction on some parts.
171 * The flushes avoid this.
172 */
173 ew32(RAL(index), rar_low);
174 e1e_flush();
175 ew32(RAH(index), rar_high);
176 e1e_flush();
171} 177}
172 178
173/** 179/**
@@ -1609,6 +1615,11 @@ void e1000e_reset_adaptive(struct e1000_hw *hw)
1609{ 1615{
1610 struct e1000_mac_info *mac = &hw->mac; 1616 struct e1000_mac_info *mac = &hw->mac;
1611 1617
1618 if (!mac->adaptive_ifs) {
1619 e_dbg("Not in Adaptive IFS mode!\n");
1620 goto out;
1621 }
1622
1612 mac->current_ifs_val = 0; 1623 mac->current_ifs_val = 0;
1613 mac->ifs_min_val = IFS_MIN; 1624 mac->ifs_min_val = IFS_MIN;
1614 mac->ifs_max_val = IFS_MAX; 1625 mac->ifs_max_val = IFS_MAX;
@@ -1617,6 +1628,8 @@ void e1000e_reset_adaptive(struct e1000_hw *hw)
1617 1628
1618 mac->in_ifs_mode = false; 1629 mac->in_ifs_mode = false;
1619 ew32(AIT, 0); 1630 ew32(AIT, 0);
1631out:
1632 return;
1620} 1633}
1621 1634
1622/** 1635/**
@@ -1630,6 +1643,11 @@ void e1000e_update_adaptive(struct e1000_hw *hw)
1630{ 1643{
1631 struct e1000_mac_info *mac = &hw->mac; 1644 struct e1000_mac_info *mac = &hw->mac;
1632 1645
1646 if (!mac->adaptive_ifs) {
1647 e_dbg("Not in Adaptive IFS mode!\n");
1648 goto out;
1649 }
1650
1633 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { 1651 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) {
1634 if (mac->tx_packet_delta > MIN_NUM_XMITS) { 1652 if (mac->tx_packet_delta > MIN_NUM_XMITS) {
1635 mac->in_ifs_mode = true; 1653 mac->in_ifs_mode = true;
@@ -1650,6 +1668,8 @@ void e1000e_update_adaptive(struct e1000_hw *hw)
1650 ew32(AIT, 0); 1668 ew32(AIT, 0);
1651 } 1669 }
1652 } 1670 }
1671out:
1672 return;
1653} 1673}
1654 1674
1655/** 1675/**
@@ -2287,10 +2307,12 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
2287 s32 ret_val, hdr_csum, csum; 2307 s32 ret_val, hdr_csum, csum;
2288 u8 i, len; 2308 u8 i, len;
2289 2309
2310 hw->mac.tx_pkt_filtering = true;
2311
2290 /* No manageability, no filtering */ 2312 /* No manageability, no filtering */
2291 if (!e1000e_check_mng_mode(hw)) { 2313 if (!e1000e_check_mng_mode(hw)) {
2292 hw->mac.tx_pkt_filtering = false; 2314 hw->mac.tx_pkt_filtering = false;
2293 return 0; 2315 goto out;
2294 } 2316 }
2295 2317
2296 /* 2318 /*
@@ -2298,9 +2320,9 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
2298 * reason, disable filtering. 2320 * reason, disable filtering.
2299 */ 2321 */
2300 ret_val = e1000_mng_enable_host_if(hw); 2322 ret_val = e1000_mng_enable_host_if(hw);
2301 if (ret_val != 0) { 2323 if (ret_val) {
2302 hw->mac.tx_pkt_filtering = false; 2324 hw->mac.tx_pkt_filtering = false;
2303 return ret_val; 2325 goto out;
2304 } 2326 }
2305 2327
2306 /* Read in the header. Length and offset are in dwords. */ 2328 /* Read in the header. Length and offset are in dwords. */
@@ -2319,17 +2341,17 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
2319 */ 2341 */
2320 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { 2342 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) {
2321 hw->mac.tx_pkt_filtering = true; 2343 hw->mac.tx_pkt_filtering = true;
2322 return 1; 2344 goto out;
2323 } 2345 }
2324 2346
2325 /* Cookie area is valid, make the final check for filtering. */ 2347 /* Cookie area is valid, make the final check for filtering. */
2326 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) { 2348 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) {
2327 hw->mac.tx_pkt_filtering = false; 2349 hw->mac.tx_pkt_filtering = false;
2328 return 0; 2350 goto out;
2329 } 2351 }
2330 2352
2331 hw->mac.tx_pkt_filtering = true; 2353out:
2332 return 1; 2354 return hw->mac.tx_pkt_filtering;
2333} 2355}
2334 2356
2335/** 2357/**
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 762b697ce731..c45965a256b6 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -3315,24 +3315,24 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3315 if ((hw->phy.type == e1000_phy_82578) || 3315 if ((hw->phy.type == e1000_phy_82578) ||
3316 (hw->phy.type == e1000_phy_82577)) { 3316 (hw->phy.type == e1000_phy_82577)) {
3317 e1e_rphy(hw, HV_SCC_UPPER, &phy_data); 3317 e1e_rphy(hw, HV_SCC_UPPER, &phy_data);
3318 e1e_rphy(hw, HV_SCC_LOWER, &phy_data); 3318 if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data))
3319 adapter->stats.scc += phy_data; 3319 adapter->stats.scc += phy_data;
3320 3320
3321 e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); 3321 e1e_rphy(hw, HV_ECOL_UPPER, &phy_data);
3322 e1e_rphy(hw, HV_ECOL_LOWER, &phy_data); 3322 if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data))
3323 adapter->stats.ecol += phy_data; 3323 adapter->stats.ecol += phy_data;
3324 3324
3325 e1e_rphy(hw, HV_MCC_UPPER, &phy_data); 3325 e1e_rphy(hw, HV_MCC_UPPER, &phy_data);
3326 e1e_rphy(hw, HV_MCC_LOWER, &phy_data); 3326 if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data))
3327 adapter->stats.mcc += phy_data; 3327 adapter->stats.mcc += phy_data;
3328 3328
3329 e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); 3329 e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data);
3330 e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data); 3330 if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data))
3331 adapter->stats.latecol += phy_data; 3331 adapter->stats.latecol += phy_data;
3332 3332
3333 e1e_rphy(hw, HV_DC_UPPER, &phy_data); 3333 e1e_rphy(hw, HV_DC_UPPER, &phy_data);
3334 e1e_rphy(hw, HV_DC_LOWER, &phy_data); 3334 if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data))
3335 adapter->stats.dc += phy_data; 3335 adapter->stats.dc += phy_data;
3336 } else { 3336 } else {
3337 adapter->stats.scc += er32(SCC); 3337 adapter->stats.scc += er32(SCC);
3338 adapter->stats.ecol += er32(ECOL); 3338 adapter->stats.ecol += er32(ECOL);
@@ -3360,8 +3360,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3360 if ((hw->phy.type == e1000_phy_82578) || 3360 if ((hw->phy.type == e1000_phy_82578) ||
3361 (hw->phy.type == e1000_phy_82577)) { 3361 (hw->phy.type == e1000_phy_82577)) {
3362 e1e_rphy(hw, HV_COLC_UPPER, &phy_data); 3362 e1e_rphy(hw, HV_COLC_UPPER, &phy_data);
3363 e1e_rphy(hw, HV_COLC_LOWER, &phy_data); 3363 if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data))
3364 hw->mac.collision_delta = phy_data; 3364 hw->mac.collision_delta = phy_data;
3365 } else { 3365 } else {
3366 hw->mac.collision_delta = er32(COLC); 3366 hw->mac.collision_delta = er32(COLC);
3367 } 3367 }
@@ -3372,8 +3372,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3372 if ((hw->phy.type == e1000_phy_82578) || 3372 if ((hw->phy.type == e1000_phy_82578) ||
3373 (hw->phy.type == e1000_phy_82577)) { 3373 (hw->phy.type == e1000_phy_82577)) {
3374 e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); 3374 e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data);
3375 e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data); 3375 if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data))
3376 adapter->stats.tncrs += phy_data; 3376 adapter->stats.tncrs += phy_data;
3377 } else { 3377 } else {
3378 if ((hw->mac.type != e1000_82574) && 3378 if ((hw->mac.type != e1000_82574) &&
3379 (hw->mac.type != e1000_82583)) 3379 (hw->mac.type != e1000_82583))
@@ -4674,6 +4674,7 @@ static int e1000_resume(struct pci_dev *pdev)
4674 4674
4675 pci_set_power_state(pdev, PCI_D0); 4675 pci_set_power_state(pdev, PCI_D0);
4676 pci_restore_state(pdev); 4676 pci_restore_state(pdev);
4677 pci_save_state(pdev);
4677 e1000e_disable_l1aspm(pdev); 4678 e1000e_disable_l1aspm(pdev);
4678 4679
4679 err = pci_enable_device_mem(pdev); 4680 err = pci_enable_device_mem(pdev);
@@ -4825,6 +4826,7 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
4825 } else { 4826 } else {
4826 pci_set_master(pdev); 4827 pci_set_master(pdev);
4827 pci_restore_state(pdev); 4828 pci_restore_state(pdev);
4829 pci_save_state(pdev);
4828 4830
4829 pci_enable_wake(pdev, PCI_D3hot, 0); 4831 pci_enable_wake(pdev, PCI_D3hot, 0);
4830 pci_enable_wake(pdev, PCI_D3cold, 0); 4832 pci_enable_wake(pdev, PCI_D3cold, 0);
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index 25fabb3eedc5..d5160edf2fcf 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -46,6 +46,11 @@
46#include "gianfar.h" 46#include "gianfar.h"
47#include "fsl_pq_mdio.h" 47#include "fsl_pq_mdio.h"
48 48
49struct fsl_pq_mdio_priv {
50 void __iomem *map;
51 struct fsl_pq_mdio __iomem *regs;
52};
53
49/* 54/*
50 * Write value to the PHY at mii_id at register regnum, 55 * Write value to the PHY at mii_id at register regnum,
51 * on the bus attached to the local interface, which may be different from the 56 * on the bus attached to the local interface, which may be different from the
@@ -105,7 +110,9 @@ int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,
105 110
106static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus) 111static struct fsl_pq_mdio __iomem *fsl_pq_mdio_get_regs(struct mii_bus *bus)
107{ 112{
108 return (void __iomem __force *)bus->priv; 113 struct fsl_pq_mdio_priv *priv = bus->priv;
114
115 return priv->regs;
109} 116}
110 117
111/* 118/*
@@ -266,6 +273,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
266{ 273{
267 struct device_node *np = ofdev->node; 274 struct device_node *np = ofdev->node;
268 struct device_node *tbi; 275 struct device_node *tbi;
276 struct fsl_pq_mdio_priv *priv;
269 struct fsl_pq_mdio __iomem *regs = NULL; 277 struct fsl_pq_mdio __iomem *regs = NULL;
270 void __iomem *map; 278 void __iomem *map;
271 u32 __iomem *tbipa; 279 u32 __iomem *tbipa;
@@ -274,14 +282,19 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
274 u64 addr = 0, size = 0; 282 u64 addr = 0, size = 0;
275 int err = 0; 283 int err = 0;
276 284
285 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
286 if (!priv)
287 return -ENOMEM;
288
277 new_bus = mdiobus_alloc(); 289 new_bus = mdiobus_alloc();
278 if (NULL == new_bus) 290 if (NULL == new_bus)
279 return -ENOMEM; 291 goto err_free_priv;
280 292
281 new_bus->name = "Freescale PowerQUICC MII Bus", 293 new_bus->name = "Freescale PowerQUICC MII Bus",
282 new_bus->read = &fsl_pq_mdio_read, 294 new_bus->read = &fsl_pq_mdio_read,
283 new_bus->write = &fsl_pq_mdio_write, 295 new_bus->write = &fsl_pq_mdio_write,
284 new_bus->reset = &fsl_pq_mdio_reset, 296 new_bus->reset = &fsl_pq_mdio_reset,
297 new_bus->priv = priv;
285 fsl_pq_mdio_bus_name(new_bus->id, np); 298 fsl_pq_mdio_bus_name(new_bus->id, np);
286 299
287 /* Set the PHY base address */ 300 /* Set the PHY base address */
@@ -291,6 +304,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
291 err = -ENOMEM; 304 err = -ENOMEM;
292 goto err_free_bus; 305 goto err_free_bus;
293 } 306 }
307 priv->map = map;
294 308
295 if (of_device_is_compatible(np, "fsl,gianfar-mdio") || 309 if (of_device_is_compatible(np, "fsl,gianfar-mdio") ||
296 of_device_is_compatible(np, "fsl,gianfar-tbi") || 310 of_device_is_compatible(np, "fsl,gianfar-tbi") ||
@@ -298,8 +312,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
298 of_device_is_compatible(np, "ucc_geth_phy")) 312 of_device_is_compatible(np, "ucc_geth_phy"))
299 map -= offsetof(struct fsl_pq_mdio, miimcfg); 313 map -= offsetof(struct fsl_pq_mdio, miimcfg);
300 regs = map; 314 regs = map;
301 315 priv->regs = regs;
302 new_bus->priv = (void __force *)regs;
303 316
304 new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); 317 new_bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
305 318
@@ -392,10 +405,11 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev,
392err_free_irqs: 405err_free_irqs:
393 kfree(new_bus->irq); 406 kfree(new_bus->irq);
394err_unmap_regs: 407err_unmap_regs:
395 iounmap(regs); 408 iounmap(priv->map);
396err_free_bus: 409err_free_bus:
397 kfree(new_bus); 410 kfree(new_bus);
398 411err_free_priv:
412 kfree(priv);
399 return err; 413 return err;
400} 414}
401 415
@@ -404,14 +418,16 @@ static int fsl_pq_mdio_remove(struct of_device *ofdev)
404{ 418{
405 struct device *device = &ofdev->dev; 419 struct device *device = &ofdev->dev;
406 struct mii_bus *bus = dev_get_drvdata(device); 420 struct mii_bus *bus = dev_get_drvdata(device);
421 struct fsl_pq_mdio_priv *priv = bus->priv;
407 422
408 mdiobus_unregister(bus); 423 mdiobus_unregister(bus);
409 424
410 dev_set_drvdata(device, NULL); 425 dev_set_drvdata(device, NULL);
411 426
412 iounmap(fsl_pq_mdio_get_regs(bus)); 427 iounmap(priv->map);
413 bus->priv = NULL; 428 bus->priv = NULL;
414 mdiobus_free(bus); 429 mdiobus_free(bus);
430 kfree(priv);
415 431
416 return 0; 432 return 0;
417} 433}
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6850dc0a7b91..8bd3c9f17532 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -143,7 +143,6 @@ void gfar_start(struct net_device *dev);
143static void gfar_clear_exact_match(struct net_device *dev); 143static void gfar_clear_exact_match(struct net_device *dev);
144static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); 144static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr);
145static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 145static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
146u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb);
147 146
148MODULE_AUTHOR("Freescale Semiconductor, Inc"); 147MODULE_AUTHOR("Freescale Semiconductor, Inc");
149MODULE_DESCRIPTION("Gianfar Ethernet Driver"); 148MODULE_DESCRIPTION("Gianfar Ethernet Driver");
@@ -357,8 +356,11 @@ static void gfar_init_mac(struct net_device *ndev)
357 /* Configure the coalescing support */ 356 /* Configure the coalescing support */
358 gfar_configure_coalescing(priv, 0xFF, 0xFF); 357 gfar_configure_coalescing(priv, 0xFF, 0xFF);
359 358
360 if (priv->rx_filer_enable) 359 if (priv->rx_filer_enable) {
361 rctrl |= RCTRL_FILREN; 360 rctrl |= RCTRL_FILREN;
361 /* Program the RIR0 reg with the required distribution */
362 gfar_write(&regs->rir0, DEFAULT_RIR0);
363 }
362 364
363 if (priv->rx_csum_enable) 365 if (priv->rx_csum_enable)
364 rctrl |= RCTRL_CHECKSUMMING; 366 rctrl |= RCTRL_CHECKSUMMING;
@@ -414,6 +416,36 @@ static void gfar_init_mac(struct net_device *ndev)
414 gfar_write(&regs->fifo_tx_starve_shutoff, priv->fifo_starve_off); 416 gfar_write(&regs->fifo_tx_starve_shutoff, priv->fifo_starve_off);
415} 417}
416 418
419static struct net_device_stats *gfar_get_stats(struct net_device *dev)
420{
421 struct gfar_private *priv = netdev_priv(dev);
422 struct netdev_queue *txq;
423 unsigned long rx_packets = 0, rx_bytes = 0, rx_dropped = 0;
424 unsigned long tx_packets = 0, tx_bytes = 0;
425 int i = 0;
426
427 for (i = 0; i < priv->num_rx_queues; i++) {
428 rx_packets += priv->rx_queue[i]->stats.rx_packets;
429 rx_bytes += priv->rx_queue[i]->stats.rx_bytes;
430 rx_dropped += priv->rx_queue[i]->stats.rx_dropped;
431 }
432
433 dev->stats.rx_packets = rx_packets;
434 dev->stats.rx_bytes = rx_bytes;
435 dev->stats.rx_dropped = rx_dropped;
436
437 for (i = 0; i < priv->num_tx_queues; i++) {
438 txq = netdev_get_tx_queue(dev, i);
439 tx_bytes += txq->tx_bytes;
440 tx_packets += txq->tx_packets;
441 }
442
443 dev->stats.tx_bytes = tx_bytes;
444 dev->stats.tx_packets = tx_packets;
445
446 return &dev->stats;
447}
448
417static const struct net_device_ops gfar_netdev_ops = { 449static const struct net_device_ops gfar_netdev_ops = {
418 .ndo_open = gfar_enet_open, 450 .ndo_open = gfar_enet_open,
419 .ndo_start_xmit = gfar_start_xmit, 451 .ndo_start_xmit = gfar_start_xmit,
@@ -422,7 +454,7 @@ static const struct net_device_ops gfar_netdev_ops = {
422 .ndo_set_multicast_list = gfar_set_multi, 454 .ndo_set_multicast_list = gfar_set_multi,
423 .ndo_tx_timeout = gfar_timeout, 455 .ndo_tx_timeout = gfar_timeout,
424 .ndo_do_ioctl = gfar_ioctl, 456 .ndo_do_ioctl = gfar_ioctl,
425 .ndo_select_queue = gfar_select_queue, 457 .ndo_get_stats = gfar_get_stats,
426 .ndo_vlan_rx_register = gfar_vlan_rx_register, 458 .ndo_vlan_rx_register = gfar_vlan_rx_register,
427 .ndo_set_mac_address = eth_mac_addr, 459 .ndo_set_mac_address = eth_mac_addr,
428 .ndo_validate_addr = eth_validate_addr, 460 .ndo_validate_addr = eth_validate_addr,
@@ -472,10 +504,6 @@ static inline int gfar_uses_fcb(struct gfar_private *priv)
472 return priv->vlgrp || priv->rx_csum_enable; 504 return priv->vlgrp || priv->rx_csum_enable;
473} 505}
474 506
475u16 gfar_select_queue(struct net_device *dev, struct sk_buff *skb)
476{
477 return skb_get_queue_mapping(skb);
478}
479static void free_tx_pointers(struct gfar_private *priv) 507static void free_tx_pointers(struct gfar_private *priv)
480{ 508{
481 int i = 0; 509 int i = 0;
@@ -1022,6 +1050,9 @@ static int gfar_probe(struct of_device *ofdev,
1022 priv->rx_queue[i]->rxic = DEFAULT_RXIC; 1050 priv->rx_queue[i]->rxic = DEFAULT_RXIC;
1023 } 1051 }
1024 1052
1053 /* enable filer if using multiple RX queues*/
1054 if(priv->num_rx_queues > 1)
1055 priv->rx_filer_enable = 1;
1025 /* Enable most messages by default */ 1056 /* Enable most messages by default */
1026 priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; 1057 priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
1027 1058
@@ -1937,7 +1968,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
1937 } 1968 }
1938 1969
1939 /* Update transmit stats */ 1970 /* Update transmit stats */
1940 dev->stats.tx_bytes += skb->len; 1971 txq->tx_bytes += skb->len;
1972 txq->tx_packets ++;
1941 1973
1942 txbdp = txbdp_start = tx_queue->cur_tx; 1974 txbdp = txbdp_start = tx_queue->cur_tx;
1943 1975
@@ -2295,8 +2327,6 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
2295 tx_queue->skb_dirtytx = skb_dirtytx; 2327 tx_queue->skb_dirtytx = skb_dirtytx;
2296 tx_queue->dirty_tx = bdp; 2328 tx_queue->dirty_tx = bdp;
2297 2329
2298 dev->stats.tx_packets += howmany;
2299
2300 return howmany; 2330 return howmany;
2301} 2331}
2302 2332
@@ -2434,10 +2464,11 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
2434 fcb = (struct rxfcb *)skb->data; 2464 fcb = (struct rxfcb *)skb->data;
2435 2465
2436 /* Remove the FCB from the skb */ 2466 /* Remove the FCB from the skb */
2437 skb_set_queue_mapping(skb, fcb->rq);
2438 /* Remove the padded bytes, if there are any */ 2467 /* Remove the padded bytes, if there are any */
2439 if (amount_pull) 2468 if (amount_pull) {
2469 skb_record_rx_queue(skb, fcb->rq);
2440 skb_pull(skb, amount_pull); 2470 skb_pull(skb, amount_pull);
2471 }
2441 2472
2442 if (priv->rx_csum_enable) 2473 if (priv->rx_csum_enable)
2443 gfar_rx_checksum(skb, fcb); 2474 gfar_rx_checksum(skb, fcb);
@@ -2510,22 +2541,22 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
2510 } 2541 }
2511 } else { 2542 } else {
2512 /* Increment the number of packets */ 2543 /* Increment the number of packets */
2513 dev->stats.rx_packets++; 2544 rx_queue->stats.rx_packets++;
2514 howmany++; 2545 howmany++;
2515 2546
2516 if (likely(skb)) { 2547 if (likely(skb)) {
2517 pkt_len = bdp->length - ETH_FCS_LEN; 2548 pkt_len = bdp->length - ETH_FCS_LEN;
2518 /* Remove the FCS from the packet length */ 2549 /* Remove the FCS from the packet length */
2519 skb_put(skb, pkt_len); 2550 skb_put(skb, pkt_len);
2520 dev->stats.rx_bytes += pkt_len; 2551 rx_queue->stats.rx_bytes += pkt_len;
2521 2552 skb_record_rx_queue(skb, rx_queue->qindex);
2522 gfar_process_frame(dev, skb, amount_pull); 2553 gfar_process_frame(dev, skb, amount_pull);
2523 2554
2524 } else { 2555 } else {
2525 if (netif_msg_rx_err(priv)) 2556 if (netif_msg_rx_err(priv))
2526 printk(KERN_WARNING 2557 printk(KERN_WARNING
2527 "%s: Missing skb!\n", dev->name); 2558 "%s: Missing skb!\n", dev->name);
2528 dev->stats.rx_dropped++; 2559 rx_queue->stats.rx_dropped++;
2529 priv->extra_stats.rx_skbmissing++; 2560 priv->extra_stats.rx_skbmissing++;
2530 } 2561 }
2531 2562
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index cbb451011cb5..3d72dc43dca5 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -333,7 +333,7 @@ extern const char gfar_driver_version[];
333#define IMASK_BSY 0x20000000 333#define IMASK_BSY 0x20000000
334#define IMASK_EBERR 0x10000000 334#define IMASK_EBERR 0x10000000
335#define IMASK_MSRO 0x04000000 335#define IMASK_MSRO 0x04000000
336#define IMASK_GRSC 0x02000000 336#define IMASK_GTSC 0x02000000
337#define IMASK_BABT 0x01000000 337#define IMASK_BABT 0x01000000
338#define IMASK_TXC 0x00800000 338#define IMASK_TXC 0x00800000
339#define IMASK_TXEEN 0x00400000 339#define IMASK_TXEEN 0x00400000
@@ -344,7 +344,7 @@ extern const char gfar_driver_version[];
344#define IMASK_XFUN 0x00010000 344#define IMASK_XFUN 0x00010000
345#define IMASK_RXB0 0x00008000 345#define IMASK_RXB0 0x00008000
346#define IMASK_MAG 0x00000800 346#define IMASK_MAG 0x00000800
347#define IMASK_GTSC 0x00000100 347#define IMASK_GRSC 0x00000100
348#define IMASK_RXFEN0 0x00000080 348#define IMASK_RXFEN0 0x00000080
349#define IMASK_FIR 0x00000008 349#define IMASK_FIR 0x00000008
350#define IMASK_FIQ 0x00000004 350#define IMASK_FIQ 0x00000004
@@ -401,6 +401,10 @@ extern const char gfar_driver_version[];
401#define FPR_FILER_MASK 0xFFFFFFFF 401#define FPR_FILER_MASK 0xFFFFFFFF
402#define MAX_FILER_IDX 0xFF 402#define MAX_FILER_IDX 0xFF
403 403
404/* This default RIR value directly corresponds
405 * to the 3-bit hash value generated */
406#define DEFAULT_RIR0 0x05397700
407
404/* RQFCR register bits */ 408/* RQFCR register bits */
405#define RQFCR_GPI 0x80000000 409#define RQFCR_GPI 0x80000000
406#define RQFCR_HASHTBL_Q 0x00000000 410#define RQFCR_HASHTBL_Q 0x00000000
@@ -936,6 +940,15 @@ struct gfar_priv_tx_q {
936 unsigned short txtime; 940 unsigned short txtime;
937}; 941};
938 942
943/*
944 * Per RX queue stats
945 */
946struct rx_q_stats {
947 unsigned long rx_packets;
948 unsigned long rx_bytes;
949 unsigned long rx_dropped;
950};
951
939/** 952/**
940 * struct gfar_priv_rx_q - per rx queue structure 953 * struct gfar_priv_rx_q - per rx queue structure
941 * @rxlock: per queue rx spin lock 954 * @rxlock: per queue rx spin lock
@@ -958,6 +971,7 @@ struct gfar_priv_rx_q {
958 struct rxbd8 *cur_rx; 971 struct rxbd8 *cur_rx;
959 struct net_device *dev; 972 struct net_device *dev;
960 struct gfar_priv_grp *grp; 973 struct gfar_priv_grp *grp;
974 struct rx_q_stats stats;
961 u16 skb_currx; 975 u16 skb_currx;
962 u16 qindex; 976 u16 qindex;
963 unsigned int rx_ring_size; 977 unsigned int rx_ring_size;
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index ae5f11c8fc13..bdadf3e23c94 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -248,6 +248,7 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
248{ 248{
249 unsigned char *ptr; 249 unsigned char *ptr;
250 struct bpqdev *bpq; 250 struct bpqdev *bpq;
251 struct net_device *orig_dev;
251 int size; 252 int size;
252 253
253 /* 254 /*
@@ -282,8 +283,9 @@ static netdev_tx_t bpq_xmit(struct sk_buff *skb, struct net_device *dev)
282 283
283 bpq = netdev_priv(dev); 284 bpq = netdev_priv(dev);
284 285
286 orig_dev = dev;
285 if ((dev = bpq_get_ether_dev(dev)) == NULL) { 287 if ((dev = bpq_get_ether_dev(dev)) == NULL) {
286 dev->stats.tx_dropped++; 288 orig_dev->stats.tx_dropped++;
287 kfree_skb(skb); 289 kfree_skb(skb);
288 return NETDEV_TX_OK; 290 return NETDEV_TX_OK;
289 } 291 }
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 090a6d3af112..052c74091d91 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -87,6 +87,7 @@ History:
87#include <linux/module.h> 87#include <linux/module.h>
88#include <linux/netdevice.h> 88#include <linux/netdevice.h>
89#include <linux/etherdevice.h> 89#include <linux/etherdevice.h>
90#include <linux/if_ether.h>
90#include <linux/skbuff.h> 91#include <linux/skbuff.h>
91#include <linux/bitops.h> 92#include <linux/bitops.h>
92 93
@@ -988,7 +989,7 @@ static int __devinit ibmlana_init_one(struct device *kdev)
988 989
989 /* copy out MAC address */ 990 /* copy out MAC address */
990 991
991 for (z = 0; z < sizeof(dev->dev_addr); z++) 992 for (z = 0; z < ETH_ALEN; z++)
992 dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); 993 dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z);
993 994
994 /* print config */ 995 /* print config */
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index e8e9e9194a88..c505b50d1fa3 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -1096,9 +1096,7 @@ static s32 igb_setup_serdes_link_82575(struct e1000_hw *hw)
1096 hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg); 1096 hw_dbg("Configuring Autoneg:PCS_LCTL=0x%08X\n", reg);
1097 } else { 1097 } else {
1098 /* Set PCS register for forced link */ 1098 /* Set PCS register for forced link */
1099 reg |= E1000_PCS_LCTL_FSD | /* Force Speed */ 1099 reg |= E1000_PCS_LCTL_FSD; /* Force Speed */
1100 E1000_PCS_LCTL_FORCE_LINK | /* Force Link */
1101 E1000_PCS_LCTL_FLV_LINK_UP; /* Force link value up */
1102 1100
1103 hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg); 1101 hw_dbg("Configuring Forced Link:PCS_LCTL=0x%08X\n", reg);
1104 } 1102 }
diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c
index 5c9d73e9bb8d..3670a66401b8 100644
--- a/drivers/net/igb/e1000_phy.c
+++ b/drivers/net/igb/e1000_phy.c
@@ -457,15 +457,6 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw)
457 phy_data |= I82580_CFG_ENABLE_DOWNSHIFT; 457 phy_data |= I82580_CFG_ENABLE_DOWNSHIFT;
458 458
459 ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data); 459 ret_val = phy->ops.write_reg(hw, I82580_CFG_REG, phy_data);
460 if (ret_val)
461 goto out;
462
463 /* Set number of link attempts before downshift */
464 ret_val = phy->ops.read_reg(hw, I82580_CTRL_REG, &phy_data);
465 if (ret_val)
466 goto out;
467 phy_data &= ~I82580_CTRL_DOWNSHIFT_MASK;
468 ret_val = phy->ops.write_reg(hw, I82580_CTRL_REG, phy_data);
469 460
470out: 461out:
471 return ret_val; 462 return ret_val;
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index ac9d5272650d..f771a6c08777 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -1795,7 +1795,7 @@ static int igb_wol_exclusion(struct igb_adapter *adapter,
1795 /* dual port cards only support WoL on port A from now on 1795 /* dual port cards only support WoL on port A from now on
1796 * unless it was enabled in the eeprom for port B 1796 * unless it was enabled in the eeprom for port B
1797 * so exclude FUNC_1 ports from having WoL enabled */ 1797 * so exclude FUNC_1 ports from having WoL enabled */
1798 if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1 && 1798 if ((rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) &&
1799 !adapter->eeprom_wol) { 1799 !adapter->eeprom_wol) {
1800 wol->supported = 0; 1800 wol->supported = 0;
1801 break; 1801 break;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 78963a0e128d..933c64ff2465 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1306,13 +1306,8 @@ void igb_reset(struct igb_adapter *adapter)
1306 hwm = min(((pba << 10) * 9 / 10), 1306 hwm = min(((pba << 10) * 9 / 10),
1307 ((pba << 10) - 2 * adapter->max_frame_size)); 1307 ((pba << 10) - 2 * adapter->max_frame_size));
1308 1308
1309 if (mac->type < e1000_82576) { 1309 fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */
1310 fc->high_water = hwm & 0xFFF8; /* 8-byte granularity */ 1310 fc->low_water = fc->high_water - 16;
1311 fc->low_water = fc->high_water - 8;
1312 } else {
1313 fc->high_water = hwm & 0xFFF0; /* 16-byte granularity */
1314 fc->low_water = fc->high_water - 16;
1315 }
1316 fc->pause_time = 0xFFFF; 1311 fc->pause_time = 0xFFFF;
1317 fc->send_xon = 1; 1312 fc->send_xon = 1;
1318 fc->current_mode = fc->requested_mode; 1313 fc->current_mode = fc->requested_mode;
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index e9dd95f136aa..0dbd0320023a 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -2763,7 +2763,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
2763 err = hw->mac.ops.reset_hw(hw); 2763 err = hw->mac.ops.reset_hw(hw);
2764 if (err) { 2764 if (err) {
2765 dev_info(&pdev->dev, 2765 dev_info(&pdev->dev,
2766 "PF still in reset state, assigning new address\n"); 2766 "PF still in reset state, assigning new address."
2767 " Is the PF interface up?\n");
2767 random_ether_addr(hw->mac.addr); 2768 random_ether_addr(hw->mac.addr);
2768 } else { 2769 } else {
2769 err = hw->mac.ops.read_mac_addr(hw); 2770 err = hw->mac.ops.read_mac_addr(hw);
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index bd64387563f0..2ad754c864cf 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -262,10 +262,12 @@ static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
262 int reg_idx = tx_ring->reg_idx; 262 int reg_idx = tx_ring->reg_idx;
263 int dcb_i = adapter->ring_feature[RING_F_DCB].indices; 263 int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
264 264
265 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 265 switch (adapter->hw.mac.type) {
266 case ixgbe_mac_82598EB:
266 tc = reg_idx >> 2; 267 tc = reg_idx >> 2;
267 txoff = IXGBE_TFCS_TXOFF0; 268 txoff = IXGBE_TFCS_TXOFF0;
268 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 269 break;
270 case ixgbe_mac_82599EB:
269 tc = 0; 271 tc = 0;
270 txoff = IXGBE_TFCS_TXOFF; 272 txoff = IXGBE_TFCS_TXOFF;
271 if (dcb_i == 8) { 273 if (dcb_i == 8) {
@@ -284,6 +286,9 @@ static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
284 tc += (reg_idx - 96) >> 4; 286 tc += (reg_idx - 96) >> 4;
285 } 287 }
286 } 288 }
289 break;
290 default:
291 tc = 0;
287 } 292 }
288 txoff <<= tc; 293 txoff <<= tc;
289 } 294 }
@@ -4373,6 +4378,11 @@ static int ixgbe_resume(struct pci_dev *pdev)
4373 4378
4374 pci_set_power_state(pdev, PCI_D0); 4379 pci_set_power_state(pdev, PCI_D0);
4375 pci_restore_state(pdev); 4380 pci_restore_state(pdev);
4381 /*
4382 * pci_restore_state clears dev->state_saved so call
4383 * pci_save_state to restore it.
4384 */
4385 pci_save_state(pdev);
4376 4386
4377 err = pci_enable_device_mem(pdev); 4387 err = pci_enable_device_mem(pdev);
4378 if (err) { 4388 if (err) {
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index 336e7c7a9275..a8522bd73ae7 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -134,7 +134,7 @@ static int temac_dma_bd_init(struct net_device *ndev)
134 struct sk_buff *skb; 134 struct sk_buff *skb;
135 int i; 135 int i;
136 136
137 lp->rx_skb = kzalloc(sizeof(struct sk_buff)*RX_BD_NUM, GFP_KERNEL); 137 lp->rx_skb = kzalloc(sizeof(*lp->rx_skb) * RX_BD_NUM, GFP_KERNEL);
138 /* allocate the tx and rx ring buffer descriptors. */ 138 /* allocate the tx and rx ring buffer descriptors. */
139 /* returns a virtual addres and a physical address. */ 139 /* returns a virtual addres and a physical address. */
140 lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent, 140 lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 291a505fd4fc..3cf56d90d859 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -1174,7 +1174,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1174 return 0; 1174 return 0;
1175 1175
1176err_port: 1176err_port:
1177 for (port = 1; port <= dev->caps.num_ports; port++) 1177 for (--port; port >= 1; --port)
1178 mlx4_cleanup_port_info(&priv->port[port]); 1178 mlx4_cleanup_port_info(&priv->port[port]);
1179 1179
1180 mlx4_cleanup_mcg_table(dev); 1180 mlx4_cleanup_mcg_table(dev);
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 1405a170bb43..af67af55efe7 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -656,6 +656,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
656 struct sk_buff *skb; 656 struct sk_buff *skb;
657 int rx; 657 int rx;
658 struct rx_desc *rx_desc; 658 struct rx_desc *rx_desc;
659 int size;
659 660
660 skb = __skb_dequeue(&mp->rx_recycle); 661 skb = __skb_dequeue(&mp->rx_recycle);
661 if (skb == NULL) 662 if (skb == NULL)
@@ -678,10 +679,11 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
678 679
679 rx_desc = rxq->rx_desc_area + rx; 680 rx_desc = rxq->rx_desc_area + rx;
680 681
682 size = skb->end - skb->data;
681 rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent, 683 rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent,
682 skb->data, mp->skb_size, 684 skb->data, size,
683 DMA_FROM_DEVICE); 685 DMA_FROM_DEVICE);
684 rx_desc->buf_size = mp->skb_size; 686 rx_desc->buf_size = size;
685 rxq->rx_skb[rx] = skb; 687 rxq->rx_skb[rx] = skb;
686 wmb(); 688 wmb();
687 rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT; 689 rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 76cd1f3e9fc8..9bc5bd1d538a 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -53,8 +53,8 @@
53 53
54#define _NETXEN_NIC_LINUX_MAJOR 4 54#define _NETXEN_NIC_LINUX_MAJOR 4
55#define _NETXEN_NIC_LINUX_MINOR 0 55#define _NETXEN_NIC_LINUX_MINOR 0
56#define _NETXEN_NIC_LINUX_SUBVERSION 65 56#define _NETXEN_NIC_LINUX_SUBVERSION 72
57#define NETXEN_NIC_LINUX_VERSIONID "4.0.65" 57#define NETXEN_NIC_LINUX_VERSIONID "4.0.72"
58 58
59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
60#define _major(v) (((v) >> 24) & 0xff) 60#define _major(v) (((v) >> 24) & 0xff)
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index ddd704ae0188..542f408333ff 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -66,7 +66,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
66 66
67#define NETXEN_NIC_TEST_LEN ARRAY_SIZE(netxen_nic_gstrings_test) 67#define NETXEN_NIC_TEST_LEN ARRAY_SIZE(netxen_nic_gstrings_test)
68 68
69#define NETXEN_NIC_REGS_COUNT 42 69#define NETXEN_NIC_REGS_COUNT 30
70#define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32)) 70#define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32))
71#define NETXEN_MAX_EEPROM_LEN 1024 71#define NETXEN_MAX_EEPROM_LEN 1024
72 72
@@ -312,150 +312,91 @@ static int netxen_nic_get_regs_len(struct net_device *dev)
312 return NETXEN_NIC_REGS_LEN; 312 return NETXEN_NIC_REGS_LEN;
313} 313}
314 314
315struct netxen_niu_regs {
316 __u32 reg[NETXEN_NIC_REGS_COUNT];
317};
318
319static struct netxen_niu_regs niu_registers[] = {
320 {
321 /* GB Mode */
322 {
323 NETXEN_NIU_GB_SERDES_RESET,
324 NETXEN_NIU_GB0_MII_MODE,
325 NETXEN_NIU_GB1_MII_MODE,
326 NETXEN_NIU_GB2_MII_MODE,
327 NETXEN_NIU_GB3_MII_MODE,
328 NETXEN_NIU_GB0_GMII_MODE,
329 NETXEN_NIU_GB1_GMII_MODE,
330 NETXEN_NIU_GB2_GMII_MODE,
331 NETXEN_NIU_GB3_GMII_MODE,
332 NETXEN_NIU_REMOTE_LOOPBACK,
333 NETXEN_NIU_GB0_HALF_DUPLEX,
334 NETXEN_NIU_GB1_HALF_DUPLEX,
335 NETXEN_NIU_RESET_SYS_FIFOS,
336 NETXEN_NIU_GB_CRC_DROP,
337 NETXEN_NIU_GB_DROP_WRONGADDR,
338 NETXEN_NIU_TEST_MUX_CTL,
339
340 NETXEN_NIU_GB_MAC_CONFIG_0(0),
341 NETXEN_NIU_GB_MAC_CONFIG_1(0),
342 NETXEN_NIU_GB_HALF_DUPLEX_CTRL(0),
343 NETXEN_NIU_GB_MAX_FRAME_SIZE(0),
344 NETXEN_NIU_GB_TEST_REG(0),
345 NETXEN_NIU_GB_MII_MGMT_CONFIG(0),
346 NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
347 NETXEN_NIU_GB_MII_MGMT_ADDR(0),
348 NETXEN_NIU_GB_MII_MGMT_CTRL(0),
349 NETXEN_NIU_GB_MII_MGMT_STATUS(0),
350 NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
351 NETXEN_NIU_GB_INTERFACE_CTRL(0),
352 NETXEN_NIU_GB_INTERFACE_STATUS(0),
353 NETXEN_NIU_GB_STATION_ADDR_0(0),
354 NETXEN_NIU_GB_STATION_ADDR_1(0),
355 -1,
356 }
357 },
358 {
359 /* XG Mode */
360 {
361 NETXEN_NIU_XG_SINGLE_TERM,
362 NETXEN_NIU_XG_DRIVE_HI,
363 NETXEN_NIU_XG_DRIVE_LO,
364 NETXEN_NIU_XG_DTX,
365 NETXEN_NIU_XG_DEQ,
366 NETXEN_NIU_XG_WORD_ALIGN,
367 NETXEN_NIU_XG_RESET,
368 NETXEN_NIU_XG_POWER_DOWN,
369 NETXEN_NIU_XG_RESET_PLL,
370 NETXEN_NIU_XG_SERDES_LOOPBACK,
371 NETXEN_NIU_XG_DO_BYTE_ALIGN,
372 NETXEN_NIU_XG_TX_ENABLE,
373 NETXEN_NIU_XG_RX_ENABLE,
374 NETXEN_NIU_XG_STATUS,
375 NETXEN_NIU_XG_PAUSE_THRESHOLD,
376 NETXEN_NIU_XGE_CONFIG_0,
377 NETXEN_NIU_XGE_CONFIG_1,
378 NETXEN_NIU_XGE_IPG,
379 NETXEN_NIU_XGE_STATION_ADDR_0_HI,
380 NETXEN_NIU_XGE_STATION_ADDR_0_1,
381 NETXEN_NIU_XGE_STATION_ADDR_1_LO,
382 NETXEN_NIU_XGE_STATUS,
383 NETXEN_NIU_XGE_MAX_FRAME_SIZE,
384 NETXEN_NIU_XGE_PAUSE_FRAME_VALUE,
385 NETXEN_NIU_XGE_TX_BYTE_CNT,
386 NETXEN_NIU_XGE_TX_FRAME_CNT,
387 NETXEN_NIU_XGE_RX_BYTE_CNT,
388 NETXEN_NIU_XGE_RX_FRAME_CNT,
389 NETXEN_NIU_XGE_AGGR_ERROR_CNT,
390 NETXEN_NIU_XGE_MULTICAST_FRAME_CNT,
391 NETXEN_NIU_XGE_UNICAST_FRAME_CNT,
392 NETXEN_NIU_XGE_CRC_ERROR_CNT,
393 NETXEN_NIU_XGE_OVERSIZE_FRAME_ERR,
394 NETXEN_NIU_XGE_UNDERSIZE_FRAME_ERR,
395 NETXEN_NIU_XGE_LOCAL_ERROR_CNT,
396 NETXEN_NIU_XGE_REMOTE_ERROR_CNT,
397 NETXEN_NIU_XGE_CONTROL_CHAR_CNT,
398 NETXEN_NIU_XGE_PAUSE_FRAME_CNT,
399 -1,
400 }
401 }
402};
403
404static void 315static void
405netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) 316netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
406{ 317{
407 struct netxen_adapter *adapter = netdev_priv(dev); 318 struct netxen_adapter *adapter = netdev_priv(dev);
408 __u32 mode, *regs_buff = p; 319 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
409 int i, window; 320 struct nx_host_sds_ring *sds_ring;
321 u32 *regs_buff = p;
322 int ring, i = 0;
323 int port = adapter->physical_port;
410 324
411 memset(p, 0, NETXEN_NIC_REGS_LEN); 325 memset(p, 0, NETXEN_NIC_REGS_LEN);
326
412 regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | 327 regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
413 (adapter->pdev)->device; 328 (adapter->pdev)->device;
414 /* which mode */
415 regs_buff[0] = NXRD32(adapter, NETXEN_NIU_MODE);
416 mode = regs_buff[0];
417
418 /* Common registers to all the modes */
419 regs_buff[2] = NXRD32(adapter, NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER);
420 /* GB/XGB Mode */
421 mode = (mode / 2) - 1;
422 window = 0;
423 if (mode <= 1) {
424 for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
425 /* GB: port specific registers */
426 if (mode == 0 && i >= 19)
427 window = adapter->physical_port *
428 NETXEN_NIC_PORT_WINDOW;
429
430 regs_buff[i] = NXRD32(adapter,
431 niu_registers[mode].reg[i - 3] + window);
432 }
433 329
330 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
331 return;
332
333 regs_buff[i++] = NXRD32(adapter, CRB_CMDPEG_STATE);
334 regs_buff[i++] = NXRD32(adapter, CRB_RCVPEG_STATE);
335 regs_buff[i++] = NXRD32(adapter, CRB_FW_CAPABILITIES_1);
336 regs_buff[i++] = NXRDIO(adapter, adapter->crb_int_state_reg);
337 regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_REF_COUNT);
338 regs_buff[i++] = NXRD32(adapter, NX_CRB_DEV_STATE);
339 regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER);
340 regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS1);
341 regs_buff[i++] = NXRD32(adapter, NETXEN_PEG_HALT_STATUS2);
342
343 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_0+0x3c);
344 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_1+0x3c);
345 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_2+0x3c);
346 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_3+0x3c);
347
348 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
349
350 regs_buff[i++] = NXRD32(adapter, NETXEN_CRB_PEG_NET_4+0x3c);
351 i += 2;
352
353 regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE_P3);
354 regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer));
355
356 } else {
357 i++;
358
359 regs_buff[i++] = NXRD32(adapter,
360 NETXEN_NIU_XGE_CONFIG_0+(0x10000*port));
361 regs_buff[i++] = NXRD32(adapter,
362 NETXEN_NIU_XGE_CONFIG_1+(0x10000*port));
363
364 regs_buff[i++] = NXRD32(adapter, CRB_XG_STATE);
365 regs_buff[i++] = NXRDIO(adapter,
366 adapter->tx_ring->crb_cmd_consumer);
367 }
368
369 regs_buff[i++] = NXRDIO(adapter, adapter->tx_ring->crb_cmd_producer);
370
371 regs_buff[i++] = NXRDIO(adapter,
372 recv_ctx->rds_rings[0].crb_rcv_producer);
373 regs_buff[i++] = NXRDIO(adapter,
374 recv_ctx->rds_rings[1].crb_rcv_producer);
375
376 regs_buff[i++] = adapter->max_sds_rings;
377
378 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
379 sds_ring = &(recv_ctx->sds_rings[ring]);
380 regs_buff[i++] = NXRDIO(adapter,
381 sds_ring->crb_sts_consumer);
434 } 382 }
435} 383}
436 384
437static u32 netxen_nic_test_link(struct net_device *dev) 385static u32 netxen_nic_test_link(struct net_device *dev)
438{ 386{
439 struct netxen_adapter *adapter = netdev_priv(dev); 387 struct netxen_adapter *adapter = netdev_priv(dev);
440 __u32 status; 388 u32 val, port;
441 int val;
442 389
443 /* read which mode */ 390 port = adapter->physical_port;
444 if (adapter->ahw.port_type == NETXEN_NIC_GBE) { 391 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
445 if (adapter->phy_read && 392 val = NXRD32(adapter, CRB_XG_STATE_P3);
446 adapter->phy_read(adapter, 393 val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val);
447 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 394 return (val == XG_LINK_UP_P3) ? 0 : 1;
448 &status) != 0) 395 } else {
449 return -EIO;
450 else {
451 val = netxen_get_phy_link(status);
452 return !val;
453 }
454 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
455 val = NXRD32(adapter, CRB_XG_STATE); 396 val = NXRD32(adapter, CRB_XG_STATE);
397 val = (val >> port*8) & 0xff;
456 return (val == XG_LINK_UP) ? 0 : 1; 398 return (val == XG_LINK_UP) ? 0 : 1;
457 } 399 }
458 return -EIO;
459} 400}
460 401
461static int 402static int
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 2e364fee3cbb..85e28e60ecf1 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -345,8 +345,7 @@ netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg)
345void 345void
346netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) 346netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem)
347{ 347{
348 int val; 348 NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem)));
349 val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem)));
350} 349}
351 350
352int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) 351int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port)
@@ -691,6 +690,9 @@ void netxen_p3_nic_set_multi(struct net_device *netdev)
691 struct list_head *head; 690 struct list_head *head;
692 nx_mac_list_t *cur; 691 nx_mac_list_t *cur;
693 692
693 if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC)
694 return;
695
694 list_splice_tail_init(&adapter->mac_list, &del_list); 696 list_splice_tail_init(&adapter->mac_list, &del_list);
695 697
696 nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list); 698 nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list);
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 02f8d4b4db63..64cff68d372c 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -184,6 +184,8 @@ skip_rds:
184 184
185 tx_ring = adapter->tx_ring; 185 tx_ring = adapter->tx_ring;
186 vfree(tx_ring->cmd_buf_arr); 186 vfree(tx_ring->cmd_buf_arr);
187 kfree(tx_ring);
188 adapter->tx_ring = NULL;
187} 189}
188 190
189int netxen_alloc_sw_resources(struct netxen_adapter *adapter) 191int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
@@ -782,7 +784,7 @@ netxen_need_fw_reset(struct netxen_adapter *adapter)
782 if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) 784 if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED)
783 return 1; 785 return 1;
784 786
785 old_count = count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); 787 old_count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER);
786 788
787 for (i = 0; i < 10; i++) { 789 for (i = 0; i < 10; i++) {
788 790
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index f4996846a234..9f9d6081959b 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -57,7 +57,9 @@ static int use_msi = 1;
57 57
58static int use_msi_x = 1; 58static int use_msi_x = 1;
59 59
60static unsigned long auto_fw_reset = AUTO_FW_RESET_ENABLED; 60static int auto_fw_reset = AUTO_FW_RESET_ENABLED;
61module_param(auto_fw_reset, int, 0644);
62MODULE_PARM_DESC(auto_fw_reset,"Auto firmware reset (0=disabled, 1=enabled");
61 63
62static int __devinit netxen_nic_probe(struct pci_dev *pdev, 64static int __devinit netxen_nic_probe(struct pci_dev *pdev,
63 const struct pci_device_id *ent); 65 const struct pci_device_id *ent);
@@ -338,7 +340,7 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot)
338 if (!(first_boot & 0x4)) { 340 if (!(first_boot & 0x4)) {
339 first_boot |= 0x4; 341 first_boot |= 0x4;
340 NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot); 342 NXWR32(adapter, NETXEN_PCIE_REG(0x4), first_boot);
341 first_boot = NXRD32(adapter, NETXEN_PCIE_REG(0x4)); 343 NXRD32(adapter, NETXEN_PCIE_REG(0x4));
342 } 344 }
343 345
344 /* This is the first boot after power up */ 346 /* This is the first boot after power up */
@@ -1896,12 +1898,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1896 linkup = (val == XG_LINK_UP_P3); 1898 linkup = (val == XG_LINK_UP_P3);
1897 } else { 1899 } else {
1898 val = NXRD32(adapter, CRB_XG_STATE); 1900 val = NXRD32(adapter, CRB_XG_STATE);
1899 if (adapter->ahw.port_type == NETXEN_NIC_GBE) 1901 val = (val >> port*8) & 0xff;
1900 linkup = (val >> port) & 1; 1902 linkup = (val == XG_LINK_UP);
1901 else {
1902 val = (val >> port*8) & 0xff;
1903 linkup = (val == XG_LINK_UP);
1904 }
1905 } 1903 }
1906 1904
1907 netxen_advert_link_change(adapter, linkup); 1905 netxen_advert_link_change(adapter, linkup);
@@ -2534,42 +2532,6 @@ static struct bin_attribute bin_attr_mem = {
2534 .write = netxen_sysfs_write_mem, 2532 .write = netxen_sysfs_write_mem,
2535}; 2533};
2536 2534
2537#ifdef CONFIG_MODULES
2538static ssize_t
2539netxen_store_auto_fw_reset(struct module_attribute *mattr,
2540 struct module *mod, const char *buf, size_t count)
2541
2542{
2543 unsigned long new;
2544
2545 if (strict_strtoul(buf, 16, &new))
2546 return -EINVAL;
2547
2548 if ((new == AUTO_FW_RESET_ENABLED) || (new == AUTO_FW_RESET_DISABLED)) {
2549 auto_fw_reset = new;
2550 return count;
2551 }
2552
2553 return -EINVAL;
2554}
2555
2556static ssize_t
2557netxen_show_auto_fw_reset(struct module_attribute *mattr,
2558 struct module *mod, char *buf)
2559
2560{
2561 if (auto_fw_reset == AUTO_FW_RESET_ENABLED)
2562 return sprintf(buf, "enabled\n");
2563 else
2564 return sprintf(buf, "disabled\n");
2565}
2566
2567static struct module_attribute mod_attr_fw_reset = {
2568 .attr = {.name = "auto_fw_reset", .mode = (S_IRUGO | S_IWUSR)},
2569 .show = netxen_show_auto_fw_reset,
2570 .store = netxen_store_auto_fw_reset,
2571};
2572#endif
2573 2535
2574static void 2536static void
2575netxen_create_sysfs_entries(struct netxen_adapter *adapter) 2537netxen_create_sysfs_entries(struct netxen_adapter *adapter)
@@ -2775,23 +2737,12 @@ static struct pci_driver netxen_driver = {
2775 2737
2776static int __init netxen_init_module(void) 2738static int __init netxen_init_module(void)
2777{ 2739{
2778#ifdef CONFIG_MODULES
2779 struct module *mod = THIS_MODULE;
2780#endif
2781
2782 printk(KERN_INFO "%s\n", netxen_nic_driver_string); 2740 printk(KERN_INFO "%s\n", netxen_nic_driver_string);
2783 2741
2784#ifdef CONFIG_INET 2742#ifdef CONFIG_INET
2785 register_netdevice_notifier(&netxen_netdev_cb); 2743 register_netdevice_notifier(&netxen_netdev_cb);
2786 register_inetaddr_notifier(&netxen_inetaddr_cb); 2744 register_inetaddr_notifier(&netxen_inetaddr_cb);
2787#endif 2745#endif
2788
2789#ifdef CONFIG_MODULES
2790 if (sysfs_create_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr))
2791 printk(KERN_ERR "%s: Failed to create auto_fw_reset "
2792 "sysfs entry.", netxen_nic_driver_name);
2793#endif
2794
2795 return pci_register_driver(&netxen_driver); 2746 return pci_register_driver(&netxen_driver);
2796} 2747}
2797 2748
@@ -2799,12 +2750,6 @@ module_init(netxen_init_module);
2799 2750
2800static void __exit netxen_exit_module(void) 2751static void __exit netxen_exit_module(void)
2801{ 2752{
2802#ifdef CONFIG_MODULES
2803 struct module *mod = THIS_MODULE;
2804
2805 sysfs_remove_file(&mod->mkobj.kobj, &mod_attr_fw_reset.attr);
2806#endif
2807
2808 pci_unregister_driver(&netxen_driver); 2753 pci_unregister_driver(&netxen_driver);
2809 2754
2810#ifdef CONFIG_INET 2755#ifdef CONFIG_INET
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 8ce58c4c7dd3..2aed2b382c40 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -2844,7 +2844,7 @@ static int tcam_wait_bit(struct niu *np, u64 bit)
2844 break; 2844 break;
2845 udelay(1); 2845 udelay(1);
2846 } 2846 }
2847 if (limit < 0) 2847 if (limit <= 0)
2848 return -ENODEV; 2848 return -ENODEV;
2849 2849
2850 return 0; 2850 return 0;
diff --git a/drivers/net/octeon/Kconfig b/drivers/net/octeon/Kconfig
new file mode 100644
index 000000000000..1e56bbf3f5c0
--- /dev/null
+++ b/drivers/net/octeon/Kconfig
@@ -0,0 +1,10 @@
1config OCTEON_MGMT_ETHERNET
2 tristate "Octeon Management port ethernet driver (CN5XXX, CN6XXX)"
3 depends on CPU_CAVIUM_OCTEON
4 select PHYLIB
5 select MDIO_OCTEON
6 default y
7 help
8 This option enables the ethernet driver for the management
9 port on Cavium Networks' Octeon CN57XX, CN56XX, CN55XX,
10 CN54XX, CN52XX, and CN6XXX chips.
diff --git a/drivers/net/octeon/Makefile b/drivers/net/octeon/Makefile
new file mode 100644
index 000000000000..906edecacfd3
--- /dev/null
+++ b/drivers/net/octeon/Makefile
@@ -0,0 +1,2 @@
1
2obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon_mgmt.o
diff --git a/drivers/net/octeon/octeon_mgmt.c b/drivers/net/octeon/octeon_mgmt.c
new file mode 100644
index 000000000000..050538bf155a
--- /dev/null
+++ b/drivers/net/octeon/octeon_mgmt.c
@@ -0,0 +1,1176 @@
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) 2009 Cavium Networks
7 */
8
9#include <linux/capability.h>
10#include <linux/dma-mapping.h>
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/netdevice.h>
14#include <linux/etherdevice.h>
15#include <linux/if_vlan.h>
16#include <linux/phy.h>
17#include <linux/spinlock.h>
18
19#include <asm/octeon/octeon.h>
20#include <asm/octeon/cvmx-mixx-defs.h>
21#include <asm/octeon/cvmx-agl-defs.h>
22
23#define DRV_NAME "octeon_mgmt"
24#define DRV_VERSION "2.0"
25#define DRV_DESCRIPTION \
26 "Cavium Networks Octeon MII (management) port Network Driver"
27
28#define OCTEON_MGMT_NAPI_WEIGHT 16
29
30/*
31 * Ring sizes that are powers of two allow for more efficient modulo
32 * opertions.
33 */
34#define OCTEON_MGMT_RX_RING_SIZE 512
35#define OCTEON_MGMT_TX_RING_SIZE 128
36
37/* Allow 8 bytes for vlan and FCS. */
38#define OCTEON_MGMT_RX_HEADROOM (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN)
39
40union mgmt_port_ring_entry {
41 u64 d64;
42 struct {
43 u64 reserved_62_63:2;
44 /* Length of the buffer/packet in bytes */
45 u64 len:14;
46 /* For TX, signals that the packet should be timestamped */
47 u64 tstamp:1;
48 /* The RX error code */
49 u64 code:7;
50#define RING_ENTRY_CODE_DONE 0xf
51#define RING_ENTRY_CODE_MORE 0x10
52 /* Physical address of the buffer */
53 u64 addr:40;
54 } s;
55};
56
57struct octeon_mgmt {
58 struct net_device *netdev;
59 int port;
60 int irq;
61 u64 *tx_ring;
62 dma_addr_t tx_ring_handle;
63 unsigned int tx_next;
64 unsigned int tx_next_clean;
65 unsigned int tx_current_fill;
66 /* The tx_list lock also protects the ring related variables */
67 struct sk_buff_head tx_list;
68
69 /* RX variables only touched in napi_poll. No locking necessary. */
70 u64 *rx_ring;
71 dma_addr_t rx_ring_handle;
72 unsigned int rx_next;
73 unsigned int rx_next_fill;
74 unsigned int rx_current_fill;
75 struct sk_buff_head rx_list;
76
77 spinlock_t lock;
78 unsigned int last_duplex;
79 unsigned int last_link;
80 struct device *dev;
81 struct napi_struct napi;
82 struct tasklet_struct tx_clean_tasklet;
83 struct phy_device *phydev;
84};
85
86static void octeon_mgmt_set_rx_irq(struct octeon_mgmt *p, int enable)
87{
88 int port = p->port;
89 union cvmx_mixx_intena mix_intena;
90 unsigned long flags;
91
92 spin_lock_irqsave(&p->lock, flags);
93 mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port));
94 mix_intena.s.ithena = enable ? 1 : 0;
95 cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
96 spin_unlock_irqrestore(&p->lock, flags);
97}
98
99static void octeon_mgmt_set_tx_irq(struct octeon_mgmt *p, int enable)
100{
101 int port = p->port;
102 union cvmx_mixx_intena mix_intena;
103 unsigned long flags;
104
105 spin_lock_irqsave(&p->lock, flags);
106 mix_intena.u64 = cvmx_read_csr(CVMX_MIXX_INTENA(port));
107 mix_intena.s.othena = enable ? 1 : 0;
108 cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
109 spin_unlock_irqrestore(&p->lock, flags);
110}
111
112static inline void octeon_mgmt_enable_rx_irq(struct octeon_mgmt *p)
113{
114 octeon_mgmt_set_rx_irq(p, 1);
115}
116
117static inline void octeon_mgmt_disable_rx_irq(struct octeon_mgmt *p)
118{
119 octeon_mgmt_set_rx_irq(p, 0);
120}
121
122static inline void octeon_mgmt_enable_tx_irq(struct octeon_mgmt *p)
123{
124 octeon_mgmt_set_tx_irq(p, 1);
125}
126
127static inline void octeon_mgmt_disable_tx_irq(struct octeon_mgmt *p)
128{
129 octeon_mgmt_set_tx_irq(p, 0);
130}
131
132static unsigned int ring_max_fill(unsigned int ring_size)
133{
134 return ring_size - 8;
135}
136
137static unsigned int ring_size_to_bytes(unsigned int ring_size)
138{
139 return ring_size * sizeof(union mgmt_port_ring_entry);
140}
141
142static void octeon_mgmt_rx_fill_ring(struct net_device *netdev)
143{
144 struct octeon_mgmt *p = netdev_priv(netdev);
145 int port = p->port;
146
147 while (p->rx_current_fill < ring_max_fill(OCTEON_MGMT_RX_RING_SIZE)) {
148 unsigned int size;
149 union mgmt_port_ring_entry re;
150 struct sk_buff *skb;
151
152 /* CN56XX pass 1 needs 8 bytes of padding. */
153 size = netdev->mtu + OCTEON_MGMT_RX_HEADROOM + 8 + NET_IP_ALIGN;
154
155 skb = netdev_alloc_skb(netdev, size);
156 if (!skb)
157 break;
158 skb_reserve(skb, NET_IP_ALIGN);
159 __skb_queue_tail(&p->rx_list, skb);
160
161 re.d64 = 0;
162 re.s.len = size;
163 re.s.addr = dma_map_single(p->dev, skb->data,
164 size,
165 DMA_FROM_DEVICE);
166
167 /* Put it in the ring. */
168 p->rx_ring[p->rx_next_fill] = re.d64;
169 dma_sync_single_for_device(p->dev, p->rx_ring_handle,
170 ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE),
171 DMA_BIDIRECTIONAL);
172 p->rx_next_fill =
173 (p->rx_next_fill + 1) % OCTEON_MGMT_RX_RING_SIZE;
174 p->rx_current_fill++;
175 /* Ring the bell. */
176 cvmx_write_csr(CVMX_MIXX_IRING2(port), 1);
177 }
178}
179
180static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
181{
182 int port = p->port;
183 union cvmx_mixx_orcnt mix_orcnt;
184 union mgmt_port_ring_entry re;
185 struct sk_buff *skb;
186 int cleaned = 0;
187 unsigned long flags;
188
189 mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
190 while (mix_orcnt.s.orcnt) {
191 dma_sync_single_for_cpu(p->dev, p->tx_ring_handle,
192 ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE),
193 DMA_BIDIRECTIONAL);
194
195 spin_lock_irqsave(&p->tx_list.lock, flags);
196
197 re.d64 = p->tx_ring[p->tx_next_clean];
198 p->tx_next_clean =
199 (p->tx_next_clean + 1) % OCTEON_MGMT_TX_RING_SIZE;
200 skb = __skb_dequeue(&p->tx_list);
201
202 mix_orcnt.u64 = 0;
203 mix_orcnt.s.orcnt = 1;
204
205 /* Acknowledge to hardware that we have the buffer. */
206 cvmx_write_csr(CVMX_MIXX_ORCNT(port), mix_orcnt.u64);
207 p->tx_current_fill--;
208
209 spin_unlock_irqrestore(&p->tx_list.lock, flags);
210
211 dma_unmap_single(p->dev, re.s.addr, re.s.len,
212 DMA_TO_DEVICE);
213 dev_kfree_skb_any(skb);
214 cleaned++;
215
216 mix_orcnt.u64 = cvmx_read_csr(CVMX_MIXX_ORCNT(port));
217 }
218
219 if (cleaned && netif_queue_stopped(p->netdev))
220 netif_wake_queue(p->netdev);
221}
222
223static void octeon_mgmt_clean_tx_tasklet(unsigned long arg)
224{
225 struct octeon_mgmt *p = (struct octeon_mgmt *)arg;
226 octeon_mgmt_clean_tx_buffers(p);
227 octeon_mgmt_enable_tx_irq(p);
228}
229
230static void octeon_mgmt_update_rx_stats(struct net_device *netdev)
231{
232 struct octeon_mgmt *p = netdev_priv(netdev);
233 int port = p->port;
234 unsigned long flags;
235 u64 drop, bad;
236
237 /* These reads also clear the count registers. */
238 drop = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port));
239 bad = cvmx_read_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port));
240
241 if (drop || bad) {
242 /* Do an atomic update. */
243 spin_lock_irqsave(&p->lock, flags);
244 netdev->stats.rx_errors += bad;
245 netdev->stats.rx_dropped += drop;
246 spin_unlock_irqrestore(&p->lock, flags);
247 }
248}
249
250static void octeon_mgmt_update_tx_stats(struct net_device *netdev)
251{
252 struct octeon_mgmt *p = netdev_priv(netdev);
253 int port = p->port;
254 unsigned long flags;
255
256 union cvmx_agl_gmx_txx_stat0 s0;
257 union cvmx_agl_gmx_txx_stat1 s1;
258
259 /* These reads also clear the count registers. */
260 s0.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT0(port));
261 s1.u64 = cvmx_read_csr(CVMX_AGL_GMX_TXX_STAT1(port));
262
263 if (s0.s.xsdef || s0.s.xscol || s1.s.scol || s1.s.mcol) {
264 /* Do an atomic update. */
265 spin_lock_irqsave(&p->lock, flags);
266 netdev->stats.tx_errors += s0.s.xsdef + s0.s.xscol;
267 netdev->stats.collisions += s1.s.scol + s1.s.mcol;
268 spin_unlock_irqrestore(&p->lock, flags);
269 }
270}
271
272/*
273 * Dequeue a receive skb and its corresponding ring entry. The ring
274 * entry is returned, *pskb is updated to point to the skb.
275 */
276static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p,
277 struct sk_buff **pskb)
278{
279 union mgmt_port_ring_entry re;
280
281 dma_sync_single_for_cpu(p->dev, p->rx_ring_handle,
282 ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE),
283 DMA_BIDIRECTIONAL);
284
285 re.d64 = p->rx_ring[p->rx_next];
286 p->rx_next = (p->rx_next + 1) % OCTEON_MGMT_RX_RING_SIZE;
287 p->rx_current_fill--;
288 *pskb = __skb_dequeue(&p->rx_list);
289
290 dma_unmap_single(p->dev, re.s.addr,
291 ETH_FRAME_LEN + OCTEON_MGMT_RX_HEADROOM,
292 DMA_FROM_DEVICE);
293
294 return re.d64;
295}
296
297
298static int octeon_mgmt_receive_one(struct octeon_mgmt *p)
299{
300 int port = p->port;
301 struct net_device *netdev = p->netdev;
302 union cvmx_mixx_ircnt mix_ircnt;
303 union mgmt_port_ring_entry re;
304 struct sk_buff *skb;
305 struct sk_buff *skb2;
306 struct sk_buff *skb_new;
307 union mgmt_port_ring_entry re2;
308 int rc = 1;
309
310
311 re.d64 = octeon_mgmt_dequeue_rx_buffer(p, &skb);
312 if (likely(re.s.code == RING_ENTRY_CODE_DONE)) {
313 /* A good packet, send it up. */
314 skb_put(skb, re.s.len);
315good:
316 skb->protocol = eth_type_trans(skb, netdev);
317 netdev->stats.rx_packets++;
318 netdev->stats.rx_bytes += skb->len;
319 netdev->last_rx = jiffies;
320 netif_receive_skb(skb);
321 rc = 0;
322 } else if (re.s.code == RING_ENTRY_CODE_MORE) {
323 /*
324 * Packet split across skbs. This can happen if we
325 * increase the MTU. Buffers that are already in the
326 * rx ring can then end up being too small. As the rx
327 * ring is refilled, buffers sized for the new MTU
328 * will be used and we should go back to the normal
329 * non-split case.
330 */
331 skb_put(skb, re.s.len);
332 do {
333 re2.d64 = octeon_mgmt_dequeue_rx_buffer(p, &skb2);
334 if (re2.s.code != RING_ENTRY_CODE_MORE
335 && re2.s.code != RING_ENTRY_CODE_DONE)
336 goto split_error;
337 skb_put(skb2, re2.s.len);
338 skb_new = skb_copy_expand(skb, 0, skb2->len,
339 GFP_ATOMIC);
340 if (!skb_new)
341 goto split_error;
342 if (skb_copy_bits(skb2, 0, skb_tail_pointer(skb_new),
343 skb2->len))
344 goto split_error;
345 skb_put(skb_new, skb2->len);
346 dev_kfree_skb_any(skb);
347 dev_kfree_skb_any(skb2);
348 skb = skb_new;
349 } while (re2.s.code == RING_ENTRY_CODE_MORE);
350 goto good;
351 } else {
352 /* Some other error, discard it. */
353 dev_kfree_skb_any(skb);
354 /*
355 * Error statistics are accumulated in
356 * octeon_mgmt_update_rx_stats.
357 */
358 }
359 goto done;
360split_error:
361 /* Discard the whole mess. */
362 dev_kfree_skb_any(skb);
363 dev_kfree_skb_any(skb2);
364 while (re2.s.code == RING_ENTRY_CODE_MORE) {
365 re2.d64 = octeon_mgmt_dequeue_rx_buffer(p, &skb2);
366 dev_kfree_skb_any(skb2);
367 }
368 netdev->stats.rx_errors++;
369
370done:
371 /* Tell the hardware we processed a packet. */
372 mix_ircnt.u64 = 0;
373 mix_ircnt.s.ircnt = 1;
374 cvmx_write_csr(CVMX_MIXX_IRCNT(port), mix_ircnt.u64);
375 return rc;
376
377}
378
379static int octeon_mgmt_receive_packets(struct octeon_mgmt *p, int budget)
380{
381 int port = p->port;
382 unsigned int work_done = 0;
383 union cvmx_mixx_ircnt mix_ircnt;
384 int rc;
385
386
387 mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port));
388 while (work_done < budget && mix_ircnt.s.ircnt) {
389
390 rc = octeon_mgmt_receive_one(p);
391 if (!rc)
392 work_done++;
393
394 /* Check for more packets. */
395 mix_ircnt.u64 = cvmx_read_csr(CVMX_MIXX_IRCNT(port));
396 }
397
398 octeon_mgmt_rx_fill_ring(p->netdev);
399
400 return work_done;
401}
402
403static int octeon_mgmt_napi_poll(struct napi_struct *napi, int budget)
404{
405 struct octeon_mgmt *p = container_of(napi, struct octeon_mgmt, napi);
406 struct net_device *netdev = p->netdev;
407 unsigned int work_done = 0;
408
409 work_done = octeon_mgmt_receive_packets(p, budget);
410
411 if (work_done < budget) {
412 /* We stopped because no more packets were available. */
413 napi_complete(napi);
414 octeon_mgmt_enable_rx_irq(p);
415 }
416 octeon_mgmt_update_rx_stats(netdev);
417
418 return work_done;
419}
420
421/* Reset the hardware to clean state. */
422static void octeon_mgmt_reset_hw(struct octeon_mgmt *p)
423{
424 union cvmx_mixx_ctl mix_ctl;
425 union cvmx_mixx_bist mix_bist;
426 union cvmx_agl_gmx_bist agl_gmx_bist;
427
428 mix_ctl.u64 = 0;
429 cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64);
430 do {
431 mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(p->port));
432 } while (mix_ctl.s.busy);
433 mix_ctl.s.reset = 1;
434 cvmx_write_csr(CVMX_MIXX_CTL(p->port), mix_ctl.u64);
435 cvmx_read_csr(CVMX_MIXX_CTL(p->port));
436 cvmx_wait(64);
437
438 mix_bist.u64 = cvmx_read_csr(CVMX_MIXX_BIST(p->port));
439 if (mix_bist.u64)
440 dev_warn(p->dev, "MIX failed BIST (0x%016llx)\n",
441 (unsigned long long)mix_bist.u64);
442
443 agl_gmx_bist.u64 = cvmx_read_csr(CVMX_AGL_GMX_BIST);
444 if (agl_gmx_bist.u64)
445 dev_warn(p->dev, "AGL failed BIST (0x%016llx)\n",
446 (unsigned long long)agl_gmx_bist.u64);
447}
448
449struct octeon_mgmt_cam_state {
450 u64 cam[6];
451 u64 cam_mask;
452 int cam_index;
453};
454
455static void octeon_mgmt_cam_state_add(struct octeon_mgmt_cam_state *cs,
456 unsigned char *addr)
457{
458 int i;
459
460 for (i = 0; i < 6; i++)
461 cs->cam[i] |= (u64)addr[i] << (8 * (cs->cam_index));
462 cs->cam_mask |= (1ULL << cs->cam_index);
463 cs->cam_index++;
464}
465
466static void octeon_mgmt_set_rx_filtering(struct net_device *netdev)
467{
468 struct octeon_mgmt *p = netdev_priv(netdev);
469 int port = p->port;
470 int i;
471 union cvmx_agl_gmx_rxx_adr_ctl adr_ctl;
472 union cvmx_agl_gmx_prtx_cfg agl_gmx_prtx;
473 unsigned long flags;
474 unsigned int prev_packet_enable;
475 unsigned int cam_mode = 1; /* 1 - Accept on CAM match */
476 unsigned int multicast_mode = 1; /* 1 - Reject all multicast. */
477 struct octeon_mgmt_cam_state cam_state;
478 struct dev_addr_list *list;
479 struct list_head *pos;
480 int available_cam_entries;
481
482 memset(&cam_state, 0, sizeof(cam_state));
483
484 if ((netdev->flags & IFF_PROMISC) || netdev->dev_addrs.count > 7) {
485 cam_mode = 0;
486 available_cam_entries = 8;
487 } else {
488 /*
489 * One CAM entry for the primary address, leaves seven
490 * for the secondary addresses.
491 */
492 available_cam_entries = 7 - netdev->dev_addrs.count;
493 }
494
495 if (netdev->flags & IFF_MULTICAST) {
496 if (cam_mode == 0 || (netdev->flags & IFF_ALLMULTI)
497 || netdev->mc_count > available_cam_entries)
498 multicast_mode = 2; /* 1 - Accept all multicast. */
499 else
500 multicast_mode = 0; /* 0 - Use CAM. */
501 }
502
503 if (cam_mode == 1) {
504 /* Add primary address. */
505 octeon_mgmt_cam_state_add(&cam_state, netdev->dev_addr);
506 list_for_each(pos, &netdev->dev_addrs.list) {
507 struct netdev_hw_addr *hw_addr;
508 hw_addr = list_entry(pos, struct netdev_hw_addr, list);
509 octeon_mgmt_cam_state_add(&cam_state, hw_addr->addr);
510 list = list->next;
511 }
512 }
513 if (multicast_mode == 0) {
514 i = netdev->mc_count;
515 list = netdev->mc_list;
516 while (i--) {
517 octeon_mgmt_cam_state_add(&cam_state, list->da_addr);
518 list = list->next;
519 }
520 }
521
522
523 spin_lock_irqsave(&p->lock, flags);
524
525 /* Disable packet I/O. */
526 agl_gmx_prtx.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
527 prev_packet_enable = agl_gmx_prtx.s.en;
528 agl_gmx_prtx.s.en = 0;
529 cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64);
530
531
532 adr_ctl.u64 = 0;
533 adr_ctl.s.cam_mode = cam_mode;
534 adr_ctl.s.mcst = multicast_mode;
535 adr_ctl.s.bcst = 1; /* Allow broadcast */
536
537 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CTL(port), adr_ctl.u64);
538
539 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM0(port), cam_state.cam[0]);
540 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM1(port), cam_state.cam[1]);
541 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM2(port), cam_state.cam[2]);
542 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM3(port), cam_state.cam[3]);
543 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM4(port), cam_state.cam[4]);
544 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM5(port), cam_state.cam[5]);
545 cvmx_write_csr(CVMX_AGL_GMX_RXX_ADR_CAM_EN(port), cam_state.cam_mask);
546
547 /* Restore packet I/O. */
548 agl_gmx_prtx.s.en = prev_packet_enable;
549 cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), agl_gmx_prtx.u64);
550
551 spin_unlock_irqrestore(&p->lock, flags);
552}
553
554static int octeon_mgmt_set_mac_address(struct net_device *netdev, void *addr)
555{
556 struct sockaddr *sa = addr;
557
558 if (!is_valid_ether_addr(sa->sa_data))
559 return -EADDRNOTAVAIL;
560
561 memcpy(netdev->dev_addr, sa->sa_data, ETH_ALEN);
562
563 octeon_mgmt_set_rx_filtering(netdev);
564
565 return 0;
566}
567
568static int octeon_mgmt_change_mtu(struct net_device *netdev, int new_mtu)
569{
570 struct octeon_mgmt *p = netdev_priv(netdev);
571 int port = p->port;
572 int size_without_fcs = new_mtu + OCTEON_MGMT_RX_HEADROOM;
573
574 /*
575 * Limit the MTU to make sure the ethernet packets are between
576 * 64 bytes and 16383 bytes.
577 */
578 if (size_without_fcs < 64 || size_without_fcs > 16383) {
579 dev_warn(p->dev, "MTU must be between %d and %d.\n",
580 64 - OCTEON_MGMT_RX_HEADROOM,
581 16383 - OCTEON_MGMT_RX_HEADROOM);
582 return -EINVAL;
583 }
584
585 netdev->mtu = new_mtu;
586
587 cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_MAX(port), size_without_fcs);
588 cvmx_write_csr(CVMX_AGL_GMX_RXX_JABBER(port),
589 (size_without_fcs + 7) & 0xfff8);
590
591 return 0;
592}
593
594static irqreturn_t octeon_mgmt_interrupt(int cpl, void *dev_id)
595{
596 struct net_device *netdev = dev_id;
597 struct octeon_mgmt *p = netdev_priv(netdev);
598 int port = p->port;
599 union cvmx_mixx_isr mixx_isr;
600
601 mixx_isr.u64 = cvmx_read_csr(CVMX_MIXX_ISR(port));
602
603 /* Clear any pending interrupts */
604 cvmx_write_csr(CVMX_MIXX_ISR(port),
605 cvmx_read_csr(CVMX_MIXX_ISR(port)));
606 cvmx_read_csr(CVMX_MIXX_ISR(port));
607
608 if (mixx_isr.s.irthresh) {
609 octeon_mgmt_disable_rx_irq(p);
610 napi_schedule(&p->napi);
611 }
612 if (mixx_isr.s.orthresh) {
613 octeon_mgmt_disable_tx_irq(p);
614 tasklet_schedule(&p->tx_clean_tasklet);
615 }
616
617 return IRQ_HANDLED;
618}
619
620static int octeon_mgmt_ioctl(struct net_device *netdev,
621 struct ifreq *rq, int cmd)
622{
623 struct octeon_mgmt *p = netdev_priv(netdev);
624
625 if (!netif_running(netdev))
626 return -EINVAL;
627
628 if (!p->phydev)
629 return -EINVAL;
630
631 return phy_mii_ioctl(p->phydev, if_mii(rq), cmd);
632}
633
634static void octeon_mgmt_adjust_link(struct net_device *netdev)
635{
636 struct octeon_mgmt *p = netdev_priv(netdev);
637 int port = p->port;
638 union cvmx_agl_gmx_prtx_cfg prtx_cfg;
639 unsigned long flags;
640 int link_changed = 0;
641
642 spin_lock_irqsave(&p->lock, flags);
643 if (p->phydev->link) {
644 if (!p->last_link)
645 link_changed = 1;
646 if (p->last_duplex != p->phydev->duplex) {
647 p->last_duplex = p->phydev->duplex;
648 prtx_cfg.u64 =
649 cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
650 prtx_cfg.s.duplex = p->phydev->duplex;
651 cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port),
652 prtx_cfg.u64);
653 }
654 } else {
655 if (p->last_link)
656 link_changed = -1;
657 }
658 p->last_link = p->phydev->link;
659 spin_unlock_irqrestore(&p->lock, flags);
660
661 if (link_changed != 0) {
662 if (link_changed > 0) {
663 netif_carrier_on(netdev);
664 pr_info("%s: Link is up - %d/%s\n", netdev->name,
665 p->phydev->speed,
666 DUPLEX_FULL == p->phydev->duplex ?
667 "Full" : "Half");
668 } else {
669 netif_carrier_off(netdev);
670 pr_info("%s: Link is down\n", netdev->name);
671 }
672 }
673}
674
675static int octeon_mgmt_init_phy(struct net_device *netdev)
676{
677 struct octeon_mgmt *p = netdev_priv(netdev);
678 char phy_id[20];
679
680 if (octeon_is_simulation()) {
681 /* No PHYs in the simulator. */
682 netif_carrier_on(netdev);
683 return 0;
684 }
685
686 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port);
687
688 p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0,
689 PHY_INTERFACE_MODE_MII);
690
691 if (IS_ERR(p->phydev)) {
692 p->phydev = NULL;
693 return -1;
694 }
695
696 phy_start_aneg(p->phydev);
697
698 return 0;
699}
700
701static int octeon_mgmt_open(struct net_device *netdev)
702{
703 struct octeon_mgmt *p = netdev_priv(netdev);
704 int port = p->port;
705 union cvmx_mixx_ctl mix_ctl;
706 union cvmx_agl_gmx_inf_mode agl_gmx_inf_mode;
707 union cvmx_mixx_oring1 oring1;
708 union cvmx_mixx_iring1 iring1;
709 union cvmx_agl_gmx_prtx_cfg prtx_cfg;
710 union cvmx_agl_gmx_rxx_frm_ctl rxx_frm_ctl;
711 union cvmx_mixx_irhwm mix_irhwm;
712 union cvmx_mixx_orhwm mix_orhwm;
713 union cvmx_mixx_intena mix_intena;
714 struct sockaddr sa;
715
716 /* Allocate ring buffers. */
717 p->tx_ring = kzalloc(ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE),
718 GFP_KERNEL);
719 if (!p->tx_ring)
720 return -ENOMEM;
721 p->tx_ring_handle =
722 dma_map_single(p->dev, p->tx_ring,
723 ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE),
724 DMA_BIDIRECTIONAL);
725 p->tx_next = 0;
726 p->tx_next_clean = 0;
727 p->tx_current_fill = 0;
728
729
730 p->rx_ring = kzalloc(ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE),
731 GFP_KERNEL);
732 if (!p->rx_ring)
733 goto err_nomem;
734 p->rx_ring_handle =
735 dma_map_single(p->dev, p->rx_ring,
736 ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE),
737 DMA_BIDIRECTIONAL);
738
739 p->rx_next = 0;
740 p->rx_next_fill = 0;
741 p->rx_current_fill = 0;
742
743 octeon_mgmt_reset_hw(p);
744
745 mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port));
746
747 /* Bring it out of reset if needed. */
748 if (mix_ctl.s.reset) {
749 mix_ctl.s.reset = 0;
750 cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64);
751 do {
752 mix_ctl.u64 = cvmx_read_csr(CVMX_MIXX_CTL(port));
753 } while (mix_ctl.s.reset);
754 }
755
756 agl_gmx_inf_mode.u64 = 0;
757 agl_gmx_inf_mode.s.en = 1;
758 cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64);
759
760 oring1.u64 = 0;
761 oring1.s.obase = p->tx_ring_handle >> 3;
762 oring1.s.osize = OCTEON_MGMT_TX_RING_SIZE;
763 cvmx_write_csr(CVMX_MIXX_ORING1(port), oring1.u64);
764
765 iring1.u64 = 0;
766 iring1.s.ibase = p->rx_ring_handle >> 3;
767 iring1.s.isize = OCTEON_MGMT_RX_RING_SIZE;
768 cvmx_write_csr(CVMX_MIXX_IRING1(port), iring1.u64);
769
770 /* Disable packet I/O. */
771 prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
772 prtx_cfg.s.en = 0;
773 cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64);
774
775 memcpy(sa.sa_data, netdev->dev_addr, ETH_ALEN);
776 octeon_mgmt_set_mac_address(netdev, &sa);
777
778 octeon_mgmt_change_mtu(netdev, netdev->mtu);
779
780 /*
781 * Enable the port HW. Packets are not allowed until
782 * cvmx_mgmt_port_enable() is called.
783 */
784 mix_ctl.u64 = 0;
785 mix_ctl.s.crc_strip = 1; /* Strip the ending CRC */
786 mix_ctl.s.en = 1; /* Enable the port */
787 mix_ctl.s.nbtarb = 0; /* Arbitration mode */
788 /* MII CB-request FIFO programmable high watermark */
789 mix_ctl.s.mrq_hwm = 1;
790 cvmx_write_csr(CVMX_MIXX_CTL(port), mix_ctl.u64);
791
792 if (OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
793 || OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X)) {
794 /*
795 * Force compensation values, as they are not
796 * determined properly by HW
797 */
798 union cvmx_agl_gmx_drv_ctl drv_ctl;
799
800 drv_ctl.u64 = cvmx_read_csr(CVMX_AGL_GMX_DRV_CTL);
801 if (port) {
802 drv_ctl.s.byp_en1 = 1;
803 drv_ctl.s.nctl1 = 6;
804 drv_ctl.s.pctl1 = 6;
805 } else {
806 drv_ctl.s.byp_en = 1;
807 drv_ctl.s.nctl = 6;
808 drv_ctl.s.pctl = 6;
809 }
810 cvmx_write_csr(CVMX_AGL_GMX_DRV_CTL, drv_ctl.u64);
811 }
812
813 octeon_mgmt_rx_fill_ring(netdev);
814
815 /* Clear statistics. */
816 /* Clear on read. */
817 cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_CTL(port), 1);
818 cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(port), 0);
819 cvmx_write_csr(CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(port), 0);
820
821 cvmx_write_csr(CVMX_AGL_GMX_TXX_STATS_CTL(port), 1);
822 cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT0(port), 0);
823 cvmx_write_csr(CVMX_AGL_GMX_TXX_STAT1(port), 0);
824
825 /* Clear any pending interrupts */
826 cvmx_write_csr(CVMX_MIXX_ISR(port), cvmx_read_csr(CVMX_MIXX_ISR(port)));
827
828 if (request_irq(p->irq, octeon_mgmt_interrupt, 0, netdev->name,
829 netdev)) {
830 dev_err(p->dev, "request_irq(%d) failed.\n", p->irq);
831 goto err_noirq;
832 }
833
834 /* Interrupt every single RX packet */
835 mix_irhwm.u64 = 0;
836 mix_irhwm.s.irhwm = 0;
837 cvmx_write_csr(CVMX_MIXX_IRHWM(port), mix_irhwm.u64);
838
839 /* Interrupt when we have 5 or more packets to clean. */
840 mix_orhwm.u64 = 0;
841 mix_orhwm.s.orhwm = 5;
842 cvmx_write_csr(CVMX_MIXX_ORHWM(port), mix_orhwm.u64);
843
844 /* Enable receive and transmit interrupts */
845 mix_intena.u64 = 0;
846 mix_intena.s.ithena = 1;
847 mix_intena.s.othena = 1;
848 cvmx_write_csr(CVMX_MIXX_INTENA(port), mix_intena.u64);
849
850
851 /* Enable packet I/O. */
852
853 rxx_frm_ctl.u64 = 0;
854 rxx_frm_ctl.s.pre_align = 1;
855 /*
856 * When set, disables the length check for non-min sized pkts
857 * with padding in the client data.
858 */
859 rxx_frm_ctl.s.pad_len = 1;
860 /* When set, disables the length check for VLAN pkts */
861 rxx_frm_ctl.s.vlan_len = 1;
862 /* When set, PREAMBLE checking is less strict */
863 rxx_frm_ctl.s.pre_free = 1;
864 /* Control Pause Frames can match station SMAC */
865 rxx_frm_ctl.s.ctl_smac = 0;
866 /* Control Pause Frames can match globally assign Multicast address */
867 rxx_frm_ctl.s.ctl_mcst = 1;
868 /* Forward pause information to TX block */
869 rxx_frm_ctl.s.ctl_bck = 1;
870 /* Drop Control Pause Frames */
871 rxx_frm_ctl.s.ctl_drp = 1;
872 /* Strip off the preamble */
873 rxx_frm_ctl.s.pre_strp = 1;
874 /*
875 * This port is configured to send PREAMBLE+SFD to begin every
876 * frame. GMX checks that the PREAMBLE is sent correctly.
877 */
878 rxx_frm_ctl.s.pre_chk = 1;
879 cvmx_write_csr(CVMX_AGL_GMX_RXX_FRM_CTL(port), rxx_frm_ctl.u64);
880
881 /* Enable the AGL block */
882 agl_gmx_inf_mode.u64 = 0;
883 agl_gmx_inf_mode.s.en = 1;
884 cvmx_write_csr(CVMX_AGL_GMX_INF_MODE, agl_gmx_inf_mode.u64);
885
886 /* Configure the port duplex and enables */
887 prtx_cfg.u64 = cvmx_read_csr(CVMX_AGL_GMX_PRTX_CFG(port));
888 prtx_cfg.s.tx_en = 1;
889 prtx_cfg.s.rx_en = 1;
890 prtx_cfg.s.en = 1;
891 p->last_duplex = 1;
892 prtx_cfg.s.duplex = p->last_duplex;
893 cvmx_write_csr(CVMX_AGL_GMX_PRTX_CFG(port), prtx_cfg.u64);
894
895 p->last_link = 0;
896 netif_carrier_off(netdev);
897
898 if (octeon_mgmt_init_phy(netdev)) {
899 dev_err(p->dev, "Cannot initialize PHY.\n");
900 goto err_noirq;
901 }
902
903 netif_wake_queue(netdev);
904 napi_enable(&p->napi);
905
906 return 0;
907err_noirq:
908 octeon_mgmt_reset_hw(p);
909 dma_unmap_single(p->dev, p->rx_ring_handle,
910 ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE),
911 DMA_BIDIRECTIONAL);
912 kfree(p->rx_ring);
913err_nomem:
914 dma_unmap_single(p->dev, p->tx_ring_handle,
915 ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE),
916 DMA_BIDIRECTIONAL);
917 kfree(p->tx_ring);
918 return -ENOMEM;
919}
920
921static int octeon_mgmt_stop(struct net_device *netdev)
922{
923 struct octeon_mgmt *p = netdev_priv(netdev);
924
925 napi_disable(&p->napi);
926 netif_stop_queue(netdev);
927
928 if (p->phydev)
929 phy_disconnect(p->phydev);
930
931 netif_carrier_off(netdev);
932
933 octeon_mgmt_reset_hw(p);
934
935
936 free_irq(p->irq, netdev);
937
938 /* dma_unmap is a nop on Octeon, so just free everything. */
939 skb_queue_purge(&p->tx_list);
940 skb_queue_purge(&p->rx_list);
941
942 dma_unmap_single(p->dev, p->rx_ring_handle,
943 ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE),
944 DMA_BIDIRECTIONAL);
945 kfree(p->rx_ring);
946
947 dma_unmap_single(p->dev, p->tx_ring_handle,
948 ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE),
949 DMA_BIDIRECTIONAL);
950 kfree(p->tx_ring);
951
952
953 return 0;
954}
955
956static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
957{
958 struct octeon_mgmt *p = netdev_priv(netdev);
959 int port = p->port;
960 union mgmt_port_ring_entry re;
961 unsigned long flags;
962
963 re.d64 = 0;
964 re.s.len = skb->len;
965 re.s.addr = dma_map_single(p->dev, skb->data,
966 skb->len,
967 DMA_TO_DEVICE);
968
969 spin_lock_irqsave(&p->tx_list.lock, flags);
970
971 if (unlikely(p->tx_current_fill >=
972 ring_max_fill(OCTEON_MGMT_TX_RING_SIZE))) {
973 spin_unlock_irqrestore(&p->tx_list.lock, flags);
974
975 dma_unmap_single(p->dev, re.s.addr, re.s.len,
976 DMA_TO_DEVICE);
977
978 netif_stop_queue(netdev);
979 return NETDEV_TX_BUSY;
980 }
981
982 __skb_queue_tail(&p->tx_list, skb);
983
984 /* Put it in the ring. */
985 p->tx_ring[p->tx_next] = re.d64;
986 p->tx_next = (p->tx_next + 1) % OCTEON_MGMT_TX_RING_SIZE;
987 p->tx_current_fill++;
988
989 spin_unlock_irqrestore(&p->tx_list.lock, flags);
990
991 dma_sync_single_for_device(p->dev, p->tx_ring_handle,
992 ring_size_to_bytes(OCTEON_MGMT_TX_RING_SIZE),
993 DMA_BIDIRECTIONAL);
994
995 netdev->stats.tx_packets++;
996 netdev->stats.tx_bytes += skb->len;
997
998 /* Ring the bell. */
999 cvmx_write_csr(CVMX_MIXX_ORING2(port), 1);
1000
1001 netdev->trans_start = jiffies;
1002 octeon_mgmt_clean_tx_buffers(p);
1003 octeon_mgmt_update_tx_stats(netdev);
1004 return NETDEV_TX_OK;
1005}
1006
1007#ifdef CONFIG_NET_POLL_CONTROLLER
1008static void octeon_mgmt_poll_controller(struct net_device *netdev)
1009{
1010 struct octeon_mgmt *p = netdev_priv(netdev);
1011
1012 octeon_mgmt_receive_packets(p, 16);
1013 octeon_mgmt_update_rx_stats(netdev);
1014 return;
1015}
1016#endif
1017
1018static void octeon_mgmt_get_drvinfo(struct net_device *netdev,
1019 struct ethtool_drvinfo *info)
1020{
1021 strncpy(info->driver, DRV_NAME, sizeof(info->driver));
1022 strncpy(info->version, DRV_VERSION, sizeof(info->version));
1023 strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
1024 strncpy(info->bus_info, "N/A", sizeof(info->bus_info));
1025 info->n_stats = 0;
1026 info->testinfo_len = 0;
1027 info->regdump_len = 0;
1028 info->eedump_len = 0;
1029}
1030
1031static int octeon_mgmt_get_settings(struct net_device *netdev,
1032 struct ethtool_cmd *cmd)
1033{
1034 struct octeon_mgmt *p = netdev_priv(netdev);
1035
1036 if (p->phydev)
1037 return phy_ethtool_gset(p->phydev, cmd);
1038
1039 return -EINVAL;
1040}
1041
1042static int octeon_mgmt_set_settings(struct net_device *netdev,
1043 struct ethtool_cmd *cmd)
1044{
1045 struct octeon_mgmt *p = netdev_priv(netdev);
1046
1047 if (!capable(CAP_NET_ADMIN))
1048 return -EPERM;
1049
1050 if (p->phydev)
1051 return phy_ethtool_sset(p->phydev, cmd);
1052
1053 return -EINVAL;
1054}
1055
1056static const struct ethtool_ops octeon_mgmt_ethtool_ops = {
1057 .get_drvinfo = octeon_mgmt_get_drvinfo,
1058 .get_link = ethtool_op_get_link,
1059 .get_settings = octeon_mgmt_get_settings,
1060 .set_settings = octeon_mgmt_set_settings
1061};
1062
1063static const struct net_device_ops octeon_mgmt_ops = {
1064 .ndo_open = octeon_mgmt_open,
1065 .ndo_stop = octeon_mgmt_stop,
1066 .ndo_start_xmit = octeon_mgmt_xmit,
1067 .ndo_set_rx_mode = octeon_mgmt_set_rx_filtering,
1068 .ndo_set_multicast_list = octeon_mgmt_set_rx_filtering,
1069 .ndo_set_mac_address = octeon_mgmt_set_mac_address,
1070 .ndo_do_ioctl = octeon_mgmt_ioctl,
1071 .ndo_change_mtu = octeon_mgmt_change_mtu,
1072#ifdef CONFIG_NET_POLL_CONTROLLER
1073 .ndo_poll_controller = octeon_mgmt_poll_controller,
1074#endif
1075};
1076
1077static int __init octeon_mgmt_probe(struct platform_device *pdev)
1078{
1079 struct resource *res_irq;
1080 struct net_device *netdev;
1081 struct octeon_mgmt *p;
1082 int i;
1083
1084 netdev = alloc_etherdev(sizeof(struct octeon_mgmt));
1085 if (netdev == NULL)
1086 return -ENOMEM;
1087
1088 dev_set_drvdata(&pdev->dev, netdev);
1089 p = netdev_priv(netdev);
1090 netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll,
1091 OCTEON_MGMT_NAPI_WEIGHT);
1092
1093 p->netdev = netdev;
1094 p->dev = &pdev->dev;
1095
1096 p->port = pdev->id;
1097 snprintf(netdev->name, IFNAMSIZ, "mgmt%d", p->port);
1098
1099 res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1100 if (!res_irq)
1101 goto err;
1102
1103 p->irq = res_irq->start;
1104 spin_lock_init(&p->lock);
1105
1106 skb_queue_head_init(&p->tx_list);
1107 skb_queue_head_init(&p->rx_list);
1108 tasklet_init(&p->tx_clean_tasklet,
1109 octeon_mgmt_clean_tx_tasklet, (unsigned long)p);
1110
1111 netdev->netdev_ops = &octeon_mgmt_ops;
1112 netdev->ethtool_ops = &octeon_mgmt_ethtool_ops;
1113
1114
1115 /* The mgmt ports get the first N MACs. */
1116 for (i = 0; i < 6; i++)
1117 netdev->dev_addr[i] = octeon_bootinfo->mac_addr_base[i];
1118 netdev->dev_addr[5] += p->port;
1119
1120 if (p->port >= octeon_bootinfo->mac_addr_count)
1121 dev_err(&pdev->dev,
1122 "Error %s: Using MAC outside of the assigned range: "
1123 "%02x:%02x:%02x:%02x:%02x:%02x\n", netdev->name,
1124 netdev->dev_addr[0], netdev->dev_addr[1],
1125 netdev->dev_addr[2], netdev->dev_addr[3],
1126 netdev->dev_addr[4], netdev->dev_addr[5]);
1127
1128 if (register_netdev(netdev))
1129 goto err;
1130
1131 dev_info(&pdev->dev, "Version " DRV_VERSION "\n");
1132 return 0;
1133err:
1134 free_netdev(netdev);
1135 return -ENOENT;
1136}
1137
1138static int __exit octeon_mgmt_remove(struct platform_device *pdev)
1139{
1140 struct net_device *netdev = dev_get_drvdata(&pdev->dev);
1141
1142 unregister_netdev(netdev);
1143 free_netdev(netdev);
1144 return 0;
1145}
1146
1147static struct platform_driver octeon_mgmt_driver = {
1148 .driver = {
1149 .name = "octeon_mgmt",
1150 .owner = THIS_MODULE,
1151 },
1152 .probe = octeon_mgmt_probe,
1153 .remove = __exit_p(octeon_mgmt_remove),
1154};
1155
1156extern void octeon_mdiobus_force_mod_depencency(void);
1157
1158static int __init octeon_mgmt_mod_init(void)
1159{
1160 /* Force our mdiobus driver module to be loaded first. */
1161 octeon_mdiobus_force_mod_depencency();
1162 return platform_driver_register(&octeon_mgmt_driver);
1163}
1164
1165static void __exit octeon_mgmt_mod_exit(void)
1166{
1167 platform_driver_unregister(&octeon_mgmt_driver);
1168}
1169
1170module_init(octeon_mgmt_mod_init);
1171module_exit(octeon_mgmt_mod_exit);
1172
1173MODULE_DESCRIPTION(DRV_DESCRIPTION);
1174MODULE_AUTHOR("David Daney");
1175MODULE_LICENSE("GPL");
1176MODULE_VERSION(DRV_VERSION);
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 8a5ae3b182ed..12e3233868e9 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -1402,7 +1402,6 @@ static void BuildLAF(int *ladrf, int *adr)
1402 for (i = 0; i < 8; i++) 1402 for (i = 0; i < 8; i++)
1403 printk(KERN_CONT " %02X", ladrf[i]); 1403 printk(KERN_CONT " %02X", ladrf[i]);
1404 printk(KERN_CONT "\n"); 1404 printk(KERN_CONT "\n");
1405 }
1406#endif 1405#endif
1407} /* BuildLAF */ 1406} /* BuildLAF */
1408 1407
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 92ed3fbf89a5..776cad2f5715 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1741,7 +1741,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1741 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), 1741 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"),
1742 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), 1742 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"),
1743 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"), 1743 PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"),
1744 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), 1744 PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "cis/PE520.cis"),
1745 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"), 1745 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "cis/NE2K.cis"),
1746 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"), 1746 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "cis/PE-200.cis"),
1747 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"), 1747 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "cis/tamarack.cis"),
@@ -1754,7 +1754,7 @@ MODULE_DEVICE_TABLE(pcmcia, pcnet_ids);
1754MODULE_FIRMWARE("cis/PCMLM28.cis"); 1754MODULE_FIRMWARE("cis/PCMLM28.cis");
1755MODULE_FIRMWARE("cis/DP83903.cis"); 1755MODULE_FIRMWARE("cis/DP83903.cis");
1756MODULE_FIRMWARE("cis/LA-PCM.cis"); 1756MODULE_FIRMWARE("cis/LA-PCM.cis");
1757MODULE_FIRMWARE("PE520.cis"); 1757MODULE_FIRMWARE("cis/PE520.cis");
1758MODULE_FIRMWARE("cis/NE2K.cis"); 1758MODULE_FIRMWARE("cis/NE2K.cis");
1759MODULE_FIRMWARE("cis/PE-200.cis"); 1759MODULE_FIRMWARE("cis/PE-200.cis");
1760MODULE_FIRMWARE("cis/tamarack.cis"); 1760MODULE_FIRMWARE("cis/tamarack.cis");
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index dcc67a35e8f2..e154677ff706 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -45,6 +45,7 @@ static const char *const version =
45#include <linux/crc32.h> 45#include <linux/crc32.h>
46#include <linux/netdevice.h> 46#include <linux/netdevice.h>
47#include <linux/etherdevice.h> 47#include <linux/etherdevice.h>
48#include <linux/if_ether.h>
48#include <linux/skbuff.h> 49#include <linux/skbuff.h>
49#include <linux/spinlock.h> 50#include <linux/spinlock.h>
50#include <linux/moduleparam.h> 51#include <linux/moduleparam.h>
@@ -1765,7 +1766,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1765 1766
1766 /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ 1767 /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */
1767 if (!is_valid_ether_addr(dev->perm_addr)) 1768 if (!is_valid_ether_addr(dev->perm_addr))
1768 memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); 1769 memset(dev->dev_addr, 0, ETH_ALEN);
1769 1770
1770 if (pcnet32_debug & NETIF_MSG_PROBE) { 1771 if (pcnet32_debug & NETIF_MSG_PROBE) {
1771 printk(" %pM", dev->dev_addr); 1772 printk(" %pM", dev->dev_addr);
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index d5d8e1c5bc91..fc5938ba3d78 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -115,4 +115,15 @@ config MDIO_GPIO
115 To compile this driver as a module, choose M here: the module 115 To compile this driver as a module, choose M here: the module
116 will be called mdio-gpio. 116 will be called mdio-gpio.
117 117
118config MDIO_OCTEON
119 tristate "Support for MDIO buses on Octeon SOCs"
120 depends on CPU_CAVIUM_OCTEON
121 default y
122 help
123
124 This module provides a driver for the Octeon MDIO busses.
125 It is required by the Octeon Ethernet device drivers.
126
127 If in doubt, say Y.
128
118endif # PHYLIB 129endif # PHYLIB
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index edfaac48cbd5..1342585af381 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o
20obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o 20obj-$(CONFIG_MDIO_GPIO) += mdio-gpio.o
21obj-$(CONFIG_NATIONAL_PHY) += national.o 21obj-$(CONFIG_NATIONAL_PHY) += national.o
22obj-$(CONFIG_STE10XP) += ste10Xp.o 22obj-$(CONFIG_STE10XP) += ste10Xp.o
23obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index f63c96a4ecb4..33c4b12a63ba 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -326,12 +326,13 @@ error:
326 326
327static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev) 327static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
328{ 328{
329 u32 val, orig; 329 u32 orig;
330 int val;
330 bool clk125en = true; 331 bool clk125en = true;
331 332
332 /* Abort if we are using an untested phy. */ 333 /* Abort if we are using an untested phy. */
333 if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 || 334 if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
334 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 || 335 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
335 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M) 336 BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M)
336 return; 337 return;
337 338
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c
new file mode 100644
index 000000000000..61a4461cbda5
--- /dev/null
+++ b/drivers/net/phy/mdio-octeon.c
@@ -0,0 +1,180 @@
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) 2009 Cavium Networks
7 */
8
9#include <linux/init.h>
10#include <linux/module.h>
11#include <linux/platform_device.h>
12#include <linux/phy.h>
13
14#include <asm/octeon/octeon.h>
15#include <asm/octeon/cvmx-smix-defs.h>
16
17#define DRV_VERSION "1.0"
18#define DRV_DESCRIPTION "Cavium Networks Octeon SMI/MDIO driver"
19
20struct octeon_mdiobus {
21 struct mii_bus *mii_bus;
22 int unit;
23 int phy_irq[PHY_MAX_ADDR];
24};
25
26static int octeon_mdiobus_read(struct mii_bus *bus, int phy_id, int regnum)
27{
28 struct octeon_mdiobus *p = bus->priv;
29 union cvmx_smix_cmd smi_cmd;
30 union cvmx_smix_rd_dat smi_rd;
31 int timeout = 1000;
32
33 smi_cmd.u64 = 0;
34 smi_cmd.s.phy_op = 1; /* MDIO_CLAUSE_22_READ */
35 smi_cmd.s.phy_adr = phy_id;
36 smi_cmd.s.reg_adr = regnum;
37 cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64);
38
39 do {
40 /*
41 * Wait 1000 clocks so we don't saturate the RSL bus
42 * doing reads.
43 */
44 cvmx_wait(1000);
45 smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(p->unit));
46 } while (smi_rd.s.pending && --timeout);
47
48 if (smi_rd.s.val)
49 return smi_rd.s.dat;
50 else
51 return -EIO;
52}
53
54static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
55 int regnum, u16 val)
56{
57 struct octeon_mdiobus *p = bus->priv;
58 union cvmx_smix_cmd smi_cmd;
59 union cvmx_smix_wr_dat smi_wr;
60 int timeout = 1000;
61
62 smi_wr.u64 = 0;
63 smi_wr.s.dat = val;
64 cvmx_write_csr(CVMX_SMIX_WR_DAT(p->unit), smi_wr.u64);
65
66 smi_cmd.u64 = 0;
67 smi_cmd.s.phy_op = 0; /* MDIO_CLAUSE_22_WRITE */
68 smi_cmd.s.phy_adr = phy_id;
69 smi_cmd.s.reg_adr = regnum;
70 cvmx_write_csr(CVMX_SMIX_CMD(p->unit), smi_cmd.u64);
71
72 do {
73 /*
74 * Wait 1000 clocks so we don't saturate the RSL bus
75 * doing reads.
76 */
77 cvmx_wait(1000);
78 smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(p->unit));
79 } while (smi_wr.s.pending && --timeout);
80
81 if (timeout <= 0)
82 return -EIO;
83
84 return 0;
85}
86
87static int __init octeon_mdiobus_probe(struct platform_device *pdev)
88{
89 struct octeon_mdiobus *bus;
90 int i;
91 int err = -ENOENT;
92
93 bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
94 if (!bus)
95 return -ENOMEM;
96
97 /* The platform_device id is our unit number. */
98 bus->unit = pdev->id;
99
100 bus->mii_bus = mdiobus_alloc();
101
102 if (!bus->mii_bus)
103 goto err;
104
105 /*
106 * Standard Octeon evaluation boards don't support phy
107 * interrupts, we need to poll.
108 */
109 for (i = 0; i < PHY_MAX_ADDR; i++)
110 bus->phy_irq[i] = PHY_POLL;
111
112 bus->mii_bus->priv = bus;
113 bus->mii_bus->irq = bus->phy_irq;
114 bus->mii_bus->name = "mdio-octeon";
115 snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%x", bus->unit);
116 bus->mii_bus->parent = &pdev->dev;
117
118 bus->mii_bus->read = octeon_mdiobus_read;
119 bus->mii_bus->write = octeon_mdiobus_write;
120
121 dev_set_drvdata(&pdev->dev, bus);
122
123 err = mdiobus_register(bus->mii_bus);
124 if (err)
125 goto err_register;
126
127 dev_info(&pdev->dev, "Version " DRV_VERSION "\n");
128
129 return 0;
130err_register:
131 mdiobus_free(bus->mii_bus);
132
133err:
134 devm_kfree(&pdev->dev, bus);
135 return err;
136}
137
138static int __exit octeon_mdiobus_remove(struct platform_device *pdev)
139{
140 struct octeon_mdiobus *bus;
141
142 bus = dev_get_drvdata(&pdev->dev);
143
144 mdiobus_unregister(bus->mii_bus);
145 mdiobus_free(bus->mii_bus);
146 return 0;
147}
148
149static struct platform_driver octeon_mdiobus_driver = {
150 .driver = {
151 .name = "mdio-octeon",
152 .owner = THIS_MODULE,
153 },
154 .probe = octeon_mdiobus_probe,
155 .remove = __exit_p(octeon_mdiobus_remove),
156};
157
158void octeon_mdiobus_force_mod_depencency(void)
159{
160 /* Let ethernet drivers force us to be loaded. */
161}
162EXPORT_SYMBOL(octeon_mdiobus_force_mod_depencency);
163
164static int __init octeon_mdiobus_mod_init(void)
165{
166 return platform_driver_register(&octeon_mdiobus_driver);
167}
168
169static void __exit octeon_mdiobus_mod_exit(void)
170{
171 platform_driver_unregister(&octeon_mdiobus_driver);
172}
173
174module_init(octeon_mdiobus_mod_init);
175module_exit(octeon_mdiobus_mod_exit);
176
177MODULE_DESCRIPTION(DRV_DESCRIPTION);
178MODULE_VERSION(DRV_VERSION);
179MODULE_AUTHOR("David Daney");
180MODULE_LICENSE("GPL");
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index bd4e8d72dc08..e17b70291bbc 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -264,6 +264,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
264 (phydev->phy_id & phydrv->phy_id_mask)); 264 (phydev->phy_id & phydrv->phy_id_mask));
265} 265}
266 266
267#ifdef CONFIG_PM
268
267static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) 269static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
268{ 270{
269 struct device_driver *drv = phydev->dev.driver; 271 struct device_driver *drv = phydev->dev.driver;
@@ -295,34 +297,88 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
295 return true; 297 return true;
296} 298}
297 299
298/* Suspend and resume. Copied from platform_suspend and 300static int mdio_bus_suspend(struct device *dev)
299 * platform_resume
300 */
301static int mdio_bus_suspend(struct device * dev, pm_message_t state)
302{ 301{
303 struct phy_driver *phydrv = to_phy_driver(dev->driver); 302 struct phy_driver *phydrv = to_phy_driver(dev->driver);
304 struct phy_device *phydev = to_phy_device(dev); 303 struct phy_device *phydev = to_phy_device(dev);
305 304
305 /*
306 * We must stop the state machine manually, otherwise it stops out of
307 * control, possibly with the phydev->lock held. Upon resume, netdev
308 * may call phy routines that try to grab the same lock, and that may
309 * lead to a deadlock.
310 */
311 if (phydev->attached_dev)
312 phy_stop_machine(phydev);
313
306 if (!mdio_bus_phy_may_suspend(phydev)) 314 if (!mdio_bus_phy_may_suspend(phydev))
307 return 0; 315 return 0;
316
308 return phydrv->suspend(phydev); 317 return phydrv->suspend(phydev);
309} 318}
310 319
311static int mdio_bus_resume(struct device * dev) 320static int mdio_bus_resume(struct device *dev)
312{ 321{
313 struct phy_driver *phydrv = to_phy_driver(dev->driver); 322 struct phy_driver *phydrv = to_phy_driver(dev->driver);
314 struct phy_device *phydev = to_phy_device(dev); 323 struct phy_device *phydev = to_phy_device(dev);
324 int ret;
315 325
316 if (!mdio_bus_phy_may_suspend(phydev)) 326 if (!mdio_bus_phy_may_suspend(phydev))
327 goto no_resume;
328
329 ret = phydrv->resume(phydev);
330 if (ret < 0)
331 return ret;
332
333no_resume:
334 if (phydev->attached_dev)
335 phy_start_machine(phydev, NULL);
336
337 return 0;
338}
339
340static int mdio_bus_restore(struct device *dev)
341{
342 struct phy_device *phydev = to_phy_device(dev);
343 struct net_device *netdev = phydev->attached_dev;
344 int ret;
345
346 if (!netdev)
317 return 0; 347 return 0;
318 return phydrv->resume(phydev); 348
349 ret = phy_init_hw(phydev);
350 if (ret < 0)
351 return ret;
352
353 /* The PHY needs to renegotiate. */
354 phydev->link = 0;
355 phydev->state = PHY_UP;
356
357 phy_start_machine(phydev, NULL);
358
359 return 0;
319} 360}
320 361
362static struct dev_pm_ops mdio_bus_pm_ops = {
363 .suspend = mdio_bus_suspend,
364 .resume = mdio_bus_resume,
365 .freeze = mdio_bus_suspend,
366 .thaw = mdio_bus_resume,
367 .restore = mdio_bus_restore,
368};
369
370#define MDIO_BUS_PM_OPS (&mdio_bus_pm_ops)
371
372#else
373
374#define MDIO_BUS_PM_OPS NULL
375
376#endif /* CONFIG_PM */
377
321struct bus_type mdio_bus_type = { 378struct bus_type mdio_bus_type = {
322 .name = "mdio_bus", 379 .name = "mdio_bus",
323 .match = mdio_bus_match, 380 .match = mdio_bus_match,
324 .suspend = mdio_bus_suspend, 381 .pm = MDIO_BUS_PM_OPS,
325 .resume = mdio_bus_resume,
326}; 382};
327EXPORT_SYMBOL(mdio_bus_type); 383EXPORT_SYMBOL(mdio_bus_type);
328 384
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b10fedd82143..8212b2b93422 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -378,6 +378,20 @@ void phy_disconnect(struct phy_device *phydev)
378} 378}
379EXPORT_SYMBOL(phy_disconnect); 379EXPORT_SYMBOL(phy_disconnect);
380 380
381int phy_init_hw(struct phy_device *phydev)
382{
383 int ret;
384
385 if (!phydev->drv || !phydev->drv->config_init)
386 return 0;
387
388 ret = phy_scan_fixups(phydev);
389 if (ret < 0)
390 return ret;
391
392 return phydev->drv->config_init(phydev);
393}
394
381/** 395/**
382 * phy_attach_direct - attach a network device to a given PHY device pointer 396 * phy_attach_direct - attach a network device to a given PHY device pointer
383 * @dev: network device to attach 397 * @dev: network device to attach
@@ -425,21 +439,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
425 /* Do initial configuration here, now that 439 /* Do initial configuration here, now that
426 * we have certain key parameters 440 * we have certain key parameters
427 * (dev_flags and interface) */ 441 * (dev_flags and interface) */
428 if (phydev->drv->config_init) { 442 return phy_init_hw(phydev);
429 int err;
430
431 err = phy_scan_fixups(phydev);
432
433 if (err < 0)
434 return err;
435
436 err = phydev->drv->config_init(phydev);
437
438 if (err < 0)
439 return err;
440 }
441
442 return 0;
443} 443}
444EXPORT_SYMBOL(phy_attach_direct); 444EXPORT_SYMBOL(phy_attach_direct);
445 445
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 20a71749154a..1c257098d0a6 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -1293,7 +1293,7 @@ static void rr_dump(struct net_device *dev)
1293 1293
1294 printk("Error code 0x%x\n", readl(&regs->Fail1)); 1294 printk("Error code 0x%x\n", readl(&regs->Fail1));
1295 1295
1296 index = (((readl(&regs->EvtPrd) >> 8) & 0xff ) - 1) % EVT_RING_ENTRIES; 1296 index = (((readl(&regs->EvtPrd) >> 8) & 0xff) - 1) % TX_RING_ENTRIES;
1297 cons = rrpriv->dirty_tx; 1297 cons = rrpriv->dirty_tx;
1298 printk("TX ring index %i, TX consumer %i\n", 1298 printk("TX ring index %i, TX consumer %i\n",
1299 index, cons); 1299 index, cons);
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index f983e3b507cc..103e8b0e2a0d 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -741,14 +741,14 @@ static int efx_probe_port(struct efx_nic *efx)
741 741
742 EFX_LOG(efx, "create port\n"); 742 EFX_LOG(efx, "create port\n");
743 743
744 if (phy_flash_cfg)
745 efx->phy_mode = PHY_MODE_SPECIAL;
746
744 /* Connect up MAC/PHY operations table */ 747 /* Connect up MAC/PHY operations table */
745 rc = efx->type->probe_port(efx); 748 rc = efx->type->probe_port(efx);
746 if (rc) 749 if (rc)
747 goto err; 750 goto err;
748 751
749 if (phy_flash_cfg)
750 efx->phy_mode = PHY_MODE_SPECIAL;
751
752 /* Sanity check MAC address */ 752 /* Sanity check MAC address */
753 if (is_valid_ether_addr(efx->mac_address)) { 753 if (is_valid_ether_addr(efx->mac_address)) {
754 memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); 754 memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN);
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 17afcd26e870..9d009c46e962 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -925,6 +925,7 @@ static int falcon_probe_port(struct efx_nic *efx)
925 925
926static void falcon_remove_port(struct efx_nic *efx) 926static void falcon_remove_port(struct efx_nic *efx)
927{ 927{
928 efx->phy_op->remove(efx);
928 efx_nic_free_buffer(efx, &efx->stats_buffer); 929 efx_nic_free_buffer(efx, &efx->stats_buffer);
929} 930}
930 931
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index 3da933f8f079..8ccab2c67a20 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -111,16 +111,12 @@ static void falcon_mask_status_intr(struct efx_nic *efx, bool enable)
111 efx_writeo(efx, &reg, FR_AB_XM_MGT_INT_MASK); 111 efx_writeo(efx, &reg, FR_AB_XM_MGT_INT_MASK);
112} 112}
113 113
114/* Get status of XAUI link */ 114static bool falcon_xgxs_link_ok(struct efx_nic *efx)
115static bool falcon_xaui_link_ok(struct efx_nic *efx)
116{ 115{
117 efx_oword_t reg; 116 efx_oword_t reg;
118 bool align_done, link_ok = false; 117 bool align_done, link_ok = false;
119 int sync_status; 118 int sync_status;
120 119
121 if (LOOPBACK_INTERNAL(efx))
122 return true;
123
124 /* Read link status */ 120 /* Read link status */
125 efx_reado(efx, &reg, FR_AB_XX_CORE_STAT); 121 efx_reado(efx, &reg, FR_AB_XX_CORE_STAT);
126 122
@@ -135,14 +131,24 @@ static bool falcon_xaui_link_ok(struct efx_nic *efx)
135 EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES); 131 EFX_SET_OWORD_FIELD(reg, FRF_AB_XX_DISPERR, FFE_AB_XX_STAT_ALL_LANES);
136 efx_writeo(efx, &reg, FR_AB_XX_CORE_STAT); 132 efx_writeo(efx, &reg, FR_AB_XX_CORE_STAT);
137 133
138 /* If the link is up, then check the phy side of the xaui link */
139 if (efx->link_state.up && link_ok)
140 if (efx->mdio.mmds & (1 << MDIO_MMD_PHYXS))
141 link_ok = efx_mdio_phyxgxs_lane_sync(efx);
142
143 return link_ok; 134 return link_ok;
144} 135}
145 136
137static bool falcon_xmac_link_ok(struct efx_nic *efx)
138{
139 /*
140 * Check MAC's XGXS link status except when using XGMII loopback
141 * which bypasses the XGXS block.
142 * If possible, check PHY's XGXS link status except when using
143 * MAC loopback.
144 */
145 return (efx->loopback_mode == LOOPBACK_XGMII ||
146 falcon_xgxs_link_ok(efx)) &&
147 (!(efx->mdio.mmds & (1 << MDIO_MMD_PHYXS)) ||
148 LOOPBACK_INTERNAL(efx) ||
149 efx_mdio_phyxgxs_lane_sync(efx));
150}
151
146void falcon_reconfigure_xmac_core(struct efx_nic *efx) 152void falcon_reconfigure_xmac_core(struct efx_nic *efx)
147{ 153{
148 unsigned int max_frame_len; 154 unsigned int max_frame_len;
@@ -245,9 +251,9 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
245 251
246 252
247/* Try to bring up the Falcon side of the Falcon-Phy XAUI link */ 253/* Try to bring up the Falcon side of the Falcon-Phy XAUI link */
248static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries) 254static bool falcon_xmac_link_ok_retry(struct efx_nic *efx, int tries)
249{ 255{
250 bool mac_up = falcon_xaui_link_ok(efx); 256 bool mac_up = falcon_xmac_link_ok(efx);
251 257
252 if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS || 258 if (LOOPBACK_MASK(efx) & LOOPBACKS_EXTERNAL(efx) & LOOPBACKS_WS ||
253 efx_phy_mode_disabled(efx->phy_mode)) 259 efx_phy_mode_disabled(efx->phy_mode))
@@ -261,7 +267,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries)
261 falcon_reset_xaui(efx); 267 falcon_reset_xaui(efx);
262 udelay(200); 268 udelay(200);
263 269
264 mac_up = falcon_xaui_link_ok(efx); 270 mac_up = falcon_xmac_link_ok(efx);
265 --tries; 271 --tries;
266 } 272 }
267 273
@@ -272,7 +278,7 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx, int tries)
272 278
273static bool falcon_xmac_check_fault(struct efx_nic *efx) 279static bool falcon_xmac_check_fault(struct efx_nic *efx)
274{ 280{
275 return !falcon_check_xaui_link_up(efx, 5); 281 return !falcon_xmac_link_ok_retry(efx, 5);
276} 282}
277 283
278static int falcon_reconfigure_xmac(struct efx_nic *efx) 284static int falcon_reconfigure_xmac(struct efx_nic *efx)
@@ -284,7 +290,7 @@ static int falcon_reconfigure_xmac(struct efx_nic *efx)
284 290
285 falcon_reconfigure_mac_wrapper(efx); 291 falcon_reconfigure_mac_wrapper(efx);
286 292
287 efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 5); 293 efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 5);
288 falcon_mask_status_intr(efx, true); 294 falcon_mask_status_intr(efx, true);
289 295
290 return 0; 296 return 0;
@@ -357,7 +363,7 @@ void falcon_poll_xmac(struct efx_nic *efx)
357 return; 363 return;
358 364
359 falcon_mask_status_intr(efx, false); 365 falcon_mask_status_intr(efx, false);
360 efx->xmac_poll_required = !falcon_check_xaui_link_up(efx, 1); 366 efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
361 falcon_mask_status_intr(efx, true); 367 falcon_mask_status_intr(efx, true);
362} 368}
363 369
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c
index 0e1bcc5a0d52..eb694af7a473 100644
--- a/drivers/net/sfc/mcdi_phy.c
+++ b/drivers/net/sfc/mcdi_phy.c
@@ -304,31 +304,47 @@ static u32 mcdi_to_ethtool_media(u32 media)
304 304
305static int efx_mcdi_phy_probe(struct efx_nic *efx) 305static int efx_mcdi_phy_probe(struct efx_nic *efx)
306{ 306{
307 struct efx_mcdi_phy_cfg *phy_cfg; 307 struct efx_mcdi_phy_cfg *phy_data;
308 u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
309 u32 caps;
308 int rc; 310 int rc;
309 311
310 /* TODO: Move phy_data initialisation to 312 /* Initialise and populate phy_data */
311 * phy_op->probe/remove, rather than init/fini */ 313 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
312 phy_cfg = kzalloc(sizeof(*phy_cfg), GFP_KERNEL); 314 if (phy_data == NULL)
313 if (phy_cfg == NULL) { 315 return -ENOMEM;
314 rc = -ENOMEM; 316
315 goto fail_alloc; 317 rc = efx_mcdi_get_phy_cfg(efx, phy_data);
316 }
317 rc = efx_mcdi_get_phy_cfg(efx, phy_cfg);
318 if (rc != 0) 318 if (rc != 0)
319 goto fail; 319 goto fail;
320 320
321 efx->phy_type = phy_cfg->type; 321 /* Read initial link advertisement */
322 BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0);
323 rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
324 outbuf, sizeof(outbuf), NULL);
325 if (rc)
326 goto fail;
327
328 /* Fill out nic state */
329 efx->phy_data = phy_data;
330 efx->phy_type = phy_data->type;
322 331
323 efx->mdio_bus = phy_cfg->channel; 332 efx->mdio_bus = phy_data->channel;
324 efx->mdio.prtad = phy_cfg->port; 333 efx->mdio.prtad = phy_data->port;
325 efx->mdio.mmds = phy_cfg->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22); 334 efx->mdio.mmds = phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22);
326 efx->mdio.mode_support = 0; 335 efx->mdio.mode_support = 0;
327 if (phy_cfg->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22)) 336 if (phy_data->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22))
328 efx->mdio.mode_support |= MDIO_SUPPORTS_C22; 337 efx->mdio.mode_support |= MDIO_SUPPORTS_C22;
329 if (phy_cfg->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22)) 338 if (phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22))
330 efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; 339 efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
331 340
341 caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP);
342 if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN))
343 efx->link_advertising =
344 mcdi_to_ethtool_cap(phy_data->media, caps);
345 else
346 phy_data->forced_cap = caps;
347
332 /* Assert that we can map efx -> mcdi loopback modes */ 348 /* Assert that we can map efx -> mcdi loopback modes */
333 BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE); 349 BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE);
334 BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA); 350 BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA);
@@ -365,46 +381,6 @@ static int efx_mcdi_phy_probe(struct efx_nic *efx)
365 * but by convention we don't */ 381 * but by convention we don't */
366 efx->loopback_modes &= ~(1 << LOOPBACK_NONE); 382 efx->loopback_modes &= ~(1 << LOOPBACK_NONE);
367 383
368 kfree(phy_cfg);
369
370 return 0;
371
372fail:
373 kfree(phy_cfg);
374fail_alloc:
375 return rc;
376}
377
378static int efx_mcdi_phy_init(struct efx_nic *efx)
379{
380 struct efx_mcdi_phy_cfg *phy_data;
381 u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
382 u32 caps;
383 int rc;
384
385 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
386 if (phy_data == NULL)
387 return -ENOMEM;
388
389 rc = efx_mcdi_get_phy_cfg(efx, phy_data);
390 if (rc != 0)
391 goto fail;
392
393 efx->phy_data = phy_data;
394
395 BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0);
396 rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
397 outbuf, sizeof(outbuf), NULL);
398 if (rc)
399 goto fail;
400
401 caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP);
402 if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN))
403 efx->link_advertising =
404 mcdi_to_ethtool_cap(phy_data->media, caps);
405 else
406 phy_data->forced_cap = caps;
407
408 return 0; 384 return 0;
409 385
410fail: 386fail:
@@ -504,7 +480,7 @@ static bool efx_mcdi_phy_poll(struct efx_nic *efx)
504 return !efx_link_state_equal(&efx->link_state, &old_state); 480 return !efx_link_state_equal(&efx->link_state, &old_state);
505} 481}
506 482
507static void efx_mcdi_phy_fini(struct efx_nic *efx) 483static void efx_mcdi_phy_remove(struct efx_nic *efx)
508{ 484{
509 struct efx_mcdi_phy_data *phy_data = efx->phy_data; 485 struct efx_mcdi_phy_data *phy_data = efx->phy_data;
510 486
@@ -586,10 +562,11 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
586 562
587struct efx_phy_operations efx_mcdi_phy_ops = { 563struct efx_phy_operations efx_mcdi_phy_ops = {
588 .probe = efx_mcdi_phy_probe, 564 .probe = efx_mcdi_phy_probe,
589 .init = efx_mcdi_phy_init, 565 .init = efx_port_dummy_op_int,
590 .reconfigure = efx_mcdi_phy_reconfigure, 566 .reconfigure = efx_mcdi_phy_reconfigure,
591 .poll = efx_mcdi_phy_poll, 567 .poll = efx_mcdi_phy_poll,
592 .fini = efx_mcdi_phy_fini, 568 .fini = efx_port_dummy_op_void,
569 .remove = efx_mcdi_phy_remove,
593 .get_settings = efx_mcdi_phy_get_settings, 570 .get_settings = efx_mcdi_phy_get_settings,
594 .set_settings = efx_mcdi_phy_set_settings, 571 .set_settings = efx_mcdi_phy_set_settings,
595 .run_tests = NULL, 572 .run_tests = NULL,
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 34c381f009b7..d5aab5b3fa06 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -524,6 +524,7 @@ struct efx_phy_operations {
524 int (*probe) (struct efx_nic *efx); 524 int (*probe) (struct efx_nic *efx);
525 int (*init) (struct efx_nic *efx); 525 int (*init) (struct efx_nic *efx);
526 void (*fini) (struct efx_nic *efx); 526 void (*fini) (struct efx_nic *efx);
527 void (*remove) (struct efx_nic *efx);
527 int (*reconfigure) (struct efx_nic *efx); 528 int (*reconfigure) (struct efx_nic *efx);
528 bool (*poll) (struct efx_nic *efx); 529 bool (*poll) (struct efx_nic *efx);
529 void (*get_settings) (struct efx_nic *efx, 530 void (*get_settings) (struct efx_nic *efx,
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c
index a577be227862..db44224ed2ca 100644
--- a/drivers/net/sfc/nic.c
+++ b/drivers/net/sfc/nic.c
@@ -1576,6 +1576,8 @@ void efx_nic_init_common(struct efx_nic *efx)
1576 EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_SOFT_EVT_EN, 1); 1576 EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_SOFT_EVT_EN, 1);
1577 /* Prefetch threshold 2 => fetch when descriptor cache half empty */ 1577 /* Prefetch threshold 2 => fetch when descriptor cache half empty */
1578 EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_THRESHOLD, 2); 1578 EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_THRESHOLD, 2);
1579 /* Disable hardware watchdog which can misfire */
1580 EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_PREF_WD_TMR, 0x3fffff);
1579 /* Squash TX of packets of 16 bytes or less */ 1581 /* Squash TX of packets of 16 bytes or less */
1580 if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) 1582 if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0)
1581 EFX_SET_OWORD_FIELD(temp, FRF_BZ_TX_FLUSH_MIN_LEN_EN, 1); 1583 EFX_SET_OWORD_FIELD(temp, FRF_BZ_TX_FLUSH_MIN_LEN_EN, 1);
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c
index 3800fc791b2f..ff8f0a417fa3 100644
--- a/drivers/net/sfc/qt202x_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -33,6 +33,9 @@
33#define PCS_FW_HEARTBEAT_REG 0xd7ee 33#define PCS_FW_HEARTBEAT_REG 0xd7ee
34#define PCS_FW_HEARTB_LBN 0 34#define PCS_FW_HEARTB_LBN 0
35#define PCS_FW_HEARTB_WIDTH 8 35#define PCS_FW_HEARTB_WIDTH 8
36#define PCS_FW_PRODUCT_CODE_1 0xd7f0
37#define PCS_FW_VERSION_1 0xd7f3
38#define PCS_FW_BUILD_1 0xd7f6
36#define PCS_UC8051_STATUS_REG 0xd7fd 39#define PCS_UC8051_STATUS_REG 0xd7fd
37#define PCS_UC_STATUS_LBN 0 40#define PCS_UC_STATUS_LBN 0
38#define PCS_UC_STATUS_WIDTH 8 41#define PCS_UC_STATUS_WIDTH 8
@@ -52,14 +55,24 @@ void falcon_qt202x_set_led(struct efx_nic *p, int led, int mode)
52 55
53struct qt202x_phy_data { 56struct qt202x_phy_data {
54 enum efx_phy_mode phy_mode; 57 enum efx_phy_mode phy_mode;
58 bool bug17190_in_bad_state;
59 unsigned long bug17190_timer;
60 u32 firmware_ver;
55}; 61};
56 62
57#define QT2022C2_MAX_RESET_TIME 500 63#define QT2022C2_MAX_RESET_TIME 500
58#define QT2022C2_RESET_WAIT 10 64#define QT2022C2_RESET_WAIT 10
59 65
60static int qt2025c_wait_reset(struct efx_nic *efx) 66#define QT2025C_MAX_HEARTB_TIME (5 * HZ)
67#define QT2025C_HEARTB_WAIT 100
68#define QT2025C_MAX_FWSTART_TIME (25 * HZ / 10)
69#define QT2025C_FWSTART_WAIT 100
70
71#define BUG17190_INTERVAL (2 * HZ)
72
73static int qt2025c_wait_heartbeat(struct efx_nic *efx)
61{ 74{
62 unsigned long timeout = jiffies + 10 * HZ; 75 unsigned long timeout = jiffies + QT2025C_MAX_HEARTB_TIME;
63 int reg, old_counter = 0; 76 int reg, old_counter = 0;
64 77
65 /* Wait for firmware heartbeat to start */ 78 /* Wait for firmware heartbeat to start */
@@ -74,11 +87,25 @@ static int qt2025c_wait_reset(struct efx_nic *efx)
74 old_counter = counter; 87 old_counter = counter;
75 else if (counter != old_counter) 88 else if (counter != old_counter)
76 break; 89 break;
77 if (time_after(jiffies, timeout)) 90 if (time_after(jiffies, timeout)) {
91 /* Some cables have EEPROMs that conflict with the
92 * PHY's on-board EEPROM so it cannot load firmware */
93 EFX_ERR(efx, "If an SFP+ direct attach cable is"
94 " connected, please check that it complies"
95 " with the SFP+ specification\n");
78 return -ETIMEDOUT; 96 return -ETIMEDOUT;
79 msleep(10); 97 }
98 msleep(QT2025C_HEARTB_WAIT);
80 } 99 }
81 100
101 return 0;
102}
103
104static int qt2025c_wait_fw_status_good(struct efx_nic *efx)
105{
106 unsigned long timeout = jiffies + QT2025C_MAX_FWSTART_TIME;
107 int reg;
108
82 /* Wait for firmware status to look good */ 109 /* Wait for firmware status to look good */
83 for (;;) { 110 for (;;) {
84 reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG); 111 reg = efx_mdio_read(efx, MDIO_MMD_PCS, PCS_UC8051_STATUS_REG);
@@ -90,7 +117,178 @@ static int qt2025c_wait_reset(struct efx_nic *efx)
90 break; 117 break;
91 if (time_after(jiffies, timeout)) 118 if (time_after(jiffies, timeout))
92 return -ETIMEDOUT; 119 return -ETIMEDOUT;
120 msleep(QT2025C_FWSTART_WAIT);
121 }
122
123 return 0;
124}
125
126static void qt2025c_restart_firmware(struct efx_nic *efx)
127{
128 /* Restart microcontroller execution of firmware from RAM */
129 efx_mdio_write(efx, 3, 0xe854, 0x00c0);
130 efx_mdio_write(efx, 3, 0xe854, 0x0040);
131 msleep(50);
132}
133
134static int qt2025c_wait_reset(struct efx_nic *efx)
135{
136 int rc;
137
138 rc = qt2025c_wait_heartbeat(efx);
139 if (rc != 0)
140 return rc;
141
142 rc = qt2025c_wait_fw_status_good(efx);
143 if (rc == -ETIMEDOUT) {
144 /* Bug 17689: occasionally heartbeat starts but firmware status
145 * code never progresses beyond 0x00. Try again, once, after
146 * restarting execution of the firmware image. */
147 EFX_LOG(efx, "bashing QT2025C microcontroller\n");
148 qt2025c_restart_firmware(efx);
149 rc = qt2025c_wait_heartbeat(efx);
150 if (rc != 0)
151 return rc;
152 rc = qt2025c_wait_fw_status_good(efx);
153 }
154
155 return rc;
156}
157
158static void qt2025c_firmware_id(struct efx_nic *efx)
159{
160 struct qt202x_phy_data *phy_data = efx->phy_data;
161 u8 firmware_id[9];
162 size_t i;
163
164 for (i = 0; i < sizeof(firmware_id); i++)
165 firmware_id[i] = efx_mdio_read(efx, MDIO_MMD_PCS,
166 PCS_FW_PRODUCT_CODE_1 + i);
167 EFX_INFO(efx, "QT2025C firmware %xr%d v%d.%d.%d.%d [20%02d-%02d-%02d]\n",
168 (firmware_id[0] << 8) | firmware_id[1], firmware_id[2],
169 firmware_id[3] >> 4, firmware_id[3] & 0xf,
170 firmware_id[4], firmware_id[5],
171 firmware_id[6], firmware_id[7], firmware_id[8]);
172 phy_data->firmware_ver = ((firmware_id[3] & 0xf0) << 20) |
173 ((firmware_id[3] & 0x0f) << 16) |
174 (firmware_id[4] << 8) | firmware_id[5];
175}
176
177static void qt2025c_bug17190_workaround(struct efx_nic *efx)
178{
179 struct qt202x_phy_data *phy_data = efx->phy_data;
180
181 /* The PHY can get stuck in a state where it reports PHY_XS and PMA/PMD
182 * layers up, but PCS down (no block_lock). If we notice this state
183 * persisting for a couple of seconds, we switch PMA/PMD loopback
184 * briefly on and then off again, which is normally sufficient to
185 * recover it.
186 */
187 if (efx->link_state.up ||
188 !efx_mdio_links_ok(efx, MDIO_DEVS_PMAPMD | MDIO_DEVS_PHYXS)) {
189 phy_data->bug17190_in_bad_state = false;
190 return;
191 }
192
193 if (!phy_data->bug17190_in_bad_state) {
194 phy_data->bug17190_in_bad_state = true;
195 phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL;
196 return;
197 }
198
199 if (time_after_eq(jiffies, phy_data->bug17190_timer)) {
200 EFX_LOG(efx, "bashing QT2025C PMA/PMD\n");
201 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1,
202 MDIO_PMA_CTRL1_LOOPBACK, true);
93 msleep(100); 203 msleep(100);
204 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_CTRL1,
205 MDIO_PMA_CTRL1_LOOPBACK, false);
206 phy_data->bug17190_timer = jiffies + BUG17190_INTERVAL;
207 }
208}
209
210static int qt2025c_select_phy_mode(struct efx_nic *efx)
211{
212 struct qt202x_phy_data *phy_data = efx->phy_data;
213 struct falcon_board *board = falcon_board(efx);
214 int reg, rc, i;
215 uint16_t phy_op_mode;
216
217 /* Only 2.0.1.0+ PHY firmware supports the more optimal SFP+
218 * Self-Configure mode. Don't attempt any switching if we encounter
219 * older firmware. */
220 if (phy_data->firmware_ver < 0x02000100)
221 return 0;
222
223 /* In general we will get optimal behaviour in "SFP+ Self-Configure"
224 * mode; however, that powers down most of the PHY when no module is
225 * present, so we must use a different mode (any fixed mode will do)
226 * to be sure that loopbacks will work. */
227 phy_op_mode = (efx->loopback_mode == LOOPBACK_NONE) ? 0x0038 : 0x0020;
228
229 /* Only change mode if really necessary */
230 reg = efx_mdio_read(efx, 1, 0xc319);
231 if ((reg & 0x0038) == phy_op_mode)
232 return 0;
233 EFX_LOG(efx, "Switching PHY to mode 0x%04x\n", phy_op_mode);
234
235 /* This sequence replicates the register writes configured in the boot
236 * EEPROM (including the differences between board revisions), except
237 * that the operating mode is changed, and the PHY is prevented from
238 * unnecessarily reloading the main firmware image again. */
239 efx_mdio_write(efx, 1, 0xc300, 0x0000);
240 /* (Note: this portion of the boot EEPROM sequence, which bit-bashes 9
241 * STOPs onto the firmware/module I2C bus to reset it, varies across
242 * board revisions, as the bus is connected to different GPIO/LED
243 * outputs on the PHY.) */
244 if (board->major == 0 && board->minor < 2) {
245 efx_mdio_write(efx, 1, 0xc303, 0x4498);
246 for (i = 0; i < 9; i++) {
247 efx_mdio_write(efx, 1, 0xc303, 0x4488);
248 efx_mdio_write(efx, 1, 0xc303, 0x4480);
249 efx_mdio_write(efx, 1, 0xc303, 0x4490);
250 efx_mdio_write(efx, 1, 0xc303, 0x4498);
251 }
252 } else {
253 efx_mdio_write(efx, 1, 0xc303, 0x0920);
254 efx_mdio_write(efx, 1, 0xd008, 0x0004);
255 for (i = 0; i < 9; i++) {
256 efx_mdio_write(efx, 1, 0xc303, 0x0900);
257 efx_mdio_write(efx, 1, 0xd008, 0x0005);
258 efx_mdio_write(efx, 1, 0xc303, 0x0920);
259 efx_mdio_write(efx, 1, 0xd008, 0x0004);
260 }
261 efx_mdio_write(efx, 1, 0xc303, 0x4900);
262 }
263 efx_mdio_write(efx, 1, 0xc303, 0x4900);
264 efx_mdio_write(efx, 1, 0xc302, 0x0004);
265 efx_mdio_write(efx, 1, 0xc316, 0x0013);
266 efx_mdio_write(efx, 1, 0xc318, 0x0054);
267 efx_mdio_write(efx, 1, 0xc319, phy_op_mode);
268 efx_mdio_write(efx, 1, 0xc31a, 0x0098);
269 efx_mdio_write(efx, 3, 0x0026, 0x0e00);
270 efx_mdio_write(efx, 3, 0x0027, 0x0013);
271 efx_mdio_write(efx, 3, 0x0028, 0xa528);
272 efx_mdio_write(efx, 1, 0xd006, 0x000a);
273 efx_mdio_write(efx, 1, 0xd007, 0x0009);
274 efx_mdio_write(efx, 1, 0xd008, 0x0004);
275 /* This additional write is not present in the boot EEPROM. It
276 * prevents the PHY's internal boot ROM doing another pointless (and
277 * slow) reload of the firmware image (the microcontroller's code
278 * memory is not affected by the microcontroller reset). */
279 efx_mdio_write(efx, 1, 0xc317, 0x00ff);
280 efx_mdio_write(efx, 1, 0xc300, 0x0002);
281 msleep(20);
282
283 /* Restart microcontroller execution of firmware from RAM */
284 qt2025c_restart_firmware(efx);
285
286 /* Wait for the microcontroller to be ready again */
287 rc = qt2025c_wait_reset(efx);
288 if (rc < 0) {
289 EFX_ERR(efx, "PHY microcontroller reset during mode switch "
290 "timed out\n");
291 return rc;
94 } 292 }
95 293
96 return 0; 294 return 0;
@@ -137,6 +335,16 @@ static int qt202x_reset_phy(struct efx_nic *efx)
137 335
138static int qt202x_phy_probe(struct efx_nic *efx) 336static int qt202x_phy_probe(struct efx_nic *efx)
139{ 337{
338 struct qt202x_phy_data *phy_data;
339
340 phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL);
341 if (!phy_data)
342 return -ENOMEM;
343 efx->phy_data = phy_data;
344 phy_data->phy_mode = efx->phy_mode;
345 phy_data->bug17190_in_bad_state = false;
346 phy_data->bug17190_timer = 0;
347
140 efx->mdio.mmds = QT202X_REQUIRED_DEVS; 348 efx->mdio.mmds = QT202X_REQUIRED_DEVS;
141 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; 349 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
142 efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS; 350 efx->loopback_modes = QT202X_LOOPBACKS | FALCON_XMAC_LOOPBACKS;
@@ -145,7 +353,6 @@ static int qt202x_phy_probe(struct efx_nic *efx)
145 353
146static int qt202x_phy_init(struct efx_nic *efx) 354static int qt202x_phy_init(struct efx_nic *efx)
147{ 355{
148 struct qt202x_phy_data *phy_data;
149 u32 devid; 356 u32 devid;
150 int rc; 357 int rc;
151 358
@@ -155,17 +362,14 @@ static int qt202x_phy_init(struct efx_nic *efx)
155 return rc; 362 return rc;
156 } 363 }
157 364
158 phy_data = kzalloc(sizeof(struct qt202x_phy_data), GFP_KERNEL);
159 if (!phy_data)
160 return -ENOMEM;
161 efx->phy_data = phy_data;
162
163 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS); 365 devid = efx_mdio_read_id(efx, MDIO_MMD_PHYXS);
164 EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n", 366 EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n",
165 devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid), 367 devid, efx_mdio_id_oui(devid), efx_mdio_id_model(devid),
166 efx_mdio_id_rev(devid)); 368 efx_mdio_id_rev(devid));
167 369
168 phy_data->phy_mode = efx->phy_mode; 370 if (efx->phy_type == PHY_TYPE_QT2025C)
371 qt2025c_firmware_id(efx);
372
169 return 0; 373 return 0;
170} 374}
171 375
@@ -183,6 +387,9 @@ static bool qt202x_phy_poll(struct efx_nic *efx)
183 efx->link_state.fd = true; 387 efx->link_state.fd = true;
184 efx->link_state.fc = efx->wanted_fc; 388 efx->link_state.fc = efx->wanted_fc;
185 389
390 if (efx->phy_type == PHY_TYPE_QT2025C)
391 qt2025c_bug17190_workaround(efx);
392
186 return efx->link_state.up != was_up; 393 return efx->link_state.up != was_up;
187} 394}
188 395
@@ -191,6 +398,10 @@ static int qt202x_phy_reconfigure(struct efx_nic *efx)
191 struct qt202x_phy_data *phy_data = efx->phy_data; 398 struct qt202x_phy_data *phy_data = efx->phy_data;
192 399
193 if (efx->phy_type == PHY_TYPE_QT2025C) { 400 if (efx->phy_type == PHY_TYPE_QT2025C) {
401 int rc = qt2025c_select_phy_mode(efx);
402 if (rc)
403 return rc;
404
194 /* There are several different register bits which can 405 /* There are several different register bits which can
195 * disable TX (and save power) on direct-attach cables 406 * disable TX (and save power) on direct-attach cables
196 * or optical transceivers, varying somewhat between 407 * or optical transceivers, varying somewhat between
@@ -224,7 +435,7 @@ static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecm
224 mdio45_ethtool_gset(&efx->mdio, ecmd); 435 mdio45_ethtool_gset(&efx->mdio, ecmd);
225} 436}
226 437
227static void qt202x_phy_fini(struct efx_nic *efx) 438static void qt202x_phy_remove(struct efx_nic *efx)
228{ 439{
229 /* Free the context block */ 440 /* Free the context block */
230 kfree(efx->phy_data); 441 kfree(efx->phy_data);
@@ -236,7 +447,8 @@ struct efx_phy_operations falcon_qt202x_phy_ops = {
236 .init = qt202x_phy_init, 447 .init = qt202x_phy_init,
237 .reconfigure = qt202x_phy_reconfigure, 448 .reconfigure = qt202x_phy_reconfigure,
238 .poll = qt202x_phy_poll, 449 .poll = qt202x_phy_poll,
239 .fini = qt202x_phy_fini, 450 .fini = efx_port_dummy_op_void,
451 .remove = qt202x_phy_remove,
240 .get_settings = qt202x_phy_get_settings, 452 .get_settings = qt202x_phy_get_settings,
241 .set_settings = efx_mdio_set_settings, 453 .set_settings = efx_mdio_set_settings,
242}; 454};
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c
index de07a4f031b2..f8c6771e66d8 100644
--- a/drivers/net/sfc/siena.c
+++ b/drivers/net/sfc/siena.c
@@ -133,6 +133,7 @@ static int siena_probe_port(struct efx_nic *efx)
133 133
134void siena_remove_port(struct efx_nic *efx) 134void siena_remove_port(struct efx_nic *efx)
135{ 135{
136 efx->phy_op->remove(efx);
136 efx_nic_free_buffer(efx, &efx->stats_buffer); 137 efx_nic_free_buffer(efx, &efx->stats_buffer);
137} 138}
138 139
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index ca11572a49a9..3009c297c135 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -202,10 +202,14 @@ static ssize_t set_phy_short_reach(struct device *dev,
202 int rc; 202 int rc;
203 203
204 rtnl_lock(); 204 rtnl_lock();
205 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR, 205 if (efx->state != STATE_RUNNING) {
206 MDIO_PMA_10GBT_TXPWR_SHORT, 206 rc = -EBUSY;
207 count != 0 && *buf != '0'); 207 } else {
208 rc = efx_reconfigure_port(efx); 208 efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR,
209 MDIO_PMA_10GBT_TXPWR_SHORT,
210 count != 0 && *buf != '0');
211 rc = efx_reconfigure_port(efx);
212 }
209 rtnl_unlock(); 213 rtnl_unlock();
210 214
211 return rc < 0 ? rc : (ssize_t)count; 215 return rc < 0 ? rc : (ssize_t)count;
@@ -298,36 +302,62 @@ static int tenxpress_init(struct efx_nic *efx)
298 return 0; 302 return 0;
299} 303}
300 304
301static int sfx7101_phy_probe(struct efx_nic *efx) 305static int tenxpress_phy_probe(struct efx_nic *efx)
302{ 306{
303 efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS; 307 struct tenxpress_phy_data *phy_data;
304 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22; 308 int rc;
305 efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS; 309
306 return 0; 310 /* Allocate phy private storage */
307} 311 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
312 if (!phy_data)
313 return -ENOMEM;
314 efx->phy_data = phy_data;
315 phy_data->phy_mode = efx->phy_mode;
316
317 /* Create any special files */
318 if (efx->phy_type == PHY_TYPE_SFT9001B) {
319 rc = device_create_file(&efx->pci_dev->dev,
320 &dev_attr_phy_short_reach);
321 if (rc)
322 goto fail;
323 }
324
325 if (efx->phy_type == PHY_TYPE_SFX7101) {
326 efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
327 efx->mdio.mode_support = MDIO_SUPPORTS_C45;
328
329 efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS;
330
331 efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg |
332 ADVERTISED_10000baseT_Full);
333 } else {
334 efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
335 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
336
337 efx->loopback_modes = (SFT9001_LOOPBACKS |
338 FALCON_XMAC_LOOPBACKS |
339 FALCON_GMAC_LOOPBACKS);
340
341 efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg |
342 ADVERTISED_10000baseT_Full |
343 ADVERTISED_1000baseT_Full |
344 ADVERTISED_100baseT_Full);
345 }
308 346
309static int sft9001_phy_probe(struct efx_nic *efx)
310{
311 efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
312 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
313 efx->loopback_modes = (SFT9001_LOOPBACKS | FALCON_XMAC_LOOPBACKS |
314 FALCON_GMAC_LOOPBACKS);
315 return 0; 347 return 0;
348
349fail:
350 kfree(efx->phy_data);
351 efx->phy_data = NULL;
352 return rc;
316} 353}
317 354
318static int tenxpress_phy_init(struct efx_nic *efx) 355static int tenxpress_phy_init(struct efx_nic *efx)
319{ 356{
320 struct tenxpress_phy_data *phy_data; 357 int rc;
321 int rc = 0;
322 358
323 falcon_board(efx)->type->init_phy(efx); 359 falcon_board(efx)->type->init_phy(efx);
324 360
325 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
326 if (!phy_data)
327 return -ENOMEM;
328 efx->phy_data = phy_data;
329 phy_data->phy_mode = efx->phy_mode;
330
331 if (!(efx->phy_mode & PHY_MODE_SPECIAL)) { 361 if (!(efx->phy_mode & PHY_MODE_SPECIAL)) {
332 if (efx->phy_type == PHY_TYPE_SFT9001A) { 362 if (efx->phy_type == PHY_TYPE_SFT9001A) {
333 int reg; 363 int reg;
@@ -341,44 +371,27 @@ static int tenxpress_phy_init(struct efx_nic *efx)
341 371
342 rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS); 372 rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS);
343 if (rc < 0) 373 if (rc < 0)
344 goto fail; 374 return rc;
345 375
346 rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0); 376 rc = efx_mdio_check_mmds(efx, TENXPRESS_REQUIRED_DEVS, 0);
347 if (rc < 0) 377 if (rc < 0)
348 goto fail; 378 return rc;
349 } 379 }
350 380
351 rc = tenxpress_init(efx); 381 rc = tenxpress_init(efx);
352 if (rc < 0) 382 if (rc < 0)
353 goto fail; 383 return rc;
354 384
355 /* Initialise advertising flags */ 385 /* Reinitialise flow control settings */
356 efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg |
357 ADVERTISED_10000baseT_Full);
358 if (efx->phy_type != PHY_TYPE_SFX7101)
359 efx->link_advertising |= (ADVERTISED_1000baseT_Full |
360 ADVERTISED_100baseT_Full);
361 efx_link_set_wanted_fc(efx, efx->wanted_fc); 386 efx_link_set_wanted_fc(efx, efx->wanted_fc);
362 efx_mdio_an_reconfigure(efx); 387 efx_mdio_an_reconfigure(efx);
363 388
364 if (efx->phy_type == PHY_TYPE_SFT9001B) {
365 rc = device_create_file(&efx->pci_dev->dev,
366 &dev_attr_phy_short_reach);
367 if (rc)
368 goto fail;
369 }
370
371 schedule_timeout_uninterruptible(HZ / 5); /* 200ms */ 389 schedule_timeout_uninterruptible(HZ / 5); /* 200ms */
372 390
373 /* Let XGXS and SerDes out of reset */ 391 /* Let XGXS and SerDes out of reset */
374 falcon_reset_xaui(efx); 392 falcon_reset_xaui(efx);
375 393
376 return 0; 394 return 0;
377
378 fail:
379 kfree(efx->phy_data);
380 efx->phy_data = NULL;
381 return rc;
382} 395}
383 396
384/* Perform a "special software reset" on the PHY. The caller is 397/* Perform a "special software reset" on the PHY. The caller is
@@ -589,25 +602,26 @@ static bool tenxpress_phy_poll(struct efx_nic *efx)
589 return !efx_link_state_equal(&efx->link_state, &old_state); 602 return !efx_link_state_equal(&efx->link_state, &old_state);
590} 603}
591 604
592static void tenxpress_phy_fini(struct efx_nic *efx) 605static void sfx7101_phy_fini(struct efx_nic *efx)
593{ 606{
594 int reg; 607 int reg;
595 608
609 /* Power down the LNPGA */
610 reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN);
611 efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg);
612
613 /* Waiting here ensures that the board fini, which can turn
614 * off the power to the PHY, won't get run until the LNPGA
615 * powerdown has been given long enough to complete. */
616 schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */
617}
618
619static void tenxpress_phy_remove(struct efx_nic *efx)
620{
596 if (efx->phy_type == PHY_TYPE_SFT9001B) 621 if (efx->phy_type == PHY_TYPE_SFT9001B)
597 device_remove_file(&efx->pci_dev->dev, 622 device_remove_file(&efx->pci_dev->dev,
598 &dev_attr_phy_short_reach); 623 &dev_attr_phy_short_reach);
599 624
600 if (efx->phy_type == PHY_TYPE_SFX7101) {
601 /* Power down the LNPGA */
602 reg = (1 << PMA_PMD_LNPGA_POWERDOWN_LBN);
603 efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg);
604
605 /* Waiting here ensures that the board fini, which can turn
606 * off the power to the PHY, won't get run until the LNPGA
607 * powerdown has been given long enough to complete. */
608 schedule_timeout_uninterruptible(LNPGA_PDOWN_WAIT); /* 200 ms */
609 }
610
611 kfree(efx->phy_data); 625 kfree(efx->phy_data);
612 efx->phy_data = NULL; 626 efx->phy_data = NULL;
613} 627}
@@ -819,11 +833,12 @@ static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising)
819} 833}
820 834
821struct efx_phy_operations falcon_sfx7101_phy_ops = { 835struct efx_phy_operations falcon_sfx7101_phy_ops = {
822 .probe = sfx7101_phy_probe, 836 .probe = tenxpress_phy_probe,
823 .init = tenxpress_phy_init, 837 .init = tenxpress_phy_init,
824 .reconfigure = tenxpress_phy_reconfigure, 838 .reconfigure = tenxpress_phy_reconfigure,
825 .poll = tenxpress_phy_poll, 839 .poll = tenxpress_phy_poll,
826 .fini = tenxpress_phy_fini, 840 .fini = sfx7101_phy_fini,
841 .remove = tenxpress_phy_remove,
827 .get_settings = tenxpress_get_settings, 842 .get_settings = tenxpress_get_settings,
828 .set_settings = tenxpress_set_settings, 843 .set_settings = tenxpress_set_settings,
829 .set_npage_adv = sfx7101_set_npage_adv, 844 .set_npage_adv = sfx7101_set_npage_adv,
@@ -832,11 +847,12 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = {
832}; 847};
833 848
834struct efx_phy_operations falcon_sft9001_phy_ops = { 849struct efx_phy_operations falcon_sft9001_phy_ops = {
835 .probe = sft9001_phy_probe, 850 .probe = tenxpress_phy_probe,
836 .init = tenxpress_phy_init, 851 .init = tenxpress_phy_init,
837 .reconfigure = tenxpress_phy_reconfigure, 852 .reconfigure = tenxpress_phy_reconfigure,
838 .poll = tenxpress_phy_poll, 853 .poll = tenxpress_phy_poll,
839 .fini = tenxpress_phy_fini, 854 .fini = efx_port_dummy_op_void,
855 .remove = tenxpress_phy_remove,
840 .get_settings = tenxpress_get_settings, 856 .get_settings = tenxpress_get_settings,
841 .set_settings = tenxpress_set_settings, 857 .set_settings = tenxpress_set_settings,
842 .set_npage_adv = sft9001_set_npage_adv, 858 .set_npage_adv = sft9001_set_npage_adv,
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index e669f94e821b..a8b70ef6d817 100644
--- a/drivers/net/sfc/tx.c
+++ b/drivers/net/sfc/tx.c
@@ -821,8 +821,6 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
821 EFX_TXQ_MASK]; 821 EFX_TXQ_MASK];
822 efx_tsoh_free(tx_queue, buffer); 822 efx_tsoh_free(tx_queue, buffer);
823 EFX_BUG_ON_PARANOID(buffer->skb); 823 EFX_BUG_ON_PARANOID(buffer->skb);
824 buffer->len = 0;
825 buffer->continuation = true;
826 if (buffer->unmap_len) { 824 if (buffer->unmap_len) {
827 unmap_addr = (buffer->dma_addr + buffer->len - 825 unmap_addr = (buffer->dma_addr + buffer->len -
828 buffer->unmap_len); 826 buffer->unmap_len);
@@ -836,6 +834,8 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
836 PCI_DMA_TODEVICE); 834 PCI_DMA_TODEVICE);
837 buffer->unmap_len = 0; 835 buffer->unmap_len = 0;
838 } 836 }
837 buffer->len = 0;
838 buffer->continuation = true;
839 } 839 }
840} 840}
841 841
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index ca6285016dfd..7402b858cab7 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -110,7 +110,7 @@ static void sh_eth_reset(struct net_device *ndev)
110 mdelay(1); 110 mdelay(1);
111 cnt--; 111 cnt--;
112 } 112 }
113 if (cnt < 0) 113 if (cnt == 0)
114 printk(KERN_ERR "Device reset fail\n"); 114 printk(KERN_ERR "Device reset fail\n");
115 115
116 /* Table Init */ 116 /* Table Init */
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 1c01b96c9611..37f486b65f63 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1844,7 +1844,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1844 sky2->tx_cons = idx; 1844 sky2->tx_cons = idx;
1845 smp_mb(); 1845 smp_mb();
1846 1846
1847 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 1847 /* Wake unless it's detached, and called e.g. from sky2_down() */
1848 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev))
1848 netif_wake_queue(dev); 1849 netif_wake_queue(dev);
1849} 1850}
1850 1851
@@ -4684,6 +4685,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4684 INIT_WORK(&hw->restart_work, sky2_restart); 4685 INIT_WORK(&hw->restart_work, sky2_restart);
4685 4686
4686 pci_set_drvdata(pdev, hw); 4687 pci_set_drvdata(pdev, hw);
4688 pdev->d3_delay = 150;
4687 4689
4688 return 0; 4690 return 0;
4689 4691
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
index 1cc8cf4425d1..516713fa0a05 100644
--- a/drivers/net/tulip/Kconfig
+++ b/drivers/net/tulip/Kconfig
@@ -101,6 +101,10 @@ config TULIP_NAPI_HW_MITIGATION
101 101
102 If in doubt, say Y. 102 If in doubt, say Y.
103 103
104config TULIP_DM910X
105 def_bool y
106 depends on TULIP && SPARC
107
104config DE4X5 108config DE4X5
105 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" 109 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
106 depends on PCI || EISA 110 depends on PCI || EISA
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index ad63621913c3..6f44ebf58910 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -92,6 +92,10 @@
92#include <asm/uaccess.h> 92#include <asm/uaccess.h>
93#include <asm/irq.h> 93#include <asm/irq.h>
94 94
95#ifdef CONFIG_TULIP_DM910X
96#include <linux/of.h>
97#endif
98
95 99
96/* Board/System/Debug information/definition ---------------- */ 100/* Board/System/Debug information/definition ---------------- */
97#define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */ 101#define PCI_DM9132_ID 0x91321282 /* Davicom DM9132 ID */
@@ -377,6 +381,23 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
377 if (!printed_version++) 381 if (!printed_version++)
378 printk(version); 382 printk(version);
379 383
384 /*
385 * SPARC on-board DM910x chips should be handled by the main
386 * tulip driver, except for early DM9100s.
387 */
388#ifdef CONFIG_TULIP_DM910X
389 if ((ent->driver_data == PCI_DM9100_ID && pdev->revision >= 0x30) ||
390 ent->driver_data == PCI_DM9102_ID) {
391 struct device_node *dp = pci_device_to_OF_node(pdev);
392
393 if (dp && of_get_property(dp, "local-mac-address", NULL)) {
394 printk(KERN_INFO DRV_NAME
395 ": skipping on-board DM910x (use tulip)\n");
396 return -ENODEV;
397 }
398 }
399#endif
400
380 /* Init network device */ 401 /* Init network device */
381 dev = alloc_etherdev(sizeof(*db)); 402 dev = alloc_etherdev(sizeof(*db));
382 if (dev == NULL) 403 if (dev == NULL)
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 0fa3140d65bf..595777dcadb1 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -196,9 +196,13 @@ struct tulip_chip_table tulip_tbl[] = {
196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task }, 196 | HAS_NWAY | HAS_PCI_MWI, tulip_timer, tulip_media_task },
197 197
198 /* DM910X */ 198 /* DM910X */
199#ifdef CONFIG_TULIP_DM910X
199 { "Davicom DM9102/DM9102A", 128, 0x0001ebef, 200 { "Davicom DM9102/DM9102A", 128, 0x0001ebef,
200 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI, 201 HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_ACPI,
201 tulip_timer, tulip_media_task }, 202 tulip_timer, tulip_media_task },
203#else
204 { NULL },
205#endif
202 206
203 /* RS7112 */ 207 /* RS7112 */
204 { "Conexant LANfinity", 256, 0x0001ebef, 208 { "Conexant LANfinity", 256, 0x0001ebef,
@@ -228,8 +232,10 @@ static struct pci_device_id tulip_pci_tbl[] = {
228 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 232 { 0x1259, 0xa120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
229 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, 233 { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 },
230 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, 234 { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 },
235#ifdef CONFIG_TULIP_DM910X
231 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 236 { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X },
232 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, 237 { 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X },
238#endif
233 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 239 { 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
234 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 }, 240 { 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
235 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, 241 { 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
@@ -1299,18 +1305,30 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1299 } 1305 }
1300 1306
1301 /* 1307 /*
1302 * Early DM9100's need software CRC and the DMFE driver 1308 * DM910x chips should be handled by the dmfe driver, except
1309 * on-board chips on SPARC systems. Also, early DM9100s need
1310 * software CRC which only the dmfe driver supports.
1303 */ 1311 */
1304 1312
1305 if (pdev->vendor == 0x1282 && pdev->device == 0x9100) 1313#ifdef CONFIG_TULIP_DM910X
1306 { 1314 if (chip_idx == DM910X) {
1307 /* Read Chip revision */ 1315 struct device_node *dp;
1308 if (pdev->revision < 0x30) 1316
1309 { 1317 if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
1310 printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); 1318 pdev->revision < 0x30) {
1319 printk(KERN_INFO PFX
1320 "skipping early DM9100 with Crc bug (use dmfe)\n");
1321 return -ENODEV;
1322 }
1323
1324 dp = pci_device_to_OF_node(pdev);
1325 if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
1326 printk(KERN_INFO PFX
1327 "skipping DM910x expansion card (use dmfe)\n");
1311 return -ENODEV; 1328 return -ENODEV;
1312 } 1329 }
1313 } 1330 }
1331#endif
1314 1332
1315 /* 1333 /*
1316 * Looks for early PCI chipsets where people report hangs 1334 * Looks for early PCI chipsets where people report hangs
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 01e99f22210e..2834a01bae24 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -849,13 +849,13 @@ static void tun_sock_write_space(struct sock *sk)
849 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 849 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
850 wake_up_interruptible_sync(sk->sk_sleep); 850 wake_up_interruptible_sync(sk->sk_sleep);
851 851
852 tun = container_of(sk, struct tun_sock, sk)->tun; 852 tun = tun_sk(sk)->tun;
853 kill_fasync(&tun->fasync, SIGIO, POLL_OUT); 853 kill_fasync(&tun->fasync, SIGIO, POLL_OUT);
854} 854}
855 855
856static void tun_sock_destruct(struct sock *sk) 856static void tun_sock_destruct(struct sock *sk)
857{ 857{
858 free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev); 858 free_netdev(tun_sk(sk)->tun->dev);
859} 859}
860 860
861static struct proto tun_proto = { 861static struct proto tun_proto = {
@@ -990,7 +990,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
990 sk->sk_write_space = tun_sock_write_space; 990 sk->sk_write_space = tun_sock_write_space;
991 sk->sk_sndbuf = INT_MAX; 991 sk->sk_sndbuf = INT_MAX;
992 992
993 container_of(sk, struct tun_sock, sk)->tun = tun; 993 tun_sk(sk)->tun = tun;
994 994
995 security_tun_dev_post_create(sk); 995 security_tun_dev_post_create(sk);
996 996
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index afaf088b72ea..96bdc0b43889 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1563,7 +1563,10 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
1563 1563
1564static void ugeth_quiesce(struct ucc_geth_private *ugeth) 1564static void ugeth_quiesce(struct ucc_geth_private *ugeth)
1565{ 1565{
1566 /* Wait for and prevent any further xmits. */ 1566 /* Prevent any further xmits, plus detach the device. */
1567 netif_device_detach(ugeth->ndev);
1568
1569 /* Wait for any current xmits to finish. */
1567 netif_tx_disable(ugeth->ndev); 1570 netif_tx_disable(ugeth->ndev);
1568 1571
1569 /* Disable the interrupt to avoid NAPI rescheduling. */ 1572 /* Disable the interrupt to avoid NAPI rescheduling. */
@@ -1577,7 +1580,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
1577{ 1580{
1578 napi_enable(&ugeth->napi); 1581 napi_enable(&ugeth->napi);
1579 enable_irq(ugeth->ug_info->uf_info.irq); 1582 enable_irq(ugeth->ug_info->uf_info.irq);
1580 netif_tx_wake_all_queues(ugeth->ndev); 1583 netif_device_attach(ugeth->ndev);
1581} 1584}
1582 1585
1583/* Called every time the controller might need to be made 1586/* Called every time the controller might need to be made
@@ -1648,25 +1651,28 @@ static void adjust_link(struct net_device *dev)
1648 ugeth->oldspeed = phydev->speed; 1651 ugeth->oldspeed = phydev->speed;
1649 } 1652 }
1650 1653
1651 /*
1652 * To change the MAC configuration we need to disable the
1653 * controller. To do so, we have to either grab ugeth->lock,
1654 * which is a bad idea since 'graceful stop' commands might
1655 * take quite a while, or we can quiesce driver's activity.
1656 */
1657 ugeth_quiesce(ugeth);
1658 ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
1659
1660 out_be32(&ug_regs->maccfg2, tempval);
1661 out_be32(&uf_regs->upsmr, upsmr);
1662
1663 ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
1664 ugeth_activate(ugeth);
1665
1666 if (!ugeth->oldlink) { 1654 if (!ugeth->oldlink) {
1667 new_state = 1; 1655 new_state = 1;
1668 ugeth->oldlink = 1; 1656 ugeth->oldlink = 1;
1669 } 1657 }
1658
1659 if (new_state) {
1660 /*
1661 * To change the MAC configuration we need to disable
1662 * the controller. To do so, we have to either grab
1663 * ugeth->lock, which is a bad idea since 'graceful
1664 * stop' commands might take quite a while, or we can
1665 * quiesce driver's activity.
1666 */
1667 ugeth_quiesce(ugeth);
1668 ugeth_disable(ugeth, COMM_DIR_RX_AND_TX);
1669
1670 out_be32(&ug_regs->maccfg2, tempval);
1671 out_be32(&uf_regs->upsmr, upsmr);
1672
1673 ugeth_enable(ugeth, COMM_DIR_RX_AND_TX);
1674 ugeth_activate(ugeth);
1675 }
1670 } else if (ugeth->oldlink) { 1676 } else if (ugeth->oldlink) {
1671 new_state = 1; 1677 new_state = 1;
1672 ugeth->oldlink = 0; 1678 ugeth->oldlink = 0;
@@ -3273,7 +3279,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
3273 /* Handle the transmitted buffer and release */ 3279 /* Handle the transmitted buffer and release */
3274 /* the BD to be used with the current frame */ 3280 /* the BD to be used with the current frame */
3275 3281
3276 if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0)) 3282 if (bd == ugeth->txBd[txQ]) /* queue empty? */
3277 break; 3283 break;
3278 3284
3279 dev->stats.tx_packets++; 3285 dev->stats.tx_packets++;
@@ -3601,6 +3607,7 @@ static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state)
3601 if (!netif_running(ndev)) 3607 if (!netif_running(ndev))
3602 return 0; 3608 return 0;
3603 3609
3610 netif_device_detach(ndev);
3604 napi_disable(&ugeth->napi); 3611 napi_disable(&ugeth->napi);
3605 3612
3606 /* 3613 /*
@@ -3659,7 +3666,7 @@ static int ucc_geth_resume(struct of_device *ofdev)
3659 phy_start(ugeth->phydev); 3666 phy_start(ugeth->phydev);
3660 3667
3661 napi_enable(&ugeth->napi); 3668 napi_enable(&ugeth->napi);
3662 netif_start_queue(ndev); 3669 netif_device_attach(ndev);
3663 3670
3664 return 0; 3671 return 0;
3665} 3672}
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index a007e2acf651..ef1fbeb11c6e 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -838,13 +838,13 @@ struct ucc_geth_hardware_statistics {
838 using the maximum is 838 using the maximum is
839 easier */ 839 easier */
840#define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32 840#define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32
841#define UCC_GETH_SCHEDULER_ALIGNMENT 4 /* This is a guess */ 841#define UCC_GETH_SCHEDULER_ALIGNMENT 8 /* This is a guess */
842#define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */ 842#define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */
843#define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */ 843#define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */
844#define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 64 844#define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 64
845#define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */ 845#define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */
846#define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */ 846#define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */
847#define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 4 /* This 847#define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 8 /* This
848 is a 848 is a
849 guess 849 guess
850 */ 850 */
@@ -899,16 +899,17 @@ struct ucc_geth_hardware_statistics {
899#define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size 899#define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size
900 */ 900 */
901#define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ 901#define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */
902#define UCC_GETH_UTFTT_INIT 128 902#define UCC_GETH_UTFTT_INIT 512
903/* Gigabit Ethernet (1000 Mbps) */ 903/* Gigabit Ethernet (1000 Mbps) */
904#define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual 904#define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual
905 FIFO size */ 905 FIFO size */
906#define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */ 906#define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */
907#define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */ 907#define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */
908#define UCC_GETH_UTFS_GIGA_INIT 8192/*2048*/ /* Tx virtual 908#define UCC_GETH_UTFS_GIGA_INIT 4096/*2048*/ /* Tx virtual
909 FIFO size */
910#define UCC_GETH_UTFET_GIGA_INIT 2048/*1024*/ /* 1/2 utfs */
911#define UCC_GETH_UTFTT_GIGA_INIT 4096/*0x40*/ /* Tx virtual
909 FIFO size */ 912 FIFO size */
910#define UCC_GETH_UTFET_GIGA_INIT 4096/*1024*/ /* 1/2 utfs */
911#define UCC_GETH_UTFTT_GIGA_INIT 0x400/*0x40*/ /* */
912 913
913#define UCC_GETH_REMODER_INIT 0 /* bits that must be 914#define UCC_GETH_REMODER_INIT 0 /* bits that must be
914 set */ 915 set */
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index f78f0903b073..6895f1531238 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -286,6 +286,7 @@ struct hso_device {
286 u8 usb_gone; 286 u8 usb_gone;
287 struct work_struct async_get_intf; 287 struct work_struct async_get_intf;
288 struct work_struct async_put_intf; 288 struct work_struct async_put_intf;
289 struct work_struct reset_device;
289 290
290 struct usb_device *usb; 291 struct usb_device *usb;
291 struct usb_interface *interface; 292 struct usb_interface *interface;
@@ -332,7 +333,8 @@ static void hso_kick_transmit(struct hso_serial *serial);
332/* Helper functions */ 333/* Helper functions */
333static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int, 334static int hso_mux_submit_intr_urb(struct hso_shared_int *mux_int,
334 struct usb_device *usb, gfp_t gfp); 335 struct usb_device *usb, gfp_t gfp);
335static void log_usb_status(int status, const char *function); 336static void handle_usb_error(int status, const char *function,
337 struct hso_device *hso_dev);
336static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf, 338static struct usb_endpoint_descriptor *hso_get_ep(struct usb_interface *intf,
337 int type, int dir); 339 int type, int dir);
338static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports); 340static int hso_get_mux_ports(struct usb_interface *intf, unsigned char *ports);
@@ -350,6 +352,7 @@ static void async_put_intf(struct work_struct *data);
350static int hso_put_activity(struct hso_device *hso_dev); 352static int hso_put_activity(struct hso_device *hso_dev);
351static int hso_get_activity(struct hso_device *hso_dev); 353static int hso_get_activity(struct hso_device *hso_dev);
352static void tiocmget_intr_callback(struct urb *urb); 354static void tiocmget_intr_callback(struct urb *urb);
355static void reset_device(struct work_struct *data);
353/*****************************************************************************/ 356/*****************************************************************************/
354/* Helping functions */ 357/* Helping functions */
355/*****************************************************************************/ 358/*****************************************************************************/
@@ -461,10 +464,17 @@ static const struct usb_device_id hso_ids[] = {
461 {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */ 464 {USB_DEVICE(0x0af0, 0x7501)}, /* GTM 382 */
462 {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */ 465 {USB_DEVICE(0x0af0, 0x7601)}, /* GE40x */
463 {USB_DEVICE(0x0af0, 0x7701)}, 466 {USB_DEVICE(0x0af0, 0x7701)},
467 {USB_DEVICE(0x0af0, 0x7706)},
464 {USB_DEVICE(0x0af0, 0x7801)}, 468 {USB_DEVICE(0x0af0, 0x7801)},
465 {USB_DEVICE(0x0af0, 0x7901)}, 469 {USB_DEVICE(0x0af0, 0x7901)},
470 {USB_DEVICE(0x0af0, 0x7A01)},
471 {USB_DEVICE(0x0af0, 0x7A05)},
466 {USB_DEVICE(0x0af0, 0x8200)}, 472 {USB_DEVICE(0x0af0, 0x8200)},
467 {USB_DEVICE(0x0af0, 0x8201)}, 473 {USB_DEVICE(0x0af0, 0x8201)},
474 {USB_DEVICE(0x0af0, 0x8300)},
475 {USB_DEVICE(0x0af0, 0x8302)},
476 {USB_DEVICE(0x0af0, 0x8304)},
477 {USB_DEVICE(0x0af0, 0x8400)},
468 {USB_DEVICE(0x0af0, 0xd035)}, 478 {USB_DEVICE(0x0af0, 0xd035)},
469 {USB_DEVICE(0x0af0, 0xd055)}, 479 {USB_DEVICE(0x0af0, 0xd055)},
470 {USB_DEVICE(0x0af0, 0xd155)}, 480 {USB_DEVICE(0x0af0, 0xd155)},
@@ -473,6 +483,8 @@ static const struct usb_device_id hso_ids[] = {
473 {USB_DEVICE(0x0af0, 0xd157)}, 483 {USB_DEVICE(0x0af0, 0xd157)},
474 {USB_DEVICE(0x0af0, 0xd257)}, 484 {USB_DEVICE(0x0af0, 0xd257)},
475 {USB_DEVICE(0x0af0, 0xd357)}, 485 {USB_DEVICE(0x0af0, 0xd357)},
486 {USB_DEVICE(0x0af0, 0xd058)},
487 {USB_DEVICE(0x0af0, 0xc100)},
476 {} 488 {}
477}; 489};
478MODULE_DEVICE_TABLE(usb, hso_ids); 490MODULE_DEVICE_TABLE(usb, hso_ids);
@@ -655,8 +667,8 @@ static void set_serial_by_index(unsigned index, struct hso_serial *serial)
655 spin_unlock_irqrestore(&serial_table_lock, flags); 667 spin_unlock_irqrestore(&serial_table_lock, flags);
656} 668}
657 669
658/* log a meaningful explanation of an USB status */ 670static void handle_usb_error(int status, const char *function,
659static void log_usb_status(int status, const char *function) 671 struct hso_device *hso_dev)
660{ 672{
661 char *explanation; 673 char *explanation;
662 674
@@ -685,10 +697,20 @@ static void log_usb_status(int status, const char *function)
685 case -EMSGSIZE: 697 case -EMSGSIZE:
686 explanation = "internal error"; 698 explanation = "internal error";
687 break; 699 break;
700 case -EILSEQ:
701 case -EPROTO:
702 case -ETIME:
703 case -ETIMEDOUT:
704 explanation = "protocol error";
705 if (hso_dev)
706 schedule_work(&hso_dev->reset_device);
707 break;
688 default: 708 default:
689 explanation = "unknown status"; 709 explanation = "unknown status";
690 break; 710 break;
691 } 711 }
712
713 /* log a meaningful explanation of an USB status */
692 D1("%s: received USB status - %s (%d)", function, explanation, status); 714 D1("%s: received USB status - %s (%d)", function, explanation, status);
693} 715}
694 716
@@ -762,7 +784,7 @@ static void write_bulk_callback(struct urb *urb)
762 /* log status, but don't act on it, we don't need to resubmit anything 784 /* log status, but don't act on it, we don't need to resubmit anything
763 * anyhow */ 785 * anyhow */
764 if (status) 786 if (status)
765 log_usb_status(status, __func__); 787 handle_usb_error(status, __func__, odev->parent);
766 788
767 hso_put_activity(odev->parent); 789 hso_put_activity(odev->parent);
768 790
@@ -806,7 +828,7 @@ static netdev_tx_t hso_net_start_xmit(struct sk_buff *skb,
806 result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC); 828 result = usb_submit_urb(odev->mux_bulk_tx_urb, GFP_ATOMIC);
807 if (result) { 829 if (result) {
808 dev_warn(&odev->parent->interface->dev, 830 dev_warn(&odev->parent->interface->dev,
809 "failed mux_bulk_tx_urb %d", result); 831 "failed mux_bulk_tx_urb %d\n", result);
810 net->stats.tx_errors++; 832 net->stats.tx_errors++;
811 netif_start_queue(net); 833 netif_start_queue(net);
812 } else { 834 } else {
@@ -998,7 +1020,7 @@ static void read_bulk_callback(struct urb *urb)
998 1020
999 /* is al ok? (Filip: Who's Al ?) */ 1021 /* is al ok? (Filip: Who's Al ?) */
1000 if (status) { 1022 if (status) {
1001 log_usb_status(status, __func__); 1023 handle_usb_error(status, __func__, odev->parent);
1002 return; 1024 return;
1003 } 1025 }
1004 1026
@@ -1019,7 +1041,8 @@ static void read_bulk_callback(struct urb *urb)
1019 if (odev->parent->port_spec & HSO_INFO_CRC_BUG) { 1041 if (odev->parent->port_spec & HSO_INFO_CRC_BUG) {
1020 u32 rest; 1042 u32 rest;
1021 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; 1043 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
1022 rest = urb->actual_length % odev->in_endp->wMaxPacketSize; 1044 rest = urb->actual_length %
1045 le16_to_cpu(odev->in_endp->wMaxPacketSize);
1023 if (((rest == 5) || (rest == 6)) && 1046 if (((rest == 5) || (rest == 6)) &&
1024 !memcmp(((u8 *) urb->transfer_buffer) + 1047 !memcmp(((u8 *) urb->transfer_buffer) +
1025 urb->actual_length - 4, crc_check, 4)) { 1048 urb->actual_length - 4, crc_check, 4)) {
@@ -1053,7 +1076,7 @@ static void read_bulk_callback(struct urb *urb)
1053 result = usb_submit_urb(urb, GFP_ATOMIC); 1076 result = usb_submit_urb(urb, GFP_ATOMIC);
1054 if (result) 1077 if (result)
1055 dev_warn(&odev->parent->interface->dev, 1078 dev_warn(&odev->parent->interface->dev,
1056 "%s failed submit mux_bulk_rx_urb %d", __func__, 1079 "%s failed submit mux_bulk_rx_urb %d\n", __func__,
1057 result); 1080 result);
1058} 1081}
1059 1082
@@ -1207,7 +1230,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
1207 D1("serial == NULL"); 1230 D1("serial == NULL");
1208 return; 1231 return;
1209 } else if (status) { 1232 } else if (status) {
1210 log_usb_status(status, __func__); 1233 handle_usb_error(status, __func__, serial->parent);
1211 return; 1234 return;
1212 } 1235 }
1213 1236
@@ -1225,7 +1248,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
1225 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF }; 1248 u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
1226 rest = 1249 rest =
1227 urb->actual_length % 1250 urb->actual_length %
1228 serial->in_endp->wMaxPacketSize; 1251 le16_to_cpu(serial->in_endp->wMaxPacketSize);
1229 if (((rest == 5) || (rest == 6)) && 1252 if (((rest == 5) || (rest == 6)) &&
1230 !memcmp(((u8 *) urb->transfer_buffer) + 1253 !memcmp(((u8 *) urb->transfer_buffer) +
1231 urb->actual_length - 4, crc_check, 4)) { 1254 urb->actual_length - 4, crc_check, 4)) {
@@ -1513,7 +1536,7 @@ static void tiocmget_intr_callback(struct urb *urb)
1513 if (!serial) 1536 if (!serial)
1514 return; 1537 return;
1515 if (status) { 1538 if (status) {
1516 log_usb_status(status, __func__); 1539 handle_usb_error(status, __func__, serial->parent);
1517 return; 1540 return;
1518 } 1541 }
1519 tiocmget = serial->tiocmget; 1542 tiocmget = serial->tiocmget;
@@ -1700,6 +1723,10 @@ static int hso_serial_tiocmset(struct tty_struct *tty, struct file *file,
1700 D1("no tty structures"); 1723 D1("no tty structures");
1701 return -EINVAL; 1724 return -EINVAL;
1702 } 1725 }
1726
1727 if ((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM)
1728 return -EINVAL;
1729
1703 if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber; 1730 if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber;
1704 1731
1705 spin_lock_irqsave(&serial->serial_lock, flags); 1732 spin_lock_irqsave(&serial->serial_lock, flags);
@@ -1838,7 +1865,7 @@ static int mux_device_request(struct hso_serial *serial, u8 type, u16 port,
1838 result = usb_submit_urb(ctrl_urb, GFP_ATOMIC); 1865 result = usb_submit_urb(ctrl_urb, GFP_ATOMIC);
1839 if (result) { 1866 if (result) {
1840 dev_err(&ctrl_urb->dev->dev, 1867 dev_err(&ctrl_urb->dev->dev,
1841 "%s failed submit ctrl_urb %d type %d", __func__, 1868 "%s failed submit ctrl_urb %d type %d\n", __func__,
1842 result, type); 1869 result, type);
1843 return result; 1870 return result;
1844 } 1871 }
@@ -1888,7 +1915,7 @@ static void intr_callback(struct urb *urb)
1888 1915
1889 /* status check */ 1916 /* status check */
1890 if (status) { 1917 if (status) {
1891 log_usb_status(status, __func__); 1918 handle_usb_error(status, __func__, NULL);
1892 return; 1919 return;
1893 } 1920 }
1894 D4("\n--- Got intr callback 0x%02X ---", status); 1921 D4("\n--- Got intr callback 0x%02X ---", status);
@@ -1905,18 +1932,18 @@ static void intr_callback(struct urb *urb)
1905 if (serial != NULL) { 1932 if (serial != NULL) {
1906 D1("Pending read interrupt on port %d\n", i); 1933 D1("Pending read interrupt on port %d\n", i);
1907 spin_lock(&serial->serial_lock); 1934 spin_lock(&serial->serial_lock);
1908 if (serial->rx_state == RX_IDLE) { 1935 if (serial->rx_state == RX_IDLE &&
1936 serial->open_count > 0) {
1909 /* Setup and send a ctrl req read on 1937 /* Setup and send a ctrl req read on
1910 * port i */ 1938 * port i */
1911 if (!serial->rx_urb_filled[0]) { 1939 if (!serial->rx_urb_filled[0]) {
1912 serial->rx_state = RX_SENT; 1940 serial->rx_state = RX_SENT;
1913 hso_mux_serial_read(serial); 1941 hso_mux_serial_read(serial);
1914 } else 1942 } else
1915 serial->rx_state = RX_PENDING; 1943 serial->rx_state = RX_PENDING;
1916
1917 } else { 1944 } else {
1918 D1("Already pending a read on " 1945 D1("Already a read pending on "
1919 "port %d\n", i); 1946 "port %d or port not open\n", i);
1920 } 1947 }
1921 spin_unlock(&serial->serial_lock); 1948 spin_unlock(&serial->serial_lock);
1922 } 1949 }
@@ -1958,7 +1985,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
1958 tty = tty_kref_get(serial->tty); 1985 tty = tty_kref_get(serial->tty);
1959 spin_unlock(&serial->serial_lock); 1986 spin_unlock(&serial->serial_lock);
1960 if (status) { 1987 if (status) {
1961 log_usb_status(status, __func__); 1988 handle_usb_error(status, __func__, serial->parent);
1962 tty_kref_put(tty); 1989 tty_kref_put(tty);
1963 return; 1990 return;
1964 } 1991 }
@@ -2014,7 +2041,7 @@ static void ctrl_callback(struct urb *urb)
2014 tty = tty_kref_get(serial->tty); 2041 tty = tty_kref_get(serial->tty);
2015 spin_unlock(&serial->serial_lock); 2042 spin_unlock(&serial->serial_lock);
2016 if (status) { 2043 if (status) {
2017 log_usb_status(status, __func__); 2044 handle_usb_error(status, __func__, serial->parent);
2018 tty_kref_put(tty); 2045 tty_kref_put(tty);
2019 return; 2046 return;
2020 } 2047 }
@@ -2358,12 +2385,12 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
2358 serial->tx_data_length = tx_size; 2385 serial->tx_data_length = tx_size;
2359 serial->tx_data = kzalloc(serial->tx_data_length, GFP_KERNEL); 2386 serial->tx_data = kzalloc(serial->tx_data_length, GFP_KERNEL);
2360 if (!serial->tx_data) { 2387 if (!serial->tx_data) {
2361 dev_err(dev, "%s - Out of memory", __func__); 2388 dev_err(dev, "%s - Out of memory\n", __func__);
2362 goto exit; 2389 goto exit;
2363 } 2390 }
2364 serial->tx_buffer = kzalloc(serial->tx_data_length, GFP_KERNEL); 2391 serial->tx_buffer = kzalloc(serial->tx_data_length, GFP_KERNEL);
2365 if (!serial->tx_buffer) { 2392 if (!serial->tx_buffer) {
2366 dev_err(dev, "%s - Out of memory", __func__); 2393 dev_err(dev, "%s - Out of memory\n", __func__);
2367 goto exit; 2394 goto exit;
2368 } 2395 }
2369 2396
@@ -2391,6 +2418,7 @@ static struct hso_device *hso_create_device(struct usb_interface *intf,
2391 2418
2392 INIT_WORK(&hso_dev->async_get_intf, async_get_intf); 2419 INIT_WORK(&hso_dev->async_get_intf, async_get_intf);
2393 INIT_WORK(&hso_dev->async_put_intf, async_put_intf); 2420 INIT_WORK(&hso_dev->async_put_intf, async_put_intf);
2421 INIT_WORK(&hso_dev->reset_device, reset_device);
2394 2422
2395 return hso_dev; 2423 return hso_dev;
2396} 2424}
@@ -2831,13 +2859,14 @@ struct hso_shared_int *hso_create_shared_int(struct usb_interface *interface)
2831 2859
2832 mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL); 2860 mux->shared_intr_urb = usb_alloc_urb(0, GFP_KERNEL);
2833 if (!mux->shared_intr_urb) { 2861 if (!mux->shared_intr_urb) {
2834 dev_err(&interface->dev, "Could not allocate intr urb?"); 2862 dev_err(&interface->dev, "Could not allocate intr urb?\n");
2835 goto exit; 2863 goto exit;
2836 } 2864 }
2837 mux->shared_intr_buf = kzalloc(mux->intr_endp->wMaxPacketSize, 2865 mux->shared_intr_buf =
2838 GFP_KERNEL); 2866 kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize),
2867 GFP_KERNEL);
2839 if (!mux->shared_intr_buf) { 2868 if (!mux->shared_intr_buf) {
2840 dev_err(&interface->dev, "Could not allocate intr buf?"); 2869 dev_err(&interface->dev, "Could not allocate intr buf?\n");
2841 goto exit; 2870 goto exit;
2842 } 2871 }
2843 2872
@@ -3132,6 +3161,26 @@ out:
3132 return result; 3161 return result;
3133} 3162}
3134 3163
3164static void reset_device(struct work_struct *data)
3165{
3166 struct hso_device *hso_dev =
3167 container_of(data, struct hso_device, reset_device);
3168 struct usb_device *usb = hso_dev->usb;
3169 int result;
3170
3171 if (hso_dev->usb_gone) {
3172 D1("No reset during disconnect\n");
3173 } else {
3174 result = usb_lock_device_for_reset(usb, hso_dev->interface);
3175 if (result < 0)
3176 D1("unable to lock device for reset: %d\n", result);
3177 else {
3178 usb_reset_device(usb);
3179 usb_unlock_device(usb);
3180 }
3181 }
3182}
3183
3135static void hso_serial_ref_free(struct kref *ref) 3184static void hso_serial_ref_free(struct kref *ref)
3136{ 3185{
3137 struct hso_device *hso_dev = container_of(ref, struct hso_device, ref); 3186 struct hso_device *hso_dev = container_of(ref, struct hso_device, ref);
@@ -3232,13 +3281,13 @@ static int hso_mux_submit_intr_urb(struct hso_shared_int *shared_int,
3232 usb_rcvintpipe(usb, 3281 usb_rcvintpipe(usb,
3233 shared_int->intr_endp->bEndpointAddress & 0x7F), 3282 shared_int->intr_endp->bEndpointAddress & 0x7F),
3234 shared_int->shared_intr_buf, 3283 shared_int->shared_intr_buf,
3235 shared_int->intr_endp->wMaxPacketSize, 3284 1,
3236 intr_callback, shared_int, 3285 intr_callback, shared_int,
3237 shared_int->intr_endp->bInterval); 3286 shared_int->intr_endp->bInterval);
3238 3287
3239 result = usb_submit_urb(shared_int->shared_intr_urb, gfp); 3288 result = usb_submit_urb(shared_int->shared_intr_urb, gfp);
3240 if (result) 3289 if (result)
3241 dev_warn(&usb->dev, "%s failed mux_intr_urb %d", __func__, 3290 dev_warn(&usb->dev, "%s failed mux_intr_urb %d\n", __func__,
3242 result); 3291 result);
3243 3292
3244 return result; 3293 return result;
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index f14d225404da..fd19db0d2504 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -270,7 +270,7 @@ static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
270 get_registers(dev, PHYCNT, 1, data); 270 get_registers(dev, PHYCNT, 1, data);
271 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); 271 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
272 272
273 if (i < MII_TIMEOUT) { 273 if (i <= MII_TIMEOUT) {
274 get_registers(dev, PHYDAT, 2, data); 274 get_registers(dev, PHYDAT, 2, data);
275 *reg = data[0] | (data[1] << 8); 275 *reg = data[0] | (data[1] << 8);
276 return 0; 276 return 0;
@@ -295,7 +295,7 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
295 get_registers(dev, PHYCNT, 1, data); 295 get_registers(dev, PHYCNT, 1, data);
296 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT)); 296 } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
297 297
298 if (i < MII_TIMEOUT) 298 if (i <= MII_TIMEOUT)
299 return 0; 299 return 0;
300 else 300 else
301 return 1; 301 return 1;
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 593e01f64e9b..611b80435955 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -102,6 +102,7 @@ static const int multicast_filter_limit = 32;
102#include <linux/ethtool.h> 102#include <linux/ethtool.h>
103#include <linux/crc32.h> 103#include <linux/crc32.h>
104#include <linux/bitops.h> 104#include <linux/bitops.h>
105#include <linux/workqueue.h>
105#include <asm/processor.h> /* Processor type for cache alignment. */ 106#include <asm/processor.h> /* Processor type for cache alignment. */
106#include <asm/io.h> 107#include <asm/io.h>
107#include <asm/irq.h> 108#include <asm/irq.h>
@@ -389,6 +390,7 @@ struct rhine_private {
389 struct net_device *dev; 390 struct net_device *dev;
390 struct napi_struct napi; 391 struct napi_struct napi;
391 spinlock_t lock; 392 spinlock_t lock;
393 struct work_struct reset_task;
392 394
393 /* Frequently used values: keep some adjacent for cache effect. */ 395 /* Frequently used values: keep some adjacent for cache effect. */
394 u32 quirks; 396 u32 quirks;
@@ -407,6 +409,7 @@ struct rhine_private {
407static int mdio_read(struct net_device *dev, int phy_id, int location); 409static int mdio_read(struct net_device *dev, int phy_id, int location);
408static void mdio_write(struct net_device *dev, int phy_id, int location, int value); 410static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
409static int rhine_open(struct net_device *dev); 411static int rhine_open(struct net_device *dev);
412static void rhine_reset_task(struct work_struct *work);
410static void rhine_tx_timeout(struct net_device *dev); 413static void rhine_tx_timeout(struct net_device *dev);
411static netdev_tx_t rhine_start_tx(struct sk_buff *skb, 414static netdev_tx_t rhine_start_tx(struct sk_buff *skb,
412 struct net_device *dev); 415 struct net_device *dev);
@@ -775,6 +778,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
775 dev->irq = pdev->irq; 778 dev->irq = pdev->irq;
776 779
777 spin_lock_init(&rp->lock); 780 spin_lock_init(&rp->lock);
781 INIT_WORK(&rp->reset_task, rhine_reset_task);
782
778 rp->mii_if.dev = dev; 783 rp->mii_if.dev = dev;
779 rp->mii_if.mdio_read = mdio_read; 784 rp->mii_if.mdio_read = mdio_read;
780 rp->mii_if.mdio_write = mdio_write; 785 rp->mii_if.mdio_write = mdio_write;
@@ -1179,22 +1184,18 @@ static int rhine_open(struct net_device *dev)
1179 return 0; 1184 return 0;
1180} 1185}
1181 1186
1182static void rhine_tx_timeout(struct net_device *dev) 1187static void rhine_reset_task(struct work_struct *work)
1183{ 1188{
1184 struct rhine_private *rp = netdev_priv(dev); 1189 struct rhine_private *rp = container_of(work, struct rhine_private,
1185 void __iomem *ioaddr = rp->base; 1190 reset_task);
1186 1191 struct net_device *dev = rp->dev;
1187 printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status "
1188 "%4.4x, resetting...\n",
1189 dev->name, ioread16(ioaddr + IntrStatus),
1190 mdio_read(dev, rp->mii_if.phy_id, MII_BMSR));
1191 1192
1192 /* protect against concurrent rx interrupts */ 1193 /* protect against concurrent rx interrupts */
1193 disable_irq(rp->pdev->irq); 1194 disable_irq(rp->pdev->irq);
1194 1195
1195 napi_disable(&rp->napi); 1196 napi_disable(&rp->napi);
1196 1197
1197 spin_lock(&rp->lock); 1198 spin_lock_bh(&rp->lock);
1198 1199
1199 /* clear all descriptors */ 1200 /* clear all descriptors */
1200 free_tbufs(dev); 1201 free_tbufs(dev);
@@ -1206,7 +1207,7 @@ static void rhine_tx_timeout(struct net_device *dev)
1206 rhine_chip_reset(dev); 1207 rhine_chip_reset(dev);
1207 init_registers(dev); 1208 init_registers(dev);
1208 1209
1209 spin_unlock(&rp->lock); 1210 spin_unlock_bh(&rp->lock);
1210 enable_irq(rp->pdev->irq); 1211 enable_irq(rp->pdev->irq);
1211 1212
1212 dev->trans_start = jiffies; 1213 dev->trans_start = jiffies;
@@ -1214,6 +1215,19 @@ static void rhine_tx_timeout(struct net_device *dev)
1214 netif_wake_queue(dev); 1215 netif_wake_queue(dev);
1215} 1216}
1216 1217
1218static void rhine_tx_timeout(struct net_device *dev)
1219{
1220 struct rhine_private *rp = netdev_priv(dev);
1221 void __iomem *ioaddr = rp->base;
1222
1223 printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status "
1224 "%4.4x, resetting...\n",
1225 dev->name, ioread16(ioaddr + IntrStatus),
1226 mdio_read(dev, rp->mii_if.phy_id, MII_BMSR));
1227
1228 schedule_work(&rp->reset_task);
1229}
1230
1217static netdev_tx_t rhine_start_tx(struct sk_buff *skb, 1231static netdev_tx_t rhine_start_tx(struct sk_buff *skb,
1218 struct net_device *dev) 1232 struct net_device *dev)
1219{ 1233{
@@ -1830,10 +1844,11 @@ static int rhine_close(struct net_device *dev)
1830 struct rhine_private *rp = netdev_priv(dev); 1844 struct rhine_private *rp = netdev_priv(dev);
1831 void __iomem *ioaddr = rp->base; 1845 void __iomem *ioaddr = rp->base;
1832 1846
1833 spin_lock_irq(&rp->lock);
1834
1835 netif_stop_queue(dev);
1836 napi_disable(&rp->napi); 1847 napi_disable(&rp->napi);
1848 cancel_work_sync(&rp->reset_task);
1849 netif_stop_queue(dev);
1850
1851 spin_lock_irq(&rp->lock);
1837 1852
1838 if (debug > 1) 1853 if (debug > 1)
1839 printk(KERN_DEBUG "%s: Shutting down ethercard, " 1854 printk(KERN_DEBUG "%s: Shutting down ethercard, "
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 4ceb441f2687..c93f58f5c6f2 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2237,8 +2237,6 @@ static int velocity_open(struct net_device *dev)
2237 /* Ensure chip is running */ 2237 /* Ensure chip is running */
2238 pci_set_power_state(vptr->pdev, PCI_D0); 2238 pci_set_power_state(vptr->pdev, PCI_D0);
2239 2239
2240 velocity_give_many_rx_descs(vptr);
2241
2242 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 2240 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
2243 2241
2244 ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED, 2242 ret = request_irq(vptr->pdev->irq, velocity_intr, IRQF_SHARED,
@@ -2250,6 +2248,8 @@ static int velocity_open(struct net_device *dev)
2250 goto out; 2248 goto out;
2251 } 2249 }
2252 2250
2251 velocity_give_many_rx_descs(vptr);
2252
2253 mac_enable_int(vptr->mac_regs); 2253 mac_enable_int(vptr->mac_regs);
2254 netif_start_queue(dev); 2254 netif_start_queue(dev);
2255 napi_enable(&vptr->napi); 2255 napi_enable(&vptr->napi);
@@ -2339,10 +2339,10 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu)
2339 2339
2340 dev->mtu = new_mtu; 2340 dev->mtu = new_mtu;
2341 2341
2342 velocity_give_many_rx_descs(vptr);
2343
2344 velocity_init_registers(vptr, VELOCITY_INIT_COLD); 2342 velocity_init_registers(vptr, VELOCITY_INIT_COLD);
2345 2343
2344 velocity_give_many_rx_descs(vptr);
2345
2346 mac_enable_int(vptr->mac_regs); 2346 mac_enable_int(vptr->mac_regs);
2347 netif_start_queue(dev); 2347 netif_start_queue(dev);
2348 2348
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index f1c4b2a1e867..b9685e82f7b6 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -310,7 +310,7 @@ static int vxge_rx_map(void *dtrh, struct vxge_ring *ring)
310 dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data, 310 dma_addr = pci_map_single(ring->pdev, rx_priv->skb_data,
311 rx_priv->data_size, PCI_DMA_FROMDEVICE); 311 rx_priv->data_size, PCI_DMA_FROMDEVICE);
312 312
313 if (dma_addr == 0) { 313 if (unlikely(pci_dma_mapping_error(ring->pdev, dma_addr))) {
314 ring->stats.pci_map_fail++; 314 ring->stats.pci_map_fail++;
315 return -EIO; 315 return -EIO;
316 } 316 }
@@ -4087,21 +4087,21 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4087 goto _exit0; 4087 goto _exit0;
4088 } 4088 }
4089 4089
4090 if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { 4090 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
4091 vxge_debug_ll_config(VXGE_TRACE, 4091 vxge_debug_ll_config(VXGE_TRACE,
4092 "%s : using 64bit DMA", __func__); 4092 "%s : using 64bit DMA", __func__);
4093 4093
4094 high_dma = 1; 4094 high_dma = 1;
4095 4095
4096 if (pci_set_consistent_dma_mask(pdev, 4096 if (pci_set_consistent_dma_mask(pdev,
4097 0xffffffffffffffffULL)) { 4097 DMA_BIT_MASK(64))) {
4098 vxge_debug_init(VXGE_ERR, 4098 vxge_debug_init(VXGE_ERR,
4099 "%s : unable to obtain 64bit DMA for " 4099 "%s : unable to obtain 64bit DMA for "
4100 "consistent allocations", __func__); 4100 "consistent allocations", __func__);
4101 ret = -ENOMEM; 4101 ret = -ENOMEM;
4102 goto _exit1; 4102 goto _exit1;
4103 } 4103 }
4104 } else if (!pci_set_dma_mask(pdev, 0xffffffffUL)) { 4104 } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
4105 vxge_debug_ll_config(VXGE_TRACE, 4105 vxge_debug_ll_config(VXGE_TRACE,
4106 "%s : using 32bit DMA", __func__); 4106 "%s : using 32bit DMA", __func__);
4107 } else { 4107 } else {
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index a4c086f069b1..e63b7c40d0ee 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1903,17 +1903,6 @@ accept:
1903 rxs->noise = sc->ah->ah_noise_floor; 1903 rxs->noise = sc->ah->ah_noise_floor;
1904 rxs->signal = rxs->noise + rs.rs_rssi; 1904 rxs->signal = rxs->noise + rs.rs_rssi;
1905 1905
1906 /* An rssi of 35 indicates you should be able use
1907 * 54 Mbps reliably. A more elaborate scheme can be used
1908 * here but it requires a map of SNR/throughput for each
1909 * possible mode used */
1910 rxs->qual = rs.rs_rssi * 100 / 35;
1911
1912 /* rssi can be more than 35 though, anything above that
1913 * should be considered at 100% */
1914 if (rxs->qual > 100)
1915 rxs->qual = 100;
1916
1917 rxs->antenna = rs.rs_antenna; 1906 rxs->antenna = rs.rs_antenna;
1918 rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate); 1907 rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate);
1919 rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs); 1908 rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs);
@@ -2381,6 +2370,9 @@ ath5k_init(struct ath5k_softc *sc)
2381 */ 2370 */
2382 ath5k_stop_locked(sc); 2371 ath5k_stop_locked(sc);
2383 2372
2373 /* Set PHY calibration interval */
2374 ah->ah_cal_intval = ath5k_calinterval;
2375
2384 /* 2376 /*
2385 * The basic interface to setting the hardware in a good 2377 * The basic interface to setting the hardware in a good
2386 * state is ``reset''. On return the hardware is known to 2378 * state is ``reset''. On return the hardware is known to
@@ -2408,10 +2400,6 @@ ath5k_init(struct ath5k_softc *sc)
2408 2400
2409 /* Set ack to be sent at low bit-rates */ 2401 /* Set ack to be sent at low bit-rates */
2410 ath5k_hw_set_ack_bitrate_high(ah, false); 2402 ath5k_hw_set_ack_bitrate_high(ah, false);
2411
2412 /* Set PHY calibration inteval */
2413 ah->ah_cal_intval = ath5k_calinterval;
2414
2415 ret = 0; 2403 ret = 0;
2416done: 2404done:
2417 mmiowb(); 2405 mmiowb();
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 71b84d91dcff..efc420cd42bf 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -186,7 +186,7 @@ bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
186 wait = wait_time; 186 wait = wait_time;
187 while (ath9k_hw_numtxpending(ah, q)) { 187 while (ath9k_hw_numtxpending(ah, q)) {
188 if ((--wait) == 0) { 188 if ((--wait) == 0) {
189 ath_print(common, ATH_DBG_QUEUE, 189 ath_print(common, ATH_DBG_FATAL,
190 "Failed to stop TX DMA in 100 " 190 "Failed to stop TX DMA in 100 "
191 "msec after killing last frame\n"); 191 "msec after killing last frame\n");
192 break; 192 break;
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index 0c87771383f0..e185479e295e 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -77,6 +77,9 @@
77#define ATH9K_TXERR_XTXOP 0x08 77#define ATH9K_TXERR_XTXOP 0x08
78#define ATH9K_TXERR_TIMER_EXPIRED 0x10 78#define ATH9K_TXERR_TIMER_EXPIRED 0x10
79#define ATH9K_TX_ACKED 0x20 79#define ATH9K_TX_ACKED 0x20
80#define ATH9K_TXERR_MASK \
81 (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \
82 ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED)
80 83
81#define ATH9K_TX_BA 0x01 84#define ATH9K_TX_BA 0x01
82#define ATH9K_TX_PWRMGMT 0x02 85#define ATH9K_TX_PWRMGMT 0x02
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c48743452515..996eb90263cc 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1973,6 +1973,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
1973 struct ieee80211_hw *hw = sc->hw; 1973 struct ieee80211_hw *hw = sc->hw;
1974 int r; 1974 int r;
1975 1975
1976 /* Stop ANI */
1977 del_timer_sync(&common->ani.timer);
1978
1976 ath9k_hw_set_interrupts(ah, 0); 1979 ath9k_hw_set_interrupts(ah, 0);
1977 ath_drain_all_txq(sc, retry_tx); 1980 ath_drain_all_txq(sc, retry_tx);
1978 ath_stoprecv(sc); 1981 ath_stoprecv(sc);
@@ -2014,6 +2017,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
2014 } 2017 }
2015 } 2018 }
2016 2019
2020 /* Start ANI */
2021 ath_start_ani(common);
2022
2017 return r; 2023 return r;
2018} 2024}
2019 2025
@@ -2508,6 +2514,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2508 return; /* another wiphy still in use */ 2514 return; /* another wiphy still in use */
2509 } 2515 }
2510 2516
2517 /* Ensure HW is awake when we try to shut it down. */
2518 ath9k_ps_wakeup(sc);
2519
2511 if (ah->btcoex_hw.enabled) { 2520 if (ah->btcoex_hw.enabled) {
2512 ath9k_hw_btcoex_disable(ah); 2521 ath9k_hw_btcoex_disable(ah);
2513 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 2522 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
@@ -2528,6 +2537,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2528 /* disable HAL and put h/w to sleep */ 2537 /* disable HAL and put h/w to sleep */
2529 ath9k_hw_disable(ah); 2538 ath9k_hw_disable(ah);
2530 ath9k_hw_configpcipowersave(ah, 1, 1); 2539 ath9k_hw_configpcipowersave(ah, 1, 1);
2540 ath9k_ps_restore(sc);
2541
2542 /* Finally, put the chip in FULL SLEEP mode */
2531 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); 2543 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP);
2532 2544
2533 sc->sc_flags |= SC_OP_INVALID; 2545 sc->sc_flags |= SC_OP_INVALID;
@@ -2641,8 +2653,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
2641 if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || 2653 if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
2642 (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || 2654 (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
2643 (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { 2655 (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
2656 ath9k_ps_wakeup(sc);
2644 ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); 2657 ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
2645 ath_beacon_return(sc, avp); 2658 ath_beacon_return(sc, avp);
2659 ath9k_ps_restore(sc);
2646 } 2660 }
2647 2661
2648 sc->sc_flags &= ~SC_OP_BEACONS; 2662 sc->sc_flags &= ~SC_OP_BEACONS;
@@ -3091,15 +3105,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
3091 case IEEE80211_AMPDU_RX_STOP: 3105 case IEEE80211_AMPDU_RX_STOP:
3092 break; 3106 break;
3093 case IEEE80211_AMPDU_TX_START: 3107 case IEEE80211_AMPDU_TX_START:
3108 ath9k_ps_wakeup(sc);
3094 ath_tx_aggr_start(sc, sta, tid, ssn); 3109 ath_tx_aggr_start(sc, sta, tid, ssn);
3095 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); 3110 ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
3111 ath9k_ps_restore(sc);
3096 break; 3112 break;
3097 case IEEE80211_AMPDU_TX_STOP: 3113 case IEEE80211_AMPDU_TX_STOP:
3114 ath9k_ps_wakeup(sc);
3098 ath_tx_aggr_stop(sc, sta, tid); 3115 ath_tx_aggr_stop(sc, sta, tid);
3099 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); 3116 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
3117 ath9k_ps_restore(sc);
3100 break; 3118 break;
3101 case IEEE80211_AMPDU_TX_OPERATIONAL: 3119 case IEEE80211_AMPDU_TX_OPERATIONAL:
3120 ath9k_ps_wakeup(sc);
3102 ath_tx_aggr_resume(sc, sta, tid); 3121 ath_tx_aggr_resume(sc, sta, tid);
3122 ath9k_ps_restore(sc);
3103 break; 3123 break;
3104 default: 3124 default:
3105 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 3125 ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL,
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 5321f735e5a0..f7af5ea54753 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -96,7 +96,7 @@ static void ath_pci_bt_coex_prep(struct ath_common *common)
96 pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); 96 pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm);
97} 97}
98 98
99const static struct ath_bus_ops ath_pci_bus_ops = { 99static const struct ath_bus_ops ath_pci_bus_ops = {
100 .read_cachesize = ath_pci_read_cachesize, 100 .read_cachesize = ath_pci_read_cachesize,
101 .cleanup = ath_pci_cleanup, 101 .cleanup = ath_pci_cleanup,
102 .eeprom_read = ath_pci_eeprom_read, 102 .eeprom_read = ath_pci_eeprom_read,
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 2a11cc57ceea..fa12b9060b0b 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1108,11 +1108,11 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
1108 if (npend) { 1108 if (npend) {
1109 int r; 1109 int r;
1110 1110
1111 ath_print(common, ATH_DBG_XMIT, 1111 ath_print(common, ATH_DBG_FATAL,
1112 "Unable to stop TxDMA. Reset HAL!\n"); 1112 "Unable to stop TxDMA. Reset HAL!\n");
1113 1113
1114 spin_lock_bh(&sc->sc_resetlock); 1114 spin_lock_bh(&sc->sc_resetlock);
1115 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, true); 1115 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false);
1116 if (r) 1116 if (r)
1117 ath_print(common, ATH_DBG_FATAL, 1117 ath_print(common, ATH_DBG_FATAL,
1118 "Unable to reset hardware; reset status %d\n", 1118 "Unable to reset hardware; reset status %d\n",
@@ -1414,17 +1414,9 @@ static void assign_aggr_tid_seqno(struct sk_buff *skb,
1414 * For HT capable stations, we save tidno for later use. 1414 * For HT capable stations, we save tidno for later use.
1415 * We also override seqno set by upper layer with the one 1415 * We also override seqno set by upper layer with the one
1416 * in tx aggregation state. 1416 * in tx aggregation state.
1417 *
1418 * If fragmentation is on, the sequence number is
1419 * not overridden, since it has been
1420 * incremented by the fragmentation routine.
1421 *
1422 * FIXME: check if the fragmentation threshold exceeds
1423 * IEEE80211 max.
1424 */ 1417 */
1425 tid = ATH_AN_2_TID(an, bf->bf_tidno); 1418 tid = ATH_AN_2_TID(an, bf->bf_tidno);
1426 hdr->seq_ctrl = cpu_to_le16(tid->seq_next << 1419 hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT);
1427 IEEE80211_SEQ_SEQ_SHIFT);
1428 bf->bf_seqno = tid->seq_next; 1420 bf->bf_seqno = tid->seq_next;
1429 INCR(tid->seq_next, IEEE80211_SEQ_MAX); 1421 INCR(tid->seq_next, IEEE80211_SEQ_MAX);
1430} 1422}
@@ -1636,7 +1628,8 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
1636 bf->bf_keyix = ATH9K_TXKEYIX_INVALID; 1628 bf->bf_keyix = ATH9K_TXKEYIX_INVALID;
1637 } 1629 }
1638 1630
1639 if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR)) 1631 if (ieee80211_is_data_qos(fc) && bf_isht(bf) &&
1632 (sc->sc_flags & SC_OP_TXAGGR))
1640 assign_aggr_tid_seqno(skb, bf); 1633 assign_aggr_tid_seqno(skb, bf);
1641 1634
1642 bf->bf_mpdu = skb; 1635 bf->bf_mpdu = skb;
@@ -1780,7 +1773,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
1780 struct ath_wiphy *aphy = hw->priv; 1773 struct ath_wiphy *aphy = hw->priv;
1781 struct ath_softc *sc = aphy->sc; 1774 struct ath_softc *sc = aphy->sc;
1782 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1775 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1783 int hdrlen, padsize; 1776 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1777 int padpos, padsize;
1784 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1778 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1785 struct ath_tx_control txctl; 1779 struct ath_tx_control txctl;
1786 1780
@@ -1792,7 +1786,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
1792 * BSSes. 1786 * BSSes.
1793 */ 1787 */
1794 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { 1788 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
1795 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1796 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) 1789 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
1797 sc->tx.seq_no += 0x10; 1790 sc->tx.seq_no += 0x10;
1798 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); 1791 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
@@ -1800,9 +1793,9 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
1800 } 1793 }
1801 1794
1802 /* Add the padding after the header if this is not already done */ 1795 /* Add the padding after the header if this is not already done */
1803 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1796 padpos = ath9k_cmn_padpos(hdr->frame_control);
1804 if (hdrlen & 3) { 1797 padsize = padpos & 3;
1805 padsize = hdrlen % 4; 1798 if (padsize && skb->len>padpos) {
1806 if (skb_headroom(skb) < padsize) { 1799 if (skb_headroom(skb) < padsize) {
1807 ath_print(common, ATH_DBG_XMIT, 1800 ath_print(common, ATH_DBG_XMIT,
1808 "TX CABQ padding failed\n"); 1801 "TX CABQ padding failed\n");
@@ -1810,7 +1803,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
1810 return; 1803 return;
1811 } 1804 }
1812 skb_push(skb, padsize); 1805 skb_push(skb, padsize);
1813 memmove(skb->data, skb->data + padsize, hdrlen); 1806 memmove(skb->data, skb->data + padsize, padpos);
1814 } 1807 }
1815 1808
1816 txctl.txq = sc->beacon.cabq; 1809 txctl.txq = sc->beacon.cabq;
@@ -1838,7 +1831,8 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
1838 struct ieee80211_hw *hw = sc->hw; 1831 struct ieee80211_hw *hw = sc->hw;
1839 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 1832 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1840 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1833 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1841 int hdrlen, padsize; 1834 struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data;
1835 int padpos, padsize;
1842 1836
1843 ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); 1837 ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
1844 1838
@@ -1853,14 +1847,14 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
1853 tx_info->flags |= IEEE80211_TX_STAT_ACK; 1847 tx_info->flags |= IEEE80211_TX_STAT_ACK;
1854 } 1848 }
1855 1849
1856 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1850 padpos = ath9k_cmn_padpos(hdr->frame_control);
1857 padsize = hdrlen & 3; 1851 padsize = padpos & 3;
1858 if (padsize && hdrlen >= 24) { 1852 if (padsize && skb->len>padpos+padsize) {
1859 /* 1853 /*
1860 * Remove MAC header padding before giving the frame back to 1854 * Remove MAC header padding before giving the frame back to
1861 * mac80211. 1855 * mac80211.
1862 */ 1856 */
1863 memmove(skb->data + padsize, skb->data, hdrlen); 1857 memmove(skb->data + padsize, skb->data, padpos);
1864 skb_pull(skb, padsize); 1858 skb_pull(skb, padsize);
1865 } 1859 }
1866 1860
@@ -2078,7 +2072,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2078 &txq->axq_q, lastbf->list.prev); 2072 &txq->axq_q, lastbf->list.prev);
2079 2073
2080 txq->axq_depth--; 2074 txq->axq_depth--;
2081 txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT); 2075 txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_MASK);
2082 txq->axq_tx_inprogress = false; 2076 txq->axq_tx_inprogress = false;
2083 spin_unlock_bh(&txq->axq_lock); 2077 spin_unlock_bh(&txq->axq_lock);
2084 2078
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 027be275e035..88d1fd02d40a 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -383,160 +383,44 @@ static inline
383 } 383 }
384} 384}
385 385
386/* Check if a DMA region fits the device constraints.
387 * Returns true, if the region is OK for usage with this device. */
388static inline bool b43_dma_address_ok(struct b43_dmaring *ring,
389 dma_addr_t addr, size_t size)
390{
391 switch (ring->type) {
392 case B43_DMA_30BIT:
393 if ((u64)addr + size > (1ULL << 30))
394 return 0;
395 break;
396 case B43_DMA_32BIT:
397 if ((u64)addr + size > (1ULL << 32))
398 return 0;
399 break;
400 case B43_DMA_64BIT:
401 /* Currently we can't have addresses beyond
402 * 64bit in the kernel. */
403 break;
404 }
405 return 1;
406}
407
408#define is_4k_aligned(addr) (((u64)(addr) & 0x0FFFull) == 0)
409#define is_8k_aligned(addr) (((u64)(addr) & 0x1FFFull) == 0)
410
411static void b43_unmap_and_free_ringmem(struct b43_dmaring *ring, void *base,
412 dma_addr_t dmaaddr, size_t size)
413{
414 ssb_dma_unmap_single(ring->dev->dev, dmaaddr, size, DMA_TO_DEVICE);
415 free_pages((unsigned long)base, get_order(size));
416}
417
418static void * __b43_get_and_map_ringmem(struct b43_dmaring *ring,
419 dma_addr_t *dmaaddr, size_t size,
420 gfp_t gfp_flags)
421{
422 void *base;
423
424 base = (void *)__get_free_pages(gfp_flags, get_order(size));
425 if (!base)
426 return NULL;
427 memset(base, 0, size);
428 *dmaaddr = ssb_dma_map_single(ring->dev->dev, base, size,
429 DMA_TO_DEVICE);
430 if (ssb_dma_mapping_error(ring->dev->dev, *dmaaddr)) {
431 free_pages((unsigned long)base, get_order(size));
432 return NULL;
433 }
434
435 return base;
436}
437
438static void * b43_get_and_map_ringmem(struct b43_dmaring *ring,
439 dma_addr_t *dmaaddr, size_t size)
440{
441 void *base;
442
443 base = __b43_get_and_map_ringmem(ring, dmaaddr, size,
444 GFP_KERNEL);
445 if (!base) {
446 b43err(ring->dev->wl, "Failed to allocate or map pages "
447 "for DMA ringmemory\n");
448 return NULL;
449 }
450 if (!b43_dma_address_ok(ring, *dmaaddr, size)) {
451 /* The memory does not fit our device constraints.
452 * Retry with GFP_DMA set to get lower memory. */
453 b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size);
454 base = __b43_get_and_map_ringmem(ring, dmaaddr, size,
455 GFP_KERNEL | GFP_DMA);
456 if (!base) {
457 b43err(ring->dev->wl, "Failed to allocate or map pages "
458 "in the GFP_DMA region for DMA ringmemory\n");
459 return NULL;
460 }
461 if (!b43_dma_address_ok(ring, *dmaaddr, size)) {
462 b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size);
463 b43err(ring->dev->wl, "Failed to allocate DMA "
464 "ringmemory that fits device constraints\n");
465 return NULL;
466 }
467 }
468 /* We expect the memory to be 4k aligned, at least. */
469 if (B43_WARN_ON(!is_4k_aligned(*dmaaddr))) {
470 b43_unmap_and_free_ringmem(ring, base, *dmaaddr, size);
471 return NULL;
472 }
473
474 return base;
475}
476
477static int alloc_ringmemory(struct b43_dmaring *ring) 386static int alloc_ringmemory(struct b43_dmaring *ring)
478{ 387{
479 unsigned int required; 388 gfp_t flags = GFP_KERNEL;
480 void *base; 389
481 dma_addr_t dmaaddr; 390 /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
482 391 * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing
483 /* There are several requirements to the descriptor ring memory: 392 * has shown that 4K is sufficient for the latter as long as the buffer
484 * - The memory region needs to fit the address constraints for the 393 * does not cross an 8K boundary.
485 * device (same as for frame buffers). 394 *
486 * - For 30/32bit DMA devices, the descriptor ring must be 4k aligned. 395 * For unknown reasons - possibly a hardware error - the BCM4311 rev
487 * - For 64bit DMA devices, the descriptor ring must be 8k aligned. 396 * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
397 * which accounts for the GFP_DMA flag below.
398 *
399 * The flags here must match the flags in free_ringmemory below!
488 */ 400 */
489
490 if (ring->type == B43_DMA_64BIT) 401 if (ring->type == B43_DMA_64BIT)
491 required = ring->nr_slots * sizeof(struct b43_dmadesc64); 402 flags |= GFP_DMA;
492 else 403 ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev,
493 required = ring->nr_slots * sizeof(struct b43_dmadesc32); 404 B43_DMA_RINGMEMSIZE,
494 if (B43_WARN_ON(required > 0x1000)) 405 &(ring->dmabase), flags);
406 if (!ring->descbase) {
407 b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
495 return -ENOMEM; 408 return -ENOMEM;
496
497 ring->alloc_descsize = 0x1000;
498 base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize);
499 if (!base)
500 return -ENOMEM;
501 ring->alloc_descbase = base;
502 ring->alloc_dmabase = dmaaddr;
503
504 if ((ring->type != B43_DMA_64BIT) || is_8k_aligned(dmaaddr)) {
505 /* We're on <=32bit DMA, or we already got 8k aligned memory.
506 * That's all we need, so we're fine. */
507 ring->descbase = base;
508 ring->dmabase = dmaaddr;
509 return 0;
510 }
511 b43_unmap_and_free_ringmem(ring, base, dmaaddr, ring->alloc_descsize);
512
513 /* Ok, we failed at the 8k alignment requirement.
514 * Try to force-align the memory region now. */
515 ring->alloc_descsize = 0x2000;
516 base = b43_get_and_map_ringmem(ring, &dmaaddr, ring->alloc_descsize);
517 if (!base)
518 return -ENOMEM;
519 ring->alloc_descbase = base;
520 ring->alloc_dmabase = dmaaddr;
521
522 if (is_8k_aligned(dmaaddr)) {
523 /* We're already 8k aligned. That Ok, too. */
524 ring->descbase = base;
525 ring->dmabase = dmaaddr;
526 return 0;
527 } 409 }
528 /* Force-align it to 8k */ 410 memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE);
529 ring->descbase = (void *)((u8 *)base + 0x1000);
530 ring->dmabase = dmaaddr + 0x1000;
531 B43_WARN_ON(!is_8k_aligned(ring->dmabase));
532 411
533 return 0; 412 return 0;
534} 413}
535 414
536static void free_ringmemory(struct b43_dmaring *ring) 415static void free_ringmemory(struct b43_dmaring *ring)
537{ 416{
538 b43_unmap_and_free_ringmem(ring, ring->alloc_descbase, 417 gfp_t flags = GFP_KERNEL;
539 ring->alloc_dmabase, ring->alloc_descsize); 418
419 if (ring->type == B43_DMA_64BIT)
420 flags |= GFP_DMA;
421
422 ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE,
423 ring->descbase, ring->dmabase, flags);
540} 424}
541 425
542/* Reset the RX DMA channel */ 426/* Reset the RX DMA channel */
@@ -646,14 +530,29 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring,
646 if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) 530 if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr)))
647 return 1; 531 return 1;
648 532
649 if (!b43_dma_address_ok(ring, addr, buffersize)) { 533 switch (ring->type) {
650 /* We can't support this address. Unmap it again. */ 534 case B43_DMA_30BIT:
651 unmap_descbuffer(ring, addr, buffersize, dma_to_device); 535 if ((u64)addr + buffersize > (1ULL << 30))
652 return 1; 536 goto address_error;
537 break;
538 case B43_DMA_32BIT:
539 if ((u64)addr + buffersize > (1ULL << 32))
540 goto address_error;
541 break;
542 case B43_DMA_64BIT:
543 /* Currently we can't have addresses beyond
544 * 64bit in the kernel. */
545 break;
653 } 546 }
654 547
655 /* The address is OK. */ 548 /* The address is OK. */
656 return 0; 549 return 0;
550
551address_error:
552 /* We can't support this address. Unmap it again. */
553 unmap_descbuffer(ring, addr, buffersize, dma_to_device);
554
555 return 1;
657} 556}
658 557
659static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) 558static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb)
@@ -715,9 +614,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
715 meta->dmaaddr = dmaaddr; 614 meta->dmaaddr = dmaaddr;
716 ring->ops->fill_descriptor(ring, desc, dmaaddr, 615 ring->ops->fill_descriptor(ring, desc, dmaaddr,
717 ring->rx_buffersize, 0, 0, 0); 616 ring->rx_buffersize, 0, 0, 0);
718 ssb_dma_sync_single_for_device(ring->dev->dev,
719 ring->alloc_dmabase,
720 ring->alloc_descsize, DMA_TO_DEVICE);
721 617
722 return 0; 618 return 0;
723} 619}
@@ -1354,9 +1250,6 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1354 } 1250 }
1355 /* Now transfer the whole frame. */ 1251 /* Now transfer the whole frame. */
1356 wmb(); 1252 wmb();
1357 ssb_dma_sync_single_for_device(ring->dev->dev,
1358 ring->alloc_dmabase,
1359 ring->alloc_descsize, DMA_TO_DEVICE);
1360 ops->poke_tx(ring, next_slot(ring, slot)); 1253 ops->poke_tx(ring, next_slot(ring, slot));
1361 return 0; 1254 return 0;
1362 1255
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index e607b392314c..f7ab37c4cdbc 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -157,6 +157,7 @@ struct b43_dmadesc_generic {
157} __attribute__ ((__packed__)); 157} __attribute__ ((__packed__));
158 158
159/* Misc DMA constants */ 159/* Misc DMA constants */
160#define B43_DMA_RINGMEMSIZE PAGE_SIZE
160#define B43_DMA0_RX_FRAMEOFFSET 30 161#define B43_DMA0_RX_FRAMEOFFSET 30
161 162
162/* DMA engine tuning knobs */ 163/* DMA engine tuning knobs */
@@ -246,12 +247,6 @@ struct b43_dmaring {
246 /* The QOS priority assigned to this ring. Only used for TX rings. 247 /* The QOS priority assigned to this ring. Only used for TX rings.
247 * This is the mac80211 "queue" value. */ 248 * This is the mac80211 "queue" value. */
248 u8 queue_prio; 249 u8 queue_prio;
249 /* Pointers and size of the originally allocated and mapped memory
250 * region for the descriptor ring. */
251 void *alloc_descbase;
252 dma_addr_t alloc_dmabase;
253 unsigned int alloc_descsize;
254 /* Pointer to our wireless device. */
255 struct b43_wldev *dev; 250 struct b43_wldev *dev;
256#ifdef CONFIG_B43_DEBUG 251#ifdef CONFIG_B43_DEBUG
257 /* Maximum number of used slots. */ 252 /* Maximum number of used slots. */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 7da1dab933d9..234891d8cc10 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -681,19 +681,13 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
681 snr = rx_stats_sig_avg / rx_stats_noise_diff; 681 snr = rx_stats_sig_avg / rx_stats_noise_diff;
682 rx_status.noise = rx_status.signal - 682 rx_status.noise = rx_status.signal -
683 iwl3945_calc_db_from_ratio(snr); 683 iwl3945_calc_db_from_ratio(snr);
684 rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal,
685 rx_status.noise);
686
687 /* If noise info not available, calculate signal quality indicator (%)
688 * using just the dBm signal level. */
689 } else { 684 } else {
690 rx_status.noise = priv->last_rx_noise; 685 rx_status.noise = priv->last_rx_noise;
691 rx_status.qual = iwl3945_calc_sig_qual(rx_status.signal, 0);
692 } 686 }
693 687
694 688
695 IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n", 689 IWL_DEBUG_STATS(priv, "Rssi %d noise %d sig_avg %d noise_diff %d\n",
696 rx_status.signal, rx_status.noise, rx_status.qual, 690 rx_status.signal, rx_status.noise,
697 rx_stats_sig_avg, rx_stats_noise_diff); 691 rx_stats_sig_avg, rx_stats_noise_diff);
698 692
699 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 693 header = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
@@ -1835,8 +1829,7 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
1835 rc = -EIO; 1829 rc = -EIO;
1836 } 1830 }
1837 1831
1838 priv->alloc_rxb_page--; 1832 iwl_free_pages(priv, cmd.reply_page);
1839 free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
1840 1833
1841 return rc; 1834 return rc;
1842} 1835}
@@ -2836,6 +2829,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
2836 .use_isr_legacy = true, 2829 .use_isr_legacy = true,
2837 .ht_greenfield_support = false, 2830 .ht_greenfield_support = false,
2838 .led_compensation = 64, 2831 .led_compensation = 64,
2832 .broken_powersave = true,
2839}; 2833};
2840 2834
2841static struct iwl_cfg iwl3945_abg_cfg = { 2835static struct iwl_cfg iwl3945_abg_cfg = {
@@ -2852,6 +2846,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
2852 .use_isr_legacy = true, 2846 .use_isr_legacy = true,
2853 .ht_greenfield_support = false, 2847 .ht_greenfield_support = false,
2854 .led_compensation = 64, 2848 .led_compensation = 64,
2849 .broken_powersave = true,
2855}; 2850};
2856 2851
2857struct pci_device_id iwl3945_hw_card_ids[] = { 2852struct pci_device_id iwl3945_hw_card_ids[] = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index ecc23ec1f6a4..531fa125f5a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -222,7 +222,6 @@ struct iwl3945_ibss_seq {
222 * 222 *
223 *****************************************************************************/ 223 *****************************************************************************/
224extern int iwl3945_calc_db_from_ratio(int sig_ratio); 224extern int iwl3945_calc_db_from_ratio(int sig_ratio);
225extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
226extern void iwl3945_rx_replenish(void *data); 225extern void iwl3945_rx_replenish(void *data);
227extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 226extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
228extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, 227extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 386513b601f5..484c5fdf7c2a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1204,7 +1204,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1204 iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info); 1204 iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info);
1205 1205
1206 /* calculate tx gain adjustment based on power supply voltage */ 1206 /* calculate tx gain adjustment based on power supply voltage */
1207 voltage = priv->calib_info->voltage; 1207 voltage = le16_to_cpu(priv->calib_info->voltage);
1208 init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); 1208 init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage);
1209 voltage_compensation = 1209 voltage_compensation =
1210 iwl4965_get_voltage_compensation(voltage, init_voltage); 1210 iwl4965_get_voltage_compensation(voltage, init_voltage);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
index 4ef6804a455a..bc056e9ab85f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
@@ -92,11 +92,15 @@
92 92
93static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) 93static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
94{ 94{
95 u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv, 95 u16 temperature, voltage;
96 EEPROM_5000_TEMPERATURE); 96 __le16 *temp_calib =
97 /* offset = temperature - voltage / coef */ 97 (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE);
98 s32 offset = (s32)(temp_calib[0] - temp_calib[1] / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); 98
99 return offset; 99 temperature = le16_to_cpu(temp_calib[0]);
100 voltage = le16_to_cpu(temp_calib[1]);
101
102 /* offset = temp - volt / coeff */
103 return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF);
100} 104}
101 105
102/* Fixed (non-configurable) rx data from phy */ 106/* Fixed (non-configurable) rx data from phy */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e2f8615c8c9b..33a5866538e7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -333,14 +333,15 @@ static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
333static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) 333static int iwl5000_set_Xtal_calib(struct iwl_priv *priv)
334{ 334{
335 struct iwl_calib_xtal_freq_cmd cmd; 335 struct iwl_calib_xtal_freq_cmd cmd;
336 u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); 336 __le16 *xtal_calib =
337 (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL);
337 338
338 cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; 339 cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD;
339 cmd.hdr.first_group = 0; 340 cmd.hdr.first_group = 0;
340 cmd.hdr.groups_num = 1; 341 cmd.hdr.groups_num = 1;
341 cmd.hdr.data_valid = 1; 342 cmd.hdr.data_valid = 1;
342 cmd.cap_pin1 = (u8)xtal_calib[0]; 343 cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
343 cmd.cap_pin2 = (u8)xtal_calib[1]; 344 cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);
344 return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], 345 return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL],
345 (u8 *)&cmd, sizeof(cmd)); 346 (u8 *)&cmd, sizeof(cmd));
346} 347}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index fe511cbf012e..b93e49158196 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -150,7 +150,7 @@ static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = {
150}; 150};
151 151
152/* mbps, mcs */ 152/* mbps, mcs */
153const static struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { 153static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = {
154 { "1", "BPSK DSSS"}, 154 { "1", "BPSK DSSS"},
155 { "2", "QPSK DSSS"}, 155 { "2", "QPSK DSSS"},
156 {"5.5", "BPSK CCK"}, 156 {"5.5", "BPSK CCK"},
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index b8377efb3ba7..1c9866daf815 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1842,7 +1842,7 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log)
1842 } 1842 }
1843 1843
1844#ifdef CONFIG_IWLWIFI_DEBUG 1844#ifdef CONFIG_IWLWIFI_DEBUG
1845 if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) 1845 if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log)
1846 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) 1846 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
1847 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; 1847 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
1848#else 1848#else
@@ -3173,7 +3173,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
3173 3173
3174 priv->ibss_beacon = NULL; 3174 priv->ibss_beacon = NULL;
3175 3175
3176 spin_lock_init(&priv->lock);
3177 spin_lock_init(&priv->sta_lock); 3176 spin_lock_init(&priv->sta_lock);
3178 spin_lock_init(&priv->hcmd_lock); 3177 spin_lock_init(&priv->hcmd_lock);
3179 3178
@@ -3361,10 +3360,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3361 (unsigned long long) pci_resource_len(pdev, 0)); 3360 (unsigned long long) pci_resource_len(pdev, 0));
3362 IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); 3361 IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
3363 3362
3364 /* this spin lock will be used in apm_ops.init and EEPROM access 3363 /* these spin locks will be used in apm_ops.init and EEPROM access
3365 * we should init now 3364 * we should init now
3366 */ 3365 */
3367 spin_lock_init(&priv->reg_lock); 3366 spin_lock_init(&priv->reg_lock);
3367 spin_lock_init(&priv->lock);
3368 iwl_hw_detect(priv); 3368 iwl_hw_detect(priv);
3369 IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n", 3369 IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n",
3370 priv->cfg->name, priv->hw_rev); 3370 priv->cfg->name, priv->hw_rev);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 675b7df632fc..27ca859e7453 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -63,7 +63,7 @@
63#ifndef __iwl_core_h__ 63#ifndef __iwl_core_h__
64#define __iwl_core_h__ 64#define __iwl_core_h__
65 65
66#include <linux/utsrelease.h> 66#include <generated/utsrelease.h>
67 67
68/************************ 68/************************
69 * forward declarations * 69 * forward declarations *
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h
index a7bfae01f19b..1ec8cb4d5eae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/iwlwifi/iwl-csr.h
@@ -77,8 +77,7 @@
77 * The MAC (uCode processor, etc.) does not need to be powered up for accessing 77 * The MAC (uCode processor, etc.) does not need to be powered up for accessing
78 * the CSR registers. 78 * the CSR registers.
79 * 79 *
80 * NOTE: Newer devices using one-time-programmable (OTP) memory 80 * NOTE: Device does need to be awake in order to read this memory
81 * require device to be awake in order to read this memory
82 * via CSR_EEPROM and CSR_OTP registers 81 * via CSR_EEPROM and CSR_OTP registers
83 */ 82 */
84#define CSR_BASE (0x000) 83#define CSR_BASE (0x000)
@@ -111,9 +110,8 @@
111/* 110/*
112 * EEPROM and OTP (one-time-programmable) memory reads 111 * EEPROM and OTP (one-time-programmable) memory reads
113 * 112 *
114 * NOTE: For (newer) devices using OTP, device must be awake, initialized via 113 * NOTE: Device must be awake, initialized via apm_ops.init(),
115 * apm_ops.init() in order to read. Older devices (3945/4965/5000) 114 * in order to read.
116 * use EEPROM and do not require this.
117 */ 115 */
118#define CSR_EEPROM_REG (CSR_BASE+0x02c) 116#define CSR_EEPROM_REG (CSR_BASE+0x02c)
119#define CSR_EEPROM_GP (CSR_BASE+0x030) 117#define CSR_EEPROM_GP (CSR_BASE+0x030)
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 2673e9a4db92..165d1f6e2dd9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1168,7 +1168,7 @@ struct iwl_priv {
1168 u32 last_beacon_time; 1168 u32 last_beacon_time;
1169 u64 last_tsf; 1169 u64 last_tsf;
1170 1170
1171 /* eeprom */ 1171 /* eeprom -- this is in the card's little endian byte order */
1172 u8 *eeprom; 1172 u8 *eeprom;
1173 int nvm_device_type; 1173 int nvm_device_type;
1174 struct iwl_eeprom_calib_info *calib_info; 1174 struct iwl_eeprom_calib_info *calib_info;
@@ -1353,4 +1353,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
1353 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; 1353 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
1354} 1354}
1355 1355
1356static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page)
1357{
1358 __free_pages(page, priv->hw_params.rx_page_order);
1359 priv->alloc_rxb_page--;
1360}
1361
1362static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page)
1363{
1364 free_pages(page, priv->hw_params.rx_page_order);
1365 priv->alloc_rxb_page--;
1366}
1356#endif /* __iwl_dev_h__ */ 1367#endif /* __iwl_dev_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 3946e5c03f81..4a30969689ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -370,7 +370,7 @@ static int iwl_init_otp_access(struct iwl_priv *priv)
370 return ret; 370 return ret;
371} 371}
372 372
373static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data) 373static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data)
374{ 374{
375 int ret = 0; 375 int ret = 0;
376 u32 r; 376 u32 r;
@@ -404,7 +404,7 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data)
404 CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); 404 CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK);
405 IWL_ERR(priv, "Correctable OTP ECC error, continue read\n"); 405 IWL_ERR(priv, "Correctable OTP ECC error, continue read\n");
406 } 406 }
407 *eeprom_data = le16_to_cpu((__force __le16)(r >> 16)); 407 *eeprom_data = cpu_to_le16(r >> 16);
408 return 0; 408 return 0;
409} 409}
410 410
@@ -413,7 +413,8 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data)
413 */ 413 */
414static bool iwl_is_otp_empty(struct iwl_priv *priv) 414static bool iwl_is_otp_empty(struct iwl_priv *priv)
415{ 415{
416 u16 next_link_addr = 0, link_value; 416 u16 next_link_addr = 0;
417 __le16 link_value;
417 bool is_empty = false; 418 bool is_empty = false;
418 419
419 /* locate the beginning of OTP link list */ 420 /* locate the beginning of OTP link list */
@@ -443,7 +444,8 @@ static bool iwl_is_otp_empty(struct iwl_priv *priv)
443static int iwl_find_otp_image(struct iwl_priv *priv, 444static int iwl_find_otp_image(struct iwl_priv *priv,
444 u16 *validblockaddr) 445 u16 *validblockaddr)
445{ 446{
446 u16 next_link_addr = 0, link_value = 0, valid_addr; 447 u16 next_link_addr = 0, valid_addr;
448 __le16 link_value = 0;
447 int usedblocks = 0; 449 int usedblocks = 0;
448 450
449 /* set addressing mode to absolute to traverse the link list */ 451 /* set addressing mode to absolute to traverse the link list */
@@ -463,7 +465,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
463 * check for more block on the link list 465 * check for more block on the link list
464 */ 466 */
465 valid_addr = next_link_addr; 467 valid_addr = next_link_addr;
466 next_link_addr = link_value * sizeof(u16); 468 next_link_addr = le16_to_cpu(link_value) * sizeof(u16);
467 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", 469 IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
468 usedblocks, next_link_addr); 470 usedblocks, next_link_addr);
469 if (iwl_read_otp_word(priv, next_link_addr, &link_value)) 471 if (iwl_read_otp_word(priv, next_link_addr, &link_value))
@@ -497,7 +499,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
497 */ 499 */
498int iwl_eeprom_init(struct iwl_priv *priv) 500int iwl_eeprom_init(struct iwl_priv *priv)
499{ 501{
500 u16 *e; 502 __le16 *e;
501 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 503 u32 gp = iwl_read32(priv, CSR_EEPROM_GP);
502 int sz; 504 int sz;
503 int ret; 505 int ret;
@@ -516,12 +518,9 @@ int iwl_eeprom_init(struct iwl_priv *priv)
516 ret = -ENOMEM; 518 ret = -ENOMEM;
517 goto alloc_err; 519 goto alloc_err;
518 } 520 }
519 e = (u16 *)priv->eeprom; 521 e = (__le16 *)priv->eeprom;
520 522
521 if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { 523 priv->cfg->ops->lib->apm_ops.init(priv);
522 /* OTP reads require powered-up chip */
523 priv->cfg->ops->lib->apm_ops.init(priv);
524 }
525 524
526 ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv); 525 ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
527 if (ret < 0) { 526 if (ret < 0) {
@@ -562,7 +561,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
562 } 561 }
563 for (addr = validblockaddr; addr < validblockaddr + sz; 562 for (addr = validblockaddr; addr < validblockaddr + sz;
564 addr += sizeof(u16)) { 563 addr += sizeof(u16)) {
565 u16 eeprom_data; 564 __le16 eeprom_data;
566 565
567 ret = iwl_read_otp_word(priv, addr, &eeprom_data); 566 ret = iwl_read_otp_word(priv, addr, &eeprom_data);
568 if (ret) 567 if (ret)
@@ -570,13 +569,6 @@ int iwl_eeprom_init(struct iwl_priv *priv)
570 e[cache_addr / 2] = eeprom_data; 569 e[cache_addr / 2] = eeprom_data;
571 cache_addr += sizeof(u16); 570 cache_addr += sizeof(u16);
572 } 571 }
573
574 /*
575 * Now that OTP reads are complete, reset chip to save
576 * power until we load uCode during "up".
577 */
578 priv->cfg->ops->lib->apm_ops.stop(priv);
579
580 } else { 572 } else {
581 /* eeprom is an array of 16bit values */ 573 /* eeprom is an array of 16bit values */
582 for (addr = 0; addr < sz; addr += sizeof(u16)) { 574 for (addr = 0; addr < sz; addr += sizeof(u16)) {
@@ -594,7 +586,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
594 goto done; 586 goto done;
595 } 587 }
596 r = _iwl_read_direct32(priv, CSR_EEPROM_REG); 588 r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
597 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); 589 e[addr / 2] = cpu_to_le16(r >> 16);
598 } 590 }
599 } 591 }
600 ret = 0; 592 ret = 0;
@@ -603,6 +595,8 @@ done:
603err: 595err:
604 if (ret) 596 if (ret)
605 iwl_eeprom_free(priv); 597 iwl_eeprom_free(priv);
598 /* Reset chip to save power until we load uCode during "up". */
599 priv->cfg->ops->lib->apm_ops.stop(priv);
606alloc_err: 600alloc_err:
607 return ret; 601 return ret;
608} 602}
@@ -755,7 +749,8 @@ static int iwl_mod_ht40_chan_info(struct iwl_priv *priv,
755 ch_info->ht40_eeprom = *eeprom_ch; 749 ch_info->ht40_eeprom = *eeprom_ch;
756 ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; 750 ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg;
757 ch_info->ht40_flags = eeprom_ch->flags; 751 ch_info->ht40_flags = eeprom_ch->flags;
758 ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel; 752 if (eeprom_ch->flags & EEPROM_CHANNEL_VALID)
753 ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel;
759 754
760 return 0; 755 return 0;
761} 756}
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 5cd2b66bbe45..0cd9c02ee044 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -137,7 +137,7 @@ struct iwl_eeprom_channel {
137 * 137 *
138 */ 138 */
139struct iwl_eeprom_enhanced_txpwr { 139struct iwl_eeprom_enhanced_txpwr {
140 u16 common; 140 __le16 common;
141 s8 chain_a_max; 141 s8 chain_a_max;
142 s8 chain_b_max; 142 s8 chain_b_max;
143 s8 chain_c_max; 143 s8 chain_c_max;
@@ -360,7 +360,7 @@ struct iwl_eeprom_calib_subband_info {
360struct iwl_eeprom_calib_info { 360struct iwl_eeprom_calib_info {
361 u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ 361 u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */
362 u8 saturation_power52; /* half-dBm */ 362 u8 saturation_power52; /* half-dBm */
363 s16 voltage; /* signed */ 363 __le16 voltage; /* signed */
364 struct iwl_eeprom_calib_subband_info 364 struct iwl_eeprom_calib_subband_info
365 band_info[EEPROM_TX_POWER_BANDS]; 365 band_info[EEPROM_TX_POWER_BANDS];
366} __attribute__ ((packed)); 366} __attribute__ ((packed));
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index a23165948202..30e9ea6d54ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -234,7 +234,7 @@ cancel:
234 } 234 }
235fail: 235fail:
236 if (cmd->reply_page) { 236 if (cmd->reply_page) {
237 free_pages(cmd->reply_page, priv->hw_params.rx_page_order); 237 iwl_free_pages(priv, cmd->reply_page);
238 cmd->reply_page = 0; 238 cmd->reply_page = 0;
239 } 239 }
240out: 240out:
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 6090bc15a6d5..6f36b6e79f5e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -345,10 +345,8 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
345 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 345 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
346 PAGE_SIZE << priv->hw_params.rx_page_order, 346 PAGE_SIZE << priv->hw_params.rx_page_order,
347 PCI_DMA_FROMDEVICE); 347 PCI_DMA_FROMDEVICE);
348 __free_pages(rxq->pool[i].page, 348 __iwl_free_pages(priv, rxq->pool[i].page);
349 priv->hw_params.rx_page_order);
350 rxq->pool[i].page = NULL; 349 rxq->pool[i].page = NULL;
351 priv->alloc_rxb_page--;
352 } 350 }
353 } 351 }
354 352
@@ -416,9 +414,7 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
416 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 414 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
417 PAGE_SIZE << priv->hw_params.rx_page_order, 415 PAGE_SIZE << priv->hw_params.rx_page_order,
418 PCI_DMA_FROMDEVICE); 416 PCI_DMA_FROMDEVICE);
419 priv->alloc_rxb_page--; 417 __iwl_free_pages(priv, rxq->pool[i].page);
420 __free_pages(rxq->pool[i].page,
421 priv->hw_params.rx_page_order);
422 rxq->pool[i].page = NULL; 418 rxq->pool[i].page = NULL;
423 } 419 }
424 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 420 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
@@ -654,47 +650,6 @@ void iwl_reply_statistics(struct iwl_priv *priv,
654} 650}
655EXPORT_SYMBOL(iwl_reply_statistics); 651EXPORT_SYMBOL(iwl_reply_statistics);
656 652
657#define PERFECT_RSSI (-20) /* dBm */
658#define WORST_RSSI (-95) /* dBm */
659#define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI)
660
661/* Calculate an indication of rx signal quality (a percentage, not dBm!).
662 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info
663 * about formulas used below. */
664static int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)
665{
666 int sig_qual;
667 int degradation = PERFECT_RSSI - rssi_dbm;
668
669 /* If we get a noise measurement, use signal-to-noise ratio (SNR)
670 * as indicator; formula is (signal dbm - noise dbm).
671 * SNR at or above 40 is a great signal (100%).
672 * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator.
673 * Weakest usable signal is usually 10 - 15 dB SNR. */
674 if (noise_dbm) {
675 if (rssi_dbm - noise_dbm >= 40)
676 return 100;
677 else if (rssi_dbm < noise_dbm)
678 return 0;
679 sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2;
680
681 /* Else use just the signal level.
682 * This formula is a least squares fit of data points collected and
683 * compared with a reference system that had a percentage (%) display
684 * for signal quality. */
685 } else
686 sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation *
687 (15 * RSSI_RANGE + 62 * degradation)) /
688 (RSSI_RANGE * RSSI_RANGE);
689
690 if (sig_qual > 100)
691 sig_qual = 100;
692 else if (sig_qual < 1)
693 sig_qual = 0;
694
695 return sig_qual;
696}
697
698/* Calc max signal level (dBm) among 3 possible receivers */ 653/* Calc max signal level (dBm) among 3 possible receivers */
699static inline int iwl_calc_rssi(struct iwl_priv *priv, 654static inline int iwl_calc_rssi(struct iwl_priv *priv,
700 struct iwl_rx_phy_res *rx_resp) 655 struct iwl_rx_phy_res *rx_resp)
@@ -1105,11 +1060,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1105 if (iwl_is_associated(priv) && 1060 if (iwl_is_associated(priv) &&
1106 !test_bit(STATUS_SCANNING, &priv->status)) { 1061 !test_bit(STATUS_SCANNING, &priv->status)) {
1107 rx_status.noise = priv->last_rx_noise; 1062 rx_status.noise = priv->last_rx_noise;
1108 rx_status.qual = iwl_calc_sig_qual(rx_status.signal,
1109 rx_status.noise);
1110 } else { 1063 } else {
1111 rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE; 1064 rx_status.noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
1112 rx_status.qual = iwl_calc_sig_qual(rx_status.signal, 0);
1113 } 1065 }
1114 1066
1115 /* Reset beacon noise level if not associated. */ 1067 /* Reset beacon noise level if not associated. */
@@ -1122,8 +1074,8 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1122 iwl_dbg_report_frame(priv, phy_res, len, header, 1); 1074 iwl_dbg_report_frame(priv, phy_res, len, header, 1);
1123#endif 1075#endif
1124 iwl_dbg_log_rx_data_frame(priv, len, header); 1076 iwl_dbg_log_rx_data_frame(priv, len, header);
1125 IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", 1077 IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, TSF %llu\n",
1126 rx_status.signal, rx_status.noise, rx_status.qual, 1078 rx_status.signal, rx_status.noise,
1127 (unsigned long long)rx_status.mactime); 1079 (unsigned long long)rx_status.mactime);
1128 1080
1129 /* 1081 /*
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index a2b2b8315ff9..fa1c89ba6459 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -144,8 +144,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
144 clear_bit(STATUS_SCAN_HW, &priv->status); 144 clear_bit(STATUS_SCAN_HW, &priv->status);
145 } 145 }
146 146
147 priv->alloc_rxb_page--; 147 iwl_free_pages(priv, cmd.reply_page);
148 free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
149 148
150 return ret; 149 return ret;
151} 150}
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index cd6a6901216e..cde09a890b73 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -164,9 +164,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
164 break; 164 break;
165 } 165 }
166 } 166 }
167 167 iwl_free_pages(priv, cmd.reply_page);
168 priv->alloc_rxb_page--;
169 free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
170 168
171 return ret; 169 return ret;
172} 170}
@@ -391,9 +389,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
391 break; 389 break;
392 } 390 }
393 } 391 }
394 392 iwl_free_pages(priv, cmd.reply_page);
395 priv->alloc_rxb_page--;
396 free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
397 393
398 return ret; 394 return ret;
399} 395}
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 00da5e152d46..87ce2bd292c7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -407,13 +407,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv)
407 int txq_id; 407 int txq_id;
408 408
409 /* Tx queues */ 409 /* Tx queues */
410 if (priv->txq) 410 if (priv->txq) {
411 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; 411 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
412 txq_id++) 412 txq_id++)
413 if (txq_id == IWL_CMD_QUEUE_NUM) 413 if (txq_id == IWL_CMD_QUEUE_NUM)
414 iwl_cmd_queue_free(priv); 414 iwl_cmd_queue_free(priv);
415 else 415 else
416 iwl_tx_queue_free(priv, txq_id); 416 iwl_tx_queue_free(priv, txq_id);
417 }
417 iwl_free_dma_ptr(priv, &priv->kw); 418 iwl_free_dma_ptr(priv, &priv->kw);
418 419
419 iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); 420 iwl_free_dma_ptr(priv, &priv->scd_bc_tbls);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2a28a1f8b1fe..f8e4e4b18d02 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -548,6 +548,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
548 txq = &priv->txq[txq_id]; 548 txq = &priv->txq[txq_id];
549 q = &txq->q; 549 q = &txq->q;
550 550
551 if ((iwl_queue_space(q) < q->high_mark))
552 goto drop;
553
551 spin_lock_irqsave(&priv->lock, flags); 554 spin_lock_irqsave(&priv->lock, flags);
552 555
553 idx = get_cmd_index(q, q->write_ptr, 0); 556 idx = get_cmd_index(q, q->write_ptr, 0);
@@ -812,7 +815,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
812 break; 815 break;
813 } 816 }
814 817
815 free_pages(cmd.reply_page, priv->hw_params.rx_page_order); 818 iwl_free_pages(priv, cmd.reply_page);
816 819
817 return rc; 820 return rc;
818} 821}
@@ -1198,9 +1201,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1198 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 1201 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
1199 PAGE_SIZE << priv->hw_params.rx_page_order, 1202 PAGE_SIZE << priv->hw_params.rx_page_order,
1200 PCI_DMA_FROMDEVICE); 1203 PCI_DMA_FROMDEVICE);
1201 priv->alloc_rxb_page--; 1204 __iwl_free_pages(priv, rxq->pool[i].page);
1202 __free_pages(rxq->pool[i].page,
1203 priv->hw_params.rx_page_order);
1204 rxq->pool[i].page = NULL; 1205 rxq->pool[i].page = NULL;
1205 } 1206 }
1206 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 1207 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
@@ -1247,10 +1248,8 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1247 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, 1248 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
1248 PAGE_SIZE << priv->hw_params.rx_page_order, 1249 PAGE_SIZE << priv->hw_params.rx_page_order,
1249 PCI_DMA_FROMDEVICE); 1250 PCI_DMA_FROMDEVICE);
1250 __free_pages(rxq->pool[i].page, 1251 __iwl_free_pages(priv, rxq->pool[i].page);
1251 priv->hw_params.rx_page_order);
1252 rxq->pool[i].page = NULL; 1252 rxq->pool[i].page = NULL;
1253 priv->alloc_rxb_page--;
1254 } 1253 }
1255 } 1254 }
1256 1255
@@ -1300,47 +1299,6 @@ int iwl3945_calc_db_from_ratio(int sig_ratio)
1300 return (int)ratio2dB[sig_ratio]; 1299 return (int)ratio2dB[sig_ratio];
1301} 1300}
1302 1301
1303#define PERFECT_RSSI (-20) /* dBm */
1304#define WORST_RSSI (-95) /* dBm */
1305#define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI)
1306
1307/* Calculate an indication of rx signal quality (a percentage, not dBm!).
1308 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info
1309 * about formulas used below. */
1310int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
1311{
1312 int sig_qual;
1313 int degradation = PERFECT_RSSI - rssi_dbm;
1314
1315 /* If we get a noise measurement, use signal-to-noise ratio (SNR)
1316 * as indicator; formula is (signal dbm - noise dbm).
1317 * SNR at or above 40 is a great signal (100%).
1318 * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator.
1319 * Weakest usable signal is usually 10 - 15 dB SNR. */
1320 if (noise_dbm) {
1321 if (rssi_dbm - noise_dbm >= 40)
1322 return 100;
1323 else if (rssi_dbm < noise_dbm)
1324 return 0;
1325 sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2;
1326
1327 /* Else use just the signal level.
1328 * This formula is a least squares fit of data points collected and
1329 * compared with a reference system that had a percentage (%) display
1330 * for signal quality. */
1331 } else
1332 sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation *
1333 (15 * RSSI_RANGE + 62 * degradation)) /
1334 (RSSI_RANGE * RSSI_RANGE);
1335
1336 if (sig_qual > 100)
1337 sig_qual = 100;
1338 else if (sig_qual < 1)
1339 sig_qual = 0;
1340
1341 return sig_qual;
1342}
1343
1344/** 1302/**
1345 * iwl3945_rx_handle - Main entry function for receiving responses from uCode 1303 * iwl3945_rx_handle - Main entry function for receiving responses from uCode
1346 * 1304 *
@@ -1688,7 +1646,7 @@ void iwl3945_dump_nic_event_log(struct iwl_priv *priv, bool full_log)
1688 } 1646 }
1689 1647
1690#ifdef CONFIG_IWLWIFI_DEBUG 1648#ifdef CONFIG_IWLWIFI_DEBUG
1691 if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)) 1649 if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log)
1692 size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES) 1650 size = (size > DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES)
1693 ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size; 1651 ? DEFAULT_IWL3945_DUMP_EVENT_LOG_ENTRIES : size;
1694#else 1652#else
@@ -3867,7 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
3867 priv->retry_rate = 1; 3825 priv->retry_rate = 1;
3868 priv->ibss_beacon = NULL; 3826 priv->ibss_beacon = NULL;
3869 3827
3870 spin_lock_init(&priv->lock);
3871 spin_lock_init(&priv->sta_lock); 3828 spin_lock_init(&priv->sta_lock);
3872 spin_lock_init(&priv->hcmd_lock); 3829 spin_lock_init(&priv->hcmd_lock);
3873 3830
@@ -3936,9 +3893,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
3936 /* Tell mac80211 our characteristics */ 3893 /* Tell mac80211 our characteristics */
3937 hw->flags = IEEE80211_HW_SIGNAL_DBM | 3894 hw->flags = IEEE80211_HW_SIGNAL_DBM |
3938 IEEE80211_HW_NOISE_DBM | 3895 IEEE80211_HW_NOISE_DBM |
3939 IEEE80211_HW_SPECTRUM_MGMT | 3896 IEEE80211_HW_SPECTRUM_MGMT;
3940 IEEE80211_HW_SUPPORTS_PS | 3897
3941 IEEE80211_HW_SUPPORTS_DYNAMIC_PS; 3898 if (!priv->cfg->broken_powersave)
3899 hw->flags |= IEEE80211_HW_SUPPORTS_PS |
3900 IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
3942 3901
3943 hw->wiphy->interface_modes = 3902 hw->wiphy->interface_modes =
3944 BIT(NL80211_IFTYPE_STATION) | 3903 BIT(NL80211_IFTYPE_STATION) |
@@ -4057,10 +4016,11 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4057 * PCI Tx retries from interfering with C3 CPU state */ 4016 * PCI Tx retries from interfering with C3 CPU state */
4058 pci_write_config_byte(pdev, 0x41, 0x00); 4017 pci_write_config_byte(pdev, 0x41, 0x00);
4059 4018
4060 /* this spin lock will be used in apm_ops.init and EEPROM access 4019 /* these spin locks will be used in apm_ops.init and EEPROM access
4061 * we should init now 4020 * we should init now
4062 */ 4021 */
4063 spin_lock_init(&priv->reg_lock); 4022 spin_lock_init(&priv->reg_lock);
4023 spin_lock_init(&priv->lock);
4064 4024
4065 /*********************** 4025 /***********************
4066 * 4. Read EEPROM 4026 * 4. Read EEPROM
diff --git a/drivers/net/wireless/iwmc3200wifi/iwm.h b/drivers/net/wireless/iwmc3200wifi/iwm.h
index 5a26bb05a33a..842811142bef 100644
--- a/drivers/net/wireless/iwmc3200wifi/iwm.h
+++ b/drivers/net/wireless/iwmc3200wifi/iwm.h
@@ -268,7 +268,7 @@ struct iwm_priv {
268 268
269 struct sk_buff_head rx_list; 269 struct sk_buff_head rx_list;
270 struct list_head rx_tickets; 270 struct list_head rx_tickets;
271 struct list_head rx_packets[IWM_RX_ID_HASH]; 271 struct list_head rx_packets[IWM_RX_ID_HASH + 1];
272 struct workqueue_struct *rx_wq; 272 struct workqueue_struct *rx_wq;
273 struct work_struct rx_worker; 273 struct work_struct rx_worker;
274 274
@@ -349,7 +349,7 @@ int iwm_up(struct iwm_priv *iwm);
349int iwm_down(struct iwm_priv *iwm); 349int iwm_down(struct iwm_priv *iwm);
350 350
351/* TX API */ 351/* TX API */
352u16 iwm_tid_to_queue(u16 tid); 352int iwm_tid_to_queue(u16 tid);
353void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages); 353void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages);
354void iwm_tx_worker(struct work_struct *work); 354void iwm_tx_worker(struct work_struct *work);
355int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev); 355int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index e4f0f8705f65..c4c0d23c63ec 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -76,7 +76,7 @@ static int iwm_stop(struct net_device *ndev)
76 */ 76 */
77static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; 77static const u16 iwm_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 };
78 78
79u16 iwm_tid_to_queue(u16 tid) 79int iwm_tid_to_queue(u16 tid)
80{ 80{
81 if (tid > IWM_UMAC_TID_NR - 2) 81 if (tid > IWM_UMAC_TID_NR - 2)
82 return -EINVAL; 82 return -EINVAL;
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c
index 1c57c1f72cba..6d6ed7485175 100644
--- a/drivers/net/wireless/iwmc3200wifi/rx.c
+++ b/drivers/net/wireless/iwmc3200wifi/rx.c
@@ -1126,7 +1126,7 @@ static int iwm_ntf_stop_resume_tx(struct iwm_priv *iwm, u8 *buf,
1126 1126
1127 if (!stop) { 1127 if (!stop) {
1128 struct iwm_tx_queue *txq; 1128 struct iwm_tx_queue *txq;
1129 u16 queue = iwm_tid_to_queue(bit); 1129 int queue = iwm_tid_to_queue(bit);
1130 1130
1131 if (queue < 0) 1131 if (queue < 0)
1132 continue; 1132 continue;
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index b9b371bfa30f..42611bea76a3 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1365,7 +1365,7 @@ static void lbs_send_confirmsleep(struct lbs_private *priv)
1365 priv->dnld_sent = DNLD_RES_RECEIVED; 1365 priv->dnld_sent = DNLD_RES_RECEIVED;
1366 1366
1367 /* If nothing to do, go back to sleep (?) */ 1367 /* If nothing to do, go back to sleep (?) */
1368 if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) 1368 if (!kfifo_len(&priv->event_fifo) && !priv->resp_len[priv->resp_idx])
1369 priv->psstate = PS_STATE_SLEEP; 1369 priv->psstate = PS_STATE_SLEEP;
1370 1370
1371 spin_unlock_irqrestore(&priv->driver_lock, flags); 1371 spin_unlock_irqrestore(&priv->driver_lock, flags);
@@ -1439,7 +1439,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
1439 } 1439 }
1440 1440
1441 /* Pending events or command responses? */ 1441 /* Pending events or command responses? */
1442 if (__kfifo_len(priv->event_fifo) || priv->resp_len[priv->resp_idx]) { 1442 if (kfifo_len(&priv->event_fifo) || priv->resp_len[priv->resp_idx]) {
1443 allowed = 0; 1443 allowed = 0;
1444 lbs_deb_host("pending events or command responses\n"); 1444 lbs_deb_host("pending events or command responses\n");
1445 } 1445 }
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 6a8d2b291d8c..05bb298dfae9 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -10,7 +10,7 @@
10#include "scan.h" 10#include "scan.h"
11#include "assoc.h" 11#include "assoc.h"
12 12
13 13#include <linux/kfifo.h>
14 14
15/** sleep_params */ 15/** sleep_params */
16struct sleep_params { 16struct sleep_params {
@@ -120,7 +120,7 @@ struct lbs_private {
120 u32 resp_len[2]; 120 u32 resp_len[2];
121 121
122 /* Events sent from hardware to driver */ 122 /* Events sent from hardware to driver */
123 struct kfifo *event_fifo; 123 struct kfifo event_fifo;
124 124
125 /** thread to service interrupts */ 125 /** thread to service interrupts */
126 struct task_struct *main_thread; 126 struct task_struct *main_thread;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index db38a5a719fa..c2975c8e2f21 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -459,7 +459,7 @@ static int lbs_thread(void *data)
459 else if (!list_empty(&priv->cmdpendingq) && 459 else if (!list_empty(&priv->cmdpendingq) &&
460 !(priv->wakeup_dev_required)) 460 !(priv->wakeup_dev_required))
461 shouldsleep = 0; /* We have a command to send */ 461 shouldsleep = 0; /* We have a command to send */
462 else if (__kfifo_len(priv->event_fifo)) 462 else if (kfifo_len(&priv->event_fifo))
463 shouldsleep = 0; /* We have an event to process */ 463 shouldsleep = 0; /* We have an event to process */
464 else 464 else
465 shouldsleep = 1; /* No command */ 465 shouldsleep = 1; /* No command */
@@ -511,10 +511,13 @@ static int lbs_thread(void *data)
511 511
512 /* Process hardware events, e.g. card removed, link lost */ 512 /* Process hardware events, e.g. card removed, link lost */
513 spin_lock_irq(&priv->driver_lock); 513 spin_lock_irq(&priv->driver_lock);
514 while (__kfifo_len(priv->event_fifo)) { 514 while (kfifo_len(&priv->event_fifo)) {
515 u32 event; 515 u32 event;
516 __kfifo_get(priv->event_fifo, (unsigned char *) &event, 516
517 sizeof(event)); 517 if (kfifo_out(&priv->event_fifo,
518 (unsigned char *) &event, sizeof(event)) !=
519 sizeof(event))
520 break;
518 spin_unlock_irq(&priv->driver_lock); 521 spin_unlock_irq(&priv->driver_lock);
519 lbs_process_event(priv, event); 522 lbs_process_event(priv, event);
520 spin_lock_irq(&priv->driver_lock); 523 spin_lock_irq(&priv->driver_lock);
@@ -883,10 +886,9 @@ static int lbs_init_adapter(struct lbs_private *priv)
883 priv->resp_len[0] = priv->resp_len[1] = 0; 886 priv->resp_len[0] = priv->resp_len[1] = 0;
884 887
885 /* Create the event FIFO */ 888 /* Create the event FIFO */
886 priv->event_fifo = kfifo_alloc(sizeof(u32) * 16, GFP_KERNEL, NULL); 889 ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL);
887 if (IS_ERR(priv->event_fifo)) { 890 if (ret) {
888 lbs_pr_err("Out of memory allocating event FIFO buffer\n"); 891 lbs_pr_err("Out of memory allocating event FIFO buffer\n");
889 ret = -ENOMEM;
890 goto out; 892 goto out;
891 } 893 }
892 894
@@ -901,8 +903,7 @@ static void lbs_free_adapter(struct lbs_private *priv)
901 lbs_deb_enter(LBS_DEB_MAIN); 903 lbs_deb_enter(LBS_DEB_MAIN);
902 904
903 lbs_free_cmd_buffer(priv); 905 lbs_free_cmd_buffer(priv);
904 if (priv->event_fifo) 906 kfifo_free(&priv->event_fifo);
905 kfifo_free(priv->event_fifo);
906 del_timer(&priv->command_timer); 907 del_timer(&priv->command_timer);
907 del_timer(&priv->auto_deepsleep_timer); 908 del_timer(&priv->auto_deepsleep_timer);
908 kfree(priv->networks); 909 kfree(priv->networks);
@@ -1177,7 +1178,7 @@ void lbs_queue_event(struct lbs_private *priv, u32 event)
1177 if (priv->psstate == PS_STATE_SLEEP) 1178 if (priv->psstate == PS_STATE_SLEEP)
1178 priv->psstate = PS_STATE_AWAKE; 1179 priv->psstate = PS_STATE_AWAKE;
1179 1180
1180 __kfifo_put(priv->event_fifo, (unsigned char *) &event, sizeof(u32)); 1181 kfifo_in(&priv->event_fifo, (unsigned char *) &event, sizeof(u32));
1181 1182
1182 wake_up_interruptible(&priv->waitq); 1183 wake_up_interruptible(&priv->waitq);
1183 1184
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c
index 2f91c9b808af..92b7a357a5e4 100644
--- a/drivers/net/wireless/libertas/mesh.c
+++ b/drivers/net/wireless/libertas/mesh.c
@@ -2,6 +2,7 @@
2#include <linux/delay.h> 2#include <linux/delay.h>
3#include <linux/etherdevice.h> 3#include <linux/etherdevice.h>
4#include <linux/netdevice.h> 4#include <linux/netdevice.h>
5#include <linux/if_ether.h>
5#include <linux/if_arp.h> 6#include <linux/if_arp.h>
6#include <linux/kthread.h> 7#include <linux/kthread.h>
7#include <linux/kfifo.h> 8#include <linux/kfifo.h>
@@ -351,8 +352,7 @@ int lbs_add_mesh(struct lbs_private *priv)
351 352
352 mesh_dev->netdev_ops = &mesh_netdev_ops; 353 mesh_dev->netdev_ops = &mesh_netdev_ops;
353 mesh_dev->ethtool_ops = &lbs_ethtool_ops; 354 mesh_dev->ethtool_ops = &lbs_ethtool_ops;
354 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, 355 memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN);
355 sizeof(priv->dev->dev_addr));
356 356
357 SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); 357 SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent);
358 358
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index c6a6c042b82f..b0b1c7841500 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -567,11 +567,8 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)
567 chan_count = lbs_scan_create_channel_list(priv, chan_list); 567 chan_count = lbs_scan_create_channel_list(priv, chan_list);
568 568
569 netif_stop_queue(priv->dev); 569 netif_stop_queue(priv->dev);
570 netif_carrier_off(priv->dev); 570 if (priv->mesh_dev)
571 if (priv->mesh_dev) {
572 netif_stop_queue(priv->mesh_dev); 571 netif_stop_queue(priv->mesh_dev);
573 netif_carrier_off(priv->mesh_dev);
574 }
575 572
576 /* Prepare to continue an interrupted scan */ 573 /* Prepare to continue an interrupted scan */
577 lbs_deb_scan("chan_count %d, scan_channel %d\n", 574 lbs_deb_scan("chan_count %d, scan_channel %d\n",
@@ -635,16 +632,13 @@ out2:
635 priv->scan_channel = 0; 632 priv->scan_channel = 0;
636 633
637out: 634out:
638 if (priv->connect_status == LBS_CONNECTED) { 635 if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len)
639 netif_carrier_on(priv->dev); 636 netif_wake_queue(priv->dev);
640 if (!priv->tx_pending_len) 637
641 netif_wake_queue(priv->dev); 638 if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) &&
642 } 639 !priv->tx_pending_len)
643 if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) { 640 netif_wake_queue(priv->mesh_dev);
644 netif_carrier_on(priv->mesh_dev); 641
645 if (!priv->tx_pending_len)
646 netif_wake_queue(priv->mesh_dev);
647 }
648 kfree(chan_list); 642 kfree(chan_list);
649 643
650 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); 644 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index a8eb9e1fcf36..4b1aab593a84 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -2025,10 +2025,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
2025 if (priv->connect_status == LBS_CONNECTED) { 2025 if (priv->connect_status == LBS_CONNECTED) {
2026 memcpy(extra, priv->curbssparams.ssid, 2026 memcpy(extra, priv->curbssparams.ssid,
2027 priv->curbssparams.ssid_len); 2027 priv->curbssparams.ssid_len);
2028 extra[priv->curbssparams.ssid_len] = '\0';
2029 } else { 2028 } else {
2030 memset(extra, 0, 32); 2029 memset(extra, 0, 32);
2031 extra[priv->curbssparams.ssid_len] = '\0';
2032 } 2030 }
2033 /* 2031 /*
2034 * If none, we may want to get the one that was set 2032 * If none, we may want to get the one that was set
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index 019431d2f8a9..26a1abd5bb03 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -495,7 +495,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
495 stats.band = IEEE80211_BAND_2GHZ; 495 stats.band = IEEE80211_BAND_2GHZ;
496 stats.signal = prxpd->snr; 496 stats.signal = prxpd->snr;
497 stats.noise = prxpd->nf; 497 stats.noise = prxpd->nf;
498 stats.qual = prxpd->snr - prxpd->nf;
499 /* Marvell rate index has a hole at value 4 */ 498 /* Marvell rate index has a hole at value 4 */
500 if (prxpd->rx_rate > 4) 499 if (prxpd->rx_rate > 4)
501 --prxpd->rx_rate; 500 --prxpd->rx_rate;
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 7698fdd6a3a2..31ca241f7753 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -23,7 +23,7 @@
23#define MAX_RID_LEN 1024 23#define MAX_RID_LEN 1024
24 24
25/* Helper routine to record keys 25/* Helper routine to record keys
26 * Do not call from interrupt context */ 26 * It is called under orinoco_lock so it may not sleep */
27static int orinoco_set_key(struct orinoco_private *priv, int index, 27static int orinoco_set_key(struct orinoco_private *priv, int index,
28 enum orinoco_alg alg, const u8 *key, int key_len, 28 enum orinoco_alg alg, const u8 *key, int key_len,
29 const u8 *seq, int seq_len) 29 const u8 *seq, int seq_len)
@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index,
32 kzfree(priv->keys[index].seq); 32 kzfree(priv->keys[index].seq);
33 33
34 if (key_len) { 34 if (key_len) {
35 priv->keys[index].key = kzalloc(key_len, GFP_KERNEL); 35 priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
36 if (!priv->keys[index].key) 36 if (!priv->keys[index].key)
37 goto nomem; 37 goto nomem;
38 } else 38 } else
39 priv->keys[index].key = NULL; 39 priv->keys[index].key = NULL;
40 40
41 if (seq_len) { 41 if (seq_len) {
42 priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL); 42 priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);
43 if (!priv->keys[index].seq) 43 if (!priv->keys[index].seq)
44 goto free_key; 44 goto free_key;
45 } else 45 } else
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h
index c5fe867665e6..1a7eae357fef 100644
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -1323,7 +1323,7 @@
1323#define PAIRWISE_KEY_ENTRY(__idx) \ 1323#define PAIRWISE_KEY_ENTRY(__idx) \
1324 ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) ) 1324 ( PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry)) )
1325#define MAC_IVEIV_ENTRY(__idx) \ 1325#define MAC_IVEIV_ENTRY(__idx) \
1326 ( MAC_IVEIV_TABLE_BASE + ((__idx) & sizeof(struct mac_iveiv_entry)) ) 1326 ( MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry)) )
1327#define MAC_WCID_ATTR_ENTRY(__idx) \ 1327#define MAC_WCID_ATTR_ENTRY(__idx) \
1328 ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) ) 1328 ( MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32)) )
1329#define SHARED_KEY_ENTRY(__idx) \ 1329#define SHARED_KEY_ENTRY(__idx) \
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index eb1e1d00bec3..27bf887f1453 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -37,7 +37,7 @@
37#include <linux/module.h> 37#include <linux/module.h>
38 38
39#include "rt2x00.h" 39#include "rt2x00.h"
40#ifdef CONFIG_RT2800USB 40#if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE)
41#include "rt2x00usb.h" 41#include "rt2x00usb.h"
42#endif 42#endif
43#include "rt2800lib.h" 43#include "rt2800lib.h"
@@ -1121,7 +1121,7 @@ int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
1121 1121
1122 if (rt2x00_intf_is_usb(rt2x00dev)) { 1122 if (rt2x00_intf_is_usb(rt2x00dev)) {
1123 rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); 1123 rt2800_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000);
1124#ifdef CONFIG_RT2800USB 1124#if defined(CONFIG_RT2800USB) || defined(CONFIG_RT2800USB_MODULE)
1125 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, 1125 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
1126 USB_MODE_RESET, REGISTER_TIMEOUT); 1126 USB_MODE_RESET, REGISTER_TIMEOUT);
1127#endif 1127#endif
@@ -2022,6 +2022,12 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2022 u16 eeprom; 2022 u16 eeprom;
2023 2023
2024 /* 2024 /*
2025 * Disable powersaving as default on PCI devices.
2026 */
2027 if (rt2x00_intf_is_pci(rt2x00dev))
2028 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
2029
2030 /*
2025 * Initialize all hw fields. 2031 * Initialize all hw fields.
2026 */ 2032 */
2027 rt2x00dev->hw->flags = 2033 rt2x00dev->hw->flags =
@@ -2074,8 +2080,7 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2074 IEEE80211_HT_CAP_SGI_20 | 2080 IEEE80211_HT_CAP_SGI_20 |
2075 IEEE80211_HT_CAP_SGI_40 | 2081 IEEE80211_HT_CAP_SGI_40 |
2076 IEEE80211_HT_CAP_TX_STBC | 2082 IEEE80211_HT_CAP_TX_STBC |
2077 IEEE80211_HT_CAP_RX_STBC | 2083 IEEE80211_HT_CAP_RX_STBC;
2078 IEEE80211_HT_CAP_PSMP_SUPPORT;
2079 spec->ht.ampdu_factor = 3; 2084 spec->ht.ampdu_factor = 3;
2080 spec->ht.ampdu_density = 4; 2085 spec->ht.ampdu_density = 4;
2081 spec->ht.mcs.tx_params = 2086 spec->ht.mcs.tx_params =
@@ -2140,8 +2145,8 @@ static void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx,
2140 rt2800_register_multiread(rt2x00dev, offset, 2145 rt2800_register_multiread(rt2x00dev, offset,
2141 &iveiv_entry, sizeof(iveiv_entry)); 2146 &iveiv_entry, sizeof(iveiv_entry));
2142 2147
2143 memcpy(&iveiv_entry.iv[0], iv16, sizeof(iv16)); 2148 memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
2144 memcpy(&iveiv_entry.iv[4], iv32, sizeof(iv32)); 2149 memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
2145} 2150}
2146 2151
2147static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) 2152static int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index af85d18cdbe7..ab95346cf6a3 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
922 { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) }, 922 { USB_DEVICE(0x1737, 0x0070), USB_DEVICE_DATA(&rt2800usb_ops) },
923 { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) }, 923 { USB_DEVICE(0x1737, 0x0071), USB_DEVICE_DATA(&rt2800usb_ops) },
924 { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) }, 924 { USB_DEVICE(0x1737, 0x0077), USB_DEVICE_DATA(&rt2800usb_ops) },
925 { USB_DEVICE(0x1737, 0x0079), USB_DEVICE_DATA(&rt2800usb_ops) },
925 /* Logitec */ 926 /* Logitec */
926 { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) }, 927 { USB_DEVICE(0x0789, 0x0162), USB_DEVICE_DATA(&rt2800usb_ops) },
927 { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) }, 928 { USB_DEVICE(0x0789, 0x0163), USB_DEVICE_DATA(&rt2800usb_ops) },
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 687e17dc2e9f..0ca589306d71 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2539,6 +2539,11 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2539 unsigned int i; 2539 unsigned int i;
2540 2540
2541 /* 2541 /*
2542 * Disable powersaving as default.
2543 */
2544 rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
2545
2546 /*
2542 * Initialize all hw fields. 2547 * Initialize all hw fields.
2543 */ 2548 */
2544 rt2x00dev->hw->flags = 2549 rt2x00dev->hw->flags =
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
index a1a3dd15c664..8a40a1439984 100644
--- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
@@ -132,7 +132,6 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
132 132
133 rx_status.antenna = (flags2 >> 15) & 1; 133 rx_status.antenna = (flags2 >> 15) & 1;
134 /* TODO: improve signal/rssi reporting */ 134 /* TODO: improve signal/rssi reporting */
135 rx_status.qual = flags2 & 0xFF;
136 rx_status.signal = (flags2 >> 8) & 0x7F; 135 rx_status.signal = (flags2 >> 8) & 0x7F;
137 /* XXX: is this correct? */ 136 /* XXX: is this correct? */
138 rx_status.rate_idx = (flags >> 20) & 0xF; 137 rx_status.rate_idx = (flags >> 20) & 0xF;
diff --git a/drivers/net/wireless/wl12xx/wl1251_boot.c b/drivers/net/wireless/wl12xx/wl1251_boot.c
index 2e733e7bdfd4..28a808674080 100644
--- a/drivers/net/wireless/wl12xx/wl1251_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1251_boot.c
@@ -256,7 +256,7 @@ int wl1251_boot_run_firmware(struct wl1251 *wl)
256 } 256 }
257 } 257 }
258 258
259 if (loop >= INIT_LOOP) { 259 if (loop > INIT_LOOP) {
260 wl1251_error("timeout waiting for the hardware to " 260 wl1251_error("timeout waiting for the hardware to "
261 "complete initialization"); 261 "complete initialization");
262 return -EIO; 262 return -EIO;
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 886a9bc39cc1..c3385b3d246c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -777,7 +777,7 @@ out:
777 return ret; 777 return ret;
778} 778}
779 779
780static int wl1271_build_basic_rates(char *rates, u8 band) 780static int wl1271_build_basic_rates(u8 *rates, u8 band)
781{ 781{
782 u8 index = 0; 782 u8 index = 0;
783 783
@@ -804,7 +804,7 @@ static int wl1271_build_basic_rates(char *rates, u8 band)
804 return index; 804 return index;
805} 805}
806 806
807static int wl1271_build_extended_rates(char *rates, u8 band) 807static int wl1271_build_extended_rates(u8 *rates, u8 band)
808{ 808{
809 u8 index = 0; 809 u8 index = 0;
810 810
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index dfa1b9bc22c8..7ca95c414fa8 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -1325,151 +1325,11 @@ int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates)
1325 return r; 1325 return r;
1326} 1326}
1327 1327
1328static int ofdm_qual_db(u8 status_quality, u8 zd_rate, unsigned int size)
1329{
1330 static const u16 constants[] = {
1331 715, 655, 585, 540, 470, 410, 360, 315,
1332 270, 235, 205, 175, 150, 125, 105, 85,
1333 65, 50, 40, 25, 15
1334 };
1335
1336 int i;
1337 u32 x;
1338
1339 /* It seems that their quality parameter is somehow per signal
1340 * and is now transferred per bit.
1341 */
1342 switch (zd_rate) {
1343 case ZD_OFDM_RATE_6M:
1344 case ZD_OFDM_RATE_12M:
1345 case ZD_OFDM_RATE_24M:
1346 size *= 2;
1347 break;
1348 case ZD_OFDM_RATE_9M:
1349 case ZD_OFDM_RATE_18M:
1350 case ZD_OFDM_RATE_36M:
1351 case ZD_OFDM_RATE_54M:
1352 size *= 4;
1353 size /= 3;
1354 break;
1355 case ZD_OFDM_RATE_48M:
1356 size *= 3;
1357 size /= 2;
1358 break;
1359 default:
1360 return -EINVAL;
1361 }
1362
1363 x = (10000 * status_quality)/size;
1364 for (i = 0; i < ARRAY_SIZE(constants); i++) {
1365 if (x > constants[i])
1366 break;
1367 }
1368
1369 switch (zd_rate) {
1370 case ZD_OFDM_RATE_6M:
1371 case ZD_OFDM_RATE_9M:
1372 i += 3;
1373 break;
1374 case ZD_OFDM_RATE_12M:
1375 case ZD_OFDM_RATE_18M:
1376 i += 5;
1377 break;
1378 case ZD_OFDM_RATE_24M:
1379 case ZD_OFDM_RATE_36M:
1380 i += 9;
1381 break;
1382 case ZD_OFDM_RATE_48M:
1383 case ZD_OFDM_RATE_54M:
1384 i += 15;
1385 break;
1386 default:
1387 return -EINVAL;
1388 }
1389
1390 return i;
1391}
1392
1393static int ofdm_qual_percent(u8 status_quality, u8 zd_rate, unsigned int size)
1394{
1395 int r;
1396
1397 r = ofdm_qual_db(status_quality, zd_rate, size);
1398 ZD_ASSERT(r >= 0);
1399 if (r < 0)
1400 r = 0;
1401
1402 r = (r * 100)/29;
1403 return r <= 100 ? r : 100;
1404}
1405
1406static unsigned int log10times100(unsigned int x)
1407{
1408 static const u8 log10[] = {
1409 0,
1410 0, 30, 47, 60, 69, 77, 84, 90, 95, 100,
1411 104, 107, 111, 114, 117, 120, 123, 125, 127, 130,
1412 132, 134, 136, 138, 139, 141, 143, 144, 146, 147,
1413 149, 150, 151, 153, 154, 155, 156, 157, 159, 160,
1414 161, 162, 163, 164, 165, 166, 167, 168, 169, 169,
1415 170, 171, 172, 173, 174, 174, 175, 176, 177, 177,
1416 178, 179, 179, 180, 181, 181, 182, 183, 183, 184,
1417 185, 185, 186, 186, 187, 188, 188, 189, 189, 190,
1418 190, 191, 191, 192, 192, 193, 193, 194, 194, 195,
1419 195, 196, 196, 197, 197, 198, 198, 199, 199, 200,
1420 200, 200, 201, 201, 202, 202, 202, 203, 203, 204,
1421 204, 204, 205, 205, 206, 206, 206, 207, 207, 207,
1422 208, 208, 208, 209, 209, 210, 210, 210, 211, 211,
1423 211, 212, 212, 212, 213, 213, 213, 213, 214, 214,
1424 214, 215, 215, 215, 216, 216, 216, 217, 217, 217,
1425 217, 218, 218, 218, 219, 219, 219, 219, 220, 220,
1426 220, 220, 221, 221, 221, 222, 222, 222, 222, 223,
1427 223, 223, 223, 224, 224, 224, 224,
1428 };
1429
1430 return x < ARRAY_SIZE(log10) ? log10[x] : 225;
1431}
1432
1433enum {
1434 MAX_CCK_EVM_DB = 45,
1435};
1436
1437static int cck_evm_db(u8 status_quality)
1438{
1439 return (20 * log10times100(status_quality)) / 100;
1440}
1441
1442static int cck_snr_db(u8 status_quality)
1443{
1444 int r = MAX_CCK_EVM_DB - cck_evm_db(status_quality);
1445 ZD_ASSERT(r >= 0);
1446 return r;
1447}
1448
1449static int cck_qual_percent(u8 status_quality)
1450{
1451 int r;
1452
1453 r = cck_snr_db(status_quality);
1454 r = (100*r)/17;
1455 return r <= 100 ? r : 100;
1456}
1457
1458static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) 1328static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame)
1459{ 1329{
1460 return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); 1330 return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame);
1461} 1331}
1462 1332
1463u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size,
1464 const struct rx_status *status)
1465{
1466 return (status->frame_status&ZD_RX_OFDM) ?
1467 ofdm_qual_percent(status->signal_quality_ofdm,
1468 zd_rate_from_ofdm_plcp_header(rx_frame),
1469 size) :
1470 cck_qual_percent(status->signal_quality_cck);
1471}
1472
1473/** 1333/**
1474 * zd_rx_rate - report zd-rate 1334 * zd_rx_rate - report zd-rate
1475 * @rx_frame - received frame 1335 * @rx_frame - received frame
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 9fd8f3508d66..f8bbf7d302ae 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -929,9 +929,6 @@ static inline int zd_get_beacon_interval(struct zd_chip *chip, u32 *interval)
929 929
930struct rx_status; 930struct rx_status;
931 931
932u8 zd_rx_qual_percent(const void *rx_frame, unsigned int size,
933 const struct rx_status *status);
934
935u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); 932u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status);
936 933
937struct zd_mc_hash { 934struct zd_mc_hash {
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index cf51e8f8174b..8ebf5c33955d 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -828,9 +828,6 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)
828 stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; 828 stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
829 stats.band = IEEE80211_BAND_2GHZ; 829 stats.band = IEEE80211_BAND_2GHZ;
830 stats.signal = status->signal_strength; 830 stats.signal = status->signal_strength;
831 stats.qual = zd_rx_qual_percent(buffer,
832 length - sizeof(struct rx_status),
833 status);
834 831
835 rate = zd_rx_rate(buffer, status); 832 rate = zd_rx_rate(buffer, status);
836 833
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index bd588eb8e922..8e210cd76e55 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -121,7 +121,7 @@ struct controller {
121#define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 121#define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450
122#define PCI_DEVICE_ID_AMD_POGO_7458 0x7458 122#define PCI_DEVICE_ID_AMD_POGO_7458 0x7458
123 123
124/* AMD PCIX bridge registers */ 124/* AMD PCI-X bridge registers */
125#define PCIX_MEM_BASE_LIMIT_OFFSET 0x1C 125#define PCIX_MEM_BASE_LIMIT_OFFSET 0x1C
126#define PCIX_MISCII_OFFSET 0x48 126#define PCIX_MISCII_OFFSET 0x48
127#define PCIX_MISC_BRIDGE_ERRORS_OFFSET 0x80 127#define PCIX_MISC_BRIDGE_ERRORS_OFFSET 0x80
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index e56f9bed6f2b..417312528ddf 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -305,7 +305,7 @@ struct device_domain_info {
305 int segment; /* PCI domain */ 305 int segment; /* PCI domain */
306 u8 bus; /* PCI bus number */ 306 u8 bus; /* PCI bus number */
307 u8 devfn; /* PCI devfn number */ 307 u8 devfn; /* PCI devfn number */
308 struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */ 308 struct pci_dev *dev; /* it's NULL for PCIe-to-PCI bridge */
309 struct intel_iommu *iommu; /* IOMMU used by this device */ 309 struct intel_iommu *iommu; /* IOMMU used by this device */
310 struct dmar_domain *domain; /* pointer to domain */ 310 struct dmar_domain *domain; /* pointer to domain */
311}; 311};
@@ -1604,7 +1604,7 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev,
1604 return ret; 1604 return ret;
1605 parent = parent->bus->self; 1605 parent = parent->bus->self;
1606 } 1606 }
1607 if (pci_is_pcie(tmp)) /* this is a PCIE-to-PCI bridge */ 1607 if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
1608 return domain_context_mapping_one(domain, 1608 return domain_context_mapping_one(domain,
1609 pci_domain_nr(tmp->subordinate), 1609 pci_domain_nr(tmp->subordinate),
1610 tmp->subordinate->number, 0, 1610 tmp->subordinate->number, 0,
@@ -3325,7 +3325,7 @@ static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
3325 parent->devfn); 3325 parent->devfn);
3326 parent = parent->bus->self; 3326 parent = parent->bus->self;
3327 } 3327 }
3328 if (pci_is_pcie(tmp)) /* this is a PCIE-to-PCI bridge */ 3328 if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
3329 iommu_detach_dev(iommu, 3329 iommu_detach_dev(iommu,
3330 tmp->subordinate->number, 0); 3330 tmp->subordinate->number, 0);
3331 else /* this is a legacy PCI bridge */ 3331 else /* this is a legacy PCI bridge */
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index 8b65a489581b..95b849130ad4 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -528,7 +528,7 @@ int set_msi_sid(struct irte *irte, struct pci_dev *dev)
528 528
529 bridge = pci_find_upstream_pcie_bridge(dev); 529 bridge = pci_find_upstream_pcie_bridge(dev);
530 if (bridge) { 530 if (bridge) {
531 if (pci_is_pcie(bridge))/* this is a PCIE-to-PCI/PCIX bridge */ 531 if (pci_is_pcie(bridge))/* this is a PCIe-to-PCI/PCIX bridge */
532 set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16, 532 set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16,
533 (bridge->bus->number << 8) | dev->bus->number); 533 (bridge->bus->number << 8) | dev->bus->number);
534 else /* this is a legacy PCI bridge */ 534 else /* this is a legacy PCI bridge */
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index cc617ddd33d0..7e2829538a4c 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -112,11 +112,7 @@ static bool acpi_pci_can_wakeup(struct pci_dev *dev)
112static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable) 112static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable)
113{ 113{
114 while (bus->parent) { 114 while (bus->parent) {
115 struct pci_dev *bridge = bus->self; 115 if (!acpi_pm_device_sleep_wake(&bus->self->dev, enable))
116 int ret;
117
118 ret = acpi_pm_device_sleep_wake(&bridge->dev, enable);
119 if (!ret || pci_is_pcie(bridge))
120 return; 116 return;
121 bus = bus->parent; 117 bus = bus->parent;
122 } 118 }
@@ -131,9 +127,7 @@ static int acpi_pci_sleep_wake(struct pci_dev *dev, bool enable)
131 if (acpi_pci_can_wakeup(dev)) 127 if (acpi_pci_can_wakeup(dev))
132 return acpi_pm_device_sleep_wake(&dev->dev, enable); 128 return acpi_pm_device_sleep_wake(&dev->dev, enable);
133 129
134 if (!pci_is_pcie(dev)) 130 acpi_pci_propagate_wakeup_enable(dev->bus, enable);
135 acpi_pci_propagate_wakeup_enable(dev->bus, enable);
136
137 return 0; 131 return 0;
138} 132}
139 133
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index c5df94e86678..807224ec8351 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -75,7 +75,8 @@ static ssize_t local_cpus_show(struct device *dev,
75 int len; 75 int len;
76 76
77#ifdef CONFIG_NUMA 77#ifdef CONFIG_NUMA
78 mask = cpumask_of_node(dev_to_node(dev)); 78 mask = (dev_to_node(dev) == -1) ? cpu_online_mask :
79 cpumask_of_node(dev_to_node(dev));
79#else 80#else
80 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); 81 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
81#endif 82#endif
@@ -93,7 +94,8 @@ static ssize_t local_cpulist_show(struct device *dev,
93 int len; 94 int len;
94 95
95#ifdef CONFIG_NUMA 96#ifdef CONFIG_NUMA
96 mask = cpumask_of_node(dev_to_node(dev)); 97 mask = (dev_to_node(dev) == -1) ? cpu_online_mask :
98 cpumask_of_node(dev_to_node(dev));
97#else 99#else
98 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); 100 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
99#endif 101#endif
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 0bc27e059019..315fea47e784 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -29,7 +29,17 @@ const char *pci_power_names[] = {
29}; 29};
30EXPORT_SYMBOL_GPL(pci_power_names); 30EXPORT_SYMBOL_GPL(pci_power_names);
31 31
32unsigned int pci_pm_d3_delay = PCI_PM_D3_WAIT; 32unsigned int pci_pm_d3_delay;
33
34static void pci_dev_d3_sleep(struct pci_dev *dev)
35{
36 unsigned int delay = dev->d3_delay;
37
38 if (delay < pci_pm_d3_delay)
39 delay = pci_pm_d3_delay;
40
41 msleep(delay);
42}
33 43
34#ifdef CONFIG_PCI_DOMAINS 44#ifdef CONFIG_PCI_DOMAINS
35int pci_domains_supported = 1; 45int pci_domains_supported = 1;
@@ -522,7 +532,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
522 /* Mandatory power management transition delays */ 532 /* Mandatory power management transition delays */
523 /* see PCI PM 1.1 5.6.1 table 18 */ 533 /* see PCI PM 1.1 5.6.1 table 18 */
524 if (state == PCI_D3hot || dev->current_state == PCI_D3hot) 534 if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
525 msleep(pci_pm_d3_delay); 535 pci_dev_d3_sleep(dev);
526 else if (state == PCI_D2 || dev->current_state == PCI_D2) 536 else if (state == PCI_D2 || dev->current_state == PCI_D2)
527 udelay(PCI_PM_D2_DELAY); 537 udelay(PCI_PM_D2_DELAY);
528 538
@@ -1153,11 +1163,11 @@ pci_disable_device(struct pci_dev *dev)
1153 1163
1154/** 1164/**
1155 * pcibios_set_pcie_reset_state - set reset state for device dev 1165 * pcibios_set_pcie_reset_state - set reset state for device dev
1156 * @dev: the PCI-E device reset 1166 * @dev: the PCIe device reset
1157 * @state: Reset state to enter into 1167 * @state: Reset state to enter into
1158 * 1168 *
1159 * 1169 *
1160 * Sets the PCI-E reset state for the device. This is the default 1170 * Sets the PCIe reset state for the device. This is the default
1161 * implementation. Architecture implementations can override this. 1171 * implementation. Architecture implementations can override this.
1162 */ 1172 */
1163int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev, 1173int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev,
@@ -1168,7 +1178,7 @@ int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev,
1168 1178
1169/** 1179/**
1170 * pci_set_pcie_reset_state - set reset state for device dev 1180 * pci_set_pcie_reset_state - set reset state for device dev
1171 * @dev: the PCI-E device reset 1181 * @dev: the PCIe device reset
1172 * @state: Reset state to enter into 1182 * @state: Reset state to enter into
1173 * 1183 *
1174 * 1184 *
@@ -1409,6 +1419,7 @@ void pci_pm_init(struct pci_dev *dev)
1409 } 1419 }
1410 1420
1411 dev->pm_cap = pm; 1421 dev->pm_cap = pm;
1422 dev->d3_delay = PCI_PM_D3_WAIT;
1412 1423
1413 dev->d1_support = false; 1424 dev->d1_support = false;
1414 dev->d2_support = false; 1425 dev->d2_support = false;
@@ -2247,12 +2258,12 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)
2247 csr &= ~PCI_PM_CTRL_STATE_MASK; 2258 csr &= ~PCI_PM_CTRL_STATE_MASK;
2248 csr |= PCI_D3hot; 2259 csr |= PCI_D3hot;
2249 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); 2260 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr);
2250 msleep(pci_pm_d3_delay); 2261 pci_dev_d3_sleep(dev);
2251 2262
2252 csr &= ~PCI_PM_CTRL_STATE_MASK; 2263 csr &= ~PCI_PM_CTRL_STATE_MASK;
2253 csr |= PCI_D0; 2264 csr |= PCI_D0;
2254 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); 2265 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr);
2255 msleep(pci_pm_d3_delay); 2266 pci_dev_d3_sleep(dev);
2256 2267
2257 return 0; 2268 return 0;
2258} 2269}
@@ -2296,6 +2307,10 @@ static int pci_dev_reset(struct pci_dev *dev, int probe)
2296 down(&dev->dev.sem); 2307 down(&dev->dev.sem);
2297 } 2308 }
2298 2309
2310 rc = pci_dev_specific_reset(dev, probe);
2311 if (rc != -ENOTTY)
2312 goto done;
2313
2299 rc = pcie_flr(dev, probe); 2314 rc = pcie_flr(dev, probe);
2300 if (rc != -ENOTTY) 2315 if (rc != -ENOTTY)
2301 goto done; 2316 goto done;
@@ -2779,6 +2794,11 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev)
2779 return 1; 2794 return 1;
2780} 2795}
2781 2796
2797void __weak pci_fixup_cardbus(struct pci_bus *bus)
2798{
2799}
2800EXPORT_SYMBOL(pci_fixup_cardbus);
2801
2782static int __init pci_setup(char *str) 2802static int __init pci_setup(char *str)
2783{ 2803{
2784 while (str) { 2804 while (str) {
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 33ed8e0aba1e..fbd0e3adbca3 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -313,4 +313,12 @@ static inline int pci_resource_alignment(struct pci_dev *dev,
313 313
314extern void pci_enable_acs(struct pci_dev *dev); 314extern void pci_enable_acs(struct pci_dev *dev);
315 315
316struct pci_dev_reset_methods {
317 u16 vendor;
318 u16 device;
319 int (*reset)(struct pci_dev *dev, int probe);
320};
321
322extern int pci_dev_specific_reset(struct pci_dev *dev, int probe);
323
316#endif /* DRIVERS_PCI_H */ 324#endif /* DRIVERS_PCI_H */
diff --git a/drivers/pci/pcie/aer/Kconfig.debug b/drivers/pci/pcie/aer/Kconfig.debug
index b8c925c1f6aa..9142949734f5 100644
--- a/drivers/pci/pcie/aer/Kconfig.debug
+++ b/drivers/pci/pcie/aer/Kconfig.debug
@@ -3,14 +3,14 @@
3# 3#
4 4
5config PCIEAER_INJECT 5config PCIEAER_INJECT
6 tristate "PCIE AER error injector support" 6 tristate "PCIe AER error injector support"
7 depends on PCIEAER 7 depends on PCIEAER
8 default n 8 default n
9 help 9 help
10 This enables PCI Express Root Port Advanced Error Reporting 10 This enables PCI Express Root Port Advanced Error Reporting
11 (AER) software error injector. 11 (AER) software error injector.
12 12
13 Debuging PCIE AER code is quite difficult because it is hard 13 Debugging PCIe AER code is quite difficult because it is hard
14 to trigger various real hardware errors. Software based 14 to trigger various real hardware errors. Software based
15 error injection can fake almost all kinds of errors with the 15 error injection can fake almost all kinds of errors with the
16 help of a user space helper tool aer-inject, which can be 16 help of a user space helper tool aer-inject, which can be
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
index 7fcd5331b14c..8c30a9544d61 100644
--- a/drivers/pci/pcie/aer/aer_inject.c
+++ b/drivers/pci/pcie/aer/aer_inject.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * PCIE AER software error injection support. 2 * PCIe AER software error injection support.
3 * 3 *
4 * Debuging PCIE AER code is quite difficult because it is hard to 4 * Debuging PCIe AER code is quite difficult because it is hard to
5 * trigger various real hardware errors. Software based error 5 * trigger various real hardware errors. Software based error
6 * injection can fake almost all kinds of errors with the help of a 6 * injection can fake almost all kinds of errors with the help of a
7 * user space helper tool aer-inject, which can be gotten from: 7 * user space helper tool aer-inject, which can be gotten from:
@@ -321,7 +321,7 @@ static int aer_inject(struct aer_error_inj *einj)
321 unsigned long flags; 321 unsigned long flags;
322 unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn); 322 unsigned int devfn = PCI_DEVFN(einj->dev, einj->fn);
323 int pos_cap_err, rp_pos_cap_err; 323 int pos_cap_err, rp_pos_cap_err;
324 u32 sever; 324 u32 sever, mask;
325 int ret = 0; 325 int ret = 0;
326 326
327 dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn); 327 dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn);
@@ -374,6 +374,24 @@ static int aer_inject(struct aer_error_inj *einj)
374 err->header_log2 = einj->header_log2; 374 err->header_log2 = einj->header_log2;
375 err->header_log3 = einj->header_log3; 375 err->header_log3 = einj->header_log3;
376 376
377 pci_read_config_dword(dev, pos_cap_err + PCI_ERR_COR_MASK, &mask);
378 if (einj->cor_status && !(einj->cor_status & ~mask)) {
379 ret = -EINVAL;
380 printk(KERN_WARNING "The correctable error(s) is masked "
381 "by device\n");
382 spin_unlock_irqrestore(&inject_lock, flags);
383 goto out_put;
384 }
385
386 pci_read_config_dword(dev, pos_cap_err + PCI_ERR_UNCOR_MASK, &mask);
387 if (einj->uncor_status && !(einj->uncor_status & ~mask)) {
388 ret = -EINVAL;
389 printk(KERN_WARNING "The uncorrectable error(s) is masked "
390 "by device\n");
391 spin_unlock_irqrestore(&inject_lock, flags);
392 goto out_put;
393 }
394
377 rperr = __find_aer_error_by_dev(rpdev); 395 rperr = __find_aer_error_by_dev(rpdev);
378 if (!rperr) { 396 if (!rperr) {
379 rperr = rperr_alloc; 397 rperr = rperr_alloc;
@@ -413,8 +431,14 @@ static int aer_inject(struct aer_error_inj *einj)
413 if (ret) 431 if (ret)
414 goto out_put; 432 goto out_put;
415 433
416 if (find_aer_device(rpdev, &edev)) 434 if (find_aer_device(rpdev, &edev)) {
435 if (!get_service_data(edev)) {
436 printk(KERN_WARNING "AER service is not initialized\n");
437 ret = -EINVAL;
438 goto out_put;
439 }
417 aer_irq(-1, edev); 440 aer_irq(-1, edev);
441 }
418 else 442 else
419 ret = -EINVAL; 443 ret = -EINVAL;
420out_put: 444out_put:
@@ -484,5 +508,5 @@ static void __exit aer_inject_exit(void)
484module_init(aer_inject_init); 508module_init(aer_inject_init);
485module_exit(aer_inject_exit); 509module_exit(aer_inject_exit);
486 510
487MODULE_DESCRIPTION("PCIE AER software error injector"); 511MODULE_DESCRIPTION("PCIe AER software error injector");
488MODULE_LICENSE("GPL"); 512MODULE_LICENSE("GPL");
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index 97a345927b55..21f215f4daa3 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -155,7 +155,7 @@ static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev)
155 mutex_init(&rpc->rpc_mutex); 155 mutex_init(&rpc->rpc_mutex);
156 init_waitqueue_head(&rpc->wait_release); 156 init_waitqueue_head(&rpc->wait_release);
157 157
158 /* Use PCIE bus function to store rpc into PCIE device */ 158 /* Use PCIe bus function to store rpc into PCIe device */
159 set_service_data(dev, rpc); 159 set_service_data(dev, rpc);
160 160
161 return rpc; 161 return rpc;
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index 8edb2f300e8f..04814087658d 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -24,7 +24,7 @@
24 * 24 *
25 * @return: Zero on success. Nonzero otherwise. 25 * @return: Zero on success. Nonzero otherwise.
26 * 26 *
27 * Invoked when PCIE bus loads AER service driver. To avoid conflict with 27 * Invoked when PCIe bus loads AER service driver. To avoid conflict with
28 * BIOS AER support requires BIOS to yield AER control to OS native driver. 28 * BIOS AER support requires BIOS to yield AER control to OS native driver.
29 **/ 29 **/
30int aer_osc_setup(struct pcie_device *pciedev) 30int aer_osc_setup(struct pcie_device *pciedev)
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index ae672ca80333..c843a799814d 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -587,7 +587,7 @@ static void handle_error_source(struct pcie_device *aerdev,
587 * aer_enable_rootport - enable Root Port's interrupts when receiving messages 587 * aer_enable_rootport - enable Root Port's interrupts when receiving messages
588 * @rpc: pointer to a Root Port data structure 588 * @rpc: pointer to a Root Port data structure
589 * 589 *
590 * Invoked when PCIE bus loads AER service driver. 590 * Invoked when PCIe bus loads AER service driver.
591 */ 591 */
592void aer_enable_rootport(struct aer_rpc *rpc) 592void aer_enable_rootport(struct aer_rpc *rpc)
593{ 593{
@@ -597,7 +597,7 @@ void aer_enable_rootport(struct aer_rpc *rpc)
597 u32 reg32; 597 u32 reg32;
598 598
599 pos = pci_pcie_cap(pdev); 599 pos = pci_pcie_cap(pdev);
600 /* Clear PCIE Capability's Device Status */ 600 /* Clear PCIe Capability's Device Status */
601 pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, &reg16); 601 pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, &reg16);
602 pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16); 602 pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16);
603 603
@@ -631,7 +631,7 @@ void aer_enable_rootport(struct aer_rpc *rpc)
631 * disable_root_aer - disable Root Port's interrupts when receiving messages 631 * disable_root_aer - disable Root Port's interrupts when receiving messages
632 * @rpc: pointer to a Root Port data structure 632 * @rpc: pointer to a Root Port data structure
633 * 633 *
634 * Invoked when PCIE bus unloads AER service driver. 634 * Invoked when PCIe bus unloads AER service driver.
635 */ 635 */
636static void disable_root_aer(struct aer_rpc *rpc) 636static void disable_root_aer(struct aer_rpc *rpc)
637{ 637{
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index 44acde72294f..9d3e4c8d0184 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
@@ -184,7 +184,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
184 184
185 if (info->status == 0) { 185 if (info->status == 0) {
186 AER_PR(info, dev, 186 AER_PR(info, dev,
187 "PCIE Bus Error: severity=%s, type=Unaccessible, " 187 "PCIe Bus Error: severity=%s, type=Unaccessible, "
188 "id=%04x(Unregistered Agent ID)\n", 188 "id=%04x(Unregistered Agent ID)\n",
189 aer_error_severity_string[info->severity], id); 189 aer_error_severity_string[info->severity], id);
190 } else { 190 } else {
@@ -194,7 +194,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
194 agent = AER_GET_AGENT(info->severity, info->status); 194 agent = AER_GET_AGENT(info->severity, info->status);
195 195
196 AER_PR(info, dev, 196 AER_PR(info, dev,
197 "PCIE Bus Error: severity=%s, type=%s, id=%04x(%s)\n", 197 "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
198 aer_error_severity_string[info->severity], 198 aer_error_severity_string[info->severity],
199 aer_error_layer[layer], id, aer_agent_string[agent]); 199 aer_error_layer[layer], id, aer_agent_string[agent]);
200 200
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 5a01fc7fbf05..be53d98fa384 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * File: drivers/pci/pcie/aspm.c 2 * File: drivers/pci/pcie/aspm.c
3 * Enabling PCIE link L0s/L1 state and Clock Power Management 3 * Enabling PCIe link L0s/L1 state and Clock Power Management
4 * 4 *
5 * Copyright (C) 2007 Intel 5 * Copyright (C) 2007 Intel
6 * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com) 6 * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com)
@@ -499,7 +499,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
499 int pos; 499 int pos;
500 u32 reg32; 500 u32 reg32;
501 /* 501 /*
502 * Some functions in a slot might not all be PCIE functions, 502 * Some functions in a slot might not all be PCIe functions,
503 * very strange. Disable ASPM for the whole slot 503 * very strange. Disable ASPM for the whole slot
504 */ 504 */
505 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) { 505 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 413262eb95b7..b174188ac121 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -27,7 +27,7 @@
27 */ 27 */
28static void release_pcie_device(struct device *dev) 28static void release_pcie_device(struct device *dev)
29{ 29{
30 kfree(to_pcie_device(dev)); 30 kfree(to_pcie_device(dev));
31} 31}
32 32
33/** 33/**
@@ -346,12 +346,11 @@ static int suspend_iter(struct device *dev, void *data)
346{ 346{
347 struct pcie_port_service_driver *service_driver; 347 struct pcie_port_service_driver *service_driver;
348 348
349 if ((dev->bus == &pcie_port_bus_type) && 349 if ((dev->bus == &pcie_port_bus_type) && dev->driver) {
350 (dev->driver)) { 350 service_driver = to_service_driver(dev->driver);
351 service_driver = to_service_driver(dev->driver); 351 if (service_driver->suspend)
352 if (service_driver->suspend) 352 service_driver->suspend(to_pcie_device(dev));
353 service_driver->suspend(to_pcie_device(dev)); 353 }
354 }
355 return 0; 354 return 0;
356} 355}
357 356
@@ -494,6 +493,7 @@ int pcie_port_service_register(struct pcie_port_service_driver *new)
494 493
495 return driver_register(&new->driver); 494 return driver_register(&new->driver);
496} 495}
496EXPORT_SYMBOL(pcie_port_service_register);
497 497
498/** 498/**
499 * pcie_port_service_unregister - unregister PCI Express port service driver 499 * pcie_port_service_unregister - unregister PCI Express port service driver
@@ -503,6 +503,4 @@ void pcie_port_service_unregister(struct pcie_port_service_driver *drv)
503{ 503{
504 driver_unregister(&drv->driver); 504 driver_unregister(&drv->driver);
505} 505}
506
507EXPORT_SYMBOL(pcie_port_service_register);
508EXPORT_SYMBOL(pcie_port_service_unregister); 506EXPORT_SYMBOL(pcie_port_service_unregister);
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index a49452e2aed9..13c8972886e6 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -24,7 +24,7 @@
24 */ 24 */
25#define DRIVER_VERSION "v1.0" 25#define DRIVER_VERSION "v1.0"
26#define DRIVER_AUTHOR "tom.l.nguyen@intel.com" 26#define DRIVER_AUTHOR "tom.l.nguyen@intel.com"
27#define DRIVER_DESC "PCIE Port Bus Driver" 27#define DRIVER_DESC "PCIe Port Bus Driver"
28MODULE_AUTHOR(DRIVER_AUTHOR); 28MODULE_AUTHOR(DRIVER_AUTHOR);
29MODULE_DESCRIPTION(DRIVER_DESC); 29MODULE_DESCRIPTION(DRIVER_DESC);
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
@@ -63,7 +63,7 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {
63 * pcie_portdrv_probe - Probe PCI-Express port devices 63 * pcie_portdrv_probe - Probe PCI-Express port devices
64 * @dev: PCI-Express port device being probed 64 * @dev: PCI-Express port device being probed
65 * 65 *
66 * If detected invokes the pcie_port_device_register() method for 66 * If detected invokes the pcie_port_device_register() method for
67 * this port device. 67 * this port device.
68 * 68 *
69 */ 69 */
@@ -78,7 +78,7 @@ static int __devinit pcie_portdrv_probe(struct pci_dev *dev,
78 (dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM))) 78 (dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)))
79 return -ENODEV; 79 return -ENODEV;
80 80
81 if (!dev->irq && dev->pin) { 81 if (!dev->irq && dev->pin) {
82 dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; " 82 dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; "
83 "check vendor BIOS\n", dev->vendor, dev->device); 83 "check vendor BIOS\n", dev->vendor, dev->device);
84 } 84 }
@@ -91,7 +91,7 @@ static int __devinit pcie_portdrv_probe(struct pci_dev *dev,
91 return 0; 91 return 0;
92} 92}
93 93
94static void pcie_portdrv_remove (struct pci_dev *dev) 94static void pcie_portdrv_remove(struct pci_dev *dev)
95{ 95{
96 pcie_port_device_remove(dev); 96 pcie_port_device_remove(dev);
97 pci_disable_device(dev); 97 pci_disable_device(dev);
@@ -129,14 +129,13 @@ static int error_detected_iter(struct device *device, void *data)
129static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev, 129static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev,
130 enum pci_channel_state error) 130 enum pci_channel_state error)
131{ 131{
132 struct aer_broadcast_data result_data = 132 struct aer_broadcast_data data = {error, PCI_ERS_RESULT_CAN_RECOVER};
133 {error, PCI_ERS_RESULT_CAN_RECOVER}; 133 int ret;
134 int retval;
135 134
136 /* can not fail */ 135 /* can not fail */
137 retval = device_for_each_child(&dev->dev, &result_data, error_detected_iter); 136 ret = device_for_each_child(&dev->dev, &data, error_detected_iter);
138 137
139 return result_data.result; 138 return data.result;
140} 139}
141 140
142static int mmio_enabled_iter(struct device *device, void *data) 141static int mmio_enabled_iter(struct device *device, void *data)
@@ -290,7 +289,7 @@ static int __init pcie_portdrv_init(void)
290 return retval; 289 return retval;
291} 290}
292 291
293static void __exit pcie_portdrv_exit(void) 292static void __exit pcie_portdrv_exit(void)
294{ 293{
295 pci_unregister_driver(&pcie_portdriver); 294 pci_unregister_driver(&pcie_portdriver);
296 pcie_port_bus_unregister(); 295 pcie_port_bus_unregister();
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7cfa7c38d318..c74694345b6e 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2629,14 +2629,86 @@ static int __init pci_apply_final_quirks(void)
2629 if (!pci_cache_line_size) { 2629 if (!pci_cache_line_size) {
2630 printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n", 2630 printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",
2631 cls << 2, pci_dfl_cache_line_size << 2); 2631 cls << 2, pci_dfl_cache_line_size << 2);
2632 pci_cache_line_size = cls; 2632 pci_cache_line_size = cls ? cls : pci_dfl_cache_line_size;
2633 } 2633 }
2634 2634
2635 return 0; 2635 return 0;
2636} 2636}
2637 2637
2638fs_initcall_sync(pci_apply_final_quirks); 2638fs_initcall_sync(pci_apply_final_quirks);
2639
2640/*
2641 * Followings are device-specific reset methods which can be used to
2642 * reset a single function if other methods (e.g. FLR, PM D0->D3) are
2643 * not available.
2644 */
2645static int reset_intel_generic_dev(struct pci_dev *dev, int probe)
2646{
2647 int pos;
2648
2649 /* only implement PCI_CLASS_SERIAL_USB at present */
2650 if (dev->class == PCI_CLASS_SERIAL_USB) {
2651 pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
2652 if (!pos)
2653 return -ENOTTY;
2654
2655 if (probe)
2656 return 0;
2657
2658 pci_write_config_byte(dev, pos + 0x4, 1);
2659 msleep(100);
2660
2661 return 0;
2662 } else {
2663 return -ENOTTY;
2664 }
2665}
2666
2667static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
2668{
2669 int pos;
2670
2671 pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
2672 if (!pos)
2673 return -ENOTTY;
2674
2675 if (probe)
2676 return 0;
2677
2678 pci_write_config_word(dev, pos + PCI_EXP_DEVCTL,
2679 PCI_EXP_DEVCTL_BCR_FLR);
2680 msleep(100);
2681
2682 return 0;
2683}
2684
2685#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed
2686
2687static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
2688 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF,
2689 reset_intel_82599_sfp_virtfn },
2690 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
2691 reset_intel_generic_dev },
2692 { 0 }
2693};
2694
2695int pci_dev_specific_reset(struct pci_dev *dev, int probe)
2696{
2697 const struct pci_dev_reset_methods *i;
2698
2699 for (i = pci_dev_reset_methods; i->reset; i++) {
2700 if ((i->vendor == dev->vendor ||
2701 i->vendor == (u16)PCI_ANY_ID) &&
2702 (i->device == dev->device ||
2703 i->device == (u16)PCI_ANY_ID))
2704 return i->reset(dev, probe);
2705 }
2706
2707 return -ENOTTY;
2708}
2709
2639#else 2710#else
2640void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} 2711void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
2712int pci_dev_specific_reset(struct pci_dev *dev, int probe) { return -ENOTTY; }
2641#endif 2713#endif
2642EXPORT_SYMBOL(pci_fixup_device); 2714EXPORT_SYMBOL(pci_fixup_device);
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 6dae87143258..4a471dc4f4b9 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -15,9 +15,9 @@
15 15
16DECLARE_RWSEM(pci_bus_sem); 16DECLARE_RWSEM(pci_bus_sem);
17/* 17/*
18 * find the upstream PCIE-to-PCI bridge of a PCI device 18 * find the upstream PCIe-to-PCI bridge of a PCI device
19 * if the device is PCIE, return NULL 19 * if the device is PCIE, return NULL
20 * if the device isn't connected to a PCIE bridge (that is its parent is a 20 * if the device isn't connected to a PCIe bridge (that is its parent is a
21 * legacy PCI bridge and the bridge is directly connected to bus 0), return its 21 * legacy PCI bridge and the bridge is directly connected to bus 0), return its
22 * parent 22 * parent
23 */ 23 */
@@ -37,7 +37,7 @@ pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
37 tmp = pdev; 37 tmp = pdev;
38 continue; 38 continue;
39 } 39 }
40 /* PCI device should connect to a PCIE bridge */ 40 /* PCI device should connect to a PCIe bridge */
41 if (pdev->pcie_type != PCI_EXP_TYPE_PCI_BRIDGE) { 41 if (pdev->pcie_type != PCI_EXP_TYPE_PCI_BRIDGE) {
42 /* Busted hardware? */ 42 /* Busted hardware? */
43 WARN_ON_ONCE(1); 43 WARN_ON_ONCE(1);
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index cdf50f3bc2df..d99f846451a3 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -222,7 +222,7 @@ int __ref cb_alloc(struct pcmcia_socket *s)
222 unsigned int max, pass; 222 unsigned int max, pass;
223 223
224 s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); 224 s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0));
225/* pcibios_fixup_bus(bus); */ 225 pci_fixup_cardbus(bus);
226 226
227 max = bus->secondary; 227 max = bus->secondary;
228 for (pass = 0; pass < 2; pass++) 228 for (pass = 0; pass < 2; pass++)
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 3aabf1e37988..76e640bccde8 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -291,7 +291,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
291 skt->nr = ops->first + i; 291 skt->nr = ops->first + i;
292 skt->ops = ops; 292 skt->ops = ops;
293 skt->socket.owner = ops->owner; 293 skt->socket.owner = ops->owner;
294 skt->socket.dev.parent = dev; 294 skt->socket.dev.parent = &dev->dev;
295 skt->socket.pci_irq = NO_IRQ; 295 skt->socket.pci_irq = NO_IRQ;
296 296
297 ret = pxa2xx_drv_pcmcia_add_one(skt); 297 ret = pxa2xx_drv_pcmcia_add_one(skt);
@@ -304,8 +304,8 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
304 soc_pcmcia_remove_one(&sinfo->skt[i]); 304 soc_pcmcia_remove_one(&sinfo->skt[i]);
305 kfree(sinfo); 305 kfree(sinfo);
306 } else { 306 } else {
307 pxa2xx_configure_sockets(dev); 307 pxa2xx_configure_sockets(&dev->dev);
308 dev_set_drvdata(dev, sinfo); 308 dev_set_drvdata(&dev->dev, sinfo);
309 } 309 }
310 310
311 return ret; 311 return ret;
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index fc5bf9d2a3f3..db32c25e3605 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -231,8 +231,36 @@ config THINKPAD_ACPI
231 231
232 This driver was formerly known as ibm-acpi. 232 This driver was formerly known as ibm-acpi.
233 233
234 Extra functionality will be available if the rfkill (CONFIG_RFKILL)
235 and/or ALSA (CONFIG_SND) subsystems are available in the kernel.
236 Note that if you want ThinkPad-ACPI to be built-in instead of
237 modular, ALSA and rfkill will also have to be built-in.
238
234 If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. 239 If you have an IBM or Lenovo ThinkPad laptop, say Y or M here.
235 240
241config THINKPAD_ACPI_ALSA_SUPPORT
242 bool "Console audio control ALSA interface"
243 depends on THINKPAD_ACPI
244 depends on SND
245 depends on SND = y || THINKPAD_ACPI = SND
246 default y
247 ---help---
248 Enables monitoring of the built-in console audio output control
249 (headphone and speakers), which is operated by the mute and (in
250 some ThinkPad models) volume hotkeys.
251
252 If this option is enabled, ThinkPad-ACPI will export an ALSA card
253 with a single read-only mixer control, which should be used for
254 on-screen-display feedback purposes by the Desktop Environment.
255
256 Optionally, the driver will also allow software control (the
257 ALSA mixer will be made read-write). Please refer to the driver
258 documentation for details.
259
260 All IBM models have both volume and mute control. Newer Lenovo
261 models only have mute control (the volume hotkeys are just normal
262 keys and volume control is done through the main HDA mixer).
263
236config THINKPAD_ACPI_DEBUGFACILITIES 264config THINKPAD_ACPI_DEBUGFACILITIES
237 bool "Maintainer debug facilities" 265 bool "Maintainer debug facilities"
238 depends on THINKPAD_ACPI 266 depends on THINKPAD_ACPI
@@ -464,4 +492,16 @@ config TOSHIBA_BT_RFKILL
464 492
465 If you have a modern Toshiba laptop with a Bluetooth and an 493 If you have a modern Toshiba laptop with a Bluetooth and an
466 RFKill switch (such as the Portege R500), say Y. 494 RFKill switch (such as the Portege R500), say Y.
495
496config ACPI_CMPC
497 tristate "CMPC Laptop Extras"
498 depends on X86 && ACPI
499 select INPUT
500 select BACKLIGHT_CLASS_DEVICE
501 default n
502 help
503 Support for Intel Classmate PC ACPI devices, including some
504 keys as input device, backlight device, tablet and accelerometer
505 devices.
506
467endif # X86_PLATFORM_DEVICES 507endif # X86_PLATFORM_DEVICES
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index b7474b6a8bf1..9cd9fa0a27e6 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -5,6 +5,7 @@
5obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o 5obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
6obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o 6obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
7obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 7obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
8obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o
8obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o 9obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
9obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o 10obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
10obj-$(CONFIG_DELL_WMI) += dell-wmi.o 11obj-$(CONFIG_DELL_WMI) += dell-wmi.o
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 454970d2d701..07d14dfdf0b4 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -96,9 +96,6 @@ struct acer_quirks {
96MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); 96MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");
97MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3"); 97MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3");
98 98
99/* Temporary workaround until the WMI sysfs interface goes in */
100MODULE_ALIAS("dmi:*:*Acer*:*:");
101
102/* 99/*
103 * Interface capability flags 100 * Interface capability flags
104 */ 101 */
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 79b15b9d9cf0..7b2384d674d0 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -52,7 +52,7 @@
52 */ 52 */
53#undef START_IN_KERNEL_MODE 53#undef START_IN_KERNEL_MODE
54 54
55#define DRV_VER "0.5.20" 55#define DRV_VER "0.5.22"
56 56
57/* 57/*
58 * According to the Atom N270 datasheet, 58 * According to the Atom N270 datasheet,
@@ -156,19 +156,25 @@ static const struct bios_settings_t bios_tbl[] = {
156 {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} }, 156 {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} },
157 /* Acer 1410 */ 157 /* Acer 1410 */
158 {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} }, 158 {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
159 /* special BIOS / other */ 159 {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
160 /* Acer 1810xx */
161 {"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
162 {"Acer", "Aspire 1810T", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
163 {"Acer", "Aspire 1810T", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
164 {"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
165 /* Gateway */
160 {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} }, 166 {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} },
161 {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} }, 167 {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} },
162 {"Gateway ", "LT31 ", "v1.3103 ", 0x55, 0x58, 168 {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x10, 0x0f, 0x00} },
163 {0x10, 0x0f, 0x00} }, 169 {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x10, 0x0f, 0x00} },
164 {"Gateway ", "LT31 ", "v1.3201 ", 0x55, 0x58, 170 {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x10, 0x0f, 0x00} },
165 {0x10, 0x0f, 0x00} }, 171 /* Packard Bell */
166 {"Gateway ", "LT31 ", "v1.3302 ", 0x55, 0x58,
167 {0x10, 0x0f, 0x00} },
168 {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} }, 172 {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} },
169 {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, 173 {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
170 {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} }, 174 {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} },
171 {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} }, 175 {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
176 {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
177 {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
172 /* pewpew-terminator */ 178 /* pewpew-terminator */
173 {"", "", "", 0, 0, {0, 0, 0} } 179 {"", "", "", 0, 0, {0, 0, 0} }
174}; 180};
@@ -486,13 +492,26 @@ static struct platform_driver acerhdf_driver = {
486 .remove = acerhdf_remove, 492 .remove = acerhdf_remove,
487}; 493};
488 494
495/* checks if str begins with start */
496static int str_starts_with(const char *str, const char *start)
497{
498 unsigned long str_len = 0, start_len = 0;
499
500 str_len = strlen(str);
501 start_len = strlen(start);
502
503 if (str_len >= start_len &&
504 !strncmp(str, start, start_len))
505 return 1;
506
507 return 0;
508}
489 509
490/* check hardware */ 510/* check hardware */
491static int acerhdf_check_hardware(void) 511static int acerhdf_check_hardware(void)
492{ 512{
493 char const *vendor, *version, *product; 513 char const *vendor, *version, *product;
494 int i; 514 const struct bios_settings_t *bt = NULL;
495 unsigned long prod_len = 0;
496 515
497 /* get BIOS data */ 516 /* get BIOS data */
498 vendor = dmi_get_system_info(DMI_SYS_VENDOR); 517 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
@@ -514,20 +533,20 @@ static int acerhdf_check_hardware(void)
514 kernelmode = 0; 533 kernelmode = 0;
515 } 534 }
516 535
517 prod_len = strlen(product);
518
519 if (verbose) 536 if (verbose)
520 pr_info("BIOS info: %s %s, product: %s\n", 537 pr_info("BIOS info: %s %s, product: %s\n",
521 vendor, version, product); 538 vendor, version, product);
522 539
523 /* search BIOS version and vendor in BIOS settings table */ 540 /* search BIOS version and vendor in BIOS settings table */
524 for (i = 0; bios_tbl[i].version[0]; i++) { 541 for (bt = bios_tbl; bt->vendor[0]; bt++) {
525 if (strlen(bios_tbl[i].product) >= prod_len && 542 /*
526 !strncmp(bios_tbl[i].product, product, 543 * check if actual hardware BIOS vendor, product and version
527 strlen(bios_tbl[i].product)) && 544 * IDs start with the strings of BIOS table entry
528 !strcmp(bios_tbl[i].vendor, vendor) && 545 */
529 !strcmp(bios_tbl[i].version, version)) { 546 if (str_starts_with(vendor, bt->vendor) &&
530 bios_cfg = &bios_tbl[i]; 547 str_starts_with(product, bt->product) &&
548 str_starts_with(version, bt->version)) {
549 bios_cfg = bt;
531 break; 550 break;
532 } 551 }
533 } 552 }
@@ -640,9 +659,14 @@ static void __exit acerhdf_exit(void)
640MODULE_LICENSE("GPL"); 659MODULE_LICENSE("GPL");
641MODULE_AUTHOR("Peter Feuerer"); 660MODULE_AUTHOR("Peter Feuerer");
642MODULE_DESCRIPTION("Aspire One temperature and fan driver"); 661MODULE_DESCRIPTION("Aspire One temperature and fan driver");
643MODULE_ALIAS("dmi:*:*Acer*:*:"); 662MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
644MODULE_ALIAS("dmi:*:*Gateway*:*:"); 663MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1410*:");
645MODULE_ALIAS("dmi:*:*Packard Bell*:*:"); 664MODULE_ALIAS("dmi:*:*Acer*:pnAspire 1810*:");
665MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
666MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
667MODULE_ALIAS("dmi:*:*Packard Bell*:pnAOA*:");
668MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOA*:");
669MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOTMU*:");
646 670
647module_init(acerhdf_init); 671module_init(acerhdf_init);
648module_exit(acerhdf_exit); 672module_exit(acerhdf_exit);
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c
index 0c9c53111a22..c1d2aeeea948 100644
--- a/drivers/platform/x86/asus_acpi.c
+++ b/drivers/platform/x86/asus_acpi.c
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/seq_file.h>
38#include <linux/backlight.h> 39#include <linux/backlight.h>
39#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
40#include <acpi/acpi_bus.h> 41#include <acpi/acpi_bus.h>
@@ -513,26 +514,12 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
513 return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER); 514 return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
514} 515}
515 516
516/* 517static int asus_info_proc_show(struct seq_file *m, void *v)
517 * We write our info in page, we begin at offset off and cannot write more
518 * than count bytes. We set eof to 1 if we handle those 2 values. We return the
519 * number of bytes written in page
520 */
521static int
522proc_read_info(char *page, char **start, off_t off, int count, int *eof,
523 void *data)
524{ 518{
525 int len = 0;
526 int temp; 519 int temp;
527 char buf[16]; /* enough for all info */
528 /*
529 * We use the easy way, we don't care of off and count,
530 * so we don't set eof to 1
531 */
532 520
533 len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n"); 521 seq_printf(m, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
534 len += sprintf(page + len, "Model reference : %s\n", 522 seq_printf(m, "Model reference : %s\n", hotk->methods->name);
535 hotk->methods->name);
536 /* 523 /*
537 * The SFUN method probably allows the original driver to get the list 524 * The SFUN method probably allows the original driver to get the list
538 * of features supported by a given model. For now, 0x0100 or 0x0800 525 * of features supported by a given model. For now, 0x0100 or 0x0800
@@ -540,8 +527,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
540 * The significance of others is yet to be found. 527 * The significance of others is yet to be found.
541 */ 528 */
542 if (read_acpi_int(hotk->handle, "SFUN", &temp)) 529 if (read_acpi_int(hotk->handle, "SFUN", &temp))
543 len += 530 seq_printf(m, "SFUN value : 0x%04x\n", temp);
544 sprintf(page + len, "SFUN value : 0x%04x\n", temp);
545 /* 531 /*
546 * Another value for userspace: the ASYM method returns 0x02 for 532 * Another value for userspace: the ASYM method returns 0x02 for
547 * battery low and 0x04 for battery critical, its readings tend to be 533 * battery low and 0x04 for battery critical, its readings tend to be
@@ -550,30 +536,34 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
550 * silently ignored. 536 * silently ignored.
551 */ 537 */
552 if (read_acpi_int(hotk->handle, "ASYM", &temp)) 538 if (read_acpi_int(hotk->handle, "ASYM", &temp))
553 len += 539 seq_printf(m, "ASYM value : 0x%04x\n", temp);
554 sprintf(page + len, "ASYM value : 0x%04x\n", temp);
555 if (asus_info) { 540 if (asus_info) {
556 snprintf(buf, 16, "%d", asus_info->length); 541 seq_printf(m, "DSDT length : %d\n", asus_info->length);
557 len += sprintf(page + len, "DSDT length : %s\n", buf); 542 seq_printf(m, "DSDT checksum : %d\n", asus_info->checksum);
558 snprintf(buf, 16, "%d", asus_info->checksum); 543 seq_printf(m, "DSDT revision : %d\n", asus_info->revision);
559 len += sprintf(page + len, "DSDT checksum : %s\n", buf); 544 seq_printf(m, "OEM id : %.*s\n", ACPI_OEM_ID_SIZE, asus_info->oem_id);
560 snprintf(buf, 16, "%d", asus_info->revision); 545 seq_printf(m, "OEM table id : %.*s\n", ACPI_OEM_TABLE_ID_SIZE, asus_info->oem_table_id);
561 len += sprintf(page + len, "DSDT revision : %s\n", buf); 546 seq_printf(m, "OEM revision : 0x%x\n", asus_info->oem_revision);
562 snprintf(buf, 7, "%s", asus_info->oem_id); 547 seq_printf(m, "ASL comp vendor id : %.*s\n", ACPI_NAME_SIZE, asus_info->asl_compiler_id);
563 len += sprintf(page + len, "OEM id : %s\n", buf); 548 seq_printf(m, "ASL comp revision : 0x%x\n", asus_info->asl_compiler_revision);
564 snprintf(buf, 9, "%s", asus_info->oem_table_id);
565 len += sprintf(page + len, "OEM table id : %s\n", buf);
566 snprintf(buf, 16, "%x", asus_info->oem_revision);
567 len += sprintf(page + len, "OEM revision : 0x%s\n", buf);
568 snprintf(buf, 5, "%s", asus_info->asl_compiler_id);
569 len += sprintf(page + len, "ASL comp vendor id : %s\n", buf);
570 snprintf(buf, 16, "%x", asus_info->asl_compiler_revision);
571 len += sprintf(page + len, "ASL comp revision : 0x%s\n", buf);
572 } 549 }
573 550
574 return len; 551 return 0;
552}
553
554static int asus_info_proc_open(struct inode *inode, struct file *file)
555{
556 return single_open(file, asus_info_proc_show, NULL);
575} 557}
576 558
559static const struct file_operations asus_info_proc_fops = {
560 .owner = THIS_MODULE,
561 .open = asus_info_proc_open,
562 .read = seq_read,
563 .llseek = seq_lseek,
564 .release = single_release,
565};
566
577/* 567/*
578 * /proc handlers 568 * /proc handlers
579 * We write our info in page, we begin at offset off and cannot write more 569 * We write our info in page, we begin at offset off and cannot write more
@@ -639,34 +629,48 @@ write_led(const char __user *buffer, unsigned long count,
639/* 629/*
640 * Proc handlers for MLED 630 * Proc handlers for MLED
641 */ 631 */
642static int 632static int mled_proc_show(struct seq_file *m, void *v)
643proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
644 void *data)
645{ 633{
646 return sprintf(page, "%d\n", 634 seq_printf(m, "%d\n", read_led(hotk->methods->mled_status, MLED_ON));
647 read_led(hotk->methods->mled_status, MLED_ON)); 635 return 0;
648} 636}
649 637
650static int 638static int mled_proc_open(struct inode *inode, struct file *file)
651proc_write_mled(struct file *file, const char __user *buffer, 639{
652 unsigned long count, void *data) 640 return single_open(file, mled_proc_show, NULL);
641}
642
643static ssize_t mled_proc_write(struct file *file, const char __user *buffer,
644 size_t count, loff_t *pos)
653{ 645{
654 return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1); 646 return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1);
655} 647}
656 648
649static const struct file_operations mled_proc_fops = {
650 .owner = THIS_MODULE,
651 .open = mled_proc_open,
652 .read = seq_read,
653 .llseek = seq_lseek,
654 .release = single_release,
655 .write = mled_proc_write,
656};
657
657/* 658/*
658 * Proc handlers for LED display 659 * Proc handlers for LED display
659 */ 660 */
660static int 661static int ledd_proc_show(struct seq_file *m, void *v)
661proc_read_ledd(char *page, char **start, off_t off, int count, int *eof,
662 void *data)
663{ 662{
664 return sprintf(page, "0x%08x\n", hotk->ledd_status); 663 seq_printf(m, "0x%08x\n", hotk->ledd_status);
664 return 0;
665} 665}
666 666
667static int 667static int ledd_proc_open(struct inode *inode, struct file *file)
668proc_write_ledd(struct file *file, const char __user *buffer, 668{
669 unsigned long count, void *data) 669 return single_open(file, ledd_proc_show, NULL);
670}
671
672static ssize_t ledd_proc_write(struct file *file, const char __user *buffer,
673 size_t count, loff_t *pos)
670{ 674{
671 int rv, value; 675 int rv, value;
672 676
@@ -682,61 +686,104 @@ proc_write_ledd(struct file *file, const char __user *buffer,
682 return rv; 686 return rv;
683} 687}
684 688
689static const struct file_operations ledd_proc_fops = {
690 .owner = THIS_MODULE,
691 .open = ledd_proc_open,
692 .read = seq_read,
693 .llseek = seq_lseek,
694 .release = single_release,
695 .write = ledd_proc_write,
696};
697
685/* 698/*
686 * Proc handlers for WLED 699 * Proc handlers for WLED
687 */ 700 */
688static int 701static int wled_proc_show(struct seq_file *m, void *v)
689proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
690 void *data)
691{ 702{
692 return sprintf(page, "%d\n", 703 seq_printf(m, "%d\n", read_led(hotk->methods->wled_status, WLED_ON));
693 read_led(hotk->methods->wled_status, WLED_ON)); 704 return 0;
694} 705}
695 706
696static int 707static int wled_proc_open(struct inode *inode, struct file *file)
697proc_write_wled(struct file *file, const char __user *buffer, 708{
698 unsigned long count, void *data) 709 return single_open(file, wled_proc_show, NULL);
710}
711
712static ssize_t wled_proc_write(struct file *file, const char __user *buffer,
713 size_t count, loff_t *pos)
699{ 714{
700 return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0); 715 return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0);
701} 716}
702 717
718static const struct file_operations wled_proc_fops = {
719 .owner = THIS_MODULE,
720 .open = wled_proc_open,
721 .read = seq_read,
722 .llseek = seq_lseek,
723 .release = single_release,
724 .write = wled_proc_write,
725};
726
703/* 727/*
704 * Proc handlers for Bluetooth 728 * Proc handlers for Bluetooth
705 */ 729 */
706static int 730static int bluetooth_proc_show(struct seq_file *m, void *v)
707proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
708 void *data)
709{ 731{
710 return sprintf(page, "%d\n", read_led(hotk->methods->bt_status, BT_ON)); 732 seq_printf(m, "%d\n", read_led(hotk->methods->bt_status, BT_ON));
733 return 0;
711} 734}
712 735
713static int 736static int bluetooth_proc_open(struct inode *inode, struct file *file)
714proc_write_bluetooth(struct file *file, const char __user *buffer, 737{
715 unsigned long count, void *data) 738 return single_open(file, bluetooth_proc_show, NULL);
739}
740
741static ssize_t bluetooth_proc_write(struct file *file,
742 const char __user *buffer, size_t count, loff_t *pos)
716{ 743{
717 /* Note: mt_bt_switch controls both internal Bluetooth adapter's 744 /* Note: mt_bt_switch controls both internal Bluetooth adapter's
718 presence and its LED */ 745 presence and its LED */
719 return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0); 746 return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0);
720} 747}
721 748
749static const struct file_operations bluetooth_proc_fops = {
750 .owner = THIS_MODULE,
751 .open = bluetooth_proc_open,
752 .read = seq_read,
753 .llseek = seq_lseek,
754 .release = single_release,
755 .write = bluetooth_proc_write,
756};
757
722/* 758/*
723 * Proc handlers for TLED 759 * Proc handlers for TLED
724 */ 760 */
725static int 761static int tled_proc_show(struct seq_file *m, void *v)
726proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
727 void *data)
728{ 762{
729 return sprintf(page, "%d\n", 763 seq_printf(m, "%d\n", read_led(hotk->methods->tled_status, TLED_ON));
730 read_led(hotk->methods->tled_status, TLED_ON)); 764 return 0;
731} 765}
732 766
733static int 767static int tled_proc_open(struct inode *inode, struct file *file)
734proc_write_tled(struct file *file, const char __user *buffer, 768{
735 unsigned long count, void *data) 769 return single_open(file, tled_proc_show, NULL);
770}
771
772static ssize_t tled_proc_write(struct file *file, const char __user *buffer,
773 size_t count, loff_t *pos)
736{ 774{
737 return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0); 775 return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
738} 776}
739 777
778static const struct file_operations tled_proc_fops = {
779 .owner = THIS_MODULE,
780 .open = tled_proc_open,
781 .read = seq_read,
782 .llseek = seq_lseek,
783 .release = single_release,
784 .write = tled_proc_write,
785};
786
740static int get_lcd_state(void) 787static int get_lcd_state(void)
741{ 788{
742 int lcd = 0; 789 int lcd = 0;
@@ -829,16 +876,19 @@ static int set_lcd_state(int value)
829 876
830} 877}
831 878
832static int 879static int lcd_proc_show(struct seq_file *m, void *v)
833proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
834 void *data)
835{ 880{
836 return sprintf(page, "%d\n", get_lcd_state()); 881 seq_printf(m, "%d\n", get_lcd_state());
882 return 0;
837} 883}
838 884
839static int 885static int lcd_proc_open(struct inode *inode, struct file *file)
840proc_write_lcd(struct file *file, const char __user *buffer, 886{
841 unsigned long count, void *data) 887 return single_open(file, lcd_proc_show, NULL);
888}
889
890static ssize_t lcd_proc_write(struct file *file, const char __user *buffer,
891 size_t count, loff_t *pos)
842{ 892{
843 int rv, value; 893 int rv, value;
844 894
@@ -848,6 +898,15 @@ proc_write_lcd(struct file *file, const char __user *buffer,
848 return rv; 898 return rv;
849} 899}
850 900
901static const struct file_operations lcd_proc_fops = {
902 .owner = THIS_MODULE,
903 .open = lcd_proc_open,
904 .read = seq_read,
905 .llseek = seq_lseek,
906 .release = single_release,
907 .write = lcd_proc_write,
908};
909
851static int read_brightness(struct backlight_device *bd) 910static int read_brightness(struct backlight_device *bd)
852{ 911{
853 int value; 912 int value;
@@ -907,16 +966,19 @@ static int set_brightness_status(struct backlight_device *bd)
907 return set_brightness(bd->props.brightness); 966 return set_brightness(bd->props.brightness);
908} 967}
909 968
910static int 969static int brn_proc_show(struct seq_file *m, void *v)
911proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
912 void *data)
913{ 970{
914 return sprintf(page, "%d\n", read_brightness(NULL)); 971 seq_printf(m, "%d\n", read_brightness(NULL));
972 return 0;
915} 973}
916 974
917static int 975static int brn_proc_open(struct inode *inode, struct file *file)
918proc_write_brn(struct file *file, const char __user *buffer, 976{
919 unsigned long count, void *data) 977 return single_open(file, brn_proc_show, NULL);
978}
979
980static ssize_t brn_proc_write(struct file *file, const char __user *buffer,
981 size_t count, loff_t *pos)
920{ 982{
921 int rv, value; 983 int rv, value;
922 984
@@ -929,6 +991,15 @@ proc_write_brn(struct file *file, const char __user *buffer,
929 return rv; 991 return rv;
930} 992}
931 993
994static const struct file_operations brn_proc_fops = {
995 .owner = THIS_MODULE,
996 .open = brn_proc_open,
997 .read = seq_read,
998 .llseek = seq_lseek,
999 .release = single_release,
1000 .write = brn_proc_write,
1001};
1002
932static void set_display(int value) 1003static void set_display(int value)
933{ 1004{
934 /* no sanity check needed for now */ 1005 /* no sanity check needed for now */
@@ -942,9 +1013,7 @@ static void set_display(int value)
942 * Now, *this* one could be more user-friendly, but so far, no-one has 1013 * Now, *this* one could be more user-friendly, but so far, no-one has
943 * complained. The significance of bits is the same as in proc_write_disp() 1014 * complained. The significance of bits is the same as in proc_write_disp()
944 */ 1015 */
945static int 1016static int disp_proc_show(struct seq_file *m, void *v)
946proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
947 void *data)
948{ 1017{
949 int value = 0; 1018 int value = 0;
950 1019
@@ -952,7 +1021,13 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
952 printk(KERN_WARNING 1021 printk(KERN_WARNING
953 "Asus ACPI: Error reading display status\n"); 1022 "Asus ACPI: Error reading display status\n");
954 value &= 0x07; /* needed for some models, shouldn't hurt others */ 1023 value &= 0x07; /* needed for some models, shouldn't hurt others */
955 return sprintf(page, "%d\n", value); 1024 seq_printf(m, "%d\n", value);
1025 return 0;
1026}
1027
1028static int disp_proc_open(struct inode *inode, struct file *file)
1029{
1030 return single_open(file, disp_proc_show, NULL);
956} 1031}
957 1032
958/* 1033/*
@@ -961,9 +1036,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
961 * (bitwise) of these will suffice. I never actually tested 3 displays hooked 1036 * (bitwise) of these will suffice. I never actually tested 3 displays hooked
962 * up simultaneously, so be warned. See the acpi4asus README for more info. 1037 * up simultaneously, so be warned. See the acpi4asus README for more info.
963 */ 1038 */
964static int 1039static ssize_t disp_proc_write(struct file *file, const char __user *buffer,
965proc_write_disp(struct file *file, const char __user *buffer, 1040 size_t count, loff_t *pos)
966 unsigned long count, void *data)
967{ 1041{
968 int rv, value; 1042 int rv, value;
969 1043
@@ -973,25 +1047,27 @@ proc_write_disp(struct file *file, const char __user *buffer,
973 return rv; 1047 return rv;
974} 1048}
975 1049
976typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, 1050static const struct file_operations disp_proc_fops = {
977 int *eof, void *data); 1051 .owner = THIS_MODULE,
978typedef int (proc_writefunc) (struct file *file, const char __user *buffer, 1052 .open = disp_proc_open,
979 unsigned long count, void *data); 1053 .read = seq_read,
1054 .llseek = seq_lseek,
1055 .release = single_release,
1056 .write = disp_proc_write,
1057};
980 1058
981static int 1059static int
982asus_proc_add(char *name, proc_writefunc *writefunc, 1060asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode,
983 proc_readfunc *readfunc, mode_t mode,
984 struct acpi_device *device) 1061 struct acpi_device *device)
985{ 1062{
986 struct proc_dir_entry *proc = 1063 struct proc_dir_entry *proc;
987 create_proc_entry(name, mode, acpi_device_dir(device)); 1064
1065 proc = proc_create_data(name, mode, acpi_device_dir(device),
1066 proc_fops, acpi_driver_data(device));
988 if (!proc) { 1067 if (!proc) {
989 printk(KERN_WARNING " Unable to create %s fs entry\n", name); 1068 printk(KERN_WARNING " Unable to create %s fs entry\n", name);
990 return -1; 1069 return -1;
991 } 1070 }
992 proc->write_proc = writefunc;
993 proc->read_proc = readfunc;
994 proc->data = acpi_driver_data(device);
995 proc->uid = asus_uid; 1071 proc->uid = asus_uid;
996 proc->gid = asus_gid; 1072 proc->gid = asus_gid;
997 return 0; 1073 return 0;
@@ -1020,10 +1096,9 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1020 if (!acpi_device_dir(device)) 1096 if (!acpi_device_dir(device))
1021 return -ENODEV; 1097 return -ENODEV;
1022 1098
1023 proc = create_proc_entry(PROC_INFO, mode, acpi_device_dir(device)); 1099 proc = proc_create(PROC_INFO, mode, acpi_device_dir(device),
1100 &asus_info_proc_fops);
1024 if (proc) { 1101 if (proc) {
1025 proc->read_proc = proc_read_info;
1026 proc->data = acpi_driver_data(device);
1027 proc->uid = asus_uid; 1102 proc->uid = asus_uid;
1028 proc->gid = asus_gid; 1103 proc->gid = asus_gid;
1029 } else { 1104 } else {
@@ -1032,28 +1107,23 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1032 } 1107 }
1033 1108
1034 if (hotk->methods->mt_wled) { 1109 if (hotk->methods->mt_wled) {
1035 asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, 1110 asus_proc_add(PROC_WLED, &wled_proc_fops, mode, device);
1036 mode, device);
1037 } 1111 }
1038 1112
1039 if (hotk->methods->mt_ledd) { 1113 if (hotk->methods->mt_ledd) {
1040 asus_proc_add(PROC_LEDD, &proc_write_ledd, &proc_read_ledd, 1114 asus_proc_add(PROC_LEDD, &ledd_proc_fops, mode, device);
1041 mode, device);
1042 } 1115 }
1043 1116
1044 if (hotk->methods->mt_mled) { 1117 if (hotk->methods->mt_mled) {
1045 asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, 1118 asus_proc_add(PROC_MLED, &mled_proc_fops, mode, device);
1046 mode, device);
1047 } 1119 }
1048 1120
1049 if (hotk->methods->mt_tled) { 1121 if (hotk->methods->mt_tled) {
1050 asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, 1122 asus_proc_add(PROC_TLED, &tled_proc_fops, mode, device);
1051 mode, device);
1052 } 1123 }
1053 1124
1054 if (hotk->methods->mt_bt_switch) { 1125 if (hotk->methods->mt_bt_switch) {
1055 asus_proc_add(PROC_BT, &proc_write_bluetooth, 1126 asus_proc_add(PROC_BT, &bluetooth_proc_fops, mode, device);
1056 &proc_read_bluetooth, mode, device);
1057 } 1127 }
1058 1128
1059 /* 1129 /*
@@ -1061,19 +1131,16 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1061 * accessible from the keyboard 1131 * accessible from the keyboard
1062 */ 1132 */
1063 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) { 1133 if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) {
1064 asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, 1134 asus_proc_add(PROC_LCD, &lcd_proc_fops, mode, device);
1065 device);
1066 } 1135 }
1067 1136
1068 if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || 1137 if ((hotk->methods->brightness_up && hotk->methods->brightness_down) ||
1069 (hotk->methods->brightness_get && hotk->methods->brightness_set)) { 1138 (hotk->methods->brightness_get && hotk->methods->brightness_set)) {
1070 asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, 1139 asus_proc_add(PROC_BRN, &brn_proc_fops, mode, device);
1071 device);
1072 } 1140 }
1073 1141
1074 if (hotk->methods->display_set) { 1142 if (hotk->methods->display_set) {
1075 asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, 1143 asus_proc_add(PROC_DISP, &disp_proc_fops, mode, device);
1076 mode, device);
1077 } 1144 }
1078 1145
1079 return 0; 1146 return 0;
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
new file mode 100644
index 000000000000..ed90082cdf1d
--- /dev/null
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -0,0 +1,609 @@
1/*
2 * Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19
20#include <linux/init.h>
21#include <linux/module.h>
22#include <linux/workqueue.h>
23#include <acpi/acpi_drivers.h>
24#include <linux/backlight.h>
25#include <linux/input.h>
26
27MODULE_LICENSE("GPL");
28
29
30struct cmpc_accel {
31 int sensitivity;
32};
33
34#define CMPC_ACCEL_SENSITIVITY_DEFAULT 5
35
36
37/*
38 * Generic input device code.
39 */
40
41typedef void (*input_device_init)(struct input_dev *dev);
42
43static int cmpc_add_acpi_notify_device(struct acpi_device *acpi, char *name,
44 input_device_init idev_init)
45{
46 struct input_dev *inputdev;
47 int error;
48
49 inputdev = input_allocate_device();
50 if (!inputdev)
51 return -ENOMEM;
52 inputdev->name = name;
53 inputdev->dev.parent = &acpi->dev;
54 idev_init(inputdev);
55 error = input_register_device(inputdev);
56 if (error) {
57 input_free_device(inputdev);
58 return error;
59 }
60 dev_set_drvdata(&acpi->dev, inputdev);
61 return 0;
62}
63
64static int cmpc_remove_acpi_notify_device(struct acpi_device *acpi)
65{
66 struct input_dev *inputdev = dev_get_drvdata(&acpi->dev);
67 input_unregister_device(inputdev);
68 return 0;
69}
70
71/*
72 * Accelerometer code.
73 */
74static acpi_status cmpc_start_accel(acpi_handle handle)
75{
76 union acpi_object param[2];
77 struct acpi_object_list input;
78 acpi_status status;
79
80 param[0].type = ACPI_TYPE_INTEGER;
81 param[0].integer.value = 0x3;
82 param[1].type = ACPI_TYPE_INTEGER;
83 input.count = 2;
84 input.pointer = param;
85 status = acpi_evaluate_object(handle, "ACMD", &input, NULL);
86 return status;
87}
88
89static acpi_status cmpc_stop_accel(acpi_handle handle)
90{
91 union acpi_object param[2];
92 struct acpi_object_list input;
93 acpi_status status;
94
95 param[0].type = ACPI_TYPE_INTEGER;
96 param[0].integer.value = 0x4;
97 param[1].type = ACPI_TYPE_INTEGER;
98 input.count = 2;
99 input.pointer = param;
100 status = acpi_evaluate_object(handle, "ACMD", &input, NULL);
101 return status;
102}
103
104static acpi_status cmpc_accel_set_sensitivity(acpi_handle handle, int val)
105{
106 union acpi_object param[2];
107 struct acpi_object_list input;
108
109 param[0].type = ACPI_TYPE_INTEGER;
110 param[0].integer.value = 0x02;
111 param[1].type = ACPI_TYPE_INTEGER;
112 param[1].integer.value = val;
113 input.count = 2;
114 input.pointer = param;
115 return acpi_evaluate_object(handle, "ACMD", &input, NULL);
116}
117
118static acpi_status cmpc_get_accel(acpi_handle handle,
119 unsigned char *x,
120 unsigned char *y,
121 unsigned char *z)
122{
123 union acpi_object param[2];
124 struct acpi_object_list input;
125 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, 0 };
126 unsigned char *locs;
127 acpi_status status;
128
129 param[0].type = ACPI_TYPE_INTEGER;
130 param[0].integer.value = 0x01;
131 param[1].type = ACPI_TYPE_INTEGER;
132 input.count = 2;
133 input.pointer = param;
134 status = acpi_evaluate_object(handle, "ACMD", &input, &output);
135 if (ACPI_SUCCESS(status)) {
136 union acpi_object *obj;
137 obj = output.pointer;
138 locs = obj->buffer.pointer;
139 *x = locs[0];
140 *y = locs[1];
141 *z = locs[2];
142 kfree(output.pointer);
143 }
144 return status;
145}
146
147static void cmpc_accel_handler(struct acpi_device *dev, u32 event)
148{
149 if (event == 0x81) {
150 unsigned char x, y, z;
151 acpi_status status;
152
153 status = cmpc_get_accel(dev->handle, &x, &y, &z);
154 if (ACPI_SUCCESS(status)) {
155 struct input_dev *inputdev = dev_get_drvdata(&dev->dev);
156
157 input_report_abs(inputdev, ABS_X, x);
158 input_report_abs(inputdev, ABS_Y, y);
159 input_report_abs(inputdev, ABS_Z, z);
160 input_sync(inputdev);
161 }
162 }
163}
164
165static ssize_t cmpc_accel_sensitivity_show(struct device *dev,
166 struct device_attribute *attr,
167 char *buf)
168{
169 struct acpi_device *acpi;
170 struct input_dev *inputdev;
171 struct cmpc_accel *accel;
172
173 acpi = to_acpi_device(dev);
174 inputdev = dev_get_drvdata(&acpi->dev);
175 accel = dev_get_drvdata(&inputdev->dev);
176
177 return sprintf(buf, "%d\n", accel->sensitivity);
178}
179
180static ssize_t cmpc_accel_sensitivity_store(struct device *dev,
181 struct device_attribute *attr,
182 const char *buf, size_t count)
183{
184 struct acpi_device *acpi;
185 struct input_dev *inputdev;
186 struct cmpc_accel *accel;
187 unsigned long sensitivity;
188 int r;
189
190 acpi = to_acpi_device(dev);
191 inputdev = dev_get_drvdata(&acpi->dev);
192 accel = dev_get_drvdata(&inputdev->dev);
193
194 r = strict_strtoul(buf, 0, &sensitivity);
195 if (r)
196 return r;
197
198 accel->sensitivity = sensitivity;
199 cmpc_accel_set_sensitivity(acpi->handle, sensitivity);
200
201 return strnlen(buf, count);
202}
203
204struct device_attribute cmpc_accel_sensitivity_attr = {
205 .attr = { .name = "sensitivity", .mode = 0660 },
206 .show = cmpc_accel_sensitivity_show,
207 .store = cmpc_accel_sensitivity_store
208};
209
210static int cmpc_accel_open(struct input_dev *input)
211{
212 struct acpi_device *acpi;
213
214 acpi = to_acpi_device(input->dev.parent);
215 if (ACPI_SUCCESS(cmpc_start_accel(acpi->handle)))
216 return 0;
217 return -EIO;
218}
219
220static void cmpc_accel_close(struct input_dev *input)
221{
222 struct acpi_device *acpi;
223
224 acpi = to_acpi_device(input->dev.parent);
225 cmpc_stop_accel(acpi->handle);
226}
227
228static void cmpc_accel_idev_init(struct input_dev *inputdev)
229{
230 set_bit(EV_ABS, inputdev->evbit);
231 input_set_abs_params(inputdev, ABS_X, 0, 255, 8, 0);
232 input_set_abs_params(inputdev, ABS_Y, 0, 255, 8, 0);
233 input_set_abs_params(inputdev, ABS_Z, 0, 255, 8, 0);
234 inputdev->open = cmpc_accel_open;
235 inputdev->close = cmpc_accel_close;
236}
237
238static int cmpc_accel_add(struct acpi_device *acpi)
239{
240 int error;
241 struct input_dev *inputdev;
242 struct cmpc_accel *accel;
243
244 accel = kmalloc(sizeof(*accel), GFP_KERNEL);
245 if (!accel)
246 return -ENOMEM;
247
248 accel->sensitivity = CMPC_ACCEL_SENSITIVITY_DEFAULT;
249 cmpc_accel_set_sensitivity(acpi->handle, accel->sensitivity);
250
251 error = device_create_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
252 if (error)
253 goto failed_file;
254
255 error = cmpc_add_acpi_notify_device(acpi, "cmpc_accel",
256 cmpc_accel_idev_init);
257 if (error)
258 goto failed_input;
259
260 inputdev = dev_get_drvdata(&acpi->dev);
261 dev_set_drvdata(&inputdev->dev, accel);
262
263 return 0;
264
265failed_input:
266 device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
267failed_file:
268 kfree(accel);
269 return error;
270}
271
272static int cmpc_accel_remove(struct acpi_device *acpi, int type)
273{
274 struct input_dev *inputdev;
275 struct cmpc_accel *accel;
276
277 inputdev = dev_get_drvdata(&acpi->dev);
278 accel = dev_get_drvdata(&inputdev->dev);
279
280 device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
281 return cmpc_remove_acpi_notify_device(acpi);
282}
283
284static const struct acpi_device_id cmpc_accel_device_ids[] = {
285 {"ACCE0000", 0},
286 {"", 0}
287};
288MODULE_DEVICE_TABLE(acpi, cmpc_accel_device_ids);
289
290static struct acpi_driver cmpc_accel_acpi_driver = {
291 .owner = THIS_MODULE,
292 .name = "cmpc_accel",
293 .class = "cmpc_accel",
294 .ids = cmpc_accel_device_ids,
295 .ops = {
296 .add = cmpc_accel_add,
297 .remove = cmpc_accel_remove,
298 .notify = cmpc_accel_handler,
299 }
300};
301
302
303/*
304 * Tablet mode code.
305 */
306static acpi_status cmpc_get_tablet(acpi_handle handle,
307 unsigned long long *value)
308{
309 union acpi_object param;
310 struct acpi_object_list input;
311 unsigned long long output;
312 acpi_status status;
313
314 param.type = ACPI_TYPE_INTEGER;
315 param.integer.value = 0x01;
316 input.count = 1;
317 input.pointer = &param;
318 status = acpi_evaluate_integer(handle, "TCMD", &input, &output);
319 if (ACPI_SUCCESS(status))
320 *value = output;
321 return status;
322}
323
324static void cmpc_tablet_handler(struct acpi_device *dev, u32 event)
325{
326 unsigned long long val = 0;
327 struct input_dev *inputdev = dev_get_drvdata(&dev->dev);
328
329 if (event == 0x81) {
330 if (ACPI_SUCCESS(cmpc_get_tablet(dev->handle, &val)))
331 input_report_switch(inputdev, SW_TABLET_MODE, !val);
332 }
333}
334
335static void cmpc_tablet_idev_init(struct input_dev *inputdev)
336{
337 unsigned long long val = 0;
338 struct acpi_device *acpi;
339
340 set_bit(EV_SW, inputdev->evbit);
341 set_bit(SW_TABLET_MODE, inputdev->swbit);
342
343 acpi = to_acpi_device(inputdev->dev.parent);
344 if (ACPI_SUCCESS(cmpc_get_tablet(acpi->handle, &val)))
345 input_report_switch(inputdev, SW_TABLET_MODE, !val);
346}
347
348static int cmpc_tablet_add(struct acpi_device *acpi)
349{
350 return cmpc_add_acpi_notify_device(acpi, "cmpc_tablet",
351 cmpc_tablet_idev_init);
352}
353
354static int cmpc_tablet_remove(struct acpi_device *acpi, int type)
355{
356 return cmpc_remove_acpi_notify_device(acpi);
357}
358
359static int cmpc_tablet_resume(struct acpi_device *acpi)
360{
361 struct input_dev *inputdev = dev_get_drvdata(&acpi->dev);
362 unsigned long long val = 0;
363 if (ACPI_SUCCESS(cmpc_get_tablet(acpi->handle, &val)))
364 input_report_switch(inputdev, SW_TABLET_MODE, !val);
365 return 0;
366}
367
368static const struct acpi_device_id cmpc_tablet_device_ids[] = {
369 {"TBLT0000", 0},
370 {"", 0}
371};
372MODULE_DEVICE_TABLE(acpi, cmpc_tablet_device_ids);
373
374static struct acpi_driver cmpc_tablet_acpi_driver = {
375 .owner = THIS_MODULE,
376 .name = "cmpc_tablet",
377 .class = "cmpc_tablet",
378 .ids = cmpc_tablet_device_ids,
379 .ops = {
380 .add = cmpc_tablet_add,
381 .remove = cmpc_tablet_remove,
382 .resume = cmpc_tablet_resume,
383 .notify = cmpc_tablet_handler,
384 }
385};
386
387
388/*
389 * Backlight code.
390 */
391
392static acpi_status cmpc_get_brightness(acpi_handle handle,
393 unsigned long long *value)
394{
395 union acpi_object param;
396 struct acpi_object_list input;
397 unsigned long long output;
398 acpi_status status;
399
400 param.type = ACPI_TYPE_INTEGER;
401 param.integer.value = 0xC0;
402 input.count = 1;
403 input.pointer = &param;
404 status = acpi_evaluate_integer(handle, "GRDI", &input, &output);
405 if (ACPI_SUCCESS(status))
406 *value = output;
407 return status;
408}
409
410static acpi_status cmpc_set_brightness(acpi_handle handle,
411 unsigned long long value)
412{
413 union acpi_object param[2];
414 struct acpi_object_list input;
415 acpi_status status;
416 unsigned long long output;
417
418 param[0].type = ACPI_TYPE_INTEGER;
419 param[0].integer.value = 0xC0;
420 param[1].type = ACPI_TYPE_INTEGER;
421 param[1].integer.value = value;
422 input.count = 2;
423 input.pointer = param;
424 status = acpi_evaluate_integer(handle, "GWRI", &input, &output);
425 return status;
426}
427
428static int cmpc_bl_get_brightness(struct backlight_device *bd)
429{
430 acpi_status status;
431 acpi_handle handle;
432 unsigned long long brightness;
433
434 handle = bl_get_data(bd);
435 status = cmpc_get_brightness(handle, &brightness);
436 if (ACPI_SUCCESS(status))
437 return brightness;
438 else
439 return -1;
440}
441
442static int cmpc_bl_update_status(struct backlight_device *bd)
443{
444 acpi_status status;
445 acpi_handle handle;
446
447 handle = bl_get_data(bd);
448 status = cmpc_set_brightness(handle, bd->props.brightness);
449 if (ACPI_SUCCESS(status))
450 return 0;
451 else
452 return -1;
453}
454
455static struct backlight_ops cmpc_bl_ops = {
456 .get_brightness = cmpc_bl_get_brightness,
457 .update_status = cmpc_bl_update_status
458};
459
460static int cmpc_bl_add(struct acpi_device *acpi)
461{
462 struct backlight_device *bd;
463
464 bd = backlight_device_register("cmpc_bl", &acpi->dev,
465 acpi->handle, &cmpc_bl_ops);
466 bd->props.max_brightness = 7;
467 dev_set_drvdata(&acpi->dev, bd);
468 return 0;
469}
470
471static int cmpc_bl_remove(struct acpi_device *acpi, int type)
472{
473 struct backlight_device *bd;
474
475 bd = dev_get_drvdata(&acpi->dev);
476 backlight_device_unregister(bd);
477 return 0;
478}
479
480static const struct acpi_device_id cmpc_device_ids[] = {
481 {"IPML200", 0},
482 {"", 0}
483};
484MODULE_DEVICE_TABLE(acpi, cmpc_device_ids);
485
486static struct acpi_driver cmpc_bl_acpi_driver = {
487 .owner = THIS_MODULE,
488 .name = "cmpc",
489 .class = "cmpc",
490 .ids = cmpc_device_ids,
491 .ops = {
492 .add = cmpc_bl_add,
493 .remove = cmpc_bl_remove
494 }
495};
496
497
498/*
499 * Extra keys code.
500 */
501static int cmpc_keys_codes[] = {
502 KEY_UNKNOWN,
503 KEY_WLAN,
504 KEY_SWITCHVIDEOMODE,
505 KEY_BRIGHTNESSDOWN,
506 KEY_BRIGHTNESSUP,
507 KEY_VENDOR,
508 KEY_MAX
509};
510
511static void cmpc_keys_handler(struct acpi_device *dev, u32 event)
512{
513 struct input_dev *inputdev;
514 int code = KEY_MAX;
515
516 if ((event & 0x0F) < ARRAY_SIZE(cmpc_keys_codes))
517 code = cmpc_keys_codes[event & 0x0F];
518 inputdev = dev_get_drvdata(&dev->dev);;
519 input_report_key(inputdev, code, !(event & 0x10));
520}
521
522static void cmpc_keys_idev_init(struct input_dev *inputdev)
523{
524 int i;
525
526 set_bit(EV_KEY, inputdev->evbit);
527 for (i = 0; cmpc_keys_codes[i] != KEY_MAX; i++)
528 set_bit(cmpc_keys_codes[i], inputdev->keybit);
529}
530
531static int cmpc_keys_add(struct acpi_device *acpi)
532{
533 return cmpc_add_acpi_notify_device(acpi, "cmpc_keys",
534 cmpc_keys_idev_init);
535}
536
537static int cmpc_keys_remove(struct acpi_device *acpi, int type)
538{
539 return cmpc_remove_acpi_notify_device(acpi);
540}
541
542static const struct acpi_device_id cmpc_keys_device_ids[] = {
543 {"FnBT0000", 0},
544 {"", 0}
545};
546MODULE_DEVICE_TABLE(acpi, cmpc_keys_device_ids);
547
548static struct acpi_driver cmpc_keys_acpi_driver = {
549 .owner = THIS_MODULE,
550 .name = "cmpc_keys",
551 .class = "cmpc_keys",
552 .ids = cmpc_keys_device_ids,
553 .ops = {
554 .add = cmpc_keys_add,
555 .remove = cmpc_keys_remove,
556 .notify = cmpc_keys_handler,
557 }
558};
559
560
561/*
562 * General init/exit code.
563 */
564
565static int cmpc_init(void)
566{
567 int r;
568
569 r = acpi_bus_register_driver(&cmpc_keys_acpi_driver);
570 if (r)
571 goto failed_keys;
572
573 r = acpi_bus_register_driver(&cmpc_bl_acpi_driver);
574 if (r)
575 goto failed_bl;
576
577 r = acpi_bus_register_driver(&cmpc_tablet_acpi_driver);
578 if (r)
579 goto failed_tablet;
580
581 r = acpi_bus_register_driver(&cmpc_accel_acpi_driver);
582 if (r)
583 goto failed_accel;
584
585 return r;
586
587failed_accel:
588 acpi_bus_unregister_driver(&cmpc_tablet_acpi_driver);
589
590failed_tablet:
591 acpi_bus_unregister_driver(&cmpc_bl_acpi_driver);
592
593failed_bl:
594 acpi_bus_unregister_driver(&cmpc_keys_acpi_driver);
595
596failed_keys:
597 return r;
598}
599
600static void cmpc_exit(void)
601{
602 acpi_bus_unregister_driver(&cmpc_accel_acpi_driver);
603 acpi_bus_unregister_driver(&cmpc_tablet_acpi_driver);
604 acpi_bus_unregister_driver(&cmpc_bl_acpi_driver);
605 acpi_bus_unregister_driver(&cmpc_keys_acpi_driver);
606}
607
608module_init(cmpc_init);
609module_exit(cmpc_exit);
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 11003bba10d3..1a387e79f719 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -51,7 +51,6 @@
51#include <linux/dmi.h> 51#include <linux/dmi.h>
52#include <linux/backlight.h> 52#include <linux/backlight.h>
53#include <linux/platform_device.h> 53#include <linux/platform_device.h>
54#include <linux/autoconf.h>
55 54
56#define COMPAL_DRIVER_VERSION "0.2.6" 55#define COMPAL_DRIVER_VERSION "0.2.6"
57 56
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 67f3fe71c509..1b1dddbd5744 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -202,8 +202,13 @@ static void dell_wmi_notify(u32 value, void *context)
202 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; 202 struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
203 static struct key_entry *key; 203 static struct key_entry *key;
204 union acpi_object *obj; 204 union acpi_object *obj;
205 acpi_status status;
205 206
206 wmi_get_event_data(value, &response); 207 status = wmi_get_event_data(value, &response);
208 if (status != AE_OK) {
209 printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status);
210 return;
211 }
207 212
208 obj = (union acpi_object *)response.pointer; 213 obj = (union acpi_object *)response.pointer;
209 214
@@ -238,6 +243,7 @@ static void dell_wmi_notify(u32 value, void *context)
238 input_sync(dell_wmi_input_dev); 243 input_sync(dell_wmi_input_dev);
239 } 244 }
240 } 245 }
246 kfree(obj);
241} 247}
242 248
243 249
@@ -322,39 +328,37 @@ static int __init dell_wmi_input_setup(void)
322static int __init dell_wmi_init(void) 328static int __init dell_wmi_init(void)
323{ 329{
324 int err; 330 int err;
331 acpi_status status;
325 332
326 if (wmi_has_guid(DELL_EVENT_GUID)) { 333 if (!wmi_has_guid(DELL_EVENT_GUID)) {
327 334 printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n");
328 dmi_walk(find_hk_type, NULL); 335 return -ENODEV;
329 336 }
330 err = dell_wmi_input_setup();
331
332 if (err)
333 return err;
334 337
335 err = wmi_install_notify_handler(DELL_EVENT_GUID, 338 dmi_walk(find_hk_type, NULL);
336 dell_wmi_notify, NULL); 339 acpi_video = acpi_video_backlight_support();
337 if (err) {
338 input_unregister_device(dell_wmi_input_dev);
339 printk(KERN_ERR "dell-wmi: Unable to register"
340 " notify handler - %d\n", err);
341 return err;
342 }
343 340
344 acpi_video = acpi_video_backlight_support(); 341 err = dell_wmi_input_setup();
342 if (err)
343 return err;
345 344
346 } else 345 status = wmi_install_notify_handler(DELL_EVENT_GUID,
347 printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); 346 dell_wmi_notify, NULL);
347 if (ACPI_FAILURE(status)) {
348 input_unregister_device(dell_wmi_input_dev);
349 printk(KERN_ERR
350 "dell-wmi: Unable to register notify handler - %d\n",
351 status);
352 return -ENODEV;
353 }
348 354
349 return 0; 355 return 0;
350} 356}
351 357
352static void __exit dell_wmi_exit(void) 358static void __exit dell_wmi_exit(void)
353{ 359{
354 if (wmi_has_guid(DELL_EVENT_GUID)) { 360 wmi_remove_notify_handler(DELL_EVENT_GUID);
355 wmi_remove_notify_handler(DELL_EVENT_GUID); 361 input_unregister_device(dell_wmi_input_dev);
356 input_unregister_device(dell_wmi_input_dev);
357 }
358} 362}
359 363
360module_init(dell_wmi_init); 364module_init(dell_wmi_init);
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index bcd4ba8be7db..5f3320d468f6 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -164,7 +164,7 @@ struct fujitsu_hotkey_t {
164 struct input_dev *input; 164 struct input_dev *input;
165 char phys[32]; 165 char phys[32];
166 struct platform_device *pf_device; 166 struct platform_device *pf_device;
167 struct kfifo *fifo; 167 struct kfifo fifo;
168 spinlock_t fifo_lock; 168 spinlock_t fifo_lock;
169 int rfkill_supported; 169 int rfkill_supported;
170 int rfkill_state; 170 int rfkill_state;
@@ -376,8 +376,8 @@ static int get_lcd_level(void)
376 376
377 status = 377 status =
378 acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state); 378 acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
379 if (status < 0) 379 if (ACPI_FAILURE(status))
380 return status; 380 return 0;
381 381
382 fujitsu->brightness_level = state & 0x0fffffff; 382 fujitsu->brightness_level = state & 0x0fffffff;
383 383
@@ -398,8 +398,8 @@ static int get_max_brightness(void)
398 398
399 status = 399 status =
400 acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state); 400 acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state);
401 if (status < 0) 401 if (ACPI_FAILURE(status))
402 return status; 402 return -1;
403 403
404 fujitsu->max_brightness = state; 404 fujitsu->max_brightness = state;
405 405
@@ -824,12 +824,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
824 824
825 /* kfifo */ 825 /* kfifo */
826 spin_lock_init(&fujitsu_hotkey->fifo_lock); 826 spin_lock_init(&fujitsu_hotkey->fifo_lock);
827 fujitsu_hotkey->fifo = 827 error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int),
828 kfifo_alloc(RINGBUFFERSIZE * sizeof(int), GFP_KERNEL, 828 GFP_KERNEL);
829 &fujitsu_hotkey->fifo_lock); 829 if (error) {
830 if (IS_ERR(fujitsu_hotkey->fifo)) {
831 printk(KERN_ERR "kfifo_alloc failed\n"); 830 printk(KERN_ERR "kfifo_alloc failed\n");
832 error = PTR_ERR(fujitsu_hotkey->fifo);
833 goto err_stop; 831 goto err_stop;
834 } 832 }
835 833
@@ -934,7 +932,7 @@ err_unregister_input_dev:
934err_free_input_dev: 932err_free_input_dev:
935 input_free_device(input); 933 input_free_device(input);
936err_free_fifo: 934err_free_fifo:
937 kfifo_free(fujitsu_hotkey->fifo); 935 kfifo_free(&fujitsu_hotkey->fifo);
938err_stop: 936err_stop:
939 return result; 937 return result;
940} 938}
@@ -956,7 +954,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
956 954
957 input_free_device(input); 955 input_free_device(input);
958 956
959 kfifo_free(fujitsu_hotkey->fifo); 957 kfifo_free(&fujitsu_hotkey->fifo);
960 958
961 fujitsu_hotkey->acpi_handle = NULL; 959 fujitsu_hotkey->acpi_handle = NULL;
962 960
@@ -1008,9 +1006,10 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
1008 vdbg_printk(FUJLAPTOP_DBG_TRACE, 1006 vdbg_printk(FUJLAPTOP_DBG_TRACE,
1009 "Push keycode into ringbuffer [%d]\n", 1007 "Push keycode into ringbuffer [%d]\n",
1010 keycode); 1008 keycode);
1011 status = kfifo_put(fujitsu_hotkey->fifo, 1009 status = kfifo_in_locked(&fujitsu_hotkey->fifo,
1012 (unsigned char *)&keycode, 1010 (unsigned char *)&keycode,
1013 sizeof(keycode)); 1011 sizeof(keycode),
1012 &fujitsu_hotkey->fifo_lock);
1014 if (status != sizeof(keycode)) { 1013 if (status != sizeof(keycode)) {
1015 vdbg_printk(FUJLAPTOP_DBG_WARN, 1014 vdbg_printk(FUJLAPTOP_DBG_WARN,
1016 "Could not push keycode [0x%x]\n", 1015 "Could not push keycode [0x%x]\n",
@@ -1021,11 +1020,12 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
1021 } 1020 }
1022 } else if (keycode == 0) { 1021 } else if (keycode == 0) {
1023 while ((status = 1022 while ((status =
1024 kfifo_get 1023 kfifo_out_locked(
1025 (fujitsu_hotkey->fifo, (unsigned char *) 1024 &fujitsu_hotkey->fifo,
1026 &keycode_r, 1025 (unsigned char *) &keycode_r,
1027 sizeof 1026 sizeof(keycode_r),
1028 (keycode_r))) == sizeof(keycode_r)) { 1027 &fujitsu_hotkey->fifo_lock))
1028 == sizeof(keycode_r)) {
1029 input_report_key(input, keycode_r, 0); 1029 input_report_key(input, keycode_r, 0);
1030 input_sync(input); 1030 input_sync(input);
1031 vdbg_printk(FUJLAPTOP_DBG_TRACE, 1031 vdbg_printk(FUJLAPTOP_DBG_TRACE,
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 63c3e658a884..ad4c414dbfbc 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -134,10 +134,15 @@ static int hp_wmi_perform_query(int query, int write, int value)
134 134
135 obj = output.pointer; 135 obj = output.pointer;
136 136
137 if (!obj || obj->type != ACPI_TYPE_BUFFER) 137 if (!obj)
138 return -EINVAL; 138 return -EINVAL;
139 else if (obj->type != ACPI_TYPE_BUFFER) {
140 kfree(obj);
141 return -EINVAL;
142 }
139 143
140 bios_return = *((struct bios_return *)obj->buffer.pointer); 144 bios_return = *((struct bios_return *)obj->buffer.pointer);
145 kfree(obj);
141 if (bios_return.return_code > 0) 146 if (bios_return.return_code > 0)
142 return bios_return.return_code * -1; 147 return bios_return.return_code * -1;
143 else 148 else
@@ -333,17 +338,24 @@ static void hp_wmi_notify(u32 value, void *context)
333 static struct key_entry *key; 338 static struct key_entry *key;
334 union acpi_object *obj; 339 union acpi_object *obj;
335 int eventcode; 340 int eventcode;
341 acpi_status status;
336 342
337 wmi_get_event_data(value, &response); 343 status = wmi_get_event_data(value, &response);
344 if (status != AE_OK) {
345 printk(KERN_INFO "hp-wmi: bad event status 0x%x\n", status);
346 return;
347 }
338 348
339 obj = (union acpi_object *)response.pointer; 349 obj = (union acpi_object *)response.pointer;
340 350
341 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { 351 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) {
342 printk(KERN_INFO "HP WMI: Unknown response received\n"); 352 printk(KERN_INFO "HP WMI: Unknown response received\n");
353 kfree(obj);
343 return; 354 return;
344 } 355 }
345 356
346 eventcode = *((u8 *) obj->buffer.pointer); 357 eventcode = *((u8 *) obj->buffer.pointer);
358 kfree(obj);
347 if (eventcode == 0x4) 359 if (eventcode == 0x4)
348 eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0, 360 eventcode = hp_wmi_perform_query(HPWMI_HOTKEY_QUERY, 0,
349 0); 361 0);
@@ -572,7 +584,7 @@ static int __init hp_wmi_init(void)
572 if (wmi_has_guid(HPWMI_EVENT_GUID)) { 584 if (wmi_has_guid(HPWMI_EVENT_GUID)) {
573 err = wmi_install_notify_handler(HPWMI_EVENT_GUID, 585 err = wmi_install_notify_handler(HPWMI_EVENT_GUID,
574 hp_wmi_notify, NULL); 586 hp_wmi_notify, NULL);
575 if (!err) 587 if (ACPI_SUCCESS(err))
576 hp_wmi_input_setup(); 588 hp_wmi_input_setup();
577 } 589 }
578 590
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index 0c8fe145c4af..f5f70d4c6913 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -34,16 +34,6 @@ MODULE_LICENSE("GPL");
34MODULE_ALIAS("wmi:551A1F84-FBDD-4125-91DB-3EA8F44F1D45"); 34MODULE_ALIAS("wmi:551A1F84-FBDD-4125-91DB-3EA8F44F1D45");
35MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"); 35MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2");
36 36
37/* Temporary workaround until the WMI sysfs interface goes in
38 { "svn", DMI_SYS_VENDOR },
39 { "pn", DMI_PRODUCT_NAME },
40 { "pvr", DMI_PRODUCT_VERSION },
41 { "rvn", DMI_BOARD_VENDOR },
42 { "rn", DMI_BOARD_NAME },
43*/
44
45MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-6638:*");
46
47#define DRV_NAME "msi-wmi" 37#define DRV_NAME "msi-wmi"
48#define DRV_PFX DRV_NAME ": " 38#define DRV_PFX DRV_NAME ": "
49 39
@@ -159,8 +149,13 @@ static void msi_wmi_notify(u32 value, void *context)
159 static struct key_entry *key; 149 static struct key_entry *key;
160 union acpi_object *obj; 150 union acpi_object *obj;
161 ktime_t cur; 151 ktime_t cur;
152 acpi_status status;
162 153
163 wmi_get_event_data(value, &response); 154 status = wmi_get_event_data(value, &response);
155 if (status != AE_OK) {
156 printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status);
157 return;
158 }
164 159
165 obj = (union acpi_object *)response.pointer; 160 obj = (union acpi_object *)response.pointer;
166 161
@@ -246,7 +241,7 @@ static int __init msi_wmi_init(void)
246 } 241 }
247 err = wmi_install_notify_handler(MSIWMI_EVENT_GUID, 242 err = wmi_install_notify_handler(MSIWMI_EVENT_GUID,
248 msi_wmi_notify, NULL); 243 msi_wmi_notify, NULL);
249 if (err) 244 if (ACPI_FAILURE(err))
250 return -EINVAL; 245 return -EINVAL;
251 246
252 err = msi_wmi_input_setup(); 247 err = msi_wmi_input_setup();
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 7a2cc8a5c975..5af53340da6f 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -131,6 +131,7 @@ enum sony_nc_rfkill {
131 N_SONY_RFKILL, 131 N_SONY_RFKILL,
132}; 132};
133 133
134static int sony_rfkill_handle;
134static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL]; 135static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL];
135static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900}; 136static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900};
136static void sony_nc_rfkill_update(void); 137static void sony_nc_rfkill_update(void);
@@ -142,7 +143,7 @@ struct sony_laptop_input_s {
142 atomic_t users; 143 atomic_t users;
143 struct input_dev *jog_dev; 144 struct input_dev *jog_dev;
144 struct input_dev *key_dev; 145 struct input_dev *key_dev;
145 struct kfifo *fifo; 146 struct kfifo fifo;
146 spinlock_t fifo_lock; 147 spinlock_t fifo_lock;
147 struct workqueue_struct *wq; 148 struct workqueue_struct *wq;
148}; 149};
@@ -232,6 +233,7 @@ static int sony_laptop_input_index[] = {
232 56, /* 69 SONYPI_EVENT_VOLUME_INC_PRESSED */ 233 56, /* 69 SONYPI_EVENT_VOLUME_INC_PRESSED */
233 57, /* 70 SONYPI_EVENT_VOLUME_DEC_PRESSED */ 234 57, /* 70 SONYPI_EVENT_VOLUME_DEC_PRESSED */
234 -1, /* 71 SONYPI_EVENT_BRIGHTNESS_PRESSED */ 235 -1, /* 71 SONYPI_EVENT_BRIGHTNESS_PRESSED */
236 58, /* 72 SONYPI_EVENT_MEDIA_PRESSED */
235}; 237};
236 238
237static int sony_laptop_input_keycode_map[] = { 239static int sony_laptop_input_keycode_map[] = {
@@ -293,6 +295,7 @@ static int sony_laptop_input_keycode_map[] = {
293 KEY_F15, /* 55 SONYPI_EVENT_SETTINGKEY_PRESSED */ 295 KEY_F15, /* 55 SONYPI_EVENT_SETTINGKEY_PRESSED */
294 KEY_VOLUMEUP, /* 56 SONYPI_EVENT_VOLUME_INC_PRESSED */ 296 KEY_VOLUMEUP, /* 56 SONYPI_EVENT_VOLUME_INC_PRESSED */
295 KEY_VOLUMEDOWN, /* 57 SONYPI_EVENT_VOLUME_DEC_PRESSED */ 297 KEY_VOLUMEDOWN, /* 57 SONYPI_EVENT_VOLUME_DEC_PRESSED */
298 KEY_MEDIA, /* 58 SONYPI_EVENT_MEDIA_PRESSED */
296}; 299};
297 300
298/* release buttons after a short delay if pressed */ 301/* release buttons after a short delay if pressed */
@@ -300,8 +303,9 @@ static void do_sony_laptop_release_key(struct work_struct *work)
300{ 303{
301 struct sony_laptop_keypress kp; 304 struct sony_laptop_keypress kp;
302 305
303 while (kfifo_get(sony_laptop_input.fifo, (unsigned char *)&kp, 306 while (kfifo_out_locked(&sony_laptop_input.fifo, (unsigned char *)&kp,
304 sizeof(kp)) == sizeof(kp)) { 307 sizeof(kp), &sony_laptop_input.fifo_lock)
308 == sizeof(kp)) {
305 msleep(10); 309 msleep(10);
306 input_report_key(kp.dev, kp.key, 0); 310 input_report_key(kp.dev, kp.key, 0);
307 input_sync(kp.dev); 311 input_sync(kp.dev);
@@ -362,8 +366,9 @@ static void sony_laptop_report_input_event(u8 event)
362 /* we emit the scancode so we can always remap the key */ 366 /* we emit the scancode so we can always remap the key */
363 input_event(kp.dev, EV_MSC, MSC_SCAN, event); 367 input_event(kp.dev, EV_MSC, MSC_SCAN, event);
364 input_sync(kp.dev); 368 input_sync(kp.dev);
365 kfifo_put(sony_laptop_input.fifo, 369 kfifo_in_locked(&sony_laptop_input.fifo,
366 (unsigned char *)&kp, sizeof(kp)); 370 (unsigned char *)&kp, sizeof(kp),
371 &sony_laptop_input.fifo_lock);
367 372
368 if (!work_pending(&sony_laptop_release_key_work)) 373 if (!work_pending(&sony_laptop_release_key_work))
369 queue_work(sony_laptop_input.wq, 374 queue_work(sony_laptop_input.wq,
@@ -385,12 +390,10 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
385 390
386 /* kfifo */ 391 /* kfifo */
387 spin_lock_init(&sony_laptop_input.fifo_lock); 392 spin_lock_init(&sony_laptop_input.fifo_lock);
388 sony_laptop_input.fifo = 393 error =
389 kfifo_alloc(SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, 394 kfifo_alloc(&sony_laptop_input.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
390 &sony_laptop_input.fifo_lock); 395 if (error) {
391 if (IS_ERR(sony_laptop_input.fifo)) {
392 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); 396 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n");
393 error = PTR_ERR(sony_laptop_input.fifo);
394 goto err_dec_users; 397 goto err_dec_users;
395 } 398 }
396 399
@@ -474,7 +477,7 @@ err_destroy_wq:
474 destroy_workqueue(sony_laptop_input.wq); 477 destroy_workqueue(sony_laptop_input.wq);
475 478
476err_free_kfifo: 479err_free_kfifo:
477 kfifo_free(sony_laptop_input.fifo); 480 kfifo_free(&sony_laptop_input.fifo);
478 481
479err_dec_users: 482err_dec_users:
480 atomic_dec(&sony_laptop_input.users); 483 atomic_dec(&sony_laptop_input.users);
@@ -500,7 +503,7 @@ static void sony_laptop_remove_input(void)
500 } 503 }
501 504
502 destroy_workqueue(sony_laptop_input.wq); 505 destroy_workqueue(sony_laptop_input.wq);
503 kfifo_free(sony_laptop_input.fifo); 506 kfifo_free(&sony_laptop_input.fifo);
504} 507}
505 508
506/*********** Platform Device ***********/ 509/*********** Platform Device ***********/
@@ -890,6 +893,8 @@ static struct sony_nc_event sony_100_events[] = {
890 { 0x0C, SONYPI_EVENT_FNKEY_RELEASED }, 893 { 0x0C, SONYPI_EVENT_FNKEY_RELEASED },
891 { 0x9f, SONYPI_EVENT_CD_EJECT_PRESSED }, 894 { 0x9f, SONYPI_EVENT_CD_EJECT_PRESSED },
892 { 0x1f, SONYPI_EVENT_ANYBUTTON_RELEASED }, 895 { 0x1f, SONYPI_EVENT_ANYBUTTON_RELEASED },
896 { 0xa1, SONYPI_EVENT_MEDIA_PRESSED },
897 { 0x21, SONYPI_EVENT_ANYBUTTON_RELEASED },
893 { 0, 0 }, 898 { 0, 0 },
894}; 899};
895 900
@@ -961,7 +966,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
961 else 966 else
962 sony_laptop_report_input_event(ev); 967 sony_laptop_report_input_event(ev);
963 } 968 }
964 } else if (sony_find_snc_handle(0x124) == ev) { 969 } else if (sony_find_snc_handle(sony_rfkill_handle) == ev) {
965 sony_nc_rfkill_update(); 970 sony_nc_rfkill_update();
966 return; 971 return;
967 } 972 }
@@ -1067,7 +1072,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked)
1067 if (!blocked) 1072 if (!blocked)
1068 argument |= 0xff0000; 1073 argument |= 0xff0000;
1069 1074
1070 return sony_call_snc_handle(0x124, argument, &result); 1075 return sony_call_snc_handle(sony_rfkill_handle, argument, &result);
1071} 1076}
1072 1077
1073static const struct rfkill_ops sony_rfkill_ops = { 1078static const struct rfkill_ops sony_rfkill_ops = {
@@ -1110,7 +1115,7 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
1110 if (!rfk) 1115 if (!rfk)
1111 return -ENOMEM; 1116 return -ENOMEM;
1112 1117
1113 sony_call_snc_handle(0x124, 0x200, &result); 1118 sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
1114 hwblock = !(result & 0x1); 1119 hwblock = !(result & 0x1);
1115 rfkill_set_hw_state(rfk, hwblock); 1120 rfkill_set_hw_state(rfk, hwblock);
1116 1121
@@ -1129,7 +1134,7 @@ static void sony_nc_rfkill_update()
1129 int result; 1134 int result;
1130 bool hwblock; 1135 bool hwblock;
1131 1136
1132 sony_call_snc_handle(0x124, 0x200, &result); 1137 sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
1133 hwblock = !(result & 0x1); 1138 hwblock = !(result & 0x1);
1134 1139
1135 for (i = 0; i < N_SONY_RFKILL; i++) { 1140 for (i = 0; i < N_SONY_RFKILL; i++) {
@@ -1145,36 +1150,79 @@ static void sony_nc_rfkill_update()
1145 continue; 1150 continue;
1146 } 1151 }
1147 1152
1148 sony_call_snc_handle(0x124, argument, &result); 1153 sony_call_snc_handle(sony_rfkill_handle, argument, &result);
1149 rfkill_set_states(sony_rfkill_devices[i], 1154 rfkill_set_states(sony_rfkill_devices[i],
1150 !(result & 0xf), false); 1155 !(result & 0xf), false);
1151 } 1156 }
1152} 1157}
1153 1158
1154static int sony_nc_rfkill_setup(struct acpi_device *device) 1159static void sony_nc_rfkill_setup(struct acpi_device *device)
1155{ 1160{
1156 int result, ret; 1161 int offset;
1162 u8 dev_code, i;
1163 acpi_status status;
1164 struct acpi_object_list params;
1165 union acpi_object in_obj;
1166 union acpi_object *device_enum;
1167 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
1157 1168
1158 if (sony_find_snc_handle(0x124) == -1) 1169 offset = sony_find_snc_handle(0x124);
1159 return -1; 1170 if (offset == -1) {
1171 offset = sony_find_snc_handle(0x135);
1172 if (offset == -1)
1173 return;
1174 else
1175 sony_rfkill_handle = 0x135;
1176 } else
1177 sony_rfkill_handle = 0x124;
1178 dprintk("Found rkfill handle: 0x%.4x\n", sony_rfkill_handle);
1160 1179
1161 ret = sony_call_snc_handle(0x124, 0xb00, &result); 1180 /* need to read the whole buffer returned by the acpi call to SN06
1162 if (ret) { 1181 * here otherwise we may miss some features
1163 printk(KERN_INFO DRV_PFX 1182 */
1164 "Unable to enumerate rfkill devices: %x\n", ret); 1183 params.count = 1;
1165 return ret; 1184 params.pointer = &in_obj;
1185 in_obj.type = ACPI_TYPE_INTEGER;
1186 in_obj.integer.value = offset;
1187 status = acpi_evaluate_object(sony_nc_acpi_handle, "SN06", &params,
1188 &buffer);
1189 if (ACPI_FAILURE(status)) {
1190 dprintk("Radio device enumeration failed\n");
1191 return;
1192 }
1193
1194 device_enum = (union acpi_object *) buffer.pointer;
1195 if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
1196 printk(KERN_ERR "Invalid SN06 return object 0x%.2x\n",
1197 device_enum->type);
1198 goto out_no_enum;
1166 } 1199 }
1167 1200
1168 if (result & 0x1) 1201 /* the buffer is filled with magic numbers describing the devices
1169 sony_nc_setup_rfkill(device, SONY_WIFI); 1202 * available, 0xff terminates the enumeration
1170 if (result & 0x2) 1203 */
1171 sony_nc_setup_rfkill(device, SONY_BLUETOOTH); 1204 while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff &&
1172 if (result & 0x1c) 1205 i < device_enum->buffer.length) {
1173 sony_nc_setup_rfkill(device, SONY_WWAN); 1206 i++;
1174 if (result & 0x20) 1207 dprintk("Radio devices, looking at 0x%.2x\n", dev_code);
1175 sony_nc_setup_rfkill(device, SONY_WIMAX);
1176 1208
1177 return 0; 1209 if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI])
1210 sony_nc_setup_rfkill(device, SONY_WIFI);
1211
1212 if (dev_code == 0x10 && !sony_rfkill_devices[SONY_BLUETOOTH])
1213 sony_nc_setup_rfkill(device, SONY_BLUETOOTH);
1214
1215 if ((0xf0 & dev_code) == 0x20 &&
1216 !sony_rfkill_devices[SONY_WWAN])
1217 sony_nc_setup_rfkill(device, SONY_WWAN);
1218
1219 if (dev_code == 0x30 && !sony_rfkill_devices[SONY_WIMAX])
1220 sony_nc_setup_rfkill(device, SONY_WIMAX);
1221 }
1222
1223out_no_enum:
1224 kfree(buffer.pointer);
1225 return;
1178} 1226}
1179 1227
1180static int sony_nc_add(struct acpi_device *device) 1228static int sony_nc_add(struct acpi_device *device)
@@ -2079,7 +2127,7 @@ static struct attribute_group spic_attribute_group = {
2079 2127
2080struct sonypi_compat_s { 2128struct sonypi_compat_s {
2081 struct fasync_struct *fifo_async; 2129 struct fasync_struct *fifo_async;
2082 struct kfifo *fifo; 2130 struct kfifo fifo;
2083 spinlock_t fifo_lock; 2131 spinlock_t fifo_lock;
2084 wait_queue_head_t fifo_proc_list; 2132 wait_queue_head_t fifo_proc_list;
2085 atomic_t open_count; 2133 atomic_t open_count;
@@ -2104,12 +2152,12 @@ static int sonypi_misc_open(struct inode *inode, struct file *file)
2104 /* Flush input queue on first open */ 2152 /* Flush input queue on first open */
2105 unsigned long flags; 2153 unsigned long flags;
2106 2154
2107 spin_lock_irqsave(sonypi_compat.fifo->lock, flags); 2155 spin_lock_irqsave(&sonypi_compat.fifo_lock, flags);
2108 2156
2109 if (atomic_inc_return(&sonypi_compat.open_count) == 1) 2157 if (atomic_inc_return(&sonypi_compat.open_count) == 1)
2110 __kfifo_reset(sonypi_compat.fifo); 2158 kfifo_reset(&sonypi_compat.fifo);
2111 2159
2112 spin_unlock_irqrestore(sonypi_compat.fifo->lock, flags); 2160 spin_unlock_irqrestore(&sonypi_compat.fifo_lock, flags);
2113 2161
2114 return 0; 2162 return 0;
2115} 2163}
@@ -2120,17 +2168,18 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
2120 ssize_t ret; 2168 ssize_t ret;
2121 unsigned char c; 2169 unsigned char c;
2122 2170
2123 if ((kfifo_len(sonypi_compat.fifo) == 0) && 2171 if ((kfifo_len(&sonypi_compat.fifo) == 0) &&
2124 (file->f_flags & O_NONBLOCK)) 2172 (file->f_flags & O_NONBLOCK))
2125 return -EAGAIN; 2173 return -EAGAIN;
2126 2174
2127 ret = wait_event_interruptible(sonypi_compat.fifo_proc_list, 2175 ret = wait_event_interruptible(sonypi_compat.fifo_proc_list,
2128 kfifo_len(sonypi_compat.fifo) != 0); 2176 kfifo_len(&sonypi_compat.fifo) != 0);
2129 if (ret) 2177 if (ret)
2130 return ret; 2178 return ret;
2131 2179
2132 while (ret < count && 2180 while (ret < count &&
2133 (kfifo_get(sonypi_compat.fifo, &c, sizeof(c)) == sizeof(c))) { 2181 (kfifo_out_locked(&sonypi_compat.fifo, &c, sizeof(c),
2182 &sonypi_compat.fifo_lock) == sizeof(c))) {
2134 if (put_user(c, buf++)) 2183 if (put_user(c, buf++))
2135 return -EFAULT; 2184 return -EFAULT;
2136 ret++; 2185 ret++;
@@ -2147,7 +2196,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
2147static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait) 2196static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait)
2148{ 2197{
2149 poll_wait(file, &sonypi_compat.fifo_proc_list, wait); 2198 poll_wait(file, &sonypi_compat.fifo_proc_list, wait);
2150 if (kfifo_len(sonypi_compat.fifo)) 2199 if (kfifo_len(&sonypi_compat.fifo))
2151 return POLLIN | POLLRDNORM; 2200 return POLLIN | POLLRDNORM;
2152 return 0; 2201 return 0;
2153} 2202}
@@ -2309,7 +2358,8 @@ static struct miscdevice sonypi_misc_device = {
2309 2358
2310static void sonypi_compat_report_event(u8 event) 2359static void sonypi_compat_report_event(u8 event)
2311{ 2360{
2312 kfifo_put(sonypi_compat.fifo, (unsigned char *)&event, sizeof(event)); 2361 kfifo_in_locked(&sonypi_compat.fifo, (unsigned char *)&event,
2362 sizeof(event), &sonypi_compat.fifo_lock);
2313 kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN); 2363 kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN);
2314 wake_up_interruptible(&sonypi_compat.fifo_proc_list); 2364 wake_up_interruptible(&sonypi_compat.fifo_proc_list);
2315} 2365}
@@ -2319,11 +2369,11 @@ static int sonypi_compat_init(void)
2319 int error; 2369 int error;
2320 2370
2321 spin_lock_init(&sonypi_compat.fifo_lock); 2371 spin_lock_init(&sonypi_compat.fifo_lock);
2322 sonypi_compat.fifo = kfifo_alloc(SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, 2372 error =
2323 &sonypi_compat.fifo_lock); 2373 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
2324 if (IS_ERR(sonypi_compat.fifo)) { 2374 if (error) {
2325 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); 2375 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n");
2326 return PTR_ERR(sonypi_compat.fifo); 2376 return error;
2327 } 2377 }
2328 2378
2329 init_waitqueue_head(&sonypi_compat.fifo_proc_list); 2379 init_waitqueue_head(&sonypi_compat.fifo_proc_list);
@@ -2342,14 +2392,14 @@ static int sonypi_compat_init(void)
2342 return 0; 2392 return 0;
2343 2393
2344err_free_kfifo: 2394err_free_kfifo:
2345 kfifo_free(sonypi_compat.fifo); 2395 kfifo_free(&sonypi_compat.fifo);
2346 return error; 2396 return error;
2347} 2397}
2348 2398
2349static void sonypi_compat_exit(void) 2399static void sonypi_compat_exit(void)
2350{ 2400{
2351 misc_deregister(&sonypi_misc_device); 2401 misc_deregister(&sonypi_misc_device);
2352 kfifo_free(sonypi_compat.fifo); 2402 kfifo_free(&sonypi_compat.fifo);
2353} 2403}
2354#else 2404#else
2355static int sonypi_compat_init(void) { return 0; } 2405static int sonypi_compat_init(void) { return 0; }
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c
index 44166003d4ef..dd33b51c3486 100644
--- a/drivers/platform/x86/tc1100-wmi.c
+++ b/drivers/platform/x86/tc1100-wmi.c
@@ -47,22 +47,6 @@ MODULE_DESCRIPTION("HP Compaq TC1100 Tablet WMI Extras");
47MODULE_LICENSE("GPL"); 47MODULE_LICENSE("GPL");
48MODULE_ALIAS("wmi:C364AC71-36DB-495A-8494-B439D472A505"); 48MODULE_ALIAS("wmi:C364AC71-36DB-495A-8494-B439D472A505");
49 49
50static int tc1100_probe(struct platform_device *device);
51static int tc1100_remove(struct platform_device *device);
52static int tc1100_suspend(struct platform_device *device, pm_message_t state);
53static int tc1100_resume(struct platform_device *device);
54
55static struct platform_driver tc1100_driver = {
56 .driver = {
57 .name = "tc1100-wmi",
58 .owner = THIS_MODULE,
59 },
60 .probe = tc1100_probe,
61 .remove = tc1100_remove,
62 .suspend = tc1100_suspend,
63 .resume = tc1100_resume,
64};
65
66static struct platform_device *tc1100_device; 50static struct platform_device *tc1100_device;
67 51
68struct tc1100_data { 52struct tc1100_data {
@@ -183,51 +167,35 @@ static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \
183show_set_bool(wireless, TC1100_INSTANCE_WIRELESS); 167show_set_bool(wireless, TC1100_INSTANCE_WIRELESS);
184show_set_bool(jogdial, TC1100_INSTANCE_JOGDIAL); 168show_set_bool(jogdial, TC1100_INSTANCE_JOGDIAL);
185 169
186static void remove_fs(void) 170static struct attribute *tc1100_attributes[] = {
187{ 171 &dev_attr_wireless.attr,
188 device_remove_file(&tc1100_device->dev, &dev_attr_wireless); 172 &dev_attr_jogdial.attr,
189 device_remove_file(&tc1100_device->dev, &dev_attr_jogdial); 173 NULL
190} 174};
191
192static int add_fs(void)
193{
194 int ret;
195
196 ret = device_create_file(&tc1100_device->dev, &dev_attr_wireless);
197 if (ret)
198 goto add_sysfs_error;
199
200 ret = device_create_file(&tc1100_device->dev, &dev_attr_jogdial);
201 if (ret)
202 goto add_sysfs_error;
203
204 return ret;
205 175
206add_sysfs_error: 176static struct attribute_group tc1100_attribute_group = {
207 remove_fs(); 177 .attrs = tc1100_attributes,
208 return ret; 178};
209}
210 179
211/* -------------------------------------------------------------------------- 180/* --------------------------------------------------------------------------
212 Driver Model 181 Driver Model
213 -------------------------------------------------------------------------- */ 182 -------------------------------------------------------------------------- */
214 183
215static int tc1100_probe(struct platform_device *device) 184static int __init tc1100_probe(struct platform_device *device)
216{ 185{
217 int result = 0; 186 return sysfs_create_group(&device->dev.kobj, &tc1100_attribute_group);
218
219 result = add_fs();
220 return result;
221} 187}
222 188
223 189
224static int tc1100_remove(struct platform_device *device) 190static int __devexit tc1100_remove(struct platform_device *device)
225{ 191{
226 remove_fs(); 192 sysfs_remove_group(&device->dev.kobj, &tc1100_attribute_group);
193
227 return 0; 194 return 0;
228} 195}
229 196
230static int tc1100_suspend(struct platform_device *dev, pm_message_t state) 197#ifdef CONFIG_PM
198static int tc1100_suspend(struct device *dev)
231{ 199{
232 int ret; 200 int ret;
233 201
@@ -239,10 +207,10 @@ static int tc1100_suspend(struct platform_device *dev, pm_message_t state)
239 if (ret) 207 if (ret)
240 return ret; 208 return ret;
241 209
242 return ret; 210 return 0;
243} 211}
244 212
245static int tc1100_resume(struct platform_device *dev) 213static int tc1100_resume(struct device *dev)
246{ 214{
247 int ret; 215 int ret;
248 216
@@ -254,34 +222,61 @@ static int tc1100_resume(struct platform_device *dev)
254 if (ret) 222 if (ret)
255 return ret; 223 return ret;
256 224
257 return ret; 225 return 0;
258} 226}
259 227
228static const struct dev_pm_ops tc1100_pm_ops = {
229 .suspend = tc1100_suspend,
230 .resume = tc1100_resume,
231 .freeze = tc1100_suspend,
232 .restore = tc1100_resume,
233};
234#endif
235
236static struct platform_driver tc1100_driver = {
237 .driver = {
238 .name = "tc1100-wmi",
239 .owner = THIS_MODULE,
240#ifdef CONFIG_PM
241 .pm = &tc1100_pm_ops,
242#endif
243 },
244 .remove = __devexit_p(tc1100_remove),
245};
246
260static int __init tc1100_init(void) 247static int __init tc1100_init(void)
261{ 248{
262 int result = 0; 249 int error;
263 250
264 if (!wmi_has_guid(GUID)) 251 if (!wmi_has_guid(GUID))
265 return -ENODEV; 252 return -ENODEV;
266 253
267 result = platform_driver_register(&tc1100_driver);
268 if (result)
269 return result;
270
271 tc1100_device = platform_device_alloc("tc1100-wmi", -1); 254 tc1100_device = platform_device_alloc("tc1100-wmi", -1);
272 platform_device_add(tc1100_device); 255 if (!tc1100_device)
256 return -ENOMEM;
257
258 error = platform_device_add(tc1100_device);
259 if (error)
260 goto err_device_put;
261
262 error = platform_driver_probe(&tc1100_driver, tc1100_probe);
263 if (error)
264 goto err_device_del;
273 265
274 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras loaded\n"); 266 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras loaded\n");
267 return 0;
275 268
276 return result; 269 err_device_del:
270 platform_device_del(tc1100_device);
271 err_device_put:
272 platform_device_put(tc1100_device);
273 return error;
277} 274}
278 275
279static void __exit tc1100_exit(void) 276static void __exit tc1100_exit(void)
280{ 277{
281 platform_device_del(tc1100_device); 278 platform_device_unregister(tc1100_device);
282 platform_driver_unregister(&tc1100_driver); 279 platform_driver_unregister(&tc1100_driver);
283
284 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras unloaded\n");
285} 280}
286 281
287module_init(tc1100_init); 282module_init(tc1100_init);
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 448c8aeb166b..e67e4feb35cb 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6384,11 +6384,13 @@ static struct ibm_struct brightness_driver_data = {
6384 * and we leave them unchanged. 6384 * and we leave them unchanged.
6385 */ 6385 */
6386 6386
6387#ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT
6388
6387#define TPACPI_ALSA_DRVNAME "ThinkPad EC" 6389#define TPACPI_ALSA_DRVNAME "ThinkPad EC"
6388#define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control" 6390#define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control"
6389#define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME 6391#define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME
6390 6392
6391static int alsa_index = SNDRV_DEFAULT_IDX1; 6393static int alsa_index = ~((1 << (SNDRV_CARDS - 3)) - 1); /* last three slots */
6392static char *alsa_id = "ThinkPadEC"; 6394static char *alsa_id = "ThinkPadEC";
6393static int alsa_enable = SNDRV_DEFAULT_ENABLE1; 6395static int alsa_enable = SNDRV_DEFAULT_ENABLE1;
6394 6396
@@ -6705,10 +6707,11 @@ static int __init volume_create_alsa_mixer(void)
6705 6707
6706 rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, 6708 rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,
6707 sizeof(struct tpacpi_alsa_data), &card); 6709 sizeof(struct tpacpi_alsa_data), &card);
6708 if (rc < 0) 6710 if (rc < 0 || !card) {
6709 return rc; 6711 printk(TPACPI_ERR
6710 if (!card) 6712 "Failed to create ALSA card structures: %d\n", rc);
6711 return -ENOMEM; 6713 return 1;
6714 }
6712 6715
6713 BUG_ON(!card->private_data); 6716 BUG_ON(!card->private_data);
6714 data = card->private_data; 6717 data = card->private_data;
@@ -6741,8 +6744,9 @@ static int __init volume_create_alsa_mixer(void)
6741 rc = snd_ctl_add(card, ctl_vol); 6744 rc = snd_ctl_add(card, ctl_vol);
6742 if (rc < 0) { 6745 if (rc < 0) {
6743 printk(TPACPI_ERR 6746 printk(TPACPI_ERR
6744 "Failed to create ALSA volume control\n"); 6747 "Failed to create ALSA volume control: %d\n",
6745 goto err_out; 6748 rc);
6749 goto err_exit;
6746 } 6750 }
6747 data->ctl_vol_id = &ctl_vol->id; 6751 data->ctl_vol_id = &ctl_vol->id;
6748 } 6752 }
@@ -6750,22 +6754,25 @@ static int __init volume_create_alsa_mixer(void)
6750 ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); 6754 ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL);
6751 rc = snd_ctl_add(card, ctl_mute); 6755 rc = snd_ctl_add(card, ctl_mute);
6752 if (rc < 0) { 6756 if (rc < 0) {
6753 printk(TPACPI_ERR "Failed to create ALSA mute control\n"); 6757 printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n",
6754 goto err_out; 6758 rc);
6759 goto err_exit;
6755 } 6760 }
6756 data->ctl_mute_id = &ctl_mute->id; 6761 data->ctl_mute_id = &ctl_mute->id;
6757 6762
6758 snd_card_set_dev(card, &tpacpi_pdev->dev); 6763 snd_card_set_dev(card, &tpacpi_pdev->dev);
6759 rc = snd_card_register(card); 6764 rc = snd_card_register(card);
6760
6761err_out:
6762 if (rc < 0) { 6765 if (rc < 0) {
6763 snd_card_free(card); 6766 printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc);
6764 card = NULL; 6767 goto err_exit;
6765 } 6768 }
6766 6769
6767 alsa_card = card; 6770 alsa_card = card;
6768 return rc; 6771 return 0;
6772
6773err_exit:
6774 snd_card_free(card);
6775 return 1;
6769} 6776}
6770 6777
6771#define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */ 6778#define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */
@@ -7016,6 +7023,28 @@ static struct ibm_struct volume_driver_data = {
7016 .shutdown = volume_shutdown, 7023 .shutdown = volume_shutdown,
7017}; 7024};
7018 7025
7026#else /* !CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */
7027
7028#define alsa_card NULL
7029
7030static void inline volume_alsa_notify_change(void)
7031{
7032}
7033
7034static int __init volume_init(struct ibm_init_struct *iibm)
7035{
7036 printk(TPACPI_INFO
7037 "volume: disabled as there is no ALSA support in this kernel\n");
7038
7039 return 1;
7040}
7041
7042static struct ibm_struct volume_driver_data = {
7043 .name = "volume",
7044};
7045
7046#endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */
7047
7019/************************************************************************* 7048/*************************************************************************
7020 * Fan subdriver 7049 * Fan subdriver
7021 */ 7050 */
@@ -8738,6 +8767,7 @@ MODULE_PARM_DESC(hotkey_report_mode,
8738 "used for backwards compatibility with userspace, " 8767 "used for backwards compatibility with userspace, "
8739 "see documentation"); 8768 "see documentation");
8740 8769
8770#ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT
8741module_param_named(volume_mode, volume_mode, uint, 0444); 8771module_param_named(volume_mode, volume_mode, uint, 0444);
8742MODULE_PARM_DESC(volume_mode, 8772MODULE_PARM_DESC(volume_mode,
8743 "Selects volume control strategy: " 8773 "Selects volume control strategy: "
@@ -8760,6 +8790,7 @@ module_param_named(id, alsa_id, charp, 0444);
8760MODULE_PARM_DESC(id, "ALSA id for the ACPI EC Mixer"); 8790MODULE_PARM_DESC(id, "ALSA id for the ACPI EC Mixer");
8761module_param_named(enable, alsa_enable, bool, 0444); 8791module_param_named(enable, alsa_enable, bool, 0444);
8762MODULE_PARM_DESC(enable, "Enable the ALSA interface for the ACPI EC Mixer"); 8792MODULE_PARM_DESC(enable, "Enable the ALSA interface for the ACPI EC Mixer");
8793#endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */
8763 8794
8764#define TPACPI_PARAM(feature) \ 8795#define TPACPI_PARAM(feature) \
8765 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ 8796 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 51c0a8bee414..77bf5d8f893a 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -42,6 +42,7 @@
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/types.h> 43#include <linux/types.h>
44#include <linux/proc_fs.h> 44#include <linux/proc_fs.h>
45#include <linux/seq_file.h>
45#include <linux/backlight.h> 46#include <linux/backlight.h>
46#include <linux/platform_device.h> 47#include <linux/platform_device.h>
47#include <linux/rfkill.h> 48#include <linux/rfkill.h>
@@ -357,63 +358,6 @@ static int force_fan;
357static int last_key_event; 358static int last_key_event;
358static int key_event_valid; 359static int key_event_valid;
359 360
360typedef struct _ProcItem {
361 const char *name;
362 char *(*read_func) (char *);
363 unsigned long (*write_func) (const char *, unsigned long);
364} ProcItem;
365
366/* proc file handlers
367 */
368
369static int
370dispatch_read(char *page, char **start, off_t off, int count, int *eof,
371 ProcItem * item)
372{
373 char *p = page;
374 int len;
375
376 if (off == 0)
377 p = item->read_func(p);
378
379 /* ISSUE: I don't understand this code */
380 len = (p - page);
381 if (len <= off + count)
382 *eof = 1;
383 *start = page + off;
384 len -= off;
385 if (len > count)
386 len = count;
387 if (len < 0)
388 len = 0;
389 return len;
390}
391
392static int
393dispatch_write(struct file *file, const char __user * buffer,
394 unsigned long count, ProcItem * item)
395{
396 int result;
397 char *tmp_buffer;
398
399 /* Arg buffer points to userspace memory, which can't be accessed
400 * directly. Since we're making a copy, zero-terminate the
401 * destination so that sscanf can be used on it safely.
402 */
403 tmp_buffer = kmalloc(count + 1, GFP_KERNEL);
404 if (!tmp_buffer)
405 return -ENOMEM;
406
407 if (copy_from_user(tmp_buffer, buffer, count)) {
408 result = -EFAULT;
409 } else {
410 tmp_buffer[count] = 0;
411 result = item->write_func(tmp_buffer, count);
412 }
413 kfree(tmp_buffer);
414 return result;
415}
416
417static int get_lcd(struct backlight_device *bd) 361static int get_lcd(struct backlight_device *bd)
418{ 362{
419 u32 hci_result; 363 u32 hci_result;
@@ -426,19 +370,24 @@ static int get_lcd(struct backlight_device *bd)
426 return -EFAULT; 370 return -EFAULT;
427} 371}
428 372
429static char *read_lcd(char *p) 373static int lcd_proc_show(struct seq_file *m, void *v)
430{ 374{
431 int value = get_lcd(NULL); 375 int value = get_lcd(NULL);
432 376
433 if (value >= 0) { 377 if (value >= 0) {
434 p += sprintf(p, "brightness: %d\n", value); 378 seq_printf(m, "brightness: %d\n", value);
435 p += sprintf(p, "brightness_levels: %d\n", 379 seq_printf(m, "brightness_levels: %d\n",
436 HCI_LCD_BRIGHTNESS_LEVELS); 380 HCI_LCD_BRIGHTNESS_LEVELS);
437 } else { 381 } else {
438 printk(MY_ERR "Error reading LCD brightness\n"); 382 printk(MY_ERR "Error reading LCD brightness\n");
439 } 383 }
440 384
441 return p; 385 return 0;
386}
387
388static int lcd_proc_open(struct inode *inode, struct file *file)
389{
390 return single_open(file, lcd_proc_show, NULL);
442} 391}
443 392
444static int set_lcd(int value) 393static int set_lcd(int value)
@@ -458,12 +407,20 @@ static int set_lcd_status(struct backlight_device *bd)
458 return set_lcd(bd->props.brightness); 407 return set_lcd(bd->props.brightness);
459} 408}
460 409
461static unsigned long write_lcd(const char *buffer, unsigned long count) 410static ssize_t lcd_proc_write(struct file *file, const char __user *buf,
411 size_t count, loff_t *pos)
462{ 412{
413 char cmd[42];
414 size_t len;
463 int value; 415 int value;
464 int ret; 416 int ret;
465 417
466 if (sscanf(buffer, " brightness : %i", &value) == 1 && 418 len = min(count, sizeof(cmd) - 1);
419 if (copy_from_user(cmd, buf, len))
420 return -EFAULT;
421 cmd[len] = '\0';
422
423 if (sscanf(cmd, " brightness : %i", &value) == 1 &&
467 value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) { 424 value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) {
468 ret = set_lcd(value); 425 ret = set_lcd(value);
469 if (ret == 0) 426 if (ret == 0)
@@ -474,7 +431,16 @@ static unsigned long write_lcd(const char *buffer, unsigned long count)
474 return ret; 431 return ret;
475} 432}
476 433
477static char *read_video(char *p) 434static const struct file_operations lcd_proc_fops = {
435 .owner = THIS_MODULE,
436 .open = lcd_proc_open,
437 .read = seq_read,
438 .llseek = seq_lseek,
439 .release = single_release,
440 .write = lcd_proc_write,
441};
442
443static int video_proc_show(struct seq_file *m, void *v)
478{ 444{
479 u32 hci_result; 445 u32 hci_result;
480 u32 value; 446 u32 value;
@@ -484,18 +450,25 @@ static char *read_video(char *p)
484 int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; 450 int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0;
485 int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; 451 int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0;
486 int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0; 452 int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0;
487 p += sprintf(p, "lcd_out: %d\n", is_lcd); 453 seq_printf(m, "lcd_out: %d\n", is_lcd);
488 p += sprintf(p, "crt_out: %d\n", is_crt); 454 seq_printf(m, "crt_out: %d\n", is_crt);
489 p += sprintf(p, "tv_out: %d\n", is_tv); 455 seq_printf(m, "tv_out: %d\n", is_tv);
490 } else { 456 } else {
491 printk(MY_ERR "Error reading video out status\n"); 457 printk(MY_ERR "Error reading video out status\n");
492 } 458 }
493 459
494 return p; 460 return 0;
495} 461}
496 462
497static unsigned long write_video(const char *buffer, unsigned long count) 463static int video_proc_open(struct inode *inode, struct file *file)
498{ 464{
465 return single_open(file, video_proc_show, NULL);
466}
467
468static ssize_t video_proc_write(struct file *file, const char __user *buf,
469 size_t count, loff_t *pos)
470{
471 char *cmd, *buffer;
499 int value; 472 int value;
500 int remain = count; 473 int remain = count;
501 int lcd_out = -1; 474 int lcd_out = -1;
@@ -504,6 +477,17 @@ static unsigned long write_video(const char *buffer, unsigned long count)
504 u32 hci_result; 477 u32 hci_result;
505 u32 video_out; 478 u32 video_out;
506 479
480 cmd = kmalloc(count + 1, GFP_KERNEL);
481 if (!cmd)
482 return -ENOMEM;
483 if (copy_from_user(cmd, buf, count)) {
484 kfree(cmd);
485 return -EFAULT;
486 }
487 cmd[count] = '\0';
488
489 buffer = cmd;
490
507 /* scan expression. Multiple expressions may be delimited with ; 491 /* scan expression. Multiple expressions may be delimited with ;
508 * 492 *
509 * NOTE: to keep scanning simple, invalid fields are ignored 493 * NOTE: to keep scanning simple, invalid fields are ignored
@@ -523,6 +507,8 @@ static unsigned long write_video(const char *buffer, unsigned long count)
523 while (remain && *(buffer - 1) != ';'); 507 while (remain && *(buffer - 1) != ';');
524 } 508 }
525 509
510 kfree(cmd);
511
526 hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); 512 hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result);
527 if (hci_result == HCI_SUCCESS) { 513 if (hci_result == HCI_SUCCESS) {
528 unsigned int new_video_out = video_out; 514 unsigned int new_video_out = video_out;
@@ -543,28 +529,50 @@ static unsigned long write_video(const char *buffer, unsigned long count)
543 return count; 529 return count;
544} 530}
545 531
546static char *read_fan(char *p) 532static const struct file_operations video_proc_fops = {
533 .owner = THIS_MODULE,
534 .open = video_proc_open,
535 .read = seq_read,
536 .llseek = seq_lseek,
537 .release = single_release,
538 .write = video_proc_write,
539};
540
541static int fan_proc_show(struct seq_file *m, void *v)
547{ 542{
548 u32 hci_result; 543 u32 hci_result;
549 u32 value; 544 u32 value;
550 545
551 hci_read1(HCI_FAN, &value, &hci_result); 546 hci_read1(HCI_FAN, &value, &hci_result);
552 if (hci_result == HCI_SUCCESS) { 547 if (hci_result == HCI_SUCCESS) {
553 p += sprintf(p, "running: %d\n", (value > 0)); 548 seq_printf(m, "running: %d\n", (value > 0));
554 p += sprintf(p, "force_on: %d\n", force_fan); 549 seq_printf(m, "force_on: %d\n", force_fan);
555 } else { 550 } else {
556 printk(MY_ERR "Error reading fan status\n"); 551 printk(MY_ERR "Error reading fan status\n");
557 } 552 }
558 553
559 return p; 554 return 0;
555}
556
557static int fan_proc_open(struct inode *inode, struct file *file)
558{
559 return single_open(file, fan_proc_show, NULL);
560} 560}
561 561
562static unsigned long write_fan(const char *buffer, unsigned long count) 562static ssize_t fan_proc_write(struct file *file, const char __user *buf,
563 size_t count, loff_t *pos)
563{ 564{
565 char cmd[42];
566 size_t len;
564 int value; 567 int value;
565 u32 hci_result; 568 u32 hci_result;
566 569
567 if (sscanf(buffer, " force_on : %i", &value) == 1 && 570 len = min(count, sizeof(cmd) - 1);
571 if (copy_from_user(cmd, buf, len))
572 return -EFAULT;
573 cmd[len] = '\0';
574
575 if (sscanf(cmd, " force_on : %i", &value) == 1 &&
568 value >= 0 && value <= 1) { 576 value >= 0 && value <= 1) {
569 hci_write1(HCI_FAN, value, &hci_result); 577 hci_write1(HCI_FAN, value, &hci_result);
570 if (hci_result != HCI_SUCCESS) 578 if (hci_result != HCI_SUCCESS)
@@ -578,7 +586,16 @@ static unsigned long write_fan(const char *buffer, unsigned long count)
578 return count; 586 return count;
579} 587}
580 588
581static char *read_keys(char *p) 589static const struct file_operations fan_proc_fops = {
590 .owner = THIS_MODULE,
591 .open = fan_proc_open,
592 .read = seq_read,
593 .llseek = seq_lseek,
594 .release = single_release,
595 .write = fan_proc_write,
596};
597
598static int keys_proc_show(struct seq_file *m, void *v)
582{ 599{
583 u32 hci_result; 600 u32 hci_result;
584 u32 value; 601 u32 value;
@@ -602,18 +619,30 @@ static char *read_keys(char *p)
602 } 619 }
603 } 620 }
604 621
605 p += sprintf(p, "hotkey_ready: %d\n", key_event_valid); 622 seq_printf(m, "hotkey_ready: %d\n", key_event_valid);
606 p += sprintf(p, "hotkey: 0x%04x\n", last_key_event); 623 seq_printf(m, "hotkey: 0x%04x\n", last_key_event);
624end:
625 return 0;
626}
607 627
608 end: 628static int keys_proc_open(struct inode *inode, struct file *file)
609 return p; 629{
630 return single_open(file, keys_proc_show, NULL);
610} 631}
611 632
612static unsigned long write_keys(const char *buffer, unsigned long count) 633static ssize_t keys_proc_write(struct file *file, const char __user *buf,
634 size_t count, loff_t *pos)
613{ 635{
636 char cmd[42];
637 size_t len;
614 int value; 638 int value;
615 639
616 if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && value == 0) { 640 len = min(count, sizeof(cmd) - 1);
641 if (copy_from_user(cmd, buf, len))
642 return -EFAULT;
643 cmd[len] = '\0';
644
645 if (sscanf(cmd, " hotkey_ready : %i", &value) == 1 && value == 0) {
617 key_event_valid = 0; 646 key_event_valid = 0;
618 } else { 647 } else {
619 return -EINVAL; 648 return -EINVAL;
@@ -622,52 +651,58 @@ static unsigned long write_keys(const char *buffer, unsigned long count)
622 return count; 651 return count;
623} 652}
624 653
625static char *read_version(char *p) 654static const struct file_operations keys_proc_fops = {
655 .owner = THIS_MODULE,
656 .open = keys_proc_open,
657 .read = seq_read,
658 .llseek = seq_lseek,
659 .release = single_release,
660 .write = keys_proc_write,
661};
662
663static int version_proc_show(struct seq_file *m, void *v)
626{ 664{
627 p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION); 665 seq_printf(m, "driver: %s\n", TOSHIBA_ACPI_VERSION);
628 p += sprintf(p, "proc_interface: %d\n", 666 seq_printf(m, "proc_interface: %d\n", PROC_INTERFACE_VERSION);
629 PROC_INTERFACE_VERSION); 667 return 0;
630 return p;
631} 668}
632 669
670static int version_proc_open(struct inode *inode, struct file *file)
671{
672 return single_open(file, version_proc_show, PDE(inode)->data);
673}
674
675static const struct file_operations version_proc_fops = {
676 .owner = THIS_MODULE,
677 .open = version_proc_open,
678 .read = seq_read,
679 .llseek = seq_lseek,
680 .release = single_release,
681};
682
633/* proc and module init 683/* proc and module init
634 */ 684 */
635 685
636#define PROC_TOSHIBA "toshiba" 686#define PROC_TOSHIBA "toshiba"
637 687
638static ProcItem proc_items[] = {
639 {"lcd", read_lcd, write_lcd},
640 {"video", read_video, write_video},
641 {"fan", read_fan, write_fan},
642 {"keys", read_keys, write_keys},
643 {"version", read_version, NULL},
644 {NULL}
645};
646
647static acpi_status __init add_device(void) 688static acpi_status __init add_device(void)
648{ 689{
649 struct proc_dir_entry *proc; 690 proc_create("lcd", S_IRUGO | S_IWUSR, toshiba_proc_dir, &lcd_proc_fops);
650 ProcItem *item; 691 proc_create("video", S_IRUGO | S_IWUSR, toshiba_proc_dir, &video_proc_fops);
651 692 proc_create("fan", S_IRUGO | S_IWUSR, toshiba_proc_dir, &fan_proc_fops);
652 for (item = proc_items; item->name; ++item) { 693 proc_create("keys", S_IRUGO | S_IWUSR, toshiba_proc_dir, &keys_proc_fops);
653 proc = create_proc_read_entry(item->name, 694 proc_create("version", S_IRUGO, toshiba_proc_dir, &version_proc_fops);
654 S_IFREG | S_IRUGO | S_IWUSR,
655 toshiba_proc_dir,
656 (read_proc_t *) dispatch_read,
657 item);
658 if (proc && item->write_func)
659 proc->write_proc = (write_proc_t *) dispatch_write;
660 }
661 695
662 return AE_OK; 696 return AE_OK;
663} 697}
664 698
665static acpi_status remove_device(void) 699static acpi_status remove_device(void)
666{ 700{
667 ProcItem *item; 701 remove_proc_entry("lcd", toshiba_proc_dir);
668 702 remove_proc_entry("video", toshiba_proc_dir);
669 for (item = proc_items; item->name; ++item) 703 remove_proc_entry("fan", toshiba_proc_dir);
670 remove_proc_entry(item->name, toshiba_proc_dir); 704 remove_proc_entry("keys", toshiba_proc_dir);
705 remove_proc_entry("version", toshiba_proc_dir);
671 return AE_OK; 706 return AE_OK;
672} 707}
673 708
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index e425a868cd3a..b104302fea0a 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -492,8 +492,7 @@ wmi_notify_handler handler, void *data)
492 if (!guid || !handler) 492 if (!guid || !handler)
493 return AE_BAD_PARAMETER; 493 return AE_BAD_PARAMETER;
494 494
495 find_guid(guid, &block); 495 if (!find_guid(guid, &block))
496 if (!block)
497 return AE_NOT_EXIST; 496 return AE_NOT_EXIST;
498 497
499 if (block->handler) 498 if (block->handler)
@@ -521,8 +520,7 @@ acpi_status wmi_remove_notify_handler(const char *guid)
521 if (!guid) 520 if (!guid)
522 return AE_BAD_PARAMETER; 521 return AE_BAD_PARAMETER;
523 522
524 find_guid(guid, &block); 523 if (!find_guid(guid, &block))
525 if (!block)
526 return AE_NOT_EXIST; 524 return AE_NOT_EXIST;
527 525
528 if (!block->handler) 526 if (!block->handler)
@@ -540,8 +538,8 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
540/** 538/**
541 * wmi_get_event_data - Get WMI data associated with an event 539 * wmi_get_event_data - Get WMI data associated with an event
542 * 540 *
543 * @event - Event to find 541 * @event: Event to find
544 * &out - Buffer to hold event data 542 * @out: Buffer to hold event data. out->pointer should be freed with kfree()
545 * 543 *
546 * Returns extra data associated with an event in WMI. 544 * Returns extra data associated with an event in WMI.
547 */ 545 */
@@ -716,6 +714,22 @@ static int wmi_class_init(void)
716 return ret; 714 return ret;
717} 715}
718 716
717static bool guid_already_parsed(const char *guid_string)
718{
719 struct guid_block *gblock;
720 struct wmi_block *wblock;
721 struct list_head *p;
722
723 list_for_each(p, &wmi_blocks.list) {
724 wblock = list_entry(p, struct wmi_block, list);
725 gblock = &wblock->gblock;
726
727 if (strncmp(gblock->guid, guid_string, 16) == 0)
728 return true;
729 }
730 return false;
731}
732
719/* 733/*
720 * Parse the _WDG method for the GUID data blocks 734 * Parse the _WDG method for the GUID data blocks
721 */ 735 */
@@ -725,6 +739,7 @@ static __init acpi_status parse_wdg(acpi_handle handle)
725 union acpi_object *obj; 739 union acpi_object *obj;
726 struct guid_block *gblock; 740 struct guid_block *gblock;
727 struct wmi_block *wblock; 741 struct wmi_block *wblock;
742 char guid_string[37];
728 acpi_status status; 743 acpi_status status;
729 u32 i, total; 744 u32 i, total;
730 745
@@ -747,6 +762,19 @@ static __init acpi_status parse_wdg(acpi_handle handle)
747 memcpy(gblock, obj->buffer.pointer, obj->buffer.length); 762 memcpy(gblock, obj->buffer.pointer, obj->buffer.length);
748 763
749 for (i = 0; i < total; i++) { 764 for (i = 0; i < total; i++) {
765 /*
766 Some WMI devices, like those for nVidia hooks, have a
767 duplicate GUID. It's not clear what we should do in this
768 case yet, so for now, we'll just ignore the duplicate.
769 Anyone who wants to add support for that device can come
770 up with a better workaround for the mess then.
771 */
772 if (guid_already_parsed(gblock[i].guid) == true) {
773 wmi_gtoa(gblock[i].guid, guid_string);
774 printk(KERN_INFO PREFIX "Skipping duplicate GUID %s\n",
775 guid_string);
776 continue;
777 }
750 wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); 778 wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL);
751 if (!wblock) 779 if (!wblock)
752 return AE_NO_MEMORY; 780 return AE_NO_MEMORY;
diff --git a/drivers/power/pmu_battery.c b/drivers/power/pmu_battery.c
index 9346a862f1f2..9c87ad564803 100644
--- a/drivers/power/pmu_battery.c
+++ b/drivers/power/pmu_battery.c
@@ -89,6 +89,8 @@ static int pmu_bat_get_property(struct power_supply *psy,
89 case POWER_SUPPLY_PROP_STATUS: 89 case POWER_SUPPLY_PROP_STATUS:
90 if (pbi->flags & PMU_BATT_CHARGING) 90 if (pbi->flags & PMU_BATT_CHARGING)
91 val->intval = POWER_SUPPLY_STATUS_CHARGING; 91 val->intval = POWER_SUPPLY_STATUS_CHARGING;
92 else if (pmu_power_flags & PMU_PWR_AC_PRESENT)
93 val->intval = POWER_SUPPLY_STATUS_FULL;
92 else 94 else
93 val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 95 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
94 break; 96 break;
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
new file mode 100644
index 000000000000..04719551381b
--- /dev/null
+++ b/drivers/regulator/88pm8607.c
@@ -0,0 +1,685 @@
1/*
2 * Regulators driver for Marvell 88PM8607
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/err.h>
14#include <linux/platform_device.h>
15#include <linux/regulator/driver.h>
16#include <linux/regulator/machine.h>
17#include <linux/mfd/88pm8607.h>
18
19struct pm8607_regulator_info {
20 struct regulator_desc desc;
21 struct pm8607_chip *chip;
22 struct regulator_dev *regulator;
23
24 int min_uV;
25 int max_uV;
26 int step_uV;
27 int vol_reg;
28 int vol_shift;
29 int vol_nbits;
30 int update_reg;
31 int update_bit;
32 int enable_reg;
33 int enable_bit;
34 int slope_double;
35};
36
37static inline int check_range(struct pm8607_regulator_info *info,
38 int min_uV, int max_uV)
39{
40 if (max_uV < info->min_uV || min_uV > info->max_uV || min_uV > max_uV)
41 return -EINVAL;
42
43 return 0;
44}
45
46static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
47{
48 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
49 uint8_t chip_id = info->chip->chip_id;
50 int ret = -EINVAL;
51
52 switch (info->desc.id) {
53 case PM8607_ID_BUCK1:
54 ret = (index < 0x1d) ? (index * 25000 + 800000) :
55 ((index < 0x20) ? 1500000 :
56 ((index < 0x40) ? ((index - 0x20) * 25000) :
57 -EINVAL));
58 break;
59 case PM8607_ID_BUCK3:
60 ret = (index < 0x3d) ? (index * 25000) :
61 ((index < 0x40) ? 1500000 : -EINVAL);
62 if (ret < 0)
63 break;
64 if (info->slope_double)
65 ret <<= 1;
66 break;
67 case PM8607_ID_LDO1:
68 ret = (index == 0) ? 1800000 :
69 ((index == 1) ? 1200000 :
70 ((index == 2) ? 2800000 : -EINVAL));
71 break;
72 case PM8607_ID_LDO5:
73 ret = (index == 0) ? 2900000 :
74 ((index == 1) ? 3000000 :
75 ((index == 2) ? 3100000 : 3300000));
76 break;
77 case PM8607_ID_LDO7:
78 case PM8607_ID_LDO8:
79 ret = (index < 3) ? (index * 50000 + 1800000) :
80 ((index < 8) ? (index * 50000 + 2550000) :
81 -EINVAL);
82 break;
83 case PM8607_ID_LDO12:
84 ret = (index < 2) ? (index * 100000 + 1800000) :
85 ((index < 7) ? (index * 100000 + 2500000) :
86 ((index == 7) ? 3300000 : 1200000));
87 break;
88 case PM8607_ID_LDO2:
89 case PM8607_ID_LDO3:
90 case PM8607_ID_LDO9:
91 switch (chip_id) {
92 case PM8607_CHIP_A0:
93 case PM8607_CHIP_A1:
94 ret = (index < 3) ? (index * 50000 + 1800000) :
95 ((index < 8) ? (index * 50000 + 2550000) :
96 -EINVAL);
97 break;
98 case PM8607_CHIP_B0:
99 ret = (index < 3) ? (index * 50000 + 1800000) :
100 ((index < 7) ? (index * 50000 + 2550000) :
101 3300000);
102 break;
103 }
104 break;
105 case PM8607_ID_LDO4:
106 switch (chip_id) {
107 case PM8607_CHIP_A0:
108 case PM8607_CHIP_A1:
109 ret = (index < 3) ? (index * 50000 + 1800000) :
110 ((index < 8) ? (index * 50000 + 2550000) :
111 -EINVAL);
112 break;
113 case PM8607_CHIP_B0:
114 ret = (index < 3) ? (index * 50000 + 1800000) :
115 ((index < 6) ? (index * 50000 + 2550000) :
116 ((index == 6) ? 2900000 : 3300000));
117 break;
118 }
119 break;
120 case PM8607_ID_LDO6:
121 switch (chip_id) {
122 case PM8607_CHIP_A0:
123 case PM8607_CHIP_A1:
124 ret = (index < 3) ? (index * 50000 + 1800000) :
125 ((index < 8) ? (index * 50000 + 2450000) :
126 -EINVAL);
127 break;
128 case PM8607_CHIP_B0:
129 ret = (index < 2) ? (index * 50000 + 1800000) :
130 ((index < 7) ? (index * 50000 + 2500000) :
131 3300000);
132 break;
133 }
134 break;
135 case PM8607_ID_LDO10:
136 switch (chip_id) {
137 case PM8607_CHIP_A0:
138 case PM8607_CHIP_A1:
139 ret = (index < 3) ? (index * 50000 + 1800000) :
140 ((index < 8) ? (index * 50000 + 2550000) :
141 1200000);
142 break;
143 case PM8607_CHIP_B0:
144 ret = (index < 3) ? (index * 50000 + 1800000) :
145 ((index < 7) ? (index * 50000 + 2550000) :
146 ((index == 7) ? 3300000 : 1200000));
147 break;
148 }
149 break;
150 case PM8607_ID_LDO14:
151 switch (chip_id) {
152 case PM8607_CHIP_A0:
153 case PM8607_CHIP_A1:
154 ret = (index < 3) ? (index * 50000 + 1800000) :
155 ((index < 8) ? (index * 50000 + 2550000) :
156 -EINVAL);
157 break;
158 case PM8607_CHIP_B0:
159 ret = (index < 2) ? (index * 50000 + 1800000) :
160 ((index < 7) ? (index * 50000 + 2600000) :
161 3300000);
162 break;
163 }
164 break;
165 }
166 return ret;
167}
168
169static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
170{
171 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
172 uint8_t chip_id = info->chip->chip_id;
173 int val = -ENOENT;
174 int ret;
175
176 switch (info->desc.id) {
177 case PM8607_ID_BUCK1:
178 if (min_uV >= 800000) /* 800mV ~ 1500mV / 25mV */
179 val = (min_uV - 775001) / 25000;
180 else { /* 25mV ~ 775mV / 25mV */
181 val = (min_uV + 249999) / 25000;
182 val += 32;
183 }
184 break;
185 case PM8607_ID_BUCK3:
186 if (info->slope_double)
187 min_uV = min_uV >> 1;
188 val = (min_uV + 249999) / 25000; /* 0mV ~ 1500mV / 25mV */
189
190 break;
191 case PM8607_ID_LDO1:
192 if (min_uV > 1800000)
193 val = 2;
194 else if (min_uV > 1200000)
195 val = 0;
196 else
197 val = 1;
198 break;
199 case PM8607_ID_LDO5:
200 if (min_uV > 3100000)
201 val = 3;
202 else /* 2900mV ~ 3100mV / 100mV */
203 val = (min_uV - 2800001) / 100000;
204 break;
205 case PM8607_ID_LDO7:
206 case PM8607_ID_LDO8:
207 if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
208 if (min_uV <= 1800000)
209 val = 0; /* 1800mv */
210 else if (min_uV <= 1900000)
211 val = (min_uV - 1750001) / 50000;
212 else
213 val = 3; /* 2700mV */
214 } else { /* 2700mV ~ 2900mV / 50mV */
215 if (min_uV <= 2900000) {
216 val = (min_uV - 2650001) / 50000;
217 val += 3;
218 } else
219 val = -EINVAL;
220 }
221 break;
222 case PM8607_ID_LDO10:
223 if (min_uV > 2850000)
224 val = 7;
225 else if (min_uV <= 1200000)
226 val = 8;
227 else if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */
228 val = (min_uV - 1750001) / 50000;
229 else { /* 2700mV ~ 2850mV / 50mV */
230 val = (min_uV - 2650001) / 50000;
231 val += 3;
232 }
233 break;
234 case PM8607_ID_LDO12:
235 if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 100mV */
236 if (min_uV <= 1200000)
237 val = 8; /* 1200mV */
238 else if (min_uV <= 1800000)
239 val = 0; /* 1800mV */
240 else if (min_uV <= 1900000)
241 val = (min_uV - 1700001) / 100000;
242 else
243 val = 2; /* 2700mV */
244 } else { /* 2700mV ~ 3100mV / 100mV */
245 if (min_uV <= 3100000) {
246 val = (min_uV - 2600001) / 100000;
247 val += 2;
248 } else if (min_uV <= 3300000)
249 val = 7;
250 else
251 val = -EINVAL;
252 }
253 break;
254 case PM8607_ID_LDO2:
255 case PM8607_ID_LDO3:
256 case PM8607_ID_LDO9:
257 switch (chip_id) {
258 case PM8607_CHIP_A0:
259 case PM8607_CHIP_A1:
260 if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */
261 if (min_uV <= 1800000)
262 val = 0;
263 else if (min_uV <= 1900000)
264 val = (min_uV - 1750001) / 50000;
265 else
266 val = 3; /* 2700mV */
267 else { /* 2700mV ~ 2900mV / 50mV */
268 if (min_uV <= 2900000) {
269 val = (min_uV - 2650001) / 50000;
270 val += 3;
271 } else
272 val = -EINVAL;
273 }
274 break;
275 case PM8607_CHIP_B0:
276 if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
277 if (min_uV <= 1800000)
278 val = 0;
279 else if (min_uV <= 1900000)
280 val = (min_uV - 1750001) / 50000;
281 else
282 val = 3; /* 2700mV */
283 } else { /* 2700mV ~ 2850mV / 50mV */
284 if (min_uV <= 2850000) {
285 val = (min_uV - 2650001) / 50000;
286 val += 3;
287 } else if (min_uV <= 3300000)
288 val = 7;
289 else
290 val = -EINVAL;
291 }
292 break;
293 }
294 break;
295 case PM8607_ID_LDO4:
296 switch (chip_id) {
297 case PM8607_CHIP_A0:
298 case PM8607_CHIP_A1:
299 if (min_uV < 2700000) /* 1800mV ~ 1900mV / 50mV */
300 if (min_uV <= 1800000)
301 val = 0;
302 else if (min_uV <= 1900000)
303 val = (min_uV - 1750001) / 50000;
304 else
305 val = 3; /* 2700mV */
306 else { /* 2700mV ~ 2900mV / 50mV */
307 if (min_uV <= 2900000) {
308 val = (min_uV - 2650001) / 50000;
309 val += 3;
310 } else
311 val = -EINVAL;
312 }
313 break;
314 case PM8607_CHIP_B0:
315 if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
316 if (min_uV <= 1800000)
317 val = 0;
318 else if (min_uV <= 1900000)
319 val = (min_uV - 1750001) / 50000;
320 else
321 val = 3; /* 2700mV */
322 } else { /* 2700mV ~ 2800mV / 50mV */
323 if (min_uV <= 2850000) {
324 val = (min_uV - 2650001) / 50000;
325 val += 3;
326 } else if (min_uV <= 2900000)
327 val = 6;
328 else if (min_uV <= 3300000)
329 val = 7;
330 else
331 val = -EINVAL;
332 }
333 break;
334 }
335 break;
336 case PM8607_ID_LDO6:
337 switch (chip_id) {
338 case PM8607_CHIP_A0:
339 case PM8607_CHIP_A1:
340 if (min_uV < 2600000) { /* 1800mV ~ 1900mV / 50mV */
341 if (min_uV <= 1800000)
342 val = 0;
343 else if (min_uV <= 1900000)
344 val = (min_uV - 1750001) / 50000;
345 else
346 val = 3; /* 2600mV */
347 } else { /* 2600mV ~ 2800mV / 50mV */
348 if (min_uV <= 2800000) {
349 val = (min_uV - 2550001) / 50000;
350 val += 3;
351 } else
352 val = -EINVAL;
353 }
354 break;
355 case PM8607_CHIP_B0:
356 if (min_uV < 2600000) { /* 1800mV ~ 1850mV / 50mV */
357 if (min_uV <= 1800000)
358 val = 0;
359 else if (min_uV <= 1850000)
360 val = (min_uV - 1750001) / 50000;
361 else
362 val = 2; /* 2600mV */
363 } else { /* 2600mV ~ 2800mV / 50mV */
364 if (min_uV <= 2800000) {
365 val = (min_uV - 2550001) / 50000;
366 val += 2;
367 } else if (min_uV <= 3300000)
368 val = 7;
369 else
370 val = -EINVAL;
371 }
372 break;
373 }
374 break;
375 case PM8607_ID_LDO14:
376 switch (chip_id) {
377 case PM8607_CHIP_A0:
378 case PM8607_CHIP_A1:
379 if (min_uV < 2700000) { /* 1800mV ~ 1900mV / 50mV */
380 if (min_uV <= 1800000)
381 val = 0;
382 else if (min_uV <= 1900000)
383 val = (min_uV - 1750001) / 50000;
384 else
385 val = 3; /* 2700mV */
386 } else { /* 2700mV ~ 2900mV / 50mV */
387 if (min_uV <= 2900000) {
388 val = (min_uV - 2650001) / 50000;
389 val += 3;
390 } else
391 val = -EINVAL;
392 }
393 break;
394 case PM8607_CHIP_B0:
395 if (min_uV < 2700000) { /* 1800mV ~ 1850mV / 50mV */
396 if (min_uV <= 1800000)
397 val = 0;
398 else if (min_uV <= 1850000)
399 val = (min_uV - 1750001) / 50000;
400 else
401 val = 2; /* 2700mV */
402 } else { /* 2700mV ~ 2900mV / 50mV */
403 if (min_uV <= 2900000) {
404 val = (min_uV - 2650001) / 50000;
405 val += 2;
406 } else if (min_uV <= 3300000)
407 val = 7;
408 else
409 val = -EINVAL;
410 }
411 break;
412 }
413 break;
414 }
415 if (val >= 0) {
416 ret = pm8607_list_voltage(rdev, val);
417 if (ret > max_uV) {
418 pr_err("exceed voltage range (%d %d) uV",
419 min_uV, max_uV);
420 return -EINVAL;
421 }
422 } else
423 pr_err("invalid voltage range (%d %d) uV", min_uV, max_uV);
424 return val;
425}
426
427static int pm8607_set_voltage(struct regulator_dev *rdev,
428 int min_uV, int max_uV)
429{
430 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
431 struct pm8607_chip *chip = info->chip;
432 uint8_t val, mask;
433 int ret;
434
435 if (check_range(info, min_uV, max_uV)) {
436 pr_err("invalid voltage range (%d, %d) uV\n", min_uV, max_uV);
437 return -EINVAL;
438 }
439
440 ret = choose_voltage(rdev, min_uV, max_uV);
441 if (ret < 0)
442 return -EINVAL;
443 val = (uint8_t)(ret << info->vol_shift);
444 mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
445
446 ret = pm8607_set_bits(chip, info->vol_reg, mask, val);
447 if (ret)
448 return ret;
449 switch (info->desc.id) {
450 case PM8607_ID_BUCK1:
451 case PM8607_ID_BUCK3:
452 ret = pm8607_set_bits(chip, info->update_reg,
453 1 << info->update_bit,
454 1 << info->update_bit);
455 break;
456 }
457 return ret;
458}
459
460static int pm8607_get_voltage(struct regulator_dev *rdev)
461{
462 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
463 struct pm8607_chip *chip = info->chip;
464 uint8_t val, mask;
465 int ret;
466
467 ret = pm8607_reg_read(chip, info->vol_reg);
468 if (ret < 0)
469 return ret;
470
471 mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
472 val = ((unsigned char)ret & mask) >> info->vol_shift;
473
474 return pm8607_list_voltage(rdev, val);
475}
476
477static int pm8607_enable(struct regulator_dev *rdev)
478{
479 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
480 struct pm8607_chip *chip = info->chip;
481
482 return pm8607_set_bits(chip, info->enable_reg,
483 1 << info->enable_bit,
484 1 << info->enable_bit);
485}
486
487static int pm8607_disable(struct regulator_dev *rdev)
488{
489 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
490 struct pm8607_chip *chip = info->chip;
491
492 return pm8607_set_bits(chip, info->enable_reg,
493 1 << info->enable_bit, 0);
494}
495
496static int pm8607_is_enabled(struct regulator_dev *rdev)
497{
498 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
499 struct pm8607_chip *chip = info->chip;
500 int ret;
501
502 ret = pm8607_reg_read(chip, info->enable_reg);
503 if (ret < 0)
504 return ret;
505
506 return !!((unsigned char)ret & (1 << info->enable_bit));
507}
508
509static struct regulator_ops pm8607_regulator_ops = {
510 .set_voltage = pm8607_set_voltage,
511 .get_voltage = pm8607_get_voltage,
512 .enable = pm8607_enable,
513 .disable = pm8607_disable,
514 .is_enabled = pm8607_is_enabled,
515};
516
517#define PM8607_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
518{ \
519 .desc = { \
520 .name = "BUCK" #_id, \
521 .ops = &pm8607_regulator_ops, \
522 .type = REGULATOR_VOLTAGE, \
523 .id = PM8607_ID_BUCK##_id, \
524 .owner = THIS_MODULE, \
525 }, \
526 .min_uV = (min) * 1000, \
527 .max_uV = (max) * 1000, \
528 .step_uV = (step) * 1000, \
529 .vol_reg = PM8607_##vreg, \
530 .vol_shift = (0), \
531 .vol_nbits = (nbits), \
532 .update_reg = PM8607_##ureg, \
533 .update_bit = (ubit), \
534 .enable_reg = PM8607_##ereg, \
535 .enable_bit = (ebit), \
536 .slope_double = (0), \
537}
538
539#define PM8607_LDO(_id, min, max, step, vreg, shift, nbits, ereg, ebit) \
540{ \
541 .desc = { \
542 .name = "LDO" #_id, \
543 .ops = &pm8607_regulator_ops, \
544 .type = REGULATOR_VOLTAGE, \
545 .id = PM8607_ID_LDO##_id, \
546 .owner = THIS_MODULE, \
547 }, \
548 .min_uV = (min) * 1000, \
549 .max_uV = (max) * 1000, \
550 .step_uV = (step) * 1000, \
551 .vol_reg = PM8607_##vreg, \
552 .vol_shift = (shift), \
553 .vol_nbits = (nbits), \
554 .enable_reg = PM8607_##ereg, \
555 .enable_bit = (ebit), \
556 .slope_double = (0), \
557}
558
559static struct pm8607_regulator_info pm8607_regulator_info[] = {
560 PM8607_DVC(1, 0, 1500, 25, BUCK1, 6, GO, 0, SUPPLIES_EN11, 0),
561 PM8607_DVC(3, 0, 1500, 25, BUCK3, 6, GO, 2, SUPPLIES_EN11, 2),
562
563 PM8607_LDO(1 , 1200, 2800, 0, LDO1 , 0, 2, SUPPLIES_EN11, 3),
564 PM8607_LDO(2 , 1800, 3300, 0, LDO2 , 0, 3, SUPPLIES_EN11, 4),
565 PM8607_LDO(3 , 1800, 3300, 0, LDO3 , 0, 3, SUPPLIES_EN11, 5),
566 PM8607_LDO(4 , 1800, 3300, 0, LDO4 , 0, 3, SUPPLIES_EN11, 6),
567 PM8607_LDO(5 , 2900, 3300, 0, LDO5 , 0, 2, SUPPLIES_EN11, 7),
568 PM8607_LDO(6 , 1800, 3300, 0, LDO6 , 0, 3, SUPPLIES_EN12, 0),
569 PM8607_LDO(7 , 1800, 2900, 0, LDO7 , 0, 3, SUPPLIES_EN12, 1),
570 PM8607_LDO(8 , 1800, 2900, 0, LDO8 , 0, 3, SUPPLIES_EN12, 2),
571 PM8607_LDO(9 , 1800, 3300, 0, LDO9 , 0, 3, SUPPLIES_EN12, 3),
572 PM8607_LDO(10, 1200, 3300, 0, LDO10, 0, 4, SUPPLIES_EN11, 4),
573 PM8607_LDO(12, 1200, 3300, 0, LDO12, 0, 4, SUPPLIES_EN11, 5),
574 PM8607_LDO(14, 1800, 3300, 0, LDO14, 0, 3, SUPPLIES_EN11, 6),
575};
576
577static inline struct pm8607_regulator_info *find_regulator_info(int id)
578{
579 struct pm8607_regulator_info *info;
580 int i;
581
582 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
583 info = &pm8607_regulator_info[i];
584 if (info->desc.id == id)
585 return info;
586 }
587 return NULL;
588}
589
590static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
591{
592 struct pm8607_chip *chip = dev_get_drvdata(pdev->dev.parent);
593 struct pm8607_platform_data *pdata = chip->dev->platform_data;
594 struct pm8607_regulator_info *info = NULL;
595
596 info = find_regulator_info(pdev->id);
597 if (info == NULL) {
598 dev_err(&pdev->dev, "invalid regulator ID specified\n");
599 return -EINVAL;
600 }
601
602 info->chip = chip;
603
604 info->regulator = regulator_register(&info->desc, &pdev->dev,
605 pdata->regulator[pdev->id], info);
606 if (IS_ERR(info->regulator)) {
607 dev_err(&pdev->dev, "failed to register regulator %s\n",
608 info->desc.name);
609 return PTR_ERR(info->regulator);
610 }
611
612 /* check DVC ramp slope double */
613 if (info->desc.id == PM8607_ID_BUCK3)
614 if (info->chip->buck3_double)
615 info->slope_double = 1;
616
617 platform_set_drvdata(pdev, info);
618 return 0;
619}
620
621static int __devexit pm8607_regulator_remove(struct platform_device *pdev)
622{
623 struct pm8607_regulator_info *info = platform_get_drvdata(pdev);
624
625 regulator_unregister(info->regulator);
626 return 0;
627}
628
629#define PM8607_REGULATOR_DRIVER(_name) \
630{ \
631 .driver = { \
632 .name = "88pm8607-" #_name, \
633 .owner = THIS_MODULE, \
634 }, \
635 .probe = pm8607_regulator_probe, \
636 .remove = __devexit_p(pm8607_regulator_remove), \
637}
638
639static struct platform_driver pm8607_regulator_driver[] = {
640 PM8607_REGULATOR_DRIVER(buck1),
641 PM8607_REGULATOR_DRIVER(buck2),
642 PM8607_REGULATOR_DRIVER(buck3),
643 PM8607_REGULATOR_DRIVER(ldo1),
644 PM8607_REGULATOR_DRIVER(ldo2),
645 PM8607_REGULATOR_DRIVER(ldo3),
646 PM8607_REGULATOR_DRIVER(ldo4),
647 PM8607_REGULATOR_DRIVER(ldo5),
648 PM8607_REGULATOR_DRIVER(ldo6),
649 PM8607_REGULATOR_DRIVER(ldo7),
650 PM8607_REGULATOR_DRIVER(ldo8),
651 PM8607_REGULATOR_DRIVER(ldo9),
652 PM8607_REGULATOR_DRIVER(ldo10),
653 PM8607_REGULATOR_DRIVER(ldo12),
654 PM8607_REGULATOR_DRIVER(ldo14),
655};
656
657static int __init pm8607_regulator_init(void)
658{
659 int i, count, ret;
660
661 count = ARRAY_SIZE(pm8607_regulator_driver);
662 for (i = 0; i < count; i++) {
663 ret = platform_driver_register(&pm8607_regulator_driver[i]);
664 if (ret != 0)
665 pr_err("Failed to register regulator driver: %d\n",
666 ret);
667 }
668 return 0;
669}
670subsys_initcall(pm8607_regulator_init);
671
672static void __exit pm8607_regulator_exit(void)
673{
674 int i, count;
675
676 count = ARRAY_SIZE(pm8607_regulator_driver);
677 for (i = 0; i < count; i++)
678 platform_driver_unregister(&pm8607_regulator_driver[i]);
679}
680module_exit(pm8607_regulator_exit);
681
682MODULE_LICENSE("GPL");
683MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
684MODULE_DESCRIPTION("Regulator Driver for Marvell 88PM8607 PMIC");
685MODULE_ALIAS("platform:88pm8607-regulator");
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 7cfdd65bebb4..262f62eec837 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -69,6 +69,13 @@ config REGULATOR_MAX1586
69 regulator via I2C bus. The provided regulator is suitable 69 regulator via I2C bus. The provided regulator is suitable
70 for PXA27x chips to control VCC_CORE and VCC_USIM voltages. 70 for PXA27x chips to control VCC_CORE and VCC_USIM voltages.
71 71
72config REGULATOR_MAX8660
73 tristate "Maxim 8660/8661 voltage regulator"
74 depends on I2C
75 help
76 This driver controls a Maxim 8660/8661 voltage output
77 regulator via I2C bus.
78
72config REGULATOR_TWL4030 79config REGULATOR_TWL4030
73 bool "TI TWL4030/TWL5030/TWL6030/TPS695x0 PMIC" 80 bool "TI TWL4030/TWL5030/TWL6030/TPS695x0 PMIC"
74 depends on TWL4030_CORE 81 depends on TWL4030_CORE
@@ -157,5 +164,11 @@ config REGULATOR_TPS6507X
157 three step-down converters and two general-purpose LDO voltage regulators. 164 three step-down converters and two general-purpose LDO voltage regulators.
158 It supports TI's software based Class-2 SmartReflex implementation. 165 It supports TI's software based Class-2 SmartReflex implementation.
159 166
167config REGULATOR_88PM8607
168 bool "Marvell 88PM8607 Power regulators"
169 depends on MFD_88PM8607=y
170 help
171 This driver supports 88PM8607 voltage regulator chips.
172
160endif 173endif
161 174
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 9ae3cc44e668..b3c806c79415 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
12obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o 12obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
13obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o 13obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
14obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o 14obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
15obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
15obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o 16obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o
16obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o 17obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
17obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o 18obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
@@ -20,10 +21,11 @@ obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
20obj-$(CONFIG_REGULATOR_DA903X) += da903x.o 21obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
21obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o 22obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
22obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o 23obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
23obj-$(CONFIG_REGULATOR_MC13783) += mc13783.o 24obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
24obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o 25obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
25 26
26obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o 27obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o
27obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o 28obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o
29obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
28 30
29ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG 31ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index 49aeee823a25..b349db4504b7 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -81,7 +81,7 @@ static const u8 ab3100_reg_init_order[AB3100_NUM_REGULATORS+2] = {
81#define LDO_C_VOLTAGE 2650000 81#define LDO_C_VOLTAGE 2650000
82#define LDO_D_VOLTAGE 2650000 82#define LDO_D_VOLTAGE 2650000
83 83
84static const int const ldo_e_buck_typ_voltages[] = { 84static const int ldo_e_buck_typ_voltages[] = {
85 1800000, 85 1800000,
86 1400000, 86 1400000,
87 1300000, 87 1300000,
@@ -91,7 +91,7 @@ static const int const ldo_e_buck_typ_voltages[] = {
91 900000, 91 900000,
92}; 92};
93 93
94static const int const ldo_f_typ_voltages[] = { 94static const int ldo_f_typ_voltages[] = {
95 1800000, 95 1800000,
96 1400000, 96 1400000,
97 1300000, 97 1300000,
@@ -102,21 +102,21 @@ static const int const ldo_f_typ_voltages[] = {
102 2650000, 102 2650000,
103}; 103};
104 104
105static const int const ldo_g_typ_voltages[] = { 105static const int ldo_g_typ_voltages[] = {
106 2850000, 106 2850000,
107 2750000, 107 2750000,
108 1800000, 108 1800000,
109 1500000, 109 1500000,
110}; 110};
111 111
112static const int const ldo_h_typ_voltages[] = { 112static const int ldo_h_typ_voltages[] = {
113 2750000, 113 2750000,
114 1800000, 114 1800000,
115 1500000, 115 1500000,
116 1200000, 116 1200000,
117}; 117};
118 118
119static const int const ldo_k_typ_voltages[] = { 119static const int ldo_k_typ_voltages[] = {
120 2750000, 120 2750000,
121 1800000, 121 1800000,
122}; 122};
@@ -241,24 +241,12 @@ static int ab3100_disable_regulator(struct regulator_dev *reg)
241 * LDO D is a special regulator. When it is disabled, the entire 241 * LDO D is a special regulator. When it is disabled, the entire
242 * system is shut down. So this is handled specially. 242 * system is shut down. So this is handled specially.
243 */ 243 */
244 pr_info("Called ab3100_disable_regulator\n");
244 if (abreg->regreg == AB3100_LDO_D) { 245 if (abreg->regreg == AB3100_LDO_D) {
245 int i;
246
247 dev_info(&reg->dev, "disabling LDO D - shut down system\n"); 246 dev_info(&reg->dev, "disabling LDO D - shut down system\n");
248 /*
249 * Set regulators to default values, ignore any errors,
250 * we're going DOWN
251 */
252 for (i = 0; i < ARRAY_SIZE(ab3100_reg_init_order); i++) {
253 (void) ab3100_set_register_interruptible(abreg->ab3100,
254 ab3100_reg_init_order[i],
255 abreg->plfdata->reg_initvals[i]);
256 }
257
258 /* Setting LDO D to 0x00 cuts the power to the SoC */ 247 /* Setting LDO D to 0x00 cuts the power to the SoC */
259 return ab3100_set_register_interruptible(abreg->ab3100, 248 return ab3100_set_register_interruptible(abreg->ab3100,
260 AB3100_LDO_D, 0x00U); 249 AB3100_LDO_D, 0x00U);
261
262 } 250 }
263 251
264 /* 252 /*
@@ -607,13 +595,6 @@ static int __init ab3100_regulators_probe(struct platform_device *pdev)
607 } 595 }
608 } 596 }
609 597
610 if (err) {
611 dev_err(&pdev->dev,
612 "LDO D regulator initialization failed with error %d\n",
613 err);
614 return err;
615 }
616
617 /* Register the regulators */ 598 /* Register the regulators */
618 for (i = 0; i < AB3100_NUM_REGULATORS; i++) { 599 for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
619 struct ab3100_regulator *reg = &ab3100_regulators[i]; 600 struct ab3100_regulator *reg = &ab3100_regulators[i];
@@ -688,7 +669,7 @@ static __init int ab3100_regulators_init(void)
688 669
689static __exit void ab3100_regulators_exit(void) 670static __exit void ab3100_regulators_exit(void)
690{ 671{
691 platform_driver_register(&ab3100_regulators_driver); 672 platform_driver_unregister(&ab3100_regulators_driver);
692} 673}
693 674
694subsys_initcall(ab3100_regulators_init); 675subsys_initcall(ab3100_regulators_init);
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index efe568deda12..686ef270ecf7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -66,6 +66,16 @@ static unsigned int _regulator_get_mode(struct regulator_dev *rdev);
66static void _notifier_call_chain(struct regulator_dev *rdev, 66static void _notifier_call_chain(struct regulator_dev *rdev,
67 unsigned long event, void *data); 67 unsigned long event, void *data);
68 68
69static const char *rdev_get_name(struct regulator_dev *rdev)
70{
71 if (rdev->constraints && rdev->constraints->name)
72 return rdev->constraints->name;
73 else if (rdev->desc->name)
74 return rdev->desc->name;
75 else
76 return "";
77}
78
69/* gets the regulator for a given consumer device */ 79/* gets the regulator for a given consumer device */
70static struct regulator *get_device_regulator(struct device *dev) 80static struct regulator *get_device_regulator(struct device *dev)
71{ 81{
@@ -96,12 +106,12 @@ static int regulator_check_voltage(struct regulator_dev *rdev,
96 106
97 if (!rdev->constraints) { 107 if (!rdev->constraints) {
98 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 108 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
99 rdev->desc->name); 109 rdev_get_name(rdev));
100 return -ENODEV; 110 return -ENODEV;
101 } 111 }
102 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { 112 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
103 printk(KERN_ERR "%s: operation not allowed for %s\n", 113 printk(KERN_ERR "%s: operation not allowed for %s\n",
104 __func__, rdev->desc->name); 114 __func__, rdev_get_name(rdev));
105 return -EPERM; 115 return -EPERM;
106 } 116 }
107 117
@@ -124,12 +134,12 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
124 134
125 if (!rdev->constraints) { 135 if (!rdev->constraints) {
126 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 136 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
127 rdev->desc->name); 137 rdev_get_name(rdev));
128 return -ENODEV; 138 return -ENODEV;
129 } 139 }
130 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) { 140 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
131 printk(KERN_ERR "%s: operation not allowed for %s\n", 141 printk(KERN_ERR "%s: operation not allowed for %s\n",
132 __func__, rdev->desc->name); 142 __func__, rdev_get_name(rdev));
133 return -EPERM; 143 return -EPERM;
134 } 144 }
135 145
@@ -159,17 +169,17 @@ static int regulator_check_mode(struct regulator_dev *rdev, int mode)
159 169
160 if (!rdev->constraints) { 170 if (!rdev->constraints) {
161 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 171 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
162 rdev->desc->name); 172 rdev_get_name(rdev));
163 return -ENODEV; 173 return -ENODEV;
164 } 174 }
165 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) { 175 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
166 printk(KERN_ERR "%s: operation not allowed for %s\n", 176 printk(KERN_ERR "%s: operation not allowed for %s\n",
167 __func__, rdev->desc->name); 177 __func__, rdev_get_name(rdev));
168 return -EPERM; 178 return -EPERM;
169 } 179 }
170 if (!(rdev->constraints->valid_modes_mask & mode)) { 180 if (!(rdev->constraints->valid_modes_mask & mode)) {
171 printk(KERN_ERR "%s: invalid mode %x for %s\n", 181 printk(KERN_ERR "%s: invalid mode %x for %s\n",
172 __func__, mode, rdev->desc->name); 182 __func__, mode, rdev_get_name(rdev));
173 return -EINVAL; 183 return -EINVAL;
174 } 184 }
175 return 0; 185 return 0;
@@ -180,12 +190,12 @@ static int regulator_check_drms(struct regulator_dev *rdev)
180{ 190{
181 if (!rdev->constraints) { 191 if (!rdev->constraints) {
182 printk(KERN_ERR "%s: no constraints for %s\n", __func__, 192 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
183 rdev->desc->name); 193 rdev_get_name(rdev));
184 return -ENODEV; 194 return -ENODEV;
185 } 195 }
186 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) { 196 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
187 printk(KERN_ERR "%s: operation not allowed for %s\n", 197 printk(KERN_ERR "%s: operation not allowed for %s\n",
188 __func__, rdev->desc->name); 198 __func__, rdev_get_name(rdev));
189 return -EPERM; 199 return -EPERM;
190 } 200 }
191 return 0; 201 return 0;
@@ -230,16 +240,8 @@ static ssize_t regulator_name_show(struct device *dev,
230 struct device_attribute *attr, char *buf) 240 struct device_attribute *attr, char *buf)
231{ 241{
232 struct regulator_dev *rdev = dev_get_drvdata(dev); 242 struct regulator_dev *rdev = dev_get_drvdata(dev);
233 const char *name;
234 243
235 if (rdev->constraints && rdev->constraints->name) 244 return sprintf(buf, "%s\n", rdev_get_name(rdev));
236 name = rdev->constraints->name;
237 else if (rdev->desc->name)
238 name = rdev->desc->name;
239 else
240 name = "";
241
242 return sprintf(buf, "%s\n", name);
243} 245}
244 246
245static ssize_t regulator_print_opmode(char *buf, int mode) 247static ssize_t regulator_print_opmode(char *buf, int mode)
@@ -388,7 +390,7 @@ static ssize_t regulator_total_uA_show(struct device *dev,
388 390
389 mutex_lock(&rdev->mutex); 391 mutex_lock(&rdev->mutex);
390 list_for_each_entry(regulator, &rdev->consumer_list, list) 392 list_for_each_entry(regulator, &rdev->consumer_list, list)
391 uA += regulator->uA_load; 393 uA += regulator->uA_load;
392 mutex_unlock(&rdev->mutex); 394 mutex_unlock(&rdev->mutex);
393 return sprintf(buf, "%d\n", uA); 395 return sprintf(buf, "%d\n", uA);
394} 396}
@@ -563,7 +565,7 @@ static void drms_uA_update(struct regulator_dev *rdev)
563 565
564 /* calc total requested load */ 566 /* calc total requested load */
565 list_for_each_entry(sibling, &rdev->consumer_list, list) 567 list_for_each_entry(sibling, &rdev->consumer_list, list)
566 current_uA += sibling->uA_load; 568 current_uA += sibling->uA_load;
567 569
568 /* now get the optimum mode for our new total regulator load */ 570 /* now get the optimum mode for our new total regulator load */
569 mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV, 571 mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV,
@@ -579,10 +581,29 @@ static int suspend_set_state(struct regulator_dev *rdev,
579 struct regulator_state *rstate) 581 struct regulator_state *rstate)
580{ 582{
581 int ret = 0; 583 int ret = 0;
584 bool can_set_state;
582 585
583 /* enable & disable are mandatory for suspend control */ 586 can_set_state = rdev->desc->ops->set_suspend_enable &&
584 if (!rdev->desc->ops->set_suspend_enable || 587 rdev->desc->ops->set_suspend_disable;
585 !rdev->desc->ops->set_suspend_disable) { 588
589 /* If we have no suspend mode configration don't set anything;
590 * only warn if the driver actually makes the suspend mode
591 * configurable.
592 */
593 if (!rstate->enabled && !rstate->disabled) {
594 if (can_set_state)
595 printk(KERN_WARNING "%s: No configuration for %s\n",
596 __func__, rdev_get_name(rdev));
597 return 0;
598 }
599
600 if (rstate->enabled && rstate->disabled) {
601 printk(KERN_ERR "%s: invalid configuration for %s\n",
602 __func__, rdev_get_name(rdev));
603 return -EINVAL;
604 }
605
606 if (!can_set_state) {
586 printk(KERN_ERR "%s: no way to set suspend state\n", 607 printk(KERN_ERR "%s: no way to set suspend state\n",
587 __func__); 608 __func__);
588 return -EINVAL; 609 return -EINVAL;
@@ -641,25 +662,43 @@ static void print_constraints(struct regulator_dev *rdev)
641{ 662{
642 struct regulation_constraints *constraints = rdev->constraints; 663 struct regulation_constraints *constraints = rdev->constraints;
643 char buf[80]; 664 char buf[80];
644 int count; 665 int count = 0;
666 int ret;
645 667
646 if (rdev->desc->type == REGULATOR_VOLTAGE) { 668 if (constraints->min_uV && constraints->max_uV) {
647 if (constraints->min_uV == constraints->max_uV) 669 if (constraints->min_uV == constraints->max_uV)
648 count = sprintf(buf, "%d mV ", 670 count += sprintf(buf + count, "%d mV ",
649 constraints->min_uV / 1000); 671 constraints->min_uV / 1000);
650 else 672 else
651 count = sprintf(buf, "%d <--> %d mV ", 673 count += sprintf(buf + count, "%d <--> %d mV ",
652 constraints->min_uV / 1000, 674 constraints->min_uV / 1000,
653 constraints->max_uV / 1000); 675 constraints->max_uV / 1000);
654 } else { 676 }
677
678 if (!constraints->min_uV ||
679 constraints->min_uV != constraints->max_uV) {
680 ret = _regulator_get_voltage(rdev);
681 if (ret > 0)
682 count += sprintf(buf + count, "at %d mV ", ret / 1000);
683 }
684
685 if (constraints->min_uA && constraints->max_uA) {
655 if (constraints->min_uA == constraints->max_uA) 686 if (constraints->min_uA == constraints->max_uA)
656 count = sprintf(buf, "%d mA ", 687 count += sprintf(buf + count, "%d mA ",
657 constraints->min_uA / 1000); 688 constraints->min_uA / 1000);
658 else 689 else
659 count = sprintf(buf, "%d <--> %d mA ", 690 count += sprintf(buf + count, "%d <--> %d mA ",
660 constraints->min_uA / 1000, 691 constraints->min_uA / 1000,
661 constraints->max_uA / 1000); 692 constraints->max_uA / 1000);
662 } 693 }
694
695 if (!constraints->min_uA ||
696 constraints->min_uA != constraints->max_uA) {
697 ret = _regulator_get_current_limit(rdev);
698 if (ret > 0)
699 count += sprintf(buf + count, "at %d uA ", ret / 1000);
700 }
701
663 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) 702 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST)
664 count += sprintf(buf + count, "fast "); 703 count += sprintf(buf + count, "fast ");
665 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL) 704 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL)
@@ -669,33 +708,30 @@ static void print_constraints(struct regulator_dev *rdev)
669 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY) 708 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY)
670 count += sprintf(buf + count, "standby"); 709 count += sprintf(buf + count, "standby");
671 710
672 printk(KERN_INFO "regulator: %s: %s\n", rdev->desc->name, buf); 711 printk(KERN_INFO "regulator: %s: %s\n", rdev_get_name(rdev), buf);
673} 712}
674 713
675/** 714static int machine_constraints_voltage(struct regulator_dev *rdev,
676 * set_machine_constraints - sets regulator constraints
677 * @rdev: regulator source
678 * @constraints: constraints to apply
679 *
680 * Allows platform initialisation code to define and constrain
681 * regulator circuits e.g. valid voltage/current ranges, etc. NOTE:
682 * Constraints *must* be set by platform code in order for some
683 * regulator operations to proceed i.e. set_voltage, set_current_limit,
684 * set_mode.
685 */
686static int set_machine_constraints(struct regulator_dev *rdev,
687 struct regulation_constraints *constraints) 715 struct regulation_constraints *constraints)
688{ 716{
689 int ret = 0;
690 const char *name;
691 struct regulator_ops *ops = rdev->desc->ops; 717 struct regulator_ops *ops = rdev->desc->ops;
718 const char *name = rdev_get_name(rdev);
719 int ret;
692 720
693 if (constraints->name) 721 /* do we need to apply the constraint voltage */
694 name = constraints->name; 722 if (rdev->constraints->apply_uV &&
695 else if (rdev->desc->name) 723 rdev->constraints->min_uV == rdev->constraints->max_uV &&
696 name = rdev->desc->name; 724 ops->set_voltage) {
697 else 725 ret = ops->set_voltage(rdev,
698 name = "regulator"; 726 rdev->constraints->min_uV, rdev->constraints->max_uV);
727 if (ret < 0) {
728 printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
729 __func__,
730 rdev->constraints->min_uV, name);
731 rdev->constraints = NULL;
732 return ret;
733 }
734 }
699 735
700 /* constrain machine-level voltage specs to fit 736 /* constrain machine-level voltage specs to fit
701 * the actual range supported by this regulator. 737 * the actual range supported by this regulator.
@@ -719,14 +755,13 @@ static int set_machine_constraints(struct regulator_dev *rdev,
719 755
720 /* voltage constraints are optional */ 756 /* voltage constraints are optional */
721 if ((cmin == 0) && (cmax == 0)) 757 if ((cmin == 0) && (cmax == 0))
722 goto out; 758 return 0;
723 759
724 /* else require explicit machine-level constraints */ 760 /* else require explicit machine-level constraints */
725 if (cmin <= 0 || cmax <= 0 || cmax < cmin) { 761 if (cmin <= 0 || cmax <= 0 || cmax < cmin) {
726 pr_err("%s: %s '%s' voltage constraints\n", 762 pr_err("%s: %s '%s' voltage constraints\n",
727 __func__, "invalid", name); 763 __func__, "invalid", name);
728 ret = -EINVAL; 764 return -EINVAL;
729 goto out;
730 } 765 }
731 766
732 /* initial: [cmin..cmax] valid, [min_uV..max_uV] not */ 767 /* initial: [cmin..cmax] valid, [min_uV..max_uV] not */
@@ -748,8 +783,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
748 if (max_uV < min_uV) { 783 if (max_uV < min_uV) {
749 pr_err("%s: %s '%s' voltage constraints\n", 784 pr_err("%s: %s '%s' voltage constraints\n",
750 __func__, "unsupportable", name); 785 __func__, "unsupportable", name);
751 ret = -EINVAL; 786 return -EINVAL;
752 goto out;
753 } 787 }
754 788
755 /* use regulator's subset of machine constraints */ 789 /* use regulator's subset of machine constraints */
@@ -767,22 +801,34 @@ static int set_machine_constraints(struct regulator_dev *rdev,
767 } 801 }
768 } 802 }
769 803
804 return 0;
805}
806
807/**
808 * set_machine_constraints - sets regulator constraints
809 * @rdev: regulator source
810 * @constraints: constraints to apply
811 *
812 * Allows platform initialisation code to define and constrain
813 * regulator circuits e.g. valid voltage/current ranges, etc. NOTE:
814 * Constraints *must* be set by platform code in order for some
815 * regulator operations to proceed i.e. set_voltage, set_current_limit,
816 * set_mode.
817 */
818static int set_machine_constraints(struct regulator_dev *rdev,
819 struct regulation_constraints *constraints)
820{
821 int ret = 0;
822 const char *name;
823 struct regulator_ops *ops = rdev->desc->ops;
824
770 rdev->constraints = constraints; 825 rdev->constraints = constraints;
771 826
772 /* do we need to apply the constraint voltage */ 827 name = rdev_get_name(rdev);
773 if (rdev->constraints->apply_uV && 828
774 rdev->constraints->min_uV == rdev->constraints->max_uV && 829 ret = machine_constraints_voltage(rdev, constraints);
775 ops->set_voltage) { 830 if (ret != 0)
776 ret = ops->set_voltage(rdev, 831 goto out;
777 rdev->constraints->min_uV, rdev->constraints->max_uV);
778 if (ret < 0) {
779 printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
780 __func__,
781 rdev->constraints->min_uV, name);
782 rdev->constraints = NULL;
783 goto out;
784 }
785 }
786 832
787 /* do we need to setup our suspend state */ 833 /* do we need to setup our suspend state */
788 if (constraints->initial_state) { 834 if (constraints->initial_state) {
@@ -903,7 +949,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
903 dev_name(&node->regulator->dev), 949 dev_name(&node->regulator->dev),
904 node->regulator->desc->name, 950 node->regulator->desc->name,
905 supply, 951 supply,
906 dev_name(&rdev->dev), rdev->desc->name); 952 dev_name(&rdev->dev), rdev_get_name(rdev));
907 return -EBUSY; 953 return -EBUSY;
908 } 954 }
909 955
@@ -1212,7 +1258,7 @@ static int _regulator_enable(struct regulator_dev *rdev)
1212 ret = _regulator_enable(rdev->supply); 1258 ret = _regulator_enable(rdev->supply);
1213 if (ret < 0) { 1259 if (ret < 0) {
1214 printk(KERN_ERR "%s: failed to enable %s: %d\n", 1260 printk(KERN_ERR "%s: failed to enable %s: %d\n",
1215 __func__, rdev->desc->name, ret); 1261 __func__, rdev_get_name(rdev), ret);
1216 return ret; 1262 return ret;
1217 } 1263 }
1218 } 1264 }
@@ -1238,7 +1284,7 @@ static int _regulator_enable(struct regulator_dev *rdev)
1238 } 1284 }
1239 } else if (ret < 0) { 1285 } else if (ret < 0) {
1240 printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n", 1286 printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n",
1241 __func__, rdev->desc->name, ret); 1287 __func__, rdev_get_name(rdev), ret);
1242 return ret; 1288 return ret;
1243 } 1289 }
1244 /* Fallthrough on positive return values - already enabled */ 1290 /* Fallthrough on positive return values - already enabled */
@@ -1279,7 +1325,7 @@ static int _regulator_disable(struct regulator_dev *rdev)
1279 1325
1280 if (WARN(rdev->use_count <= 0, 1326 if (WARN(rdev->use_count <= 0,
1281 "unbalanced disables for %s\n", 1327 "unbalanced disables for %s\n",
1282 rdev->desc->name)) 1328 rdev_get_name(rdev)))
1283 return -EIO; 1329 return -EIO;
1284 1330
1285 /* are we the last user and permitted to disable ? */ 1331 /* are we the last user and permitted to disable ? */
@@ -1292,7 +1338,7 @@ static int _regulator_disable(struct regulator_dev *rdev)
1292 ret = rdev->desc->ops->disable(rdev); 1338 ret = rdev->desc->ops->disable(rdev);
1293 if (ret < 0) { 1339 if (ret < 0) {
1294 printk(KERN_ERR "%s: failed to disable %s\n", 1340 printk(KERN_ERR "%s: failed to disable %s\n",
1295 __func__, rdev->desc->name); 1341 __func__, rdev_get_name(rdev));
1296 return ret; 1342 return ret;
1297 } 1343 }
1298 } 1344 }
@@ -1349,7 +1395,7 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
1349 ret = rdev->desc->ops->disable(rdev); 1395 ret = rdev->desc->ops->disable(rdev);
1350 if (ret < 0) { 1396 if (ret < 0) {
1351 printk(KERN_ERR "%s: failed to force disable %s\n", 1397 printk(KERN_ERR "%s: failed to force disable %s\n",
1352 __func__, rdev->desc->name); 1398 __func__, rdev_get_name(rdev));
1353 return ret; 1399 return ret;
1354 } 1400 }
1355 /* notify other consumers that power has been forced off */ 1401 /* notify other consumers that power has been forced off */
@@ -1766,7 +1812,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1766 output_uV = rdev->desc->ops->get_voltage(rdev); 1812 output_uV = rdev->desc->ops->get_voltage(rdev);
1767 if (output_uV <= 0) { 1813 if (output_uV <= 0) {
1768 printk(KERN_ERR "%s: invalid output voltage found for %s\n", 1814 printk(KERN_ERR "%s: invalid output voltage found for %s\n",
1769 __func__, rdev->desc->name); 1815 __func__, rdev_get_name(rdev));
1770 goto out; 1816 goto out;
1771 } 1817 }
1772 1818
@@ -1777,13 +1823,13 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1777 input_uV = rdev->constraints->input_uV; 1823 input_uV = rdev->constraints->input_uV;
1778 if (input_uV <= 0) { 1824 if (input_uV <= 0) {
1779 printk(KERN_ERR "%s: invalid input voltage found for %s\n", 1825 printk(KERN_ERR "%s: invalid input voltage found for %s\n",
1780 __func__, rdev->desc->name); 1826 __func__, rdev_get_name(rdev));
1781 goto out; 1827 goto out;
1782 } 1828 }
1783 1829
1784 /* calc total requested load for this regulator */ 1830 /* calc total requested load for this regulator */
1785 list_for_each_entry(consumer, &rdev->consumer_list, list) 1831 list_for_each_entry(consumer, &rdev->consumer_list, list)
1786 total_uA_load += consumer->uA_load; 1832 total_uA_load += consumer->uA_load;
1787 1833
1788 mode = rdev->desc->ops->get_optimum_mode(rdev, 1834 mode = rdev->desc->ops->get_optimum_mode(rdev,
1789 input_uV, output_uV, 1835 input_uV, output_uV,
@@ -1791,7 +1837,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1791 ret = regulator_check_mode(rdev, mode); 1837 ret = regulator_check_mode(rdev, mode);
1792 if (ret < 0) { 1838 if (ret < 0) {
1793 printk(KERN_ERR "%s: failed to get optimum mode for %s @" 1839 printk(KERN_ERR "%s: failed to get optimum mode for %s @"
1794 " %d uA %d -> %d uV\n", __func__, rdev->desc->name, 1840 " %d uA %d -> %d uV\n", __func__, rdev_get_name(rdev),
1795 total_uA_load, input_uV, output_uV); 1841 total_uA_load, input_uV, output_uV);
1796 goto out; 1842 goto out;
1797 } 1843 }
@@ -1799,7 +1845,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1799 ret = rdev->desc->ops->set_mode(rdev, mode); 1845 ret = rdev->desc->ops->set_mode(rdev, mode);
1800 if (ret < 0) { 1846 if (ret < 0) {
1801 printk(KERN_ERR "%s: failed to set optimum mode %x for %s\n", 1847 printk(KERN_ERR "%s: failed to set optimum mode %x for %s\n",
1802 __func__, mode, rdev->desc->name); 1848 __func__, mode, rdev_get_name(rdev));
1803 goto out; 1849 goto out;
1804 } 1850 }
1805 ret = mode; 1851 ret = mode;
@@ -1852,9 +1898,9 @@ static void _notifier_call_chain(struct regulator_dev *rdev,
1852 1898
1853 /* now notify regulator we supply */ 1899 /* now notify regulator we supply */
1854 list_for_each_entry(_rdev, &rdev->supply_list, slist) { 1900 list_for_each_entry(_rdev, &rdev->supply_list, slist) {
1855 mutex_lock(&_rdev->mutex); 1901 mutex_lock(&_rdev->mutex);
1856 _notifier_call_chain(_rdev, event, data); 1902 _notifier_call_chain(_rdev, event, data);
1857 mutex_unlock(&_rdev->mutex); 1903 mutex_unlock(&_rdev->mutex);
1858 } 1904 }
1859} 1905}
1860 1906
@@ -1885,9 +1931,9 @@ int regulator_bulk_get(struct device *dev, int num_consumers,
1885 consumers[i].consumer = regulator_get(dev, 1931 consumers[i].consumer = regulator_get(dev,
1886 consumers[i].supply); 1932 consumers[i].supply);
1887 if (IS_ERR(consumers[i].consumer)) { 1933 if (IS_ERR(consumers[i].consumer)) {
1888 dev_err(dev, "Failed to get supply '%s'\n",
1889 consumers[i].supply);
1890 ret = PTR_ERR(consumers[i].consumer); 1934 ret = PTR_ERR(consumers[i].consumer);
1935 dev_err(dev, "Failed to get supply '%s': %d\n",
1936 consumers[i].supply, ret);
1891 consumers[i].consumer = NULL; 1937 consumers[i].consumer = NULL;
1892 goto err; 1938 goto err;
1893 } 1939 }
@@ -1930,8 +1976,8 @@ int regulator_bulk_enable(int num_consumers,
1930 return 0; 1976 return 0;
1931 1977
1932err: 1978err:
1933 printk(KERN_ERR "Failed to enable %s\n", consumers[i].supply); 1979 printk(KERN_ERR "Failed to enable %s: %d\n", consumers[i].supply, ret);
1934 for (i = 0; i < num_consumers; i++) 1980 for (--i; i >= 0; --i)
1935 regulator_disable(consumers[i].consumer); 1981 regulator_disable(consumers[i].consumer);
1936 1982
1937 return ret; 1983 return ret;
@@ -1965,8 +2011,9 @@ int regulator_bulk_disable(int num_consumers,
1965 return 0; 2011 return 0;
1966 2012
1967err: 2013err:
1968 printk(KERN_ERR "Failed to disable %s\n", consumers[i].supply); 2014 printk(KERN_ERR "Failed to disable %s: %d\n", consumers[i].supply,
1969 for (i = 0; i < num_consumers; i++) 2015 ret);
2016 for (--i; i >= 0; --i)
1970 regulator_enable(consumers[i].consumer); 2017 regulator_enable(consumers[i].consumer);
1971 2018
1972 return ret; 2019 return ret;
@@ -2316,7 +2363,7 @@ int regulator_suspend_prepare(suspend_state_t state)
2316 2363
2317 if (ret < 0) { 2364 if (ret < 0) {
2318 printk(KERN_ERR "%s: failed to prepare %s\n", 2365 printk(KERN_ERR "%s: failed to prepare %s\n",
2319 __func__, rdev->desc->name); 2366 __func__, rdev_get_name(rdev));
2320 goto out; 2367 goto out;
2321 } 2368 }
2322 } 2369 }
@@ -2429,12 +2476,7 @@ static int __init regulator_init_complete(void)
2429 ops = rdev->desc->ops; 2476 ops = rdev->desc->ops;
2430 c = rdev->constraints; 2477 c = rdev->constraints;
2431 2478
2432 if (c && c->name) 2479 name = rdev_get_name(rdev);
2433 name = c->name;
2434 else if (rdev->desc->name)
2435 name = rdev->desc->name;
2436 else
2437 name = "regulator";
2438 2480
2439 if (!ops->disable || (c && c->always_on)) 2481 if (!ops->disable || (c && c->always_on))
2440 continue; 2482 continue;
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index aa224d936e0d..f8c4661a7a81 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -331,7 +331,7 @@ static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
331static int da9034_list_ldo12_voltage(struct regulator_dev *rdev, 331static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
332 unsigned selector) 332 unsigned selector)
333{ 333{
334 if (selector > ARRAY_SIZE(da9034_ldo12_data)) 334 if (selector >= ARRAY_SIZE(da9034_ldo12_data))
335 return -EINVAL; 335 return -EINVAL;
336 return da9034_ldo12_data[selector] * 1000; 336 return da9034_ldo12_data[selector] * 1000;
337} 337}
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 7803a320543b..76d08c282f9c 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -446,8 +446,8 @@ static int setup_regulators(struct lp3971 *lp3971,
446 lp3971->rdev[i] = regulator_register(&regulators[id], 446 lp3971->rdev[i] = regulator_register(&regulators[id],
447 lp3971->dev, pdata->regulators[i].initdata, lp3971); 447 lp3971->dev, pdata->regulators[i].initdata, lp3971);
448 448
449 err = IS_ERR(lp3971->rdev[i]); 449 if (IS_ERR(lp3971->rdev[i])) {
450 if (err) { 450 err = PTR_ERR(lp3971->rdev[i]);
451 dev_err(lp3971->dev, "regulator init failed: %d\n", 451 dev_err(lp3971->dev, "regulator init failed: %d\n",
452 err); 452 err);
453 goto error; 453 goto error;
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
new file mode 100644
index 000000000000..acc2fb7b6087
--- /dev/null
+++ b/drivers/regulator/max8660.c
@@ -0,0 +1,510 @@
1/*
2 * max8660.c -- Voltage regulation for the Maxim 8660/8661
3 *
4 * based on max1586.c and wm8400-regulator.c
5 *
6 * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Some info:
22 *
23 * Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8660-MAX8661.pdf
24 *
25 * This chip is a bit nasty because it is a write-only device. Thus, the driver
26 * uses shadow registers to keep track of its values. The main problem appears
27 * to be the initialization: When Linux boots up, we cannot know if the chip is
28 * in the default state or not, so we would have to pass such information in
29 * platform_data. As this adds a bit of complexity to the driver, this is left
30 * out for now until it is really needed.
31 *
32 * [A|S|M]DTV1 registers are currently not used, but [A|S|M]DTV2.
33 *
34 * If the driver is feature complete, it might be worth to check if one set of
35 * functions for V3-V7 is sufficient. For maximum flexibility during
36 * development, they are separated for now.
37 *
38 */
39
40#include <linux/module.h>
41#include <linux/err.h>
42#include <linux/i2c.h>
43#include <linux/platform_device.h>
44#include <linux/regulator/driver.h>
45#include <linux/regulator/max8660.h>
46
47#define MAX8660_DCDC_MIN_UV 725000
48#define MAX8660_DCDC_MAX_UV 1800000
49#define MAX8660_DCDC_STEP 25000
50#define MAX8660_DCDC_MAX_SEL 0x2b
51
52#define MAX8660_LDO5_MIN_UV 1700000
53#define MAX8660_LDO5_MAX_UV 2000000
54#define MAX8660_LDO5_STEP 25000
55#define MAX8660_LDO5_MAX_SEL 0x0c
56
57#define MAX8660_LDO67_MIN_UV 1800000
58#define MAX8660_LDO67_MAX_UV 3300000
59#define MAX8660_LDO67_STEP 100000
60#define MAX8660_LDO67_MAX_SEL 0x0f
61
62enum {
63 MAX8660_OVER1,
64 MAX8660_OVER2,
65 MAX8660_VCC1,
66 MAX8660_ADTV1,
67 MAX8660_ADTV2,
68 MAX8660_SDTV1,
69 MAX8660_SDTV2,
70 MAX8660_MDTV1,
71 MAX8660_MDTV2,
72 MAX8660_L12VCR,
73 MAX8660_FPWM,
74 MAX8660_N_REGS, /* not a real register */
75};
76
77struct max8660 {
78 struct i2c_client *client;
79 u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */
80 struct regulator_dev *rdev[];
81};
82
83static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val)
84{
85 static const u8 max8660_addresses[MAX8660_N_REGS] =
86 { 0x10, 0x12, 0x20, 0x23, 0x24, 0x29, 0x2a, 0x32, 0x33, 0x39, 0x80 };
87
88 int ret;
89 u8 reg_val = (max8660->shadow_regs[reg] & mask) | val;
90 dev_vdbg(&max8660->client->dev, "Writing reg %02x with %02x\n",
91 max8660_addresses[reg], reg_val);
92
93 ret = i2c_smbus_write_byte_data(max8660->client,
94 max8660_addresses[reg], reg_val);
95 if (ret == 0)
96 max8660->shadow_regs[reg] = reg_val;
97
98 return ret;
99}
100
101
102/*
103 * DCDC functions
104 */
105
106static int max8660_dcdc_is_enabled(struct regulator_dev *rdev)
107{
108 struct max8660 *max8660 = rdev_get_drvdata(rdev);
109 u8 val = max8660->shadow_regs[MAX8660_OVER1];
110 u8 mask = (rdev_get_id(rdev) == MAX8660_V3) ? 1 : 4;
111 return !!(val & mask);
112}
113
114static int max8660_dcdc_enable(struct regulator_dev *rdev)
115{
116 struct max8660 *max8660 = rdev_get_drvdata(rdev);
117 u8 bit = (rdev_get_id(rdev) == MAX8660_V3) ? 1 : 4;
118 return max8660_write(max8660, MAX8660_OVER1, 0xff, bit);
119}
120
121static int max8660_dcdc_disable(struct regulator_dev *rdev)
122{
123 struct max8660 *max8660 = rdev_get_drvdata(rdev);
124 u8 mask = (rdev_get_id(rdev) == MAX8660_V3) ? ~1 : ~4;
125 return max8660_write(max8660, MAX8660_OVER1, mask, 0);
126}
127
128static int max8660_dcdc_list(struct regulator_dev *rdev, unsigned selector)
129{
130 if (selector > MAX8660_DCDC_MAX_SEL)
131 return -EINVAL;
132 return MAX8660_DCDC_MIN_UV + selector * MAX8660_DCDC_STEP;
133}
134
135static int max8660_dcdc_get(struct regulator_dev *rdev)
136{
137 struct max8660 *max8660 = rdev_get_drvdata(rdev);
138 u8 reg = (rdev_get_id(rdev) == MAX8660_V3) ? MAX8660_ADTV2 : MAX8660_SDTV2;
139 u8 selector = max8660->shadow_regs[reg];
140 return MAX8660_DCDC_MIN_UV + selector * MAX8660_DCDC_STEP;
141}
142
143static int max8660_dcdc_set(struct regulator_dev *rdev, int min_uV, int max_uV)
144{
145 struct max8660 *max8660 = rdev_get_drvdata(rdev);
146 u8 reg, selector, bits;
147 int ret;
148
149 if (min_uV < MAX8660_DCDC_MIN_UV || min_uV > MAX8660_DCDC_MAX_UV)
150 return -EINVAL;
151 if (max_uV < MAX8660_DCDC_MIN_UV || max_uV > MAX8660_DCDC_MAX_UV)
152 return -EINVAL;
153
154 selector = (min_uV - (MAX8660_DCDC_MIN_UV - MAX8660_DCDC_STEP + 1))
155 / MAX8660_DCDC_STEP;
156
157 ret = max8660_dcdc_list(rdev, selector);
158 if (ret < 0 || ret > max_uV)
159 return -EINVAL;
160
161 reg = (rdev_get_id(rdev) == MAX8660_V3) ? MAX8660_ADTV2 : MAX8660_SDTV2;
162 ret = max8660_write(max8660, reg, 0, selector);
163 if (ret)
164 return ret;
165
166 /* Select target voltage register and activate regulation */
167 bits = (rdev_get_id(rdev) == MAX8660_V3) ? 0x03 : 0x30;
168 return max8660_write(max8660, MAX8660_VCC1, 0xff, bits);
169}
170
171static struct regulator_ops max8660_dcdc_ops = {
172 .is_enabled = max8660_dcdc_is_enabled,
173 .list_voltage = max8660_dcdc_list,
174 .set_voltage = max8660_dcdc_set,
175 .get_voltage = max8660_dcdc_get,
176};
177
178
179/*
180 * LDO5 functions
181 */
182
183static int max8660_ldo5_list(struct regulator_dev *rdev, unsigned selector)
184{
185 if (selector > MAX8660_LDO5_MAX_SEL)
186 return -EINVAL;
187 return MAX8660_LDO5_MIN_UV + selector * MAX8660_LDO5_STEP;
188}
189
190static int max8660_ldo5_get(struct regulator_dev *rdev)
191{
192 struct max8660 *max8660 = rdev_get_drvdata(rdev);
193 u8 selector = max8660->shadow_regs[MAX8660_MDTV2];
194
195 return MAX8660_LDO5_MIN_UV + selector * MAX8660_LDO5_STEP;
196}
197
198static int max8660_ldo5_set(struct regulator_dev *rdev, int min_uV, int max_uV)
199{
200 struct max8660 *max8660 = rdev_get_drvdata(rdev);
201 u8 selector;
202 int ret;
203
204 if (min_uV < MAX8660_LDO5_MIN_UV || min_uV > MAX8660_LDO5_MAX_UV)
205 return -EINVAL;
206 if (max_uV < MAX8660_LDO5_MIN_UV || max_uV > MAX8660_LDO5_MAX_UV)
207 return -EINVAL;
208
209 selector = (min_uV - (MAX8660_LDO5_MIN_UV - MAX8660_LDO5_STEP + 1))
210 / MAX8660_LDO5_STEP;
211 ret = max8660_ldo5_list(rdev, selector);
212 if (ret < 0 || ret > max_uV)
213 return -EINVAL;
214
215 ret = max8660_write(max8660, MAX8660_MDTV2, 0, selector);
216 if (ret)
217 return ret;
218
219 /* Select target voltage register and activate regulation */
220 return max8660_write(max8660, MAX8660_VCC1, 0xff, 0xc0);
221}
222
223static struct regulator_ops max8660_ldo5_ops = {
224 .list_voltage = max8660_ldo5_list,
225 .set_voltage = max8660_ldo5_set,
226 .get_voltage = max8660_ldo5_get,
227};
228
229
230/*
231 * LDO67 functions
232 */
233
234static int max8660_ldo67_is_enabled(struct regulator_dev *rdev)
235{
236 struct max8660 *max8660 = rdev_get_drvdata(rdev);
237 u8 val = max8660->shadow_regs[MAX8660_OVER2];
238 u8 mask = (rdev_get_id(rdev) == MAX8660_V6) ? 2 : 4;
239 return !!(val & mask);
240}
241
242static int max8660_ldo67_enable(struct regulator_dev *rdev)
243{
244 struct max8660 *max8660 = rdev_get_drvdata(rdev);
245 u8 bit = (rdev_get_id(rdev) == MAX8660_V6) ? 2 : 4;
246 return max8660_write(max8660, MAX8660_OVER2, 0xff, bit);
247}
248
249static int max8660_ldo67_disable(struct regulator_dev *rdev)
250{
251 struct max8660 *max8660 = rdev_get_drvdata(rdev);
252 u8 mask = (rdev_get_id(rdev) == MAX8660_V6) ? ~2 : ~4;
253 return max8660_write(max8660, MAX8660_OVER2, mask, 0);
254}
255
256static int max8660_ldo67_list(struct regulator_dev *rdev, unsigned selector)
257{
258 if (selector > MAX8660_LDO67_MAX_SEL)
259 return -EINVAL;
260 return MAX8660_LDO67_MIN_UV + selector * MAX8660_LDO67_STEP;
261}
262
263static int max8660_ldo67_get(struct regulator_dev *rdev)
264{
265 struct max8660 *max8660 = rdev_get_drvdata(rdev);
266 u8 shift = (rdev_get_id(rdev) == MAX8660_V6) ? 0 : 4;
267 u8 selector = (max8660->shadow_regs[MAX8660_L12VCR] >> shift) & 0xf;
268
269 return MAX8660_LDO67_MIN_UV + selector * MAX8660_LDO67_STEP;
270}
271
272static int max8660_ldo67_set(struct regulator_dev *rdev, int min_uV, int max_uV)
273{
274 struct max8660 *max8660 = rdev_get_drvdata(rdev);
275 u8 selector;
276 int ret;
277
278 if (min_uV < MAX8660_LDO67_MIN_UV || min_uV > MAX8660_LDO67_MAX_UV)
279 return -EINVAL;
280 if (max_uV < MAX8660_LDO67_MIN_UV || max_uV > MAX8660_LDO67_MAX_UV)
281 return -EINVAL;
282
283 selector = (min_uV - (MAX8660_LDO67_MIN_UV - MAX8660_LDO67_STEP + 1))
284 / MAX8660_LDO67_STEP;
285
286 ret = max8660_ldo67_list(rdev, selector);
287 if (ret < 0 || ret > max_uV)
288 return -EINVAL;
289
290 if (rdev_get_id(rdev) == MAX8660_V6)
291 return max8660_write(max8660, MAX8660_L12VCR, 0xf0, selector);
292 else
293 return max8660_write(max8660, MAX8660_L12VCR, 0x0f, selector << 4);
294}
295
296static struct regulator_ops max8660_ldo67_ops = {
297 .is_enabled = max8660_ldo67_is_enabled,
298 .enable = max8660_ldo67_enable,
299 .disable = max8660_ldo67_disable,
300 .list_voltage = max8660_ldo67_list,
301 .get_voltage = max8660_ldo67_get,
302 .set_voltage = max8660_ldo67_set,
303};
304
305static struct regulator_desc max8660_reg[] = {
306 {
307 .name = "V3(DCDC)",
308 .id = MAX8660_V3,
309 .ops = &max8660_dcdc_ops,
310 .type = REGULATOR_VOLTAGE,
311 .n_voltages = MAX8660_DCDC_MAX_SEL + 1,
312 .owner = THIS_MODULE,
313 },
314 {
315 .name = "V4(DCDC)",
316 .id = MAX8660_V4,
317 .ops = &max8660_dcdc_ops,
318 .type = REGULATOR_VOLTAGE,
319 .n_voltages = MAX8660_DCDC_MAX_SEL + 1,
320 .owner = THIS_MODULE,
321 },
322 {
323 .name = "V5(LDO)",
324 .id = MAX8660_V5,
325 .ops = &max8660_ldo5_ops,
326 .type = REGULATOR_VOLTAGE,
327 .n_voltages = MAX8660_LDO5_MAX_SEL + 1,
328 .owner = THIS_MODULE,
329 },
330 {
331 .name = "V6(LDO)",
332 .id = MAX8660_V6,
333 .ops = &max8660_ldo67_ops,
334 .type = REGULATOR_VOLTAGE,
335 .n_voltages = MAX8660_LDO67_MAX_SEL + 1,
336 .owner = THIS_MODULE,
337 },
338 {
339 .name = "V7(LDO)",
340 .id = MAX8660_V7,
341 .ops = &max8660_ldo67_ops,
342 .type = REGULATOR_VOLTAGE,
343 .n_voltages = MAX8660_LDO67_MAX_SEL + 1,
344 .owner = THIS_MODULE,
345 },
346};
347
348static int max8660_probe(struct i2c_client *client,
349 const struct i2c_device_id *i2c_id)
350{
351 struct regulator_dev **rdev;
352 struct max8660_platform_data *pdata = client->dev.platform_data;
353 struct max8660 *max8660;
354 int boot_on, i, id, ret = -EINVAL;
355
356 if (pdata->num_subdevs > MAX8660_V_END) {
357 dev_err(&client->dev, "Too much regulators found!\n");
358 goto out;
359 }
360
361 max8660 = kzalloc(sizeof(struct max8660) +
362 sizeof(struct regulator_dev *) * MAX8660_V_END,
363 GFP_KERNEL);
364 if (!max8660) {
365 ret = -ENOMEM;
366 goto out;
367 }
368
369 max8660->client = client;
370 rdev = max8660->rdev;
371
372 if (pdata->en34_is_high) {
373 /* Simulate always on */
374 max8660->shadow_regs[MAX8660_OVER1] = 5;
375 } else {
376 /* Otherwise devices can be toggled via software */
377 max8660_dcdc_ops.enable = max8660_dcdc_enable;
378 max8660_dcdc_ops.disable = max8660_dcdc_disable;
379 }
380
381 /*
382 * First, set up shadow registers to prevent glitches. As some
383 * registers are shared between regulators, everything must be properly
384 * set up for all regulators in advance.
385 */
386 max8660->shadow_regs[MAX8660_ADTV1] =
387 max8660->shadow_regs[MAX8660_ADTV2] =
388 max8660->shadow_regs[MAX8660_SDTV1] =
389 max8660->shadow_regs[MAX8660_SDTV2] = 0x1b;
390 max8660->shadow_regs[MAX8660_MDTV1] =
391 max8660->shadow_regs[MAX8660_MDTV2] = 0x04;
392
393 for (i = 0; i < pdata->num_subdevs; i++) {
394
395 if (!pdata->subdevs[i].platform_data)
396 goto err_free;
397
398 boot_on = pdata->subdevs[i].platform_data->constraints.boot_on;
399
400 switch (pdata->subdevs[i].id) {
401 case MAX8660_V3:
402 if (boot_on)
403 max8660->shadow_regs[MAX8660_OVER1] |= 1;
404 break;
405
406 case MAX8660_V4:
407 if (boot_on)
408 max8660->shadow_regs[MAX8660_OVER1] |= 4;
409 break;
410
411 case MAX8660_V5:
412 break;
413
414 case MAX8660_V6:
415 if (boot_on)
416 max8660->shadow_regs[MAX8660_OVER2] |= 2;
417 break;
418
419 case MAX8660_V7:
420 if (!strcmp(i2c_id->name, "max8661")) {
421 dev_err(&client->dev, "Regulator not on this chip!\n");
422 goto err_free;
423 }
424
425 if (boot_on)
426 max8660->shadow_regs[MAX8660_OVER2] |= 4;
427 break;
428
429 default:
430 dev_err(&client->dev, "invalid regulator %s\n",
431 pdata->subdevs[i].name);
432 goto err_free;
433 }
434 }
435
436 /* Finally register devices */
437 for (i = 0; i < pdata->num_subdevs; i++) {
438
439 id = pdata->subdevs[i].id;
440
441 rdev[i] = regulator_register(&max8660_reg[id], &client->dev,
442 pdata->subdevs[i].platform_data,
443 max8660);
444 if (IS_ERR(rdev[i])) {
445 ret = PTR_ERR(rdev[i]);
446 dev_err(&client->dev, "failed to register %s\n",
447 max8660_reg[id].name);
448 goto err_unregister;
449 }
450 }
451
452 i2c_set_clientdata(client, rdev);
453 dev_info(&client->dev, "Maxim 8660/8661 regulator driver loaded\n");
454 return 0;
455
456err_unregister:
457 while (--i >= 0)
458 regulator_unregister(rdev[i]);
459err_free:
460 kfree(max8660);
461out:
462 return ret;
463}
464
465static int max8660_remove(struct i2c_client *client)
466{
467 struct regulator_dev **rdev = i2c_get_clientdata(client);
468 int i;
469
470 for (i = 0; i < MAX8660_V_END; i++)
471 if (rdev[i])
472 regulator_unregister(rdev[i]);
473 kfree(rdev);
474 i2c_set_clientdata(client, NULL);
475
476 return 0;
477}
478
479static const struct i2c_device_id max8660_id[] = {
480 { "max8660", 0 },
481 { "max8661", 0 },
482 { }
483};
484MODULE_DEVICE_TABLE(i2c, max8660_id);
485
486static struct i2c_driver max8660_driver = {
487 .probe = max8660_probe,
488 .remove = max8660_remove,
489 .driver = {
490 .name = "max8660",
491 },
492 .id_table = max8660_id,
493};
494
495static int __init max8660_init(void)
496{
497 return i2c_add_driver(&max8660_driver);
498}
499subsys_initcall(max8660_init);
500
501static void __exit max8660_exit(void)
502{
503 i2c_del_driver(&max8660_driver);
504}
505module_exit(max8660_exit);
506
507/* Module information */
508MODULE_DESCRIPTION("MAXIM 8660/8661 voltage regulator driver");
509MODULE_AUTHOR("Wolfram Sang");
510MODULE_LICENSE("GPL v2");
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
new file mode 100644
index 000000000000..39c495300045
--- /dev/null
+++ b/drivers/regulator/mc13783-regulator.c
@@ -0,0 +1,245 @@
1/*
2 * Regulator Driver for Freescale MC13783 PMIC
3 *
4 * Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/mfd/mc13783.h>
12#include <linux/regulator/machine.h>
13#include <linux/regulator/driver.h>
14#include <linux/platform_device.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/err.h>
18
19#define MC13783_REG_SWITCHERS4 28
20#define MC13783_REG_SWITCHERS4_PLLEN (1 << 18)
21
22#define MC13783_REG_SWITCHERS5 29
23#define MC13783_REG_SWITCHERS5_SW3EN (1 << 20)
24
25#define MC13783_REG_REGULATORMODE0 32
26#define MC13783_REG_REGULATORMODE0_VAUDIOEN (1 << 0)
27#define MC13783_REG_REGULATORMODE0_VIOHIEN (1 << 3)
28#define MC13783_REG_REGULATORMODE0_VIOLOEN (1 << 6)
29#define MC13783_REG_REGULATORMODE0_VDIGEN (1 << 9)
30#define MC13783_REG_REGULATORMODE0_VGENEN (1 << 12)
31#define MC13783_REG_REGULATORMODE0_VRFDIGEN (1 << 15)
32#define MC13783_REG_REGULATORMODE0_VRFREFEN (1 << 18)
33#define MC13783_REG_REGULATORMODE0_VRFCPEN (1 << 21)
34
35#define MC13783_REG_REGULATORMODE1 33
36#define MC13783_REG_REGULATORMODE1_VSIMEN (1 << 0)
37#define MC13783_REG_REGULATORMODE1_VESIMEN (1 << 3)
38#define MC13783_REG_REGULATORMODE1_VCAMEN (1 << 6)
39#define MC13783_REG_REGULATORMODE1_VRFBGEN (1 << 9)
40#define MC13783_REG_REGULATORMODE1_VVIBEN (1 << 11)
41#define MC13783_REG_REGULATORMODE1_VRF1EN (1 << 12)
42#define MC13783_REG_REGULATORMODE1_VRF2EN (1 << 15)
43#define MC13783_REG_REGULATORMODE1_VMMC1EN (1 << 18)
44#define MC13783_REG_REGULATORMODE1_VMMC2EN (1 << 21)
45
46#define MC13783_REG_POWERMISC 34
47#define MC13783_REG_POWERMISC_GPO1EN (1 << 6)
48#define MC13783_REG_POWERMISC_GPO2EN (1 << 8)
49#define MC13783_REG_POWERMISC_GPO3EN (1 << 10)
50#define MC13783_REG_POWERMISC_GPO4EN (1 << 12)
51
52struct mc13783_regulator {
53 struct regulator_desc desc;
54 int reg;
55 int enable_bit;
56};
57
58static struct regulator_ops mc13783_regulator_ops;
59
60#define MC13783_DEFINE(prefix, _name, _reg) \
61 [MC13783_ ## prefix ## _ ## _name] = { \
62 .desc = { \
63 .name = #prefix "_" #_name, \
64 .ops = &mc13783_regulator_ops, \
65 .type = REGULATOR_VOLTAGE, \
66 .id = MC13783_ ## prefix ## _ ## _name, \
67 .owner = THIS_MODULE, \
68 }, \
69 .reg = MC13783_REG_ ## _reg, \
70 .enable_bit = MC13783_REG_ ## _reg ## _ ## _name ## EN, \
71 }
72
73#define MC13783_DEFINE_SW(_name, _reg) MC13783_DEFINE(SW, _name, _reg)
74#define MC13783_DEFINE_REGU(_name, _reg) MC13783_DEFINE(REGU, _name, _reg)
75
76static struct mc13783_regulator mc13783_regulators[] = {
77 MC13783_DEFINE_SW(SW3, SWITCHERS5),
78 MC13783_DEFINE_SW(PLL, SWITCHERS4),
79
80 MC13783_DEFINE_REGU(VAUDIO, REGULATORMODE0),
81 MC13783_DEFINE_REGU(VIOHI, REGULATORMODE0),
82 MC13783_DEFINE_REGU(VIOLO, REGULATORMODE0),
83 MC13783_DEFINE_REGU(VDIG, REGULATORMODE0),
84 MC13783_DEFINE_REGU(VGEN, REGULATORMODE0),
85 MC13783_DEFINE_REGU(VRFDIG, REGULATORMODE0),
86 MC13783_DEFINE_REGU(VRFREF, REGULATORMODE0),
87 MC13783_DEFINE_REGU(VRFCP, REGULATORMODE0),
88 MC13783_DEFINE_REGU(VSIM, REGULATORMODE1),
89 MC13783_DEFINE_REGU(VESIM, REGULATORMODE1),
90 MC13783_DEFINE_REGU(VCAM, REGULATORMODE1),
91 MC13783_DEFINE_REGU(VRFBG, REGULATORMODE1),
92 MC13783_DEFINE_REGU(VVIB, REGULATORMODE1),
93 MC13783_DEFINE_REGU(VRF1, REGULATORMODE1),
94 MC13783_DEFINE_REGU(VRF2, REGULATORMODE1),
95 MC13783_DEFINE_REGU(VMMC1, REGULATORMODE1),
96 MC13783_DEFINE_REGU(VMMC2, REGULATORMODE1),
97 MC13783_DEFINE_REGU(GPO1, POWERMISC),
98 MC13783_DEFINE_REGU(GPO2, POWERMISC),
99 MC13783_DEFINE_REGU(GPO3, POWERMISC),
100 MC13783_DEFINE_REGU(GPO4, POWERMISC),
101};
102
103struct mc13783_regulator_priv {
104 struct mc13783 *mc13783;
105 struct regulator_dev *regulators[];
106};
107
108static int mc13783_regulator_enable(struct regulator_dev *rdev)
109{
110 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
111 int id = rdev_get_id(rdev);
112 int ret;
113
114 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
115
116 mc13783_lock(priv->mc13783);
117 ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].reg,
118 mc13783_regulators[id].enable_bit,
119 mc13783_regulators[id].enable_bit);
120 mc13783_unlock(priv->mc13783);
121
122 return ret;
123}
124
125static int mc13783_regulator_disable(struct regulator_dev *rdev)
126{
127 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
128 int id = rdev_get_id(rdev);
129 int ret;
130
131 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
132
133 mc13783_lock(priv->mc13783);
134 ret = mc13783_reg_rmw(priv->mc13783, mc13783_regulators[id].reg,
135 mc13783_regulators[id].enable_bit, 0);
136 mc13783_unlock(priv->mc13783);
137
138 return ret;
139}
140
141static int mc13783_regulator_is_enabled(struct regulator_dev *rdev)
142{
143 struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev);
144 int ret, id = rdev_get_id(rdev);
145 unsigned int val;
146
147 mc13783_lock(priv->mc13783);
148 ret = mc13783_reg_read(priv->mc13783, mc13783_regulators[id].reg, &val);
149 mc13783_unlock(priv->mc13783);
150
151 if (ret)
152 return ret;
153
154 return (val & mc13783_regulators[id].enable_bit) != 0;
155}
156
157static struct regulator_ops mc13783_regulator_ops = {
158 .enable = mc13783_regulator_enable,
159 .disable = mc13783_regulator_disable,
160 .is_enabled = mc13783_regulator_is_enabled,
161};
162
163static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
164{
165 struct mc13783_regulator_priv *priv;
166 struct mc13783 *mc13783 = dev_get_drvdata(pdev->dev.parent);
167 struct mc13783_regulator_platform_data *pdata =
168 dev_get_platdata(&pdev->dev);
169 struct mc13783_regulator_init_data *init_data;
170 int i, ret;
171
172 dev_dbg(&pdev->dev, "mc13783_regulator_probe id %d\n", pdev->id);
173
174 priv = kzalloc(sizeof(*priv) +
175 pdata->num_regulators * sizeof(priv->regulators[0]),
176 GFP_KERNEL);
177 if (!priv)
178 return -ENOMEM;
179
180 priv->mc13783 = mc13783;
181
182 for (i = 0; i < pdata->num_regulators; i++) {
183 init_data = &pdata->regulators[i];
184 priv->regulators[i] = regulator_register(
185 &mc13783_regulators[init_data->id].desc,
186 &pdev->dev, init_data->init_data, priv);
187
188 if (IS_ERR(priv->regulators[i])) {
189 dev_err(&pdev->dev, "failed to register regulator %s\n",
190 mc13783_regulators[i].desc.name);
191 ret = PTR_ERR(priv->regulators[i]);
192 goto err;
193 }
194 }
195
196 platform_set_drvdata(pdev, priv);
197
198 return 0;
199err:
200 while (--i >= 0)
201 regulator_unregister(priv->regulators[i]);
202
203 kfree(priv);
204
205 return ret;
206}
207
208static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
209{
210 struct mc13783_regulator_priv *priv = platform_get_drvdata(pdev);
211 struct mc13783_regulator_platform_data *pdata =
212 dev_get_platdata(&pdev->dev);
213 int i;
214
215 for (i = 0; i < pdata->num_regulators; i++)
216 regulator_unregister(priv->regulators[i]);
217
218 return 0;
219}
220
221static struct platform_driver mc13783_regulator_driver = {
222 .driver = {
223 .name = "mc13783-regulator",
224 .owner = THIS_MODULE,
225 },
226 .remove = __devexit_p(mc13783_regulator_remove),
227 .probe = mc13783_regulator_probe,
228};
229
230static int __init mc13783_regulator_init(void)
231{
232 return platform_driver_register(&mc13783_regulator_driver);
233}
234subsys_initcall(mc13783_regulator_init);
235
236static void __exit mc13783_regulator_exit(void)
237{
238 platform_driver_unregister(&mc13783_regulator_driver);
239}
240module_exit(mc13783_regulator_exit);
241
242MODULE_LICENSE("GPL v2");
243MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de");
244MODULE_DESCRIPTION("Regulator Driver for Freescale MC13783 PMIC");
245MODULE_ALIAS("platform:mc13783-regulator");
diff --git a/drivers/regulator/mc13783.c b/drivers/regulator/mc13783.c
deleted file mode 100644
index 710211f67449..000000000000
--- a/drivers/regulator/mc13783.c
+++ /dev/null
@@ -1,410 +0,0 @@
1/*
2 * Regulator Driver for Freescale MC13783 PMIC
3 *
4 * Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/mfd/mc13783-private.h>
12#include <linux/regulator/machine.h>
13#include <linux/regulator/driver.h>
14#include <linux/platform_device.h>
15#include <linux/mfd/mc13783.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/err.h>
19
20struct mc13783_regulator {
21 struct regulator_desc desc;
22 int reg;
23 int enable_bit;
24};
25
26static struct regulator_ops mc13783_regulator_ops;
27
28static struct mc13783_regulator mc13783_regulators[] = {
29 [MC13783_SW_SW3] = {
30 .desc = {
31 .name = "SW_SW3",
32 .ops = &mc13783_regulator_ops,
33 .type = REGULATOR_VOLTAGE,
34 .id = MC13783_SW_SW3,
35 .owner = THIS_MODULE,
36 },
37 .reg = MC13783_REG_SWITCHERS_5,
38 .enable_bit = MC13783_SWCTRL_SW3_EN,
39 },
40 [MC13783_SW_PLL] = {
41 .desc = {
42 .name = "SW_PLL",
43 .ops = &mc13783_regulator_ops,
44 .type = REGULATOR_VOLTAGE,
45 .id = MC13783_SW_PLL,
46 .owner = THIS_MODULE,
47 },
48 .reg = MC13783_REG_SWITCHERS_4,
49 .enable_bit = MC13783_SWCTRL_PLL_EN,
50 },
51 [MC13783_REGU_VAUDIO] = {
52 .desc = {
53 .name = "REGU_VAUDIO",
54 .ops = &mc13783_regulator_ops,
55 .type = REGULATOR_VOLTAGE,
56 .id = MC13783_REGU_VAUDIO,
57 .owner = THIS_MODULE,
58 },
59 .reg = MC13783_REG_REGULATOR_MODE_0,
60 .enable_bit = MC13783_REGCTRL_VAUDIO_EN,
61 },
62 [MC13783_REGU_VIOHI] = {
63 .desc = {
64 .name = "REGU_VIOHI",
65 .ops = &mc13783_regulator_ops,
66 .type = REGULATOR_VOLTAGE,
67 .id = MC13783_REGU_VIOHI,
68 .owner = THIS_MODULE,
69 },
70 .reg = MC13783_REG_REGULATOR_MODE_0,
71 .enable_bit = MC13783_REGCTRL_VIOHI_EN,
72 },
73 [MC13783_REGU_VIOLO] = {
74 .desc = {
75 .name = "REGU_VIOLO",
76 .ops = &mc13783_regulator_ops,
77 .type = REGULATOR_VOLTAGE,
78 .id = MC13783_REGU_VIOLO,
79 .owner = THIS_MODULE,
80 },
81 .reg = MC13783_REG_REGULATOR_MODE_0,
82 .enable_bit = MC13783_REGCTRL_VIOLO_EN,
83 },
84 [MC13783_REGU_VDIG] = {
85 .desc = {
86 .name = "REGU_VDIG",
87 .ops = &mc13783_regulator_ops,
88 .type = REGULATOR_VOLTAGE,
89 .id = MC13783_REGU_VDIG,
90 .owner = THIS_MODULE,
91 },
92 .reg = MC13783_REG_REGULATOR_MODE_0,
93 .enable_bit = MC13783_REGCTRL_VDIG_EN,
94 },
95 [MC13783_REGU_VGEN] = {
96 .desc = {
97 .name = "REGU_VGEN",
98 .ops = &mc13783_regulator_ops,
99 .type = REGULATOR_VOLTAGE,
100 .id = MC13783_REGU_VGEN,
101 .owner = THIS_MODULE,
102 },
103 .reg = MC13783_REG_REGULATOR_MODE_0,
104 .enable_bit = MC13783_REGCTRL_VGEN_EN,
105 },
106 [MC13783_REGU_VRFDIG] = {
107 .desc = {
108 .name = "REGU_VRFDIG",
109 .ops = &mc13783_regulator_ops,
110 .type = REGULATOR_VOLTAGE,
111 .id = MC13783_REGU_VRFDIG,
112 .owner = THIS_MODULE,
113 },
114 .reg = MC13783_REG_REGULATOR_MODE_0,
115 .enable_bit = MC13783_REGCTRL_VRFDIG_EN,
116 },
117 [MC13783_REGU_VRFREF] = {
118 .desc = {
119 .name = "REGU_VRFREF",
120 .ops = &mc13783_regulator_ops,
121 .type = REGULATOR_VOLTAGE,
122 .id = MC13783_REGU_VRFREF,
123 .owner = THIS_MODULE,
124 },
125 .reg = MC13783_REG_REGULATOR_MODE_0,
126 .enable_bit = MC13783_REGCTRL_VRFREF_EN,
127 },
128 [MC13783_REGU_VRFCP] = {
129 .desc = {
130 .name = "REGU_VRFCP",
131 .ops = &mc13783_regulator_ops,
132 .type = REGULATOR_VOLTAGE,
133 .id = MC13783_REGU_VRFCP,
134 .owner = THIS_MODULE,
135 },
136 .reg = MC13783_REG_REGULATOR_MODE_0,
137 .enable_bit = MC13783_REGCTRL_VRFCP_EN,
138 },
139 [MC13783_REGU_VSIM] = {
140 .desc = {
141 .name = "REGU_VSIM",
142 .ops = &mc13783_regulator_ops,
143 .type = REGULATOR_VOLTAGE,
144 .id = MC13783_REGU_VSIM,
145 .owner = THIS_MODULE,
146 },
147 .reg = MC13783_REG_REGULATOR_MODE_1,
148 .enable_bit = MC13783_REGCTRL_VSIM_EN,
149 },
150 [MC13783_REGU_VESIM] = {
151 .desc = {
152 .name = "REGU_VESIM",
153 .ops = &mc13783_regulator_ops,
154 .type = REGULATOR_VOLTAGE,
155 .id = MC13783_REGU_VESIM,
156 .owner = THIS_MODULE,
157 },
158 .reg = MC13783_REG_REGULATOR_MODE_1,
159 .enable_bit = MC13783_REGCTRL_VESIM_EN,
160 },
161 [MC13783_REGU_VCAM] = {
162 .desc = {
163 .name = "REGU_VCAM",
164 .ops = &mc13783_regulator_ops,
165 .type = REGULATOR_VOLTAGE,
166 .id = MC13783_REGU_VCAM,
167 .owner = THIS_MODULE,
168 },
169 .reg = MC13783_REG_REGULATOR_MODE_1,
170 .enable_bit = MC13783_REGCTRL_VCAM_EN,
171 },
172 [MC13783_REGU_VRFBG] = {
173 .desc = {
174 .name = "REGU_VRFBG",
175 .ops = &mc13783_regulator_ops,
176 .type = REGULATOR_VOLTAGE,
177 .id = MC13783_REGU_VRFBG,
178 .owner = THIS_MODULE,
179 },
180 .reg = MC13783_REG_REGULATOR_MODE_1,
181 .enable_bit = MC13783_REGCTRL_VRFBG_EN,
182 },
183 [MC13783_REGU_VVIB] = {
184 .desc = {
185 .name = "REGU_VVIB",
186 .ops = &mc13783_regulator_ops,
187 .type = REGULATOR_VOLTAGE,
188 .id = MC13783_REGU_VVIB,
189 .owner = THIS_MODULE,
190 },
191 .reg = MC13783_REG_REGULATOR_MODE_1,
192 .enable_bit = MC13783_REGCTRL_VVIB_EN,
193 },
194 [MC13783_REGU_VRF1] = {
195 .desc = {
196 .name = "REGU_VRF1",
197 .ops = &mc13783_regulator_ops,
198 .type = REGULATOR_VOLTAGE,
199 .id = MC13783_REGU_VRF1,
200 .owner = THIS_MODULE,
201 },
202 .reg = MC13783_REG_REGULATOR_MODE_1,
203 .enable_bit = MC13783_REGCTRL_VRF1_EN,
204 },
205 [MC13783_REGU_VRF2] = {
206 .desc = {
207 .name = "REGU_VRF2",
208 .ops = &mc13783_regulator_ops,
209 .type = REGULATOR_VOLTAGE,
210 .id = MC13783_REGU_VRF2,
211 .owner = THIS_MODULE,
212 },
213 .reg = MC13783_REG_REGULATOR_MODE_1,
214 .enable_bit = MC13783_REGCTRL_VRF2_EN,
215 },
216 [MC13783_REGU_VMMC1] = {
217 .desc = {
218 .name = "REGU_VMMC1",
219 .ops = &mc13783_regulator_ops,
220 .type = REGULATOR_VOLTAGE,
221 .id = MC13783_REGU_VMMC1,
222 .owner = THIS_MODULE,
223 },
224 .reg = MC13783_REG_REGULATOR_MODE_1,
225 .enable_bit = MC13783_REGCTRL_VMMC1_EN,
226 },
227 [MC13783_REGU_VMMC2] = {
228 .desc = {
229 .name = "REGU_VMMC2",
230 .ops = &mc13783_regulator_ops,
231 .type = REGULATOR_VOLTAGE,
232 .id = MC13783_REGU_VMMC2,
233 .owner = THIS_MODULE,
234 },
235 .reg = MC13783_REG_REGULATOR_MODE_1,
236 .enable_bit = MC13783_REGCTRL_VMMC2_EN,
237 },
238 [MC13783_REGU_GPO1] = {
239 .desc = {
240 .name = "REGU_GPO1",
241 .ops = &mc13783_regulator_ops,
242 .type = REGULATOR_VOLTAGE,
243 .id = MC13783_REGU_GPO1,
244 .owner = THIS_MODULE,
245 },
246 .reg = MC13783_REG_POWER_MISCELLANEOUS,
247 .enable_bit = MC13783_REGCTRL_GPO1_EN,
248 },
249 [MC13783_REGU_GPO2] = {
250 .desc = {
251 .name = "REGU_GPO2",
252 .ops = &mc13783_regulator_ops,
253 .type = REGULATOR_VOLTAGE,
254 .id = MC13783_REGU_GPO2,
255 .owner = THIS_MODULE,
256 },
257 .reg = MC13783_REG_POWER_MISCELLANEOUS,
258 .enable_bit = MC13783_REGCTRL_GPO2_EN,
259 },
260 [MC13783_REGU_GPO3] = {
261 .desc = {
262 .name = "REGU_GPO3",
263 .ops = &mc13783_regulator_ops,
264 .type = REGULATOR_VOLTAGE,
265 .id = MC13783_REGU_GPO3,
266 .owner = THIS_MODULE,
267 },
268 .reg = MC13783_REG_POWER_MISCELLANEOUS,
269 .enable_bit = MC13783_REGCTRL_GPO3_EN,
270 },
271 [MC13783_REGU_GPO4] = {
272 .desc = {
273 .name = "REGU_GPO4",
274 .ops = &mc13783_regulator_ops,
275 .type = REGULATOR_VOLTAGE,
276 .id = MC13783_REGU_GPO4,
277 .owner = THIS_MODULE,
278 },
279 .reg = MC13783_REG_POWER_MISCELLANEOUS,
280 .enable_bit = MC13783_REGCTRL_GPO4_EN,
281 },
282};
283
284struct mc13783_priv {
285 struct regulator_desc desc[ARRAY_SIZE(mc13783_regulators)];
286 struct mc13783 *mc13783;
287 struct regulator_dev *regulators[0];
288};
289
290static int mc13783_enable(struct regulator_dev *rdev)
291{
292 struct mc13783_priv *priv = rdev_get_drvdata(rdev);
293 int id = rdev_get_id(rdev);
294
295 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
296
297 return mc13783_set_bits(priv->mc13783, mc13783_regulators[id].reg,
298 mc13783_regulators[id].enable_bit,
299 mc13783_regulators[id].enable_bit);
300}
301
302static int mc13783_disable(struct regulator_dev *rdev)
303{
304 struct mc13783_priv *priv = rdev_get_drvdata(rdev);
305 int id = rdev_get_id(rdev);
306
307 dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
308
309 return mc13783_set_bits(priv->mc13783, mc13783_regulators[id].reg,
310 mc13783_regulators[id].enable_bit, 0);
311}
312
313static int mc13783_is_enabled(struct regulator_dev *rdev)
314{
315 struct mc13783_priv *priv = rdev_get_drvdata(rdev);
316 int ret, id = rdev_get_id(rdev);
317 unsigned int val;
318
319 ret = mc13783_reg_read(priv->mc13783, mc13783_regulators[id].reg, &val);
320 if (ret)
321 return ret;
322
323 return (val & mc13783_regulators[id].enable_bit) != 0;
324}
325
326static struct regulator_ops mc13783_regulator_ops = {
327 .enable = mc13783_enable,
328 .disable = mc13783_disable,
329 .is_enabled = mc13783_is_enabled,
330};
331
332static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
333{
334 struct mc13783_priv *priv;
335 struct mc13783 *mc13783 = dev_get_drvdata(pdev->dev.parent);
336 struct mc13783_regulator_init_data *init_data;
337 int i, ret;
338
339 dev_dbg(&pdev->dev, "mc13783_regulator_probe id %d\n", pdev->id);
340
341 priv = kzalloc(sizeof(*priv) + mc13783->num_regulators * sizeof(void *),
342 GFP_KERNEL);
343 if (!priv)
344 return -ENOMEM;
345
346 priv->mc13783 = mc13783;
347
348 for (i = 0; i < mc13783->num_regulators; i++) {
349 init_data = &mc13783->regulators[i];
350 priv->regulators[i] = regulator_register(
351 &mc13783_regulators[init_data->id].desc,
352 &pdev->dev, init_data->init_data, priv);
353
354 if (IS_ERR(priv->regulators[i])) {
355 dev_err(&pdev->dev, "failed to register regulator %s\n",
356 mc13783_regulators[i].desc.name);
357 ret = PTR_ERR(priv->regulators[i]);
358 goto err;
359 }
360 }
361
362 platform_set_drvdata(pdev, priv);
363
364 return 0;
365err:
366 while (--i >= 0)
367 regulator_unregister(priv->regulators[i]);
368
369 kfree(priv);
370
371 return ret;
372}
373
374static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
375{
376 struct mc13783_priv *priv = platform_get_drvdata(pdev);
377 struct mc13783 *mc13783 = priv->mc13783;
378 int i;
379
380 for (i = 0; i < mc13783->num_regulators; i++)
381 regulator_unregister(priv->regulators[i]);
382
383 return 0;
384}
385
386static struct platform_driver mc13783_regulator_driver = {
387 .driver = {
388 .name = "mc13783-regulator",
389 .owner = THIS_MODULE,
390 },
391 .remove = __devexit_p(mc13783_regulator_remove),
392};
393
394static int __init mc13783_regulator_init(void)
395{
396 return platform_driver_probe(&mc13783_regulator_driver,
397 mc13783_regulator_probe);
398}
399subsys_initcall(mc13783_regulator_init);
400
401static void __exit mc13783_regulator_exit(void)
402{
403 platform_driver_unregister(&mc13783_regulator_driver);
404}
405module_exit(mc13783_regulator_exit);
406
407MODULE_LICENSE("GPL");
408MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de");
409MODULE_DESCRIPTION("Regulator Driver for Freescale MC13783 PMIC");
410MODULE_ALIAS("platform:mc13783-regulator");
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 7ea1c3a31081..7e674859bd59 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -12,6 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/delay.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/regulator/driver.h> 17#include <linux/regulator/driver.h>
17#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
@@ -40,6 +41,12 @@ struct twlreg_info {
40 u8 table_len; 41 u8 table_len;
41 const u16 *table; 42 const u16 *table;
42 43
44 /* regulator specific turn-on delay */
45 u16 delay;
46
47 /* State REMAP default configuration */
48 u8 remap;
49
43 /* chip constraints on regulator behavior */ 50 /* chip constraints on regulator behavior */
44 u16 min_mV; 51 u16 min_mV;
45 52
@@ -128,6 +135,7 @@ static int twlreg_enable(struct regulator_dev *rdev)
128{ 135{
129 struct twlreg_info *info = rdev_get_drvdata(rdev); 136 struct twlreg_info *info = rdev_get_drvdata(rdev);
130 int grp; 137 int grp;
138 int ret;
131 139
132 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); 140 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
133 if (grp < 0) 141 if (grp < 0)
@@ -138,7 +146,11 @@ static int twlreg_enable(struct regulator_dev *rdev)
138 else 146 else
139 grp |= P1_GRP_6030; 147 grp |= P1_GRP_6030;
140 148
141 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); 149 ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
150
151 udelay(info->delay);
152
153 return ret;
142} 154}
143 155
144static int twlreg_disable(struct regulator_dev *rdev) 156static int twlreg_disable(struct regulator_dev *rdev)
@@ -151,9 +163,9 @@ static int twlreg_disable(struct regulator_dev *rdev)
151 return grp; 163 return grp;
152 164
153 if (twl_class_is_4030()) 165 if (twl_class_is_4030())
154 grp &= ~P1_GRP_4030; 166 grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
155 else 167 else
156 grp &= ~P1_GRP_6030; 168 grp &= ~(P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030);
157 169
158 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); 170 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
159} 171}
@@ -294,6 +306,18 @@ static const u16 VSIM_VSEL_table[] = {
294static const u16 VDAC_VSEL_table[] = { 306static const u16 VDAC_VSEL_table[] = {
295 1200, 1300, 1800, 1800, 307 1200, 1300, 1800, 1800,
296}; 308};
309static const u16 VDD1_VSEL_table[] = {
310 800, 1450,
311};
312static const u16 VDD2_VSEL_table[] = {
313 800, 1450, 1500,
314};
315static const u16 VIO_VSEL_table[] = {
316 1800, 1850,
317};
318static const u16 VINTANA2_VSEL_table[] = {
319 2500, 2750,
320};
297static const u16 VAUX1_6030_VSEL_table[] = { 321static const u16 VAUX1_6030_VSEL_table[] = {
298 1000, 1300, 1800, 2500, 322 1000, 1300, 1800, 2500,
299 2800, 2900, 3000, 3000, 323 2800, 2900, 3000, 3000,
@@ -414,20 +438,30 @@ static struct regulator_ops twlfixed_ops = {
414 438
415/*----------------------------------------------------------------------*/ 439/*----------------------------------------------------------------------*/
416 440
417#define TWL4030_ADJUSTABLE_LDO(label, offset, num) \ 441#define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \
418 TWL_ADJUSTABLE_LDO(label, offset, num, TWL4030) 442 TWL_ADJUSTABLE_LDO(label, offset, num, turnon_delay, \
419#define TWL4030_FIXED_LDO(label, offset, mVolts, num) \ 443 remap_conf, TWL4030)
420 TWL_FIXED_LDO(label, offset, mVolts, num, TWL4030) 444#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
421#define TWL6030_ADJUSTABLE_LDO(label, offset, num) \ 445 remap_conf) \
422 TWL_ADJUSTABLE_LDO(label, offset, num, TWL6030) 446 TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
423#define TWL6030_FIXED_LDO(label, offset, mVolts, num) \ 447 remap_conf, TWL4030)
424 TWL_FIXED_LDO(label, offset, mVolts, num, TWL6030) 448#define TWL6030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, \
425 449 remap_conf) \
426#define TWL_ADJUSTABLE_LDO(label, offset, num, family) { \ 450 TWL_ADJUSTABLE_LDO(label, offset, num, turnon_delay, \
451 remap_conf, TWL6030)
452#define TWL6030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
453 remap_conf) \
454 TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
455 remap_conf, TWL6030)
456
457#define TWL_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf, \
458 family) { \
427 .base = offset, \ 459 .base = offset, \
428 .id = num, \ 460 .id = num, \
429 .table_len = ARRAY_SIZE(label##_VSEL_table), \ 461 .table_len = ARRAY_SIZE(label##_VSEL_table), \
430 .table = label##_VSEL_table, \ 462 .table = label##_VSEL_table, \
463 .delay = turnon_delay, \
464 .remap = remap_conf, \
431 .desc = { \ 465 .desc = { \
432 .name = #label, \ 466 .name = #label, \
433 .id = family##_REG_##label, \ 467 .id = family##_REG_##label, \
@@ -438,10 +472,13 @@ static struct regulator_ops twlfixed_ops = {
438 }, \ 472 }, \
439 } 473 }
440 474
441#define TWL_FIXED_LDO(label, offset, mVolts, num, family) { \ 475#define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \
476 family) { \
442 .base = offset, \ 477 .base = offset, \
443 .id = num, \ 478 .id = num, \
444 .min_mV = mVolts, \ 479 .min_mV = mVolts, \
480 .delay = turnon_delay, \
481 .remap = remap_conf, \
445 .desc = { \ 482 .desc = { \
446 .name = #label, \ 483 .name = #label, \
447 .id = family##_REG_##label, \ 484 .id = family##_REG_##label, \
@@ -457,43 +494,41 @@ static struct regulator_ops twlfixed_ops = {
457 * software control over them after boot. 494 * software control over them after boot.
458 */ 495 */
459static struct twlreg_info twl_regs[] = { 496static struct twlreg_info twl_regs[] = {
460 TWL4030_ADJUSTABLE_LDO(VAUX1, 0x17, 1), 497 TWL4030_ADJUSTABLE_LDO(VAUX1, 0x17, 1, 100, 0x08),
461 TWL4030_ADJUSTABLE_LDO(VAUX2_4030, 0x1b, 2), 498 TWL4030_ADJUSTABLE_LDO(VAUX2_4030, 0x1b, 2, 100, 0x08),
462 TWL4030_ADJUSTABLE_LDO(VAUX2, 0x1b, 2), 499 TWL4030_ADJUSTABLE_LDO(VAUX2, 0x1b, 2, 100, 0x08),
463 TWL4030_ADJUSTABLE_LDO(VAUX3, 0x1f, 3), 500 TWL4030_ADJUSTABLE_LDO(VAUX3, 0x1f, 3, 100, 0x08),
464 TWL4030_ADJUSTABLE_LDO(VAUX4, 0x23, 4), 501 TWL4030_ADJUSTABLE_LDO(VAUX4, 0x23, 4, 100, 0x08),
465 TWL4030_ADJUSTABLE_LDO(VMMC1, 0x27, 5), 502 TWL4030_ADJUSTABLE_LDO(VMMC1, 0x27, 5, 100, 0x08),
466 TWL4030_ADJUSTABLE_LDO(VMMC2, 0x2b, 6), 503 TWL4030_ADJUSTABLE_LDO(VMMC2, 0x2b, 6, 100, 0x08),
467 /* 504 TWL4030_ADJUSTABLE_LDO(VPLL1, 0x2f, 7, 100, 0x00),
468 TWL4030_ADJUSTABLE_LDO(VPLL1, 0x2f, 7), 505 TWL4030_ADJUSTABLE_LDO(VPLL2, 0x33, 8, 100, 0x08),
469 */ 506 TWL4030_ADJUSTABLE_LDO(VSIM, 0x37, 9, 100, 0x00),
470 TWL4030_ADJUSTABLE_LDO(VPLL2, 0x33, 8), 507 TWL4030_ADJUSTABLE_LDO(VDAC, 0x3b, 10, 100, 0x08),
471 TWL4030_ADJUSTABLE_LDO(VSIM, 0x37, 9), 508 TWL4030_FIXED_LDO(VINTANA1, 0x3f, 1500, 11, 100, 0x08),
472 TWL4030_ADJUSTABLE_LDO(VDAC, 0x3b, 10), 509 TWL4030_ADJUSTABLE_LDO(VINTANA2, 0x43, 12, 100, 0x08),
473 /* 510 TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08),
474 TWL4030_ADJUSTABLE_LDO(VINTANA1, 0x3f, 11), 511 TWL4030_ADJUSTABLE_LDO(VIO, 0x4b, 14, 1000, 0x08),
475 TWL4030_ADJUSTABLE_LDO(VINTANA2, 0x43, 12), 512 TWL4030_ADJUSTABLE_LDO(VDD1, 0x55, 15, 1000, 0x08),
476 TWL4030_ADJUSTABLE_LDO(VINTDIG, 0x47, 13), 513 TWL4030_ADJUSTABLE_LDO(VDD2, 0x63, 16, 1000, 0x08),
477 TWL4030_SMPS(VIO, 0x4b, 14), 514 TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08),
478 TWL4030_SMPS(VDD1, 0x55, 15), 515 TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08),
479 TWL4030_SMPS(VDD2, 0x63, 16), 516 TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19, 150, 0x08),
480 */
481 TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17),
482 TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18),
483 TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19),
484 /* VUSBCP is managed *only* by the USB subchip */ 517 /* VUSBCP is managed *only* by the USB subchip */
485 518
486 /* 6030 REG with base as PMC Slave Misc : 0x0030 */ 519 /* 6030 REG with base as PMC Slave Misc : 0x0030 */
487 TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1), 520 /* Turnon-delay and remap configuration values for 6030 are not
488 TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 2), 521 verified since the specification is not public */
489 TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 3), 522 TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1, 0, 0x08),
490 TWL6030_ADJUSTABLE_LDO(VMMC, 0x68, 4), 523 TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 2, 0, 0x08),
491 TWL6030_ADJUSTABLE_LDO(VPP, 0x6c, 5), 524 TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 3, 0, 0x08),
492 TWL6030_ADJUSTABLE_LDO(VUSIM, 0x74, 7), 525 TWL6030_ADJUSTABLE_LDO(VMMC, 0x68, 4, 0, 0x08),
493 TWL6030_FIXED_LDO(VANA, 0x50, 2100, 15), 526 TWL6030_ADJUSTABLE_LDO(VPP, 0x6c, 5, 0, 0x08),
494 TWL6030_FIXED_LDO(VCXIO, 0x60, 1800, 16), 527 TWL6030_ADJUSTABLE_LDO(VUSIM, 0x74, 7, 0, 0x08),
495 TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 17), 528 TWL6030_FIXED_LDO(VANA, 0x50, 2100, 15, 0, 0x08),
496 TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 18) 529 TWL6030_FIXED_LDO(VCXIO, 0x60, 1800, 16, 0, 0x08),
530 TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 17, 0, 0x08),
531 TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 18, 0, 0x08)
497}; 532};
498 533
499static int twlreg_probe(struct platform_device *pdev) 534static int twlreg_probe(struct platform_device *pdev)
@@ -525,6 +560,19 @@ static int twlreg_probe(struct platform_device *pdev)
525 c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE 560 c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE
526 | REGULATOR_CHANGE_MODE 561 | REGULATOR_CHANGE_MODE
527 | REGULATOR_CHANGE_STATUS; 562 | REGULATOR_CHANGE_STATUS;
563 switch (pdev->id) {
564 case TWL4030_REG_VIO:
565 case TWL4030_REG_VDD1:
566 case TWL4030_REG_VDD2:
567 case TWL4030_REG_VPLL1:
568 case TWL4030_REG_VINTANA1:
569 case TWL4030_REG_VINTANA2:
570 case TWL4030_REG_VINTDIG:
571 c->always_on = true;
572 break;
573 default:
574 break;
575 }
528 576
529 rdev = regulator_register(&info->desc, &pdev->dev, initdata, info); 577 rdev = regulator_register(&info->desc, &pdev->dev, initdata, info);
530 if (IS_ERR(rdev)) { 578 if (IS_ERR(rdev)) {
@@ -534,6 +582,9 @@ static int twlreg_probe(struct platform_device *pdev)
534 } 582 }
535 platform_set_drvdata(pdev, rdev); 583 platform_set_drvdata(pdev, rdev);
536 584
585 twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_REMAP,
586 info->remap);
587
537 /* NOTE: many regulators support short-circuit IRQs (presentable 588 /* NOTE: many regulators support short-circuit IRQs (presentable
538 * as REGULATOR_OVER_CURRENT notifications?) configured via: 589 * as REGULATOR_OVER_CURRENT notifications?) configured via:
539 * - SC_CONFIG 590 * - SC_CONFIG
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 2eefc1a0cf08..0a6577577e8d 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -19,6 +19,8 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/regulator/driver.h> 21#include <linux/regulator/driver.h>
22#include <linux/regulator/machine.h>
23#include <linux/gpio.h>
22 24
23#include <linux/mfd/wm831x/core.h> 25#include <linux/mfd/wm831x/core.h>
24#include <linux/mfd/wm831x/regulator.h> 26#include <linux/mfd/wm831x/regulator.h>
@@ -39,6 +41,7 @@
39#define WM831X_DCDC_CONTROL_2 1 41#define WM831X_DCDC_CONTROL_2 1
40#define WM831X_DCDC_ON_CONFIG 2 42#define WM831X_DCDC_ON_CONFIG 2
41#define WM831X_DCDC_SLEEP_CONTROL 3 43#define WM831X_DCDC_SLEEP_CONTROL 3
44#define WM831X_DCDC_DVS_CONTROL 4
42 45
43/* 46/*
44 * Shared 47 * Shared
@@ -50,6 +53,10 @@ struct wm831x_dcdc {
50 int base; 53 int base;
51 struct wm831x *wm831x; 54 struct wm831x *wm831x;
52 struct regulator_dev *regulator; 55 struct regulator_dev *regulator;
56 int dvs_gpio;
57 int dvs_gpio_state;
58 int on_vsel;
59 int dvs_vsel;
53}; 60};
54 61
55static int wm831x_dcdc_is_enabled(struct regulator_dev *rdev) 62static int wm831x_dcdc_is_enabled(struct regulator_dev *rdev)
@@ -240,11 +247,9 @@ static int wm831x_buckv_list_voltage(struct regulator_dev *rdev,
240 return -EINVAL; 247 return -EINVAL;
241} 248}
242 249
243static int wm831x_buckv_set_voltage_int(struct regulator_dev *rdev, int reg, 250static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev,
244 int min_uV, int max_uV) 251 int min_uV, int max_uV)
245{ 252{
246 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
247 struct wm831x *wm831x = dcdc->wm831x;
248 u16 vsel; 253 u16 vsel;
249 254
250 if (min_uV < 600000) 255 if (min_uV < 600000)
@@ -257,39 +262,126 @@ static int wm831x_buckv_set_voltage_int(struct regulator_dev *rdev, int reg,
257 if (wm831x_buckv_list_voltage(rdev, vsel) > max_uV) 262 if (wm831x_buckv_list_voltage(rdev, vsel) > max_uV)
258 return -EINVAL; 263 return -EINVAL;
259 264
260 return wm831x_set_bits(wm831x, reg, WM831X_DC1_ON_VSEL_MASK, vsel); 265 return vsel;
266}
267
268static int wm831x_buckv_select_max_voltage(struct regulator_dev *rdev,
269 int min_uV, int max_uV)
270{
271 u16 vsel;
272
273 if (max_uV < 600000 || max_uV > 1800000)
274 return -EINVAL;
275
276 vsel = ((max_uV - 600000) / 12500) + 8;
277
278 if (wm831x_buckv_list_voltage(rdev, vsel) < min_uV ||
279 wm831x_buckv_list_voltage(rdev, vsel) < max_uV)
280 return -EINVAL;
281
282 return vsel;
283}
284
285static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
286{
287 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
288
289 if (state == dcdc->dvs_gpio_state)
290 return 0;
291
292 dcdc->dvs_gpio_state = state;
293 gpio_set_value(dcdc->dvs_gpio, state);
294
295 /* Should wait for DVS state change to be asserted if we have
296 * a GPIO for it, for now assume the device is configured
297 * for the fastest possible transition.
298 */
299
300 return 0;
261} 301}
262 302
263static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, 303static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
264 int min_uV, int max_uV) 304 int min_uV, int max_uV)
265{ 305{
266 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); 306 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
267 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG; 307 struct wm831x *wm831x = dcdc->wm831x;
308 int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
309 int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
310 int vsel, ret;
311
312 vsel = wm831x_buckv_select_min_voltage(rdev, min_uV, max_uV);
313 if (vsel < 0)
314 return vsel;
315
316 /* If this value is already set then do a GPIO update if we can */
317 if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
318 return wm831x_buckv_set_dvs(rdev, 0);
319
320 if (dcdc->dvs_gpio && dcdc->dvs_vsel == vsel)
321 return wm831x_buckv_set_dvs(rdev, 1);
322
323 /* Always set the ON status to the minimum voltage */
324 ret = wm831x_set_bits(wm831x, on_reg, WM831X_DC1_ON_VSEL_MASK, vsel);
325 if (ret < 0)
326 return ret;
327 dcdc->on_vsel = vsel;
328
329 if (!dcdc->dvs_gpio)
330 return ret;
331
332 /* Kick the voltage transition now */
333 ret = wm831x_buckv_set_dvs(rdev, 0);
334 if (ret < 0)
335 return ret;
336
337 /* Set the high voltage as the DVS voltage. This is optimised
338 * for CPUfreq usage, most processors will keep the maximum
339 * voltage constant and lower the minimum with the frequency. */
340 vsel = wm831x_buckv_select_max_voltage(rdev, min_uV, max_uV);
341 if (vsel < 0) {
342 /* This should never happen - at worst the same vsel
343 * should be chosen */
344 WARN_ON(vsel < 0);
345 return 0;
346 }
347
348 /* Don't bother if it's the same VSEL we're already using */
349 if (vsel == dcdc->on_vsel)
350 return 0;
268 351
269 return wm831x_buckv_set_voltage_int(rdev, reg, min_uV, max_uV); 352 ret = wm831x_set_bits(wm831x, dvs_reg, WM831X_DC1_DVS_VSEL_MASK, vsel);
353 if (ret == 0)
354 dcdc->dvs_vsel = vsel;
355 else
356 dev_warn(wm831x->dev, "Failed to set DCDC DVS VSEL: %d\n",
357 ret);
358
359 return 0;
270} 360}
271 361
272static int wm831x_buckv_set_suspend_voltage(struct regulator_dev *rdev, 362static int wm831x_buckv_set_suspend_voltage(struct regulator_dev *rdev,
273 int uV) 363 int uV)
274{ 364{
275 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); 365 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
366 struct wm831x *wm831x = dcdc->wm831x;
276 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL; 367 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
368 int vsel;
369
370 vsel = wm831x_buckv_select_min_voltage(rdev, uV, uV);
371 if (vsel < 0)
372 return vsel;
277 373
278 return wm831x_buckv_set_voltage_int(rdev, reg, uV, uV); 374 return wm831x_set_bits(wm831x, reg, WM831X_DC1_SLP_VSEL_MASK, vsel);
279} 375}
280 376
281static int wm831x_buckv_get_voltage(struct regulator_dev *rdev) 377static int wm831x_buckv_get_voltage(struct regulator_dev *rdev)
282{ 378{
283 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); 379 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
284 struct wm831x *wm831x = dcdc->wm831x;
285 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
286 int val;
287 380
288 val = wm831x_reg_read(wm831x, reg); 381 if (dcdc->dvs_gpio && dcdc->dvs_gpio_state)
289 if (val < 0) 382 return wm831x_buckv_list_voltage(rdev, dcdc->dvs_vsel);
290 return val; 383 else
291 384 return wm831x_buckv_list_voltage(rdev, dcdc->on_vsel);
292 return wm831x_buckv_list_voltage(rdev, val & WM831X_DC1_ON_VSEL_MASK);
293} 385}
294 386
295/* Current limit options */ 387/* Current limit options */
@@ -346,6 +438,64 @@ static struct regulator_ops wm831x_buckv_ops = {
346 .set_suspend_mode = wm831x_dcdc_set_suspend_mode, 438 .set_suspend_mode = wm831x_dcdc_set_suspend_mode,
347}; 439};
348 440
441/*
442 * Set up DVS control. We just log errors since we can still run
443 * (with reduced performance) if we fail.
444 */
445static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc,
446 struct wm831x_buckv_pdata *pdata)
447{
448 struct wm831x *wm831x = dcdc->wm831x;
449 int ret;
450 u16 ctrl;
451
452 if (!pdata || !pdata->dvs_gpio)
453 return;
454
455 switch (pdata->dvs_control_src) {
456 case 1:
457 ctrl = 2 << WM831X_DC1_DVS_SRC_SHIFT;
458 break;
459 case 2:
460 ctrl = 3 << WM831X_DC1_DVS_SRC_SHIFT;
461 break;
462 default:
463 dev_err(wm831x->dev, "Invalid DVS control source %d for %s\n",
464 pdata->dvs_control_src, dcdc->name);
465 return;
466 }
467
468 ret = wm831x_set_bits(wm831x, dcdc->base + WM831X_DCDC_DVS_CONTROL,
469 WM831X_DC1_DVS_SRC_MASK, ctrl);
470 if (ret < 0) {
471 dev_err(wm831x->dev, "Failed to set %s DVS source: %d\n",
472 dcdc->name, ret);
473 return;
474 }
475
476 ret = gpio_request(pdata->dvs_gpio, "DCDC DVS");
477 if (ret < 0) {
478 dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n",
479 dcdc->name, ret);
480 return;
481 }
482
483 /* gpiolib won't let us read the GPIO status so pick the higher
484 * of the two existing voltages so we take it as platform data.
485 */
486 dcdc->dvs_gpio_state = pdata->dvs_init_state;
487
488 ret = gpio_direction_output(pdata->dvs_gpio, dcdc->dvs_gpio_state);
489 if (ret < 0) {
490 dev_err(wm831x->dev, "Failed to enable %s DVS GPIO: %d\n",
491 dcdc->name, ret);
492 gpio_free(pdata->dvs_gpio);
493 return;
494 }
495
496 dcdc->dvs_gpio = pdata->dvs_gpio;
497}
498
349static __devinit int wm831x_buckv_probe(struct platform_device *pdev) 499static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
350{ 500{
351 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 501 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
@@ -384,6 +534,23 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
384 dcdc->desc.ops = &wm831x_buckv_ops; 534 dcdc->desc.ops = &wm831x_buckv_ops;
385 dcdc->desc.owner = THIS_MODULE; 535 dcdc->desc.owner = THIS_MODULE;
386 536
537 ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG);
538 if (ret < 0) {
539 dev_err(wm831x->dev, "Failed to read ON VSEL: %d\n", ret);
540 goto err;
541 }
542 dcdc->on_vsel = ret & WM831X_DC1_ON_VSEL_MASK;
543
544 ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG);
545 if (ret < 0) {
546 dev_err(wm831x->dev, "Failed to read DVS VSEL: %d\n", ret);
547 goto err;
548 }
549 dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK;
550
551 if (pdata->dcdc[id])
552 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data);
553
387 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 554 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev,
388 pdata->dcdc[id], dcdc); 555 pdata->dcdc[id], dcdc);
389 if (IS_ERR(dcdc->regulator)) { 556 if (IS_ERR(dcdc->regulator)) {
@@ -422,6 +589,8 @@ err_uv:
422err_regulator: 589err_regulator:
423 regulator_unregister(dcdc->regulator); 590 regulator_unregister(dcdc->regulator);
424err: 591err:
592 if (dcdc->dvs_gpio)
593 gpio_free(dcdc->dvs_gpio);
425 kfree(dcdc); 594 kfree(dcdc);
426 return ret; 595 return ret;
427} 596}
@@ -434,6 +603,8 @@ static __devexit int wm831x_buckv_remove(struct platform_device *pdev)
434 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "HC"), dcdc); 603 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "HC"), dcdc);
435 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "UV"), dcdc); 604 wm831x_free_irq(wm831x, platform_get_irq_byname(pdev, "UV"), dcdc);
436 regulator_unregister(dcdc->regulator); 605 regulator_unregister(dcdc->regulator);
606 if (dcdc->dvs_gpio)
607 gpio_free(dcdc->dvs_gpio);
437 kfree(dcdc); 608 kfree(dcdc);
438 609
439 return 0; 610 return 0;
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 902db56ce099..61e02ac2fda3 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -470,7 +470,7 @@ static unsigned int wm831x_aldo_get_mode(struct regulator_dev *rdev)
470 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); 470 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
471 struct wm831x *wm831x = ldo->wm831x; 471 struct wm831x *wm831x = ldo->wm831x;
472 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; 472 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
473 unsigned int ret; 473 int ret;
474 474
475 ret = wm831x_reg_read(wm831x, on_reg); 475 ret = wm831x_reg_read(wm831x, on_reg);
476 if (ret < 0) 476 if (ret < 0)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index eb154dc57164..e9aa814ddd23 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -686,7 +686,8 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
686 */ 686 */
687#if defined(CONFIG_ATARI) 687#if defined(CONFIG_ATARI)
688 address_space = 64; 688 address_space = 64;
689#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__sparc__) 689#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) \
690 || defined(__sparc__) || defined(__mips__)
690 address_space = 128; 691 address_space = 128;
691#else 692#else
692#warning Assuming 128 bytes of RTC+NVRAM address space, not 64 bytes. 693#warning Assuming 128 bytes of RTC+NVRAM address space, not 64 bytes.
@@ -1095,9 +1096,9 @@ static int cmos_pnp_resume(struct pnp_dev *pnp)
1095#define cmos_pnp_resume NULL 1096#define cmos_pnp_resume NULL
1096#endif 1097#endif
1097 1098
1098static void cmos_pnp_shutdown(struct device *pdev) 1099static void cmos_pnp_shutdown(struct pnp_dev *pnp)
1099{ 1100{
1100 if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(pdev)) 1101 if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pnp->dev))
1101 return; 1102 return;
1102 1103
1103 cmos_do_shutdown(); 1104 cmos_do_shutdown();
@@ -1116,15 +1117,12 @@ static struct pnp_driver cmos_pnp_driver = {
1116 .id_table = rtc_ids, 1117 .id_table = rtc_ids,
1117 .probe = cmos_pnp_probe, 1118 .probe = cmos_pnp_probe,
1118 .remove = __exit_p(cmos_pnp_remove), 1119 .remove = __exit_p(cmos_pnp_remove),
1120 .shutdown = cmos_pnp_shutdown,
1119 1121
1120 /* flag ensures resume() gets called, and stops syslog spam */ 1122 /* flag ensures resume() gets called, and stops syslog spam */
1121 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, 1123 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
1122 .suspend = cmos_pnp_suspend, 1124 .suspend = cmos_pnp_suspend,
1123 .resume = cmos_pnp_resume, 1125 .resume = cmos_pnp_resume,
1124 .driver = {
1125 .name = (char *)driver_name,
1126 .shutdown = cmos_pnp_shutdown,
1127 }
1128}; 1126};
1129 1127
1130#endif /* CONFIG_PNP */ 1128#endif /* CONFIG_PNP */
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 259db7f3535b..9630e7d3314e 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -778,6 +778,8 @@ static int __devinit ds1305_probe(struct spi_device *spi)
778 spi->irq, status); 778 spi->irq, status);
779 goto fail1; 779 goto fail1;
780 } 780 }
781
782 device_set_wakeup_capable(&spi->dev, 1);
781 } 783 }
782 784
783 /* export NVRAM */ 785 /* export NVRAM */
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 8a99da6f2f24..c4ec5c158aa1 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -881,6 +881,8 @@ read_rtc:
881 "unable to request IRQ!\n"); 881 "unable to request IRQ!\n");
882 goto exit_irq; 882 goto exit_irq;
883 } 883 }
884
885 device_set_wakeup_capable(&client->dev, 1);
884 set_bit(HAS_ALARM, &ds1307->flags); 886 set_bit(HAS_ALARM, &ds1307->flags);
885 dev_dbg(&client->dev, "got IRQ %d\n", client->irq); 887 dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
886 } 888 }
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 713f7bf5afb3..5317bbcbc7a0 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -383,6 +383,8 @@ static int ds1374_probe(struct i2c_client *client,
383 dev_err(&client->dev, "unable to request IRQ\n"); 383 dev_err(&client->dev, "unable to request IRQ\n");
384 goto out_free; 384 goto out_free;
385 } 385 }
386
387 device_set_wakeup_capable(&client->dev, 1);
386 } 388 }
387 389
388 ds1374->rtc = rtc_device_register(client->name, &client->dev, 390 ds1374->rtc = rtc_device_register(client->name, &client->dev,
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index fd1231738ef4..148b1dd24070 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -218,7 +218,7 @@ int dasd_alias_make_device_known_to_lcu(struct dasd_device *device)
218 spin_unlock_irqrestore(&aliastree.lock, flags); 218 spin_unlock_irqrestore(&aliastree.lock, flags);
219 newlcu = _allocate_lcu(uid); 219 newlcu = _allocate_lcu(uid);
220 if (IS_ERR(newlcu)) 220 if (IS_ERR(newlcu))
221 return PTR_ERR(lcu); 221 return PTR_ERR(newlcu);
222 spin_lock_irqsave(&aliastree.lock, flags); 222 spin_lock_irqsave(&aliastree.lock, flags);
223 lcu = _find_lcu(server, uid); 223 lcu = _find_lcu(server, uid);
224 if (!lcu) { 224 if (!lcu) {
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index f64d0db881b4..6e14863f5c70 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -8,7 +8,7 @@
8 * 8 *
9 */ 9 */
10 10
11#define KMSG_COMPONENT "dasd-diag" 11#define KMSG_COMPONENT "dasd"
12 12
13#include <linux/stddef.h> 13#include <linux/stddef.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
@@ -146,16 +146,16 @@ dasd_diag_erp(struct dasd_device *device)
146 rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); 146 rc = mdsk_init_io(device, device->block->bp_block, 0, NULL);
147 if (rc == 4) { 147 if (rc == 4) {
148 if (!(device->features & DASD_FEATURE_READONLY)) { 148 if (!(device->features & DASD_FEATURE_READONLY)) {
149 dev_warn(&device->cdev->dev, 149 pr_warning("%s: The access mode of a DIAG device "
150 "The access mode of a DIAG device changed" 150 "changed to read-only\n",
151 " to read-only"); 151 dev_name(&device->cdev->dev));
152 device->features |= DASD_FEATURE_READONLY; 152 device->features |= DASD_FEATURE_READONLY;
153 } 153 }
154 rc = 0; 154 rc = 0;
155 } 155 }
156 if (rc) 156 if (rc)
157 dev_warn(&device->cdev->dev, "DIAG ERP failed with " 157 pr_warning("%s: DIAG ERP failed with "
158 "rc=%d\n", rc); 158 "rc=%d\n", dev_name(&device->cdev->dev), rc);
159} 159}
160 160
161/* Start a given request at the device. Return zero on success, non-zero 161/* Start a given request at the device. Return zero on success, non-zero
@@ -371,8 +371,9 @@ dasd_diag_check_device(struct dasd_device *device)
371 private->pt_block = 2; 371 private->pt_block = 2;
372 break; 372 break;
373 default: 373 default:
374 dev_warn(&device->cdev->dev, "Device type %d is not supported " 374 pr_warning("%s: Device type %d is not supported "
375 "in DIAG mode\n", private->rdc_data.vdev_class); 375 "in DIAG mode\n", dev_name(&device->cdev->dev),
376 private->rdc_data.vdev_class);
376 rc = -EOPNOTSUPP; 377 rc = -EOPNOTSUPP;
377 goto out; 378 goto out;
378 } 379 }
@@ -413,8 +414,8 @@ dasd_diag_check_device(struct dasd_device *device)
413 private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; 414 private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT;
414 rc = dia250(&private->iob, RW_BIO); 415 rc = dia250(&private->iob, RW_BIO);
415 if (rc == 3) { 416 if (rc == 3) {
416 dev_warn(&device->cdev->dev, 417 pr_warning("%s: A 64-bit DIAG call failed\n",
417 "A 64-bit DIAG call failed\n"); 418 dev_name(&device->cdev->dev));
418 rc = -EOPNOTSUPP; 419 rc = -EOPNOTSUPP;
419 goto out_label; 420 goto out_label;
420 } 421 }
@@ -423,8 +424,9 @@ dasd_diag_check_device(struct dasd_device *device)
423 break; 424 break;
424 } 425 }
425 if (bsize > PAGE_SIZE) { 426 if (bsize > PAGE_SIZE) {
426 dev_warn(&device->cdev->dev, "Accessing the DASD failed because" 427 pr_warning("%s: Accessing the DASD failed because of an "
427 " of an incorrect format (rc=%d)\n", rc); 428 "incorrect format (rc=%d)\n",
429 dev_name(&device->cdev->dev), rc);
428 rc = -EIO; 430 rc = -EIO;
429 goto out_label; 431 goto out_label;
430 } 432 }
@@ -442,18 +444,18 @@ dasd_diag_check_device(struct dasd_device *device)
442 block->s2b_shift++; 444 block->s2b_shift++;
443 rc = mdsk_init_io(device, block->bp_block, 0, NULL); 445 rc = mdsk_init_io(device, block->bp_block, 0, NULL);
444 if (rc && (rc != 4)) { 446 if (rc && (rc != 4)) {
445 dev_warn(&device->cdev->dev, "DIAG initialization " 447 pr_warning("%s: DIAG initialization failed with rc=%d\n",
446 "failed with rc=%d\n", rc); 448 dev_name(&device->cdev->dev), rc);
447 rc = -EIO; 449 rc = -EIO;
448 } else { 450 } else {
449 if (rc == 4) 451 if (rc == 4)
450 device->features |= DASD_FEATURE_READONLY; 452 device->features |= DASD_FEATURE_READONLY;
451 dev_info(&device->cdev->dev, 453 pr_info("%s: New DASD with %ld byte/block, total size %ld "
452 "New DASD with %ld byte/block, total size %ld KB%s\n", 454 "KB%s\n", dev_name(&device->cdev->dev),
453 (unsigned long) block->bp_block, 455 (unsigned long) block->bp_block,
454 (unsigned long) (block->blocks << 456 (unsigned long) (block->blocks <<
455 block->s2b_shift) >> 1, 457 block->s2b_shift) >> 1,
456 (rc == 4) ? ", read-only device" : ""); 458 (rc == 4) ? ", read-only device" : "");
457 rc = 0; 459 rc = 0;
458 } 460 }
459out_label: 461out_label:
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index 28e4649fa9e4..247b2b934728 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -467,7 +467,7 @@ fs3270_open(struct inode *inode, struct file *filp)
467 if (IS_ERR(ib)) { 467 if (IS_ERR(ib)) {
468 raw3270_put_view(&fp->view); 468 raw3270_put_view(&fp->view);
469 raw3270_del_view(&fp->view); 469 raw3270_del_view(&fp->view);
470 rc = PTR_ERR(fp); 470 rc = PTR_ERR(ib);
471 goto out; 471 goto out;
472 } 472 }
473 fp->rdbuf = ib; 473 fp->rdbuf = ib;
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index 3657fe103c27..cb70fa1cf539 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#define KMSG_COMPONENT "tape_34xx" 11#define KMSG_COMPONENT "tape_34xx"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 13
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/init.h> 15#include <linux/init.h>
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 0c72aadb8391..9821c5886613 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#define KMSG_COMPONENT "tape_3590" 11#define KMSG_COMPONENT "tape_3590"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 13
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/init.h> 15#include <linux/init.h>
@@ -136,7 +137,7 @@ static void int_to_ext_kekl(struct tape3592_kekl *in,
136 out->type_on_tape = TAPE390_KEKL_TYPE_LABEL; 137 out->type_on_tape = TAPE390_KEKL_TYPE_LABEL;
137 memcpy(out->label, in->label, sizeof(in->label)); 138 memcpy(out->label, in->label, sizeof(in->label));
138 EBCASC(out->label, sizeof(in->label)); 139 EBCASC(out->label, sizeof(in->label));
139 strstrip(out->label); 140 strim(out->label);
140} 141}
141 142
142static void int_to_ext_kekl_pair(struct tape3592_kekl_pair *in, 143static void int_to_ext_kekl_pair(struct tape3592_kekl_pair *in,
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 4799cc2f73c3..96816149368a 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#define KMSG_COMPONENT "tape" 13#define KMSG_COMPONENT "tape"
14#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
14 15
15#include <linux/fs.h> 16#include <linux/fs.h>
16#include <linux/module.h> 17#include <linux/module.h>
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
index 23d773a0d113..2125ec7d95f0 100644
--- a/drivers/s390/char/tape_char.c
+++ b/drivers/s390/char/tape_char.c
@@ -10,6 +10,9 @@
10 * Martin Schwidefsky <schwidefsky@de.ibm.com> 10 * Martin Schwidefsky <schwidefsky@de.ibm.com>
11 */ 11 */
12 12
13#define KMSG_COMPONENT "tape"
14#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
15
13#include <linux/module.h> 16#include <linux/module.h>
14#include <linux/types.h> 17#include <linux/types.h>
15#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c
index ddc914ccea8f..b2864e3edb6d 100644
--- a/drivers/s390/char/tape_class.c
+++ b/drivers/s390/char/tape_class.c
@@ -7,6 +7,10 @@
7 * Author: Stefan Bader <shbader@de.ibm.com> 7 * Author: Stefan Bader <shbader@de.ibm.com>
8 * Based on simple class device code by Greg K-H 8 * Based on simple class device code by Greg K-H
9 */ 9 */
10
11#define KMSG_COMPONENT "tape"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13
10#include "tape_class.h" 14#include "tape_class.h"
11 15
12MODULE_AUTHOR("Stefan Bader <shbader@de.ibm.com>"); 16MODULE_AUTHOR("Stefan Bader <shbader@de.ibm.com>");
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index f5d6802dc5da..81b094e480e6 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -12,6 +12,8 @@
12 */ 12 */
13 13
14#define KMSG_COMPONENT "tape" 14#define KMSG_COMPONENT "tape"
15#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
16
15#include <linux/module.h> 17#include <linux/module.h>
16#include <linux/init.h> // for kernel parameters 18#include <linux/init.h> // for kernel parameters
17#include <linux/kmod.h> // for requesting modules 19#include <linux/kmod.h> // for requesting modules
diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c
index ebd820ccfb24..0ceb37984f77 100644
--- a/drivers/s390/char/tape_proc.c
+++ b/drivers/s390/char/tape_proc.c
@@ -11,6 +11,9 @@
11 * PROCFS Functions 11 * PROCFS Functions
12 */ 12 */
13 13
14#define KMSG_COMPONENT "tape"
15#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
16
14#include <linux/module.h> 17#include <linux/module.h>
15#include <linux/vmalloc.h> 18#include <linux/vmalloc.h>
16#include <linux/seq_file.h> 19#include <linux/seq_file.h>
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 750354ad16e5..03f07e5dd6e9 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -11,6 +11,9 @@
11 * Stefan Bader <shbader@de.ibm.com> 11 * Stefan Bader <shbader@de.ibm.com>
12 */ 12 */
13 13
14#define KMSG_COMPONENT "tape"
15#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
16
14#include <linux/stddef.h> 17#include <linux/stddef.h>
15#include <linux/kernel.h> 18#include <linux/kernel.h>
16#include <linux/bio.h> 19#include <linux/bio.h>
diff --git a/drivers/s390/cio/Makefile b/drivers/s390/cio/Makefile
index d033414f7599..e1b700a19648 100644
--- a/drivers/s390/cio/Makefile
+++ b/drivers/s390/cio/Makefile
@@ -10,5 +10,5 @@ obj-y += ccw_device.o cmf.o
10obj-$(CONFIG_CHSC_SCH) += chsc_sch.o 10obj-$(CONFIG_CHSC_SCH) += chsc_sch.o
11obj-$(CONFIG_CCWGROUP) += ccwgroup.o 11obj-$(CONFIG_CCWGROUP) += ccwgroup.o
12 12
13qdio-objs := qdio_main.o qdio_thinint.o qdio_debug.o qdio_perf.o qdio_setup.o 13qdio-objs := qdio_main.o qdio_thinint.o qdio_debug.o qdio_setup.o
14obj-$(CONFIG_QDIO) += qdio.o 14obj-$(CONFIG_QDIO) += qdio.o
diff --git a/drivers/s390/cio/ccwreq.c b/drivers/s390/cio/ccwreq.c
index 9509e3860934..7a28a3029a3f 100644
--- a/drivers/s390/cio/ccwreq.c
+++ b/drivers/s390/cio/ccwreq.c
@@ -49,7 +49,6 @@ static u16 ccwreq_next_path(struct ccw_device *cdev)
49 */ 49 */
50static void ccwreq_stop(struct ccw_device *cdev, int rc) 50static void ccwreq_stop(struct ccw_device *cdev, int rc)
51{ 51{
52 struct subchannel *sch = to_subchannel(cdev->dev.parent);
53 struct ccw_request *req = &cdev->private->req; 52 struct ccw_request *req = &cdev->private->req;
54 53
55 if (req->done) 54 if (req->done)
@@ -57,7 +56,6 @@ static void ccwreq_stop(struct ccw_device *cdev, int rc)
57 req->done = 1; 56 req->done = 1;
58 ccw_device_set_timeout(cdev, 0); 57 ccw_device_set_timeout(cdev, 0);
59 memset(&cdev->private->irb, 0, sizeof(struct irb)); 58 memset(&cdev->private->irb, 0, sizeof(struct irb));
60 sch->lpm = sch->schib.pmcw.pam;
61 if (rc && rc != -ENODEV && req->drc) 59 if (rc && rc != -ENODEV && req->drc)
62 rc = req->drc; 60 rc = req->drc;
63 req->callback(cdev, req->data, rc); 61 req->callback(cdev, req->data, rc);
@@ -80,7 +78,6 @@ static void ccwreq_do(struct ccw_device *cdev)
80 continue; 78 continue;
81 } 79 }
82 /* Perform start function. */ 80 /* Perform start function. */
83 sch->lpm = 0xff;
84 memset(&cdev->private->irb, 0, sizeof(struct irb)); 81 memset(&cdev->private->irb, 0, sizeof(struct irb));
85 rc = cio_start(sch, cp, (u8) req->mask); 82 rc = cio_start(sch, cp, (u8) req->mask);
86 if (rc == 0) { 83 if (rc == 0) {
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 73901c9e260f..a6c7d5426fb2 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -1519,6 +1519,7 @@ static int ccw_device_console_enable(struct ccw_device *cdev,
1519 sch->driver = &io_subchannel_driver; 1519 sch->driver = &io_subchannel_driver;
1520 /* Initialize the ccw_device structure. */ 1520 /* Initialize the ccw_device structure. */
1521 cdev->dev.parent= &sch->dev; 1521 cdev->dev.parent= &sch->dev;
1522 sch_set_cdev(sch, cdev);
1522 io_subchannel_recog(cdev, sch); 1523 io_subchannel_recog(cdev, sch);
1523 /* Now wait for the async. recognition to come to an end. */ 1524 /* Now wait for the async. recognition to come to an end. */
1524 spin_lock_irq(cdev->ccwlock); 1525 spin_lock_irq(cdev->ccwlock);
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index aad188e43b4f..6facb5499a65 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -142,7 +142,7 @@ static void spid_do(struct ccw_device *cdev)
142 u8 fn; 142 u8 fn;
143 143
144 /* Use next available path that is not already in correct state. */ 144 /* Use next available path that is not already in correct state. */
145 req->lpm = lpm_adjust(req->lpm, sch->schib.pmcw.pam & ~sch->vpm); 145 req->lpm = lpm_adjust(req->lpm, cdev->private->pgid_todo_mask);
146 if (!req->lpm) 146 if (!req->lpm)
147 goto out_nopath; 147 goto out_nopath;
148 /* Channel program setup. */ 148 /* Channel program setup. */
@@ -254,15 +254,15 @@ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p,
254 *p = first; 254 *p = first;
255} 255}
256 256
257static u8 pgid_to_vpm(struct ccw_device *cdev) 257static u8 pgid_to_donepm(struct ccw_device *cdev)
258{ 258{
259 struct subchannel *sch = to_subchannel(cdev->dev.parent); 259 struct subchannel *sch = to_subchannel(cdev->dev.parent);
260 struct pgid *pgid; 260 struct pgid *pgid;
261 int i; 261 int i;
262 int lpm; 262 int lpm;
263 u8 vpm = 0; 263 u8 donepm = 0;
264 264
265 /* Set VPM bits for paths which are already in the target state. */ 265 /* Set bits for paths which are already in the target state. */
266 for (i = 0; i < 8; i++) { 266 for (i = 0; i < 8; i++) {
267 lpm = 0x80 >> i; 267 lpm = 0x80 >> i;
268 if ((cdev->private->pgid_valid_mask & lpm) == 0) 268 if ((cdev->private->pgid_valid_mask & lpm) == 0)
@@ -282,10 +282,10 @@ static u8 pgid_to_vpm(struct ccw_device *cdev)
282 if (pgid->inf.ps.state3 != SNID_STATE3_SINGLE_PATH) 282 if (pgid->inf.ps.state3 != SNID_STATE3_SINGLE_PATH)
283 continue; 283 continue;
284 } 284 }
285 vpm |= lpm; 285 donepm |= lpm;
286 } 286 }
287 287
288 return vpm; 288 return donepm;
289} 289}
290 290
291static void pgid_fill(struct ccw_device *cdev, struct pgid *pgid) 291static void pgid_fill(struct ccw_device *cdev, struct pgid *pgid)
@@ -307,6 +307,7 @@ static void snid_done(struct ccw_device *cdev, int rc)
307 int mismatch = 0; 307 int mismatch = 0;
308 int reserved = 0; 308 int reserved = 0;
309 int reset = 0; 309 int reset = 0;
310 u8 donepm;
310 311
311 if (rc) 312 if (rc)
312 goto out; 313 goto out;
@@ -316,18 +317,20 @@ static void snid_done(struct ccw_device *cdev, int rc)
316 else if (mismatch) 317 else if (mismatch)
317 rc = -EOPNOTSUPP; 318 rc = -EOPNOTSUPP;
318 else { 319 else {
319 sch->vpm = pgid_to_vpm(cdev); 320 donepm = pgid_to_donepm(cdev);
321 sch->vpm = donepm & sch->opm;
322 cdev->private->pgid_todo_mask &= ~donepm;
320 pgid_fill(cdev, pgid); 323 pgid_fill(cdev, pgid);
321 } 324 }
322out: 325out:
323 CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " 326 CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x "
324 "mism=%d rsvd=%d reset=%d\n", id->ssid, id->devno, rc, 327 "todo=%02x mism=%d rsvd=%d reset=%d\n", id->ssid,
325 cdev->private->pgid_valid_mask, sch->vpm, mismatch, 328 id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm,
326 reserved, reset); 329 cdev->private->pgid_todo_mask, mismatch, reserved, reset);
327 switch (rc) { 330 switch (rc) {
328 case 0: 331 case 0:
329 /* Anything left to do? */ 332 /* Anything left to do? */
330 if (sch->vpm == sch->schib.pmcw.pam) { 333 if (cdev->private->pgid_todo_mask == 0) {
331 verify_done(cdev, sch->vpm == 0 ? -EACCES : 0); 334 verify_done(cdev, sch->vpm == 0 ? -EACCES : 0);
332 return; 335 return;
333 } 336 }
@@ -411,6 +414,7 @@ static void verify_start(struct ccw_device *cdev)
411 struct ccw_dev_id *devid = &cdev->private->dev_id; 414 struct ccw_dev_id *devid = &cdev->private->dev_id;
412 415
413 sch->vpm = 0; 416 sch->vpm = 0;
417 sch->lpm = sch->schib.pmcw.pam;
414 /* Initialize request data. */ 418 /* Initialize request data. */
415 memset(req, 0, sizeof(*req)); 419 memset(req, 0, sizeof(*req));
416 req->timeout = PGID_TIMEOUT; 420 req->timeout = PGID_TIMEOUT;
@@ -442,11 +446,14 @@ static void verify_start(struct ccw_device *cdev)
442 */ 446 */
443void ccw_device_verify_start(struct ccw_device *cdev) 447void ccw_device_verify_start(struct ccw_device *cdev)
444{ 448{
449 struct subchannel *sch = to_subchannel(cdev->dev.parent);
450
445 CIO_TRACE_EVENT(4, "vrfy"); 451 CIO_TRACE_EVENT(4, "vrfy");
446 CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id)); 452 CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id));
447 /* Initialize PGID data. */ 453 /* Initialize PGID data. */
448 memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid)); 454 memset(cdev->private->pgid, 0, sizeof(cdev->private->pgid));
449 cdev->private->pgid_valid_mask = 0; 455 cdev->private->pgid_valid_mask = 0;
456 cdev->private->pgid_todo_mask = sch->schib.pmcw.pam;
450 /* 457 /*
451 * Initialize pathgroup and multipath state with target values. 458 * Initialize pathgroup and multipath state with target values.
452 * They may change in the course of path verification. 459 * They may change in the course of path verification.
diff --git a/drivers/s390/cio/fcx.c b/drivers/s390/cio/fcx.c
index 61677dfbdc9b..ca5e9bb9d458 100644
--- a/drivers/s390/cio/fcx.c
+++ b/drivers/s390/cio/fcx.c
@@ -163,7 +163,7 @@ void tcw_finalize(struct tcw *tcw, int num_tidaws)
163 /* Add tcat to tccb. */ 163 /* Add tcat to tccb. */
164 tccb = tcw_get_tccb(tcw); 164 tccb = tcw_get_tccb(tcw);
165 tcat = (struct tccb_tcat *) &tccb->tca[tca_size(tccb)]; 165 tcat = (struct tccb_tcat *) &tccb->tca[tca_size(tccb)];
166 memset(tcat, 0, sizeof(tcat)); 166 memset(tcat, 0, sizeof(*tcat));
167 /* Calculate tcw input/output count and tcat transport count. */ 167 /* Calculate tcw input/output count and tcat transport count. */
168 count = calc_dcw_count(tccb); 168 count = calc_dcw_count(tccb);
169 if (tcw->w && (tcw->flags & TCW_FLAGS_OUTPUT_TIDA)) 169 if (tcw->w && (tcw->flags & TCW_FLAGS_OUTPUT_TIDA))
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(tccb_init);
269 */ 269 */
270void tsb_init(struct tsb *tsb) 270void tsb_init(struct tsb *tsb)
271{ 271{
272 memset(tsb, 0, sizeof(tsb)); 272 memset(tsb, 0, sizeof(*tsb));
273} 273}
274EXPORT_SYMBOL(tsb_init); 274EXPORT_SYMBOL(tsb_init);
275 275
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h
index d72ae4c93af9..b9ce712a7f25 100644
--- a/drivers/s390/cio/io_sch.h
+++ b/drivers/s390/cio/io_sch.h
@@ -150,6 +150,7 @@ struct ccw_device_private {
150 struct ccw_request req; /* internal I/O request */ 150 struct ccw_request req; /* internal I/O request */
151 int iretry; 151 int iretry;
152 u8 pgid_valid_mask; /* mask of valid PGIDs */ 152 u8 pgid_valid_mask; /* mask of valid PGIDs */
153 u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */
153 struct { 154 struct {
154 unsigned int fast:1; /* post with "channel end" */ 155 unsigned int fast:1; /* post with "channel end" */
155 unsigned int repall:1; /* report every interrupt status */ 156 unsigned int repall:1; /* report every interrupt status */
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index ff7748a9199d..44f2f6a97f33 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -182,6 +182,34 @@ struct scssc_area {
182 u32:32; 182 u32:32;
183} __attribute__ ((packed)); 183} __attribute__ ((packed));
184 184
185struct qdio_dev_perf_stat {
186 unsigned int adapter_int;
187 unsigned int qdio_int;
188 unsigned int pci_request_int;
189
190 unsigned int tasklet_inbound;
191 unsigned int tasklet_inbound_resched;
192 unsigned int tasklet_inbound_resched2;
193 unsigned int tasklet_outbound;
194
195 unsigned int siga_read;
196 unsigned int siga_write;
197 unsigned int siga_sync;
198
199 unsigned int inbound_call;
200 unsigned int inbound_handler;
201 unsigned int stop_polling;
202 unsigned int inbound_queue_full;
203 unsigned int outbound_call;
204 unsigned int outbound_handler;
205 unsigned int fast_requeue;
206 unsigned int target_full;
207 unsigned int eqbs;
208 unsigned int eqbs_partial;
209 unsigned int sqbs;
210 unsigned int sqbs_partial;
211};
212
185struct qdio_input_q { 213struct qdio_input_q {
186 /* input buffer acknowledgement flag */ 214 /* input buffer acknowledgement flag */
187 int polling; 215 int polling;
@@ -269,6 +297,7 @@ struct qdio_irq {
269 u32 *dsci; /* address of device state change indicator */ 297 u32 *dsci; /* address of device state change indicator */
270 struct ccw_device *cdev; 298 struct ccw_device *cdev;
271 struct dentry *debugfs_dev; 299 struct dentry *debugfs_dev;
300 struct dentry *debugfs_perf;
272 301
273 unsigned long int_parm; 302 unsigned long int_parm;
274 struct subchannel_id schid; 303 struct subchannel_id schid;
@@ -286,9 +315,10 @@ struct qdio_irq {
286 struct ciw aqueue; 315 struct ciw aqueue;
287 316
288 struct qdio_ssqd_desc ssqd_desc; 317 struct qdio_ssqd_desc ssqd_desc;
289
290 void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *); 318 void (*orig_handler) (struct ccw_device *, unsigned long, struct irb *);
291 319
320 struct qdio_dev_perf_stat perf_stat;
321 int perf_stat_enabled;
292 /* 322 /*
293 * Warning: Leave these members together at the end so they won't be 323 * Warning: Leave these members together at the end so they won't be
294 * cleared in qdio_setup_irq. 324 * cleared in qdio_setup_irq.
@@ -311,6 +341,10 @@ struct qdio_irq {
311 (irq->qib.qfmt == QDIO_IQDIO_QFMT || \ 341 (irq->qib.qfmt == QDIO_IQDIO_QFMT || \
312 css_general_characteristics.aif_osa) 342 css_general_characteristics.aif_osa)
313 343
344#define qperf(qdev,attr) qdev->perf_stat.attr
345#define qperf_inc(q,attr) if (q->irq_ptr->perf_stat_enabled) \
346 q->irq_ptr->perf_stat.attr++
347
314/* the highest iqdio queue is used for multicast */ 348/* the highest iqdio queue is used for multicast */
315static inline int multicast_outbound(struct qdio_q *q) 349static inline int multicast_outbound(struct qdio_q *q)
316{ 350{
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
index 76769978285f..f49761ff9a00 100644
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -55,13 +55,11 @@ static int qstat_show(struct seq_file *m, void *v)
55 if (!q) 55 if (!q)
56 return 0; 56 return 0;
57 57
58 seq_printf(m, "device state indicator: %d\n", *(u32 *)q->irq_ptr->dsci); 58 seq_printf(m, "DSCI: %d nr_used: %d\n",
59 seq_printf(m, "nr_used: %d\n", atomic_read(&q->nr_buf_used)); 59 *(u32 *)q->irq_ptr->dsci, atomic_read(&q->nr_buf_used));
60 seq_printf(m, "ftc: %d\n", q->first_to_check); 60 seq_printf(m, "ftc: %d last_move: %d\n", q->first_to_check, q->last_move);
61 seq_printf(m, "last_move: %d\n", q->last_move); 61 seq_printf(m, "polling: %d ack start: %d ack count: %d\n",
62 seq_printf(m, "polling: %d\n", q->u.in.polling); 62 q->u.in.polling, q->u.in.ack_start, q->u.in.ack_count);
63 seq_printf(m, "ack start: %d\n", q->u.in.ack_start);
64 seq_printf(m, "ack count: %d\n", q->u.in.ack_count);
65 seq_printf(m, "slsb buffer states:\n"); 63 seq_printf(m, "slsb buffer states:\n");
66 seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n"); 64 seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n");
67 65
@@ -110,7 +108,6 @@ static ssize_t qstat_seq_write(struct file *file, const char __user *buf,
110 108
111 if (!q) 109 if (!q)
112 return 0; 110 return 0;
113
114 if (q->is_input_q) 111 if (q->is_input_q)
115 xchg(q->irq_ptr->dsci, 1); 112 xchg(q->irq_ptr->dsci, 1);
116 local_bh_disable(); 113 local_bh_disable();
@@ -134,6 +131,98 @@ static const struct file_operations debugfs_fops = {
134 .release = single_release, 131 .release = single_release,
135}; 132};
136 133
134static char *qperf_names[] = {
135 "Assumed adapter interrupts",
136 "QDIO interrupts",
137 "Requested PCIs",
138 "Inbound tasklet runs",
139 "Inbound tasklet resched",
140 "Inbound tasklet resched2",
141 "Outbound tasklet runs",
142 "SIGA read",
143 "SIGA write",
144 "SIGA sync",
145 "Inbound calls",
146 "Inbound handler",
147 "Inbound stop_polling",
148 "Inbound queue full",
149 "Outbound calls",
150 "Outbound handler",
151 "Outbound fast_requeue",
152 "Outbound target_full",
153 "QEBSM eqbs",
154 "QEBSM eqbs partial",
155 "QEBSM sqbs",
156 "QEBSM sqbs partial"
157};
158
159static int qperf_show(struct seq_file *m, void *v)
160{
161 struct qdio_irq *irq_ptr = m->private;
162 unsigned int *stat;
163 int i;
164
165 if (!irq_ptr)
166 return 0;
167 if (!irq_ptr->perf_stat_enabled) {
168 seq_printf(m, "disabled\n");
169 return 0;
170 }
171 stat = (unsigned int *)&irq_ptr->perf_stat;
172
173 for (i = 0; i < ARRAY_SIZE(qperf_names); i++)
174 seq_printf(m, "%26s:\t%u\n",
175 qperf_names[i], *(stat + i));
176 return 0;
177}
178
179static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
180 size_t count, loff_t *off)
181{
182 struct seq_file *seq = file->private_data;
183 struct qdio_irq *irq_ptr = seq->private;
184 unsigned long val;
185 char buf[8];
186 int ret;
187
188 if (!irq_ptr)
189 return 0;
190 if (count >= sizeof(buf))
191 return -EINVAL;
192 if (copy_from_user(&buf, ubuf, count))
193 return -EFAULT;
194 buf[count] = 0;
195
196 ret = strict_strtoul(buf, 10, &val);
197 if (ret < 0)
198 return ret;
199
200 switch (val) {
201 case 0:
202 irq_ptr->perf_stat_enabled = 0;
203 memset(&irq_ptr->perf_stat, 0, sizeof(irq_ptr->perf_stat));
204 break;
205 case 1:
206 irq_ptr->perf_stat_enabled = 1;
207 break;
208 }
209 return count;
210}
211
212static int qperf_seq_open(struct inode *inode, struct file *filp)
213{
214 return single_open(filp, qperf_show,
215 filp->f_path.dentry->d_inode->i_private);
216}
217
218static struct file_operations debugfs_perf_fops = {
219 .owner = THIS_MODULE,
220 .open = qperf_seq_open,
221 .read = seq_read,
222 .write = qperf_seq_write,
223 .llseek = seq_lseek,
224 .release = single_release,
225};
137static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev) 226static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev)
138{ 227{
139 char name[QDIO_DEBUGFS_NAME_LEN]; 228 char name[QDIO_DEBUGFS_NAME_LEN];
@@ -156,6 +245,14 @@ void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev)
156 debugfs_root); 245 debugfs_root);
157 if (IS_ERR(irq_ptr->debugfs_dev)) 246 if (IS_ERR(irq_ptr->debugfs_dev))
158 irq_ptr->debugfs_dev = NULL; 247 irq_ptr->debugfs_dev = NULL;
248
249 irq_ptr->debugfs_perf = debugfs_create_file("statistics",
250 S_IFREG | S_IRUGO | S_IWUSR,
251 irq_ptr->debugfs_dev, irq_ptr,
252 &debugfs_perf_fops);
253 if (IS_ERR(irq_ptr->debugfs_perf))
254 irq_ptr->debugfs_perf = NULL;
255
159 for_each_input_queue(irq_ptr, q, i) 256 for_each_input_queue(irq_ptr, q, i)
160 setup_debugfs_entry(q, cdev); 257 setup_debugfs_entry(q, cdev);
161 for_each_output_queue(irq_ptr, q, i) 258 for_each_output_queue(irq_ptr, q, i)
@@ -171,6 +268,7 @@ void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cd
171 debugfs_remove(q->debugfs_q); 268 debugfs_remove(q->debugfs_q);
172 for_each_output_queue(irq_ptr, q, i) 269 for_each_output_queue(irq_ptr, q, i)
173 debugfs_remove(q->debugfs_q); 270 debugfs_remove(q->debugfs_q);
271 debugfs_remove(irq_ptr->debugfs_perf);
174 debugfs_remove(irq_ptr->debugfs_dev); 272 debugfs_remove(irq_ptr->debugfs_dev);
175} 273}
176 274
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 4be6e84b9599..999fe80c4051 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -22,7 +22,6 @@
22#include "device.h" 22#include "device.h"
23#include "qdio.h" 23#include "qdio.h"
24#include "qdio_debug.h" 24#include "qdio_debug.h"
25#include "qdio_perf.h"
26 25
27MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\ 26MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\
28 "Jan Glauber <jang@linux.vnet.ibm.com>"); 27 "Jan Glauber <jang@linux.vnet.ibm.com>");
@@ -126,7 +125,7 @@ static int qdio_do_eqbs(struct qdio_q *q, unsigned char *state,
126 int rc; 125 int rc;
127 126
128 BUG_ON(!q->irq_ptr->sch_token); 127 BUG_ON(!q->irq_ptr->sch_token);
129 qdio_perf_stat_inc(&perf_stats.debug_eqbs_all); 128 qperf_inc(q, eqbs);
130 129
131 if (!q->is_input_q) 130 if (!q->is_input_q)
132 nr += q->irq_ptr->nr_input_qs; 131 nr += q->irq_ptr->nr_input_qs;
@@ -139,7 +138,7 @@ again:
139 * buffers later. 138 * buffers later.
140 */ 139 */
141 if ((ccq == 96) && (count != tmp_count)) { 140 if ((ccq == 96) && (count != tmp_count)) {
142 qdio_perf_stat_inc(&perf_stats.debug_eqbs_incomplete); 141 qperf_inc(q, eqbs_partial);
143 return (count - tmp_count); 142 return (count - tmp_count);
144 } 143 }
145 144
@@ -182,7 +181,7 @@ static int qdio_do_sqbs(struct qdio_q *q, unsigned char state, int start,
182 return 0; 181 return 0;
183 182
184 BUG_ON(!q->irq_ptr->sch_token); 183 BUG_ON(!q->irq_ptr->sch_token);
185 qdio_perf_stat_inc(&perf_stats.debug_sqbs_all); 184 qperf_inc(q, sqbs);
186 185
187 if (!q->is_input_q) 186 if (!q->is_input_q)
188 nr += q->irq_ptr->nr_input_qs; 187 nr += q->irq_ptr->nr_input_qs;
@@ -191,7 +190,7 @@ again:
191 rc = qdio_check_ccq(q, ccq); 190 rc = qdio_check_ccq(q, ccq);
192 if (rc == 1) { 191 if (rc == 1) {
193 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq); 192 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "SQBS again:%2d", ccq);
194 qdio_perf_stat_inc(&perf_stats.debug_sqbs_incomplete); 193 qperf_inc(q, sqbs_partial);
195 goto again; 194 goto again;
196 } 195 }
197 if (rc < 0) { 196 if (rc < 0) {
@@ -285,7 +284,7 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output,
285 return 0; 284 return 0;
286 285
287 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); 286 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr);
288 qdio_perf_stat_inc(&perf_stats.siga_sync); 287 qperf_inc(q, siga_sync);
289 288
290 cc = do_siga_sync(q->irq_ptr->schid, output, input); 289 cc = do_siga_sync(q->irq_ptr->schid, output, input);
291 if (cc) 290 if (cc)
@@ -350,7 +349,7 @@ static inline int qdio_siga_input(struct qdio_q *q)
350 int cc; 349 int cc;
351 350
352 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); 351 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr);
353 qdio_perf_stat_inc(&perf_stats.siga_in); 352 qperf_inc(q, siga_read);
354 353
355 cc = do_siga_input(q->irq_ptr->schid, q->mask); 354 cc = do_siga_input(q->irq_ptr->schid, q->mask);
356 if (cc) 355 if (cc)
@@ -382,7 +381,7 @@ static inline void qdio_stop_polling(struct qdio_q *q)
382 return; 381 return;
383 382
384 q->u.in.polling = 0; 383 q->u.in.polling = 0;
385 qdio_perf_stat_inc(&perf_stats.debug_stop_polling); 384 qperf_inc(q, stop_polling);
386 385
387 /* show the card that we are not polling anymore */ 386 /* show the card that we are not polling anymore */
388 if (is_qebsm(q)) { 387 if (is_qebsm(q)) {
@@ -400,7 +399,7 @@ static void announce_buffer_error(struct qdio_q *q, int count)
400 /* special handling for no target buffer empty */ 399 /* special handling for no target buffer empty */
401 if ((!q->is_input_q && 400 if ((!q->is_input_q &&
402 (q->sbal[q->first_to_check]->element[15].flags & 0xff) == 0x10)) { 401 (q->sbal[q->first_to_check]->element[15].flags & 0xff) == 0x10)) {
403 qdio_perf_stat_inc(&perf_stats.outbound_target_full); 402 qperf_inc(q, target_full);
404 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x", 403 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x",
405 q->first_to_check); 404 q->first_to_check);
406 return; 405 return;
@@ -486,7 +485,8 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
486 case SLSB_P_INPUT_PRIMED: 485 case SLSB_P_INPUT_PRIMED:
487 inbound_primed(q, count); 486 inbound_primed(q, count);
488 q->first_to_check = add_buf(q->first_to_check, count); 487 q->first_to_check = add_buf(q->first_to_check, count);
489 atomic_sub(count, &q->nr_buf_used); 488 if (atomic_sub(count, &q->nr_buf_used) == 0)
489 qperf_inc(q, inbound_queue_full);
490 break; 490 break;
491 case SLSB_P_INPUT_ERROR: 491 case SLSB_P_INPUT_ERROR:
492 announce_buffer_error(q, count); 492 announce_buffer_error(q, count);
@@ -566,9 +566,10 @@ static void qdio_kick_handler(struct qdio_q *q)
566 count = sub_buf(end, start); 566 count = sub_buf(end, start);
567 567
568 if (q->is_input_q) { 568 if (q->is_input_q) {
569 qdio_perf_stat_inc(&perf_stats.inbound_handler); 569 qperf_inc(q, inbound_handler);
570 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); 570 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count);
571 } else 571 } else
572 qperf_inc(q, outbound_handler);
572 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", 573 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x",
573 start, count); 574 start, count);
574 575
@@ -582,24 +583,28 @@ static void qdio_kick_handler(struct qdio_q *q)
582 583
583static void __qdio_inbound_processing(struct qdio_q *q) 584static void __qdio_inbound_processing(struct qdio_q *q)
584{ 585{
585 qdio_perf_stat_inc(&perf_stats.tasklet_inbound); 586 qperf_inc(q, tasklet_inbound);
586again: 587again:
587 if (!qdio_inbound_q_moved(q)) 588 if (!qdio_inbound_q_moved(q))
588 return; 589 return;
589 590
590 qdio_kick_handler(q); 591 qdio_kick_handler(q);
591 592
592 if (!qdio_inbound_q_done(q)) 593 if (!qdio_inbound_q_done(q)) {
593 /* means poll time is not yet over */ 594 /* means poll time is not yet over */
595 qperf_inc(q, tasklet_inbound_resched);
594 goto again; 596 goto again;
597 }
595 598
596 qdio_stop_polling(q); 599 qdio_stop_polling(q);
597 /* 600 /*
598 * We need to check again to not lose initiative after 601 * We need to check again to not lose initiative after
599 * resetting the ACK state. 602 * resetting the ACK state.
600 */ 603 */
601 if (!qdio_inbound_q_done(q)) 604 if (!qdio_inbound_q_done(q)) {
605 qperf_inc(q, tasklet_inbound_resched2);
602 goto again; 606 goto again;
607 }
603} 608}
604 609
605void qdio_inbound_processing(unsigned long data) 610void qdio_inbound_processing(unsigned long data)
@@ -687,7 +692,7 @@ static int qdio_kick_outbound_q(struct qdio_q *q)
687 return 0; 692 return 0;
688 693
689 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr); 694 DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-w:%1d", q->nr);
690 qdio_perf_stat_inc(&perf_stats.siga_out); 695 qperf_inc(q, siga_write);
691 696
692 cc = qdio_siga_output(q, &busy_bit); 697 cc = qdio_siga_output(q, &busy_bit);
693 switch (cc) { 698 switch (cc) {
@@ -710,7 +715,7 @@ static int qdio_kick_outbound_q(struct qdio_q *q)
710 715
711static void __qdio_outbound_processing(struct qdio_q *q) 716static void __qdio_outbound_processing(struct qdio_q *q)
712{ 717{
713 qdio_perf_stat_inc(&perf_stats.tasklet_outbound); 718 qperf_inc(q, tasklet_outbound);
714 BUG_ON(atomic_read(&q->nr_buf_used) < 0); 719 BUG_ON(atomic_read(&q->nr_buf_used) < 0);
715 720
716 if (qdio_outbound_q_moved(q)) 721 if (qdio_outbound_q_moved(q))
@@ -738,12 +743,9 @@ static void __qdio_outbound_processing(struct qdio_q *q)
738 */ 743 */
739 if (qdio_outbound_q_done(q)) 744 if (qdio_outbound_q_done(q))
740 del_timer(&q->u.out.timer); 745 del_timer(&q->u.out.timer);
741 else { 746 else
742 if (!timer_pending(&q->u.out.timer)) { 747 if (!timer_pending(&q->u.out.timer))
743 mod_timer(&q->u.out.timer, jiffies + 10 * HZ); 748 mod_timer(&q->u.out.timer, jiffies + 10 * HZ);
744 qdio_perf_stat_inc(&perf_stats.debug_tl_out_timer);
745 }
746 }
747 return; 749 return;
748 750
749sched: 751sched:
@@ -783,7 +785,7 @@ static inline void qdio_check_outbound_after_thinint(struct qdio_q *q)
783 785
784static void __tiqdio_inbound_processing(struct qdio_q *q) 786static void __tiqdio_inbound_processing(struct qdio_q *q)
785{ 787{
786 qdio_perf_stat_inc(&perf_stats.thinint_inbound); 788 qperf_inc(q, tasklet_inbound);
787 qdio_sync_after_thinint(q); 789 qdio_sync_after_thinint(q);
788 790
789 /* 791 /*
@@ -798,7 +800,7 @@ static void __tiqdio_inbound_processing(struct qdio_q *q)
798 qdio_kick_handler(q); 800 qdio_kick_handler(q);
799 801
800 if (!qdio_inbound_q_done(q)) { 802 if (!qdio_inbound_q_done(q)) {
801 qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop); 803 qperf_inc(q, tasklet_inbound_resched);
802 if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) { 804 if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) {
803 tasklet_schedule(&q->tasklet); 805 tasklet_schedule(&q->tasklet);
804 return; 806 return;
@@ -811,7 +813,7 @@ static void __tiqdio_inbound_processing(struct qdio_q *q)
811 * resetting the ACK state. 813 * resetting the ACK state.
812 */ 814 */
813 if (!qdio_inbound_q_done(q)) { 815 if (!qdio_inbound_q_done(q)) {
814 qdio_perf_stat_inc(&perf_stats.thinint_inbound_loop2); 816 qperf_inc(q, tasklet_inbound_resched2);
815 if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED)) 817 if (likely(q->irq_ptr->state != QDIO_IRQ_STATE_STOPPED))
816 tasklet_schedule(&q->tasklet); 818 tasklet_schedule(&q->tasklet);
817 } 819 }
@@ -850,8 +852,6 @@ static void qdio_int_handler_pci(struct qdio_irq *irq_ptr)
850 if (unlikely(irq_ptr->state == QDIO_IRQ_STATE_STOPPED)) 852 if (unlikely(irq_ptr->state == QDIO_IRQ_STATE_STOPPED))
851 return; 853 return;
852 854
853 qdio_perf_stat_inc(&perf_stats.pci_int);
854
855 for_each_input_queue(irq_ptr, q, i) 855 for_each_input_queue(irq_ptr, q, i)
856 tasklet_schedule(&q->tasklet); 856 tasklet_schedule(&q->tasklet);
857 857
@@ -922,8 +922,6 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
922 struct qdio_irq *irq_ptr = cdev->private->qdio_data; 922 struct qdio_irq *irq_ptr = cdev->private->qdio_data;
923 int cstat, dstat; 923 int cstat, dstat;
924 924
925 qdio_perf_stat_inc(&perf_stats.qdio_int);
926
927 if (!intparm || !irq_ptr) { 925 if (!intparm || !irq_ptr) {
928 DBF_ERROR("qint:%4x", cdev->private->schid.sch_no); 926 DBF_ERROR("qint:%4x", cdev->private->schid.sch_no);
929 return; 927 return;
@@ -1382,6 +1380,8 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags,
1382{ 1380{
1383 int used, diff; 1381 int used, diff;
1384 1382
1383 qperf_inc(q, inbound_call);
1384
1385 if (!q->u.in.polling) 1385 if (!q->u.in.polling)
1386 goto set; 1386 goto set;
1387 1387
@@ -1437,14 +1437,16 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags,
1437 unsigned char state; 1437 unsigned char state;
1438 int used, rc = 0; 1438 int used, rc = 0;
1439 1439
1440 qdio_perf_stat_inc(&perf_stats.outbound_handler); 1440 qperf_inc(q, outbound_call);
1441 1441
1442 count = set_buf_states(q, bufnr, SLSB_CU_OUTPUT_PRIMED, count); 1442 count = set_buf_states(q, bufnr, SLSB_CU_OUTPUT_PRIMED, count);
1443 used = atomic_add_return(count, &q->nr_buf_used); 1443 used = atomic_add_return(count, &q->nr_buf_used);
1444 BUG_ON(used > QDIO_MAX_BUFFERS_PER_Q); 1444 BUG_ON(used > QDIO_MAX_BUFFERS_PER_Q);
1445 1445
1446 if (callflags & QDIO_FLAG_PCI_OUT) 1446 if (callflags & QDIO_FLAG_PCI_OUT) {
1447 q->u.out.pci_out_enabled = 1; 1447 q->u.out.pci_out_enabled = 1;
1448 qperf_inc(q, pci_request_int);
1449 }
1448 else 1450 else
1449 q->u.out.pci_out_enabled = 0; 1451 q->u.out.pci_out_enabled = 0;
1450 1452
@@ -1483,7 +1485,7 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags,
1483 if (state != SLSB_CU_OUTPUT_PRIMED) 1485 if (state != SLSB_CU_OUTPUT_PRIMED)
1484 rc = qdio_kick_outbound_q(q); 1486 rc = qdio_kick_outbound_q(q);
1485 else 1487 else
1486 qdio_perf_stat_inc(&perf_stats.fast_requeue); 1488 qperf_inc(q, fast_requeue);
1487 1489
1488out: 1490out:
1489 tasklet_schedule(&q->tasklet); 1491 tasklet_schedule(&q->tasklet);
@@ -1539,16 +1541,11 @@ static int __init init_QDIO(void)
1539 rc = qdio_debug_init(); 1541 rc = qdio_debug_init();
1540 if (rc) 1542 if (rc)
1541 goto out_ti; 1543 goto out_ti;
1542 rc = qdio_setup_perf_stats();
1543 if (rc)
1544 goto out_debug;
1545 rc = tiqdio_register_thinints(); 1544 rc = tiqdio_register_thinints();
1546 if (rc) 1545 if (rc)
1547 goto out_perf; 1546 goto out_debug;
1548 return 0; 1547 return 0;
1549 1548
1550out_perf:
1551 qdio_remove_perf_stats();
1552out_debug: 1549out_debug:
1553 qdio_debug_exit(); 1550 qdio_debug_exit();
1554out_ti: 1551out_ti:
@@ -1562,7 +1559,6 @@ static void __exit exit_QDIO(void)
1562{ 1559{
1563 tiqdio_unregister_thinints(); 1560 tiqdio_unregister_thinints();
1564 tiqdio_free_memory(); 1561 tiqdio_free_memory();
1565 qdio_remove_perf_stats();
1566 qdio_debug_exit(); 1562 qdio_debug_exit();
1567 qdio_setup_exit(); 1563 qdio_setup_exit();
1568} 1564}
diff --git a/drivers/s390/cio/qdio_perf.c b/drivers/s390/cio/qdio_perf.c
deleted file mode 100644
index 968e3c7c2632..000000000000
--- a/drivers/s390/cio/qdio_perf.c
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2 * drivers/s390/cio/qdio_perf.c
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
7 */
8#include <linux/kernel.h>
9#include <linux/proc_fs.h>
10#include <linux/seq_file.h>
11#include <asm/ccwdev.h>
12
13#include "cio.h"
14#include "css.h"
15#include "device.h"
16#include "ioasm.h"
17#include "chsc.h"
18#include "qdio_debug.h"
19#include "qdio_perf.h"
20
21int qdio_performance_stats;
22struct qdio_perf_stats perf_stats;
23
24#ifdef CONFIG_PROC_FS
25static struct proc_dir_entry *qdio_perf_pde;
26#endif
27
28/*
29 * procfs functions
30 */
31static int qdio_perf_proc_show(struct seq_file *m, void *v)
32{
33 seq_printf(m, "Number of qdio interrupts\t\t\t: %li\n",
34 (long)atomic_long_read(&perf_stats.qdio_int));
35 seq_printf(m, "Number of PCI interrupts\t\t\t: %li\n",
36 (long)atomic_long_read(&perf_stats.pci_int));
37 seq_printf(m, "Number of adapter interrupts\t\t\t: %li\n",
38 (long)atomic_long_read(&perf_stats.thin_int));
39 seq_printf(m, "\n");
40 seq_printf(m, "Inbound tasklet runs\t\t\t\t: %li\n",
41 (long)atomic_long_read(&perf_stats.tasklet_inbound));
42 seq_printf(m, "Outbound tasklet runs\t\t\t\t: %li\n",
43 (long)atomic_long_read(&perf_stats.tasklet_outbound));
44 seq_printf(m, "Adapter interrupt tasklet runs/loops\t\t: %li/%li\n",
45 (long)atomic_long_read(&perf_stats.tasklet_thinint),
46 (long)atomic_long_read(&perf_stats.tasklet_thinint_loop));
47 seq_printf(m, "Adapter interrupt inbound tasklet runs/loops\t: %li/%li\n",
48 (long)atomic_long_read(&perf_stats.thinint_inbound),
49 (long)atomic_long_read(&perf_stats.thinint_inbound_loop));
50 seq_printf(m, "\n");
51 seq_printf(m, "Number of SIGA In issued\t\t\t: %li\n",
52 (long)atomic_long_read(&perf_stats.siga_in));
53 seq_printf(m, "Number of SIGA Out issued\t\t\t: %li\n",
54 (long)atomic_long_read(&perf_stats.siga_out));
55 seq_printf(m, "Number of SIGA Sync issued\t\t\t: %li\n",
56 (long)atomic_long_read(&perf_stats.siga_sync));
57 seq_printf(m, "\n");
58 seq_printf(m, "Number of inbound transfers\t\t\t: %li\n",
59 (long)atomic_long_read(&perf_stats.inbound_handler));
60 seq_printf(m, "Number of outbound transfers\t\t\t: %li\n",
61 (long)atomic_long_read(&perf_stats.outbound_handler));
62 seq_printf(m, "\n");
63 seq_printf(m, "Number of fast requeues (outg. SBAL w/o SIGA)\t: %li\n",
64 (long)atomic_long_read(&perf_stats.fast_requeue));
65 seq_printf(m, "Number of outbound target full condition\t: %li\n",
66 (long)atomic_long_read(&perf_stats.outbound_target_full));
67 seq_printf(m, "Number of outbound tasklet mod_timer calls\t: %li\n",
68 (long)atomic_long_read(&perf_stats.debug_tl_out_timer));
69 seq_printf(m, "Number of stop polling calls\t\t\t: %li\n",
70 (long)atomic_long_read(&perf_stats.debug_stop_polling));
71 seq_printf(m, "AI inbound tasklet loops after stop polling\t: %li\n",
72 (long)atomic_long_read(&perf_stats.thinint_inbound_loop2));
73 seq_printf(m, "QEBSM EQBS total/incomplete\t\t\t: %li/%li\n",
74 (long)atomic_long_read(&perf_stats.debug_eqbs_all),
75 (long)atomic_long_read(&perf_stats.debug_eqbs_incomplete));
76 seq_printf(m, "QEBSM SQBS total/incomplete\t\t\t: %li/%li\n",
77 (long)atomic_long_read(&perf_stats.debug_sqbs_all),
78 (long)atomic_long_read(&perf_stats.debug_sqbs_incomplete));
79 seq_printf(m, "\n");
80 return 0;
81}
82static int qdio_perf_seq_open(struct inode *inode, struct file *filp)
83{
84 return single_open(filp, qdio_perf_proc_show, NULL);
85}
86
87static const struct file_operations qdio_perf_proc_fops = {
88 .owner = THIS_MODULE,
89 .open = qdio_perf_seq_open,
90 .read = seq_read,
91 .llseek = seq_lseek,
92 .release = single_release,
93};
94
95/*
96 * sysfs functions
97 */
98static ssize_t qdio_perf_stats_show(struct bus_type *bus, char *buf)
99{
100 return sprintf(buf, "%i\n", qdio_performance_stats ? 1 : 0);
101}
102
103static ssize_t qdio_perf_stats_store(struct bus_type *bus,
104 const char *buf, size_t count)
105{
106 unsigned long i;
107
108 if (strict_strtoul(buf, 16, &i) != 0)
109 return -EINVAL;
110 if ((i != 0) && (i != 1))
111 return -EINVAL;
112 if (i == qdio_performance_stats)
113 return count;
114
115 qdio_performance_stats = i;
116 /* reset performance statistics */
117 if (i == 0)
118 memset(&perf_stats, 0, sizeof(struct qdio_perf_stats));
119 return count;
120}
121
122static BUS_ATTR(qdio_performance_stats, 0644, qdio_perf_stats_show,
123 qdio_perf_stats_store);
124
125int __init qdio_setup_perf_stats(void)
126{
127 int rc;
128
129 rc = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
130 if (rc)
131 return rc;
132
133#ifdef CONFIG_PROC_FS
134 memset(&perf_stats, 0, sizeof(struct qdio_perf_stats));
135 qdio_perf_pde = proc_create("qdio_perf", S_IFREG | S_IRUGO,
136 NULL, &qdio_perf_proc_fops);
137#endif
138 return 0;
139}
140
141void qdio_remove_perf_stats(void)
142{
143#ifdef CONFIG_PROC_FS
144 remove_proc_entry("qdio_perf", NULL);
145#endif
146 bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
147}
diff --git a/drivers/s390/cio/qdio_perf.h b/drivers/s390/cio/qdio_perf.h
deleted file mode 100644
index ff4504ce1e3c..000000000000
--- a/drivers/s390/cio/qdio_perf.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * drivers/s390/cio/qdio_perf.h
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
7 */
8#ifndef QDIO_PERF_H
9#define QDIO_PERF_H
10
11#include <linux/types.h>
12#include <asm/atomic.h>
13
14struct qdio_perf_stats {
15 /* interrupt handler calls */
16 atomic_long_t qdio_int;
17 atomic_long_t pci_int;
18 atomic_long_t thin_int;
19
20 /* tasklet runs */
21 atomic_long_t tasklet_inbound;
22 atomic_long_t tasklet_outbound;
23 atomic_long_t tasklet_thinint;
24 atomic_long_t tasklet_thinint_loop;
25 atomic_long_t thinint_inbound;
26 atomic_long_t thinint_inbound_loop;
27 atomic_long_t thinint_inbound_loop2;
28
29 /* signal adapter calls */
30 atomic_long_t siga_out;
31 atomic_long_t siga_in;
32 atomic_long_t siga_sync;
33
34 /* misc */
35 atomic_long_t inbound_handler;
36 atomic_long_t outbound_handler;
37 atomic_long_t fast_requeue;
38 atomic_long_t outbound_target_full;
39
40 /* for debugging */
41 atomic_long_t debug_tl_out_timer;
42 atomic_long_t debug_stop_polling;
43 atomic_long_t debug_eqbs_all;
44 atomic_long_t debug_eqbs_incomplete;
45 atomic_long_t debug_sqbs_all;
46 atomic_long_t debug_sqbs_incomplete;
47};
48
49extern struct qdio_perf_stats perf_stats;
50extern int qdio_performance_stats;
51
52static inline void qdio_perf_stat_inc(atomic_long_t *count)
53{
54 if (qdio_performance_stats)
55 atomic_long_inc(count);
56}
57
58int qdio_setup_perf_stats(void);
59void qdio_remove_perf_stats(void);
60
61#endif
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index 18d54fc21ce9..8c2dea5fa2b4 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -48,7 +48,6 @@ static void set_impl_params(struct qdio_irq *irq_ptr,
48 if (!irq_ptr) 48 if (!irq_ptr)
49 return; 49 return;
50 50
51 WARN_ON((unsigned long)&irq_ptr->qib & 0xff);
52 irq_ptr->qib.pfmt = qib_param_field_format; 51 irq_ptr->qib.pfmt = qib_param_field_format;
53 if (qib_param_field) 52 if (qib_param_field)
54 memcpy(irq_ptr->qib.parm, qib_param_field, 53 memcpy(irq_ptr->qib.parm, qib_param_field,
@@ -82,14 +81,12 @@ static int __qdio_allocate_qs(struct qdio_q **irq_ptr_qs, int nr_queues)
82 q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL); 81 q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
83 if (!q) 82 if (!q)
84 return -ENOMEM; 83 return -ENOMEM;
85 WARN_ON((unsigned long)q & 0xff);
86 84
87 q->slib = (struct slib *) __get_free_page(GFP_KERNEL); 85 q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
88 if (!q->slib) { 86 if (!q->slib) {
89 kmem_cache_free(qdio_q_cache, q); 87 kmem_cache_free(qdio_q_cache, q);
90 return -ENOMEM; 88 return -ENOMEM;
91 } 89 }
92 WARN_ON((unsigned long)q->slib & 0x7ff);
93 irq_ptr_qs[i] = q; 90 irq_ptr_qs[i] = q;
94 } 91 }
95 return 0; 92 return 0;
@@ -131,7 +128,7 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr,
131 /* fill in sbal */ 128 /* fill in sbal */
132 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) { 129 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) {
133 q->sbal[j] = *sbals_array++; 130 q->sbal[j] = *sbals_array++;
134 WARN_ON((unsigned long)q->sbal[j] & 0xff); 131 BUG_ON((unsigned long)q->sbal[j] & 0xff);
135 } 132 }
136 133
137 /* fill in slib */ 134 /* fill in slib */
@@ -147,11 +144,6 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr,
147 /* fill in sl */ 144 /* fill in sl */
148 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) 145 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++)
149 q->sl->element[j].sbal = (unsigned long)q->sbal[j]; 146 q->sl->element[j].sbal = (unsigned long)q->sbal[j];
150
151 DBF_EVENT("sl-slsb-sbal");
152 DBF_HEX(q->sl, sizeof(void *));
153 DBF_HEX(&q->slsb, sizeof(void *));
154 DBF_HEX(q->sbal, sizeof(void *));
155} 147}
156 148
157static void setup_queues(struct qdio_irq *irq_ptr, 149static void setup_queues(struct qdio_irq *irq_ptr,
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index 981a77ea7ee2..091d904d3182 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -1,9 +1,7 @@
1/* 1/*
2 * linux/drivers/s390/cio/thinint_qdio.c 2 * linux/drivers/s390/cio/thinint_qdio.c
3 * 3 *
4 * thin interrupt support for qdio 4 * Copyright 2000,2009 IBM Corp.
5 *
6 * Copyright 2000-2008 IBM Corp.
7 * Author(s): Utz Bacher <utz.bacher@de.ibm.com> 5 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
8 * Cornelia Huck <cornelia.huck@de.ibm.com> 6 * Cornelia Huck <cornelia.huck@de.ibm.com>
9 * Jan Glauber <jang@linux.vnet.ibm.com> 7 * Jan Glauber <jang@linux.vnet.ibm.com>
@@ -19,7 +17,6 @@
19#include "ioasm.h" 17#include "ioasm.h"
20#include "qdio.h" 18#include "qdio.h"
21#include "qdio_debug.h" 19#include "qdio_debug.h"
22#include "qdio_perf.h"
23 20
24/* 21/*
25 * Restriction: only 63 iqdio subchannels would have its own indicator, 22 * Restriction: only 63 iqdio subchannels would have its own indicator,
@@ -132,8 +129,6 @@ static void tiqdio_thinint_handler(void *ind, void *drv_data)
132{ 129{
133 struct qdio_q *q; 130 struct qdio_q *q;
134 131
135 qdio_perf_stat_inc(&perf_stats.thin_int);
136
137 /* 132 /*
138 * SVS only when needed: issue SVS to benefit from iqdio interrupt 133 * SVS only when needed: issue SVS to benefit from iqdio interrupt
139 * avoidance (SVS clears adapter interrupt suppression overwrite) 134 * avoidance (SVS clears adapter interrupt suppression overwrite)
@@ -154,6 +149,7 @@ static void tiqdio_thinint_handler(void *ind, void *drv_data)
154 list_for_each_entry_rcu(q, &tiq_list, entry) 149 list_for_each_entry_rcu(q, &tiq_list, entry)
155 /* only process queues from changed sets */ 150 /* only process queues from changed sets */
156 if (*q->irq_ptr->dsci) { 151 if (*q->irq_ptr->dsci) {
152 qperf_inc(q, adapter_int);
157 153
158 /* only clear it if the indicator is non-shared */ 154 /* only clear it if the indicator is non-shared */
159 if (!shared_ind(q->irq_ptr)) 155 if (!shared_ind(q->irq_ptr))
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 3c77bfe0764c..147bb1a69aba 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -3398,7 +3398,7 @@ claw_init(void)
3398 goto out_err; 3398 goto out_err;
3399 } 3399 }
3400 CLAW_DBF_TEXT(2, setup, "init_mod"); 3400 CLAW_DBF_TEXT(2, setup, "init_mod");
3401 claw_root_dev = root_device_register("qeth"); 3401 claw_root_dev = root_device_register("claw");
3402 ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0; 3402 ret = IS_ERR(claw_root_dev) ? PTR_ERR(claw_root_dev) : 0;
3403 if (ret) 3403 if (ret)
3404 goto register_err; 3404 goto register_err;
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index 7c815d3327f7..28d86f9df83c 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -522,6 +522,40 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct of_device *op,
522 set_fan_speeds(fp); 522 set_fan_speeds(fp);
523} 523}
524 524
525static void destroy_one_temp(struct bbc_cpu_temperature *tp)
526{
527 bbc_i2c_detach(tp->client);
528 kfree(tp);
529}
530
531static void destroy_all_temps(struct bbc_i2c_bus *bp)
532{
533 struct bbc_cpu_temperature *tp, *tpos;
534
535 list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) {
536 list_del(&tp->bp_list);
537 list_del(&tp->glob_list);
538 destroy_one_temp(tp);
539 }
540}
541
542static void destroy_one_fan(struct bbc_fan_control *fp)
543{
544 bbc_i2c_detach(fp->client);
545 kfree(fp);
546}
547
548static void destroy_all_fans(struct bbc_i2c_bus *bp)
549{
550 struct bbc_fan_control *fp, *fpos;
551
552 list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) {
553 list_del(&fp->bp_list);
554 list_del(&fp->glob_list);
555 destroy_one_fan(fp);
556 }
557}
558
525int bbc_envctrl_init(struct bbc_i2c_bus *bp) 559int bbc_envctrl_init(struct bbc_i2c_bus *bp)
526{ 560{
527 struct of_device *op; 561 struct of_device *op;
@@ -541,6 +575,8 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
541 int err = PTR_ERR(kenvctrld_task); 575 int err = PTR_ERR(kenvctrld_task);
542 576
543 kenvctrld_task = NULL; 577 kenvctrld_task = NULL;
578 destroy_all_temps(bp);
579 destroy_all_fans(bp);
544 return err; 580 return err;
545 } 581 }
546 } 582 }
@@ -548,35 +584,11 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
548 return 0; 584 return 0;
549} 585}
550 586
551static void destroy_one_temp(struct bbc_cpu_temperature *tp)
552{
553 bbc_i2c_detach(tp->client);
554 kfree(tp);
555}
556
557static void destroy_one_fan(struct bbc_fan_control *fp)
558{
559 bbc_i2c_detach(fp->client);
560 kfree(fp);
561}
562
563void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp) 587void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp)
564{ 588{
565 struct bbc_cpu_temperature *tp, *tpos;
566 struct bbc_fan_control *fp, *fpos;
567
568 if (kenvctrld_task) 589 if (kenvctrld_task)
569 kthread_stop(kenvctrld_task); 590 kthread_stop(kenvctrld_task);
570 591
571 list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) { 592 destroy_all_temps(bp);
572 list_del(&tp->bp_list); 593 destroy_all_fans(bp);
573 list_del(&tp->glob_list);
574 destroy_one_temp(tp);
575 }
576
577 list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) {
578 list_del(&fp->bp_list);
579 list_del(&fp->glob_list);
580 destroy_one_fan(fp);
581 }
582} 594}
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 3bf75924741f..84d3bbaa95e7 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -76,6 +76,7 @@
76 Fix bug in twa_get_param() on 4GB+. 76 Fix bug in twa_get_param() on 4GB+.
77 Use pci_resource_len() for ioremap(). 77 Use pci_resource_len() for ioremap().
78 2.26.02.012 - Add power management support. 78 2.26.02.012 - Add power management support.
79 2.26.02.013 - Fix bug in twa_load_sgl().
79*/ 80*/
80 81
81#include <linux/module.h> 82#include <linux/module.h>
@@ -100,7 +101,7 @@
100#include "3w-9xxx.h" 101#include "3w-9xxx.h"
101 102
102/* Globals */ 103/* Globals */
103#define TW_DRIVER_VERSION "2.26.02.012" 104#define TW_DRIVER_VERSION "2.26.02.013"
104static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; 105static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
105static unsigned int twa_device_extension_count; 106static unsigned int twa_device_extension_count;
106static int twa_major = -1; 107static int twa_major = -1;
@@ -1382,10 +1383,12 @@ static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
1382 newcommand = &full_command_packet->command.newcommand; 1383 newcommand = &full_command_packet->command.newcommand;
1383 newcommand->request_id__lunl = 1384 newcommand->request_id__lunl =
1384 cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id)); 1385 cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id));
1385 newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1); 1386 if (length) {
1386 newcommand->sg_list[0].length = cpu_to_le32(length); 1387 newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1);
1388 newcommand->sg_list[0].length = cpu_to_le32(length);
1389 }
1387 newcommand->sgl_entries__lunh = 1390 newcommand->sgl_entries__lunh =
1388 cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->sgl_entries__lunh), 1)); 1391 cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->sgl_entries__lunh), length ? 1 : 0));
1389 } else { 1392 } else {
1390 oldcommand = &full_command_packet->command.oldcommand; 1393 oldcommand = &full_command_packet->command.oldcommand;
1391 oldcommand->request_id = request_id; 1394 oldcommand->request_id = request_id;
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 36900c71a592..9191d1ea6451 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -388,6 +388,16 @@ config BLK_DEV_3W_XXXX_RAID
388 Please read the comments at the top of 388 Please read the comments at the top of
389 <file:drivers/scsi/3w-xxxx.c>. 389 <file:drivers/scsi/3w-xxxx.c>.
390 390
391config SCSI_HPSA
392 tristate "HP Smart Array SCSI driver"
393 depends on PCI && SCSI
394 help
395 This driver supports HP Smart Array Controllers (circa 2009).
396 It is a SCSI alternative to the cciss driver, which is a block
397 driver. Anyone wishing to use HP Smart Array controllers who
398 would prefer the devices be presented to linux as SCSI devices,
399 rather than as generic block devices should say Y here.
400
391config SCSI_3W_9XXX 401config SCSI_3W_9XXX
392 tristate "3ware 9xxx SATA-RAID support" 402 tristate "3ware 9xxx SATA-RAID support"
393 depends on PCI && SCSI 403 depends on PCI && SCSI
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 280d3c657d60..92a8c500b23d 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -91,6 +91,7 @@ obj-$(CONFIG_SCSI_BFA_FC) += bfa/
91obj-$(CONFIG_SCSI_PAS16) += pas16.o 91obj-$(CONFIG_SCSI_PAS16) += pas16.o
92obj-$(CONFIG_SCSI_T128) += t128.o 92obj-$(CONFIG_SCSI_T128) += t128.o
93obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o 93obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o
94obj-$(CONFIG_SCSI_HPSA) += hpsa.o
94obj-$(CONFIG_SCSI_DTC3280) += dtc.o 95obj-$(CONFIG_SCSI_DTC3280) += dtc.o
95obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/ 96obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/
96obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o 97obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 698a527d6cca..f008708f1b08 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -135,11 +135,15 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
135 while ((compl = be_mcc_compl_get(phba))) { 135 while ((compl = be_mcc_compl_get(phba))) {
136 if (compl->flags & CQE_FLAGS_ASYNC_MASK) { 136 if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
137 /* Interpret flags as an async trailer */ 137 /* Interpret flags as an async trailer */
138 BUG_ON(!is_link_state_evt(compl->flags)); 138 if (is_link_state_evt(compl->flags))
139 /* Interpret compl as a async link evt */
140 beiscsi_async_link_state_process(phba,
141 (struct be_async_event_link_state *) compl);
142 else
143 SE_DEBUG(DBG_LVL_1,
144 " Unsupported Async Event, flags"
145 " = 0x%08x \n", compl->flags);
139 146
140 /* Interpret compl as a async link evt */
141 beiscsi_async_link_state_process(phba,
142 (struct be_async_event_link_state *) compl);
143 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { 147 } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
144 status = be_mcc_compl_process(ctrl, compl); 148 status = be_mcc_compl_process(ctrl, compl);
145 atomic_dec(&phba->ctrl.mcc_obj.q.used); 149 atomic_dec(&phba->ctrl.mcc_obj.q.used);
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 2b973f3c2eb2..6cf9dc37d78b 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -684,6 +684,7 @@ extern unsigned int error_mask1, error_mask2;
684extern u64 iscsi_error_mask; 684extern u64 iscsi_error_mask;
685extern unsigned int en_tcp_dack; 685extern unsigned int en_tcp_dack;
686extern unsigned int event_coal_div; 686extern unsigned int event_coal_div;
687extern unsigned int event_coal_min;
687 688
688extern struct scsi_transport_template *bnx2i_scsi_xport_template; 689extern struct scsi_transport_template *bnx2i_scsi_xport_template;
689extern struct iscsi_transport bnx2i_iscsi_transport; 690extern struct iscsi_transport bnx2i_iscsi_transport;
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 5c8d7630c13e..1af578dec276 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -133,20 +133,38 @@ void bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action)
133{ 133{
134 struct bnx2i_5771x_cq_db *cq_db; 134 struct bnx2i_5771x_cq_db *cq_db;
135 u16 cq_index; 135 u16 cq_index;
136 u16 next_index;
137 u32 num_active_cmds;
136 138
139
140 /* Coalesce CQ entries only on 10G devices */
137 if (!test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) 141 if (!test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type))
138 return; 142 return;
139 143
144 /* Do not update CQ DB multiple times before firmware writes
145 * '0xFFFF' to CQDB->SQN field. Deviation may cause spurious
146 * interrupts and other unwanted results
147 */
148 cq_db = (struct bnx2i_5771x_cq_db *) ep->qp.cq_pgtbl_virt;
149 if (cq_db->sqn[0] && cq_db->sqn[0] != 0xFFFF)
150 return;
151
140 if (action == CNIC_ARM_CQE) { 152 if (action == CNIC_ARM_CQE) {
141 cq_index = ep->qp.cqe_exp_seq_sn + 153 num_active_cmds = ep->num_active_cmds;
142 ep->num_active_cmds / event_coal_div; 154 if (num_active_cmds <= event_coal_min)
143 cq_index %= (ep->qp.cqe_size * 2 + 1); 155 next_index = 1;
144 if (!cq_index) { 156 else
157 next_index = event_coal_min +
158 (num_active_cmds - event_coal_min) / event_coal_div;
159 if (!next_index)
160 next_index = 1;
161 cq_index = ep->qp.cqe_exp_seq_sn + next_index - 1;
162 if (cq_index > ep->qp.cqe_size * 2)
163 cq_index -= ep->qp.cqe_size * 2;
164 if (!cq_index)
145 cq_index = 1; 165 cq_index = 1;
146 cq_db = (struct bnx2i_5771x_cq_db *) 166
147 ep->qp.cq_pgtbl_virt; 167 cq_db->sqn[0] = cq_index;
148 cq_db->sqn[0] = cq_index;
149 }
150 } 168 }
151} 169}
152 170
@@ -366,6 +384,7 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
366 struct bnx2i_cmd *bnx2i_cmd; 384 struct bnx2i_cmd *bnx2i_cmd;
367 struct bnx2i_tmf_request *tmfabort_wqe; 385 struct bnx2i_tmf_request *tmfabort_wqe;
368 u32 dword; 386 u32 dword;
387 u32 scsi_lun[2];
369 388
370 bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data; 389 bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data;
371 tmfabort_hdr = (struct iscsi_tm *)mtask->hdr; 390 tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
@@ -376,27 +395,35 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
376 tmfabort_wqe->op_attr = 0; 395 tmfabort_wqe->op_attr = 0;
377 tmfabort_wqe->op_attr = 396 tmfabort_wqe->op_attr =
378 ISCSI_TMF_REQUEST_ALWAYS_ONE | ISCSI_TM_FUNC_ABORT_TASK; 397 ISCSI_TMF_REQUEST_ALWAYS_ONE | ISCSI_TM_FUNC_ABORT_TASK;
379 tmfabort_wqe->lun[0] = be32_to_cpu(tmfabort_hdr->lun[0]);
380 tmfabort_wqe->lun[1] = be32_to_cpu(tmfabort_hdr->lun[1]);
381 398
382 tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14)); 399 tmfabort_wqe->itt = (mtask->itt | (ISCSI_TASK_TYPE_MPATH << 14));
383 tmfabort_wqe->reserved2 = 0; 400 tmfabort_wqe->reserved2 = 0;
384 tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn); 401 tmfabort_wqe->cmd_sn = be32_to_cpu(tmfabort_hdr->cmdsn);
385 402
386 ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt); 403 ctask = iscsi_itt_to_task(conn, tmfabort_hdr->rtt);
387 if (!ctask || ctask->sc) 404 if (!ctask || !ctask->sc)
388 /* 405 /*
389 * the iscsi layer must have completed the cmd while this 406 * the iscsi layer must have completed the cmd while this
390 * was starting up. 407 * was starting up.
408 *
409 * Note: In the case of a SCSI cmd timeout, the task's sc
410 * is still active; hence ctask->sc != 0
411 * In this case, the task must be aborted
391 */ 412 */
392 return 0; 413 return 0;
414
393 ref_sc = ctask->sc; 415 ref_sc = ctask->sc;
394 416
417 /* Retrieve LUN directly from the ref_sc */
418 int_to_scsilun(ref_sc->device->lun, (struct scsi_lun *) scsi_lun);
419 tmfabort_wqe->lun[0] = be32_to_cpu(scsi_lun[0]);
420 tmfabort_wqe->lun[1] = be32_to_cpu(scsi_lun[1]);
421
395 if (ref_sc->sc_data_direction == DMA_TO_DEVICE) 422 if (ref_sc->sc_data_direction == DMA_TO_DEVICE)
396 dword = (ISCSI_TASK_TYPE_WRITE << ISCSI_CMD_REQUEST_TYPE_SHIFT); 423 dword = (ISCSI_TASK_TYPE_WRITE << ISCSI_CMD_REQUEST_TYPE_SHIFT);
397 else 424 else
398 dword = (ISCSI_TASK_TYPE_READ << ISCSI_CMD_REQUEST_TYPE_SHIFT); 425 dword = (ISCSI_TASK_TYPE_READ << ISCSI_CMD_REQUEST_TYPE_SHIFT);
399 tmfabort_wqe->ref_itt = (dword | tmfabort_hdr->rtt); 426 tmfabort_wqe->ref_itt = (dword | (tmfabort_hdr->rtt & ISCSI_ITT_MASK));
400 tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn); 427 tmfabort_wqe->ref_cmd_sn = be32_to_cpu(tmfabort_hdr->refcmdsn);
401 428
402 tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma; 429 tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma;
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 0c4210d48ee8..6d8172e781cf 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -17,8 +17,8 @@ static struct list_head adapter_list = LIST_HEAD_INIT(adapter_list);
17static u32 adapter_count; 17static u32 adapter_count;
18 18
19#define DRV_MODULE_NAME "bnx2i" 19#define DRV_MODULE_NAME "bnx2i"
20#define DRV_MODULE_VERSION "2.0.1e" 20#define DRV_MODULE_VERSION "2.1.0"
21#define DRV_MODULE_RELDATE "June 22, 2009" 21#define DRV_MODULE_RELDATE "Dec 06, 2009"
22 22
23static char version[] __devinitdata = 23static char version[] __devinitdata =
24 "Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \ 24 "Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
@@ -32,6 +32,10 @@ MODULE_VERSION(DRV_MODULE_VERSION);
32 32
33static DEFINE_MUTEX(bnx2i_dev_lock); 33static DEFINE_MUTEX(bnx2i_dev_lock);
34 34
35unsigned int event_coal_min = 24;
36module_param(event_coal_min, int, 0664);
37MODULE_PARM_DESC(event_coal_min, "Event Coalescing Minimum Commands");
38
35unsigned int event_coal_div = 1; 39unsigned int event_coal_div = 1;
36module_param(event_coal_div, int, 0664); 40module_param(event_coal_div, int, 0664);
37MODULE_PARM_DESC(event_coal_div, "Event Coalescing Divide Factor"); 41MODULE_PARM_DESC(event_coal_div, "Event Coalescing Divide Factor");
@@ -83,8 +87,12 @@ void bnx2i_identify_device(struct bnx2i_hba *hba)
83 set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type); 87 set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type);
84 hba->mail_queue_access = BNX2I_MQ_BIN_MODE; 88 hba->mail_queue_access = BNX2I_MQ_BIN_MODE;
85 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_57710 || 89 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_57710 ||
86 hba->pci_did == PCI_DEVICE_ID_NX2_57711) 90 hba->pci_did == PCI_DEVICE_ID_NX2_57711 ||
91 hba->pci_did == PCI_DEVICE_ID_NX2_57711E)
87 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type); 92 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type);
93 else
94 printk(KERN_ALERT "bnx2i: unknown device, 0x%x\n",
95 hba->pci_did);
88} 96}
89 97
90 98
@@ -363,7 +371,7 @@ static int __init bnx2i_mod_init(void)
363 371
364 printk(KERN_INFO "%s", version); 372 printk(KERN_INFO "%s", version);
365 373
366 if (!is_power_of_2(sq_size)) 374 if (sq_size && !is_power_of_2(sq_size))
367 sq_size = roundup_pow_of_two(sq_size); 375 sq_size = roundup_pow_of_two(sq_size);
368 376
369 mutex_init(&bnx2i_dev_lock); 377 mutex_init(&bnx2i_dev_lock);
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 132898c88d5e..33b2294625bb 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -485,7 +485,6 @@ static int bnx2i_setup_cmd_pool(struct bnx2i_hba *hba,
485 struct iscsi_task *task = session->cmds[i]; 485 struct iscsi_task *task = session->cmds[i];
486 struct bnx2i_cmd *cmd = task->dd_data; 486 struct bnx2i_cmd *cmd = task->dd_data;
487 487
488 /* Anil */
489 task->hdr = &cmd->hdr; 488 task->hdr = &cmd->hdr;
490 task->hdr_max = sizeof(struct iscsi_hdr); 489 task->hdr_max = sizeof(struct iscsi_hdr);
491 490
@@ -765,7 +764,6 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
765 hba->pci_svid = hba->pcidev->subsystem_vendor; 764 hba->pci_svid = hba->pcidev->subsystem_vendor;
766 hba->pci_func = PCI_FUNC(hba->pcidev->devfn); 765 hba->pci_func = PCI_FUNC(hba->pcidev->devfn);
767 hba->pci_devno = PCI_SLOT(hba->pcidev->devfn); 766 hba->pci_devno = PCI_SLOT(hba->pcidev->devfn);
768 bnx2i_identify_device(hba);
769 767
770 bnx2i_identify_device(hba); 768 bnx2i_identify_device(hba);
771 bnx2i_setup_host_queue_size(hba, shost); 769 bnx2i_setup_host_queue_size(hba, shost);
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index c1d5be4adf9c..15a00e8b7122 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -291,7 +291,7 @@ static void act_open_req_arp_failure(struct t3cdev *dev, struct sk_buff *skb)
291 c3cn_hold(c3cn); 291 c3cn_hold(c3cn);
292 spin_lock_bh(&c3cn->lock); 292 spin_lock_bh(&c3cn->lock);
293 if (c3cn->state == C3CN_STATE_CONNECTING) 293 if (c3cn->state == C3CN_STATE_CONNECTING)
294 fail_act_open(c3cn, EHOSTUNREACH); 294 fail_act_open(c3cn, -EHOSTUNREACH);
295 spin_unlock_bh(&c3cn->lock); 295 spin_unlock_bh(&c3cn->lock);
296 c3cn_put(c3cn); 296 c3cn_put(c3cn);
297 __kfree_skb(skb); 297 __kfree_skb(skb);
@@ -792,18 +792,18 @@ static int act_open_rpl_status_to_errno(int status)
792{ 792{
793 switch (status) { 793 switch (status) {
794 case CPL_ERR_CONN_RESET: 794 case CPL_ERR_CONN_RESET:
795 return ECONNREFUSED; 795 return -ECONNREFUSED;
796 case CPL_ERR_ARP_MISS: 796 case CPL_ERR_ARP_MISS:
797 return EHOSTUNREACH; 797 return -EHOSTUNREACH;
798 case CPL_ERR_CONN_TIMEDOUT: 798 case CPL_ERR_CONN_TIMEDOUT:
799 return ETIMEDOUT; 799 return -ETIMEDOUT;
800 case CPL_ERR_TCAM_FULL: 800 case CPL_ERR_TCAM_FULL:
801 return ENOMEM; 801 return -ENOMEM;
802 case CPL_ERR_CONN_EXIST: 802 case CPL_ERR_CONN_EXIST:
803 cxgb3i_log_error("ACTIVE_OPEN_RPL: 4-tuple in use\n"); 803 cxgb3i_log_error("ACTIVE_OPEN_RPL: 4-tuple in use\n");
804 return EADDRINUSE; 804 return -EADDRINUSE;
805 default: 805 default:
806 return EIO; 806 return -EIO;
807 } 807 }
808} 808}
809 809
@@ -817,7 +817,7 @@ static void act_open_retry_timer(unsigned long data)
817 spin_lock_bh(&c3cn->lock); 817 spin_lock_bh(&c3cn->lock);
818 skb = alloc_skb(sizeof(struct cpl_act_open_req), GFP_ATOMIC); 818 skb = alloc_skb(sizeof(struct cpl_act_open_req), GFP_ATOMIC);
819 if (!skb) 819 if (!skb)
820 fail_act_open(c3cn, ENOMEM); 820 fail_act_open(c3cn, -ENOMEM);
821 else { 821 else {
822 skb->sk = (struct sock *)c3cn; 822 skb->sk = (struct sock *)c3cn;
823 set_arp_failure_handler(skb, act_open_req_arp_failure); 823 set_arp_failure_handler(skb, act_open_req_arp_failure);
@@ -966,14 +966,14 @@ static int abort_status_to_errno(struct s3_conn *c3cn, int abort_reason,
966 case CPL_ERR_BAD_SYN: /* fall through */ 966 case CPL_ERR_BAD_SYN: /* fall through */
967 case CPL_ERR_CONN_RESET: 967 case CPL_ERR_CONN_RESET:
968 return c3cn->state > C3CN_STATE_ESTABLISHED ? 968 return c3cn->state > C3CN_STATE_ESTABLISHED ?
969 EPIPE : ECONNRESET; 969 -EPIPE : -ECONNRESET;
970 case CPL_ERR_XMIT_TIMEDOUT: 970 case CPL_ERR_XMIT_TIMEDOUT:
971 case CPL_ERR_PERSIST_TIMEDOUT: 971 case CPL_ERR_PERSIST_TIMEDOUT:
972 case CPL_ERR_FINWAIT2_TIMEDOUT: 972 case CPL_ERR_FINWAIT2_TIMEDOUT:
973 case CPL_ERR_KEEPALIVE_TIMEDOUT: 973 case CPL_ERR_KEEPALIVE_TIMEDOUT:
974 return ETIMEDOUT; 974 return -ETIMEDOUT;
975 default: 975 default:
976 return EIO; 976 return -EIO;
977 } 977 }
978} 978}
979 979
@@ -1440,6 +1440,10 @@ void cxgb3i_c3cn_release(struct s3_conn *c3cn)
1440static int is_cxgb3_dev(struct net_device *dev) 1440static int is_cxgb3_dev(struct net_device *dev)
1441{ 1441{
1442 struct cxgb3i_sdev_data *cdata; 1442 struct cxgb3i_sdev_data *cdata;
1443 struct net_device *ndev = dev;
1444
1445 if (dev->priv_flags & IFF_802_1Q_VLAN)
1446 ndev = vlan_dev_real_dev(dev);
1443 1447
1444 write_lock(&cdata_rwlock); 1448 write_lock(&cdata_rwlock);
1445 list_for_each_entry(cdata, &cdata_list, list) { 1449 list_for_each_entry(cdata, &cdata_list, list) {
@@ -1447,7 +1451,7 @@ static int is_cxgb3_dev(struct net_device *dev)
1447 int i; 1451 int i;
1448 1452
1449 for (i = 0; i < ports->nports; i++) 1453 for (i = 0; i < ports->nports; i++)
1450 if (dev == ports->lldevs[i]) { 1454 if (ndev == ports->lldevs[i]) {
1451 write_unlock(&cdata_rwlock); 1455 write_unlock(&cdata_rwlock);
1452 return 1; 1456 return 1;
1453 } 1457 }
@@ -1563,9 +1567,29 @@ free_tid:
1563 s3_free_atid(cdev, c3cn->tid); 1567 s3_free_atid(cdev, c3cn->tid);
1564 c3cn->tid = 0; 1568 c3cn->tid = 0;
1565out_err: 1569out_err:
1566 return -1; 1570 return -EINVAL;
1567} 1571}
1568 1572
1573/**
1574 * cxgb3i_find_dev - find the interface associated with the given address
1575 * @ipaddr: ip address
1576 */
1577static struct net_device *
1578cxgb3i_find_dev(struct net_device *dev, __be32 ipaddr)
1579{
1580 struct flowi fl;
1581 int err;
1582 struct rtable *rt;
1583
1584 memset(&fl, 0, sizeof(fl));
1585 fl.nl_u.ip4_u.daddr = ipaddr;
1586
1587 err = ip_route_output_key(dev ? dev_net(dev) : &init_net, &rt, &fl);
1588 if (!err)
1589 return (&rt->u.dst)->dev;
1590
1591 return NULL;
1592}
1569 1593
1570/** 1594/**
1571 * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address 1595 * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address
@@ -1581,6 +1605,7 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn,
1581 struct cxgb3i_sdev_data *cdata; 1605 struct cxgb3i_sdev_data *cdata;
1582 struct t3cdev *cdev; 1606 struct t3cdev *cdev;
1583 __be32 sipv4; 1607 __be32 sipv4;
1608 struct net_device *dstdev;
1584 int err; 1609 int err;
1585 1610
1586 c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev); 1611 c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev);
@@ -1591,6 +1616,13 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn,
1591 c3cn->daddr.sin_port = usin->sin_port; 1616 c3cn->daddr.sin_port = usin->sin_port;
1592 c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr; 1617 c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr;
1593 1618
1619 dstdev = cxgb3i_find_dev(dev, usin->sin_addr.s_addr);
1620 if (!dstdev || !is_cxgb3_dev(dstdev))
1621 return -ENETUNREACH;
1622
1623 if (dstdev->priv_flags & IFF_802_1Q_VLAN)
1624 dev = dstdev;
1625
1594 rt = find_route(dev, c3cn->saddr.sin_addr.s_addr, 1626 rt = find_route(dev, c3cn->saddr.sin_addr.s_addr,
1595 c3cn->daddr.sin_addr.s_addr, 1627 c3cn->daddr.sin_addr.s_addr,
1596 c3cn->saddr.sin_port, 1628 c3cn->saddr.sin_port,
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
index 709105071177..1fe3b0f1f3c9 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
@@ -388,8 +388,8 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *task)
388 if (err > 0) { 388 if (err > 0) {
389 int pdulen = err; 389 int pdulen = err;
390 390
391 cxgb3i_tx_debug("task 0x%p, skb 0x%p, len %u/%u, rv %d.\n", 391 cxgb3i_tx_debug("task 0x%p, skb 0x%p, len %u/%u, rv %d.\n",
392 task, skb, skb->len, skb->data_len, err); 392 task, skb, skb->len, skb->data_len, err);
393 393
394 if (task->conn->hdrdgst_en) 394 if (task->conn->hdrdgst_en)
395 pdulen += ISCSI_DIGEST_SIZE; 395 pdulen += ISCSI_DIGEST_SIZE;
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index 47cfe1c49c3e..1a660191a905 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -748,6 +748,8 @@ static const struct scsi_dh_devlist rdac_dev_list[] = {
748 {"IBM", "1724"}, 748 {"IBM", "1724"},
749 {"IBM", "1726"}, 749 {"IBM", "1726"},
750 {"IBM", "1742"}, 750 {"IBM", "1742"},
751 {"IBM", "1745"},
752 {"IBM", "1746"},
751 {"IBM", "1814"}, 753 {"IBM", "1814"},
752 {"IBM", "1815"}, 754 {"IBM", "1815"},
753 {"IBM", "1818"}, 755 {"IBM", "1818"},
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index a30ffaa1222c..10be9f36a4cc 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -101,6 +101,8 @@ static int fcoe_cpu_callback(struct notifier_block *, unsigned long, void *);
101 101
102static int fcoe_create(const char *, struct kernel_param *); 102static int fcoe_create(const char *, struct kernel_param *);
103static int fcoe_destroy(const char *, struct kernel_param *); 103static int fcoe_destroy(const char *, struct kernel_param *);
104static int fcoe_enable(const char *, struct kernel_param *);
105static int fcoe_disable(const char *, struct kernel_param *);
104 106
105static struct fc_seq *fcoe_elsct_send(struct fc_lport *, 107static struct fc_seq *fcoe_elsct_send(struct fc_lport *,
106 u32 did, struct fc_frame *, 108 u32 did, struct fc_frame *,
@@ -115,10 +117,16 @@ static void fcoe_get_lesb(struct fc_lport *, struct fc_els_lesb *);
115 117
116module_param_call(create, fcoe_create, NULL, NULL, S_IWUSR); 118module_param_call(create, fcoe_create, NULL, NULL, S_IWUSR);
117__MODULE_PARM_TYPE(create, "string"); 119__MODULE_PARM_TYPE(create, "string");
118MODULE_PARM_DESC(create, "Create fcoe fcoe using net device passed in."); 120MODULE_PARM_DESC(create, " Creates fcoe instance on a ethernet interface");
119module_param_call(destroy, fcoe_destroy, NULL, NULL, S_IWUSR); 121module_param_call(destroy, fcoe_destroy, NULL, NULL, S_IWUSR);
120__MODULE_PARM_TYPE(destroy, "string"); 122__MODULE_PARM_TYPE(destroy, "string");
121MODULE_PARM_DESC(destroy, "Destroy fcoe fcoe"); 123MODULE_PARM_DESC(destroy, " Destroys fcoe instance on a ethernet interface");
124module_param_call(enable, fcoe_enable, NULL, NULL, S_IWUSR);
125__MODULE_PARM_TYPE(enable, "string");
126MODULE_PARM_DESC(enable, " Enables fcoe on a ethernet interface.");
127module_param_call(disable, fcoe_disable, NULL, NULL, S_IWUSR);
128__MODULE_PARM_TYPE(disable, "string");
129MODULE_PARM_DESC(disable, " Disables fcoe on a ethernet interface.");
122 130
123/* notification function for packets from net device */ 131/* notification function for packets from net device */
124static struct notifier_block fcoe_notifier = { 132static struct notifier_block fcoe_notifier = {
@@ -545,6 +553,23 @@ static void fcoe_queue_timer(ulong lport)
545} 553}
546 554
547/** 555/**
556 * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
557 * @netdev: the associated net device
558 * @wwn: the output WWN
559 * @type: the type of WWN (WWPN or WWNN)
560 *
561 * Returns: 0 for success
562 */
563static int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
564{
565 const struct net_device_ops *ops = netdev->netdev_ops;
566
567 if (ops->ndo_fcoe_get_wwn)
568 return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
569 return -EINVAL;
570}
571
572/**
548 * fcoe_netdev_config() - Set up net devive for SW FCoE 573 * fcoe_netdev_config() - Set up net devive for SW FCoE
549 * @lport: The local port that is associated with the net device 574 * @lport: The local port that is associated with the net device
550 * @netdev: The associated net device 575 * @netdev: The associated net device
@@ -611,9 +636,13 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
611 */ 636 */
612 if (netdev->priv_flags & IFF_802_1Q_VLAN) 637 if (netdev->priv_flags & IFF_802_1Q_VLAN)
613 vid = vlan_dev_vlan_id(netdev); 638 vid = vlan_dev_vlan_id(netdev);
614 wwnn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr, 1, 0); 639
640 if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
641 wwnn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr, 1, 0);
615 fc_set_wwnn(lport, wwnn); 642 fc_set_wwnn(lport, wwnn);
616 wwpn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr, 2, vid); 643 if (fcoe_get_wwn(netdev, &wwpn, NETDEV_FCOE_WWPN))
644 wwpn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr,
645 2, vid);
617 fc_set_wwpn(lport, wwpn); 646 fc_set_wwpn(lport, wwpn);
618 } 647 }
619 648
@@ -1231,7 +1260,7 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
1231 "CPU.\n"); 1260 "CPU.\n");
1232 1261
1233 spin_unlock_bh(&fps->fcoe_rx_list.lock); 1262 spin_unlock_bh(&fps->fcoe_rx_list.lock);
1234 cpu = first_cpu(cpu_online_map); 1263 cpu = cpumask_first(cpu_online_mask);
1235 fps = &per_cpu(fcoe_percpu, cpu); 1264 fps = &per_cpu(fcoe_percpu, cpu);
1236 spin_lock_bh(&fps->fcoe_rx_list.lock); 1265 spin_lock_bh(&fps->fcoe_rx_list.lock);
1237 if (!fps->thread) { 1266 if (!fps->thread) {
@@ -1838,6 +1867,104 @@ static struct net_device *fcoe_if_to_netdev(const char *buffer)
1838} 1867}
1839 1868
1840/** 1869/**
1870 * fcoe_disable() - Disables a FCoE interface
1871 * @buffer: The name of the Ethernet interface to be disabled
1872 * @kp: The associated kernel parameter
1873 *
1874 * Called from sysfs.
1875 *
1876 * Returns: 0 for success
1877 */
1878static int fcoe_disable(const char *buffer, struct kernel_param *kp)
1879{
1880 struct fcoe_interface *fcoe;
1881 struct net_device *netdev;
1882 int rc = 0;
1883
1884 mutex_lock(&fcoe_config_mutex);
1885#ifdef CONFIG_FCOE_MODULE
1886 /*
1887 * Make sure the module has been initialized, and is not about to be
1888 * removed. Module paramter sysfs files are writable before the
1889 * module_init function is called and after module_exit.
1890 */
1891 if (THIS_MODULE->state != MODULE_STATE_LIVE) {
1892 rc = -ENODEV;
1893 goto out_nodev;
1894 }
1895#endif
1896
1897 netdev = fcoe_if_to_netdev(buffer);
1898 if (!netdev) {
1899 rc = -ENODEV;
1900 goto out_nodev;
1901 }
1902
1903 rtnl_lock();
1904 fcoe = fcoe_hostlist_lookup_port(netdev);
1905 rtnl_unlock();
1906
1907 if (fcoe)
1908 fc_fabric_logoff(fcoe->ctlr.lp);
1909 else
1910 rc = -ENODEV;
1911
1912 dev_put(netdev);
1913out_nodev:
1914 mutex_unlock(&fcoe_config_mutex);
1915 return rc;
1916}
1917
1918/**
1919 * fcoe_enable() - Enables a FCoE interface
1920 * @buffer: The name of the Ethernet interface to be enabled
1921 * @kp: The associated kernel parameter
1922 *
1923 * Called from sysfs.
1924 *
1925 * Returns: 0 for success
1926 */
1927static int fcoe_enable(const char *buffer, struct kernel_param *kp)
1928{
1929 struct fcoe_interface *fcoe;
1930 struct net_device *netdev;
1931 int rc = 0;
1932
1933 mutex_lock(&fcoe_config_mutex);
1934#ifdef CONFIG_FCOE_MODULE
1935 /*
1936 * Make sure the module has been initialized, and is not about to be
1937 * removed. Module paramter sysfs files are writable before the
1938 * module_init function is called and after module_exit.
1939 */
1940 if (THIS_MODULE->state != MODULE_STATE_LIVE) {
1941 rc = -ENODEV;
1942 goto out_nodev;
1943 }
1944#endif
1945
1946 netdev = fcoe_if_to_netdev(buffer);
1947 if (!netdev) {
1948 rc = -ENODEV;
1949 goto out_nodev;
1950 }
1951
1952 rtnl_lock();
1953 fcoe = fcoe_hostlist_lookup_port(netdev);
1954 rtnl_unlock();
1955
1956 if (fcoe)
1957 rc = fc_fabric_login(fcoe->ctlr.lp);
1958 else
1959 rc = -ENODEV;
1960
1961 dev_put(netdev);
1962out_nodev:
1963 mutex_unlock(&fcoe_config_mutex);
1964 return rc;
1965}
1966
1967/**
1841 * fcoe_destroy() - Destroy a FCoE interface 1968 * fcoe_destroy() - Destroy a FCoE interface
1842 * @buffer: The name of the Ethernet interface to be destroyed 1969 * @buffer: The name of the Ethernet interface to be destroyed
1843 * @kp: The associated kernel parameter 1970 * @kp: The associated kernel parameter
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
new file mode 100644
index 000000000000..bb96fdd58e23
--- /dev/null
+++ b/drivers/scsi/hpsa.c
@@ -0,0 +1,3531 @@
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2000, 2009 Hewlett-Packard Development Company, L.P.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
19 *
20 */
21
22#include <linux/module.h>
23#include <linux/interrupt.h>
24#include <linux/types.h>
25#include <linux/pci.h>
26#include <linux/kernel.h>
27#include <linux/slab.h>
28#include <linux/delay.h>
29#include <linux/fs.h>
30#include <linux/timer.h>
31#include <linux/seq_file.h>
32#include <linux/init.h>
33#include <linux/spinlock.h>
34#include <linux/smp_lock.h>
35#include <linux/compat.h>
36#include <linux/blktrace_api.h>
37#include <linux/uaccess.h>
38#include <linux/io.h>
39#include <linux/dma-mapping.h>
40#include <linux/completion.h>
41#include <linux/moduleparam.h>
42#include <scsi/scsi.h>
43#include <scsi/scsi_cmnd.h>
44#include <scsi/scsi_device.h>
45#include <scsi/scsi_host.h>
46#include <linux/cciss_ioctl.h>
47#include <linux/string.h>
48#include <linux/bitmap.h>
49#include <asm/atomic.h>
50#include <linux/kthread.h>
51#include "hpsa_cmd.h"
52#include "hpsa.h"
53
54/* HPSA_DRIVER_VERSION must be 3 byte values (0-255) separated by '.' */
55#define HPSA_DRIVER_VERSION "1.0.0"
56#define DRIVER_NAME "HP HPSA Driver (v " HPSA_DRIVER_VERSION ")"
57
58/* How long to wait (in milliseconds) for board to go into simple mode */
59#define MAX_CONFIG_WAIT 30000
60#define MAX_IOCTL_CONFIG_WAIT 1000
61
62/*define how many times we will try a command because of bus resets */
63#define MAX_CMD_RETRIES 3
64
65/* Embedded module documentation macros - see modules.h */
66MODULE_AUTHOR("Hewlett-Packard Company");
67MODULE_DESCRIPTION("Driver for HP Smart Array Controller version " \
68 HPSA_DRIVER_VERSION);
69MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
70MODULE_VERSION(HPSA_DRIVER_VERSION);
71MODULE_LICENSE("GPL");
72
73static int hpsa_allow_any;
74module_param(hpsa_allow_any, int, S_IRUGO|S_IWUSR);
75MODULE_PARM_DESC(hpsa_allow_any,
76 "Allow hpsa driver to access unknown HP Smart Array hardware");
77
78/* define the PCI info for the cards we can control */
79static const struct pci_device_id hpsa_pci_device_id[] = {
80 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3223},
81 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3234},
82 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x323D},
83 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3241},
84 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3243},
85 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245},
86 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247},
87 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
88 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324a},
89 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324b},
90 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
91 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
92 {0,}
93};
94
95MODULE_DEVICE_TABLE(pci, hpsa_pci_device_id);
96
97/* board_id = Subsystem Device ID & Vendor ID
98 * product = Marketing Name for the board
99 * access = Address of the struct of function pointers
100 */
101static struct board_type products[] = {
102 {0x3223103C, "Smart Array P800", &SA5_access},
103 {0x3234103C, "Smart Array P400", &SA5_access},
104 {0x323d103c, "Smart Array P700M", &SA5_access},
105 {0x3241103C, "Smart Array P212", &SA5_access},
106 {0x3243103C, "Smart Array P410", &SA5_access},
107 {0x3245103C, "Smart Array P410i", &SA5_access},
108 {0x3247103C, "Smart Array P411", &SA5_access},
109 {0x3249103C, "Smart Array P812", &SA5_access},
110 {0x324a103C, "Smart Array P712m", &SA5_access},
111 {0x324b103C, "Smart Array P711m", &SA5_access},
112 {0xFFFF103C, "Unknown Smart Array", &SA5_access},
113};
114
115static int number_of_controllers;
116
117static irqreturn_t do_hpsa_intr(int irq, void *dev_id);
118static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg);
119static void start_io(struct ctlr_info *h);
120
121#ifdef CONFIG_COMPAT
122static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg);
123#endif
124
125static void cmd_free(struct ctlr_info *h, struct CommandList *c);
126static void cmd_special_free(struct ctlr_info *h, struct CommandList *c);
127static struct CommandList *cmd_alloc(struct ctlr_info *h);
128static struct CommandList *cmd_special_alloc(struct ctlr_info *h);
129static void fill_cmd(struct CommandList *c, __u8 cmd, struct ctlr_info *h,
130 void *buff, size_t size, __u8 page_code, unsigned char *scsi3addr,
131 int cmd_type);
132
133static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
134 void (*done)(struct scsi_cmnd *));
135
136static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd);
137static int hpsa_slave_alloc(struct scsi_device *sdev);
138static void hpsa_slave_destroy(struct scsi_device *sdev);
139
140static ssize_t raid_level_show(struct device *dev,
141 struct device_attribute *attr, char *buf);
142static ssize_t lunid_show(struct device *dev,
143 struct device_attribute *attr, char *buf);
144static ssize_t unique_id_show(struct device *dev,
145 struct device_attribute *attr, char *buf);
146static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno);
147static ssize_t host_store_rescan(struct device *dev,
148 struct device_attribute *attr, const char *buf, size_t count);
149static int check_for_unit_attention(struct ctlr_info *h,
150 struct CommandList *c);
151static void check_ioctl_unit_attention(struct ctlr_info *h,
152 struct CommandList *c);
153
154static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
155static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
156static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
157static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
158
159static struct device_attribute *hpsa_sdev_attrs[] = {
160 &dev_attr_raid_level,
161 &dev_attr_lunid,
162 &dev_attr_unique_id,
163 NULL,
164};
165
166static struct device_attribute *hpsa_shost_attrs[] = {
167 &dev_attr_rescan,
168 NULL,
169};
170
171static struct scsi_host_template hpsa_driver_template = {
172 .module = THIS_MODULE,
173 .name = "hpsa",
174 .proc_name = "hpsa",
175 .queuecommand = hpsa_scsi_queue_command,
176 .can_queue = 512,
177 .this_id = -1,
178 .sg_tablesize = MAXSGENTRIES,
179 .cmd_per_lun = 512,
180 .use_clustering = ENABLE_CLUSTERING,
181 .eh_device_reset_handler = hpsa_eh_device_reset_handler,
182 .ioctl = hpsa_ioctl,
183 .slave_alloc = hpsa_slave_alloc,
184 .slave_destroy = hpsa_slave_destroy,
185#ifdef CONFIG_COMPAT
186 .compat_ioctl = hpsa_compat_ioctl,
187#endif
188 .sdev_attrs = hpsa_sdev_attrs,
189 .shost_attrs = hpsa_shost_attrs,
190};
191
192static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
193{
194 unsigned long *priv = shost_priv(sdev->host);
195 return (struct ctlr_info *) *priv;
196}
197
198static struct task_struct *hpsa_scan_thread;
199static DEFINE_MUTEX(hpsa_scan_mutex);
200static LIST_HEAD(hpsa_scan_q);
201static int hpsa_scan_func(void *data);
202
203/**
204 * add_to_scan_list() - add controller to rescan queue
205 * @h: Pointer to the controller.
206 *
207 * Adds the controller to the rescan queue if not already on the queue.
208 *
209 * returns 1 if added to the queue, 0 if skipped (could be on the
210 * queue already, or the controller could be initializing or shutting
211 * down).
212 **/
213static int add_to_scan_list(struct ctlr_info *h)
214{
215 struct ctlr_info *test_h;
216 int found = 0;
217 int ret = 0;
218
219 if (h->busy_initializing)
220 return 0;
221
222 /*
223 * If we don't get the lock, it means the driver is unloading
224 * and there's no point in scheduling a new scan.
225 */
226 if (!mutex_trylock(&h->busy_shutting_down))
227 return 0;
228
229 mutex_lock(&hpsa_scan_mutex);
230 list_for_each_entry(test_h, &hpsa_scan_q, scan_list) {
231 if (test_h == h) {
232 found = 1;
233 break;
234 }
235 }
236 if (!found && !h->busy_scanning) {
237 INIT_COMPLETION(h->scan_wait);
238 list_add_tail(&h->scan_list, &hpsa_scan_q);
239 ret = 1;
240 }
241 mutex_unlock(&hpsa_scan_mutex);
242 mutex_unlock(&h->busy_shutting_down);
243
244 return ret;
245}
246
247/**
248 * remove_from_scan_list() - remove controller from rescan queue
249 * @h: Pointer to the controller.
250 *
251 * Removes the controller from the rescan queue if present. Blocks if
252 * the controller is currently conducting a rescan. The controller
253 * can be in one of three states:
254 * 1. Doesn't need a scan
255 * 2. On the scan list, but not scanning yet (we remove it)
256 * 3. Busy scanning (and not on the list). In this case we want to wait for
257 * the scan to complete to make sure the scanning thread for this
258 * controller is completely idle.
259 **/
260static void remove_from_scan_list(struct ctlr_info *h)
261{
262 struct ctlr_info *test_h, *tmp_h;
263
264 mutex_lock(&hpsa_scan_mutex);
265 list_for_each_entry_safe(test_h, tmp_h, &hpsa_scan_q, scan_list) {
266 if (test_h == h) { /* state 2. */
267 list_del(&h->scan_list);
268 complete_all(&h->scan_wait);
269 mutex_unlock(&hpsa_scan_mutex);
270 return;
271 }
272 }
273 if (h->busy_scanning) { /* state 3. */
274 mutex_unlock(&hpsa_scan_mutex);
275 wait_for_completion(&h->scan_wait);
276 } else { /* state 1, nothing to do. */
277 mutex_unlock(&hpsa_scan_mutex);
278 }
279}
280
281/* hpsa_scan_func() - kernel thread used to rescan controllers
282 * @data: Ignored.
283 *
284 * A kernel thread used scan for drive topology changes on
285 * controllers. The thread processes only one controller at a time
286 * using a queue. Controllers are added to the queue using
287 * add_to_scan_list() and removed from the queue either after done
288 * processing or using remove_from_scan_list().
289 *
290 * returns 0.
291 **/
292static int hpsa_scan_func(__attribute__((unused)) void *data)
293{
294 struct ctlr_info *h;
295 int host_no;
296
297 while (1) {
298 set_current_state(TASK_INTERRUPTIBLE);
299 schedule();
300 if (kthread_should_stop())
301 break;
302
303 while (1) {
304 mutex_lock(&hpsa_scan_mutex);
305 if (list_empty(&hpsa_scan_q)) {
306 mutex_unlock(&hpsa_scan_mutex);
307 break;
308 }
309 h = list_entry(hpsa_scan_q.next, struct ctlr_info,
310 scan_list);
311 list_del(&h->scan_list);
312 h->busy_scanning = 1;
313 mutex_unlock(&hpsa_scan_mutex);
314 host_no = h->scsi_host ? h->scsi_host->host_no : -1;
315 hpsa_update_scsi_devices(h, host_no);
316 complete_all(&h->scan_wait);
317 mutex_lock(&hpsa_scan_mutex);
318 h->busy_scanning = 0;
319 mutex_unlock(&hpsa_scan_mutex);
320 }
321 }
322 return 0;
323}
324
325static int check_for_unit_attention(struct ctlr_info *h,
326 struct CommandList *c)
327{
328 if (c->err_info->SenseInfo[2] != UNIT_ATTENTION)
329 return 0;
330
331 switch (c->err_info->SenseInfo[12]) {
332 case STATE_CHANGED:
333 dev_warn(&h->pdev->dev, "hpsa%d: a state change "
334 "detected, command retried\n", h->ctlr);
335 break;
336 case LUN_FAILED:
337 dev_warn(&h->pdev->dev, "hpsa%d: LUN failure "
338 "detected, action required\n", h->ctlr);
339 break;
340 case REPORT_LUNS_CHANGED:
341 dev_warn(&h->pdev->dev, "hpsa%d: report LUN data "
342 "changed\n", h->ctlr);
343 /*
344 * Here, we could call add_to_scan_list and wake up the scan thread,
345 * except that it's quite likely that we will get more than one
346 * REPORT_LUNS_CHANGED condition in quick succession, which means
347 * that those which occur after the first one will likely happen
348 * *during* the hpsa_scan_thread's rescan. And the rescan code is not
349 * robust enough to restart in the middle, undoing what it has already
350 * done, and it's not clear that it's even possible to do this, since
351 * part of what it does is notify the SCSI mid layer, which starts
352 * doing it's own i/o to read partition tables and so on, and the
353 * driver doesn't have visibility to know what might need undoing.
354 * In any event, if possible, it is horribly complicated to get right
355 * so we just don't do it for now.
356 *
357 * Note: this REPORT_LUNS_CHANGED condition only occurs on the MSA2012.
358 */
359 break;
360 case POWER_OR_RESET:
361 dev_warn(&h->pdev->dev, "hpsa%d: a power on "
362 "or device reset detected\n", h->ctlr);
363 break;
364 case UNIT_ATTENTION_CLEARED:
365 dev_warn(&h->pdev->dev, "hpsa%d: unit attention "
366 "cleared by another initiator\n", h->ctlr);
367 break;
368 default:
369 dev_warn(&h->pdev->dev, "hpsa%d: unknown "
370 "unit attention detected\n", h->ctlr);
371 break;
372 }
373 return 1;
374}
375
376static ssize_t host_store_rescan(struct device *dev,
377 struct device_attribute *attr,
378 const char *buf, size_t count)
379{
380 struct ctlr_info *h;
381 struct Scsi_Host *shost = class_to_shost(dev);
382 unsigned long *priv = shost_priv(shost);
383 h = (struct ctlr_info *) *priv;
384 if (add_to_scan_list(h)) {
385 wake_up_process(hpsa_scan_thread);
386 wait_for_completion_interruptible(&h->scan_wait);
387 }
388 return count;
389}
390
391/* Enqueuing and dequeuing functions for cmdlists. */
392static inline void addQ(struct hlist_head *list, struct CommandList *c)
393{
394 hlist_add_head(&c->list, list);
395}
396
397static void enqueue_cmd_and_start_io(struct ctlr_info *h,
398 struct CommandList *c)
399{
400 unsigned long flags;
401 spin_lock_irqsave(&h->lock, flags);
402 addQ(&h->reqQ, c);
403 h->Qdepth++;
404 start_io(h);
405 spin_unlock_irqrestore(&h->lock, flags);
406}
407
408static inline void removeQ(struct CommandList *c)
409{
410 if (WARN_ON(hlist_unhashed(&c->list)))
411 return;
412 hlist_del_init(&c->list);
413}
414
415static inline int is_hba_lunid(unsigned char scsi3addr[])
416{
417 return memcmp(scsi3addr, RAID_CTLR_LUNID, 8) == 0;
418}
419
420static inline int is_logical_dev_addr_mode(unsigned char scsi3addr[])
421{
422 return (scsi3addr[3] & 0xC0) == 0x40;
423}
424
425static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG",
426 "UNKNOWN"
427};
428#define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 1)
429
430static ssize_t raid_level_show(struct device *dev,
431 struct device_attribute *attr, char *buf)
432{
433 ssize_t l = 0;
434 int rlevel;
435 struct ctlr_info *h;
436 struct scsi_device *sdev;
437 struct hpsa_scsi_dev_t *hdev;
438 unsigned long flags;
439
440 sdev = to_scsi_device(dev);
441 h = sdev_to_hba(sdev);
442 spin_lock_irqsave(&h->lock, flags);
443 hdev = sdev->hostdata;
444 if (!hdev) {
445 spin_unlock_irqrestore(&h->lock, flags);
446 return -ENODEV;
447 }
448
449 /* Is this even a logical drive? */
450 if (!is_logical_dev_addr_mode(hdev->scsi3addr)) {
451 spin_unlock_irqrestore(&h->lock, flags);
452 l = snprintf(buf, PAGE_SIZE, "N/A\n");
453 return l;
454 }
455
456 rlevel = hdev->raid_level;
457 spin_unlock_irqrestore(&h->lock, flags);
458 if (rlevel < 0 || rlevel > RAID_UNKNOWN)
459 rlevel = RAID_UNKNOWN;
460 l = snprintf(buf, PAGE_SIZE, "RAID %s\n", raid_label[rlevel]);
461 return l;
462}
463
464static ssize_t lunid_show(struct device *dev,
465 struct device_attribute *attr, char *buf)
466{
467 struct ctlr_info *h;
468 struct scsi_device *sdev;
469 struct hpsa_scsi_dev_t *hdev;
470 unsigned long flags;
471 unsigned char lunid[8];
472
473 sdev = to_scsi_device(dev);
474 h = sdev_to_hba(sdev);
475 spin_lock_irqsave(&h->lock, flags);
476 hdev = sdev->hostdata;
477 if (!hdev) {
478 spin_unlock_irqrestore(&h->lock, flags);
479 return -ENODEV;
480 }
481 memcpy(lunid, hdev->scsi3addr, sizeof(lunid));
482 spin_unlock_irqrestore(&h->lock, flags);
483 return snprintf(buf, 20, "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
484 lunid[0], lunid[1], lunid[2], lunid[3],
485 lunid[4], lunid[5], lunid[6], lunid[7]);
486}
487
488static ssize_t unique_id_show(struct device *dev,
489 struct device_attribute *attr, char *buf)
490{
491 struct ctlr_info *h;
492 struct scsi_device *sdev;
493 struct hpsa_scsi_dev_t *hdev;
494 unsigned long flags;
495 unsigned char sn[16];
496
497 sdev = to_scsi_device(dev);
498 h = sdev_to_hba(sdev);
499 spin_lock_irqsave(&h->lock, flags);
500 hdev = sdev->hostdata;
501 if (!hdev) {
502 spin_unlock_irqrestore(&h->lock, flags);
503 return -ENODEV;
504 }
505 memcpy(sn, hdev->device_id, sizeof(sn));
506 spin_unlock_irqrestore(&h->lock, flags);
507 return snprintf(buf, 16 * 2 + 2,
508 "%02X%02X%02X%02X%02X%02X%02X%02X"
509 "%02X%02X%02X%02X%02X%02X%02X%02X\n",
510 sn[0], sn[1], sn[2], sn[3],
511 sn[4], sn[5], sn[6], sn[7],
512 sn[8], sn[9], sn[10], sn[11],
513 sn[12], sn[13], sn[14], sn[15]);
514}
515
516static int hpsa_find_target_lun(struct ctlr_info *h,
517 unsigned char scsi3addr[], int bus, int *target, int *lun)
518{
519 /* finds an unused bus, target, lun for a new physical device
520 * assumes h->devlock is held
521 */
522 int i, found = 0;
523 DECLARE_BITMAP(lun_taken, HPSA_MAX_SCSI_DEVS_PER_HBA);
524
525 memset(&lun_taken[0], 0, HPSA_MAX_SCSI_DEVS_PER_HBA >> 3);
526
527 for (i = 0; i < h->ndevices; i++) {
528 if (h->dev[i]->bus == bus && h->dev[i]->target != -1)
529 set_bit(h->dev[i]->target, lun_taken);
530 }
531
532 for (i = 0; i < HPSA_MAX_SCSI_DEVS_PER_HBA; i++) {
533 if (!test_bit(i, lun_taken)) {
534 /* *bus = 1; */
535 *target = i;
536 *lun = 0;
537 found = 1;
538 break;
539 }
540 }
541 return !found;
542}
543
544/* Add an entry into h->dev[] array. */
545static int hpsa_scsi_add_entry(struct ctlr_info *h, int hostno,
546 struct hpsa_scsi_dev_t *device,
547 struct hpsa_scsi_dev_t *added[], int *nadded)
548{
549 /* assumes h->devlock is held */
550 int n = h->ndevices;
551 int i;
552 unsigned char addr1[8], addr2[8];
553 struct hpsa_scsi_dev_t *sd;
554
555 if (n >= HPSA_MAX_SCSI_DEVS_PER_HBA) {
556 dev_err(&h->pdev->dev, "too many devices, some will be "
557 "inaccessible.\n");
558 return -1;
559 }
560
561 /* physical devices do not have lun or target assigned until now. */
562 if (device->lun != -1)
563 /* Logical device, lun is already assigned. */
564 goto lun_assigned;
565
566 /* If this device a non-zero lun of a multi-lun device
567 * byte 4 of the 8-byte LUN addr will contain the logical
568 * unit no, zero otherise.
569 */
570 if (device->scsi3addr[4] == 0) {
571 /* This is not a non-zero lun of a multi-lun device */
572 if (hpsa_find_target_lun(h, device->scsi3addr,
573 device->bus, &device->target, &device->lun) != 0)
574 return -1;
575 goto lun_assigned;
576 }
577
578 /* This is a non-zero lun of a multi-lun device.
579 * Search through our list and find the device which
580 * has the same 8 byte LUN address, excepting byte 4.
581 * Assign the same bus and target for this new LUN.
582 * Use the logical unit number from the firmware.
583 */
584 memcpy(addr1, device->scsi3addr, 8);
585 addr1[4] = 0;
586 for (i = 0; i < n; i++) {
587 sd = h->dev[i];
588 memcpy(addr2, sd->scsi3addr, 8);
589 addr2[4] = 0;
590 /* differ only in byte 4? */
591 if (memcmp(addr1, addr2, 8) == 0) {
592 device->bus = sd->bus;
593 device->target = sd->target;
594 device->lun = device->scsi3addr[4];
595 break;
596 }
597 }
598 if (device->lun == -1) {
599 dev_warn(&h->pdev->dev, "physical device with no LUN=0,"
600 " suspect firmware bug or unsupported hardware "
601 "configuration.\n");
602 return -1;
603 }
604
605lun_assigned:
606
607 h->dev[n] = device;
608 h->ndevices++;
609 added[*nadded] = device;
610 (*nadded)++;
611
612 /* initially, (before registering with scsi layer) we don't
613 * know our hostno and we don't want to print anything first
614 * time anyway (the scsi layer's inquiries will show that info)
615 */
616 /* if (hostno != -1) */
617 dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d added.\n",
618 scsi_device_type(device->devtype), hostno,
619 device->bus, device->target, device->lun);
620 return 0;
621}
622
623/* Remove an entry from h->dev[] array. */
624static void hpsa_scsi_remove_entry(struct ctlr_info *h, int hostno, int entry,
625 struct hpsa_scsi_dev_t *removed[], int *nremoved)
626{
627 /* assumes h->devlock is held */
628 int i;
629 struct hpsa_scsi_dev_t *sd;
630
631 if (entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA)
632 BUG();
633
634 sd = h->dev[entry];
635 removed[*nremoved] = h->dev[entry];
636 (*nremoved)++;
637
638 for (i = entry; i < h->ndevices-1; i++)
639 h->dev[i] = h->dev[i+1];
640 h->ndevices--;
641 dev_info(&h->pdev->dev, "%s device c%db%dt%dl%d removed.\n",
642 scsi_device_type(sd->devtype), hostno, sd->bus, sd->target,
643 sd->lun);
644}
645
646#define SCSI3ADDR_EQ(a, b) ( \
647 (a)[7] == (b)[7] && \
648 (a)[6] == (b)[6] && \
649 (a)[5] == (b)[5] && \
650 (a)[4] == (b)[4] && \
651 (a)[3] == (b)[3] && \
652 (a)[2] == (b)[2] && \
653 (a)[1] == (b)[1] && \
654 (a)[0] == (b)[0])
655
656static void fixup_botched_add(struct ctlr_info *h,
657 struct hpsa_scsi_dev_t *added)
658{
659 /* called when scsi_add_device fails in order to re-adjust
660 * h->dev[] to match the mid layer's view.
661 */
662 unsigned long flags;
663 int i, j;
664
665 spin_lock_irqsave(&h->lock, flags);
666 for (i = 0; i < h->ndevices; i++) {
667 if (h->dev[i] == added) {
668 for (j = i; j < h->ndevices-1; j++)
669 h->dev[j] = h->dev[j+1];
670 h->ndevices--;
671 break;
672 }
673 }
674 spin_unlock_irqrestore(&h->lock, flags);
675 kfree(added);
676}
677
678static inline int device_is_the_same(struct hpsa_scsi_dev_t *dev1,
679 struct hpsa_scsi_dev_t *dev2)
680{
681 if ((is_logical_dev_addr_mode(dev1->scsi3addr) ||
682 (dev1->lun != -1 && dev2->lun != -1)) &&
683 dev1->devtype != 0x0C)
684 return (memcmp(dev1, dev2, sizeof(*dev1)) == 0);
685
686 /* we compare everything except lun and target as these
687 * are not yet assigned. Compare parts likely
688 * to differ first
689 */
690 if (memcmp(dev1->scsi3addr, dev2->scsi3addr,
691 sizeof(dev1->scsi3addr)) != 0)
692 return 0;
693 if (memcmp(dev1->device_id, dev2->device_id,
694 sizeof(dev1->device_id)) != 0)
695 return 0;
696 if (memcmp(dev1->model, dev2->model, sizeof(dev1->model)) != 0)
697 return 0;
698 if (memcmp(dev1->vendor, dev2->vendor, sizeof(dev1->vendor)) != 0)
699 return 0;
700 if (memcmp(dev1->revision, dev2->revision, sizeof(dev1->revision)) != 0)
701 return 0;
702 if (dev1->devtype != dev2->devtype)
703 return 0;
704 if (dev1->raid_level != dev2->raid_level)
705 return 0;
706 if (dev1->bus != dev2->bus)
707 return 0;
708 return 1;
709}
710
711/* Find needle in haystack. If exact match found, return DEVICE_SAME,
712 * and return needle location in *index. If scsi3addr matches, but not
713 * vendor, model, serial num, etc. return DEVICE_CHANGED, and return needle
714 * location in *index. If needle not found, return DEVICE_NOT_FOUND.
715 */
716static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
717 struct hpsa_scsi_dev_t *haystack[], int haystack_size,
718 int *index)
719{
720 int i;
721#define DEVICE_NOT_FOUND 0
722#define DEVICE_CHANGED 1
723#define DEVICE_SAME 2
724 for (i = 0; i < haystack_size; i++) {
725 if (SCSI3ADDR_EQ(needle->scsi3addr, haystack[i]->scsi3addr)) {
726 *index = i;
727 if (device_is_the_same(needle, haystack[i]))
728 return DEVICE_SAME;
729 else
730 return DEVICE_CHANGED;
731 }
732 }
733 *index = -1;
734 return DEVICE_NOT_FOUND;
735}
736
737static int adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
738 struct hpsa_scsi_dev_t *sd[], int nsds)
739{
740 /* sd contains scsi3 addresses and devtypes, and inquiry
741 * data. This function takes what's in sd to be the current
742 * reality and updates h->dev[] to reflect that reality.
743 */
744 int i, entry, device_change, changes = 0;
745 struct hpsa_scsi_dev_t *csd;
746 unsigned long flags;
747 struct hpsa_scsi_dev_t **added, **removed;
748 int nadded, nremoved;
749 struct Scsi_Host *sh = NULL;
750
751 added = kzalloc(sizeof(*added) * HPSA_MAX_SCSI_DEVS_PER_HBA,
752 GFP_KERNEL);
753 removed = kzalloc(sizeof(*removed) * HPSA_MAX_SCSI_DEVS_PER_HBA,
754 GFP_KERNEL);
755
756 if (!added || !removed) {
757 dev_warn(&h->pdev->dev, "out of memory in "
758 "adjust_hpsa_scsi_table\n");
759 goto free_and_out;
760 }
761
762 spin_lock_irqsave(&h->devlock, flags);
763
764 /* find any devices in h->dev[] that are not in
765 * sd[] and remove them from h->dev[], and for any
766 * devices which have changed, remove the old device
767 * info and add the new device info.
768 */
769 i = 0;
770 nremoved = 0;
771 nadded = 0;
772 while (i < h->ndevices) {
773 csd = h->dev[i];
774 device_change = hpsa_scsi_find_entry(csd, sd, nsds, &entry);
775 if (device_change == DEVICE_NOT_FOUND) {
776 changes++;
777 hpsa_scsi_remove_entry(h, hostno, i,
778 removed, &nremoved);
779 continue; /* remove ^^^, hence i not incremented */
780 } else if (device_change == DEVICE_CHANGED) {
781 changes++;
782 hpsa_scsi_remove_entry(h, hostno, i,
783 removed, &nremoved);
784 (void) hpsa_scsi_add_entry(h, hostno, sd[entry],
785 added, &nadded);
786 /* add can't fail, we just removed one. */
787 sd[entry] = NULL; /* prevent it from being freed */
788 }
789 i++;
790 }
791
792 /* Now, make sure every device listed in sd[] is also
793 * listed in h->dev[], adding them if they aren't found
794 */
795
796 for (i = 0; i < nsds; i++) {
797 if (!sd[i]) /* if already added above. */
798 continue;
799 device_change = hpsa_scsi_find_entry(sd[i], h->dev,
800 h->ndevices, &entry);
801 if (device_change == DEVICE_NOT_FOUND) {
802 changes++;
803 if (hpsa_scsi_add_entry(h, hostno, sd[i],
804 added, &nadded) != 0)
805 break;
806 sd[i] = NULL; /* prevent from being freed later. */
807 } else if (device_change == DEVICE_CHANGED) {
808 /* should never happen... */
809 changes++;
810 dev_warn(&h->pdev->dev,
811 "device unexpectedly changed.\n");
812 /* but if it does happen, we just ignore that device */
813 }
814 }
815 spin_unlock_irqrestore(&h->devlock, flags);
816
817 /* Don't notify scsi mid layer of any changes the first time through
818 * (or if there are no changes) scsi_scan_host will do it later the
819 * first time through.
820 */
821 if (hostno == -1 || !changes)
822 goto free_and_out;
823
824 sh = h->scsi_host;
825 /* Notify scsi mid layer of any removed devices */
826 for (i = 0; i < nremoved; i++) {
827 struct scsi_device *sdev =
828 scsi_device_lookup(sh, removed[i]->bus,
829 removed[i]->target, removed[i]->lun);
830 if (sdev != NULL) {
831 scsi_remove_device(sdev);
832 scsi_device_put(sdev);
833 } else {
834 /* We don't expect to get here.
835 * future cmds to this device will get selection
836 * timeout as if the device was gone.
837 */
838 dev_warn(&h->pdev->dev, "didn't find c%db%dt%dl%d "
839 " for removal.", hostno, removed[i]->bus,
840 removed[i]->target, removed[i]->lun);
841 }
842 kfree(removed[i]);
843 removed[i] = NULL;
844 }
845
846 /* Notify scsi mid layer of any added devices */
847 for (i = 0; i < nadded; i++) {
848 if (scsi_add_device(sh, added[i]->bus,
849 added[i]->target, added[i]->lun) == 0)
850 continue;
851 dev_warn(&h->pdev->dev, "scsi_add_device c%db%dt%dl%d failed, "
852 "device not added.\n", hostno, added[i]->bus,
853 added[i]->target, added[i]->lun);
854 /* now we have to remove it from h->dev,
855 * since it didn't get added to scsi mid layer
856 */
857 fixup_botched_add(h, added[i]);
858 }
859
860free_and_out:
861 kfree(added);
862 kfree(removed);
863 return 0;
864}
865
866/*
867 * Lookup bus/target/lun and retrun corresponding struct hpsa_scsi_dev_t *
868 * Assume's h->devlock is held.
869 */
870static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h,
871 int bus, int target, int lun)
872{
873 int i;
874 struct hpsa_scsi_dev_t *sd;
875
876 for (i = 0; i < h->ndevices; i++) {
877 sd = h->dev[i];
878 if (sd->bus == bus && sd->target == target && sd->lun == lun)
879 return sd;
880 }
881 return NULL;
882}
883
884/* link sdev->hostdata to our per-device structure. */
885static int hpsa_slave_alloc(struct scsi_device *sdev)
886{
887 struct hpsa_scsi_dev_t *sd;
888 unsigned long flags;
889 struct ctlr_info *h;
890
891 h = sdev_to_hba(sdev);
892 spin_lock_irqsave(&h->devlock, flags);
893 sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),
894 sdev_id(sdev), sdev->lun);
895 if (sd != NULL)
896 sdev->hostdata = sd;
897 spin_unlock_irqrestore(&h->devlock, flags);
898 return 0;
899}
900
901static void hpsa_slave_destroy(struct scsi_device *sdev)
902{
903 return; /* nothing to do. */
904}
905
906static void hpsa_scsi_setup(struct ctlr_info *h)
907{
908 h->ndevices = 0;
909 h->scsi_host = NULL;
910 spin_lock_init(&h->devlock);
911 return;
912}
913
914static void complete_scsi_command(struct CommandList *cp,
915 int timeout, __u32 tag)
916{
917 struct scsi_cmnd *cmd;
918 struct ctlr_info *h;
919 struct ErrorInfo *ei;
920
921 unsigned char sense_key;
922 unsigned char asc; /* additional sense code */
923 unsigned char ascq; /* additional sense code qualifier */
924
925 ei = cp->err_info;
926 cmd = (struct scsi_cmnd *) cp->scsi_cmd;
927 h = cp->h;
928
929 scsi_dma_unmap(cmd); /* undo the DMA mappings */
930
931 cmd->result = (DID_OK << 16); /* host byte */
932 cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */
933 cmd->result |= (ei->ScsiStatus << 1);
934
935 /* copy the sense data whether we need to or not. */
936 memcpy(cmd->sense_buffer, ei->SenseInfo,
937 ei->SenseLen > SCSI_SENSE_BUFFERSIZE ?
938 SCSI_SENSE_BUFFERSIZE :
939 ei->SenseLen);
940 scsi_set_resid(cmd, ei->ResidualCnt);
941
942 if (ei->CommandStatus == 0) {
943 cmd->scsi_done(cmd);
944 cmd_free(h, cp);
945 return;
946 }
947
948 /* an error has occurred */
949 switch (ei->CommandStatus) {
950
951 case CMD_TARGET_STATUS:
952 if (ei->ScsiStatus) {
953 /* Get sense key */
954 sense_key = 0xf & ei->SenseInfo[2];
955 /* Get additional sense code */
956 asc = ei->SenseInfo[12];
957 /* Get addition sense code qualifier */
958 ascq = ei->SenseInfo[13];
959 }
960
961 if (ei->ScsiStatus == SAM_STAT_CHECK_CONDITION) {
962 if (check_for_unit_attention(h, cp)) {
963 cmd->result = DID_SOFT_ERROR << 16;
964 break;
965 }
966 if (sense_key == ILLEGAL_REQUEST) {
967 /*
968 * SCSI REPORT_LUNS is commonly unsupported on
969 * Smart Array. Suppress noisy complaint.
970 */
971 if (cp->Request.CDB[0] == REPORT_LUNS)
972 break;
973
974 /* If ASC/ASCQ indicate Logical Unit
975 * Not Supported condition,
976 */
977 if ((asc == 0x25) && (ascq == 0x0)) {
978 dev_warn(&h->pdev->dev, "cp %p "
979 "has check condition\n", cp);
980 break;
981 }
982 }
983
984 if (sense_key == NOT_READY) {
985 /* If Sense is Not Ready, Logical Unit
986 * Not ready, Manual Intervention
987 * required
988 */
989 if ((asc == 0x04) && (ascq == 0x03)) {
990 cmd->result = DID_NO_CONNECT << 16;
991 dev_warn(&h->pdev->dev, "cp %p "
992 "has check condition: unit "
993 "not ready, manual "
994 "intervention required\n", cp);
995 break;
996 }
997 }
998
999
1000 /* Must be some other type of check condition */
1001 dev_warn(&h->pdev->dev, "cp %p has check condition: "
1002 "unknown type: "
1003 "Sense: 0x%x, ASC: 0x%x, ASCQ: 0x%x, "
1004 "Returning result: 0x%x, "
1005 "cmd=[%02x %02x %02x %02x %02x "
1006 "%02x %02x %02x %02x %02x]\n",
1007 cp, sense_key, asc, ascq,
1008 cmd->result,
1009 cmd->cmnd[0], cmd->cmnd[1],
1010 cmd->cmnd[2], cmd->cmnd[3],
1011 cmd->cmnd[4], cmd->cmnd[5],
1012 cmd->cmnd[6], cmd->cmnd[7],
1013 cmd->cmnd[8], cmd->cmnd[9]);
1014 break;
1015 }
1016
1017
1018 /* Problem was not a check condition
1019 * Pass it up to the upper layers...
1020 */
1021 if (ei->ScsiStatus) {
1022 dev_warn(&h->pdev->dev, "cp %p has status 0x%x "
1023 "Sense: 0x%x, ASC: 0x%x, ASCQ: 0x%x, "
1024 "Returning result: 0x%x\n",
1025 cp, ei->ScsiStatus,
1026 sense_key, asc, ascq,
1027 cmd->result);
1028 } else { /* scsi status is zero??? How??? */
1029 dev_warn(&h->pdev->dev, "cp %p SCSI status was 0. "
1030 "Returning no connection.\n", cp),
1031
1032 /* Ordinarily, this case should never happen,
1033 * but there is a bug in some released firmware
1034 * revisions that allows it to happen if, for
1035 * example, a 4100 backplane loses power and
1036 * the tape drive is in it. We assume that
1037 * it's a fatal error of some kind because we
1038 * can't show that it wasn't. We will make it
1039 * look like selection timeout since that is
1040 * the most common reason for this to occur,
1041 * and it's severe enough.
1042 */
1043
1044 cmd->result = DID_NO_CONNECT << 16;
1045 }
1046 break;
1047
1048 case CMD_DATA_UNDERRUN: /* let mid layer handle it. */
1049 break;
1050 case CMD_DATA_OVERRUN:
1051 dev_warn(&h->pdev->dev, "cp %p has"
1052 " completed with data overrun "
1053 "reported\n", cp);
1054 break;
1055 case CMD_INVALID: {
1056 /* print_bytes(cp, sizeof(*cp), 1, 0);
1057 print_cmd(cp); */
1058 /* We get CMD_INVALID if you address a non-existent device
1059 * instead of a selection timeout (no response). You will
1060 * see this if you yank out a drive, then try to access it.
1061 * This is kind of a shame because it means that any other
1062 * CMD_INVALID (e.g. driver bug) will get interpreted as a
1063 * missing target. */
1064 cmd->result = DID_NO_CONNECT << 16;
1065 }
1066 break;
1067 case CMD_PROTOCOL_ERR:
1068 dev_warn(&h->pdev->dev, "cp %p has "
1069 "protocol error \n", cp);
1070 break;
1071 case CMD_HARDWARE_ERR:
1072 cmd->result = DID_ERROR << 16;
1073 dev_warn(&h->pdev->dev, "cp %p had hardware error\n", cp);
1074 break;
1075 case CMD_CONNECTION_LOST:
1076 cmd->result = DID_ERROR << 16;
1077 dev_warn(&h->pdev->dev, "cp %p had connection lost\n", cp);
1078 break;
1079 case CMD_ABORTED:
1080 cmd->result = DID_ABORT << 16;
1081 dev_warn(&h->pdev->dev, "cp %p was aborted with status 0x%x\n",
1082 cp, ei->ScsiStatus);
1083 break;
1084 case CMD_ABORT_FAILED:
1085 cmd->result = DID_ERROR << 16;
1086 dev_warn(&h->pdev->dev, "cp %p reports abort failed\n", cp);
1087 break;
1088 case CMD_UNSOLICITED_ABORT:
1089 cmd->result = DID_ABORT << 16;
1090 dev_warn(&h->pdev->dev, "cp %p aborted do to an unsolicited "
1091 "abort\n", cp);
1092 break;
1093 case CMD_TIMEOUT:
1094 cmd->result = DID_TIME_OUT << 16;
1095 dev_warn(&h->pdev->dev, "cp %p timedout\n", cp);
1096 break;
1097 default:
1098 cmd->result = DID_ERROR << 16;
1099 dev_warn(&h->pdev->dev, "cp %p returned unknown status %x\n",
1100 cp, ei->CommandStatus);
1101 }
1102 cmd->scsi_done(cmd);
1103 cmd_free(h, cp);
1104}
1105
1106static int hpsa_scsi_detect(struct ctlr_info *h)
1107{
1108 struct Scsi_Host *sh;
1109 int error;
1110
1111 sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h));
1112 if (sh == NULL)
1113 goto fail;
1114
1115 sh->io_port = 0;
1116 sh->n_io_port = 0;
1117 sh->this_id = -1;
1118 sh->max_channel = 3;
1119 sh->max_cmd_len = MAX_COMMAND_SIZE;
1120 sh->max_lun = HPSA_MAX_LUN;
1121 sh->max_id = HPSA_MAX_LUN;
1122 h->scsi_host = sh;
1123 sh->hostdata[0] = (unsigned long) h;
1124 sh->irq = h->intr[SIMPLE_MODE_INT];
1125 sh->unique_id = sh->irq;
1126 error = scsi_add_host(sh, &h->pdev->dev);
1127 if (error)
1128 goto fail_host_put;
1129 scsi_scan_host(sh);
1130 return 0;
1131
1132 fail_host_put:
1133 dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_add_host"
1134 " failed for controller %d\n", h->ctlr);
1135 scsi_host_put(sh);
1136 return -1;
1137 fail:
1138 dev_err(&h->pdev->dev, "hpsa_scsi_detect: scsi_host_alloc"
1139 " failed for controller %d\n", h->ctlr);
1140 return -1;
1141}
1142
1143static void hpsa_pci_unmap(struct pci_dev *pdev,
1144 struct CommandList *c, int sg_used, int data_direction)
1145{
1146 int i;
1147 union u64bit addr64;
1148
1149 for (i = 0; i < sg_used; i++) {
1150 addr64.val32.lower = c->SG[i].Addr.lower;
1151 addr64.val32.upper = c->SG[i].Addr.upper;
1152 pci_unmap_single(pdev, (dma_addr_t) addr64.val, c->SG[i].Len,
1153 data_direction);
1154 }
1155}
1156
1157static void hpsa_map_one(struct pci_dev *pdev,
1158 struct CommandList *cp,
1159 unsigned char *buf,
1160 size_t buflen,
1161 int data_direction)
1162{
1163 __u64 addr64;
1164
1165 if (buflen == 0 || data_direction == PCI_DMA_NONE) {
1166 cp->Header.SGList = 0;
1167 cp->Header.SGTotal = 0;
1168 return;
1169 }
1170
1171 addr64 = (__u64) pci_map_single(pdev, buf, buflen, data_direction);
1172 cp->SG[0].Addr.lower =
1173 (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF);
1174 cp->SG[0].Addr.upper =
1175 (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF);
1176 cp->SG[0].Len = buflen;
1177 cp->Header.SGList = (__u8) 1; /* no. SGs contig in this cmd */
1178 cp->Header.SGTotal = (__u16) 1; /* total sgs in this cmd list */
1179}
1180
1181static inline void hpsa_scsi_do_simple_cmd_core(struct ctlr_info *h,
1182 struct CommandList *c)
1183{
1184 DECLARE_COMPLETION_ONSTACK(wait);
1185
1186 c->waiting = &wait;
1187 enqueue_cmd_and_start_io(h, c);
1188 wait_for_completion(&wait);
1189}
1190
1191static void hpsa_scsi_do_simple_cmd_with_retry(struct ctlr_info *h,
1192 struct CommandList *c, int data_direction)
1193{
1194 int retry_count = 0;
1195
1196 do {
1197 memset(c->err_info, 0, sizeof(c->err_info));
1198 hpsa_scsi_do_simple_cmd_core(h, c);
1199 retry_count++;
1200 } while (check_for_unit_attention(h, c) && retry_count <= 3);
1201 hpsa_pci_unmap(h->pdev, c, 1, data_direction);
1202}
1203
1204static void hpsa_scsi_interpret_error(struct CommandList *cp)
1205{
1206 struct ErrorInfo *ei;
1207 struct device *d = &cp->h->pdev->dev;
1208
1209 ei = cp->err_info;
1210 switch (ei->CommandStatus) {
1211 case CMD_TARGET_STATUS:
1212 dev_warn(d, "cmd %p has completed with errors\n", cp);
1213 dev_warn(d, "cmd %p has SCSI Status = %x\n", cp,
1214 ei->ScsiStatus);
1215 if (ei->ScsiStatus == 0)
1216 dev_warn(d, "SCSI status is abnormally zero. "
1217 "(probably indicates selection timeout "
1218 "reported incorrectly due to a known "
1219 "firmware bug, circa July, 2001.)\n");
1220 break;
1221 case CMD_DATA_UNDERRUN: /* let mid layer handle it. */
1222 dev_info(d, "UNDERRUN\n");
1223 break;
1224 case CMD_DATA_OVERRUN:
1225 dev_warn(d, "cp %p has completed with data overrun\n", cp);
1226 break;
1227 case CMD_INVALID: {
1228 /* controller unfortunately reports SCSI passthru's
1229 * to non-existent targets as invalid commands.
1230 */
1231 dev_warn(d, "cp %p is reported invalid (probably means "
1232 "target device no longer present)\n", cp);
1233 /* print_bytes((unsigned char *) cp, sizeof(*cp), 1, 0);
1234 print_cmd(cp); */
1235 }
1236 break;
1237 case CMD_PROTOCOL_ERR:
1238 dev_warn(d, "cp %p has protocol error \n", cp);
1239 break;
1240 case CMD_HARDWARE_ERR:
1241 /* cmd->result = DID_ERROR << 16; */
1242 dev_warn(d, "cp %p had hardware error\n", cp);
1243 break;
1244 case CMD_CONNECTION_LOST:
1245 dev_warn(d, "cp %p had connection lost\n", cp);
1246 break;
1247 case CMD_ABORTED:
1248 dev_warn(d, "cp %p was aborted\n", cp);
1249 break;
1250 case CMD_ABORT_FAILED:
1251 dev_warn(d, "cp %p reports abort failed\n", cp);
1252 break;
1253 case CMD_UNSOLICITED_ABORT:
1254 dev_warn(d, "cp %p aborted due to an unsolicited abort\n", cp);
1255 break;
1256 case CMD_TIMEOUT:
1257 dev_warn(d, "cp %p timed out\n", cp);
1258 break;
1259 default:
1260 dev_warn(d, "cp %p returned unknown status %x\n", cp,
1261 ei->CommandStatus);
1262 }
1263}
1264
1265static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
1266 unsigned char page, unsigned char *buf,
1267 unsigned char bufsize)
1268{
1269 int rc = IO_OK;
1270 struct CommandList *c;
1271 struct ErrorInfo *ei;
1272
1273 c = cmd_special_alloc(h);
1274
1275 if (c == NULL) { /* trouble... */
1276 dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
1277 return -1;
1278 }
1279
1280 fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize, page, scsi3addr, TYPE_CMD);
1281 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE);
1282 ei = c->err_info;
1283 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
1284 hpsa_scsi_interpret_error(c);
1285 rc = -1;
1286 }
1287 cmd_special_free(h, c);
1288 return rc;
1289}
1290
1291static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr)
1292{
1293 int rc = IO_OK;
1294 struct CommandList *c;
1295 struct ErrorInfo *ei;
1296
1297 c = cmd_special_alloc(h);
1298
1299 if (c == NULL) { /* trouble... */
1300 dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
1301 return -1;
1302 }
1303
1304 fill_cmd(c, HPSA_DEVICE_RESET_MSG, h, NULL, 0, 0, scsi3addr, TYPE_MSG);
1305 hpsa_scsi_do_simple_cmd_core(h, c);
1306 /* no unmap needed here because no data xfer. */
1307
1308 ei = c->err_info;
1309 if (ei->CommandStatus != 0) {
1310 hpsa_scsi_interpret_error(c);
1311 rc = -1;
1312 }
1313 cmd_special_free(h, c);
1314 return rc;
1315}
1316
1317static void hpsa_get_raid_level(struct ctlr_info *h,
1318 unsigned char *scsi3addr, unsigned char *raid_level)
1319{
1320 int rc;
1321 unsigned char *buf;
1322
1323 *raid_level = RAID_UNKNOWN;
1324 buf = kzalloc(64, GFP_KERNEL);
1325 if (!buf)
1326 return;
1327 rc = hpsa_scsi_do_inquiry(h, scsi3addr, 0xC1, buf, 64);
1328 if (rc == 0)
1329 *raid_level = buf[8];
1330 if (*raid_level > RAID_UNKNOWN)
1331 *raid_level = RAID_UNKNOWN;
1332 kfree(buf);
1333 return;
1334}
1335
1336/* Get the device id from inquiry page 0x83 */
1337static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr,
1338 unsigned char *device_id, int buflen)
1339{
1340 int rc;
1341 unsigned char *buf;
1342
1343 if (buflen > 16)
1344 buflen = 16;
1345 buf = kzalloc(64, GFP_KERNEL);
1346 if (!buf)
1347 return -1;
1348 rc = hpsa_scsi_do_inquiry(h, scsi3addr, 0x83, buf, 64);
1349 if (rc == 0)
1350 memcpy(device_id, &buf[8], buflen);
1351 kfree(buf);
1352 return rc != 0;
1353}
1354
1355static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
1356 struct ReportLUNdata *buf, int bufsize,
1357 int extended_response)
1358{
1359 int rc = IO_OK;
1360 struct CommandList *c;
1361 unsigned char scsi3addr[8];
1362 struct ErrorInfo *ei;
1363
1364 c = cmd_special_alloc(h);
1365 if (c == NULL) { /* trouble... */
1366 dev_err(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
1367 return -1;
1368 }
1369
1370 memset(&scsi3addr[0], 0, 8); /* address the controller */
1371
1372 fill_cmd(c, logical ? HPSA_REPORT_LOG : HPSA_REPORT_PHYS, h,
1373 buf, bufsize, 0, scsi3addr, TYPE_CMD);
1374 if (extended_response)
1375 c->Request.CDB[1] = extended_response;
1376 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE);
1377 ei = c->err_info;
1378 if (ei->CommandStatus != 0 &&
1379 ei->CommandStatus != CMD_DATA_UNDERRUN) {
1380 hpsa_scsi_interpret_error(c);
1381 rc = -1;
1382 }
1383 cmd_special_free(h, c);
1384 return rc;
1385}
1386
1387static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h,
1388 struct ReportLUNdata *buf,
1389 int bufsize, int extended_response)
1390{
1391 return hpsa_scsi_do_report_luns(h, 0, buf, bufsize, extended_response);
1392}
1393
1394static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h,
1395 struct ReportLUNdata *buf, int bufsize)
1396{
1397 return hpsa_scsi_do_report_luns(h, 1, buf, bufsize, 0);
1398}
1399
1400static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device,
1401 int bus, int target, int lun)
1402{
1403 device->bus = bus;
1404 device->target = target;
1405 device->lun = lun;
1406}
1407
1408static int hpsa_update_device_info(struct ctlr_info *h,
1409 unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device)
1410{
1411#define OBDR_TAPE_INQ_SIZE 49
1412 unsigned char *inq_buff = NULL;
1413
1414 inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
1415 if (!inq_buff)
1416 goto bail_out;
1417
1418 memset(inq_buff, 0, OBDR_TAPE_INQ_SIZE);
1419 /* Do an inquiry to the device to see what it is. */
1420 if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
1421 (unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
1422 /* Inquiry failed (msg printed already) */
1423 dev_err(&h->pdev->dev,
1424 "hpsa_update_device_info: inquiry failed\n");
1425 goto bail_out;
1426 }
1427
1428 /* As a side effect, record the firmware version number
1429 * if we happen to be talking to the RAID controller.
1430 */
1431 if (is_hba_lunid(scsi3addr))
1432 memcpy(h->firm_ver, &inq_buff[32], 4);
1433
1434 this_device->devtype = (inq_buff[0] & 0x1f);
1435 memcpy(this_device->scsi3addr, scsi3addr, 8);
1436 memcpy(this_device->vendor, &inq_buff[8],
1437 sizeof(this_device->vendor));
1438 memcpy(this_device->model, &inq_buff[16],
1439 sizeof(this_device->model));
1440 memcpy(this_device->revision, &inq_buff[32],
1441 sizeof(this_device->revision));
1442 memset(this_device->device_id, 0,
1443 sizeof(this_device->device_id));
1444 hpsa_get_device_id(h, scsi3addr, this_device->device_id,
1445 sizeof(this_device->device_id));
1446
1447 if (this_device->devtype == TYPE_DISK &&
1448 is_logical_dev_addr_mode(scsi3addr))
1449 hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
1450 else
1451 this_device->raid_level = RAID_UNKNOWN;
1452
1453 kfree(inq_buff);
1454 return 0;
1455
1456bail_out:
1457 kfree(inq_buff);
1458 return 1;
1459}
1460
1461static unsigned char *msa2xxx_model[] = {
1462 "MSA2012",
1463 "MSA2024",
1464 "MSA2312",
1465 "MSA2324",
1466 NULL,
1467};
1468
1469static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
1470{
1471 int i;
1472
1473 for (i = 0; msa2xxx_model[i]; i++)
1474 if (strncmp(device->model, msa2xxx_model[i],
1475 strlen(msa2xxx_model[i])) == 0)
1476 return 1;
1477 return 0;
1478}
1479
1480/* Helper function to assign bus, target, lun mapping of devices.
1481 * Puts non-msa2xxx logical volumes on bus 0, msa2xxx logical
1482 * volumes on bus 1, physical devices on bus 2. and the hba on bus 3.
1483 * Logical drive target and lun are assigned at this time, but
1484 * physical device lun and target assignment are deferred (assigned
1485 * in hpsa_find_target_lun, called by hpsa_scsi_add_entry.)
1486 */
1487static void figure_bus_target_lun(struct ctlr_info *h,
1488 __u8 *lunaddrbytes, int *bus, int *target, int *lun,
1489 struct hpsa_scsi_dev_t *device)
1490{
1491
1492 __u32 lunid;
1493
1494 if (is_logical_dev_addr_mode(lunaddrbytes)) {
1495 /* logical device */
1496 memcpy(&lunid, lunaddrbytes, sizeof(lunid));
1497 lunid = le32_to_cpu(lunid);
1498
1499 if (is_msa2xxx(h, device)) {
1500 *bus = 1;
1501 *target = (lunid >> 16) & 0x3fff;
1502 *lun = lunid & 0x00ff;
1503 } else {
1504 *bus = 0;
1505 *lun = 0;
1506 *target = lunid & 0x3fff;
1507 }
1508 } else {
1509 /* physical device */
1510 if (is_hba_lunid(lunaddrbytes))
1511 *bus = 3;
1512 else
1513 *bus = 2;
1514 *target = -1;
1515 *lun = -1; /* we will fill these in later. */
1516 }
1517}
1518
1519/*
1520 * If there is no lun 0 on a target, linux won't find any devices.
1521 * For the MSA2xxx boxes, we have to manually detect the enclosure
1522 * which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report
1523 * it for some reason. *tmpdevice is the target we're adding,
1524 * this_device is a pointer into the current element of currentsd[]
1525 * that we're building up in update_scsi_devices(), below.
1526 * lunzerobits is a bitmap that tracks which targets already have a
1527 * lun 0 assigned.
1528 * Returns 1 if an enclosure was added, 0 if not.
1529 */
1530static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
1531 struct hpsa_scsi_dev_t *tmpdevice,
1532 struct hpsa_scsi_dev_t *this_device, __u8 *lunaddrbytes,
1533 int bus, int target, int lun, unsigned long lunzerobits[],
1534 int *nmsa2xxx_enclosures)
1535{
1536 unsigned char scsi3addr[8];
1537
1538 if (test_bit(target, lunzerobits))
1539 return 0; /* There is already a lun 0 on this target. */
1540
1541 if (!is_logical_dev_addr_mode(lunaddrbytes))
1542 return 0; /* It's the logical targets that may lack lun 0. */
1543
1544 if (!is_msa2xxx(h, tmpdevice))
1545 return 0; /* It's only the MSA2xxx that have this problem. */
1546
1547 if (lun == 0) /* if lun is 0, then obviously we have a lun 0. */
1548 return 0;
1549
1550 if (is_hba_lunid(scsi3addr))
1551 return 0; /* Don't add the RAID controller here. */
1552
1553#define MAX_MSA2XXX_ENCLOSURES 32
1554 if (*nmsa2xxx_enclosures >= MAX_MSA2XXX_ENCLOSURES) {
1555 dev_warn(&h->pdev->dev, "Maximum number of MSA2XXX "
1556 "enclosures exceeded. Check your hardware "
1557 "configuration.");
1558 return 0;
1559 }
1560
1561 memset(scsi3addr, 0, 8);
1562 scsi3addr[3] = target;
1563 if (hpsa_update_device_info(h, scsi3addr, this_device))
1564 return 0;
1565 (*nmsa2xxx_enclosures)++;
1566 hpsa_set_bus_target_lun(this_device, bus, target, 0);
1567 set_bit(target, lunzerobits);
1568 return 1;
1569}
1570
1571/*
1572 * Do CISS_REPORT_PHYS and CISS_REPORT_LOG. Data is returned in physdev,
1573 * logdev. The number of luns in physdev and logdev are returned in
1574 * *nphysicals and *nlogicals, respectively.
1575 * Returns 0 on success, -1 otherwise.
1576 */
1577static int hpsa_gather_lun_info(struct ctlr_info *h,
1578 int reportlunsize,
1579 struct ReportLUNdata *physdev, __u32 *nphysicals,
1580 struct ReportLUNdata *logdev, __u32 *nlogicals)
1581{
1582 if (hpsa_scsi_do_report_phys_luns(h, physdev, reportlunsize, 0)) {
1583 dev_err(&h->pdev->dev, "report physical LUNs failed.\n");
1584 return -1;
1585 }
1586 memcpy(nphysicals, &physdev->LUNListLength[0], sizeof(*nphysicals));
1587 *nphysicals = be32_to_cpu(*nphysicals) / 8;
1588#ifdef DEBUG
1589 dev_info(&h->pdev->dev, "number of physical luns is %d\n", *nphysicals);
1590#endif
1591 if (*nphysicals > HPSA_MAX_PHYS_LUN) {
1592 dev_warn(&h->pdev->dev, "maximum physical LUNs (%d) exceeded."
1593 " %d LUNs ignored.\n", HPSA_MAX_PHYS_LUN,
1594 *nphysicals - HPSA_MAX_PHYS_LUN);
1595 *nphysicals = HPSA_MAX_PHYS_LUN;
1596 }
1597 if (hpsa_scsi_do_report_log_luns(h, logdev, reportlunsize)) {
1598 dev_err(&h->pdev->dev, "report logical LUNs failed.\n");
1599 return -1;
1600 }
1601 memcpy(nlogicals, &logdev->LUNListLength[0], sizeof(*nlogicals));
1602 *nlogicals = be32_to_cpu(*nlogicals) / 8;
1603#ifdef DEBUG
1604 dev_info(&h->pdev->dev, "number of logical luns is %d\n", *nlogicals);
1605#endif
1606 /* Reject Logicals in excess of our max capability. */
1607 if (*nlogicals > HPSA_MAX_LUN) {
1608 dev_warn(&h->pdev->dev,
1609 "maximum logical LUNs (%d) exceeded. "
1610 "%d LUNs ignored.\n", HPSA_MAX_LUN,
1611 *nlogicals - HPSA_MAX_LUN);
1612 *nlogicals = HPSA_MAX_LUN;
1613 }
1614 if (*nlogicals + *nphysicals > HPSA_MAX_PHYS_LUN) {
1615 dev_warn(&h->pdev->dev,
1616 "maximum logical + physical LUNs (%d) exceeded. "
1617 "%d LUNs ignored.\n", HPSA_MAX_PHYS_LUN,
1618 *nphysicals + *nlogicals - HPSA_MAX_PHYS_LUN);
1619 *nlogicals = HPSA_MAX_PHYS_LUN - *nphysicals;
1620 }
1621 return 0;
1622}
1623
1624static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
1625{
1626 /* the idea here is we could get notified
1627 * that some devices have changed, so we do a report
1628 * physical luns and report logical luns cmd, and adjust
1629 * our list of devices accordingly.
1630 *
1631 * The scsi3addr's of devices won't change so long as the
1632 * adapter is not reset. That means we can rescan and
1633 * tell which devices we already know about, vs. new
1634 * devices, vs. disappearing devices.
1635 */
1636 struct ReportLUNdata *physdev_list = NULL;
1637 struct ReportLUNdata *logdev_list = NULL;
1638 unsigned char *inq_buff = NULL;
1639 __u32 nphysicals = 0;
1640 __u32 nlogicals = 0;
1641 __u32 ndev_allocated = 0;
1642 struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice;
1643 int ncurrent = 0;
1644 int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8;
1645 int i, nmsa2xxx_enclosures, ndevs_to_allocate;
1646 int bus, target, lun;
1647 DECLARE_BITMAP(lunzerobits, HPSA_MAX_TARGETS_PER_CTLR);
1648
1649 currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_SCSI_DEVS_PER_HBA,
1650 GFP_KERNEL);
1651 physdev_list = kzalloc(reportlunsize, GFP_KERNEL);
1652 logdev_list = kzalloc(reportlunsize, GFP_KERNEL);
1653 inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
1654 tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL);
1655
1656 if (!currentsd || !physdev_list || !logdev_list ||
1657 !inq_buff || !tmpdevice) {
1658 dev_err(&h->pdev->dev, "out of memory\n");
1659 goto out;
1660 }
1661 memset(lunzerobits, 0, sizeof(lunzerobits));
1662
1663 if (hpsa_gather_lun_info(h, reportlunsize, physdev_list, &nphysicals,
1664 logdev_list, &nlogicals))
1665 goto out;
1666
1667 /* We might see up to 32 MSA2xxx enclosures, actually 8 of them
1668 * but each of them 4 times through different paths. The plus 1
1669 * is for the RAID controller.
1670 */
1671 ndevs_to_allocate = nphysicals + nlogicals + MAX_MSA2XXX_ENCLOSURES + 1;
1672
1673 /* Allocate the per device structures */
1674 for (i = 0; i < ndevs_to_allocate; i++) {
1675 currentsd[i] = kzalloc(sizeof(*currentsd[i]), GFP_KERNEL);
1676 if (!currentsd[i]) {
1677 dev_warn(&h->pdev->dev, "out of memory at %s:%d\n",
1678 __FILE__, __LINE__);
1679 goto out;
1680 }
1681 ndev_allocated++;
1682 }
1683
1684 /* adjust our table of devices */
1685 nmsa2xxx_enclosures = 0;
1686 for (i = 0; i < nphysicals + nlogicals + 1; i++) {
1687 __u8 *lunaddrbytes;
1688
1689 /* Figure out where the LUN ID info is coming from */
1690 if (i < nphysicals)
1691 lunaddrbytes = &physdev_list->LUN[i][0];
1692 else
1693 if (i < nphysicals + nlogicals)
1694 lunaddrbytes =
1695 &logdev_list->LUN[i-nphysicals][0];
1696 else /* jam in the RAID controller at the end */
1697 lunaddrbytes = RAID_CTLR_LUNID;
1698
1699 /* skip masked physical devices. */
1700 if (lunaddrbytes[3] & 0xC0 && i < nphysicals)
1701 continue;
1702
1703 /* Get device type, vendor, model, device id */
1704 if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice))
1705 continue; /* skip it if we can't talk to it. */
1706 figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun,
1707 tmpdevice);
1708 this_device = currentsd[ncurrent];
1709
1710 /*
1711 * For the msa2xxx boxes, we have to insert a LUN 0 which
1712 * doesn't show up in CCISS_REPORT_PHYSICAL data, but there
1713 * is nonetheless an enclosure device there. We have to
1714 * present that otherwise linux won't find anything if
1715 * there is no lun 0.
1716 */
1717 if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device,
1718 lunaddrbytes, bus, target, lun, lunzerobits,
1719 &nmsa2xxx_enclosures)) {
1720 ncurrent++;
1721 this_device = currentsd[ncurrent];
1722 }
1723
1724 *this_device = *tmpdevice;
1725 hpsa_set_bus_target_lun(this_device, bus, target, lun);
1726
1727 switch (this_device->devtype) {
1728 case TYPE_ROM: {
1729 /* We don't *really* support actual CD-ROM devices,
1730 * just "One Button Disaster Recovery" tape drive
1731 * which temporarily pretends to be a CD-ROM drive.
1732 * So we check that the device is really an OBDR tape
1733 * device by checking for "$DR-10" in bytes 43-48 of
1734 * the inquiry data.
1735 */
1736 char obdr_sig[7];
1737#define OBDR_TAPE_SIG "$DR-10"
1738 strncpy(obdr_sig, &inq_buff[43], 6);
1739 obdr_sig[6] = '\0';
1740 if (strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0)
1741 /* Not OBDR device, ignore it. */
1742 break;
1743 }
1744 ncurrent++;
1745 break;
1746 case TYPE_DISK:
1747 if (i < nphysicals)
1748 break;
1749 ncurrent++;
1750 break;
1751 case TYPE_TAPE:
1752 case TYPE_MEDIUM_CHANGER:
1753 ncurrent++;
1754 break;
1755 case TYPE_RAID:
1756 /* Only present the Smartarray HBA as a RAID controller.
1757 * If it's a RAID controller other than the HBA itself
1758 * (an external RAID controller, MSA500 or similar)
1759 * don't present it.
1760 */
1761 if (!is_hba_lunid(lunaddrbytes))
1762 break;
1763 ncurrent++;
1764 break;
1765 default:
1766 break;
1767 }
1768 if (ncurrent >= HPSA_MAX_SCSI_DEVS_PER_HBA)
1769 break;
1770 }
1771 adjust_hpsa_scsi_table(h, hostno, currentsd, ncurrent);
1772out:
1773 kfree(tmpdevice);
1774 for (i = 0; i < ndev_allocated; i++)
1775 kfree(currentsd[i]);
1776 kfree(currentsd);
1777 kfree(inq_buff);
1778 kfree(physdev_list);
1779 kfree(logdev_list);
1780 return;
1781}
1782
1783/* hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
1784 * dma mapping and fills in the scatter gather entries of the
1785 * hpsa command, cp.
1786 */
1787static int hpsa_scatter_gather(struct pci_dev *pdev,
1788 struct CommandList *cp,
1789 struct scsi_cmnd *cmd)
1790{
1791 unsigned int len;
1792 struct scatterlist *sg;
1793 __u64 addr64;
1794 int use_sg, i;
1795
1796 BUG_ON(scsi_sg_count(cmd) > MAXSGENTRIES);
1797
1798 use_sg = scsi_dma_map(cmd);
1799 if (use_sg < 0)
1800 return use_sg;
1801
1802 if (!use_sg)
1803 goto sglist_finished;
1804
1805 scsi_for_each_sg(cmd, sg, use_sg, i) {
1806 addr64 = (__u64) sg_dma_address(sg);
1807 len = sg_dma_len(sg);
1808 cp->SG[i].Addr.lower =
1809 (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF);
1810 cp->SG[i].Addr.upper =
1811 (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF);
1812 cp->SG[i].Len = len;
1813 cp->SG[i].Ext = 0; /* we are not chaining */
1814 }
1815
1816sglist_finished:
1817
1818 cp->Header.SGList = (__u8) use_sg; /* no. SGs contig in this cmd */
1819 cp->Header.SGTotal = (__u16) use_sg; /* total sgs in this cmd list */
1820 return 0;
1821}
1822
1823
1824static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
1825 void (*done)(struct scsi_cmnd *))
1826{
1827 struct ctlr_info *h;
1828 struct hpsa_scsi_dev_t *dev;
1829 unsigned char scsi3addr[8];
1830 struct CommandList *c;
1831 unsigned long flags;
1832
1833 /* Get the ptr to our adapter structure out of cmd->host. */
1834 h = sdev_to_hba(cmd->device);
1835 dev = cmd->device->hostdata;
1836 if (!dev) {
1837 cmd->result = DID_NO_CONNECT << 16;
1838 done(cmd);
1839 return 0;
1840 }
1841 memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr));
1842
1843 /* Need a lock as this is being allocated from the pool */
1844 spin_lock_irqsave(&h->lock, flags);
1845 c = cmd_alloc(h);
1846 spin_unlock_irqrestore(&h->lock, flags);
1847 if (c == NULL) { /* trouble... */
1848 dev_err(&h->pdev->dev, "cmd_alloc returned NULL!\n");
1849 return SCSI_MLQUEUE_HOST_BUSY;
1850 }
1851
1852 /* Fill in the command list header */
1853
1854 cmd->scsi_done = done; /* save this for use by completion code */
1855
1856 /* save c in case we have to abort it */
1857 cmd->host_scribble = (unsigned char *) c;
1858
1859 c->cmd_type = CMD_SCSI;
1860 c->scsi_cmd = cmd;
1861 c->Header.ReplyQueue = 0; /* unused in simple mode */
1862 memcpy(&c->Header.LUN.LunAddrBytes[0], &scsi3addr[0], 8);
1863 c->Header.Tag.lower = c->busaddr; /* Use k. address of cmd as tag */
1864
1865 /* Fill in the request block... */
1866
1867 c->Request.Timeout = 0;
1868 memset(c->Request.CDB, 0, sizeof(c->Request.CDB));
1869 BUG_ON(cmd->cmd_len > sizeof(c->Request.CDB));
1870 c->Request.CDBLen = cmd->cmd_len;
1871 memcpy(c->Request.CDB, cmd->cmnd, cmd->cmd_len);
1872 c->Request.Type.Type = TYPE_CMD;
1873 c->Request.Type.Attribute = ATTR_SIMPLE;
1874 switch (cmd->sc_data_direction) {
1875 case DMA_TO_DEVICE:
1876 c->Request.Type.Direction = XFER_WRITE;
1877 break;
1878 case DMA_FROM_DEVICE:
1879 c->Request.Type.Direction = XFER_READ;
1880 break;
1881 case DMA_NONE:
1882 c->Request.Type.Direction = XFER_NONE;
1883 break;
1884 case DMA_BIDIRECTIONAL:
1885 /* This can happen if a buggy application does a scsi passthru
1886 * and sets both inlen and outlen to non-zero. ( see
1887 * ../scsi/scsi_ioctl.c:scsi_ioctl_send_command() )
1888 */
1889
1890 c->Request.Type.Direction = XFER_RSVD;
1891 /* This is technically wrong, and hpsa controllers should
1892 * reject it with CMD_INVALID, which is the most correct
1893 * response, but non-fibre backends appear to let it
1894 * slide by, and give the same results as if this field
1895 * were set correctly. Either way is acceptable for
1896 * our purposes here.
1897 */
1898
1899 break;
1900
1901 default:
1902 dev_err(&h->pdev->dev, "unknown data direction: %d\n",
1903 cmd->sc_data_direction);
1904 BUG();
1905 break;
1906 }
1907
1908 if (hpsa_scatter_gather(h->pdev, c, cmd) < 0) { /* Fill SG list */
1909 cmd_free(h, c);
1910 return SCSI_MLQUEUE_HOST_BUSY;
1911 }
1912 enqueue_cmd_and_start_io(h, c);
1913 /* the cmd'll come back via intr handler in complete_scsi_command() */
1914 return 0;
1915}
1916
1917static void hpsa_unregister_scsi(struct ctlr_info *h)
1918{
1919 /* we are being forcibly unloaded, and may not refuse. */
1920 scsi_remove_host(h->scsi_host);
1921 scsi_host_put(h->scsi_host);
1922 h->scsi_host = NULL;
1923}
1924
1925static int hpsa_register_scsi(struct ctlr_info *h)
1926{
1927 int rc;
1928
1929 hpsa_update_scsi_devices(h, -1);
1930 rc = hpsa_scsi_detect(h);
1931 if (rc != 0)
1932 dev_err(&h->pdev->dev, "hpsa_register_scsi: failed"
1933 " hpsa_scsi_detect(), rc is %d\n", rc);
1934 return rc;
1935}
1936
1937static int wait_for_device_to_become_ready(struct ctlr_info *h,
1938 unsigned char lunaddr[])
1939{
1940 int rc = 0;
1941 int count = 0;
1942 int waittime = 1; /* seconds */
1943 struct CommandList *c;
1944
1945 c = cmd_special_alloc(h);
1946 if (!c) {
1947 dev_warn(&h->pdev->dev, "out of memory in "
1948 "wait_for_device_to_become_ready.\n");
1949 return IO_ERROR;
1950 }
1951
1952 /* Send test unit ready until device ready, or give up. */
1953 while (count < HPSA_TUR_RETRY_LIMIT) {
1954
1955 /* Wait for a bit. do this first, because if we send
1956 * the TUR right away, the reset will just abort it.
1957 */
1958 msleep(1000 * waittime);
1959 count++;
1960
1961 /* Increase wait time with each try, up to a point. */
1962 if (waittime < HPSA_MAX_WAIT_INTERVAL_SECS)
1963 waittime = waittime * 2;
1964
1965 /* Send the Test Unit Ready */
1966 fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, lunaddr, TYPE_CMD);
1967 hpsa_scsi_do_simple_cmd_core(h, c);
1968 /* no unmap needed here because no data xfer. */
1969
1970 if (c->err_info->CommandStatus == CMD_SUCCESS)
1971 break;
1972
1973 if (c->err_info->CommandStatus == CMD_TARGET_STATUS &&
1974 c->err_info->ScsiStatus == SAM_STAT_CHECK_CONDITION &&
1975 (c->err_info->SenseInfo[2] == NO_SENSE ||
1976 c->err_info->SenseInfo[2] == UNIT_ATTENTION))
1977 break;
1978
1979 dev_warn(&h->pdev->dev, "waiting %d secs "
1980 "for device to become ready.\n", waittime);
1981 rc = 1; /* device not ready. */
1982 }
1983
1984 if (rc)
1985 dev_warn(&h->pdev->dev, "giving up on device.\n");
1986 else
1987 dev_warn(&h->pdev->dev, "device is ready.\n");
1988
1989 cmd_special_free(h, c);
1990 return rc;
1991}
1992
1993/* Need at least one of these error handlers to keep ../scsi/hosts.c from
1994 * complaining. Doing a host- or bus-reset can't do anything good here.
1995 */
1996static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
1997{
1998 int rc;
1999 struct ctlr_info *h;
2000 struct hpsa_scsi_dev_t *dev;
2001
2002 /* find the controller to which the command to be aborted was sent */
2003 h = sdev_to_hba(scsicmd->device);
2004 if (h == NULL) /* paranoia */
2005 return FAILED;
2006 dev_warn(&h->pdev->dev, "resetting drive\n");
2007
2008 dev = scsicmd->device->hostdata;
2009 if (!dev) {
2010 dev_err(&h->pdev->dev, "hpsa_eh_device_reset_handler: "
2011 "device lookup failed.\n");
2012 return FAILED;
2013 }
2014 /* send a reset to the SCSI LUN which the command was sent to */
2015 rc = hpsa_send_reset(h, dev->scsi3addr);
2016 if (rc == 0 && wait_for_device_to_become_ready(h, dev->scsi3addr) == 0)
2017 return SUCCESS;
2018
2019 dev_warn(&h->pdev->dev, "resetting device failed.\n");
2020 return FAILED;
2021}
2022
2023/*
2024 * For operations that cannot sleep, a command block is allocated at init,
2025 * and managed by cmd_alloc() and cmd_free() using a simple bitmap to track
2026 * which ones are free or in use. Lock must be held when calling this.
2027 * cmd_free() is the complement.
2028 */
2029static struct CommandList *cmd_alloc(struct ctlr_info *h)
2030{
2031 struct CommandList *c;
2032 int i;
2033 union u64bit temp64;
2034 dma_addr_t cmd_dma_handle, err_dma_handle;
2035
2036 do {
2037 i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
2038 if (i == h->nr_cmds)
2039 return NULL;
2040 } while (test_and_set_bit
2041 (i & (BITS_PER_LONG - 1),
2042 h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
2043 c = h->cmd_pool + i;
2044 memset(c, 0, sizeof(*c));
2045 cmd_dma_handle = h->cmd_pool_dhandle
2046 + i * sizeof(*c);
2047 c->err_info = h->errinfo_pool + i;
2048 memset(c->err_info, 0, sizeof(*c->err_info));
2049 err_dma_handle = h->errinfo_pool_dhandle
2050 + i * sizeof(*c->err_info);
2051 h->nr_allocs++;
2052
2053 c->cmdindex = i;
2054
2055 INIT_HLIST_NODE(&c->list);
2056 c->busaddr = (__u32) cmd_dma_handle;
2057 temp64.val = (__u64) err_dma_handle;
2058 c->ErrDesc.Addr.lower = temp64.val32.lower;
2059 c->ErrDesc.Addr.upper = temp64.val32.upper;
2060 c->ErrDesc.Len = sizeof(*c->err_info);
2061
2062 c->h = h;
2063 return c;
2064}
2065
2066/* For operations that can wait for kmalloc to possibly sleep,
2067 * this routine can be called. Lock need not be held to call
2068 * cmd_special_alloc. cmd_special_free() is the complement.
2069 */
2070static struct CommandList *cmd_special_alloc(struct ctlr_info *h)
2071{
2072 struct CommandList *c;
2073 union u64bit temp64;
2074 dma_addr_t cmd_dma_handle, err_dma_handle;
2075
2076 c = pci_alloc_consistent(h->pdev, sizeof(*c), &cmd_dma_handle);
2077 if (c == NULL)
2078 return NULL;
2079 memset(c, 0, sizeof(*c));
2080
2081 c->cmdindex = -1;
2082
2083 c->err_info = pci_alloc_consistent(h->pdev, sizeof(*c->err_info),
2084 &err_dma_handle);
2085
2086 if (c->err_info == NULL) {
2087 pci_free_consistent(h->pdev,
2088 sizeof(*c), c, cmd_dma_handle);
2089 return NULL;
2090 }
2091 memset(c->err_info, 0, sizeof(*c->err_info));
2092
2093 INIT_HLIST_NODE(&c->list);
2094 c->busaddr = (__u32) cmd_dma_handle;
2095 temp64.val = (__u64) err_dma_handle;
2096 c->ErrDesc.Addr.lower = temp64.val32.lower;
2097 c->ErrDesc.Addr.upper = temp64.val32.upper;
2098 c->ErrDesc.Len = sizeof(*c->err_info);
2099
2100 c->h = h;
2101 return c;
2102}
2103
2104static void cmd_free(struct ctlr_info *h, struct CommandList *c)
2105{
2106 int i;
2107
2108 i = c - h->cmd_pool;
2109 clear_bit(i & (BITS_PER_LONG - 1),
2110 h->cmd_pool_bits + (i / BITS_PER_LONG));
2111 h->nr_frees++;
2112}
2113
2114static void cmd_special_free(struct ctlr_info *h, struct CommandList *c)
2115{
2116 union u64bit temp64;
2117
2118 temp64.val32.lower = c->ErrDesc.Addr.lower;
2119 temp64.val32.upper = c->ErrDesc.Addr.upper;
2120 pci_free_consistent(h->pdev, sizeof(*c->err_info),
2121 c->err_info, (dma_addr_t) temp64.val);
2122 pci_free_consistent(h->pdev, sizeof(*c),
2123 c, (dma_addr_t) c->busaddr);
2124}
2125
2126#ifdef CONFIG_COMPAT
2127
2128static int do_ioctl(struct scsi_device *dev, int cmd, void *arg)
2129{
2130 int ret;
2131
2132 lock_kernel();
2133 ret = hpsa_ioctl(dev, cmd, arg);
2134 unlock_kernel();
2135 return ret;
2136}
2137
2138static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg);
2139static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
2140 int cmd, void *arg);
2141
2142static int hpsa_compat_ioctl(struct scsi_device *dev, int cmd, void *arg)
2143{
2144 switch (cmd) {
2145 case CCISS_GETPCIINFO:
2146 case CCISS_GETINTINFO:
2147 case CCISS_SETINTINFO:
2148 case CCISS_GETNODENAME:
2149 case CCISS_SETNODENAME:
2150 case CCISS_GETHEARTBEAT:
2151 case CCISS_GETBUSTYPES:
2152 case CCISS_GETFIRMVER:
2153 case CCISS_GETDRIVVER:
2154 case CCISS_REVALIDVOLS:
2155 case CCISS_DEREGDISK:
2156 case CCISS_REGNEWDISK:
2157 case CCISS_REGNEWD:
2158 case CCISS_RESCANDISK:
2159 case CCISS_GETLUNINFO:
2160 return do_ioctl(dev, cmd, arg);
2161
2162 case CCISS_PASSTHRU32:
2163 return hpsa_ioctl32_passthru(dev, cmd, arg);
2164 case CCISS_BIG_PASSTHRU32:
2165 return hpsa_ioctl32_big_passthru(dev, cmd, arg);
2166
2167 default:
2168 return -ENOIOCTLCMD;
2169 }
2170}
2171
2172static int hpsa_ioctl32_passthru(struct scsi_device *dev, int cmd, void *arg)
2173{
2174 IOCTL32_Command_struct __user *arg32 =
2175 (IOCTL32_Command_struct __user *) arg;
2176 IOCTL_Command_struct arg64;
2177 IOCTL_Command_struct __user *p = compat_alloc_user_space(sizeof(arg64));
2178 int err;
2179 u32 cp;
2180
2181 err = 0;
2182 err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
2183 sizeof(arg64.LUN_info));
2184 err |= copy_from_user(&arg64.Request, &arg32->Request,
2185 sizeof(arg64.Request));
2186 err |= copy_from_user(&arg64.error_info, &arg32->error_info,
2187 sizeof(arg64.error_info));
2188 err |= get_user(arg64.buf_size, &arg32->buf_size);
2189 err |= get_user(cp, &arg32->buf);
2190 arg64.buf = compat_ptr(cp);
2191 err |= copy_to_user(p, &arg64, sizeof(arg64));
2192
2193 if (err)
2194 return -EFAULT;
2195
2196 err = do_ioctl(dev, CCISS_PASSTHRU, (void *)p);
2197 if (err)
2198 return err;
2199 err |= copy_in_user(&arg32->error_info, &p->error_info,
2200 sizeof(arg32->error_info));
2201 if (err)
2202 return -EFAULT;
2203 return err;
2204}
2205
2206static int hpsa_ioctl32_big_passthru(struct scsi_device *dev,
2207 int cmd, void *arg)
2208{
2209 BIG_IOCTL32_Command_struct __user *arg32 =
2210 (BIG_IOCTL32_Command_struct __user *) arg;
2211 BIG_IOCTL_Command_struct arg64;
2212 BIG_IOCTL_Command_struct __user *p =
2213 compat_alloc_user_space(sizeof(arg64));
2214 int err;
2215 u32 cp;
2216
2217 err = 0;
2218 err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
2219 sizeof(arg64.LUN_info));
2220 err |= copy_from_user(&arg64.Request, &arg32->Request,
2221 sizeof(arg64.Request));
2222 err |= copy_from_user(&arg64.error_info, &arg32->error_info,
2223 sizeof(arg64.error_info));
2224 err |= get_user(arg64.buf_size, &arg32->buf_size);
2225 err |= get_user(arg64.malloc_size, &arg32->malloc_size);
2226 err |= get_user(cp, &arg32->buf);
2227 arg64.buf = compat_ptr(cp);
2228 err |= copy_to_user(p, &arg64, sizeof(arg64));
2229
2230 if (err)
2231 return -EFAULT;
2232
2233 err = do_ioctl(dev, CCISS_BIG_PASSTHRU, (void *)p);
2234 if (err)
2235 return err;
2236 err |= copy_in_user(&arg32->error_info, &p->error_info,
2237 sizeof(arg32->error_info));
2238 if (err)
2239 return -EFAULT;
2240 return err;
2241}
2242#endif
2243
2244static int hpsa_getpciinfo_ioctl(struct ctlr_info *h, void __user *argp)
2245{
2246 struct hpsa_pci_info pciinfo;
2247
2248 if (!argp)
2249 return -EINVAL;
2250 pciinfo.domain = pci_domain_nr(h->pdev->bus);
2251 pciinfo.bus = h->pdev->bus->number;
2252 pciinfo.dev_fn = h->pdev->devfn;
2253 pciinfo.board_id = h->board_id;
2254 if (copy_to_user(argp, &pciinfo, sizeof(pciinfo)))
2255 return -EFAULT;
2256 return 0;
2257}
2258
2259static int hpsa_getdrivver_ioctl(struct ctlr_info *h, void __user *argp)
2260{
2261 DriverVer_type DriverVer;
2262 unsigned char vmaj, vmin, vsubmin;
2263 int rc;
2264
2265 rc = sscanf(HPSA_DRIVER_VERSION, "%hhu.%hhu.%hhu",
2266 &vmaj, &vmin, &vsubmin);
2267 if (rc != 3) {
2268 dev_info(&h->pdev->dev, "driver version string '%s' "
2269 "unrecognized.", HPSA_DRIVER_VERSION);
2270 vmaj = 0;
2271 vmin = 0;
2272 vsubmin = 0;
2273 }
2274 DriverVer = (vmaj << 16) | (vmin << 8) | vsubmin;
2275 if (!argp)
2276 return -EINVAL;
2277 if (copy_to_user(argp, &DriverVer, sizeof(DriverVer_type)))
2278 return -EFAULT;
2279 return 0;
2280}
2281
2282static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
2283{
2284 IOCTL_Command_struct iocommand;
2285 struct CommandList *c;
2286 char *buff = NULL;
2287 union u64bit temp64;
2288
2289 if (!argp)
2290 return -EINVAL;
2291 if (!capable(CAP_SYS_RAWIO))
2292 return -EPERM;
2293 if (copy_from_user(&iocommand, argp, sizeof(iocommand)))
2294 return -EFAULT;
2295 if ((iocommand.buf_size < 1) &&
2296 (iocommand.Request.Type.Direction != XFER_NONE)) {
2297 return -EINVAL;
2298 }
2299 if (iocommand.buf_size > 0) {
2300 buff = kmalloc(iocommand.buf_size, GFP_KERNEL);
2301 if (buff == NULL)
2302 return -EFAULT;
2303 }
2304 if (iocommand.Request.Type.Direction == XFER_WRITE) {
2305 /* Copy the data into the buffer we created */
2306 if (copy_from_user(buff, iocommand.buf, iocommand.buf_size)) {
2307 kfree(buff);
2308 return -EFAULT;
2309 }
2310 } else
2311 memset(buff, 0, iocommand.buf_size);
2312 c = cmd_special_alloc(h);
2313 if (c == NULL) {
2314 kfree(buff);
2315 return -ENOMEM;
2316 }
2317 /* Fill in the command type */
2318 c->cmd_type = CMD_IOCTL_PEND;
2319 /* Fill in Command Header */
2320 c->Header.ReplyQueue = 0; /* unused in simple mode */
2321 if (iocommand.buf_size > 0) { /* buffer to fill */
2322 c->Header.SGList = 1;
2323 c->Header.SGTotal = 1;
2324 } else { /* no buffers to fill */
2325 c->Header.SGList = 0;
2326 c->Header.SGTotal = 0;
2327 }
2328 memcpy(&c->Header.LUN, &iocommand.LUN_info, sizeof(c->Header.LUN));
2329 /* use the kernel address the cmd block for tag */
2330 c->Header.Tag.lower = c->busaddr;
2331
2332 /* Fill in Request block */
2333 memcpy(&c->Request, &iocommand.Request,
2334 sizeof(c->Request));
2335
2336 /* Fill in the scatter gather information */
2337 if (iocommand.buf_size > 0) {
2338 temp64.val = pci_map_single(h->pdev, buff,
2339 iocommand.buf_size, PCI_DMA_BIDIRECTIONAL);
2340 c->SG[0].Addr.lower = temp64.val32.lower;
2341 c->SG[0].Addr.upper = temp64.val32.upper;
2342 c->SG[0].Len = iocommand.buf_size;
2343 c->SG[0].Ext = 0; /* we are not chaining*/
2344 }
2345 hpsa_scsi_do_simple_cmd_core(h, c);
2346 hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
2347 check_ioctl_unit_attention(h, c);
2348
2349 /* Copy the error information out */
2350 memcpy(&iocommand.error_info, c->err_info,
2351 sizeof(iocommand.error_info));
2352 if (copy_to_user(argp, &iocommand, sizeof(iocommand))) {
2353 kfree(buff);
2354 cmd_special_free(h, c);
2355 return -EFAULT;
2356 }
2357
2358 if (iocommand.Request.Type.Direction == XFER_READ) {
2359 /* Copy the data out of the buffer we created */
2360 if (copy_to_user(iocommand.buf, buff, iocommand.buf_size)) {
2361 kfree(buff);
2362 cmd_special_free(h, c);
2363 return -EFAULT;
2364 }
2365 }
2366 kfree(buff);
2367 cmd_special_free(h, c);
2368 return 0;
2369}
2370
2371static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
2372{
2373 BIG_IOCTL_Command_struct *ioc;
2374 struct CommandList *c;
2375 unsigned char **buff = NULL;
2376 int *buff_size = NULL;
2377 union u64bit temp64;
2378 BYTE sg_used = 0;
2379 int status = 0;
2380 int i;
2381 __u32 left;
2382 __u32 sz;
2383 BYTE __user *data_ptr;
2384
2385 if (!argp)
2386 return -EINVAL;
2387 if (!capable(CAP_SYS_RAWIO))
2388 return -EPERM;
2389 ioc = (BIG_IOCTL_Command_struct *)
2390 kmalloc(sizeof(*ioc), GFP_KERNEL);
2391 if (!ioc) {
2392 status = -ENOMEM;
2393 goto cleanup1;
2394 }
2395 if (copy_from_user(ioc, argp, sizeof(*ioc))) {
2396 status = -EFAULT;
2397 goto cleanup1;
2398 }
2399 if ((ioc->buf_size < 1) &&
2400 (ioc->Request.Type.Direction != XFER_NONE)) {
2401 status = -EINVAL;
2402 goto cleanup1;
2403 }
2404 /* Check kmalloc limits using all SGs */
2405 if (ioc->malloc_size > MAX_KMALLOC_SIZE) {
2406 status = -EINVAL;
2407 goto cleanup1;
2408 }
2409 if (ioc->buf_size > ioc->malloc_size * MAXSGENTRIES) {
2410 status = -EINVAL;
2411 goto cleanup1;
2412 }
2413 buff = kzalloc(MAXSGENTRIES * sizeof(char *), GFP_KERNEL);
2414 if (!buff) {
2415 status = -ENOMEM;
2416 goto cleanup1;
2417 }
2418 buff_size = kmalloc(MAXSGENTRIES * sizeof(int), GFP_KERNEL);
2419 if (!buff_size) {
2420 status = -ENOMEM;
2421 goto cleanup1;
2422 }
2423 left = ioc->buf_size;
2424 data_ptr = ioc->buf;
2425 while (left) {
2426 sz = (left > ioc->malloc_size) ? ioc->malloc_size : left;
2427 buff_size[sg_used] = sz;
2428 buff[sg_used] = kmalloc(sz, GFP_KERNEL);
2429 if (buff[sg_used] == NULL) {
2430 status = -ENOMEM;
2431 goto cleanup1;
2432 }
2433 if (ioc->Request.Type.Direction == XFER_WRITE) {
2434 if (copy_from_user(buff[sg_used], data_ptr, sz)) {
2435 status = -ENOMEM;
2436 goto cleanup1;
2437 }
2438 } else
2439 memset(buff[sg_used], 0, sz);
2440 left -= sz;
2441 data_ptr += sz;
2442 sg_used++;
2443 }
2444 c = cmd_special_alloc(h);
2445 if (c == NULL) {
2446 status = -ENOMEM;
2447 goto cleanup1;
2448 }
2449 c->cmd_type = CMD_IOCTL_PEND;
2450 c->Header.ReplyQueue = 0;
2451
2452 if (ioc->buf_size > 0) {
2453 c->Header.SGList = sg_used;
2454 c->Header.SGTotal = sg_used;
2455 } else {
2456 c->Header.SGList = 0;
2457 c->Header.SGTotal = 0;
2458 }
2459 memcpy(&c->Header.LUN, &ioc->LUN_info, sizeof(c->Header.LUN));
2460 c->Header.Tag.lower = c->busaddr;
2461 memcpy(&c->Request, &ioc->Request, sizeof(c->Request));
2462 if (ioc->buf_size > 0) {
2463 int i;
2464 for (i = 0; i < sg_used; i++) {
2465 temp64.val = pci_map_single(h->pdev, buff[i],
2466 buff_size[i], PCI_DMA_BIDIRECTIONAL);
2467 c->SG[i].Addr.lower = temp64.val32.lower;
2468 c->SG[i].Addr.upper = temp64.val32.upper;
2469 c->SG[i].Len = buff_size[i];
2470 /* we are not chaining */
2471 c->SG[i].Ext = 0;
2472 }
2473 }
2474 hpsa_scsi_do_simple_cmd_core(h, c);
2475 hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
2476 check_ioctl_unit_attention(h, c);
2477 /* Copy the error information out */
2478 memcpy(&ioc->error_info, c->err_info, sizeof(ioc->error_info));
2479 if (copy_to_user(argp, ioc, sizeof(*ioc))) {
2480 cmd_special_free(h, c);
2481 status = -EFAULT;
2482 goto cleanup1;
2483 }
2484 if (ioc->Request.Type.Direction == XFER_READ) {
2485 /* Copy the data out of the buffer we created */
2486 BYTE __user *ptr = ioc->buf;
2487 for (i = 0; i < sg_used; i++) {
2488 if (copy_to_user(ptr, buff[i], buff_size[i])) {
2489 cmd_special_free(h, c);
2490 status = -EFAULT;
2491 goto cleanup1;
2492 }
2493 ptr += buff_size[i];
2494 }
2495 }
2496 cmd_special_free(h, c);
2497 status = 0;
2498cleanup1:
2499 if (buff) {
2500 for (i = 0; i < sg_used; i++)
2501 kfree(buff[i]);
2502 kfree(buff);
2503 }
2504 kfree(buff_size);
2505 kfree(ioc);
2506 return status;
2507}
2508
2509static void check_ioctl_unit_attention(struct ctlr_info *h,
2510 struct CommandList *c)
2511{
2512 if (c->err_info->CommandStatus == CMD_TARGET_STATUS &&
2513 c->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION)
2514 (void) check_for_unit_attention(h, c);
2515}
2516/*
2517 * ioctl
2518 */
2519static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
2520{
2521 struct ctlr_info *h;
2522 void __user *argp = (void __user *)arg;
2523
2524 h = sdev_to_hba(dev);
2525
2526 switch (cmd) {
2527 case CCISS_DEREGDISK:
2528 case CCISS_REGNEWDISK:
2529 case CCISS_REGNEWD:
2530 hpsa_update_scsi_devices(h, dev->host->host_no);
2531 return 0;
2532 case CCISS_GETPCIINFO:
2533 return hpsa_getpciinfo_ioctl(h, argp);
2534 case CCISS_GETDRIVVER:
2535 return hpsa_getdrivver_ioctl(h, argp);
2536 case CCISS_PASSTHRU:
2537 return hpsa_passthru_ioctl(h, argp);
2538 case CCISS_BIG_PASSTHRU:
2539 return hpsa_big_passthru_ioctl(h, argp);
2540 default:
2541 return -ENOTTY;
2542 }
2543}
2544
2545static void fill_cmd(struct CommandList *c, __u8 cmd, struct ctlr_info *h,
2546 void *buff, size_t size, __u8 page_code, unsigned char *scsi3addr,
2547 int cmd_type)
2548{
2549 int pci_dir = XFER_NONE;
2550
2551 c->cmd_type = CMD_IOCTL_PEND;
2552 c->Header.ReplyQueue = 0;
2553 if (buff != NULL && size > 0) {
2554 c->Header.SGList = 1;
2555 c->Header.SGTotal = 1;
2556 } else {
2557 c->Header.SGList = 0;
2558 c->Header.SGTotal = 0;
2559 }
2560 c->Header.Tag.lower = c->busaddr;
2561 memcpy(c->Header.LUN.LunAddrBytes, scsi3addr, 8);
2562
2563 c->Request.Type.Type = cmd_type;
2564 if (cmd_type == TYPE_CMD) {
2565 switch (cmd) {
2566 case HPSA_INQUIRY:
2567 /* are we trying to read a vital product page */
2568 if (page_code != 0) {
2569 c->Request.CDB[1] = 0x01;
2570 c->Request.CDB[2] = page_code;
2571 }
2572 c->Request.CDBLen = 6;
2573 c->Request.Type.Attribute = ATTR_SIMPLE;
2574 c->Request.Type.Direction = XFER_READ;
2575 c->Request.Timeout = 0;
2576 c->Request.CDB[0] = HPSA_INQUIRY;
2577 c->Request.CDB[4] = size & 0xFF;
2578 break;
2579 case HPSA_REPORT_LOG:
2580 case HPSA_REPORT_PHYS:
2581 /* Talking to controller so It's a physical command
2582 mode = 00 target = 0. Nothing to write.
2583 */
2584 c->Request.CDBLen = 12;
2585 c->Request.Type.Attribute = ATTR_SIMPLE;
2586 c->Request.Type.Direction = XFER_READ;
2587 c->Request.Timeout = 0;
2588 c->Request.CDB[0] = cmd;
2589 c->Request.CDB[6] = (size >> 24) & 0xFF; /* MSB */
2590 c->Request.CDB[7] = (size >> 16) & 0xFF;
2591 c->Request.CDB[8] = (size >> 8) & 0xFF;
2592 c->Request.CDB[9] = size & 0xFF;
2593 break;
2594
2595 case HPSA_READ_CAPACITY:
2596 c->Request.CDBLen = 10;
2597 c->Request.Type.Attribute = ATTR_SIMPLE;
2598 c->Request.Type.Direction = XFER_READ;
2599 c->Request.Timeout = 0;
2600 c->Request.CDB[0] = cmd;
2601 break;
2602 case HPSA_CACHE_FLUSH:
2603 c->Request.CDBLen = 12;
2604 c->Request.Type.Attribute = ATTR_SIMPLE;
2605 c->Request.Type.Direction = XFER_WRITE;
2606 c->Request.Timeout = 0;
2607 c->Request.CDB[0] = BMIC_WRITE;
2608 c->Request.CDB[6] = BMIC_CACHE_FLUSH;
2609 break;
2610 case TEST_UNIT_READY:
2611 c->Request.CDBLen = 6;
2612 c->Request.Type.Attribute = ATTR_SIMPLE;
2613 c->Request.Type.Direction = XFER_NONE;
2614 c->Request.Timeout = 0;
2615 break;
2616 default:
2617 dev_warn(&h->pdev->dev, "unknown command 0x%c\n", cmd);
2618 BUG();
2619 return;
2620 }
2621 } else if (cmd_type == TYPE_MSG) {
2622 switch (cmd) {
2623
2624 case HPSA_DEVICE_RESET_MSG:
2625 c->Request.CDBLen = 16;
2626 c->Request.Type.Type = 1; /* It is a MSG not a CMD */
2627 c->Request.Type.Attribute = ATTR_SIMPLE;
2628 c->Request.Type.Direction = XFER_NONE;
2629 c->Request.Timeout = 0; /* Don't time out */
2630 c->Request.CDB[0] = 0x01; /* RESET_MSG is 0x01 */
2631 c->Request.CDB[1] = 0x03; /* Reset target above */
2632 /* If bytes 4-7 are zero, it means reset the */
2633 /* LunID device */
2634 c->Request.CDB[4] = 0x00;
2635 c->Request.CDB[5] = 0x00;
2636 c->Request.CDB[6] = 0x00;
2637 c->Request.CDB[7] = 0x00;
2638 break;
2639
2640 default:
2641 dev_warn(&h->pdev->dev, "unknown message type %d\n",
2642 cmd);
2643 BUG();
2644 }
2645 } else {
2646 dev_warn(&h->pdev->dev, "unknown command type %d\n", cmd_type);
2647 BUG();
2648 }
2649
2650 switch (c->Request.Type.Direction) {
2651 case XFER_READ:
2652 pci_dir = PCI_DMA_FROMDEVICE;
2653 break;
2654 case XFER_WRITE:
2655 pci_dir = PCI_DMA_TODEVICE;
2656 break;
2657 case XFER_NONE:
2658 pci_dir = PCI_DMA_NONE;
2659 break;
2660 default:
2661 pci_dir = PCI_DMA_BIDIRECTIONAL;
2662 }
2663
2664 hpsa_map_one(h->pdev, c, buff, size, pci_dir);
2665
2666 return;
2667}
2668
2669/*
2670 * Map (physical) PCI mem into (virtual) kernel space
2671 */
2672static void __iomem *remap_pci_mem(ulong base, ulong size)
2673{
2674 ulong page_base = ((ulong) base) & PAGE_MASK;
2675 ulong page_offs = ((ulong) base) - page_base;
2676 void __iomem *page_remapped = ioremap(page_base, page_offs + size);
2677
2678 return page_remapped ? (page_remapped + page_offs) : NULL;
2679}
2680
2681/* Takes cmds off the submission queue and sends them to the hardware,
2682 * then puts them on the queue of cmds waiting for completion.
2683 */
2684static void start_io(struct ctlr_info *h)
2685{
2686 struct CommandList *c;
2687
2688 while (!hlist_empty(&h->reqQ)) {
2689 c = hlist_entry(h->reqQ.first, struct CommandList, list);
2690 /* can't do anything if fifo is full */
2691 if ((h->access.fifo_full(h))) {
2692 dev_warn(&h->pdev->dev, "fifo full\n");
2693 break;
2694 }
2695
2696 /* Get the first entry from the Request Q */
2697 removeQ(c);
2698 h->Qdepth--;
2699
2700 /* Tell the controller execute command */
2701 h->access.submit_command(h, c);
2702
2703 /* Put job onto the completed Q */
2704 addQ(&h->cmpQ, c);
2705 }
2706}
2707
2708static inline unsigned long get_next_completion(struct ctlr_info *h)
2709{
2710 return h->access.command_completed(h);
2711}
2712
2713static inline int interrupt_pending(struct ctlr_info *h)
2714{
2715 return h->access.intr_pending(h);
2716}
2717
2718static inline long interrupt_not_for_us(struct ctlr_info *h)
2719{
2720 return ((h->access.intr_pending(h) == 0) ||
2721 (h->interrupts_enabled == 0));
2722}
2723
2724static inline int bad_tag(struct ctlr_info *h, __u32 tag_index,
2725 __u32 raw_tag)
2726{
2727 if (unlikely(tag_index >= h->nr_cmds)) {
2728 dev_warn(&h->pdev->dev, "bad tag 0x%08x ignored.\n", raw_tag);
2729 return 1;
2730 }
2731 return 0;
2732}
2733
2734static inline void finish_cmd(struct CommandList *c, __u32 raw_tag)
2735{
2736 removeQ(c);
2737 if (likely(c->cmd_type == CMD_SCSI))
2738 complete_scsi_command(c, 0, raw_tag);
2739 else if (c->cmd_type == CMD_IOCTL_PEND)
2740 complete(c->waiting);
2741}
2742
2743static irqreturn_t do_hpsa_intr(int irq, void *dev_id)
2744{
2745 struct ctlr_info *h = dev_id;
2746 struct CommandList *c;
2747 unsigned long flags;
2748 __u32 raw_tag, tag, tag_index;
2749 struct hlist_node *tmp;
2750
2751 if (interrupt_not_for_us(h))
2752 return IRQ_NONE;
2753 spin_lock_irqsave(&h->lock, flags);
2754 while (interrupt_pending(h)) {
2755 while ((raw_tag = get_next_completion(h)) != FIFO_EMPTY) {
2756 if (likely(HPSA_TAG_CONTAINS_INDEX(raw_tag))) {
2757 tag_index = HPSA_TAG_TO_INDEX(raw_tag);
2758 if (bad_tag(h, tag_index, raw_tag))
2759 return IRQ_HANDLED;
2760 c = h->cmd_pool + tag_index;
2761 finish_cmd(c, raw_tag);
2762 continue;
2763 }
2764 tag = HPSA_TAG_DISCARD_ERROR_BITS(raw_tag);
2765 c = NULL;
2766 hlist_for_each_entry(c, tmp, &h->cmpQ, list) {
2767 if (c->busaddr == tag) {
2768 finish_cmd(c, raw_tag);
2769 break;
2770 }
2771 }
2772 }
2773 }
2774 spin_unlock_irqrestore(&h->lock, flags);
2775 return IRQ_HANDLED;
2776}
2777
2778/* Send a message CDB to the firmware. */
2779static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
2780 unsigned char type)
2781{
2782 struct Command {
2783 struct CommandListHeader CommandHeader;
2784 struct RequestBlock Request;
2785 struct ErrDescriptor ErrorDescriptor;
2786 };
2787 struct Command *cmd;
2788 static const size_t cmd_sz = sizeof(*cmd) +
2789 sizeof(cmd->ErrorDescriptor);
2790 dma_addr_t paddr64;
2791 uint32_t paddr32, tag;
2792 void __iomem *vaddr;
2793 int i, err;
2794
2795 vaddr = pci_ioremap_bar(pdev, 0);
2796 if (vaddr == NULL)
2797 return -ENOMEM;
2798
2799 /* The Inbound Post Queue only accepts 32-bit physical addresses for the
2800 * CCISS commands, so they must be allocated from the lower 4GiB of
2801 * memory.
2802 */
2803 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
2804 if (err) {
2805 iounmap(vaddr);
2806 return -ENOMEM;
2807 }
2808
2809 cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);
2810 if (cmd == NULL) {
2811 iounmap(vaddr);
2812 return -ENOMEM;
2813 }
2814
2815 /* This must fit, because of the 32-bit consistent DMA mask. Also,
2816 * although there's no guarantee, we assume that the address is at
2817 * least 4-byte aligned (most likely, it's page-aligned).
2818 */
2819 paddr32 = paddr64;
2820
2821 cmd->CommandHeader.ReplyQueue = 0;
2822 cmd->CommandHeader.SGList = 0;
2823 cmd->CommandHeader.SGTotal = 0;
2824 cmd->CommandHeader.Tag.lower = paddr32;
2825 cmd->CommandHeader.Tag.upper = 0;
2826 memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);
2827
2828 cmd->Request.CDBLen = 16;
2829 cmd->Request.Type.Type = TYPE_MSG;
2830 cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE;
2831 cmd->Request.Type.Direction = XFER_NONE;
2832 cmd->Request.Timeout = 0; /* Don't time out */
2833 cmd->Request.CDB[0] = opcode;
2834 cmd->Request.CDB[1] = type;
2835 memset(&cmd->Request.CDB[2], 0, 14); /* rest of the CDB is reserved */
2836 cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(*cmd);
2837 cmd->ErrorDescriptor.Addr.upper = 0;
2838 cmd->ErrorDescriptor.Len = sizeof(struct ErrorInfo);
2839
2840 writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET);
2841
2842 for (i = 0; i < HPSA_MSG_SEND_RETRY_LIMIT; i++) {
2843 tag = readl(vaddr + SA5_REPLY_PORT_OFFSET);
2844 if (HPSA_TAG_DISCARD_ERROR_BITS(tag) == paddr32)
2845 break;
2846 msleep(HPSA_MSG_SEND_RETRY_INTERVAL_MSECS);
2847 }
2848
2849 iounmap(vaddr);
2850
2851 /* we leak the DMA buffer here ... no choice since the controller could
2852 * still complete the command.
2853 */
2854 if (i == HPSA_MSG_SEND_RETRY_LIMIT) {
2855 dev_err(&pdev->dev, "controller message %02x:%02x timed out\n",
2856 opcode, type);
2857 return -ETIMEDOUT;
2858 }
2859
2860 pci_free_consistent(pdev, cmd_sz, cmd, paddr64);
2861
2862 if (tag & HPSA_ERROR_BIT) {
2863 dev_err(&pdev->dev, "controller message %02x:%02x failed\n",
2864 opcode, type);
2865 return -EIO;
2866 }
2867
2868 dev_info(&pdev->dev, "controller message %02x:%02x succeeded\n",
2869 opcode, type);
2870 return 0;
2871}
2872
2873#define hpsa_soft_reset_controller(p) hpsa_message(p, 1, 0)
2874#define hpsa_noop(p) hpsa_message(p, 3, 0)
2875
2876static __devinit int hpsa_reset_msi(struct pci_dev *pdev)
2877{
2878/* the #defines are stolen from drivers/pci/msi.h. */
2879#define msi_control_reg(base) (base + PCI_MSI_FLAGS)
2880#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
2881
2882 int pos;
2883 u16 control = 0;
2884
2885 pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
2886 if (pos) {
2887 pci_read_config_word(pdev, msi_control_reg(pos), &control);
2888 if (control & PCI_MSI_FLAGS_ENABLE) {
2889 dev_info(&pdev->dev, "resetting MSI\n");
2890 pci_write_config_word(pdev, msi_control_reg(pos),
2891 control & ~PCI_MSI_FLAGS_ENABLE);
2892 }
2893 }
2894
2895 pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
2896 if (pos) {
2897 pci_read_config_word(pdev, msi_control_reg(pos), &control);
2898 if (control & PCI_MSIX_FLAGS_ENABLE) {
2899 dev_info(&pdev->dev, "resetting MSI-X\n");
2900 pci_write_config_word(pdev, msi_control_reg(pos),
2901 control & ~PCI_MSIX_FLAGS_ENABLE);
2902 }
2903 }
2904
2905 return 0;
2906}
2907
2908/* This does a hard reset of the controller using PCI power management
2909 * states.
2910 */
2911static __devinit int hpsa_hard_reset_controller(struct pci_dev *pdev)
2912{
2913 u16 pmcsr, saved_config_space[32];
2914 int i, pos;
2915
2916 dev_info(&pdev->dev, "using PCI PM to reset controller\n");
2917
2918 /* This is very nearly the same thing as
2919 *
2920 * pci_save_state(pci_dev);
2921 * pci_set_power_state(pci_dev, PCI_D3hot);
2922 * pci_set_power_state(pci_dev, PCI_D0);
2923 * pci_restore_state(pci_dev);
2924 *
2925 * but we can't use these nice canned kernel routines on
2926 * kexec, because they also check the MSI/MSI-X state in PCI
2927 * configuration space and do the wrong thing when it is
2928 * set/cleared. Also, the pci_save/restore_state functions
2929 * violate the ordering requirements for restoring the
2930 * configuration space from the CCISS document (see the
2931 * comment below). So we roll our own ....
2932 */
2933
2934 for (i = 0; i < 32; i++)
2935 pci_read_config_word(pdev, 2*i, &saved_config_space[i]);
2936
2937 pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
2938 if (pos == 0) {
2939 dev_err(&pdev->dev,
2940 "hpsa_reset_controller: PCI PM not supported\n");
2941 return -ENODEV;
2942 }
2943
2944 /* Quoting from the Open CISS Specification: "The Power
2945 * Management Control/Status Register (CSR) controls the power
2946 * state of the device. The normal operating state is D0,
2947 * CSR=00h. The software off state is D3, CSR=03h. To reset
2948 * the controller, place the interface device in D3 then to
2949 * D0, this causes a secondary PCI reset which will reset the
2950 * controller."
2951 */
2952
2953 /* enter the D3hot power management state */
2954 pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
2955 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
2956 pmcsr |= PCI_D3hot;
2957 pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
2958
2959 msleep(500);
2960
2961 /* enter the D0 power management state */
2962 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
2963 pmcsr |= PCI_D0;
2964 pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
2965
2966 msleep(500);
2967
2968 /* Restore the PCI configuration space. The Open CISS
2969 * Specification says, "Restore the PCI Configuration
2970 * Registers, offsets 00h through 60h. It is important to
2971 * restore the command register, 16-bits at offset 04h,
2972 * last. Do not restore the configuration status register,
2973 * 16-bits at offset 06h." Note that the offset is 2*i.
2974 */
2975 for (i = 0; i < 32; i++) {
2976 if (i == 2 || i == 3)
2977 continue;
2978 pci_write_config_word(pdev, 2*i, saved_config_space[i]);
2979 }
2980 wmb();
2981 pci_write_config_word(pdev, 4, saved_config_space[2]);
2982
2983 return 0;
2984}
2985
2986/*
2987 * We cannot read the structure directly, for portability we must use
2988 * the io functions.
2989 * This is for debug only.
2990 */
2991#ifdef HPSA_DEBUG
2992static void print_cfg_table(struct device *dev, struct CfgTable *tb)
2993{
2994 int i;
2995 char temp_name[17];
2996
2997 dev_info(dev, "Controller Configuration information\n");
2998 dev_info(dev, "------------------------------------\n");
2999 for (i = 0; i < 4; i++)
3000 temp_name[i] = readb(&(tb->Signature[i]));
3001 temp_name[4] = '\0';
3002 dev_info(dev, " Signature = %s\n", temp_name);
3003 dev_info(dev, " Spec Number = %d\n", readl(&(tb->SpecValence)));
3004 dev_info(dev, " Transport methods supported = 0x%x\n",
3005 readl(&(tb->TransportSupport)));
3006 dev_info(dev, " Transport methods active = 0x%x\n",
3007 readl(&(tb->TransportActive)));
3008 dev_info(dev, " Requested transport Method = 0x%x\n",
3009 readl(&(tb->HostWrite.TransportRequest)));
3010 dev_info(dev, " Coalesce Interrupt Delay = 0x%x\n",
3011 readl(&(tb->HostWrite.CoalIntDelay)));
3012 dev_info(dev, " Coalesce Interrupt Count = 0x%x\n",
3013 readl(&(tb->HostWrite.CoalIntCount)));
3014 dev_info(dev, " Max outstanding commands = 0x%d\n",
3015 readl(&(tb->CmdsOutMax)));
3016 dev_info(dev, " Bus Types = 0x%x\n", readl(&(tb->BusTypes)));
3017 for (i = 0; i < 16; i++)
3018 temp_name[i] = readb(&(tb->ServerName[i]));
3019 temp_name[16] = '\0';
3020 dev_info(dev, " Server Name = %s\n", temp_name);
3021 dev_info(dev, " Heartbeat Counter = 0x%x\n\n\n",
3022 readl(&(tb->HeartBeat)));
3023}
3024#endif /* HPSA_DEBUG */
3025
3026static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
3027{
3028 int i, offset, mem_type, bar_type;
3029
3030 if (pci_bar_addr == PCI_BASE_ADDRESS_0) /* looking for BAR zero? */
3031 return 0;
3032 offset = 0;
3033 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
3034 bar_type = pci_resource_flags(pdev, i) & PCI_BASE_ADDRESS_SPACE;
3035 if (bar_type == PCI_BASE_ADDRESS_SPACE_IO)
3036 offset += 4;
3037 else {
3038 mem_type = pci_resource_flags(pdev, i) &
3039 PCI_BASE_ADDRESS_MEM_TYPE_MASK;
3040 switch (mem_type) {
3041 case PCI_BASE_ADDRESS_MEM_TYPE_32:
3042 case PCI_BASE_ADDRESS_MEM_TYPE_1M:
3043 offset += 4; /* 32 bit */
3044 break;
3045 case PCI_BASE_ADDRESS_MEM_TYPE_64:
3046 offset += 8;
3047 break;
3048 default: /* reserved in PCI 2.2 */
3049 dev_warn(&pdev->dev,
3050 "base address is invalid\n");
3051 return -1;
3052 break;
3053 }
3054 }
3055 if (offset == pci_bar_addr - PCI_BASE_ADDRESS_0)
3056 return i + 1;
3057 }
3058 return -1;
3059}
3060
3061/* If MSI/MSI-X is supported by the kernel we will try to enable it on
3062 * controllers that are capable. If not, we use IO-APIC mode.
3063 */
3064
3065static void __devinit hpsa_interrupt_mode(struct ctlr_info *h,
3066 struct pci_dev *pdev, __u32 board_id)
3067{
3068#ifdef CONFIG_PCI_MSI
3069 int err;
3070 struct msix_entry hpsa_msix_entries[4] = { {0, 0}, {0, 1},
3071 {0, 2}, {0, 3}
3072 };
3073
3074 /* Some boards advertise MSI but don't really support it */
3075 if ((board_id == 0x40700E11) ||
3076 (board_id == 0x40800E11) ||
3077 (board_id == 0x40820E11) || (board_id == 0x40830E11))
3078 goto default_int_mode;
3079 if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
3080 dev_info(&pdev->dev, "MSIX\n");
3081 err = pci_enable_msix(pdev, hpsa_msix_entries, 4);
3082 if (!err) {
3083 h->intr[0] = hpsa_msix_entries[0].vector;
3084 h->intr[1] = hpsa_msix_entries[1].vector;
3085 h->intr[2] = hpsa_msix_entries[2].vector;
3086 h->intr[3] = hpsa_msix_entries[3].vector;
3087 h->msix_vector = 1;
3088 return;
3089 }
3090 if (err > 0) {
3091 dev_warn(&pdev->dev, "only %d MSI-X vectors "
3092 "available\n", err);
3093 goto default_int_mode;
3094 } else {
3095 dev_warn(&pdev->dev, "MSI-X init failed %d\n",
3096 err);
3097 goto default_int_mode;
3098 }
3099 }
3100 if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) {
3101 dev_info(&pdev->dev, "MSI\n");
3102 if (!pci_enable_msi(pdev))
3103 h->msi_vector = 1;
3104 else
3105 dev_warn(&pdev->dev, "MSI init failed\n");
3106 }
3107default_int_mode:
3108#endif /* CONFIG_PCI_MSI */
3109 /* if we get here we're going to use the default interrupt mode */
3110 h->intr[SIMPLE_MODE_INT] = pdev->irq;
3111 return;
3112}
3113
3114static int hpsa_pci_init(struct ctlr_info *h, struct pci_dev *pdev)
3115{
3116 ushort subsystem_vendor_id, subsystem_device_id, command;
3117 __u32 board_id, scratchpad = 0;
3118 __u64 cfg_offset;
3119 __u32 cfg_base_addr;
3120 __u64 cfg_base_addr_index;
3121 int i, prod_index, err;
3122
3123 subsystem_vendor_id = pdev->subsystem_vendor;
3124 subsystem_device_id = pdev->subsystem_device;
3125 board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) |
3126 subsystem_vendor_id);
3127
3128 for (i = 0; i < ARRAY_SIZE(products); i++)
3129 if (board_id == products[i].board_id)
3130 break;
3131
3132 prod_index = i;
3133
3134 if (prod_index == ARRAY_SIZE(products)) {
3135 prod_index--;
3136 if (subsystem_vendor_id != PCI_VENDOR_ID_HP ||
3137 !hpsa_allow_any) {
3138 dev_warn(&pdev->dev, "unrecognized board ID:"
3139 " 0x%08lx, ignoring.\n",
3140 (unsigned long) board_id);
3141 return -ENODEV;
3142 }
3143 }
3144 /* check to see if controller has been disabled
3145 * BEFORE trying to enable it
3146 */
3147 (void)pci_read_config_word(pdev, PCI_COMMAND, &command);
3148 if (!(command & 0x02)) {
3149 dev_warn(&pdev->dev, "controller appears to be disabled\n");
3150 return -ENODEV;
3151 }
3152
3153 err = pci_enable_device(pdev);
3154 if (err) {
3155 dev_warn(&pdev->dev, "unable to enable PCI device\n");
3156 return err;
3157 }
3158
3159 err = pci_request_regions(pdev, "hpsa");
3160 if (err) {
3161 dev_err(&pdev->dev, "cannot obtain PCI resources, aborting\n");
3162 return err;
3163 }
3164
3165 /* If the kernel supports MSI/MSI-X we will try to enable that,
3166 * else we use the IO-APIC interrupt assigned to us by system ROM.
3167 */
3168 hpsa_interrupt_mode(h, pdev, board_id);
3169
3170 /* find the memory BAR */
3171 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
3172 if (pci_resource_flags(pdev, i) & IORESOURCE_MEM)
3173 break;
3174 }
3175 if (i == DEVICE_COUNT_RESOURCE) {
3176 dev_warn(&pdev->dev, "no memory BAR found\n");
3177 err = -ENODEV;
3178 goto err_out_free_res;
3179 }
3180
3181 h->paddr = pci_resource_start(pdev, i); /* addressing mode bits
3182 * already removed
3183 */
3184
3185 h->vaddr = remap_pci_mem(h->paddr, 0x250);
3186
3187 /* Wait for the board to become ready. */
3188 for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) {
3189 scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
3190 if (scratchpad == HPSA_FIRMWARE_READY)
3191 break;
3192 msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS);
3193 }
3194 if (scratchpad != HPSA_FIRMWARE_READY) {
3195 dev_warn(&pdev->dev, "board not ready, timed out.\n");
3196 err = -ENODEV;
3197 goto err_out_free_res;
3198 }
3199
3200 /* get the address index number */
3201 cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET);
3202 cfg_base_addr &= (__u32) 0x0000ffff;
3203 cfg_base_addr_index = find_PCI_BAR_index(pdev, cfg_base_addr);
3204 if (cfg_base_addr_index == -1) {
3205 dev_warn(&pdev->dev, "cannot find cfg_base_addr_index\n");
3206 err = -ENODEV;
3207 goto err_out_free_res;
3208 }
3209
3210 cfg_offset = readl(h->vaddr + SA5_CTMEM_OFFSET);
3211 h->cfgtable = remap_pci_mem(pci_resource_start(pdev,
3212 cfg_base_addr_index) + cfg_offset,
3213 sizeof(h->cfgtable));
3214 h->board_id = board_id;
3215
3216 /* Query controller for max supported commands: */
3217 h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
3218
3219 h->product_name = products[prod_index].product_name;
3220 h->access = *(products[prod_index].access);
3221 /* Allow room for some ioctls */
3222 h->nr_cmds = h->max_commands - 4;
3223
3224 if ((readb(&h->cfgtable->Signature[0]) != 'C') ||
3225 (readb(&h->cfgtable->Signature[1]) != 'I') ||
3226 (readb(&h->cfgtable->Signature[2]) != 'S') ||
3227 (readb(&h->cfgtable->Signature[3]) != 'S')) {
3228 dev_warn(&pdev->dev, "not a valid CISS config table\n");
3229 err = -ENODEV;
3230 goto err_out_free_res;
3231 }
3232#ifdef CONFIG_X86
3233 {
3234 /* Need to enable prefetch in the SCSI core for 6400 in x86 */
3235 __u32 prefetch;
3236 prefetch = readl(&(h->cfgtable->SCSI_Prefetch));
3237 prefetch |= 0x100;
3238 writel(prefetch, &(h->cfgtable->SCSI_Prefetch));
3239 }
3240#endif
3241
3242 /* Disabling DMA prefetch for the P600
3243 * An ASIC bug may result in a prefetch beyond
3244 * physical memory.
3245 */
3246 if (board_id == 0x3225103C) {
3247 __u32 dma_prefetch;
3248 dma_prefetch = readl(h->vaddr + I2O_DMA1_CFG);
3249 dma_prefetch |= 0x8000;
3250 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG);
3251 }
3252
3253 h->max_commands = readl(&(h->cfgtable->CmdsOutMax));
3254 /* Update the field, and then ring the doorbell */
3255 writel(CFGTBL_Trans_Simple, &(h->cfgtable->HostWrite.TransportRequest));
3256 writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
3257
3258 /* under certain very rare conditions, this can take awhile.
3259 * (e.g.: hot replace a failed 144GB drive in a RAID 5 set right
3260 * as we enter this code.)
3261 */
3262 for (i = 0; i < MAX_CONFIG_WAIT; i++) {
3263 if (!(readl(h->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
3264 break;
3265 /* delay and try again */
3266 msleep(10);
3267 }
3268
3269#ifdef HPSA_DEBUG
3270 print_cfg_table(&pdev->dev, h->cfgtable);
3271#endif /* HPSA_DEBUG */
3272
3273 if (!(readl(&(h->cfgtable->TransportActive)) & CFGTBL_Trans_Simple)) {
3274 dev_warn(&pdev->dev, "unable to get board into simple mode\n");
3275 err = -ENODEV;
3276 goto err_out_free_res;
3277 }
3278 return 0;
3279
3280err_out_free_res:
3281 /*
3282 * Deliberately omit pci_disable_device(): it does something nasty to
3283 * Smart Array controllers that pci_enable_device does not undo
3284 */
3285 pci_release_regions(pdev);
3286 return err;
3287}
3288
3289static int __devinit hpsa_init_one(struct pci_dev *pdev,
3290 const struct pci_device_id *ent)
3291{
3292 int i;
3293 int dac;
3294 struct ctlr_info *h;
3295
3296 if (number_of_controllers == 0)
3297 printk(KERN_INFO DRIVER_NAME "\n");
3298 if (reset_devices) {
3299 /* Reset the controller with a PCI power-cycle */
3300 if (hpsa_hard_reset_controller(pdev) || hpsa_reset_msi(pdev))
3301 return -ENODEV;
3302
3303 /* Some devices (notably the HP Smart Array 5i Controller)
3304 need a little pause here */
3305 msleep(HPSA_POST_RESET_PAUSE_MSECS);
3306
3307 /* Now try to get the controller to respond to a no-op */
3308 for (i = 0; i < HPSA_POST_RESET_NOOP_RETRIES; i++) {
3309 if (hpsa_noop(pdev) == 0)
3310 break;
3311 else
3312 dev_warn(&pdev->dev, "no-op failed%s\n",
3313 (i < 11 ? "; re-trying" : ""));
3314 }
3315 }
3316
3317 BUILD_BUG_ON(sizeof(struct CommandList) % 8);
3318 h = kzalloc(sizeof(*h), GFP_KERNEL);
3319 if (!h)
3320 return -1;
3321
3322 h->busy_initializing = 1;
3323 INIT_HLIST_HEAD(&h->cmpQ);
3324 INIT_HLIST_HEAD(&h->reqQ);
3325 mutex_init(&h->busy_shutting_down);
3326 init_completion(&h->scan_wait);
3327 if (hpsa_pci_init(h, pdev) != 0)
3328 goto clean1;
3329
3330 sprintf(h->devname, "hpsa%d", number_of_controllers);
3331 h->ctlr = number_of_controllers;
3332 number_of_controllers++;
3333 h->pdev = pdev;
3334
3335 /* configure PCI DMA stuff */
3336 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
3337 dac = 1;
3338 else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
3339 dac = 0;
3340 else {
3341 dev_err(&pdev->dev, "no suitable DMA available\n");
3342 goto clean1;
3343 }
3344
3345 /* make sure the board interrupts are off */
3346 h->access.set_intr_mask(h, HPSA_INTR_OFF);
3347 if (request_irq(h->intr[SIMPLE_MODE_INT], do_hpsa_intr,
3348 IRQF_DISABLED | IRQF_SHARED, h->devname, h)) {
3349 dev_err(&pdev->dev, "unable to get irq %d for %s\n",
3350 h->intr[SIMPLE_MODE_INT], h->devname);
3351 goto clean2;
3352 }
3353
3354 dev_info(&pdev->dev, "%s: <0x%x> at PCI %s IRQ %d%s using DAC\n",
3355 h->devname, pdev->device, pci_name(pdev),
3356 h->intr[SIMPLE_MODE_INT], dac ? "" : " not");
3357
3358 h->cmd_pool_bits =
3359 kmalloc(((h->nr_cmds + BITS_PER_LONG -
3360 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL);
3361 h->cmd_pool = pci_alloc_consistent(h->pdev,
3362 h->nr_cmds * sizeof(*h->cmd_pool),
3363 &(h->cmd_pool_dhandle));
3364 h->errinfo_pool = pci_alloc_consistent(h->pdev,
3365 h->nr_cmds * sizeof(*h->errinfo_pool),
3366 &(h->errinfo_pool_dhandle));
3367 if ((h->cmd_pool_bits == NULL)
3368 || (h->cmd_pool == NULL)
3369 || (h->errinfo_pool == NULL)) {
3370 dev_err(&pdev->dev, "out of memory");
3371 goto clean4;
3372 }
3373 spin_lock_init(&h->lock);
3374
3375 pci_set_drvdata(pdev, h);
3376 memset(h->cmd_pool_bits, 0,
3377 ((h->nr_cmds + BITS_PER_LONG -
3378 1) / BITS_PER_LONG) * sizeof(unsigned long));
3379
3380 hpsa_scsi_setup(h);
3381
3382 /* Turn the interrupts on so we can service requests */
3383 h->access.set_intr_mask(h, HPSA_INTR_ON);
3384
3385 hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */
3386 h->busy_initializing = 0;
3387 return 1;
3388
3389clean4:
3390 kfree(h->cmd_pool_bits);
3391 if (h->cmd_pool)
3392 pci_free_consistent(h->pdev,
3393 h->nr_cmds * sizeof(struct CommandList),
3394 h->cmd_pool, h->cmd_pool_dhandle);
3395 if (h->errinfo_pool)
3396 pci_free_consistent(h->pdev,
3397 h->nr_cmds * sizeof(struct ErrorInfo),
3398 h->errinfo_pool,
3399 h->errinfo_pool_dhandle);
3400 free_irq(h->intr[SIMPLE_MODE_INT], h);
3401clean2:
3402clean1:
3403 h->busy_initializing = 0;
3404 kfree(h);
3405 return -1;
3406}
3407
3408static void hpsa_flush_cache(struct ctlr_info *h)
3409{
3410 char *flush_buf;
3411 struct CommandList *c;
3412
3413 flush_buf = kzalloc(4, GFP_KERNEL);
3414 if (!flush_buf)
3415 return;
3416
3417 c = cmd_special_alloc(h);
3418 if (!c) {
3419 dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
3420 goto out_of_memory;
3421 }
3422 fill_cmd(c, HPSA_CACHE_FLUSH, h, flush_buf, 4, 0,
3423 RAID_CTLR_LUNID, TYPE_CMD);
3424 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_TODEVICE);
3425 if (c->err_info->CommandStatus != 0)
3426 dev_warn(&h->pdev->dev,
3427 "error flushing cache on controller\n");
3428 cmd_special_free(h, c);
3429out_of_memory:
3430 kfree(flush_buf);
3431}
3432
3433static void hpsa_shutdown(struct pci_dev *pdev)
3434{
3435 struct ctlr_info *h;
3436
3437 h = pci_get_drvdata(pdev);
3438 /* Turn board interrupts off and send the flush cache command
3439 * sendcmd will turn off interrupt, and send the flush...
3440 * To write all data in the battery backed cache to disks
3441 */
3442 hpsa_flush_cache(h);
3443 h->access.set_intr_mask(h, HPSA_INTR_OFF);
3444 free_irq(h->intr[2], h);
3445#ifdef CONFIG_PCI_MSI
3446 if (h->msix_vector)
3447 pci_disable_msix(h->pdev);
3448 else if (h->msi_vector)
3449 pci_disable_msi(h->pdev);
3450#endif /* CONFIG_PCI_MSI */
3451}
3452
3453static void __devexit hpsa_remove_one(struct pci_dev *pdev)
3454{
3455 struct ctlr_info *h;
3456
3457 if (pci_get_drvdata(pdev) == NULL) {
3458 dev_err(&pdev->dev, "unable to remove device \n");
3459 return;
3460 }
3461 h = pci_get_drvdata(pdev);
3462 mutex_lock(&h->busy_shutting_down);
3463 remove_from_scan_list(h);
3464 hpsa_unregister_scsi(h); /* unhook from SCSI subsystem */
3465 hpsa_shutdown(pdev);
3466 iounmap(h->vaddr);
3467 pci_free_consistent(h->pdev,
3468 h->nr_cmds * sizeof(struct CommandList),
3469 h->cmd_pool, h->cmd_pool_dhandle);
3470 pci_free_consistent(h->pdev,
3471 h->nr_cmds * sizeof(struct ErrorInfo),
3472 h->errinfo_pool, h->errinfo_pool_dhandle);
3473 kfree(h->cmd_pool_bits);
3474 /*
3475 * Deliberately omit pci_disable_device(): it does something nasty to
3476 * Smart Array controllers that pci_enable_device does not undo
3477 */
3478 pci_release_regions(pdev);
3479 pci_set_drvdata(pdev, NULL);
3480 mutex_unlock(&h->busy_shutting_down);
3481 kfree(h);
3482}
3483
3484static int hpsa_suspend(__attribute__((unused)) struct pci_dev *pdev,
3485 __attribute__((unused)) pm_message_t state)
3486{
3487 return -ENOSYS;
3488}
3489
3490static int hpsa_resume(__attribute__((unused)) struct pci_dev *pdev)
3491{
3492 return -ENOSYS;
3493}
3494
3495static struct pci_driver hpsa_pci_driver = {
3496 .name = "hpsa",
3497 .probe = hpsa_init_one,
3498 .remove = __devexit_p(hpsa_remove_one),
3499 .id_table = hpsa_pci_device_id, /* id_table */
3500 .shutdown = hpsa_shutdown,
3501 .suspend = hpsa_suspend,
3502 .resume = hpsa_resume,
3503};
3504
3505/*
3506 * This is it. Register the PCI driver information for the cards we control
3507 * the OS will call our registered routines when it finds one of our cards.
3508 */
3509static int __init hpsa_init(void)
3510{
3511 int err;
3512 /* Start the scan thread */
3513 hpsa_scan_thread = kthread_run(hpsa_scan_func, NULL, "hpsa_scan");
3514 if (IS_ERR(hpsa_scan_thread)) {
3515 err = PTR_ERR(hpsa_scan_thread);
3516 return -ENODEV;
3517 }
3518 err = pci_register_driver(&hpsa_pci_driver);
3519 if (err)
3520 kthread_stop(hpsa_scan_thread);
3521 return err;
3522}
3523
3524static void __exit hpsa_cleanup(void)
3525{
3526 pci_unregister_driver(&hpsa_pci_driver);
3527 kthread_stop(hpsa_scan_thread);
3528}
3529
3530module_init(hpsa_init);
3531module_exit(hpsa_cleanup);
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
new file mode 100644
index 000000000000..6bd1949144b5
--- /dev/null
+++ b/drivers/scsi/hpsa.h
@@ -0,0 +1,273 @@
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2000, 2009 Hewlett-Packard Development Company, L.P.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
19 *
20 */
21#ifndef HPSA_H
22#define HPSA_H
23
24#include <scsi/scsicam.h>
25
26#define IO_OK 0
27#define IO_ERROR 1
28
29struct ctlr_info;
30
31struct access_method {
32 void (*submit_command)(struct ctlr_info *h,
33 struct CommandList *c);
34 void (*set_intr_mask)(struct ctlr_info *h, unsigned long val);
35 unsigned long (*fifo_full)(struct ctlr_info *h);
36 unsigned long (*intr_pending)(struct ctlr_info *h);
37 unsigned long (*command_completed)(struct ctlr_info *h);
38};
39
40struct hpsa_scsi_dev_t {
41 int devtype;
42 int bus, target, lun; /* as presented to the OS */
43 unsigned char scsi3addr[8]; /* as presented to the HW */
44#define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
45 unsigned char device_id[16]; /* from inquiry pg. 0x83 */
46 unsigned char vendor[8]; /* bytes 8-15 of inquiry data */
47 unsigned char model[16]; /* bytes 16-31 of inquiry data */
48 unsigned char revision[4]; /* bytes 32-35 of inquiry data */
49 unsigned char raid_level; /* from inquiry page 0xC1 */
50};
51
52struct ctlr_info {
53 int ctlr;
54 char devname[8];
55 char *product_name;
56 char firm_ver[4]; /* Firmware version */
57 struct pci_dev *pdev;
58 __u32 board_id;
59 void __iomem *vaddr;
60 unsigned long paddr;
61 int nr_cmds; /* Number of commands allowed on this controller */
62 struct CfgTable __iomem *cfgtable;
63 int interrupts_enabled;
64 int major;
65 int max_commands;
66 int commands_outstanding;
67 int max_outstanding; /* Debug */
68 int usage_count; /* number of opens all all minor devices */
69# define DOORBELL_INT 0
70# define PERF_MODE_INT 1
71# define SIMPLE_MODE_INT 2
72# define MEMQ_MODE_INT 3
73 unsigned int intr[4];
74 unsigned int msix_vector;
75 unsigned int msi_vector;
76 struct access_method access;
77
78 /* queue and queue Info */
79 struct hlist_head reqQ;
80 struct hlist_head cmpQ;
81 unsigned int Qdepth;
82 unsigned int maxQsinceinit;
83 unsigned int maxSG;
84 spinlock_t lock;
85
86 /* pointers to command and error info pool */
87 struct CommandList *cmd_pool;
88 dma_addr_t cmd_pool_dhandle;
89 struct ErrorInfo *errinfo_pool;
90 dma_addr_t errinfo_pool_dhandle;
91 unsigned long *cmd_pool_bits;
92 int nr_allocs;
93 int nr_frees;
94 int busy_initializing;
95 int busy_scanning;
96 struct mutex busy_shutting_down;
97 struct list_head scan_list;
98 struct completion scan_wait;
99
100 struct Scsi_Host *scsi_host;
101 spinlock_t devlock; /* to protect hba[ctlr]->dev[]; */
102 int ndevices; /* number of used elements in .dev[] array. */
103#define HPSA_MAX_SCSI_DEVS_PER_HBA 256
104 struct hpsa_scsi_dev_t *dev[HPSA_MAX_SCSI_DEVS_PER_HBA];
105};
106#define HPSA_ABORT_MSG 0
107#define HPSA_DEVICE_RESET_MSG 1
108#define HPSA_BUS_RESET_MSG 2
109#define HPSA_HOST_RESET_MSG 3
110#define HPSA_MSG_SEND_RETRY_LIMIT 10
111#define HPSA_MSG_SEND_RETRY_INTERVAL_MSECS 1000
112
113/* Maximum time in seconds driver will wait for command completions
114 * when polling before giving up.
115 */
116#define HPSA_MAX_POLL_TIME_SECS (20)
117
118/* During SCSI error recovery, HPSA_TUR_RETRY_LIMIT defines
119 * how many times to retry TEST UNIT READY on a device
120 * while waiting for it to become ready before giving up.
121 * HPSA_MAX_WAIT_INTERVAL_SECS is the max wait interval
122 * between sending TURs while waiting for a device
123 * to become ready.
124 */
125#define HPSA_TUR_RETRY_LIMIT (20)
126#define HPSA_MAX_WAIT_INTERVAL_SECS (30)
127
128/* HPSA_BOARD_READY_WAIT_SECS is how long to wait for a board
129 * to become ready, in seconds, before giving up on it.
130 * HPSA_BOARD_READY_POLL_INTERVAL_MSECS * is how long to wait
131 * between polling the board to see if it is ready, in
132 * milliseconds. HPSA_BOARD_READY_POLL_INTERVAL and
133 * HPSA_BOARD_READY_ITERATIONS are derived from those.
134 */
135#define HPSA_BOARD_READY_WAIT_SECS (120)
136#define HPSA_BOARD_READY_POLL_INTERVAL_MSECS (100)
137#define HPSA_BOARD_READY_POLL_INTERVAL \
138 ((HPSA_BOARD_READY_POLL_INTERVAL_MSECS * HZ) / 1000)
139#define HPSA_BOARD_READY_ITERATIONS \
140 ((HPSA_BOARD_READY_WAIT_SECS * 1000) / \
141 HPSA_BOARD_READY_POLL_INTERVAL_MSECS)
142#define HPSA_POST_RESET_PAUSE_MSECS (3000)
143#define HPSA_POST_RESET_NOOP_RETRIES (12)
144
145/* Defining the diffent access_menthods */
146/*
147 * Memory mapped FIFO interface (SMART 53xx cards)
148 */
149#define SA5_DOORBELL 0x20
150#define SA5_REQUEST_PORT_OFFSET 0x40
151#define SA5_REPLY_INTR_MASK_OFFSET 0x34
152#define SA5_REPLY_PORT_OFFSET 0x44
153#define SA5_INTR_STATUS 0x30
154#define SA5_SCRATCHPAD_OFFSET 0xB0
155
156#define SA5_CTCFG_OFFSET 0xB4
157#define SA5_CTMEM_OFFSET 0xB8
158
159#define SA5_INTR_OFF 0x08
160#define SA5B_INTR_OFF 0x04
161#define SA5_INTR_PENDING 0x08
162#define SA5B_INTR_PENDING 0x04
163#define FIFO_EMPTY 0xffffffff
164#define HPSA_FIRMWARE_READY 0xffff0000 /* value in scratchpad register */
165
166#define HPSA_ERROR_BIT 0x02
167#define HPSA_TAG_CONTAINS_INDEX(tag) ((tag) & 0x04)
168#define HPSA_TAG_TO_INDEX(tag) ((tag) >> 3)
169#define HPSA_TAG_DISCARD_ERROR_BITS(tag) ((tag) & ~3)
170
171#define HPSA_INTR_ON 1
172#define HPSA_INTR_OFF 0
173/*
174 Send the command to the hardware
175*/
176static void SA5_submit_command(struct ctlr_info *h,
177 struct CommandList *c)
178{
179#ifdef HPSA_DEBUG
180 printk(KERN_WARNING "hpsa: Sending %x - down to controller\n",
181 c->busaddr);
182#endif /* HPSA_DEBUG */
183 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
184 h->commands_outstanding++;
185 if (h->commands_outstanding > h->max_outstanding)
186 h->max_outstanding = h->commands_outstanding;
187}
188
189/*
190 * This card is the opposite of the other cards.
191 * 0 turns interrupts on...
192 * 0x08 turns them off...
193 */
194static void SA5_intr_mask(struct ctlr_info *h, unsigned long val)
195{
196 if (val) { /* Turn interrupts on */
197 h->interrupts_enabled = 1;
198 writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
199 } else { /* Turn them off */
200 h->interrupts_enabled = 0;
201 writel(SA5_INTR_OFF,
202 h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
203 }
204}
205/*
206 * Returns true if fifo is full.
207 *
208 */
209static unsigned long SA5_fifo_full(struct ctlr_info *h)
210{
211 if (h->commands_outstanding >= h->max_commands)
212 return 1;
213 else
214 return 0;
215
216}
217/*
218 * returns value read from hardware.
219 * returns FIFO_EMPTY if there is nothing to read
220 */
221static unsigned long SA5_completed(struct ctlr_info *h)
222{
223 unsigned long register_value
224 = readl(h->vaddr + SA5_REPLY_PORT_OFFSET);
225
226 if (register_value != FIFO_EMPTY)
227 h->commands_outstanding--;
228
229#ifdef HPSA_DEBUG
230 if (register_value != FIFO_EMPTY)
231 printk(KERN_INFO "hpsa: Read %lx back from board\n",
232 register_value);
233 else
234 printk(KERN_INFO "hpsa: FIFO Empty read\n");
235#endif
236
237 return register_value;
238}
239/*
240 * Returns true if an interrupt is pending..
241 */
242static unsigned long SA5_intr_pending(struct ctlr_info *h)
243{
244 unsigned long register_value =
245 readl(h->vaddr + SA5_INTR_STATUS);
246#ifdef HPSA_DEBUG
247 printk(KERN_INFO "hpsa: intr_pending %lx\n", register_value);
248#endif /* HPSA_DEBUG */
249 if (register_value & SA5_INTR_PENDING)
250 return 1;
251 return 0 ;
252}
253
254
255static struct access_method SA5_access = {
256 SA5_submit_command,
257 SA5_intr_mask,
258 SA5_fifo_full,
259 SA5_intr_pending,
260 SA5_completed,
261};
262
263struct board_type {
264 __u32 board_id;
265 char *product_name;
266 struct access_method *access;
267};
268
269
270/* end of old hpsa_scsi.h file */
271
272#endif /* HPSA_H */
273
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
new file mode 100644
index 000000000000..12d71387ed9a
--- /dev/null
+++ b/drivers/scsi/hpsa_cmd.h
@@ -0,0 +1,326 @@
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2000, 2009 Hewlett-Packard Development Company, L.P.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 * NON INFRINGEMENT. See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
19 *
20 */
21#ifndef HPSA_CMD_H
22#define HPSA_CMD_H
23
24/* general boundary defintions */
25#define SENSEINFOBYTES 32 /* may vary between hbas */
26#define MAXSGENTRIES 31
27#define MAXREPLYQS 256
28
29/* Command Status value */
30#define CMD_SUCCESS 0x0000
31#define CMD_TARGET_STATUS 0x0001
32#define CMD_DATA_UNDERRUN 0x0002
33#define CMD_DATA_OVERRUN 0x0003
34#define CMD_INVALID 0x0004
35#define CMD_PROTOCOL_ERR 0x0005
36#define CMD_HARDWARE_ERR 0x0006
37#define CMD_CONNECTION_LOST 0x0007
38#define CMD_ABORTED 0x0008
39#define CMD_ABORT_FAILED 0x0009
40#define CMD_UNSOLICITED_ABORT 0x000A
41#define CMD_TIMEOUT 0x000B
42#define CMD_UNABORTABLE 0x000C
43
44/* Unit Attentions ASC's as defined for the MSA2012sa */
45#define POWER_OR_RESET 0x29
46#define STATE_CHANGED 0x2a
47#define UNIT_ATTENTION_CLEARED 0x2f
48#define LUN_FAILED 0x3e
49#define REPORT_LUNS_CHANGED 0x3f
50
51/* Unit Attentions ASCQ's as defined for the MSA2012sa */
52
53 /* These ASCQ's defined for ASC = POWER_OR_RESET */
54#define POWER_ON_RESET 0x00
55#define POWER_ON_REBOOT 0x01
56#define SCSI_BUS_RESET 0x02
57#define MSA_TARGET_RESET 0x03
58#define CONTROLLER_FAILOVER 0x04
59#define TRANSCEIVER_SE 0x05
60#define TRANSCEIVER_LVD 0x06
61
62 /* These ASCQ's defined for ASC = STATE_CHANGED */
63#define RESERVATION_PREEMPTED 0x03
64#define ASYM_ACCESS_CHANGED 0x06
65#define LUN_CAPACITY_CHANGED 0x09
66
67/* transfer direction */
68#define XFER_NONE 0x00
69#define XFER_WRITE 0x01
70#define XFER_READ 0x02
71#define XFER_RSVD 0x03
72
73/* task attribute */
74#define ATTR_UNTAGGED 0x00
75#define ATTR_SIMPLE 0x04
76#define ATTR_HEADOFQUEUE 0x05
77#define ATTR_ORDERED 0x06
78#define ATTR_ACA 0x07
79
80/* cdb type */
81#define TYPE_CMD 0x00
82#define TYPE_MSG 0x01
83
84/* config space register offsets */
85#define CFG_VENDORID 0x00
86#define CFG_DEVICEID 0x02
87#define CFG_I2OBAR 0x10
88#define CFG_MEM1BAR 0x14
89
90/* i2o space register offsets */
91#define I2O_IBDB_SET 0x20
92#define I2O_IBDB_CLEAR 0x70
93#define I2O_INT_STATUS 0x30
94#define I2O_INT_MASK 0x34
95#define I2O_IBPOST_Q 0x40
96#define I2O_OBPOST_Q 0x44
97#define I2O_DMA1_CFG 0x214
98
99/* Configuration Table */
100#define CFGTBL_ChangeReq 0x00000001l
101#define CFGTBL_AccCmds 0x00000001l
102
103#define CFGTBL_Trans_Simple 0x00000002l
104
105#define CFGTBL_BusType_Ultra2 0x00000001l
106#define CFGTBL_BusType_Ultra3 0x00000002l
107#define CFGTBL_BusType_Fibre1G 0x00000100l
108#define CFGTBL_BusType_Fibre2G 0x00000200l
109struct vals32 {
110 __u32 lower;
111 __u32 upper;
112};
113
114union u64bit {
115 struct vals32 val32;
116 __u64 val;
117};
118
119/* FIXME this is a per controller value (barf!) */
120#define HPSA_MAX_TARGETS_PER_CTLR 16
121#define HPSA_MAX_LUN 256
122#define HPSA_MAX_PHYS_LUN 1024
123
124/* SCSI-3 Commands */
125#pragma pack(1)
126
127#define HPSA_INQUIRY 0x12
128struct InquiryData {
129 __u8 data_byte[36];
130};
131
132#define HPSA_REPORT_LOG 0xc2 /* Report Logical LUNs */
133#define HPSA_REPORT_PHYS 0xc3 /* Report Physical LUNs */
134struct ReportLUNdata {
135 __u8 LUNListLength[4];
136 __u32 reserved;
137 __u8 LUN[HPSA_MAX_LUN][8];
138};
139
140struct ReportExtendedLUNdata {
141 __u8 LUNListLength[4];
142 __u8 extended_response_flag;
143 __u8 reserved[3];
144 __u8 LUN[HPSA_MAX_LUN][24];
145};
146
147struct SenseSubsystem_info {
148 __u8 reserved[36];
149 __u8 portname[8];
150 __u8 reserved1[1108];
151};
152
153#define HPSA_READ_CAPACITY 0x25 /* Read Capacity */
154struct ReadCapdata {
155 __u8 total_size[4]; /* Total size in blocks */
156 __u8 block_size[4]; /* Size of blocks in bytes */
157};
158
159#if 0
160/* 12 byte commands not implemented in firmware yet. */
161#define HPSA_READ 0xa8
162#define HPSA_WRITE 0xaa
163#endif
164
165#define HPSA_READ 0x28 /* Read(10) */
166#define HPSA_WRITE 0x2a /* Write(10) */
167
168/* BMIC commands */
169#define BMIC_READ 0x26
170#define BMIC_WRITE 0x27
171#define BMIC_CACHE_FLUSH 0xc2
172#define HPSA_CACHE_FLUSH 0x01 /* C2 was already being used by HPSA */
173
174/* Command List Structure */
175union SCSI3Addr {
176 struct {
177 __u8 Dev;
178 __u8 Bus:6;
179 __u8 Mode:2; /* b00 */
180 } PeripDev;
181 struct {
182 __u8 DevLSB;
183 __u8 DevMSB:6;
184 __u8 Mode:2; /* b01 */
185 } LogDev;
186 struct {
187 __u8 Dev:5;
188 __u8 Bus:3;
189 __u8 Targ:6;
190 __u8 Mode:2; /* b10 */
191 } LogUnit;
192};
193
194struct PhysDevAddr {
195 __u32 TargetId:24;
196 __u32 Bus:6;
197 __u32 Mode:2;
198 /* 2 level target device addr */
199 union SCSI3Addr Target[2];
200};
201
202struct LogDevAddr {
203 __u32 VolId:30;
204 __u32 Mode:2;
205 __u8 reserved[4];
206};
207
208union LUNAddr {
209 __u8 LunAddrBytes[8];
210 union SCSI3Addr SCSI3Lun[4];
211 struct PhysDevAddr PhysDev;
212 struct LogDevAddr LogDev;
213};
214
215struct CommandListHeader {
216 __u8 ReplyQueue;
217 __u8 SGList;
218 __u16 SGTotal;
219 struct vals32 Tag;
220 union LUNAddr LUN;
221};
222
223struct RequestBlock {
224 __u8 CDBLen;
225 struct {
226 __u8 Type:3;
227 __u8 Attribute:3;
228 __u8 Direction:2;
229 } Type;
230 __u16 Timeout;
231 __u8 CDB[16];
232};
233
234struct ErrDescriptor {
235 struct vals32 Addr;
236 __u32 Len;
237};
238
239struct SGDescriptor {
240 struct vals32 Addr;
241 __u32 Len;
242 __u32 Ext;
243};
244
245union MoreErrInfo {
246 struct {
247 __u8 Reserved[3];
248 __u8 Type;
249 __u32 ErrorInfo;
250 } Common_Info;
251 struct {
252 __u8 Reserved[2];
253 __u8 offense_size; /* size of offending entry */
254 __u8 offense_num; /* byte # of offense 0-base */
255 __u32 offense_value;
256 } Invalid_Cmd;
257};
258struct ErrorInfo {
259 __u8 ScsiStatus;
260 __u8 SenseLen;
261 __u16 CommandStatus;
262 __u32 ResidualCnt;
263 union MoreErrInfo MoreErrInfo;
264 __u8 SenseInfo[SENSEINFOBYTES];
265};
266/* Command types */
267#define CMD_IOCTL_PEND 0x01
268#define CMD_SCSI 0x03
269
270struct ctlr_info; /* defined in hpsa.h */
271/* The size of this structure needs to be divisible by 8
272 * od on all architectures, because the controller uses 2
273 * lower bits of the address, and the driver uses 1 lower
274 * bit (3 bits total.)
275 */
276struct CommandList {
277 struct CommandListHeader Header;
278 struct RequestBlock Request;
279 struct ErrDescriptor ErrDesc;
280 struct SGDescriptor SG[MAXSGENTRIES];
281 /* information associated with the command */
282 __u32 busaddr; /* physical addr of this record */
283 struct ErrorInfo *err_info; /* pointer to the allocated mem */
284 struct ctlr_info *h;
285 int cmd_type;
286 long cmdindex;
287 struct hlist_node list;
288 struct CommandList *prev;
289 struct CommandList *next;
290 struct request *rq;
291 struct completion *waiting;
292 int retry_count;
293 void *scsi_cmd;
294};
295
296/* Configuration Table Structure */
297struct HostWrite {
298 __u32 TransportRequest;
299 __u32 Reserved;
300 __u32 CoalIntDelay;
301 __u32 CoalIntCount;
302};
303
304struct CfgTable {
305 __u8 Signature[4];
306 __u32 SpecValence;
307 __u32 TransportSupport;
308 __u32 TransportActive;
309 struct HostWrite HostWrite;
310 __u32 CmdsOutMax;
311 __u32 BusTypes;
312 __u32 Reserved;
313 __u8 ServerName[16];
314 __u32 HeartBeat;
315 __u32 SCSI_Prefetch;
316};
317
318struct hpsa_pci_info {
319 unsigned char bus;
320 unsigned char dev_fn;
321 unsigned short domain;
322 __u32 board_id;
323};
324
325#pragma pack()
326#endif /* HPSA_CMD_H */
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 8643f5089361..9e52d16c7c39 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6521,6 +6521,7 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
6521 int rc; 6521 int rc;
6522 6522
6523 ENTER; 6523 ENTER;
6524 ioa_cfg->pdev->state_saved = true;
6524 rc = pci_restore_state(ioa_cfg->pdev); 6525 rc = pci_restore_state(ioa_cfg->pdev);
6525 6526
6526 if (rc != PCIBIOS_SUCCESSFUL) { 6527 if (rc != PCIBIOS_SUCCESSFUL) {
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index c4b58d042f6f..881d5dfe8c74 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -68,18 +68,20 @@ struct kmem_cache *scsi_pkt_cachep;
68 68
69/** 69/**
70 * struct fc_fcp_internal - FCP layer internal data 70 * struct fc_fcp_internal - FCP layer internal data
71 * @scsi_pkt_pool: Memory pool to draw FCP packets from 71 * @scsi_pkt_pool: Memory pool to draw FCP packets from
72 * @scsi_queue_lock: Protects the scsi_pkt_queue
72 * @scsi_pkt_queue: Current FCP packets 73 * @scsi_pkt_queue: Current FCP packets
73 * @last_can_queue_ramp_down_time: ramp down time 74 * @last_can_queue_ramp_down_time: ramp down time
74 * @last_can_queue_ramp_up_time: ramp up time 75 * @last_can_queue_ramp_up_time: ramp up time
75 * @max_can_queue: max can_queue size 76 * @max_can_queue: max can_queue size
76 */ 77 */
77struct fc_fcp_internal { 78struct fc_fcp_internal {
78 mempool_t *scsi_pkt_pool; 79 mempool_t *scsi_pkt_pool;
79 struct list_head scsi_pkt_queue; 80 spinlock_t scsi_queue_lock;
80 unsigned long last_can_queue_ramp_down_time; 81 struct list_head scsi_pkt_queue;
81 unsigned long last_can_queue_ramp_up_time; 82 unsigned long last_can_queue_ramp_down_time;
82 int max_can_queue; 83 unsigned long last_can_queue_ramp_up_time;
84 int max_can_queue;
83}; 85};
84 86
85#define fc_get_scsi_internal(x) ((struct fc_fcp_internal *)(x)->scsi_priv) 87#define fc_get_scsi_internal(x) ((struct fc_fcp_internal *)(x)->scsi_priv)
@@ -410,12 +412,14 @@ static inline struct fc_frame *fc_fcp_frame_alloc(struct fc_lport *lport,
410 unsigned long flags; 412 unsigned long flags;
411 413
412 fp = fc_frame_alloc(lport, len); 414 fp = fc_frame_alloc(lport, len);
413 if (!fp) { 415 if (likely(fp))
414 spin_lock_irqsave(lport->host->host_lock, flags); 416 return fp;
415 fc_fcp_can_queue_ramp_down(lport); 417
416 spin_unlock_irqrestore(lport->host->host_lock, flags); 418 /* error case */
417 } 419 spin_lock_irqsave(lport->host->host_lock, flags);
418 return fp; 420 fc_fcp_can_queue_ramp_down(lport);
421 spin_unlock_irqrestore(lport->host->host_lock, flags);
422 return NULL;
419} 423}
420 424
421/** 425/**
@@ -990,7 +994,7 @@ static void fc_fcp_cleanup_each_cmd(struct fc_lport *lport, unsigned int id,
990 struct scsi_cmnd *sc_cmd; 994 struct scsi_cmnd *sc_cmd;
991 unsigned long flags; 995 unsigned long flags;
992 996
993 spin_lock_irqsave(lport->host->host_lock, flags); 997 spin_lock_irqsave(&si->scsi_queue_lock, flags);
994restart: 998restart:
995 list_for_each_entry(fsp, &si->scsi_pkt_queue, list) { 999 list_for_each_entry(fsp, &si->scsi_pkt_queue, list) {
996 sc_cmd = fsp->cmd; 1000 sc_cmd = fsp->cmd;
@@ -1001,7 +1005,7 @@ restart:
1001 continue; 1005 continue;
1002 1006
1003 fc_fcp_pkt_hold(fsp); 1007 fc_fcp_pkt_hold(fsp);
1004 spin_unlock_irqrestore(lport->host->host_lock, flags); 1008 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1005 1009
1006 if (!fc_fcp_lock_pkt(fsp)) { 1010 if (!fc_fcp_lock_pkt(fsp)) {
1007 fc_fcp_cleanup_cmd(fsp, error); 1011 fc_fcp_cleanup_cmd(fsp, error);
@@ -1010,14 +1014,14 @@ restart:
1010 } 1014 }
1011 1015
1012 fc_fcp_pkt_release(fsp); 1016 fc_fcp_pkt_release(fsp);
1013 spin_lock_irqsave(lport->host->host_lock, flags); 1017 spin_lock_irqsave(&si->scsi_queue_lock, flags);
1014 /* 1018 /*
1015 * while we dropped the lock multiple pkts could 1019 * while we dropped the lock multiple pkts could
1016 * have been released, so we have to start over. 1020 * have been released, so we have to start over.
1017 */ 1021 */
1018 goto restart; 1022 goto restart;
1019 } 1023 }
1020 spin_unlock_irqrestore(lport->host->host_lock, flags); 1024 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1021} 1025}
1022 1026
1023/** 1027/**
@@ -1035,11 +1039,12 @@ static void fc_fcp_abort_io(struct fc_lport *lport)
1035 * @fsp: The FCP packet to send 1039 * @fsp: The FCP packet to send
1036 * 1040 *
1037 * Return: Zero for success and -1 for failure 1041 * Return: Zero for success and -1 for failure
1038 * Locks: Called with the host lock and irqs disabled. 1042 * Locks: Called without locks held
1039 */ 1043 */
1040static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp) 1044static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)
1041{ 1045{
1042 struct fc_fcp_internal *si = fc_get_scsi_internal(lport); 1046 struct fc_fcp_internal *si = fc_get_scsi_internal(lport);
1047 unsigned long flags;
1043 int rc; 1048 int rc;
1044 1049
1045 fsp->cmd->SCp.ptr = (char *)fsp; 1050 fsp->cmd->SCp.ptr = (char *)fsp;
@@ -1049,13 +1054,16 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)
1049 int_to_scsilun(fsp->cmd->device->lun, 1054 int_to_scsilun(fsp->cmd->device->lun,
1050 (struct scsi_lun *)fsp->cdb_cmd.fc_lun); 1055 (struct scsi_lun *)fsp->cdb_cmd.fc_lun);
1051 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); 1056 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len);
1052 list_add_tail(&fsp->list, &si->scsi_pkt_queue);
1053 1057
1054 spin_unlock_irq(lport->host->host_lock); 1058 spin_lock_irqsave(&si->scsi_queue_lock, flags);
1059 list_add_tail(&fsp->list, &si->scsi_pkt_queue);
1060 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1055 rc = lport->tt.fcp_cmd_send(lport, fsp, fc_fcp_recv); 1061 rc = lport->tt.fcp_cmd_send(lport, fsp, fc_fcp_recv);
1056 spin_lock_irq(lport->host->host_lock); 1062 if (unlikely(rc)) {
1057 if (rc) 1063 spin_lock_irqsave(&si->scsi_queue_lock, flags);
1058 list_del(&fsp->list); 1064 list_del(&fsp->list);
1065 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1066 }
1059 1067
1060 return rc; 1068 return rc;
1061} 1069}
@@ -1752,6 +1760,7 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
1752 struct fcoe_dev_stats *stats; 1760 struct fcoe_dev_stats *stats;
1753 1761
1754 lport = shost_priv(sc_cmd->device->host); 1762 lport = shost_priv(sc_cmd->device->host);
1763 spin_unlock_irq(lport->host->host_lock);
1755 1764
1756 rval = fc_remote_port_chkready(rport); 1765 rval = fc_remote_port_chkready(rport);
1757 if (rval) { 1766 if (rval) {
@@ -1834,6 +1843,7 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
1834 rc = SCSI_MLQUEUE_HOST_BUSY; 1843 rc = SCSI_MLQUEUE_HOST_BUSY;
1835 } 1844 }
1836out: 1845out:
1846 spin_lock_irq(lport->host->host_lock);
1837 return rc; 1847 return rc;
1838} 1848}
1839EXPORT_SYMBOL(fc_queuecommand); 1849EXPORT_SYMBOL(fc_queuecommand);
@@ -1864,11 +1874,8 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1864 1874
1865 lport = fsp->lp; 1875 lport = fsp->lp;
1866 si = fc_get_scsi_internal(lport); 1876 si = fc_get_scsi_internal(lport);
1867 spin_lock_irqsave(lport->host->host_lock, flags); 1877 if (!fsp->cmd)
1868 if (!fsp->cmd) {
1869 spin_unlock_irqrestore(lport->host->host_lock, flags);
1870 return; 1878 return;
1871 }
1872 1879
1873 /* 1880 /*
1874 * if can_queue ramp down is done then try can_queue ramp up 1881 * if can_queue ramp down is done then try can_queue ramp up
@@ -1880,10 +1887,8 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1880 sc_cmd = fsp->cmd; 1887 sc_cmd = fsp->cmd;
1881 fsp->cmd = NULL; 1888 fsp->cmd = NULL;
1882 1889
1883 if (!sc_cmd->SCp.ptr) { 1890 if (!sc_cmd->SCp.ptr)
1884 spin_unlock_irqrestore(lport->host->host_lock, flags);
1885 return; 1891 return;
1886 }
1887 1892
1888 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status; 1893 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status;
1889 switch (fsp->status_code) { 1894 switch (fsp->status_code) {
@@ -1945,10 +1950,11 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1945 break; 1950 break;
1946 } 1951 }
1947 1952
1953 spin_lock_irqsave(&si->scsi_queue_lock, flags);
1948 list_del(&fsp->list); 1954 list_del(&fsp->list);
1955 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1949 sc_cmd->SCp.ptr = NULL; 1956 sc_cmd->SCp.ptr = NULL;
1950 sc_cmd->scsi_done(sc_cmd); 1957 sc_cmd->scsi_done(sc_cmd);
1951 spin_unlock_irqrestore(lport->host->host_lock, flags);
1952 1958
1953 /* release ref from initial allocation in queue command */ 1959 /* release ref from initial allocation in queue command */
1954 fc_fcp_pkt_release(fsp); 1960 fc_fcp_pkt_release(fsp);
@@ -2216,6 +2222,7 @@ int fc_fcp_init(struct fc_lport *lport)
2216 lport->scsi_priv = si; 2222 lport->scsi_priv = si;
2217 si->max_can_queue = lport->host->can_queue; 2223 si->max_can_queue = lport->host->can_queue;
2218 INIT_LIST_HEAD(&si->scsi_pkt_queue); 2224 INIT_LIST_HEAD(&si->scsi_pkt_queue);
2225 spin_lock_init(&si->scsi_queue_lock);
2219 2226
2220 si->scsi_pkt_pool = mempool_create_slab_pool(2, scsi_pkt_cachep); 2227 si->scsi_pkt_pool = mempool_create_slab_pool(2, scsi_pkt_cachep);
2221 if (!si->scsi_pkt_pool) { 2228 if (!si->scsi_pkt_pool) {
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 74338c83ad0a..0b165024a219 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -537,7 +537,9 @@ int fc_fabric_login(struct fc_lport *lport)
537 int rc = -1; 537 int rc = -1;
538 538
539 mutex_lock(&lport->lp_mutex); 539 mutex_lock(&lport->lp_mutex);
540 if (lport->state == LPORT_ST_DISABLED) { 540 if (lport->state == LPORT_ST_DISABLED ||
541 lport->state == LPORT_ST_LOGO) {
542 fc_lport_state_enter(lport, LPORT_ST_RESET);
541 fc_lport_enter_reset(lport); 543 fc_lport_enter_reset(lport);
542 rc = 0; 544 rc = 0;
543 } 545 }
@@ -967,6 +969,9 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
967 FC_LPORT_DBG(lport, "Entered RESET state from %s state\n", 969 FC_LPORT_DBG(lport, "Entered RESET state from %s state\n",
968 fc_lport_state(lport)); 970 fc_lport_state(lport));
969 971
972 if (lport->state == LPORT_ST_DISABLED || lport->state == LPORT_ST_LOGO)
973 return;
974
970 if (lport->vport) { 975 if (lport->vport) {
971 if (lport->link_up) 976 if (lport->link_up)
972 fc_vport_set_state(lport->vport, FC_VPORT_INITIALIZING); 977 fc_vport_set_state(lport->vport, FC_VPORT_INITIALIZING);
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 35ca0e72df46..02300523b234 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -310,6 +310,7 @@ static void fc_rport_work(struct work_struct *work)
310 restart = 1; 310 restart = 1;
311 else 311 else
312 list_del(&rdata->peers); 312 list_del(&rdata->peers);
313 rdata->event = RPORT_EV_NONE;
313 mutex_unlock(&rdata->rp_mutex); 314 mutex_unlock(&rdata->rp_mutex);
314 mutex_unlock(&lport->disc.disc_mutex); 315 mutex_unlock(&lport->disc.disc_mutex);
315 } 316 }
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index b7689f3d05f5..c28a712fd4db 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -517,7 +517,7 @@ static void iscsi_free_task(struct iscsi_task *task)
517 if (conn->login_task == task) 517 if (conn->login_task == task)
518 return; 518 return;
519 519
520 __kfifo_put(session->cmdpool.queue, (void*)&task, sizeof(void*)); 520 kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
521 521
522 if (sc) { 522 if (sc) {
523 task->sc = NULL; 523 task->sc = NULL;
@@ -737,7 +737,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
737 BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); 737 BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE);
738 BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); 738 BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED);
739 739
740 if (!__kfifo_get(session->cmdpool.queue, 740 if (!kfifo_out(&session->cmdpool.queue,
741 (void*)&task, sizeof(void*))) 741 (void*)&task, sizeof(void*)))
742 return NULL; 742 return NULL;
743 } 743 }
@@ -1567,7 +1567,7 @@ static inline struct iscsi_task *iscsi_alloc_task(struct iscsi_conn *conn,
1567{ 1567{
1568 struct iscsi_task *task; 1568 struct iscsi_task *task;
1569 1569
1570 if (!__kfifo_get(conn->session->cmdpool.queue, 1570 if (!kfifo_out(&conn->session->cmdpool.queue,
1571 (void *) &task, sizeof(void *))) 1571 (void *) &task, sizeof(void *)))
1572 return NULL; 1572 return NULL;
1573 1573
@@ -2461,12 +2461,7 @@ iscsi_pool_init(struct iscsi_pool *q, int max, void ***items, int item_size)
2461 if (q->pool == NULL) 2461 if (q->pool == NULL)
2462 return -ENOMEM; 2462 return -ENOMEM;
2463 2463
2464 q->queue = kfifo_init((void*)q->pool, max * sizeof(void*), 2464 kfifo_init(&q->queue, (void*)q->pool, max * sizeof(void*));
2465 GFP_KERNEL, NULL);
2466 if (IS_ERR(q->queue)) {
2467 q->queue = NULL;
2468 goto enomem;
2469 }
2470 2465
2471 for (i = 0; i < max; i++) { 2466 for (i = 0; i < max; i++) {
2472 q->pool[i] = kzalloc(item_size, GFP_KERNEL); 2467 q->pool[i] = kzalloc(item_size, GFP_KERNEL);
@@ -2474,7 +2469,7 @@ iscsi_pool_init(struct iscsi_pool *q, int max, void ***items, int item_size)
2474 q->max = i; 2469 q->max = i;
2475 goto enomem; 2470 goto enomem;
2476 } 2471 }
2477 __kfifo_put(q->queue, (void*)&q->pool[i], sizeof(void*)); 2472 kfifo_in(&q->queue, (void*)&q->pool[i], sizeof(void*));
2478 } 2473 }
2479 2474
2480 if (items) { 2475 if (items) {
@@ -2497,7 +2492,6 @@ void iscsi_pool_free(struct iscsi_pool *q)
2497 for (i = 0; i < q->max; i++) 2492 for (i = 0; i < q->max; i++)
2498 kfree(q->pool[i]); 2493 kfree(q->pool[i]);
2499 kfree(q->pool); 2494 kfree(q->pool);
2500 kfree(q->queue);
2501} 2495}
2502EXPORT_SYMBOL_GPL(iscsi_pool_free); 2496EXPORT_SYMBOL_GPL(iscsi_pool_free);
2503 2497
@@ -2825,7 +2819,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
2825 2819
2826 /* allocate login_task used for the login/text sequences */ 2820 /* allocate login_task used for the login/text sequences */
2827 spin_lock_bh(&session->lock); 2821 spin_lock_bh(&session->lock);
2828 if (!__kfifo_get(session->cmdpool.queue, 2822 if (!kfifo_out(&session->cmdpool.queue,
2829 (void*)&conn->login_task, 2823 (void*)&conn->login_task,
2830 sizeof(void*))) { 2824 sizeof(void*))) {
2831 spin_unlock_bh(&session->lock); 2825 spin_unlock_bh(&session->lock);
@@ -2845,7 +2839,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
2845 return cls_conn; 2839 return cls_conn;
2846 2840
2847login_task_data_alloc_fail: 2841login_task_data_alloc_fail:
2848 __kfifo_put(session->cmdpool.queue, (void*)&conn->login_task, 2842 kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task,
2849 sizeof(void*)); 2843 sizeof(void*));
2850login_task_alloc_fail: 2844login_task_alloc_fail:
2851 iscsi_destroy_conn(cls_conn); 2845 iscsi_destroy_conn(cls_conn);
@@ -2908,7 +2902,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
2908 free_pages((unsigned long) conn->data, 2902 free_pages((unsigned long) conn->data,
2909 get_order(ISCSI_DEF_MAX_RECV_SEG_LEN)); 2903 get_order(ISCSI_DEF_MAX_RECV_SEG_LEN));
2910 kfree(conn->persistent_address); 2904 kfree(conn->persistent_address);
2911 __kfifo_put(session->cmdpool.queue, (void*)&conn->login_task, 2905 kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task,
2912 sizeof(void*)); 2906 sizeof(void*));
2913 if (session->leadconn == conn) 2907 if (session->leadconn == conn)
2914 session->leadconn = NULL; 2908 session->leadconn = NULL;
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index ca25ee5190b0..db6856c138fc 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -445,15 +445,15 @@ void iscsi_tcp_cleanup_task(struct iscsi_task *task)
445 return; 445 return;
446 446
447 /* flush task's r2t queues */ 447 /* flush task's r2t queues */
448 while (__kfifo_get(tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) { 448 while (kfifo_out(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*))) {
449 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, 449 kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t,
450 sizeof(void*)); 450 sizeof(void*));
451 ISCSI_DBG_TCP(task->conn, "pending r2t dropped\n"); 451 ISCSI_DBG_TCP(task->conn, "pending r2t dropped\n");
452 } 452 }
453 453
454 r2t = tcp_task->r2t; 454 r2t = tcp_task->r2t;
455 if (r2t != NULL) { 455 if (r2t != NULL) {
456 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, 456 kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t,
457 sizeof(void*)); 457 sizeof(void*));
458 tcp_task->r2t = NULL; 458 tcp_task->r2t = NULL;
459 } 459 }
@@ -541,7 +541,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
541 return 0; 541 return 0;
542 } 542 }
543 543
544 rc = __kfifo_get(tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); 544 rc = kfifo_out(&tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*));
545 if (!rc) { 545 if (!rc) {
546 iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. " 546 iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. "
547 "Target has sent more R2Ts than it " 547 "Target has sent more R2Ts than it "
@@ -554,7 +554,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
554 if (r2t->data_length == 0) { 554 if (r2t->data_length == 0) {
555 iscsi_conn_printk(KERN_ERR, conn, 555 iscsi_conn_printk(KERN_ERR, conn,
556 "invalid R2T with zero data len\n"); 556 "invalid R2T with zero data len\n");
557 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, 557 kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t,
558 sizeof(void*)); 558 sizeof(void*));
559 return ISCSI_ERR_DATALEN; 559 return ISCSI_ERR_DATALEN;
560 } 560 }
@@ -570,7 +570,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
570 "invalid R2T with data len %u at offset %u " 570 "invalid R2T with data len %u at offset %u "
571 "and total length %d\n", r2t->data_length, 571 "and total length %d\n", r2t->data_length,
572 r2t->data_offset, scsi_out(task->sc)->length); 572 r2t->data_offset, scsi_out(task->sc)->length);
573 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, 573 kfifo_in(&tcp_task->r2tpool.queue, (void*)&r2t,
574 sizeof(void*)); 574 sizeof(void*));
575 return ISCSI_ERR_DATALEN; 575 return ISCSI_ERR_DATALEN;
576 } 576 }
@@ -580,7 +580,7 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
580 r2t->sent = 0; 580 r2t->sent = 0;
581 581
582 tcp_task->exp_datasn = r2tsn + 1; 582 tcp_task->exp_datasn = r2tsn + 1;
583 __kfifo_put(tcp_task->r2tqueue, (void*)&r2t, sizeof(void*)); 583 kfifo_in(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*));
584 conn->r2t_pdus_cnt++; 584 conn->r2t_pdus_cnt++;
585 585
586 iscsi_requeue_task(task); 586 iscsi_requeue_task(task);
@@ -951,7 +951,7 @@ int iscsi_tcp_task_init(struct iscsi_task *task)
951 return conn->session->tt->init_pdu(task, 0, task->data_count); 951 return conn->session->tt->init_pdu(task, 0, task->data_count);
952 } 952 }
953 953
954 BUG_ON(__kfifo_len(tcp_task->r2tqueue)); 954 BUG_ON(kfifo_len(&tcp_task->r2tqueue));
955 tcp_task->exp_datasn = 0; 955 tcp_task->exp_datasn = 0;
956 956
957 /* Prepare PDU, optionally w/ immediate data */ 957 /* Prepare PDU, optionally w/ immediate data */
@@ -982,7 +982,7 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task)
982 if (r2t->data_length <= r2t->sent) { 982 if (r2t->data_length <= r2t->sent) {
983 ISCSI_DBG_TCP(task->conn, 983 ISCSI_DBG_TCP(task->conn,
984 " done with r2t %p\n", r2t); 984 " done with r2t %p\n", r2t);
985 __kfifo_put(tcp_task->r2tpool.queue, 985 kfifo_in(&tcp_task->r2tpool.queue,
986 (void *)&tcp_task->r2t, 986 (void *)&tcp_task->r2t,
987 sizeof(void *)); 987 sizeof(void *));
988 tcp_task->r2t = r2t = NULL; 988 tcp_task->r2t = r2t = NULL;
@@ -990,8 +990,13 @@ static struct iscsi_r2t_info *iscsi_tcp_get_curr_r2t(struct iscsi_task *task)
990 } 990 }
991 991
992 if (r2t == NULL) { 992 if (r2t == NULL) {
993 __kfifo_get(tcp_task->r2tqueue, 993 if (kfifo_out(&tcp_task->r2tqueue,
994 (void *)&tcp_task->r2t, sizeof(void *)); 994 (void *)&tcp_task->r2t, sizeof(void *)) !=
995 sizeof(void *)) {
996 WARN_ONCE(1, "unexpected fifo state");
997 r2t = NULL;
998 }
999
995 r2t = tcp_task->r2t; 1000 r2t = tcp_task->r2t;
996 } 1001 }
997 spin_unlock_bh(&session->lock); 1002 spin_unlock_bh(&session->lock);
@@ -1127,9 +1132,8 @@ int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session)
1127 } 1132 }
1128 1133
1129 /* R2T xmit queue */ 1134 /* R2T xmit queue */
1130 tcp_task->r2tqueue = kfifo_alloc( 1135 if (kfifo_alloc(&tcp_task->r2tqueue,
1131 session->max_r2t * 4 * sizeof(void*), GFP_KERNEL, NULL); 1136 session->max_r2t * 4 * sizeof(void*), GFP_KERNEL)) {
1132 if (tcp_task->r2tqueue == ERR_PTR(-ENOMEM)) {
1133 iscsi_pool_free(&tcp_task->r2tpool); 1137 iscsi_pool_free(&tcp_task->r2tpool);
1134 goto r2t_alloc_fail; 1138 goto r2t_alloc_fail;
1135 } 1139 }
@@ -1142,7 +1146,7 @@ r2t_alloc_fail:
1142 struct iscsi_task *task = session->cmds[i]; 1146 struct iscsi_task *task = session->cmds[i];
1143 struct iscsi_tcp_task *tcp_task = task->dd_data; 1147 struct iscsi_tcp_task *tcp_task = task->dd_data;
1144 1148
1145 kfifo_free(tcp_task->r2tqueue); 1149 kfifo_free(&tcp_task->r2tqueue);
1146 iscsi_pool_free(&tcp_task->r2tpool); 1150 iscsi_pool_free(&tcp_task->r2tpool);
1147 } 1151 }
1148 return -ENOMEM; 1152 return -ENOMEM;
@@ -1157,7 +1161,7 @@ void iscsi_tcp_r2tpool_free(struct iscsi_session *session)
1157 struct iscsi_task *task = session->cmds[i]; 1161 struct iscsi_task *task = session->cmds[i];
1158 struct iscsi_tcp_task *tcp_task = task->dd_data; 1162 struct iscsi_tcp_task *tcp_task = task->dd_data;
1159 1163
1160 kfifo_free(tcp_task->r2tqueue); 1164 kfifo_free(&tcp_task->r2tqueue);
1161 iscsi_pool_free(&tcp_task->r2tpool); 1165 iscsi_pool_free(&tcp_task->r2tpool);
1162 } 1166 }
1163} 1167}
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c
index 9ad38e81e343..ab19b3b4be52 100644
--- a/drivers/scsi/libsrp.c
+++ b/drivers/scsi/libsrp.c
@@ -58,19 +58,15 @@ static int srp_iu_pool_alloc(struct srp_queue *q, size_t max,
58 goto free_pool; 58 goto free_pool;
59 59
60 spin_lock_init(&q->lock); 60 spin_lock_init(&q->lock);
61 q->queue = kfifo_init((void *) q->pool, max * sizeof(void *), 61 kfifo_init(&q->queue, (void *) q->pool, max * sizeof(void *));
62 GFP_KERNEL, &q->lock);
63 if (IS_ERR(q->queue))
64 goto free_item;
65 62
66 for (i = 0, iue = q->items; i < max; i++) { 63 for (i = 0, iue = q->items; i < max; i++) {
67 __kfifo_put(q->queue, (void *) &iue, sizeof(void *)); 64 kfifo_in(&q->queue, (void *) &iue, sizeof(void *));
68 iue->sbuf = ring[i]; 65 iue->sbuf = ring[i];
69 iue++; 66 iue++;
70 } 67 }
71 return 0; 68 return 0;
72 69
73free_item:
74 kfree(q->items); 70 kfree(q->items);
75free_pool: 71free_pool:
76 kfree(q->pool); 72 kfree(q->pool);
@@ -167,7 +163,11 @@ struct iu_entry *srp_iu_get(struct srp_target *target)
167{ 163{
168 struct iu_entry *iue = NULL; 164 struct iu_entry *iue = NULL;
169 165
170 kfifo_get(target->iu_queue.queue, (void *) &iue, sizeof(void *)); 166 if (kfifo_out_locked(&target->iu_queue.queue, (void *) &iue,
167 sizeof(void *), &target->iu_queue.lock) != sizeof(void *)) {
168 WARN_ONCE(1, "unexpected fifo state");
169 return NULL;
170 }
171 if (!iue) 171 if (!iue)
172 return iue; 172 return iue;
173 iue->target = target; 173 iue->target = target;
@@ -179,7 +179,8 @@ EXPORT_SYMBOL_GPL(srp_iu_get);
179 179
180void srp_iu_put(struct iu_entry *iue) 180void srp_iu_put(struct iu_entry *iue)
181{ 181{
182 kfifo_put(iue->target->iu_queue.queue, (void *) &iue, sizeof(void *)); 182 kfifo_in_locked(&iue->target->iu_queue.queue, (void *) &iue,
183 sizeof(void *), &iue->target->iu_queue.lock);
183} 184}
184EXPORT_SYMBOL_GPL(srp_iu_put); 185EXPORT_SYMBOL_GPL(srp_iu_put);
185 186
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index ce522702a6c1..2cc39684ce97 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4142,8 +4142,8 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4142 spin_lock_irq(shost->host_lock); 4142 spin_lock_irq(shost->host_lock);
4143 if (vport->fc_rscn_flush) { 4143 if (vport->fc_rscn_flush) {
4144 /* Another thread is walking fc_rscn_id_list on this vport */ 4144 /* Another thread is walking fc_rscn_id_list on this vport */
4145 spin_unlock_irq(shost->host_lock);
4146 vport->fc_flag |= FC_RSCN_DISCOVERY; 4145 vport->fc_flag |= FC_RSCN_DISCOVERY;
4146 spin_unlock_irq(shost->host_lock);
4147 /* Send back ACC */ 4147 /* Send back ACC */
4148 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); 4148 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
4149 return 0; 4149 return 0;
@@ -5948,8 +5948,8 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
5948 lpfc_initial_fdisc(vport); 5948 lpfc_initial_fdisc(vport);
5949 break; 5949 break;
5950 } 5950 }
5951
5952 } else { 5951 } else {
5952 vport->vpi_state |= LPFC_VPI_REGISTERED;
5953 if (vport == phba->pport) 5953 if (vport == phba->pport)
5954 if (phba->sli_rev < LPFC_SLI_REV4) 5954 if (phba->sli_rev < LPFC_SLI_REV4)
5955 lpfc_issue_fabric_reglogin(vport); 5955 lpfc_issue_fabric_reglogin(vport);
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 3b9424427652..2445e399fd60 100755
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -747,6 +747,10 @@ lpfc_linkdown(struct lpfc_hba *phba)
747 747
748 if (phba->link_state == LPFC_LINK_DOWN) 748 if (phba->link_state == LPFC_LINK_DOWN)
749 return 0; 749 return 0;
750
751 /* Block all SCSI stack I/Os */
752 lpfc_scsi_dev_block(phba);
753
750 spin_lock_irq(&phba->hbalock); 754 spin_lock_irq(&phba->hbalock);
751 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_DISCOVERED); 755 phba->fcf.fcf_flag &= ~(FCF_AVAILABLE | FCF_DISCOVERED);
752 if (phba->link_state > LPFC_LINK_DOWN) { 756 if (phba->link_state > LPFC_LINK_DOWN) {
@@ -1555,10 +1559,16 @@ lpfc_mbx_cmpl_read_fcf_record(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1555 * to book keeping the FCFIs can be used. 1559 * to book keeping the FCFIs can be used.
1556 */ 1560 */
1557 if (shdr_status || shdr_add_status) { 1561 if (shdr_status || shdr_add_status) {
1558 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1562 if (shdr_status == STATUS_FCF_TABLE_EMPTY) {
1559 "2521 READ_FCF_RECORD mailbox failed " 1563 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1560 "with status x%x add_status x%x, mbx\n", 1564 "2726 READ_FCF_RECORD Indicates empty "
1561 shdr_status, shdr_add_status); 1565 "FCF table.\n");
1566 } else {
1567 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1568 "2521 READ_FCF_RECORD mailbox failed "
1569 "with status x%x add_status x%x, mbx\n",
1570 shdr_status, shdr_add_status);
1571 }
1562 goto out; 1572 goto out;
1563 } 1573 }
1564 /* Interpreting the returned information of FCF records */ 1574 /* Interpreting the returned information of FCF records */
@@ -1698,7 +1708,9 @@ lpfc_init_vpi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1698 lpfc_vport_set_state(vport, FC_VPORT_FAILED); 1708 lpfc_vport_set_state(vport, FC_VPORT_FAILED);
1699 return; 1709 return;
1700 } 1710 }
1711 spin_lock_irq(&phba->hbalock);
1701 vport->fc_flag &= ~FC_VPORT_NEEDS_INIT_VPI; 1712 vport->fc_flag &= ~FC_VPORT_NEEDS_INIT_VPI;
1713 spin_unlock_irq(&phba->hbalock);
1702 1714
1703 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) 1715 if (phba->link_flag & LS_NPIV_FAB_SUPPORTED)
1704 lpfc_initial_fdisc(vport); 1716 lpfc_initial_fdisc(vport);
@@ -2259,7 +2271,10 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
2259 mb->mbxStatus); 2271 mb->mbxStatus);
2260 break; 2272 break;
2261 } 2273 }
2274 spin_lock_irq(&phba->hbalock);
2262 vport->vpi_state &= ~LPFC_VPI_REGISTERED; 2275 vport->vpi_state &= ~LPFC_VPI_REGISTERED;
2276 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
2277 spin_unlock_irq(&phba->hbalock);
2263 vport->unreg_vpi_cmpl = VPORT_OK; 2278 vport->unreg_vpi_cmpl = VPORT_OK;
2264 mempool_free(pmb, phba->mbox_mem_pool); 2279 mempool_free(pmb, phba->mbox_mem_pool);
2265 /* 2280 /*
@@ -4475,8 +4490,10 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
4475 (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) 4490 (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED))
4476 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { 4491 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
4477 lpfc_mbx_unreg_vpi(vports[i]); 4492 lpfc_mbx_unreg_vpi(vports[i]);
4493 spin_lock_irq(&phba->hbalock);
4478 vports[i]->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; 4494 vports[i]->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
4479 vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED; 4495 vports[i]->vpi_state &= ~LPFC_VPI_REGISTERED;
4496 spin_unlock_irq(&phba->hbalock);
4480 } 4497 }
4481 lpfc_destroy_vport_work_array(phba, vports); 4498 lpfc_destroy_vport_work_array(phba, vports);
4482 4499
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 1585148a17e5..8a2a1c5935c6 100644..100755
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -1013,7 +1013,7 @@ struct lpfc_mbx_wq_destroy {
1013}; 1013};
1014 1014
1015#define LPFC_HDR_BUF_SIZE 128 1015#define LPFC_HDR_BUF_SIZE 128
1016#define LPFC_DATA_BUF_SIZE 4096 1016#define LPFC_DATA_BUF_SIZE 2048
1017struct rq_context { 1017struct rq_context {
1018 uint32_t word0; 1018 uint32_t word0;
1019#define lpfc_rq_context_rq_size_SHIFT 16 1019#define lpfc_rq_context_rq_size_SHIFT 16
@@ -1371,6 +1371,7 @@ struct lpfc_mbx_query_fw_cfg {
1371#define STATUS_ERROR_ACITMAIN 0x2a 1371#define STATUS_ERROR_ACITMAIN 0x2a
1372#define STATUS_REBOOT_REQUIRED 0x2c 1372#define STATUS_REBOOT_REQUIRED 0x2c
1373#define STATUS_FCF_IN_USE 0x3a 1373#define STATUS_FCF_IN_USE 0x3a
1374#define STATUS_FCF_TABLE_EMPTY 0x43
1374 1375
1375struct lpfc_mbx_sli4_config { 1376struct lpfc_mbx_sli4_config {
1376 struct mbox_header header; 1377 struct mbox_header header;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 226920d15ea1..b8eb1b6e5e77 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3006,6 +3006,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3006 struct lpfc_vport *vport; 3006 struct lpfc_vport *vport;
3007 struct lpfc_nodelist *ndlp; 3007 struct lpfc_nodelist *ndlp;
3008 struct Scsi_Host *shost; 3008 struct Scsi_Host *shost;
3009 uint32_t link_state;
3009 3010
3010 phba->fc_eventTag = acqe_fcoe->event_tag; 3011 phba->fc_eventTag = acqe_fcoe->event_tag;
3011 phba->fcoe_eventtag = acqe_fcoe->event_tag; 3012 phba->fcoe_eventtag = acqe_fcoe->event_tag;
@@ -3052,9 +3053,12 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3052 break; 3053 break;
3053 /* 3054 /*
3054 * Currently, driver support only one FCF - so treat this as 3055 * Currently, driver support only one FCF - so treat this as
3055 * a link down. 3056 * a link down, but save the link state because we don't want
3057 * it to be changed to Link Down unless it is already down.
3056 */ 3058 */
3059 link_state = phba->link_state;
3057 lpfc_linkdown(phba); 3060 lpfc_linkdown(phba);
3061 phba->link_state = link_state;
3058 /* Unregister FCF if no devices connected to it */ 3062 /* Unregister FCF if no devices connected to it */
3059 lpfc_unregister_unused_fcf(phba); 3063 lpfc_unregister_unused_fcf(phba);
3060 break; 3064 break;
@@ -4506,9 +4510,13 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
4506 pdev = phba->pcidev; 4510 pdev = phba->pcidev;
4507 4511
4508 /* Set the device DMA mask size */ 4512 /* Set the device DMA mask size */
4509 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) 4513 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0
4510 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) 4514 || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) {
4515 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
4516 || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
4511 return error; 4517 return error;
4518 }
4519 }
4512 4520
4513 /* Get the bus address of Bar0 and Bar2 and the number of bytes 4521 /* Get the bus address of Bar0 and Bar2 and the number of bytes
4514 * required by each mapping. 4522 * required by each mapping.
@@ -6021,9 +6029,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
6021 pdev = phba->pcidev; 6029 pdev = phba->pcidev;
6022 6030
6023 /* Set the device DMA mask size */ 6031 /* Set the device DMA mask size */
6024 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) 6032 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0
6025 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) 6033 || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) {
6034 if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
6035 || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
6026 return error; 6036 return error;
6037 }
6038 }
6027 6039
6028 /* Get the bus address of SLI4 device Bar0, Bar1, and Bar2 and the 6040 /* Get the bus address of SLI4 device Bar0, Bar1, and Bar2 and the
6029 * number of bytes required by each mapping. They are actually 6041 * number of bytes required by each mapping. They are actually
@@ -7218,8 +7230,6 @@ lpfc_prep_dev_for_perm_failure(struct lpfc_hba *phba)
7218{ 7230{
7219 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 7231 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
7220 "2711 PCI channel permanent disable for failure\n"); 7232 "2711 PCI channel permanent disable for failure\n");
7221 /* Block all SCSI devices' I/Os on the host */
7222 lpfc_scsi_dev_block(phba);
7223 /* Clean up all driver's outstanding SCSI I/Os */ 7233 /* Clean up all driver's outstanding SCSI I/Os */
7224 lpfc_sli_flush_fcp_rings(phba); 7234 lpfc_sli_flush_fcp_rings(phba);
7225} 7235}
@@ -7248,6 +7258,9 @@ lpfc_io_error_detected_s3(struct pci_dev *pdev, pci_channel_state_t state)
7248 struct Scsi_Host *shost = pci_get_drvdata(pdev); 7258 struct Scsi_Host *shost = pci_get_drvdata(pdev);
7249 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; 7259 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
7250 7260
7261 /* Block all SCSI devices' I/Os on the host */
7262 lpfc_scsi_dev_block(phba);
7263
7251 switch (state) { 7264 switch (state) {
7252 case pci_channel_io_normal: 7265 case pci_channel_io_normal:
7253 /* Non-fatal error, prepare for recovery */ 7266 /* Non-fatal error, prepare for recovery */
@@ -7499,6 +7512,9 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
7499 error = -ENODEV; 7512 error = -ENODEV;
7500 goto out_free_sysfs_attr; 7513 goto out_free_sysfs_attr;
7501 } 7514 }
7515 /* Default to single FCP EQ for non-MSI-X */
7516 if (phba->intr_type != MSIX)
7517 phba->cfg_fcp_eq_count = 1;
7502 /* Set up SLI-4 HBA */ 7518 /* Set up SLI-4 HBA */
7503 if (lpfc_sli4_hba_setup(phba)) { 7519 if (lpfc_sli4_hba_setup(phba)) {
7504 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 7520 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 7935667b81a5..589549b2bf0e 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1383,7 +1383,7 @@ lpfc_sli_hbq_to_firmware_s4(struct lpfc_hba *phba, uint32_t hbqno,
1383/* HBQ for ELS and CT traffic. */ 1383/* HBQ for ELS and CT traffic. */
1384static struct lpfc_hbq_init lpfc_els_hbq = { 1384static struct lpfc_hbq_init lpfc_els_hbq = {
1385 .rn = 1, 1385 .rn = 1,
1386 .entry_count = 200, 1386 .entry_count = 256,
1387 .mask_count = 0, 1387 .mask_count = 0,
1388 .profile = 0, 1388 .profile = 0,
1389 .ring_mask = (1 << LPFC_ELS_RING), 1389 .ring_mask = (1 << LPFC_ELS_RING),
@@ -1482,8 +1482,11 @@ err:
1482int 1482int
1483lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) 1483lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno)
1484{ 1484{
1485 return(lpfc_sli_hbqbuf_fill_hbqs(phba, qno, 1485 if (phba->sli_rev == LPFC_SLI_REV4)
1486 lpfc_hbq_defs[qno]->add_count)); 1486 return 0;
1487 else
1488 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
1489 lpfc_hbq_defs[qno]->add_count);
1487} 1490}
1488 1491
1489/** 1492/**
@@ -1498,8 +1501,12 @@ lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno)
1498static int 1501static int
1499lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno) 1502lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno)
1500{ 1503{
1501 return(lpfc_sli_hbqbuf_fill_hbqs(phba, qno, 1504 if (phba->sli_rev == LPFC_SLI_REV4)
1502 lpfc_hbq_defs[qno]->init_count)); 1505 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
1506 lpfc_hbq_defs[qno]->entry_count);
1507 else
1508 return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
1509 lpfc_hbq_defs[qno]->init_count);
1503} 1510}
1504 1511
1505/** 1512/**
@@ -4110,6 +4117,7 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
4110 if (rc) { 4117 if (rc) {
4111 dma_free_coherent(&phba->pcidev->dev, dma_size, 4118 dma_free_coherent(&phba->pcidev->dev, dma_size,
4112 dmabuf->virt, dmabuf->phys); 4119 dmabuf->virt, dmabuf->phys);
4120 kfree(dmabuf);
4113 return -EIO; 4121 return -EIO;
4114 } 4122 }
4115 4123
@@ -5848,7 +5856,6 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
5848 iocbq->iocb.un.ulpWord[3]); 5856 iocbq->iocb.un.ulpWord[3]);
5849 wqe->generic.word3 = 0; 5857 wqe->generic.word3 = 0;
5850 bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext); 5858 bf_set(wqe_rcvoxid, &wqe->generic, iocbq->iocb.ulpContext);
5851 bf_set(wqe_xc, &wqe->generic, 1);
5852 /* The entire sequence is transmitted for this IOCB */ 5859 /* The entire sequence is transmitted for this IOCB */
5853 xmit_len = total_len; 5860 xmit_len = total_len;
5854 cmnd = CMD_XMIT_SEQUENCE64_CR; 5861 cmnd = CMD_XMIT_SEQUENCE64_CR;
@@ -10944,7 +10951,8 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
10944 return dmabuf; 10951 return dmabuf;
10945 } 10952 }
10946 temp_hdr = seq_dmabuf->hbuf.virt; 10953 temp_hdr = seq_dmabuf->hbuf.virt;
10947 if (new_hdr->fh_seq_cnt < temp_hdr->fh_seq_cnt) { 10954 if (be16_to_cpu(new_hdr->fh_seq_cnt) <
10955 be16_to_cpu(temp_hdr->fh_seq_cnt)) {
10948 list_del_init(&seq_dmabuf->hbuf.list); 10956 list_del_init(&seq_dmabuf->hbuf.list);
10949 list_add_tail(&dmabuf->hbuf.list, &vport->rcv_buffer_list); 10957 list_add_tail(&dmabuf->hbuf.list, &vport->rcv_buffer_list);
10950 list_add_tail(&dmabuf->dbuf.list, &seq_dmabuf->dbuf.list); 10958 list_add_tail(&dmabuf->dbuf.list, &seq_dmabuf->dbuf.list);
@@ -10955,6 +10963,11 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
10955 list_move_tail(&seq_dmabuf->hbuf.list, &vport->rcv_buffer_list); 10963 list_move_tail(&seq_dmabuf->hbuf.list, &vport->rcv_buffer_list);
10956 seq_dmabuf->time_stamp = jiffies; 10964 seq_dmabuf->time_stamp = jiffies;
10957 lpfc_update_rcv_time_stamp(vport); 10965 lpfc_update_rcv_time_stamp(vport);
10966 if (list_empty(&seq_dmabuf->dbuf.list)) {
10967 temp_hdr = dmabuf->hbuf.virt;
10968 list_add_tail(&dmabuf->dbuf.list, &seq_dmabuf->dbuf.list);
10969 return seq_dmabuf;
10970 }
10958 /* find the correct place in the sequence to insert this frame */ 10971 /* find the correct place in the sequence to insert this frame */
10959 list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) { 10972 list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) {
10960 temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); 10973 temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf);
@@ -10963,7 +10976,8 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
10963 * If the frame's sequence count is greater than the frame on 10976 * If the frame's sequence count is greater than the frame on
10964 * the list then insert the frame right after this frame 10977 * the list then insert the frame right after this frame
10965 */ 10978 */
10966 if (new_hdr->fh_seq_cnt > temp_hdr->fh_seq_cnt) { 10979 if (be16_to_cpu(new_hdr->fh_seq_cnt) >
10980 be16_to_cpu(temp_hdr->fh_seq_cnt)) {
10967 list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list); 10981 list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list);
10968 return seq_dmabuf; 10982 return seq_dmabuf;
10969 } 10983 }
@@ -11210,7 +11224,7 @@ lpfc_seq_complete(struct hbq_dmabuf *dmabuf)
11210 seq_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf); 11224 seq_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf);
11211 hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt; 11225 hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt;
11212 /* If there is a hole in the sequence count then fail. */ 11226 /* If there is a hole in the sequence count then fail. */
11213 if (++seq_count != hdr->fh_seq_cnt) 11227 if (++seq_count != be16_to_cpu(hdr->fh_seq_cnt))
11214 return 0; 11228 return 0;
11215 fctl = (hdr->fh_f_ctl[0] << 16 | 11229 fctl = (hdr->fh_f_ctl[0] << 16 |
11216 hdr->fh_f_ctl[1] << 8 | 11230 hdr->fh_f_ctl[1] << 8 |
@@ -11242,6 +11256,7 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
11242 struct lpfc_iocbq *first_iocbq, *iocbq; 11256 struct lpfc_iocbq *first_iocbq, *iocbq;
11243 struct fc_frame_header *fc_hdr; 11257 struct fc_frame_header *fc_hdr;
11244 uint32_t sid; 11258 uint32_t sid;
11259 struct ulp_bde64 *pbde;
11245 11260
11246 fc_hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt; 11261 fc_hdr = (struct fc_frame_header *)seq_dmabuf->hbuf.virt;
11247 /* remove from receive buffer list */ 11262 /* remove from receive buffer list */
@@ -11283,8 +11298,9 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
11283 if (!iocbq->context3) { 11298 if (!iocbq->context3) {
11284 iocbq->context3 = d_buf; 11299 iocbq->context3 = d_buf;
11285 iocbq->iocb.ulpBdeCount++; 11300 iocbq->iocb.ulpBdeCount++;
11286 iocbq->iocb.unsli3.rcvsli3.bde2.tus.f.bdeSize = 11301 pbde = (struct ulp_bde64 *)
11287 LPFC_DATA_BUF_SIZE; 11302 &iocbq->iocb.unsli3.sli3Words[4];
11303 pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
11288 first_iocbq->iocb.unsli3.rcvsli3.acc_len += 11304 first_iocbq->iocb.unsli3.rcvsli3.acc_len +=
11289 bf_get(lpfc_rcqe_length, 11305 bf_get(lpfc_rcqe_length,
11290 &seq_dmabuf->cq_event.cqe.rcqe_cmpl); 11306 &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
@@ -11401,15 +11417,9 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba,
11401 return; 11417 return;
11402 } 11418 }
11403 /* If not last frame in sequence continue processing frames. */ 11419 /* If not last frame in sequence continue processing frames. */
11404 if (!lpfc_seq_complete(seq_dmabuf)) { 11420 if (!lpfc_seq_complete(seq_dmabuf))
11405 /*
11406 * When saving off frames post a new one and mark this
11407 * frame to be freed when it is finished.
11408 **/
11409 lpfc_sli_hbqbuf_fill_hbqs(phba, LPFC_ELS_HBQ, 1);
11410 dmabuf->tag = -1;
11411 return; 11421 return;
11412 } 11422
11413 /* Send the complete sequence to the upper layer protocol */ 11423 /* Send the complete sequence to the upper layer protocol */
11414 lpfc_sli4_send_seq_to_ulp(vport, seq_dmabuf); 11424 lpfc_sli4_send_seq_to_ulp(vport, seq_dmabuf);
11415} 11425}
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 25d66d070cf8..44e5f574236b 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -28,7 +28,7 @@
28/* Multi-queue arrangement for fast-path FCP work queues */ 28/* Multi-queue arrangement for fast-path FCP work queues */
29#define LPFC_FN_EQN_MAX 8 29#define LPFC_FN_EQN_MAX 8
30#define LPFC_SP_EQN_DEF 1 30#define LPFC_SP_EQN_DEF 1
31#define LPFC_FP_EQN_DEF 1 31#define LPFC_FP_EQN_DEF 4
32#define LPFC_FP_EQN_MIN 1 32#define LPFC_FP_EQN_MIN 1
33#define LPFC_FP_EQN_MAX (LPFC_FN_EQN_MAX - LPFC_SP_EQN_DEF) 33#define LPFC_FP_EQN_MAX (LPFC_FN_EQN_MAX - LPFC_SP_EQN_DEF)
34 34
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index c7f3aed2aab8..792f72263f1a 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.3.6" 21#define LPFC_DRIVER_VERSION "8.3.7"
22#define LPFC_DRIVER_NAME "lpfc" 22#define LPFC_DRIVER_NAME "lpfc"
23#define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" 23#define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp"
24#define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp" 24#define LPFC_FP_DRIVER_HANDLER_NAME "lpfc:fp"
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 7d6dd83d3592..e3c7fa642306 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -512,8 +512,10 @@ enable_vport(struct fc_vport *fc_vport)
512 return VPORT_OK; 512 return VPORT_OK;
513 } 513 }
514 514
515 spin_lock_irq(&phba->hbalock);
515 vport->load_flag |= FC_LOADING; 516 vport->load_flag |= FC_LOADING;
516 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 517 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
518 spin_unlock_irq(&phba->hbalock);
517 519
518 /* Use the Physical nodes Fabric NDLP to determine if the link is 520 /* Use the Physical nodes Fabric NDLP to determine if the link is
519 * up and ready to FDISC. 521 * up and ready to FDISC.
@@ -700,7 +702,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
700 } 702 }
701 spin_unlock_irq(&phba->ndlp_lock); 703 spin_unlock_irq(&phba->ndlp_lock);
702 } 704 }
703 if (vport->vpi_state != LPFC_VPI_REGISTERED) 705 if (!(vport->vpi_state & LPFC_VPI_REGISTERED))
704 goto skip_logo; 706 goto skip_logo;
705 vport->unreg_vpi_cmpl = VPORT_INVAL; 707 vport->unreg_vpi_cmpl = VPORT_INVAL;
706 timeout = msecs_to_jiffies(phba->fc_ratov * 2000); 708 timeout = msecs_to_jiffies(phba->fc_ratov * 2000);
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 134c63ef6d38..708ea3157b60 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -2501,7 +2501,9 @@ static int megasas_init_mfi(struct megasas_instance *instance)
2501 instance->base_addr = pci_resource_start(instance->pdev, 0); 2501 instance->base_addr = pci_resource_start(instance->pdev, 0);
2502 } 2502 }
2503 2503
2504 if (pci_request_regions(instance->pdev, "megasas: LSI")) { 2504 if (pci_request_selected_regions(instance->pdev,
2505 pci_select_bars(instance->pdev, IORESOURCE_MEM),
2506 "megasas: LSI")) {
2505 printk(KERN_DEBUG "megasas: IO memory region busy!\n"); 2507 printk(KERN_DEBUG "megasas: IO memory region busy!\n");
2506 return -EBUSY; 2508 return -EBUSY;
2507 } 2509 }
@@ -2642,7 +2644,8 @@ static int megasas_init_mfi(struct megasas_instance *instance)
2642 iounmap(instance->reg_set); 2644 iounmap(instance->reg_set);
2643 2645
2644 fail_ioremap: 2646 fail_ioremap:
2645 pci_release_regions(instance->pdev); 2647 pci_release_selected_regions(instance->pdev,
2648 pci_select_bars(instance->pdev, IORESOURCE_MEM));
2646 2649
2647 return -EINVAL; 2650 return -EINVAL;
2648} 2651}
@@ -2662,7 +2665,8 @@ static void megasas_release_mfi(struct megasas_instance *instance)
2662 2665
2663 iounmap(instance->reg_set); 2666 iounmap(instance->reg_set);
2664 2667
2665 pci_release_regions(instance->pdev); 2668 pci_release_selected_regions(instance->pdev,
2669 pci_select_bars(instance->pdev, IORESOURCE_MEM));
2666} 2670}
2667 2671
2668/** 2672/**
@@ -2971,7 +2975,7 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2971 /* 2975 /*
2972 * PCI prepping: enable device set bus mastering and dma mask 2976 * PCI prepping: enable device set bus mastering and dma mask
2973 */ 2977 */
2974 rval = pci_enable_device(pdev); 2978 rval = pci_enable_device_mem(pdev);
2975 2979
2976 if (rval) { 2980 if (rval) {
2977 return rval; 2981 return rval;
@@ -3276,7 +3280,7 @@ megasas_resume(struct pci_dev *pdev)
3276 /* 3280 /*
3277 * PCI prepping: enable device set bus mastering and dma mask 3281 * PCI prepping: enable device set bus mastering and dma mask
3278 */ 3282 */
3279 rval = pci_enable_device(pdev); 3283 rval = pci_enable_device_mem(pdev);
3280 3284
3281 if (rval) { 3285 if (rval) {
3282 printk(KERN_ERR "megasas: Enable device failed\n"); 3286 printk(KERN_ERR "megasas: Enable device failed\n");
@@ -4042,7 +4046,7 @@ megasas_aen_polling(struct work_struct *work)
4042} 4046}
4043 4047
4044 4048
4045static DRIVER_ATTR(poll_mode_io, S_IRUGO|S_IWUGO, 4049static DRIVER_ATTR(poll_mode_io, S_IRUGO|S_IWUSR,
4046 megasas_sysfs_show_poll_mode_io, 4050 megasas_sysfs_show_poll_mode_io,
4047 megasas_sysfs_set_poll_mode_io); 4051 megasas_sysfs_set_poll_mode_io);
4048 4052
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 6422e258fd52..89d02401b9ec 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -3583,6 +3583,11 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3583 ioc->transport_cmds.status = MPT2_CMD_NOT_USED; 3583 ioc->transport_cmds.status = MPT2_CMD_NOT_USED;
3584 mutex_init(&ioc->transport_cmds.mutex); 3584 mutex_init(&ioc->transport_cmds.mutex);
3585 3585
3586 /* scsih internal command bits */
3587 ioc->scsih_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
3588 ioc->scsih_cmds.status = MPT2_CMD_NOT_USED;
3589 mutex_init(&ioc->scsih_cmds.mutex);
3590
3586 /* task management internal command bits */ 3591 /* task management internal command bits */
3587 ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); 3592 ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
3588 ioc->tm_cmds.status = MPT2_CMD_NOT_USED; 3593 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index c790d45876c4..cae6b2cf492f 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -657,6 +657,7 @@ static struct pci_device_id __devinitdata mvs_pci_table[] = {
657 { PCI_VDEVICE(MARVELL, 0x9180), chip_9180 }, 657 { PCI_VDEVICE(MARVELL, 0x9180), chip_9180 },
658 { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 }, 658 { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 },
659 { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 }, 659 { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 },
660 { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 },
660 661
661 { } /* terminate list */ 662 { } /* terminate list */
662}; 663};
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index 950202a70bcf..24223473f573 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -432,30 +432,23 @@ static void _osd_free_seg(struct osd_request *or __unused,
432 seg->alloc_size = 0; 432 seg->alloc_size = 0;
433} 433}
434 434
435static void _put_request(struct request *rq , bool is_async) 435static void _put_request(struct request *rq)
436{ 436{
437 if (is_async) { 437 /*
438 WARN_ON(rq->bio); 438 * If osd_finalize_request() was called but the request was not
439 __blk_put_request(rq->q, rq); 439 * executed through the block layer, then we must release BIOs.
440 } else { 440 * TODO: Keep error code in or->async_error. Need to audit all
441 /* 441 * code paths.
442 * If osd_finalize_request() was called but the request was not 442 */
443 * executed through the block layer, then we must release BIOs. 443 if (unlikely(rq->bio))
444 * TODO: Keep error code in or->async_error. Need to audit all 444 blk_end_request(rq, -ENOMEM, blk_rq_bytes(rq));
445 * code paths. 445 else
446 */ 446 blk_put_request(rq);
447 if (unlikely(rq->bio))
448 blk_end_request(rq, -ENOMEM, blk_rq_bytes(rq));
449 else
450 blk_put_request(rq);
451 }
452} 447}
453 448
454void osd_end_request(struct osd_request *or) 449void osd_end_request(struct osd_request *or)
455{ 450{
456 struct request *rq = or->request; 451 struct request *rq = or->request;
457 /* IMPORTANT: make sure this agrees with osd_execute_request_async */
458 bool is_async = (or->request->end_io_data == or);
459 452
460 _osd_free_seg(or, &or->set_attr); 453 _osd_free_seg(or, &or->set_attr);
461 _osd_free_seg(or, &or->enc_get_attr); 454 _osd_free_seg(or, &or->enc_get_attr);
@@ -463,20 +456,34 @@ void osd_end_request(struct osd_request *or)
463 456
464 if (rq) { 457 if (rq) {
465 if (rq->next_rq) { 458 if (rq->next_rq) {
466 _put_request(rq->next_rq, is_async); 459 _put_request(rq->next_rq);
467 rq->next_rq = NULL; 460 rq->next_rq = NULL;
468 } 461 }
469 462
470 _put_request(rq, is_async); 463 _put_request(rq);
471 } 464 }
472 _osd_request_free(or); 465 _osd_request_free(or);
473} 466}
474EXPORT_SYMBOL(osd_end_request); 467EXPORT_SYMBOL(osd_end_request);
475 468
469static void _set_error_resid(struct osd_request *or, struct request *req,
470 int error)
471{
472 or->async_error = error;
473 or->req_errors = req->errors ? : error;
474 or->sense_len = req->sense_len;
475 if (or->out.req)
476 or->out.residual = or->out.req->resid_len;
477 if (or->in.req)
478 or->in.residual = or->in.req->resid_len;
479}
480
476int osd_execute_request(struct osd_request *or) 481int osd_execute_request(struct osd_request *or)
477{ 482{
478 return or->async_error = 483 int error = blk_execute_rq(or->request->q, NULL, or->request, 0);
479 blk_execute_rq(or->request->q, NULL, or->request, 0); 484
485 _set_error_resid(or, or->request, error);
486 return error;
480} 487}
481EXPORT_SYMBOL(osd_execute_request); 488EXPORT_SYMBOL(osd_execute_request);
482 489
@@ -484,15 +491,17 @@ static void osd_request_async_done(struct request *req, int error)
484{ 491{
485 struct osd_request *or = req->end_io_data; 492 struct osd_request *or = req->end_io_data;
486 493
487 or->async_error = error; 494 _set_error_resid(or, req, error);
488 495 if (req->next_rq) {
489 if (unlikely(error)) { 496 __blk_put_request(req->q, req->next_rq);
490 OSD_DEBUG("osd_request_async_done error recieved %d " 497 req->next_rq = NULL;
491 "errors 0x%x\n", error, req->errors);
492 if (!req->errors) /* don't miss out on this one */
493 req->errors = error;
494 } 498 }
495 499
500 __blk_put_request(req->q, req);
501 or->request = NULL;
502 or->in.req = NULL;
503 or->out.req = NULL;
504
496 if (or->async_done) 505 if (or->async_done)
497 or->async_done(or, or->async_private); 506 or->async_done(or, or->async_private);
498 else 507 else
@@ -1489,21 +1498,18 @@ int osd_req_decode_sense_full(struct osd_request *or,
1489#endif 1498#endif
1490 int ret; 1499 int ret;
1491 1500
1492 if (likely(!or->request->errors)) { 1501 if (likely(!or->req_errors))
1493 osi->out_resid = 0;
1494 osi->in_resid = 0;
1495 return 0; 1502 return 0;
1496 }
1497 1503
1498 osi = osi ? : &local_osi; 1504 osi = osi ? : &local_osi;
1499 memset(osi, 0, sizeof(*osi)); 1505 memset(osi, 0, sizeof(*osi));
1500 1506
1501 ssdb = or->request->sense; 1507 ssdb = (typeof(ssdb))or->sense;
1502 sense_len = or->request->sense_len; 1508 sense_len = or->sense_len;
1503 if ((sense_len < (int)sizeof(*ssdb) || !ssdb->sense_key)) { 1509 if ((sense_len < (int)sizeof(*ssdb) || !ssdb->sense_key)) {
1504 OSD_ERR("Block-layer returned error(0x%x) but " 1510 OSD_ERR("Block-layer returned error(0x%x) but "
1505 "sense_len(%u) || key(%d) is empty\n", 1511 "sense_len(%u) || key(%d) is empty\n",
1506 or->request->errors, sense_len, ssdb->sense_key); 1512 or->req_errors, sense_len, ssdb->sense_key);
1507 goto analyze; 1513 goto analyze;
1508 } 1514 }
1509 1515
@@ -1525,7 +1531,7 @@ int osd_req_decode_sense_full(struct osd_request *or,
1525 "additional_code=0x%x async_error=%d errors=0x%x\n", 1531 "additional_code=0x%x async_error=%d errors=0x%x\n",
1526 osi->key, original_sense_len, sense_len, 1532 osi->key, original_sense_len, sense_len,
1527 osi->additional_code, or->async_error, 1533 osi->additional_code, or->async_error,
1528 or->request->errors); 1534 or->req_errors);
1529 1535
1530 if (original_sense_len < sense_len) 1536 if (original_sense_len < sense_len)
1531 sense_len = original_sense_len; 1537 sense_len = original_sense_len;
@@ -1695,10 +1701,10 @@ analyze:
1695 ret = -EIO; 1701 ret = -EIO;
1696 } 1702 }
1697 1703
1698 if (or->out.req) 1704 if (!or->out.residual)
1699 osi->out_resid = or->out.req->resid_len ?: or->out.total_bytes; 1705 or->out.residual = or->out.total_bytes;
1700 if (or->in.req) 1706 if (!or->in.residual)
1701 osi->in_resid = or->in.req->resid_len ?: or->in.total_bytes; 1707 or->in.residual = or->in.total_bytes;
1702 1708
1703 return ret; 1709 return ret;
1704} 1710}
diff --git a/drivers/scsi/pm8001/pm8001_ctl.h b/drivers/scsi/pm8001/pm8001_ctl.h
index 22644de26399..63ad4aa0c422 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.h
+++ b/drivers/scsi/pm8001/pm8001_ctl.h
@@ -45,16 +45,6 @@
45#define HEADER_LEN 28 45#define HEADER_LEN 28
46#define SIZE_OFFSET 16 46#define SIZE_OFFSET 16
47 47
48struct pm8001_ioctl_payload {
49 u32 signature;
50 u16 major_function;
51 u16 minor_function;
52 u16 length;
53 u16 status;
54 u16 offset;
55 u16 id;
56 u8 func_specific[1];
57};
58 48
59#define FLASH_OK 0x000000 49#define FLASH_OK 0x000000
60#define FAIL_OPEN_BIOS_FILE 0x000100 50#define FAIL_OPEN_BIOS_FILE 0x000100
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index a3de306b9045..9b44c6f1b10e 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -373,10 +373,7 @@ static int bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue)
373static void __devinit 373static void __devinit
374mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha, u32 SSCbit) 374mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha, u32 SSCbit)
375{ 375{
376 u32 offset; 376 u32 value, offset, i;
377 u32 value;
378 u32 i, j;
379 u32 bit_cnt;
380 377
381#define SAS2_SETTINGS_LOCAL_PHY_0_3_SHIFT_ADDR 0x00030000 378#define SAS2_SETTINGS_LOCAL_PHY_0_3_SHIFT_ADDR 0x00030000
382#define SAS2_SETTINGS_LOCAL_PHY_4_7_SHIFT_ADDR 0x00040000 379#define SAS2_SETTINGS_LOCAL_PHY_4_7_SHIFT_ADDR 0x00040000
@@ -392,55 +389,35 @@ mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha, u32 SSCbit)
392 */ 389 */
393 if (-1 == bar4_shift(pm8001_ha, SAS2_SETTINGS_LOCAL_PHY_0_3_SHIFT_ADDR)) 390 if (-1 == bar4_shift(pm8001_ha, SAS2_SETTINGS_LOCAL_PHY_0_3_SHIFT_ADDR))
394 return; 391 return;
395 /* set SSC bit of PHY 0 - 3 */ 392
396 for (i = 0; i < 4; i++) { 393 for (i = 0; i < 4; i++) {
397 offset = SAS2_SETTINGS_LOCAL_PHY_0_3_OFFSET + 0x4000 * i; 394 offset = SAS2_SETTINGS_LOCAL_PHY_0_3_OFFSET + 0x4000 * i;
398 value = pm8001_cr32(pm8001_ha, 2, offset); 395 pm8001_cw32(pm8001_ha, 2, offset, 0x80001501);
399 if (SSCbit) {
400 value |= 0x00000001 << PHY_G3_WITH_SSC_BIT_SHIFT;
401 value &= ~(0x00000001 << PHY_G3_WITHOUT_SSC_BIT_SHIFT);
402 } else {
403 value |= 0x00000001 << PHY_G3_WITHOUT_SSC_BIT_SHIFT;
404 value &= ~(0x00000001 << PHY_G3_WITH_SSC_BIT_SHIFT);
405 }
406 bit_cnt = 0;
407 for (j = 0; j < 31; j++)
408 if ((value >> j) & 0x00000001)
409 bit_cnt++;
410 if (bit_cnt % 2)
411 value &= ~(0x00000001 << SNW3_PHY_CAPABILITIES_PARITY);
412 else
413 value |= 0x00000001 << SNW3_PHY_CAPABILITIES_PARITY;
414
415 pm8001_cw32(pm8001_ha, 2, offset, value);
416 } 396 }
417
418 /* shift membase 3 for SAS2_SETTINGS_LOCAL_PHY 4 - 7 */ 397 /* shift membase 3 for SAS2_SETTINGS_LOCAL_PHY 4 - 7 */
419 if (-1 == bar4_shift(pm8001_ha, SAS2_SETTINGS_LOCAL_PHY_4_7_SHIFT_ADDR)) 398 if (-1 == bar4_shift(pm8001_ha, SAS2_SETTINGS_LOCAL_PHY_4_7_SHIFT_ADDR))
420 return; 399 return;
421
422 /* set SSC bit of PHY 4 - 7 */
423 for (i = 4; i < 8; i++) { 400 for (i = 4; i < 8; i++) {
424 offset = SAS2_SETTINGS_LOCAL_PHY_4_7_OFFSET + 0x4000 * (i-4); 401 offset = SAS2_SETTINGS_LOCAL_PHY_4_7_OFFSET + 0x4000 * (i-4);
425 value = pm8001_cr32(pm8001_ha, 2, offset); 402 pm8001_cw32(pm8001_ha, 2, offset, 0x80001501);
426 if (SSCbit) {
427 value |= 0x00000001 << PHY_G3_WITH_SSC_BIT_SHIFT;
428 value &= ~(0x00000001 << PHY_G3_WITHOUT_SSC_BIT_SHIFT);
429 } else {
430 value |= 0x00000001 << PHY_G3_WITHOUT_SSC_BIT_SHIFT;
431 value &= ~(0x00000001 << PHY_G3_WITH_SSC_BIT_SHIFT);
432 }
433 bit_cnt = 0;
434 for (j = 0; j < 31; j++)
435 if ((value >> j) & 0x00000001)
436 bit_cnt++;
437 if (bit_cnt % 2)
438 value &= ~(0x00000001 << SNW3_PHY_CAPABILITIES_PARITY);
439 else
440 value |= 0x00000001 << SNW3_PHY_CAPABILITIES_PARITY;
441
442 pm8001_cw32(pm8001_ha, 2, offset, value);
443 } 403 }
404 /*************************************************************
405 Change the SSC upspreading value to 0x0 so that upspreading is disabled.
406 Device MABC SMOD0 Controls
407 Address: (via MEMBASE-III):
408 Using shifted destination address 0x0_0000: with Offset 0xD8
409
410 31:28 R/W Reserved Do not change
411 27:24 R/W SAS_SMOD_SPRDUP 0000
412 23:20 R/W SAS_SMOD_SPRDDN 0000
413 19:0 R/W Reserved Do not change
414 Upon power-up this register will read as 0x8990c016,
415 and I would like you to change the SAS_SMOD_SPRDUP bits to 0b0000
416 so that the written value will be 0x8090c016.
417 This will ensure only down-spreading SSC is enabled on the SPC.
418 *************************************************************/
419 value = pm8001_cr32(pm8001_ha, 2, 0xd8);
420 pm8001_cw32(pm8001_ha, 2, 0xd8, 0x8000C016);
444 421
445 /*set the shifted destination address to 0x0 to avoid error operation */ 422 /*set the shifted destination address to 0x0 to avoid error operation */
446 bar4_shift(pm8001_ha, 0x0); 423 bar4_shift(pm8001_ha, 0x0);
@@ -1901,7 +1878,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
1901{ 1878{
1902 struct sas_task *t; 1879 struct sas_task *t;
1903 struct pm8001_ccb_info *ccb; 1880 struct pm8001_ccb_info *ccb;
1904 unsigned long flags; 1881 unsigned long flags = 0;
1905 u32 param; 1882 u32 param;
1906 u32 status; 1883 u32 status;
1907 u32 tag; 1884 u32 tag;
@@ -2040,7 +2017,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2040 ts->stat = SAS_QUEUE_FULL; 2017 ts->stat = SAS_QUEUE_FULL;
2041 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2018 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2042 mb();/*in order to force CPU ordering*/ 2019 mb();/*in order to force CPU ordering*/
2020 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2043 t->task_done(t); 2021 t->task_done(t);
2022 spin_lock_irqsave(&pm8001_ha->lock, flags);
2044 return; 2023 return;
2045 } 2024 }
2046 break; 2025 break;
@@ -2058,7 +2037,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2058 ts->stat = SAS_QUEUE_FULL; 2037 ts->stat = SAS_QUEUE_FULL;
2059 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2038 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2060 mb();/*ditto*/ 2039 mb();/*ditto*/
2040 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2061 t->task_done(t); 2041 t->task_done(t);
2042 spin_lock_irqsave(&pm8001_ha->lock, flags);
2062 return; 2043 return;
2063 } 2044 }
2064 break; 2045 break;
@@ -2084,7 +2065,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2084 ts->stat = SAS_QUEUE_FULL; 2065 ts->stat = SAS_QUEUE_FULL;
2085 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2066 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2086 mb();/* ditto*/ 2067 mb();/* ditto*/
2068 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2087 t->task_done(t); 2069 t->task_done(t);
2070 spin_lock_irqsave(&pm8001_ha->lock, flags);
2088 return; 2071 return;
2089 } 2072 }
2090 break; 2073 break;
@@ -2149,7 +2132,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2149 ts->stat = SAS_QUEUE_FULL; 2132 ts->stat = SAS_QUEUE_FULL;
2150 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2133 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2151 mb();/*ditto*/ 2134 mb();/*ditto*/
2135 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2152 t->task_done(t); 2136 t->task_done(t);
2137 spin_lock_irqsave(&pm8001_ha->lock, flags);
2153 return; 2138 return;
2154 } 2139 }
2155 break; 2140 break;
@@ -2171,7 +2156,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2171 ts->stat = SAS_QUEUE_FULL; 2156 ts->stat = SAS_QUEUE_FULL;
2172 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2157 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2173 mb();/*ditto*/ 2158 mb();/*ditto*/
2159 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2174 t->task_done(t); 2160 t->task_done(t);
2161 spin_lock_irqsave(&pm8001_ha->lock, flags);
2175 return; 2162 return;
2176 } 2163 }
2177 break; 2164 break;
@@ -2200,11 +2187,20 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2200 " resp 0x%x stat 0x%x but aborted by upper layer!\n", 2187 " resp 0x%x stat 0x%x but aborted by upper layer!\n",
2201 t, status, ts->resp, ts->stat)); 2188 t, status, ts->resp, ts->stat));
2202 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2189 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2203 } else { 2190 } else if (t->uldd_task) {
2204 spin_unlock_irqrestore(&t->task_state_lock, flags); 2191 spin_unlock_irqrestore(&t->task_state_lock, flags);
2205 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2192 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2206 mb();/* ditto */ 2193 mb();/* ditto */
2194 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2207 t->task_done(t); 2195 t->task_done(t);
2196 spin_lock_irqsave(&pm8001_ha->lock, flags);
2197 } else if (!t->uldd_task) {
2198 spin_unlock_irqrestore(&t->task_state_lock, flags);
2199 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2200 mb();/*ditto*/
2201 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2202 t->task_done(t);
2203 spin_lock_irqsave(&pm8001_ha->lock, flags);
2208 } 2204 }
2209} 2205}
2210 2206
@@ -2212,7 +2208,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2212static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) 2208static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
2213{ 2209{
2214 struct sas_task *t; 2210 struct sas_task *t;
2215 unsigned long flags; 2211 unsigned long flags = 0;
2216 struct task_status_struct *ts; 2212 struct task_status_struct *ts;
2217 struct pm8001_ccb_info *ccb; 2213 struct pm8001_ccb_info *ccb;
2218 struct pm8001_device *pm8001_dev; 2214 struct pm8001_device *pm8001_dev;
@@ -2292,7 +2288,9 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
2292 ts->stat = SAS_QUEUE_FULL; 2288 ts->stat = SAS_QUEUE_FULL;
2293 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2289 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2294 mb();/*ditto*/ 2290 mb();/*ditto*/
2291 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2295 t->task_done(t); 2292 t->task_done(t);
2293 spin_lock_irqsave(&pm8001_ha->lock, flags);
2296 return; 2294 return;
2297 } 2295 }
2298 break; 2296 break;
@@ -2401,11 +2399,20 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
2401 " resp 0x%x stat 0x%x but aborted by upper layer!\n", 2399 " resp 0x%x stat 0x%x but aborted by upper layer!\n",
2402 t, event, ts->resp, ts->stat)); 2400 t, event, ts->resp, ts->stat));
2403 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2401 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2404 } else { 2402 } else if (t->uldd_task) {
2405 spin_unlock_irqrestore(&t->task_state_lock, flags); 2403 spin_unlock_irqrestore(&t->task_state_lock, flags);
2406 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); 2404 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2407 mb();/* in order to force CPU ordering */ 2405 mb();/* ditto */
2406 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2408 t->task_done(t); 2407 t->task_done(t);
2408 spin_lock_irqsave(&pm8001_ha->lock, flags);
2409 } else if (!t->uldd_task) {
2410 spin_unlock_irqrestore(&t->task_state_lock, flags);
2411 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2412 mb();/*ditto*/
2413 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
2414 t->task_done(t);
2415 spin_lock_irqsave(&pm8001_ha->lock, flags);
2409 } 2416 }
2410} 2417}
2411 2418
@@ -2876,15 +2883,20 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
2876 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); 2883 le32_to_cpu(pPayload->lr_evt_status_phyid_portid);
2877 u8 link_rate = 2884 u8 link_rate =
2878 (u8)((lr_evt_status_phyid_portid & 0xF0000000) >> 28); 2885 (u8)((lr_evt_status_phyid_portid & 0xF0000000) >> 28);
2886 u8 port_id = (u8)(lr_evt_status_phyid_portid & 0x0000000F);
2879 u8 phy_id = 2887 u8 phy_id =
2880 (u8)((lr_evt_status_phyid_portid & 0x000000F0) >> 4); 2888 (u8)((lr_evt_status_phyid_portid & 0x000000F0) >> 4);
2889 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate);
2890 u8 portstate = (u8)(npip_portstate & 0x0000000F);
2891 struct pm8001_port *port = &pm8001_ha->port[port_id];
2881 struct sas_ha_struct *sas_ha = pm8001_ha->sas; 2892 struct sas_ha_struct *sas_ha = pm8001_ha->sas;
2882 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; 2893 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
2883 unsigned long flags; 2894 unsigned long flags;
2884 u8 deviceType = pPayload->sas_identify.dev_type; 2895 u8 deviceType = pPayload->sas_identify.dev_type;
2885 2896 port->port_state = portstate;
2886 PM8001_MSG_DBG(pm8001_ha, 2897 PM8001_MSG_DBG(pm8001_ha,
2887 pm8001_printk("HW_EVENT_SAS_PHY_UP \n")); 2898 pm8001_printk("HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n",
2899 port_id, phy_id));
2888 2900
2889 switch (deviceType) { 2901 switch (deviceType) {
2890 case SAS_PHY_UNUSED: 2902 case SAS_PHY_UNUSED:
@@ -2895,16 +2907,19 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
2895 PM8001_MSG_DBG(pm8001_ha, pm8001_printk("end device.\n")); 2907 PM8001_MSG_DBG(pm8001_ha, pm8001_printk("end device.\n"));
2896 pm8001_chip_phy_ctl_req(pm8001_ha, phy_id, 2908 pm8001_chip_phy_ctl_req(pm8001_ha, phy_id,
2897 PHY_NOTIFY_ENABLE_SPINUP); 2909 PHY_NOTIFY_ENABLE_SPINUP);
2910 port->port_attached = 1;
2898 get_lrate_mode(phy, link_rate); 2911 get_lrate_mode(phy, link_rate);
2899 break; 2912 break;
2900 case SAS_EDGE_EXPANDER_DEVICE: 2913 case SAS_EDGE_EXPANDER_DEVICE:
2901 PM8001_MSG_DBG(pm8001_ha, 2914 PM8001_MSG_DBG(pm8001_ha,
2902 pm8001_printk("expander device.\n")); 2915 pm8001_printk("expander device.\n"));
2916 port->port_attached = 1;
2903 get_lrate_mode(phy, link_rate); 2917 get_lrate_mode(phy, link_rate);
2904 break; 2918 break;
2905 case SAS_FANOUT_EXPANDER_DEVICE: 2919 case SAS_FANOUT_EXPANDER_DEVICE:
2906 PM8001_MSG_DBG(pm8001_ha, 2920 PM8001_MSG_DBG(pm8001_ha,
2907 pm8001_printk("fanout expander device.\n")); 2921 pm8001_printk("fanout expander device.\n"));
2922 port->port_attached = 1;
2908 get_lrate_mode(phy, link_rate); 2923 get_lrate_mode(phy, link_rate);
2909 break; 2924 break;
2910 default: 2925 default:
@@ -2946,11 +2961,20 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb)
2946 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); 2961 le32_to_cpu(pPayload->lr_evt_status_phyid_portid);
2947 u8 link_rate = 2962 u8 link_rate =
2948 (u8)((lr_evt_status_phyid_portid & 0xF0000000) >> 28); 2963 (u8)((lr_evt_status_phyid_portid & 0xF0000000) >> 28);
2964 u8 port_id = (u8)(lr_evt_status_phyid_portid & 0x0000000F);
2949 u8 phy_id = 2965 u8 phy_id =
2950 (u8)((lr_evt_status_phyid_portid & 0x000000F0) >> 4); 2966 (u8)((lr_evt_status_phyid_portid & 0x000000F0) >> 4);
2967 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate);
2968 u8 portstate = (u8)(npip_portstate & 0x0000000F);
2969 struct pm8001_port *port = &pm8001_ha->port[port_id];
2951 struct sas_ha_struct *sas_ha = pm8001_ha->sas; 2970 struct sas_ha_struct *sas_ha = pm8001_ha->sas;
2952 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; 2971 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
2953 unsigned long flags; 2972 unsigned long flags;
2973 PM8001_MSG_DBG(pm8001_ha,
2974 pm8001_printk("HW_EVENT_SATA_PHY_UP port id = %d,"
2975 " phy id = %d\n", port_id, phy_id));
2976 port->port_state = portstate;
2977 port->port_attached = 1;
2954 get_lrate_mode(phy, link_rate); 2978 get_lrate_mode(phy, link_rate);
2955 phy->phy_type |= PORT_TYPE_SATA; 2979 phy->phy_type |= PORT_TYPE_SATA;
2956 phy->phy_attached = 1; 2980 phy->phy_attached = 1;
@@ -2984,7 +3008,13 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
2984 (u8)((lr_evt_status_phyid_portid & 0x000000F0) >> 4); 3008 (u8)((lr_evt_status_phyid_portid & 0x000000F0) >> 4);
2985 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); 3009 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate);
2986 u8 portstate = (u8)(npip_portstate & 0x0000000F); 3010 u8 portstate = (u8)(npip_portstate & 0x0000000F);
2987 3011 struct pm8001_port *port = &pm8001_ha->port[port_id];
3012 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
3013 port->port_state = portstate;
3014 phy->phy_type = 0;
3015 phy->identify.device_type = 0;
3016 phy->phy_attached = 0;
3017 memset(&phy->dev_sas_addr, 0, SAS_ADDR_SIZE);
2988 switch (portstate) { 3018 switch (portstate) {
2989 case PORT_VALID: 3019 case PORT_VALID:
2990 break; 3020 break;
@@ -2993,26 +3023,30 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb)
2993 pm8001_printk(" PortInvalid portID %d \n", port_id)); 3023 pm8001_printk(" PortInvalid portID %d \n", port_id));
2994 PM8001_MSG_DBG(pm8001_ha, 3024 PM8001_MSG_DBG(pm8001_ha,
2995 pm8001_printk(" Last phy Down and port invalid\n")); 3025 pm8001_printk(" Last phy Down and port invalid\n"));
3026 port->port_attached = 0;
2996 pm8001_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN, 3027 pm8001_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
2997 port_id, phy_id, 0, 0); 3028 port_id, phy_id, 0, 0);
2998 break; 3029 break;
2999 case PORT_IN_RESET: 3030 case PORT_IN_RESET:
3000 PM8001_MSG_DBG(pm8001_ha, 3031 PM8001_MSG_DBG(pm8001_ha,
3001 pm8001_printk(" PortInReset portID %d \n", port_id)); 3032 pm8001_printk(" Port In Reset portID %d \n", port_id));
3002 break; 3033 break;
3003 case PORT_NOT_ESTABLISHED: 3034 case PORT_NOT_ESTABLISHED:
3004 PM8001_MSG_DBG(pm8001_ha, 3035 PM8001_MSG_DBG(pm8001_ha,
3005 pm8001_printk(" phy Down and PORT_NOT_ESTABLISHED\n")); 3036 pm8001_printk(" phy Down and PORT_NOT_ESTABLISHED\n"));
3037 port->port_attached = 0;
3006 break; 3038 break;
3007 case PORT_LOSTCOMM: 3039 case PORT_LOSTCOMM:
3008 PM8001_MSG_DBG(pm8001_ha, 3040 PM8001_MSG_DBG(pm8001_ha,
3009 pm8001_printk(" phy Down and PORT_LOSTCOMM\n")); 3041 pm8001_printk(" phy Down and PORT_LOSTCOMM\n"));
3010 PM8001_MSG_DBG(pm8001_ha, 3042 PM8001_MSG_DBG(pm8001_ha,
3011 pm8001_printk(" Last phy Down and port invalid\n")); 3043 pm8001_printk(" Last phy Down and port invalid\n"));
3044 port->port_attached = 0;
3012 pm8001_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN, 3045 pm8001_hw_event_ack_req(pm8001_ha, 0, HW_EVENT_PHY_DOWN,
3013 port_id, phy_id, 0, 0); 3046 port_id, phy_id, 0, 0);
3014 break; 3047 break;
3015 default: 3048 default:
3049 port->port_attached = 0;
3016 PM8001_MSG_DBG(pm8001_ha, 3050 PM8001_MSG_DBG(pm8001_ha,
3017 pm8001_printk(" phy Down and(default) = %x\n", 3051 pm8001_printk(" phy Down and(default) = %x\n",
3018 portstate)); 3052 portstate));
@@ -3770,7 +3804,8 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,
3770 u32 opc = OPC_INB_SSPINIIOSTART; 3804 u32 opc = OPC_INB_SSPINIIOSTART;
3771 memset(&ssp_cmd, 0, sizeof(ssp_cmd)); 3805 memset(&ssp_cmd, 0, sizeof(ssp_cmd));
3772 memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); 3806 memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8);
3773 ssp_cmd.dir_m_tlr = data_dir_flags[task->data_dir] << 8 | 0x0;/*0 for 3807 ssp_cmd.dir_m_tlr =
3808 cpu_to_le32(data_dir_flags[task->data_dir] << 8 | 0x0);/*0 for
3774 SAS 1.1 compatible TLR*/ 3809 SAS 1.1 compatible TLR*/
3775 ssp_cmd.data_len = cpu_to_le32(task->total_xfer_len); 3810 ssp_cmd.data_len = cpu_to_le32(task->total_xfer_len);
3776 ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id); 3811 ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id);
@@ -3841,7 +3876,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,
3841 } 3876 }
3842 } 3877 }
3843 if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) 3878 if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag))
3844 ncg_tag = cpu_to_le32(hdr_tag); 3879 ncg_tag = hdr_tag;
3845 dir = data_dir_flags[task->data_dir] << 8; 3880 dir = data_dir_flags[task->data_dir] << 8;
3846 sata_cmd.tag = cpu_to_le32(tag); 3881 sata_cmd.tag = cpu_to_le32(tag);
3847 sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); 3882 sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
@@ -3986,7 +4021,7 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
3986 ((stp_sspsmp_sata & 0x03) * 0x10000000)); 4021 ((stp_sspsmp_sata & 0x03) * 0x10000000));
3987 payload.firstburstsize_ITNexustimeout = 4022 payload.firstburstsize_ITNexustimeout =
3988 cpu_to_le32(ITNT | (firstBurstSize * 0x10000)); 4023 cpu_to_le32(ITNT | (firstBurstSize * 0x10000));
3989 memcpy(&payload.sas_addr_hi, pm8001_dev->sas_device->sas_addr, 4024 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr,
3990 SAS_ADDR_SIZE); 4025 SAS_ADDR_SIZE);
3991 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); 4026 rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload);
3992 return rc; 4027 return rc;
@@ -4027,7 +4062,7 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha,
4027 struct inbound_queue_table *circularQ; 4062 struct inbound_queue_table *circularQ;
4028 int ret; 4063 int ret;
4029 u32 opc = OPC_INB_LOCAL_PHY_CONTROL; 4064 u32 opc = OPC_INB_LOCAL_PHY_CONTROL;
4030 memset((u8 *)&payload, 0, sizeof(payload)); 4065 memset(&payload, 0, sizeof(payload));
4031 circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4066 circularQ = &pm8001_ha->inbnd_q_tbl[0];
4032 payload.tag = 1; 4067 payload.tag = 1;
4033 payload.phyop_phyid = 4068 payload.phyop_phyid =
diff --git a/drivers/scsi/pm8001/pm8001_hwi.h b/drivers/scsi/pm8001/pm8001_hwi.h
index 96e4daa68b8f..833a5201eda4 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.h
+++ b/drivers/scsi/pm8001/pm8001_hwi.h
@@ -242,8 +242,7 @@ struct reg_dev_req {
242 __le32 phyid_portid; 242 __le32 phyid_portid;
243 __le32 dtype_dlr_retry; 243 __le32 dtype_dlr_retry;
244 __le32 firstburstsize_ITNexustimeout; 244 __le32 firstburstsize_ITNexustimeout;
245 u32 sas_addr_hi; 245 u8 sas_addr[SAS_ADDR_SIZE];
246 u32 sas_addr_low;
247 __le32 upper_device_id; 246 __le32 upper_device_id;
248 u32 reserved[8]; 247 u32 reserved[8];
249} __attribute__((packed, aligned(4))); 248} __attribute__((packed, aligned(4)));
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 42ebe725d5a5..c2f1032496cb 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -200,8 +200,13 @@ static int __devinit pm8001_alloc(struct pm8001_hba_info *pm8001_ha)
200{ 200{
201 int i; 201 int i;
202 spin_lock_init(&pm8001_ha->lock); 202 spin_lock_init(&pm8001_ha->lock);
203 for (i = 0; i < pm8001_ha->chip->n_phy; i++) 203 for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
204 pm8001_phy_init(pm8001_ha, i); 204 pm8001_phy_init(pm8001_ha, i);
205 pm8001_ha->port[i].wide_port_phymap = 0;
206 pm8001_ha->port[i].port_attached = 0;
207 pm8001_ha->port[i].port_state = 0;
208 INIT_LIST_HEAD(&pm8001_ha->port[i].list);
209 }
205 210
206 pm8001_ha->tags = kzalloc(PM8001_MAX_CCB, GFP_KERNEL); 211 pm8001_ha->tags = kzalloc(PM8001_MAX_CCB, GFP_KERNEL);
207 if (!pm8001_ha->tags) 212 if (!pm8001_ha->tags)
@@ -511,19 +516,23 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
511 u8 i; 516 u8 i;
512#ifdef PM8001_READ_VPD 517#ifdef PM8001_READ_VPD
513 DECLARE_COMPLETION_ONSTACK(completion); 518 DECLARE_COMPLETION_ONSTACK(completion);
519 struct pm8001_ioctl_payload payload;
514 pm8001_ha->nvmd_completion = &completion; 520 pm8001_ha->nvmd_completion = &completion;
515 PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, 0, 0); 521 payload.minor_function = 0;
522 payload.length = 128;
523 payload.func_specific = kzalloc(128, GFP_KERNEL);
524 PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
516 wait_for_completion(&completion); 525 wait_for_completion(&completion);
517 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { 526 for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
518 memcpy(&pm8001_ha->phy[i].dev_sas_addr, pm8001_ha->sas_addr, 527 memcpy(&pm8001_ha->phy[i].dev_sas_addr, pm8001_ha->sas_addr,
519 SAS_ADDR_SIZE); 528 SAS_ADDR_SIZE);
520 PM8001_INIT_DBG(pm8001_ha, 529 PM8001_INIT_DBG(pm8001_ha,
521 pm8001_printk("phy %d sas_addr = %x \n", i, 530 pm8001_printk("phy %d sas_addr = %016llx \n", i,
522 (u64)pm8001_ha->phy[i].dev_sas_addr)); 531 pm8001_ha->phy[i].dev_sas_addr));
523 } 532 }
524#else 533#else
525 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { 534 for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
526 pm8001_ha->phy[i].dev_sas_addr = 0x500e004010000004ULL; 535 pm8001_ha->phy[i].dev_sas_addr = 0x50010c600047f9d0ULL;
527 pm8001_ha->phy[i].dev_sas_addr = 536 pm8001_ha->phy[i].dev_sas_addr =
528 cpu_to_be64((u64) 537 cpu_to_be64((u64)
529 (*(u64 *)&pm8001_ha->phy[i].dev_sas_addr)); 538 (*(u64 *)&pm8001_ha->phy[i].dev_sas_addr));
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 1f767a0e727a..7f9c83a76390 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -329,6 +329,23 @@ int pm8001_slave_configure(struct scsi_device *sdev)
329 } 329 }
330 return 0; 330 return 0;
331} 331}
332 /* Find the local port id that's attached to this device */
333static int sas_find_local_port_id(struct domain_device *dev)
334{
335 struct domain_device *pdev = dev->parent;
336
337 /* Directly attached device */
338 if (!pdev)
339 return dev->port->id;
340 while (pdev) {
341 struct domain_device *pdev_p = pdev->parent;
342 if (!pdev_p)
343 return pdev->port->id;
344 pdev = pdev->parent;
345 }
346 return 0;
347}
348
332/** 349/**
333 * pm8001_task_exec - queue the task(ssp, smp && ata) to the hardware. 350 * pm8001_task_exec - queue the task(ssp, smp && ata) to the hardware.
334 * @task: the task to be execute. 351 * @task: the task to be execute.
@@ -346,11 +363,12 @@ static int pm8001_task_exec(struct sas_task *task, const int num,
346 struct domain_device *dev = task->dev; 363 struct domain_device *dev = task->dev;
347 struct pm8001_hba_info *pm8001_ha; 364 struct pm8001_hba_info *pm8001_ha;
348 struct pm8001_device *pm8001_dev; 365 struct pm8001_device *pm8001_dev;
366 struct pm8001_port *port = NULL;
349 struct sas_task *t = task; 367 struct sas_task *t = task;
350 struct pm8001_ccb_info *ccb; 368 struct pm8001_ccb_info *ccb;
351 u32 tag = 0xdeadbeef, rc, n_elem = 0; 369 u32 tag = 0xdeadbeef, rc, n_elem = 0;
352 u32 n = num; 370 u32 n = num;
353 unsigned long flags = 0; 371 unsigned long flags = 0, flags_libsas = 0;
354 372
355 if (!dev->port) { 373 if (!dev->port) {
356 struct task_status_struct *tsm = &t->task_status; 374 struct task_status_struct *tsm = &t->task_status;
@@ -379,6 +397,35 @@ static int pm8001_task_exec(struct sas_task *task, const int num,
379 rc = SAS_PHY_DOWN; 397 rc = SAS_PHY_DOWN;
380 goto out_done; 398 goto out_done;
381 } 399 }
400 port = &pm8001_ha->port[sas_find_local_port_id(dev)];
401 if (!port->port_attached) {
402 if (sas_protocol_ata(t->task_proto)) {
403 struct task_status_struct *ts = &t->task_status;
404 ts->resp = SAS_TASK_UNDELIVERED;
405 ts->stat = SAS_PHY_DOWN;
406
407 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
408 spin_unlock_irqrestore(dev->sata_dev.ap->lock,
409 flags_libsas);
410 t->task_done(t);
411 spin_lock_irqsave(dev->sata_dev.ap->lock,
412 flags_libsas);
413 spin_lock_irqsave(&pm8001_ha->lock, flags);
414 if (n > 1)
415 t = list_entry(t->list.next,
416 struct sas_task, list);
417 continue;
418 } else {
419 struct task_status_struct *ts = &t->task_status;
420 ts->resp = SAS_TASK_UNDELIVERED;
421 ts->stat = SAS_PHY_DOWN;
422 t->task_done(t);
423 if (n > 1)
424 t = list_entry(t->list.next,
425 struct sas_task, list);
426 continue;
427 }
428 }
382 rc = pm8001_tag_alloc(pm8001_ha, &tag); 429 rc = pm8001_tag_alloc(pm8001_ha, &tag);
383 if (rc) 430 if (rc)
384 goto err_out; 431 goto err_out;
@@ -569,11 +616,11 @@ static int pm8001_dev_found_notify(struct domain_device *dev)
569 spin_lock_irqsave(&pm8001_ha->lock, flags); 616 spin_lock_irqsave(&pm8001_ha->lock, flags);
570 617
571 pm8001_device = pm8001_alloc_dev(pm8001_ha); 618 pm8001_device = pm8001_alloc_dev(pm8001_ha);
572 pm8001_device->sas_device = dev;
573 if (!pm8001_device) { 619 if (!pm8001_device) {
574 res = -1; 620 res = -1;
575 goto found_out; 621 goto found_out;
576 } 622 }
623 pm8001_device->sas_device = dev;
577 dev->lldd_dev = pm8001_device; 624 dev->lldd_dev = pm8001_device;
578 pm8001_device->dev_type = dev->dev_type; 625 pm8001_device->dev_type = dev->dev_type;
579 pm8001_device->dcompletion = &completion; 626 pm8001_device->dcompletion = &completion;
@@ -609,7 +656,7 @@ static int pm8001_dev_found_notify(struct domain_device *dev)
609 wait_for_completion(&completion); 656 wait_for_completion(&completion);
610 if (dev->dev_type == SAS_END_DEV) 657 if (dev->dev_type == SAS_END_DEV)
611 msleep(50); 658 msleep(50);
612 pm8001_ha->flags = PM8001F_RUN_TIME ; 659 pm8001_ha->flags |= PM8001F_RUN_TIME ;
613 return 0; 660 return 0;
614found_out: 661found_out:
615 spin_unlock_irqrestore(&pm8001_ha->lock, flags); 662 spin_unlock_irqrestore(&pm8001_ha->lock, flags);
@@ -772,7 +819,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
772 task->task_done = pm8001_task_done; 819 task->task_done = pm8001_task_done;
773 task->timer.data = (unsigned long)task; 820 task->timer.data = (unsigned long)task;
774 task->timer.function = pm8001_tmf_timedout; 821 task->timer.function = pm8001_tmf_timedout;
775 task->timer.expires = jiffies + PM8001_TASK_TIMEOUT*HZ; 822 task->timer.expires = jiffies + PM8001_TASK_TIMEOUT * HZ;
776 add_timer(&task->timer); 823 add_timer(&task->timer);
777 824
778 res = pm8001_tag_alloc(pm8001_ha, &ccb_tag); 825 res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
@@ -897,6 +944,8 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
897 944
898 if (dev_is_sata(dev)) { 945 if (dev_is_sata(dev)) {
899 DECLARE_COMPLETION_ONSTACK(completion_setstate); 946 DECLARE_COMPLETION_ONSTACK(completion_setstate);
947 if (scsi_is_sas_phy_local(phy))
948 return 0;
900 rc = sas_phy_reset(phy, 1); 949 rc = sas_phy_reset(phy, 1);
901 msleep(2000); 950 msleep(2000);
902 rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , 951 rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index 30f2ede55a75..8e38ca8cd101 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -59,11 +59,11 @@
59 59
60#define DRV_NAME "pm8001" 60#define DRV_NAME "pm8001"
61#define DRV_VERSION "0.1.36" 61#define DRV_VERSION "0.1.36"
62#define PM8001_FAIL_LOGGING 0x01 /* libsas EH function logging */ 62#define PM8001_FAIL_LOGGING 0x01 /* Error message logging */
63#define PM8001_INIT_LOGGING 0x02 /* driver init logging */ 63#define PM8001_INIT_LOGGING 0x02 /* driver init logging */
64#define PM8001_DISC_LOGGING 0x04 /* discovery layer logging */ 64#define PM8001_DISC_LOGGING 0x04 /* discovery layer logging */
65#define PM8001_IO_LOGGING 0x08 /* I/O path logging */ 65#define PM8001_IO_LOGGING 0x08 /* I/O path logging */
66#define PM8001_EH_LOGGING 0x10 /* Error message logging */ 66#define PM8001_EH_LOGGING 0x10 /* libsas EH function logging*/
67#define PM8001_IOCTL_LOGGING 0x20 /* IOCTL message logging */ 67#define PM8001_IOCTL_LOGGING 0x20 /* IOCTL message logging */
68#define PM8001_MSG_LOGGING 0x40 /* misc message logging */ 68#define PM8001_MSG_LOGGING 0x40 /* misc message logging */
69#define pm8001_printk(format, arg...) printk(KERN_INFO "%s %d:" format,\ 69#define pm8001_printk(format, arg...) printk(KERN_INFO "%s %d:" format,\
@@ -100,6 +100,7 @@ do { \
100 100
101#define PM8001_USE_TASKLET 101#define PM8001_USE_TASKLET
102#define PM8001_USE_MSIX 102#define PM8001_USE_MSIX
103#define PM8001_READ_VPD
103 104
104 105
105#define DEV_IS_EXPANDER(type) ((type == EDGE_DEV) || (type == FANOUT_DEV)) 106#define DEV_IS_EXPANDER(type) ((type == EDGE_DEV) || (type == FANOUT_DEV))
@@ -111,7 +112,22 @@ extern const struct pm8001_dispatch pm8001_8001_dispatch;
111struct pm8001_hba_info; 112struct pm8001_hba_info;
112struct pm8001_ccb_info; 113struct pm8001_ccb_info;
113struct pm8001_device; 114struct pm8001_device;
114struct pm8001_tmf_task; 115/* define task management IU */
116struct pm8001_tmf_task {
117 u8 tmf;
118 u32 tag_of_task_to_be_managed;
119};
120struct pm8001_ioctl_payload {
121 u32 signature;
122 u16 major_function;
123 u16 minor_function;
124 u16 length;
125 u16 status;
126 u16 offset;
127 u16 id;
128 u8 *func_specific;
129};
130
115struct pm8001_dispatch { 131struct pm8001_dispatch {
116 char *name; 132 char *name;
117 int (*chip_init)(struct pm8001_hba_info *pm8001_ha); 133 int (*chip_init)(struct pm8001_hba_info *pm8001_ha);
@@ -164,6 +180,10 @@ struct pm8001_chip_info {
164 180
165struct pm8001_port { 181struct pm8001_port {
166 struct asd_sas_port sas_port; 182 struct asd_sas_port sas_port;
183 u8 port_attached;
184 u8 wide_port_phymap;
185 u8 port_state;
186 struct list_head list;
167}; 187};
168 188
169struct pm8001_phy { 189struct pm8001_phy {
@@ -386,11 +406,7 @@ struct pm8001_fw_image_header {
386 __be32 startup_entry; 406 __be32 startup_entry;
387} __attribute__((packed, aligned(4))); 407} __attribute__((packed, aligned(4)));
388 408
389/* define task management IU */ 409
390struct pm8001_tmf_task {
391 u8 tmf;
392 u32 tag_of_task_to_be_managed;
393};
394/** 410/**
395 * FW Flash Update status values 411 * FW Flash Update status values
396 */ 412 */
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 34c6b896a91b..b6f1ef954af1 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * pmcraid.c -- driver for PMC Sierra MaxRAID controller adapters 2 * pmcraid.c -- driver for PMC Sierra MaxRAID controller adapters
3 * 3 *
4 * Written By: PMC Sierra Corporation 4 * Written By: Anil Ravindranath<anil_ravindranath@pmc-sierra.com>
5 * PMC-Sierra Inc
5 * 6 *
6 * Copyright (C) 2008, 2009 PMC Sierra Inc 7 * Copyright (C) 2008, 2009 PMC Sierra Inc
7 * 8 *
@@ -79,7 +80,7 @@ DECLARE_BITMAP(pmcraid_minor, PMCRAID_MAX_ADAPTERS);
79/* 80/*
80 * Module parameters 81 * Module parameters
81 */ 82 */
82MODULE_AUTHOR("PMC Sierra Corporation, anil_ravindranath@pmc-sierra.com"); 83MODULE_AUTHOR("Anil Ravindranath<anil_ravindranath@pmc-sierra.com>");
83MODULE_DESCRIPTION("PMC Sierra MaxRAID Controller Driver"); 84MODULE_DESCRIPTION("PMC Sierra MaxRAID Controller Driver");
84MODULE_LICENSE("GPL"); 85MODULE_LICENSE("GPL");
85MODULE_VERSION(PMCRAID_DRIVER_VERSION); 86MODULE_VERSION(PMCRAID_DRIVER_VERSION);
@@ -162,10 +163,10 @@ static int pmcraid_slave_alloc(struct scsi_device *scsi_dev)
162 spin_lock_irqsave(&pinstance->resource_lock, lock_flags); 163 spin_lock_irqsave(&pinstance->resource_lock, lock_flags);
163 list_for_each_entry(temp, &pinstance->used_res_q, queue) { 164 list_for_each_entry(temp, &pinstance->used_res_q, queue) {
164 165
165 /* do not expose VSETs with order-ids >= 240 */ 166 /* do not expose VSETs with order-ids > MAX_VSET_TARGETS */
166 if (RES_IS_VSET(temp->cfg_entry)) { 167 if (RES_IS_VSET(temp->cfg_entry)) {
167 target = temp->cfg_entry.unique_flags1; 168 target = temp->cfg_entry.unique_flags1;
168 if (target >= PMCRAID_MAX_VSET_TARGETS) 169 if (target > PMCRAID_MAX_VSET_TARGETS)
169 continue; 170 continue;
170 bus = PMCRAID_VSET_BUS_ID; 171 bus = PMCRAID_VSET_BUS_ID;
171 lun = 0; 172 lun = 0;
@@ -1210,7 +1211,7 @@ static int pmcraid_expose_resource(struct pmcraid_config_table_entry *cfgte)
1210 int retval = 0; 1211 int retval = 0;
1211 1212
1212 if (cfgte->resource_type == RES_TYPE_VSET) 1213 if (cfgte->resource_type == RES_TYPE_VSET)
1213 retval = ((cfgte->unique_flags1 & 0xFF) < 0xFE); 1214 retval = ((cfgte->unique_flags1 & 0x80) == 0);
1214 else if (cfgte->resource_type == RES_TYPE_GSCSI) 1215 else if (cfgte->resource_type == RES_TYPE_GSCSI)
1215 retval = (RES_BUS(cfgte->resource_address) != 1216 retval = (RES_BUS(cfgte->resource_address) !=
1216 PMCRAID_VIRTUAL_ENCL_BUS_ID); 1217 PMCRAID_VIRTUAL_ENCL_BUS_ID);
@@ -1361,6 +1362,7 @@ static int pmcraid_notify_aen(struct pmcraid_instance *pinstance, u8 type)
1361 * Return value: 1362 * Return value:
1362 * none 1363 * none
1363 */ 1364 */
1365
1364static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance) 1366static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
1365{ 1367{
1366 struct pmcraid_config_table_entry *cfg_entry; 1368 struct pmcraid_config_table_entry *cfg_entry;
@@ -1368,9 +1370,10 @@ static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
1368 struct pmcraid_cmd *cmd; 1370 struct pmcraid_cmd *cmd;
1369 struct pmcraid_cmd *cfgcmd; 1371 struct pmcraid_cmd *cfgcmd;
1370 struct pmcraid_resource_entry *res = NULL; 1372 struct pmcraid_resource_entry *res = NULL;
1371 u32 new_entry = 1;
1372 unsigned long lock_flags; 1373 unsigned long lock_flags;
1373 unsigned long host_lock_flags; 1374 unsigned long host_lock_flags;
1375 u32 new_entry = 1;
1376 u32 hidden_entry = 0;
1374 int rc; 1377 int rc;
1375 1378
1376 ccn_hcam = (struct pmcraid_hcam_ccn *)pinstance->ccn.hcam; 1379 ccn_hcam = (struct pmcraid_hcam_ccn *)pinstance->ccn.hcam;
@@ -1406,9 +1409,15 @@ static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
1406 } 1409 }
1407 1410
1408 /* If this resource is not going to be added to mid-layer, just notify 1411 /* If this resource is not going to be added to mid-layer, just notify
1409 * applications and return 1412 * applications and return. If this notification is about hiding a VSET
1413 * resource, check if it was exposed already.
1410 */ 1414 */
1411 if (!pmcraid_expose_resource(cfg_entry)) 1415 if (pinstance->ccn.hcam->notification_type ==
1416 NOTIFICATION_TYPE_ENTRY_CHANGED &&
1417 cfg_entry->resource_type == RES_TYPE_VSET &&
1418 cfg_entry->unique_flags1 & 0x80) {
1419 hidden_entry = 1;
1420 } else if (!pmcraid_expose_resource(cfg_entry))
1412 goto out_notify_apps; 1421 goto out_notify_apps;
1413 1422
1414 spin_lock_irqsave(&pinstance->resource_lock, lock_flags); 1423 spin_lock_irqsave(&pinstance->resource_lock, lock_flags);
@@ -1424,6 +1433,12 @@ static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
1424 1433
1425 if (new_entry) { 1434 if (new_entry) {
1426 1435
1436 if (hidden_entry) {
1437 spin_unlock_irqrestore(&pinstance->resource_lock,
1438 lock_flags);
1439 goto out_notify_apps;
1440 }
1441
1427 /* If there are more number of resources than what driver can 1442 /* If there are more number of resources than what driver can
1428 * manage, do not notify the applications about the CCN. Just 1443 * manage, do not notify the applications about the CCN. Just
1429 * ignore this notifications and re-register the same HCAM 1444 * ignore this notifications and re-register the same HCAM
@@ -1454,8 +1469,9 @@ static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
1454 sizeof(struct pmcraid_config_table_entry)); 1469 sizeof(struct pmcraid_config_table_entry));
1455 1470
1456 if (pinstance->ccn.hcam->notification_type == 1471 if (pinstance->ccn.hcam->notification_type ==
1457 NOTIFICATION_TYPE_ENTRY_DELETED) { 1472 NOTIFICATION_TYPE_ENTRY_DELETED || hidden_entry) {
1458 if (res->scsi_dev) { 1473 if (res->scsi_dev) {
1474 res->cfg_entry.unique_flags1 &= 0x7F;
1459 res->change_detected = RES_CHANGE_DEL; 1475 res->change_detected = RES_CHANGE_DEL;
1460 res->cfg_entry.resource_handle = 1476 res->cfg_entry.resource_handle =
1461 PMCRAID_INVALID_RES_HANDLE; 1477 PMCRAID_INVALID_RES_HANDLE;
@@ -2467,14 +2483,12 @@ static int pmcraid_error_handler(struct pmcraid_cmd *cmd)
2467 sense_copied = 1; 2483 sense_copied = 1;
2468 } 2484 }
2469 2485
2470 if (RES_IS_GSCSI(res->cfg_entry)) { 2486 if (RES_IS_GSCSI(res->cfg_entry))
2471 pmcraid_cancel_all(cmd, sense_copied); 2487 pmcraid_cancel_all(cmd, sense_copied);
2472 } else if (sense_copied) { 2488 else if (sense_copied)
2473 pmcraid_erp_done(cmd); 2489 pmcraid_erp_done(cmd);
2474 return 0; 2490 else
2475 } else {
2476 pmcraid_request_sense(cmd); 2491 pmcraid_request_sense(cmd);
2477 }
2478 2492
2479 return 1; 2493 return 1;
2480 2494
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h
index 2752b56cad56..92f89d50850c 100644
--- a/drivers/scsi/pmcraid.h
+++ b/drivers/scsi/pmcraid.h
@@ -1,6 +1,9 @@
1/* 1/*
2 * pmcraid.h -- PMC Sierra MaxRAID controller driver header file 2 * pmcraid.h -- PMC Sierra MaxRAID controller driver header file
3 * 3 *
4 * Written By: Anil Ravindranath<anil_ravindranath@pmc-sierra.com>
5 * PMC-Sierra Inc
6 *
4 * Copyright (C) 2008, 2009 PMC Sierra Inc. 7 * Copyright (C) 2008, 2009 PMC Sierra Inc.
5 * 8 *
6 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -106,7 +109,7 @@
106#define PMCRAID_VSET_LUN_ID 0x0 109#define PMCRAID_VSET_LUN_ID 0x0
107#define PMCRAID_PHYS_BUS_ID 0x0 110#define PMCRAID_PHYS_BUS_ID 0x0
108#define PMCRAID_VIRTUAL_ENCL_BUS_ID 0x8 111#define PMCRAID_VIRTUAL_ENCL_BUS_ID 0x8
109#define PMCRAID_MAX_VSET_TARGETS 240 112#define PMCRAID_MAX_VSET_TARGETS 0x7F
110#define PMCRAID_MAX_VSET_LUNS_PER_TARGET 8 113#define PMCRAID_MAX_VSET_LUNS_PER_TARGET 8
111 114
112#define PMCRAID_IOA_MAX_SECTORS 32767 115#define PMCRAID_IOA_MAX_SECTORS 32767
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 21e2bc4d7401..3a9f5b288aee 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -232,6 +232,9 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
232 if (off) 232 if (off)
233 return 0; 233 return 0;
234 234
235 if (unlikely(pci_channel_offline(ha->pdev)))
236 return 0;
237
235 if (sscanf(buf, "%d:%x:%x", &val, &start, &size) < 1) 238 if (sscanf(buf, "%d:%x:%x", &val, &start, &size) < 1)
236 return -EINVAL; 239 return -EINVAL;
237 if (start > ha->optrom_size) 240 if (start > ha->optrom_size)
@@ -379,6 +382,9 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj,
379 struct device, kobj))); 382 struct device, kobj)));
380 struct qla_hw_data *ha = vha->hw; 383 struct qla_hw_data *ha = vha->hw;
381 384
385 if (unlikely(pci_channel_offline(ha->pdev)))
386 return 0;
387
382 if (!capable(CAP_SYS_ADMIN)) 388 if (!capable(CAP_SYS_ADMIN))
383 return 0; 389 return 0;
384 390
@@ -398,6 +404,9 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj,
398 struct qla_hw_data *ha = vha->hw; 404 struct qla_hw_data *ha = vha->hw;
399 uint8_t *tmp_data; 405 uint8_t *tmp_data;
400 406
407 if (unlikely(pci_channel_offline(ha->pdev)))
408 return 0;
409
401 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size || 410 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size ||
402 !ha->isp_ops->write_nvram) 411 !ha->isp_ops->write_nvram)
403 return 0; 412 return 0;
@@ -1238,10 +1247,11 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
1238 char *buf) 1247 char *buf)
1239{ 1248{
1240 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev)); 1249 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1241 int rval; 1250 int rval = QLA_FUNCTION_FAILED;
1242 uint16_t state[5]; 1251 uint16_t state[5];
1243 1252
1244 rval = qla2x00_get_firmware_state(vha, state); 1253 if (!vha->hw->flags.eeh_busy)
1254 rval = qla2x00_get_firmware_state(vha, state);
1245 if (rval != QLA_SUCCESS) 1255 if (rval != QLA_SUCCESS)
1246 memset(state, -1, sizeof(state)); 1256 memset(state, -1, sizeof(state));
1247 1257
@@ -1452,10 +1462,13 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
1452 if (!fcport) 1462 if (!fcport)
1453 return; 1463 return;
1454 1464
1455 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) 1465 if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
1466 return;
1467
1468 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
1456 qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); 1469 qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
1457 else 1470 return;
1458 qla2x00_abort_fcport_cmds(fcport); 1471 }
1459 1472
1460 /* 1473 /*
1461 * Transport has effectively 'deleted' the rport, clear 1474 * Transport has effectively 'deleted' the rport, clear
@@ -1475,6 +1488,9 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)
1475 if (!fcport) 1488 if (!fcport)
1476 return; 1489 return;
1477 1490
1491 if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
1492 return;
1493
1478 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) { 1494 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
1479 qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16); 1495 qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
1480 return; 1496 return;
@@ -1515,6 +1531,12 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1515 pfc_host_stat = &ha->fc_host_stat; 1531 pfc_host_stat = &ha->fc_host_stat;
1516 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics)); 1532 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
1517 1533
1534 if (test_bit(UNLOADING, &vha->dpc_flags))
1535 goto done;
1536
1537 if (unlikely(pci_channel_offline(ha->pdev)))
1538 goto done;
1539
1518 stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma); 1540 stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma);
1519 if (stats == NULL) { 1541 if (stats == NULL) {
1520 DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n", 1542 DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
index f660dd70b72e..d6d9c86cb058 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -26,7 +26,7 @@
26/* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */ 26/* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */
27/* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */ 27/* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */
28/* #define QL_DEBUG_LEVEL_16 */ /* Output ISP84XX trace msgs */ 28/* #define QL_DEBUG_LEVEL_16 */ /* Output ISP84XX trace msgs */
29/* #define QL_DEBUG_LEVEL_17 */ /* Output MULTI-Q trace messages */ 29/* #define QL_DEBUG_LEVEL_17 */ /* Output EEH trace messages */
30 30
31/* 31/*
32* Macros use for debugging the driver. 32* Macros use for debugging the driver.
@@ -132,6 +132,13 @@
132#else 132#else
133#define DEBUG16(x) do {} while (0) 133#define DEBUG16(x) do {} while (0)
134#endif 134#endif
135
136#if defined(QL_DEBUG_LEVEL_17)
137#define DEBUG17(x) do {x;} while (0)
138#else
139#define DEBUG17(x) do {} while (0)
140#endif
141
135/* 142/*
136 * Firmware Dump structure definition 143 * Firmware Dump structure definition
137 */ 144 */
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6b9bf23c7735..608e675f68c8 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1570,9 +1570,6 @@ typedef struct fc_port {
1570 struct fc_rport *rport, *drport; 1570 struct fc_rport *rport, *drport;
1571 u32 supported_classes; 1571 u32 supported_classes;
1572 1572
1573 unsigned long last_queue_full;
1574 unsigned long last_ramp_up;
1575
1576 uint16_t vp_idx; 1573 uint16_t vp_idx;
1577} fc_port_t; 1574} fc_port_t;
1578 1575
@@ -2259,12 +2256,15 @@ struct qla_hw_data {
2259 uint32_t disable_serdes :1; 2256 uint32_t disable_serdes :1;
2260 uint32_t gpsc_supported :1; 2257 uint32_t gpsc_supported :1;
2261 uint32_t npiv_supported :1; 2258 uint32_t npiv_supported :1;
2259 uint32_t pci_channel_io_perm_failure :1;
2262 uint32_t fce_enabled :1; 2260 uint32_t fce_enabled :1;
2263 uint32_t fac_supported :1; 2261 uint32_t fac_supported :1;
2264 uint32_t chip_reset_done :1; 2262 uint32_t chip_reset_done :1;
2265 uint32_t port0 :1; 2263 uint32_t port0 :1;
2266 uint32_t running_gold_fw :1; 2264 uint32_t running_gold_fw :1;
2265 uint32_t eeh_busy :1;
2267 uint32_t cpu_affinity_enabled :1; 2266 uint32_t cpu_affinity_enabled :1;
2267 uint32_t disable_msix_handshake :1;
2268 } flags; 2268 } flags;
2269 2269
2270 /* This spinlock is used to protect "io transactions", you must 2270 /* This spinlock is used to protect "io transactions", you must
@@ -2387,6 +2387,7 @@ struct qla_hw_data {
2387#define IS_QLA81XX(ha) (IS_QLA8001(ha)) 2387#define IS_QLA81XX(ha) (IS_QLA8001(ha))
2388#define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \ 2388#define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \
2389 IS_QLA25XX(ha) || IS_QLA81XX(ha)) 2389 IS_QLA25XX(ha) || IS_QLA81XX(ha))
2390#define IS_MSIX_NACK_CAPABLE(ha) (IS_QLA81XX(ha))
2390#define IS_NOPOLLING_TYPE(ha) ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && \ 2391#define IS_NOPOLLING_TYPE(ha) ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && \
2391 (ha)->flags.msix_enabled) 2392 (ha)->flags.msix_enabled)
2392#define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha)) 2393#define IS_FAC_REQUIRED(ha) (IS_QLA81XX(ha))
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index e21851358509..f61fb8d01330 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -72,8 +72,6 @@ extern int ql2xloginretrycount;
72extern int ql2xfdmienable; 72extern int ql2xfdmienable;
73extern int ql2xallocfwdump; 73extern int ql2xallocfwdump;
74extern int ql2xextended_error_logging; 74extern int ql2xextended_error_logging;
75extern int ql2xqfullrampup;
76extern int ql2xqfulltracking;
77extern int ql2xiidmaenable; 75extern int ql2xiidmaenable;
78extern int ql2xmaxqueues; 76extern int ql2xmaxqueues;
79extern int ql2xmultique_tag; 77extern int ql2xmultique_tag;
@@ -326,6 +324,7 @@ qla2x00_read_ram_word(scsi_qla_host_t *, uint32_t, uint32_t *);
326extern int 324extern int
327qla2x00_write_ram_word(scsi_qla_host_t *, uint32_t, uint32_t); 325qla2x00_write_ram_word(scsi_qla_host_t *, uint32_t, uint32_t);
328 326
327extern int qla2x00_get_data_rate(scsi_qla_host_t *);
329/* 328/*
330 * Global Function Prototypes in qla_isr.c source file. 329 * Global Function Prototypes in qla_isr.c source file.
331 */ 330 */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index b74924b279ef..b4a0eac8f96d 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -269,6 +269,8 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
269 vha->flags.online = 0; 269 vha->flags.online = 0;
270 ha->flags.chip_reset_done = 0; 270 ha->flags.chip_reset_done = 0;
271 vha->flags.reset_active = 0; 271 vha->flags.reset_active = 0;
272 ha->flags.pci_channel_io_perm_failure = 0;
273 ha->flags.eeh_busy = 0;
272 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 274 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
273 atomic_set(&vha->loop_state, LOOP_DOWN); 275 atomic_set(&vha->loop_state, LOOP_DOWN);
274 vha->device_flags = DFLG_NO_CABLE; 276 vha->device_flags = DFLG_NO_CABLE;
@@ -581,6 +583,9 @@ qla2x00_reset_chip(scsi_qla_host_t *vha)
581 uint32_t cnt; 583 uint32_t cnt;
582 uint16_t cmd; 584 uint16_t cmd;
583 585
586 if (unlikely(pci_channel_offline(ha->pdev)))
587 return;
588
584 ha->isp_ops->disable_intrs(ha); 589 ha->isp_ops->disable_intrs(ha);
585 590
586 spin_lock_irqsave(&ha->hardware_lock, flags); 591 spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -786,6 +791,12 @@ void
786qla24xx_reset_chip(scsi_qla_host_t *vha) 791qla24xx_reset_chip(scsi_qla_host_t *vha)
787{ 792{
788 struct qla_hw_data *ha = vha->hw; 793 struct qla_hw_data *ha = vha->hw;
794
795 if (pci_channel_offline(ha->pdev) &&
796 ha->flags.pci_channel_io_perm_failure) {
797 return;
798 }
799
789 ha->isp_ops->disable_intrs(ha); 800 ha->isp_ops->disable_intrs(ha);
790 801
791 /* Perform RISC reset. */ 802 /* Perform RISC reset. */
@@ -1442,7 +1453,17 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
1442 icb->firmware_options_2 |= 1453 icb->firmware_options_2 |=
1443 __constant_cpu_to_le32(BIT_18); 1454 __constant_cpu_to_le32(BIT_18);
1444 1455
1445 icb->firmware_options_2 &= __constant_cpu_to_le32(~BIT_22); 1456 /* Use Disable MSIX Handshake mode for capable adapters */
1457 if (IS_MSIX_NACK_CAPABLE(ha)) {
1458 icb->firmware_options_2 &=
1459 __constant_cpu_to_le32(~BIT_22);
1460 ha->flags.disable_msix_handshake = 1;
1461 qla_printk(KERN_INFO, ha,
1462 "MSIX Handshake Disable Mode turned on\n");
1463 } else {
1464 icb->firmware_options_2 |=
1465 __constant_cpu_to_le32(BIT_22);
1466 }
1446 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23); 1467 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23);
1447 1468
1448 WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0); 1469 WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0);
@@ -2256,6 +2277,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
2256 clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); 2277 clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
2257 clear_bit(RSCN_UPDATE, &vha->dpc_flags); 2278 clear_bit(RSCN_UPDATE, &vha->dpc_flags);
2258 2279
2280 qla2x00_get_data_rate(vha);
2281
2259 /* Determine what we need to do */ 2282 /* Determine what we need to do */
2260 if (ha->current_topology == ISP_CFG_FL && 2283 if (ha->current_topology == ISP_CFG_FL &&
2261 (test_bit(LOCAL_LOOP_UPDATE, &flags))) { 2284 (test_bit(LOCAL_LOOP_UPDATE, &flags))) {
@@ -3550,6 +3573,13 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3550 /* Requeue all commands in outstanding command list. */ 3573 /* Requeue all commands in outstanding command list. */
3551 qla2x00_abort_all_cmds(vha, DID_RESET << 16); 3574 qla2x00_abort_all_cmds(vha, DID_RESET << 16);
3552 3575
3576 if (unlikely(pci_channel_offline(ha->pdev) &&
3577 ha->flags.pci_channel_io_perm_failure)) {
3578 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
3579 status = 0;
3580 return status;
3581 }
3582
3553 ha->isp_ops->get_flash_version(vha, req->ring); 3583 ha->isp_ops->get_flash_version(vha, req->ring);
3554 3584
3555 ha->isp_ops->nvram_config(vha); 3585 ha->isp_ops->nvram_config(vha);
@@ -4448,6 +4478,8 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *vha)
4448 int ret, retries; 4478 int ret, retries;
4449 struct qla_hw_data *ha = vha->hw; 4479 struct qla_hw_data *ha = vha->hw;
4450 4480
4481 if (ha->flags.pci_channel_io_perm_failure)
4482 return;
4451 if (!IS_FWI2_CAPABLE(ha)) 4483 if (!IS_FWI2_CAPABLE(ha))
4452 return; 4484 return;
4453 if (!ha->fw_major_version) 4485 if (!ha->fw_major_version)
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 804987397b77..ffd0efdff40e 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -152,7 +152,7 @@ qla2300_intr_handler(int irq, void *dev_id)
152 for (iter = 50; iter--; ) { 152 for (iter = 50; iter--; ) {
153 stat = RD_REG_DWORD(&reg->u.isp2300.host_status); 153 stat = RD_REG_DWORD(&reg->u.isp2300.host_status);
154 if (stat & HSR_RISC_PAUSED) { 154 if (stat & HSR_RISC_PAUSED) {
155 if (pci_channel_offline(ha->pdev)) 155 if (unlikely(pci_channel_offline(ha->pdev)))
156 break; 156 break;
157 157
158 hccr = RD_REG_WORD(&reg->hccr); 158 hccr = RD_REG_WORD(&reg->hccr);
@@ -811,78 +811,6 @@ skip_rio:
811 qla2x00_alert_all_vps(rsp, mb); 811 qla2x00_alert_all_vps(rsp, mb);
812} 812}
813 813
814static void
815qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data)
816{
817 fc_port_t *fcport = data;
818 struct scsi_qla_host *vha = fcport->vha;
819 struct qla_hw_data *ha = vha->hw;
820 struct req_que *req = NULL;
821
822 if (!ql2xqfulltracking)
823 return;
824
825 req = vha->req;
826 if (!req)
827 return;
828 if (req->max_q_depth <= sdev->queue_depth)
829 return;
830
831 if (sdev->ordered_tags)
832 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
833 sdev->queue_depth + 1);
834 else
835 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
836 sdev->queue_depth + 1);
837
838 fcport->last_ramp_up = jiffies;
839
840 DEBUG2(qla_printk(KERN_INFO, ha,
841 "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
842 fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
843 sdev->queue_depth));
844}
845
846static void
847qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data)
848{
849 fc_port_t *fcport = data;
850
851 if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1))
852 return;
853
854 DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
855 "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
856 fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
857 sdev->queue_depth));
858}
859
860static inline void
861qla2x00_ramp_up_queue_depth(scsi_qla_host_t *vha, struct req_que *req,
862 srb_t *sp)
863{
864 fc_port_t *fcport;
865 struct scsi_device *sdev;
866
867 if (!ql2xqfulltracking)
868 return;
869
870 sdev = sp->cmd->device;
871 if (sdev->queue_depth >= req->max_q_depth)
872 return;
873
874 fcport = sp->fcport;
875 if (time_before(jiffies,
876 fcport->last_ramp_up + ql2xqfullrampup * HZ))
877 return;
878 if (time_before(jiffies,
879 fcport->last_queue_full + ql2xqfullrampup * HZ))
880 return;
881
882 starget_for_each_device(sdev->sdev_target, fcport,
883 qla2x00_adjust_sdev_qdepth_up);
884}
885
886/** 814/**
887 * qla2x00_process_completed_request() - Process a Fast Post response. 815 * qla2x00_process_completed_request() - Process a Fast Post response.
888 * @ha: SCSI driver HA context 816 * @ha: SCSI driver HA context
@@ -913,8 +841,6 @@ qla2x00_process_completed_request(struct scsi_qla_host *vha,
913 841
914 /* Save ISP completion status */ 842 /* Save ISP completion status */
915 sp->cmd->result = DID_OK << 16; 843 sp->cmd->result = DID_OK << 16;
916
917 qla2x00_ramp_up_queue_depth(vha, req, sp);
918 qla2x00_sp_compl(ha, sp); 844 qla2x00_sp_compl(ha, sp);
919 } else { 845 } else {
920 DEBUG2(printk("scsi(%ld) Req:%d: Invalid ISP SCSI completion" 846 DEBUG2(printk("scsi(%ld) Req:%d: Invalid ISP SCSI completion"
@@ -1435,13 +1361,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1435 "scsi(%ld): QUEUE FULL status detected " 1361 "scsi(%ld): QUEUE FULL status detected "
1436 "0x%x-0x%x.\n", vha->host_no, comp_status, 1362 "0x%x-0x%x.\n", vha->host_no, comp_status,
1437 scsi_status)); 1363 scsi_status));
1438
1439 /* Adjust queue depth for all luns on the port. */
1440 if (!ql2xqfulltracking)
1441 break;
1442 fcport->last_queue_full = jiffies;
1443 starget_for_each_device(cp->device->sdev_target,
1444 fcport, qla2x00_adjust_sdev_qdepth_down);
1445 break; 1364 break;
1446 } 1365 }
1447 if (lscsi_status != SS_CHECK_CONDITION) 1366 if (lscsi_status != SS_CHECK_CONDITION)
@@ -1516,17 +1435,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
1516 "scsi(%ld): QUEUE FULL status detected " 1435 "scsi(%ld): QUEUE FULL status detected "
1517 "0x%x-0x%x.\n", vha->host_no, comp_status, 1436 "0x%x-0x%x.\n", vha->host_no, comp_status,
1518 scsi_status)); 1437 scsi_status));
1519
1520 /*
1521 * Adjust queue depth for all luns on the
1522 * port.
1523 */
1524 if (!ql2xqfulltracking)
1525 break;
1526 fcport->last_queue_full = jiffies;
1527 starget_for_each_device(
1528 cp->device->sdev_target, fcport,
1529 qla2x00_adjust_sdev_qdepth_down);
1530 break; 1438 break;
1531 } 1439 }
1532 if (lscsi_status != SS_CHECK_CONDITION) 1440 if (lscsi_status != SS_CHECK_CONDITION)
@@ -1938,12 +1846,15 @@ qla24xx_intr_handler(int irq, void *dev_id)
1938 reg = &ha->iobase->isp24; 1846 reg = &ha->iobase->isp24;
1939 status = 0; 1847 status = 0;
1940 1848
1849 if (unlikely(pci_channel_offline(ha->pdev)))
1850 return IRQ_HANDLED;
1851
1941 spin_lock_irqsave(&ha->hardware_lock, flags); 1852 spin_lock_irqsave(&ha->hardware_lock, flags);
1942 vha = pci_get_drvdata(ha->pdev); 1853 vha = pci_get_drvdata(ha->pdev);
1943 for (iter = 50; iter--; ) { 1854 for (iter = 50; iter--; ) {
1944 stat = RD_REG_DWORD(&reg->host_status); 1855 stat = RD_REG_DWORD(&reg->host_status);
1945 if (stat & HSRX_RISC_PAUSED) { 1856 if (stat & HSRX_RISC_PAUSED) {
1946 if (pci_channel_offline(ha->pdev)) 1857 if (unlikely(pci_channel_offline(ha->pdev)))
1947 break; 1858 break;
1948 1859
1949 hccr = RD_REG_DWORD(&reg->hccr); 1860 hccr = RD_REG_DWORD(&reg->hccr);
@@ -2020,7 +1931,7 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
2020 1931
2021 vha = qla25xx_get_host(rsp); 1932 vha = qla25xx_get_host(rsp);
2022 qla24xx_process_response_queue(vha, rsp); 1933 qla24xx_process_response_queue(vha, rsp);
2023 if (!ha->mqenable) { 1934 if (!ha->flags.disable_msix_handshake) {
2024 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT); 1935 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
2025 RD_REG_DWORD_RELAXED(&reg->hccr); 1936 RD_REG_DWORD_RELAXED(&reg->hccr);
2026 } 1937 }
@@ -2034,6 +1945,7 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
2034{ 1945{
2035 struct qla_hw_data *ha; 1946 struct qla_hw_data *ha;
2036 struct rsp_que *rsp; 1947 struct rsp_que *rsp;
1948 struct device_reg_24xx __iomem *reg;
2037 1949
2038 rsp = (struct rsp_que *) dev_id; 1950 rsp = (struct rsp_que *) dev_id;
2039 if (!rsp) { 1951 if (!rsp) {
@@ -2043,6 +1955,14 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
2043 } 1955 }
2044 ha = rsp->hw; 1956 ha = rsp->hw;
2045 1957
1958 /* Clear the interrupt, if enabled, for this response queue */
1959 if (rsp->options & ~BIT_6) {
1960 reg = &ha->iobase->isp24;
1961 spin_lock_irq(&ha->hardware_lock);
1962 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
1963 RD_REG_DWORD_RELAXED(&reg->hccr);
1964 spin_unlock_irq(&ha->hardware_lock);
1965 }
2046 queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work); 1966 queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work);
2047 1967
2048 return IRQ_HANDLED; 1968 return IRQ_HANDLED;
@@ -2075,7 +1995,7 @@ qla24xx_msix_default(int irq, void *dev_id)
2075 do { 1995 do {
2076 stat = RD_REG_DWORD(&reg->host_status); 1996 stat = RD_REG_DWORD(&reg->host_status);
2077 if (stat & HSRX_RISC_PAUSED) { 1997 if (stat & HSRX_RISC_PAUSED) {
2078 if (pci_channel_offline(ha->pdev)) 1998 if (unlikely(pci_channel_offline(ha->pdev)))
2079 break; 1999 break;
2080 2000
2081 hccr = RD_REG_DWORD(&reg->hccr); 2001 hccr = RD_REG_DWORD(&reg->hccr);
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 05d595d9a7ef..056e4d4505f3 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -56,6 +56,12 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
56 56
57 DEBUG11(printk("%s(%ld): entered.\n", __func__, base_vha->host_no)); 57 DEBUG11(printk("%s(%ld): entered.\n", __func__, base_vha->host_no));
58 58
59 if (ha->flags.pci_channel_io_perm_failure) {
60 DEBUG(printk("%s(%ld): Perm failure on EEH, timeout MBX "
61 "Exiting.\n", __func__, vha->host_no));
62 return QLA_FUNCTION_TIMEOUT;
63 }
64
59 /* 65 /*
60 * Wait for active mailbox commands to finish by waiting at most tov 66 * Wait for active mailbox commands to finish by waiting at most tov
61 * seconds. This is to serialize actual issuing of mailbox cmds during 67 * seconds. This is to serialize actual issuing of mailbox cmds during
@@ -154,10 +160,14 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
154 /* Check for pending interrupts. */ 160 /* Check for pending interrupts. */
155 qla2x00_poll(ha->rsp_q_map[0]); 161 qla2x00_poll(ha->rsp_q_map[0]);
156 162
157 if (command != MBC_LOAD_RISC_RAM_EXTENDED && 163 if (!ha->flags.mbox_int &&
158 !ha->flags.mbox_int) 164 !(IS_QLA2200(ha) &&
165 command == MBC_LOAD_RISC_RAM_EXTENDED))
159 msleep(10); 166 msleep(10);
160 } /* while */ 167 } /* while */
168 DEBUG17(qla_printk(KERN_WARNING, ha,
169 "Waited %d sec\n",
170 (uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ)));
161 } 171 }
162 172
163 /* Check whether we timed out */ 173 /* Check whether we timed out */
@@ -227,7 +237,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
227 237
228 if (rval == QLA_FUNCTION_TIMEOUT && 238 if (rval == QLA_FUNCTION_TIMEOUT &&
229 mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) { 239 mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) {
230 if (!io_lock_on || (mcp->flags & IOCTL_CMD)) { 240 if (!io_lock_on || (mcp->flags & IOCTL_CMD) ||
241 ha->flags.eeh_busy) {
231 /* not in dpc. schedule it for dpc to take over. */ 242 /* not in dpc. schedule it for dpc to take over. */
232 DEBUG(printk("%s(%ld): timeout schedule " 243 DEBUG(printk("%s(%ld): timeout schedule "
233 "isp_abort_needed.\n", __func__, 244 "isp_abort_needed.\n", __func__,
@@ -237,7 +248,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
237 base_vha->host_no)); 248 base_vha->host_no));
238 qla_printk(KERN_WARNING, ha, 249 qla_printk(KERN_WARNING, ha,
239 "Mailbox command timeout occurred. Scheduling ISP " 250 "Mailbox command timeout occurred. Scheduling ISP "
240 "abort.\n"); 251 "abort. eeh_busy: 0x%x\n", ha->flags.eeh_busy);
241 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); 252 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags);
242 qla2xxx_wake_dpc(vha); 253 qla2xxx_wake_dpc(vha);
243 } else if (!abort_active) { 254 } else if (!abort_active) {
@@ -2530,6 +2541,9 @@ qla2x00_enable_eft_trace(scsi_qla_host_t *vha, dma_addr_t eft_dma,
2530 if (!IS_FWI2_CAPABLE(vha->hw)) 2541 if (!IS_FWI2_CAPABLE(vha->hw))
2531 return QLA_FUNCTION_FAILED; 2542 return QLA_FUNCTION_FAILED;
2532 2543
2544 if (unlikely(pci_channel_offline(vha->hw->pdev)))
2545 return QLA_FUNCTION_FAILED;
2546
2533 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); 2547 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
2534 2548
2535 mcp->mb[0] = MBC_TRACE_CONTROL; 2549 mcp->mb[0] = MBC_TRACE_CONTROL;
@@ -2565,6 +2579,9 @@ qla2x00_disable_eft_trace(scsi_qla_host_t *vha)
2565 if (!IS_FWI2_CAPABLE(vha->hw)) 2579 if (!IS_FWI2_CAPABLE(vha->hw))
2566 return QLA_FUNCTION_FAILED; 2580 return QLA_FUNCTION_FAILED;
2567 2581
2582 if (unlikely(pci_channel_offline(vha->hw->pdev)))
2583 return QLA_FUNCTION_FAILED;
2584
2568 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); 2585 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
2569 2586
2570 mcp->mb[0] = MBC_TRACE_CONTROL; 2587 mcp->mb[0] = MBC_TRACE_CONTROL;
@@ -2595,6 +2612,9 @@ qla2x00_enable_fce_trace(scsi_qla_host_t *vha, dma_addr_t fce_dma,
2595 if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw)) 2612 if (!IS_QLA25XX(vha->hw) && !IS_QLA81XX(vha->hw))
2596 return QLA_FUNCTION_FAILED; 2613 return QLA_FUNCTION_FAILED;
2597 2614
2615 if (unlikely(pci_channel_offline(vha->hw->pdev)))
2616 return QLA_FUNCTION_FAILED;
2617
2598 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); 2618 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
2599 2619
2600 mcp->mb[0] = MBC_TRACE_CONTROL; 2620 mcp->mb[0] = MBC_TRACE_CONTROL;
@@ -2639,6 +2659,9 @@ qla2x00_disable_fce_trace(scsi_qla_host_t *vha, uint64_t *wr, uint64_t *rd)
2639 if (!IS_FWI2_CAPABLE(vha->hw)) 2659 if (!IS_FWI2_CAPABLE(vha->hw))
2640 return QLA_FUNCTION_FAILED; 2660 return QLA_FUNCTION_FAILED;
2641 2661
2662 if (unlikely(pci_channel_offline(vha->hw->pdev)))
2663 return QLA_FUNCTION_FAILED;
2664
2642 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); 2665 DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
2643 2666
2644 mcp->mb[0] = MBC_TRACE_CONTROL; 2667 mcp->mb[0] = MBC_TRACE_CONTROL;
@@ -3643,3 +3666,36 @@ qla2x00_write_ram_word(scsi_qla_host_t *vha, uint32_t risc_addr, uint32_t data)
3643 3666
3644 return rval; 3667 return rval;
3645} 3668}
3669
3670int
3671qla2x00_get_data_rate(scsi_qla_host_t *vha)
3672{
3673 int rval;
3674 mbx_cmd_t mc;
3675 mbx_cmd_t *mcp = &mc;
3676 struct qla_hw_data *ha = vha->hw;
3677
3678 if (!IS_FWI2_CAPABLE(ha))
3679 return QLA_FUNCTION_FAILED;
3680
3681 DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, vha->host_no));
3682
3683 mcp->mb[0] = MBC_DATA_RATE;
3684 mcp->mb[1] = 0;
3685 mcp->out_mb = MBX_1|MBX_0;
3686 mcp->in_mb = MBX_2|MBX_1|MBX_0;
3687 mcp->tov = MBX_TOV_SECONDS;
3688 mcp->flags = 0;
3689 rval = qla2x00_mailbox_command(vha, mcp);
3690 if (rval != QLA_SUCCESS) {
3691 DEBUG2_3_11(printk(KERN_INFO "%s(%ld): failed=%x mb[0]=%x.\n",
3692 __func__, vha->host_no, rval, mcp->mb[0]));
3693 } else {
3694 DEBUG11(printk(KERN_INFO
3695 "%s(%ld): done.\n", __func__, vha->host_no));
3696 if (mcp->mb[1] != 0x7)
3697 ha->link_data_rate = mcp->mb[1];
3698 }
3699
3700 return rval;
3701}
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index a47d34308a3a..b901aa267e7d 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -639,8 +639,10 @@ static void qla_do_work(struct work_struct *work)
639 struct rsp_que *rsp = container_of(work, struct rsp_que, q_work); 639 struct rsp_que *rsp = container_of(work, struct rsp_que, q_work);
640 struct scsi_qla_host *vha; 640 struct scsi_qla_host *vha;
641 641
642 spin_lock_irq(&rsp->hw->hardware_lock);
642 vha = qla25xx_get_host(rsp); 643 vha = qla25xx_get_host(rsp);
643 qla24xx_process_response_queue(vha, rsp); 644 qla24xx_process_response_queue(vha, rsp);
645 spin_unlock_irq(&rsp->hw->hardware_lock);
644} 646}
645 647
646/* create response queue */ 648/* create response queue */
@@ -696,6 +698,10 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
696 /* Use alternate PCI devfn */ 698 /* Use alternate PCI devfn */
697 if (LSB(rsp->rid)) 699 if (LSB(rsp->rid))
698 options |= BIT_5; 700 options |= BIT_5;
701 /* Enable MSIX handshake mode on for uncapable adapters */
702 if (!IS_MSIX_NACK_CAPABLE(ha))
703 options |= BIT_6;
704
699 rsp->options = options; 705 rsp->options = options;
700 rsp->id = que_id; 706 rsp->id = que_id;
701 reg = ISP_QUE_REG(ha, que_id); 707 reg = ISP_QUE_REG(ha, que_id);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 41669357b186..209f50e788a1 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -78,21 +78,6 @@ module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR);
78MODULE_PARM_DESC(ql2xmaxqdepth, 78MODULE_PARM_DESC(ql2xmaxqdepth,
79 "Maximum queue depth to report for target devices."); 79 "Maximum queue depth to report for target devices.");
80 80
81int ql2xqfulltracking = 1;
82module_param(ql2xqfulltracking, int, S_IRUGO|S_IWUSR);
83MODULE_PARM_DESC(ql2xqfulltracking,
84 "Controls whether the driver tracks queue full status "
85 "returns and dynamically adjusts a scsi device's queue "
86 "depth. Default is 1, perform tracking. Set to 0 to "
87 "disable dynamic tracking and adjustment of queue depth.");
88
89int ql2xqfullrampup = 120;
90module_param(ql2xqfullrampup, int, S_IRUGO|S_IWUSR);
91MODULE_PARM_DESC(ql2xqfullrampup,
92 "Number of seconds to wait to begin to ramp-up the queue "
93 "depth for a device after a queue-full condition has been "
94 "detected. Default is 120 seconds.");
95
96int ql2xiidmaenable=1; 81int ql2xiidmaenable=1;
97module_param(ql2xiidmaenable, int, S_IRUGO|S_IRUSR); 82module_param(ql2xiidmaenable, int, S_IRUGO|S_IRUSR);
98MODULE_PARM_DESC(ql2xiidmaenable, 83MODULE_PARM_DESC(ql2xiidmaenable,
@@ -490,11 +475,11 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
490 srb_t *sp; 475 srb_t *sp;
491 int rval; 476 int rval;
492 477
493 if (unlikely(pci_channel_offline(ha->pdev))) { 478 if (ha->flags.eeh_busy) {
494 if (ha->pdev->error_state == pci_channel_io_frozen) 479 if (ha->flags.pci_channel_io_perm_failure)
495 cmd->result = DID_REQUEUE << 16;
496 else
497 cmd->result = DID_NO_CONNECT << 16; 480 cmd->result = DID_NO_CONNECT << 16;
481 else
482 cmd->result = DID_REQUEUE << 16;
498 goto qc24_fail_command; 483 goto qc24_fail_command;
499 } 484 }
500 485
@@ -567,8 +552,15 @@ qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)
567#define ABORT_POLLING_PERIOD 1000 552#define ABORT_POLLING_PERIOD 1000
568#define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD)) 553#define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD))
569 unsigned long wait_iter = ABORT_WAIT_ITER; 554 unsigned long wait_iter = ABORT_WAIT_ITER;
555 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
556 struct qla_hw_data *ha = vha->hw;
570 int ret = QLA_SUCCESS; 557 int ret = QLA_SUCCESS;
571 558
559 if (unlikely(pci_channel_offline(ha->pdev)) || ha->flags.eeh_busy) {
560 DEBUG17(qla_printk(KERN_WARNING, ha, "return:eh_wait\n"));
561 return ret;
562 }
563
572 while (CMD_SP(cmd) && wait_iter--) { 564 while (CMD_SP(cmd) && wait_iter--) {
573 msleep(ABORT_POLLING_PERIOD); 565 msleep(ABORT_POLLING_PERIOD);
574 } 566 }
@@ -1217,13 +1209,61 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
1217 sdev->hostdata = NULL; 1209 sdev->hostdata = NULL;
1218} 1210}
1219 1211
1212static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
1213{
1214 fc_port_t *fcport = (struct fc_port *) sdev->hostdata;
1215
1216 if (!scsi_track_queue_full(sdev, qdepth))
1217 return;
1218
1219 DEBUG2(qla_printk(KERN_INFO, fcport->vha->hw,
1220 "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n",
1221 fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
1222 sdev->queue_depth));
1223}
1224
1225static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
1226{
1227 fc_port_t *fcport = sdev->hostdata;
1228 struct scsi_qla_host *vha = fcport->vha;
1229 struct qla_hw_data *ha = vha->hw;
1230 struct req_que *req = NULL;
1231
1232 req = vha->req;
1233 if (!req)
1234 return;
1235
1236 if (req->max_q_depth <= sdev->queue_depth || req->max_q_depth < qdepth)
1237 return;
1238
1239 if (sdev->ordered_tags)
1240 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, qdepth);
1241 else
1242 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth);
1243
1244 DEBUG2(qla_printk(KERN_INFO, ha,
1245 "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n",
1246 fcport->vha->host_no, sdev->channel, sdev->id, sdev->lun,
1247 sdev->queue_depth));
1248}
1249
1220static int 1250static int
1221qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) 1251qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
1222{ 1252{
1223 if (reason != SCSI_QDEPTH_DEFAULT) 1253 switch (reason) {
1224 return -EOPNOTSUPP; 1254 case SCSI_QDEPTH_DEFAULT:
1255 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
1256 break;
1257 case SCSI_QDEPTH_QFULL:
1258 qla2x00_handle_queue_full(sdev, qdepth);
1259 break;
1260 case SCSI_QDEPTH_RAMP_UP:
1261 qla2x00_adjust_sdev_qdepth_up(sdev, qdepth);
1262 break;
1263 default:
1264 return EOPNOTSUPP;
1265 }
1225 1266
1226 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
1227 return sdev->queue_depth; 1267 return sdev->queue_depth;
1228} 1268}
1229 1269
@@ -1777,6 +1817,13 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1777 1817
1778 /* Set ISP-type information. */ 1818 /* Set ISP-type information. */
1779 qla2x00_set_isp_flags(ha); 1819 qla2x00_set_isp_flags(ha);
1820
1821 /* Set EEH reset type to fundamental if required by hba */
1822 if ( IS_QLA24XX(ha) || IS_QLA25XX(ha) || IS_QLA81XX(ha)) {
1823 pdev->needs_freset = 1;
1824 pci_save_state(pdev);
1825 }
1826
1780 /* Configure PCI I/O space */ 1827 /* Configure PCI I/O space */
1781 ret = qla2x00_iospace_config(ha); 1828 ret = qla2x00_iospace_config(ha);
1782 if (ret) 1829 if (ret)
@@ -2003,13 +2050,13 @@ skip_dpc:
2003 DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n", 2050 DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n",
2004 base_vha->host_no, ha)); 2051 base_vha->host_no, ha));
2005 2052
2006 base_vha->flags.init_done = 1;
2007 base_vha->flags.online = 1;
2008
2009 ret = scsi_add_host(host, &pdev->dev); 2053 ret = scsi_add_host(host, &pdev->dev);
2010 if (ret) 2054 if (ret)
2011 goto probe_failed; 2055 goto probe_failed;
2012 2056
2057 base_vha->flags.init_done = 1;
2058 base_vha->flags.online = 1;
2059
2013 ha->isp_ops->enable_intrs(ha); 2060 ha->isp_ops->enable_intrs(ha);
2014 2061
2015 scsi_scan_host(host); 2062 scsi_scan_host(host);
@@ -2141,6 +2188,24 @@ qla2x00_free_device(scsi_qla_host_t *vha)
2141{ 2188{
2142 struct qla_hw_data *ha = vha->hw; 2189 struct qla_hw_data *ha = vha->hw;
2143 2190
2191 qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16);
2192
2193 /* Disable timer */
2194 if (vha->timer_active)
2195 qla2x00_stop_timer(vha);
2196
2197 /* Kill the kernel thread for this host */
2198 if (ha->dpc_thread) {
2199 struct task_struct *t = ha->dpc_thread;
2200
2201 /*
2202 * qla2xxx_wake_dpc checks for ->dpc_thread
2203 * so we need to zero it out.
2204 */
2205 ha->dpc_thread = NULL;
2206 kthread_stop(t);
2207 }
2208
2144 qla25xx_delete_queues(vha); 2209 qla25xx_delete_queues(vha);
2145 2210
2146 if (ha->flags.fce_enabled) 2211 if (ha->flags.fce_enabled)
@@ -2152,6 +2217,8 @@ qla2x00_free_device(scsi_qla_host_t *vha)
2152 /* Stop currently executing firmware. */ 2217 /* Stop currently executing firmware. */
2153 qla2x00_try_to_stop_firmware(vha); 2218 qla2x00_try_to_stop_firmware(vha);
2154 2219
2220 vha->flags.online = 0;
2221
2155 /* turn-off interrupts on the card */ 2222 /* turn-off interrupts on the card */
2156 if (ha->interrupts_on) 2223 if (ha->interrupts_on)
2157 ha->isp_ops->disable_intrs(ha); 2224 ha->isp_ops->disable_intrs(ha);
@@ -2826,6 +2893,13 @@ qla2x00_do_dpc(void *data)
2826 if (!base_vha->flags.init_done) 2893 if (!base_vha->flags.init_done)
2827 continue; 2894 continue;
2828 2895
2896 if (ha->flags.eeh_busy) {
2897 DEBUG17(qla_printk(KERN_WARNING, ha,
2898 "qla2x00_do_dpc: dpc_flags: %lx\n",
2899 base_vha->dpc_flags));
2900 continue;
2901 }
2902
2829 DEBUG3(printk("scsi(%ld): DPC handler\n", base_vha->host_no)); 2903 DEBUG3(printk("scsi(%ld): DPC handler\n", base_vha->host_no));
2830 2904
2831 ha->dpc_active = 1; 2905 ha->dpc_active = 1;
@@ -3016,8 +3090,13 @@ qla2x00_timer(scsi_qla_host_t *vha)
3016 int index; 3090 int index;
3017 srb_t *sp; 3091 srb_t *sp;
3018 int t; 3092 int t;
3093 uint16_t w;
3019 struct qla_hw_data *ha = vha->hw; 3094 struct qla_hw_data *ha = vha->hw;
3020 struct req_que *req; 3095 struct req_que *req;
3096
3097 /* Hardware read to raise pending EEH errors during mailbox waits. */
3098 if (!pci_channel_offline(ha->pdev))
3099 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
3021 /* 3100 /*
3022 * Ports - Port down timer. 3101 * Ports - Port down timer.
3023 * 3102 *
@@ -3219,16 +3298,23 @@ qla2x00_release_firmware(void)
3219static pci_ers_result_t 3298static pci_ers_result_t
3220qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) 3299qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
3221{ 3300{
3222 scsi_qla_host_t *base_vha = pci_get_drvdata(pdev); 3301 scsi_qla_host_t *vha = pci_get_drvdata(pdev);
3302 struct qla_hw_data *ha = vha->hw;
3303
3304 DEBUG2(qla_printk(KERN_WARNING, ha, "error_detected:state %x\n",
3305 state));
3223 3306
3224 switch (state) { 3307 switch (state) {
3225 case pci_channel_io_normal: 3308 case pci_channel_io_normal:
3309 ha->flags.eeh_busy = 0;
3226 return PCI_ERS_RESULT_CAN_RECOVER; 3310 return PCI_ERS_RESULT_CAN_RECOVER;
3227 case pci_channel_io_frozen: 3311 case pci_channel_io_frozen:
3312 ha->flags.eeh_busy = 1;
3228 pci_disable_device(pdev); 3313 pci_disable_device(pdev);
3229 return PCI_ERS_RESULT_NEED_RESET; 3314 return PCI_ERS_RESULT_NEED_RESET;
3230 case pci_channel_io_perm_failure: 3315 case pci_channel_io_perm_failure:
3231 qla2x00_abort_all_cmds(base_vha, DID_NO_CONNECT << 16); 3316 ha->flags.pci_channel_io_perm_failure = 1;
3317 qla2x00_abort_all_cmds(vha, DID_NO_CONNECT << 16);
3232 return PCI_ERS_RESULT_DISCONNECT; 3318 return PCI_ERS_RESULT_DISCONNECT;
3233 } 3319 }
3234 return PCI_ERS_RESULT_NEED_RESET; 3320 return PCI_ERS_RESULT_NEED_RESET;
@@ -3279,6 +3365,8 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
3279 struct qla_hw_data *ha = base_vha->hw; 3365 struct qla_hw_data *ha = base_vha->hw;
3280 int rc; 3366 int rc;
3281 3367
3368 DEBUG17(qla_printk(KERN_WARNING, ha, "slot_reset\n"));
3369
3282 if (ha->mem_only) 3370 if (ha->mem_only)
3283 rc = pci_enable_device_mem(pdev); 3371 rc = pci_enable_device_mem(pdev);
3284 else 3372 else
@@ -3287,19 +3375,33 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev)
3287 if (rc) { 3375 if (rc) {
3288 qla_printk(KERN_WARNING, ha, 3376 qla_printk(KERN_WARNING, ha,
3289 "Can't re-enable PCI device after reset.\n"); 3377 "Can't re-enable PCI device after reset.\n");
3290
3291 return ret; 3378 return ret;
3292 } 3379 }
3293 pci_set_master(pdev);
3294 3380
3295 if (ha->isp_ops->pci_config(base_vha)) 3381 if (ha->isp_ops->pci_config(base_vha))
3296 return ret; 3382 return ret;
3297 3383
3384#ifdef QL_DEBUG_LEVEL_17
3385 {
3386 uint8_t b;
3387 uint32_t i;
3388
3389 printk("slot_reset_1: ");
3390 for (i = 0; i < 256; i++) {
3391 pci_read_config_byte(ha->pdev, i, &b);
3392 printk("%s%02x", (i%16) ? " " : "\n", b);
3393 }
3394 printk("\n");
3395 }
3396#endif
3298 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); 3397 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
3299 if (qla2x00_abort_isp(base_vha) == QLA_SUCCESS) 3398 if (qla2x00_abort_isp(base_vha) == QLA_SUCCESS)
3300 ret = PCI_ERS_RESULT_RECOVERED; 3399 ret = PCI_ERS_RESULT_RECOVERED;
3301 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); 3400 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags);
3302 3401
3402 DEBUG17(qla_printk(KERN_WARNING, ha,
3403 "slot_reset-return:ret=%x\n", ret));
3404
3303 return ret; 3405 return ret;
3304} 3406}
3305 3407
@@ -3310,12 +3412,17 @@ qla2xxx_pci_resume(struct pci_dev *pdev)
3310 struct qla_hw_data *ha = base_vha->hw; 3412 struct qla_hw_data *ha = base_vha->hw;
3311 int ret; 3413 int ret;
3312 3414
3415 DEBUG17(qla_printk(KERN_WARNING, ha, "pci_resume\n"));
3416
3313 ret = qla2x00_wait_for_hba_online(base_vha); 3417 ret = qla2x00_wait_for_hba_online(base_vha);
3314 if (ret != QLA_SUCCESS) { 3418 if (ret != QLA_SUCCESS) {
3315 qla_printk(KERN_ERR, ha, 3419 qla_printk(KERN_ERR, ha,
3316 "the device failed to resume I/O " 3420 "the device failed to resume I/O "
3317 "from slot/link_reset"); 3421 "from slot/link_reset");
3318 } 3422 }
3423
3424 ha->flags.eeh_busy = 0;
3425
3319 pci_cleanup_aer_uncorrect_error_status(pdev); 3426 pci_cleanup_aer_uncorrect_error_status(pdev);
3320} 3427}
3321 3428
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 807e0dbc67fa..a65dd95507c6 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.03.01-k7" 10#define QLA2XXX_VERSION "8.03.01-k9"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 3 13#define QLA_DRIVER_MINOR_VER 3
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e495d3813948..d8927681ec88 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -859,6 +859,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
859 case 0x07: /* operation in progress */ 859 case 0x07: /* operation in progress */
860 case 0x08: /* Long write in progress */ 860 case 0x08: /* Long write in progress */
861 case 0x09: /* self test in progress */ 861 case 0x09: /* self test in progress */
862 case 0x14: /* space allocation in progress */
862 action = ACTION_DELAYED_RETRY; 863 action = ACTION_DELAYED_RETRY;
863 break; 864 break;
864 default: 865 default:
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 6531c91501be..ddfcecd5099f 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -649,11 +649,22 @@ static __init int fc_transport_init(void)
649 return error; 649 return error;
650 error = transport_class_register(&fc_vport_class); 650 error = transport_class_register(&fc_vport_class);
651 if (error) 651 if (error)
652 return error; 652 goto unreg_host_class;
653 error = transport_class_register(&fc_rport_class); 653 error = transport_class_register(&fc_rport_class);
654 if (error) 654 if (error)
655 return error; 655 goto unreg_vport_class;
656 return transport_class_register(&fc_transport_class); 656 error = transport_class_register(&fc_transport_class);
657 if (error)
658 goto unreg_rport_class;
659 return 0;
660
661unreg_rport_class:
662 transport_class_unregister(&fc_rport_class);
663unreg_vport_class:
664 transport_class_unregister(&fc_vport_class);
665unreg_host_class:
666 transport_class_unregister(&fc_host_class);
667 return error;
657} 668}
658 669
659static void __exit fc_transport_exit(void) 670static void __exit fc_transport_exit(void)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 9093c7261f33..255da53e5a01 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -264,6 +264,15 @@ sd_show_app_tag_own(struct device *dev, struct device_attribute *attr,
264 return snprintf(buf, 20, "%u\n", sdkp->ATO); 264 return snprintf(buf, 20, "%u\n", sdkp->ATO);
265} 265}
266 266
267static ssize_t
268sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr,
269 char *buf)
270{
271 struct scsi_disk *sdkp = to_scsi_disk(dev);
272
273 return snprintf(buf, 20, "%u\n", sdkp->thin_provisioning);
274}
275
267static struct device_attribute sd_disk_attrs[] = { 276static struct device_attribute sd_disk_attrs[] = {
268 __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, 277 __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type,
269 sd_store_cache_type), 278 sd_store_cache_type),
@@ -274,6 +283,7 @@ static struct device_attribute sd_disk_attrs[] = {
274 sd_store_manage_start_stop), 283 sd_store_manage_start_stop),
275 __ATTR(protection_type, S_IRUGO, sd_show_protection_type, NULL), 284 __ATTR(protection_type, S_IRUGO, sd_show_protection_type, NULL),
276 __ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL), 285 __ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL),
286 __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL),
277 __ATTR_NULL, 287 __ATTR_NULL,
278}; 288};
279 289
@@ -399,6 +409,57 @@ static void sd_prot_op(struct scsi_cmnd *scmd, unsigned int dif)
399} 409}
400 410
401/** 411/**
412 * sd_prepare_discard - unmap blocks on thinly provisioned device
413 * @rq: Request to prepare
414 *
415 * Will issue either UNMAP or WRITE SAME(16) depending on preference
416 * indicated by target device.
417 **/
418static int sd_prepare_discard(struct request *rq)
419{
420 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
421 struct bio *bio = rq->bio;
422 sector_t sector = bio->bi_sector;
423 unsigned int num = bio_sectors(bio);
424
425 if (sdkp->device->sector_size == 4096) {
426 sector >>= 3;
427 num >>= 3;
428 }
429
430 rq->cmd_type = REQ_TYPE_BLOCK_PC;
431 rq->timeout = SD_TIMEOUT;
432
433 memset(rq->cmd, 0, rq->cmd_len);
434
435 if (sdkp->unmap) {
436 char *buf = kmap_atomic(bio_page(bio), KM_USER0);
437
438 rq->cmd[0] = UNMAP;
439 rq->cmd[8] = 24;
440 rq->cmd_len = 10;
441
442 /* Ensure that data length matches payload */
443 rq->__data_len = bio->bi_size = bio->bi_io_vec->bv_len = 24;
444
445 put_unaligned_be16(6 + 16, &buf[0]);
446 put_unaligned_be16(16, &buf[2]);
447 put_unaligned_be64(sector, &buf[8]);
448 put_unaligned_be32(num, &buf[16]);
449
450 kunmap_atomic(buf, KM_USER0);
451 } else {
452 rq->cmd[0] = WRITE_SAME_16;
453 rq->cmd[1] = 0x8; /* UNMAP */
454 put_unaligned_be64(sector, &rq->cmd[2]);
455 put_unaligned_be32(num, &rq->cmd[10]);
456 rq->cmd_len = 16;
457 }
458
459 return BLKPREP_OK;
460}
461
462/**
402 * sd_init_command - build a scsi (read or write) command from 463 * sd_init_command - build a scsi (read or write) command from
403 * information in the request structure. 464 * information in the request structure.
404 * @SCpnt: pointer to mid-level's per scsi command structure that 465 * @SCpnt: pointer to mid-level's per scsi command structure that
@@ -418,6 +479,13 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
418 int ret, host_dif; 479 int ret, host_dif;
419 unsigned char protect; 480 unsigned char protect;
420 481
482 /*
483 * Discard request come in as REQ_TYPE_FS but we turn them into
484 * block PC requests to make life easier.
485 */
486 if (blk_discard_rq(rq))
487 ret = sd_prepare_discard(rq);
488
421 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { 489 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
422 ret = scsi_setup_blk_pc_cmnd(sdp, rq); 490 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
423 goto out; 491 goto out;
@@ -1432,6 +1500,19 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
1432 sd_printk(KERN_NOTICE, sdkp, 1500 sd_printk(KERN_NOTICE, sdkp,
1433 "physical block alignment offset: %u\n", alignment); 1501 "physical block alignment offset: %u\n", alignment);
1434 1502
1503 if (buffer[14] & 0x80) { /* TPE */
1504 struct request_queue *q = sdp->request_queue;
1505
1506 sdkp->thin_provisioning = 1;
1507 q->limits.discard_granularity = sdkp->hw_sector_size;
1508 q->limits.max_discard_sectors = 0xffffffff;
1509
1510 if (buffer[14] & 0x40) /* TPRZ */
1511 q->limits.discard_zeroes_data = 1;
1512
1513 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
1514 }
1515
1435 sdkp->capacity = lba + 1; 1516 sdkp->capacity = lba + 1;
1436 return sector_size; 1517 return sector_size;
1437} 1518}
@@ -1863,6 +1944,7 @@ void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
1863 */ 1944 */
1864static void sd_read_block_limits(struct scsi_disk *sdkp) 1945static void sd_read_block_limits(struct scsi_disk *sdkp)
1865{ 1946{
1947 struct request_queue *q = sdkp->disk->queue;
1866 unsigned int sector_sz = sdkp->device->sector_size; 1948 unsigned int sector_sz = sdkp->device->sector_size;
1867 char *buffer; 1949 char *buffer;
1868 1950
@@ -1877,6 +1959,31 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
1877 blk_queue_io_opt(sdkp->disk->queue, 1959 blk_queue_io_opt(sdkp->disk->queue,
1878 get_unaligned_be32(&buffer[12]) * sector_sz); 1960 get_unaligned_be32(&buffer[12]) * sector_sz);
1879 1961
1962 /* Thin provisioning enabled and page length indicates TP support */
1963 if (sdkp->thin_provisioning && buffer[3] == 0x3c) {
1964 unsigned int lba_count, desc_count, granularity;
1965
1966 lba_count = get_unaligned_be32(&buffer[20]);
1967 desc_count = get_unaligned_be32(&buffer[24]);
1968
1969 if (lba_count) {
1970 q->limits.max_discard_sectors =
1971 lba_count * sector_sz >> 9;
1972
1973 if (desc_count)
1974 sdkp->unmap = 1;
1975 }
1976
1977 granularity = get_unaligned_be32(&buffer[28]);
1978
1979 if (granularity)
1980 q->limits.discard_granularity = granularity * sector_sz;
1981
1982 if (buffer[32] & 0x80)
1983 q->limits.discard_alignment =
1984 get_unaligned_be32(&buffer[32]) & ~(1 << 31);
1985 }
1986
1880 kfree(buffer); 1987 kfree(buffer);
1881} 1988}
1882 1989
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index e374804d26fb..43d3caf268ef 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -60,6 +60,8 @@ struct scsi_disk {
60 unsigned RCD : 1; /* state of disk RCD bit, unused */ 60 unsigned RCD : 1; /* state of disk RCD bit, unused */
61 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ 61 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
62 unsigned first_scan : 1; 62 unsigned first_scan : 1;
63 unsigned thin_provisioning : 1;
64 unsigned unmap : 1;
63}; 65};
64#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) 66#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
65 67
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index ad59abb47722..d04ea9a6f673 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -552,13 +552,15 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd
552 SRpnt->waiting = waiting; 552 SRpnt->waiting = waiting;
553 553
554 if (STp->buffer->do_dio) { 554 if (STp->buffer->do_dio) {
555 mdata->page_order = 0;
555 mdata->nr_entries = STp->buffer->sg_segs; 556 mdata->nr_entries = STp->buffer->sg_segs;
556 mdata->pages = STp->buffer->mapped_pages; 557 mdata->pages = STp->buffer->mapped_pages;
557 } else { 558 } else {
559 mdata->page_order = STp->buffer->reserved_page_order;
558 mdata->nr_entries = 560 mdata->nr_entries =
559 DIV_ROUND_UP(bytes, PAGE_SIZE << mdata->page_order); 561 DIV_ROUND_UP(bytes, PAGE_SIZE << mdata->page_order);
560 STp->buffer->map_data.pages = STp->buffer->reserved_pages; 562 mdata->pages = STp->buffer->reserved_pages;
561 STp->buffer->map_data.offset = 0; 563 mdata->offset = 0;
562 } 564 }
563 565
564 memcpy(SRpnt->cmd, cmd, sizeof(SRpnt->cmd)); 566 memcpy(SRpnt->cmd, cmd, sizeof(SRpnt->cmd));
@@ -3719,7 +3721,7 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
3719 priority |= __GFP_ZERO; 3721 priority |= __GFP_ZERO;
3720 3722
3721 if (STbuffer->frp_segs) { 3723 if (STbuffer->frp_segs) {
3722 order = STbuffer->map_data.page_order; 3724 order = STbuffer->reserved_page_order;
3723 b_size = PAGE_SIZE << order; 3725 b_size = PAGE_SIZE << order;
3724 } else { 3726 } else {
3725 for (b_size = PAGE_SIZE, order = 0; 3727 for (b_size = PAGE_SIZE, order = 0;
@@ -3752,7 +3754,7 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
3752 segs++; 3754 segs++;
3753 } 3755 }
3754 STbuffer->b_data = page_address(STbuffer->reserved_pages[0]); 3756 STbuffer->b_data = page_address(STbuffer->reserved_pages[0]);
3755 STbuffer->map_data.page_order = order; 3757 STbuffer->reserved_page_order = order;
3756 3758
3757 return 1; 3759 return 1;
3758} 3760}
@@ -3765,7 +3767,7 @@ static void clear_buffer(struct st_buffer * st_bp)
3765 3767
3766 for (i=0; i < st_bp->frp_segs; i++) 3768 for (i=0; i < st_bp->frp_segs; i++)
3767 memset(page_address(st_bp->reserved_pages[i]), 0, 3769 memset(page_address(st_bp->reserved_pages[i]), 0,
3768 PAGE_SIZE << st_bp->map_data.page_order); 3770 PAGE_SIZE << st_bp->reserved_page_order);
3769 st_bp->cleared = 1; 3771 st_bp->cleared = 1;
3770} 3772}
3771 3773
@@ -3773,7 +3775,7 @@ static void clear_buffer(struct st_buffer * st_bp)
3773/* Release the extra buffer */ 3775/* Release the extra buffer */
3774static void normalize_buffer(struct st_buffer * STbuffer) 3776static void normalize_buffer(struct st_buffer * STbuffer)
3775{ 3777{
3776 int i, order = STbuffer->map_data.page_order; 3778 int i, order = STbuffer->reserved_page_order;
3777 3779
3778 for (i = 0; i < STbuffer->frp_segs; i++) { 3780 for (i = 0; i < STbuffer->frp_segs; i++) {
3779 __free_pages(STbuffer->reserved_pages[i], order); 3781 __free_pages(STbuffer->reserved_pages[i], order);
@@ -3781,7 +3783,7 @@ static void normalize_buffer(struct st_buffer * STbuffer)
3781 } 3783 }
3782 STbuffer->frp_segs = 0; 3784 STbuffer->frp_segs = 0;
3783 STbuffer->sg_segs = 0; 3785 STbuffer->sg_segs = 0;
3784 STbuffer->map_data.page_order = 0; 3786 STbuffer->reserved_page_order = 0;
3785 STbuffer->map_data.offset = 0; 3787 STbuffer->map_data.offset = 0;
3786} 3788}
3787 3789
@@ -3791,7 +3793,7 @@ static void normalize_buffer(struct st_buffer * STbuffer)
3791static int append_to_buffer(const char __user *ubp, struct st_buffer * st_bp, int do_count) 3793static int append_to_buffer(const char __user *ubp, struct st_buffer * st_bp, int do_count)
3792{ 3794{
3793 int i, cnt, res, offset; 3795 int i, cnt, res, offset;
3794 int length = PAGE_SIZE << st_bp->map_data.page_order; 3796 int length = PAGE_SIZE << st_bp->reserved_page_order;
3795 3797
3796 for (i = 0, offset = st_bp->buffer_bytes; 3798 for (i = 0, offset = st_bp->buffer_bytes;
3797 i < st_bp->frp_segs && offset >= length; i++) 3799 i < st_bp->frp_segs && offset >= length; i++)
@@ -3823,7 +3825,7 @@ static int append_to_buffer(const char __user *ubp, struct st_buffer * st_bp, in
3823static int from_buffer(struct st_buffer * st_bp, char __user *ubp, int do_count) 3825static int from_buffer(struct st_buffer * st_bp, char __user *ubp, int do_count)
3824{ 3826{
3825 int i, cnt, res, offset; 3827 int i, cnt, res, offset;
3826 int length = PAGE_SIZE << st_bp->map_data.page_order; 3828 int length = PAGE_SIZE << st_bp->reserved_page_order;
3827 3829
3828 for (i = 0, offset = st_bp->read_pointer; 3830 for (i = 0, offset = st_bp->read_pointer;
3829 i < st_bp->frp_segs && offset >= length; i++) 3831 i < st_bp->frp_segs && offset >= length; i++)
@@ -3856,7 +3858,7 @@ static void move_buffer_data(struct st_buffer * st_bp, int offset)
3856{ 3858{
3857 int src_seg, dst_seg, src_offset = 0, dst_offset; 3859 int src_seg, dst_seg, src_offset = 0, dst_offset;
3858 int count, total; 3860 int count, total;
3859 int length = PAGE_SIZE << st_bp->map_data.page_order; 3861 int length = PAGE_SIZE << st_bp->reserved_page_order;
3860 3862
3861 if (offset == 0) 3863 if (offset == 0)
3862 return; 3864 return;
@@ -4578,7 +4580,6 @@ static int sgl_map_user_pages(struct st_buffer *STbp,
4578 } 4580 }
4579 4581
4580 mdata->offset = uaddr & ~PAGE_MASK; 4582 mdata->offset = uaddr & ~PAGE_MASK;
4581 mdata->page_order = 0;
4582 STbp->mapped_pages = pages; 4583 STbp->mapped_pages = pages;
4583 4584
4584 return nr_pages; 4585 return nr_pages;
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
index 544dc6b1f548..f91a67c6d968 100644
--- a/drivers/scsi/st.h
+++ b/drivers/scsi/st.h
@@ -46,6 +46,7 @@ struct st_buffer {
46 struct st_request *last_SRpnt; 46 struct st_request *last_SRpnt;
47 struct st_cmdstatus cmdstat; 47 struct st_cmdstatus cmdstat;
48 struct page **reserved_pages; 48 struct page **reserved_pages;
49 int reserved_page_order;
49 struct page **mapped_pages; 50 struct page **mapped_pages;
50 struct rq_map_data map_data; 51 struct rq_map_data map_data;
51 unsigned char *b_data; 52 unsigned char *b_data;
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 3058bb1aff95..fd7b15be7640 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -623,6 +623,11 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
623 } 623 }
624 break; 624 break;
625 case INQUIRY: 625 case INQUIRY:
626 if (lun >= host->max_lun) {
627 cmd->result = DID_NO_CONNECT << 16;
628 done(cmd);
629 return 0;
630 }
626 if (id != host->max_id - 1) 631 if (id != host->max_id - 1)
627 break; 632 break;
628 if (!lun && !cmd->device->channel && 633 if (!lun && !cmd->device->channel &&
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 1e3d19397a59..8681f1345056 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -58,7 +58,7 @@ static const char serial21285_name[] = "Footbridge UART";
58static void serial21285_stop_tx(struct uart_port *port) 58static void serial21285_stop_tx(struct uart_port *port)
59{ 59{
60 if (tx_enabled(port)) { 60 if (tx_enabled(port)) {
61 disable_irq(IRQ_CONTX); 61 disable_irq_nosync(IRQ_CONTX);
62 tx_enabled(port) = 0; 62 tx_enabled(port) = 0;
63 } 63 }
64} 64}
@@ -74,7 +74,7 @@ static void serial21285_start_tx(struct uart_port *port)
74static void serial21285_stop_rx(struct uart_port *port) 74static void serial21285_stop_rx(struct uart_port *port)
75{ 75{
76 if (rx_enabled(port)) { 76 if (rx_enabled(port)) {
77 disable_irq(IRQ_CONRX); 77 disable_irq_nosync(IRQ_CONRX);
78 rx_enabled(port) = 0; 78 rx_enabled(port) = 0;
79 } 79 }
80} 80}
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index fc413f0f8dd2..0ee7239c5d69 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -819,6 +819,7 @@ static struct pcmcia_device_id serial_ids[] = {
819 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"), 819 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"),
820 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"), 820 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"),
821 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */ 821 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC850 3G Network Adapter R1 */
822 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC860", 0xd85f6206, 0x698f93db, "cis/SW_8xx_SER.cis"), /* Sierra Wireless AC860 3G Network Adapter R1 */
822 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC710/AC750", 0xd85f6206, 0x761b11e0, "cis/SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */ 823 PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC710/AC750", 0xd85f6206, 0x761b11e0, "cis/SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */
823 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */ 824 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */
824 PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */ 825 PCMCIA_DEVICE_CIS_MANF_CARD(0x013f, 0xa555, "cis/SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- post update */
@@ -827,7 +828,7 @@ static struct pcmcia_device_id serial_ids[] = {
827 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"), 828 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "cis/COMpad4.cis"),
828 PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "cis/COMpad2.cis"), 829 PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "cis/COMpad2.cis"),
829 PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"), 830 PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "cis/RS-COM-2P.cis"),
830 PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), 831 PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "cis/GLOBETROTTER.cis"),
831 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b), 832 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100 1.00.",0x19ca78af,0xf964f42b),
832 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83), 833 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL100",0x19ca78af,0x71d98e83),
833 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490), 834 PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.","SERIAL CARD: SL232 1.00.",0x19ca78af,0x69fb7490),
@@ -861,6 +862,18 @@ static struct pcmcia_device_id serial_ids[] = {
861}; 862};
862MODULE_DEVICE_TABLE(pcmcia, serial_ids); 863MODULE_DEVICE_TABLE(pcmcia, serial_ids);
863 864
865MODULE_FIRMWARE("cis/PCMLM28.cis");
866MODULE_FIRMWARE("cis/DP83903.cis");
867MODULE_FIRMWARE("cis/3CCFEM556.cis");
868MODULE_FIRMWARE("cis/3CXEM556.cis");
869MODULE_FIRMWARE("cis/SW_8xx_SER.cis");
870MODULE_FIRMWARE("cis/SW_7xx_SER.cis");
871MODULE_FIRMWARE("cis/SW_555_SER.cis");
872MODULE_FIRMWARE("cis/MT5634ZLX.cis");
873MODULE_FIRMWARE("cis/COMpad2.cis");
874MODULE_FIRMWARE("cis/COMpad4.cis");
875MODULE_FIRMWARE("cis/RS-COM-2P.cis");
876
864static struct pcmcia_driver serial_cs_driver = { 877static struct pcmcia_driver serial_cs_driver = {
865 .owner = THIS_MODULE, 878 .owner = THIS_MODULE,
866 .drv = { 879 .drv = {
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 68c7f6cfd728..37f0de9dd9ce 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -222,9 +222,9 @@ static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
222 Set SCP6MD1,0 = {01} (output) */ 222 Set SCP6MD1,0 = {01} (output) */
223 __raw_writew((data & 0x0fcf) | 0x1000, SCPCR); 223 __raw_writew((data & 0x0fcf) | 0x1000, SCPCR);
224 224
225 data = ctrl_inb(SCPDR); 225 data = __raw_readb(SCPDR);
226 /* Set /RTS2 (bit6) = 0 */ 226 /* Set /RTS2 (bit6) = 0 */
227 ctrl_outb(data & 0xbf, SCPDR); 227 __raw_writeb(data & 0xbf, SCPDR);
228 } 228 }
229} 229}
230#elif defined(CONFIG_CPU_SUBTYPE_SH7722) 230#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
@@ -897,11 +897,21 @@ static void sci_shutdown(struct uart_port *port)
897static void sci_set_termios(struct uart_port *port, struct ktermios *termios, 897static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
898 struct ktermios *old) 898 struct ktermios *old)
899{ 899{
900 unsigned int status, baud, smr_val; 900 unsigned int status, baud, smr_val, max_baud;
901 int t = -1; 901 int t = -1;
902 902
903 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 903 /*
904 if (likely(baud)) 904 * earlyprintk comes here early on with port->uartclk set to zero.
905 * the clock framework is not up and running at this point so here
906 * we assume that 115200 is the maximum baud rate. please note that
907 * the baud rate is not programmed during earlyprintk - it is assumed
908 * that the previous boot loader has enabled required clocks and
909 * setup the baud rate generator hardware for us already.
910 */
911 max_baud = port->uartclk ? port->uartclk / 16 : 115200;
912
913 baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
914 if (likely(baud && port->uartclk))
905 t = SCBRR_VALUE(baud, port->uartclk); 915 t = SCBRR_VALUE(baud, port->uartclk);
906 916
907 do { 917 do {
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index a32094eeb42b..0efcded59ae6 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -517,20 +517,20 @@ static const struct __attribute__((packed)) {
517static inline int sci_rxd_in(struct uart_port *port) 517static inline int sci_rxd_in(struct uart_port *port)
518{ 518{
519 if (port->mapbase == 0xfffffe80) 519 if (port->mapbase == 0xfffffe80)
520 return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCI */ 520 return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
521 if (port->mapbase == 0xa4000150) 521 if (port->mapbase == 0xa4000150)
522 return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */ 522 return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
523 if (port->mapbase == 0xa4000140) 523 if (port->mapbase == 0xa4000140)
524 return ctrl_inb(SCPDR)&0x04 ? 1 : 0; /* IRDA */ 524 return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
525 return 1; 525 return 1;
526} 526}
527#elif defined(CONFIG_CPU_SUBTYPE_SH7705) 527#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
528static inline int sci_rxd_in(struct uart_port *port) 528static inline int sci_rxd_in(struct uart_port *port)
529{ 529{
530 if (port->mapbase == SCIF0) 530 if (port->mapbase == SCIF0)
531 return ctrl_inb(SCPDR)&0x04 ? 1 : 0; /* IRDA */ 531 return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
532 if (port->mapbase == SCIF2) 532 if (port->mapbase == SCIF2)
533 return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */ 533 return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
534 return 1; 534 return 1;
535} 535}
536#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 536#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
@@ -557,68 +557,68 @@ static inline int sci_rxd_in(struct uart_port *port)
557static inline int sci_rxd_in(struct uart_port *port) 557static inline int sci_rxd_in(struct uart_port *port)
558{ 558{
559 if (port->mapbase == 0xffe00000) 559 if (port->mapbase == 0xffe00000)
560 return ctrl_inb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */ 560 return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
561 if (port->mapbase == 0xffe80000) 561 if (port->mapbase == 0xffe80000)
562 return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ 562 return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
563 return 1; 563 return 1;
564} 564}
565#elif defined(CONFIG_CPU_SUBTYPE_SH4_202) 565#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
566static inline int sci_rxd_in(struct uart_port *port) 566static inline int sci_rxd_in(struct uart_port *port)
567{ 567{
568 if (port->mapbase == 0xffe80000) 568 if (port->mapbase == 0xffe80000)
569 return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */ 569 return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
570 return 1; 570 return 1;
571} 571}
572#elif defined(CONFIG_CPU_SUBTYPE_SH7757) 572#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
573static inline int sci_rxd_in(struct uart_port *port) 573static inline int sci_rxd_in(struct uart_port *port)
574{ 574{
575 if (port->mapbase == 0xfe4b0000) 575 if (port->mapbase == 0xfe4b0000)
576 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; 576 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0;
577 if (port->mapbase == 0xfe4c0000) 577 if (port->mapbase == 0xfe4c0000)
578 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; 578 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0;
579 if (port->mapbase == 0xfe4d0000) 579 if (port->mapbase == 0xfe4d0000)
580 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; 580 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0;
581} 581}
582#elif defined(CONFIG_CPU_SUBTYPE_SH7760) 582#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
583static inline int sci_rxd_in(struct uart_port *port) 583static inline int sci_rxd_in(struct uart_port *port)
584{ 584{
585 if (port->mapbase == 0xfe600000) 585 if (port->mapbase == 0xfe600000)
586 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 586 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
587 if (port->mapbase == 0xfe610000) 587 if (port->mapbase == 0xfe610000)
588 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 588 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
589 if (port->mapbase == 0xfe620000) 589 if (port->mapbase == 0xfe620000)
590 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 590 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
591 return 1; 591 return 1;
592} 592}
593#elif defined(CONFIG_CPU_SUBTYPE_SH7343) 593#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
594static inline int sci_rxd_in(struct uart_port *port) 594static inline int sci_rxd_in(struct uart_port *port)
595{ 595{
596 if (port->mapbase == 0xffe00000) 596 if (port->mapbase == 0xffe00000)
597 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 597 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
598 if (port->mapbase == 0xffe10000) 598 if (port->mapbase == 0xffe10000)
599 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 599 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
600 if (port->mapbase == 0xffe20000) 600 if (port->mapbase == 0xffe20000)
601 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 601 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
602 if (port->mapbase == 0xffe30000) 602 if (port->mapbase == 0xffe30000)
603 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 603 return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
604 return 1; 604 return 1;
605} 605}
606#elif defined(CONFIG_CPU_SUBTYPE_SH7366) 606#elif defined(CONFIG_CPU_SUBTYPE_SH7366)
607static inline int sci_rxd_in(struct uart_port *port) 607static inline int sci_rxd_in(struct uart_port *port)
608{ 608{
609 if (port->mapbase == 0xffe00000) 609 if (port->mapbase == 0xffe00000)
610 return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ 610 return __raw_readb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */
611 return 1; 611 return 1;
612} 612}
613#elif defined(CONFIG_CPU_SUBTYPE_SH7722) 613#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
614static inline int sci_rxd_in(struct uart_port *port) 614static inline int sci_rxd_in(struct uart_port *port)
615{ 615{
616 if (port->mapbase == 0xffe00000) 616 if (port->mapbase == 0xffe00000)
617 return ctrl_inb(PSDR) & 0x02 ? 1 : 0; /* SCIF0 */ 617 return __raw_readb(PSDR) & 0x02 ? 1 : 0; /* SCIF0 */
618 if (port->mapbase == 0xffe10000) 618 if (port->mapbase == 0xffe10000)
619 return ctrl_inb(PADR) & 0x40 ? 1 : 0; /* SCIF1 */ 619 return __raw_readb(PADR) & 0x40 ? 1 : 0; /* SCIF1 */
620 if (port->mapbase == 0xffe20000) 620 if (port->mapbase == 0xffe20000)
621 return ctrl_inb(PWDR) & 0x04 ? 1 : 0; /* SCIF2 */ 621 return __raw_readb(PWDR) & 0x04 ? 1 : 0; /* SCIF2 */
622 622
623 return 1; 623 return 1;
624} 624}
@@ -626,17 +626,17 @@ static inline int sci_rxd_in(struct uart_port *port)
626static inline int sci_rxd_in(struct uart_port *port) 626static inline int sci_rxd_in(struct uart_port *port)
627{ 627{
628 if (port->mapbase == 0xffe00000) 628 if (port->mapbase == 0xffe00000)
629 return ctrl_inb(SCSPTR0) & 0x0008 ? 1 : 0; /* SCIF0 */ 629 return __raw_readb(SCSPTR0) & 0x0008 ? 1 : 0; /* SCIF0 */
630 if (port->mapbase == 0xffe10000) 630 if (port->mapbase == 0xffe10000)
631 return ctrl_inb(SCSPTR1) & 0x0020 ? 1 : 0; /* SCIF1 */ 631 return __raw_readb(SCSPTR1) & 0x0020 ? 1 : 0; /* SCIF1 */
632 if (port->mapbase == 0xffe20000) 632 if (port->mapbase == 0xffe20000)
633 return ctrl_inb(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF2 */ 633 return __raw_readb(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF2 */
634 if (port->mapbase == 0xa4e30000) 634 if (port->mapbase == 0xa4e30000)
635 return ctrl_inb(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF3 */ 635 return __raw_readb(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF3 */
636 if (port->mapbase == 0xa4e40000) 636 if (port->mapbase == 0xa4e40000)
637 return ctrl_inb(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF4 */ 637 return __raw_readb(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF4 */
638 if (port->mapbase == 0xa4e50000) 638 if (port->mapbase == 0xa4e50000)
639 return ctrl_inb(SCSPTR5) & 0x0008 ? 1 : 0; /* SCIF5 */ 639 return __raw_readb(SCSPTR5) & 0x0008 ? 1 : 0; /* SCIF5 */
640 return 1; 640 return 1;
641} 641}
642#elif defined(CONFIG_CPU_SUBTYPE_SH7724) 642#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
@@ -645,9 +645,9 @@ static inline int sci_rxd_in(struct uart_port *port)
645static inline int sci_rxd_in(struct uart_port *port) 645static inline int sci_rxd_in(struct uart_port *port)
646{ 646{
647 if (port->type == PORT_SCIF) 647 if (port->type == PORT_SCIF)
648 return ctrl_inw((port->mapbase + SCFSR)) & SCIF_BRK ? 1 : 0; 648 return __raw_readw((port->mapbase + SCFSR)) & SCIF_BRK ? 1 : 0;
649 if (port->type == PORT_SCIFA) 649 if (port->type == PORT_SCIFA)
650 return ctrl_inw((port->mapbase + SCASSR)) & SCIF_BRK ? 1 : 0; 650 return __raw_readw((port->mapbase + SCASSR)) & SCIF_BRK ? 1 : 0;
651 return 1; 651 return 1;
652} 652}
653#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 653#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
@@ -665,11 +665,11 @@ static inline int sci_rxd_in(struct uart_port *port)
665static inline int sci_rxd_in(struct uart_port *port) 665static inline int sci_rxd_in(struct uart_port *port)
666{ 666{
667 if (port->mapbase == 0xffe00000) 667 if (port->mapbase == 0xffe00000)
668 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 668 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
669 if (port->mapbase == 0xffe08000) 669 if (port->mapbase == 0xffe08000)
670 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 670 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
671 if (port->mapbase == 0xffe10000) 671 if (port->mapbase == 0xffe10000)
672 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */ 672 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */
673 673
674 return 1; 674 return 1;
675} 675}
@@ -677,20 +677,20 @@ static inline int sci_rxd_in(struct uart_port *port)
677static inline int sci_rxd_in(struct uart_port *port) 677static inline int sci_rxd_in(struct uart_port *port)
678{ 678{
679 if (port->mapbase == 0xff923000) 679 if (port->mapbase == 0xff923000)
680 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 680 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
681 if (port->mapbase == 0xff924000) 681 if (port->mapbase == 0xff924000)
682 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 682 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
683 if (port->mapbase == 0xff925000) 683 if (port->mapbase == 0xff925000)
684 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 684 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
685 return 1; 685 return 1;
686} 686}
687#elif defined(CONFIG_CPU_SUBTYPE_SH7780) 687#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
688static inline int sci_rxd_in(struct uart_port *port) 688static inline int sci_rxd_in(struct uart_port *port)
689{ 689{
690 if (port->mapbase == 0xffe00000) 690 if (port->mapbase == 0xffe00000)
691 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 691 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
692 if (port->mapbase == 0xffe10000) 692 if (port->mapbase == 0xffe10000)
693 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 693 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
694 return 1; 694 return 1;
695} 695}
696#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \ 696#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
@@ -698,17 +698,17 @@ static inline int sci_rxd_in(struct uart_port *port)
698static inline int sci_rxd_in(struct uart_port *port) 698static inline int sci_rxd_in(struct uart_port *port)
699{ 699{
700 if (port->mapbase == 0xffea0000) 700 if (port->mapbase == 0xffea0000)
701 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 701 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
702 if (port->mapbase == 0xffeb0000) 702 if (port->mapbase == 0xffeb0000)
703 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 703 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
704 if (port->mapbase == 0xffec0000) 704 if (port->mapbase == 0xffec0000)
705 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 705 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
706 if (port->mapbase == 0xffed0000) 706 if (port->mapbase == 0xffed0000)
707 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 707 return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
708 if (port->mapbase == 0xffee0000) 708 if (port->mapbase == 0xffee0000)
709 return ctrl_inw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */ 709 return __raw_readw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */
710 if (port->mapbase == 0xffef0000) 710 if (port->mapbase == 0xffef0000)
711 return ctrl_inw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */ 711 return __raw_readw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */
712 return 1; 712 return 1;
713} 713}
714#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \ 714#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
@@ -718,22 +718,22 @@ static inline int sci_rxd_in(struct uart_port *port)
718static inline int sci_rxd_in(struct uart_port *port) 718static inline int sci_rxd_in(struct uart_port *port)
719{ 719{
720 if (port->mapbase == 0xfffe8000) 720 if (port->mapbase == 0xfffe8000)
721 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 721 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
722 if (port->mapbase == 0xfffe8800) 722 if (port->mapbase == 0xfffe8800)
723 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 723 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
724 if (port->mapbase == 0xfffe9000) 724 if (port->mapbase == 0xfffe9000)
725 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 725 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
726 if (port->mapbase == 0xfffe9800) 726 if (port->mapbase == 0xfffe9800)
727 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 727 return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
728#if defined(CONFIG_CPU_SUBTYPE_SH7201) 728#if defined(CONFIG_CPU_SUBTYPE_SH7201)
729 if (port->mapbase == 0xfffeA000) 729 if (port->mapbase == 0xfffeA000)
730 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 730 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
731 if (port->mapbase == 0xfffeA800) 731 if (port->mapbase == 0xfffeA800)
732 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 732 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
733 if (port->mapbase == 0xfffeB000) 733 if (port->mapbase == 0xfffeB000)
734 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 734 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
735 if (port->mapbase == 0xfffeB800) 735 if (port->mapbase == 0xfffeB800)
736 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 736 return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
737#endif 737#endif
738 return 1; 738 return 1;
739} 739}
@@ -741,24 +741,24 @@ static inline int sci_rxd_in(struct uart_port *port)
741static inline int sci_rxd_in(struct uart_port *port) 741static inline int sci_rxd_in(struct uart_port *port)
742{ 742{
743 if (port->mapbase == 0xf8400000) 743 if (port->mapbase == 0xf8400000)
744 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 744 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
745 if (port->mapbase == 0xf8410000) 745 if (port->mapbase == 0xf8410000)
746 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 746 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
747 if (port->mapbase == 0xf8420000) 747 if (port->mapbase == 0xf8420000)
748 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 748 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
749 return 1; 749 return 1;
750} 750}
751#elif defined(CONFIG_CPU_SUBTYPE_SHX3) 751#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
752static inline int sci_rxd_in(struct uart_port *port) 752static inline int sci_rxd_in(struct uart_port *port)
753{ 753{
754 if (port->mapbase == 0xffc30000) 754 if (port->mapbase == 0xffc30000)
755 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 755 return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
756 if (port->mapbase == 0xffc40000) 756 if (port->mapbase == 0xffc40000)
757 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 757 return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
758 if (port->mapbase == 0xffc50000) 758 if (port->mapbase == 0xffc50000)
759 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 759 return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
760 if (port->mapbase == 0xffc60000) 760 if (port->mapbase == 0xffc60000)
761 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ 761 return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
762 return 1; 762 return 1;
763} 763}
764#endif 764#endif
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 2d9d70359360..f55eb0107336 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -216,6 +216,17 @@ config SPI_S3C24XX
216 help 216 help
217 SPI driver for Samsung S3C24XX series ARM SoCs 217 SPI driver for Samsung S3C24XX series ARM SoCs
218 218
219config SPI_S3C24XX_FIQ
220 bool "S3C24XX driver with FIQ pseudo-DMA"
221 depends on SPI_S3C24XX
222 select FIQ
223 help
224 Enable FIQ support for the S3C24XX SPI driver to provide pseudo
225 DMA by using the fast-interrupt request framework, This allows
226 the driver to get DMA-like performance when there are either
227 no free DMA channels, or when doing transfers that required both
228 TX and RX data paths.
229
219config SPI_S3C24XX_GPIO 230config SPI_S3C24XX_GPIO
220 tristate "Samsung S3C24XX series SPI by GPIO" 231 tristate "Samsung S3C24XX series SPI by GPIO"
221 depends on ARCH_S3C2410 && EXPERIMENTAL 232 depends on ARCH_S3C2410 && EXPERIMENTAL
@@ -226,6 +237,13 @@ config SPI_S3C24XX_GPIO
226 the inbuilt hardware cannot provide the transfer mode, or 237 the inbuilt hardware cannot provide the transfer mode, or
227 where the board is using non hardware connected pins. 238 where the board is using non hardware connected pins.
228 239
240config SPI_S3C64XX
241 tristate "Samsung S3C64XX series type SPI"
242 depends on ARCH_S3C64XX && EXPERIMENTAL
243 select S3C64XX_DMA
244 help
245 SPI driver for Samsung S3C64XX and newer SoCs.
246
229config SPI_SH_MSIOF 247config SPI_SH_MSIOF
230 tristate "SuperH MSIOF SPI controller" 248 tristate "SuperH MSIOF SPI controller"
231 depends on SUPERH && HAVE_CLK 249 depends on SUPERH && HAVE_CLK
@@ -289,6 +307,16 @@ config SPI_NUC900
289# Add new SPI master controllers in alphabetical order above this line 307# Add new SPI master controllers in alphabetical order above this line
290# 308#
291 309
310config SPI_DESIGNWARE
311 bool "DesignWare SPI controller core support"
312 depends on SPI_MASTER
313 help
314 general driver for SPI controller core from DesignWare
315
316config SPI_DW_PCI
317 tristate "PCI interface driver for DW SPI core"
318 depends on SPI_DESIGNWARE && PCI
319
292# 320#
293# There are lots of SPI device types, with sensors and memory 321# There are lots of SPI device types, with sensors and memory
294# being probably the most widely used ones. 322# being probably the most widely used ones.
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index ed8c1675b52f..f3d2810ba11c 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -16,6 +16,8 @@ obj-$(CONFIG_SPI_BFIN) += spi_bfin5xx.o
16obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o 16obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o
17obj-$(CONFIG_SPI_AU1550) += au1550_spi.o 17obj-$(CONFIG_SPI_AU1550) += au1550_spi.o
18obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o 18obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o
19obj-$(CONFIG_SPI_DESIGNWARE) += dw_spi.o
20obj-$(CONFIG_SPI_DW_PCI) += dw_spi_pci.o
19obj-$(CONFIG_SPI_GPIO) += spi_gpio.o 21obj-$(CONFIG_SPI_GPIO) += spi_gpio.o
20obj-$(CONFIG_SPI_IMX) += spi_imx.o 22obj-$(CONFIG_SPI_IMX) += spi_imx.o
21obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o 23obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o
@@ -30,7 +32,8 @@ obj-$(CONFIG_SPI_MPC52xx) += mpc52xx_spi.o
30obj-$(CONFIG_SPI_MPC8xxx) += spi_mpc8xxx.o 32obj-$(CONFIG_SPI_MPC8xxx) += spi_mpc8xxx.o
31obj-$(CONFIG_SPI_PPC4xx) += spi_ppc4xx.o 33obj-$(CONFIG_SPI_PPC4xx) += spi_ppc4xx.o
32obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o 34obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o
33obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx.o 35obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx_hw.o
36obj-$(CONFIG_SPI_S3C64XX) += spi_s3c64xx.o
34obj-$(CONFIG_SPI_TXX9) += spi_txx9.o 37obj-$(CONFIG_SPI_TXX9) += spi_txx9.o
35obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o 38obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o
36obj-$(CONFIG_SPI_XILINX_OF) += xilinx_spi_of.o 39obj-$(CONFIG_SPI_XILINX_OF) += xilinx_spi_of.o
@@ -39,6 +42,11 @@ obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o
39obj-$(CONFIG_SPI_SH_MSIOF) += spi_sh_msiof.o 42obj-$(CONFIG_SPI_SH_MSIOF) += spi_sh_msiof.o
40obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o 43obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o
41obj-$(CONFIG_SPI_NUC900) += spi_nuc900.o 44obj-$(CONFIG_SPI_NUC900) += spi_nuc900.o
45
46# special build for s3c24xx spi driver with fiq support
47spi_s3c24xx_hw-y := spi_s3c24xx.o
48spi_s3c24xx_hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi_s3c24xx_fiq.o
49
42# ... add above this line ... 50# ... add above this line ...
43 51
44# SPI protocol drivers (device/link on bus) 52# SPI protocol drivers (device/link on bus)
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index f5b3fdbb1e27..d21c24eaf0a9 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -189,14 +189,14 @@ static void atmel_spi_next_xfer_data(struct spi_master *master,
189 189
190 /* use scratch buffer only when rx or tx data is unspecified */ 190 /* use scratch buffer only when rx or tx data is unspecified */
191 if (xfer->rx_buf) 191 if (xfer->rx_buf)
192 *rx_dma = xfer->rx_dma + xfer->len - len; 192 *rx_dma = xfer->rx_dma + xfer->len - *plen;
193 else { 193 else {
194 *rx_dma = as->buffer_dma; 194 *rx_dma = as->buffer_dma;
195 if (len > BUFFER_SIZE) 195 if (len > BUFFER_SIZE)
196 len = BUFFER_SIZE; 196 len = BUFFER_SIZE;
197 } 197 }
198 if (xfer->tx_buf) 198 if (xfer->tx_buf)
199 *tx_dma = xfer->tx_dma + xfer->len - len; 199 *tx_dma = xfer->tx_dma + xfer->len - *plen;
200 else { 200 else {
201 *tx_dma = as->buffer_dma; 201 *tx_dma = as->buffer_dma;
202 if (len > BUFFER_SIZE) 202 if (len > BUFFER_SIZE)
@@ -788,7 +788,7 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
788 spin_lock_init(&as->lock); 788 spin_lock_init(&as->lock);
789 INIT_LIST_HEAD(&as->queue); 789 INIT_LIST_HEAD(&as->queue);
790 as->pdev = pdev; 790 as->pdev = pdev;
791 as->regs = ioremap(regs->start, (regs->end - regs->start) + 1); 791 as->regs = ioremap(regs->start, resource_size(regs));
792 if (!as->regs) 792 if (!as->regs)
793 goto out_free_buffer; 793 goto out_free_buffer;
794 as->irq = irq; 794 as->irq = irq;
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
new file mode 100644
index 000000000000..31620fae77be
--- /dev/null
+++ b/drivers/spi/dw_spi.c
@@ -0,0 +1,944 @@
1/*
2 * dw_spi.c - Designware SPI core controller driver (refer pxa2xx_spi.c)
3 *
4 * Copyright (c) 2009, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include <linux/dma-mapping.h>
21#include <linux/interrupt.h>
22#include <linux/highmem.h>
23#include <linux/delay.h>
24
25#include <linux/spi/dw_spi.h>
26#include <linux/spi/spi.h>
27
28#ifdef CONFIG_DEBUG_FS
29#include <linux/debugfs.h>
30#endif
31
32#define START_STATE ((void *)0)
33#define RUNNING_STATE ((void *)1)
34#define DONE_STATE ((void *)2)
35#define ERROR_STATE ((void *)-1)
36
37#define QUEUE_RUNNING 0
38#define QUEUE_STOPPED 1
39
40#define MRST_SPI_DEASSERT 0
41#define MRST_SPI_ASSERT 1
42
43/* Slave spi_dev related */
44struct chip_data {
45 u16 cr0;
46 u8 cs; /* chip select pin */
47 u8 n_bytes; /* current is a 1/2/4 byte op */
48 u8 tmode; /* TR/TO/RO/EEPROM */
49 u8 type; /* SPI/SSP/MicroWire */
50
51 u8 poll_mode; /* 1 means use poll mode */
52
53 u32 dma_width;
54 u32 rx_threshold;
55 u32 tx_threshold;
56 u8 enable_dma;
57 u8 bits_per_word;
58 u16 clk_div; /* baud rate divider */
59 u32 speed_hz; /* baud rate */
60 int (*write)(struct dw_spi *dws);
61 int (*read)(struct dw_spi *dws);
62 void (*cs_control)(u32 command);
63};
64
65#ifdef CONFIG_DEBUG_FS
66static int spi_show_regs_open(struct inode *inode, struct file *file)
67{
68 file->private_data = inode->i_private;
69 return 0;
70}
71
72#define SPI_REGS_BUFSIZE 1024
73static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
74 size_t count, loff_t *ppos)
75{
76 struct dw_spi *dws;
77 char *buf;
78 u32 len = 0;
79 ssize_t ret;
80
81 dws = file->private_data;
82
83 buf = kzalloc(SPI_REGS_BUFSIZE, GFP_KERNEL);
84 if (!buf)
85 return 0;
86
87 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
88 "MRST SPI0 registers:\n");
89 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
90 "=================================\n");
91 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
92 "CTRL0: \t\t0x%08x\n", dw_readl(dws, ctrl0));
93 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
94 "CTRL1: \t\t0x%08x\n", dw_readl(dws, ctrl1));
95 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
96 "SSIENR: \t0x%08x\n", dw_readl(dws, ssienr));
97 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
98 "SER: \t\t0x%08x\n", dw_readl(dws, ser));
99 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
100 "BAUDR: \t\t0x%08x\n", dw_readl(dws, baudr));
101 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
102 "TXFTLR: \t0x%08x\n", dw_readl(dws, txfltr));
103 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
104 "RXFTLR: \t0x%08x\n", dw_readl(dws, rxfltr));
105 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
106 "TXFLR: \t\t0x%08x\n", dw_readl(dws, txflr));
107 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
108 "RXFLR: \t\t0x%08x\n", dw_readl(dws, rxflr));
109 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
110 "SR: \t\t0x%08x\n", dw_readl(dws, sr));
111 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
112 "IMR: \t\t0x%08x\n", dw_readl(dws, imr));
113 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
114 "ISR: \t\t0x%08x\n", dw_readl(dws, isr));
115 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
116 "DMACR: \t\t0x%08x\n", dw_readl(dws, dmacr));
117 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
118 "DMATDLR: \t0x%08x\n", dw_readl(dws, dmatdlr));
119 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
120 "DMARDLR: \t0x%08x\n", dw_readl(dws, dmardlr));
121 len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
122 "=================================\n");
123
124 ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
125 kfree(buf);
126 return ret;
127}
128
129static const struct file_operations mrst_spi_regs_ops = {
130 .owner = THIS_MODULE,
131 .open = spi_show_regs_open,
132 .read = spi_show_regs,
133};
134
135static int mrst_spi_debugfs_init(struct dw_spi *dws)
136{
137 dws->debugfs = debugfs_create_dir("mrst_spi", NULL);
138 if (!dws->debugfs)
139 return -ENOMEM;
140
141 debugfs_create_file("registers", S_IFREG | S_IRUGO,
142 dws->debugfs, (void *)dws, &mrst_spi_regs_ops);
143 return 0;
144}
145
146static void mrst_spi_debugfs_remove(struct dw_spi *dws)
147{
148 if (dws->debugfs)
149 debugfs_remove_recursive(dws->debugfs);
150}
151
152#else
153static inline int mrst_spi_debugfs_init(struct dw_spi *dws)
154{
155}
156
157static inline void mrst_spi_debugfs_remove(struct dw_spi *dws)
158{
159}
160#endif /* CONFIG_DEBUG_FS */
161
162static void wait_till_not_busy(struct dw_spi *dws)
163{
164 unsigned long end = jiffies + usecs_to_jiffies(1000);
165
166 while (time_before(jiffies, end)) {
167 if (!(dw_readw(dws, sr) & SR_BUSY))
168 return;
169 }
170 dev_err(&dws->master->dev,
171 "DW SPI: Stutus keeps busy for 1000us after a read/write!\n");
172}
173
174static void flush(struct dw_spi *dws)
175{
176 while (dw_readw(dws, sr) & SR_RF_NOT_EMPT)
177 dw_readw(dws, dr);
178
179 wait_till_not_busy(dws);
180}
181
182static void null_cs_control(u32 command)
183{
184}
185
186static int null_writer(struct dw_spi *dws)
187{
188 u8 n_bytes = dws->n_bytes;
189
190 if (!(dw_readw(dws, sr) & SR_TF_NOT_FULL)
191 || (dws->tx == dws->tx_end))
192 return 0;
193 dw_writew(dws, dr, 0);
194 dws->tx += n_bytes;
195
196 wait_till_not_busy(dws);
197 return 1;
198}
199
200static int null_reader(struct dw_spi *dws)
201{
202 u8 n_bytes = dws->n_bytes;
203
204 while ((dw_readw(dws, sr) & SR_RF_NOT_EMPT)
205 && (dws->rx < dws->rx_end)) {
206 dw_readw(dws, dr);
207 dws->rx += n_bytes;
208 }
209 wait_till_not_busy(dws);
210 return dws->rx == dws->rx_end;
211}
212
213static int u8_writer(struct dw_spi *dws)
214{
215 if (!(dw_readw(dws, sr) & SR_TF_NOT_FULL)
216 || (dws->tx == dws->tx_end))
217 return 0;
218
219 dw_writew(dws, dr, *(u8 *)(dws->tx));
220 ++dws->tx;
221
222 wait_till_not_busy(dws);
223 return 1;
224}
225
226static int u8_reader(struct dw_spi *dws)
227{
228 while ((dw_readw(dws, sr) & SR_RF_NOT_EMPT)
229 && (dws->rx < dws->rx_end)) {
230 *(u8 *)(dws->rx) = dw_readw(dws, dr);
231 ++dws->rx;
232 }
233
234 wait_till_not_busy(dws);
235 return dws->rx == dws->rx_end;
236}
237
238static int u16_writer(struct dw_spi *dws)
239{
240 if (!(dw_readw(dws, sr) & SR_TF_NOT_FULL)
241 || (dws->tx == dws->tx_end))
242 return 0;
243
244 dw_writew(dws, dr, *(u16 *)(dws->tx));
245 dws->tx += 2;
246
247 wait_till_not_busy(dws);
248 return 1;
249}
250
251static int u16_reader(struct dw_spi *dws)
252{
253 u16 temp;
254
255 while ((dw_readw(dws, sr) & SR_RF_NOT_EMPT)
256 && (dws->rx < dws->rx_end)) {
257 temp = dw_readw(dws, dr);
258 *(u16 *)(dws->rx) = temp;
259 dws->rx += 2;
260 }
261
262 wait_till_not_busy(dws);
263 return dws->rx == dws->rx_end;
264}
265
266static void *next_transfer(struct dw_spi *dws)
267{
268 struct spi_message *msg = dws->cur_msg;
269 struct spi_transfer *trans = dws->cur_transfer;
270
271 /* Move to next transfer */
272 if (trans->transfer_list.next != &msg->transfers) {
273 dws->cur_transfer =
274 list_entry(trans->transfer_list.next,
275 struct spi_transfer,
276 transfer_list);
277 return RUNNING_STATE;
278 } else
279 return DONE_STATE;
280}
281
282/*
283 * Note: first step is the protocol driver prepares
284 * a dma-capable memory, and this func just need translate
285 * the virt addr to physical
286 */
287static int map_dma_buffers(struct dw_spi *dws)
288{
289 if (!dws->cur_msg->is_dma_mapped || !dws->dma_inited
290 || !dws->cur_chip->enable_dma)
291 return 0;
292
293 if (dws->cur_transfer->tx_dma)
294 dws->tx_dma = dws->cur_transfer->tx_dma;
295
296 if (dws->cur_transfer->rx_dma)
297 dws->rx_dma = dws->cur_transfer->rx_dma;
298
299 return 1;
300}
301
302/* Caller already set message->status; dma and pio irqs are blocked */
303static void giveback(struct dw_spi *dws)
304{
305 struct spi_transfer *last_transfer;
306 unsigned long flags;
307 struct spi_message *msg;
308
309 spin_lock_irqsave(&dws->lock, flags);
310 msg = dws->cur_msg;
311 dws->cur_msg = NULL;
312 dws->cur_transfer = NULL;
313 dws->prev_chip = dws->cur_chip;
314 dws->cur_chip = NULL;
315 dws->dma_mapped = 0;
316 queue_work(dws->workqueue, &dws->pump_messages);
317 spin_unlock_irqrestore(&dws->lock, flags);
318
319 last_transfer = list_entry(msg->transfers.prev,
320 struct spi_transfer,
321 transfer_list);
322
323 if (!last_transfer->cs_change)
324 dws->cs_control(MRST_SPI_DEASSERT);
325
326 msg->state = NULL;
327 if (msg->complete)
328 msg->complete(msg->context);
329}
330
331static void int_error_stop(struct dw_spi *dws, const char *msg)
332{
333 /* Stop and reset hw */
334 flush(dws);
335 spi_enable_chip(dws, 0);
336
337 dev_err(&dws->master->dev, "%s\n", msg);
338 dws->cur_msg->state = ERROR_STATE;
339 tasklet_schedule(&dws->pump_transfers);
340}
341
342static void transfer_complete(struct dw_spi *dws)
343{
344 /* Update total byte transfered return count actual bytes read */
345 dws->cur_msg->actual_length += dws->len;
346
347 /* Move to next transfer */
348 dws->cur_msg->state = next_transfer(dws);
349
350 /* Handle end of message */
351 if (dws->cur_msg->state == DONE_STATE) {
352 dws->cur_msg->status = 0;
353 giveback(dws);
354 } else
355 tasklet_schedule(&dws->pump_transfers);
356}
357
358static irqreturn_t interrupt_transfer(struct dw_spi *dws)
359{
360 u16 irq_status, irq_mask = 0x3f;
361
362 irq_status = dw_readw(dws, isr) & irq_mask;
363 /* Error handling */
364 if (irq_status & (SPI_INT_TXOI | SPI_INT_RXOI | SPI_INT_RXUI)) {
365 dw_readw(dws, txoicr);
366 dw_readw(dws, rxoicr);
367 dw_readw(dws, rxuicr);
368 int_error_stop(dws, "interrupt_transfer: fifo overrun");
369 return IRQ_HANDLED;
370 }
371
372 /* INT comes from tx */
373 if (dws->tx && (irq_status & SPI_INT_TXEI)) {
374 while (dws->tx < dws->tx_end)
375 dws->write(dws);
376
377 if (dws->tx == dws->tx_end) {
378 spi_mask_intr(dws, SPI_INT_TXEI);
379 transfer_complete(dws);
380 }
381 }
382
383 /* INT comes from rx */
384 if (dws->rx && (irq_status & SPI_INT_RXFI)) {
385 if (dws->read(dws))
386 transfer_complete(dws);
387 }
388 return IRQ_HANDLED;
389}
390
391static irqreturn_t dw_spi_irq(int irq, void *dev_id)
392{
393 struct dw_spi *dws = dev_id;
394
395 if (!dws->cur_msg) {
396 spi_mask_intr(dws, SPI_INT_TXEI);
397 /* Never fail */
398 return IRQ_HANDLED;
399 }
400
401 return dws->transfer_handler(dws);
402}
403
404/* Must be called inside pump_transfers() */
405static void poll_transfer(struct dw_spi *dws)
406{
407 if (dws->tx) {
408 while (dws->write(dws))
409 dws->read(dws);
410 }
411
412 dws->read(dws);
413 transfer_complete(dws);
414}
415
416static void dma_transfer(struct dw_spi *dws, int cs_change)
417{
418}
419
420static void pump_transfers(unsigned long data)
421{
422 struct dw_spi *dws = (struct dw_spi *)data;
423 struct spi_message *message = NULL;
424 struct spi_transfer *transfer = NULL;
425 struct spi_transfer *previous = NULL;
426 struct spi_device *spi = NULL;
427 struct chip_data *chip = NULL;
428 u8 bits = 0;
429 u8 imask = 0;
430 u8 cs_change = 0;
431 u16 clk_div = 0;
432 u32 speed = 0;
433 u32 cr0 = 0;
434
435 /* Get current state information */
436 message = dws->cur_msg;
437 transfer = dws->cur_transfer;
438 chip = dws->cur_chip;
439 spi = message->spi;
440
441 if (message->state == ERROR_STATE) {
442 message->status = -EIO;
443 goto early_exit;
444 }
445
446 /* Handle end of message */
447 if (message->state == DONE_STATE) {
448 message->status = 0;
449 goto early_exit;
450 }
451
452 /* Delay if requested at end of transfer*/
453 if (message->state == RUNNING_STATE) {
454 previous = list_entry(transfer->transfer_list.prev,
455 struct spi_transfer,
456 transfer_list);
457 if (previous->delay_usecs)
458 udelay(previous->delay_usecs);
459 }
460
461 dws->n_bytes = chip->n_bytes;
462 dws->dma_width = chip->dma_width;
463 dws->cs_control = chip->cs_control;
464
465 dws->rx_dma = transfer->rx_dma;
466 dws->tx_dma = transfer->tx_dma;
467 dws->tx = (void *)transfer->tx_buf;
468 dws->tx_end = dws->tx + transfer->len;
469 dws->rx = transfer->rx_buf;
470 dws->rx_end = dws->rx + transfer->len;
471 dws->write = dws->tx ? chip->write : null_writer;
472 dws->read = dws->rx ? chip->read : null_reader;
473 dws->cs_change = transfer->cs_change;
474 dws->len = dws->cur_transfer->len;
475 if (chip != dws->prev_chip)
476 cs_change = 1;
477
478 cr0 = chip->cr0;
479
480 /* Handle per transfer options for bpw and speed */
481 if (transfer->speed_hz) {
482 speed = chip->speed_hz;
483
484 if (transfer->speed_hz != speed) {
485 speed = transfer->speed_hz;
486 if (speed > dws->max_freq) {
487 printk(KERN_ERR "MRST SPI0: unsupported"
488 "freq: %dHz\n", speed);
489 message->status = -EIO;
490 goto early_exit;
491 }
492
493 /* clk_div doesn't support odd number */
494 clk_div = dws->max_freq / speed;
495 clk_div = (clk_div >> 1) << 1;
496
497 chip->speed_hz = speed;
498 chip->clk_div = clk_div;
499 }
500 }
501 if (transfer->bits_per_word) {
502 bits = transfer->bits_per_word;
503
504 switch (bits) {
505 case 8:
506 dws->n_bytes = 1;
507 dws->dma_width = 1;
508 dws->read = (dws->read != null_reader) ?
509 u8_reader : null_reader;
510 dws->write = (dws->write != null_writer) ?
511 u8_writer : null_writer;
512 break;
513 case 16:
514 dws->n_bytes = 2;
515 dws->dma_width = 2;
516 dws->read = (dws->read != null_reader) ?
517 u16_reader : null_reader;
518 dws->write = (dws->write != null_writer) ?
519 u16_writer : null_writer;
520 break;
521 default:
522 printk(KERN_ERR "MRST SPI0: unsupported bits:"
523 "%db\n", bits);
524 message->status = -EIO;
525 goto early_exit;
526 }
527
528 cr0 = (bits - 1)
529 | (chip->type << SPI_FRF_OFFSET)
530 | (spi->mode << SPI_MODE_OFFSET)
531 | (chip->tmode << SPI_TMOD_OFFSET);
532 }
533 message->state = RUNNING_STATE;
534
535 /* Check if current transfer is a DMA transaction */
536 dws->dma_mapped = map_dma_buffers(dws);
537
538 if (!dws->dma_mapped && !chip->poll_mode) {
539 if (dws->rx)
540 imask |= SPI_INT_RXFI;
541 if (dws->tx)
542 imask |= SPI_INT_TXEI;
543 dws->transfer_handler = interrupt_transfer;
544 }
545
546 /*
547 * Reprogram registers only if
548 * 1. chip select changes
549 * 2. clk_div is changed
550 * 3. control value changes
551 */
552 if (dw_readw(dws, ctrl0) != cr0 || cs_change || clk_div) {
553 spi_enable_chip(dws, 0);
554
555 if (dw_readw(dws, ctrl0) != cr0)
556 dw_writew(dws, ctrl0, cr0);
557
558 /* Set the interrupt mask, for poll mode just diable all int */
559 spi_mask_intr(dws, 0xff);
560 if (!chip->poll_mode)
561 spi_umask_intr(dws, imask);
562
563 spi_set_clk(dws, clk_div ? clk_div : chip->clk_div);
564 spi_chip_sel(dws, spi->chip_select);
565 spi_enable_chip(dws, 1);
566
567 if (cs_change)
568 dws->prev_chip = chip;
569 }
570
571 if (dws->dma_mapped)
572 dma_transfer(dws, cs_change);
573
574 if (chip->poll_mode)
575 poll_transfer(dws);
576
577 return;
578
579early_exit:
580 giveback(dws);
581 return;
582}
583
584static void pump_messages(struct work_struct *work)
585{
586 struct dw_spi *dws =
587 container_of(work, struct dw_spi, pump_messages);
588 unsigned long flags;
589
590 /* Lock queue and check for queue work */
591 spin_lock_irqsave(&dws->lock, flags);
592 if (list_empty(&dws->queue) || dws->run == QUEUE_STOPPED) {
593 dws->busy = 0;
594 spin_unlock_irqrestore(&dws->lock, flags);
595 return;
596 }
597
598 /* Make sure we are not already running a message */
599 if (dws->cur_msg) {
600 spin_unlock_irqrestore(&dws->lock, flags);
601 return;
602 }
603
604 /* Extract head of queue */
605 dws->cur_msg = list_entry(dws->queue.next, struct spi_message, queue);
606 list_del_init(&dws->cur_msg->queue);
607
608 /* Initial message state*/
609 dws->cur_msg->state = START_STATE;
610 dws->cur_transfer = list_entry(dws->cur_msg->transfers.next,
611 struct spi_transfer,
612 transfer_list);
613 dws->cur_chip = spi_get_ctldata(dws->cur_msg->spi);
614
615 /* Mark as busy and launch transfers */
616 tasklet_schedule(&dws->pump_transfers);
617
618 dws->busy = 1;
619 spin_unlock_irqrestore(&dws->lock, flags);
620}
621
622/* spi_device use this to queue in their spi_msg */
623static int dw_spi_transfer(struct spi_device *spi, struct spi_message *msg)
624{
625 struct dw_spi *dws = spi_master_get_devdata(spi->master);
626 unsigned long flags;
627
628 spin_lock_irqsave(&dws->lock, flags);
629
630 if (dws->run == QUEUE_STOPPED) {
631 spin_unlock_irqrestore(&dws->lock, flags);
632 return -ESHUTDOWN;
633 }
634
635 msg->actual_length = 0;
636 msg->status = -EINPROGRESS;
637 msg->state = START_STATE;
638
639 list_add_tail(&msg->queue, &dws->queue);
640
641 if (dws->run == QUEUE_RUNNING && !dws->busy) {
642
643 if (dws->cur_transfer || dws->cur_msg)
644 queue_work(dws->workqueue,
645 &dws->pump_messages);
646 else {
647 /* If no other data transaction in air, just go */
648 spin_unlock_irqrestore(&dws->lock, flags);
649 pump_messages(&dws->pump_messages);
650 return 0;
651 }
652 }
653
654 spin_unlock_irqrestore(&dws->lock, flags);
655 return 0;
656}
657
658/* This may be called twice for each spi dev */
659static int dw_spi_setup(struct spi_device *spi)
660{
661 struct dw_spi_chip *chip_info = NULL;
662 struct chip_data *chip;
663
664 if (spi->bits_per_word != 8 && spi->bits_per_word != 16)
665 return -EINVAL;
666
667 /* Only alloc on first setup */
668 chip = spi_get_ctldata(spi);
669 if (!chip) {
670 chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
671 if (!chip)
672 return -ENOMEM;
673
674 chip->cs_control = null_cs_control;
675 chip->enable_dma = 0;
676 }
677
678 /*
679 * Protocol drivers may change the chip settings, so...
680 * if chip_info exists, use it
681 */
682 chip_info = spi->controller_data;
683
684 /* chip_info doesn't always exist */
685 if (chip_info) {
686 if (chip_info->cs_control)
687 chip->cs_control = chip_info->cs_control;
688
689 chip->poll_mode = chip_info->poll_mode;
690 chip->type = chip_info->type;
691
692 chip->rx_threshold = 0;
693 chip->tx_threshold = 0;
694
695 chip->enable_dma = chip_info->enable_dma;
696 }
697
698 if (spi->bits_per_word <= 8) {
699 chip->n_bytes = 1;
700 chip->dma_width = 1;
701 chip->read = u8_reader;
702 chip->write = u8_writer;
703 } else if (spi->bits_per_word <= 16) {
704 chip->n_bytes = 2;
705 chip->dma_width = 2;
706 chip->read = u16_reader;
707 chip->write = u16_writer;
708 } else {
709 /* Never take >16b case for MRST SPIC */
710 dev_err(&spi->dev, "invalid wordsize\n");
711 return -EINVAL;
712 }
713 chip->bits_per_word = spi->bits_per_word;
714
715 chip->speed_hz = spi->max_speed_hz;
716 if (chip->speed_hz)
717 chip->clk_div = 25000000 / chip->speed_hz;
718 else
719 chip->clk_div = 8; /* default value */
720
721 chip->tmode = 0; /* Tx & Rx */
722 /* Default SPI mode is SCPOL = 0, SCPH = 0 */
723 chip->cr0 = (chip->bits_per_word - 1)
724 | (chip->type << SPI_FRF_OFFSET)
725 | (spi->mode << SPI_MODE_OFFSET)
726 | (chip->tmode << SPI_TMOD_OFFSET);
727
728 spi_set_ctldata(spi, chip);
729 return 0;
730}
731
732static void dw_spi_cleanup(struct spi_device *spi)
733{
734 struct chip_data *chip = spi_get_ctldata(spi);
735 kfree(chip);
736}
737
738static int __init init_queue(struct dw_spi *dws)
739{
740 INIT_LIST_HEAD(&dws->queue);
741 spin_lock_init(&dws->lock);
742
743 dws->run = QUEUE_STOPPED;
744 dws->busy = 0;
745
746 tasklet_init(&dws->pump_transfers,
747 pump_transfers, (unsigned long)dws);
748
749 INIT_WORK(&dws->pump_messages, pump_messages);
750 dws->workqueue = create_singlethread_workqueue(
751 dev_name(dws->master->dev.parent));
752 if (dws->workqueue == NULL)
753 return -EBUSY;
754
755 return 0;
756}
757
758static int start_queue(struct dw_spi *dws)
759{
760 unsigned long flags;
761
762 spin_lock_irqsave(&dws->lock, flags);
763
764 if (dws->run == QUEUE_RUNNING || dws->busy) {
765 spin_unlock_irqrestore(&dws->lock, flags);
766 return -EBUSY;
767 }
768
769 dws->run = QUEUE_RUNNING;
770 dws->cur_msg = NULL;
771 dws->cur_transfer = NULL;
772 dws->cur_chip = NULL;
773 dws->prev_chip = NULL;
774 spin_unlock_irqrestore(&dws->lock, flags);
775
776 queue_work(dws->workqueue, &dws->pump_messages);
777
778 return 0;
779}
780
781static int stop_queue(struct dw_spi *dws)
782{
783 unsigned long flags;
784 unsigned limit = 50;
785 int status = 0;
786
787 spin_lock_irqsave(&dws->lock, flags);
788 dws->run = QUEUE_STOPPED;
789 while (!list_empty(&dws->queue) && dws->busy && limit--) {
790 spin_unlock_irqrestore(&dws->lock, flags);
791 msleep(10);
792 spin_lock_irqsave(&dws->lock, flags);
793 }
794
795 if (!list_empty(&dws->queue) || dws->busy)
796 status = -EBUSY;
797 spin_unlock_irqrestore(&dws->lock, flags);
798
799 return status;
800}
801
802static int destroy_queue(struct dw_spi *dws)
803{
804 int status;
805
806 status = stop_queue(dws);
807 if (status != 0)
808 return status;
809 destroy_workqueue(dws->workqueue);
810 return 0;
811}
812
813/* Restart the controller, disable all interrupts, clean rx fifo */
814static void spi_hw_init(struct dw_spi *dws)
815{
816 spi_enable_chip(dws, 0);
817 spi_mask_intr(dws, 0xff);
818 spi_enable_chip(dws, 1);
819 flush(dws);
820}
821
822int __devinit dw_spi_add_host(struct dw_spi *dws)
823{
824 struct spi_master *master;
825 int ret;
826
827 BUG_ON(dws == NULL);
828
829 master = spi_alloc_master(dws->parent_dev, 0);
830 if (!master) {
831 ret = -ENOMEM;
832 goto exit;
833 }
834
835 dws->master = master;
836 dws->type = SSI_MOTO_SPI;
837 dws->prev_chip = NULL;
838 dws->dma_inited = 0;
839 dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60);
840
841 ret = request_irq(dws->irq, dw_spi_irq, 0,
842 "dw_spi", dws);
843 if (ret < 0) {
844 dev_err(&master->dev, "can not get IRQ\n");
845 goto err_free_master;
846 }
847
848 master->mode_bits = SPI_CPOL | SPI_CPHA;
849 master->bus_num = dws->bus_num;
850 master->num_chipselect = dws->num_cs;
851 master->cleanup = dw_spi_cleanup;
852 master->setup = dw_spi_setup;
853 master->transfer = dw_spi_transfer;
854
855 dws->dma_inited = 0;
856
857 /* Basic HW init */
858 spi_hw_init(dws);
859
860 /* Initial and start queue */
861 ret = init_queue(dws);
862 if (ret) {
863 dev_err(&master->dev, "problem initializing queue\n");
864 goto err_diable_hw;
865 }
866 ret = start_queue(dws);
867 if (ret) {
868 dev_err(&master->dev, "problem starting queue\n");
869 goto err_diable_hw;
870 }
871
872 spi_master_set_devdata(master, dws);
873 ret = spi_register_master(master);
874 if (ret) {
875 dev_err(&master->dev, "problem registering spi master\n");
876 goto err_queue_alloc;
877 }
878
879 mrst_spi_debugfs_init(dws);
880 return 0;
881
882err_queue_alloc:
883 destroy_queue(dws);
884err_diable_hw:
885 spi_enable_chip(dws, 0);
886 free_irq(dws->irq, dws);
887err_free_master:
888 spi_master_put(master);
889exit:
890 return ret;
891}
892EXPORT_SYMBOL(dw_spi_add_host);
893
894void __devexit dw_spi_remove_host(struct dw_spi *dws)
895{
896 int status = 0;
897
898 if (!dws)
899 return;
900 mrst_spi_debugfs_remove(dws);
901
902 /* Remove the queue */
903 status = destroy_queue(dws);
904 if (status != 0)
905 dev_err(&dws->master->dev, "dw_spi_remove: workqueue will not "
906 "complete, message memory not freed\n");
907
908 spi_enable_chip(dws, 0);
909 /* Disable clk */
910 spi_set_clk(dws, 0);
911 free_irq(dws->irq, dws);
912
913 /* Disconnect from the SPI framework */
914 spi_unregister_master(dws->master);
915}
916
917int dw_spi_suspend_host(struct dw_spi *dws)
918{
919 int ret = 0;
920
921 ret = stop_queue(dws);
922 if (ret)
923 return ret;
924 spi_enable_chip(dws, 0);
925 spi_set_clk(dws, 0);
926 return ret;
927}
928EXPORT_SYMBOL(dw_spi_suspend_host);
929
930int dw_spi_resume_host(struct dw_spi *dws)
931{
932 int ret;
933
934 spi_hw_init(dws);
935 ret = start_queue(dws);
936 if (ret)
937 dev_err(&dws->master->dev, "fail to start queue (%d)\n", ret);
938 return ret;
939}
940EXPORT_SYMBOL(dw_spi_resume_host);
941
942MODULE_AUTHOR("Feng Tang <feng.tang@intel.com>");
943MODULE_DESCRIPTION("Driver for DesignWare SPI controller core");
944MODULE_LICENSE("GPL v2");
diff --git a/drivers/spi/dw_spi_pci.c b/drivers/spi/dw_spi_pci.c
new file mode 100644
index 000000000000..34ba69161734
--- /dev/null
+++ b/drivers/spi/dw_spi_pci.c
@@ -0,0 +1,169 @@
1/*
2 * mrst_spi_pci.c - PCI interface driver for DW SPI Core
3 *
4 * Copyright (c) 2009, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include <linux/interrupt.h>
21#include <linux/pci.h>
22#include <linux/spi/dw_spi.h>
23#include <linux/spi/spi.h>
24
25#define DRIVER_NAME "dw_spi_pci"
26
27struct dw_spi_pci {
28 struct pci_dev *pdev;
29 struct dw_spi dws;
30};
31
32static int __devinit spi_pci_probe(struct pci_dev *pdev,
33 const struct pci_device_id *ent)
34{
35 struct dw_spi_pci *dwpci;
36 struct dw_spi *dws;
37 int pci_bar = 0;
38 int ret;
39
40 printk(KERN_INFO "DW: found PCI SPI controller(ID: %04x:%04x)\n",
41 pdev->vendor, pdev->device);
42
43 ret = pci_enable_device(pdev);
44 if (ret)
45 return ret;
46
47 dwpci = kzalloc(sizeof(struct dw_spi_pci), GFP_KERNEL);
48 if (!dwpci) {
49 ret = -ENOMEM;
50 goto err_disable;
51 }
52
53 dwpci->pdev = pdev;
54 dws = &dwpci->dws;
55
56 /* Get basic io resource and map it */
57 dws->paddr = pci_resource_start(pdev, pci_bar);
58 dws->iolen = pci_resource_len(pdev, pci_bar);
59
60 ret = pci_request_region(pdev, pci_bar, dev_name(&pdev->dev));
61 if (ret)
62 goto err_kfree;
63
64 dws->regs = ioremap_nocache((unsigned long)dws->paddr,
65 pci_resource_len(pdev, pci_bar));
66 if (!dws->regs) {
67 ret = -ENOMEM;
68 goto err_release_reg;
69 }
70
71 dws->parent_dev = &pdev->dev;
72 dws->bus_num = 0;
73 dws->num_cs = 4;
74 dws->max_freq = 25000000; /* for Moorestwon */
75 dws->irq = pdev->irq;
76
77 ret = dw_spi_add_host(dws);
78 if (ret)
79 goto err_unmap;
80
81 /* PCI hook and SPI hook use the same drv data */
82 pci_set_drvdata(pdev, dwpci);
83 return 0;
84
85err_unmap:
86 iounmap(dws->regs);
87err_release_reg:
88 pci_release_region(pdev, pci_bar);
89err_kfree:
90 kfree(dwpci);
91err_disable:
92 pci_disable_device(pdev);
93 return ret;
94}
95
96static void __devexit spi_pci_remove(struct pci_dev *pdev)
97{
98 struct dw_spi_pci *dwpci = pci_get_drvdata(pdev);
99
100 pci_set_drvdata(pdev, NULL);
101 iounmap(dwpci->dws.regs);
102 pci_release_region(pdev, 0);
103 kfree(dwpci);
104 pci_disable_device(pdev);
105}
106
107#ifdef CONFIG_PM
108static int spi_suspend(struct pci_dev *pdev, pm_message_t state)
109{
110 struct dw_spi_pci *dwpci = pci_get_drvdata(pdev);
111 int ret;
112
113 ret = dw_spi_suspend_host(&dwpci->dws);
114 if (ret)
115 return ret;
116 pci_save_state(pdev);
117 pci_disable_device(pdev);
118 pci_set_power_state(pdev, pci_choose_state(pdev, state));
119 return ret;
120}
121
122static int spi_resume(struct pci_dev *pdev)
123{
124 struct dw_spi_pci *dwpci = pci_get_drvdata(pdev);
125 int ret;
126
127 pci_set_power_state(pdev, PCI_D0);
128 pci_restore_state(pdev);
129 ret = pci_enable_device(pdev);
130 if (ret)
131 return ret;
132 return dw_spi_resume_host(&dwpci->dws);
133}
134#else
135#define spi_suspend NULL
136#define spi_resume NULL
137#endif
138
139static const struct pci_device_id pci_ids[] __devinitdata = {
140 /* Intel Moorestown platform SPI controller 0 */
141 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) },
142 {},
143};
144
145static struct pci_driver dw_spi_driver = {
146 .name = DRIVER_NAME,
147 .id_table = pci_ids,
148 .probe = spi_pci_probe,
149 .remove = __devexit_p(spi_pci_remove),
150 .suspend = spi_suspend,
151 .resume = spi_resume,
152};
153
154static int __init mrst_spi_init(void)
155{
156 return pci_register_driver(&dw_spi_driver);
157}
158
159static void __exit mrst_spi_exit(void)
160{
161 pci_unregister_driver(&dw_spi_driver);
162}
163
164module_init(mrst_spi_init);
165module_exit(mrst_spi_exit);
166
167MODULE_AUTHOR("Feng Tang <feng.tang@intel.com>");
168MODULE_DESCRIPTION("PCI interface driver for DW SPI Core");
169MODULE_LICENSE("GPL v2");
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 73e24ef5a2f9..1d41058bbab2 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -1294,7 +1294,7 @@ static int __init bfin_spi_probe(struct platform_device *pdev)
1294 goto out_error_get_res; 1294 goto out_error_get_res;
1295 } 1295 }
1296 1296
1297 drv_data->regs_base = ioremap(res->start, (res->end - res->start + 1)); 1297 drv_data->regs_base = ioremap(res->start, resource_size(res));
1298 if (drv_data->regs_base == NULL) { 1298 if (drv_data->regs_base == NULL) {
1299 dev_err(dev, "Cannot map IO\n"); 1299 dev_err(dev, "Cannot map IO\n");
1300 status = -ENXIO; 1300 status = -ENXIO;
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c
index e9390d747bfc..1fb2a6ea328c 100644
--- a/drivers/spi/spi_mpc8xxx.c
+++ b/drivers/spi/spi_mpc8xxx.c
@@ -1013,7 +1013,7 @@ mpc8xxx_spi_probe(struct device *dev, struct resource *mem, unsigned int irq)
1013 1013
1014 init_completion(&mpc8xxx_spi->done); 1014 init_completion(&mpc8xxx_spi->done);
1015 1015
1016 mpc8xxx_spi->base = ioremap(mem->start, mem->end - mem->start + 1); 1016 mpc8xxx_spi->base = ioremap(mem->start, resource_size(mem));
1017 if (mpc8xxx_spi->base == NULL) { 1017 if (mpc8xxx_spi->base == NULL) {
1018 ret = -ENOMEM; 1018 ret = -ENOMEM;
1019 goto err_ioremap; 1019 goto err_ioremap;
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 276591569c8b..c010733877ae 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -1,7 +1,7 @@
1/* linux/drivers/spi/spi_s3c24xx.c 1/* linux/drivers/spi/spi_s3c24xx.c
2 * 2 *
3 * Copyright (c) 2006 Ben Dooks 3 * Copyright (c) 2006 Ben Dooks
4 * Copyright (c) 2006 Simtec Electronics 4 * Copyright 2006-2009 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -28,6 +28,11 @@
28#include <plat/regs-spi.h> 28#include <plat/regs-spi.h>
29#include <mach/spi.h> 29#include <mach/spi.h>
30 30
31#include <plat/fiq.h>
32#include <asm/fiq.h>
33
34#include "spi_s3c24xx_fiq.h"
35
31/** 36/**
32 * s3c24xx_spi_devstate - per device data 37 * s3c24xx_spi_devstate - per device data
33 * @hz: Last frequency calculated for @sppre field. 38 * @hz: Last frequency calculated for @sppre field.
@@ -42,6 +47,13 @@ struct s3c24xx_spi_devstate {
42 u8 sppre; 47 u8 sppre;
43}; 48};
44 49
50enum spi_fiq_mode {
51 FIQ_MODE_NONE = 0,
52 FIQ_MODE_TX = 1,
53 FIQ_MODE_RX = 2,
54 FIQ_MODE_TXRX = 3,
55};
56
45struct s3c24xx_spi { 57struct s3c24xx_spi {
46 /* bitbang has to be first */ 58 /* bitbang has to be first */
47 struct spi_bitbang bitbang; 59 struct spi_bitbang bitbang;
@@ -52,6 +64,11 @@ struct s3c24xx_spi {
52 int len; 64 int len;
53 int count; 65 int count;
54 66
67 struct fiq_handler fiq_handler;
68 enum spi_fiq_mode fiq_mode;
69 unsigned char fiq_inuse;
70 unsigned char fiq_claimed;
71
55 void (*set_cs)(struct s3c2410_spi_info *spi, 72 void (*set_cs)(struct s3c2410_spi_info *spi,
56 int cs, int pol); 73 int cs, int pol);
57 74
@@ -67,6 +84,7 @@ struct s3c24xx_spi {
67 struct s3c2410_spi_info *pdata; 84 struct s3c2410_spi_info *pdata;
68}; 85};
69 86
87
70#define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT) 88#define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT)
71#define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP) 89#define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP)
72 90
@@ -127,7 +145,7 @@ static int s3c24xx_spi_update_state(struct spi_device *spi,
127 } 145 }
128 146
129 if (spi->mode != cs->mode) { 147 if (spi->mode != cs->mode) {
130 u8 spcon = SPCON_DEFAULT; 148 u8 spcon = SPCON_DEFAULT | S3C2410_SPCON_ENSCK;
131 149
132 if (spi->mode & SPI_CPHA) 150 if (spi->mode & SPI_CPHA)
133 spcon |= S3C2410_SPCON_CPHA_FMTB; 151 spcon |= S3C2410_SPCON_CPHA_FMTB;
@@ -214,13 +232,196 @@ static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
214 return hw->tx ? hw->tx[count] : 0; 232 return hw->tx ? hw->tx[count] : 0;
215} 233}
216 234
235#ifdef CONFIG_SPI_S3C24XX_FIQ
236/* Support for FIQ based pseudo-DMA to improve the transfer speed.
237 *
238 * This code uses the assembly helper in spi_s3c24xx_spi.S which is
239 * used by the FIQ core to move data between main memory and the peripheral
240 * block. Since this is code running on the processor, there is no problem
241 * with cache coherency of the buffers, so we can use any buffer we like.
242 */
243
244/**
245 * struct spi_fiq_code - FIQ code and header
246 * @length: The length of the code fragment, excluding this header.
247 * @ack_offset: The offset from @data to the word to place the IRQ ACK bit at.
248 * @data: The code itself to install as a FIQ handler.
249 */
250struct spi_fiq_code {
251 u32 length;
252 u32 ack_offset;
253 u8 data[0];
254};
255
256extern struct spi_fiq_code s3c24xx_spi_fiq_txrx;
257extern struct spi_fiq_code s3c24xx_spi_fiq_tx;
258extern struct spi_fiq_code s3c24xx_spi_fiq_rx;
259
260/**
261 * ack_bit - turn IRQ into IRQ acknowledgement bit
262 * @irq: The interrupt number
263 *
264 * Returns the bit to write to the interrupt acknowledge register.
265 */
266static inline u32 ack_bit(unsigned int irq)
267{
268 return 1 << (irq - IRQ_EINT0);
269}
270
271/**
272 * s3c24xx_spi_tryfiq - attempt to claim and setup FIQ for transfer
273 * @hw: The hardware state.
274 *
275 * Claim the FIQ handler (only one can be active at any one time) and
276 * then setup the correct transfer code for this transfer.
277 *
278 * This call updates all the necessary state information if sucessful,
279 * so the caller does not need to do anything more than start the transfer
280 * as normal, since the IRQ will have been re-routed to the FIQ handler.
281*/
282void s3c24xx_spi_tryfiq(struct s3c24xx_spi *hw)
283{
284 struct pt_regs regs;
285 enum spi_fiq_mode mode;
286 struct spi_fiq_code *code;
287 int ret;
288
289 if (!hw->fiq_claimed) {
290 /* try and claim fiq if we haven't got it, and if not
291 * then return and simply use another transfer method */
292
293 ret = claim_fiq(&hw->fiq_handler);
294 if (ret)
295 return;
296 }
297
298 if (hw->tx && !hw->rx)
299 mode = FIQ_MODE_TX;
300 else if (hw->rx && !hw->tx)
301 mode = FIQ_MODE_RX;
302 else
303 mode = FIQ_MODE_TXRX;
304
305 regs.uregs[fiq_rspi] = (long)hw->regs;
306 regs.uregs[fiq_rrx] = (long)hw->rx;
307 regs.uregs[fiq_rtx] = (long)hw->tx + 1;
308 regs.uregs[fiq_rcount] = hw->len - 1;
309 regs.uregs[fiq_rirq] = (long)S3C24XX_VA_IRQ;
310
311 set_fiq_regs(&regs);
312
313 if (hw->fiq_mode != mode) {
314 u32 *ack_ptr;
315
316 hw->fiq_mode = mode;
317
318 switch (mode) {
319 case FIQ_MODE_TX:
320 code = &s3c24xx_spi_fiq_tx;
321 break;
322 case FIQ_MODE_RX:
323 code = &s3c24xx_spi_fiq_rx;
324 break;
325 case FIQ_MODE_TXRX:
326 code = &s3c24xx_spi_fiq_txrx;
327 break;
328 default:
329 code = NULL;
330 }
331
332 BUG_ON(!code);
333
334 ack_ptr = (u32 *)&code->data[code->ack_offset];
335 *ack_ptr = ack_bit(hw->irq);
336
337 set_fiq_handler(&code->data, code->length);
338 }
339
340 s3c24xx_set_fiq(hw->irq, true);
341
342 hw->fiq_mode = mode;
343 hw->fiq_inuse = 1;
344}
345
346/**
347 * s3c24xx_spi_fiqop - FIQ core code callback
348 * @pw: Data registered with the handler
349 * @release: Whether this is a release or a return.
350 *
351 * Called by the FIQ code when another module wants to use the FIQ, so
352 * return whether we are currently using this or not and then update our
353 * internal state.
354 */
355static int s3c24xx_spi_fiqop(void *pw, int release)
356{
357 struct s3c24xx_spi *hw = pw;
358 int ret = 0;
359
360 if (release) {
361 if (hw->fiq_inuse)
362 ret = -EBUSY;
363
364 /* note, we do not need to unroute the FIQ, as the FIQ
365 * vector code de-routes it to signal the end of transfer */
366
367 hw->fiq_mode = FIQ_MODE_NONE;
368 hw->fiq_claimed = 0;
369 } else {
370 hw->fiq_claimed = 1;
371 }
372
373 return ret;
374}
375
376/**
377 * s3c24xx_spi_initfiq - setup the information for the FIQ core
378 * @hw: The hardware state.
379 *
380 * Setup the fiq_handler block to pass to the FIQ core.
381 */
382static inline void s3c24xx_spi_initfiq(struct s3c24xx_spi *hw)
383{
384 hw->fiq_handler.dev_id = hw;
385 hw->fiq_handler.name = dev_name(hw->dev);
386 hw->fiq_handler.fiq_op = s3c24xx_spi_fiqop;
387}
388
389/**
390 * s3c24xx_spi_usefiq - return if we should be using FIQ.
391 * @hw: The hardware state.
392 *
393 * Return true if the platform data specifies whether this channel is
394 * allowed to use the FIQ.
395 */
396static inline bool s3c24xx_spi_usefiq(struct s3c24xx_spi *hw)
397{
398 return hw->pdata->use_fiq;
399}
400
401/**
402 * s3c24xx_spi_usingfiq - return if channel is using FIQ
403 * @spi: The hardware state.
404 *
405 * Return whether the channel is currently using the FIQ (separate from
406 * whether the FIQ is claimed).
407 */
408static inline bool s3c24xx_spi_usingfiq(struct s3c24xx_spi *spi)
409{
410 return spi->fiq_inuse;
411}
412#else
413
414static inline void s3c24xx_spi_initfiq(struct s3c24xx_spi *s) { }
415static inline void s3c24xx_spi_tryfiq(struct s3c24xx_spi *s) { }
416static inline bool s3c24xx_spi_usefiq(struct s3c24xx_spi *s) { return false; }
417static inline bool s3c24xx_spi_usingfiq(struct s3c24xx_spi *s) { return false; }
418
419#endif /* CONFIG_SPI_S3C24XX_FIQ */
420
217static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t) 421static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
218{ 422{
219 struct s3c24xx_spi *hw = to_hw(spi); 423 struct s3c24xx_spi *hw = to_hw(spi);
220 424
221 dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n",
222 t->tx_buf, t->rx_buf, t->len);
223
224 hw->tx = t->tx_buf; 425 hw->tx = t->tx_buf;
225 hw->rx = t->rx_buf; 426 hw->rx = t->rx_buf;
226 hw->len = t->len; 427 hw->len = t->len;
@@ -228,11 +429,14 @@ static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
228 429
229 init_completion(&hw->done); 430 init_completion(&hw->done);
230 431
432 hw->fiq_inuse = 0;
433 if (s3c24xx_spi_usefiq(hw) && t->len >= 3)
434 s3c24xx_spi_tryfiq(hw);
435
231 /* send the first byte */ 436 /* send the first byte */
232 writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT); 437 writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
233 438
234 wait_for_completion(&hw->done); 439 wait_for_completion(&hw->done);
235
236 return hw->count; 440 return hw->count;
237} 441}
238 442
@@ -254,17 +458,27 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
254 goto irq_done; 458 goto irq_done;
255 } 459 }
256 460
257 hw->count++; 461 if (!s3c24xx_spi_usingfiq(hw)) {
462 hw->count++;
258 463
259 if (hw->rx) 464 if (hw->rx)
260 hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT); 465 hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);
261 466
262 count++; 467 count++;
468
469 if (count < hw->len)
470 writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT);
471 else
472 complete(&hw->done);
473 } else {
474 hw->count = hw->len;
475 hw->fiq_inuse = 0;
476
477 if (hw->rx)
478 hw->rx[hw->len-1] = readb(hw->regs + S3C2410_SPRDAT);
263 479
264 if (count < hw->len)
265 writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT);
266 else
267 complete(&hw->done); 480 complete(&hw->done);
481 }
268 482
269 irq_done: 483 irq_done:
270 return IRQ_HANDLED; 484 return IRQ_HANDLED;
@@ -322,6 +536,10 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
322 platform_set_drvdata(pdev, hw); 536 platform_set_drvdata(pdev, hw);
323 init_completion(&hw->done); 537 init_completion(&hw->done);
324 538
539 /* initialise fiq handler */
540
541 s3c24xx_spi_initfiq(hw);
542
325 /* setup the master state. */ 543 /* setup the master state. */
326 544
327 /* the spi->mode bits understood by this driver: */ 545 /* the spi->mode bits understood by this driver: */
diff --git a/drivers/spi/spi_s3c24xx_fiq.S b/drivers/spi/spi_s3c24xx_fiq.S
new file mode 100644
index 000000000000..3793cae361db
--- /dev/null
+++ b/drivers/spi/spi_s3c24xx_fiq.S
@@ -0,0 +1,116 @@
1/* linux/drivers/spi/spi_s3c24xx_fiq.S
2 *
3 * Copyright 2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX SPI - FIQ pseudo-DMA transfer code
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/linkage.h>
14#include <asm/assembler.h>
15
16#include <mach/map.h>
17#include <mach/regs-irq.h>
18#include <plat/regs-spi.h>
19
20#include "spi_s3c24xx_fiq.h"
21
22 .text
23
24 @ entry to these routines is as follows, with the register names
25 @ defined in fiq.h so that they can be shared with the C files which
26 @ setup the calling registers.
27 @
28 @ fiq_rirq The base of the IRQ registers to find S3C2410_SRCPND
29 @ fiq_rtmp Temporary register to hold tx/rx data
30 @ fiq_rspi The base of the SPI register block
31 @ fiq_rtx The tx buffer pointer
32 @ fiq_rrx The rx buffer pointer
33 @ fiq_rcount The number of bytes to move
34
35 @ each entry starts with a word entry of how long it is
36 @ and an offset to the irq acknowledgment word
37
38ENTRY(s3c24xx_spi_fiq_rx)
39s3c24xx_spi_fix_rx:
40 .word fiq_rx_end - fiq_rx_start
41 .word fiq_rx_irq_ack - fiq_rx_start
42fiq_rx_start:
43 ldr fiq_rtmp, fiq_rx_irq_ack
44 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
45
46 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
47 strb fiq_rtmp, [ fiq_rrx ], #1
48
49 mov fiq_rtmp, #0xff
50 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
51
52 subs fiq_rcount, fiq_rcount, #1
53 subnes pc, lr, #4 @@ return, still have work to do
54
55 @@ set IRQ controller so that next op will trigger IRQ
56 mov fiq_rtmp, #0
57 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
58 subs pc, lr, #4
59
60fiq_rx_irq_ack:
61 .word 0
62fiq_rx_end:
63
64ENTRY(s3c24xx_spi_fiq_txrx)
65s3c24xx_spi_fiq_txrx:
66 .word fiq_txrx_end - fiq_txrx_start
67 .word fiq_txrx_irq_ack - fiq_txrx_start
68fiq_txrx_start:
69
70 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
71 strb fiq_rtmp, [ fiq_rrx ], #1
72
73 ldr fiq_rtmp, fiq_txrx_irq_ack
74 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
75
76 ldrb fiq_rtmp, [ fiq_rtx ], #1
77 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
78
79 subs fiq_rcount, fiq_rcount, #1
80 subnes pc, lr, #4 @@ return, still have work to do
81
82 mov fiq_rtmp, #0
83 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
84 subs pc, lr, #4
85
86fiq_txrx_irq_ack:
87 .word 0
88
89fiq_txrx_end:
90
91ENTRY(s3c24xx_spi_fiq_tx)
92s3c24xx_spi_fix_tx:
93 .word fiq_tx_end - fiq_tx_start
94 .word fiq_tx_irq_ack - fiq_tx_start
95fiq_tx_start:
96 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
97
98 ldr fiq_rtmp, fiq_tx_irq_ack
99 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
100
101 ldrb fiq_rtmp, [ fiq_rtx ], #1
102 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
103
104 subs fiq_rcount, fiq_rcount, #1
105 subnes pc, lr, #4 @@ return, still have work to do
106
107 mov fiq_rtmp, #0
108 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
109 subs pc, lr, #4
110
111fiq_tx_irq_ack:
112 .word 0
113
114fiq_tx_end:
115
116 .end
diff --git a/drivers/spi/spi_s3c24xx_fiq.h b/drivers/spi/spi_s3c24xx_fiq.h
new file mode 100644
index 000000000000..a5950bb25b51
--- /dev/null
+++ b/drivers/spi/spi_s3c24xx_fiq.h
@@ -0,0 +1,26 @@
1/* linux/drivers/spi/spi_s3c24xx_fiq.h
2 *
3 * Copyright 2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX SPI - FIQ pseudo-DMA transfer support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13/* We have R8 through R13 to play with */
14
15#ifdef __ASSEMBLY__
16#define __REG_NR(x) r##x
17#else
18#define __REG_NR(x) (x)
19#endif
20
21#define fiq_rspi __REG_NR(8)
22#define fiq_rtmp __REG_NR(9)
23#define fiq_rrx __REG_NR(10)
24#define fiq_rtx __REG_NR(11)
25#define fiq_rcount __REG_NR(12)
26#define fiq_rirq __REG_NR(13)
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
new file mode 100644
index 000000000000..88a456dba967
--- /dev/null
+++ b/drivers/spi/spi_s3c64xx.c
@@ -0,0 +1,1196 @@
1/* linux/drivers/spi/spi_s3c64xx.c
2 *
3 * Copyright (C) 2009 Samsung Electronics Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <linux/init.h>
22#include <linux/module.h>
23#include <linux/workqueue.h>
24#include <linux/delay.h>
25#include <linux/clk.h>
26#include <linux/dma-mapping.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29
30#include <mach/dma.h>
31#include <plat/spi.h>
32
33/* Registers and bit-fields */
34
35#define S3C64XX_SPI_CH_CFG 0x00
36#define S3C64XX_SPI_CLK_CFG 0x04
37#define S3C64XX_SPI_MODE_CFG 0x08
38#define S3C64XX_SPI_SLAVE_SEL 0x0C
39#define S3C64XX_SPI_INT_EN 0x10
40#define S3C64XX_SPI_STATUS 0x14
41#define S3C64XX_SPI_TX_DATA 0x18
42#define S3C64XX_SPI_RX_DATA 0x1C
43#define S3C64XX_SPI_PACKET_CNT 0x20
44#define S3C64XX_SPI_PENDING_CLR 0x24
45#define S3C64XX_SPI_SWAP_CFG 0x28
46#define S3C64XX_SPI_FB_CLK 0x2C
47
48#define S3C64XX_SPI_CH_HS_EN (1<<6) /* High Speed Enable */
49#define S3C64XX_SPI_CH_SW_RST (1<<5)
50#define S3C64XX_SPI_CH_SLAVE (1<<4)
51#define S3C64XX_SPI_CPOL_L (1<<3)
52#define S3C64XX_SPI_CPHA_B (1<<2)
53#define S3C64XX_SPI_CH_RXCH_ON (1<<1)
54#define S3C64XX_SPI_CH_TXCH_ON (1<<0)
55
56#define S3C64XX_SPI_CLKSEL_SRCMSK (3<<9)
57#define S3C64XX_SPI_CLKSEL_SRCSHFT 9
58#define S3C64XX_SPI_ENCLK_ENABLE (1<<8)
59#define S3C64XX_SPI_PSR_MASK 0xff
60
61#define S3C64XX_SPI_MODE_CH_TSZ_BYTE (0<<29)
62#define S3C64XX_SPI_MODE_CH_TSZ_HALFWORD (1<<29)
63#define S3C64XX_SPI_MODE_CH_TSZ_WORD (2<<29)
64#define S3C64XX_SPI_MODE_CH_TSZ_MASK (3<<29)
65#define S3C64XX_SPI_MODE_BUS_TSZ_BYTE (0<<17)
66#define S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD (1<<17)
67#define S3C64XX_SPI_MODE_BUS_TSZ_WORD (2<<17)
68#define S3C64XX_SPI_MODE_BUS_TSZ_MASK (3<<17)
69#define S3C64XX_SPI_MODE_RXDMA_ON (1<<2)
70#define S3C64XX_SPI_MODE_TXDMA_ON (1<<1)
71#define S3C64XX_SPI_MODE_4BURST (1<<0)
72
73#define S3C64XX_SPI_SLAVE_AUTO (1<<1)
74#define S3C64XX_SPI_SLAVE_SIG_INACT (1<<0)
75
76#define S3C64XX_SPI_ACT(c) writel(0, (c)->regs + S3C64XX_SPI_SLAVE_SEL)
77
78#define S3C64XX_SPI_DEACT(c) writel(S3C64XX_SPI_SLAVE_SIG_INACT, \
79 (c)->regs + S3C64XX_SPI_SLAVE_SEL)
80
81#define S3C64XX_SPI_INT_TRAILING_EN (1<<6)
82#define S3C64XX_SPI_INT_RX_OVERRUN_EN (1<<5)
83#define S3C64XX_SPI_INT_RX_UNDERRUN_EN (1<<4)
84#define S3C64XX_SPI_INT_TX_OVERRUN_EN (1<<3)
85#define S3C64XX_SPI_INT_TX_UNDERRUN_EN (1<<2)
86#define S3C64XX_SPI_INT_RX_FIFORDY_EN (1<<1)
87#define S3C64XX_SPI_INT_TX_FIFORDY_EN (1<<0)
88
89#define S3C64XX_SPI_ST_RX_OVERRUN_ERR (1<<5)
90#define S3C64XX_SPI_ST_RX_UNDERRUN_ERR (1<<4)
91#define S3C64XX_SPI_ST_TX_OVERRUN_ERR (1<<3)
92#define S3C64XX_SPI_ST_TX_UNDERRUN_ERR (1<<2)
93#define S3C64XX_SPI_ST_RX_FIFORDY (1<<1)
94#define S3C64XX_SPI_ST_TX_FIFORDY (1<<0)
95
96#define S3C64XX_SPI_PACKET_CNT_EN (1<<16)
97
98#define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4)
99#define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3)
100#define S3C64XX_SPI_PND_RX_UNDERRUN_CLR (1<<2)
101#define S3C64XX_SPI_PND_RX_OVERRUN_CLR (1<<1)
102#define S3C64XX_SPI_PND_TRAILING_CLR (1<<0)
103
104#define S3C64XX_SPI_SWAP_RX_HALF_WORD (1<<7)
105#define S3C64XX_SPI_SWAP_RX_BYTE (1<<6)
106#define S3C64XX_SPI_SWAP_RX_BIT (1<<5)
107#define S3C64XX_SPI_SWAP_RX_EN (1<<4)
108#define S3C64XX_SPI_SWAP_TX_HALF_WORD (1<<3)
109#define S3C64XX_SPI_SWAP_TX_BYTE (1<<2)
110#define S3C64XX_SPI_SWAP_TX_BIT (1<<1)
111#define S3C64XX_SPI_SWAP_TX_EN (1<<0)
112
113#define S3C64XX_SPI_FBCLK_MSK (3<<0)
114
115#define S3C64XX_SPI_ST_TRLCNTZ(v, i) ((((v) >> (i)->rx_lvl_offset) & \
116 (((i)->fifo_lvl_mask + 1))) \
117 ? 1 : 0)
118
119#define S3C64XX_SPI_ST_TX_DONE(v, i) ((((v) >> (i)->rx_lvl_offset) & \
120 (((i)->fifo_lvl_mask + 1) << 1)) \
121 ? 1 : 0)
122#define TX_FIFO_LVL(v, i) (((v) >> 6) & (i)->fifo_lvl_mask)
123#define RX_FIFO_LVL(v, i) (((v) >> (i)->rx_lvl_offset) & (i)->fifo_lvl_mask)
124
125#define S3C64XX_SPI_MAX_TRAILCNT 0x3ff
126#define S3C64XX_SPI_TRAILCNT_OFF 19
127
128#define S3C64XX_SPI_TRAILCNT S3C64XX_SPI_MAX_TRAILCNT
129
130#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
131
132#define SUSPND (1<<0)
133#define SPIBUSY (1<<1)
134#define RXBUSY (1<<2)
135#define TXBUSY (1<<3)
136
137/**
138 * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver.
139 * @clk: Pointer to the spi clock.
140 * @master: Pointer to the SPI Protocol master.
141 * @workqueue: Work queue for the SPI xfer requests.
142 * @cntrlr_info: Platform specific data for the controller this driver manages.
143 * @tgl_spi: Pointer to the last CS left untoggled by the cs_change hint.
144 * @work: Work
145 * @queue: To log SPI xfer requests.
146 * @lock: Controller specific lock.
147 * @state: Set of FLAGS to indicate status.
148 * @rx_dmach: Controller's DMA channel for Rx.
149 * @tx_dmach: Controller's DMA channel for Tx.
150 * @sfr_start: BUS address of SPI controller regs.
151 * @regs: Pointer to ioremap'ed controller registers.
152 * @xfer_completion: To indicate completion of xfer task.
153 * @cur_mode: Stores the active configuration of the controller.
154 * @cur_bpw: Stores the active bits per word settings.
155 * @cur_speed: Stores the active xfer clock speed.
156 */
157struct s3c64xx_spi_driver_data {
158 void __iomem *regs;
159 struct clk *clk;
160 struct platform_device *pdev;
161 struct spi_master *master;
162 struct workqueue_struct *workqueue;
163 struct s3c64xx_spi_cntrlr_info *cntrlr_info;
164 struct spi_device *tgl_spi;
165 struct work_struct work;
166 struct list_head queue;
167 spinlock_t lock;
168 enum dma_ch rx_dmach;
169 enum dma_ch tx_dmach;
170 unsigned long sfr_start;
171 struct completion xfer_completion;
172 unsigned state;
173 unsigned cur_mode, cur_bpw;
174 unsigned cur_speed;
175};
176
177static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
178 .name = "samsung-spi-dma",
179};
180
181static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
182{
183 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
184 void __iomem *regs = sdd->regs;
185 unsigned long loops;
186 u32 val;
187
188 writel(0, regs + S3C64XX_SPI_PACKET_CNT);
189
190 val = readl(regs + S3C64XX_SPI_CH_CFG);
191 val |= S3C64XX_SPI_CH_SW_RST;
192 val &= ~S3C64XX_SPI_CH_HS_EN;
193 writel(val, regs + S3C64XX_SPI_CH_CFG);
194
195 /* Flush TxFIFO*/
196 loops = msecs_to_loops(1);
197 do {
198 val = readl(regs + S3C64XX_SPI_STATUS);
199 } while (TX_FIFO_LVL(val, sci) && loops--);
200
201 /* Flush RxFIFO*/
202 loops = msecs_to_loops(1);
203 do {
204 val = readl(regs + S3C64XX_SPI_STATUS);
205 if (RX_FIFO_LVL(val, sci))
206 readl(regs + S3C64XX_SPI_RX_DATA);
207 else
208 break;
209 } while (loops--);
210
211 val = readl(regs + S3C64XX_SPI_CH_CFG);
212 val &= ~S3C64XX_SPI_CH_SW_RST;
213 writel(val, regs + S3C64XX_SPI_CH_CFG);
214
215 val = readl(regs + S3C64XX_SPI_MODE_CFG);
216 val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
217 writel(val, regs + S3C64XX_SPI_MODE_CFG);
218
219 val = readl(regs + S3C64XX_SPI_CH_CFG);
220 val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
221 writel(val, regs + S3C64XX_SPI_CH_CFG);
222}
223
224static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
225 struct spi_device *spi,
226 struct spi_transfer *xfer, int dma_mode)
227{
228 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
229 void __iomem *regs = sdd->regs;
230 u32 modecfg, chcfg;
231
232 modecfg = readl(regs + S3C64XX_SPI_MODE_CFG);
233 modecfg &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
234
235 chcfg = readl(regs + S3C64XX_SPI_CH_CFG);
236 chcfg &= ~S3C64XX_SPI_CH_TXCH_ON;
237
238 if (dma_mode) {
239 chcfg &= ~S3C64XX_SPI_CH_RXCH_ON;
240 } else {
241 /* Always shift in data in FIFO, even if xfer is Tx only,
242 * this helps setting PCKT_CNT value for generating clocks
243 * as exactly needed.
244 */
245 chcfg |= S3C64XX_SPI_CH_RXCH_ON;
246 writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff)
247 | S3C64XX_SPI_PACKET_CNT_EN,
248 regs + S3C64XX_SPI_PACKET_CNT);
249 }
250
251 if (xfer->tx_buf != NULL) {
252 sdd->state |= TXBUSY;
253 chcfg |= S3C64XX_SPI_CH_TXCH_ON;
254 if (dma_mode) {
255 modecfg |= S3C64XX_SPI_MODE_TXDMA_ON;
256 s3c2410_dma_config(sdd->tx_dmach, 1);
257 s3c2410_dma_enqueue(sdd->tx_dmach, (void *)sdd,
258 xfer->tx_dma, xfer->len);
259 s3c2410_dma_ctrl(sdd->tx_dmach, S3C2410_DMAOP_START);
260 } else {
261 unsigned char *buf = (unsigned char *) xfer->tx_buf;
262 int i = 0;
263 while (i < xfer->len)
264 writeb(buf[i++], regs + S3C64XX_SPI_TX_DATA);
265 }
266 }
267
268 if (xfer->rx_buf != NULL) {
269 sdd->state |= RXBUSY;
270
271 if (sci->high_speed && sdd->cur_speed >= 30000000UL
272 && !(sdd->cur_mode & SPI_CPHA))
273 chcfg |= S3C64XX_SPI_CH_HS_EN;
274
275 if (dma_mode) {
276 modecfg |= S3C64XX_SPI_MODE_RXDMA_ON;
277 chcfg |= S3C64XX_SPI_CH_RXCH_ON;
278 writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff)
279 | S3C64XX_SPI_PACKET_CNT_EN,
280 regs + S3C64XX_SPI_PACKET_CNT);
281 s3c2410_dma_config(sdd->rx_dmach, 1);
282 s3c2410_dma_enqueue(sdd->rx_dmach, (void *)sdd,
283 xfer->rx_dma, xfer->len);
284 s3c2410_dma_ctrl(sdd->rx_dmach, S3C2410_DMAOP_START);
285 }
286 }
287
288 writel(modecfg, regs + S3C64XX_SPI_MODE_CFG);
289 writel(chcfg, regs + S3C64XX_SPI_CH_CFG);
290}
291
292static inline void enable_cs(struct s3c64xx_spi_driver_data *sdd,
293 struct spi_device *spi)
294{
295 struct s3c64xx_spi_csinfo *cs;
296
297 if (sdd->tgl_spi != NULL) { /* If last device toggled after mssg */
298 if (sdd->tgl_spi != spi) { /* if last mssg on diff device */
299 /* Deselect the last toggled device */
300 cs = sdd->tgl_spi->controller_data;
301 cs->set_level(spi->mode & SPI_CS_HIGH ? 0 : 1);
302 }
303 sdd->tgl_spi = NULL;
304 }
305
306 cs = spi->controller_data;
307 cs->set_level(spi->mode & SPI_CS_HIGH ? 1 : 0);
308}
309
310static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
311 struct spi_transfer *xfer, int dma_mode)
312{
313 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
314 void __iomem *regs = sdd->regs;
315 unsigned long val;
316 int ms;
317
318 /* millisecs to xfer 'len' bytes @ 'cur_speed' */
319 ms = xfer->len * 8 * 1000 / sdd->cur_speed;
320 ms += 5; /* some tolerance */
321
322 if (dma_mode) {
323 val = msecs_to_jiffies(ms) + 10;
324 val = wait_for_completion_timeout(&sdd->xfer_completion, val);
325 } else {
326 val = msecs_to_loops(ms);
327 do {
328 val = readl(regs + S3C64XX_SPI_STATUS);
329 } while (RX_FIFO_LVL(val, sci) < xfer->len && --val);
330 }
331
332 if (!val)
333 return -EIO;
334
335 if (dma_mode) {
336 u32 status;
337
338 /*
339 * DmaTx returns after simply writing data in the FIFO,
340 * w/o waiting for real transmission on the bus to finish.
341 * DmaRx returns only after Dma read data from FIFO which
342 * needs bus transmission to finish, so we don't worry if
343 * Xfer involved Rx(with or without Tx).
344 */
345 if (xfer->rx_buf == NULL) {
346 val = msecs_to_loops(10);
347 status = readl(regs + S3C64XX_SPI_STATUS);
348 while ((TX_FIFO_LVL(status, sci)
349 || !S3C64XX_SPI_ST_TX_DONE(status, sci))
350 && --val) {
351 cpu_relax();
352 status = readl(regs + S3C64XX_SPI_STATUS);
353 }
354
355 if (!val)
356 return -EIO;
357 }
358 } else {
359 unsigned char *buf;
360 int i;
361
362 /* If it was only Tx */
363 if (xfer->rx_buf == NULL) {
364 sdd->state &= ~TXBUSY;
365 return 0;
366 }
367
368 i = 0;
369 buf = xfer->rx_buf;
370 while (i < xfer->len)
371 buf[i++] = readb(regs + S3C64XX_SPI_RX_DATA);
372
373 sdd->state &= ~RXBUSY;
374 }
375
376 return 0;
377}
378
379static inline void disable_cs(struct s3c64xx_spi_driver_data *sdd,
380 struct spi_device *spi)
381{
382 struct s3c64xx_spi_csinfo *cs = spi->controller_data;
383
384 if (sdd->tgl_spi == spi)
385 sdd->tgl_spi = NULL;
386
387 cs->set_level(spi->mode & SPI_CS_HIGH ? 0 : 1);
388}
389
390static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
391{
392 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
393 void __iomem *regs = sdd->regs;
394 u32 val;
395
396 /* Disable Clock */
397 val = readl(regs + S3C64XX_SPI_CLK_CFG);
398 val &= ~S3C64XX_SPI_ENCLK_ENABLE;
399 writel(val, regs + S3C64XX_SPI_CLK_CFG);
400
401 /* Set Polarity and Phase */
402 val = readl(regs + S3C64XX_SPI_CH_CFG);
403 val &= ~(S3C64XX_SPI_CH_SLAVE |
404 S3C64XX_SPI_CPOL_L |
405 S3C64XX_SPI_CPHA_B);
406
407 if (sdd->cur_mode & SPI_CPOL)
408 val |= S3C64XX_SPI_CPOL_L;
409
410 if (sdd->cur_mode & SPI_CPHA)
411 val |= S3C64XX_SPI_CPHA_B;
412
413 writel(val, regs + S3C64XX_SPI_CH_CFG);
414
415 /* Set Channel & DMA Mode */
416 val = readl(regs + S3C64XX_SPI_MODE_CFG);
417 val &= ~(S3C64XX_SPI_MODE_BUS_TSZ_MASK
418 | S3C64XX_SPI_MODE_CH_TSZ_MASK);
419
420 switch (sdd->cur_bpw) {
421 case 32:
422 val |= S3C64XX_SPI_MODE_BUS_TSZ_WORD;
423 break;
424 case 16:
425 val |= S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD;
426 break;
427 default:
428 val |= S3C64XX_SPI_MODE_BUS_TSZ_BYTE;
429 break;
430 }
431 val |= S3C64XX_SPI_MODE_CH_TSZ_BYTE; /* Always 8bits wide */
432
433 writel(val, regs + S3C64XX_SPI_MODE_CFG);
434
435 /* Configure Clock */
436 val = readl(regs + S3C64XX_SPI_CLK_CFG);
437 val &= ~S3C64XX_SPI_PSR_MASK;
438 val |= ((clk_get_rate(sci->src_clk) / sdd->cur_speed / 2 - 1)
439 & S3C64XX_SPI_PSR_MASK);
440 writel(val, regs + S3C64XX_SPI_CLK_CFG);
441
442 /* Enable Clock */
443 val = readl(regs + S3C64XX_SPI_CLK_CFG);
444 val |= S3C64XX_SPI_ENCLK_ENABLE;
445 writel(val, regs + S3C64XX_SPI_CLK_CFG);
446}
447
448void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id,
449 int size, enum s3c2410_dma_buffresult res)
450{
451 struct s3c64xx_spi_driver_data *sdd = buf_id;
452 unsigned long flags;
453
454 spin_lock_irqsave(&sdd->lock, flags);
455
456 if (res == S3C2410_RES_OK)
457 sdd->state &= ~RXBUSY;
458 else
459 dev_err(&sdd->pdev->dev, "DmaAbrtRx-%d\n", size);
460
461 /* If the other done */
462 if (!(sdd->state & TXBUSY))
463 complete(&sdd->xfer_completion);
464
465 spin_unlock_irqrestore(&sdd->lock, flags);
466}
467
468void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
469 int size, enum s3c2410_dma_buffresult res)
470{
471 struct s3c64xx_spi_driver_data *sdd = buf_id;
472 unsigned long flags;
473
474 spin_lock_irqsave(&sdd->lock, flags);
475
476 if (res == S3C2410_RES_OK)
477 sdd->state &= ~TXBUSY;
478 else
479 dev_err(&sdd->pdev->dev, "DmaAbrtTx-%d \n", size);
480
481 /* If the other done */
482 if (!(sdd->state & RXBUSY))
483 complete(&sdd->xfer_completion);
484
485 spin_unlock_irqrestore(&sdd->lock, flags);
486}
487
488#define XFER_DMAADDR_INVALID DMA_BIT_MASK(32)
489
490static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
491 struct spi_message *msg)
492{
493 struct device *dev = &sdd->pdev->dev;
494 struct spi_transfer *xfer;
495
496 if (msg->is_dma_mapped)
497 return 0;
498
499 /* First mark all xfer unmapped */
500 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
501 xfer->rx_dma = XFER_DMAADDR_INVALID;
502 xfer->tx_dma = XFER_DMAADDR_INVALID;
503 }
504
505 /* Map until end or first fail */
506 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
507
508 if (xfer->tx_buf != NULL) {
509 xfer->tx_dma = dma_map_single(dev, xfer->tx_buf,
510 xfer->len, DMA_TO_DEVICE);
511 if (dma_mapping_error(dev, xfer->tx_dma)) {
512 dev_err(dev, "dma_map_single Tx failed\n");
513 xfer->tx_dma = XFER_DMAADDR_INVALID;
514 return -ENOMEM;
515 }
516 }
517
518 if (xfer->rx_buf != NULL) {
519 xfer->rx_dma = dma_map_single(dev, xfer->rx_buf,
520 xfer->len, DMA_FROM_DEVICE);
521 if (dma_mapping_error(dev, xfer->rx_dma)) {
522 dev_err(dev, "dma_map_single Rx failed\n");
523 dma_unmap_single(dev, xfer->tx_dma,
524 xfer->len, DMA_TO_DEVICE);
525 xfer->tx_dma = XFER_DMAADDR_INVALID;
526 xfer->rx_dma = XFER_DMAADDR_INVALID;
527 return -ENOMEM;
528 }
529 }
530 }
531
532 return 0;
533}
534
535static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
536 struct spi_message *msg)
537{
538 struct device *dev = &sdd->pdev->dev;
539 struct spi_transfer *xfer;
540
541 if (msg->is_dma_mapped)
542 return;
543
544 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
545
546 if (xfer->rx_buf != NULL
547 && xfer->rx_dma != XFER_DMAADDR_INVALID)
548 dma_unmap_single(dev, xfer->rx_dma,
549 xfer->len, DMA_FROM_DEVICE);
550
551 if (xfer->tx_buf != NULL
552 && xfer->tx_dma != XFER_DMAADDR_INVALID)
553 dma_unmap_single(dev, xfer->tx_dma,
554 xfer->len, DMA_TO_DEVICE);
555 }
556}
557
558static void handle_msg(struct s3c64xx_spi_driver_data *sdd,
559 struct spi_message *msg)
560{
561 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
562 struct spi_device *spi = msg->spi;
563 struct s3c64xx_spi_csinfo *cs = spi->controller_data;
564 struct spi_transfer *xfer;
565 int status = 0, cs_toggle = 0;
566 u32 speed;
567 u8 bpw;
568
569 /* If Master's(controller) state differs from that needed by Slave */
570 if (sdd->cur_speed != spi->max_speed_hz
571 || sdd->cur_mode != spi->mode
572 || sdd->cur_bpw != spi->bits_per_word) {
573 sdd->cur_bpw = spi->bits_per_word;
574 sdd->cur_speed = spi->max_speed_hz;
575 sdd->cur_mode = spi->mode;
576 s3c64xx_spi_config(sdd);
577 }
578
579 /* Map all the transfers if needed */
580 if (s3c64xx_spi_map_mssg(sdd, msg)) {
581 dev_err(&spi->dev,
582 "Xfer: Unable to map message buffers!\n");
583 status = -ENOMEM;
584 goto out;
585 }
586
587 /* Configure feedback delay */
588 writel(cs->fb_delay & 0x3, sdd->regs + S3C64XX_SPI_FB_CLK);
589
590 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
591
592 unsigned long flags;
593 int use_dma;
594
595 INIT_COMPLETION(sdd->xfer_completion);
596
597 /* Only BPW and Speed may change across transfers */
598 bpw = xfer->bits_per_word ? : spi->bits_per_word;
599 speed = xfer->speed_hz ? : spi->max_speed_hz;
600
601 if (bpw != sdd->cur_bpw || speed != sdd->cur_speed) {
602 sdd->cur_bpw = bpw;
603 sdd->cur_speed = speed;
604 s3c64xx_spi_config(sdd);
605 }
606
607 /* Polling method for xfers not bigger than FIFO capacity */
608 if (xfer->len <= ((sci->fifo_lvl_mask >> 1) + 1))
609 use_dma = 0;
610 else
611 use_dma = 1;
612
613 spin_lock_irqsave(&sdd->lock, flags);
614
615 /* Pending only which is to be done */
616 sdd->state &= ~RXBUSY;
617 sdd->state &= ~TXBUSY;
618
619 enable_datapath(sdd, spi, xfer, use_dma);
620
621 /* Slave Select */
622 enable_cs(sdd, spi);
623
624 /* Start the signals */
625 S3C64XX_SPI_ACT(sdd);
626
627 spin_unlock_irqrestore(&sdd->lock, flags);
628
629 status = wait_for_xfer(sdd, xfer, use_dma);
630
631 /* Quiese the signals */
632 S3C64XX_SPI_DEACT(sdd);
633
634 if (status) {
635 dev_err(&spi->dev, "I/O Error: \
636 rx-%d tx-%d res:rx-%c tx-%c len-%d\n",
637 xfer->rx_buf ? 1 : 0, xfer->tx_buf ? 1 : 0,
638 (sdd->state & RXBUSY) ? 'f' : 'p',
639 (sdd->state & TXBUSY) ? 'f' : 'p',
640 xfer->len);
641
642 if (use_dma) {
643 if (xfer->tx_buf != NULL
644 && (sdd->state & TXBUSY))
645 s3c2410_dma_ctrl(sdd->tx_dmach,
646 S3C2410_DMAOP_FLUSH);
647 if (xfer->rx_buf != NULL
648 && (sdd->state & RXBUSY))
649 s3c2410_dma_ctrl(sdd->rx_dmach,
650 S3C2410_DMAOP_FLUSH);
651 }
652
653 goto out;
654 }
655
656 if (xfer->delay_usecs)
657 udelay(xfer->delay_usecs);
658
659 if (xfer->cs_change) {
660 /* Hint that the next mssg is gonna be
661 for the same device */
662 if (list_is_last(&xfer->transfer_list,
663 &msg->transfers))
664 cs_toggle = 1;
665 else
666 disable_cs(sdd, spi);
667 }
668
669 msg->actual_length += xfer->len;
670
671 flush_fifo(sdd);
672 }
673
674out:
675 if (!cs_toggle || status)
676 disable_cs(sdd, spi);
677 else
678 sdd->tgl_spi = spi;
679
680 s3c64xx_spi_unmap_mssg(sdd, msg);
681
682 msg->status = status;
683
684 if (msg->complete)
685 msg->complete(msg->context);
686}
687
688static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
689{
690 if (s3c2410_dma_request(sdd->rx_dmach,
691 &s3c64xx_spi_dma_client, NULL) < 0) {
692 dev_err(&sdd->pdev->dev, "cannot get RxDMA\n");
693 return 0;
694 }
695 s3c2410_dma_set_buffdone_fn(sdd->rx_dmach, s3c64xx_spi_dma_rxcb);
696 s3c2410_dma_devconfig(sdd->rx_dmach, S3C2410_DMASRC_HW,
697 sdd->sfr_start + S3C64XX_SPI_RX_DATA);
698
699 if (s3c2410_dma_request(sdd->tx_dmach,
700 &s3c64xx_spi_dma_client, NULL) < 0) {
701 dev_err(&sdd->pdev->dev, "cannot get TxDMA\n");
702 s3c2410_dma_free(sdd->rx_dmach, &s3c64xx_spi_dma_client);
703 return 0;
704 }
705 s3c2410_dma_set_buffdone_fn(sdd->tx_dmach, s3c64xx_spi_dma_txcb);
706 s3c2410_dma_devconfig(sdd->tx_dmach, S3C2410_DMASRC_MEM,
707 sdd->sfr_start + S3C64XX_SPI_TX_DATA);
708
709 return 1;
710}
711
712static void s3c64xx_spi_work(struct work_struct *work)
713{
714 struct s3c64xx_spi_driver_data *sdd = container_of(work,
715 struct s3c64xx_spi_driver_data, work);
716 unsigned long flags;
717
718 /* Acquire DMA channels */
719 while (!acquire_dma(sdd))
720 msleep(10);
721
722 spin_lock_irqsave(&sdd->lock, flags);
723
724 while (!list_empty(&sdd->queue)
725 && !(sdd->state & SUSPND)) {
726
727 struct spi_message *msg;
728
729 msg = container_of(sdd->queue.next, struct spi_message, queue);
730
731 list_del_init(&msg->queue);
732
733 /* Set Xfer busy flag */
734 sdd->state |= SPIBUSY;
735
736 spin_unlock_irqrestore(&sdd->lock, flags);
737
738 handle_msg(sdd, msg);
739
740 spin_lock_irqsave(&sdd->lock, flags);
741
742 sdd->state &= ~SPIBUSY;
743 }
744
745 spin_unlock_irqrestore(&sdd->lock, flags);
746
747 /* Free DMA channels */
748 s3c2410_dma_free(sdd->tx_dmach, &s3c64xx_spi_dma_client);
749 s3c2410_dma_free(sdd->rx_dmach, &s3c64xx_spi_dma_client);
750}
751
752static int s3c64xx_spi_transfer(struct spi_device *spi,
753 struct spi_message *msg)
754{
755 struct s3c64xx_spi_driver_data *sdd;
756 unsigned long flags;
757
758 sdd = spi_master_get_devdata(spi->master);
759
760 spin_lock_irqsave(&sdd->lock, flags);
761
762 if (sdd->state & SUSPND) {
763 spin_unlock_irqrestore(&sdd->lock, flags);
764 return -ESHUTDOWN;
765 }
766
767 msg->status = -EINPROGRESS;
768 msg->actual_length = 0;
769
770 list_add_tail(&msg->queue, &sdd->queue);
771
772 queue_work(sdd->workqueue, &sdd->work);
773
774 spin_unlock_irqrestore(&sdd->lock, flags);
775
776 return 0;
777}
778
779/*
780 * Here we only check the validity of requested configuration
781 * and save the configuration in a local data-structure.
782 * The controller is actually configured only just before we
783 * get a message to transfer.
784 */
785static int s3c64xx_spi_setup(struct spi_device *spi)
786{
787 struct s3c64xx_spi_csinfo *cs = spi->controller_data;
788 struct s3c64xx_spi_driver_data *sdd;
789 struct s3c64xx_spi_cntrlr_info *sci;
790 struct spi_message *msg;
791 u32 psr, speed;
792 unsigned long flags;
793 int err = 0;
794
795 if (cs == NULL || cs->set_level == NULL) {
796 dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
797 return -ENODEV;
798 }
799
800 sdd = spi_master_get_devdata(spi->master);
801 sci = sdd->cntrlr_info;
802
803 spin_lock_irqsave(&sdd->lock, flags);
804
805 list_for_each_entry(msg, &sdd->queue, queue) {
806 /* Is some mssg is already queued for this device */
807 if (msg->spi == spi) {
808 dev_err(&spi->dev,
809 "setup: attempt while mssg in queue!\n");
810 spin_unlock_irqrestore(&sdd->lock, flags);
811 return -EBUSY;
812 }
813 }
814
815 if (sdd->state & SUSPND) {
816 spin_unlock_irqrestore(&sdd->lock, flags);
817 dev_err(&spi->dev,
818 "setup: SPI-%d not active!\n", spi->master->bus_num);
819 return -ESHUTDOWN;
820 }
821
822 spin_unlock_irqrestore(&sdd->lock, flags);
823
824 if (spi->bits_per_word != 8
825 && spi->bits_per_word != 16
826 && spi->bits_per_word != 32) {
827 dev_err(&spi->dev, "setup: %dbits/wrd not supported!\n",
828 spi->bits_per_word);
829 err = -EINVAL;
830 goto setup_exit;
831 }
832
833 /* Check if we can provide the requested rate */
834 speed = clk_get_rate(sci->src_clk) / 2 / (0 + 1); /* Max possible */
835
836 if (spi->max_speed_hz > speed)
837 spi->max_speed_hz = speed;
838
839 psr = clk_get_rate(sci->src_clk) / 2 / spi->max_speed_hz - 1;
840 psr &= S3C64XX_SPI_PSR_MASK;
841 if (psr == S3C64XX_SPI_PSR_MASK)
842 psr--;
843
844 speed = clk_get_rate(sci->src_clk) / 2 / (psr + 1);
845 if (spi->max_speed_hz < speed) {
846 if (psr+1 < S3C64XX_SPI_PSR_MASK) {
847 psr++;
848 } else {
849 err = -EINVAL;
850 goto setup_exit;
851 }
852 }
853
854 speed = clk_get_rate(sci->src_clk) / 2 / (psr + 1);
855 if (spi->max_speed_hz >= speed)
856 spi->max_speed_hz = speed;
857 else
858 err = -EINVAL;
859
860setup_exit:
861
862 /* setup() returns with device de-selected */
863 disable_cs(sdd, spi);
864
865 return err;
866}
867
868static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
869{
870 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
871 void __iomem *regs = sdd->regs;
872 unsigned int val;
873
874 sdd->cur_speed = 0;
875
876 S3C64XX_SPI_DEACT(sdd);
877
878 /* Disable Interrupts - we use Polling if not DMA mode */
879 writel(0, regs + S3C64XX_SPI_INT_EN);
880
881 writel(sci->src_clk_nr << S3C64XX_SPI_CLKSEL_SRCSHFT,
882 regs + S3C64XX_SPI_CLK_CFG);
883 writel(0, regs + S3C64XX_SPI_MODE_CFG);
884 writel(0, regs + S3C64XX_SPI_PACKET_CNT);
885
886 /* Clear any irq pending bits */
887 writel(readl(regs + S3C64XX_SPI_PENDING_CLR),
888 regs + S3C64XX_SPI_PENDING_CLR);
889
890 writel(0, regs + S3C64XX_SPI_SWAP_CFG);
891
892 val = readl(regs + S3C64XX_SPI_MODE_CFG);
893 val &= ~S3C64XX_SPI_MODE_4BURST;
894 val &= ~(S3C64XX_SPI_MAX_TRAILCNT << S3C64XX_SPI_TRAILCNT_OFF);
895 val |= (S3C64XX_SPI_TRAILCNT << S3C64XX_SPI_TRAILCNT_OFF);
896 writel(val, regs + S3C64XX_SPI_MODE_CFG);
897
898 flush_fifo(sdd);
899}
900
901static int __init s3c64xx_spi_probe(struct platform_device *pdev)
902{
903 struct resource *mem_res, *dmatx_res, *dmarx_res;
904 struct s3c64xx_spi_driver_data *sdd;
905 struct s3c64xx_spi_cntrlr_info *sci;
906 struct spi_master *master;
907 int ret;
908
909 if (pdev->id < 0) {
910 dev_err(&pdev->dev,
911 "Invalid platform device id-%d\n", pdev->id);
912 return -ENODEV;
913 }
914
915 if (pdev->dev.platform_data == NULL) {
916 dev_err(&pdev->dev, "platform_data missing!\n");
917 return -ENODEV;
918 }
919
920 /* Check for availability of necessary resource */
921
922 dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
923 if (dmatx_res == NULL) {
924 dev_err(&pdev->dev, "Unable to get SPI-Tx dma resource\n");
925 return -ENXIO;
926 }
927
928 dmarx_res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
929 if (dmarx_res == NULL) {
930 dev_err(&pdev->dev, "Unable to get SPI-Rx dma resource\n");
931 return -ENXIO;
932 }
933
934 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
935 if (mem_res == NULL) {
936 dev_err(&pdev->dev, "Unable to get SPI MEM resource\n");
937 return -ENXIO;
938 }
939
940 master = spi_alloc_master(&pdev->dev,
941 sizeof(struct s3c64xx_spi_driver_data));
942 if (master == NULL) {
943 dev_err(&pdev->dev, "Unable to allocate SPI Master\n");
944 return -ENOMEM;
945 }
946
947 sci = pdev->dev.platform_data;
948
949 platform_set_drvdata(pdev, master);
950
951 sdd = spi_master_get_devdata(master);
952 sdd->master = master;
953 sdd->cntrlr_info = sci;
954 sdd->pdev = pdev;
955 sdd->sfr_start = mem_res->start;
956 sdd->tx_dmach = dmatx_res->start;
957 sdd->rx_dmach = dmarx_res->start;
958
959 sdd->cur_bpw = 8;
960
961 master->bus_num = pdev->id;
962 master->setup = s3c64xx_spi_setup;
963 master->transfer = s3c64xx_spi_transfer;
964 master->num_chipselect = sci->num_cs;
965 master->dma_alignment = 8;
966 /* the spi->mode bits understood by this driver: */
967 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
968
969 if (request_mem_region(mem_res->start,
970 resource_size(mem_res), pdev->name) == NULL) {
971 dev_err(&pdev->dev, "Req mem region failed\n");
972 ret = -ENXIO;
973 goto err0;
974 }
975
976 sdd->regs = ioremap(mem_res->start, resource_size(mem_res));
977 if (sdd->regs == NULL) {
978 dev_err(&pdev->dev, "Unable to remap IO\n");
979 ret = -ENXIO;
980 goto err1;
981 }
982
983 if (sci->cfg_gpio == NULL || sci->cfg_gpio(pdev)) {
984 dev_err(&pdev->dev, "Unable to config gpio\n");
985 ret = -EBUSY;
986 goto err2;
987 }
988
989 /* Setup clocks */
990 sdd->clk = clk_get(&pdev->dev, "spi");
991 if (IS_ERR(sdd->clk)) {
992 dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n");
993 ret = PTR_ERR(sdd->clk);
994 goto err3;
995 }
996
997 if (clk_enable(sdd->clk)) {
998 dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
999 ret = -EBUSY;
1000 goto err4;
1001 }
1002
1003 if (sci->src_clk_nr == S3C64XX_SPI_SRCCLK_PCLK)
1004 sci->src_clk = sdd->clk;
1005 else
1006 sci->src_clk = clk_get(&pdev->dev, sci->src_clk_name);
1007 if (IS_ERR(sci->src_clk)) {
1008 dev_err(&pdev->dev,
1009 "Unable to acquire clock '%s'\n", sci->src_clk_name);
1010 ret = PTR_ERR(sci->src_clk);
1011 goto err5;
1012 }
1013
1014 if (sci->src_clk != sdd->clk && clk_enable(sci->src_clk)) {
1015 dev_err(&pdev->dev, "Couldn't enable clock '%s'\n",
1016 sci->src_clk_name);
1017 ret = -EBUSY;
1018 goto err6;
1019 }
1020
1021 sdd->workqueue = create_singlethread_workqueue(
1022 dev_name(master->dev.parent));
1023 if (sdd->workqueue == NULL) {
1024 dev_err(&pdev->dev, "Unable to create workqueue\n");
1025 ret = -ENOMEM;
1026 goto err7;
1027 }
1028
1029 /* Setup Deufult Mode */
1030 s3c64xx_spi_hwinit(sdd, pdev->id);
1031
1032 spin_lock_init(&sdd->lock);
1033 init_completion(&sdd->xfer_completion);
1034 INIT_WORK(&sdd->work, s3c64xx_spi_work);
1035 INIT_LIST_HEAD(&sdd->queue);
1036
1037 if (spi_register_master(master)) {
1038 dev_err(&pdev->dev, "cannot register SPI master\n");
1039 ret = -EBUSY;
1040 goto err8;
1041 }
1042
1043 dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d \
1044 with %d Slaves attached\n",
1045 pdev->id, master->num_chipselect);
1046 dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\
1047 \tDMA=[Rx-%d, Tx-%d]\n",
1048 mem_res->end, mem_res->start,
1049 sdd->rx_dmach, sdd->tx_dmach);
1050
1051 return 0;
1052
1053err8:
1054 destroy_workqueue(sdd->workqueue);
1055err7:
1056 if (sci->src_clk != sdd->clk)
1057 clk_disable(sci->src_clk);
1058err6:
1059 if (sci->src_clk != sdd->clk)
1060 clk_put(sci->src_clk);
1061err5:
1062 clk_disable(sdd->clk);
1063err4:
1064 clk_put(sdd->clk);
1065err3:
1066err2:
1067 iounmap((void *) sdd->regs);
1068err1:
1069 release_mem_region(mem_res->start, resource_size(mem_res));
1070err0:
1071 platform_set_drvdata(pdev, NULL);
1072 spi_master_put(master);
1073
1074 return ret;
1075}
1076
1077static int s3c64xx_spi_remove(struct platform_device *pdev)
1078{
1079 struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
1080 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
1081 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
1082 struct resource *mem_res;
1083 unsigned long flags;
1084
1085 spin_lock_irqsave(&sdd->lock, flags);
1086 sdd->state |= SUSPND;
1087 spin_unlock_irqrestore(&sdd->lock, flags);
1088
1089 while (sdd->state & SPIBUSY)
1090 msleep(10);
1091
1092 spi_unregister_master(master);
1093
1094 destroy_workqueue(sdd->workqueue);
1095
1096 if (sci->src_clk != sdd->clk)
1097 clk_disable(sci->src_clk);
1098
1099 if (sci->src_clk != sdd->clk)
1100 clk_put(sci->src_clk);
1101
1102 clk_disable(sdd->clk);
1103 clk_put(sdd->clk);
1104
1105 iounmap((void *) sdd->regs);
1106
1107 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1108 release_mem_region(mem_res->start, resource_size(mem_res));
1109
1110 platform_set_drvdata(pdev, NULL);
1111 spi_master_put(master);
1112
1113 return 0;
1114}
1115
1116#ifdef CONFIG_PM
1117static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
1118{
1119 struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
1120 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
1121 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
1122 struct s3c64xx_spi_csinfo *cs;
1123 unsigned long flags;
1124
1125 spin_lock_irqsave(&sdd->lock, flags);
1126 sdd->state |= SUSPND;
1127 spin_unlock_irqrestore(&sdd->lock, flags);
1128
1129 while (sdd->state & SPIBUSY)
1130 msleep(10);
1131
1132 /* Disable the clock */
1133 if (sci->src_clk != sdd->clk)
1134 clk_disable(sci->src_clk);
1135
1136 clk_disable(sdd->clk);
1137
1138 sdd->cur_speed = 0; /* Output Clock is stopped */
1139
1140 return 0;
1141}
1142
1143static int s3c64xx_spi_resume(struct platform_device *pdev)
1144{
1145 struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
1146 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
1147 struct s3c64xx_spi_cntrlr_info *sci = sdd->cntrlr_info;
1148 unsigned long flags;
1149
1150 sci->cfg_gpio(pdev);
1151
1152 /* Enable the clock */
1153 if (sci->src_clk != sdd->clk)
1154 clk_enable(sci->src_clk);
1155
1156 clk_enable(sdd->clk);
1157
1158 s3c64xx_spi_hwinit(sdd, pdev->id);
1159
1160 spin_lock_irqsave(&sdd->lock, flags);
1161 sdd->state &= ~SUSPND;
1162 spin_unlock_irqrestore(&sdd->lock, flags);
1163
1164 return 0;
1165}
1166#else
1167#define s3c64xx_spi_suspend NULL
1168#define s3c64xx_spi_resume NULL
1169#endif /* CONFIG_PM */
1170
1171static struct platform_driver s3c64xx_spi_driver = {
1172 .driver = {
1173 .name = "s3c64xx-spi",
1174 .owner = THIS_MODULE,
1175 },
1176 .remove = s3c64xx_spi_remove,
1177 .suspend = s3c64xx_spi_suspend,
1178 .resume = s3c64xx_spi_resume,
1179};
1180MODULE_ALIAS("platform:s3c64xx-spi");
1181
1182static int __init s3c64xx_spi_init(void)
1183{
1184 return platform_driver_probe(&s3c64xx_spi_driver, s3c64xx_spi_probe);
1185}
1186module_init(s3c64xx_spi_init);
1187
1188static void __exit s3c64xx_spi_exit(void)
1189{
1190 platform_driver_unregister(&s3c64xx_spi_driver);
1191}
1192module_exit(s3c64xx_spi_exit);
1193
1194MODULE_AUTHOR("Jaswinder Singh <jassi.brar@samsung.com>");
1195MODULE_DESCRIPTION("S3C64XX SPI Controller Driver");
1196MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi_sh_sci.c b/drivers/spi/spi_sh_sci.c
index 7d36720eb982..a65c12ffa733 100644
--- a/drivers/spi/spi_sh_sci.c
+++ b/drivers/spi/spi_sh_sci.c
@@ -148,7 +148,7 @@ static int sh_sci_spi_probe(struct platform_device *dev)
148 ret = -ENOENT; 148 ret = -ENOENT;
149 goto err1; 149 goto err1;
150 } 150 }
151 sp->membase = ioremap(r->start, r->end - r->start + 1); 151 sp->membase = ioremap(r->start, resource_size(r));
152 if (!sp->membase) { 152 if (!sp->membase) {
153 ret = -ENXIO; 153 ret = -ENXIO;
154 goto err1; 154 goto err1;
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c
index 19f75627c3de..dfa024b633e1 100644
--- a/drivers/spi/spi_txx9.c
+++ b/drivers/spi/spi_txx9.c
@@ -375,12 +375,10 @@ static int __init txx9spi_probe(struct platform_device *dev)
375 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 375 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
376 if (!res) 376 if (!res)
377 goto exit_busy; 377 goto exit_busy;
378 if (!devm_request_mem_region(&dev->dev, 378 if (!devm_request_mem_region(&dev->dev, res->start, resource_size(res),
379 res->start, res->end - res->start + 1,
380 "spi_txx9")) 379 "spi_txx9"))
381 goto exit_busy; 380 goto exit_busy;
382 c->membase = devm_ioremap(&dev->dev, 381 c->membase = devm_ioremap(&dev->dev, res->start, resource_size(res));
383 res->start, res->end - res->start + 1);
384 if (!c->membase) 382 if (!c->membase)
385 goto exit_busy; 383 goto exit_busy;
386 384
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 9c446e6003d5..ea1bec3c9a13 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -53,7 +53,7 @@
53#define SPIDEV_MAJOR 153 /* assigned */ 53#define SPIDEV_MAJOR 153 /* assigned */
54#define N_SPI_MINORS 32 /* ... up to 256 */ 54#define N_SPI_MINORS 32 /* ... up to 256 */
55 55
56static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG]; 56static DECLARE_BITMAP(minors, N_SPI_MINORS);
57 57
58 58
59/* Bit masks for spi_device.mode management. Note that incorrect 59/* Bit masks for spi_device.mode management. Note that incorrect
@@ -558,7 +558,7 @@ static struct class *spidev_class;
558 558
559/*-------------------------------------------------------------------------*/ 559/*-------------------------------------------------------------------------*/
560 560
561static int spidev_probe(struct spi_device *spi) 561static int __devinit spidev_probe(struct spi_device *spi)
562{ 562{
563 struct spidev_data *spidev; 563 struct spidev_data *spidev;
564 int status; 564 int status;
@@ -607,7 +607,7 @@ static int spidev_probe(struct spi_device *spi)
607 return status; 607 return status;
608} 608}
609 609
610static int spidev_remove(struct spi_device *spi) 610static int __devexit spidev_remove(struct spi_device *spi)
611{ 611{
612 struct spidev_data *spidev = spi_get_drvdata(spi); 612 struct spidev_data *spidev = spi_get_drvdata(spi);
613 613
@@ -629,7 +629,7 @@ static int spidev_remove(struct spi_device *spi)
629 return 0; 629 return 0;
630} 630}
631 631
632static struct spi_driver spidev_spi = { 632static struct spi_driver spidev_spi_driver = {
633 .driver = { 633 .driver = {
634 .name = "spidev", 634 .name = "spidev",
635 .owner = THIS_MODULE, 635 .owner = THIS_MODULE,
@@ -661,14 +661,14 @@ static int __init spidev_init(void)
661 661
662 spidev_class = class_create(THIS_MODULE, "spidev"); 662 spidev_class = class_create(THIS_MODULE, "spidev");
663 if (IS_ERR(spidev_class)) { 663 if (IS_ERR(spidev_class)) {
664 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name); 664 unregister_chrdev(SPIDEV_MAJOR, spidev_spi_driver.driver.name);
665 return PTR_ERR(spidev_class); 665 return PTR_ERR(spidev_class);
666 } 666 }
667 667
668 status = spi_register_driver(&spidev_spi); 668 status = spi_register_driver(&spidev_spi_driver);
669 if (status < 0) { 669 if (status < 0) {
670 class_destroy(spidev_class); 670 class_destroy(spidev_class);
671 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name); 671 unregister_chrdev(SPIDEV_MAJOR, spidev_spi_driver.driver.name);
672 } 672 }
673 return status; 673 return status;
674} 674}
@@ -676,9 +676,9 @@ module_init(spidev_init);
676 676
677static void __exit spidev_exit(void) 677static void __exit spidev_exit(void)
678{ 678{
679 spi_unregister_driver(&spidev_spi); 679 spi_unregister_driver(&spidev_spi_driver);
680 class_destroy(spidev_class); 680 class_destroy(spidev_class);
681 unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name); 681 unregister_chrdev(SPIDEV_MAJOR, spidev_spi_driver.driver.name);
682} 682}
683module_exit(spidev_exit); 683module_exit(spidev_exit);
684 684
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 093f57af32d3..94eb86319ff3 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -87,8 +87,6 @@ source "drivers/staging/frontier/Kconfig"
87 87
88source "drivers/staging/dream/Kconfig" 88source "drivers/staging/dream/Kconfig"
89 89
90source "drivers/staging/dst/Kconfig"
91
92source "drivers/staging/pohmelfs/Kconfig" 90source "drivers/staging/pohmelfs/Kconfig"
93 91
94source "drivers/staging/b3dfg/Kconfig" 92source "drivers/staging/b3dfg/Kconfig"
@@ -145,5 +143,7 @@ source "drivers/staging/wavelan/Kconfig"
145 143
146source "drivers/staging/netwave/Kconfig" 144source "drivers/staging/netwave/Kconfig"
147 145
146source "drivers/staging/sm7xx/Kconfig"
147
148endif # !STAGING_EXCLUDE_BUILD 148endif # !STAGING_EXCLUDE_BUILD
149endif # STAGING 149endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 069864f4391e..b5e67b889f60 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_RTL8192E) += rtl8192e/
26obj-$(CONFIG_INPUT_MIMIO) += mimio/ 26obj-$(CONFIG_INPUT_MIMIO) += mimio/
27obj-$(CONFIG_TRANZPORT) += frontier/ 27obj-$(CONFIG_TRANZPORT) += frontier/
28obj-$(CONFIG_DREAM) += dream/ 28obj-$(CONFIG_DREAM) += dream/
29obj-$(CONFIG_DST) += dst/
30obj-$(CONFIG_POHMELFS) += pohmelfs/ 29obj-$(CONFIG_POHMELFS) += pohmelfs/
31obj-$(CONFIG_B3DFG) += b3dfg/ 30obj-$(CONFIG_B3DFG) += b3dfg/
32obj-$(CONFIG_IDE_PHISON) += phison/ 31obj-$(CONFIG_IDE_PHISON) += phison/
@@ -53,3 +52,4 @@ obj-$(CONFIG_ARLAN) += arlan/
53obj-$(CONFIG_WAVELAN) += wavelan/ 52obj-$(CONFIG_WAVELAN) += wavelan/
54obj-$(CONFIG_PCMCIA_WAVELAN) += wavelan/ 53obj-$(CONFIG_PCMCIA_WAVELAN) += wavelan/
55obj-$(CONFIG_PCMCIA_NETWAVE) += netwave/ 54obj-$(CONFIG_PCMCIA_NETWAVE) += netwave/
55obj-$(CONFIG_FB_SM7XX) += sm7xx/
diff --git a/drivers/staging/batman-adv/Kconfig b/drivers/staging/batman-adv/Kconfig
index 7632f5760060..1d74dabf9511 100644
--- a/drivers/staging/batman-adv/Kconfig
+++ b/drivers/staging/batman-adv/Kconfig
@@ -4,6 +4,7 @@
4 4
5config BATMAN_ADV 5config BATMAN_ADV
6 tristate "B.A.T.M.A.N. Advanced Meshing Protocol" 6 tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
7 depends on PROC_FS && PACKET
7 default n 8 default n
8 ---help--- 9 ---help---
9 10
diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c
index d724798278d6..eb617508cca4 100644
--- a/drivers/staging/batman-adv/send.c
+++ b/drivers/staging/batman-adv/send.c
@@ -363,8 +363,10 @@ void add_bcast_packet_to_list(unsigned char *packet_buff, int packet_len)
363 return; 363 return;
364 364
365 forw_packet->packet_buff = kmalloc(packet_len, GFP_ATOMIC); 365 forw_packet->packet_buff = kmalloc(packet_len, GFP_ATOMIC);
366 if (!forw_packet->packet_buff) 366 if (!forw_packet->packet_buff) {
367 kfree(forw_packet);
367 return; 368 return;
369 }
368 370
369 forw_packet->packet_len = packet_len; 371 forw_packet->packet_len = packet_len;
370 memcpy(forw_packet->packet_buff, packet_buff, forw_packet->packet_len); 372 memcpy(forw_packet->packet_buff, packet_buff, forw_packet->packet_len);
diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index ccc5cdc008c6..b559a9c2f857 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -451,7 +451,7 @@
451 451
452#define COMEDI_CB_EOS 1 /* end of scan */ 452#define COMEDI_CB_EOS 1 /* end of scan */
453#define COMEDI_CB_EOA 2 /* end of acquisition */ 453#define COMEDI_CB_EOA 2 /* end of acquisition */
454#define COMEDI_CB_BLOCK 4 /* DEPRECATED: convenient block size */ 454#define COMEDI_CB_BLOCK 4 /* data has arrived: wakes up read() / write() */
455#define COMEDI_CB_EOBUF 8 /* DEPRECATED: end of buffer */ 455#define COMEDI_CB_EOBUF 8 /* DEPRECATED: end of buffer */
456#define COMEDI_CB_ERROR 16 /* card error during acquisition */ 456#define COMEDI_CB_ERROR 16 /* card error during acquisition */
457#define COMEDI_CB_OVERFLOW 32 /* buffer overflow/underflow */ 457#define COMEDI_CB_OVERFLOW 32 /* buffer overflow/underflow */
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index 0d2c2eb23b23..bd397840dcba 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -849,8 +849,11 @@ static int jr3_pci_attach(struct comedi_device *dev,
849 } 849 }
850 850
851 devpriv->pci_enabled = 1; 851 devpriv->pci_enabled = 1;
852 devpriv->iobase = 852 devpriv->iobase = ioremap(pci_resource_start(card, 0),
853 ioremap(pci_resource_start(card, 0), sizeof(struct jr3_t)); 853 offsetof(struct jr3_t, channel[devpriv->n_channels]));
854 if (!devpriv->iobase)
855 return -ENOMEM;
856
854 result = alloc_subdevices(dev, devpriv->n_channels); 857 result = alloc_subdevices(dev, devpriv->n_channels);
855 if (result < 0) 858 if (result < 0)
856 goto out; 859 goto out;
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 06c020466298..9a1b559c4b0d 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -1,4 +1,4 @@
1#define DRIVER_VERSION "v2.3" 1#define DRIVER_VERSION "v2.4"
2#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" 2#define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com"
3#define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com" 3#define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com"
4/* 4/*
@@ -81,6 +81,8 @@ sampling rate. If you sample two channels you get 4kHz and so on.
81 * 2.1: changed PWM API 81 * 2.1: changed PWM API
82 * 2.2: added firmware kernel request to fix an udev problem 82 * 2.2: added firmware kernel request to fix an udev problem
83 * 2.3: corrected a bug in bulk timeouts which were far too short 83 * 2.3: corrected a bug in bulk timeouts which were far too short
84 * 2.4: fixed a bug which causes the driver to hang when it ran out of data.
85 * Thanks to Jan-Matthias Braun and Ian to spot the bug and fix it.
84 * 86 *
85 */ 87 */
86 88
@@ -532,6 +534,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
532 } 534 }
533 } 535 }
534 /* tell comedi that data is there */ 536 /* tell comedi that data is there */
537 s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
535 comedi_event(this_usbduxsub->comedidev, s); 538 comedi_event(this_usbduxsub->comedidev, s);
536} 539}
537 540
diff --git a/drivers/staging/dst/Kconfig b/drivers/staging/dst/Kconfig
deleted file mode 100644
index 448d342ac2a2..000000000000
--- a/drivers/staging/dst/Kconfig
+++ /dev/null
@@ -1,67 +0,0 @@
1config DST
2 tristate "Distributed storage"
3 depends on NET && CRYPTO && SYSFS && BLK_DEV
4 select CONNECTOR
5 ---help---
6 DST is a network block device storage, which can be used to organize
7 exported storage on the remote nodes into the local block device.
8
9 DST works on top of any network media and protocol; it is just a matter
10 of configuration utility to understand the correct addresses. The most
11 common example is TCP over IP, which allows to pass through firewalls and
12 create remote backup storage in a different datacenter. DST requires
13 single port to be enabled on the exporting node and outgoing connections
14 on the local node.
15
16 DST works with in-kernel client and server, which improves performance by
17 eliminating unneded data copies and by not depending on the version
18 of the external IO components. It requires userspace configuration utility
19 though.
20
21 DST uses transaction model, when each store has to be explicitly acked
22 from the remote node to be considered as successfully written. There
23 may be lots of in-flight transactions. When remote host does not ack
24 the transaction it will be resent predefined number of times with specified
25 timeouts between them. All those parameters are configurable. Transactions
26 are marked as failed after all resends complete unsuccessfully; having
27 long enough resend timeout and/or large number of resends allows not to
28 return error to the higher (FS usually) layer in case of short network
29 problems or remote node outages. In case of network RAID setup this means
30 that storage will not degrade until transactions are marked as failed, and
31 thus will not force checksum recalculation and data rebuild. In case of
32 connection failure DST will try to reconnect to the remote node automatically.
33 DST sends ping commands at idle time to detect if remote node is alive.
34
35 Because of transactional model it is possible to use zero-copy sending
36 without worry of data corruption (which in turn could be detected by the
37 strong checksums though).
38
39 DST may fully encrypt the data channel in case of untrusted channel and implement
40 strong checksum of the transferred data. It is possible to configure algorithms
41 and crypto keys; they should match on both sides of the network channel.
42 Crypto processing does not introduce noticeble performance overhead, since DST
43 uses configurable pool of threads to perform crypto processing.
44
45 DST utilizes memory pool model of all its transaction allocations (it is the
46 only additional allocation on the client) and server allocations (bio pools,
47 while pages are allocated from the slab).
48
49 At startup DST performs a simple negotiation with the export node to determine
50 access permissions and size of the exported storage. It can be extended if
51 new parameters should be autonegotiated.
52
53 DST carries block IO flags in the protocol, which allows to transparently implement
54 barriers and sync/flush operations. Those flags are used in the export node where
55 IO against the local storage is performed, which means that sync write will be sync
56 on the remote node too, which in turn improves data integrity and improved resistance
57 to errors and data corruption during power outages or storage damages.
58
59 Homepage: http://www.ioremap.net/projects/dst
60 Userspace configuration utility and the latest releases: http://www.ioremap.net/archive/dst/
61
62config DST_DEBUG
63 bool "DST debug"
64 depends on DST
65 ---help---
66 This option will enable HEAVY debugging of the DST.
67 Turn it on ONLY if you have to debug some really obscure problem.
diff --git a/drivers/staging/dst/Makefile b/drivers/staging/dst/Makefile
deleted file mode 100644
index 3a8b0cf9643e..000000000000
--- a/drivers/staging/dst/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
1obj-$(CONFIG_DST) += nst.o
2
3nst-y := dcore.o state.o export.o thread_pool.o crypto.o trans.o
diff --git a/drivers/staging/dst/crypto.c b/drivers/staging/dst/crypto.c
deleted file mode 100644
index 351295c97a4b..000000000000
--- a/drivers/staging/dst/crypto.c
+++ /dev/null
@@ -1,733 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/bio.h>
17#include <linux/crypto.h>
18#include <linux/dst.h>
19#include <linux/kernel.h>
20#include <linux/scatterlist.h>
21#include <linux/slab.h>
22
23/*
24 * Tricky bastard, but IV can be more complex with time...
25 */
26static inline u64 dst_gen_iv(struct dst_trans *t)
27{
28 return t->gen;
29}
30
31/*
32 * Crypto machinery: hash/cipher support for the given crypto controls.
33 */
34static struct crypto_hash *dst_init_hash(struct dst_crypto_ctl *ctl, u8 *key)
35{
36 int err;
37 struct crypto_hash *hash;
38
39 hash = crypto_alloc_hash(ctl->hash_algo, 0, CRYPTO_ALG_ASYNC);
40 if (IS_ERR(hash)) {
41 err = PTR_ERR(hash);
42 dprintk("%s: failed to allocate hash '%s', err: %d.\n",
43 __func__, ctl->hash_algo, err);
44 goto err_out_exit;
45 }
46
47 ctl->crypto_attached_size = crypto_hash_digestsize(hash);
48
49 if (!ctl->hash_keysize)
50 return hash;
51
52 err = crypto_hash_setkey(hash, key, ctl->hash_keysize);
53 if (err) {
54 dprintk("%s: failed to set key for hash '%s', err: %d.\n",
55 __func__, ctl->hash_algo, err);
56 goto err_out_free;
57 }
58
59 return hash;
60
61err_out_free:
62 crypto_free_hash(hash);
63err_out_exit:
64 return ERR_PTR(err);
65}
66
67static struct crypto_ablkcipher *dst_init_cipher(struct dst_crypto_ctl *ctl,
68 u8 *key)
69{
70 int err = -EINVAL;
71 struct crypto_ablkcipher *cipher;
72
73 if (!ctl->cipher_keysize)
74 goto err_out_exit;
75
76 cipher = crypto_alloc_ablkcipher(ctl->cipher_algo, 0, 0);
77 if (IS_ERR(cipher)) {
78 err = PTR_ERR(cipher);
79 dprintk("%s: failed to allocate cipher '%s', err: %d.\n",
80 __func__, ctl->cipher_algo, err);
81 goto err_out_exit;
82 }
83
84 crypto_ablkcipher_clear_flags(cipher, ~0);
85
86 err = crypto_ablkcipher_setkey(cipher, key, ctl->cipher_keysize);
87 if (err) {
88 dprintk("%s: failed to set key for cipher '%s', err: %d.\n",
89 __func__, ctl->cipher_algo, err);
90 goto err_out_free;
91 }
92
93 return cipher;
94
95err_out_free:
96 crypto_free_ablkcipher(cipher);
97err_out_exit:
98 return ERR_PTR(err);
99}
100
101/*
102 * Crypto engine has a pool of pages to encrypt data into before sending
103 * it over the network. This pool is freed/allocated here.
104 */
105static void dst_crypto_pages_free(struct dst_crypto_engine *e)
106{
107 unsigned int i;
108
109 for (i = 0; i < e->page_num; ++i)
110 __free_page(e->pages[i]);
111 kfree(e->pages);
112}
113
114static int dst_crypto_pages_alloc(struct dst_crypto_engine *e, int num)
115{
116 int i;
117
118 e->pages = kmalloc(num * sizeof(struct page **), GFP_KERNEL);
119 if (!e->pages)
120 return -ENOMEM;
121
122 for (i = 0; i < num; ++i) {
123 e->pages[i] = alloc_page(GFP_KERNEL);
124 if (!e->pages[i])
125 goto err_out_free_pages;
126 }
127
128 e->page_num = num;
129 return 0;
130
131err_out_free_pages:
132 while (--i >= 0)
133 __free_page(e->pages[i]);
134
135 kfree(e->pages);
136 return -ENOMEM;
137}
138
139/*
140 * Initialize crypto engine for given node.
141 * Setup cipher/hash, keys, pool of threads and private data.
142 */
143static int dst_crypto_engine_init(struct dst_crypto_engine *e,
144 struct dst_node *n)
145{
146 int err;
147 struct dst_crypto_ctl *ctl = &n->crypto;
148
149 err = dst_crypto_pages_alloc(e, n->max_pages);
150 if (err)
151 goto err_out_exit;
152
153 e->size = PAGE_SIZE;
154 e->data = kmalloc(e->size, GFP_KERNEL);
155 if (!e->data) {
156 err = -ENOMEM;
157 goto err_out_free_pages;
158 }
159
160 if (ctl->hash_algo[0]) {
161 e->hash = dst_init_hash(ctl, n->hash_key);
162 if (IS_ERR(e->hash)) {
163 err = PTR_ERR(e->hash);
164 e->hash = NULL;
165 goto err_out_free;
166 }
167 }
168
169 if (ctl->cipher_algo[0]) {
170 e->cipher = dst_init_cipher(ctl, n->cipher_key);
171 if (IS_ERR(e->cipher)) {
172 err = PTR_ERR(e->cipher);
173 e->cipher = NULL;
174 goto err_out_free_hash;
175 }
176 }
177
178 return 0;
179
180err_out_free_hash:
181 crypto_free_hash(e->hash);
182err_out_free:
183 kfree(e->data);
184err_out_free_pages:
185 dst_crypto_pages_free(e);
186err_out_exit:
187 return err;
188}
189
190static void dst_crypto_engine_exit(struct dst_crypto_engine *e)
191{
192 if (e->hash)
193 crypto_free_hash(e->hash);
194 if (e->cipher)
195 crypto_free_ablkcipher(e->cipher);
196 dst_crypto_pages_free(e);
197 kfree(e->data);
198}
199
200/*
201 * Waiting for cipher processing to be completed.
202 */
203struct dst_crypto_completion {
204 struct completion complete;
205 int error;
206};
207
208static void dst_crypto_complete(struct crypto_async_request *req, int err)
209{
210 struct dst_crypto_completion *c = req->data;
211
212 if (err == -EINPROGRESS)
213 return;
214
215 dprintk("%s: req: %p, err: %d.\n", __func__, req, err);
216 c->error = err;
217 complete(&c->complete);
218}
219
220static int dst_crypto_process(struct ablkcipher_request *req,
221 struct scatterlist *sg_dst, struct scatterlist *sg_src,
222 void *iv, int enc, unsigned long timeout)
223{
224 struct dst_crypto_completion c;
225 int err;
226
227 init_completion(&c.complete);
228 c.error = -EINPROGRESS;
229
230 ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
231 dst_crypto_complete, &c);
232
233 ablkcipher_request_set_crypt(req, sg_src, sg_dst, sg_src->length, iv);
234
235 if (enc)
236 err = crypto_ablkcipher_encrypt(req);
237 else
238 err = crypto_ablkcipher_decrypt(req);
239
240 switch (err) {
241 case -EINPROGRESS:
242 case -EBUSY:
243 err = wait_for_completion_interruptible_timeout(&c.complete,
244 timeout);
245 if (!err)
246 err = -ETIMEDOUT;
247 else
248 err = c.error;
249 break;
250 default:
251 break;
252 }
253
254 return err;
255}
256
257/*
258 * DST uses generic iteration approach for data crypto processing.
259 * Single block IO request is switched into array of scatterlists,
260 * which are submitted to the crypto processing iterator.
261 *
262 * Input and output iterator initialization are different, since
263 * in output case we can not encrypt data in-place and need a
264 * temporary storage, which is then being sent to the remote peer.
265 */
266static int dst_trans_iter_out(struct bio *bio, struct dst_crypto_engine *e,
267 int (*iterator) (struct dst_crypto_engine *e,
268 struct scatterlist *dst,
269 struct scatterlist *src))
270{
271 struct bio_vec *bv;
272 int err, i;
273
274 sg_init_table(e->src, bio->bi_vcnt);
275 sg_init_table(e->dst, bio->bi_vcnt);
276
277 bio_for_each_segment(bv, bio, i) {
278 sg_set_page(&e->src[i], bv->bv_page, bv->bv_len, bv->bv_offset);
279 sg_set_page(&e->dst[i], e->pages[i], bv->bv_len, bv->bv_offset);
280
281 err = iterator(e, &e->dst[i], &e->src[i]);
282 if (err)
283 return err;
284 }
285
286 return 0;
287}
288
289static int dst_trans_iter_in(struct bio *bio, struct dst_crypto_engine *e,
290 int (*iterator) (struct dst_crypto_engine *e,
291 struct scatterlist *dst,
292 struct scatterlist *src))
293{
294 struct bio_vec *bv;
295 int err, i;
296
297 sg_init_table(e->src, bio->bi_vcnt);
298 sg_init_table(e->dst, bio->bi_vcnt);
299
300 bio_for_each_segment(bv, bio, i) {
301 sg_set_page(&e->src[i], bv->bv_page, bv->bv_len, bv->bv_offset);
302 sg_set_page(&e->dst[i], bv->bv_page, bv->bv_len, bv->bv_offset);
303
304 err = iterator(e, &e->dst[i], &e->src[i]);
305 if (err)
306 return err;
307 }
308
309 return 0;
310}
311
312static int dst_crypt_iterator(struct dst_crypto_engine *e,
313 struct scatterlist *sg_dst, struct scatterlist *sg_src)
314{
315 struct ablkcipher_request *req = e->data;
316 u8 iv[32];
317
318 memset(iv, 0, sizeof(iv));
319
320 memcpy(iv, &e->iv, sizeof(e->iv));
321
322 return dst_crypto_process(req, sg_dst, sg_src, iv, e->enc, e->timeout);
323}
324
325static int dst_crypt(struct dst_crypto_engine *e, struct bio *bio)
326{
327 struct ablkcipher_request *req = e->data;
328
329 memset(req, 0, sizeof(struct ablkcipher_request));
330 ablkcipher_request_set_tfm(req, e->cipher);
331
332 if (e->enc)
333 return dst_trans_iter_out(bio, e, dst_crypt_iterator);
334 else
335 return dst_trans_iter_in(bio, e, dst_crypt_iterator);
336}
337
338static int dst_hash_iterator(struct dst_crypto_engine *e,
339 struct scatterlist *sg_dst, struct scatterlist *sg_src)
340{
341 return crypto_hash_update(e->data, sg_src, sg_src->length);
342}
343
344static int dst_hash(struct dst_crypto_engine *e, struct bio *bio, void *dst)
345{
346 struct hash_desc *desc = e->data;
347 int err;
348
349 desc->tfm = e->hash;
350 desc->flags = 0;
351
352 err = crypto_hash_init(desc);
353 if (err)
354 return err;
355
356 err = dst_trans_iter_in(bio, e, dst_hash_iterator);
357 if (err)
358 return err;
359
360 err = crypto_hash_final(desc, dst);
361 if (err)
362 return err;
363
364 return 0;
365}
366
367/*
368 * Initialize/cleanup a crypto thread. The only thing it should
369 * do is to allocate a pool of pages as temporary storage.
370 * And to setup cipher and/or hash.
371 */
372static void *dst_crypto_thread_init(void *data)
373{
374 struct dst_node *n = data;
375 struct dst_crypto_engine *e;
376 int err = -ENOMEM;
377
378 e = kzalloc(sizeof(struct dst_crypto_engine), GFP_KERNEL);
379 if (!e)
380 goto err_out_exit;
381 e->src = kcalloc(2 * n->max_pages, sizeof(struct scatterlist),
382 GFP_KERNEL);
383 if (!e->src)
384 goto err_out_free;
385
386 e->dst = e->src + n->max_pages;
387
388 err = dst_crypto_engine_init(e, n);
389 if (err)
390 goto err_out_free_all;
391
392 return e;
393
394err_out_free_all:
395 kfree(e->src);
396err_out_free:
397 kfree(e);
398err_out_exit:
399 return ERR_PTR(err);
400}
401
402static void dst_crypto_thread_cleanup(void *private)
403{
404 struct dst_crypto_engine *e = private;
405
406 dst_crypto_engine_exit(e);
407 kfree(e->src);
408 kfree(e);
409}
410
411/*
412 * Initialize crypto engine for given node: store keys, create pool
413 * of threads, initialize each one.
414 *
415 * Each thread has unique ID, but 0 and 1 are reserved for receiving and
416 * accepting threads (if export node), so IDs could start from 2, but starting
417 * them from 10 allows easily understand what this thread is for.
418 */
419int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl)
420{
421 void *key = (ctl + 1);
422 int err = -ENOMEM, i;
423 char name[32];
424
425 if (ctl->hash_keysize) {
426 n->hash_key = kmalloc(ctl->hash_keysize, GFP_KERNEL);
427 if (!n->hash_key)
428 goto err_out_exit;
429 memcpy(n->hash_key, key, ctl->hash_keysize);
430 }
431
432 if (ctl->cipher_keysize) {
433 n->cipher_key = kmalloc(ctl->cipher_keysize, GFP_KERNEL);
434 if (!n->cipher_key)
435 goto err_out_free_hash;
436 memcpy(n->cipher_key, key, ctl->cipher_keysize);
437 }
438 memcpy(&n->crypto, ctl, sizeof(struct dst_crypto_ctl));
439
440 for (i = 0; i < ctl->thread_num; ++i) {
441 snprintf(name, sizeof(name), "%s-crypto-%d", n->name, i);
442 /* Unique ids... */
443 err = thread_pool_add_worker(n->pool, name, i + 10,
444 dst_crypto_thread_init, dst_crypto_thread_cleanup, n);
445 if (err)
446 goto err_out_free_threads;
447 }
448
449 return 0;
450
451err_out_free_threads:
452 while (--i >= 0)
453 thread_pool_del_worker_id(n->pool, i+10);
454
455 if (ctl->cipher_keysize)
456 kfree(n->cipher_key);
457 ctl->cipher_keysize = 0;
458err_out_free_hash:
459 if (ctl->hash_keysize)
460 kfree(n->hash_key);
461 ctl->hash_keysize = 0;
462err_out_exit:
463 return err;
464}
465
466void dst_node_crypto_exit(struct dst_node *n)
467{
468 struct dst_crypto_ctl *ctl = &n->crypto;
469
470 if (ctl->cipher_algo[0] || ctl->hash_algo[0]) {
471 kfree(n->hash_key);
472 kfree(n->cipher_key);
473 }
474}
475
476/*
477 * Thrad pool setup callback. Just stores a transaction in private data.
478 */
479static int dst_trans_crypto_setup(void *crypto_engine, void *trans)
480{
481 struct dst_crypto_engine *e = crypto_engine;
482
483 e->private = trans;
484 return 0;
485}
486
487#if 0
488static void dst_dump_bio(struct bio *bio)
489{
490 u8 *p;
491 struct bio_vec *bv;
492 int i;
493
494 bio_for_each_segment(bv, bio, i) {
495 dprintk("%s: %llu/%u: size: %u, offset: %u, data: ",
496 __func__, bio->bi_sector, bio->bi_size,
497 bv->bv_len, bv->bv_offset);
498
499 p = kmap(bv->bv_page) + bv->bv_offset;
500 for (i = 0; i < bv->bv_len; ++i)
501 printk(KERN_DEBUG "%02x ", p[i]);
502 kunmap(bv->bv_page);
503 printk("\n");
504 }
505}
506#endif
507
508/*
509 * Encrypt/hash data and send it to the network.
510 */
511static int dst_crypto_process_sending(struct dst_crypto_engine *e,
512 struct bio *bio, u8 *hash)
513{
514 int err;
515
516 if (e->cipher) {
517 err = dst_crypt(e, bio);
518 if (err)
519 goto err_out_exit;
520 }
521
522 if (e->hash) {
523 err = dst_hash(e, bio, hash);
524 if (err)
525 goto err_out_exit;
526
527#ifdef CONFIG_DST_DEBUG
528 {
529 unsigned int i;
530
531 /* dst_dump_bio(bio); */
532
533 printk(KERN_DEBUG "%s: bio: %llu/%u, rw: %lu, hash: ",
534 __func__, (u64)bio->bi_sector,
535 bio->bi_size, bio_data_dir(bio));
536 for (i = 0; i < crypto_hash_digestsize(e->hash); ++i)
537 printk("%02x ", hash[i]);
538 printk("\n");
539 }
540#endif
541 }
542
543 return 0;
544
545err_out_exit:
546 return err;
547}
548
549/*
550 * Check if received data is valid. Decipher if it is.
551 */
552static int dst_crypto_process_receiving(struct dst_crypto_engine *e,
553 struct bio *bio, u8 *hash, u8 *recv_hash)
554{
555 int err;
556
557 if (e->hash) {
558 int mismatch;
559
560 err = dst_hash(e, bio, hash);
561 if (err)
562 goto err_out_exit;
563
564 mismatch = !!memcmp(recv_hash, hash,
565 crypto_hash_digestsize(e->hash));
566#ifdef CONFIG_DST_DEBUG
567 /* dst_dump_bio(bio); */
568
569 printk(KERN_DEBUG "%s: bio: %llu/%u, rw: %lu, hash mismatch: %d",
570 __func__, (u64)bio->bi_sector, bio->bi_size,
571 bio_data_dir(bio), mismatch);
572 if (mismatch) {
573 unsigned int i;
574
575 printk(", recv/calc: ");
576 for (i = 0; i < crypto_hash_digestsize(e->hash); ++i)
577 printk("%02x/%02x ", recv_hash[i], hash[i]);
578
579 }
580 printk("\n");
581#endif
582 err = -1;
583 if (mismatch)
584 goto err_out_exit;
585 }
586
587 if (e->cipher) {
588 err = dst_crypt(e, bio);
589 if (err)
590 goto err_out_exit;
591 }
592
593 return 0;
594
595err_out_exit:
596 return err;
597}
598
599/*
600 * Thread pool callback to encrypt data and send it to the netowork.
601 */
602static int dst_trans_crypto_action(void *crypto_engine, void *schedule_data)
603{
604 struct dst_crypto_engine *e = crypto_engine;
605 struct dst_trans *t = schedule_data;
606 struct bio *bio = t->bio;
607 int err;
608
609 dprintk("%s: t: %p, gen: %llu, cipher: %p, hash: %p.\n",
610 __func__, t, t->gen, e->cipher, e->hash);
611
612 e->enc = t->enc;
613 e->iv = dst_gen_iv(t);
614
615 if (bio_data_dir(bio) == WRITE) {
616 err = dst_crypto_process_sending(e, bio, t->cmd.hash);
617 if (err)
618 goto err_out_exit;
619
620 if (e->hash) {
621 t->cmd.csize = crypto_hash_digestsize(e->hash);
622 t->cmd.size += t->cmd.csize;
623 }
624
625 return dst_trans_send(t);
626 } else {
627 u8 *hash = e->data + e->size/2;
628
629 err = dst_crypto_process_receiving(e, bio, hash, t->cmd.hash);
630 if (err)
631 goto err_out_exit;
632
633 dst_trans_remove(t);
634 dst_trans_put(t);
635 }
636
637 return 0;
638
639err_out_exit:
640 t->error = err;
641 dst_trans_put(t);
642 return err;
643}
644
645/*
646 * Schedule crypto processing for given transaction.
647 */
648int dst_trans_crypto(struct dst_trans *t)
649{
650 struct dst_node *n = t->n;
651 int err;
652
653 err = thread_pool_schedule(n->pool,
654 dst_trans_crypto_setup, dst_trans_crypto_action,
655 t, MAX_SCHEDULE_TIMEOUT);
656 if (err)
657 goto err_out_exit;
658
659 return 0;
660
661err_out_exit:
662 dst_trans_put(t);
663 return err;
664}
665
666/*
667 * Crypto machinery for the export node.
668 */
669static int dst_export_crypto_setup(void *crypto_engine, void *bio)
670{
671 struct dst_crypto_engine *e = crypto_engine;
672
673 e->private = bio;
674 return 0;
675}
676
677static int dst_export_crypto_action(void *crypto_engine, void *schedule_data)
678{
679 struct dst_crypto_engine *e = crypto_engine;
680 struct bio *bio = schedule_data;
681 struct dst_export_priv *p = bio->bi_private;
682 int err;
683
684 dprintk("%s: e: %p, data: %p, bio: %llu/%u, dir: %lu.\n",
685 __func__, e, e->data, (u64)bio->bi_sector,
686 bio->bi_size, bio_data_dir(bio));
687
688 e->enc = (bio_data_dir(bio) == READ);
689 e->iv = p->cmd.id;
690
691 if (bio_data_dir(bio) == WRITE) {
692 u8 *hash = e->data + e->size/2;
693
694 err = dst_crypto_process_receiving(e, bio, hash, p->cmd.hash);
695 if (err)
696 goto err_out_exit;
697
698 generic_make_request(bio);
699 } else {
700 err = dst_crypto_process_sending(e, bio, p->cmd.hash);
701 if (err)
702 goto err_out_exit;
703
704 if (e->hash) {
705 p->cmd.csize = crypto_hash_digestsize(e->hash);
706 p->cmd.size += p->cmd.csize;
707 }
708
709 err = dst_export_send_bio(bio);
710 }
711 return 0;
712
713err_out_exit:
714 bio_put(bio);
715 return err;
716}
717
718int dst_export_crypto(struct dst_node *n, struct bio *bio)
719{
720 int err;
721
722 err = thread_pool_schedule(n->pool,
723 dst_export_crypto_setup, dst_export_crypto_action,
724 bio, MAX_SCHEDULE_TIMEOUT);
725 if (err)
726 goto err_out_exit;
727
728 return 0;
729
730err_out_exit:
731 bio_put(bio);
732 return err;
733}
diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c
deleted file mode 100644
index c83ca7e3d048..000000000000
--- a/drivers/staging/dst/dcore.c
+++ /dev/null
@@ -1,968 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/blkdev.h>
19#include <linux/bio.h>
20#include <linux/buffer_head.h>
21#include <linux/connector.h>
22#include <linux/dst.h>
23#include <linux/device.h>
24#include <linux/jhash.h>
25#include <linux/idr.h>
26#include <linux/init.h>
27#include <linux/namei.h>
28#include <linux/slab.h>
29#include <linux/socket.h>
30
31#include <linux/in.h>
32#include <linux/in6.h>
33
34#include <net/sock.h>
35
36static int dst_major;
37
38static DEFINE_MUTEX(dst_hash_lock);
39static struct list_head *dst_hashtable;
40static unsigned int dst_hashtable_size = 128;
41module_param(dst_hashtable_size, uint, 0644);
42
43static char dst_name[] = "Dementianting goldfish";
44
45static DEFINE_IDR(dst_index_idr);
46static struct cb_id cn_dst_id = { CN_DST_IDX, CN_DST_VAL };
47
48/*
49 * DST sysfs tree for device called 'storage':
50 *
51 * /sys/bus/dst/devices/storage/
52 * /sys/bus/dst/devices/storage/type : 192.168.4.80:1025
53 * /sys/bus/dst/devices/storage/size : 800
54 * /sys/bus/dst/devices/storage/name : storage
55 */
56
57static int dst_dev_match(struct device *dev, struct device_driver *drv)
58{
59 return 1;
60}
61
62static struct bus_type dst_dev_bus_type = {
63 .name = "dst",
64 .match = &dst_dev_match,
65};
66
67static void dst_node_release(struct device *dev)
68{
69 struct dst_info *info = container_of(dev, struct dst_info, device);
70
71 kfree(info);
72}
73
74static struct device dst_node_dev = {
75 .bus = &dst_dev_bus_type,
76 .release = &dst_node_release
77};
78
79/*
80 * Setting size of the node after it was changed.
81 */
82static void dst_node_set_size(struct dst_node *n)
83{
84 struct block_device *bdev;
85
86 set_capacity(n->disk, n->size >> 9);
87
88 bdev = bdget_disk(n->disk, 0);
89 if (bdev) {
90 mutex_lock(&bdev->bd_inode->i_mutex);
91 i_size_write(bdev->bd_inode, n->size);
92 mutex_unlock(&bdev->bd_inode->i_mutex);
93 bdput(bdev);
94 }
95}
96
97/*
98 * Distributed storage request processing function.
99 */
100static int dst_request(struct request_queue *q, struct bio *bio)
101{
102 struct dst_node *n = q->queuedata;
103 int err = -EIO;
104
105 if (bio_empty_barrier(bio) && !blk_queue_discard(q)) {
106 /*
107 * This is a dirty^Wnice hack, but if we complete this
108 * operation with -EOPNOTSUPP like intended, XFS
109 * will stuck and freeze the machine. This may be
110 * not particulary XFS problem though, but it is the
111 * only FS which sends empty barrier at umount time
112 * I worked with.
113 *
114 * Empty barriers are not allowed anyway, see 51fd77bd9f512
115 * for example, although later it was changed to
116 * bio_rw_flagged(bio, BIO_RW_DISCARD) only, which does not
117 * work in this case.
118 */
119 /* err = -EOPNOTSUPP; */
120 err = 0;
121 goto end_io;
122 }
123
124 bio_get(bio);
125
126 return dst_process_bio(n, bio);
127
128end_io:
129 bio_endio(bio, err);
130 return err;
131}
132
133/*
134 * Open/close callbacks for appropriate block device.
135 */
136static int dst_bdev_open(struct block_device *bdev, fmode_t mode)
137{
138 struct dst_node *n = bdev->bd_disk->private_data;
139
140 dst_node_get(n);
141 return 0;
142}
143
144static int dst_bdev_release(struct gendisk *disk, fmode_t mode)
145{
146 struct dst_node *n = disk->private_data;
147
148 dst_node_put(n);
149 return 0;
150}
151
152static struct block_device_operations dst_blk_ops = {
153 .open = dst_bdev_open,
154 .release = dst_bdev_release,
155 .owner = THIS_MODULE,
156};
157
158/*
159 * Block layer binding - disk is created when array is fully configured
160 * by userspace request.
161 */
162static int dst_node_create_disk(struct dst_node *n)
163{
164 int err = -ENOMEM;
165 u32 index = 0;
166
167 n->queue = blk_init_queue(NULL, NULL);
168 if (!n->queue)
169 goto err_out_exit;
170
171 n->queue->queuedata = n;
172 blk_queue_make_request(n->queue, dst_request);
173 blk_queue_max_phys_segments(n->queue, n->max_pages);
174 blk_queue_max_hw_segments(n->queue, n->max_pages);
175
176 err = -ENOMEM;
177 n->disk = alloc_disk(1);
178 if (!n->disk)
179 goto err_out_free_queue;
180
181 if (!(n->state->permissions & DST_PERM_WRITE)) {
182 printk(KERN_INFO "DST node %s attached read-only.\n", n->name);
183 set_disk_ro(n->disk, 1);
184 }
185
186 if (!idr_pre_get(&dst_index_idr, GFP_KERNEL))
187 goto err_out_put;
188
189 mutex_lock(&dst_hash_lock);
190 err = idr_get_new(&dst_index_idr, NULL, &index);
191 mutex_unlock(&dst_hash_lock);
192 if (err)
193 goto err_out_put;
194
195 n->disk->major = dst_major;
196 n->disk->first_minor = index;
197 n->disk->fops = &dst_blk_ops;
198 n->disk->queue = n->queue;
199 n->disk->private_data = n;
200 snprintf(n->disk->disk_name, sizeof(n->disk->disk_name),
201 "dst-%s", n->name);
202
203 return 0;
204
205err_out_put:
206 put_disk(n->disk);
207err_out_free_queue:
208 blk_cleanup_queue(n->queue);
209err_out_exit:
210 return err;
211}
212
213/*
214 * Sysfs machinery: show device's size.
215 */
216static ssize_t dst_show_size(struct device *dev,
217 struct device_attribute *attr, char *buf)
218{
219 struct dst_info *info = container_of(dev, struct dst_info, device);
220
221 return sprintf(buf, "%llu\n", info->size);
222}
223
224/*
225 * Show local exported device.
226 */
227static ssize_t dst_show_local(struct device *dev,
228 struct device_attribute *attr, char *buf)
229{
230 struct dst_info *info = container_of(dev, struct dst_info, device);
231
232 return sprintf(buf, "%s\n", info->local);
233}
234
235/*
236 * Shows type of the remote node - device major/minor number
237 * for local nodes and address (af_inet ipv4/ipv6 only) for remote nodes.
238 */
239static ssize_t dst_show_type(struct device *dev,
240 struct device_attribute *attr, char *buf)
241{
242 struct dst_info *info = container_of(dev, struct dst_info, device);
243 int family = info->net.addr.sa_family;
244
245 if (family == AF_INET) {
246 struct sockaddr_in *sin = (struct sockaddr_in *)&info->net.addr;
247 return sprintf(buf, "%u.%u.%u.%u:%d\n",
248 NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
249 } else if (family == AF_INET6) {
250 struct sockaddr_in6 *sin = (struct sockaddr_in6 *)
251 &info->net.addr;
252 return sprintf(buf,
253 "%pi6:%d\n",
254 &sin->sin6_addr, ntohs(sin->sin6_port));
255 } else {
256 int i, sz = PAGE_SIZE - 2; /* 0 symbol and '\n' below */
257 int size, addrlen = info->net.addr.sa_data_len;
258 unsigned char *a = (unsigned char *)&info->net.addr.sa_data;
259 char *buf_orig = buf;
260
261 size = snprintf(buf, sz, "family: %d, addrlen: %u, addr: ",
262 family, addrlen);
263 sz -= size;
264 buf += size;
265
266 for (i = 0; i < addrlen; ++i) {
267 if (sz < 3)
268 break;
269
270 size = snprintf(buf, sz, "%02x ", a[i]);
271 sz -= size;
272 buf += size;
273 }
274 buf += sprintf(buf, "\n");
275
276 return buf - buf_orig;
277 }
278 return 0;
279}
280
281static struct device_attribute dst_node_attrs[] = {
282 __ATTR(size, 0444, dst_show_size, NULL),
283 __ATTR(type, 0444, dst_show_type, NULL),
284 __ATTR(local, 0444, dst_show_local, NULL),
285};
286
287static int dst_create_node_attributes(struct dst_node *n)
288{
289 int err, i;
290
291 for (i = 0; i < ARRAY_SIZE(dst_node_attrs); ++i) {
292 err = device_create_file(&n->info->device,
293 &dst_node_attrs[i]);
294 if (err)
295 goto err_out_remove_all;
296 }
297 return 0;
298
299err_out_remove_all:
300 while (--i >= 0)
301 device_remove_file(&n->info->device,
302 &dst_node_attrs[i]);
303
304 return err;
305}
306
307static void dst_remove_node_attributes(struct dst_node *n)
308{
309 int i;
310
311 for (i = 0; i < ARRAY_SIZE(dst_node_attrs); ++i)
312 device_remove_file(&n->info->device,
313 &dst_node_attrs[i]);
314}
315
316/*
317 * Sysfs cleanup and initialization.
318 * Shows number of useful parameters.
319 */
320static void dst_node_sysfs_exit(struct dst_node *n)
321{
322 if (n->info) {
323 dst_remove_node_attributes(n);
324 device_unregister(&n->info->device);
325 n->info = NULL;
326 }
327}
328
329static int dst_node_sysfs_init(struct dst_node *n)
330{
331 int err;
332
333 n->info = kzalloc(sizeof(struct dst_info), GFP_KERNEL);
334 if (!n->info)
335 return -ENOMEM;
336
337 memcpy(&n->info->device, &dst_node_dev, sizeof(struct device));
338 n->info->size = n->size;
339
340 dev_set_name(&n->info->device, "dst-%s", n->name);
341 err = device_register(&n->info->device);
342 if (err) {
343 dprintk(KERN_ERR "Failed to register node '%s', err: %d.\n",
344 n->name, err);
345 goto err_out_exit;
346 }
347
348 dst_create_node_attributes(n);
349
350 return 0;
351
352err_out_exit:
353 kfree(n->info);
354 n->info = NULL;
355 return err;
356}
357
358/*
359 * DST node hash tables machinery.
360 */
361static inline unsigned int dst_hash(char *str, unsigned int size)
362{
363 return jhash(str, size, 0) % dst_hashtable_size;
364}
365
366static void dst_node_remove(struct dst_node *n)
367{
368 mutex_lock(&dst_hash_lock);
369 list_del_init(&n->node_entry);
370 mutex_unlock(&dst_hash_lock);
371}
372
373static void dst_node_add(struct dst_node *n)
374{
375 unsigned hash = dst_hash(n->name, sizeof(n->name));
376
377 mutex_lock(&dst_hash_lock);
378 list_add_tail(&n->node_entry, &dst_hashtable[hash]);
379 mutex_unlock(&dst_hash_lock);
380}
381
382/*
383 * Cleaning node when it is about to be freed.
384 * There are still users of the socket though,
385 * so connection cleanup should be protected.
386 */
387static void dst_node_cleanup(struct dst_node *n)
388{
389 struct dst_state *st = n->state;
390
391 if (!st)
392 return;
393
394 if (n->queue) {
395 blk_cleanup_queue(n->queue);
396
397 mutex_lock(&dst_hash_lock);
398 idr_remove(&dst_index_idr, n->disk->first_minor);
399 mutex_unlock(&dst_hash_lock);
400
401 put_disk(n->disk);
402 }
403
404 if (n->bdev) {
405 sync_blockdev(n->bdev);
406 close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
407 }
408
409 dst_state_lock(st);
410 st->need_exit = 1;
411 dst_state_exit_connected(st);
412 dst_state_unlock(st);
413
414 wake_up(&st->thread_wait);
415
416 dst_state_put(st);
417 n->state = NULL;
418}
419
420/*
421 * Free security attributes attached to given node.
422 */
423static void dst_security_exit(struct dst_node *n)
424{
425 struct dst_secure *s, *tmp;
426
427 list_for_each_entry_safe(s, tmp, &n->security_list, sec_entry) {
428 list_del(&s->sec_entry);
429 kfree(s);
430 }
431}
432
433/*
434 * Free node when there are no more users.
435 * Actually node has to be freed on behalf od userspace process,
436 * since there are number of threads, which are embedded in the
437 * node, so they can not exit and free node from there, that is
438 * why there is a wakeup if reference counter is not equal to zero.
439 */
440void dst_node_put(struct dst_node *n)
441{
442 if (unlikely(!n))
443 return;
444
445 dprintk("%s: n: %p, refcnt: %d.\n",
446 __func__, n, atomic_read(&n->refcnt));
447
448 if (atomic_dec_and_test(&n->refcnt)) {
449 dst_node_remove(n);
450 n->trans_scan_timeout = 0;
451 dst_node_cleanup(n);
452 thread_pool_destroy(n->pool);
453 dst_node_sysfs_exit(n);
454 dst_node_crypto_exit(n);
455 dst_security_exit(n);
456 dst_node_trans_exit(n);
457
458 kfree(n);
459
460 dprintk("%s: freed n: %p.\n", __func__, n);
461 } else {
462 wake_up(&n->wait);
463 }
464}
465
466/*
467 * Setting up export device: lookup by the name, get its size
468 * and setup listening socket, which will accept clients, which
469 * will submit IO for given storage.
470 */
471static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
472 struct dst_export_ctl *le)
473{
474 int err;
475
476 snprintf(n->info->local, sizeof(n->info->local), "%s", le->device);
477
478 n->bdev = open_bdev_exclusive(le->device, FMODE_READ|FMODE_WRITE, NULL);
479 if (IS_ERR(n->bdev))
480 return PTR_ERR(n->bdev);
481
482 if (n->size != 0)
483 n->size = min_t(loff_t, n->bdev->bd_inode->i_size, n->size);
484 else
485 n->size = n->bdev->bd_inode->i_size;
486
487 n->info->size = n->size;
488 err = dst_node_init_listened(n, le);
489 if (err)
490 goto err_out_cleanup;
491
492 return 0;
493
494err_out_cleanup:
495 close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
496 n->bdev = NULL;
497
498 return err;
499}
500
501/* Empty thread pool callbacks for the network processing threads. */
502static inline void *dst_thread_network_init(void *data)
503{
504 dprintk("%s: data: %p.\n", __func__, data);
505 return data;
506}
507
508static inline void dst_thread_network_cleanup(void *data)
509{
510 dprintk("%s: data: %p.\n", __func__, data);
511}
512
513/*
514 * Allocate DST node and initialize some of its parameters.
515 */
516static struct dst_node *dst_alloc_node(struct dst_ctl *ctl,
517 int (*start)(struct dst_node *),
518 int num)
519{
520 struct dst_node *n;
521 int err;
522
523 n = kzalloc(sizeof(struct dst_node), GFP_KERNEL);
524 if (!n)
525 return NULL;
526
527 INIT_LIST_HEAD(&n->node_entry);
528
529 INIT_LIST_HEAD(&n->security_list);
530 mutex_init(&n->security_lock);
531
532 init_waitqueue_head(&n->wait);
533
534 n->trans_scan_timeout = msecs_to_jiffies(ctl->trans_scan_timeout);
535 if (!n->trans_scan_timeout)
536 n->trans_scan_timeout = HZ;
537
538 n->trans_max_retries = ctl->trans_max_retries;
539 if (!n->trans_max_retries)
540 n->trans_max_retries = 10;
541
542 /*
543 * Pretty much arbitrary default numbers.
544 * 32 matches maximum number of pages in bio originated from ext3 (31).
545 */
546 n->max_pages = ctl->max_pages;
547 if (!n->max_pages)
548 n->max_pages = 32;
549
550 if (n->max_pages > 1024)
551 n->max_pages = 1024;
552
553 n->start = start;
554 n->size = ctl->size;
555
556 atomic_set(&n->refcnt, 1);
557 atomic_long_set(&n->gen, 0);
558 snprintf(n->name, sizeof(n->name), "%s", ctl->name);
559
560 err = dst_node_sysfs_init(n);
561 if (err)
562 goto err_out_free;
563
564 n->pool = thread_pool_create(num, n->name, dst_thread_network_init,
565 dst_thread_network_cleanup, n);
566 if (IS_ERR(n->pool)) {
567 err = PTR_ERR(n->pool);
568 goto err_out_sysfs_exit;
569 }
570
571 dprintk("%s: n: %p, name: %s.\n", __func__, n, n->name);
572
573 return n;
574
575err_out_sysfs_exit:
576 dst_node_sysfs_exit(n);
577err_out_free:
578 kfree(n);
579 return NULL;
580}
581
582/*
583 * Starting a node, connected to the remote server:
584 * register block device and initialize transaction mechanism.
585 * In revers order though.
586 *
587 * It will autonegotiate some parameters with the remote node
588 * and update local if needed.
589 *
590 * Transaction initialization should be the last thing before
591 * starting the node, since transaction should include not only
592 * block IO, but also crypto related data (if any), which are
593 * initialized separately.
594 */
595static int dst_start_remote(struct dst_node *n)
596{
597 int err;
598
599 err = dst_node_trans_init(n, sizeof(struct dst_trans));
600 if (err)
601 return err;
602
603 err = dst_node_create_disk(n);
604 if (err)
605 return err;
606
607 dst_node_set_size(n);
608 add_disk(n->disk);
609
610 dprintk("DST: started remote node '%s', minor: %d.\n",
611 n->name, n->disk->first_minor);
612
613 return 0;
614}
615
616/*
617 * Adding remote node and initialize connection.
618 */
619static int dst_add_remote(struct dst_node *n, struct dst_ctl *ctl,
620 void *data, unsigned int size)
621{
622 int err;
623 struct dst_network_ctl *rctl = data;
624
625 if (n)
626 return -EEXIST;
627
628 if (size != sizeof(struct dst_network_ctl))
629 return -EINVAL;
630
631 n = dst_alloc_node(ctl, dst_start_remote, 1);
632 if (!n)
633 return -ENOMEM;
634
635 memcpy(&n->info->net, rctl, sizeof(struct dst_network_ctl));
636 err = dst_node_init_connected(n, rctl);
637 if (err)
638 goto err_out_free;
639
640 dst_node_add(n);
641
642 return 0;
643
644err_out_free:
645 dst_node_put(n);
646 return err;
647}
648
649/*
650 * Adding export node: initializing block device and listening socket.
651 */
652static int dst_add_export(struct dst_node *n, struct dst_ctl *ctl,
653 void *data, unsigned int size)
654{
655 int err;
656 struct dst_export_ctl *le = data;
657
658 if (n)
659 return -EEXIST;
660
661 if (size != sizeof(struct dst_export_ctl))
662 return -EINVAL;
663
664 n = dst_alloc_node(ctl, dst_start_export, 2);
665 if (!n)
666 return -EINVAL;
667
668 err = dst_setup_export(n, ctl, le);
669 if (err)
670 goto err_out_free;
671
672 dst_node_add(n);
673
674 return 0;
675
676err_out_free:
677 dst_node_put(n);
678 return err;
679}
680
681static int dst_node_remove_unload(struct dst_node *n)
682{
683 printk(KERN_INFO "STOPPED name: '%s', size: %llu.\n",
684 n->name, n->size);
685
686 if (n->disk)
687 del_gendisk(n->disk);
688
689 dst_node_remove(n);
690 dst_node_sysfs_exit(n);
691
692 /*
693 * This is not a hack. Really.
694 * Node's reference counter allows to implement fine grained
695 * node freeing, but since all transactions (which hold node's
696 * reference counter) are processed in the dedicated thread,
697 * it is possible that reference will hit zero in that thread,
698 * so we will not be able to exit thread and cleanup the node.
699 *
700 * So, we remove disk, so no new activity is possible, and
701 * wait until all pending transaction are completed (either
702 * in receiving thread or by timeout in workqueue), in this
703 * case reference counter will be less or equal to 2 (once set in
704 * dst_alloc_node() and then in connector message parser;
705 * or when we force module unloading, and connector message
706 * parser does not hold a reference, in this case reference
707 * counter will be equal to 1),
708 * and subsequent dst_node_put() calls will free the node.
709 */
710 dprintk("%s: going to sleep with %d refcnt.\n",
711 __func__, atomic_read(&n->refcnt));
712 wait_event(n->wait, atomic_read(&n->refcnt) <= 2);
713
714 dst_node_put(n);
715 return 0;
716}
717
718/*
719 * Remove node from the hash table.
720 */
721static int dst_del_node(struct dst_node *n, struct dst_ctl *ctl,
722 void *data, unsigned int size)
723{
724 if (!n)
725 return -ENODEV;
726
727 return dst_node_remove_unload(n);
728}
729
730/*
731 * Initialize crypto processing for given node.
732 */
733static int dst_crypto_init(struct dst_node *n, struct dst_ctl *ctl,
734 void *data, unsigned int size)
735{
736 struct dst_crypto_ctl *crypto = data;
737
738 if (!n)
739 return -ENODEV;
740
741 if (size != sizeof(struct dst_crypto_ctl) + crypto->hash_keysize +
742 crypto->cipher_keysize)
743 return -EINVAL;
744
745 if (n->trans_cache)
746 return -EEXIST;
747
748 return dst_node_crypto_init(n, crypto);
749}
750
751/*
752 * Security attributes for given node.
753 */
754static int dst_security_init(struct dst_node *n, struct dst_ctl *ctl,
755 void *data, unsigned int size)
756{
757 struct dst_secure *s;
758
759 if (!n)
760 return -ENODEV;
761
762 if (size != sizeof(struct dst_secure_user))
763 return -EINVAL;
764
765 s = kmalloc(sizeof(struct dst_secure), GFP_KERNEL);
766 if (!s)
767 return -ENOMEM;
768
769 memcpy(&s->sec, data, size);
770
771 mutex_lock(&n->security_lock);
772 list_add_tail(&s->sec_entry, &n->security_list);
773 mutex_unlock(&n->security_lock);
774
775 return 0;
776}
777
778/*
779 * Kill'em all!
780 */
781static int dst_start_node(struct dst_node *n, struct dst_ctl *ctl,
782 void *data, unsigned int size)
783{
784 int err;
785
786 if (!n)
787 return -ENODEV;
788
789 if (n->trans_cache)
790 return 0;
791
792 err = n->start(n);
793 if (err)
794 return err;
795
796 printk(KERN_INFO "STARTED name: '%s', size: %llu.\n", n->name, n->size);
797 return 0;
798}
799
800typedef int (*dst_command_func)(struct dst_node *n, struct dst_ctl *ctl,
801 void *data, unsigned int size);
802
803/*
804 * List of userspace commands.
805 */
806static dst_command_func dst_commands[] = {
807 [DST_ADD_REMOTE] = &dst_add_remote,
808 [DST_ADD_EXPORT] = &dst_add_export,
809 [DST_DEL_NODE] = &dst_del_node,
810 [DST_CRYPTO] = &dst_crypto_init,
811 [DST_SECURITY] = &dst_security_init,
812 [DST_START] = &dst_start_node,
813};
814
815/*
816 * Configuration parser.
817 */
818static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
819{
820 struct dst_ctl *ctl;
821 int err;
822 struct dst_ctl_ack ack;
823 struct dst_node *n = NULL, *tmp;
824 unsigned int hash;
825
826 if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN)) {
827 err = -EPERM;
828 goto out;
829 }
830
831 if (msg->len < sizeof(struct dst_ctl)) {
832 err = -EBADMSG;
833 goto out;
834 }
835
836 ctl = (struct dst_ctl *)msg->data;
837
838 if (ctl->cmd >= DST_CMD_MAX) {
839 err = -EINVAL;
840 goto out;
841 }
842 hash = dst_hash(ctl->name, sizeof(ctl->name));
843
844 mutex_lock(&dst_hash_lock);
845 list_for_each_entry(tmp, &dst_hashtable[hash], node_entry) {
846 if (!memcmp(tmp->name, ctl->name, sizeof(tmp->name))) {
847 n = tmp;
848 dst_node_get(n);
849 break;
850 }
851 }
852 mutex_unlock(&dst_hash_lock);
853
854 err = dst_commands[ctl->cmd](n, ctl, msg->data + sizeof(struct dst_ctl),
855 msg->len - sizeof(struct dst_ctl));
856
857 dst_node_put(n);
858out:
859 memcpy(&ack.msg, msg, sizeof(struct cn_msg));
860
861 ack.msg.ack = msg->ack + 1;
862 ack.msg.len = sizeof(struct dst_ctl_ack) - sizeof(struct cn_msg);
863
864 ack.error = err;
865
866 cn_netlink_send(&ack.msg, 0, GFP_KERNEL);
867}
868
869/*
870 * Global initialization: sysfs, hash table, block device registration,
871 * connector and various caches.
872 */
873static int __init dst_sysfs_init(void)
874{
875 return bus_register(&dst_dev_bus_type);
876}
877
878static void dst_sysfs_exit(void)
879{
880 bus_unregister(&dst_dev_bus_type);
881}
882
883static int __init dst_hashtable_init(void)
884{
885 unsigned int i;
886
887 dst_hashtable = kcalloc(dst_hashtable_size, sizeof(struct list_head),
888 GFP_KERNEL);
889 if (!dst_hashtable)
890 return -ENOMEM;
891
892 for (i = 0; i < dst_hashtable_size; ++i)
893 INIT_LIST_HEAD(&dst_hashtable[i]);
894
895 return 0;
896}
897
898static void dst_hashtable_exit(void)
899{
900 unsigned int i;
901 struct dst_node *n, *tmp;
902
903 for (i = 0; i < dst_hashtable_size; ++i) {
904 list_for_each_entry_safe(n, tmp, &dst_hashtable[i], node_entry) {
905 dst_node_remove_unload(n);
906 }
907 }
908
909 kfree(dst_hashtable);
910}
911
912static int __init dst_sys_init(void)
913{
914 int err = -ENOMEM;
915
916 err = dst_hashtable_init();
917 if (err)
918 goto err_out_exit;
919
920 err = dst_export_init();
921 if (err)
922 goto err_out_hashtable_exit;
923
924 err = register_blkdev(dst_major, DST_NAME);
925 if (err < 0)
926 goto err_out_export_exit;
927 if (err)
928 dst_major = err;
929
930 err = dst_sysfs_init();
931 if (err)
932 goto err_out_unregister;
933
934 err = cn_add_callback(&cn_dst_id, "DST", cn_dst_callback);
935 if (err)
936 goto err_out_sysfs_exit;
937
938 printk(KERN_INFO "Distributed storage, '%s' release.\n", dst_name);
939
940 return 0;
941
942err_out_sysfs_exit:
943 dst_sysfs_exit();
944err_out_unregister:
945 unregister_blkdev(dst_major, DST_NAME);
946err_out_export_exit:
947 dst_export_exit();
948err_out_hashtable_exit:
949 dst_hashtable_exit();
950err_out_exit:
951 return err;
952}
953
954static void __exit dst_sys_exit(void)
955{
956 cn_del_callback(&cn_dst_id);
957 unregister_blkdev(dst_major, DST_NAME);
958 dst_hashtable_exit();
959 dst_sysfs_exit();
960 dst_export_exit();
961}
962
963module_init(dst_sys_init);
964module_exit(dst_sys_exit);
965
966MODULE_DESCRIPTION("Distributed storage");
967MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
968MODULE_LICENSE("GPL");
diff --git a/drivers/staging/dst/export.c b/drivers/staging/dst/export.c
deleted file mode 100644
index c324230e8b60..000000000000
--- a/drivers/staging/dst/export.c
+++ /dev/null
@@ -1,660 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/blkdev.h>
17#include <linux/bio.h>
18#include <linux/dst.h>
19#include <linux/in.h>
20#include <linux/in6.h>
21#include <linux/poll.h>
22#include <linux/slab.h>
23#include <linux/socket.h>
24
25#include <net/sock.h>
26
27/*
28 * Export bioset is used for server block IO requests.
29 */
30static struct bio_set *dst_bio_set;
31
32int __init dst_export_init(void)
33{
34 int err = -ENOMEM;
35
36 dst_bio_set = bioset_create(32, sizeof(struct dst_export_priv));
37 if (!dst_bio_set)
38 goto err_out_exit;
39
40 return 0;
41
42err_out_exit:
43 return err;
44}
45
46void dst_export_exit(void)
47{
48 bioset_free(dst_bio_set);
49}
50
51/*
52 * When client connects and autonegotiates with the server node,
53 * its permissions are checked in a security attributes and sent
54 * back.
55 */
56static unsigned int dst_check_permissions(struct dst_state *main,
57 struct dst_state *st)
58{
59 struct dst_node *n = main->node;
60 struct dst_secure *sentry;
61 struct dst_secure_user *s;
62 struct saddr *sa = &st->ctl.addr;
63 unsigned int perm = 0;
64
65 mutex_lock(&n->security_lock);
66 list_for_each_entry(sentry, &n->security_list, sec_entry) {
67 s = &sentry->sec;
68
69 if (s->addr.sa_family != sa->sa_family)
70 continue;
71
72 if (s->addr.sa_data_len != sa->sa_data_len)
73 continue;
74
75 /*
76 * This '2' below is a port field. This may be very wrong to do
77 * in atalk for example though. If there will be any need
78 * to extent protocol to something else, I can create
79 * per-family helpers and use them instead of this memcmp.
80 */
81 if (memcmp(s->addr.sa_data + 2, sa->sa_data + 2,
82 sa->sa_data_len - 2))
83 continue;
84
85 perm = s->permissions;
86 }
87 mutex_unlock(&n->security_lock);
88
89 return perm;
90}
91
92/*
93 * Accept new client: allocate appropriate network state and check permissions.
94 */
95static struct dst_state *dst_accept_client(struct dst_state *st)
96{
97 unsigned int revents = 0;
98 unsigned int err_mask = POLLERR | POLLHUP | POLLRDHUP;
99 unsigned int mask = err_mask | POLLIN;
100 struct dst_node *n = st->node;
101 int err = 0;
102 struct socket *sock = NULL;
103 struct dst_state *new;
104
105 while (!err && !sock) {
106 revents = dst_state_poll(st);
107
108 if (!(revents & mask)) {
109 DEFINE_WAIT(wait);
110
111 for (;;) {
112 prepare_to_wait(&st->thread_wait,
113 &wait, TASK_INTERRUPTIBLE);
114 if (!n->trans_scan_timeout || st->need_exit)
115 break;
116
117 revents = dst_state_poll(st);
118
119 if (revents & mask)
120 break;
121
122 if (signal_pending(current))
123 break;
124
125 /*
126 * Magic HZ? Polling check above is not safe in
127 * all cases (like socket reset in BH context),
128 * so it is simpler just to postpone it to the
129 * process context instead of implementing
130 * special locking there.
131 */
132 schedule_timeout(HZ);
133 }
134 finish_wait(&st->thread_wait, &wait);
135 }
136
137 err = -ECONNRESET;
138 dst_state_lock(st);
139
140 dprintk("%s: st: %p, revents: %x [err: %d, in: %d].\n",
141 __func__, st, revents, revents & err_mask,
142 revents & POLLIN);
143
144 if (revents & err_mask) {
145 dprintk("%s: revents: %x, socket: %p, err: %d.\n",
146 __func__, revents, st->socket, err);
147 err = -ECONNRESET;
148 }
149
150 if (!n->trans_scan_timeout || st->need_exit)
151 err = -ENODEV;
152
153 if (st->socket && (revents & POLLIN))
154 err = kernel_accept(st->socket, &sock, 0);
155
156 dst_state_unlock(st);
157 }
158
159 if (err)
160 goto err_out_exit;
161
162 new = dst_state_alloc(st->node);
163 if (IS_ERR(new)) {
164 err = -ENOMEM;
165 goto err_out_release;
166 }
167 new->socket = sock;
168
169 new->ctl.addr.sa_data_len = sizeof(struct sockaddr);
170 err = kernel_getpeername(sock, (struct sockaddr *)&new->ctl.addr,
171 (int *)&new->ctl.addr.sa_data_len);
172 if (err)
173 goto err_out_put;
174
175 new->permissions = dst_check_permissions(st, new);
176 if (new->permissions == 0) {
177 err = -EPERM;
178 dst_dump_addr(sock, (struct sockaddr *)&new->ctl.addr,
179 "Client is not allowed to connect");
180 goto err_out_put;
181 }
182
183 err = dst_poll_init(new);
184 if (err)
185 goto err_out_put;
186
187 dst_dump_addr(sock, (struct sockaddr *)&new->ctl.addr,
188 "Connected client");
189
190 return new;
191
192err_out_put:
193 dst_state_put(new);
194err_out_release:
195 sock_release(sock);
196err_out_exit:
197 return ERR_PTR(err);
198}
199
200/*
201 * Each server's block request sometime finishes.
202 * Usually it happens in hard irq context of the appropriate controller,
203 * so to play good with all cases we just queue BIO into the queue
204 * and wake up processing thread, which gets completed request and
205 * send (encrypting if needed) it back to the client (if it was a read
206 * request), or sends back reply that writing successfully completed.
207 */
208static int dst_export_process_request_queue(struct dst_state *st)
209{
210 unsigned long flags;
211 struct dst_export_priv *p = NULL;
212 struct bio *bio;
213 int err = 0;
214
215 while (!list_empty(&st->request_list)) {
216 spin_lock_irqsave(&st->request_lock, flags);
217 if (!list_empty(&st->request_list)) {
218 p = list_first_entry(&st->request_list,
219 struct dst_export_priv, request_entry);
220 list_del(&p->request_entry);
221 }
222 spin_unlock_irqrestore(&st->request_lock, flags);
223
224 if (!p)
225 break;
226
227 bio = p->bio;
228
229 if (dst_need_crypto(st->node) && (bio_data_dir(bio) == READ))
230 err = dst_export_crypto(st->node, bio);
231 else
232 err = dst_export_send_bio(bio);
233
234 if (err)
235 break;
236 }
237
238 return err;
239}
240
241/*
242 * Cleanup export state.
243 * It has to wait until all requests are finished,
244 * and then free them all.
245 */
246static void dst_state_cleanup_export(struct dst_state *st)
247{
248 struct dst_export_priv *p;
249 unsigned long flags;
250
251 /*
252 * This loop waits for all pending bios to be completed and freed.
253 */
254 while (atomic_read(&st->refcnt) > 1) {
255 dprintk("%s: st: %p, refcnt: %d, list_empty: %d.\n",
256 __func__, st, atomic_read(&st->refcnt),
257 list_empty(&st->request_list));
258 wait_event_timeout(st->thread_wait,
259 (atomic_read(&st->refcnt) == 1) ||
260 !list_empty(&st->request_list),
261 HZ/2);
262
263 while (!list_empty(&st->request_list)) {
264 p = NULL;
265 spin_lock_irqsave(&st->request_lock, flags);
266 if (!list_empty(&st->request_list)) {
267 p = list_first_entry(&st->request_list,
268 struct dst_export_priv, request_entry);
269 list_del(&p->request_entry);
270 }
271 spin_unlock_irqrestore(&st->request_lock, flags);
272
273 if (p)
274 bio_put(p->bio);
275
276 dprintk("%s: st: %p, refcnt: %d, list_empty: %d, p: "
277 "%p.\n", __func__, st, atomic_read(&st->refcnt),
278 list_empty(&st->request_list), p);
279 }
280 }
281
282 dst_state_put(st);
283}
284
285/*
286 * Client accepting thread.
287 * Not only accepts new connection, but also schedules receiving thread
288 * and performs request completion described above.
289 */
290static int dst_accept(void *init_data, void *schedule_data)
291{
292 struct dst_state *main_st = schedule_data;
293 struct dst_node *n = init_data;
294 struct dst_state *st;
295 int err;
296
297 while (n->trans_scan_timeout && !main_st->need_exit) {
298 dprintk("%s: main_st: %p, n: %p.\n", __func__, main_st, n);
299 st = dst_accept_client(main_st);
300 if (IS_ERR(st))
301 continue;
302
303 err = dst_state_schedule_receiver(st);
304 if (!err) {
305 while (n->trans_scan_timeout) {
306 err = wait_event_interruptible_timeout(st->thread_wait,
307 !list_empty(&st->request_list) ||
308 !n->trans_scan_timeout ||
309 st->need_exit,
310 HZ);
311
312 if (!n->trans_scan_timeout || st->need_exit)
313 break;
314
315 if (list_empty(&st->request_list))
316 continue;
317
318 err = dst_export_process_request_queue(st);
319 if (err)
320 break;
321 }
322
323 st->need_exit = 1;
324 wake_up(&st->thread_wait);
325 }
326
327 dst_state_cleanup_export(st);
328 }
329
330 dprintk("%s: freeing listening socket st: %p.\n", __func__, main_st);
331
332 dst_state_lock(main_st);
333 dst_poll_exit(main_st);
334 dst_state_socket_release(main_st);
335 dst_state_unlock(main_st);
336 dst_state_put(main_st);
337 dprintk("%s: freed listening socket st: %p.\n", __func__, main_st);
338
339 return 0;
340}
341
342int dst_start_export(struct dst_node *n)
343{
344 if (list_empty(&n->security_list)) {
345 printk(KERN_ERR "You are trying to export node '%s' "
346 "without security attributes.\nNo clients will "
347 "be allowed to connect. Exiting.\n", n->name);
348 return -EINVAL;
349 }
350 return dst_node_trans_init(n, sizeof(struct dst_export_priv));
351}
352
353/*
354 * Initialize listening state and schedule accepting thread.
355 */
356int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le)
357{
358 struct dst_state *st;
359 int err = -ENOMEM;
360 struct dst_network_ctl *ctl = &le->ctl;
361
362 memcpy(&n->info->net, ctl, sizeof(struct dst_network_ctl));
363
364 st = dst_state_alloc(n);
365 if (IS_ERR(st)) {
366 err = PTR_ERR(st);
367 goto err_out_exit;
368 }
369 memcpy(&st->ctl, ctl, sizeof(struct dst_network_ctl));
370
371 err = dst_state_socket_create(st);
372 if (err)
373 goto err_out_put;
374
375 st->socket->sk->sk_reuse = 1;
376
377 err = kernel_bind(st->socket, (struct sockaddr *)&ctl->addr,
378 ctl->addr.sa_data_len);
379 if (err)
380 goto err_out_socket_release;
381
382 err = kernel_listen(st->socket, 1024);
383 if (err)
384 goto err_out_socket_release;
385 n->state = st;
386
387 err = dst_poll_init(st);
388 if (err)
389 goto err_out_socket_release;
390
391 dst_state_get(st);
392
393 err = thread_pool_schedule(n->pool, dst_thread_setup,
394 dst_accept, st, MAX_SCHEDULE_TIMEOUT);
395 if (err)
396 goto err_out_poll_exit;
397
398 return 0;
399
400err_out_poll_exit:
401 dst_poll_exit(st);
402err_out_socket_release:
403 dst_state_socket_release(st);
404err_out_put:
405 dst_state_put(st);
406err_out_exit:
407 n->state = NULL;
408 return err;
409}
410
411/*
412 * Free bio and related private data.
413 * Also drop a reference counter for appropriate state,
414 * which waits when there are no more block IOs in-flight.
415 */
416static void dst_bio_destructor(struct bio *bio)
417{
418 struct bio_vec *bv;
419 struct dst_export_priv *priv = bio->bi_private;
420 int i;
421
422 bio_for_each_segment(bv, bio, i) {
423 if (!bv->bv_page)
424 break;
425
426 __free_page(bv->bv_page);
427 }
428
429 if (priv)
430 dst_state_put(priv->state);
431 bio_free(bio, dst_bio_set);
432}
433
434/*
435 * Block IO completion. Queue request to be sent back to
436 * the client (or just confirmation).
437 */
438static void dst_bio_end_io(struct bio *bio, int err)
439{
440 struct dst_export_priv *p = bio->bi_private;
441 struct dst_state *st = p->state;
442 unsigned long flags;
443
444 spin_lock_irqsave(&st->request_lock, flags);
445 list_add_tail(&p->request_entry, &st->request_list);
446 spin_unlock_irqrestore(&st->request_lock, flags);
447
448 wake_up(&st->thread_wait);
449}
450
451/*
452 * Allocate read request for the server.
453 */
454static int dst_export_read_request(struct bio *bio, unsigned int total_size)
455{
456 unsigned int size;
457 struct page *page;
458 int err;
459
460 while (total_size) {
461 err = -ENOMEM;
462 page = alloc_page(GFP_KERNEL);
463 if (!page)
464 goto err_out_exit;
465
466 size = min_t(unsigned int, PAGE_SIZE, total_size);
467
468 err = bio_add_page(bio, page, size, 0);
469 dprintk("%s: bio: %llu/%u, size: %u, err: %d.\n",
470 __func__, (u64)bio->bi_sector, bio->bi_size,
471 size, err);
472 if (err <= 0)
473 goto err_out_free_page;
474
475 total_size -= size;
476 }
477
478 return 0;
479
480err_out_free_page:
481 __free_page(page);
482err_out_exit:
483 return err;
484}
485
486/*
487 * Allocate write request for the server.
488 * Should not only get pages, but also read data from the network.
489 */
490static int dst_export_write_request(struct dst_state *st,
491 struct bio *bio, unsigned int total_size)
492{
493 unsigned int size;
494 struct page *page;
495 void *data;
496 int err;
497
498 while (total_size) {
499 err = -ENOMEM;
500 page = alloc_page(GFP_KERNEL);
501 if (!page)
502 goto err_out_exit;
503
504 data = kmap(page);
505 if (!data)
506 goto err_out_free_page;
507
508 size = min_t(unsigned int, PAGE_SIZE, total_size);
509
510 err = dst_data_recv(st, data, size);
511 if (err)
512 goto err_out_unmap_page;
513
514 err = bio_add_page(bio, page, size, 0);
515 if (err <= 0)
516 goto err_out_unmap_page;
517
518 kunmap(page);
519
520 total_size -= size;
521 }
522
523 return 0;
524
525err_out_unmap_page:
526 kunmap(page);
527err_out_free_page:
528 __free_page(page);
529err_out_exit:
530 return err;
531}
532
533/*
534 * Groovy, we've gotten an IO request from the client.
535 * Allocate BIO from the bioset, private data from the mempool
536 * and lots of pages for IO.
537 */
538int dst_process_io(struct dst_state *st)
539{
540 struct dst_node *n = st->node;
541 struct dst_cmd *cmd = st->data;
542 struct bio *bio;
543 struct dst_export_priv *priv;
544 int err = -ENOMEM;
545
546 if (unlikely(!n->bdev)) {
547 err = -EINVAL;
548 goto err_out_exit;
549 }
550
551 bio = bio_alloc_bioset(GFP_KERNEL,
552 PAGE_ALIGN(cmd->size) >> PAGE_SHIFT,
553 dst_bio_set);
554 if (!bio)
555 goto err_out_exit;
556
557 priv = (struct dst_export_priv *)(((void *)bio) -
558 sizeof (struct dst_export_priv));
559
560 priv->state = dst_state_get(st);
561 priv->bio = bio;
562
563 bio->bi_private = priv;
564 bio->bi_end_io = dst_bio_end_io;
565 bio->bi_destructor = dst_bio_destructor;
566 bio->bi_bdev = n->bdev;
567
568 /*
569 * Server side is only interested in two low bits:
570 * uptodate (set by itself actually) and rw block
571 */
572 bio->bi_flags |= cmd->flags & 3;
573
574 bio->bi_rw = cmd->rw;
575 bio->bi_size = 0;
576 bio->bi_sector = cmd->sector;
577
578 dst_bio_to_cmd(bio, &priv->cmd, DST_IO_RESPONSE, cmd->id);
579
580 priv->cmd.flags = 0;
581 priv->cmd.size = cmd->size;
582
583 if (bio_data_dir(bio) == WRITE) {
584 err = dst_recv_cdata(st, priv->cmd.hash);
585 if (err)
586 goto err_out_free;
587
588 err = dst_export_write_request(st, bio, cmd->size);
589 if (err)
590 goto err_out_free;
591
592 if (dst_need_crypto(n))
593 return dst_export_crypto(n, bio);
594 } else {
595 err = dst_export_read_request(bio, cmd->size);
596 if (err)
597 goto err_out_free;
598 }
599
600 dprintk("%s: bio: %llu/%u, rw: %lu, dir: %lu, flags: %lx, phys: %d.\n",
601 __func__, (u64)bio->bi_sector, bio->bi_size,
602 bio->bi_rw, bio_data_dir(bio),
603 bio->bi_flags, bio->bi_phys_segments);
604
605 generic_make_request(bio);
606
607 return 0;
608
609err_out_free:
610 bio_put(bio);
611err_out_exit:
612 return err;
613}
614
615/*
616 * Ok, block IO is ready, let's send it back to the client...
617 */
618int dst_export_send_bio(struct bio *bio)
619{
620 struct dst_export_priv *p = bio->bi_private;
621 struct dst_state *st = p->state;
622 struct dst_cmd *cmd = &p->cmd;
623 int err;
624
625 dprintk("%s: id: %llu, bio: %llu/%u, csize: %u, flags: %lu, rw: %lu.\n",
626 __func__, cmd->id, (u64)bio->bi_sector, bio->bi_size,
627 cmd->csize, bio->bi_flags, bio->bi_rw);
628
629 dst_convert_cmd(cmd);
630
631 dst_state_lock(st);
632 if (!st->socket) {
633 err = -ECONNRESET;
634 goto err_out_unlock;
635 }
636
637 if (bio_data_dir(bio) == WRITE) {
638 /* ... or just confirmation that writing has completed. */
639 cmd->size = cmd->csize = 0;
640 err = dst_data_send_header(st->socket, cmd,
641 sizeof(struct dst_cmd), 0);
642 if (err)
643 goto err_out_unlock;
644 } else {
645 err = dst_send_bio(st, cmd, bio);
646 if (err)
647 goto err_out_unlock;
648 }
649
650 dst_state_unlock(st);
651
652 bio_put(bio);
653 return 0;
654
655err_out_unlock:
656 dst_state_unlock(st);
657
658 bio_put(bio);
659 return err;
660}
diff --git a/drivers/staging/dst/state.c b/drivers/staging/dst/state.c
deleted file mode 100644
index 02a05e6c48c3..000000000000
--- a/drivers/staging/dst/state.c
+++ /dev/null
@@ -1,844 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/buffer_head.h>
17#include <linux/blkdev.h>
18#include <linux/bio.h>
19#include <linux/connector.h>
20#include <linux/dst.h>
21#include <linux/device.h>
22#include <linux/in.h>
23#include <linux/in6.h>
24#include <linux/socket.h>
25#include <linux/slab.h>
26
27#include <net/sock.h>
28
29/*
30 * Polling machinery.
31 */
32
33struct dst_poll_helper {
34 poll_table pt;
35 struct dst_state *st;
36};
37
38static int dst_queue_wake(wait_queue_t *wait, unsigned mode,
39 int sync, void *key)
40{
41 struct dst_state *st = container_of(wait, struct dst_state, wait);
42
43 wake_up(&st->thread_wait);
44 return 1;
45}
46
47static void dst_queue_func(struct file *file, wait_queue_head_t *whead,
48 poll_table *pt)
49{
50 struct dst_state *st = container_of(pt, struct dst_poll_helper, pt)->st;
51
52 st->whead = whead;
53 init_waitqueue_func_entry(&st->wait, dst_queue_wake);
54 add_wait_queue(whead, &st->wait);
55}
56
57void dst_poll_exit(struct dst_state *st)
58{
59 if (st->whead) {
60 remove_wait_queue(st->whead, &st->wait);
61 st->whead = NULL;
62 }
63}
64
65int dst_poll_init(struct dst_state *st)
66{
67 struct dst_poll_helper ph;
68
69 ph.st = st;
70 init_poll_funcptr(&ph.pt, &dst_queue_func);
71
72 st->socket->ops->poll(NULL, st->socket, &ph.pt);
73 return 0;
74}
75
76/*
77 * Header receiving function - may block.
78 */
79static int dst_data_recv_header(struct socket *sock,
80 void *data, unsigned int size, int block)
81{
82 struct msghdr msg;
83 struct kvec iov;
84 int err;
85
86 iov.iov_base = data;
87 iov.iov_len = size;
88
89 msg.msg_iov = (struct iovec *)&iov;
90 msg.msg_iovlen = 1;
91 msg.msg_name = NULL;
92 msg.msg_namelen = 0;
93 msg.msg_control = NULL;
94 msg.msg_controllen = 0;
95 msg.msg_flags = (block) ? MSG_WAITALL : MSG_DONTWAIT;
96
97 err = kernel_recvmsg(sock, &msg, &iov, 1, iov.iov_len,
98 msg.msg_flags);
99 if (err != size)
100 return -1;
101
102 return 0;
103}
104
105/*
106 * Header sending function - may block.
107 */
108int dst_data_send_header(struct socket *sock,
109 void *data, unsigned int size, int more)
110{
111 struct msghdr msg;
112 struct kvec iov;
113 int err;
114
115 iov.iov_base = data;
116 iov.iov_len = size;
117
118 msg.msg_iov = (struct iovec *)&iov;
119 msg.msg_iovlen = 1;
120 msg.msg_name = NULL;
121 msg.msg_namelen = 0;
122 msg.msg_control = NULL;
123 msg.msg_controllen = 0;
124 msg.msg_flags = MSG_WAITALL | (more ? MSG_MORE : 0);
125
126 err = kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len);
127 if (err != size) {
128 dprintk("%s: size: %u, more: %d, err: %d.\n",
129 __func__, size, more, err);
130 return -1;
131 }
132
133 return 0;
134}
135
136/*
137 * Block autoconfiguration: request size of the storage and permissions.
138 */
139static int dst_request_remote_config(struct dst_state *st)
140{
141 struct dst_node *n = st->node;
142 int err = -EINVAL;
143 struct dst_cmd *cmd = st->data;
144
145 memset(cmd, 0, sizeof(struct dst_cmd));
146 cmd->cmd = DST_CFG;
147
148 dst_convert_cmd(cmd);
149
150 err = dst_data_send_header(st->socket, cmd, sizeof(struct dst_cmd), 0);
151 if (err)
152 goto out;
153
154 err = dst_data_recv_header(st->socket, cmd, sizeof(struct dst_cmd), 1);
155 if (err)
156 goto out;
157
158 dst_convert_cmd(cmd);
159
160 if (cmd->cmd != DST_CFG) {
161 err = -EINVAL;
162 dprintk("%s: checking result: cmd: %d, size reported: %llu.\n",
163 __func__, cmd->cmd, cmd->sector);
164 goto out;
165 }
166
167 if (n->size != 0)
168 n->size = min_t(loff_t, n->size, cmd->sector);
169 else
170 n->size = cmd->sector;
171
172 n->info->size = n->size;
173 st->permissions = cmd->rw;
174
175out:
176 dprintk("%s: n: %p, err: %d, size: %llu, permission: %x.\n",
177 __func__, n, err, n->size, st->permissions);
178 return err;
179}
180
181/*
182 * Socket machinery.
183 */
184
185#define DST_DEFAULT_TIMEO 20000
186
187int dst_state_socket_create(struct dst_state *st)
188{
189 int err;
190 struct socket *sock;
191 struct dst_network_ctl *ctl = &st->ctl;
192
193 err = sock_create(ctl->addr.sa_family, ctl->type, ctl->proto, &sock);
194 if (err < 0)
195 return err;
196
197 sock->sk->sk_sndtimeo = sock->sk->sk_rcvtimeo =
198 msecs_to_jiffies(DST_DEFAULT_TIMEO);
199 sock->sk->sk_allocation = GFP_NOIO;
200
201 st->socket = st->read_socket = sock;
202 return 0;
203}
204
205void dst_state_socket_release(struct dst_state *st)
206{
207 dprintk("%s: st: %p, socket: %p, n: %p.\n",
208 __func__, st, st->socket, st->node);
209 if (st->socket) {
210 sock_release(st->socket);
211 st->socket = NULL;
212 st->read_socket = NULL;
213 }
214}
215
216void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str)
217{
218 if (sk->ops->family == AF_INET) {
219 struct sockaddr_in *sin = (struct sockaddr_in *)sa;
220 printk(KERN_INFO "%s %u.%u.%u.%u:%d.\n", str,
221 NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
222 } else if (sk->ops->family == AF_INET6) {
223 struct sockaddr_in6 *sin = (struct sockaddr_in6 *)sa;
224 printk(KERN_INFO "%s %pi6:%d",
225 str, &sin->sin6_addr, ntohs(sin->sin6_port));
226 }
227}
228
229void dst_state_exit_connected(struct dst_state *st)
230{
231 if (st->socket) {
232 dst_poll_exit(st);
233 st->socket->ops->shutdown(st->socket, 2);
234
235 dst_dump_addr(st->socket, (struct sockaddr *)&st->ctl.addr,
236 "Disconnected peer");
237 dst_state_socket_release(st);
238 }
239}
240
241static int dst_state_init_connected(struct dst_state *st)
242{
243 int err;
244 struct dst_network_ctl *ctl = &st->ctl;
245
246 err = dst_state_socket_create(st);
247 if (err)
248 goto err_out_exit;
249
250 err = kernel_connect(st->socket, (struct sockaddr *)&st->ctl.addr,
251 st->ctl.addr.sa_data_len, 0);
252 if (err)
253 goto err_out_release;
254
255 err = dst_poll_init(st);
256 if (err)
257 goto err_out_release;
258
259 dst_dump_addr(st->socket, (struct sockaddr *)&ctl->addr,
260 "Connected to peer");
261
262 return 0;
263
264err_out_release:
265 dst_state_socket_release(st);
266err_out_exit:
267 return err;
268}
269
270/*
271 * State reset is used to reconnect to the remote peer.
272 * May fail, but who cares, we will try again later.
273 */
274static inline void dst_state_reset_nolock(struct dst_state *st)
275{
276 dst_state_exit_connected(st);
277 dst_state_init_connected(st);
278}
279
280static inline void dst_state_reset(struct dst_state *st)
281{
282 dst_state_lock(st);
283 dst_state_reset_nolock(st);
284 dst_state_unlock(st);
285}
286
287/*
288 * Basic network sending/receiving functions.
289 * Blocked mode is used.
290 */
291static int dst_data_recv_raw(struct dst_state *st, void *buf, u64 size)
292{
293 struct msghdr msg;
294 struct kvec iov;
295 int err;
296
297 BUG_ON(!size);
298
299 iov.iov_base = buf;
300 iov.iov_len = size;
301
302 msg.msg_iov = (struct iovec *)&iov;
303 msg.msg_iovlen = 1;
304 msg.msg_name = NULL;
305 msg.msg_namelen = 0;
306 msg.msg_control = NULL;
307 msg.msg_controllen = 0;
308 msg.msg_flags = MSG_DONTWAIT;
309
310 err = kernel_recvmsg(st->socket, &msg, &iov, 1, iov.iov_len,
311 msg.msg_flags);
312 if (err <= 0) {
313 dprintk("%s: failed to recv data: size: %llu, err: %d.\n",
314 __func__, size, err);
315 if (err == 0)
316 err = -ECONNRESET;
317
318 dst_state_exit_connected(st);
319 }
320
321 return err;
322}
323
324/*
325 * Ping command to early detect failed nodes.
326 */
327static int dst_send_ping(struct dst_state *st)
328{
329 struct dst_cmd *cmd = st->data;
330 int err = -ECONNRESET;
331
332 dst_state_lock(st);
333 if (st->socket) {
334 memset(cmd, 0, sizeof(struct dst_cmd));
335
336 cmd->cmd = __cpu_to_be32(DST_PING);
337
338 err = dst_data_send_header(st->socket, cmd,
339 sizeof(struct dst_cmd), 0);
340 }
341 dprintk("%s: st: %p, socket: %p, err: %d.\n", __func__,
342 st, st->socket, err);
343 dst_state_unlock(st);
344
345 return err;
346}
347
348/*
349 * Receiving function, which should either return error or read
350 * whole block request. If there was no traffic for a one second,
351 * send a ping, since remote node may die.
352 */
353int dst_data_recv(struct dst_state *st, void *data, unsigned int size)
354{
355 unsigned int revents = 0;
356 unsigned int err_mask = POLLERR | POLLHUP | POLLRDHUP;
357 unsigned int mask = err_mask | POLLIN;
358 struct dst_node *n = st->node;
359 int err = 0;
360
361 while (size && !err) {
362 revents = dst_state_poll(st);
363
364 if (!(revents & mask)) {
365 DEFINE_WAIT(wait);
366
367 for (;;) {
368 prepare_to_wait(&st->thread_wait, &wait,
369 TASK_INTERRUPTIBLE);
370 if (!n->trans_scan_timeout || st->need_exit)
371 break;
372
373 revents = dst_state_poll(st);
374
375 if (revents & mask)
376 break;
377
378 if (signal_pending(current))
379 break;
380
381 if (!schedule_timeout(HZ)) {
382 err = dst_send_ping(st);
383 if (err)
384 return err;
385 }
386
387 continue;
388 }
389 finish_wait(&st->thread_wait, &wait);
390 }
391
392 err = -ECONNRESET;
393 dst_state_lock(st);
394
395 if (st->socket && (st->read_socket == st->socket) &&
396 (revents & POLLIN)) {
397 err = dst_data_recv_raw(st, data, size);
398 if (err > 0) {
399 data += err;
400 size -= err;
401 err = 0;
402 }
403 }
404
405 if (revents & err_mask || !st->socket) {
406 dprintk("%s: revents: %x, socket: %p, size: %u, "
407 "err: %d.\n", __func__, revents,
408 st->socket, size, err);
409 err = -ECONNRESET;
410 }
411
412 dst_state_unlock(st);
413
414 if (!n->trans_scan_timeout)
415 err = -ENODEV;
416 }
417
418 return err;
419}
420
421/*
422 * Send block autoconf reply.
423 */
424static int dst_process_cfg(struct dst_state *st)
425{
426 struct dst_node *n = st->node;
427 struct dst_cmd *cmd = st->data;
428 int err;
429
430 cmd->sector = n->size;
431 cmd->rw = st->permissions;
432
433 dst_convert_cmd(cmd);
434
435 dst_state_lock(st);
436 err = dst_data_send_header(st->socket, cmd, sizeof(struct dst_cmd), 0);
437 dst_state_unlock(st);
438
439 return err;
440}
441
442/*
443 * Receive block IO from the network.
444 */
445static int dst_recv_bio(struct dst_state *st, struct bio *bio,
446 unsigned int total_size)
447{
448 struct bio_vec *bv;
449 int i, err;
450 void *data;
451 unsigned int sz;
452
453 bio_for_each_segment(bv, bio, i) {
454 sz = min(total_size, bv->bv_len);
455
456 dprintk("%s: bio: %llu/%u, total: %u, len: %u, sz: %u, "
457 "off: %u.\n", __func__, (u64)bio->bi_sector,
458 bio->bi_size, total_size, bv->bv_len, sz,
459 bv->bv_offset);
460
461 data = kmap(bv->bv_page) + bv->bv_offset;
462 err = dst_data_recv(st, data, sz);
463 kunmap(bv->bv_page);
464
465 bv->bv_len = sz;
466
467 if (err)
468 return err;
469
470 total_size -= sz;
471 if (total_size == 0)
472 break;
473 }
474
475 return 0;
476}
477
478/*
479 * Our block IO has just completed and arrived: get it.
480 */
481static int dst_process_io_response(struct dst_state *st)
482{
483 struct dst_node *n = st->node;
484 struct dst_cmd *cmd = st->data;
485 struct dst_trans *t;
486 int err = 0;
487 struct bio *bio;
488
489 mutex_lock(&n->trans_lock);
490 t = dst_trans_search(n, cmd->id);
491 mutex_unlock(&n->trans_lock);
492
493 if (!t)
494 goto err_out_exit;
495
496 bio = t->bio;
497
498 dprintk("%s: bio: %llu/%u, cmd_size: %u, csize: %u, dir: %lu.\n",
499 __func__, (u64)bio->bi_sector, bio->bi_size, cmd->size,
500 cmd->csize, bio_data_dir(bio));
501
502 if (bio_data_dir(bio) == READ) {
503 if (bio->bi_size != cmd->size - cmd->csize)
504 goto err_out_exit;
505
506 if (dst_need_crypto(n)) {
507 err = dst_recv_cdata(st, t->cmd.hash);
508 if (err)
509 goto err_out_exit;
510 }
511
512 err = dst_recv_bio(st, t->bio, bio->bi_size);
513 if (err)
514 goto err_out_exit;
515
516 if (dst_need_crypto(n))
517 return dst_trans_crypto(t);
518 } else {
519 err = -EBADMSG;
520 if (cmd->size || cmd->csize)
521 goto err_out_exit;
522 }
523
524 dst_trans_remove(t);
525 dst_trans_put(t);
526
527 return 0;
528
529err_out_exit:
530 return err;
531}
532
533/*
534 * Receive crypto data.
535 */
536int dst_recv_cdata(struct dst_state *st, void *cdata)
537{
538 struct dst_cmd *cmd = st->data;
539 struct dst_node *n = st->node;
540 struct dst_crypto_ctl *c = &n->crypto;
541 int err;
542
543 if (cmd->csize != c->crypto_attached_size) {
544 dprintk("%s: cmd: cmd: %u, sector: %llu, size: %u, "
545 "csize: %u != digest size %u.\n",
546 __func__, cmd->cmd, cmd->sector, cmd->size,
547 cmd->csize, c->crypto_attached_size);
548 err = -EINVAL;
549 goto err_out_exit;
550 }
551
552 err = dst_data_recv(st, cdata, cmd->csize);
553 if (err)
554 goto err_out_exit;
555
556 cmd->size -= cmd->csize;
557 return 0;
558
559err_out_exit:
560 return err;
561}
562
563/*
564 * Receive the command and start its processing.
565 */
566static int dst_recv_processing(struct dst_state *st)
567{
568 int err = -EINTR;
569 struct dst_cmd *cmd = st->data;
570
571 /*
572 * If socket will be reset after this statement, then
573 * dst_data_recv() will just fail and loop will
574 * start again, so it can be done without any locks.
575 *
576 * st->read_socket is needed to prevents state machine
577 * breaking between this data reading and subsequent one
578 * in protocol specific functions during connection reset.
579 * In case of reset we have to read next command and do
580 * not expect data for old command to magically appear in
581 * new connection.
582 */
583 st->read_socket = st->socket;
584 err = dst_data_recv(st, cmd, sizeof(struct dst_cmd));
585 if (err)
586 goto out_exit;
587
588 dst_convert_cmd(cmd);
589
590 dprintk("%s: cmd: %u, size: %u, csize: %u, id: %llu, "
591 "sector: %llu, flags: %llx, rw: %llx.\n",
592 __func__, cmd->cmd, cmd->size,
593 cmd->csize, cmd->id, cmd->sector,
594 cmd->flags, cmd->rw);
595
596 /*
597 * This should catch protocol breakage and random garbage
598 * instead of commands.
599 */
600 if (unlikely(cmd->csize > st->size - sizeof(struct dst_cmd))) {
601 err = -EBADMSG;
602 goto out_exit;
603 }
604
605 err = -EPROTO;
606 switch (cmd->cmd) {
607 case DST_IO_RESPONSE:
608 err = dst_process_io_response(st);
609 break;
610 case DST_IO:
611 err = dst_process_io(st);
612 break;
613 case DST_CFG:
614 err = dst_process_cfg(st);
615 break;
616 case DST_PING:
617 err = 0;
618 break;
619 default:
620 break;
621 }
622
623out_exit:
624 return err;
625}
626
627/*
628 * Receiving thread. For the client node we should try to reconnect,
629 * for accepted client we just drop the state and expect it to reconnect.
630 */
631static int dst_recv(void *init_data, void *schedule_data)
632{
633 struct dst_state *st = schedule_data;
634 struct dst_node *n = init_data;
635 int err = 0;
636
637 dprintk("%s: start st: %p, n: %p, scan: %lu, need_exit: %d.\n",
638 __func__, st, n, n->trans_scan_timeout, st->need_exit);
639
640 while (n->trans_scan_timeout && !st->need_exit) {
641 err = dst_recv_processing(st);
642 if (err < 0) {
643 if (!st->ctl.type)
644 break;
645
646 if (!n->trans_scan_timeout || st->need_exit)
647 break;
648
649 dst_state_reset(st);
650 msleep(1000);
651 }
652 }
653
654 st->need_exit = 1;
655 wake_up(&st->thread_wait);
656
657 dprintk("%s: freeing receiving socket st: %p.\n", __func__, st);
658 dst_state_lock(st);
659 dst_state_exit_connected(st);
660 dst_state_unlock(st);
661 dst_state_put(st);
662
663 dprintk("%s: freed receiving socket st: %p.\n", __func__, st);
664
665 return err;
666}
667
668/*
669 * Network state dies here and borns couple of lines below.
670 * This object is the main network state processing engine:
671 * sending, receiving, reconnections, all network related
672 * tasks are handled on behalf of the state.
673 */
674static void dst_state_free(struct dst_state *st)
675{
676 dprintk("%s: st: %p.\n", __func__, st);
677 if (st->cleanup)
678 st->cleanup(st);
679 kfree(st->data);
680 kfree(st);
681}
682
683struct dst_state *dst_state_alloc(struct dst_node *n)
684{
685 struct dst_state *st;
686 int err = -ENOMEM;
687
688 st = kzalloc(sizeof(struct dst_state), GFP_KERNEL);
689 if (!st)
690 goto err_out_exit;
691
692 st->node = n;
693 st->need_exit = 0;
694
695 st->size = PAGE_SIZE;
696 st->data = kmalloc(st->size, GFP_KERNEL);
697 if (!st->data)
698 goto err_out_free;
699
700 spin_lock_init(&st->request_lock);
701 INIT_LIST_HEAD(&st->request_list);
702
703 mutex_init(&st->state_lock);
704 init_waitqueue_head(&st->thread_wait);
705
706 /*
707 * One for processing thread, another one for node itself.
708 */
709 atomic_set(&st->refcnt, 2);
710
711 dprintk("%s: st: %p, n: %p.\n", __func__, st, st->node);
712
713 return st;
714
715err_out_free:
716 kfree(st);
717err_out_exit:
718 return ERR_PTR(err);
719}
720
721int dst_state_schedule_receiver(struct dst_state *st)
722{
723 return thread_pool_schedule_private(st->node->pool, dst_thread_setup,
724 dst_recv, st, MAX_SCHEDULE_TIMEOUT, st->node);
725}
726
727/*
728 * Initialize client's connection to the remote peer: allocate state,
729 * connect and perform block IO autoconfiguration.
730 */
731int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r)
732{
733 struct dst_state *st;
734 int err = -ENOMEM;
735
736 st = dst_state_alloc(n);
737 if (IS_ERR(st)) {
738 err = PTR_ERR(st);
739 goto err_out_exit;
740 }
741 memcpy(&st->ctl, r, sizeof(struct dst_network_ctl));
742
743 err = dst_state_init_connected(st);
744 if (err)
745 goto err_out_free_data;
746
747 err = dst_request_remote_config(st);
748 if (err)
749 goto err_out_exit_connected;
750 n->state = st;
751
752 err = dst_state_schedule_receiver(st);
753 if (err)
754 goto err_out_exit_connected;
755
756 return 0;
757
758err_out_exit_connected:
759 dst_state_exit_connected(st);
760err_out_free_data:
761 dst_state_free(st);
762err_out_exit:
763 n->state = NULL;
764 return err;
765}
766
767void dst_state_put(struct dst_state *st)
768{
769 dprintk("%s: st: %p, refcnt: %d.\n",
770 __func__, st, atomic_read(&st->refcnt));
771 if (atomic_dec_and_test(&st->refcnt))
772 dst_state_free(st);
773}
774
775/*
776 * Send block IO to the network one by one using zero-copy ->sendpage().
777 */
778int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio)
779{
780 struct bio_vec *bv;
781 struct dst_crypto_ctl *c = &st->node->crypto;
782 int err, i = 0;
783 int flags = MSG_WAITALL;
784
785 err = dst_data_send_header(st->socket, cmd,
786 sizeof(struct dst_cmd) + c->crypto_attached_size, bio->bi_vcnt);
787 if (err)
788 goto err_out_exit;
789
790 bio_for_each_segment(bv, bio, i) {
791 if (i < bio->bi_vcnt - 1)
792 flags |= MSG_MORE;
793
794 err = kernel_sendpage(st->socket, bv->bv_page, bv->bv_offset,
795 bv->bv_len, flags);
796 if (err <= 0)
797 goto err_out_exit;
798 }
799
800 return 0;
801
802err_out_exit:
803 dprintk("%s: %d/%d, flags: %x, err: %d.\n",
804 __func__, i, bio->bi_vcnt, flags, err);
805 return err;
806}
807
808/*
809 * Send transaction to the remote peer.
810 */
811int dst_trans_send(struct dst_trans *t)
812{
813 int err;
814 struct dst_state *st = t->n->state;
815 struct bio *bio = t->bio;
816
817 dst_convert_cmd(&t->cmd);
818
819 dst_state_lock(st);
820 if (!st->socket) {
821 err = dst_state_init_connected(st);
822 if (err)
823 goto err_out_unlock;
824 }
825
826 if (bio_data_dir(bio) == WRITE) {
827 err = dst_send_bio(st, &t->cmd, t->bio);
828 } else {
829 err = dst_data_send_header(st->socket, &t->cmd,
830 sizeof(struct dst_cmd), 0);
831 }
832 if (err)
833 goto err_out_reset;
834
835 dst_state_unlock(st);
836 return 0;
837
838err_out_reset:
839 dst_state_reset_nolock(st);
840err_out_unlock:
841 dst_state_unlock(st);
842
843 return err;
844}
diff --git a/drivers/staging/dst/thread_pool.c b/drivers/staging/dst/thread_pool.c
deleted file mode 100644
index 29a82b2602f3..000000000000
--- a/drivers/staging/dst/thread_pool.c
+++ /dev/null
@@ -1,348 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/kernel.h>
17#include <linux/dst.h>
18#include <linux/kthread.h>
19#include <linux/slab.h>
20
21/*
22 * Thread pool abstraction allows to schedule a work to be performed
23 * on behalf of kernel thread. One does not operate with threads itself,
24 * instead user provides setup and cleanup callbacks for thread pool itself,
25 * and action and cleanup callbacks for each submitted work.
26 *
27 * Each worker has private data initialized at creation time and data,
28 * provided by user at scheduling time.
29 *
30 * When action is being performed, thread can not be used by other users,
31 * instead they will sleep until there is free thread to pick their work.
32 */
33struct thread_pool_worker {
34 struct list_head worker_entry;
35
36 struct task_struct *thread;
37
38 struct thread_pool *pool;
39
40 int error;
41 int has_data;
42 int need_exit;
43 unsigned int id;
44
45 wait_queue_head_t wait;
46
47 void *private;
48 void *schedule_data;
49
50 int (*action)(void *private, void *schedule_data);
51 void (*cleanup)(void *private);
52};
53
54static void thread_pool_exit_worker(struct thread_pool_worker *w)
55{
56 kthread_stop(w->thread);
57
58 w->cleanup(w->private);
59 kfree(w);
60}
61
62/*
63 * Called to mark thread as ready and allow users to schedule new work.
64 */
65static void thread_pool_worker_make_ready(struct thread_pool_worker *w)
66{
67 struct thread_pool *p = w->pool;
68
69 mutex_lock(&p->thread_lock);
70
71 if (!w->need_exit) {
72 list_move_tail(&w->worker_entry, &p->ready_list);
73 w->has_data = 0;
74 mutex_unlock(&p->thread_lock);
75
76 wake_up(&p->wait);
77 } else {
78 p->thread_num--;
79 list_del(&w->worker_entry);
80 mutex_unlock(&p->thread_lock);
81
82 thread_pool_exit_worker(w);
83 }
84}
85
86/*
87 * Thread action loop: waits until there is new work.
88 */
89static int thread_pool_worker_func(void *data)
90{
91 struct thread_pool_worker *w = data;
92
93 while (!kthread_should_stop()) {
94 wait_event_interruptible(w->wait,
95 kthread_should_stop() || w->has_data);
96
97 if (kthread_should_stop())
98 break;
99
100 if (!w->has_data)
101 continue;
102
103 w->action(w->private, w->schedule_data);
104 thread_pool_worker_make_ready(w);
105 }
106
107 return 0;
108}
109
110/*
111 * Remove single worker without specifying which one.
112 */
113void thread_pool_del_worker(struct thread_pool *p)
114{
115 struct thread_pool_worker *w = NULL;
116
117 while (!w && p->thread_num) {
118 wait_event(p->wait, !list_empty(&p->ready_list) ||
119 !p->thread_num);
120
121 dprintk("%s: locking list_empty: %d, thread_num: %d.\n",
122 __func__, list_empty(&p->ready_list),
123 p->thread_num);
124
125 mutex_lock(&p->thread_lock);
126 if (!list_empty(&p->ready_list)) {
127 w = list_first_entry(&p->ready_list,
128 struct thread_pool_worker,
129 worker_entry);
130
131 dprintk("%s: deleting w: %p, thread_num: %d, "
132 "list: %p [%p.%p].\n", __func__,
133 w, p->thread_num, &p->ready_list,
134 p->ready_list.prev, p->ready_list.next);
135
136 p->thread_num--;
137 list_del(&w->worker_entry);
138 }
139 mutex_unlock(&p->thread_lock);
140 }
141
142 if (w)
143 thread_pool_exit_worker(w);
144 dprintk("%s: deleted w: %p, thread_num: %d.\n",
145 __func__, w, p->thread_num);
146}
147
148/*
149 * Remove a worker with given ID.
150 */
151void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id)
152{
153 struct thread_pool_worker *w;
154 int found = 0;
155
156 mutex_lock(&p->thread_lock);
157 list_for_each_entry(w, &p->ready_list, worker_entry) {
158 if (w->id == id) {
159 found = 1;
160 p->thread_num--;
161 list_del(&w->worker_entry);
162 break;
163 }
164 }
165
166 if (!found) {
167 list_for_each_entry(w, &p->active_list, worker_entry) {
168 if (w->id == id) {
169 w->need_exit = 1;
170 break;
171 }
172 }
173 }
174 mutex_unlock(&p->thread_lock);
175
176 if (found)
177 thread_pool_exit_worker(w);
178}
179
180/*
181 * Add new worker thread with given parameters.
182 * If initialization callback fails, return error.
183 */
184int thread_pool_add_worker(struct thread_pool *p,
185 char *name,
186 unsigned int id,
187 void *(*init)(void *private),
188 void (*cleanup)(void *private),
189 void *private)
190{
191 struct thread_pool_worker *w;
192 int err = -ENOMEM;
193
194 w = kzalloc(sizeof(struct thread_pool_worker), GFP_KERNEL);
195 if (!w)
196 goto err_out_exit;
197
198 w->pool = p;
199 init_waitqueue_head(&w->wait);
200 w->cleanup = cleanup;
201 w->id = id;
202
203 w->thread = kthread_run(thread_pool_worker_func, w, "%s", name);
204 if (IS_ERR(w->thread)) {
205 err = PTR_ERR(w->thread);
206 goto err_out_free;
207 }
208
209 w->private = init(private);
210 if (IS_ERR(w->private)) {
211 err = PTR_ERR(w->private);
212 goto err_out_stop_thread;
213 }
214
215 mutex_lock(&p->thread_lock);
216 list_add_tail(&w->worker_entry, &p->ready_list);
217 p->thread_num++;
218 mutex_unlock(&p->thread_lock);
219
220 return 0;
221
222err_out_stop_thread:
223 kthread_stop(w->thread);
224err_out_free:
225 kfree(w);
226err_out_exit:
227 return err;
228}
229
230/*
231 * Destroy the whole pool.
232 */
233void thread_pool_destroy(struct thread_pool *p)
234{
235 while (p->thread_num) {
236 dprintk("%s: num: %d.\n", __func__, p->thread_num);
237 thread_pool_del_worker(p);
238 }
239
240 kfree(p);
241}
242
243/*
244 * Create a pool with given number of threads.
245 * They will have sequential IDs started from zero.
246 */
247struct thread_pool *thread_pool_create(int num, char *name,
248 void *(*init)(void *private),
249 void (*cleanup)(void *private),
250 void *private)
251{
252 struct thread_pool_worker *w, *tmp;
253 struct thread_pool *p;
254 int err = -ENOMEM;
255 int i;
256
257 p = kzalloc(sizeof(struct thread_pool), GFP_KERNEL);
258 if (!p)
259 goto err_out_exit;
260
261 init_waitqueue_head(&p->wait);
262 mutex_init(&p->thread_lock);
263 INIT_LIST_HEAD(&p->ready_list);
264 INIT_LIST_HEAD(&p->active_list);
265 p->thread_num = 0;
266
267 for (i = 0; i < num; ++i) {
268 err = thread_pool_add_worker(p, name, i, init,
269 cleanup, private);
270 if (err)
271 goto err_out_free_all;
272 }
273
274 return p;
275
276err_out_free_all:
277 list_for_each_entry_safe(w, tmp, &p->ready_list, worker_entry) {
278 list_del(&w->worker_entry);
279 thread_pool_exit_worker(w);
280 }
281 kfree(p);
282err_out_exit:
283 return ERR_PTR(err);
284}
285
286/*
287 * Schedule execution of the action on a given thread,
288 * provided ID pointer has to match previously stored
289 * private data.
290 */
291int thread_pool_schedule_private(struct thread_pool *p,
292 int (*setup)(void *private, void *data),
293 int (*action)(void *private, void *data),
294 void *data, long timeout, void *id)
295{
296 struct thread_pool_worker *w, *tmp, *worker = NULL;
297 int err = 0;
298
299 while (!worker && !err) {
300 timeout = wait_event_interruptible_timeout(p->wait,
301 !list_empty(&p->ready_list),
302 timeout);
303
304 if (!timeout) {
305 err = -ETIMEDOUT;
306 break;
307 }
308
309 worker = NULL;
310 mutex_lock(&p->thread_lock);
311 list_for_each_entry_safe(w, tmp, &p->ready_list, worker_entry) {
312 if (id && id != w->private)
313 continue;
314
315 worker = w;
316
317 list_move_tail(&w->worker_entry, &p->active_list);
318
319 err = setup(w->private, data);
320 if (!err) {
321 w->schedule_data = data;
322 w->action = action;
323 w->has_data = 1;
324 wake_up(&w->wait);
325 } else {
326 list_move_tail(&w->worker_entry,
327 &p->ready_list);
328 }
329
330 break;
331 }
332 mutex_unlock(&p->thread_lock);
333 }
334
335 return err;
336}
337
338/*
339 * Schedule execution on arbitrary thread from the pool.
340 */
341int thread_pool_schedule(struct thread_pool *p,
342 int (*setup)(void *private, void *data),
343 int (*action)(void *private, void *data),
344 void *data, long timeout)
345{
346 return thread_pool_schedule_private(p, setup,
347 action, data, timeout, NULL);
348}
diff --git a/drivers/staging/dst/trans.c b/drivers/staging/dst/trans.c
deleted file mode 100644
index 1c36a6bc31d5..000000000000
--- a/drivers/staging/dst/trans.c
+++ /dev/null
@@ -1,337 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/bio.h>
17#include <linux/dst.h>
18#include <linux/slab.h>
19#include <linux/mempool.h>
20
21/*
22 * Transaction memory pool size.
23 */
24static int dst_mempool_num = 32;
25module_param(dst_mempool_num, int, 0644);
26
27/*
28 * Transaction tree management.
29 */
30static inline int dst_trans_cmp(dst_gen_t gen, dst_gen_t new)
31{
32 if (gen < new)
33 return 1;
34 if (gen > new)
35 return -1;
36 return 0;
37}
38
39struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen)
40{
41 struct rb_root *root = &node->trans_root;
42 struct rb_node *n = root->rb_node;
43 struct dst_trans *t, *ret = NULL;
44 int cmp;
45
46 while (n) {
47 t = rb_entry(n, struct dst_trans, trans_entry);
48
49 cmp = dst_trans_cmp(t->gen, gen);
50 if (cmp < 0)
51 n = n->rb_left;
52 else if (cmp > 0)
53 n = n->rb_right;
54 else {
55 ret = t;
56 break;
57 }
58 }
59
60 dprintk("%s: %s transaction: id: %llu.\n", __func__,
61 (ret) ? "found" : "not found", gen);
62
63 return ret;
64}
65
66static int dst_trans_insert(struct dst_trans *new)
67{
68 struct rb_root *root = &new->n->trans_root;
69 struct rb_node **n = &root->rb_node, *parent = NULL;
70 struct dst_trans *ret = NULL, *t;
71 int cmp;
72
73 while (*n) {
74 parent = *n;
75
76 t = rb_entry(parent, struct dst_trans, trans_entry);
77
78 cmp = dst_trans_cmp(t->gen, new->gen);
79 if (cmp < 0)
80 n = &parent->rb_left;
81 else if (cmp > 0)
82 n = &parent->rb_right;
83 else {
84 ret = t;
85 break;
86 }
87 }
88
89 new->send_time = jiffies;
90 if (ret) {
91 printk(KERN_DEBUG "%s: exist: old: gen: %llu, bio: %llu/%u, "
92 "send_time: %lu, new: gen: %llu, bio: %llu/%u, "
93 "send_time: %lu.\n", __func__,
94 ret->gen, (u64)ret->bio->bi_sector,
95 ret->bio->bi_size, ret->send_time,
96 new->gen, (u64)new->bio->bi_sector,
97 new->bio->bi_size, new->send_time);
98 return -EEXIST;
99 }
100
101 rb_link_node(&new->trans_entry, parent, n);
102 rb_insert_color(&new->trans_entry, root);
103
104 dprintk("%s: inserted: gen: %llu, bio: %llu/%u, send_time: %lu.\n",
105 __func__, new->gen, (u64)new->bio->bi_sector,
106 new->bio->bi_size, new->send_time);
107
108 return 0;
109}
110
111int dst_trans_remove_nolock(struct dst_trans *t)
112{
113 struct dst_node *n = t->n;
114
115 if (t->trans_entry.rb_parent_color) {
116 rb_erase(&t->trans_entry, &n->trans_root);
117 t->trans_entry.rb_parent_color = 0;
118 }
119 return 0;
120}
121
122int dst_trans_remove(struct dst_trans *t)
123{
124 int ret;
125 struct dst_node *n = t->n;
126
127 mutex_lock(&n->trans_lock);
128 ret = dst_trans_remove_nolock(t);
129 mutex_unlock(&n->trans_lock);
130
131 return ret;
132}
133
134/*
135 * When transaction is completed and there are no more users,
136 * we complete appriate block IO request with given error status.
137 */
138void dst_trans_put(struct dst_trans *t)
139{
140 if (atomic_dec_and_test(&t->refcnt)) {
141 struct bio *bio = t->bio;
142
143 dprintk("%s: completed t: %p, gen: %llu, bio: %p.\n",
144 __func__, t, t->gen, bio);
145
146 bio_endio(bio, t->error);
147 bio_put(bio);
148
149 dst_node_put(t->n);
150 mempool_free(t, t->n->trans_pool);
151 }
152}
153
154/*
155 * Process given block IO request: allocate transaction, insert it into the tree
156 * and send/schedule crypto processing.
157 */
158int dst_process_bio(struct dst_node *n, struct bio *bio)
159{
160 struct dst_trans *t;
161 int err = -ENOMEM;
162
163 t = mempool_alloc(n->trans_pool, GFP_NOFS);
164 if (!t)
165 goto err_out_exit;
166
167 t->n = dst_node_get(n);
168 t->bio = bio;
169 t->error = 0;
170 t->retries = 0;
171 atomic_set(&t->refcnt, 1);
172 t->gen = atomic_long_inc_return(&n->gen);
173
174 t->enc = bio_data_dir(bio);
175 dst_bio_to_cmd(bio, &t->cmd, DST_IO, t->gen);
176
177 mutex_lock(&n->trans_lock);
178 err = dst_trans_insert(t);
179 mutex_unlock(&n->trans_lock);
180 if (err)
181 goto err_out_free;
182
183 dprintk("%s: gen: %llu, bio: %llu/%u, dir/enc: %d, need_crypto: %d.\n",
184 __func__, t->gen, (u64)bio->bi_sector,
185 bio->bi_size, t->enc, dst_need_crypto(n));
186
187 if (dst_need_crypto(n) && t->enc)
188 dst_trans_crypto(t);
189 else
190 dst_trans_send(t);
191
192 return 0;
193
194err_out_free:
195 dst_node_put(n);
196 mempool_free(t, n->trans_pool);
197err_out_exit:
198 bio_endio(bio, err);
199 bio_put(bio);
200 return err;
201}
202
203/*
204 * Scan for timeout/stale transactions.
205 * Each transaction is being resent multiple times before error completion.
206 */
207static void dst_trans_scan(struct work_struct *work)
208{
209 struct dst_node *n = container_of(work, struct dst_node,
210 trans_work.work);
211 struct rb_node *rb_node;
212 struct dst_trans *t;
213 unsigned long timeout = n->trans_scan_timeout;
214 int num = 10 * n->trans_max_retries;
215
216 mutex_lock(&n->trans_lock);
217
218 for (rb_node = rb_first(&n->trans_root); rb_node; ) {
219 t = rb_entry(rb_node, struct dst_trans, trans_entry);
220
221 if (timeout && time_after(t->send_time + timeout, jiffies)
222 && t->retries == 0)
223 break;
224#if 0
225 dprintk("%s: t: %p, gen: %llu, n: %s, retries: %u, max: %u.\n",
226 __func__, t, t->gen, n->name,
227 t->retries, n->trans_max_retries);
228#endif
229 if (--num == 0)
230 break;
231
232 dst_trans_get(t);
233
234 rb_node = rb_next(rb_node);
235
236 if (timeout && (++t->retries < n->trans_max_retries)) {
237 dst_trans_send(t);
238 } else {
239 t->error = -ETIMEDOUT;
240 dst_trans_remove_nolock(t);
241 dst_trans_put(t);
242 }
243
244 dst_trans_put(t);
245 }
246
247 mutex_unlock(&n->trans_lock);
248
249 /*
250 * If no timeout specified then system is in the middle of exiting
251 * process, so no need to reschedule scanning process again.
252 */
253 if (timeout) {
254 if (!num)
255 timeout = HZ;
256 schedule_delayed_work(&n->trans_work, timeout);
257 }
258}
259
260/*
261 * Flush all transactions and mark them as timed out.
262 * Destroy transaction pools.
263 */
264void dst_node_trans_exit(struct dst_node *n)
265{
266 struct dst_trans *t;
267 struct rb_node *rb_node;
268
269 if (!n->trans_cache)
270 return;
271
272 dprintk("%s: n: %p, cancelling the work.\n", __func__, n);
273 cancel_delayed_work_sync(&n->trans_work);
274 flush_scheduled_work();
275 dprintk("%s: n: %p, work has been cancelled.\n", __func__, n);
276
277 for (rb_node = rb_first(&n->trans_root); rb_node; ) {
278 t = rb_entry(rb_node, struct dst_trans, trans_entry);
279
280 dprintk("%s: t: %p, gen: %llu, n: %s.\n",
281 __func__, t, t->gen, n->name);
282
283 rb_node = rb_next(rb_node);
284
285 t->error = -ETIMEDOUT;
286 dst_trans_remove_nolock(t);
287 dst_trans_put(t);
288 }
289
290 mempool_destroy(n->trans_pool);
291 kmem_cache_destroy(n->trans_cache);
292}
293
294/*
295 * Initialize transaction storage for given node.
296 * Transaction stores not only control information,
297 * but also network command and crypto data (if needed)
298 * to reduce number of allocations. Thus transaction size
299 * differs from node to node.
300 */
301int dst_node_trans_init(struct dst_node *n, unsigned int size)
302{
303 /*
304 * We need this, since node with given name can be dropped from the
305 * hash table, but be still alive, so subsequent creation of the node
306 * with the same name may collide with existing cache name.
307 */
308
309 snprintf(n->cache_name, sizeof(n->cache_name), "%s-%p", n->name, n);
310
311 n->trans_cache = kmem_cache_create(n->cache_name,
312 size + n->crypto.crypto_attached_size,
313 0, 0, NULL);
314 if (!n->trans_cache)
315 goto err_out_exit;
316
317 n->trans_pool = mempool_create_slab_pool(dst_mempool_num,
318 n->trans_cache);
319 if (!n->trans_pool)
320 goto err_out_cache_destroy;
321
322 mutex_init(&n->trans_lock);
323 n->trans_root = RB_ROOT;
324
325 INIT_DELAYED_WORK(&n->trans_work, dst_trans_scan);
326 schedule_delayed_work(&n->trans_work, n->trans_scan_timeout);
327
328 dprintk("%s: n: %p, size: %u, crypto: %u.\n",
329 __func__, n, size, n->crypto.crypto_attached_size);
330
331 return 0;
332
333err_out_cache_destroy:
334 kmem_cache_destroy(n->trans_cache);
335err_out_exit:
336 return -ENOMEM;
337}
diff --git a/drivers/staging/iio/ring_sw.h b/drivers/staging/iio/ring_sw.h
index f0b86f02cd80..fd677f008365 100644
--- a/drivers/staging/iio/ring_sw.h
+++ b/drivers/staging/iio/ring_sw.h
@@ -29,7 +29,6 @@
29 * driver requests - some may support multiple options */ 29 * driver requests - some may support multiple options */
30 30
31 31
32#include <linux/autoconf.h>
33#include "iio.h" 32#include "iio.h"
34#include "ring_generic.h" 33#include "ring_generic.h"
35 34
diff --git a/drivers/staging/octeon/Kconfig b/drivers/staging/octeon/Kconfig
index 536e2382de54..638ad6b35891 100644
--- a/drivers/staging/octeon/Kconfig
+++ b/drivers/staging/octeon/Kconfig
@@ -1,7 +1,8 @@
1config OCTEON_ETHERNET 1config OCTEON_ETHERNET
2 tristate "Cavium Networks Octeon Ethernet support" 2 tristate "Cavium Networks Octeon Ethernet support"
3 depends on CPU_CAVIUM_OCTEON 3 depends on CPU_CAVIUM_OCTEON
4 select MII 4 select PHYLIB
5 select MDIO_OCTEON
5 help 6 help
6 This driver supports the builtin ethernet ports on Cavium 7 This driver supports the builtin ethernet ports on Cavium
7 Networks' products in the Octeon family. This driver supports the 8 Networks' products in the Octeon family. This driver supports the
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 31a58e508924..05a5cc0f43ed 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -26,7 +26,8 @@
26**********************************************************************/ 26**********************************************************************/
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/ethtool.h> 28#include <linux/ethtool.h>
29#include <linux/mii.h> 29#include <linux/phy.h>
30
30#include <net/dst.h> 31#include <net/dst.h>
31 32
32#include <asm/octeon/octeon.h> 33#include <asm/octeon/octeon.h>
@@ -34,86 +35,12 @@
34#include "ethernet-defines.h" 35#include "ethernet-defines.h"
35#include "octeon-ethernet.h" 36#include "octeon-ethernet.h"
36#include "ethernet-mdio.h" 37#include "ethernet-mdio.h"
38#include "ethernet-util.h"
37 39
38#include "cvmx-helper-board.h" 40#include "cvmx-helper-board.h"
39 41
40#include "cvmx-smix-defs.h" 42#include "cvmx-smix-defs.h"
41 43
42DECLARE_MUTEX(mdio_sem);
43
44/**
45 * Perform an MII read. Called by the generic MII routines
46 *
47 * @dev: Device to perform read for
48 * @phy_id: The MII phy id
49 * @location: Register location to read
50 * Returns Result from the read or zero on failure
51 */
52static int cvm_oct_mdio_read(struct net_device *dev, int phy_id, int location)
53{
54 union cvmx_smix_cmd smi_cmd;
55 union cvmx_smix_rd_dat smi_rd;
56
57 smi_cmd.u64 = 0;
58 smi_cmd.s.phy_op = 1;
59 smi_cmd.s.phy_adr = phy_id;
60 smi_cmd.s.reg_adr = location;
61 cvmx_write_csr(CVMX_SMIX_CMD(0), smi_cmd.u64);
62
63 do {
64 if (!in_interrupt())
65 yield();
66 smi_rd.u64 = cvmx_read_csr(CVMX_SMIX_RD_DAT(0));
67 } while (smi_rd.s.pending);
68
69 if (smi_rd.s.val)
70 return smi_rd.s.dat;
71 else
72 return 0;
73}
74
75static int cvm_oct_mdio_dummy_read(struct net_device *dev, int phy_id,
76 int location)
77{
78 return 0xffff;
79}
80
81/**
82 * Perform an MII write. Called by the generic MII routines
83 *
84 * @dev: Device to perform write for
85 * @phy_id: The MII phy id
86 * @location: Register location to write
87 * @val: Value to write
88 */
89static void cvm_oct_mdio_write(struct net_device *dev, int phy_id, int location,
90 int val)
91{
92 union cvmx_smix_cmd smi_cmd;
93 union cvmx_smix_wr_dat smi_wr;
94
95 smi_wr.u64 = 0;
96 smi_wr.s.dat = val;
97 cvmx_write_csr(CVMX_SMIX_WR_DAT(0), smi_wr.u64);
98
99 smi_cmd.u64 = 0;
100 smi_cmd.s.phy_op = 0;
101 smi_cmd.s.phy_adr = phy_id;
102 smi_cmd.s.reg_adr = location;
103 cvmx_write_csr(CVMX_SMIX_CMD(0), smi_cmd.u64);
104
105 do {
106 if (!in_interrupt())
107 yield();
108 smi_wr.u64 = cvmx_read_csr(CVMX_SMIX_WR_DAT(0));
109 } while (smi_wr.s.pending);
110}
111
112static void cvm_oct_mdio_dummy_write(struct net_device *dev, int phy_id,
113 int location, int val)
114{
115}
116
117static void cvm_oct_get_drvinfo(struct net_device *dev, 44static void cvm_oct_get_drvinfo(struct net_device *dev,
118 struct ethtool_drvinfo *info) 45 struct ethtool_drvinfo *info)
119{ 46{
@@ -125,49 +52,37 @@ static void cvm_oct_get_drvinfo(struct net_device *dev,
125static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 52static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
126{ 53{
127 struct octeon_ethernet *priv = netdev_priv(dev); 54 struct octeon_ethernet *priv = netdev_priv(dev);
128 int ret;
129 55
130 down(&mdio_sem); 56 if (priv->phydev)
131 ret = mii_ethtool_gset(&priv->mii_info, cmd); 57 return phy_ethtool_gset(priv->phydev, cmd);
132 up(&mdio_sem);
133 58
134 return ret; 59 return -EINVAL;
135} 60}
136 61
137static int cvm_oct_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 62static int cvm_oct_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
138{ 63{
139 struct octeon_ethernet *priv = netdev_priv(dev); 64 struct octeon_ethernet *priv = netdev_priv(dev);
140 int ret;
141 65
142 down(&mdio_sem); 66 if (!capable(CAP_NET_ADMIN))
143 ret = mii_ethtool_sset(&priv->mii_info, cmd); 67 return -EPERM;
144 up(&mdio_sem); 68
69 if (priv->phydev)
70 return phy_ethtool_sset(priv->phydev, cmd);
145 71
146 return ret; 72 return -EINVAL;
147} 73}
148 74
149static int cvm_oct_nway_reset(struct net_device *dev) 75static int cvm_oct_nway_reset(struct net_device *dev)
150{ 76{
151 struct octeon_ethernet *priv = netdev_priv(dev); 77 struct octeon_ethernet *priv = netdev_priv(dev);
152 int ret;
153 78
154 down(&mdio_sem); 79 if (!capable(CAP_NET_ADMIN))
155 ret = mii_nway_restart(&priv->mii_info); 80 return -EPERM;
156 up(&mdio_sem);
157 81
158 return ret; 82 if (priv->phydev)
159} 83 return phy_start_aneg(priv->phydev);
160 84
161static u32 cvm_oct_get_link(struct net_device *dev) 85 return -EINVAL;
162{
163 struct octeon_ethernet *priv = netdev_priv(dev);
164 u32 ret;
165
166 down(&mdio_sem);
167 ret = mii_link_ok(&priv->mii_info);
168 up(&mdio_sem);
169
170 return ret;
171} 86}
172 87
173const struct ethtool_ops cvm_oct_ethtool_ops = { 88const struct ethtool_ops cvm_oct_ethtool_ops = {
@@ -175,7 +90,7 @@ const struct ethtool_ops cvm_oct_ethtool_ops = {
175 .get_settings = cvm_oct_get_settings, 90 .get_settings = cvm_oct_get_settings,
176 .set_settings = cvm_oct_set_settings, 91 .set_settings = cvm_oct_set_settings,
177 .nway_reset = cvm_oct_nway_reset, 92 .nway_reset = cvm_oct_nway_reset,
178 .get_link = cvm_oct_get_link, 93 .get_link = ethtool_op_get_link,
179 .get_sg = ethtool_op_get_sg, 94 .get_sg = ethtool_op_get_sg,
180 .get_tx_csum = ethtool_op_get_tx_csum, 95 .get_tx_csum = ethtool_op_get_tx_csum,
181}; 96};
@@ -191,41 +106,78 @@ const struct ethtool_ops cvm_oct_ethtool_ops = {
191int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 106int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
192{ 107{
193 struct octeon_ethernet *priv = netdev_priv(dev); 108 struct octeon_ethernet *priv = netdev_priv(dev);
194 struct mii_ioctl_data *data = if_mii(rq);
195 unsigned int duplex_chg;
196 int ret;
197 109
198 down(&mdio_sem); 110 if (!netif_running(dev))
199 ret = generic_mii_ioctl(&priv->mii_info, data, cmd, &duplex_chg); 111 return -EINVAL;
200 up(&mdio_sem); 112
113 if (!priv->phydev)
114 return -EINVAL;
115
116 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
117}
201 118
202 return ret; 119static void cvm_oct_adjust_link(struct net_device *dev)
120{
121 struct octeon_ethernet *priv = netdev_priv(dev);
122 cvmx_helper_link_info_t link_info;
123
124 if (priv->last_link != priv->phydev->link) {
125 priv->last_link = priv->phydev->link;
126 link_info.u64 = 0;
127 link_info.s.link_up = priv->last_link ? 1 : 0;
128 link_info.s.full_duplex = priv->phydev->duplex ? 1 : 0;
129 link_info.s.speed = priv->phydev->speed;
130 cvmx_helper_link_set( priv->port, link_info);
131 if (priv->last_link) {
132 netif_carrier_on(dev);
133 if (priv->queue != -1)
134 DEBUGPRINT("%s: %u Mbps %s duplex, "
135 "port %2d, queue %2d\n",
136 dev->name, priv->phydev->speed,
137 priv->phydev->duplex ?
138 "Full" : "Half",
139 priv->port, priv->queue);
140 else
141 DEBUGPRINT("%s: %u Mbps %s duplex, "
142 "port %2d, POW\n",
143 dev->name, priv->phydev->speed,
144 priv->phydev->duplex ?
145 "Full" : "Half",
146 priv->port);
147 } else {
148 netif_carrier_off(dev);
149 DEBUGPRINT("%s: Link down\n", dev->name);
150 }
151 }
203} 152}
204 153
154
205/** 155/**
206 * Setup the MDIO device structures 156 * Setup the PHY
207 * 157 *
208 * @dev: Device to setup 158 * @dev: Device to setup
209 * 159 *
210 * Returns Zero on success, negative on failure 160 * Returns Zero on success, negative on failure
211 */ 161 */
212int cvm_oct_mdio_setup_device(struct net_device *dev) 162int cvm_oct_phy_setup_device(struct net_device *dev)
213{ 163{
214 struct octeon_ethernet *priv = netdev_priv(dev); 164 struct octeon_ethernet *priv = netdev_priv(dev);
215 int phy_id = cvmx_helper_board_get_mii_address(priv->port); 165
216 if (phy_id != -1) { 166 int phy_addr = cvmx_helper_board_get_mii_address(priv->port);
217 priv->mii_info.dev = dev; 167 if (phy_addr != -1) {
218 priv->mii_info.phy_id = phy_id; 168 char phy_id[20];
219 priv->mii_info.phy_id_mask = 0xff; 169
220 priv->mii_info.supports_gmii = 1; 170 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", phy_addr);
221 priv->mii_info.reg_num_mask = 0x1f; 171
222 priv->mii_info.mdio_read = cvm_oct_mdio_read; 172 priv->phydev = phy_connect(dev, phy_id, cvm_oct_adjust_link, 0,
223 priv->mii_info.mdio_write = cvm_oct_mdio_write; 173 PHY_INTERFACE_MODE_GMII);
224 } else { 174
225 /* Supply dummy MDIO routines so the kernel won't crash 175 if (IS_ERR(priv->phydev)) {
226 if the user tries to read them */ 176 priv->phydev = NULL;
227 priv->mii_info.mdio_read = cvm_oct_mdio_dummy_read; 177 return -1;
228 priv->mii_info.mdio_write = cvm_oct_mdio_dummy_write; 178 }
179 priv->last_link = 0;
180 phy_start_aneg(priv->phydev);
229 } 181 }
230 return 0; 182 return 0;
231} 183}
diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h
index b3328aeec2df..55d0614a7cd9 100644
--- a/drivers/staging/octeon/ethernet-mdio.h
+++ b/drivers/staging/octeon/ethernet-mdio.h
@@ -43,4 +43,4 @@
43 43
44extern const struct ethtool_ops cvm_oct_ethtool_ops; 44extern const struct ethtool_ops cvm_oct_ethtool_ops;
45int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 45int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
46int cvm_oct_mdio_setup_device(struct net_device *dev); 46int cvm_oct_phy_setup_device(struct net_device *dev);
diff --git a/drivers/staging/octeon/ethernet-proc.c b/drivers/staging/octeon/ethernet-proc.c
index 8fa88fc419b7..16308d484d3b 100644
--- a/drivers/staging/octeon/ethernet-proc.c
+++ b/drivers/staging/octeon/ethernet-proc.c
@@ -25,7 +25,6 @@
25 * Contact Cavium Networks for more information 25 * Contact Cavium Networks for more information
26**********************************************************************/ 26**********************************************************************/
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/mii.h>
29#include <linux/seq_file.h> 28#include <linux/seq_file.h>
30#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
31#include <net/dst.h> 30#include <net/dst.h>
@@ -38,112 +37,6 @@
38#include "cvmx-helper.h" 37#include "cvmx-helper.h"
39#include "cvmx-pip.h" 38#include "cvmx-pip.h"
40 39
41static unsigned long long cvm_oct_stats_read_switch(struct net_device *dev,
42 int phy_id, int offset)
43{
44 struct octeon_ethernet *priv = netdev_priv(dev);
45
46 priv->mii_info.mdio_write(dev, phy_id, 0x1d, 0xcc00 | offset);
47 return ((uint64_t) priv->mii_info.
48 mdio_read(dev, phy_id,
49 0x1e) << 16) | (uint64_t) priv->mii_info.
50 mdio_read(dev, phy_id, 0x1f);
51}
52
53static int cvm_oct_stats_switch_show(struct seq_file *m, void *v)
54{
55 static const int ports[] = { 0, 1, 2, 3, 9, -1 };
56 struct net_device *dev = cvm_oct_device[0];
57 int index = 0;
58
59 while (ports[index] != -1) {
60
61 /* Latch port */
62 struct octeon_ethernet *priv = netdev_priv(dev);
63
64 priv->mii_info.mdio_write(dev, 0x1b, 0x1d,
65 0xdc00 | ports[index]);
66 seq_printf(m, "\nSwitch Port %d\n", ports[index]);
67 seq_printf(m, "InGoodOctets: %12llu\t"
68 "OutOctets: %12llu\t"
69 "64 Octets: %12llu\n",
70 cvm_oct_stats_read_switch(dev, 0x1b,
71 0x00) |
72 (cvm_oct_stats_read_switch(dev, 0x1b, 0x01) << 32),
73 cvm_oct_stats_read_switch(dev, 0x1b,
74 0x0E) |
75 (cvm_oct_stats_read_switch(dev, 0x1b, 0x0F) << 32),
76 cvm_oct_stats_read_switch(dev, 0x1b, 0x08));
77
78 seq_printf(m, "InBadOctets: %12llu\t"
79 "OutUnicast: %12llu\t"
80 "65-127 Octets: %12llu\n",
81 cvm_oct_stats_read_switch(dev, 0x1b, 0x02),
82 cvm_oct_stats_read_switch(dev, 0x1b, 0x10),
83 cvm_oct_stats_read_switch(dev, 0x1b, 0x09));
84
85 seq_printf(m, "InUnicast: %12llu\t"
86 "OutBroadcasts: %12llu\t"
87 "128-255 Octets: %12llu\n",
88 cvm_oct_stats_read_switch(dev, 0x1b, 0x04),
89 cvm_oct_stats_read_switch(dev, 0x1b, 0x13),
90 cvm_oct_stats_read_switch(dev, 0x1b, 0x0A));
91
92 seq_printf(m, "InBroadcasts: %12llu\t"
93 "OutMulticasts: %12llu\t"
94 "256-511 Octets: %12llu\n",
95 cvm_oct_stats_read_switch(dev, 0x1b, 0x06),
96 cvm_oct_stats_read_switch(dev, 0x1b, 0x12),
97 cvm_oct_stats_read_switch(dev, 0x1b, 0x0B));
98
99 seq_printf(m, "InMulticasts: %12llu\t"
100 "OutPause: %12llu\t"
101 "512-1023 Octets:%12llu\n",
102 cvm_oct_stats_read_switch(dev, 0x1b, 0x07),
103 cvm_oct_stats_read_switch(dev, 0x1b, 0x15),
104 cvm_oct_stats_read_switch(dev, 0x1b, 0x0C));
105
106 seq_printf(m, "InPause: %12llu\t"
107 "Excessive: %12llu\t"
108 "1024-Max Octets:%12llu\n",
109 cvm_oct_stats_read_switch(dev, 0x1b, 0x16),
110 cvm_oct_stats_read_switch(dev, 0x1b, 0x11),
111 cvm_oct_stats_read_switch(dev, 0x1b, 0x0D));
112
113 seq_printf(m, "InUndersize: %12llu\t"
114 "Collisions: %12llu\n",
115 cvm_oct_stats_read_switch(dev, 0x1b, 0x18),
116 cvm_oct_stats_read_switch(dev, 0x1b, 0x1E));
117
118 seq_printf(m, "InFragments: %12llu\t"
119 "Deferred: %12llu\n",
120 cvm_oct_stats_read_switch(dev, 0x1b, 0x19),
121 cvm_oct_stats_read_switch(dev, 0x1b, 0x05));
122
123 seq_printf(m, "InOversize: %12llu\t"
124 "Single: %12llu\n",
125 cvm_oct_stats_read_switch(dev, 0x1b, 0x1A),
126 cvm_oct_stats_read_switch(dev, 0x1b, 0x14));
127
128 seq_printf(m, "InJabber: %12llu\t"
129 "Multiple: %12llu\n",
130 cvm_oct_stats_read_switch(dev, 0x1b, 0x1B),
131 cvm_oct_stats_read_switch(dev, 0x1b, 0x17));
132
133 seq_printf(m, "In RxErr: %12llu\t"
134 "OutFCSErr: %12llu\n",
135 cvm_oct_stats_read_switch(dev, 0x1b, 0x1C),
136 cvm_oct_stats_read_switch(dev, 0x1b, 0x03));
137
138 seq_printf(m, "InFCSErr: %12llu\t"
139 "Late: %12llu\n",
140 cvm_oct_stats_read_switch(dev, 0x1b, 0x1D),
141 cvm_oct_stats_read_switch(dev, 0x1b, 0x1F));
142 index++;
143 }
144 return 0;
145}
146
147/** 40/**
148 * User is reading /proc/octeon_ethernet_stats 41 * User is reading /proc/octeon_ethernet_stats
149 * 42 *
@@ -215,11 +108,6 @@ static int cvm_oct_stats_show(struct seq_file *m, void *v)
215 } 108 }
216 } 109 }
217 110
218 if (cvm_oct_device[0]) {
219 priv = netdev_priv(cvm_oct_device[0]);
220 if (priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII)
221 cvm_oct_stats_switch_show(m, v);
222 }
223 return 0; 111 return 0;
224} 112}
225 113
diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
index fbaa465d2fac..3820f1ec11d1 100644
--- a/drivers/staging/octeon/ethernet-rgmii.c
+++ b/drivers/staging/octeon/ethernet-rgmii.c
@@ -147,32 +147,36 @@ static void cvm_oct_rgmii_poll(struct net_device *dev)
147 cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface), 147 cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface),
148 gmxx_rxx_int_reg.u64); 148 gmxx_rxx_int_reg.u64);
149 } 149 }
150 150 if (priv->phydev == NULL) {
151 link_info = cvmx_helper_link_autoconf(priv->port); 151 link_info = cvmx_helper_link_autoconf(priv->port);
152 priv->link_info = link_info.u64; 152 priv->link_info = link_info.u64;
153 }
153 spin_unlock_irqrestore(&global_register_lock, flags); 154 spin_unlock_irqrestore(&global_register_lock, flags);
154 155
155 /* Tell Linux */ 156 if (priv->phydev == NULL) {
156 if (link_info.s.link_up) { 157 /* Tell core. */
157 158 if (link_info.s.link_up) {
158 if (!netif_carrier_ok(dev)) 159 if (!netif_carrier_ok(dev))
159 netif_carrier_on(dev); 160 netif_carrier_on(dev);
160 if (priv->queue != -1) 161 if (priv->queue != -1)
161 DEBUGPRINT 162 DEBUGPRINT("%s: %u Mbps %s duplex, "
162 ("%s: %u Mbps %s duplex, port %2d, queue %2d\n", 163 "port %2d, queue %2d\n",
163 dev->name, link_info.s.speed, 164 dev->name, link_info.s.speed,
164 (link_info.s.full_duplex) ? "Full" : "Half", 165 (link_info.s.full_duplex) ?
165 priv->port, priv->queue); 166 "Full" : "Half",
166 else 167 priv->port, priv->queue);
167 DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n", 168 else
168 dev->name, link_info.s.speed, 169 DEBUGPRINT("%s: %u Mbps %s duplex, "
169 (link_info.s.full_duplex) ? "Full" : "Half", 170 "port %2d, POW\n",
170 priv->port); 171 dev->name, link_info.s.speed,
171 } else { 172 (link_info.s.full_duplex) ?
172 173 "Full" : "Half",
173 if (netif_carrier_ok(dev)) 174 priv->port);
174 netif_carrier_off(dev); 175 } else {
175 DEBUGPRINT("%s: Link down\n", dev->name); 176 if (netif_carrier_ok(dev))
177 netif_carrier_off(dev);
178 DEBUGPRINT("%s: Link down\n", dev->name);
179 }
176 } 180 }
177} 181}
178 182
diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
index 2b54996bd85d..6061d01eca2d 100644
--- a/drivers/staging/octeon/ethernet-sgmii.c
+++ b/drivers/staging/octeon/ethernet-sgmii.c
@@ -113,7 +113,7 @@ int cvm_oct_sgmii_init(struct net_device *dev)
113 struct octeon_ethernet *priv = netdev_priv(dev); 113 struct octeon_ethernet *priv = netdev_priv(dev);
114 cvm_oct_common_init(dev); 114 cvm_oct_common_init(dev);
115 dev->netdev_ops->ndo_stop(dev); 115 dev->netdev_ops->ndo_stop(dev);
116 if (!octeon_is_simulation()) 116 if (!octeon_is_simulation() && priv->phydev == NULL)
117 priv->poll = cvm_oct_sgmii_poll; 117 priv->poll = cvm_oct_sgmii_poll;
118 118
119 /* FIXME: Need autoneg logic */ 119 /* FIXME: Need autoneg logic */
diff --git a/drivers/staging/octeon/ethernet-xaui.c b/drivers/staging/octeon/ethernet-xaui.c
index 0c2e7cc40f35..ee3dc41b2c53 100644
--- a/drivers/staging/octeon/ethernet-xaui.c
+++ b/drivers/staging/octeon/ethernet-xaui.c
@@ -112,7 +112,7 @@ int cvm_oct_xaui_init(struct net_device *dev)
112 struct octeon_ethernet *priv = netdev_priv(dev); 112 struct octeon_ethernet *priv = netdev_priv(dev);
113 cvm_oct_common_init(dev); 113 cvm_oct_common_init(dev);
114 dev->netdev_ops->ndo_stop(dev); 114 dev->netdev_ops->ndo_stop(dev);
115 if (!octeon_is_simulation()) 115 if (!octeon_is_simulation() && priv->phydev == NULL)
116 priv->poll = cvm_oct_xaui_poll; 116 priv->poll = cvm_oct_xaui_poll;
117 117
118 return 0; 118 return 0;
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 492c5029992d..4cfd4b136b32 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -30,7 +30,7 @@
30#include <linux/netdevice.h> 30#include <linux/netdevice.h>
31#include <linux/etherdevice.h> 31#include <linux/etherdevice.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/mii.h> 33#include <linux/phy.h>
34 34
35#include <net/dst.h> 35#include <net/dst.h>
36 36
@@ -132,8 +132,6 @@ static struct timer_list cvm_oct_poll_timer;
132 */ 132 */
133struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS]; 133struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
134 134
135extern struct semaphore mdio_sem;
136
137/** 135/**
138 * Periodic timer tick for slow management operations 136 * Periodic timer tick for slow management operations
139 * 137 *
@@ -160,13 +158,8 @@ static void cvm_do_timer(unsigned long arg)
160 goto out; 158 goto out;
161 159
162 priv = netdev_priv(cvm_oct_device[port]); 160 priv = netdev_priv(cvm_oct_device[port]);
163 if (priv->poll) { 161 if (priv->poll)
164 /* skip polling if we don't get the lock */ 162 priv->poll(cvm_oct_device[port]);
165 if (!down_trylock(&mdio_sem)) {
166 priv->poll(cvm_oct_device[port]);
167 up(&mdio_sem);
168 }
169 }
170 163
171 queues_per_port = cvmx_pko_get_num_queues(port); 164 queues_per_port = cvmx_pko_get_num_queues(port);
172 /* Drain any pending packets in the free list */ 165 /* Drain any pending packets in the free list */
@@ -524,7 +517,7 @@ int cvm_oct_common_init(struct net_device *dev)
524 dev->features |= NETIF_F_LLTX; 517 dev->features |= NETIF_F_LLTX;
525 SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops); 518 SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops);
526 519
527 cvm_oct_mdio_setup_device(dev); 520 cvm_oct_phy_setup_device(dev);
528 dev->netdev_ops->ndo_set_mac_address(dev, &sa); 521 dev->netdev_ops->ndo_set_mac_address(dev, &sa);
529 dev->netdev_ops->ndo_change_mtu(dev, dev->mtu); 522 dev->netdev_ops->ndo_change_mtu(dev, dev->mtu);
530 523
@@ -540,7 +533,10 @@ int cvm_oct_common_init(struct net_device *dev)
540 533
541void cvm_oct_common_uninit(struct net_device *dev) 534void cvm_oct_common_uninit(struct net_device *dev)
542{ 535{
543 /* Currently nothing to do */ 536 struct octeon_ethernet *priv = netdev_priv(dev);
537
538 if (priv->phydev)
539 phy_disconnect(priv->phydev);
544} 540}
545 541
546static const struct net_device_ops cvm_oct_npi_netdev_ops = { 542static const struct net_device_ops cvm_oct_npi_netdev_ops = {
@@ -627,6 +623,8 @@ static const struct net_device_ops cvm_oct_pow_netdev_ops = {
627#endif 623#endif
628}; 624};
629 625
626extern void octeon_mdiobus_force_mod_depencency(void);
627
630/** 628/**
631 * Module/ driver initialization. Creates the linux network 629 * Module/ driver initialization. Creates the linux network
632 * devices. 630 * devices.
@@ -640,6 +638,7 @@ static int __init cvm_oct_init_module(void)
640 int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE; 638 int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
641 int qos; 639 int qos;
642 640
641 octeon_mdiobus_force_mod_depencency();
643 pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION); 642 pr_notice("cavium-ethernet %s\n", OCTEON_ETHERNET_VERSION);
644 643
645 if (OCTEON_IS_MODEL(OCTEON_CN52XX)) 644 if (OCTEON_IS_MODEL(OCTEON_CN52XX))
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
index 3aef9878fc0a..402a15b9bb0e 100644
--- a/drivers/staging/octeon/octeon-ethernet.h
+++ b/drivers/staging/octeon/octeon-ethernet.h
@@ -50,9 +50,9 @@ struct octeon_ethernet {
50 /* List of outstanding tx buffers per queue */ 50 /* List of outstanding tx buffers per queue */
51 struct sk_buff_head tx_free_list[16]; 51 struct sk_buff_head tx_free_list[16];
52 /* Device statistics */ 52 /* Device statistics */
53 struct net_device_stats stats 53 struct net_device_stats stats;
54; /* Generic MII info structure */ 54 struct phy_device *phydev;
55 struct mii_if_info mii_info; 55 unsigned int last_link;
56 /* Last negotiated link state */ 56 /* Last negotiated link state */
57 uint64_t link_info; 57 uint64_t link_info;
58 /* Called periodically to check link status */ 58 /* Called periodically to check link status */
diff --git a/drivers/staging/panel/Kconfig b/drivers/staging/panel/Kconfig
index 3abe7c9d558d..3defa0133f2e 100644
--- a/drivers/staging/panel/Kconfig
+++ b/drivers/staging/panel/Kconfig
@@ -47,7 +47,7 @@ config PANEL_PROFILE
47config PANEL_KEYPAD 47config PANEL_KEYPAD
48 depends on PANEL && PANEL_PROFILE="0" 48 depends on PANEL && PANEL_PROFILE="0"
49 int "Keypad type (0=none, 1=old 6 keys, 2=new 6 keys, 3=Nexcom 4 keys)" 49 int "Keypad type (0=none, 1=old 6 keys, 2=new 6 keys, 3=Nexcom 4 keys)"
50 range 0 4 50 range 0 3
51 default 0 51 default 0
52 ---help--- 52 ---help---
53 This enables and configures a keypad connected to the parallel port. 53 This enables and configures a keypad connected to the parallel port.
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 4ce399b6d237..95c93e82ccec 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -55,7 +55,7 @@
55#include <linux/list.h> 55#include <linux/list.h>
56#include <linux/notifier.h> 56#include <linux/notifier.h>
57#include <linux/reboot.h> 57#include <linux/reboot.h>
58#include <linux/utsrelease.h> 58#include <generated/utsrelease.h>
59 59
60#include <linux/io.h> 60#include <linux/io.h>
61#include <asm/uaccess.h> 61#include <asm/uaccess.h>
@@ -378,7 +378,7 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
378 378
379#ifdef CONFIG_PANEL_LCD_CHARSET 379#ifdef CONFIG_PANEL_LCD_CHARSET
380#undef DEFAULT_LCD_CHARSET 380#undef DEFAULT_LCD_CHARSET
381#define DEFAULT_LCD_CHARSET 381#define DEFAULT_LCD_CHARSET CONFIG_PANEL_LCD_CHARSET
382#endif 382#endif
383 383
384#endif /* DEFAULT_PROFILE == 0 */ 384#endif /* DEFAULT_PROFILE == 0 */
diff --git a/drivers/staging/pohmelfs/dir.c b/drivers/staging/pohmelfs/dir.c
index 6c5b261e9f06..aacd25bfb0cb 100644
--- a/drivers/staging/pohmelfs/dir.c
+++ b/drivers/staging/pohmelfs/dir.c
@@ -722,8 +722,6 @@ static int pohmelfs_remove_entry(struct inode *dir, struct dentry *dentry)
722 if (inode->i_nlink) 722 if (inode->i_nlink)
723 inode_dec_link_count(inode); 723 inode_dec_link_count(inode);
724 } 724 }
725 dprintk("%s: inode: %p, lock: %ld, unhashed: %d.\n",
726 __func__, pi, inode->i_state & I_LOCK, hlist_unhashed(&inode->i_hash));
727 725
728 return err; 726 return err;
729} 727}
diff --git a/drivers/staging/ramzswap/TODO b/drivers/staging/ramzswap/TODO
index bac40d6cb9f1..8d64e28fac0e 100644
--- a/drivers/staging/ramzswap/TODO
+++ b/drivers/staging/ramzswap/TODO
@@ -1,6 +1,5 @@
1TODO: 1TODO:
2 - Add support for swap notifiers 2 - Add support for swap notifiers
3 - Remove CONFIG_ARM hack
4 3
5Please send patches to Greg Kroah-Hartman <greg@kroah.com> and 4Please send patches to Greg Kroah-Hartman <greg@kroah.com> and
6Nitin Gupta <ngupta@vflare.org> 5Nitin Gupta <ngupta@vflare.org>
diff --git a/drivers/staging/ramzswap/ramzswap_drv.c b/drivers/staging/ramzswap/ramzswap_drv.c
index b839f05efbce..989fac5b01b3 100644
--- a/drivers/staging/ramzswap/ramzswap_drv.c
+++ b/drivers/staging/ramzswap/ramzswap_drv.c
@@ -222,28 +222,6 @@ out:
222 return ret; 222 return ret;
223} 223}
224 224
225static void ramzswap_flush_dcache_page(struct page *page)
226{
227#ifdef CONFIG_ARM
228 int flag = 0;
229 /*
230 * Ugly hack to get flush_dcache_page() work on ARM.
231 * page_mapping(page) == NULL after clearing this swap cache flag.
232 * Without clearing this flag, flush_dcache_page() will simply set
233 * "PG_dcache_dirty" bit and return.
234 */
235 if (PageSwapCache(page)) {
236 flag = 1;
237 ClearPageSwapCache(page);
238 }
239#endif
240 flush_dcache_page(page);
241#ifdef CONFIG_ARM
242 if (flag)
243 SetPageSwapCache(page);
244#endif
245}
246
247void ramzswap_ioctl_get_stats(struct ramzswap *rzs, 225void ramzswap_ioctl_get_stats(struct ramzswap *rzs,
248 struct ramzswap_ioctl_stats *s) 226 struct ramzswap_ioctl_stats *s)
249{ 227{
@@ -655,7 +633,7 @@ static int handle_zero_page(struct bio *bio)
655 memset(user_mem, 0, PAGE_SIZE); 633 memset(user_mem, 0, PAGE_SIZE);
656 kunmap_atomic(user_mem, KM_USER0); 634 kunmap_atomic(user_mem, KM_USER0);
657 635
658 ramzswap_flush_dcache_page(page); 636 flush_dcache_page(page);
659 637
660 set_bit(BIO_UPTODATE, &bio->bi_flags); 638 set_bit(BIO_UPTODATE, &bio->bi_flags);
661 bio_endio(bio, 0); 639 bio_endio(bio, 0);
@@ -679,7 +657,7 @@ static int handle_uncompressed_page(struct ramzswap *rzs, struct bio *bio)
679 kunmap_atomic(user_mem, KM_USER0); 657 kunmap_atomic(user_mem, KM_USER0);
680 kunmap_atomic(cmem, KM_USER1); 658 kunmap_atomic(cmem, KM_USER1);
681 659
682 ramzswap_flush_dcache_page(page); 660 flush_dcache_page(page);
683 661
684 set_bit(BIO_UPTODATE, &bio->bi_flags); 662 set_bit(BIO_UPTODATE, &bio->bi_flags);
685 bio_endio(bio, 0); 663 bio_endio(bio, 0);
@@ -779,7 +757,7 @@ static int ramzswap_read(struct ramzswap *rzs, struct bio *bio)
779 goto out; 757 goto out;
780 } 758 }
781 759
782 ramzswap_flush_dcache_page(page); 760 flush_dcache_page(page);
783 761
784 set_bit(BIO_UPTODATE, &bio->bi_flags); 762 set_bit(BIO_UPTODATE, &bio->bi_flags);
785 bio_endio(bio, 0); 763 bio_endio(bio, 0);
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
index 3222c22152fb..0d490c164db6 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
@@ -1318,13 +1318,13 @@ extern int ieee80211_encrypt_fragment(
1318 struct sk_buff *frag, 1318 struct sk_buff *frag,
1319 int hdr_len); 1319 int hdr_len);
1320 1320
1321extern int ieee80211_xmit(struct sk_buff *skb, 1321extern int ieee80211_rtl_xmit(struct sk_buff *skb,
1322 struct net_device *dev); 1322 struct net_device *dev);
1323extern void ieee80211_txb_free(struct ieee80211_txb *); 1323extern void ieee80211_txb_free(struct ieee80211_txb *);
1324 1324
1325 1325
1326/* ieee80211_rx.c */ 1326/* ieee80211_rx.c */
1327extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 1327extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1328 struct ieee80211_rx_stats *rx_stats); 1328 struct ieee80211_rx_stats *rx_stats);
1329extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 1329extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1330 struct ieee80211_hdr_4addr *header, 1330 struct ieee80211_hdr_4addr *header,
@@ -1376,8 +1376,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
1376extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); 1376extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
1377extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); 1377extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
1378extern void ieee80211_reset_queue(struct ieee80211_device *ieee); 1378extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
1379extern void ieee80211_wake_queue(struct ieee80211_device *ieee); 1379extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
1380extern void ieee80211_stop_queue(struct ieee80211_device *ieee); 1380extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
1381extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); 1381extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
1382extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); 1382extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
1383extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); 1383extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
@@ -1385,7 +1385,7 @@ extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct
1385extern void notify_wx_assoc_event(struct ieee80211_device *ieee); 1385extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
1386extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); 1386extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
1387extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn); 1387extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn);
1388extern void ieee80211_start_scan(struct ieee80211_device *ieee); 1388extern void ieee80211_rtl_start_scan(struct ieee80211_device *ieee);
1389 1389
1390//Add for RF power on power off by lizhaoming 080512 1390//Add for RF power on power off by lizhaoming 080512
1391extern void SendDisassociation(struct ieee80211_device *ieee, 1391extern void SendDisassociation(struct ieee80211_device *ieee,
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
index f882dd8cf9b5..9128c181bc7d 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
@@ -469,7 +469,7 @@ drop:
469/* All received frames are sent to this function. @skb contains the frame in 469/* All received frames are sent to this function. @skb contains the frame in
470 * IEEE 802.11 format, i.e., in the format it was sent over air. 470 * IEEE 802.11 format, i.e., in the format it was sent over air.
471 * This function is called only as a tasklet (software IRQ). */ 471 * This function is called only as a tasklet (software IRQ). */
472int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 472int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
473 struct ieee80211_rx_stats *rx_stats) 473 struct ieee80211_rx_stats *rx_stats)
474{ 474{
475 struct net_device *dev = ieee->dev; 475 struct net_device *dev = ieee->dev;
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
index 1fe19c39d702..c7c645af0ebb 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -689,7 +689,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee)
689} 689}
690 690
691/* called with ieee->lock held */ 691/* called with ieee->lock held */
692void ieee80211_start_scan(struct ieee80211_device *ieee) 692void ieee80211_rtl_start_scan(struct ieee80211_device *ieee)
693{ 693{
694 if(IS_DOT11D_ENABLE(ieee) ) 694 if(IS_DOT11D_ENABLE(ieee) )
695 { 695 {
@@ -1196,7 +1196,7 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
1196 } 1196 }
1197} 1197}
1198 1198
1199void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) 1199void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
1200{ 1200{
1201 u8 *c; 1201 u8 *c;
1202 struct sk_buff *skb; 1202 struct sk_buff *skb;
@@ -1898,7 +1898,7 @@ associate_complete:
1898 1898
1899 ieee80211_associate_step2(ieee); 1899 ieee80211_associate_step2(ieee);
1900 }else{ 1900 }else{
1901 ieee80211_auth_challenge(ieee, challenge, chlen); 1901 ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
1902 } 1902 }
1903 }else{ 1903 }else{
1904 ieee->softmac_stats.rx_auth_rs_err++; 1904 ieee->softmac_stats.rx_auth_rs_err++;
@@ -2047,7 +2047,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee)
2047 2047
2048} 2048}
2049 2049
2050void ieee80211_wake_queue(struct ieee80211_device *ieee) 2050void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
2051{ 2051{
2052 2052
2053 unsigned long flags; 2053 unsigned long flags;
@@ -2089,7 +2089,7 @@ exit :
2089} 2089}
2090 2090
2091 2091
2092void ieee80211_stop_queue(struct ieee80211_device *ieee) 2092void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
2093{ 2093{
2094 //unsigned long flags; 2094 //unsigned long flags;
2095 //spin_lock_irqsave(&ieee->lock,flags); 2095 //spin_lock_irqsave(&ieee->lock,flags);
@@ -2301,7 +2301,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
2301//#else 2301//#else
2302 if (ieee->state == IEEE80211_NOLINK){ 2302 if (ieee->state == IEEE80211_NOLINK){
2303 ieee->actscanning = true; 2303 ieee->actscanning = true;
2304 ieee80211_start_scan(ieee); 2304 ieee80211_rtl_start_scan(ieee);
2305 } 2305 }
2306//#endif 2306//#endif
2307 spin_unlock_irqrestore(&ieee->lock, flags); 2307 spin_unlock_irqrestore(&ieee->lock, flags);
@@ -2357,7 +2357,7 @@ void ieee80211_associate_retry_wq(struct work_struct *work)
2357 if(ieee->state == IEEE80211_NOLINK){ 2357 if(ieee->state == IEEE80211_NOLINK){
2358 ieee->beinretry = false; 2358 ieee->beinretry = false;
2359 ieee->actscanning = true; 2359 ieee->actscanning = true;
2360 ieee80211_start_scan(ieee); 2360 ieee80211_rtl_start_scan(ieee);
2361 } 2361 }
2362 //YJ,add,080828, notify os here 2362 //YJ,add,080828, notify os here
2363 if(ieee->state == IEEE80211_NOLINK) 2363 if(ieee->state == IEEE80211_NOLINK)
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
index dde1f2e0cf32..69bd02164b0c 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
@@ -304,7 +304,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network)
304} 304}
305 305
306/* SKBs are added to the ieee->tx_queue. */ 306/* SKBs are added to the ieee->tx_queue. */
307int ieee80211_xmit(struct sk_buff *skb, 307int ieee80211_rtl_xmit(struct sk_buff *skb,
308 struct net_device *dev) 308 struct net_device *dev)
309{ 309{
310 struct ieee80211_device *ieee = netdev_priv(dev); 310 struct ieee80211_device *ieee = netdev_priv(dev);
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 57c62b0a402f..e0f13efdb15a 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -1811,7 +1811,7 @@ void rtl8180_rx(struct net_device *dev)
1811 if(priv->rx_skb->len > 4) 1811 if(priv->rx_skb->len > 4)
1812 skb_trim(priv->rx_skb,priv->rx_skb->len-4); 1812 skb_trim(priv->rx_skb,priv->rx_skb->len-4);
1813#ifndef RX_DONT_PASS_UL 1813#ifndef RX_DONT_PASS_UL
1814 if(!ieee80211_rx(priv->ieee80211, 1814 if(!ieee80211_rtl_rx(priv->ieee80211,
1815 priv->rx_skb, &stats)){ 1815 priv->rx_skb, &stats)){
1816#endif // RX_DONT_PASS_UL 1816#endif // RX_DONT_PASS_UL
1817 1817
@@ -1917,11 +1917,11 @@ rate)
1917 if (!check_nic_enought_desc(dev, priority)){ 1917 if (!check_nic_enought_desc(dev, priority)){
1918 DMESGW("Error: no descriptor left by previous TX (avail %d) ", 1918 DMESGW("Error: no descriptor left by previous TX (avail %d) ",
1919 get_curr_tx_free_desc(dev, priority)); 1919 get_curr_tx_free_desc(dev, priority));
1920 ieee80211_stop_queue(priv->ieee80211); 1920 ieee80211_rtl_stop_queue(priv->ieee80211);
1921 } 1921 }
1922 rtl8180_tx(dev, skb->data, skb->len, priority, morefrag,0,rate); 1922 rtl8180_tx(dev, skb->data, skb->len, priority, morefrag,0,rate);
1923 if (!check_nic_enought_desc(dev, priority)) 1923 if (!check_nic_enought_desc(dev, priority))
1924 ieee80211_stop_queue(priv->ieee80211); 1924 ieee80211_rtl_stop_queue(priv->ieee80211);
1925 1925
1926 spin_unlock_irqrestore(&priv->tx_lock,flags); 1926 spin_unlock_irqrestore(&priv->tx_lock,flags);
1927} 1927}
@@ -3680,7 +3680,7 @@ static const struct net_device_ops rtl8180_netdev_ops = {
3680 .ndo_set_mac_address = r8180_set_mac_adr, 3680 .ndo_set_mac_address = r8180_set_mac_adr,
3681 .ndo_validate_addr = eth_validate_addr, 3681 .ndo_validate_addr = eth_validate_addr,
3682 .ndo_change_mtu = eth_change_mtu, 3682 .ndo_change_mtu = eth_change_mtu,
3683 .ndo_start_xmit = ieee80211_xmit, 3683 .ndo_start_xmit = ieee80211_rtl_xmit,
3684}; 3684};
3685 3685
3686static int __devinit rtl8180_pci_probe(struct pci_dev *pdev, 3686static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
@@ -3900,7 +3900,7 @@ void rtl8180_try_wake_queue(struct net_device *dev, int pri)
3900 spin_unlock_irqrestore(&priv->tx_lock,flags); 3900 spin_unlock_irqrestore(&priv->tx_lock,flags);
3901 3901
3902 if(enough_desc) 3902 if(enough_desc)
3903 ieee80211_wake_queue(priv->ieee80211); 3903 ieee80211_rtl_wake_queue(priv->ieee80211);
3904} 3904}
3905 3905
3906void rtl8180_tx_isr(struct net_device *dev, int pri,short error) 3906void rtl8180_tx_isr(struct net_device *dev, int pri,short error)
diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c
index 536cb6e8e796..124cde356cbc 100644
--- a/drivers/staging/rtl8187se/r8180_wx.c
+++ b/drivers/staging/rtl8187se/r8180_wx.c
@@ -377,7 +377,7 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
377 // queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq); 377 // queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq);
378 //printk("start scan============================>\n"); 378 //printk("start scan============================>\n");
379 ieee80211_softmac_ips_scan_syncro(priv->ieee80211); 379 ieee80211_softmac_ips_scan_syncro(priv->ieee80211);
380//ieee80211_start_scan(priv->ieee80211); 380//ieee80211_rtl_start_scan(priv->ieee80211);
381 /* intentionally forget to up sem */ 381 /* intentionally forget to up sem */
382// up(&priv->ieee80211->wx_sem); 382// up(&priv->ieee80211->wx_sem);
383 ret = 0; 383 ret = 0;
diff --git a/drivers/staging/rtl8192e/ieee80211.h b/drivers/staging/rtl8192e/ieee80211.h
index 97137ddefff4..3ba9e9e90bda 100644
--- a/drivers/staging/rtl8192e/ieee80211.h
+++ b/drivers/staging/rtl8192e/ieee80211.h
@@ -303,8 +303,8 @@ enum _ReasonCode{
303#define ieee80211_rx_mgt ieee80211_rx_mgt_rsl 303#define ieee80211_rx_mgt ieee80211_rx_mgt_rsl
304 304
305#define ieee80211_get_beacon ieee80211_get_beacon_rsl 305#define ieee80211_get_beacon ieee80211_get_beacon_rsl
306#define ieee80211_wake_queue ieee80211_wake_queue_rsl 306#define ieee80211_rtl_wake_queue ieee80211_rtl_wake_queue_rsl
307#define ieee80211_stop_queue ieee80211_stop_queue_rsl 307#define ieee80211_rtl_stop_queue ieee80211_rtl_stop_queue_rsl
308#define ieee80211_reset_queue ieee80211_reset_queue_rsl 308#define ieee80211_reset_queue ieee80211_reset_queue_rsl
309#define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl 309#define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl
310#define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl 310#define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl
@@ -2435,13 +2435,13 @@ extern int ieee80211_encrypt_fragment(
2435 struct sk_buff *frag, 2435 struct sk_buff *frag,
2436 int hdr_len); 2436 int hdr_len);
2437 2437
2438extern int ieee80211_xmit(struct sk_buff *skb, 2438extern int ieee80211_rtl_xmit(struct sk_buff *skb,
2439 struct net_device *dev); 2439 struct net_device *dev);
2440extern void ieee80211_txb_free(struct ieee80211_txb *); 2440extern void ieee80211_txb_free(struct ieee80211_txb *);
2441 2441
2442 2442
2443/* ieee80211_rx.c */ 2443/* ieee80211_rx.c */
2444extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 2444extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2445 struct ieee80211_rx_stats *rx_stats); 2445 struct ieee80211_rx_stats *rx_stats);
2446extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 2446extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
2447 struct ieee80211_hdr_4addr *header, 2447 struct ieee80211_hdr_4addr *header,
@@ -2502,8 +2502,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
2502extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); 2502extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
2503extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); 2503extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
2504extern void ieee80211_reset_queue(struct ieee80211_device *ieee); 2504extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
2505extern void ieee80211_wake_queue(struct ieee80211_device *ieee); 2505extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
2506extern void ieee80211_stop_queue(struct ieee80211_device *ieee); 2506extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
2507extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); 2507extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
2508extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); 2508extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
2509extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); 2509extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211.h b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
index 83c8452de378..aa76390487bb 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
@@ -333,8 +333,8 @@ enum _ReasonCode{
333#define ieee80211_rx_mgt ieee80211_rx_mgt_rsl 333#define ieee80211_rx_mgt ieee80211_rx_mgt_rsl
334 334
335#define ieee80211_get_beacon ieee80211_get_beacon_rsl 335#define ieee80211_get_beacon ieee80211_get_beacon_rsl
336#define ieee80211_wake_queue ieee80211_wake_queue_rsl 336#define ieee80211_rtl_wake_queue ieee80211_rtl_wake_queue_rsl
337#define ieee80211_stop_queue ieee80211_stop_queue_rsl 337#define ieee80211_rtl_stop_queue ieee80211_rtl_stop_queue_rsl
338#define ieee80211_reset_queue ieee80211_reset_queue_rsl 338#define ieee80211_reset_queue ieee80211_reset_queue_rsl
339#define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl 339#define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl
340#define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl 340#define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl
@@ -2546,13 +2546,13 @@ extern int ieee80211_encrypt_fragment(
2546 struct sk_buff *frag, 2546 struct sk_buff *frag,
2547 int hdr_len); 2547 int hdr_len);
2548 2548
2549extern int ieee80211_xmit(struct sk_buff *skb, 2549extern int ieee80211_rtl_xmit(struct sk_buff *skb,
2550 struct net_device *dev); 2550 struct net_device *dev);
2551extern void ieee80211_txb_free(struct ieee80211_txb *); 2551extern void ieee80211_txb_free(struct ieee80211_txb *);
2552 2552
2553 2553
2554/* ieee80211_rx.c */ 2554/* ieee80211_rx.c */
2555extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 2555extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
2556 struct ieee80211_rx_stats *rx_stats); 2556 struct ieee80211_rx_stats *rx_stats);
2557extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 2557extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
2558 struct ieee80211_hdr_4addr *header, 2558 struct ieee80211_hdr_4addr *header,
@@ -2613,8 +2613,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
2613extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); 2613extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
2614extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); 2614extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
2615extern void ieee80211_reset_queue(struct ieee80211_device *ieee); 2615extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
2616extern void ieee80211_wake_queue(struct ieee80211_device *ieee); 2616extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
2617extern void ieee80211_stop_queue(struct ieee80211_device *ieee); 2617extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
2618extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); 2618extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
2619extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); 2619extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
2620extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); 2620extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
index 2644155737a8..f43a7db5c78b 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
@@ -119,7 +119,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
119 ieee = (struct ieee80211_device *)dev->priv; 119 ieee = (struct ieee80211_device *)dev->priv;
120#endif 120#endif
121#if 0 121#if 0
122 dev->hard_start_xmit = ieee80211_xmit; 122 dev->hard_start_xmit = ieee80211_rtl_xmit;
123#endif 123#endif
124 124
125 memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); 125 memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv);
@@ -333,7 +333,7 @@ extern void ieee80211_crypto_ccmp_exit(void);
333extern int ieee80211_crypto_wep_init(void); 333extern int ieee80211_crypto_wep_init(void);
334extern void ieee80211_crypto_wep_exit(void); 334extern void ieee80211_crypto_wep_exit(void);
335 335
336int __init ieee80211_init(void) 336int __init ieee80211_rtl_init(void)
337{ 337{
338 struct proc_dir_entry *e; 338 struct proc_dir_entry *e;
339 int retval; 339 int retval;
@@ -389,7 +389,7 @@ int __init ieee80211_init(void)
389 return 0; 389 return 0;
390} 390}
391 391
392void __exit ieee80211_exit(void) 392void __exit ieee80211_rtl_exit(void)
393{ 393{
394 if (ieee80211_proc) { 394 if (ieee80211_proc) {
395 remove_proc_entry("debug_level", ieee80211_proc); 395 remove_proc_entry("debug_level", ieee80211_proc);
@@ -412,8 +412,8 @@ module_param(debug, int, 0444);
412MODULE_PARM_DESC(debug, "debug output mask"); 412MODULE_PARM_DESC(debug, "debug output mask");
413 413
414 414
415//module_exit(ieee80211_exit); 415//module_exit(ieee80211_rtl_exit);
416//module_init(ieee80211_init); 416//module_init(ieee80211_rtl_init);
417#endif 417#endif
418#endif 418#endif
419 419
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
index 5dc478b86375..06d91715143c 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
@@ -923,7 +923,7 @@ u8 parse_subframe(struct sk_buff *skb,
923/* All received frames are sent to this function. @skb contains the frame in 923/* All received frames are sent to this function. @skb contains the frame in
924 * IEEE 802.11 format, i.e., in the format it was sent over air. 924 * IEEE 802.11 format, i.e., in the format it was sent over air.
925 * This function is called only as a tasklet (software IRQ). */ 925 * This function is called only as a tasklet (software IRQ). */
926int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 926int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
927 struct ieee80211_rx_stats *rx_stats) 927 struct ieee80211_rx_stats *rx_stats)
928{ 928{
929 struct net_device *dev = ieee->dev; 929 struct net_device *dev = ieee->dev;
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
index 593d22825184..6d1ddec39f0e 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
@@ -684,7 +684,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee)
684} 684}
685 685
686/* called with ieee->lock held */ 686/* called with ieee->lock held */
687void ieee80211_start_scan(struct ieee80211_device *ieee) 687void ieee80211_rtl_start_scan(struct ieee80211_device *ieee)
688{ 688{
689#ifdef ENABLE_DOT11D 689#ifdef ENABLE_DOT11D
690 if(IS_DOT11D_ENABLE(ieee) ) 690 if(IS_DOT11D_ENABLE(ieee) )
@@ -1430,7 +1430,7 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
1430 } 1430 }
1431} 1431}
1432 1432
1433void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) 1433void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
1434{ 1434{
1435 u8 *c; 1435 u8 *c;
1436 struct sk_buff *skb; 1436 struct sk_buff *skb;
@@ -2262,7 +2262,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2262 2262
2263 ieee80211_associate_step2(ieee); 2263 ieee80211_associate_step2(ieee);
2264 }else{ 2264 }else{
2265 ieee80211_auth_challenge(ieee, challenge, chlen); 2265 ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
2266 } 2266 }
2267 }else{ 2267 }else{
2268 ieee->softmac_stats.rx_auth_rs_err++; 2268 ieee->softmac_stats.rx_auth_rs_err++;
@@ -2376,7 +2376,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
2376 * to check it any more. 2376 * to check it any more.
2377 * */ 2377 * */
2378 //printk("error:no descriptor left@queue_index %d\n", queue_index); 2378 //printk("error:no descriptor left@queue_index %d\n", queue_index);
2379 //ieee80211_stop_queue(ieee); 2379 //ieee80211_rtl_stop_queue(ieee);
2380#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE 2380#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
2381 skb_queue_tail(&ieee->skb_drv_aggQ[queue_index], txb->fragments[i]); 2381 skb_queue_tail(&ieee->skb_drv_aggQ[queue_index], txb->fragments[i]);
2382#else 2382#else
@@ -2440,7 +2440,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee)
2440 2440
2441} 2441}
2442 2442
2443void ieee80211_wake_queue(struct ieee80211_device *ieee) 2443void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
2444{ 2444{
2445 2445
2446 unsigned long flags; 2446 unsigned long flags;
@@ -2481,7 +2481,7 @@ exit :
2481} 2481}
2482 2482
2483 2483
2484void ieee80211_stop_queue(struct ieee80211_device *ieee) 2484void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
2485{ 2485{
2486 //unsigned long flags; 2486 //unsigned long flags;
2487 //spin_lock_irqsave(&ieee->lock,flags); 2487 //spin_lock_irqsave(&ieee->lock,flags);
@@ -2706,7 +2706,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
2706 2706
2707 if (ieee->state == IEEE80211_NOLINK){ 2707 if (ieee->state == IEEE80211_NOLINK){
2708 ieee->actscanning = true; 2708 ieee->actscanning = true;
2709 ieee80211_start_scan(ieee); 2709 ieee80211_rtl_start_scan(ieee);
2710 } 2710 }
2711 spin_unlock_irqrestore(&ieee->lock, flags); 2711 spin_unlock_irqrestore(&ieee->lock, flags);
2712} 2712}
@@ -2775,7 +2775,7 @@ void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
2775 { 2775 {
2776 ieee->is_roaming= false; 2776 ieee->is_roaming= false;
2777 ieee->actscanning = true; 2777 ieee->actscanning = true;
2778 ieee80211_start_scan(ieee); 2778 ieee80211_rtl_start_scan(ieee);
2779 } 2779 }
2780 spin_unlock_irqrestore(&ieee->lock, flags); 2780 spin_unlock_irqrestore(&ieee->lock, flags);
2781 2781
@@ -3497,8 +3497,8 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee)
3497 3497
3498#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) 3498#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
3499//EXPORT_SYMBOL(ieee80211_get_beacon); 3499//EXPORT_SYMBOL(ieee80211_get_beacon);
3500//EXPORT_SYMBOL(ieee80211_wake_queue); 3500//EXPORT_SYMBOL(ieee80211_rtl_wake_queue);
3501//EXPORT_SYMBOL(ieee80211_stop_queue); 3501//EXPORT_SYMBOL(ieee80211_rtl_stop_queue);
3502//EXPORT_SYMBOL(ieee80211_reset_queue); 3502//EXPORT_SYMBOL(ieee80211_reset_queue);
3503//EXPORT_SYMBOL(ieee80211_softmac_stop_protocol); 3503//EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
3504//EXPORT_SYMBOL(ieee80211_softmac_start_protocol); 3504//EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
@@ -3518,8 +3518,8 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee)
3518//EXPORT_SYMBOL(ieee80211_start_scan_syncro); 3518//EXPORT_SYMBOL(ieee80211_start_scan_syncro);
3519#else 3519#else
3520EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon); 3520EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon);
3521EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue); 3521EXPORT_SYMBOL_NOVERS(ieee80211_rtl_wake_queue);
3522EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue); 3522EXPORT_SYMBOL_NOVERS(ieee80211_rtl_stop_queue);
3523EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue); 3523EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue);
3524EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol); 3524EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol);
3525EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol); 3525EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol);
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c
index 103b33c093f5..798fb4154c25 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_tx.c
@@ -604,7 +604,7 @@ void ieee80211_query_seqnum(struct ieee80211_device*ieee, struct sk_buff* skb, u
604 } 604 }
605} 605}
606 606
607int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) 607int ieee80211_rtl_xmit(struct sk_buff *skb, struct net_device *dev)
608{ 608{
609#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) 609#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
610 struct ieee80211_device *ieee = netdev_priv(dev); 610 struct ieee80211_device *ieee = netdev_priv(dev);
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
index 4e34a1f4c66b..3441b72dd8fa 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
@@ -976,7 +976,7 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
976 { 976 {
977 if (len != ie[1]+2) 977 if (len != ie[1]+2)
978 { 978 {
979 printk("len:%d, ie:%d\n", len, ie[1]); 979 printk("len:%zu, ie:%d\n", len, ie[1]);
980 return -EINVAL; 980 return -EINVAL;
981 } 981 }
982 buf = kmalloc(len, GFP_KERNEL); 982 buf = kmalloc(len, GFP_KERNEL);
diff --git a/drivers/staging/rtl8192e/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192e/ieee80211/rtl819x_BAProc.c
index 98b3bb6b6d69..e41e8a0c739c 100644
--- a/drivers/staging/rtl8192e/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192e/ieee80211/rtl819x_BAProc.c
@@ -382,7 +382,7 @@ int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb)
382 382
383 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) 383 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9)
384 { 384 {
385 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); 385 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9));
386 return -1; 386 return -1;
387 } 387 }
388 388
@@ -481,7 +481,7 @@ int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb)
481 481
482 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) 482 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9)
483 { 483 {
484 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); 484 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9));
485 return -1; 485 return -1;
486 } 486 }
487 rsp = ( struct ieee80211_hdr_3addr*)skb->data; 487 rsp = ( struct ieee80211_hdr_3addr*)skb->data;
@@ -611,7 +611,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb)
611 611
612 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 6) 612 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 6)
613 { 613 {
614 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6)); 614 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6));
615 return -1; 615 return -1;
616 } 616 }
617 617
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index ff8fe7e32a92..0ca5d8b4f746 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -5795,7 +5795,7 @@ static void rtl8192_rx(struct net_device *dev)
5795 stats.fragoffset = 0; 5795 stats.fragoffset = 0;
5796 stats.ntotalfrag = 1; 5796 stats.ntotalfrag = 1;
5797 5797
5798 if(!ieee80211_rx(priv->ieee80211, skb, &stats)){ 5798 if(!ieee80211_rtl_rx(priv->ieee80211, skb, &stats)){
5799 dev_kfree_skb_any(skb); 5799 dev_kfree_skb_any(skb);
5800 } else { 5800 } else {
5801 priv->stats.rxok++; 5801 priv->stats.rxok++;
@@ -5837,7 +5837,7 @@ static const struct net_device_ops rtl8192_netdev_ops = {
5837 .ndo_do_ioctl = rtl8192_ioctl, 5837 .ndo_do_ioctl = rtl8192_ioctl,
5838 .ndo_set_multicast_list = r8192_set_multicast, 5838 .ndo_set_multicast_list = r8192_set_multicast,
5839 .ndo_set_mac_address = r8192_set_mac_adr, 5839 .ndo_set_mac_address = r8192_set_mac_adr,
5840 .ndo_start_xmit = ieee80211_xmit, 5840 .ndo_start_xmit = ieee80211_rtl_xmit,
5841}; 5841};
5842 5842
5843/**************************************************************************** 5843/****************************************************************************
@@ -6121,14 +6121,14 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
6121 RT_TRACE(COMP_DOWN, "wlan driver removed\n"); 6121 RT_TRACE(COMP_DOWN, "wlan driver removed\n");
6122} 6122}
6123 6123
6124extern int ieee80211_init(void); 6124extern int ieee80211_rtl_init(void);
6125extern void ieee80211_exit(void); 6125extern void ieee80211_rtl_exit(void);
6126 6126
6127static int __init rtl8192_pci_module_init(void) 6127static int __init rtl8192_pci_module_init(void)
6128{ 6128{
6129 int retval; 6129 int retval;
6130 6130
6131 retval = ieee80211_init(); 6131 retval = ieee80211_rtl_init();
6132 if (retval) 6132 if (retval)
6133 return retval; 6133 return retval;
6134 6134
@@ -6153,7 +6153,7 @@ static void __exit rtl8192_pci_module_exit(void)
6153 6153
6154 RT_TRACE(COMP_DOWN, "Exiting"); 6154 RT_TRACE(COMP_DOWN, "Exiting");
6155 rtl8192_proc_module_remove(); 6155 rtl8192_proc_module_remove();
6156 ieee80211_exit(); 6156 ieee80211_rtl_exit();
6157} 6157}
6158 6158
6159//warning message WB 6159//warning message WB
@@ -6313,7 +6313,7 @@ void rtl8192_try_wake_queue(struct net_device *dev, int pri)
6313 spin_unlock_irqrestore(&priv->tx_lock,flags); 6313 spin_unlock_irqrestore(&priv->tx_lock,flags);
6314 6314
6315 if(enough_desc) 6315 if(enough_desc)
6316 ieee80211_wake_queue(priv->ieee80211); 6316 ieee80211_rtl_wake_queue(priv->ieee80211);
6317#endif 6317#endif
6318} 6318}
6319 6319
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211.h b/drivers/staging/rtl8192su/ieee80211/ieee80211.h
index f22d024b1c39..9a4c858b0666 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211.h
@@ -1721,13 +1721,13 @@ extern int ieee80211_encrypt_fragment(
1721 struct sk_buff *frag, 1721 struct sk_buff *frag,
1722 int hdr_len); 1722 int hdr_len);
1723 1723
1724extern int rtl8192_ieee80211_xmit(struct sk_buff *skb, 1724extern int rtl8192_ieee80211_rtl_xmit(struct sk_buff *skb,
1725 struct net_device *dev); 1725 struct net_device *dev);
1726extern void ieee80211_txb_free(struct ieee80211_txb *); 1726extern void ieee80211_txb_free(struct ieee80211_txb *);
1727 1727
1728 1728
1729/* ieee80211_rx.c */ 1729/* ieee80211_rx.c */
1730extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 1730extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1731 struct ieee80211_rx_stats *rx_stats); 1731 struct ieee80211_rx_stats *rx_stats);
1732extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 1732extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1733 struct ieee80211_hdr_4addr *header, 1733 struct ieee80211_hdr_4addr *header,
@@ -1783,8 +1783,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
1783extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); 1783extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
1784extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); 1784extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
1785extern void ieee80211_reset_queue(struct ieee80211_device *ieee); 1785extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
1786extern void ieee80211_wake_queue(struct ieee80211_device *ieee); 1786extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
1787extern void ieee80211_stop_queue(struct ieee80211_device *ieee); 1787extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
1788extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); 1788extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
1789extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); 1789extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
1790extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); 1790extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
index ac223cef1d33..fecfa120ff48 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_rx.c
@@ -208,7 +208,7 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
208 * 208 *
209 * Responsible for handling management control frames 209 * Responsible for handling management control frames
210 * 210 *
211 * Called by ieee80211_rx */ 211 * Called by ieee80211_rtl_rx */
212static inline int 212static inline int
213ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, 213ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
214 struct ieee80211_rx_stats *rx_stats, u16 type, 214 struct ieee80211_rx_stats *rx_stats, u16 type,
@@ -289,7 +289,7 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
289 return 0; 289 return 0;
290} 290}
291 291
292/* Called only as a tasklet (software IRQ), by ieee80211_rx */ 292/* Called only as a tasklet (software IRQ), by ieee80211_rtl_rx */
293static inline int 293static inline int
294ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, 294ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
295 struct ieee80211_crypt_data *crypt) 295 struct ieee80211_crypt_data *crypt)
@@ -858,7 +858,7 @@ u8 parse_subframe(struct sk_buff *skb,
858/* All received frames are sent to this function. @skb contains the frame in 858/* All received frames are sent to this function. @skb contains the frame in
859 * IEEE 802.11 format, i.e., in the format it was sent over air. 859 * IEEE 802.11 format, i.e., in the format it was sent over air.
860 * This function is called only as a tasklet (software IRQ). */ 860 * This function is called only as a tasklet (software IRQ). */
861int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 861int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
862 struct ieee80211_rx_stats *rx_stats) 862 struct ieee80211_rx_stats *rx_stats)
863{ 863{
864 struct net_device *dev = ieee->dev; 864 struct net_device *dev = ieee->dev;
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
index 203c0a5cc8c1..95d4f84dcf3f 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
@@ -610,7 +610,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee)
610} 610}
611 611
612/* called with ieee->lock held */ 612/* called with ieee->lock held */
613void ieee80211_start_scan(struct ieee80211_device *ieee) 613void ieee80211_rtl_start_scan(struct ieee80211_device *ieee)
614{ 614{
615 if(IS_DOT11D_ENABLE(ieee) ) 615 if(IS_DOT11D_ENABLE(ieee) )
616 { 616 {
@@ -1281,7 +1281,7 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
1281 } 1281 }
1282} 1282}
1283 1283
1284void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) 1284void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
1285{ 1285{
1286 u8 *c; 1286 u8 *c;
1287 struct sk_buff *skb; 1287 struct sk_buff *skb;
@@ -2054,7 +2054,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
2054 2054
2055 ieee80211_associate_step2(ieee); 2055 ieee80211_associate_step2(ieee);
2056 }else{ 2056 }else{
2057 ieee80211_auth_challenge(ieee, challenge, chlen); 2057 ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
2058 } 2058 }
2059 }else{ 2059 }else{
2060 ieee->softmac_stats.rx_auth_rs_err++; 2060 ieee->softmac_stats.rx_auth_rs_err++;
@@ -2162,7 +2162,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
2162 * to check it any more. 2162 * to check it any more.
2163 * */ 2163 * */
2164 //printk("error:no descriptor left@queue_index %d, %d, %d\n", queue_index, skb_queue_len(&ieee->skb_waitQ[queue_index]), ieee->check_nic_enough_desc(ieee->dev,queue_index)); 2164 //printk("error:no descriptor left@queue_index %d, %d, %d\n", queue_index, skb_queue_len(&ieee->skb_waitQ[queue_index]), ieee->check_nic_enough_desc(ieee->dev,queue_index));
2165 //ieee80211_stop_queue(ieee); 2165 //ieee80211_rtl_stop_queue(ieee);
2166 skb_queue_tail(&ieee->skb_waitQ[queue_index], txb->fragments[i]); 2166 skb_queue_tail(&ieee->skb_waitQ[queue_index], txb->fragments[i]);
2167 }else{ 2167 }else{
2168 ieee->softmac_data_hard_start_xmit( 2168 ieee->softmac_data_hard_start_xmit(
@@ -2222,7 +2222,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee)
2222 2222
2223} 2223}
2224 2224
2225void ieee80211_wake_queue(struct ieee80211_device *ieee) 2225void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
2226{ 2226{
2227 2227
2228 unsigned long flags; 2228 unsigned long flags;
@@ -2263,7 +2263,7 @@ exit :
2263} 2263}
2264 2264
2265 2265
2266void ieee80211_stop_queue(struct ieee80211_device *ieee) 2266void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
2267{ 2267{
2268 //unsigned long flags; 2268 //unsigned long flags;
2269 //spin_lock_irqsave(&ieee->lock,flags); 2269 //spin_lock_irqsave(&ieee->lock,flags);
@@ -2479,7 +2479,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
2479 2479
2480 if (ieee->state == IEEE80211_NOLINK){ 2480 if (ieee->state == IEEE80211_NOLINK){
2481 ieee->actscanning = true; 2481 ieee->actscanning = true;
2482 ieee80211_start_scan(ieee); 2482 ieee80211_rtl_start_scan(ieee);
2483 } 2483 }
2484 spin_unlock_irqrestore(&ieee->lock, flags); 2484 spin_unlock_irqrestore(&ieee->lock, flags);
2485} 2485}
@@ -2552,7 +2552,7 @@ void ieee80211_associate_retry_wq(struct work_struct *work)
2552 if(ieee->state == IEEE80211_NOLINK) 2552 if(ieee->state == IEEE80211_NOLINK)
2553 { 2553 {
2554 ieee->actscanning = true; 2554 ieee->actscanning = true;
2555 ieee80211_start_scan(ieee); 2555 ieee80211_rtl_start_scan(ieee);
2556 } 2556 }
2557 spin_unlock_irqrestore(&ieee->lock, flags); 2557 spin_unlock_irqrestore(&ieee->lock, flags);
2558 2558
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
index 60621d6b2a6b..4d54e1e62d22 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_tx.c
@@ -604,7 +604,7 @@ void ieee80211_query_seqnum(struct ieee80211_device*ieee, struct sk_buff* skb, u
604 } 604 }
605} 605}
606 606
607int rtl8192_ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) 607int rtl8192_ieee80211_rtl_xmit(struct sk_buff *skb, struct net_device *dev)
608{ 608{
609 struct ieee80211_device *ieee = netdev_priv(dev); 609 struct ieee80211_device *ieee = netdev_priv(dev);
610 struct ieee80211_txb *txb = NULL; 610 struct ieee80211_txb *txb = NULL;
diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c
index 66274d7666ff..ccb9d5b8cd44 100644
--- a/drivers/staging/rtl8192su/r8192U_core.c
+++ b/drivers/staging/rtl8192su/r8192U_core.c
@@ -126,6 +126,8 @@ static struct usb_device_id rtl8192_usb_id_tbl[] = {
126 {USB_DEVICE(0x2001, 0x3301)}, 126 {USB_DEVICE(0x2001, 0x3301)},
127 /* Zinwell */ 127 /* Zinwell */
128 {USB_DEVICE(0x5a57, 0x0290)}, 128 {USB_DEVICE(0x5a57, 0x0290)},
129 /* Guillemot */
130 {USB_DEVICE(0x06f8, 0xe031)},
129 //92SU 131 //92SU
130 {USB_DEVICE(0x0bda, 0x8172)}, 132 {USB_DEVICE(0x0bda, 0x8172)},
131 {} 133 {}
@@ -1501,7 +1503,7 @@ static void rtl8192_rx_isr(struct urb *urb)
1501 urb->context = skb; 1503 urb->context = skb;
1502 skb_queue_tail(&priv->rx_queue, skb); 1504 skb_queue_tail(&priv->rx_queue, skb);
1503 err = usb_submit_urb(urb, GFP_ATOMIC); 1505 err = usb_submit_urb(urb, GFP_ATOMIC);
1504 if(err && err != EPERM) 1506 if(err && err != -EPERM)
1505 printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); 1507 printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status);
1506} 1508}
1507 1509
@@ -7155,7 +7157,7 @@ void rtl8192SU_rx_nomal(struct sk_buff* skb)
7155 unicast_packet = true; 7157 unicast_packet = true;
7156 } 7158 }
7157 7159
7158 if(!ieee80211_rx(priv->ieee80211,skb, &stats)) { 7160 if(!ieee80211_rtl_rx(priv->ieee80211,skb, &stats)) {
7159 dev_kfree_skb_any(skb); 7161 dev_kfree_skb_any(skb);
7160 } else { 7162 } else {
7161 // priv->stats.rxoktotal++; //YJ,test,090108 7163 // priv->stats.rxoktotal++; //YJ,test,090108
@@ -7426,7 +7428,7 @@ static const struct net_device_ops rtl8192_netdev_ops = {
7426 .ndo_set_mac_address = r8192_set_mac_adr, 7428 .ndo_set_mac_address = r8192_set_mac_adr,
7427 .ndo_validate_addr = eth_validate_addr, 7429 .ndo_validate_addr = eth_validate_addr,
7428 .ndo_change_mtu = eth_change_mtu, 7430 .ndo_change_mtu = eth_change_mtu,
7429 .ndo_start_xmit = rtl8192_ieee80211_xmit, 7431 .ndo_start_xmit = rtl8192_ieee80211_rtl_xmit,
7430}; 7432};
7431 7433
7432static int __devinit rtl8192_usb_probe(struct usb_interface *intf, 7434static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
@@ -7619,7 +7621,7 @@ void rtl8192_try_wake_queue(struct net_device *dev, int pri)
7619 spin_unlock_irqrestore(&priv->tx_lock,flags); 7621 spin_unlock_irqrestore(&priv->tx_lock,flags);
7620 7622
7621 if(enough_desc) 7623 if(enough_desc)
7622 ieee80211_wake_queue(priv->ieee80211); 7624 ieee80211_rtl_wake_queue(priv->ieee80211);
7623} 7625}
7624 7626
7625void EnableHWSecurityConfig8192(struct net_device *dev) 7627void EnableHWSecurityConfig8192(struct net_device *dev)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
index d397f1d68eb7..5f12d62658c9 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
@@ -845,7 +845,7 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
845 { 845 {
846 if (len != ie[1]+2) 846 if (len != ie[1]+2)
847 { 847 {
848 printk("len:%d, ie:%d\n", len, ie[1]); 848 printk("len:%zu, ie:%d\n", len, ie[1]);
849 return -EINVAL; 849 return -EINVAL;
850 } 850 }
851 buf = kmalloc(len, GFP_KERNEL); 851 buf = kmalloc(len, GFP_KERNEL);
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 26af43bb8390..512a57aebde3 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -340,7 +340,7 @@ int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb)
340 340
341 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) 341 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9)
342 { 342 {
343 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); 343 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BAREQ(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9));
344 return -1; 344 return -1;
345 } 345 }
346 346
@@ -439,7 +439,7 @@ int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb)
439 439
440 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9) 440 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 9)
441 { 441 {
442 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9)); 442 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in BARSP(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 9));
443 return -1; 443 return -1;
444 } 444 }
445 rsp = ( struct ieee80211_hdr_3addr*)skb->data; 445 rsp = ( struct ieee80211_hdr_3addr*)skb->data;
@@ -569,7 +569,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb)
569 569
570 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 6) 570 if (skb->len < sizeof( struct ieee80211_hdr_3addr) + 6)
571 { 571 {
572 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %d)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6)); 572 IEEE80211_DEBUG(IEEE80211_DL_ERR, " Invalid skb len in DELBA(%d / %zu)\n", skb->len, (sizeof( struct ieee80211_hdr_3addr) + 6));
573 return -1; 573 return -1;
574 } 574 }
575 575
diff --git a/drivers/staging/sm7xx/Kconfig b/drivers/staging/sm7xx/Kconfig
new file mode 100644
index 000000000000..204dbfc3c38b
--- /dev/null
+++ b/drivers/staging/sm7xx/Kconfig
@@ -0,0 +1,15 @@
1config FB_SM7XX
2 tristate "Silicon Motion SM7XX Frame Buffer Support"
3 depends on FB
4 select FB_CFB_FILLRECT
5 select FB_CFB_COPYAREA
6 select FB_CFB_IMAGEBLIT
7 help
8 Frame Buffer driver for the Silicon Motion SM7XX serial graphic card.
9
10config FB_SM7XX_ACCEL
11 bool "Siliconmotion Acceleration functions (EXPERIMENTAL)"
12 depends on FB_SM7XX && EXPERIMENTAL
13 help
14 This will compile the Trident frame buffer device with
15 acceleration functions.
diff --git a/drivers/staging/sm7xx/Makefile b/drivers/staging/sm7xx/Makefile
new file mode 100644
index 000000000000..f43cb9106305
--- /dev/null
+++ b/drivers/staging/sm7xx/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_FB_SM7XX) += sm7xx.o
2
3sm7xx-y := smtcfb.o
diff --git a/drivers/staging/sm7xx/TODO b/drivers/staging/sm7xx/TODO
new file mode 100644
index 000000000000..1f61f5e11cf5
--- /dev/null
+++ b/drivers/staging/sm7xx/TODO
@@ -0,0 +1,10 @@
1TODO:
2- Dual head support
3- use kernel coding style
4- checkpatch.pl clean
5- refine the code and remove unused code
6- use kernel framebuffer mode setting instead of hard code
7- move it to drivers/video/sm7xx/ or make it be drivers/video/sm7xxfb.c
8
9Please send any patches to Greg Kroah-Hartman <greg@kroah.com> and
10Teddy Wang <teddy.wang@siliconmotion.com.cn>.
diff --git a/drivers/staging/sm7xx/smtc2d.c b/drivers/staging/sm7xx/smtc2d.c
new file mode 100644
index 000000000000..133b86c6a678
--- /dev/null
+++ b/drivers/staging/sm7xx/smtc2d.c
@@ -0,0 +1,979 @@
1/*
2 * Silicon Motion SM7XX 2D drawing engine functions.
3 *
4 * Copyright (C) 2006 Silicon Motion Technology Corp.
5 * Author: Boyod boyod.yang@siliconmotion.com.cn
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive for
12 * more details.
13 *
14 * Version 0.10.26192.21.01
15 * - Add PowerPC support
16 * - Add 2D support for Lynx -
17 * Verified on 2.6.19.2
18 * Boyod.yang <boyod.yang@siliconmotion.com.cn>
19 */
20
21unsigned char smtc_de_busy;
22
23void SMTC_write2Dreg(unsigned long nOffset, unsigned long nData)
24{
25 writel(nData, smtc_2DBaseAddress + nOffset);
26}
27
28unsigned long SMTC_read2Dreg(unsigned long nOffset)
29{
30 return readl(smtc_2DBaseAddress + nOffset);
31}
32
33void SMTC_write2Ddataport(unsigned long nOffset, unsigned long nData)
34{
35 writel(nData, smtc_2Ddataport + nOffset);
36}
37
38/**********************************************************************
39 *
40 * deInit
41 *
42 * Purpose
43 * Drawing engine initialization.
44 *
45 **********************************************************************/
46
47void deInit(unsigned int nModeWidth, unsigned int nModeHeight,
48 unsigned int bpp)
49{
50 /* Get current power configuration. */
51 unsigned char clock;
52 clock = smtc_seqr(0x21);
53
54 /* initialize global 'mutex lock' variable */
55 smtc_de_busy = 0;
56
57 /* Enable 2D Drawing Engine */
58 smtc_seqw(0x21, clock & 0xF8);
59
60 SMTC_write2Dreg(DE_CLIP_TL,
61 FIELD_VALUE(0, DE_CLIP_TL, TOP, 0) |
62 FIELD_SET(0, DE_CLIP_TL, STATUS, DISABLE) |
63 FIELD_SET(0, DE_CLIP_TL, INHIBIT, OUTSIDE) |
64 FIELD_VALUE(0, DE_CLIP_TL, LEFT, 0));
65
66 if (bpp >= 24) {
67 SMTC_write2Dreg(DE_PITCH,
68 FIELD_VALUE(0, DE_PITCH, DESTINATION,
69 nModeWidth * 3) | FIELD_VALUE(0,
70 DE_PITCH,
71 SOURCE,
72 nModeWidth
73 * 3));
74 } else {
75 SMTC_write2Dreg(DE_PITCH,
76 FIELD_VALUE(0, DE_PITCH, DESTINATION,
77 nModeWidth) | FIELD_VALUE(0,
78 DE_PITCH,
79 SOURCE,
80 nModeWidth));
81 }
82
83 SMTC_write2Dreg(DE_WINDOW_WIDTH,
84 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
85 nModeWidth) | FIELD_VALUE(0,
86 DE_WINDOW_WIDTH,
87 SOURCE,
88 nModeWidth));
89
90 switch (bpp) {
91 case 8:
92 SMTC_write2Dreg(DE_STRETCH_FORMAT,
93 FIELD_SET(0, DE_STRETCH_FORMAT, PATTERN_XY,
94 NORMAL) | FIELD_VALUE(0,
95 DE_STRETCH_FORMAT,
96 PATTERN_Y,
97 0) |
98 FIELD_VALUE(0, DE_STRETCH_FORMAT, PATTERN_X,
99 0) | FIELD_SET(0, DE_STRETCH_FORMAT,
100 PIXEL_FORMAT,
101 8) | FIELD_SET(0,
102 DE_STRETCH_FORMAT,
103 ADDRESSING,
104 XY) |
105 FIELD_VALUE(0, DE_STRETCH_FORMAT,
106 SOURCE_HEIGHT, 3));
107 break;
108 case 24:
109 SMTC_write2Dreg(DE_STRETCH_FORMAT,
110 FIELD_SET(0, DE_STRETCH_FORMAT, PATTERN_XY,
111 NORMAL) | FIELD_VALUE(0,
112 DE_STRETCH_FORMAT,
113 PATTERN_Y,
114 0) |
115 FIELD_VALUE(0, DE_STRETCH_FORMAT, PATTERN_X,
116 0) | FIELD_SET(0, DE_STRETCH_FORMAT,
117 PIXEL_FORMAT,
118 24) | FIELD_SET(0,
119 DE_STRETCH_FORMAT,
120 ADDRESSING,
121 XY) |
122 FIELD_VALUE(0, DE_STRETCH_FORMAT,
123 SOURCE_HEIGHT, 3));
124 break;
125 case 16:
126 default:
127 SMTC_write2Dreg(DE_STRETCH_FORMAT,
128 FIELD_SET(0, DE_STRETCH_FORMAT, PATTERN_XY,
129 NORMAL) | FIELD_VALUE(0,
130 DE_STRETCH_FORMAT,
131 PATTERN_Y,
132 0) |
133 FIELD_VALUE(0, DE_STRETCH_FORMAT, PATTERN_X,
134 0) | FIELD_SET(0, DE_STRETCH_FORMAT,
135 PIXEL_FORMAT,
136 16) | FIELD_SET(0,
137 DE_STRETCH_FORMAT,
138 ADDRESSING,
139 XY) |
140 FIELD_VALUE(0, DE_STRETCH_FORMAT,
141 SOURCE_HEIGHT, 3));
142 break;
143 }
144
145 SMTC_write2Dreg(DE_MASKS,
146 FIELD_VALUE(0, DE_MASKS, BYTE_MASK, 0xFFFF) |
147 FIELD_VALUE(0, DE_MASKS, BIT_MASK, 0xFFFF));
148 SMTC_write2Dreg(DE_COLOR_COMPARE_MASK,
149 FIELD_VALUE(0, DE_COLOR_COMPARE_MASK, MASKS, \
150 0xFFFFFF));
151 SMTC_write2Dreg(DE_COLOR_COMPARE,
152 FIELD_VALUE(0, DE_COLOR_COMPARE, COLOR, 0xFFFFFF));
153}
154
155void deVerticalLine(unsigned long dst_base,
156 unsigned long dst_pitch,
157 unsigned long nX,
158 unsigned long nY,
159 unsigned long dst_height, unsigned long nColor)
160{
161 deWaitForNotBusy();
162
163 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
164 FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
165 dst_base));
166
167 SMTC_write2Dreg(DE_PITCH,
168 FIELD_VALUE(0, DE_PITCH, DESTINATION, dst_pitch) |
169 FIELD_VALUE(0, DE_PITCH, SOURCE, dst_pitch));
170
171 SMTC_write2Dreg(DE_WINDOW_WIDTH,
172 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
173 dst_pitch) | FIELD_VALUE(0, DE_WINDOW_WIDTH,
174 SOURCE,
175 dst_pitch));
176
177 SMTC_write2Dreg(DE_FOREGROUND,
178 FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
179
180 SMTC_write2Dreg(DE_DESTINATION,
181 FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
182 FIELD_VALUE(0, DE_DESTINATION, X, nX) |
183 FIELD_VALUE(0, DE_DESTINATION, Y, nY));
184
185 SMTC_write2Dreg(DE_DIMENSION,
186 FIELD_VALUE(0, DE_DIMENSION, X, 1) |
187 FIELD_VALUE(0, DE_DIMENSION, Y_ET, dst_height));
188
189 SMTC_write2Dreg(DE_CONTROL,
190 FIELD_SET(0, DE_CONTROL, STATUS, START) |
191 FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) |
192 FIELD_SET(0, DE_CONTROL, MAJOR, Y) |
193 FIELD_SET(0, DE_CONTROL, STEP_X, NEGATIVE) |
194 FIELD_SET(0, DE_CONTROL, STEP_Y, POSITIVE) |
195 FIELD_SET(0, DE_CONTROL, LAST_PIXEL, OFF) |
196 FIELD_SET(0, DE_CONTROL, COMMAND, SHORT_STROKE) |
197 FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
198 FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C));
199
200 smtc_de_busy = 1;
201}
202
203void deHorizontalLine(unsigned long dst_base,
204 unsigned long dst_pitch,
205 unsigned long nX,
206 unsigned long nY,
207 unsigned long dst_width, unsigned long nColor)
208{
209 deWaitForNotBusy();
210
211 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
212 FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
213 dst_base));
214
215 SMTC_write2Dreg(DE_PITCH,
216 FIELD_VALUE(0, DE_PITCH, DESTINATION, dst_pitch) |
217 FIELD_VALUE(0, DE_PITCH, SOURCE, dst_pitch));
218
219 SMTC_write2Dreg(DE_WINDOW_WIDTH,
220 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
221 dst_pitch) | FIELD_VALUE(0, DE_WINDOW_WIDTH,
222 SOURCE,
223 dst_pitch));
224 SMTC_write2Dreg(DE_FOREGROUND,
225 FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
226 SMTC_write2Dreg(DE_DESTINATION,
227 FIELD_SET(0, DE_DESTINATION, WRAP,
228 DISABLE) | FIELD_VALUE(0, DE_DESTINATION, X,
229 nX) | FIELD_VALUE(0,
230 DE_DESTINATION,
231 Y,
232 nY));
233 SMTC_write2Dreg(DE_DIMENSION,
234 FIELD_VALUE(0, DE_DIMENSION, X,
235 dst_width) | FIELD_VALUE(0, DE_DIMENSION,
236 Y_ET, 1));
237 SMTC_write2Dreg(DE_CONTROL,
238 FIELD_SET(0, DE_CONTROL, STATUS, START) | FIELD_SET(0,
239 DE_CONTROL,
240 DIRECTION,
241 RIGHT_TO_LEFT)
242 | FIELD_SET(0, DE_CONTROL, MAJOR, X) | FIELD_SET(0,
243 DE_CONTROL,
244 STEP_X,
245 POSITIVE)
246 | FIELD_SET(0, DE_CONTROL, STEP_Y,
247 NEGATIVE) | FIELD_SET(0, DE_CONTROL,
248 LAST_PIXEL,
249 OFF) | FIELD_SET(0,
250 DE_CONTROL,
251 COMMAND,
252 SHORT_STROKE)
253 | FIELD_SET(0, DE_CONTROL, ROP_SELECT,
254 ROP2) | FIELD_VALUE(0, DE_CONTROL, ROP,
255 0x0C));
256
257 smtc_de_busy = 1;
258}
259
260void deLine(unsigned long dst_base,
261 unsigned long dst_pitch,
262 unsigned long nX1,
263 unsigned long nY1,
264 unsigned long nX2, unsigned long nY2, unsigned long nColor)
265{
266 unsigned long nCommand =
267 FIELD_SET(0, DE_CONTROL, STATUS, START) |
268 FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) |
269 FIELD_SET(0, DE_CONTROL, MAJOR, X) |
270 FIELD_SET(0, DE_CONTROL, STEP_X, POSITIVE) |
271 FIELD_SET(0, DE_CONTROL, STEP_Y, POSITIVE) |
272 FIELD_SET(0, DE_CONTROL, LAST_PIXEL, OFF) |
273 FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
274 FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C);
275 unsigned long DeltaX;
276 unsigned long DeltaY;
277
278 /* Calculate delta X */
279 if (nX1 <= nX2)
280 DeltaX = nX2 - nX1;
281 else {
282 DeltaX = nX1 - nX2;
283 nCommand = FIELD_SET(nCommand, DE_CONTROL, STEP_X, NEGATIVE);
284 }
285
286 /* Calculate delta Y */
287 if (nY1 <= nY2)
288 DeltaY = nY2 - nY1;
289 else {
290 DeltaY = nY1 - nY2;
291 nCommand = FIELD_SET(nCommand, DE_CONTROL, STEP_Y, NEGATIVE);
292 }
293
294 /* Determine the major axis */
295 if (DeltaX < DeltaY)
296 nCommand = FIELD_SET(nCommand, DE_CONTROL, MAJOR, Y);
297
298 /* Vertical line? */
299 if (nX1 == nX2)
300 deVerticalLine(dst_base, dst_pitch, nX1, nY1, DeltaY, nColor);
301
302 /* Horizontal line? */
303 else if (nY1 == nY2)
304 deHorizontalLine(dst_base, dst_pitch, nX1, nY1, \
305 DeltaX, nColor);
306
307 /* Diagonal line? */
308 else if (DeltaX == DeltaY) {
309 deWaitForNotBusy();
310
311 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
312 FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE,
313 ADDRESS, dst_base));
314
315 SMTC_write2Dreg(DE_PITCH,
316 FIELD_VALUE(0, DE_PITCH, DESTINATION,
317 dst_pitch) | FIELD_VALUE(0,
318 DE_PITCH,
319 SOURCE,
320 dst_pitch));
321
322 SMTC_write2Dreg(DE_WINDOW_WIDTH,
323 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
324 dst_pitch) | FIELD_VALUE(0,
325 DE_WINDOW_WIDTH,
326 SOURCE,
327 dst_pitch));
328
329 SMTC_write2Dreg(DE_FOREGROUND,
330 FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
331
332 SMTC_write2Dreg(DE_DESTINATION,
333 FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
334 FIELD_VALUE(0, DE_DESTINATION, X, 1) |
335 FIELD_VALUE(0, DE_DESTINATION, Y, nY1));
336
337 SMTC_write2Dreg(DE_DIMENSION,
338 FIELD_VALUE(0, DE_DIMENSION, X, 1) |
339 FIELD_VALUE(0, DE_DIMENSION, Y_ET, DeltaX));
340
341 SMTC_write2Dreg(DE_CONTROL,
342 FIELD_SET(nCommand, DE_CONTROL, COMMAND,
343 SHORT_STROKE));
344 }
345
346 /* Generic line */
347 else {
348 unsigned int k1, k2, et, w;
349 if (DeltaX < DeltaY) {
350 k1 = 2 * DeltaX;
351 et = k1 - DeltaY;
352 k2 = et - DeltaY;
353 w = DeltaY + 1;
354 } else {
355 k1 = 2 * DeltaY;
356 et = k1 - DeltaX;
357 k2 = et - DeltaX;
358 w = DeltaX + 1;
359 }
360
361 deWaitForNotBusy();
362
363 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
364 FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE,
365 ADDRESS, dst_base));
366
367 SMTC_write2Dreg(DE_PITCH,
368 FIELD_VALUE(0, DE_PITCH, DESTINATION,
369 dst_pitch) | FIELD_VALUE(0,
370 DE_PITCH,
371 SOURCE,
372 dst_pitch));
373
374 SMTC_write2Dreg(DE_WINDOW_WIDTH,
375 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
376 dst_pitch) | FIELD_VALUE(0,
377 DE_WINDOW_WIDTH,
378 SOURCE,
379 dst_pitch));
380
381 SMTC_write2Dreg(DE_FOREGROUND,
382 FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
383
384 SMTC_write2Dreg(DE_SOURCE,
385 FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
386 FIELD_VALUE(0, DE_SOURCE, X_K1, k1) |
387 FIELD_VALUE(0, DE_SOURCE, Y_K2, k2));
388
389 SMTC_write2Dreg(DE_DESTINATION,
390 FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
391 FIELD_VALUE(0, DE_DESTINATION, X, nX1) |
392 FIELD_VALUE(0, DE_DESTINATION, Y, nY1));
393
394 SMTC_write2Dreg(DE_DIMENSION,
395 FIELD_VALUE(0, DE_DIMENSION, X, w) |
396 FIELD_VALUE(0, DE_DIMENSION, Y_ET, et));
397
398 SMTC_write2Dreg(DE_CONTROL,
399 FIELD_SET(nCommand, DE_CONTROL, COMMAND,
400 LINE_DRAW));
401 }
402
403 smtc_de_busy = 1;
404}
405
406void deFillRect(unsigned long dst_base,
407 unsigned long dst_pitch,
408 unsigned long dst_X,
409 unsigned long dst_Y,
410 unsigned long dst_width,
411 unsigned long dst_height, unsigned long nColor)
412{
413 deWaitForNotBusy();
414
415 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
416 FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
417 dst_base));
418
419 if (dst_pitch) {
420 SMTC_write2Dreg(DE_PITCH,
421 FIELD_VALUE(0, DE_PITCH, DESTINATION,
422 dst_pitch) | FIELD_VALUE(0,
423 DE_PITCH,
424 SOURCE,
425 dst_pitch));
426
427 SMTC_write2Dreg(DE_WINDOW_WIDTH,
428 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
429 dst_pitch) | FIELD_VALUE(0,
430 DE_WINDOW_WIDTH,
431 SOURCE,
432 dst_pitch));
433 }
434
435 SMTC_write2Dreg(DE_FOREGROUND,
436 FIELD_VALUE(0, DE_FOREGROUND, COLOR, nColor));
437
438 SMTC_write2Dreg(DE_DESTINATION,
439 FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
440 FIELD_VALUE(0, DE_DESTINATION, X, dst_X) |
441 FIELD_VALUE(0, DE_DESTINATION, Y, dst_Y));
442
443 SMTC_write2Dreg(DE_DIMENSION,
444 FIELD_VALUE(0, DE_DIMENSION, X, dst_width) |
445 FIELD_VALUE(0, DE_DIMENSION, Y_ET, dst_height));
446
447 SMTC_write2Dreg(DE_CONTROL,
448 FIELD_SET(0, DE_CONTROL, STATUS, START) |
449 FIELD_SET(0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) |
450 FIELD_SET(0, DE_CONTROL, LAST_PIXEL, OFF) |
451 FIELD_SET(0, DE_CONTROL, COMMAND, RECTANGLE_FILL) |
452 FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
453 FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C));
454
455 smtc_de_busy = 1;
456}
457
458/**********************************************************************
459 *
460 * deRotatePattern
461 *
462 * Purpose
463 * Rotate the given pattern if necessary
464 *
465 * Parameters
466 * [in]
467 * pPattern - Pointer to DE_SURFACE structure containing
468 * pattern attributes
469 * patternX - X position (0-7) of pattern origin
470 * patternY - Y position (0-7) of pattern origin
471 *
472 * [out]
473 * pattern_dstaddr - Pointer to pre-allocated buffer containing
474 * rotated pattern
475 *
476 **********************************************************************/
477void deRotatePattern(unsigned char *pattern_dstaddr,
478 unsigned long pattern_src_addr,
479 unsigned long pattern_BPP,
480 unsigned long pattern_stride, int patternX, int patternY)
481{
482 unsigned int i;
483 unsigned long pattern[PATTERN_WIDTH * PATTERN_HEIGHT];
484 unsigned int x, y;
485 unsigned char *pjPatByte;
486
487 if (pattern_dstaddr != NULL) {
488 deWaitForNotBusy();
489
490 if (patternX || patternY) {
491 /* Rotate pattern */
492 pjPatByte = (unsigned char *)pattern;
493
494 switch (pattern_BPP) {
495 case 8:
496 {
497 for (y = 0; y < 8; y++) {
498 unsigned char *pjBuffer =
499 pattern_dstaddr +
500 ((patternY + y) & 7) * 8;
501 for (x = 0; x < 8; x++) {
502 pjBuffer[(patternX +
503 x) & 7] =
504 pjPatByte[x];
505 }
506 pjPatByte += pattern_stride;
507 }
508 break;
509 }
510
511 case 16:
512 {
513 for (y = 0; y < 8; y++) {
514 unsigned short *pjBuffer =
515 (unsigned short *)
516 pattern_dstaddr +
517 ((patternY + y) & 7) * 8;
518 for (x = 0; x < 8; x++) {
519 pjBuffer[(patternX +
520 x) & 7] =
521 ((unsigned short *)
522 pjPatByte)[x];
523 }
524 pjPatByte += pattern_stride;
525 }
526 break;
527 }
528
529 case 32:
530 {
531 for (y = 0; y < 8; y++) {
532 unsigned long *pjBuffer =
533 (unsigned long *)
534 pattern_dstaddr +
535 ((patternY + y) & 7) * 8;
536 for (x = 0; x < 8; x++) {
537 pjBuffer[(patternX +
538 x) & 7] =
539 ((unsigned long *)
540 pjPatByte)[x];
541 }
542 pjPatByte += pattern_stride;
543 }
544 break;
545 }
546 }
547 } else {
548 /*Don't rotate,just copy pattern into pattern_dstaddr*/
549 for (i = 0; i < (pattern_BPP * 2); i++) {
550 ((unsigned long *)pattern_dstaddr)[i] =
551 pattern[i];
552 }
553 }
554
555 }
556}
557
558/**********************************************************************
559 *
560 * deCopy
561 *
562 * Purpose
563 * Copy a rectangular area of the source surface to a destination surface
564 *
565 * Remarks
566 * Source bitmap must have the same color depth (BPP) as the destination
567 * bitmap.
568 *
569**********************************************************************/
570void deCopy(unsigned long dst_base,
571 unsigned long dst_pitch,
572 unsigned long dst_BPP,
573 unsigned long dst_X,
574 unsigned long dst_Y,
575 unsigned long dst_width,
576 unsigned long dst_height,
577 unsigned long src_base,
578 unsigned long src_pitch,
579 unsigned long src_X,
580 unsigned long src_Y, pTransparent pTransp, unsigned char nROP2)
581{
582 unsigned long nDirection = 0;
583 unsigned long nTransparent = 0;
584 /* Direction of ROP2 operation:
585 * 1 = Left to Right,
586 * (-1) = Right to Left
587 */
588 unsigned long opSign = 1;
589 /* xWidth is in pixels */
590 unsigned long xWidth = 192 / (dst_BPP / 8);
591 unsigned long de_ctrl = 0;
592
593 deWaitForNotBusy();
594
595 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE,
596 FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS,
597 dst_base));
598
599 SMTC_write2Dreg(DE_WINDOW_SOURCE_BASE,
600 FIELD_VALUE(0, DE_WINDOW_SOURCE_BASE, ADDRESS,
601 src_base));
602
603 if (dst_pitch && src_pitch) {
604 SMTC_write2Dreg(DE_PITCH,
605 FIELD_VALUE(0, DE_PITCH, DESTINATION,
606 dst_pitch) | FIELD_VALUE(0,
607 DE_PITCH,
608 SOURCE,
609 src_pitch));
610
611 SMTC_write2Dreg(DE_WINDOW_WIDTH,
612 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
613 dst_pitch) | FIELD_VALUE(0,
614 DE_WINDOW_WIDTH,
615 SOURCE,
616 src_pitch));
617 }
618
619 /* Set transparent bits if necessary */
620 if (pTransp != NULL) {
621 nTransparent =
622 pTransp->match | pTransp->select | pTransp->control;
623
624 /* Set color compare register */
625 SMTC_write2Dreg(DE_COLOR_COMPARE,
626 FIELD_VALUE(0, DE_COLOR_COMPARE, COLOR,
627 pTransp->color));
628 }
629
630 /* Determine direction of operation */
631 if (src_Y < dst_Y) {
632 /* +----------+
633 |S |
634 | +----------+
635 | | | |
636 | | | |
637 +---|------+ |
638 | D |
639 +----------+ */
640
641 nDirection = BOTTOM_TO_TOP;
642 } else if (src_Y > dst_Y) {
643 /* +----------+
644 |D |
645 | +----------+
646 | | | |
647 | | | |
648 +---|------+ |
649 | S |
650 +----------+ */
651
652 nDirection = TOP_TO_BOTTOM;
653 } else {
654 /* src_Y == dst_Y */
655
656 if (src_X <= dst_X) {
657 /* +------+---+------+
658 |S | | D|
659 | | | |
660 | | | |
661 | | | |
662 +------+---+------+ */
663
664 nDirection = RIGHT_TO_LEFT;
665 } else {
666 /* src_X > dst_X */
667
668 /* +------+---+------+
669 |D | | S|
670 | | | |
671 | | | |
672 | | | |
673 +------+---+------+ */
674
675 nDirection = LEFT_TO_RIGHT;
676 }
677 }
678
679 if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) {
680 src_X += dst_width - 1;
681 src_Y += dst_height - 1;
682 dst_X += dst_width - 1;
683 dst_Y += dst_height - 1;
684 opSign = (-1);
685 }
686
687 if (dst_BPP >= 24) {
688 src_X *= 3;
689 src_Y *= 3;
690 dst_X *= 3;
691 dst_Y *= 3;
692 dst_width *= 3;
693 if ((nDirection == BOTTOM_TO_TOP)
694 || (nDirection == RIGHT_TO_LEFT)) {
695 src_X += 2;
696 dst_X += 2;
697 }
698 }
699
700 /* Workaround for 192 byte hw bug */
701 if ((nROP2 != 0x0C) && ((dst_width * (dst_BPP / 8)) >= 192)) {
702 /*
703 * Perform the ROP2 operation in chunks of (xWidth *
704 * dst_height)
705 */
706 while (1) {
707 deWaitForNotBusy();
708
709 SMTC_write2Dreg(DE_SOURCE,
710 FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
711 FIELD_VALUE(0, DE_SOURCE, X_K1, src_X) |
712 FIELD_VALUE(0, DE_SOURCE, Y_K2, src_Y));
713
714 SMTC_write2Dreg(DE_DESTINATION,
715 FIELD_SET(0, DE_DESTINATION, WRAP,
716 DISABLE) | FIELD_VALUE(0,
717 DE_DESTINATION,
718 X,
719 dst_X)
720 | FIELD_VALUE(0, DE_DESTINATION, Y,
721 dst_Y));
722
723 SMTC_write2Dreg(DE_DIMENSION,
724 FIELD_VALUE(0, DE_DIMENSION, X,
725 xWidth) | FIELD_VALUE(0,
726 DE_DIMENSION,
727 Y_ET,
728 dst_height));
729
730 de_ctrl =
731 FIELD_VALUE(0, DE_CONTROL, ROP,
732 nROP2) | nTransparent | FIELD_SET(0,
733 DE_CONTROL,
734 ROP_SELECT,
735 ROP2)
736 | FIELD_SET(0, DE_CONTROL, COMMAND,
737 BITBLT) | ((nDirection ==
738 1) ? FIELD_SET(0,
739 DE_CONTROL,
740 DIRECTION,
741 RIGHT_TO_LEFT)
742 : FIELD_SET(0, DE_CONTROL,
743 DIRECTION,
744 LEFT_TO_RIGHT)) |
745 FIELD_SET(0, DE_CONTROL, STATUS, START);
746
747 SMTC_write2Dreg(DE_CONTROL, de_ctrl);
748
749 src_X += (opSign * xWidth);
750 dst_X += (opSign * xWidth);
751 dst_width -= xWidth;
752
753 if (dst_width <= 0) {
754 /* ROP2 operation is complete */
755 break;
756 }
757
758 if (xWidth > dst_width)
759 xWidth = dst_width;
760 }
761 } else {
762 deWaitForNotBusy();
763 SMTC_write2Dreg(DE_SOURCE,
764 FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
765 FIELD_VALUE(0, DE_SOURCE, X_K1, src_X) |
766 FIELD_VALUE(0, DE_SOURCE, Y_K2, src_Y));
767
768 SMTC_write2Dreg(DE_DESTINATION,
769 FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
770 FIELD_VALUE(0, DE_DESTINATION, X, dst_X) |
771 FIELD_VALUE(0, DE_DESTINATION, Y, dst_Y));
772
773 SMTC_write2Dreg(DE_DIMENSION,
774 FIELD_VALUE(0, DE_DIMENSION, X, dst_width) |
775 FIELD_VALUE(0, DE_DIMENSION, Y_ET, dst_height));
776
777 de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, nROP2) |
778 nTransparent |
779 FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
780 FIELD_SET(0, DE_CONTROL, COMMAND, BITBLT) |
781 ((nDirection == 1) ? FIELD_SET(0, DE_CONTROL, DIRECTION,
782 RIGHT_TO_LEFT)
783 : FIELD_SET(0, DE_CONTROL, DIRECTION,
784 LEFT_TO_RIGHT)) | FIELD_SET(0, DE_CONTROL,
785 STATUS, START);
786 SMTC_write2Dreg(DE_CONTROL, de_ctrl);
787 }
788
789 smtc_de_busy = 1;
790}
791
792/*
793 * This function sets the pixel format that will apply to the 2D Engine.
794 */
795void deSetPixelFormat(unsigned long bpp)
796{
797 unsigned long de_format;
798
799 de_format = SMTC_read2Dreg(DE_STRETCH_FORMAT);
800
801 switch (bpp) {
802 case 8:
803 de_format =
804 FIELD_SET(de_format, DE_STRETCH_FORMAT, PIXEL_FORMAT, 8);
805 break;
806 default:
807 case 16:
808 de_format =
809 FIELD_SET(de_format, DE_STRETCH_FORMAT, PIXEL_FORMAT, 16);
810 break;
811 case 32:
812 de_format =
813 FIELD_SET(de_format, DE_STRETCH_FORMAT, PIXEL_FORMAT, 32);
814 break;
815 }
816
817 SMTC_write2Dreg(DE_STRETCH_FORMAT, de_format);
818}
819
820/*
821 * System memory to Video memory monochrome expansion.
822 *
823 * Source is monochrome image in system memory. This function expands the
824 * monochrome data to color image in video memory.
825 */
826
827long deSystemMem2VideoMemMonoBlt(const char *pSrcbuf,
828 long srcDelta,
829 unsigned long startBit,
830 unsigned long dBase,
831 unsigned long dPitch,
832 unsigned long bpp,
833 unsigned long dx, unsigned long dy,
834 unsigned long width, unsigned long height,
835 unsigned long fColor,
836 unsigned long bColor,
837 unsigned long rop2) {
838 unsigned long bytePerPixel;
839 unsigned long ulBytesPerScan;
840 unsigned long ul4BytesPerScan;
841 unsigned long ulBytesRemain;
842 unsigned long de_ctrl = 0;
843 unsigned char ajRemain[4];
844 long i, j;
845
846 bytePerPixel = bpp / 8;
847
848 /* Just make sure the start bit is within legal range */
849 startBit &= 7;
850
851 ulBytesPerScan = (width + startBit + 7) / 8;
852 ul4BytesPerScan = ulBytesPerScan & ~3;
853 ulBytesRemain = ulBytesPerScan & 3;
854
855 if (smtc_de_busy)
856 deWaitForNotBusy();
857
858 /*
859 * 2D Source Base. Use 0 for HOST Blt.
860 */
861
862 SMTC_write2Dreg(DE_WINDOW_SOURCE_BASE, 0);
863
864 /*
865 * 2D Destination Base.
866 *
867 * It is an address offset (128 bit aligned) from the beginning of
868 * frame buffer.
869 */
870
871 SMTC_write2Dreg(DE_WINDOW_DESTINATION_BASE, dBase);
872
873 if (dPitch) {
874
875 /*
876 * Program pitch (distance between the 1st points of two
877 * adjacent lines).
878 *
879 * Note that input pitch is BYTE value, but the 2D Pitch
880 * register uses pixel values. Need Byte to pixel convertion.
881 */
882
883 SMTC_write2Dreg(DE_PITCH,
884 FIELD_VALUE(0, DE_PITCH, DESTINATION,
885 dPitch /
886 bytePerPixel) | FIELD_VALUE(0,
887 DE_PITCH,
888 SOURCE,
889 dPitch /
890 bytePerPixel));
891
892 /* Screen Window width in Pixels.
893 *
894 * 2D engine uses this value to calculate the linear address in
895 * frame buffer for a given point.
896 */
897
898 SMTC_write2Dreg(DE_WINDOW_WIDTH,
899 FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION,
900 (dPitch /
901 bytePerPixel)) | FIELD_VALUE(0,
902 DE_WINDOW_WIDTH,
903 SOURCE,
904 (dPitch
905 /
906 bytePerPixel)));
907 }
908 /* Note: For 2D Source in Host Write, only X_K1 field is needed, and
909 * Y_K2 field is not used. For mono bitmap, use startBit for X_K1.
910 */
911
912 SMTC_write2Dreg(DE_SOURCE,
913 FIELD_SET(0, DE_SOURCE, WRAP, DISABLE) |
914 FIELD_VALUE(0, DE_SOURCE, X_K1, startBit) |
915 FIELD_VALUE(0, DE_SOURCE, Y_K2, 0));
916
917 SMTC_write2Dreg(DE_DESTINATION,
918 FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) |
919 FIELD_VALUE(0, DE_DESTINATION, X, dx) |
920 FIELD_VALUE(0, DE_DESTINATION, Y, dy));
921
922 SMTC_write2Dreg(DE_DIMENSION,
923 FIELD_VALUE(0, DE_DIMENSION, X, width) |
924 FIELD_VALUE(0, DE_DIMENSION, Y_ET, height));
925
926 SMTC_write2Dreg(DE_FOREGROUND, fColor);
927 SMTC_write2Dreg(DE_BACKGROUND, bColor);
928
929 if (bpp)
930 deSetPixelFormat(bpp);
931 /* Set the pixel format of the destination */
932
933 de_ctrl = FIELD_VALUE(0, DE_CONTROL, ROP, rop2) |
934 FIELD_SET(0, DE_CONTROL, ROP_SELECT, ROP2) |
935 FIELD_SET(0, DE_CONTROL, COMMAND, HOST_WRITE) |
936 FIELD_SET(0, DE_CONTROL, HOST, MONO) |
937 FIELD_SET(0, DE_CONTROL, STATUS, START);
938
939 SMTC_write2Dreg(DE_CONTROL, de_ctrl | deGetTransparency());
940
941 /* Write MONO data (line by line) to 2D Engine data port */
942 for (i = 0; i < height; i++) {
943 /* For each line, send the data in chunks of 4 bytes */
944 for (j = 0; j < (ul4BytesPerScan / 4); j++)
945 SMTC_write2Ddataport(0,
946 *(unsigned long *)(pSrcbuf +
947 (j * 4)));
948
949 if (ulBytesRemain) {
950 memcpy(ajRemain, pSrcbuf + ul4BytesPerScan,
951 ulBytesRemain);
952 SMTC_write2Ddataport(0, *(unsigned long *)ajRemain);
953 }
954
955 pSrcbuf += srcDelta;
956 }
957 smtc_de_busy = 1;
958
959 return 0;
960}
961
962/*
963 * This function gets the transparency status from DE_CONTROL register.
964 * It returns a double word with the transparent fields properly set,
965 * while other fields are 0.
966 */
967unsigned long deGetTransparency(void)
968{
969 unsigned long de_ctrl;
970
971 de_ctrl = SMTC_read2Dreg(DE_CONTROL);
972
973 de_ctrl &=
974 FIELD_MASK(DE_CONTROL_TRANSPARENCY_MATCH) |
975 FIELD_MASK(DE_CONTROL_TRANSPARENCY_SELECT) |
976 FIELD_MASK(DE_CONTROL_TRANSPARENCY);
977
978 return de_ctrl;
979}
diff --git a/drivers/staging/sm7xx/smtc2d.h b/drivers/staging/sm7xx/smtc2d.h
new file mode 100644
index 000000000000..38d0c335322b
--- /dev/null
+++ b/drivers/staging/sm7xx/smtc2d.h
@@ -0,0 +1,530 @@
1/*
2 * Silicon Motion SM712 2D drawing engine functions.
3 *
4 * Copyright (C) 2006 Silicon Motion Technology Corp.
5 * Author: Ge Wang, gewang@siliconmotion.com
6 *
7 * Copyright (C) 2009 Lemote, Inc.
8 * Author: Wu Zhangjin, wuzj@lemote.com
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive for
12 * more details.
13 */
14
15#ifndef NULL
16#define NULL 0
17#endif
18
19/* Internal macros */
20
21#define _F_START(f) (0 ? f)
22#define _F_END(f) (1 ? f)
23#define _F_SIZE(f) (1 + _F_END(f) - _F_START(f))
24#define _F_MASK(f) (((1ULL << _F_SIZE(f)) - 1) << _F_START(f))
25#define _F_NORMALIZE(v, f) (((v) & _F_MASK(f)) >> _F_START(f))
26#define _F_DENORMALIZE(v, f) (((v) << _F_START(f)) & _F_MASK(f))
27
28/* Global macros */
29
30#define FIELD_GET(x, reg, field) \
31( \
32 _F_NORMALIZE((x), reg ## _ ## field) \
33)
34
35#define FIELD_SET(x, reg, field, value) \
36( \
37 (x & ~_F_MASK(reg ## _ ## field)) \
38 | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \
39)
40
41#define FIELD_VALUE(x, reg, field, value) \
42( \
43 (x & ~_F_MASK(reg ## _ ## field)) \
44 | _F_DENORMALIZE(value, reg ## _ ## field) \
45)
46
47#define FIELD_CLEAR(reg, field) \
48( \
49 ~_F_MASK(reg ## _ ## field) \
50)
51
52/* Field Macros */
53
54#define FIELD_START(field) (0 ? field)
55#define FIELD_END(field) (1 ? field)
56#define FIELD_SIZE(field) \
57 (1 + FIELD_END(field) - FIELD_START(field))
58
59#define FIELD_MASK(field) \
60 (((1 << (FIELD_SIZE(field)-1)) \
61 | ((1 << (FIELD_SIZE(field)-1)) - 1)) \
62 << FIELD_START(field))
63
64#define FIELD_NORMALIZE(reg, field) \
65 (((reg) & FIELD_MASK(field)) >> FIELD_START(field))
66
67#define FIELD_DENORMALIZE(field, value) \
68 (((value) << FIELD_START(field)) & FIELD_MASK(field))
69
70#define FIELD_INIT(reg, field, value) \
71 FIELD_DENORMALIZE(reg ## _ ## field, \
72 reg ## _ ## field ## _ ## value)
73
74#define FIELD_INIT_VAL(reg, field, value) \
75 (FIELD_DENORMALIZE(reg ## _ ## field, value))
76
77#define FIELD_VAL_SET(x, r, f, v) ({ \
78 x = (x & ~FIELD_MASK(r ## _ ## f)) \
79 | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) \
80})
81
82#define RGB(r, g, b) ((unsigned long)(((r) << 16) | ((g) << 8) | (b)))
83
84/* Transparent info definition */
85typedef struct {
86 unsigned long match; /* Matching pixel is OPAQUE/TRANSPARENT */
87 unsigned long select; /* Transparency controlled by SRC/DST */
88 unsigned long control; /* ENABLE/DISABLE transparency */
89 unsigned long color; /* Transparent color */
90} Transparent, *pTransparent;
91
92#define PIXEL_DEPTH_1_BP 0 /* 1 bit per pixel */
93#define PIXEL_DEPTH_8_BPP 1 /* 8 bits per pixel */
94#define PIXEL_DEPTH_16_BPP 2 /* 16 bits per pixel */
95#define PIXEL_DEPTH_32_BPP 3 /* 32 bits per pixel */
96#define PIXEL_DEPTH_YUV422 8 /* 16 bits per pixel YUV422 */
97#define PIXEL_DEPTH_YUV420 9 /* 16 bits per pixel YUV420 */
98
99#define PATTERN_WIDTH 8
100#define PATTERN_HEIGHT 8
101
102#define TOP_TO_BOTTOM 0
103#define BOTTOM_TO_TOP 1
104#define RIGHT_TO_LEFT BOTTOM_TO_TOP
105#define LEFT_TO_RIGHT TOP_TO_BOTTOM
106
107/* Constants used in Transparent structure */
108#define MATCH_OPAQUE 0x00000000
109#define MATCH_TRANSPARENT 0x00000400
110#define SOURCE 0x00000000
111#define DESTINATION 0x00000200
112
113/* 2D registers. */
114
115#define DE_SOURCE 0x000000
116#define DE_SOURCE_WRAP 31 : 31
117#define DE_SOURCE_WRAP_DISABLE 0
118#define DE_SOURCE_WRAP_ENABLE 1
119#define DE_SOURCE_X_K1 29 : 16
120#define DE_SOURCE_Y_K2 15 : 0
121
122#define DE_DESTINATION 0x000004
123#define DE_DESTINATION_WRAP 31 : 31
124#define DE_DESTINATION_WRAP_DISABLE 0
125#define DE_DESTINATION_WRAP_ENABLE 1
126#define DE_DESTINATION_X 28 : 16
127#define DE_DESTINATION_Y 15 : 0
128
129#define DE_DIMENSION 0x000008
130#define DE_DIMENSION_X 28 : 16
131#define DE_DIMENSION_Y_ET 15 : 0
132
133#define DE_CONTROL 0x00000C
134#define DE_CONTROL_STATUS 31 : 31
135#define DE_CONTROL_STATUS_STOP 0
136#define DE_CONTROL_STATUS_START 1
137#define DE_CONTROL_PATTERN 30 : 30
138#define DE_CONTROL_PATTERN_MONO 0
139#define DE_CONTROL_PATTERN_COLOR 1
140#define DE_CONTROL_UPDATE_DESTINATION_X 29 : 29
141#define DE_CONTROL_UPDATE_DESTINATION_X_DISABLE 0
142#define DE_CONTROL_UPDATE_DESTINATION_X_ENABLE 1
143#define DE_CONTROL_QUICK_START 28 : 28
144#define DE_CONTROL_QUICK_START_DISABLE 0
145#define DE_CONTROL_QUICK_START_ENABLE 1
146#define DE_CONTROL_DIRECTION 27 : 27
147#define DE_CONTROL_DIRECTION_LEFT_TO_RIGHT 0
148#define DE_CONTROL_DIRECTION_RIGHT_TO_LEFT 1
149#define DE_CONTROL_MAJOR 26 : 26
150#define DE_CONTROL_MAJOR_X 0
151#define DE_CONTROL_MAJOR_Y 1
152#define DE_CONTROL_STEP_X 25 : 25
153#define DE_CONTROL_STEP_X_POSITIVE 1
154#define DE_CONTROL_STEP_X_NEGATIVE 0
155#define DE_CONTROL_STEP_Y 24 : 24
156#define DE_CONTROL_STEP_Y_POSITIVE 1
157#define DE_CONTROL_STEP_Y_NEGATIVE 0
158#define DE_CONTROL_STRETCH 23 : 23
159#define DE_CONTROL_STRETCH_DISABLE 0
160#define DE_CONTROL_STRETCH_ENABLE 1
161#define DE_CONTROL_HOST 22 : 22
162#define DE_CONTROL_HOST_COLOR 0
163#define DE_CONTROL_HOST_MONO 1
164#define DE_CONTROL_LAST_PIXEL 21 : 21
165#define DE_CONTROL_LAST_PIXEL_OFF 0
166#define DE_CONTROL_LAST_PIXEL_ON 1
167#define DE_CONTROL_COMMAND 20 : 16
168#define DE_CONTROL_COMMAND_BITBLT 0
169#define DE_CONTROL_COMMAND_RECTANGLE_FILL 1
170#define DE_CONTROL_COMMAND_DE_TILE 2
171#define DE_CONTROL_COMMAND_TRAPEZOID_FILL 3
172#define DE_CONTROL_COMMAND_ALPHA_BLEND 4
173#define DE_CONTROL_COMMAND_RLE_STRIP 5
174#define DE_CONTROL_COMMAND_SHORT_STROKE 6
175#define DE_CONTROL_COMMAND_LINE_DRAW 7
176#define DE_CONTROL_COMMAND_HOST_WRITE 8
177#define DE_CONTROL_COMMAND_HOST_READ 9
178#define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP 10
179#define DE_CONTROL_COMMAND_ROTATE 11
180#define DE_CONTROL_COMMAND_FONT 12
181#define DE_CONTROL_COMMAND_TEXTURE_LOAD 15
182#define DE_CONTROL_ROP_SELECT 15 : 15
183#define DE_CONTROL_ROP_SELECT_ROP3 0
184#define DE_CONTROL_ROP_SELECT_ROP2 1
185#define DE_CONTROL_ROP2_SOURCE 14 : 14
186#define DE_CONTROL_ROP2_SOURCE_BITMAP 0
187#define DE_CONTROL_ROP2_SOURCE_PATTERN 1
188#define DE_CONTROL_MONO_DATA 13 : 12
189#define DE_CONTROL_MONO_DATA_NOT_PACKED 0
190#define DE_CONTROL_MONO_DATA_8_PACKED 1
191#define DE_CONTROL_MONO_DATA_16_PACKED 2
192#define DE_CONTROL_MONO_DATA_32_PACKED 3
193#define DE_CONTROL_REPEAT_ROTATE 11 : 11
194#define DE_CONTROL_REPEAT_ROTATE_DISABLE 0
195#define DE_CONTROL_REPEAT_ROTATE_ENABLE 1
196#define DE_CONTROL_TRANSPARENCY_MATCH 10 : 10
197#define DE_CONTROL_TRANSPARENCY_MATCH_OPAQUE 0
198#define DE_CONTROL_TRANSPARENCY_MATCH_TRANSPARENT 1
199#define DE_CONTROL_TRANSPARENCY_SELECT 9 : 9
200#define DE_CONTROL_TRANSPARENCY_SELECT_SOURCE 0
201#define DE_CONTROL_TRANSPARENCY_SELECT_DESTINATION 1
202#define DE_CONTROL_TRANSPARENCY 8 : 8
203#define DE_CONTROL_TRANSPARENCY_DISABLE 0
204#define DE_CONTROL_TRANSPARENCY_ENABLE 1
205#define DE_CONTROL_ROP 7 : 0
206
207/* Pseudo fields. */
208
209#define DE_CONTROL_SHORT_STROKE_DIR 27 : 24
210#define DE_CONTROL_SHORT_STROKE_DIR_225 0
211#define DE_CONTROL_SHORT_STROKE_DIR_135 1
212#define DE_CONTROL_SHORT_STROKE_DIR_315 2
213#define DE_CONTROL_SHORT_STROKE_DIR_45 3
214#define DE_CONTROL_SHORT_STROKE_DIR_270 4
215#define DE_CONTROL_SHORT_STROKE_DIR_90 5
216#define DE_CONTROL_SHORT_STROKE_DIR_180 8
217#define DE_CONTROL_SHORT_STROKE_DIR_0 10
218#define DE_CONTROL_ROTATION 25 : 24
219#define DE_CONTROL_ROTATION_0 0
220#define DE_CONTROL_ROTATION_270 1
221#define DE_CONTROL_ROTATION_90 2
222#define DE_CONTROL_ROTATION_180 3
223
224#define DE_PITCH 0x000010
225#define DE_PITCH_DESTINATION 28 : 16
226#define DE_PITCH_SOURCE 12 : 0
227
228#define DE_FOREGROUND 0x000014
229#define DE_FOREGROUND_COLOR 31 : 0
230
231#define DE_BACKGROUND 0x000018
232#define DE_BACKGROUND_COLOR 31 : 0
233
234#define DE_STRETCH_FORMAT 0x00001C
235#define DE_STRETCH_FORMAT_PATTERN_XY 30 : 30
236#define DE_STRETCH_FORMAT_PATTERN_XY_NORMAL 0
237#define DE_STRETCH_FORMAT_PATTERN_XY_OVERWRITE 1
238#define DE_STRETCH_FORMAT_PATTERN_Y 29 : 27
239#define DE_STRETCH_FORMAT_PATTERN_X 25 : 23
240#define DE_STRETCH_FORMAT_PIXEL_FORMAT 21 : 20
241#define DE_STRETCH_FORMAT_PIXEL_FORMAT_8 0
242#define DE_STRETCH_FORMAT_PIXEL_FORMAT_16 1
243#define DE_STRETCH_FORMAT_PIXEL_FORMAT_24 3
244#define DE_STRETCH_FORMAT_PIXEL_FORMAT_32 2
245#define DE_STRETCH_FORMAT_ADDRESSING 19 : 16
246#define DE_STRETCH_FORMAT_ADDRESSING_XY 0
247#define DE_STRETCH_FORMAT_ADDRESSING_LINEAR 15
248#define DE_STRETCH_FORMAT_SOURCE_HEIGHT 11 : 0
249
250#define DE_COLOR_COMPARE 0x000020
251#define DE_COLOR_COMPARE_COLOR 23 : 0
252
253#define DE_COLOR_COMPARE_MASK 0x000024
254#define DE_COLOR_COMPARE_MASK_MASKS 23 : 0
255
256#define DE_MASKS 0x000028
257#define DE_MASKS_BYTE_MASK 31 : 16
258#define DE_MASKS_BIT_MASK 15 : 0
259
260#define DE_CLIP_TL 0x00002C
261#define DE_CLIP_TL_TOP 31 : 16
262#define DE_CLIP_TL_STATUS 13 : 13
263#define DE_CLIP_TL_STATUS_DISABLE 0
264#define DE_CLIP_TL_STATUS_ENABLE 1
265#define DE_CLIP_TL_INHIBIT 12 : 12
266#define DE_CLIP_TL_INHIBIT_OUTSIDE 0
267#define DE_CLIP_TL_INHIBIT_INSIDE 1
268#define DE_CLIP_TL_LEFT 11 : 0
269
270#define DE_CLIP_BR 0x000030
271#define DE_CLIP_BR_BOTTOM 31 : 16
272#define DE_CLIP_BR_RIGHT 12 : 0
273
274#define DE_MONO_PATTERN_LOW 0x000034
275#define DE_MONO_PATTERN_LOW_PATTERN 31 : 0
276
277#define DE_MONO_PATTERN_HIGH 0x000038
278#define DE_MONO_PATTERN_HIGH_PATTERN 31 : 0
279
280#define DE_WINDOW_WIDTH 0x00003C
281#define DE_WINDOW_WIDTH_DESTINATION 28 : 16
282#define DE_WINDOW_WIDTH_SOURCE 12 : 0
283
284#define DE_WINDOW_SOURCE_BASE 0x000040
285#define DE_WINDOW_SOURCE_BASE_EXT 27 : 27
286#define DE_WINDOW_SOURCE_BASE_EXT_LOCAL 0
287#define DE_WINDOW_SOURCE_BASE_EXT_EXTERNAL 1
288#define DE_WINDOW_SOURCE_BASE_CS 26 : 26
289#define DE_WINDOW_SOURCE_BASE_CS_0 0
290#define DE_WINDOW_SOURCE_BASE_CS_1 1
291#define DE_WINDOW_SOURCE_BASE_ADDRESS 25 : 0
292
293#define DE_WINDOW_DESTINATION_BASE 0x000044
294#define DE_WINDOW_DESTINATION_BASE_EXT 27 : 27
295#define DE_WINDOW_DESTINATION_BASE_EXT_LOCAL 0
296#define DE_WINDOW_DESTINATION_BASE_EXT_EXTERNAL 1
297#define DE_WINDOW_DESTINATION_BASE_CS 26 : 26
298#define DE_WINDOW_DESTINATION_BASE_CS_0 0
299#define DE_WINDOW_DESTINATION_BASE_CS_1 1
300#define DE_WINDOW_DESTINATION_BASE_ADDRESS 25 : 0
301
302#define DE_ALPHA 0x000048
303#define DE_ALPHA_VALUE 7 : 0
304
305#define DE_WRAP 0x00004C
306#define DE_WRAP_X 31 : 16
307#define DE_WRAP_Y 15 : 0
308
309#define DE_STATUS 0x000050
310#define DE_STATUS_CSC 1 : 1
311#define DE_STATUS_CSC_CLEAR 0
312#define DE_STATUS_CSC_NOT_ACTIVE 0
313#define DE_STATUS_CSC_ACTIVE 1
314#define DE_STATUS_2D 0 : 0
315#define DE_STATUS_2D_CLEAR 0
316#define DE_STATUS_2D_NOT_ACTIVE 0
317#define DE_STATUS_2D_ACTIVE 1
318
319/* Color Space Conversion registers. */
320
321#define CSC_Y_SOURCE_BASE 0x0000C8
322#define CSC_Y_SOURCE_BASE_EXT 27 : 27
323#define CSC_Y_SOURCE_BASE_EXT_LOCAL 0
324#define CSC_Y_SOURCE_BASE_EXT_EXTERNAL 1
325#define CSC_Y_SOURCE_BASE_CS 26 : 26
326#define CSC_Y_SOURCE_BASE_CS_0 0
327#define CSC_Y_SOURCE_BASE_CS_1 1
328#define CSC_Y_SOURCE_BASE_ADDRESS 25 : 0
329
330#define CSC_CONSTANTS 0x0000CC
331#define CSC_CONSTANTS_Y 31 : 24
332#define CSC_CONSTANTS_R 23 : 16
333#define CSC_CONSTANTS_G 15 : 8
334#define CSC_CONSTANTS_B 7 : 0
335
336#define CSC_Y_SOURCE_X 0x0000D0
337#define CSC_Y_SOURCE_X_INTEGER 26 : 16
338#define CSC_Y_SOURCE_X_FRACTION 15 : 3
339
340#define CSC_Y_SOURCE_Y 0x0000D4
341#define CSC_Y_SOURCE_Y_INTEGER 27 : 16
342#define CSC_Y_SOURCE_Y_FRACTION 15 : 3
343
344#define CSC_U_SOURCE_BASE 0x0000D8
345#define CSC_U_SOURCE_BASE_EXT 27 : 27
346#define CSC_U_SOURCE_BASE_EXT_LOCAL 0
347#define CSC_U_SOURCE_BASE_EXT_EXTERNAL 1
348#define CSC_U_SOURCE_BASE_CS 26 : 26
349#define CSC_U_SOURCE_BASE_CS_0 0
350#define CSC_U_SOURCE_BASE_CS_1 1
351#define CSC_U_SOURCE_BASE_ADDRESS 25 : 0
352
353#define CSC_V_SOURCE_BASE 0x0000DC
354#define CSC_V_SOURCE_BASE_EXT 27 : 27
355#define CSC_V_SOURCE_BASE_EXT_LOCAL 0
356#define CSC_V_SOURCE_BASE_EXT_EXTERNAL 1
357#define CSC_V_SOURCE_BASE_CS 26 : 26
358#define CSC_V_SOURCE_BASE_CS_0 0
359#define CSC_V_SOURCE_BASE_CS_1 1
360#define CSC_V_SOURCE_BASE_ADDRESS 25 : 0
361
362#define CSC_SOURCE_DIMENSION 0x0000E0
363#define CSC_SOURCE_DIMENSION_X 31 : 16
364#define CSC_SOURCE_DIMENSION_Y 15 : 0
365
366#define CSC_SOURCE_PITCH 0x0000E4
367#define CSC_SOURCE_PITCH_Y 31 : 16
368#define CSC_SOURCE_PITCH_UV 15 : 0
369
370#define CSC_DESTINATION 0x0000E8
371#define CSC_DESTINATION_WRAP 31 : 31
372#define CSC_DESTINATION_WRAP_DISABLE 0
373#define CSC_DESTINATION_WRAP_ENABLE 1
374#define CSC_DESTINATION_X 27 : 16
375#define CSC_DESTINATION_Y 11 : 0
376
377#define CSC_DESTINATION_DIMENSION 0x0000EC
378#define CSC_DESTINATION_DIMENSION_X 31 : 16
379#define CSC_DESTINATION_DIMENSION_Y 15 : 0
380
381#define CSC_DESTINATION_PITCH 0x0000F0
382#define CSC_DESTINATION_PITCH_X 31 : 16
383#define CSC_DESTINATION_PITCH_Y 15 : 0
384
385#define CSC_SCALE_FACTOR 0x0000F4
386#define CSC_SCALE_FACTOR_HORIZONTAL 31 : 16
387#define CSC_SCALE_FACTOR_VERTICAL 15 : 0
388
389#define CSC_DESTINATION_BASE 0x0000F8
390#define CSC_DESTINATION_BASE_EXT 27 : 27
391#define CSC_DESTINATION_BASE_EXT_LOCAL 0
392#define CSC_DESTINATION_BASE_EXT_EXTERNAL 1
393#define CSC_DESTINATION_BASE_CS 26 : 26
394#define CSC_DESTINATION_BASE_CS_0 0
395#define CSC_DESTINATION_BASE_CS_1 1
396#define CSC_DESTINATION_BASE_ADDRESS 25 : 0
397
398#define CSC_CONTROL 0x0000FC
399#define CSC_CONTROL_STATUS 31 : 31
400#define CSC_CONTROL_STATUS_STOP 0
401#define CSC_CONTROL_STATUS_START 1
402#define CSC_CONTROL_SOURCE_FORMAT 30 : 28
403#define CSC_CONTROL_SOURCE_FORMAT_YUV422 0
404#define CSC_CONTROL_SOURCE_FORMAT_YUV420I 1
405#define CSC_CONTROL_SOURCE_FORMAT_YUV420 2
406#define CSC_CONTROL_SOURCE_FORMAT_YVU9 3
407#define CSC_CONTROL_SOURCE_FORMAT_IYU1 4
408#define CSC_CONTROL_SOURCE_FORMAT_IYU2 5
409#define CSC_CONTROL_SOURCE_FORMAT_RGB565 6
410#define CSC_CONTROL_SOURCE_FORMAT_RGB8888 7
411#define CSC_CONTROL_DESTINATION_FORMAT 27 : 26
412#define CSC_CONTROL_DESTINATION_FORMAT_RGB565 0
413#define CSC_CONTROL_DESTINATION_FORMAT_RGB8888 1
414#define CSC_CONTROL_HORIZONTAL_FILTER 25 : 25
415#define CSC_CONTROL_HORIZONTAL_FILTER_DISABLE 0
416#define CSC_CONTROL_HORIZONTAL_FILTER_ENABLE 1
417#define CSC_CONTROL_VERTICAL_FILTER 24 : 24
418#define CSC_CONTROL_VERTICAL_FILTER_DISABLE 0
419#define CSC_CONTROL_VERTICAL_FILTER_ENABLE 1
420#define CSC_CONTROL_BYTE_ORDER 23 : 23
421#define CSC_CONTROL_BYTE_ORDER_YUYV 0
422#define CSC_CONTROL_BYTE_ORDER_UYVY 1
423
424#define DE_DATA_PORT_501 0x110000
425#define DE_DATA_PORT_712 0x400000
426#define DE_DATA_PORT_722 0x6000
427
428/* point to virtual Memory Map IO starting address */
429extern char *smtc_RegBaseAddress;
430/* point to virtual video memory starting address */
431extern char *smtc_VRAMBaseAddress;
432extern unsigned char smtc_de_busy;
433
434extern unsigned long memRead32(unsigned long nOffset);
435extern void memWrite32(unsigned long nOffset, unsigned long nData);
436extern unsigned long SMTC_read2Dreg(unsigned long nOffset);
437
438/* 2D functions */
439extern void deInit(unsigned int nModeWidth, unsigned int nModeHeight,
440 unsigned int bpp);
441
442extern void deWaitForNotBusy(void);
443
444extern void deVerticalLine(unsigned long dst_base,
445 unsigned long dst_pitch,
446 unsigned long nX,
447 unsigned long nY,
448 unsigned long dst_height,
449 unsigned long nColor);
450
451extern void deHorizontalLine(unsigned long dst_base,
452 unsigned long dst_pitch,
453 unsigned long nX,
454 unsigned long nY,
455 unsigned long dst_width,
456 unsigned long nColor);
457
458extern void deLine(unsigned long dst_base,
459 unsigned long dst_pitch,
460 unsigned long nX1,
461 unsigned long nY1,
462 unsigned long nX2,
463 unsigned long nY2,
464 unsigned long nColor);
465
466extern void deFillRect(unsigned long dst_base,
467 unsigned long dst_pitch,
468 unsigned long dst_X,
469 unsigned long dst_Y,
470 unsigned long dst_width,
471 unsigned long dst_height,
472 unsigned long nColor);
473
474extern void deRotatePattern(unsigned char *pattern_dstaddr,
475 unsigned long pattern_src_addr,
476 unsigned long pattern_BPP,
477 unsigned long pattern_stride,
478 int patternX,
479 int patternY);
480
481extern void deCopy(unsigned long dst_base,
482 unsigned long dst_pitch,
483 unsigned long dst_BPP,
484 unsigned long dst_X,
485 unsigned long dst_Y,
486 unsigned long dst_width,
487 unsigned long dst_height,
488 unsigned long src_base,
489 unsigned long src_pitch,
490 unsigned long src_X,
491 unsigned long src_Y,
492 pTransparent pTransp,
493 unsigned char nROP2);
494
495/*
496 * System memory to Video memory monochrome expansion.
497 *
498 * Source is monochrome image in system memory. This function expands the
499 * monochrome data to color image in video memory.
500 *
501 * @pSrcbuf: pointer to start of source buffer in system memory
502 * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top
503 * down and -ive mean button up
504 * @startBit: Mono data can start at any bit in a byte, this value should
505 * be 0 to 7
506 * @dBase: Address of destination : offset in frame buffer
507 * @dPitch: Pitch value of destination surface in BYTE
508 * @bpp: Color depth of destination surface
509 * @dx, dy: Starting coordinate of destination surface
510 * @width, height: width and height of rectange in pixel value
511 * @fColor,bColor: Foreground, Background color (corresponding to a 1, 0 in
512 * the monochrome data)
513 * @rop2: ROP value
514 */
515
516extern long deSystemMem2VideoMemMonoBlt(
517 const char *pSrcbuf,
518 long srcDelta,
519 unsigned long startBit,
520 unsigned long dBase,
521 unsigned long dPitch,
522 unsigned long bpp,
523 unsigned long dx, unsigned long dy,
524 unsigned long width, unsigned long height,
525 unsigned long fColor,
526 unsigned long bColor,
527 unsigned long rop2);
528
529extern unsigned long deGetTransparency(void);
530extern void deSetPixelFormat(unsigned long bpp);
diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
new file mode 100644
index 000000000000..161dbc9c1397
--- /dev/null
+++ b/drivers/staging/sm7xx/smtcfb.c
@@ -0,0 +1,1253 @@
1/*
2 * Silicon Motion SM7XX frame buffer device
3 *
4 * Copyright (C) 2006 Silicon Motion Technology Corp.
5 * Authors: Ge Wang, gewang@siliconmotion.com
6 * Boyod boyod.yang@siliconmotion.com.cn
7 *
8 * Copyright (C) 2009 Lemote, Inc.
9 * Author: Wu Zhangjin, wuzj@lemote.com
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file COPYING in the main directory of this archive for
13 * more details.
14 *
15 * Version 0.10.26192.21.01
16 * - Add PowerPC/Big endian support
17 * - Add 2D support for Lynx
18 * - Verified on2.6.19.2 Boyod.yang <boyod.yang@siliconmotion.com.cn>
19 *
20 * Version 0.09.2621.00.01
21 * - Only support Linux Kernel's version 2.6.21.
22 * Boyod.yang <boyod.yang@siliconmotion.com.cn>
23 *
24 * Version 0.09
25 * - Only support Linux Kernel's version 2.6.12.
26 * Boyod.yang <boyod.yang@siliconmotion.com.cn>
27 */
28
29#ifndef __KERNEL__
30#define __KERNEL__
31#endif
32
33#include <linux/io.h>
34#include <linux/fb.h>
35#include <linux/pci.h>
36#include <linux/init.h>
37#include <linux/uaccess.h>
38#include <linux/console.h>
39#include <linux/screen_info.h>
40
41#ifdef CONFIG_PM
42#include <linux/pm.h>
43#endif
44
45struct screen_info smtc_screen_info;
46
47#include "smtcfb.h"
48#include "smtc2d.h"
49
50#ifdef DEBUG
51#define smdbg(format, arg...) printk(KERN_DEBUG format , ## arg)
52#else
53#define smdbg(format, arg...)
54#endif
55
56/*
57* Private structure
58*/
59struct smtcfb_info {
60 /*
61 * The following is a pointer to be passed into the
62 * functions below. The modules outside the main
63 * voyager.c driver have no knowledge as to what
64 * is within this structure.
65 */
66 struct fb_info fb;
67 struct display_switch *dispsw;
68 struct pci_dev *dev;
69 signed int currcon;
70
71 struct {
72 u8 red, green, blue;
73 } palette[NR_RGB];
74
75 u_int palette_size;
76};
77
78struct par_info {
79 /*
80 * Hardware
81 */
82 u16 chipID;
83 unsigned char __iomem *m_pMMIO;
84 char __iomem *m_pLFB;
85 char *m_pDPR;
86 char *m_pVPR;
87 char *m_pCPR;
88
89 u_int width;
90 u_int height;
91 u_int hz;
92 u_long BaseAddressInVRAM;
93 u8 chipRevID;
94};
95
96struct vesa_mode_table {
97 char mode_index[6];
98 u16 lfb_width;
99 u16 lfb_height;
100 u16 lfb_depth;
101};
102
103static struct vesa_mode_table vesa_mode[] = {
104 {"0x301", 640, 480, 8},
105 {"0x303", 800, 600, 8},
106 {"0x305", 1024, 768, 8},
107 {"0x307", 1280, 1024, 8},
108
109 {"0x311", 640, 480, 16},
110 {"0x314", 800, 600, 16},
111 {"0x317", 1024, 768, 16},
112 {"0x31A", 1280, 1024, 16},
113
114 {"0x312", 640, 480, 24},
115 {"0x315", 800, 600, 24},
116 {"0x318", 1024, 768, 24},
117 {"0x31B", 1280, 1024, 24},
118};
119
120char __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */
121char __iomem *smtc_VRAMBaseAddress; /* video memory starting address */
122
123char *smtc_2DBaseAddress; /* 2D engine starting address */
124char *smtc_2Ddataport; /* 2D data port offset */
125short smtc_2Dacceleration;
126
127static u32 colreg[17];
128static struct par_info hw; /* hardware information */
129
130u16 smtc_ChipIDs[] = {
131 0x710,
132 0x712,
133 0x720
134};
135
136#define numSMTCchipIDs (sizeof(smtc_ChipIDs) / sizeof(u16))
137
138void deWaitForNotBusy(void)
139{
140 unsigned long i = 0x1000000;
141 while (i--) {
142 if ((smtc_seqr(0x16) & 0x18) == 0x10)
143 break;
144 }
145 smtc_de_busy = 0;
146}
147
148static void sm712_set_timing(struct smtcfb_info *sfb,
149 struct par_info *ppar_info)
150{
151 int i = 0, j = 0;
152 u32 m_nScreenStride;
153
154 smdbg("\nppar_info->width = %d ppar_info->height = %d"
155 "sfb->fb.var.bits_per_pixel = %d ppar_info->hz = %d\n",
156 ppar_info->width, ppar_info->height,
157 sfb->fb.var.bits_per_pixel, ppar_info->hz);
158
159 for (j = 0; j < numVGAModes; j++) {
160 if (VGAMode[j].mmSizeX == ppar_info->width &&
161 VGAMode[j].mmSizeY == ppar_info->height &&
162 VGAMode[j].bpp == sfb->fb.var.bits_per_pixel &&
163 VGAMode[j].hz == ppar_info->hz) {
164
165 smdbg("\nVGAMode[j].mmSizeX = %d VGAMode[j].mmSizeY ="
166 "%d VGAMode[j].bpp = %d"
167 "VGAMode[j].hz=%d\n",
168 VGAMode[j].mmSizeX, VGAMode[j].mmSizeY,
169 VGAMode[j].bpp, VGAMode[j].hz);
170
171 smdbg("VGAMode index=%d\n", j);
172
173 smtc_mmiowb(0x0, 0x3c6);
174
175 smtc_seqw(0, 0x1);
176
177 smtc_mmiowb(VGAMode[j].Init_MISC, 0x3c2);
178
179 /* init SEQ register SR00 - SR04 */
180 for (i = 0; i < SIZE_SR00_SR04; i++)
181 smtc_seqw(i, VGAMode[j].Init_SR00_SR04[i]);
182
183 /* init SEQ register SR10 - SR24 */
184 for (i = 0; i < SIZE_SR10_SR24; i++)
185 smtc_seqw(i + 0x10,
186 VGAMode[j].Init_SR10_SR24[i]);
187
188 /* init SEQ register SR30 - SR75 */
189 for (i = 0; i < SIZE_SR30_SR75; i++)
190 if (((i + 0x30) != 0x62) \
191 && ((i + 0x30) != 0x6a) \
192 && ((i + 0x30) != 0x6b))
193 smtc_seqw(i + 0x30,
194 VGAMode[j].Init_SR30_SR75[i]);
195
196 /* init SEQ register SR80 - SR93 */
197 for (i = 0; i < SIZE_SR80_SR93; i++)
198 smtc_seqw(i + 0x80,
199 VGAMode[j].Init_SR80_SR93[i]);
200
201 /* init SEQ register SRA0 - SRAF */
202 for (i = 0; i < SIZE_SRA0_SRAF; i++)
203 smtc_seqw(i + 0xa0,
204 VGAMode[j].Init_SRA0_SRAF[i]);
205
206 /* init Graphic register GR00 - GR08 */
207 for (i = 0; i < SIZE_GR00_GR08; i++)
208 smtc_grphw(i, VGAMode[j].Init_GR00_GR08[i]);
209
210 /* init Attribute register AR00 - AR14 */
211 for (i = 0; i < SIZE_AR00_AR14; i++)
212 smtc_attrw(i, VGAMode[j].Init_AR00_AR14[i]);
213
214 /* init CRTC register CR00 - CR18 */
215 for (i = 0; i < SIZE_CR00_CR18; i++)
216 smtc_crtcw(i, VGAMode[j].Init_CR00_CR18[i]);
217
218 /* init CRTC register CR30 - CR4D */
219 for (i = 0; i < SIZE_CR30_CR4D; i++)
220 smtc_crtcw(i + 0x30,
221 VGAMode[j].Init_CR30_CR4D[i]);
222
223 /* init CRTC register CR90 - CRA7 */
224 for (i = 0; i < SIZE_CR90_CRA7; i++)
225 smtc_crtcw(i + 0x90,
226 VGAMode[j].Init_CR90_CRA7[i]);
227 }
228 }
229 smtc_mmiowb(0x67, 0x3c2);
230
231 /* set VPR registers */
232 writel(0x0, ppar_info->m_pVPR + 0x0C);
233 writel(0x0, ppar_info->m_pVPR + 0x40);
234
235 /* set data width */
236 m_nScreenStride =
237 (ppar_info->width * sfb->fb.var.bits_per_pixel) / 64;
238 switch (sfb->fb.var.bits_per_pixel) {
239 case 8:
240 writel(0x0, ppar_info->m_pVPR + 0x0);
241 break;
242 case 16:
243 writel(0x00020000, ppar_info->m_pVPR + 0x0);
244 break;
245 case 24:
246 writel(0x00040000, ppar_info->m_pVPR + 0x0);
247 break;
248 case 32:
249 writel(0x00030000, ppar_info->m_pVPR + 0x0);
250 break;
251 }
252 writel((u32) (((m_nScreenStride + 2) << 16) | m_nScreenStride),
253 ppar_info->m_pVPR + 0x10);
254
255}
256
257static void sm712_setpalette(int regno, unsigned red, unsigned green,
258 unsigned blue, struct fb_info *info)
259{
260 struct par_info *cur_par = (struct par_info *)info->par;
261
262 if (cur_par->BaseAddressInVRAM)
263 /*
264 * second display palette for dual head. Enable CRT RAM, 6-bit
265 * RAM
266 */
267 smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x20);
268 else
269 /* primary display palette. Enable LCD RAM only, 6-bit RAM */
270 smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10);
271 smtc_mmiowb(regno, dac_reg);
272 smtc_mmiowb(red >> 10, dac_val);
273 smtc_mmiowb(green >> 10, dac_val);
274 smtc_mmiowb(blue >> 10, dac_val);
275}
276
277static void smtc_set_timing(struct smtcfb_info *sfb, struct par_info
278 *ppar_info)
279{
280 switch (ppar_info->chipID) {
281 case 0x710:
282 case 0x712:
283 case 0x720:
284 sm712_set_timing(sfb, ppar_info);
285 break;
286 }
287}
288
289static struct fb_var_screeninfo smtcfb_var = {
290 .xres = 1024,
291 .yres = 600,
292 .xres_virtual = 1024,
293 .yres_virtual = 600,
294 .bits_per_pixel = 16,
295 .red = {16, 8, 0},
296 .green = {8, 8, 0},
297 .blue = {0, 8, 0},
298 .activate = FB_ACTIVATE_NOW,
299 .height = -1,
300 .width = -1,
301 .vmode = FB_VMODE_NONINTERLACED,
302};
303
304static struct fb_fix_screeninfo smtcfb_fix = {
305 .id = "sm712fb",
306 .type = FB_TYPE_PACKED_PIXELS,
307 .visual = FB_VISUAL_TRUECOLOR,
308 .line_length = 800 * 3,
309 .accel = FB_ACCEL_SMI_LYNX,
310};
311
312/* chan_to_field
313 *
314 * convert a colour value into a field position
315 *
316 * from pxafb.c
317 */
318
319static inline unsigned int chan_to_field(unsigned int chan,
320 struct fb_bitfield *bf)
321{
322 chan &= 0xffff;
323 chan >>= 16 - bf->length;
324 return chan << bf->offset;
325}
326
327static int smtcfb_blank(int blank_mode, struct fb_info *info)
328{
329 /* clear DPMS setting */
330 switch (blank_mode) {
331 case FB_BLANK_UNBLANK:
332 /* Screen On: HSync: On, VSync : On */
333 smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
334 smtc_seqw(0x6a, 0x16);
335 smtc_seqw(0x6b, 0x02);
336 smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77));
337 smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
338 smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
339 smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
340 smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03));
341 break;
342 case FB_BLANK_NORMAL:
343 /* Screen Off: HSync: On, VSync : On Soft blank */
344 smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
345 smtc_seqw(0x6a, 0x16);
346 smtc_seqw(0x6b, 0x02);
347 smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
348 smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
349 smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
350 smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
351 break;
352 case FB_BLANK_VSYNC_SUSPEND:
353 /* Screen On: HSync: On, VSync : Off */
354 smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
355 smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
356 smtc_seqw(0x6a, 0x0c);
357 smtc_seqw(0x6b, 0x02);
358 smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
359 smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20));
360 smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20));
361 smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
362 smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
363 smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
364 break;
365 case FB_BLANK_HSYNC_SUSPEND:
366 /* Screen On: HSync: Off, VSync : On */
367 smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
368 smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
369 smtc_seqw(0x6a, 0x0c);
370 smtc_seqw(0x6b, 0x02);
371 smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
372 smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10));
373 smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
374 smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
375 smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
376 smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
377 break;
378 case FB_BLANK_POWERDOWN:
379 /* Screen On: HSync: Off, VSync : Off */
380 smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
381 smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
382 smtc_seqw(0x6a, 0x0c);
383 smtc_seqw(0x6b, 0x02);
384 smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
385 smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30));
386 smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
387 smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
388 smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
389 smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
390 break;
391 default:
392 return -EINVAL;
393 }
394
395 return 0;
396}
397
398static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green,
399 unsigned blue, unsigned trans, struct fb_info *info)
400{
401 struct smtcfb_info *sfb = (struct smtcfb_info *)info;
402 u32 val;
403
404 if (regno > 255)
405 return 1;
406
407 switch (sfb->fb.fix.visual) {
408 case FB_VISUAL_DIRECTCOLOR:
409 case FB_VISUAL_TRUECOLOR:
410 /*
411 * 16/32 bit true-colour, use pseuo-palette for 16 base color
412 */
413 if (regno < 16) {
414 if (sfb->fb.var.bits_per_pixel == 16) {
415 u32 *pal = sfb->fb.pseudo_palette;
416 val = chan_to_field(red, &sfb->fb.var.red);
417 val |= chan_to_field(green, \
418 &sfb->fb.var.green);
419 val |= chan_to_field(blue, &sfb->fb.var.blue);
420#ifdef __BIG_ENDIAN
421 pal[regno] =
422 ((red & 0xf800) >> 8) |
423 ((green & 0xe000) >> 13) |
424 ((green & 0x1c00) << 3) |
425 ((blue & 0xf800) >> 3);
426#else
427 pal[regno] = val;
428#endif
429 } else {
430 u32 *pal = sfb->fb.pseudo_palette;
431 val = chan_to_field(red, &sfb->fb.var.red);
432 val |= chan_to_field(green, \
433 &sfb->fb.var.green);
434 val |= chan_to_field(blue, &sfb->fb.var.blue);
435#ifdef __BIG_ENDIAN
436 val =
437 (val & 0xff00ff00 >> 8) |
438 (val & 0x00ff00ff << 8);
439#endif
440 pal[regno] = val;
441 }
442 }
443 break;
444
445 case FB_VISUAL_PSEUDOCOLOR:
446 /* color depth 8 bit */
447 sm712_setpalette(regno, red, green, blue, info);
448 break;
449
450 default:
451 return 1; /* unknown type */
452 }
453
454 return 0;
455
456}
457
458#ifdef __BIG_ENDIAN
459static ssize_t smtcfb_read(struct fb_info *info, char __user * buf, size_t
460 count, loff_t *ppos)
461{
462 unsigned long p = *ppos;
463
464 u32 *buffer, *dst;
465 u32 __iomem *src;
466 int c, i, cnt = 0, err = 0;
467 unsigned long total_size;
468
469 if (!info || !info->screen_base)
470 return -ENODEV;
471
472 if (info->state != FBINFO_STATE_RUNNING)
473 return -EPERM;
474
475 total_size = info->screen_size;
476
477 if (total_size == 0)
478 total_size = info->fix.smem_len;
479
480 if (p >= total_size)
481 return 0;
482
483 if (count >= total_size)
484 count = total_size;
485
486 if (count + p > total_size)
487 count = total_size - p;
488
489 buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
490 if (!buffer)
491 return -ENOMEM;
492
493 src = (u32 __iomem *) (info->screen_base + p);
494
495 if (info->fbops->fb_sync)
496 info->fbops->fb_sync(info);
497
498 while (count) {
499 c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
500 dst = buffer;
501 for (i = c >> 2; i--;) {
502 *dst = fb_readl(src++);
503 *dst =
504 (*dst & 0xff00ff00 >> 8) |
505 (*dst & 0x00ff00ff << 8);
506 dst++;
507 }
508 if (c & 3) {
509 u8 *dst8 = (u8 *) dst;
510 u8 __iomem *src8 = (u8 __iomem *) src;
511
512 for (i = c & 3; i--;) {
513 if (i & 1) {
514 *dst8++ = fb_readb(++src8);
515 } else {
516 *dst8++ = fb_readb(--src8);
517 src8 += 2;
518 }
519 }
520 src = (u32 __iomem *) src8;
521 }
522
523 if (copy_to_user(buf, buffer, c)) {
524 err = -EFAULT;
525 break;
526 }
527 *ppos += c;
528 buf += c;
529 cnt += c;
530 count -= c;
531 }
532
533 kfree(buffer);
534
535 return (err) ? err : cnt;
536}
537
538static ssize_t
539smtcfb_write(struct fb_info *info, const char __user *buf, size_t count,
540 loff_t *ppos)
541{
542 unsigned long p = *ppos;
543
544 u32 *buffer, *src;
545 u32 __iomem *dst;
546 int c, i, cnt = 0, err = 0;
547 unsigned long total_size;
548
549 if (!info || !info->screen_base)
550 return -ENODEV;
551
552 if (info->state != FBINFO_STATE_RUNNING)
553 return -EPERM;
554
555 total_size = info->screen_size;
556
557 if (total_size == 0)
558 total_size = info->fix.smem_len;
559
560 if (p > total_size)
561 return -EFBIG;
562
563 if (count > total_size) {
564 err = -EFBIG;
565 count = total_size;
566 }
567
568 if (count + p > total_size) {
569 if (!err)
570 err = -ENOSPC;
571
572 count = total_size - p;
573 }
574
575 buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
576 if (!buffer)
577 return -ENOMEM;
578
579 dst = (u32 __iomem *) (info->screen_base + p);
580
581 if (info->fbops->fb_sync)
582 info->fbops->fb_sync(info);
583
584 while (count) {
585 c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
586 src = buffer;
587
588 if (copy_from_user(src, buf, c)) {
589 err = -EFAULT;
590 break;
591 }
592
593 for (i = c >> 2; i--;) {
594 fb_writel((*src & 0xff00ff00 >> 8) |
595 (*src & 0x00ff00ff << 8), dst++);
596 src++;
597 }
598 if (c & 3) {
599 u8 *src8 = (u8 *) src;
600 u8 __iomem *dst8 = (u8 __iomem *) dst;
601
602 for (i = c & 3; i--;) {
603 if (i & 1) {
604 fb_writeb(*src8++, ++dst8);
605 } else {
606 fb_writeb(*src8++, --dst8);
607 dst8 += 2;
608 }
609 }
610 dst = (u32 __iomem *) dst8;
611 }
612
613 *ppos += c;
614 buf += c;
615 cnt += c;
616 count -= c;
617 }
618
619 kfree(buffer);
620
621 return (cnt) ? cnt : err;
622}
623#endif /* ! __BIG_ENDIAN */
624
625#include "smtc2d.c"
626
627void smtcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
628{
629 struct par_info *p = (struct par_info *)info->par;
630
631 if (smtc_2Dacceleration) {
632 if (!area->width || !area->height)
633 return;
634
635 deCopy(p->BaseAddressInVRAM, 0, info->var.bits_per_pixel,
636 area->dx, area->dy, area->width, area->height,
637 p->BaseAddressInVRAM, 0, area->sx, area->sy, 0, 0xC);
638
639 } else
640 cfb_copyarea(info, area);
641}
642
643void smtcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
644{
645 struct par_info *p = (struct par_info *)info->par;
646
647 if (smtc_2Dacceleration) {
648 if (!rect->width || !rect->height)
649 return;
650 if (info->var.bits_per_pixel >= 24)
651 deFillRect(p->BaseAddressInVRAM, 0, rect->dx * 3,
652 rect->dy * 3, rect->width * 3, rect->height,
653 rect->color);
654 else
655 deFillRect(p->BaseAddressInVRAM, 0, rect->dx, rect->dy,
656 rect->width, rect->height, rect->color);
657 } else
658 cfb_fillrect(info, rect);
659}
660
661void smtcfb_imageblit(struct fb_info *info, const struct fb_image *image)
662{
663 struct par_info *p = (struct par_info *)info->par;
664 u32 bg_col = 0, fg_col = 0;
665
666 if ((smtc_2Dacceleration) && (image->depth == 1)) {
667 if (smtc_de_busy)
668 deWaitForNotBusy();
669
670 switch (info->var.bits_per_pixel) {
671 case 8:
672 bg_col = image->bg_color;
673 fg_col = image->fg_color;
674 break;
675 case 16:
676 bg_col =
677 ((u32 *) (info->pseudo_palette))[image->bg_color];
678 fg_col =
679 ((u32 *) (info->pseudo_palette))[image->fg_color];
680 break;
681 case 32:
682 bg_col =
683 ((u32 *) (info->pseudo_palette))[image->bg_color];
684 fg_col =
685 ((u32 *) (info->pseudo_palette))[image->fg_color];
686 break;
687 }
688
689 deSystemMem2VideoMemMonoBlt(
690 image->data,
691 image->width / 8,
692 0,
693 p->BaseAddressInVRAM,
694 0,
695 0,
696 image->dx, image->dy,
697 image->width, image->height,
698 fg_col, bg_col,
699 0x0C);
700
701 } else
702 cfb_imageblit(info, image);
703}
704
705static struct fb_ops smtcfb_ops = {
706 .owner = THIS_MODULE,
707 .fb_setcolreg = smtc_setcolreg,
708 .fb_blank = smtcfb_blank,
709 .fb_fillrect = smtcfb_fillrect,
710 .fb_imageblit = smtcfb_imageblit,
711 .fb_copyarea = smtcfb_copyarea,
712#ifdef __BIG_ENDIAN
713 .fb_read = smtcfb_read,
714 .fb_write = smtcfb_write,
715#endif
716
717};
718
719void smtcfb_setmode(struct smtcfb_info *sfb)
720{
721 switch (sfb->fb.var.bits_per_pixel) {
722 case 32:
723 sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
724 sfb->fb.fix.line_length = sfb->fb.var.xres * 4;
725 sfb->fb.var.red.length = 8;
726 sfb->fb.var.green.length = 8;
727 sfb->fb.var.blue.length = 8;
728 sfb->fb.var.red.offset = 16;
729 sfb->fb.var.green.offset = 8;
730 sfb->fb.var.blue.offset = 0;
731
732 break;
733 case 8:
734 sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
735 sfb->fb.fix.line_length = sfb->fb.var.xres;
736 sfb->fb.var.red.offset = 5;
737 sfb->fb.var.red.length = 3;
738 sfb->fb.var.green.offset = 2;
739 sfb->fb.var.green.length = 3;
740 sfb->fb.var.blue.offset = 0;
741 sfb->fb.var.blue.length = 2;
742 break;
743 case 24:
744 sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
745 sfb->fb.fix.line_length = sfb->fb.var.xres * 3;
746 sfb->fb.var.red.length = 8;
747 sfb->fb.var.green.length = 8;
748 sfb->fb.var.blue.length = 8;
749
750 sfb->fb.var.red.offset = 16;
751 sfb->fb.var.green.offset = 8;
752 sfb->fb.var.blue.offset = 0;
753
754 break;
755 case 16:
756 default:
757 sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
758 sfb->fb.fix.line_length = sfb->fb.var.xres * 2;
759
760 sfb->fb.var.red.length = 5;
761 sfb->fb.var.green.length = 6;
762 sfb->fb.var.blue.length = 5;
763
764 sfb->fb.var.red.offset = 11;
765 sfb->fb.var.green.offset = 5;
766 sfb->fb.var.blue.offset = 0;
767
768 break;
769 }
770
771 hw.width = sfb->fb.var.xres;
772 hw.height = sfb->fb.var.yres;
773 hw.hz = 60;
774 smtc_set_timing(sfb, &hw);
775 if (smtc_2Dacceleration) {
776 printk("2D acceleration enabled!\n");
777 /* Init smtc drawing engine */
778 deInit(sfb->fb.var.xres, sfb->fb.var.yres,
779 sfb->fb.var.bits_per_pixel);
780 }
781}
782
783/*
784 * Alloc struct smtcfb_info and assign the default value
785 */
786static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *dev,
787 char *name)
788{
789 struct smtcfb_info *sfb;
790
791 sfb = kmalloc(sizeof(struct smtcfb_info), GFP_KERNEL);
792
793 if (!sfb)
794 return NULL;
795
796 memset(sfb, 0, sizeof(struct smtcfb_info));
797
798 sfb->currcon = -1;
799 sfb->dev = dev;
800
801 /*** Init sfb->fb with default value ***/
802 sfb->fb.flags = FBINFO_FLAG_DEFAULT;
803 sfb->fb.fbops = &smtcfb_ops;
804 sfb->fb.var = smtcfb_var;
805 sfb->fb.fix = smtcfb_fix;
806
807 strcpy(sfb->fb.fix.id, name);
808
809 sfb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
810 sfb->fb.fix.type_aux = 0;
811 sfb->fb.fix.xpanstep = 0;
812 sfb->fb.fix.ypanstep = 0;
813 sfb->fb.fix.ywrapstep = 0;
814 sfb->fb.fix.accel = FB_ACCEL_SMI_LYNX;
815
816 sfb->fb.var.nonstd = 0;
817 sfb->fb.var.activate = FB_ACTIVATE_NOW;
818 sfb->fb.var.height = -1;
819 sfb->fb.var.width = -1;
820 /* text mode acceleration */
821 sfb->fb.var.accel_flags = FB_ACCELF_TEXT;
822 sfb->fb.var.vmode = FB_VMODE_NONINTERLACED;
823 sfb->fb.par = &hw;
824 sfb->fb.pseudo_palette = colreg;
825
826 return sfb;
827}
828
829/*
830 * Unmap in the memory mapped IO registers
831 */
832
833static void smtc_unmap_mmio(struct smtcfb_info *sfb)
834{
835 if (sfb && smtc_RegBaseAddress)
836 smtc_RegBaseAddress = NULL;
837}
838
839/*
840 * Map in the screen memory
841 */
842
843static int smtc_map_smem(struct smtcfb_info *sfb,
844 struct pci_dev *dev, u_long smem_len)
845{
846 if (sfb->fb.var.bits_per_pixel == 32) {
847#ifdef __BIG_ENDIAN
848 sfb->fb.fix.smem_start = pci_resource_start(dev, 0)
849 + 0x800000;
850#else
851 sfb->fb.fix.smem_start = pci_resource_start(dev, 0);
852#endif
853 } else {
854 sfb->fb.fix.smem_start = pci_resource_start(dev, 0);
855 }
856
857 sfb->fb.fix.smem_len = smem_len;
858
859 sfb->fb.screen_base = smtc_VRAMBaseAddress;
860
861 if (!sfb->fb.screen_base) {
862 printk(KERN_INFO "%s: unable to map screen memory\n",
863 sfb->fb.fix.id);
864 return -ENOMEM;
865 }
866
867 return 0;
868}
869
870/*
871 * Unmap in the screen memory
872 *
873 */
874static void smtc_unmap_smem(struct smtcfb_info *sfb)
875{
876 if (sfb && sfb->fb.screen_base) {
877 iounmap(sfb->fb.screen_base);
878 sfb->fb.screen_base = NULL;
879 }
880}
881
882/*
883 * We need to wake up the LynxEM+, and make sure its in linear memory mode.
884 */
885static inline void sm7xx_init_hw(void)
886{
887 outb_p(0x18, 0x3c4);
888 outb_p(0x11, 0x3c5);
889}
890
891static void smtc_free_fb_info(struct smtcfb_info *sfb)
892{
893 if (sfb) {
894 fb_alloc_cmap(&sfb->fb.cmap, 0, 0);
895 kfree(sfb);
896 }
897}
898
899/*
900 * sm712vga_setup - process command line options, get vga parameter
901 * @options: string of options
902 * Returns zero.
903 *
904 */
905static int __init __maybe_unused sm712vga_setup(char *options)
906{
907 int index;
908
909 if (!options || !*options) {
910 smdbg("\n No vga parameter\n");
911 return -EINVAL;
912 }
913
914 smtc_screen_info.lfb_width = 0;
915 smtc_screen_info.lfb_height = 0;
916 smtc_screen_info.lfb_depth = 0;
917
918 smdbg("\nsm712vga_setup = %s\n", options);
919
920 for (index = 0;
921 index < (sizeof(vesa_mode) / sizeof(struct vesa_mode_table));
922 index++) {
923 if (strstr(options, vesa_mode[index].mode_index)) {
924 smtc_screen_info.lfb_width = vesa_mode[index].lfb_width;
925 smtc_screen_info.lfb_height =
926 vesa_mode[index].lfb_height;
927 smtc_screen_info.lfb_depth = vesa_mode[index].lfb_depth;
928 return 0;
929 }
930 }
931
932 return -1;
933}
934__setup("vga=", sm712vga_setup);
935
936/* Jason (08/13/2009)
937 * Original init function changed to probe method to be used by pci_drv
938 * process used to detect chips replaced with kernel process in pci_drv
939 */
940static int __init smtcfb_pci_probe(struct pci_dev *pdev,
941 const struct pci_device_id *ent)
942{
943 struct smtcfb_info *sfb;
944 u_long smem_size = 0x00800000; /* default 8MB */
945 char name[16];
946 int err;
947 unsigned long pFramebufferPhysical;
948
949 printk(KERN_INFO
950 "Silicon Motion display driver " SMTC_LINUX_FB_VERSION "\n");
951
952 err = pci_enable_device(pdev); /* enable SMTC chip */
953
954 if (err)
955 return err;
956 err = -ENOMEM;
957
958 hw.chipID = ent->device;
959 sprintf(name, "sm%Xfb", hw.chipID);
960
961 sfb = smtc_alloc_fb_info(pdev, name);
962
963 if (!sfb)
964 goto failed;
965 /* Jason (08/13/2009)
966 * Store fb_info to be further used when suspending and resuming
967 */
968 pci_set_drvdata(pdev, sfb);
969
970 sm7xx_init_hw();
971
972 /*get mode parameter from smtc_screen_info */
973 if (smtc_screen_info.lfb_width != 0) {
974 sfb->fb.var.xres = smtc_screen_info.lfb_width;
975 sfb->fb.var.yres = smtc_screen_info.lfb_height;
976 sfb->fb.var.bits_per_pixel = smtc_screen_info.lfb_depth;
977 } else {
978 /* default resolution 1024x600 16bit mode */
979 sfb->fb.var.xres = SCREEN_X_RES;
980 sfb->fb.var.yres = SCREEN_Y_RES;
981 sfb->fb.var.bits_per_pixel = SCREEN_BPP;
982 }
983
984#ifdef __BIG_ENDIAN
985 if (sfb->fb.var.bits_per_pixel == 24)
986 sfb->fb.var.bits_per_pixel = (smtc_screen_info.lfb_depth = 32);
987#endif
988 /* Map address and memory detection */
989 pFramebufferPhysical = pci_resource_start(pdev, 0);
990 pci_read_config_byte(pdev, PCI_REVISION_ID, &hw.chipRevID);
991
992 switch (hw.chipID) {
993 case 0x710:
994 case 0x712:
995 sfb->fb.fix.mmio_start = pFramebufferPhysical + 0x00400000;
996 sfb->fb.fix.mmio_len = 0x00400000;
997 smem_size = SM712_VIDEOMEMORYSIZE;
998#ifdef __BIG_ENDIAN
999 hw.m_pLFB = (smtc_VRAMBaseAddress =
1000 ioremap(pFramebufferPhysical, 0x00c00000));
1001#else
1002 hw.m_pLFB = (smtc_VRAMBaseAddress =
1003 ioremap(pFramebufferPhysical, 0x00800000));
1004#endif
1005 hw.m_pMMIO = (smtc_RegBaseAddress =
1006 smtc_VRAMBaseAddress + 0x00700000);
1007 smtc_2DBaseAddress = (hw.m_pDPR =
1008 smtc_VRAMBaseAddress + 0x00408000);
1009 smtc_2Ddataport = smtc_VRAMBaseAddress + DE_DATA_PORT_712;
1010 hw.m_pVPR = hw.m_pLFB + 0x0040c000;
1011#ifdef __BIG_ENDIAN
1012 if (sfb->fb.var.bits_per_pixel == 32) {
1013 smtc_VRAMBaseAddress += 0x800000;
1014 hw.m_pLFB += 0x800000;
1015 printk(KERN_INFO
1016 "\nsmtc_VRAMBaseAddress=%p hw.m_pLFB=%p\n",
1017 smtc_VRAMBaseAddress, hw.m_pLFB);
1018 }
1019#endif
1020 if (!smtc_RegBaseAddress) {
1021 printk(KERN_INFO
1022 "%s: unable to map memory mapped IO\n",
1023 sfb->fb.fix.id);
1024 return -ENOMEM;
1025 }
1026
1027 /* set MCLK = 14.31818 * (0x16 / 0x2) */
1028 smtc_seqw(0x6a, 0x16);
1029 smtc_seqw(0x6b, 0x02);
1030 smtc_seqw(0x62, 0x3e);
1031 /* enable PCI burst */
1032 smtc_seqw(0x17, 0x20);
1033 /* enable word swap */
1034#ifdef __BIG_ENDIAN
1035 if (sfb->fb.var.bits_per_pixel == 32)
1036 smtc_seqw(0x17, 0x30);
1037#endif
1038#ifdef CONFIG_FB_SM7XX_ACCEL
1039 smtc_2Dacceleration = 1;
1040#endif
1041 break;
1042 case 0x720:
1043 sfb->fb.fix.mmio_start = pFramebufferPhysical;
1044 sfb->fb.fix.mmio_len = 0x00200000;
1045 smem_size = SM722_VIDEOMEMORYSIZE;
1046 smtc_2DBaseAddress = (hw.m_pDPR =
1047 ioremap(pFramebufferPhysical, 0x00a00000));
1048 hw.m_pLFB = (smtc_VRAMBaseAddress =
1049 smtc_2DBaseAddress + 0x00200000);
1050 hw.m_pMMIO = (smtc_RegBaseAddress =
1051 smtc_2DBaseAddress + 0x000c0000);
1052 smtc_2Ddataport = smtc_2DBaseAddress + DE_DATA_PORT_722;
1053 hw.m_pVPR = smtc_2DBaseAddress + 0x800;
1054
1055 smtc_seqw(0x62, 0xff);
1056 smtc_seqw(0x6a, 0x0d);
1057 smtc_seqw(0x6b, 0x02);
1058 smtc_2Dacceleration = 0;
1059 break;
1060 default:
1061 printk(KERN_INFO
1062 "No valid Silicon Motion display chip was detected!\n");
1063
1064 smtc_free_fb_info(sfb);
1065 return err;
1066 }
1067
1068 /* can support 32 bpp */
1069 if (15 == sfb->fb.var.bits_per_pixel)
1070 sfb->fb.var.bits_per_pixel = 16;
1071
1072 sfb->fb.var.xres_virtual = sfb->fb.var.xres;
1073 sfb->fb.var.yres_virtual = sfb->fb.var.yres;
1074 err = smtc_map_smem(sfb, pdev, smem_size);
1075 if (err)
1076 goto failed;
1077
1078 smtcfb_setmode(sfb);
1079 /* Primary display starting from 0 postion */
1080 hw.BaseAddressInVRAM = 0;
1081 sfb->fb.par = &hw;
1082
1083 err = register_framebuffer(&sfb->fb);
1084 if (err < 0)
1085 goto failed;
1086
1087 printk(KERN_INFO "Silicon Motion SM%X Rev%X primary display mode"
1088 "%dx%d-%d Init Complete.\n", hw.chipID, hw.chipRevID,
1089 sfb->fb.var.xres, sfb->fb.var.yres,
1090 sfb->fb.var.bits_per_pixel);
1091
1092 return 0;
1093
1094 failed:
1095 printk(KERN_INFO "Silicon Motion, Inc. primary display init fail\n");
1096
1097 smtc_unmap_smem(sfb);
1098 smtc_unmap_mmio(sfb);
1099 smtc_free_fb_info(sfb);
1100
1101 return err;
1102}
1103
1104
1105/* Jason (08/11/2009) PCI_DRV wrapper essential structs */
1106static struct pci_device_id smtcfb_pci_table[] = {
1107 {0x126f, 0x710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1108 {0x126f, 0x712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1109 {0x126f, 0x720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1110 {0,}
1111};
1112
1113
1114/* Jason (08/14/2009)
1115 * do some clean up when the driver module is removed
1116 */
1117static void __devexit smtcfb_pci_remove(struct pci_dev *pdev)
1118{
1119 struct smtcfb_info *sfb;
1120
1121 sfb = pci_get_drvdata(pdev);
1122 pci_set_drvdata(pdev, NULL);
1123 smtc_unmap_smem(sfb);
1124 smtc_unmap_mmio(sfb);
1125 unregister_framebuffer(&sfb->fb);
1126 smtc_free_fb_info(sfb);
1127}
1128
1129/* Jason (08/14/2009)
1130 * suspend function, called when the suspend event is triggered
1131 */
1132static int __maybe_unused smtcfb_suspend(struct pci_dev *pdev, pm_message_t msg)
1133{
1134 struct smtcfb_info *sfb;
1135 int retv;
1136
1137 sfb = pci_get_drvdata(pdev);
1138
1139 /* set the hw in sleep mode use externel clock and self memory refresh
1140 * so that we can turn off internal PLLs later on
1141 */
1142 smtc_seqw(0x20, (smtc_seqr(0x20) | 0xc0));
1143 smtc_seqw(0x69, (smtc_seqr(0x69) & 0xf7));
1144
1145 switch (msg.event) {
1146 case PM_EVENT_FREEZE:
1147 case PM_EVENT_PRETHAW:
1148 pdev->dev.power.power_state = msg;
1149 return 0;
1150 }
1151
1152 /* when doing suspend, call fb apis and pci apis */
1153 if (msg.event == PM_EVENT_SUSPEND) {
1154 acquire_console_sem();
1155 fb_set_suspend(&sfb->fb, 1);
1156 release_console_sem();
1157 retv = pci_save_state(pdev);
1158 pci_disable_device(pdev);
1159 retv = pci_choose_state(pdev, msg);
1160 retv = pci_set_power_state(pdev, retv);
1161 }
1162
1163 pdev->dev.power.power_state = msg;
1164
1165 /* additionaly turn off all function blocks including internal PLLs */
1166 smtc_seqw(0x21, 0xff);
1167
1168 return 0;
1169}
1170
1171static int __maybe_unused smtcfb_resume(struct pci_dev *pdev)
1172{
1173 struct smtcfb_info *sfb;
1174 int retv;
1175
1176 sfb = pci_get_drvdata(pdev);
1177
1178 /* when resuming, restore pci data and fb cursor */
1179 if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
1180 retv = pci_set_power_state(pdev, PCI_D0);
1181 retv = pci_restore_state(pdev);
1182 if (pci_enable_device(pdev))
1183 return -1;
1184 pci_set_master(pdev);
1185 }
1186
1187 /* reinit hardware */
1188 sm7xx_init_hw();
1189 switch (hw.chipID) {
1190 case 0x710:
1191 case 0x712:
1192 /* set MCLK = 14.31818 * (0x16 / 0x2) */
1193 smtc_seqw(0x6a, 0x16);
1194 smtc_seqw(0x6b, 0x02);
1195 smtc_seqw(0x62, 0x3e);
1196 /* enable PCI burst */
1197 smtc_seqw(0x17, 0x20);
1198#ifdef __BIG_ENDIAN
1199 if (sfb->fb.var.bits_per_pixel == 32)
1200 smtc_seqw(0x17, 0x30);
1201#endif
1202 break;
1203 case 0x720:
1204 smtc_seqw(0x62, 0xff);
1205 smtc_seqw(0x6a, 0x0d);
1206 smtc_seqw(0x6b, 0x02);
1207 break;
1208 }
1209
1210 smtc_seqw(0x34, (smtc_seqr(0x34) | 0xc0));
1211 smtc_seqw(0x33, ((smtc_seqr(0x33) | 0x08) & 0xfb));
1212
1213 smtcfb_setmode(sfb);
1214
1215 acquire_console_sem();
1216 fb_set_suspend(&sfb->fb, 0);
1217 release_console_sem();
1218
1219 return 0;
1220}
1221
1222/* Jason (08/13/2009)
1223 * pci_driver struct used to wrap the original driver
1224 * so that it can be registered into the kernel and
1225 * the proper method would be called when suspending and resuming
1226 */
1227static struct pci_driver smtcfb_driver = {
1228 .name = "smtcfb",
1229 .id_table = smtcfb_pci_table,
1230 .probe = smtcfb_pci_probe,
1231 .remove = __devexit_p(smtcfb_pci_remove),
1232#ifdef CONFIG_PM
1233 .suspend = smtcfb_suspend,
1234 .resume = smtcfb_resume,
1235#endif
1236};
1237
1238static int __init smtcfb_init(void)
1239{
1240 return pci_register_driver(&smtcfb_driver);
1241}
1242
1243static void __exit smtcfb_exit(void)
1244{
1245 pci_unregister_driver(&smtcfb_driver);
1246}
1247
1248module_init(smtcfb_init);
1249module_exit(smtcfb_exit);
1250
1251MODULE_AUTHOR("Siliconmotion ");
1252MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards");
1253MODULE_LICENSE("GPL");
diff --git a/drivers/staging/sm7xx/smtcfb.h b/drivers/staging/sm7xx/smtcfb.h
new file mode 100644
index 000000000000..7f2c34138215
--- /dev/null
+++ b/drivers/staging/sm7xx/smtcfb.h
@@ -0,0 +1,793 @@
1/*
2 * Silicon Motion SM712 frame buffer device
3 *
4 * Copyright (C) 2006 Silicon Motion Technology Corp.
5 * Authors: Ge Wang, gewang@siliconmotion.com
6 * Boyod boyod.yang@siliconmotion.com.cn
7 *
8 * Copyright (C) 2009 Lemote, Inc.
9 * Author: Wu Zhangjin, wuzj@lemote.com
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file COPYING in the main directory of this archive for
13 * more details.
14 */
15
16#define SMTC_LINUX_FB_VERSION "version 0.11.2619.21.01 July 27, 2008"
17
18#define NR_PALETTE 256
19#define NR_RGB 2
20
21#define FB_ACCEL_SMI_LYNX 88
22
23#ifdef __BIG_ENDIAN
24#define PC_VGA 0
25#else
26#define PC_VGA 1
27#endif
28
29#define SCREEN_X_RES 1024
30#define SCREEN_Y_RES 600
31#define SCREEN_BPP 16
32
33#ifndef FIELD_OFFSET
34#define FIELD_OFSFET(type, field) \
35 ((unsigned long) (PUCHAR) & (((type *)0)->field))
36#endif
37
38/*Assume SM712 graphics chip has 4MB VRAM */
39#define SM712_VIDEOMEMORYSIZE 0x00400000
40/*Assume SM722 graphics chip has 8MB VRAM */
41#define SM722_VIDEOMEMORYSIZE 0x00800000
42
43#define dac_reg (0x3c8)
44#define dac_val (0x3c9)
45
46extern char *smtc_RegBaseAddress;
47#define smtc_mmiowb(dat, reg) writeb(dat, smtc_RegBaseAddress + reg)
48#define smtc_mmioww(dat, reg) writew(dat, smtc_RegBaseAddress + reg)
49#define smtc_mmiowl(dat, reg) writel(dat, smtc_RegBaseAddress + reg)
50
51#define smtc_mmiorb(reg) readb(smtc_RegBaseAddress + reg)
52#define smtc_mmiorw(reg) readw(smtc_RegBaseAddress + reg)
53#define smtc_mmiorl(reg) readl(smtc_RegBaseAddress + reg)
54
55#define SIZE_SR00_SR04 (0x04 - 0x00 + 1)
56#define SIZE_SR10_SR24 (0x24 - 0x10 + 1)
57#define SIZE_SR30_SR75 (0x75 - 0x30 + 1)
58#define SIZE_SR80_SR93 (0x93 - 0x80 + 1)
59#define SIZE_SRA0_SRAF (0xAF - 0xA0 + 1)
60#define SIZE_GR00_GR08 (0x08 - 0x00 + 1)
61#define SIZE_AR00_AR14 (0x14 - 0x00 + 1)
62#define SIZE_CR00_CR18 (0x18 - 0x00 + 1)
63#define SIZE_CR30_CR4D (0x4D - 0x30 + 1)
64#define SIZE_CR90_CRA7 (0xA7 - 0x90 + 1)
65#define SIZE_VPR (0x6C + 1)
66#define SIZE_DPR (0x44 + 1)
67
68static inline void smtc_crtcw(int reg, int val)
69{
70 smtc_mmiowb(reg, 0x3d4);
71 smtc_mmiowb(val, 0x3d5);
72}
73
74static inline unsigned int smtc_crtcr(int reg)
75{
76 smtc_mmiowb(reg, 0x3d4);
77 return smtc_mmiorb(0x3d5);
78}
79
80static inline void smtc_grphw(int reg, int val)
81{
82 smtc_mmiowb(reg, 0x3ce);
83 smtc_mmiowb(val, 0x3cf);
84}
85
86static inline unsigned int smtc_grphr(int reg)
87{
88 smtc_mmiowb(reg, 0x3ce);
89 return smtc_mmiorb(0x3cf);
90}
91
92static inline void smtc_attrw(int reg, int val)
93{
94 smtc_mmiorb(0x3da);
95 smtc_mmiowb(reg, 0x3c0);
96 smtc_mmiorb(0x3c1);
97 smtc_mmiowb(val, 0x3c0);
98}
99
100static inline void smtc_seqw(int reg, int val)
101{
102 smtc_mmiowb(reg, 0x3c4);
103 smtc_mmiowb(val, 0x3c5);
104}
105
106static inline unsigned int smtc_seqr(int reg)
107{
108 smtc_mmiowb(reg, 0x3c4);
109 return smtc_mmiorb(0x3c5);
110}
111
112/* The next structure holds all information relevant for a specific video mode.
113 */
114
115struct ModeInit {
116 int mmSizeX;
117 int mmSizeY;
118 int bpp;
119 int hz;
120 unsigned char Init_MISC;
121 unsigned char Init_SR00_SR04[SIZE_SR00_SR04];
122 unsigned char Init_SR10_SR24[SIZE_SR10_SR24];
123 unsigned char Init_SR30_SR75[SIZE_SR30_SR75];
124 unsigned char Init_SR80_SR93[SIZE_SR80_SR93];
125 unsigned char Init_SRA0_SRAF[SIZE_SRA0_SRAF];
126 unsigned char Init_GR00_GR08[SIZE_GR00_GR08];
127 unsigned char Init_AR00_AR14[SIZE_AR00_AR14];
128 unsigned char Init_CR00_CR18[SIZE_CR00_CR18];
129 unsigned char Init_CR30_CR4D[SIZE_CR30_CR4D];
130 unsigned char Init_CR90_CRA7[SIZE_CR90_CRA7];
131};
132
133/**********************************************************************
134 SM712 Mode table.
135 **********************************************************************/
136struct ModeInit VGAMode[] = {
137 {
138 /* mode#0: 640 x 480 16Bpp 60Hz */
139 640, 480, 16, 60,
140 /* Init_MISC */
141 0xE3,
142 { /* Init_SR0_SR4 */
143 0x03, 0x01, 0x0F, 0x00, 0x0E,
144 },
145 { /* Init_SR10_SR24 */
146 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
147 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0xC4, 0x30, 0x02, 0x01, 0x01,
149 },
150 { /* Init_SR30_SR75 */
151 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32,
152 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF,
153 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
154 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32,
155 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA,
156 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32,
157 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
158 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04,
159 0x00, 0x45, 0x30, 0x30, 0x40, 0x30,
160 },
161 { /* Init_SR80_SR93 */
162 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32,
163 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32,
164 0x00, 0x00, 0x00, 0x00,
165 },
166 { /* Init_SRA0_SRAF */
167 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
168 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF,
169 },
170 { /* Init_GR00_GR08 */
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
172 0xFF,
173 },
174 { /* Init_AR00_AR14 */
175 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
176 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
177 0x41, 0x00, 0x0F, 0x00, 0x00,
178 },
179 { /* Init_CR00_CR18 */
180 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E,
181 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3,
183 0xFF,
184 },
185 { /* Init_CR30_CR4D */
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20,
187 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD,
188 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00,
189 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF,
190 },
191 { /* Init_CR90_CRA7 */
192 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55,
193 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00,
194 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
195 },
196 },
197 {
198 /* mode#1: 640 x 480 24Bpp 60Hz */
199 640, 480, 24, 60,
200 /* Init_MISC */
201 0xE3,
202 { /* Init_SR0_SR4 */
203 0x03, 0x01, 0x0F, 0x00, 0x0E,
204 },
205 { /* Init_SR10_SR24 */
206 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
207 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0xC4, 0x30, 0x02, 0x01, 0x01,
209 },
210 { /* Init_SR30_SR75 */
211 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32,
212 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF,
213 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
214 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32,
215 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA,
216 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32,
217 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
218 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04,
219 0x00, 0x45, 0x30, 0x30, 0x40, 0x30,
220 },
221 { /* Init_SR80_SR93 */
222 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32,
223 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32,
224 0x00, 0x00, 0x00, 0x00,
225 },
226 { /* Init_SRA0_SRAF */
227 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
228 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF,
229 },
230 { /* Init_GR00_GR08 */
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
232 0xFF,
233 },
234 { /* Init_AR00_AR14 */
235 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
236 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
237 0x41, 0x00, 0x0F, 0x00, 0x00,
238 },
239 { /* Init_CR00_CR18 */
240 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E,
241 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3,
243 0xFF,
244 },
245 { /* Init_CR30_CR4D */
246 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20,
247 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD,
248 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00,
249 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF,
250 },
251 { /* Init_CR90_CRA7 */
252 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55,
253 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00,
254 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
255 },
256 },
257 {
258 /* mode#0: 640 x 480 32Bpp 60Hz */
259 640, 480, 32, 60,
260 /* Init_MISC */
261 0xE3,
262 { /* Init_SR0_SR4 */
263 0x03, 0x01, 0x0F, 0x00, 0x0E,
264 },
265 { /* Init_SR10_SR24 */
266 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
267 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268 0xC4, 0x30, 0x02, 0x01, 0x01,
269 },
270 { /* Init_SR30_SR75 */
271 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32,
272 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF,
273 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
274 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32,
275 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA,
276 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32,
277 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
278 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04,
279 0x00, 0x45, 0x30, 0x30, 0x40, 0x30,
280 },
281 { /* Init_SR80_SR93 */
282 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32,
283 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32,
284 0x00, 0x00, 0x00, 0x00,
285 },
286 { /* Init_SRA0_SRAF */
287 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
288 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF,
289 },
290 { /* Init_GR00_GR08 */
291 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
292 0xFF,
293 },
294 { /* Init_AR00_AR14 */
295 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
296 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
297 0x41, 0x00, 0x0F, 0x00, 0x00,
298 },
299 { /* Init_CR00_CR18 */
300 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E,
301 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
302 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3,
303 0xFF,
304 },
305 { /* Init_CR30_CR4D */
306 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20,
307 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD,
308 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00,
309 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF,
310 },
311 { /* Init_CR90_CRA7 */
312 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55,
313 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00,
314 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
315 },
316 },
317
318 { /* mode#2: 800 x 600 16Bpp 60Hz */
319 800, 600, 16, 60,
320 /* Init_MISC */
321 0x2B,
322 { /* Init_SR0_SR4 */
323 0x03, 0x01, 0x0F, 0x03, 0x0E,
324 },
325 { /* Init_SR10_SR24 */
326 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
327 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
328 0xC4, 0x30, 0x02, 0x01, 0x01,
329 },
330 { /* Init_SR30_SR75 */
331 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24,
332 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF,
333 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC,
334 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24,
335 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58,
336 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24,
337 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00,
338 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13,
339 0x02, 0x45, 0x30, 0x35, 0x40, 0x20,
340 },
341 { /* Init_SR80_SR93 */
342 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24,
343 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24,
344 0x00, 0x00, 0x00, 0x00,
345 },
346 { /* Init_SRA0_SRAF */
347 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
348 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF,
349 },
350 { /* Init_GR00_GR08 */
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
352 0xFF,
353 },
354 { /* Init_AR00_AR14 */
355 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
356 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
357 0x41, 0x00, 0x0F, 0x00, 0x00,
358 },
359 { /* Init_CR00_CR18 */
360 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0,
361 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3,
363 0xFF,
364 },
365 { /* Init_CR30_CR4D */
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20,
367 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD,
368 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00,
369 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57,
370 },
371 { /* Init_CR90_CRA7 */
372 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA,
373 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00,
374 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
375 },
376 },
377 { /* mode#3: 800 x 600 24Bpp 60Hz */
378 800, 600, 24, 60,
379 0x2B,
380 { /* Init_SR0_SR4 */
381 0x03, 0x01, 0x0F, 0x03, 0x0E,
382 },
383 { /* Init_SR10_SR24 */
384 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
385 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0xC4, 0x30, 0x02, 0x01, 0x01,
387 },
388 { /* Init_SR30_SR75 */
389 0x36, 0x03, 0x20, 0x09, 0xC0, 0x36, 0x36, 0x36,
390 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x03, 0xFF,
391 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
392 0x20, 0x0C, 0x44, 0x20, 0x00, 0x36, 0x36, 0x36,
393 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58,
394 0x04, 0x55, 0x59, 0x36, 0x36, 0x00, 0x00, 0x36,
395 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
396 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13,
397 0x02, 0x45, 0x30, 0x30, 0x40, 0x20,
398 },
399 { /* Init_SR80_SR93 */
400 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x36,
401 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x36, 0x36,
402 0x00, 0x00, 0x00, 0x00,
403 },
404 { /* Init_SRA0_SRAF */
405 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
406 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF,
407 },
408 { /* Init_GR00_GR08 */
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
410 0xFF,
411 },
412 { /* Init_AR00_AR14 */
413 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
414 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
415 0x41, 0x00, 0x0F, 0x00, 0x00,
416 },
417 { /* Init_CR00_CR18 */
418 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0,
419 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3,
421 0xFF,
422 },
423 { /* Init_CR30_CR4D */
424 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20,
425 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD,
426 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00,
427 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57,
428 },
429 { /* Init_CR90_CRA7 */
430 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA,
431 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00,
432 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
433 },
434 },
435 { /* mode#7: 800 x 600 32Bpp 60Hz */
436 800, 600, 32, 60,
437 /* Init_MISC */
438 0x2B,
439 { /* Init_SR0_SR4 */
440 0x03, 0x01, 0x0F, 0x03, 0x0E,
441 },
442 { /* Init_SR10_SR24 */
443 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
444 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
445 0xC4, 0x30, 0x02, 0x01, 0x01,
446 },
447 { /* Init_SR30_SR75 */
448 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24,
449 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF,
450 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC,
451 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24,
452 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58,
453 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24,
454 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00,
455 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13,
456 0x02, 0x45, 0x30, 0x35, 0x40, 0x20,
457 },
458 { /* Init_SR80_SR93 */
459 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24,
460 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24,
461 0x00, 0x00, 0x00, 0x00,
462 },
463 { /* Init_SRA0_SRAF */
464 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
465 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF,
466 },
467 { /* Init_GR00_GR08 */
468 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
469 0xFF,
470 },
471 { /* Init_AR00_AR14 */
472 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
473 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
474 0x41, 0x00, 0x0F, 0x00, 0x00,
475 },
476 { /* Init_CR00_CR18 */
477 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0,
478 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
479 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3,
480 0xFF,
481 },
482 { /* Init_CR30_CR4D */
483 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20,
484 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD,
485 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00,
486 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57,
487 },
488 { /* Init_CR90_CRA7 */
489 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA,
490 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00,
491 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
492 },
493 },
494 /* We use 1024x768 table to light 1024x600 panel for lemote */
495 { /* mode#4: 1024 x 600 16Bpp 60Hz */
496 1024, 600, 16, 60,
497 /* Init_MISC */
498 0xEB,
499 { /* Init_SR0_SR4 */
500 0x03, 0x01, 0x0F, 0x00, 0x0E,
501 },
502 { /* Init_SR10_SR24 */
503 0xC8, 0x40, 0x14, 0x60, 0x00, 0x0A, 0x17, 0x20,
504 0x51, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
505 0xC4, 0x30, 0x02, 0x00, 0x01,
506 },
507 { /* Init_SR30_SR75 */
508 0x22, 0x03, 0x24, 0x09, 0xC0, 0x22, 0x22, 0x22,
509 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x03, 0xFF,
510 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
511 0x20, 0x0C, 0x44, 0x20, 0x00, 0x22, 0x22, 0x22,
512 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
513 0x00, 0x60, 0x59, 0x22, 0x22, 0x00, 0x00, 0x22,
514 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00,
515 0x50, 0x03, 0x16, 0x02, 0x0D, 0x82, 0x09, 0x02,
516 0x04, 0x45, 0x3F, 0x30, 0x40, 0x20,
517 },
518 { /* Init_SR80_SR93 */
519 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
520 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
521 0x00, 0x00, 0x00, 0x00,
522 },
523 { /* Init_SRA0_SRAF */
524 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
525 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
526 },
527 { /* Init_GR00_GR08 */
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
529 0xFF,
530 },
531 { /* Init_AR00_AR14 */
532 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
533 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
534 0x41, 0x00, 0x0F, 0x00, 0x00,
535 },
536 { /* Init_CR00_CR18 */
537 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
538 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
539 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
540 0xFF,
541 },
542 { /* Init_CR30_CR4D */
543 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
544 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
545 0xA3, 0x7F, 0x00, 0x82, 0x0b, 0x6f, 0x57, 0x00,
546 0x5c, 0x0f, 0xE0, 0xe0, 0x7F, 0x57,
547 },
548 { /* Init_CR90_CRA7 */
549 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
550 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
551 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
552 },
553 },
554 { /* mode#5: 1024 x 768 24Bpp 60Hz */
555 1024, 768, 24, 60,
556 /* Init_MISC */
557 0xEB,
558 { /* Init_SR0_SR4 */
559 0x03, 0x01, 0x0F, 0x03, 0x0E,
560 },
561 { /* Init_SR10_SR24 */
562 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
563 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
564 0xC4, 0x30, 0x02, 0x01, 0x01,
565 },
566 { /* Init_SR30_SR75 */
567 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
568 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
569 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
570 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
571 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
572 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
573 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
574 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02,
575 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
576 },
577 { /* Init_SR80_SR93 */
578 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
579 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
580 0x00, 0x00, 0x00, 0x00,
581 },
582 { /* Init_SRA0_SRAF */
583 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
584 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
585 },
586 { /* Init_GR00_GR08 */
587 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
588 0xFF,
589 },
590 { /* Init_AR00_AR14 */
591 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
592 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
593 0x41, 0x00, 0x0F, 0x00, 0x00,
594 },
595 { /* Init_CR00_CR18 */
596 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
597 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
598 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
599 0xFF,
600 },
601 { /* Init_CR30_CR4D */
602 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
603 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
604 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00,
605 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF,
606 },
607 { /* Init_CR90_CRA7 */
608 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
609 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
610 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
611 },
612 },
613 { /* mode#4: 1024 x 768 32Bpp 60Hz */
614 1024, 768, 32, 60,
615 /* Init_MISC */
616 0xEB,
617 { /* Init_SR0_SR4 */
618 0x03, 0x01, 0x0F, 0x03, 0x0E,
619 },
620 { /* Init_SR10_SR24 */
621 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
622 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
623 0xC4, 0x32, 0x02, 0x01, 0x01,
624 },
625 { /* Init_SR30_SR75 */
626 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
627 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
628 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
629 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
630 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
631 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
632 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
633 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02,
634 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
635 },
636 { /* Init_SR80_SR93 */
637 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
638 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
639 0x00, 0x00, 0x00, 0x00,
640 },
641 { /* Init_SRA0_SRAF */
642 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
643 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
644 },
645 { /* Init_GR00_GR08 */
646 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
647 0xFF,
648 },
649 { /* Init_AR00_AR14 */
650 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
651 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
652 0x41, 0x00, 0x0F, 0x00, 0x00,
653 },
654 { /* Init_CR00_CR18 */
655 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
656 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
657 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
658 0xFF,
659 },
660 { /* Init_CR30_CR4D */
661 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
662 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
663 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00,
664 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF,
665 },
666 { /* Init_CR90_CRA7 */
667 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
668 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
669 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
670 },
671 },
672 { /* mode#6: 320 x 240 16Bpp 60Hz */
673 320, 240, 16, 60,
674 /* Init_MISC */
675 0xEB,
676 { /* Init_SR0_SR4 */
677 0x03, 0x01, 0x0F, 0x03, 0x0E,
678 },
679 { /* Init_SR10_SR24 */
680 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
681 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
682 0xC4, 0x32, 0x02, 0x01, 0x01,
683 },
684 { /* Init_SR30_SR75 */
685 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
686 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
687 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
688 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
689 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
690 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
691 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
692 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43,
693 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
694 },
695 { /* Init_SR80_SR93 */
696 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
697 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
698 0x00, 0x00, 0x00, 0x00,
699 },
700 { /* Init_SRA0_SRAF */
701 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
702 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
703 },
704 { /* Init_GR00_GR08 */
705 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
706 0xFF,
707 },
708 { /* Init_AR00_AR14 */
709 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
710 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
711 0x41, 0x00, 0x0F, 0x00, 0x00,
712 },
713 { /* Init_CR00_CR18 */
714 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
715 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
716 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
717 0xFF,
718 },
719 { /* Init_CR30_CR4D */
720 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
721 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
722 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00,
723 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF,
724 },
725 { /* Init_CR90_CRA7 */
726 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
727 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
728 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
729 },
730 },
731
732 { /* mode#8: 320 x 240 32Bpp 60Hz */
733 320, 240, 32, 60,
734 /* Init_MISC */
735 0xEB,
736 { /* Init_SR0_SR4 */
737 0x03, 0x01, 0x0F, 0x03, 0x0E,
738 },
739 { /* Init_SR10_SR24 */
740 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
741 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
742 0xC4, 0x32, 0x02, 0x01, 0x01,
743 },
744 { /* Init_SR30_SR75 */
745 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
746 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
747 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
748 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
749 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
750 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
751 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
752 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43,
753 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
754 },
755 { /* Init_SR80_SR93 */
756 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
757 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
758 0x00, 0x00, 0x00, 0x00,
759 },
760 { /* Init_SRA0_SRAF */
761 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
762 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
763 },
764 { /* Init_GR00_GR08 */
765 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
766 0xFF,
767 },
768 { /* Init_AR00_AR14 */
769 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
770 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
771 0x41, 0x00, 0x0F, 0x00, 0x00,
772 },
773 { /* Init_CR00_CR18 */
774 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
775 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
776 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
777 0xFF,
778 },
779 { /* Init_CR30_CR4D */
780 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
781 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
782 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00,
783 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF,
784 },
785 { /* Init_CR90_CRA7 */
786 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
787 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
788 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
789 },
790 },
791};
792
793#define numVGAModes (sizeof(VGAMode) / sizeof(struct ModeInit))
diff --git a/drivers/staging/vt6655/Kconfig b/drivers/staging/vt6655/Kconfig
index 825bbc4fc3fa..061e730df2d0 100644
--- a/drivers/staging/vt6655/Kconfig
+++ b/drivers/staging/vt6655/Kconfig
@@ -1,6 +1,6 @@
1config VT6655 1config VT6655
2 tristate "VIA Technologies VT6655 support" 2 tristate "VIA Technologies VT6655 support"
3 depends on PCI 3 depends on PCI && WLAN
4 select WIRELESS_EXT 4 select WIRELESS_EXT
5 select WEXT_PRIV 5 select WEXT_PRIV
6 ---help--- 6 ---help---
diff --git a/drivers/staging/vt6656/Kconfig b/drivers/staging/vt6656/Kconfig
index 87bcd269310c..1055b526c532 100644
--- a/drivers/staging/vt6656/Kconfig
+++ b/drivers/staging/vt6656/Kconfig
@@ -1,6 +1,6 @@
1config VT6656 1config VT6656
2 tristate "VIA Technologies VT6656 support" 2 tristate "VIA Technologies VT6656 support"
3 depends on USB 3 depends on USB && WLAN
4 select WIRELESS_EXT 4 select WIRELESS_EXT
5 select WEXT_PRIV 5 select WEXT_PRIV
6 ---help--- 6 ---help---
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 7d76a7f92a33..aaa70ed57710 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -439,7 +439,7 @@ void free_chunks(imgchunk_t *fchunk, unsigned int *nfchunks)
439 } 439 }
440 } 440 }
441 *nfchunks = 0; 441 *nfchunks = 0;
442 memset(fchunk, 0, sizeof(fchunk)); 442 memset(fchunk, 0, sizeof(*fchunk));
443 443
444} 444}
445 445
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 473aa1a20de9..be3c9b80bc9f 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -44,5 +44,3 @@ obj-y += early/
44 44
45obj-$(CONFIG_USB_ATM) += atm/ 45obj-$(CONFIG_USB_ATM) += atm/
46obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ 46obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
47
48obj-$(CONFIG_USB_ULPI) += otg/
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 6dac3b802d41..0495fa651225 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1597,7 +1597,9 @@ rescan:
1597} 1597}
1598 1598
1599/** 1599/**
1600 * Check whether a new bandwidth setting exceeds the bus bandwidth. 1600 * usb_hcd_alloc_bandwidth - check whether a new bandwidth setting exceeds
1601 * the bus bandwidth
1602 * @udev: target &usb_device
1601 * @new_config: new configuration to install 1603 * @new_config: new configuration to install
1602 * @cur_alt: the current alternate interface setting 1604 * @cur_alt: the current alternate interface setting
1603 * @new_alt: alternate interface setting that is being installed 1605 * @new_alt: alternate interface setting that is being installed
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 06af970e1064..0cec6caf6e9b 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1658,12 +1658,12 @@ static inline void announce_device(struct usb_device *udev) { }
1658#endif 1658#endif
1659 1659
1660/** 1660/**
1661 * usb_configure_device_otg - FIXME (usbcore-internal) 1661 * usb_enumerate_device_otg - FIXME (usbcore-internal)
1662 * @udev: newly addressed device (in ADDRESS state) 1662 * @udev: newly addressed device (in ADDRESS state)
1663 * 1663 *
1664 * Do configuration for On-The-Go devices 1664 * Finish enumeration for On-The-Go devices
1665 */ 1665 */
1666static int usb_configure_device_otg(struct usb_device *udev) 1666static int usb_enumerate_device_otg(struct usb_device *udev)
1667{ 1667{
1668 int err = 0; 1668 int err = 0;
1669 1669
@@ -1734,7 +1734,7 @@ fail:
1734 1734
1735 1735
1736/** 1736/**
1737 * usb_configure_device - Detect and probe device intfs/otg (usbcore-internal) 1737 * usb_enumerate_device - Read device configs/intfs/otg (usbcore-internal)
1738 * @udev: newly addressed device (in ADDRESS state) 1738 * @udev: newly addressed device (in ADDRESS state)
1739 * 1739 *
1740 * This is only called by usb_new_device() and usb_authorize_device() 1740 * This is only called by usb_new_device() and usb_authorize_device()
@@ -1745,7 +1745,7 @@ fail:
1745 * the string descriptors, as they will be errored out by the device 1745 * the string descriptors, as they will be errored out by the device
1746 * until it has been authorized. 1746 * until it has been authorized.
1747 */ 1747 */
1748static int usb_configure_device(struct usb_device *udev) 1748static int usb_enumerate_device(struct usb_device *udev)
1749{ 1749{
1750 int err; 1750 int err;
1751 1751
@@ -1769,7 +1769,7 @@ static int usb_configure_device(struct usb_device *udev)
1769 udev->descriptor.iManufacturer); 1769 udev->descriptor.iManufacturer);
1770 udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber); 1770 udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
1771 } 1771 }
1772 err = usb_configure_device_otg(udev); 1772 err = usb_enumerate_device_otg(udev);
1773fail: 1773fail:
1774 return err; 1774 return err;
1775} 1775}
@@ -1779,8 +1779,8 @@ fail:
1779 * usb_new_device - perform initial device setup (usbcore-internal) 1779 * usb_new_device - perform initial device setup (usbcore-internal)
1780 * @udev: newly addressed device (in ADDRESS state) 1780 * @udev: newly addressed device (in ADDRESS state)
1781 * 1781 *
1782 * This is called with devices which have been enumerated, but not yet 1782 * This is called with devices which have been detected but not fully
1783 * configured. The device descriptor is available, but not descriptors 1783 * enumerated. The device descriptor is available, but not descriptors
1784 * for any device configuration. The caller must have locked either 1784 * for any device configuration. The caller must have locked either
1785 * the parent hub (if udev is a normal device) or else the 1785 * the parent hub (if udev is a normal device) or else the
1786 * usb_bus_list_lock (if udev is a root hub). The parent's pointer to 1786 * usb_bus_list_lock (if udev is a root hub). The parent's pointer to
@@ -1803,8 +1803,8 @@ int usb_new_device(struct usb_device *udev)
1803 if (udev->parent) 1803 if (udev->parent)
1804 usb_autoresume_device(udev->parent); 1804 usb_autoresume_device(udev->parent);
1805 1805
1806 usb_detect_quirks(udev); /* Determine quirks */ 1806 usb_detect_quirks(udev);
1807 err = usb_configure_device(udev); /* detect & probe dev/intfs */ 1807 err = usb_enumerate_device(udev); /* Read descriptors */
1808 if (err < 0) 1808 if (err < 0)
1809 goto fail; 1809 goto fail;
1810 dev_dbg(&udev->dev, "udev %d, busnum %d, minor = %d\n", 1810 dev_dbg(&udev->dev, "udev %d, busnum %d, minor = %d\n",
@@ -1849,21 +1849,23 @@ fail:
1849 */ 1849 */
1850int usb_deauthorize_device(struct usb_device *usb_dev) 1850int usb_deauthorize_device(struct usb_device *usb_dev)
1851{ 1851{
1852 unsigned cnt;
1853 usb_lock_device(usb_dev); 1852 usb_lock_device(usb_dev);
1854 if (usb_dev->authorized == 0) 1853 if (usb_dev->authorized == 0)
1855 goto out_unauthorized; 1854 goto out_unauthorized;
1855
1856 usb_dev->authorized = 0; 1856 usb_dev->authorized = 0;
1857 usb_set_configuration(usb_dev, -1); 1857 usb_set_configuration(usb_dev, -1);
1858
1859 kfree(usb_dev->product);
1858 usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL); 1860 usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL);
1861 kfree(usb_dev->manufacturer);
1859 usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL); 1862 usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL);
1863 kfree(usb_dev->serial);
1860 usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL); 1864 usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL);
1861 kfree(usb_dev->config); 1865
1862 usb_dev->config = NULL; 1866 usb_destroy_configuration(usb_dev);
1863 for (cnt = 0; cnt < usb_dev->descriptor.bNumConfigurations; cnt++)
1864 kfree(usb_dev->rawdescriptors[cnt]);
1865 usb_dev->descriptor.bNumConfigurations = 0; 1867 usb_dev->descriptor.bNumConfigurations = 0;
1866 kfree(usb_dev->rawdescriptors); 1868
1867out_unauthorized: 1869out_unauthorized:
1868 usb_unlock_device(usb_dev); 1870 usb_unlock_device(usb_dev);
1869 return 0; 1871 return 0;
@@ -1873,15 +1875,11 @@ out_unauthorized:
1873int usb_authorize_device(struct usb_device *usb_dev) 1875int usb_authorize_device(struct usb_device *usb_dev)
1874{ 1876{
1875 int result = 0, c; 1877 int result = 0, c;
1878
1876 usb_lock_device(usb_dev); 1879 usb_lock_device(usb_dev);
1877 if (usb_dev->authorized == 1) 1880 if (usb_dev->authorized == 1)
1878 goto out_authorized; 1881 goto out_authorized;
1879 kfree(usb_dev->product); 1882
1880 usb_dev->product = NULL;
1881 kfree(usb_dev->manufacturer);
1882 usb_dev->manufacturer = NULL;
1883 kfree(usb_dev->serial);
1884 usb_dev->serial = NULL;
1885 result = usb_autoresume_device(usb_dev); 1883 result = usb_autoresume_device(usb_dev);
1886 if (result < 0) { 1884 if (result < 0) {
1887 dev_err(&usb_dev->dev, 1885 dev_err(&usb_dev->dev,
@@ -1894,10 +1892,18 @@ int usb_authorize_device(struct usb_device *usb_dev)
1894 "authorization: %d\n", result); 1892 "authorization: %d\n", result);
1895 goto error_device_descriptor; 1893 goto error_device_descriptor;
1896 } 1894 }
1895
1896 kfree(usb_dev->product);
1897 usb_dev->product = NULL;
1898 kfree(usb_dev->manufacturer);
1899 usb_dev->manufacturer = NULL;
1900 kfree(usb_dev->serial);
1901 usb_dev->serial = NULL;
1902
1897 usb_dev->authorized = 1; 1903 usb_dev->authorized = 1;
1898 result = usb_configure_device(usb_dev); 1904 result = usb_enumerate_device(usb_dev);
1899 if (result < 0) 1905 if (result < 0)
1900 goto error_configure; 1906 goto error_enumerate;
1901 /* Choose and set the configuration. This registers the interfaces 1907 /* Choose and set the configuration. This registers the interfaces
1902 * with the driver core and lets interface drivers bind to them. 1908 * with the driver core and lets interface drivers bind to them.
1903 */ 1909 */
@@ -1912,8 +1918,10 @@ int usb_authorize_device(struct usb_device *usb_dev)
1912 } 1918 }
1913 } 1919 }
1914 dev_info(&usb_dev->dev, "authorized to connect\n"); 1920 dev_info(&usb_dev->dev, "authorized to connect\n");
1915error_configure: 1921
1922error_enumerate:
1916error_device_descriptor: 1923error_device_descriptor:
1924 usb_autosuspend_device(usb_dev);
1917error_autoresume: 1925error_autoresume:
1918out_authorized: 1926out_authorized:
1919 usb_unlock_device(usb_dev); // complements locktree 1927 usb_unlock_device(usb_dev); // complements locktree
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 15477008b631..485edf937f25 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -82,9 +82,13 @@ static ssize_t show_##name(struct device *dev, \
82 struct device_attribute *attr, char *buf) \ 82 struct device_attribute *attr, char *buf) \
83{ \ 83{ \
84 struct usb_device *udev; \ 84 struct usb_device *udev; \
85 int retval; \
85 \ 86 \
86 udev = to_usb_device(dev); \ 87 udev = to_usb_device(dev); \
87 return sprintf(buf, "%s\n", udev->name); \ 88 usb_lock_device(udev); \
89 retval = sprintf(buf, "%s\n", udev->name); \
90 usb_unlock_device(udev); \
91 return retval; \
88} \ 92} \
89static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); 93static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
90 94
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 2fb42043b305..0daff0d968ba 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -66,9 +66,9 @@ MODULE_PARM_DESC(autosuspend, "default autosuspend delay");
66/** 66/**
67 * usb_find_alt_setting() - Given a configuration, find the alternate setting 67 * usb_find_alt_setting() - Given a configuration, find the alternate setting
68 * for the given interface. 68 * for the given interface.
69 * @config - the configuration to search (not necessarily the current config). 69 * @config: the configuration to search (not necessarily the current config).
70 * @iface_num - interface number to search in 70 * @iface_num: interface number to search in
71 * @alt_num - alternate interface setting number to search for. 71 * @alt_num: alternate interface setting number to search for.
72 * 72 *
73 * Search the configuration's interface cache for the given alt setting. 73 * Search the configuration's interface cache for the given alt setting.
74 */ 74 */
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index 1206a26ef893..2958a1271b20 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -613,7 +613,7 @@ err:
613} 613}
614EXPORT_SYMBOL_GPL(dbgp_external_startup); 614EXPORT_SYMBOL_GPL(dbgp_external_startup);
615 615
616static int __init ehci_reset_port(int port) 616static int ehci_reset_port(int port)
617{ 617{
618 u32 portsc; 618 u32 portsc;
619 u32 delay_time, delay; 619 u32 delay_time, delay;
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c
index 58f220323847..a62af7b59094 100644
--- a/drivers/usb/gadget/audio.c
+++ b/drivers/usb/gadget/audio.c
@@ -158,6 +158,7 @@ fail:
158 158
159static int __exit audio_unbind(struct usb_composite_dev *cdev) 159static int __exit audio_unbind(struct usb_composite_dev *cdev)
160{ 160{
161 gaudio_cleanup();
161 return 0; 162 return 0;
162} 163}
163 164
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
index c43c89ffa2c8..df77f6131c73 100644
--- a/drivers/usb/gadget/f_audio.c
+++ b/drivers/usb/gadget/f_audio.c
@@ -56,13 +56,16 @@ static struct usb_interface_descriptor ac_interface_desc __initdata = {
56DECLARE_UAC_AC_HEADER_DESCRIPTOR(2); 56DECLARE_UAC_AC_HEADER_DESCRIPTOR(2);
57 57
58#define UAC_DT_AC_HEADER_LENGTH UAC_DT_AC_HEADER_SIZE(F_AUDIO_NUM_INTERFACES) 58#define UAC_DT_AC_HEADER_LENGTH UAC_DT_AC_HEADER_SIZE(F_AUDIO_NUM_INTERFACES)
59/* 1 input terminal, 1 output terminal and 1 feature unit */
60#define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \
61 + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0))
59/* B.3.2 Class-Specific AC Interface Descriptor */ 62/* B.3.2 Class-Specific AC Interface Descriptor */
60static struct uac_ac_header_descriptor_2 ac_header_desc = { 63static struct uac_ac_header_descriptor_2 ac_header_desc = {
61 .bLength = UAC_DT_AC_HEADER_LENGTH, 64 .bLength = UAC_DT_AC_HEADER_LENGTH,
62 .bDescriptorType = USB_DT_CS_INTERFACE, 65 .bDescriptorType = USB_DT_CS_INTERFACE,
63 .bDescriptorSubtype = UAC_HEADER, 66 .bDescriptorSubtype = UAC_HEADER,
64 .bcdADC = __constant_cpu_to_le16(0x0100), 67 .bcdADC = __constant_cpu_to_le16(0x0100),
65 .wTotalLength = __constant_cpu_to_le16(UAC_DT_AC_HEADER_LENGTH), 68 .wTotalLength = __constant_cpu_to_le16(UAC_DT_TOTAL_LENGTH),
66 .bInCollection = F_AUDIO_NUM_INTERFACES, 69 .bInCollection = F_AUDIO_NUM_INTERFACES,
67 .baInterfaceNr = { 70 .baInterfaceNr = {
68 [0] = F_AUDIO_AC_INTERFACE, 71 [0] = F_AUDIO_AC_INTERFACE,
@@ -252,12 +255,12 @@ static struct f_audio_buf *f_audio_buffer_alloc(int buf_size)
252 255
253 copy_buf = kzalloc(sizeof *copy_buf, GFP_ATOMIC); 256 copy_buf = kzalloc(sizeof *copy_buf, GFP_ATOMIC);
254 if (!copy_buf) 257 if (!copy_buf)
255 return (struct f_audio_buf *)-ENOMEM; 258 return ERR_PTR(-ENOMEM);
256 259
257 copy_buf->buf = kzalloc(buf_size, GFP_ATOMIC); 260 copy_buf->buf = kzalloc(buf_size, GFP_ATOMIC);
258 if (!copy_buf->buf) { 261 if (!copy_buf->buf) {
259 kfree(copy_buf); 262 kfree(copy_buf);
260 return (struct f_audio_buf *)-ENOMEM; 263 return ERR_PTR(-ENOMEM);
261 } 264 }
262 265
263 return copy_buf; 266 return copy_buf;
@@ -332,7 +335,7 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
332 list_add_tail(&copy_buf->list, &audio->play_queue); 335 list_add_tail(&copy_buf->list, &audio->play_queue);
333 schedule_work(&audio->playback_work); 336 schedule_work(&audio->playback_work);
334 copy_buf = f_audio_buffer_alloc(audio_buf_size); 337 copy_buf = f_audio_buffer_alloc(audio_buf_size);
335 if (copy_buf < 0) 338 if (IS_ERR(copy_buf))
336 return -ENOMEM; 339 return -ENOMEM;
337 } 340 }
338 341
@@ -576,6 +579,8 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
576 usb_ep_enable(out_ep, audio->out_desc); 579 usb_ep_enable(out_ep, audio->out_desc);
577 out_ep->driver_data = audio; 580 out_ep->driver_data = audio;
578 audio->copy_buf = f_audio_buffer_alloc(audio_buf_size); 581 audio->copy_buf = f_audio_buffer_alloc(audio_buf_size);
582 if (IS_ERR(audio->copy_buf))
583 return -ENOMEM;
579 584
580 /* 585 /*
581 * allocate a bunch of read buffers 586 * allocate a bunch of read buffers
@@ -787,7 +792,7 @@ int __init audio_bind_config(struct usb_configuration *c)
787 return status; 792 return status;
788 793
789add_fail: 794add_fail:
790 gaudio_cleanup(&audio->card); 795 gaudio_cleanup();
791setup_fail: 796setup_fail:
792 kfree(audio); 797 kfree(audio);
793 return status; 798 return status;
diff --git a/drivers/usb/gadget/u_audio.c b/drivers/usb/gadget/u_audio.c
index 8252595d619d..35e0930f5bbb 100644
--- a/drivers/usb/gadget/u_audio.c
+++ b/drivers/usb/gadget/u_audio.c
@@ -288,6 +288,7 @@ static int gaudio_close_snd_dev(struct gaudio *gau)
288 return 0; 288 return 0;
289} 289}
290 290
291static struct gaudio *the_card;
291/** 292/**
292 * gaudio_setup - setup ALSA interface and preparing for USB transfer 293 * gaudio_setup - setup ALSA interface and preparing for USB transfer
293 * 294 *
@@ -303,6 +304,9 @@ int __init gaudio_setup(struct gaudio *card)
303 if (ret) 304 if (ret)
304 ERROR(card, "we need at least one control device\n"); 305 ERROR(card, "we need at least one control device\n");
305 306
307 if (!the_card)
308 the_card = card;
309
306 return ret; 310 return ret;
307 311
308} 312}
@@ -312,9 +316,11 @@ int __init gaudio_setup(struct gaudio *card)
312 * 316 *
313 * This is called to free all resources allocated by @gaudio_setup(). 317 * This is called to free all resources allocated by @gaudio_setup().
314 */ 318 */
315void gaudio_cleanup(struct gaudio *card) 319void gaudio_cleanup(void)
316{ 320{
317 if (card) 321 if (the_card) {
318 gaudio_close_snd_dev(card); 322 gaudio_close_snd_dev(the_card);
323 the_card = NULL;
324 }
319} 325}
320 326
diff --git a/drivers/usb/gadget/u_audio.h b/drivers/usb/gadget/u_audio.h
index cc8d159c648a..08ffce3298e6 100644
--- a/drivers/usb/gadget/u_audio.h
+++ b/drivers/usb/gadget/u_audio.h
@@ -51,6 +51,6 @@ struct gaudio {
51}; 51};
52 52
53int gaudio_setup(struct gaudio *card); 53int gaudio_setup(struct gaudio *card);
54void gaudio_cleanup(struct gaudio *card); 54void gaudio_cleanup(void);
55 55
56#endif /* __U_AUDIO_H */ 56#endif /* __U_AUDIO_H */
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 12f1ad2fd0e8..74d07f4e8b7d 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -37,7 +37,7 @@
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/clk.h> 38#include <linux/clk.h>
39#include <linux/gpio.h> 39#include <linux/gpio.h>
40#include <mach/usb.h> 40#include <plat/usb.h>
41 41
42/* 42/*
43 * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES 43 * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c
index 00a29855d0c4..ff43747a614f 100644
--- a/drivers/usb/host/fhci-sched.c
+++ b/drivers/usb/host/fhci-sched.c
@@ -37,7 +37,7 @@ static void recycle_frame(struct fhci_usb *usb, struct packet *pkt)
37 pkt->info = 0; 37 pkt->info = 0;
38 pkt->priv_data = NULL; 38 pkt->priv_data = NULL;
39 39
40 cq_put(usb->ep0->empty_frame_Q, pkt); 40 cq_put(&usb->ep0->empty_frame_Q, pkt);
41} 41}
42 42
43/* confirm submitted packet */ 43/* confirm submitted packet */
@@ -57,7 +57,7 @@ void fhci_transaction_confirm(struct fhci_usb *usb, struct packet *pkt)
57 if ((td->data + td->actual_len) && trans_len) 57 if ((td->data + td->actual_len) && trans_len)
58 memcpy(td->data + td->actual_len, pkt->data, 58 memcpy(td->data + td->actual_len, pkt->data,
59 trans_len); 59 trans_len);
60 cq_put(usb->ep0->dummy_packets_Q, pkt->data); 60 cq_put(&usb->ep0->dummy_packets_Q, pkt->data);
61 } 61 }
62 62
63 recycle_frame(usb, pkt); 63 recycle_frame(usb, pkt);
@@ -213,7 +213,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td)
213 } 213 }
214 214
215 /* update frame object fields before transmitting */ 215 /* update frame object fields before transmitting */
216 pkt = cq_get(usb->ep0->empty_frame_Q); 216 pkt = cq_get(&usb->ep0->empty_frame_Q);
217 if (!pkt) { 217 if (!pkt) {
218 fhci_dbg(usb->fhci, "there is no empty frame\n"); 218 fhci_dbg(usb->fhci, "there is no empty frame\n");
219 return -1; 219 return -1;
@@ -222,7 +222,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td)
222 222
223 pkt->info = 0; 223 pkt->info = 0;
224 if (data == NULL) { 224 if (data == NULL) {
225 data = cq_get(usb->ep0->dummy_packets_Q); 225 data = cq_get(&usb->ep0->dummy_packets_Q);
226 BUG_ON(!data); 226 BUG_ON(!data);
227 pkt->info = PKT_DUMMY_PACKET; 227 pkt->info = PKT_DUMMY_PACKET;
228 } 228 }
@@ -246,7 +246,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td)
246 list_del_init(&td->frame_lh); 246 list_del_init(&td->frame_lh);
247 td->status = USB_TD_OK; 247 td->status = USB_TD_OK;
248 if (pkt->info & PKT_DUMMY_PACKET) 248 if (pkt->info & PKT_DUMMY_PACKET)
249 cq_put(usb->ep0->dummy_packets_Q, pkt->data); 249 cq_put(&usb->ep0->dummy_packets_Q, pkt->data);
250 recycle_frame(usb, pkt); 250 recycle_frame(usb, pkt);
251 usb->actual_frame->total_bytes -= (len + PROTOCOL_OVERHEAD); 251 usb->actual_frame->total_bytes -= (len + PROTOCOL_OVERHEAD);
252 fhci_err(usb->fhci, "host transaction failed\n"); 252 fhci_err(usb->fhci, "host transaction failed\n");
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c
index b40332290319..d224ab467a40 100644
--- a/drivers/usb/host/fhci-tds.c
+++ b/drivers/usb/host/fhci-tds.c
@@ -106,33 +106,33 @@ void fhci_ep0_free(struct fhci_usb *usb)
106 cpm_muram_free(cpm_muram_offset(ep->td_base)); 106 cpm_muram_free(cpm_muram_offset(ep->td_base));
107 107
108 if (ep->conf_frame_Q) { 108 if (ep->conf_frame_Q) {
109 size = cq_howmany(ep->conf_frame_Q); 109 size = cq_howmany(&ep->conf_frame_Q);
110 for (; size; size--) { 110 for (; size; size--) {
111 struct packet *pkt = cq_get(ep->conf_frame_Q); 111 struct packet *pkt = cq_get(&ep->conf_frame_Q);
112 112
113 kfree(pkt); 113 kfree(pkt);
114 } 114 }
115 cq_delete(ep->conf_frame_Q); 115 cq_delete(&ep->conf_frame_Q);
116 } 116 }
117 117
118 if (ep->empty_frame_Q) { 118 if (ep->empty_frame_Q) {
119 size = cq_howmany(ep->empty_frame_Q); 119 size = cq_howmany(&ep->empty_frame_Q);
120 for (; size; size--) { 120 for (; size; size--) {
121 struct packet *pkt = cq_get(ep->empty_frame_Q); 121 struct packet *pkt = cq_get(&ep->empty_frame_Q);
122 122
123 kfree(pkt); 123 kfree(pkt);
124 } 124 }
125 cq_delete(ep->empty_frame_Q); 125 cq_delete(&ep->empty_frame_Q);
126 } 126 }
127 127
128 if (ep->dummy_packets_Q) { 128 if (ep->dummy_packets_Q) {
129 size = cq_howmany(ep->dummy_packets_Q); 129 size = cq_howmany(&ep->dummy_packets_Q);
130 for (; size; size--) { 130 for (; size; size--) {
131 u8 *buff = cq_get(ep->dummy_packets_Q); 131 u8 *buff = cq_get(&ep->dummy_packets_Q);
132 132
133 kfree(buff); 133 kfree(buff);
134 } 134 }
135 cq_delete(ep->dummy_packets_Q); 135 cq_delete(&ep->dummy_packets_Q);
136 } 136 }
137 137
138 kfree(ep); 138 kfree(ep);
@@ -175,10 +175,9 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
175 ep->td_base = cpm_muram_addr(ep_offset); 175 ep->td_base = cpm_muram_addr(ep_offset);
176 176
177 /* zero all queue pointers */ 177 /* zero all queue pointers */
178 ep->conf_frame_Q = cq_new(ring_len + 2); 178 if (cq_new(&ep->conf_frame_Q, ring_len + 2) ||
179 ep->empty_frame_Q = cq_new(ring_len + 2); 179 cq_new(&ep->empty_frame_Q, ring_len + 2) ||
180 ep->dummy_packets_Q = cq_new(ring_len + 2); 180 cq_new(&ep->dummy_packets_Q, ring_len + 2)) {
181 if (!ep->conf_frame_Q || !ep->empty_frame_Q || !ep->dummy_packets_Q) {
182 err_for = "frame_queues"; 181 err_for = "frame_queues";
183 goto err; 182 goto err;
184 } 183 }
@@ -199,8 +198,8 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem,
199 err_for = "buffer"; 198 err_for = "buffer";
200 goto err; 199 goto err;
201 } 200 }
202 cq_put(ep->empty_frame_Q, pkt); 201 cq_put(&ep->empty_frame_Q, pkt);
203 cq_put(ep->dummy_packets_Q, buff); 202 cq_put(&ep->dummy_packets_Q, buff);
204 } 203 }
205 204
206 /* we put the endpoint parameter RAM right behind the TD ring */ 205 /* we put the endpoint parameter RAM right behind the TD ring */
@@ -319,7 +318,7 @@ static void fhci_td_transaction_confirm(struct fhci_usb *usb)
319 if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) 318 if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W))
320 continue; 319 continue;
321 320
322 pkt = cq_get(ep->conf_frame_Q); 321 pkt = cq_get(&ep->conf_frame_Q);
323 if (!pkt) 322 if (!pkt)
324 fhci_err(usb->fhci, "no frame to confirm\n"); 323 fhci_err(usb->fhci, "no frame to confirm\n");
325 324
@@ -460,9 +459,9 @@ u32 fhci_host_transaction(struct fhci_usb *usb,
460 out_be16(&td->length, pkt->len); 459 out_be16(&td->length, pkt->len);
461 460
462 /* put the frame to the confirmation queue */ 461 /* put the frame to the confirmation queue */
463 cq_put(ep->conf_frame_Q, pkt); 462 cq_put(&ep->conf_frame_Q, pkt);
464 463
465 if (cq_howmany(ep->conf_frame_Q) == 1) 464 if (cq_howmany(&ep->conf_frame_Q) == 1)
466 out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); 465 out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO);
467 466
468 return 0; 467 return 0;
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h
index 7116284ed21a..72dae1c5ab38 100644
--- a/drivers/usb/host/fhci.h
+++ b/drivers/usb/host/fhci.h
@@ -423,9 +423,9 @@ struct endpoint {
423 struct usb_td __iomem *td_base; /* first TD in the ring */ 423 struct usb_td __iomem *td_base; /* first TD in the ring */
424 struct usb_td __iomem *conf_td; /* next TD for confirm after transac */ 424 struct usb_td __iomem *conf_td; /* next TD for confirm after transac */
425 struct usb_td __iomem *empty_td;/* next TD for new transaction req. */ 425 struct usb_td __iomem *empty_td;/* next TD for new transaction req. */
426 struct kfifo *empty_frame_Q; /* Empty frames list to use */ 426 struct kfifo empty_frame_Q; /* Empty frames list to use */
427 struct kfifo *conf_frame_Q; /* frames passed to TDs,waiting for tx */ 427 struct kfifo conf_frame_Q; /* frames passed to TDs,waiting for tx */
428 struct kfifo *dummy_packets_Q;/* dummy packets for the CRC overun */ 428 struct kfifo dummy_packets_Q;/* dummy packets for the CRC overun */
429 429
430 bool already_pushed_dummy_bd; 430 bool already_pushed_dummy_bd;
431}; 431};
@@ -493,9 +493,9 @@ static inline struct usb_hcd *fhci_to_hcd(struct fhci_hcd *fhci)
493} 493}
494 494
495/* fifo of pointers */ 495/* fifo of pointers */
496static inline struct kfifo *cq_new(int size) 496static inline int cq_new(struct kfifo *fifo, int size)
497{ 497{
498 return kfifo_alloc(size * sizeof(void *), GFP_KERNEL, NULL); 498 return kfifo_alloc(fifo, size * sizeof(void *), GFP_KERNEL);
499} 499}
500 500
501static inline void cq_delete(struct kfifo *kfifo) 501static inline void cq_delete(struct kfifo *kfifo)
@@ -505,19 +505,19 @@ static inline void cq_delete(struct kfifo *kfifo)
505 505
506static inline unsigned int cq_howmany(struct kfifo *kfifo) 506static inline unsigned int cq_howmany(struct kfifo *kfifo)
507{ 507{
508 return __kfifo_len(kfifo) / sizeof(void *); 508 return kfifo_len(kfifo) / sizeof(void *);
509} 509}
510 510
511static inline int cq_put(struct kfifo *kfifo, void *p) 511static inline int cq_put(struct kfifo *kfifo, void *p)
512{ 512{
513 return __kfifo_put(kfifo, (void *)&p, sizeof(p)); 513 return kfifo_in(kfifo, (void *)&p, sizeof(p));
514} 514}
515 515
516static inline void *cq_get(struct kfifo *kfifo) 516static inline void *cq_get(struct kfifo *kfifo)
517{ 517{
518 void *p = NULL; 518 void *p = NULL;
519 519
520 __kfifo_get(kfifo, (void *)&p, sizeof(p)); 520 kfifo_out(kfifo, (void *)&p, sizeof(p));
521 return p; 521 return p;
522} 522}
523 523
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 1d8e39a557d9..1eb9e4162cc6 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -60,6 +60,7 @@
60static struct usb_device_id appledisplay_table [] = { 60static struct usb_device_id appledisplay_table [] = {
61 { APPLEDISPLAY_DEVICE(0x9218) }, 61 { APPLEDISPLAY_DEVICE(0x9218) },
62 { APPLEDISPLAY_DEVICE(0x9219) }, 62 { APPLEDISPLAY_DEVICE(0x9219) },
63 { APPLEDISPLAY_DEVICE(0x921c) },
63 { APPLEDISPLAY_DEVICE(0x921d) }, 64 { APPLEDISPLAY_DEVICE(0x921d) },
64 65
65 /* Terminating entry */ 66 /* Terminating entry */
@@ -72,8 +73,8 @@ struct appledisplay {
72 struct usb_device *udev; /* usb device */ 73 struct usb_device *udev; /* usb device */
73 struct urb *urb; /* usb request block */ 74 struct urb *urb; /* usb request block */
74 struct backlight_device *bd; /* backlight device */ 75 struct backlight_device *bd; /* backlight device */
75 char *urbdata; /* interrupt URB data buffer */ 76 u8 *urbdata; /* interrupt URB data buffer */
76 char *msgdata; /* control message data buffer */ 77 u8 *msgdata; /* control message data buffer */
77 78
78 struct delayed_work work; 79 struct delayed_work work;
79 int button_pressed; 80 int button_pressed;
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index 602ee05ba9ff..59860b328534 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -167,7 +167,7 @@ static int emi62_load_firmware (struct usb_device *dev)
167 err("%s - error loading firmware: error = %d", __func__, err); 167 err("%s - error loading firmware: error = %d", __func__, err);
168 goto wraperr; 168 goto wraperr;
169 } 169 }
170 } while (i > 0); 170 } while (rec);
171 171
172 /* Assert reset (stop the CPU in the EMI) */ 172 /* Assert reset (stop the CPU in the EMI) */
173 err = emi62_set_reset(dev,1); 173 err = emi62_set_reset(dev,1);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index fe4934d9602c..ad26e6569665 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -29,6 +29,8 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
29{ 29{
30 void __iomem *fifo = hw_ep->fifo; 30 void __iomem *fifo = hw_ep->fifo;
31 void __iomem *epio = hw_ep->regs; 31 void __iomem *epio = hw_ep->regs;
32 u8 epnum = hw_ep->epnum;
33 u16 dma_reg = 0;
32 34
33 prefetch((u8 *)src); 35 prefetch((u8 *)src);
34 36
@@ -39,67 +41,113 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
39 41
40 dump_fifo_data(src, len); 42 dump_fifo_data(src, len);
41 43
42 if (unlikely((unsigned long)src & 0x01)) 44 if (!ANOMALY_05000380 && epnum != 0) {
43 outsw_8((unsigned long)fifo, src, 45 flush_dcache_range((unsigned int)src,
44 len & 0x01 ? (len >> 1) + 1 : len >> 1); 46 (unsigned int)(src + len));
45 else 47
46 outsw((unsigned long)fifo, src, 48 /* Setup DMA address register */
47 len & 0x01 ? (len >> 1) + 1 : len >> 1); 49 dma_reg = (u16) ((u32) src & 0xFFFF);
48} 50 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
51 SSYNC();
52
53 dma_reg = (u16) (((u32) src >> 16) & 0xFFFF);
54 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
55 SSYNC();
56
57 /* Setup DMA count register */
58 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
59 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
60 SSYNC();
61
62 /* Enable the DMA */
63 dma_reg = (epnum << 4) | DMA_ENA | INT_ENA | DIRECTION;
64 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
65 SSYNC();
66
67 /* Wait for compelete */
68 while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum)))
69 cpu_relax();
70
71 /* acknowledge dma interrupt */
72 bfin_write_USB_DMA_INTERRUPT(1 << epnum);
73 SSYNC();
74
75 /* Reset DMA */
76 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
77 SSYNC();
78 } else {
79 SSYNC();
80
81 if (unlikely((unsigned long)src & 0x01))
82 outsw_8((unsigned long)fifo, src,
83 len & 0x01 ? (len >> 1) + 1 : len >> 1);
84 else
85 outsw((unsigned long)fifo, src,
86 len & 0x01 ? (len >> 1) + 1 : len >> 1);
49 87
88 }
89}
50/* 90/*
51 * Unload an endpoint's FIFO 91 * Unload an endpoint's FIFO
52 */ 92 */
53void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) 93void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
54{ 94{
55 void __iomem *fifo = hw_ep->fifo; 95 void __iomem *fifo = hw_ep->fifo;
56
57#ifdef CONFIG_BF52x
58 u8 epnum = hw_ep->epnum; 96 u8 epnum = hw_ep->epnum;
59 u16 dma_reg = 0; 97 u16 dma_reg = 0;
60 98
61 invalidate_dcache_range((unsigned int)dst, 99 if (ANOMALY_05000467 && epnum != 0) {
62 (unsigned int)(dst + len));
63 100
64 /* Setup DMA address register */ 101 invalidate_dcache_range((unsigned int)dst,
65 dma_reg = (u16) ((u32) dst & 0xFFFF); 102 (unsigned int)(dst + len));
66 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
67 SSYNC();
68 103
69 dma_reg = (u16) (((u32) dst >> 16) & 0xFFFF); 104 /* Setup DMA address register */
70 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); 105 dma_reg = (u16) ((u32) dst & 0xFFFF);
71 SSYNC(); 106 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
107 SSYNC();
72 108
73 /* Setup DMA count register */ 109 dma_reg = (u16) (((u32) dst >> 16) & 0xFFFF);
74 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len); 110 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
75 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0); 111 SSYNC();
76 SSYNC();
77 112
78 /* Enable the DMA */ 113 /* Setup DMA count register */
79 dma_reg = (epnum << 4) | DMA_ENA | INT_ENA; 114 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
80 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg); 115 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
81 SSYNC(); 116 SSYNC();
82 117
83 /* Wait for compelete */ 118 /* Enable the DMA */
84 while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum))) 119 dma_reg = (epnum << 4) | DMA_ENA | INT_ENA;
85 cpu_relax(); 120 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
121 SSYNC();
86 122
87 /* acknowledge dma interrupt */ 123 /* Wait for compelete */
88 bfin_write_USB_DMA_INTERRUPT(1 << epnum); 124 while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum)))
89 SSYNC(); 125 cpu_relax();
90 126
91 /* Reset DMA */ 127 /* acknowledge dma interrupt */
92 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0); 128 bfin_write_USB_DMA_INTERRUPT(1 << epnum);
93 SSYNC(); 129 SSYNC();
94#else
95 if (unlikely((unsigned long)dst & 0x01))
96 insw_8((unsigned long)fifo, dst,
97 len & 0x01 ? (len >> 1) + 1 : len >> 1);
98 else
99 insw((unsigned long)fifo, dst,
100 len & 0x01 ? (len >> 1) + 1 : len >> 1);
101#endif
102 130
131 /* Reset DMA */
132 bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
133 SSYNC();
134 } else {
135 SSYNC();
136 /* Read the last byte of packet with odd size from address fifo + 4
137 * to trigger 1 byte access to EP0 FIFO.
138 */
139 if (len == 1)
140 *dst = (u8)inw((unsigned long)fifo + 4);
141 else {
142 if (unlikely((unsigned long)dst & 0x01))
143 insw_8((unsigned long)fifo, dst, len >> 1);
144 else
145 insw((unsigned long)fifo, dst, len >> 1);
146
147 if (len & 0x01)
148 *(dst + len - 1) = (u8)inw((unsigned long)fifo + 4);
149 }
150 }
103 DBG(4, "%cX ep%d fifo %p count %d buf %p\n", 151 DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
104 'R', hw_ep->epnum, fifo, len, dst); 152 'R', hw_ep->epnum, fifo, len, dst);
105 153
diff --git a/drivers/usb/musb/blackfin.h b/drivers/usb/musb/blackfin.h
index 10b7d7584f4b..bd9352a2ef2a 100644
--- a/drivers/usb/musb/blackfin.h
+++ b/drivers/usb/musb/blackfin.h
@@ -69,7 +69,6 @@ static void dump_fifo_data(u8 *buf, u16 len)
69#define dump_fifo_data(buf, len) do {} while (0) 69#define dump_fifo_data(buf, len) do {} while (0)
70#endif 70#endif
71 71
72#ifdef CONFIG_BF52x
73 72
74#define USB_DMA_BASE USB_DMA_INTERRUPT 73#define USB_DMA_BASE USB_DMA_INTERRUPT
75#define USB_DMAx_CTRL 0x04 74#define USB_DMAx_CTRL 0x04
@@ -79,7 +78,6 @@ static void dump_fifo_data(u8 *buf, u16 len)
79#define USB_DMAx_COUNT_HIGH 0x14 78#define USB_DMAx_COUNT_HIGH 0x14
80 79
81#define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg) 80#define USB_DMA_REG(ep, reg) (USB_DMA_BASE + 0x20 * ep + reg)
82#endif
83 81
84/* Almost 1 second */ 82/* Almost 1 second */
85#define TIMER_DELAY (1 * HZ) 83#define TIMER_DELAY (1 * HZ)
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index ef2332a9941d..a44a450c860d 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -1154,8 +1154,11 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
1154 struct musb_hw_ep *hw_ep = NULL; 1154 struct musb_hw_ep *hw_ep = NULL;
1155 u32 rx, tx; 1155 u32 rx, tx;
1156 int i, index; 1156 int i, index;
1157 unsigned long flags;
1157 1158
1158 cppi = container_of(musb->dma_controller, struct cppi, controller); 1159 cppi = container_of(musb->dma_controller, struct cppi, controller);
1160 if (cppi->irq)
1161 spin_lock_irqsave(&musb->lock, flags);
1159 1162
1160 tibase = musb->ctrl_base; 1163 tibase = musb->ctrl_base;
1161 1164
@@ -1285,6 +1288,9 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
1285 /* write to CPPI EOI register to re-enable interrupts */ 1288 /* write to CPPI EOI register to re-enable interrupts */
1286 musb_writel(tibase, DAVINCI_CPPI_EOI_REG, 0); 1289 musb_writel(tibase, DAVINCI_CPPI_EOI_REG, 0);
1287 1290
1291 if (cppi->irq)
1292 spin_unlock_irqrestore(&musb->lock, flags);
1293
1288 return IRQ_HANDLED; 1294 return IRQ_HANDLED;
1289} 1295}
1290 1296
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index e16ff605c458..66913811af5e 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -42,7 +42,7 @@
42#include "musb_core.h" 42#include "musb_core.h"
43 43
44#ifdef CONFIG_MACH_DAVINCI_EVM 44#ifdef CONFIG_MACH_DAVINCI_EVM
45#define GPIO_nVBUS_DRV 144 45#define GPIO_nVBUS_DRV 160
46#endif 46#endif
47 47
48#include "davinci.h" 48#include "davinci.h"
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index bfe08f4975a3..5eb9318cff77 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1319,7 +1319,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1319#endif 1319#endif
1320 u8 reg; 1320 u8 reg;
1321 char *type; 1321 char *type;
1322 char aInfo[78], aRevision[32], aDate[12]; 1322 char aInfo[90], aRevision[32], aDate[12];
1323 void __iomem *mbase = musb->mregs; 1323 void __iomem *mbase = musb->mregs;
1324 int status = 0; 1324 int status = 0;
1325 int i; 1325 int i;
@@ -1521,6 +1521,14 @@ irqreturn_t musb_interrupt(struct musb *musb)
1521 (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", 1521 (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral",
1522 musb->int_usb, musb->int_tx, musb->int_rx); 1522 musb->int_usb, musb->int_tx, musb->int_rx);
1523 1523
1524#ifdef CONFIG_USB_GADGET_MUSB_HDRC
1525 if (is_otg_enabled(musb) || is_peripheral_enabled(musb))
1526 if (!musb->gadget_driver) {
1527 DBG(5, "No gadget driver loaded\n");
1528 return IRQ_HANDLED;
1529 }
1530#endif
1531
1524 /* the core can interrupt us for multiple reasons; docs have 1532 /* the core can interrupt us for multiple reasons; docs have
1525 * a generic interrupt flowchart to follow 1533 * a generic interrupt flowchart to follow
1526 */ 1534 */
@@ -2139,7 +2147,7 @@ static int __init musb_probe(struct platform_device *pdev)
2139 return musb_init_controller(dev, irq, base); 2147 return musb_init_controller(dev, irq, base);
2140} 2148}
2141 2149
2142static int __devexit musb_remove(struct platform_device *pdev) 2150static int __exit musb_remove(struct platform_device *pdev)
2143{ 2151{
2144 struct musb *musb = dev_to_musb(&pdev->dev); 2152 struct musb *musb = dev_to_musb(&pdev->dev);
2145 void __iomem *ctrl_base = musb->ctrl_base; 2153 void __iomem *ctrl_base = musb->ctrl_base;
@@ -2231,7 +2239,7 @@ static struct platform_driver musb_driver = {
2231 .owner = THIS_MODULE, 2239 .owner = THIS_MODULE,
2232 .pm = MUSB_DEV_PM_OPS, 2240 .pm = MUSB_DEV_PM_OPS,
2233 }, 2241 },
2234 .remove = __devexit_p(musb_remove), 2242 .remove = __exit_p(musb_remove),
2235 .shutdown = musb_shutdown, 2243 .shutdown = musb_shutdown,
2236}; 2244};
2237 2245
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index c49b9ba025ab..cbcf14a236e6 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -309,7 +309,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
309 size_t request_size; 309 size_t request_size;
310 310
311 /* setup DMA, then program endpoint CSR */ 311 /* setup DMA, then program endpoint CSR */
312 request_size = min(request->length, 312 request_size = min_t(size_t, request->length,
313 musb_ep->dma->max_len); 313 musb_ep->dma->max_len);
314 if (request_size < musb_ep->packet_sz) 314 if (request_size < musb_ep->packet_sz)
315 musb_ep->dma->desired_mode = 0; 315 musb_ep->dma->desired_mode = 0;
@@ -319,7 +319,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
319 use_dma = use_dma && c->channel_program( 319 use_dma = use_dma && c->channel_program(
320 musb_ep->dma, musb_ep->packet_sz, 320 musb_ep->dma, musb_ep->packet_sz,
321 musb_ep->dma->desired_mode, 321 musb_ep->dma->desired_mode,
322 request->dma, request_size); 322 request->dma + request->actual, request_size);
323 if (use_dma) { 323 if (use_dma) {
324 if (musb_ep->dma->desired_mode == 0) { 324 if (musb_ep->dma->desired_mode == 0) {
325 /* 325 /*
@@ -515,12 +515,12 @@ void musb_g_tx(struct musb *musb, u8 epnum)
515 if (csr & MUSB_TXCSR_FIFONOTEMPTY) 515 if (csr & MUSB_TXCSR_FIFONOTEMPTY)
516 return; 516 return;
517 517
518 if (!musb_ep->desc) { 518 request = musb_ep->desc ? next_request(musb_ep) : NULL;
519 if (!request) {
519 DBG(4, "%s idle now\n", 520 DBG(4, "%s idle now\n",
520 musb_ep->end_point.name); 521 musb_ep->end_point.name);
521 return; 522 return;
522 } else 523 }
523 request = next_request(musb_ep);
524 } 524 }
525 525
526 txstate(musb, to_musb_request(request)); 526 txstate(musb, to_musb_request(request));
@@ -746,6 +746,8 @@ void musb_g_rx(struct musb *musb, u8 epnum)
746 musb_ep_select(mbase, epnum); 746 musb_ep_select(mbase, epnum);
747 747
748 request = next_request(musb_ep); 748 request = next_request(musb_ep);
749 if (!request)
750 return;
749 751
750 csr = musb_readw(epio, MUSB_RXCSR); 752 csr = musb_readw(epio, MUSB_RXCSR);
751 dma = is_dma_capable() ? musb_ep->dma : NULL; 753 dma = is_dma_capable() ? musb_ep->dma : NULL;
@@ -1731,6 +1733,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1731 spin_lock_irqsave(&musb->lock, flags); 1733 spin_lock_irqsave(&musb->lock, flags);
1732 1734
1733 otg_set_peripheral(musb->xceiv, &musb->g); 1735 otg_set_peripheral(musb->xceiv, &musb->g);
1736 musb->xceiv->state = OTG_STATE_B_IDLE;
1734 musb->is_active = 1; 1737 musb->is_active = 1;
1735 1738
1736 /* FIXME this ignores the softconnect flag. Drivers are 1739 /* FIXME this ignores the softconnect flag. Drivers are
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 8fba3f11e473..53d06451f820 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -664,7 +664,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
664 musb->ep0_state = MUSB_EP0_STAGE_STATUSIN; 664 musb->ep0_state = MUSB_EP0_STAGE_STATUSIN;
665 break; 665 break;
666 default: 666 default:
667 ERR("SetupEnd came in a wrong ep0stage %s", 667 ERR("SetupEnd came in a wrong ep0stage %s\n",
668 decode_ep0stage(musb->ep0_state)); 668 decode_ep0stage(musb->ep0_state));
669 } 669 }
670 csr = musb_readw(regs, MUSB_CSR0); 670 csr = musb_readw(regs, MUSB_CSR0);
@@ -787,12 +787,18 @@ setup:
787 handled = service_zero_data_request( 787 handled = service_zero_data_request(
788 musb, &setup); 788 musb, &setup);
789 789
790 /*
791 * We're expecting no data in any case, so
792 * always set the DATAEND bit -- doing this
793 * here helps avoid SetupEnd interrupt coming
794 * in the idle stage when we're stalling...
795 */
796 musb->ackpend |= MUSB_CSR0_P_DATAEND;
797
790 /* status stage might be immediate */ 798 /* status stage might be immediate */
791 if (handled > 0) { 799 if (handled > 0)
792 musb->ackpend |= MUSB_CSR0_P_DATAEND;
793 musb->ep0_state = 800 musb->ep0_state =
794 MUSB_EP0_STAGE_STATUSIN; 801 MUSB_EP0_STAGE_STATUSIN;
795 }
796 break; 802 break;
797 803
798 /* sequence #1 (IN to host), includes GET_STATUS 804 /* sequence #1 (IN to host), includes GET_STATUS
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index d54460a88173..78a209709260 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -843,7 +843,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
843 843
844static struct platform_device *otg_dev; 844static struct platform_device *otg_dev;
845 845
846static int otg_init(struct isp1301 *isp) 846static int isp1301_otg_init(struct isp1301 *isp)
847{ 847{
848 u32 l; 848 u32 l;
849 849
@@ -1275,7 +1275,7 @@ static int __exit isp1301_remove(struct i2c_client *i2c)
1275static int isp1301_otg_enable(struct isp1301 *isp) 1275static int isp1301_otg_enable(struct isp1301 *isp)
1276{ 1276{
1277 power_up(isp); 1277 power_up(isp);
1278 otg_init(isp); 1278 isp1301_otg_init(isp);
1279 1279
1280 /* NOTE: since we don't change this, this provides 1280 /* NOTE: since we don't change this, this provides
1281 * a few more interrupts than are strictly needed. 1281 * a few more interrupts than are strictly needed.
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index f99498fca99a..216f187582ab 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -44,6 +44,7 @@
44#include <linux/serial.h> 44#include <linux/serial.h>
45#include <linux/usb/serial.h> 45#include <linux/usb/serial.h>
46#include "ftdi_sio.h" 46#include "ftdi_sio.h"
47#include "ftdi_sio_ids.h"
47 48
48/* 49/*
49 * Version Information 50 * Version Information
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 4586a24fafb0..b0e0d64f822e 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -1,7 +1,10 @@
1/* 1/*
2 * Definitions for the FTDI USB Single Port Serial Converter - 2 * Driver definitions for the FTDI USB Single Port Serial Converter -
3 * known as FTDI_SIO (Serial Input/Output application of the chipset) 3 * known as FTDI_SIO (Serial Input/Output application of the chipset)
4 * 4 *
5 * For USB vendor/product IDs (VID/PID), please see ftdi_sio_ids.h
6 *
7 *
5 * The example I have is known as the USC-1000 which is available from 8 * The example I have is known as the USC-1000 which is available from
6 * http://www.dse.co.nz - cat no XH4214 It looks similar to this: 9 * http://www.dse.co.nz - cat no XH4214 It looks similar to this:
7 * http://www.dansdata.com/usbser.htm but I can't be sure There are other 10 * http://www.dansdata.com/usbser.htm but I can't be sure There are other
@@ -17,880 +20,7 @@
17 * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the 20 * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the
18 * FTDI_SIO implementation. 21 * FTDI_SIO implementation.
19 * 22 *
20 * Philipp Gühring - pg@futureware.at - added the Device ID of the USB relais
21 * from Rudolf Gugler
22 *
23 */
24
25#define FTDI_VID 0x0403 /* Vendor Id */
26#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */
27#define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */
28#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
29#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
30#define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */
31#define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */
32#define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */
33#define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */
34#define FTDI_NF_RIC_PID 0x0001 /* Product Id */
35#define FTDI_USBX_707_PID 0xF857 /* ADSTech IR Blaster USBX-707 */
36
37/* Larsen and Brusgaard AltiTrack/USBtrack */
38#define LARSENBRUSGAARD_VID 0x0FD8
39#define LB_ALTITRACK_PID 0x0001
40
41/* www.canusb.com Lawicel CANUSB device */
42#define FTDI_CANUSB_PID 0xFFA8 /* Product Id */
43
44/* AlphaMicro Components AMC-232USB01 device */
45#define FTDI_AMC232_PID 0xFF00 /* Product Id */
46
47/* www.candapter.com Ewert Energy Systems CANdapter device */
48#define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
49
50/* SCS HF Radio Modems PID's (http://www.scs-ptc.com) */
51/* the VID is the standard ftdi vid (FTDI_VID) */
52#define FTDI_SCS_DEVICE_0_PID 0xD010 /* SCS PTC-IIusb */
53#define FTDI_SCS_DEVICE_1_PID 0xD011 /* SCS Tracker / DSP TNC */
54#define FTDI_SCS_DEVICE_2_PID 0xD012
55#define FTDI_SCS_DEVICE_3_PID 0xD013
56#define FTDI_SCS_DEVICE_4_PID 0xD014
57#define FTDI_SCS_DEVICE_5_PID 0xD015
58#define FTDI_SCS_DEVICE_6_PID 0xD016
59#define FTDI_SCS_DEVICE_7_PID 0xD017
60
61/* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */
62#define FTDI_ACTZWAVE_PID 0xF2D0
63
64
65/* www.starting-point-systems.com µChameleon device */
66#define FTDI_MICRO_CHAMELEON_PID 0xCAA0 /* Product Id */
67
68/* www.irtrans.de device */
69#define FTDI_IRTRANS_PID 0xFC60 /* Product Id */
70
71
72/* www.thoughttechnology.com/ TT-USB provide with procomp use ftdi_sio */
73#define FTDI_TTUSB_PID 0xFF20 /* Product Id */
74
75/* iPlus device */
76#define FTDI_IPLUS_PID 0xD070 /* Product Id */
77#define FTDI_IPLUS2_PID 0xD071 /* Product Id */
78
79/* DMX4ALL DMX Interfaces */
80#define FTDI_DMX4ALL 0xC850
81
82/* OpenDCC (www.opendcc.de) product id */
83#define FTDI_OPENDCC_PID 0xBFD8
84#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9
85#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
86#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
87
88/* Sprog II (Andrew Crosland's SprogII DCC interface) */
89#define FTDI_SPROG_II 0xF0C8
90
91/* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */
92/* they use the ftdi chipset for the USB interface and the vendor id is the same */
93#define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */
94#define FTDI_XF_634_PID 0xFC09 /* 634: 20x4 Character Display */
95#define FTDI_XF_547_PID 0xFC0A /* 547: Two line Display */
96#define FTDI_XF_633_PID 0xFC0B /* 633: 16x2 Character Display with Keys */
97#define FTDI_XF_631_PID 0xFC0C /* 631: 20x2 Character Display */
98#define FTDI_XF_635_PID 0xFC0D /* 635: 20x4 Character Display */
99#define FTDI_XF_640_PID 0xFC0E /* 640: Two line Display */
100#define FTDI_XF_642_PID 0xFC0F /* 642: Two line Display */
101
102/* Video Networks Limited / Homechoice in the UK use an ftdi-based device for their 1Mb */
103/* broadband internet service. The following PID is exhibited by the usb device supplied */
104/* (the VID is the standard ftdi vid (FTDI_VID) */
105#define FTDI_VNHCPCUSB_D_PID 0xfe38 /* Product Id */
106
107/*
108 * PCDJ use ftdi based dj-controllers. The following PID is for their DAC-2 device
109 * http://www.pcdjhardware.com/DAC2.asp (PID sent by Wouter Paesen)
110 * (the VID is the standard ftdi vid (FTDI_VID) */
111#define FTDI_PCDJ_DAC2_PID 0xFA88
112
113/*
114 * The following are the values for the Matrix Orbital LCD displays,
115 * which are the FT232BM ( similar to the 8U232AM )
116 */
117#define FTDI_MTXORB_0_PID 0xFA00 /* Matrix Orbital Product Id */
118#define FTDI_MTXORB_1_PID 0xFA01 /* Matrix Orbital Product Id */
119#define FTDI_MTXORB_2_PID 0xFA02 /* Matrix Orbital Product Id */
120#define FTDI_MTXORB_3_PID 0xFA03 /* Matrix Orbital Product Id */
121#define FTDI_MTXORB_4_PID 0xFA04 /* Matrix Orbital Product Id */
122#define FTDI_MTXORB_5_PID 0xFA05 /* Matrix Orbital Product Id */
123#define FTDI_MTXORB_6_PID 0xFA06 /* Matrix Orbital Product Id */
124
125/* OOCDlink by Joern Kaipf <joernk@web.de>
126 * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */
127#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */
128
129/*
130 * The following are the values for the Matrix Orbital FTDI Range
131 * Anything in this range will use an FT232RL.
132 */
133#define MTXORB_VID 0x1B3D
134#define MTXORB_FTDI_RANGE_0100_PID 0x0100
135#define MTXORB_FTDI_RANGE_0101_PID 0x0101
136#define MTXORB_FTDI_RANGE_0102_PID 0x0102
137#define MTXORB_FTDI_RANGE_0103_PID 0x0103
138#define MTXORB_FTDI_RANGE_0104_PID 0x0104
139#define MTXORB_FTDI_RANGE_0105_PID 0x0105
140#define MTXORB_FTDI_RANGE_0106_PID 0x0106
141#define MTXORB_FTDI_RANGE_0107_PID 0x0107
142#define MTXORB_FTDI_RANGE_0108_PID 0x0108
143#define MTXORB_FTDI_RANGE_0109_PID 0x0109
144#define MTXORB_FTDI_RANGE_010A_PID 0x010A
145#define MTXORB_FTDI_RANGE_010B_PID 0x010B
146#define MTXORB_FTDI_RANGE_010C_PID 0x010C
147#define MTXORB_FTDI_RANGE_010D_PID 0x010D
148#define MTXORB_FTDI_RANGE_010E_PID 0x010E
149#define MTXORB_FTDI_RANGE_010F_PID 0x010F
150#define MTXORB_FTDI_RANGE_0110_PID 0x0110
151#define MTXORB_FTDI_RANGE_0111_PID 0x0111
152#define MTXORB_FTDI_RANGE_0112_PID 0x0112
153#define MTXORB_FTDI_RANGE_0113_PID 0x0113
154#define MTXORB_FTDI_RANGE_0114_PID 0x0114
155#define MTXORB_FTDI_RANGE_0115_PID 0x0115
156#define MTXORB_FTDI_RANGE_0116_PID 0x0116
157#define MTXORB_FTDI_RANGE_0117_PID 0x0117
158#define MTXORB_FTDI_RANGE_0118_PID 0x0118
159#define MTXORB_FTDI_RANGE_0119_PID 0x0119
160#define MTXORB_FTDI_RANGE_011A_PID 0x011A
161#define MTXORB_FTDI_RANGE_011B_PID 0x011B
162#define MTXORB_FTDI_RANGE_011C_PID 0x011C
163#define MTXORB_FTDI_RANGE_011D_PID 0x011D
164#define MTXORB_FTDI_RANGE_011E_PID 0x011E
165#define MTXORB_FTDI_RANGE_011F_PID 0x011F
166#define MTXORB_FTDI_RANGE_0120_PID 0x0120
167#define MTXORB_FTDI_RANGE_0121_PID 0x0121
168#define MTXORB_FTDI_RANGE_0122_PID 0x0122
169#define MTXORB_FTDI_RANGE_0123_PID 0x0123
170#define MTXORB_FTDI_RANGE_0124_PID 0x0124
171#define MTXORB_FTDI_RANGE_0125_PID 0x0125
172#define MTXORB_FTDI_RANGE_0126_PID 0x0126
173#define MTXORB_FTDI_RANGE_0127_PID 0x0127
174#define MTXORB_FTDI_RANGE_0128_PID 0x0128
175#define MTXORB_FTDI_RANGE_0129_PID 0x0129
176#define MTXORB_FTDI_RANGE_012A_PID 0x012A
177#define MTXORB_FTDI_RANGE_012B_PID 0x012B
178#define MTXORB_FTDI_RANGE_012C_PID 0x012C
179#define MTXORB_FTDI_RANGE_012D_PID 0x012D
180#define MTXORB_FTDI_RANGE_012E_PID 0x012E
181#define MTXORB_FTDI_RANGE_012F_PID 0x012F
182#define MTXORB_FTDI_RANGE_0130_PID 0x0130
183#define MTXORB_FTDI_RANGE_0131_PID 0x0131
184#define MTXORB_FTDI_RANGE_0132_PID 0x0132
185#define MTXORB_FTDI_RANGE_0133_PID 0x0133
186#define MTXORB_FTDI_RANGE_0134_PID 0x0134
187#define MTXORB_FTDI_RANGE_0135_PID 0x0135
188#define MTXORB_FTDI_RANGE_0136_PID 0x0136
189#define MTXORB_FTDI_RANGE_0137_PID 0x0137
190#define MTXORB_FTDI_RANGE_0138_PID 0x0138
191#define MTXORB_FTDI_RANGE_0139_PID 0x0139
192#define MTXORB_FTDI_RANGE_013A_PID 0x013A
193#define MTXORB_FTDI_RANGE_013B_PID 0x013B
194#define MTXORB_FTDI_RANGE_013C_PID 0x013C
195#define MTXORB_FTDI_RANGE_013D_PID 0x013D
196#define MTXORB_FTDI_RANGE_013E_PID 0x013E
197#define MTXORB_FTDI_RANGE_013F_PID 0x013F
198#define MTXORB_FTDI_RANGE_0140_PID 0x0140
199#define MTXORB_FTDI_RANGE_0141_PID 0x0141
200#define MTXORB_FTDI_RANGE_0142_PID 0x0142
201#define MTXORB_FTDI_RANGE_0143_PID 0x0143
202#define MTXORB_FTDI_RANGE_0144_PID 0x0144
203#define MTXORB_FTDI_RANGE_0145_PID 0x0145
204#define MTXORB_FTDI_RANGE_0146_PID 0x0146
205#define MTXORB_FTDI_RANGE_0147_PID 0x0147
206#define MTXORB_FTDI_RANGE_0148_PID 0x0148
207#define MTXORB_FTDI_RANGE_0149_PID 0x0149
208#define MTXORB_FTDI_RANGE_014A_PID 0x014A
209#define MTXORB_FTDI_RANGE_014B_PID 0x014B
210#define MTXORB_FTDI_RANGE_014C_PID 0x014C
211#define MTXORB_FTDI_RANGE_014D_PID 0x014D
212#define MTXORB_FTDI_RANGE_014E_PID 0x014E
213#define MTXORB_FTDI_RANGE_014F_PID 0x014F
214#define MTXORB_FTDI_RANGE_0150_PID 0x0150
215#define MTXORB_FTDI_RANGE_0151_PID 0x0151
216#define MTXORB_FTDI_RANGE_0152_PID 0x0152
217#define MTXORB_FTDI_RANGE_0153_PID 0x0153
218#define MTXORB_FTDI_RANGE_0154_PID 0x0154
219#define MTXORB_FTDI_RANGE_0155_PID 0x0155
220#define MTXORB_FTDI_RANGE_0156_PID 0x0156
221#define MTXORB_FTDI_RANGE_0157_PID 0x0157
222#define MTXORB_FTDI_RANGE_0158_PID 0x0158
223#define MTXORB_FTDI_RANGE_0159_PID 0x0159
224#define MTXORB_FTDI_RANGE_015A_PID 0x015A
225#define MTXORB_FTDI_RANGE_015B_PID 0x015B
226#define MTXORB_FTDI_RANGE_015C_PID 0x015C
227#define MTXORB_FTDI_RANGE_015D_PID 0x015D
228#define MTXORB_FTDI_RANGE_015E_PID 0x015E
229#define MTXORB_FTDI_RANGE_015F_PID 0x015F
230#define MTXORB_FTDI_RANGE_0160_PID 0x0160
231#define MTXORB_FTDI_RANGE_0161_PID 0x0161
232#define MTXORB_FTDI_RANGE_0162_PID 0x0162
233#define MTXORB_FTDI_RANGE_0163_PID 0x0163
234#define MTXORB_FTDI_RANGE_0164_PID 0x0164
235#define MTXORB_FTDI_RANGE_0165_PID 0x0165
236#define MTXORB_FTDI_RANGE_0166_PID 0x0166
237#define MTXORB_FTDI_RANGE_0167_PID 0x0167
238#define MTXORB_FTDI_RANGE_0168_PID 0x0168
239#define MTXORB_FTDI_RANGE_0169_PID 0x0169
240#define MTXORB_FTDI_RANGE_016A_PID 0x016A
241#define MTXORB_FTDI_RANGE_016B_PID 0x016B
242#define MTXORB_FTDI_RANGE_016C_PID 0x016C
243#define MTXORB_FTDI_RANGE_016D_PID 0x016D
244#define MTXORB_FTDI_RANGE_016E_PID 0x016E
245#define MTXORB_FTDI_RANGE_016F_PID 0x016F
246#define MTXORB_FTDI_RANGE_0170_PID 0x0170
247#define MTXORB_FTDI_RANGE_0171_PID 0x0171
248#define MTXORB_FTDI_RANGE_0172_PID 0x0172
249#define MTXORB_FTDI_RANGE_0173_PID 0x0173
250#define MTXORB_FTDI_RANGE_0174_PID 0x0174
251#define MTXORB_FTDI_RANGE_0175_PID 0x0175
252#define MTXORB_FTDI_RANGE_0176_PID 0x0176
253#define MTXORB_FTDI_RANGE_0177_PID 0x0177
254#define MTXORB_FTDI_RANGE_0178_PID 0x0178
255#define MTXORB_FTDI_RANGE_0179_PID 0x0179
256#define MTXORB_FTDI_RANGE_017A_PID 0x017A
257#define MTXORB_FTDI_RANGE_017B_PID 0x017B
258#define MTXORB_FTDI_RANGE_017C_PID 0x017C
259#define MTXORB_FTDI_RANGE_017D_PID 0x017D
260#define MTXORB_FTDI_RANGE_017E_PID 0x017E
261#define MTXORB_FTDI_RANGE_017F_PID 0x017F
262#define MTXORB_FTDI_RANGE_0180_PID 0x0180
263#define MTXORB_FTDI_RANGE_0181_PID 0x0181
264#define MTXORB_FTDI_RANGE_0182_PID 0x0182
265#define MTXORB_FTDI_RANGE_0183_PID 0x0183
266#define MTXORB_FTDI_RANGE_0184_PID 0x0184
267#define MTXORB_FTDI_RANGE_0185_PID 0x0185
268#define MTXORB_FTDI_RANGE_0186_PID 0x0186
269#define MTXORB_FTDI_RANGE_0187_PID 0x0187
270#define MTXORB_FTDI_RANGE_0188_PID 0x0188
271#define MTXORB_FTDI_RANGE_0189_PID 0x0189
272#define MTXORB_FTDI_RANGE_018A_PID 0x018A
273#define MTXORB_FTDI_RANGE_018B_PID 0x018B
274#define MTXORB_FTDI_RANGE_018C_PID 0x018C
275#define MTXORB_FTDI_RANGE_018D_PID 0x018D
276#define MTXORB_FTDI_RANGE_018E_PID 0x018E
277#define MTXORB_FTDI_RANGE_018F_PID 0x018F
278#define MTXORB_FTDI_RANGE_0190_PID 0x0190
279#define MTXORB_FTDI_RANGE_0191_PID 0x0191
280#define MTXORB_FTDI_RANGE_0192_PID 0x0192
281#define MTXORB_FTDI_RANGE_0193_PID 0x0193
282#define MTXORB_FTDI_RANGE_0194_PID 0x0194
283#define MTXORB_FTDI_RANGE_0195_PID 0x0195
284#define MTXORB_FTDI_RANGE_0196_PID 0x0196
285#define MTXORB_FTDI_RANGE_0197_PID 0x0197
286#define MTXORB_FTDI_RANGE_0198_PID 0x0198
287#define MTXORB_FTDI_RANGE_0199_PID 0x0199
288#define MTXORB_FTDI_RANGE_019A_PID 0x019A
289#define MTXORB_FTDI_RANGE_019B_PID 0x019B
290#define MTXORB_FTDI_RANGE_019C_PID 0x019C
291#define MTXORB_FTDI_RANGE_019D_PID 0x019D
292#define MTXORB_FTDI_RANGE_019E_PID 0x019E
293#define MTXORB_FTDI_RANGE_019F_PID 0x019F
294#define MTXORB_FTDI_RANGE_01A0_PID 0x01A0
295#define MTXORB_FTDI_RANGE_01A1_PID 0x01A1
296#define MTXORB_FTDI_RANGE_01A2_PID 0x01A2
297#define MTXORB_FTDI_RANGE_01A3_PID 0x01A3
298#define MTXORB_FTDI_RANGE_01A4_PID 0x01A4
299#define MTXORB_FTDI_RANGE_01A5_PID 0x01A5
300#define MTXORB_FTDI_RANGE_01A6_PID 0x01A6
301#define MTXORB_FTDI_RANGE_01A7_PID 0x01A7
302#define MTXORB_FTDI_RANGE_01A8_PID 0x01A8
303#define MTXORB_FTDI_RANGE_01A9_PID 0x01A9
304#define MTXORB_FTDI_RANGE_01AA_PID 0x01AA
305#define MTXORB_FTDI_RANGE_01AB_PID 0x01AB
306#define MTXORB_FTDI_RANGE_01AC_PID 0x01AC
307#define MTXORB_FTDI_RANGE_01AD_PID 0x01AD
308#define MTXORB_FTDI_RANGE_01AE_PID 0x01AE
309#define MTXORB_FTDI_RANGE_01AF_PID 0x01AF
310#define MTXORB_FTDI_RANGE_01B0_PID 0x01B0
311#define MTXORB_FTDI_RANGE_01B1_PID 0x01B1
312#define MTXORB_FTDI_RANGE_01B2_PID 0x01B2
313#define MTXORB_FTDI_RANGE_01B3_PID 0x01B3
314#define MTXORB_FTDI_RANGE_01B4_PID 0x01B4
315#define MTXORB_FTDI_RANGE_01B5_PID 0x01B5
316#define MTXORB_FTDI_RANGE_01B6_PID 0x01B6
317#define MTXORB_FTDI_RANGE_01B7_PID 0x01B7
318#define MTXORB_FTDI_RANGE_01B8_PID 0x01B8
319#define MTXORB_FTDI_RANGE_01B9_PID 0x01B9
320#define MTXORB_FTDI_RANGE_01BA_PID 0x01BA
321#define MTXORB_FTDI_RANGE_01BB_PID 0x01BB
322#define MTXORB_FTDI_RANGE_01BC_PID 0x01BC
323#define MTXORB_FTDI_RANGE_01BD_PID 0x01BD
324#define MTXORB_FTDI_RANGE_01BE_PID 0x01BE
325#define MTXORB_FTDI_RANGE_01BF_PID 0x01BF
326#define MTXORB_FTDI_RANGE_01C0_PID 0x01C0
327#define MTXORB_FTDI_RANGE_01C1_PID 0x01C1
328#define MTXORB_FTDI_RANGE_01C2_PID 0x01C2
329#define MTXORB_FTDI_RANGE_01C3_PID 0x01C3
330#define MTXORB_FTDI_RANGE_01C4_PID 0x01C4
331#define MTXORB_FTDI_RANGE_01C5_PID 0x01C5
332#define MTXORB_FTDI_RANGE_01C6_PID 0x01C6
333#define MTXORB_FTDI_RANGE_01C7_PID 0x01C7
334#define MTXORB_FTDI_RANGE_01C8_PID 0x01C8
335#define MTXORB_FTDI_RANGE_01C9_PID 0x01C9
336#define MTXORB_FTDI_RANGE_01CA_PID 0x01CA
337#define MTXORB_FTDI_RANGE_01CB_PID 0x01CB
338#define MTXORB_FTDI_RANGE_01CC_PID 0x01CC
339#define MTXORB_FTDI_RANGE_01CD_PID 0x01CD
340#define MTXORB_FTDI_RANGE_01CE_PID 0x01CE
341#define MTXORB_FTDI_RANGE_01CF_PID 0x01CF
342#define MTXORB_FTDI_RANGE_01D0_PID 0x01D0
343#define MTXORB_FTDI_RANGE_01D1_PID 0x01D1
344#define MTXORB_FTDI_RANGE_01D2_PID 0x01D2
345#define MTXORB_FTDI_RANGE_01D3_PID 0x01D3
346#define MTXORB_FTDI_RANGE_01D4_PID 0x01D4
347#define MTXORB_FTDI_RANGE_01D5_PID 0x01D5
348#define MTXORB_FTDI_RANGE_01D6_PID 0x01D6
349#define MTXORB_FTDI_RANGE_01D7_PID 0x01D7
350#define MTXORB_FTDI_RANGE_01D8_PID 0x01D8
351#define MTXORB_FTDI_RANGE_01D9_PID 0x01D9
352#define MTXORB_FTDI_RANGE_01DA_PID 0x01DA
353#define MTXORB_FTDI_RANGE_01DB_PID 0x01DB
354#define MTXORB_FTDI_RANGE_01DC_PID 0x01DC
355#define MTXORB_FTDI_RANGE_01DD_PID 0x01DD
356#define MTXORB_FTDI_RANGE_01DE_PID 0x01DE
357#define MTXORB_FTDI_RANGE_01DF_PID 0x01DF
358#define MTXORB_FTDI_RANGE_01E0_PID 0x01E0
359#define MTXORB_FTDI_RANGE_01E1_PID 0x01E1
360#define MTXORB_FTDI_RANGE_01E2_PID 0x01E2
361#define MTXORB_FTDI_RANGE_01E3_PID 0x01E3
362#define MTXORB_FTDI_RANGE_01E4_PID 0x01E4
363#define MTXORB_FTDI_RANGE_01E5_PID 0x01E5
364#define MTXORB_FTDI_RANGE_01E6_PID 0x01E6
365#define MTXORB_FTDI_RANGE_01E7_PID 0x01E7
366#define MTXORB_FTDI_RANGE_01E8_PID 0x01E8
367#define MTXORB_FTDI_RANGE_01E9_PID 0x01E9
368#define MTXORB_FTDI_RANGE_01EA_PID 0x01EA
369#define MTXORB_FTDI_RANGE_01EB_PID 0x01EB
370#define MTXORB_FTDI_RANGE_01EC_PID 0x01EC
371#define MTXORB_FTDI_RANGE_01ED_PID 0x01ED
372#define MTXORB_FTDI_RANGE_01EE_PID 0x01EE
373#define MTXORB_FTDI_RANGE_01EF_PID 0x01EF
374#define MTXORB_FTDI_RANGE_01F0_PID 0x01F0
375#define MTXORB_FTDI_RANGE_01F1_PID 0x01F1
376#define MTXORB_FTDI_RANGE_01F2_PID 0x01F2
377#define MTXORB_FTDI_RANGE_01F3_PID 0x01F3
378#define MTXORB_FTDI_RANGE_01F4_PID 0x01F4
379#define MTXORB_FTDI_RANGE_01F5_PID 0x01F5
380#define MTXORB_FTDI_RANGE_01F6_PID 0x01F6
381#define MTXORB_FTDI_RANGE_01F7_PID 0x01F7
382#define MTXORB_FTDI_RANGE_01F8_PID 0x01F8
383#define MTXORB_FTDI_RANGE_01F9_PID 0x01F9
384#define MTXORB_FTDI_RANGE_01FA_PID 0x01FA
385#define MTXORB_FTDI_RANGE_01FB_PID 0x01FB
386#define MTXORB_FTDI_RANGE_01FC_PID 0x01FC
387#define MTXORB_FTDI_RANGE_01FD_PID 0x01FD
388#define MTXORB_FTDI_RANGE_01FE_PID 0x01FE
389#define MTXORB_FTDI_RANGE_01FF_PID 0x01FF
390
391
392
393/* Interbiometrics USB I/O Board */
394/* Developed for Interbiometrics by Rudolf Gugler */
395#define INTERBIOMETRICS_VID 0x1209
396#define INTERBIOMETRICS_IOBOARD_PID 0x1002
397#define INTERBIOMETRICS_MINI_IOBOARD_PID 0x1006
398
399/*
400 * The following are the values for the Perle Systems
401 * UltraPort USB serial converters
402 */
403#define FTDI_PERLE_ULTRAPORT_PID 0xF0C0 /* Perle UltraPort Product Id */
404
405/*
406 * The following are the values for the Sealevel SeaLINK+ adapters.
407 * (Original list sent by Tuan Hoang. Ian Abbott renamed the macros and
408 * removed some PIDs that don't seem to match any existing products.)
409 */
410#define SEALEVEL_VID 0x0c52 /* Sealevel Vendor ID */
411#define SEALEVEL_2101_PID 0x2101 /* SeaLINK+232 (2101/2105) */
412#define SEALEVEL_2102_PID 0x2102 /* SeaLINK+485 (2102) */
413#define SEALEVEL_2103_PID 0x2103 /* SeaLINK+232I (2103) */
414#define SEALEVEL_2104_PID 0x2104 /* SeaLINK+485I (2104) */
415#define SEALEVEL_2106_PID 0x9020 /* SeaLINK+422 (2106) */
416#define SEALEVEL_2201_1_PID 0x2211 /* SeaPORT+2/232 (2201) Port 1 */
417#define SEALEVEL_2201_2_PID 0x2221 /* SeaPORT+2/232 (2201) Port 2 */
418#define SEALEVEL_2202_1_PID 0x2212 /* SeaPORT+2/485 (2202) Port 1 */
419#define SEALEVEL_2202_2_PID 0x2222 /* SeaPORT+2/485 (2202) Port 2 */
420#define SEALEVEL_2203_1_PID 0x2213 /* SeaPORT+2 (2203) Port 1 */
421#define SEALEVEL_2203_2_PID 0x2223 /* SeaPORT+2 (2203) Port 2 */
422#define SEALEVEL_2401_1_PID 0x2411 /* SeaPORT+4/232 (2401) Port 1 */
423#define SEALEVEL_2401_2_PID 0x2421 /* SeaPORT+4/232 (2401) Port 2 */
424#define SEALEVEL_2401_3_PID 0x2431 /* SeaPORT+4/232 (2401) Port 3 */
425#define SEALEVEL_2401_4_PID 0x2441 /* SeaPORT+4/232 (2401) Port 4 */
426#define SEALEVEL_2402_1_PID 0x2412 /* SeaPORT+4/485 (2402) Port 1 */
427#define SEALEVEL_2402_2_PID 0x2422 /* SeaPORT+4/485 (2402) Port 2 */
428#define SEALEVEL_2402_3_PID 0x2432 /* SeaPORT+4/485 (2402) Port 3 */
429#define SEALEVEL_2402_4_PID 0x2442 /* SeaPORT+4/485 (2402) Port 4 */
430#define SEALEVEL_2403_1_PID 0x2413 /* SeaPORT+4 (2403) Port 1 */
431#define SEALEVEL_2403_2_PID 0x2423 /* SeaPORT+4 (2403) Port 2 */
432#define SEALEVEL_2403_3_PID 0x2433 /* SeaPORT+4 (2403) Port 3 */
433#define SEALEVEL_2403_4_PID 0x2443 /* SeaPORT+4 (2403) Port 4 */
434#define SEALEVEL_2801_1_PID 0X2811 /* SeaLINK+8/232 (2801) Port 1 */
435#define SEALEVEL_2801_2_PID 0X2821 /* SeaLINK+8/232 (2801) Port 2 */
436#define SEALEVEL_2801_3_PID 0X2831 /* SeaLINK+8/232 (2801) Port 3 */
437#define SEALEVEL_2801_4_PID 0X2841 /* SeaLINK+8/232 (2801) Port 4 */
438#define SEALEVEL_2801_5_PID 0X2851 /* SeaLINK+8/232 (2801) Port 5 */
439#define SEALEVEL_2801_6_PID 0X2861 /* SeaLINK+8/232 (2801) Port 6 */
440#define SEALEVEL_2801_7_PID 0X2871 /* SeaLINK+8/232 (2801) Port 7 */
441#define SEALEVEL_2801_8_PID 0X2881 /* SeaLINK+8/232 (2801) Port 8 */
442#define SEALEVEL_2802_1_PID 0X2812 /* SeaLINK+8/485 (2802) Port 1 */
443#define SEALEVEL_2802_2_PID 0X2822 /* SeaLINK+8/485 (2802) Port 2 */
444#define SEALEVEL_2802_3_PID 0X2832 /* SeaLINK+8/485 (2802) Port 3 */
445#define SEALEVEL_2802_4_PID 0X2842 /* SeaLINK+8/485 (2802) Port 4 */
446#define SEALEVEL_2802_5_PID 0X2852 /* SeaLINK+8/485 (2802) Port 5 */
447#define SEALEVEL_2802_6_PID 0X2862 /* SeaLINK+8/485 (2802) Port 6 */
448#define SEALEVEL_2802_7_PID 0X2872 /* SeaLINK+8/485 (2802) Port 7 */
449#define SEALEVEL_2802_8_PID 0X2882 /* SeaLINK+8/485 (2802) Port 8 */
450#define SEALEVEL_2803_1_PID 0X2813 /* SeaLINK+8 (2803) Port 1 */
451#define SEALEVEL_2803_2_PID 0X2823 /* SeaLINK+8 (2803) Port 2 */
452#define SEALEVEL_2803_3_PID 0X2833 /* SeaLINK+8 (2803) Port 3 */
453#define SEALEVEL_2803_4_PID 0X2843 /* SeaLINK+8 (2803) Port 4 */
454#define SEALEVEL_2803_5_PID 0X2853 /* SeaLINK+8 (2803) Port 5 */
455#define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */
456#define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */
457#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */
458
459/*
460 * The following are the values for two KOBIL chipcard terminals.
461 */
462#define KOBIL_VID 0x0d46 /* KOBIL Vendor ID */
463#define KOBIL_CONV_B1_PID 0x2020 /* KOBIL Konverter for B1 */
464#define KOBIL_CONV_KAAN_PID 0x2021 /* KOBIL_Konverter for KAAN */
465
466/*
467 * Icom ID-1 digital transceiver
468 */
469
470#define ICOM_ID1_VID 0x0C26
471#define ICOM_ID1_PID 0x0004
472
473/*
474 * ASK.fr devices
475 */
476#define FTDI_ASK_RDR400_PID 0xC991 /* ASK RDR 400 series card reader */
477
478/*
479 * FTDI USB UART chips used in construction projects from the
480 * Elektor Electronics magazine (http://elektor-electronics.co.uk)
481 */
482#define ELEKTOR_VID 0x0C7D
483#define ELEKTOR_FT323R_PID 0x0005 /* RFID-Reader, issue 09-2006 */
484
485/*
486 * DSS-20 Sync Station for Sony Ericsson P800
487 */
488#define FTDI_DSS20_PID 0xFC82
489
490/*
491 * Home Electronics (www.home-electro.com) USB gadgets
492 */
493#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR transceiver */
494
495/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */
496/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */
497#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */
498
499/* TNC-X USB-to-packet-radio adapter, versions prior to 3.0 (DLP module) */
500
501#define FTDI_TNC_X_PID 0xEBE0
502
503/*
504 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de).
505 * All of these devices use FTDI's vendor ID (0x0403).
506 *
507 * The previously included PID for the UO 100 module was incorrect.
508 * In fact, that PID was for ELV's UR 100 USB-RS232 converter (0xFB58).
509 *
510 * Armin Laeuger originally sent the PID for the UM 100 module.
511 */
512#define FTDI_R2000KU_TRUE_RNG 0xFB80 /* R2000KU TRUE RNG */
513#define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */
514#define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */
515#define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */
516#define FTDI_ELV_ALC8500_PID 0xF06E /* ALC 8500 Expert */
517/* Additional ELV PIDs that default to using the FTDI D2XX drivers on
518 * MS Windows, rather than the FTDI Virtual Com Port drivers.
519 * Maybe these will be easier to use with the libftdi/libusb user-space
520 * drivers, or possibly the Comedi drivers in some cases. */
521#define FTDI_ELV_CLI7000_PID 0xFB59 /* Computer-Light-Interface (CLI 7000) */
522#define FTDI_ELV_PPS7330_PID 0xFB5C /* Processor-Power-Supply (PPS 7330) */
523#define FTDI_ELV_TFM100_PID 0xFB5D /* Temperartur-Feuchte Messgeraet (TFM 100) */
524#define FTDI_ELV_UDF77_PID 0xFB5E /* USB DCF Funkurh (UDF 77) */
525#define FTDI_ELV_UIO88_PID 0xFB5F /* USB-I/O Interface (UIO 88) */
526#define FTDI_ELV_UAD8_PID 0xF068 /* USB-AD-Wandler (UAD 8) */
527#define FTDI_ELV_UDA7_PID 0xF069 /* USB-DA-Wandler (UDA 7) */
528#define FTDI_ELV_USI2_PID 0xF06A /* USB-Schrittmotoren-Interface (USI 2) */
529#define FTDI_ELV_T1100_PID 0xF06B /* Thermometer (T 1100) */
530#define FTDI_ELV_PCD200_PID 0xF06C /* PC-Datenlogger (PCD 200) */
531#define FTDI_ELV_ULA200_PID 0xF06D /* USB-LCD-Ansteuerung (ULA 200) */
532#define FTDI_ELV_FHZ1000PC_PID 0xF06F /* FHZ 1000 PC */
533#define FTDI_ELV_CSI8_PID 0xE0F0 /* Computer-Schalt-Interface (CSI 8) */
534#define FTDI_ELV_EM1000DL_PID 0xE0F1 /* PC-Datenlogger fuer Energiemonitor (EM 1000 DL) */
535#define FTDI_ELV_PCK100_PID 0xE0F2 /* PC-Kabeltester (PCK 100) */
536#define FTDI_ELV_RFP500_PID 0xE0F3 /* HF-Leistungsmesser (RFP 500) */
537#define FTDI_ELV_FS20SIG_PID 0xE0F4 /* Signalgeber (FS 20 SIG) */
538#define FTDI_ELV_WS300PC_PID 0xE0F6 /* PC-Wetterstation (WS 300 PC) */
539#define FTDI_ELV_FHZ1300PC_PID 0xE0E8 /* FHZ 1300 PC */
540#define FTDI_ELV_WS500_PID 0xE0E9 /* PC-Wetterstation (WS 500) */
541#define FTDI_ELV_HS485_PID 0xE0EA /* USB to RS-485 adapter */
542#define FTDI_ELV_EM1010PC_PID 0xE0EF /* Engery monitor EM 1010 PC */
543#define FTDI_PHI_FISCO_PID 0xE40B /* PHI Fisco USB to Serial cable */
544
545/*
546 * Definitions for ID TECH (www.idt-net.com) devices
547 */
548#define IDTECH_VID 0x0ACD /* ID TECH Vendor ID */
549#define IDTECH_IDT1221U_PID 0x0300 /* IDT1221U USB to RS-232 adapter */
550
551/*
552 * Definitions for Omnidirectional Control Technology, Inc. devices
553 */
554#define OCT_VID 0x0B39 /* OCT vendor ID */
555/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */
556/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */
557/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */
558#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
559
560/* an infrared receiver for user access control with IR tags */
561#define FTDI_PIEGROUP_PID 0xF208 /* Product Id */
562
563/*
564 * Definitions for Artemis astronomical USB based cameras
565 * Check it at http://www.artemisccd.co.uk/
566 */
567#define FTDI_ARTEMIS_PID 0xDF28 /* All Artemis Cameras */
568
569/*
570 * Definitions for ATIK Instruments astronomical USB based cameras
571 * Check it at http://www.atik-instruments.com/
572 */
573#define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Grayscale Camera */
574#define FTDI_ATIK_ATK16C_PID 0xDF32 /* ATIK ATK-16C Colour Camera */
575#define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Grayscale Camera */
576#define FTDI_ATIK_ATK16HRC_PID 0xDF33 /* ATIK ATK-16HRC Colour Camera */
577#define FTDI_ATIK_ATK16IC_PID 0xDF35 /* ATIK ATK-16IC Grayscale Camera */
578
579/*
580 * Protego product ids
581 */
582#define PROTEGO_SPECIAL_1 0xFC70 /* special/unknown device */
583#define PROTEGO_R2X0 0xFC71 /* R200-USB TRNG unit (R210, R220, and R230) */
584#define PROTEGO_SPECIAL_3 0xFC72 /* special/unknown device */
585#define PROTEGO_SPECIAL_4 0xFC73 /* special/unknown device */
586
587/*
588 * Gude Analog- und Digitalsysteme GmbH
589 */
590#define FTDI_GUDEADS_E808_PID 0xE808
591#define FTDI_GUDEADS_E809_PID 0xE809
592#define FTDI_GUDEADS_E80A_PID 0xE80A
593#define FTDI_GUDEADS_E80B_PID 0xE80B
594#define FTDI_GUDEADS_E80C_PID 0xE80C
595#define FTDI_GUDEADS_E80D_PID 0xE80D
596#define FTDI_GUDEADS_E80E_PID 0xE80E
597#define FTDI_GUDEADS_E80F_PID 0xE80F
598#define FTDI_GUDEADS_E888_PID 0xE888 /* Expert ISDN Control USB */
599#define FTDI_GUDEADS_E889_PID 0xE889 /* USB RS-232 OptoBridge */
600#define FTDI_GUDEADS_E88A_PID 0xE88A
601#define FTDI_GUDEADS_E88B_PID 0xE88B
602#define FTDI_GUDEADS_E88C_PID 0xE88C
603#define FTDI_GUDEADS_E88D_PID 0xE88D
604#define FTDI_GUDEADS_E88E_PID 0xE88E
605#define FTDI_GUDEADS_E88F_PID 0xE88F
606
607/*
608 * Linx Technologies product ids
609 */
610#define LINX_SDMUSBQSS_PID 0xF448 /* Linx SDM-USB-QS-S */
611#define LINX_MASTERDEVEL2_PID 0xF449 /* Linx Master Development 2.0 */
612#define LINX_FUTURE_0_PID 0xF44A /* Linx future device */
613#define LINX_FUTURE_1_PID 0xF44B /* Linx future device */
614#define LINX_FUTURE_2_PID 0xF44C /* Linx future device */
615
616/* CCS Inc. ICDU/ICDU40 product ID - the FT232BM is used in an in-circuit-debugger */
617/* unit for PIC16's/PIC18's */
618#define FTDI_CCSICDU20_0_PID 0xF9D0
619#define FTDI_CCSICDU40_1_PID 0xF9D1
620#define FTDI_CCSMACHX_2_PID 0xF9D2
621#define FTDI_CCSLOAD_N_GO_3_PID 0xF9D3
622#define FTDI_CCSICDU64_4_PID 0xF9D4
623#define FTDI_CCSPRIME8_5_PID 0xF9D5
624
625/* Inside Accesso contactless reader (http://www.insidefr.com) */
626#define INSIDE_ACCESSO 0xFAD0
627
628/*
629 * Intrepid Control Systems (http://www.intrepidcs.com/) ValueCAN and NeoVI
630 */
631#define INTREPID_VID 0x093C
632#define INTREPID_VALUECAN_PID 0x0601
633#define INTREPID_NEOVI_PID 0x0701
634
635/*
636 * Falcom Wireless Communications GmbH
637 */
638#define FALCOM_VID 0x0F94 /* Vendor Id */
639#define FALCOM_TWIST_PID 0x0001 /* Falcom Twist USB GPRS modem */
640#define FALCOM_SAMBA_PID 0x0005 /* Falcom Samba USB GPRS modem */
641
642/*
643 * SUUNTO product ids
644 */
645#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */
646
647/*
648 * Oceanic product ids
649 */
650#define FTDI_OCEANIC_PID 0xF460 /* Oceanic dive instrument */
651
652/*
653 * TTi (Thurlby Thandar Instruments)
654 */
655#define TTI_VID 0x103E /* Vendor Id */
656#define TTI_QL355P_PID 0x03E8 /* TTi QL355P power supply */
657
658/*
659 * Definitions for B&B Electronics products.
660 */
661#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
662#define BANDB_USOTL4_PID 0xAC01 /* USOTL4 Isolated RS-485 Converter */
663#define BANDB_USTL4_PID 0xAC02 /* USTL4 RS-485 Converter */
664#define BANDB_USO9ML2_PID 0xAC03 /* USO9ML2 Isolated RS-232 Converter */
665#define BANDB_USOPTL4_PID 0xAC11
666#define BANDB_USPTL4_PID 0xAC12
667#define BANDB_USO9ML2DR_2_PID 0xAC16
668#define BANDB_USO9ML2DR_PID 0xAC17
669#define BANDB_USOPTL4DR2_PID 0xAC18 /* USOPTL4R-2 2-port Isolated RS-232 Converter */
670#define BANDB_USOPTL4DR_PID 0xAC19
671#define BANDB_485USB9F_2W_PID 0xAC25
672#define BANDB_485USB9F_4W_PID 0xAC26
673#define BANDB_232USB9M_PID 0xAC27
674#define BANDB_485USBTB_2W_PID 0xAC33
675#define BANDB_485USBTB_4W_PID 0xAC34
676#define BANDB_TTL5USB9M_PID 0xAC49
677#define BANDB_TTL3USB9M_PID 0xAC50
678#define BANDB_ZZ_PROG1_USB_PID 0xBA02
679
680/*
681 * RM Michaelides CANview USB (http://www.rmcan.com)
682 * CAN fieldbus interface adapter, added by port GmbH www.port.de)
683 * Ian Abbott changed the macro names for consistency.
684 */
685#define FTDI_RM_CANVIEW_PID 0xfd60 /* Product Id */
686
687/*
688 * EVER Eco Pro UPS (http://www.ever.com.pl/)
689 */
690
691#define EVER_ECO_PRO_CDS 0xe520 /* RS-232 converter */
692
693/*
694 * 4N-GALAXY.DE PIDs for CAN-USB, USB-RS232, USB-RS422, USB-RS485,
695 * USB-TTY activ, USB-TTY passiv. Some PIDs are used by several devices
696 * and I'm not entirely sure which are used by which.
697 */
698#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
699#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
700
701/*
702 * Mobility Electronics products.
703 */
704#define MOBILITY_VID 0x1342
705#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */
706
707/*
708 * microHAM product IDs (http://www.microham.com).
709 * Submitted by Justin Burket (KL1RL) <zorton@jtan.com>
710 * and Mike Studer (K6EEP) <k6eep@hamsoftware.org>.
711 * Ian Abbott <abbotti@mev.co.uk> added a few more from the driver INF file.
712 */
713#define FTDI_MHAM_KW_PID 0xEEE8 /* USB-KW interface */
714#define FTDI_MHAM_YS_PID 0xEEE9 /* USB-YS interface */
715#define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */
716#define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */
717#define FTDI_MHAM_IC_PID 0xEEEC /* USB-IC interface */
718#define FTDI_MHAM_DB9_PID 0xEEED /* USB-DB9 interface */
719#define FTDI_MHAM_RS232_PID 0xEEEE /* USB-RS232 interface */
720#define FTDI_MHAM_Y9_PID 0xEEEF /* USB-Y9 interface */
721
722/*
723 * Active Robots product ids.
724 */
725#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */
726
727/*
728 * Xsens Technologies BV products (http://www.xsens.com).
729 */
730#define XSENS_CONVERTER_0_PID 0xD388
731#define XSENS_CONVERTER_1_PID 0xD389
732#define XSENS_CONVERTER_2_PID 0xD38A
733#define XSENS_CONVERTER_3_PID 0xD38B
734#define XSENS_CONVERTER_4_PID 0xD38C
735#define XSENS_CONVERTER_5_PID 0xD38D
736#define XSENS_CONVERTER_6_PID 0xD38E
737#define XSENS_CONVERTER_7_PID 0xD38F
738
739/*
740 * Teratronik product ids.
741 * Submitted by O. Wölfelschneider.
742 */
743#define FTDI_TERATRONIK_VCP_PID 0xEC88 /* Teratronik device (preferring VCP driver on windows) */
744#define FTDI_TERATRONIK_D2XX_PID 0xEC89 /* Teratronik device (preferring D2XX driver on windows) */
745
746/*
747 * Evolution Robotics products (http://www.evolution.com/).
748 * Submitted by Shawn M. Lavelle.
749 */
750#define EVOLUTION_VID 0xDEEE /* Vendor ID */
751#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
752#define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/
753#define EVO_HYBRID_PID 0x0302 /* Evolution robotics RCM4 PID (FT232BM)*/
754#define EVO_RCM4_PID 0x0303 /* Evolution robotics RCM4 PID */
755
756/* Pyramid Computer GmbH */
757#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */
758
759/*
760 * NDI (www.ndigital.com) product ids
761 */
762#define FTDI_NDI_HUC_PID 0xDA70 /* NDI Host USB Converter */
763#define FTDI_NDI_SPECTRA_SCU_PID 0xDA71 /* NDI Spectra SCU */
764#define FTDI_NDI_FUTURE_2_PID 0xDA72 /* NDI future device #2 */
765#define FTDI_NDI_FUTURE_3_PID 0xDA73 /* NDI future device #3 */
766#define FTDI_NDI_AURORA_SCU_PID 0xDA74 /* NDI Aurora SCU */
767
768/*
769 * Posiflex inc retail equipment (http://www.posiflex.com.tw)
770 */
771#define POSIFLEX_VID 0x0d3a /* Vendor ID */
772#define POSIFLEX_PP7000_PID 0x0300 /* PP-7000II thermal printer */
773
774/*
775 * Westrex International devices submitted by Cory Lee
776 */
777#define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */
778#define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */
779
780/*
781 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
782 */
783#define FTDI_RRCIRKITS_LOCOBUFFER_PID 0xc7d0 /* LocoBuffer USB */
784
785/*
786 * Eclo (http://www.eclo.pt/) product IDs.
787 * PID 0xEA90 submitted by Martin Grill.
788 */
789#define FTDI_ECLO_COM_1WIRE_PID 0xEA90 /* COM to 1-Wire USB adaptor */
790
791/*
792 * Papouch products (http://www.papouch.com/)
793 * Submitted by Folkert van Heusden
794 */
795
796#define PAPOUCH_VID 0x5050 /* Vendor ID */
797#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
798#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */
799
800/*
801 * ACG Identification Technologies GmbH products (http://www.acg.de/).
802 * Submitted by anton -at- goto10 -dot- org.
803 */ 23 */
804#define FTDI_ACG_HFDUAL_PID 0xDD20 /* HF Dual ISO Reader (RFID) */
805
806/*
807 * Yost Engineering, Inc. products (www.yostengineering.com).
808 * PID 0xE050 submitted by Aaron Prose.
809 */
810#define FTDI_YEI_SERVOCENTER31_PID 0xE050 /* YEI ServoCenter3.1 USB */
811
812/*
813 * ThorLabs USB motor drivers
814 */
815#define FTDI_THORLABS_PID 0xfaf0 /* ThorLabs USB motor drivers */
816
817/*
818 * Testo products (http://www.testo.com/)
819 * Submitted by Colin Leroy
820 */
821#define TESTO_VID 0x128D
822#define TESTO_USB_INTERFACE_PID 0x0001
823
824/*
825 * Gamma Scout (http://gamma-scout.com/). Submitted by rsc@runtux.com.
826 */
827#define FTDI_GAMMA_SCOUT_PID 0xD678 /* Gamma Scout online */
828
829/*
830 * Tactrix OpenPort (ECU) devices.
831 * OpenPort 1.3M submitted by Donour Sizemore.
832 * OpenPort 1.3S and 1.3U submitted by Ian Abbott.
833 */
834#define FTDI_TACTRIX_OPENPORT_13M_PID 0xCC48 /* OpenPort 1.3 Mitsubishi */
835#define FTDI_TACTRIX_OPENPORT_13S_PID 0xCC49 /* OpenPort 1.3 Subaru */
836#define FTDI_TACTRIX_OPENPORT_13U_PID 0xCC4A /* OpenPort 1.3 Universal */
837
838/*
839 * Telldus Technologies
840 */
841#define TELLDUS_VID 0x1781 /* Vendor ID */
842#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */
843
844/*
845 * IBS elektronik product ids
846 * Submitted by Thomas Schleusener
847 */
848#define FTDI_IBS_US485_PID 0xff38 /* IBS US485 (USB<-->RS422/485 interface) */
849#define FTDI_IBS_PICPRO_PID 0xff39 /* IBS PIC-Programmer */
850#define FTDI_IBS_PCMCIA_PID 0xff3a /* IBS Card reader for PCMCIA SRAM-cards */
851#define FTDI_IBS_PK1_PID 0xff3b /* IBS PK1 - Particel counter */
852#define FTDI_IBS_RS232MON_PID 0xff3c /* IBS RS232 - Monitor */
853#define FTDI_IBS_APP70_PID 0xff3d /* APP 70 (dust monitoring system) */
854#define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */
855#define FTDI_IBS_PROD_PID 0xff3f /* future device */
856
857/*
858 * MaxStream devices www.maxstream.net
859 */
860#define FTDI_MAXSTREAM_PID 0xEE18 /* Xbee PKG-U Module */
861
862/* Olimex */
863#define OLIMEX_VID 0x15BA
864#define OLIMEX_ARM_USB_OCD_PID 0x0003
865
866/* Luminary Micro Stellaris Boards, VID = FTDI_VID */
867/* FTDI 2332C Dual channel device, side A=245 FIFO (JTAG), Side B=RS232 UART */
868#define LMI_LM3S_DEVEL_BOARD_PID 0xbcd8
869#define LMI_LM3S_EVAL_BOARD_PID 0xbcd9
870
871/* www.elsterelectricity.com Elster Unicom III Optical Probe */
872#define FTDI_ELSTER_UNICOM_PID 0xE700 /* Product Id */
873
874/*
875 * The Mobility Lab (TML)
876 * Submitted by Pierre Castella
877 */
878#define TML_VID 0x1B91 /* Vendor ID */
879#define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */
880
881/* Propox devices */
882#define FTDI_PROPOX_JTAGCABLEII_PID 0xD738
883
884/* Rig Expert Ukraine devices */
885#define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */
886
887/* Domintell products http://www.domintell.com */
888#define FTDI_DOMINTELL_DGQG_PID 0xEF50 /* Master */
889#define FTDI_DOMINTELL_DUSB_PID 0xEF51 /* DUSB01 module */
890
891/* Alti-2 products http://www.alti-2.com */
892#define ALTI2_VID 0x1BC9
893#define ALTI2_N3_PID 0x6001 /* Neptune 3 */
894 24
895/* Commands */ 25/* Commands */
896#define FTDI_SIO_RESET 0 /* Reset the port */ 26#define FTDI_SIO_RESET 0 /* Reset the port */
@@ -910,86 +40,6 @@
910#define INTERFACE_C 3 40#define INTERFACE_C 3
911#define INTERFACE_D 4 41#define INTERFACE_D 4
912 42
913/*
914 * FIC / OpenMoko, Inc. http://wiki.openmoko.org/wiki/Neo1973_Debug_Board_v3
915 * Submitted by Harald Welte <laforge@openmoko.org>
916 */
917#define FIC_VID 0x1457
918#define FIC_NEO1973_DEBUG_PID 0x5118
919
920/*
921 * RATOC REX-USB60F
922 */
923#define RATOC_VENDOR_ID 0x0584
924#define RATOC_PRODUCT_ID_USB60F 0xb020
925
926/*
927 * DIEBOLD BCS SE923
928 */
929#define DIEBOLD_BCS_SE923_PID 0xfb99
930
931/*
932 * Atmel STK541
933 */
934#define ATMEL_VID 0x03eb /* Vendor ID */
935#define STK541_PID 0x2109 /* Zigbee Controller */
936
937/*
938 * Dresden Elektronic Sensor Terminal Board
939 */
940#define DE_VID 0x1cf1 /* Vendor ID */
941#define STB_PID 0x0001 /* Sensor Terminal Board */
942#define WHT_PID 0x0004 /* Wireless Handheld Terminal */
943
944/*
945 * Blackfin gnICE JTAG
946 * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice
947 */
948#define ADI_VID 0x0456
949#define ADI_GNICE_PID 0xF000
950#define ADI_GNICEPLUS_PID 0xF001
951
952/*
953 * JETI SPECTROMETER SPECBOS 1201
954 * http://www.jeti.com/products/sys/scb/scb1201.php
955 */
956#define JETI_VID 0x0c6c
957#define JETI_SPC1201_PID 0x04b2
958
959/*
960 * Marvell SheevaPlug
961 */
962#define MARVELL_VID 0x9e88
963#define MARVELL_SHEEVAPLUG_PID 0x9e8f
964
965#define FTDI_TURTELIZER_PID 0xBDC8 /* JTAG/RS-232 adapter by egnite GmBH */
966
967/*
968 * GN Otometrics (http://www.otometrics.com)
969 * Submitted by Ville Sundberg.
970 */
971#define GN_OTOMETRICS_VID 0x0c33 /* Vendor ID */
972#define AURICAL_USB_PID 0x0010 /* Aurical USB Audiometer */
973
974/*
975 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
976 * http://winglucofacts.com/cables/
977 */
978#define BAYER_VID 0x1A79
979#define BAYER_CONTOUR_CABLE_PID 0x6001
980
981/*
982 * Marvell OpenRD Base, Client
983 * http://www.open-rd.org
984 * OpenRD Base, Client use VID 0x0403
985 */
986#define MARVELL_OPENRD_PID 0x9e90
987
988/*
989 * Hameg HO820 and HO870 interface (using VID 0x0403)
990 */
991#define HAMEG_HO820_PID 0xed74
992#define HAMEG_HO870_PID 0xed71
993 43
994/* 44/*
995 * BmRequestType: 1100 0000b 45 * BmRequestType: 1100 0000b
@@ -1504,4 +554,3 @@ typedef enum {
1504 * B2..7 Length of message - (not including Byte 0) 554 * B2..7 Length of message - (not including Byte 0)
1505 * 555 *
1506 */ 556 */
1507
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
new file mode 100644
index 000000000000..da92b4952ffb
--- /dev/null
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -0,0 +1,986 @@
1/*
2 * vendor/product IDs (VID/PID) of devices using FTDI USB serial converters.
3 * Please keep numerically sorted within individual areas, thanks!
4 *
5 * Philipp Gühring - pg@futureware.at - added the Device ID of the USB relais
6 * from Rudolf Gugler
7 *
8 */
9
10
11/**********************************/
12/***** devices using FTDI VID *****/
13/**********************************/
14
15
16#define FTDI_VID 0x0403 /* Vendor Id */
17
18
19/*** "original" FTDI device PIDs ***/
20
21#define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */
22#define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
23#define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
24#define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */
25#define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */
26#define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */
27
28
29/*** third-party PIDs (using FTDI_VID) ***/
30
31/*
32 * Marvell OpenRD Base, Client
33 * http://www.open-rd.org
34 * OpenRD Base, Client use VID 0x0403
35 */
36#define MARVELL_OPENRD_PID 0x9e90
37
38/* www.candapter.com Ewert Energy Systems CANdapter device */
39#define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
40
41/* OOCDlink by Joern Kaipf <joernk@web.de>
42 * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */
43#define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */
44
45/* Luminary Micro Stellaris Boards, VID = FTDI_VID */
46/* FTDI 2332C Dual channel device, side A=245 FIFO (JTAG), Side B=RS232 UART */
47#define LMI_LM3S_DEVEL_BOARD_PID 0xbcd8
48#define LMI_LM3S_EVAL_BOARD_PID 0xbcd9
49
50#define FTDI_TURTELIZER_PID 0xBDC8 /* JTAG/RS-232 adapter by egnite GmBH */
51
52/* OpenDCC (www.opendcc.de) product id */
53#define FTDI_OPENDCC_PID 0xBFD8
54#define FTDI_OPENDCC_SNIFFER_PID 0xBFD9
55#define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
56#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
57
58/*
59 * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com)
60 */
61#define FTDI_RRCIRKITS_LOCOBUFFER_PID 0xc7d0 /* LocoBuffer USB */
62
63/* DMX4ALL DMX Interfaces */
64#define FTDI_DMX4ALL 0xC850
65
66/*
67 * ASK.fr devices
68 */
69#define FTDI_ASK_RDR400_PID 0xC991 /* ASK RDR 400 series card reader */
70
71/* www.starting-point-systems.com µChameleon device */
72#define FTDI_MICRO_CHAMELEON_PID 0xCAA0 /* Product Id */
73
74/*
75 * Tactrix OpenPort (ECU) devices.
76 * OpenPort 1.3M submitted by Donour Sizemore.
77 * OpenPort 1.3S and 1.3U submitted by Ian Abbott.
78 */
79#define FTDI_TACTRIX_OPENPORT_13M_PID 0xCC48 /* OpenPort 1.3 Mitsubishi */
80#define FTDI_TACTRIX_OPENPORT_13S_PID 0xCC49 /* OpenPort 1.3 Subaru */
81#define FTDI_TACTRIX_OPENPORT_13U_PID 0xCC4A /* OpenPort 1.3 Universal */
82
83/* SCS HF Radio Modems PID's (http://www.scs-ptc.com) */
84/* the VID is the standard ftdi vid (FTDI_VID) */
85#define FTDI_SCS_DEVICE_0_PID 0xD010 /* SCS PTC-IIusb */
86#define FTDI_SCS_DEVICE_1_PID 0xD011 /* SCS Tracker / DSP TNC */
87#define FTDI_SCS_DEVICE_2_PID 0xD012
88#define FTDI_SCS_DEVICE_3_PID 0xD013
89#define FTDI_SCS_DEVICE_4_PID 0xD014
90#define FTDI_SCS_DEVICE_5_PID 0xD015
91#define FTDI_SCS_DEVICE_6_PID 0xD016
92#define FTDI_SCS_DEVICE_7_PID 0xD017
93
94/* iPlus device */
95#define FTDI_IPLUS_PID 0xD070 /* Product Id */
96#define FTDI_IPLUS2_PID 0xD071 /* Product Id */
97
98/*
99 * Gamma Scout (http://gamma-scout.com/). Submitted by rsc@runtux.com.
100 */
101#define FTDI_GAMMA_SCOUT_PID 0xD678 /* Gamma Scout online */
102
103/* Propox devices */
104#define FTDI_PROPOX_JTAGCABLEII_PID 0xD738
105
106/*
107 * Xsens Technologies BV products (http://www.xsens.com).
108 */
109#define XSENS_CONVERTER_0_PID 0xD388
110#define XSENS_CONVERTER_1_PID 0xD389
111#define XSENS_CONVERTER_2_PID 0xD38A
112#define XSENS_CONVERTER_3_PID 0xD38B
113#define XSENS_CONVERTER_4_PID 0xD38C
114#define XSENS_CONVERTER_5_PID 0xD38D
115#define XSENS_CONVERTER_6_PID 0xD38E
116#define XSENS_CONVERTER_7_PID 0xD38F
117
118/*
119 * NDI (www.ndigital.com) product ids
120 */
121#define FTDI_NDI_HUC_PID 0xDA70 /* NDI Host USB Converter */
122#define FTDI_NDI_SPECTRA_SCU_PID 0xDA71 /* NDI Spectra SCU */
123#define FTDI_NDI_FUTURE_2_PID 0xDA72 /* NDI future device #2 */
124#define FTDI_NDI_FUTURE_3_PID 0xDA73 /* NDI future device #3 */
125#define FTDI_NDI_AURORA_SCU_PID 0xDA74 /* NDI Aurora SCU */
126
127/*
128 * Westrex International devices submitted by Cory Lee
129 */
130#define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */
131#define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */
132
133/*
134 * ACG Identification Technologies GmbH products (http://www.acg.de/).
135 * Submitted by anton -at- goto10 -dot- org.
136 */
137#define FTDI_ACG_HFDUAL_PID 0xDD20 /* HF Dual ISO Reader (RFID) */
138
139/*
140 * Definitions for Artemis astronomical USB based cameras
141 * Check it at http://www.artemisccd.co.uk/
142 */
143#define FTDI_ARTEMIS_PID 0xDF28 /* All Artemis Cameras */
144
145/*
146 * Definitions for ATIK Instruments astronomical USB based cameras
147 * Check it at http://www.atik-instruments.com/
148 */
149#define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Grayscale Camera */
150#define FTDI_ATIK_ATK16C_PID 0xDF32 /* ATIK ATK-16C Colour Camera */
151#define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Grayscale Camera */
152#define FTDI_ATIK_ATK16HRC_PID 0xDF33 /* ATIK ATK-16HRC Colour Camera */
153#define FTDI_ATIK_ATK16IC_PID 0xDF35 /* ATIK ATK-16IC Grayscale Camera */
154
155/*
156 * Yost Engineering, Inc. products (www.yostengineering.com).
157 * PID 0xE050 submitted by Aaron Prose.
158 */
159#define FTDI_YEI_SERVOCENTER31_PID 0xE050 /* YEI ServoCenter3.1 USB */
160
161/*
162 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de).
163 * All of these devices use FTDI's vendor ID (0x0403).
164 *
165 * The previously included PID for the UO 100 module was incorrect.
166 * In fact, that PID was for ELV's UR 100 USB-RS232 converter (0xFB58).
167 *
168 * Armin Laeuger originally sent the PID for the UM 100 module.
169 */
170#define FTDI_ELV_FHZ1300PC_PID 0xE0E8 /* FHZ 1300 PC */
171#define FTDI_ELV_WS500_PID 0xE0E9 /* PC-Wetterstation (WS 500) */
172#define FTDI_ELV_HS485_PID 0xE0EA /* USB to RS-485 adapter */
173#define FTDI_ELV_EM1010PC_PID 0xE0EF /* Engery monitor EM 1010 PC */
174#define FTDI_ELV_CSI8_PID 0xE0F0 /* Computer-Schalt-Interface (CSI 8) */
175#define FTDI_ELV_EM1000DL_PID 0xE0F1 /* PC-Datenlogger fuer Energiemonitor (EM 1000 DL) */
176#define FTDI_ELV_PCK100_PID 0xE0F2 /* PC-Kabeltester (PCK 100) */
177#define FTDI_ELV_RFP500_PID 0xE0F3 /* HF-Leistungsmesser (RFP 500) */
178#define FTDI_ELV_FS20SIG_PID 0xE0F4 /* Signalgeber (FS 20 SIG) */
179#define FTDI_ELV_WS300PC_PID 0xE0F6 /* PC-Wetterstation (WS 300 PC) */
180#define FTDI_PHI_FISCO_PID 0xE40B /* PHI Fisco USB to Serial cable */
181#define FTDI_ELV_UAD8_PID 0xF068 /* USB-AD-Wandler (UAD 8) */
182#define FTDI_ELV_UDA7_PID 0xF069 /* USB-DA-Wandler (UDA 7) */
183#define FTDI_ELV_USI2_PID 0xF06A /* USB-Schrittmotoren-Interface (USI 2) */
184#define FTDI_ELV_T1100_PID 0xF06B /* Thermometer (T 1100) */
185#define FTDI_ELV_PCD200_PID 0xF06C /* PC-Datenlogger (PCD 200) */
186#define FTDI_ELV_ULA200_PID 0xF06D /* USB-LCD-Ansteuerung (ULA 200) */
187#define FTDI_ELV_ALC8500_PID 0xF06E /* ALC 8500 Expert */
188#define FTDI_ELV_FHZ1000PC_PID 0xF06F /* FHZ 1000 PC */
189#define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */
190#define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */
191#define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */
192/* Additional ELV PIDs that default to using the FTDI D2XX drivers on
193 * MS Windows, rather than the FTDI Virtual Com Port drivers.
194 * Maybe these will be easier to use with the libftdi/libusb user-space
195 * drivers, or possibly the Comedi drivers in some cases. */
196#define FTDI_ELV_CLI7000_PID 0xFB59 /* Computer-Light-Interface (CLI 7000) */
197#define FTDI_ELV_PPS7330_PID 0xFB5C /* Processor-Power-Supply (PPS 7330) */
198#define FTDI_ELV_TFM100_PID 0xFB5D /* Temperartur-Feuchte Messgeraet (TFM 100) */
199#define FTDI_ELV_UDF77_PID 0xFB5E /* USB DCF Funkurh (UDF 77) */
200#define FTDI_ELV_UIO88_PID 0xFB5F /* USB-I/O Interface (UIO 88) */
201
202/*
203 * EVER Eco Pro UPS (http://www.ever.com.pl/)
204 */
205
206#define EVER_ECO_PRO_CDS 0xe520 /* RS-232 converter */
207
208/*
209 * Active Robots product ids.
210 */
211#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */
212
213/* Pyramid Computer GmbH */
214#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */
215
216/* www.elsterelectricity.com Elster Unicom III Optical Probe */
217#define FTDI_ELSTER_UNICOM_PID 0xE700 /* Product Id */
218
219/*
220 * Gude Analog- und Digitalsysteme GmbH
221 */
222#define FTDI_GUDEADS_E808_PID 0xE808
223#define FTDI_GUDEADS_E809_PID 0xE809
224#define FTDI_GUDEADS_E80A_PID 0xE80A
225#define FTDI_GUDEADS_E80B_PID 0xE80B
226#define FTDI_GUDEADS_E80C_PID 0xE80C
227#define FTDI_GUDEADS_E80D_PID 0xE80D
228#define FTDI_GUDEADS_E80E_PID 0xE80E
229#define FTDI_GUDEADS_E80F_PID 0xE80F
230#define FTDI_GUDEADS_E888_PID 0xE888 /* Expert ISDN Control USB */
231#define FTDI_GUDEADS_E889_PID 0xE889 /* USB RS-232 OptoBridge */
232#define FTDI_GUDEADS_E88A_PID 0xE88A
233#define FTDI_GUDEADS_E88B_PID 0xE88B
234#define FTDI_GUDEADS_E88C_PID 0xE88C
235#define FTDI_GUDEADS_E88D_PID 0xE88D
236#define FTDI_GUDEADS_E88E_PID 0xE88E
237#define FTDI_GUDEADS_E88F_PID 0xE88F
238
239/*
240 * Eclo (http://www.eclo.pt/) product IDs.
241 * PID 0xEA90 submitted by Martin Grill.
242 */
243#define FTDI_ECLO_COM_1WIRE_PID 0xEA90 /* COM to 1-Wire USB adaptor */
244
245/* TNC-X USB-to-packet-radio adapter, versions prior to 3.0 (DLP module) */
246#define FTDI_TNC_X_PID 0xEBE0
247
248/*
249 * Teratronik product ids.
250 * Submitted by O. Wölfelschneider.
251 */
252#define FTDI_TERATRONIK_VCP_PID 0xEC88 /* Teratronik device (preferring VCP driver on windows) */
253#define FTDI_TERATRONIK_D2XX_PID 0xEC89 /* Teratronik device (preferring D2XX driver on windows) */
254
255/* Rig Expert Ukraine devices */
256#define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */
257
258/*
259 * Hameg HO820 and HO870 interface (using VID 0x0403)
260 */
261#define HAMEG_HO820_PID 0xed74
262#define HAMEG_HO870_PID 0xed71
263
264/*
265 * MaxStream devices www.maxstream.net
266 */
267#define FTDI_MAXSTREAM_PID 0xEE18 /* Xbee PKG-U Module */
268
269/*
270 * microHAM product IDs (http://www.microham.com).
271 * Submitted by Justin Burket (KL1RL) <zorton@jtan.com>
272 * and Mike Studer (K6EEP) <k6eep@hamsoftware.org>.
273 * Ian Abbott <abbotti@mev.co.uk> added a few more from the driver INF file.
274 */
275#define FTDI_MHAM_KW_PID 0xEEE8 /* USB-KW interface */
276#define FTDI_MHAM_YS_PID 0xEEE9 /* USB-YS interface */
277#define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */
278#define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */
279#define FTDI_MHAM_IC_PID 0xEEEC /* USB-IC interface */
280#define FTDI_MHAM_DB9_PID 0xEEED /* USB-DB9 interface */
281#define FTDI_MHAM_RS232_PID 0xEEEE /* USB-RS232 interface */
282#define FTDI_MHAM_Y9_PID 0xEEEF /* USB-Y9 interface */
283
284/* Domintell products http://www.domintell.com */
285#define FTDI_DOMINTELL_DGQG_PID 0xEF50 /* Master */
286#define FTDI_DOMINTELL_DUSB_PID 0xEF51 /* DUSB01 module */
287
288/*
289 * The following are the values for the Perle Systems
290 * UltraPort USB serial converters
291 */
292#define FTDI_PERLE_ULTRAPORT_PID 0xF0C0 /* Perle UltraPort Product Id */
293
294/* Sprog II (Andrew Crosland's SprogII DCC interface) */
295#define FTDI_SPROG_II 0xF0C8
296
297/* an infrared receiver for user access control with IR tags */
298#define FTDI_PIEGROUP_PID 0xF208 /* Product Id */
299
300/* ACT Solutions HomePro ZWave interface
301 (http://www.act-solutions.com/HomePro.htm) */
302#define FTDI_ACTZWAVE_PID 0xF2D0
303
304/*
305 * 4N-GALAXY.DE PIDs for CAN-USB, USB-RS232, USB-RS422, USB-RS485,
306 * USB-TTY activ, USB-TTY passiv. Some PIDs are used by several devices
307 * and I'm not entirely sure which are used by which.
308 */
309#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
310#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
311
312/*
313 * Linx Technologies product ids
314 */
315#define LINX_SDMUSBQSS_PID 0xF448 /* Linx SDM-USB-QS-S */
316#define LINX_MASTERDEVEL2_PID 0xF449 /* Linx Master Development 2.0 */
317#define LINX_FUTURE_0_PID 0xF44A /* Linx future device */
318#define LINX_FUTURE_1_PID 0xF44B /* Linx future device */
319#define LINX_FUTURE_2_PID 0xF44C /* Linx future device */
320
321/*
322 * Oceanic product ids
323 */
324#define FTDI_OCEANIC_PID 0xF460 /* Oceanic dive instrument */
325
326/*
327 * SUUNTO product ids
328 */
329#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */
330
331/* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */
332/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */
333#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */
334
335/* CCS Inc. ICDU/ICDU40 product ID -
336 * the FT232BM is used in an in-circuit-debugger unit for PIC16's/PIC18's */
337#define FTDI_CCSICDU20_0_PID 0xF9D0
338#define FTDI_CCSICDU40_1_PID 0xF9D1
339#define FTDI_CCSMACHX_2_PID 0xF9D2
340#define FTDI_CCSLOAD_N_GO_3_PID 0xF9D3
341#define FTDI_CCSICDU64_4_PID 0xF9D4
342#define FTDI_CCSPRIME8_5_PID 0xF9D5
343
344/*
345 * The following are the values for the Matrix Orbital LCD displays,
346 * which are the FT232BM ( similar to the 8U232AM )
347 */
348#define FTDI_MTXORB_0_PID 0xFA00 /* Matrix Orbital Product Id */
349#define FTDI_MTXORB_1_PID 0xFA01 /* Matrix Orbital Product Id */
350#define FTDI_MTXORB_2_PID 0xFA02 /* Matrix Orbital Product Id */
351#define FTDI_MTXORB_3_PID 0xFA03 /* Matrix Orbital Product Id */
352#define FTDI_MTXORB_4_PID 0xFA04 /* Matrix Orbital Product Id */
353#define FTDI_MTXORB_5_PID 0xFA05 /* Matrix Orbital Product Id */
354#define FTDI_MTXORB_6_PID 0xFA06 /* Matrix Orbital Product Id */
355
356/*
357 * Home Electronics (www.home-electro.com) USB gadgets
358 */
359#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR transceiver */
360
361/* Inside Accesso contactless reader (http://www.insidefr.com) */
362#define INSIDE_ACCESSO 0xFAD0
363
364/*
365 * ThorLabs USB motor drivers
366 */
367#define FTDI_THORLABS_PID 0xfaf0 /* ThorLabs USB motor drivers */
368
369/*
370 * Protego product ids
371 */
372#define PROTEGO_SPECIAL_1 0xFC70 /* special/unknown device */
373#define PROTEGO_R2X0 0xFC71 /* R200-USB TRNG unit (R210, R220, and R230) */
374#define PROTEGO_SPECIAL_3 0xFC72 /* special/unknown device */
375#define PROTEGO_SPECIAL_4 0xFC73 /* special/unknown device */
376
377/*
378 * DSS-20 Sync Station for Sony Ericsson P800
379 */
380#define FTDI_DSS20_PID 0xFC82
381
382/* www.irtrans.de device */
383#define FTDI_IRTRANS_PID 0xFC60 /* Product Id */
384
385/*
386 * RM Michaelides CANview USB (http://www.rmcan.com) (FTDI_VID)
387 * CAN fieldbus interface adapter, added by port GmbH www.port.de)
388 * Ian Abbott changed the macro names for consistency.
389 */
390#define FTDI_RM_CANVIEW_PID 0xfd60 /* Product Id */
391/* www.thoughttechnology.com/ TT-USB provide with procomp use ftdi_sio */
392#define FTDI_TTUSB_PID 0xFF20 /* Product Id */
393
394#define FTDI_USBX_707_PID 0xF857 /* ADSTech IR Blaster USBX-707 (FTDI_VID) */
395
396#define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */
397
398/*
399 * PCDJ use ftdi based dj-controllers. The following PID is
400 * for their DAC-2 device http://www.pcdjhardware.com/DAC2.asp
401 * (the VID is the standard ftdi vid (FTDI_VID), PID sent by Wouter Paesen)
402 */
403#define FTDI_PCDJ_DAC2_PID 0xFA88
404
405#define FTDI_R2000KU_TRUE_RNG 0xFB80 /* R2000KU TRUE RNG (FTDI_VID) */
406
407/*
408 * DIEBOLD BCS SE923 (FTDI_VID)
409 */
410#define DIEBOLD_BCS_SE923_PID 0xfb99
411
412/* www.crystalfontz.com devices
413 * - thanx for providing free devices for evaluation !
414 * they use the ftdi chipset for the USB interface
415 * and the vendor id is the same
416 */
417#define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */
418#define FTDI_XF_634_PID 0xFC09 /* 634: 20x4 Character Display */
419#define FTDI_XF_547_PID 0xFC0A /* 547: Two line Display */
420#define FTDI_XF_633_PID 0xFC0B /* 633: 16x2 Character Display with Keys */
421#define FTDI_XF_631_PID 0xFC0C /* 631: 20x2 Character Display */
422#define FTDI_XF_635_PID 0xFC0D /* 635: 20x4 Character Display */
423#define FTDI_XF_640_PID 0xFC0E /* 640: Two line Display */
424#define FTDI_XF_642_PID 0xFC0F /* 642: Two line Display */
425
426/*
427 * Video Networks Limited / Homechoice in the UK use an ftdi-based device
428 * for their 1Mb broadband internet service. The following PID is exhibited
429 * by the usb device supplied (the VID is the standard ftdi vid (FTDI_VID)
430 */
431#define FTDI_VNHCPCUSB_D_PID 0xfe38 /* Product Id */
432
433/* AlphaMicro Components AMC-232USB01 device (FTDI_VID) */
434#define FTDI_AMC232_PID 0xFF00 /* Product Id */
435
436/*
437 * IBS elektronik product ids (FTDI_VID)
438 * Submitted by Thomas Schleusener
439 */
440#define FTDI_IBS_US485_PID 0xff38 /* IBS US485 (USB<-->RS422/485 interface) */
441#define FTDI_IBS_PICPRO_PID 0xff39 /* IBS PIC-Programmer */
442#define FTDI_IBS_PCMCIA_PID 0xff3a /* IBS Card reader for PCMCIA SRAM-cards */
443#define FTDI_IBS_PK1_PID 0xff3b /* IBS PK1 - Particel counter */
444#define FTDI_IBS_RS232MON_PID 0xff3c /* IBS RS232 - Monitor */
445#define FTDI_IBS_APP70_PID 0xff3d /* APP 70 (dust monitoring system) */
446#define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */
447#define FTDI_IBS_PROD_PID 0xff3f /* future device */
448/* www.canusb.com Lawicel CANUSB device (FTDI_VID) */
449#define FTDI_CANUSB_PID 0xFFA8 /* Product Id */
450
451
452
453/********************************/
454/** third-party VID/PID combos **/
455/********************************/
456
457
458
459/*
460 * Atmel STK541
461 */
462#define ATMEL_VID 0x03eb /* Vendor ID */
463#define STK541_PID 0x2109 /* Zigbee Controller */
464
465/*
466 * Blackfin gnICE JTAG
467 * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice
468 */
469#define ADI_VID 0x0456
470#define ADI_GNICE_PID 0xF000
471#define ADI_GNICEPLUS_PID 0xF001
472
473/*
474 * RATOC REX-USB60F
475 */
476#define RATOC_VENDOR_ID 0x0584
477#define RATOC_PRODUCT_ID_USB60F 0xb020
478
479/*
480 * Definitions for B&B Electronics products.
481 */
482#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
483#define BANDB_USOTL4_PID 0xAC01 /* USOTL4 Isolated RS-485 Converter */
484#define BANDB_USTL4_PID 0xAC02 /* USTL4 RS-485 Converter */
485#define BANDB_USO9ML2_PID 0xAC03 /* USO9ML2 Isolated RS-232 Converter */
486#define BANDB_USOPTL4_PID 0xAC11
487#define BANDB_USPTL4_PID 0xAC12
488#define BANDB_USO9ML2DR_2_PID 0xAC16
489#define BANDB_USO9ML2DR_PID 0xAC17
490#define BANDB_USOPTL4DR2_PID 0xAC18 /* USOPTL4R-2 2-port Isolated RS-232 Converter */
491#define BANDB_USOPTL4DR_PID 0xAC19
492#define BANDB_485USB9F_2W_PID 0xAC25
493#define BANDB_485USB9F_4W_PID 0xAC26
494#define BANDB_232USB9M_PID 0xAC27
495#define BANDB_485USBTB_2W_PID 0xAC33
496#define BANDB_485USBTB_4W_PID 0xAC34
497#define BANDB_TTL5USB9M_PID 0xAC49
498#define BANDB_TTL3USB9M_PID 0xAC50
499#define BANDB_ZZ_PROG1_USB_PID 0xBA02
500
501/*
502 * Intrepid Control Systems (http://www.intrepidcs.com/) ValueCAN and NeoVI
503 */
504#define INTREPID_VID 0x093C
505#define INTREPID_VALUECAN_PID 0x0601
506#define INTREPID_NEOVI_PID 0x0701
507
508/*
509 * Definitions for ID TECH (www.idt-net.com) devices
510 */
511#define IDTECH_VID 0x0ACD /* ID TECH Vendor ID */
512#define IDTECH_IDT1221U_PID 0x0300 /* IDT1221U USB to RS-232 adapter */
513
514/*
515 * Definitions for Omnidirectional Control Technology, Inc. devices
516 */
517#define OCT_VID 0x0B39 /* OCT vendor ID */
518/* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */
519/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */
520/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */
521#define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
522
523/*
524 * Icom ID-1 digital transceiver
525 */
526
527#define ICOM_ID1_VID 0x0C26
528#define ICOM_ID1_PID 0x0004
529
530/*
531 * GN Otometrics (http://www.otometrics.com)
532 * Submitted by Ville Sundberg.
533 */
534#define GN_OTOMETRICS_VID 0x0c33 /* Vendor ID */
535#define AURICAL_USB_PID 0x0010 /* Aurical USB Audiometer */
536
537/*
538 * The following are the values for the Sealevel SeaLINK+ adapters.
539 * (Original list sent by Tuan Hoang. Ian Abbott renamed the macros and
540 * removed some PIDs that don't seem to match any existing products.)
541 */
542#define SEALEVEL_VID 0x0c52 /* Sealevel Vendor ID */
543#define SEALEVEL_2101_PID 0x2101 /* SeaLINK+232 (2101/2105) */
544#define SEALEVEL_2102_PID 0x2102 /* SeaLINK+485 (2102) */
545#define SEALEVEL_2103_PID 0x2103 /* SeaLINK+232I (2103) */
546#define SEALEVEL_2104_PID 0x2104 /* SeaLINK+485I (2104) */
547#define SEALEVEL_2106_PID 0x9020 /* SeaLINK+422 (2106) */
548#define SEALEVEL_2201_1_PID 0x2211 /* SeaPORT+2/232 (2201) Port 1 */
549#define SEALEVEL_2201_2_PID 0x2221 /* SeaPORT+2/232 (2201) Port 2 */
550#define SEALEVEL_2202_1_PID 0x2212 /* SeaPORT+2/485 (2202) Port 1 */
551#define SEALEVEL_2202_2_PID 0x2222 /* SeaPORT+2/485 (2202) Port 2 */
552#define SEALEVEL_2203_1_PID 0x2213 /* SeaPORT+2 (2203) Port 1 */
553#define SEALEVEL_2203_2_PID 0x2223 /* SeaPORT+2 (2203) Port 2 */
554#define SEALEVEL_2401_1_PID 0x2411 /* SeaPORT+4/232 (2401) Port 1 */
555#define SEALEVEL_2401_2_PID 0x2421 /* SeaPORT+4/232 (2401) Port 2 */
556#define SEALEVEL_2401_3_PID 0x2431 /* SeaPORT+4/232 (2401) Port 3 */
557#define SEALEVEL_2401_4_PID 0x2441 /* SeaPORT+4/232 (2401) Port 4 */
558#define SEALEVEL_2402_1_PID 0x2412 /* SeaPORT+4/485 (2402) Port 1 */
559#define SEALEVEL_2402_2_PID 0x2422 /* SeaPORT+4/485 (2402) Port 2 */
560#define SEALEVEL_2402_3_PID 0x2432 /* SeaPORT+4/485 (2402) Port 3 */
561#define SEALEVEL_2402_4_PID 0x2442 /* SeaPORT+4/485 (2402) Port 4 */
562#define SEALEVEL_2403_1_PID 0x2413 /* SeaPORT+4 (2403) Port 1 */
563#define SEALEVEL_2403_2_PID 0x2423 /* SeaPORT+4 (2403) Port 2 */
564#define SEALEVEL_2403_3_PID 0x2433 /* SeaPORT+4 (2403) Port 3 */
565#define SEALEVEL_2403_4_PID 0x2443 /* SeaPORT+4 (2403) Port 4 */
566#define SEALEVEL_2801_1_PID 0X2811 /* SeaLINK+8/232 (2801) Port 1 */
567#define SEALEVEL_2801_2_PID 0X2821 /* SeaLINK+8/232 (2801) Port 2 */
568#define SEALEVEL_2801_3_PID 0X2831 /* SeaLINK+8/232 (2801) Port 3 */
569#define SEALEVEL_2801_4_PID 0X2841 /* SeaLINK+8/232 (2801) Port 4 */
570#define SEALEVEL_2801_5_PID 0X2851 /* SeaLINK+8/232 (2801) Port 5 */
571#define SEALEVEL_2801_6_PID 0X2861 /* SeaLINK+8/232 (2801) Port 6 */
572#define SEALEVEL_2801_7_PID 0X2871 /* SeaLINK+8/232 (2801) Port 7 */
573#define SEALEVEL_2801_8_PID 0X2881 /* SeaLINK+8/232 (2801) Port 8 */
574#define SEALEVEL_2802_1_PID 0X2812 /* SeaLINK+8/485 (2802) Port 1 */
575#define SEALEVEL_2802_2_PID 0X2822 /* SeaLINK+8/485 (2802) Port 2 */
576#define SEALEVEL_2802_3_PID 0X2832 /* SeaLINK+8/485 (2802) Port 3 */
577#define SEALEVEL_2802_4_PID 0X2842 /* SeaLINK+8/485 (2802) Port 4 */
578#define SEALEVEL_2802_5_PID 0X2852 /* SeaLINK+8/485 (2802) Port 5 */
579#define SEALEVEL_2802_6_PID 0X2862 /* SeaLINK+8/485 (2802) Port 6 */
580#define SEALEVEL_2802_7_PID 0X2872 /* SeaLINK+8/485 (2802) Port 7 */
581#define SEALEVEL_2802_8_PID 0X2882 /* SeaLINK+8/485 (2802) Port 8 */
582#define SEALEVEL_2803_1_PID 0X2813 /* SeaLINK+8 (2803) Port 1 */
583#define SEALEVEL_2803_2_PID 0X2823 /* SeaLINK+8 (2803) Port 2 */
584#define SEALEVEL_2803_3_PID 0X2833 /* SeaLINK+8 (2803) Port 3 */
585#define SEALEVEL_2803_4_PID 0X2843 /* SeaLINK+8 (2803) Port 4 */
586#define SEALEVEL_2803_5_PID 0X2853 /* SeaLINK+8 (2803) Port 5 */
587#define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */
588#define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */
589#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */
590
591/*
592 * JETI SPECTROMETER SPECBOS 1201
593 * http://www.jeti.com/products/sys/scb/scb1201.php
594 */
595#define JETI_VID 0x0c6c
596#define JETI_SPC1201_PID 0x04b2
597
598/*
599 * FTDI USB UART chips used in construction projects from the
600 * Elektor Electronics magazine (http://elektor-electronics.co.uk)
601 */
602#define ELEKTOR_VID 0x0C7D
603#define ELEKTOR_FT323R_PID 0x0005 /* RFID-Reader, issue 09-2006 */
604
605/*
606 * Posiflex inc retail equipment (http://www.posiflex.com.tw)
607 */
608#define POSIFLEX_VID 0x0d3a /* Vendor ID */
609#define POSIFLEX_PP7000_PID 0x0300 /* PP-7000II thermal printer */
610
611/*
612 * The following are the values for two KOBIL chipcard terminals.
613 */
614#define KOBIL_VID 0x0d46 /* KOBIL Vendor ID */
615#define KOBIL_CONV_B1_PID 0x2020 /* KOBIL Konverter for B1 */
616#define KOBIL_CONV_KAAN_PID 0x2021 /* KOBIL_Konverter for KAAN */
617
618#define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */
619#define FTDI_NF_RIC_PID 0x0001 /* Product Id */
620
621/*
622 * Falcom Wireless Communications GmbH
623 */
624#define FALCOM_VID 0x0F94 /* Vendor Id */
625#define FALCOM_TWIST_PID 0x0001 /* Falcom Twist USB GPRS modem */
626#define FALCOM_SAMBA_PID 0x0005 /* Falcom Samba USB GPRS modem */
627
628/* Larsen and Brusgaard AltiTrack/USBtrack */
629#define LARSENBRUSGAARD_VID 0x0FD8
630#define LB_ALTITRACK_PID 0x0001
631
632/*
633 * TTi (Thurlby Thandar Instruments)
634 */
635#define TTI_VID 0x103E /* Vendor Id */
636#define TTI_QL355P_PID 0x03E8 /* TTi QL355P power supply */
637
638/* Interbiometrics USB I/O Board */
639/* Developed for Interbiometrics by Rudolf Gugler */
640#define INTERBIOMETRICS_VID 0x1209
641#define INTERBIOMETRICS_IOBOARD_PID 0x1002
642#define INTERBIOMETRICS_MINI_IOBOARD_PID 0x1006
643
644/*
645 * Testo products (http://www.testo.com/)
646 * Submitted by Colin Leroy
647 */
648#define TESTO_VID 0x128D
649#define TESTO_USB_INTERFACE_PID 0x0001
650
651/*
652 * Mobility Electronics products.
653 */
654#define MOBILITY_VID 0x1342
655#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */
656
657/*
658 * FIC / OpenMoko, Inc. http://wiki.openmoko.org/wiki/Neo1973_Debug_Board_v3
659 * Submitted by Harald Welte <laforge@openmoko.org>
660 */
661#define FIC_VID 0x1457
662#define FIC_NEO1973_DEBUG_PID 0x5118
663
664/* Olimex */
665#define OLIMEX_VID 0x15BA
666#define OLIMEX_ARM_USB_OCD_PID 0x0003
667
668/*
669 * Telldus Technologies
670 */
671#define TELLDUS_VID 0x1781 /* Vendor ID */
672#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */
673
674/*
675 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
676 * http://winglucofacts.com/cables/
677 */
678#define BAYER_VID 0x1A79
679#define BAYER_CONTOUR_CABLE_PID 0x6001
680
681/*
682 * The following are the values for the Matrix Orbital FTDI Range
683 * Anything in this range will use an FT232RL.
684 */
685#define MTXORB_VID 0x1B3D
686#define MTXORB_FTDI_RANGE_0100_PID 0x0100
687#define MTXORB_FTDI_RANGE_0101_PID 0x0101
688#define MTXORB_FTDI_RANGE_0102_PID 0x0102
689#define MTXORB_FTDI_RANGE_0103_PID 0x0103
690#define MTXORB_FTDI_RANGE_0104_PID 0x0104
691#define MTXORB_FTDI_RANGE_0105_PID 0x0105
692#define MTXORB_FTDI_RANGE_0106_PID 0x0106
693#define MTXORB_FTDI_RANGE_0107_PID 0x0107
694#define MTXORB_FTDI_RANGE_0108_PID 0x0108
695#define MTXORB_FTDI_RANGE_0109_PID 0x0109
696#define MTXORB_FTDI_RANGE_010A_PID 0x010A
697#define MTXORB_FTDI_RANGE_010B_PID 0x010B
698#define MTXORB_FTDI_RANGE_010C_PID 0x010C
699#define MTXORB_FTDI_RANGE_010D_PID 0x010D
700#define MTXORB_FTDI_RANGE_010E_PID 0x010E
701#define MTXORB_FTDI_RANGE_010F_PID 0x010F
702#define MTXORB_FTDI_RANGE_0110_PID 0x0110
703#define MTXORB_FTDI_RANGE_0111_PID 0x0111
704#define MTXORB_FTDI_RANGE_0112_PID 0x0112
705#define MTXORB_FTDI_RANGE_0113_PID 0x0113
706#define MTXORB_FTDI_RANGE_0114_PID 0x0114
707#define MTXORB_FTDI_RANGE_0115_PID 0x0115
708#define MTXORB_FTDI_RANGE_0116_PID 0x0116
709#define MTXORB_FTDI_RANGE_0117_PID 0x0117
710#define MTXORB_FTDI_RANGE_0118_PID 0x0118
711#define MTXORB_FTDI_RANGE_0119_PID 0x0119
712#define MTXORB_FTDI_RANGE_011A_PID 0x011A
713#define MTXORB_FTDI_RANGE_011B_PID 0x011B
714#define MTXORB_FTDI_RANGE_011C_PID 0x011C
715#define MTXORB_FTDI_RANGE_011D_PID 0x011D
716#define MTXORB_FTDI_RANGE_011E_PID 0x011E
717#define MTXORB_FTDI_RANGE_011F_PID 0x011F
718#define MTXORB_FTDI_RANGE_0120_PID 0x0120
719#define MTXORB_FTDI_RANGE_0121_PID 0x0121
720#define MTXORB_FTDI_RANGE_0122_PID 0x0122
721#define MTXORB_FTDI_RANGE_0123_PID 0x0123
722#define MTXORB_FTDI_RANGE_0124_PID 0x0124
723#define MTXORB_FTDI_RANGE_0125_PID 0x0125
724#define MTXORB_FTDI_RANGE_0126_PID 0x0126
725#define MTXORB_FTDI_RANGE_0127_PID 0x0127
726#define MTXORB_FTDI_RANGE_0128_PID 0x0128
727#define MTXORB_FTDI_RANGE_0129_PID 0x0129
728#define MTXORB_FTDI_RANGE_012A_PID 0x012A
729#define MTXORB_FTDI_RANGE_012B_PID 0x012B
730#define MTXORB_FTDI_RANGE_012C_PID 0x012C
731#define MTXORB_FTDI_RANGE_012D_PID 0x012D
732#define MTXORB_FTDI_RANGE_012E_PID 0x012E
733#define MTXORB_FTDI_RANGE_012F_PID 0x012F
734#define MTXORB_FTDI_RANGE_0130_PID 0x0130
735#define MTXORB_FTDI_RANGE_0131_PID 0x0131
736#define MTXORB_FTDI_RANGE_0132_PID 0x0132
737#define MTXORB_FTDI_RANGE_0133_PID 0x0133
738#define MTXORB_FTDI_RANGE_0134_PID 0x0134
739#define MTXORB_FTDI_RANGE_0135_PID 0x0135
740#define MTXORB_FTDI_RANGE_0136_PID 0x0136
741#define MTXORB_FTDI_RANGE_0137_PID 0x0137
742#define MTXORB_FTDI_RANGE_0138_PID 0x0138
743#define MTXORB_FTDI_RANGE_0139_PID 0x0139
744#define MTXORB_FTDI_RANGE_013A_PID 0x013A
745#define MTXORB_FTDI_RANGE_013B_PID 0x013B
746#define MTXORB_FTDI_RANGE_013C_PID 0x013C
747#define MTXORB_FTDI_RANGE_013D_PID 0x013D
748#define MTXORB_FTDI_RANGE_013E_PID 0x013E
749#define MTXORB_FTDI_RANGE_013F_PID 0x013F
750#define MTXORB_FTDI_RANGE_0140_PID 0x0140
751#define MTXORB_FTDI_RANGE_0141_PID 0x0141
752#define MTXORB_FTDI_RANGE_0142_PID 0x0142
753#define MTXORB_FTDI_RANGE_0143_PID 0x0143
754#define MTXORB_FTDI_RANGE_0144_PID 0x0144
755#define MTXORB_FTDI_RANGE_0145_PID 0x0145
756#define MTXORB_FTDI_RANGE_0146_PID 0x0146
757#define MTXORB_FTDI_RANGE_0147_PID 0x0147
758#define MTXORB_FTDI_RANGE_0148_PID 0x0148
759#define MTXORB_FTDI_RANGE_0149_PID 0x0149
760#define MTXORB_FTDI_RANGE_014A_PID 0x014A
761#define MTXORB_FTDI_RANGE_014B_PID 0x014B
762#define MTXORB_FTDI_RANGE_014C_PID 0x014C
763#define MTXORB_FTDI_RANGE_014D_PID 0x014D
764#define MTXORB_FTDI_RANGE_014E_PID 0x014E
765#define MTXORB_FTDI_RANGE_014F_PID 0x014F
766#define MTXORB_FTDI_RANGE_0150_PID 0x0150
767#define MTXORB_FTDI_RANGE_0151_PID 0x0151
768#define MTXORB_FTDI_RANGE_0152_PID 0x0152
769#define MTXORB_FTDI_RANGE_0153_PID 0x0153
770#define MTXORB_FTDI_RANGE_0154_PID 0x0154
771#define MTXORB_FTDI_RANGE_0155_PID 0x0155
772#define MTXORB_FTDI_RANGE_0156_PID 0x0156
773#define MTXORB_FTDI_RANGE_0157_PID 0x0157
774#define MTXORB_FTDI_RANGE_0158_PID 0x0158
775#define MTXORB_FTDI_RANGE_0159_PID 0x0159
776#define MTXORB_FTDI_RANGE_015A_PID 0x015A
777#define MTXORB_FTDI_RANGE_015B_PID 0x015B
778#define MTXORB_FTDI_RANGE_015C_PID 0x015C
779#define MTXORB_FTDI_RANGE_015D_PID 0x015D
780#define MTXORB_FTDI_RANGE_015E_PID 0x015E
781#define MTXORB_FTDI_RANGE_015F_PID 0x015F
782#define MTXORB_FTDI_RANGE_0160_PID 0x0160
783#define MTXORB_FTDI_RANGE_0161_PID 0x0161
784#define MTXORB_FTDI_RANGE_0162_PID 0x0162
785#define MTXORB_FTDI_RANGE_0163_PID 0x0163
786#define MTXORB_FTDI_RANGE_0164_PID 0x0164
787#define MTXORB_FTDI_RANGE_0165_PID 0x0165
788#define MTXORB_FTDI_RANGE_0166_PID 0x0166
789#define MTXORB_FTDI_RANGE_0167_PID 0x0167
790#define MTXORB_FTDI_RANGE_0168_PID 0x0168
791#define MTXORB_FTDI_RANGE_0169_PID 0x0169
792#define MTXORB_FTDI_RANGE_016A_PID 0x016A
793#define MTXORB_FTDI_RANGE_016B_PID 0x016B
794#define MTXORB_FTDI_RANGE_016C_PID 0x016C
795#define MTXORB_FTDI_RANGE_016D_PID 0x016D
796#define MTXORB_FTDI_RANGE_016E_PID 0x016E
797#define MTXORB_FTDI_RANGE_016F_PID 0x016F
798#define MTXORB_FTDI_RANGE_0170_PID 0x0170
799#define MTXORB_FTDI_RANGE_0171_PID 0x0171
800#define MTXORB_FTDI_RANGE_0172_PID 0x0172
801#define MTXORB_FTDI_RANGE_0173_PID 0x0173
802#define MTXORB_FTDI_RANGE_0174_PID 0x0174
803#define MTXORB_FTDI_RANGE_0175_PID 0x0175
804#define MTXORB_FTDI_RANGE_0176_PID 0x0176
805#define MTXORB_FTDI_RANGE_0177_PID 0x0177
806#define MTXORB_FTDI_RANGE_0178_PID 0x0178
807#define MTXORB_FTDI_RANGE_0179_PID 0x0179
808#define MTXORB_FTDI_RANGE_017A_PID 0x017A
809#define MTXORB_FTDI_RANGE_017B_PID 0x017B
810#define MTXORB_FTDI_RANGE_017C_PID 0x017C
811#define MTXORB_FTDI_RANGE_017D_PID 0x017D
812#define MTXORB_FTDI_RANGE_017E_PID 0x017E
813#define MTXORB_FTDI_RANGE_017F_PID 0x017F
814#define MTXORB_FTDI_RANGE_0180_PID 0x0180
815#define MTXORB_FTDI_RANGE_0181_PID 0x0181
816#define MTXORB_FTDI_RANGE_0182_PID 0x0182
817#define MTXORB_FTDI_RANGE_0183_PID 0x0183
818#define MTXORB_FTDI_RANGE_0184_PID 0x0184
819#define MTXORB_FTDI_RANGE_0185_PID 0x0185
820#define MTXORB_FTDI_RANGE_0186_PID 0x0186
821#define MTXORB_FTDI_RANGE_0187_PID 0x0187
822#define MTXORB_FTDI_RANGE_0188_PID 0x0188
823#define MTXORB_FTDI_RANGE_0189_PID 0x0189
824#define MTXORB_FTDI_RANGE_018A_PID 0x018A
825#define MTXORB_FTDI_RANGE_018B_PID 0x018B
826#define MTXORB_FTDI_RANGE_018C_PID 0x018C
827#define MTXORB_FTDI_RANGE_018D_PID 0x018D
828#define MTXORB_FTDI_RANGE_018E_PID 0x018E
829#define MTXORB_FTDI_RANGE_018F_PID 0x018F
830#define MTXORB_FTDI_RANGE_0190_PID 0x0190
831#define MTXORB_FTDI_RANGE_0191_PID 0x0191
832#define MTXORB_FTDI_RANGE_0192_PID 0x0192
833#define MTXORB_FTDI_RANGE_0193_PID 0x0193
834#define MTXORB_FTDI_RANGE_0194_PID 0x0194
835#define MTXORB_FTDI_RANGE_0195_PID 0x0195
836#define MTXORB_FTDI_RANGE_0196_PID 0x0196
837#define MTXORB_FTDI_RANGE_0197_PID 0x0197
838#define MTXORB_FTDI_RANGE_0198_PID 0x0198
839#define MTXORB_FTDI_RANGE_0199_PID 0x0199
840#define MTXORB_FTDI_RANGE_019A_PID 0x019A
841#define MTXORB_FTDI_RANGE_019B_PID 0x019B
842#define MTXORB_FTDI_RANGE_019C_PID 0x019C
843#define MTXORB_FTDI_RANGE_019D_PID 0x019D
844#define MTXORB_FTDI_RANGE_019E_PID 0x019E
845#define MTXORB_FTDI_RANGE_019F_PID 0x019F
846#define MTXORB_FTDI_RANGE_01A0_PID 0x01A0
847#define MTXORB_FTDI_RANGE_01A1_PID 0x01A1
848#define MTXORB_FTDI_RANGE_01A2_PID 0x01A2
849#define MTXORB_FTDI_RANGE_01A3_PID 0x01A3
850#define MTXORB_FTDI_RANGE_01A4_PID 0x01A4
851#define MTXORB_FTDI_RANGE_01A5_PID 0x01A5
852#define MTXORB_FTDI_RANGE_01A6_PID 0x01A6
853#define MTXORB_FTDI_RANGE_01A7_PID 0x01A7
854#define MTXORB_FTDI_RANGE_01A8_PID 0x01A8
855#define MTXORB_FTDI_RANGE_01A9_PID 0x01A9
856#define MTXORB_FTDI_RANGE_01AA_PID 0x01AA
857#define MTXORB_FTDI_RANGE_01AB_PID 0x01AB
858#define MTXORB_FTDI_RANGE_01AC_PID 0x01AC
859#define MTXORB_FTDI_RANGE_01AD_PID 0x01AD
860#define MTXORB_FTDI_RANGE_01AE_PID 0x01AE
861#define MTXORB_FTDI_RANGE_01AF_PID 0x01AF
862#define MTXORB_FTDI_RANGE_01B0_PID 0x01B0
863#define MTXORB_FTDI_RANGE_01B1_PID 0x01B1
864#define MTXORB_FTDI_RANGE_01B2_PID 0x01B2
865#define MTXORB_FTDI_RANGE_01B3_PID 0x01B3
866#define MTXORB_FTDI_RANGE_01B4_PID 0x01B4
867#define MTXORB_FTDI_RANGE_01B5_PID 0x01B5
868#define MTXORB_FTDI_RANGE_01B6_PID 0x01B6
869#define MTXORB_FTDI_RANGE_01B7_PID 0x01B7
870#define MTXORB_FTDI_RANGE_01B8_PID 0x01B8
871#define MTXORB_FTDI_RANGE_01B9_PID 0x01B9
872#define MTXORB_FTDI_RANGE_01BA_PID 0x01BA
873#define MTXORB_FTDI_RANGE_01BB_PID 0x01BB
874#define MTXORB_FTDI_RANGE_01BC_PID 0x01BC
875#define MTXORB_FTDI_RANGE_01BD_PID 0x01BD
876#define MTXORB_FTDI_RANGE_01BE_PID 0x01BE
877#define MTXORB_FTDI_RANGE_01BF_PID 0x01BF
878#define MTXORB_FTDI_RANGE_01C0_PID 0x01C0
879#define MTXORB_FTDI_RANGE_01C1_PID 0x01C1
880#define MTXORB_FTDI_RANGE_01C2_PID 0x01C2
881#define MTXORB_FTDI_RANGE_01C3_PID 0x01C3
882#define MTXORB_FTDI_RANGE_01C4_PID 0x01C4
883#define MTXORB_FTDI_RANGE_01C5_PID 0x01C5
884#define MTXORB_FTDI_RANGE_01C6_PID 0x01C6
885#define MTXORB_FTDI_RANGE_01C7_PID 0x01C7
886#define MTXORB_FTDI_RANGE_01C8_PID 0x01C8
887#define MTXORB_FTDI_RANGE_01C9_PID 0x01C9
888#define MTXORB_FTDI_RANGE_01CA_PID 0x01CA
889#define MTXORB_FTDI_RANGE_01CB_PID 0x01CB
890#define MTXORB_FTDI_RANGE_01CC_PID 0x01CC
891#define MTXORB_FTDI_RANGE_01CD_PID 0x01CD
892#define MTXORB_FTDI_RANGE_01CE_PID 0x01CE
893#define MTXORB_FTDI_RANGE_01CF_PID 0x01CF
894#define MTXORB_FTDI_RANGE_01D0_PID 0x01D0
895#define MTXORB_FTDI_RANGE_01D1_PID 0x01D1
896#define MTXORB_FTDI_RANGE_01D2_PID 0x01D2
897#define MTXORB_FTDI_RANGE_01D3_PID 0x01D3
898#define MTXORB_FTDI_RANGE_01D4_PID 0x01D4
899#define MTXORB_FTDI_RANGE_01D5_PID 0x01D5
900#define MTXORB_FTDI_RANGE_01D6_PID 0x01D6
901#define MTXORB_FTDI_RANGE_01D7_PID 0x01D7
902#define MTXORB_FTDI_RANGE_01D8_PID 0x01D8
903#define MTXORB_FTDI_RANGE_01D9_PID 0x01D9
904#define MTXORB_FTDI_RANGE_01DA_PID 0x01DA
905#define MTXORB_FTDI_RANGE_01DB_PID 0x01DB
906#define MTXORB_FTDI_RANGE_01DC_PID 0x01DC
907#define MTXORB_FTDI_RANGE_01DD_PID 0x01DD
908#define MTXORB_FTDI_RANGE_01DE_PID 0x01DE
909#define MTXORB_FTDI_RANGE_01DF_PID 0x01DF
910#define MTXORB_FTDI_RANGE_01E0_PID 0x01E0
911#define MTXORB_FTDI_RANGE_01E1_PID 0x01E1
912#define MTXORB_FTDI_RANGE_01E2_PID 0x01E2
913#define MTXORB_FTDI_RANGE_01E3_PID 0x01E3
914#define MTXORB_FTDI_RANGE_01E4_PID 0x01E4
915#define MTXORB_FTDI_RANGE_01E5_PID 0x01E5
916#define MTXORB_FTDI_RANGE_01E6_PID 0x01E6
917#define MTXORB_FTDI_RANGE_01E7_PID 0x01E7
918#define MTXORB_FTDI_RANGE_01E8_PID 0x01E8
919#define MTXORB_FTDI_RANGE_01E9_PID 0x01E9
920#define MTXORB_FTDI_RANGE_01EA_PID 0x01EA
921#define MTXORB_FTDI_RANGE_01EB_PID 0x01EB
922#define MTXORB_FTDI_RANGE_01EC_PID 0x01EC
923#define MTXORB_FTDI_RANGE_01ED_PID 0x01ED
924#define MTXORB_FTDI_RANGE_01EE_PID 0x01EE
925#define MTXORB_FTDI_RANGE_01EF_PID 0x01EF
926#define MTXORB_FTDI_RANGE_01F0_PID 0x01F0
927#define MTXORB_FTDI_RANGE_01F1_PID 0x01F1
928#define MTXORB_FTDI_RANGE_01F2_PID 0x01F2
929#define MTXORB_FTDI_RANGE_01F3_PID 0x01F3
930#define MTXORB_FTDI_RANGE_01F4_PID 0x01F4
931#define MTXORB_FTDI_RANGE_01F5_PID 0x01F5
932#define MTXORB_FTDI_RANGE_01F6_PID 0x01F6
933#define MTXORB_FTDI_RANGE_01F7_PID 0x01F7
934#define MTXORB_FTDI_RANGE_01F8_PID 0x01F8
935#define MTXORB_FTDI_RANGE_01F9_PID 0x01F9
936#define MTXORB_FTDI_RANGE_01FA_PID 0x01FA
937#define MTXORB_FTDI_RANGE_01FB_PID 0x01FB
938#define MTXORB_FTDI_RANGE_01FC_PID 0x01FC
939#define MTXORB_FTDI_RANGE_01FD_PID 0x01FD
940#define MTXORB_FTDI_RANGE_01FE_PID 0x01FE
941#define MTXORB_FTDI_RANGE_01FF_PID 0x01FF
942
943
944
945/*
946 * The Mobility Lab (TML)
947 * Submitted by Pierre Castella
948 */
949#define TML_VID 0x1B91 /* Vendor ID */
950#define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */
951
952/* Alti-2 products http://www.alti-2.com */
953#define ALTI2_VID 0x1BC9
954#define ALTI2_N3_PID 0x6001 /* Neptune 3 */
955
956/*
957 * Dresden Elektronic Sensor Terminal Board
958 */
959#define DE_VID 0x1cf1 /* Vendor ID */
960#define STB_PID 0x0001 /* Sensor Terminal Board */
961#define WHT_PID 0x0004 /* Wireless Handheld Terminal */
962
963/*
964 * Papouch products (http://www.papouch.com/)
965 * Submitted by Folkert van Heusden
966 */
967
968#define PAPOUCH_VID 0x5050 /* Vendor ID */
969#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
970#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */
971
972/*
973 * Marvell SheevaPlug
974 */
975#define MARVELL_VID 0x9e88
976#define MARVELL_SHEEVAPLUG_PID 0x9e8f
977
978/*
979 * Evolution Robotics products (http://www.evolution.com/).
980 * Submitted by Shawn M. Lavelle.
981 */
982#define EVOLUTION_VID 0xDEEE /* Vendor ID */
983#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
984#define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/
985#define EVO_HYBRID_PID 0x0302 /* Evolution robotics RCM4 PID (FT232BM)*/
986#define EVO_RCM4_PID 0x0303 /* Evolution robotics RCM4 PID */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index bbe005cefcfb..f1ea3a33b6e6 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -276,7 +276,7 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port)
276 if (port->write_urb_busy) 276 if (port->write_urb_busy)
277 start_io = false; 277 start_io = false;
278 else { 278 else {
279 start_io = (__kfifo_len(port->write_fifo) != 0); 279 start_io = (kfifo_len(&port->write_fifo) != 0);
280 port->write_urb_busy = start_io; 280 port->write_urb_busy = start_io;
281 } 281 }
282 spin_unlock_irqrestore(&port->lock, flags); 282 spin_unlock_irqrestore(&port->lock, flags);
@@ -285,7 +285,7 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port)
285 return 0; 285 return 0;
286 286
287 data = port->write_urb->transfer_buffer; 287 data = port->write_urb->transfer_buffer;
288 count = kfifo_get(port->write_fifo, data, port->bulk_out_size); 288 count = kfifo_out_locked(&port->write_fifo, data, port->bulk_out_size, &port->lock);
289 usb_serial_debug_data(debug, &port->dev, __func__, count, data); 289 usb_serial_debug_data(debug, &port->dev, __func__, count, data);
290 290
291 /* set up our urb */ 291 /* set up our urb */
@@ -345,7 +345,7 @@ int usb_serial_generic_write(struct tty_struct *tty,
345 return usb_serial_multi_urb_write(tty, port, 345 return usb_serial_multi_urb_write(tty, port,
346 buf, count); 346 buf, count);
347 347
348 count = kfifo_put(port->write_fifo, buf, count); 348 count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
349 result = usb_serial_generic_write_start(port); 349 result = usb_serial_generic_write_start(port);
350 350
351 if (result >= 0) 351 if (result >= 0)
@@ -370,7 +370,7 @@ int usb_serial_generic_write_room(struct tty_struct *tty)
370 (serial->type->max_in_flight_urbs - 370 (serial->type->max_in_flight_urbs -
371 port->urbs_in_flight); 371 port->urbs_in_flight);
372 } else if (serial->num_bulk_out) 372 } else if (serial->num_bulk_out)
373 room = port->write_fifo->size - __kfifo_len(port->write_fifo); 373 room = kfifo_avail(&port->write_fifo);
374 spin_unlock_irqrestore(&port->lock, flags); 374 spin_unlock_irqrestore(&port->lock, flags);
375 375
376 dbg("%s - returns %d", __func__, room); 376 dbg("%s - returns %d", __func__, room);
@@ -391,7 +391,7 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
391 chars = port->tx_bytes_flight; 391 chars = port->tx_bytes_flight;
392 spin_unlock_irqrestore(&port->lock, flags); 392 spin_unlock_irqrestore(&port->lock, flags);
393 } else if (serial->num_bulk_out) 393 } else if (serial->num_bulk_out)
394 chars = kfifo_len(port->write_fifo); 394 chars = kfifo_len(&port->write_fifo);
395 395
396 dbg("%s - returns %d", __func__, chars); 396 dbg("%s - returns %d", __func__, chars);
397 return chars; 397 return chars;
@@ -507,7 +507,7 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
507 if (status) { 507 if (status) {
508 dbg("%s - nonzero multi-urb write bulk status " 508 dbg("%s - nonzero multi-urb write bulk status "
509 "received: %d", __func__, status); 509 "received: %d", __func__, status);
510 kfifo_reset(port->write_fifo); 510 kfifo_reset_out(&port->write_fifo);
511 } else 511 } else
512 usb_serial_generic_write_start(port); 512 usb_serial_generic_write_start(port);
513 } 513 }
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 485fa9c5b107..2cfe2451ed97 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -127,8 +127,9 @@
127#define BANDB_DEVICE_ID_US9ML2_4 0xAC30 127#define BANDB_DEVICE_ID_US9ML2_4 0xAC30
128#define BANDB_DEVICE_ID_USPTL4_2 0xAC31 128#define BANDB_DEVICE_ID_USPTL4_2 0xAC31
129#define BANDB_DEVICE_ID_USPTL4_4 0xAC32 129#define BANDB_DEVICE_ID_USPTL4_4 0xAC32
130#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 130#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42
131#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 131#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44
132#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24
132 133
133/* This driver also supports 134/* This driver also supports
134 * ATEN UC2324 device using Moschip MCS7840 135 * ATEN UC2324 device using Moschip MCS7840
@@ -191,6 +192,7 @@ static struct usb_device_id moschip_port_id_table[] = {
191 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)}, 192 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)},
192 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, 193 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
193 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, 194 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
195 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)},
194 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, 196 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
195 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, 197 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)},
196 {} /* terminating entry */ 198 {} /* terminating entry */
@@ -207,6 +209,7 @@ static __devinitdata struct usb_device_id moschip_id_table_combined[] = {
207 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)}, 209 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)},
208 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, 210 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
209 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, 211 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
212 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)},
210 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, 213 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
211 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)}, 214 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)},
212 {} /* terminating entry */ 215 {} /* terminating entry */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9a2b903492ec..6e94a6711f08 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -340,6 +340,10 @@ static int option_resume(struct usb_serial *serial);
340#define FOUR_G_SYSTEMS_VENDOR_ID 0x1c9e 340#define FOUR_G_SYSTEMS_VENDOR_ID 0x1c9e
341#define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 341#define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
342 342
343/* Haier products */
344#define HAIER_VENDOR_ID 0x201e
345#define HAIER_PRODUCT_CE100 0x2009
346
343static struct usb_device_id option_ids[] = { 347static struct usb_device_id option_ids[] = {
344 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 348 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
345 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 349 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -641,6 +645,7 @@ static struct usb_device_id option_ids[] = {
641 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, 645 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
642 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, 646 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
643 { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14) }, 647 { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14) },
648 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
644 { } /* Terminating entry */ 649 { } /* Terminating entry */
645}; 650};
646MODULE_DEVICE_TABLE(usb, option_ids); 651MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 4543f359be75..33c85f7084f8 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -595,8 +595,7 @@ static void port_release(struct device *dev)
595 usb_free_urb(port->write_urb); 595 usb_free_urb(port->write_urb);
596 usb_free_urb(port->interrupt_in_urb); 596 usb_free_urb(port->interrupt_in_urb);
597 usb_free_urb(port->interrupt_out_urb); 597 usb_free_urb(port->interrupt_out_urb);
598 if (!IS_ERR(port->write_fifo) && port->write_fifo) 598 kfifo_free(&port->write_fifo);
599 kfifo_free(port->write_fifo);
600 kfree(port->bulk_in_buffer); 599 kfree(port->bulk_in_buffer);
601 kfree(port->bulk_out_buffer); 600 kfree(port->bulk_out_buffer);
602 kfree(port->interrupt_in_buffer); 601 kfree(port->interrupt_in_buffer);
@@ -939,9 +938,7 @@ int usb_serial_probe(struct usb_interface *interface,
939 dev_err(&interface->dev, "No free urbs available\n"); 938 dev_err(&interface->dev, "No free urbs available\n");
940 goto probe_error; 939 goto probe_error;
941 } 940 }
942 port->write_fifo = kfifo_alloc(PAGE_SIZE, GFP_KERNEL, 941 if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL))
943 &port->lock);
944 if (IS_ERR(port->write_fifo))
945 goto probe_error; 942 goto probe_error;
946 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); 943 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
947 port->bulk_out_size = buffer_size; 944 port->bulk_out_size = buffer_size;
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index 2051c9dc813b..b7687c55fe16 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -2245,9 +2245,6 @@ static int ext_setcolreg(unsigned int regno, unsigned int red,
2245 if (regno > 255) 2245 if (regno > 255)
2246 return 1; 2246 return 1;
2247 2247
2248 if (regno > 255)
2249 return 1;
2250
2251 switch (external_card_type) { 2248 switch (external_card_type) {
2252 case IS_VGA: 2249 case IS_VGA:
2253 OUTB(0x3c8, regno); 2250 OUTB(0x3c8, regno);
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index 4c10edecfb66..86d95c228adb 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -85,7 +85,7 @@ static int adp5520_bl_get_brightness(struct backlight_device *bl)
85 return error ? data->current_brightness : reg_val; 85 return error ? data->current_brightness : reg_val;
86} 86}
87 87
88static struct backlight_ops adp5520_bl_ops = { 88static const struct backlight_ops adp5520_bl_ops = {
89 .update_status = adp5520_bl_update_status, 89 .update_status = adp5520_bl_update_status,
90 .get_brightness = adp5520_bl_get_brightness, 90 .get_brightness = adp5520_bl_get_brightness,
91}; 91};
diff --git a/drivers/video/backlight/adx_bl.c b/drivers/video/backlight/adx_bl.c
index 2c3bdfc620b7..d769b0bab21a 100644
--- a/drivers/video/backlight/adx_bl.c
+++ b/drivers/video/backlight/adx_bl.c
@@ -61,7 +61,7 @@ static int adx_backlight_check_fb(struct fb_info *fb)
61 return 1; 61 return 1;
62} 62}
63 63
64static struct backlight_ops adx_backlight_ops = { 64static const struct backlight_ops adx_backlight_ops = {
65 .options = 0, 65 .options = 0,
66 .update_status = adx_backlight_update_status, 66 .update_status = adx_backlight_update_status,
67 .get_brightness = adx_backlight_get_brightness, 67 .get_brightness = adx_backlight_get_brightness,
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
index 2cf7ba52f67c..f625ffc69ad3 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -113,7 +113,7 @@ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
113 return pwm_channel_enable(&pwmbl->pwmc); 113 return pwm_channel_enable(&pwmbl->pwmc);
114} 114}
115 115
116static struct backlight_ops atmel_pwm_bl_ops = { 116static const struct backlight_ops atmel_pwm_bl_ops = {
117 .get_brightness = atmel_pwm_bl_get_intensity, 117 .get_brightness = atmel_pwm_bl_get_intensity,
118 .update_status = atmel_pwm_bl_set_intensity, 118 .update_status = atmel_pwm_bl_set_intensity,
119}; 119};
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 6615ac7fa60a..18829cf68b1b 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(backlight_force_update);
269 * ERR_PTR() or a pointer to the newly allocated device. 269 * ERR_PTR() or a pointer to the newly allocated device.
270 */ 270 */
271struct backlight_device *backlight_device_register(const char *name, 271struct backlight_device *backlight_device_register(const char *name,
272 struct device *parent, void *devdata, struct backlight_ops *ops) 272 struct device *parent, void *devdata, const struct backlight_ops *ops)
273{ 273{
274 struct backlight_device *new_bd; 274 struct backlight_device *new_bd;
275 int rc; 275 int rc;
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 96774949cd30..b4bcf8043797 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -451,7 +451,7 @@ void corgi_lcd_limit_intensity(int limit)
451} 451}
452EXPORT_SYMBOL(corgi_lcd_limit_intensity); 452EXPORT_SYMBOL(corgi_lcd_limit_intensity);
453 453
454static struct backlight_ops corgi_bl_ops = { 454static const struct backlight_ops corgi_bl_ops = {
455 .get_brightness = corgi_bl_get_intensity, 455 .get_brightness = corgi_bl_get_intensity,
456 .update_status = corgi_bl_update_status, 456 .update_status = corgi_bl_update_status,
457}; 457};
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c
index b9fe62b475c6..da86db4374a0 100644
--- a/drivers/video/backlight/cr_bllcd.c
+++ b/drivers/video/backlight/cr_bllcd.c
@@ -108,7 +108,7 @@ static int cr_backlight_get_intensity(struct backlight_device *bd)
108 return intensity; 108 return intensity;
109} 109}
110 110
111static struct backlight_ops cr_backlight_ops = { 111static const struct backlight_ops cr_backlight_ops = {
112 .get_brightness = cr_backlight_get_intensity, 112 .get_brightness = cr_backlight_get_intensity,
113 .update_status = cr_backlight_set_intensity, 113 .update_status = cr_backlight_set_intensity,
114}; 114};
@@ -201,7 +201,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
201 if (IS_ERR(ldp)) { 201 if (IS_ERR(ldp)) {
202 backlight_device_unregister(bdp); 202 backlight_device_unregister(bdp);
203 pci_dev_put(lpc_dev); 203 pci_dev_put(lpc_dev);
204 return PTR_ERR(bdp); 204 return PTR_ERR(ldp);
205 } 205 }
206 206
207 pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR, 207 pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR,
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c
index f2d76dae1eb3..74cdc640173d 100644
--- a/drivers/video/backlight/da903x_bl.c
+++ b/drivers/video/backlight/da903x_bl.c
@@ -95,7 +95,7 @@ static int da903x_backlight_get_brightness(struct backlight_device *bl)
95 return data->current_brightness; 95 return data->current_brightness;
96} 96}
97 97
98static struct backlight_ops da903x_backlight_ops = { 98static const struct backlight_ops da903x_backlight_ops = {
99 .update_status = da903x_backlight_update_status, 99 .update_status = da903x_backlight_update_status,
100 .get_brightness = da903x_backlight_get_brightness, 100 .get_brightness = da903x_backlight_get_brightness,
101}; 101};
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c
index 6d27f62fdcd0..e6d348e63596 100644
--- a/drivers/video/backlight/generic_bl.c
+++ b/drivers/video/backlight/generic_bl.c
@@ -70,7 +70,7 @@ void corgibl_limit_intensity(int limit)
70} 70}
71EXPORT_SYMBOL(corgibl_limit_intensity); 71EXPORT_SYMBOL(corgibl_limit_intensity);
72 72
73static struct backlight_ops genericbl_ops = { 73static const struct backlight_ops genericbl_ops = {
74 .options = BL_CORE_SUSPENDRESUME, 74 .options = BL_CORE_SUSPENDRESUME,
75 .get_brightness = genericbl_get_intensity, 75 .get_brightness = genericbl_get_intensity,
76 .update_status = genericbl_send_intensity, 76 .update_status = genericbl_send_intensity,
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index 7fb4eefff80d..f7cc528d5be7 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -98,7 +98,7 @@ static int hp680bl_get_intensity(struct backlight_device *bd)
98 return current_intensity; 98 return current_intensity;
99} 99}
100 100
101static struct backlight_ops hp680bl_ops = { 101static const struct backlight_ops hp680bl_ops = {
102 .get_brightness = hp680bl_get_intensity, 102 .get_brightness = hp680bl_get_intensity,
103 .update_status = hp680bl_set_intensity, 103 .update_status = hp680bl_set_intensity,
104}; 104};
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c
index 7aed2565c1bd..db9071fc5665 100644
--- a/drivers/video/backlight/jornada720_bl.c
+++ b/drivers/video/backlight/jornada720_bl.c
@@ -93,7 +93,7 @@ out:
93 return ret; 93 return ret;
94} 94}
95 95
96static struct backlight_ops jornada_bl_ops = { 96static const struct backlight_ops jornada_bl_ops = {
97 .get_brightness = jornada_bl_get_brightness, 97 .get_brightness = jornada_bl_get_brightness,
98 .update_status = jornada_bl_update_status, 98 .update_status = jornada_bl_update_status,
99 .options = BL_CORE_SUSPENDRESUME, 99 .options = BL_CORE_SUSPENDRESUME,
diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c
index a38fda1742dd..939e7b830cf3 100644
--- a/drivers/video/backlight/kb3886_bl.c
+++ b/drivers/video/backlight/kb3886_bl.c
@@ -134,7 +134,7 @@ static int kb3886bl_get_intensity(struct backlight_device *bd)
134 return kb3886bl_intensity; 134 return kb3886bl_intensity;
135} 135}
136 136
137static struct backlight_ops kb3886bl_ops = { 137static const struct backlight_ops kb3886bl_ops = {
138 .get_brightness = kb3886bl_get_intensity, 138 .get_brightness = kb3886bl_get_intensity,
139 .update_status = kb3886bl_send_intensity, 139 .update_status = kb3886bl_send_intensity,
140}; 140};
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index 6b488b8a7eee..00a9591b0003 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -141,7 +141,7 @@ static int locomolcd_get_intensity(struct backlight_device *bd)
141 return current_intensity; 141 return current_intensity;
142} 142}
143 143
144static struct backlight_ops locomobl_data = { 144static const struct backlight_ops locomobl_data = {
145 .get_brightness = locomolcd_get_intensity, 145 .get_brightness = locomolcd_get_intensity,
146 .update_status = locomolcd_set_intensity, 146 .update_status = locomolcd_set_intensity,
147}; 147};
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c
index 9edb8d7c295f..2e78b0784bdc 100644
--- a/drivers/video/backlight/mbp_nvidia_bl.c
+++ b/drivers/video/backlight/mbp_nvidia_bl.c
@@ -33,7 +33,7 @@ struct dmi_match_data {
33 unsigned long iostart; 33 unsigned long iostart;
34 unsigned long iolen; 34 unsigned long iolen;
35 /* Backlight operations structure. */ 35 /* Backlight operations structure. */
36 struct backlight_ops backlight_ops; 36 const struct backlight_ops backlight_ops;
37}; 37};
38 38
39/* Module parameters. */ 39/* Module parameters. */
@@ -220,6 +220,24 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {
220 }, 220 },
221 { 221 {
222 .callback = mbp_dmi_match, 222 .callback = mbp_dmi_match,
223 .ident = "MacBookPro 5,3",
224 .matches = {
225 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
226 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,3"),
227 },
228 .driver_data = (void *)&nvidia_chipset_data,
229 },
230 {
231 .callback = mbp_dmi_match,
232 .ident = "MacBookPro 5,4",
233 .matches = {
234 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
235 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,4"),
236 },
237 .driver_data = (void *)&nvidia_chipset_data,
238 },
239 {
240 .callback = mbp_dmi_match,
223 .ident = "MacBookPro 5,5", 241 .ident = "MacBookPro 5,5",
224 .matches = { 242 .matches = {
225 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), 243 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c
index 8693e5fcd2eb..a3a7f8938175 100644
--- a/drivers/video/backlight/omap1_bl.c
+++ b/drivers/video/backlight/omap1_bl.c
@@ -125,7 +125,7 @@ static int omapbl_get_intensity(struct backlight_device *dev)
125 return bl->current_intensity; 125 return bl->current_intensity;
126} 126}
127 127
128static struct backlight_ops omapbl_ops = { 128static const struct backlight_ops omapbl_ops = {
129 .get_brightness = omapbl_get_intensity, 129 .get_brightness = omapbl_get_intensity,
130 .update_status = omapbl_update_status, 130 .update_status = omapbl_update_status,
131}; 131};
@@ -139,8 +139,6 @@ static int omapbl_probe(struct platform_device *pdev)
139 if (!pdata) 139 if (!pdata)
140 return -ENXIO; 140 return -ENXIO;
141 141
142 omapbl_ops.check_fb = pdata->check_fb;
143
144 bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL); 142 bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL);
145 if (unlikely(!bl)) 143 if (unlikely(!bl))
146 return -ENOMEM; 144 return -ENOMEM;
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c
index 9edaf24fd82d..075786e05034 100644
--- a/drivers/video/backlight/progear_bl.c
+++ b/drivers/video/backlight/progear_bl.c
@@ -54,7 +54,7 @@ static int progearbl_get_intensity(struct backlight_device *bd)
54 return intensity - HW_LEVEL_MIN; 54 return intensity - HW_LEVEL_MIN;
55} 55}
56 56
57static struct backlight_ops progearbl_ops = { 57static const struct backlight_ops progearbl_ops = {
58 .get_brightness = progearbl_get_intensity, 58 .get_brightness = progearbl_get_intensity,
59 .update_status = progearbl_set_intensity, 59 .update_status = progearbl_set_intensity,
60}; 60};
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 887166267443..9d2ec2a1cce8 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -22,8 +22,10 @@
22 22
23struct pwm_bl_data { 23struct pwm_bl_data {
24 struct pwm_device *pwm; 24 struct pwm_device *pwm;
25 struct device *dev;
25 unsigned int period; 26 unsigned int period;
26 int (*notify)(int brightness); 27 int (*notify)(struct device *,
28 int brightness);
27}; 29};
28 30
29static int pwm_backlight_update_status(struct backlight_device *bl) 31static int pwm_backlight_update_status(struct backlight_device *bl)
@@ -39,7 +41,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
39 brightness = 0; 41 brightness = 0;
40 42
41 if (pb->notify) 43 if (pb->notify)
42 brightness = pb->notify(brightness); 44 brightness = pb->notify(pb->dev, brightness);
43 45
44 if (brightness == 0) { 46 if (brightness == 0) {
45 pwm_config(pb->pwm, 0, pb->period); 47 pwm_config(pb->pwm, 0, pb->period);
@@ -56,7 +58,7 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl)
56 return bl->props.brightness; 58 return bl->props.brightness;
57} 59}
58 60
59static struct backlight_ops pwm_backlight_ops = { 61static const struct backlight_ops pwm_backlight_ops = {
60 .update_status = pwm_backlight_update_status, 62 .update_status = pwm_backlight_update_status,
61 .get_brightness = pwm_backlight_get_brightness, 63 .get_brightness = pwm_backlight_get_brightness,
62}; 64};
@@ -88,6 +90,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
88 90
89 pb->period = data->pwm_period_ns; 91 pb->period = data->pwm_period_ns;
90 pb->notify = data->notify; 92 pb->notify = data->notify;
93 pb->dev = &pdev->dev;
91 94
92 pb->pwm = pwm_request(data->pwm_id, "backlight"); 95 pb->pwm = pwm_request(data->pwm_id, "backlight");
93 if (IS_ERR(pb->pwm)) { 96 if (IS_ERR(pb->pwm)) {
@@ -146,7 +149,7 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
146 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); 149 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
147 150
148 if (pb->notify) 151 if (pb->notify)
149 pb->notify(0); 152 pb->notify(pb->dev, 0);
150 pwm_config(pb->pwm, 0, pb->period); 153 pwm_config(pb->pwm, 0, pb->period);
151 pwm_disable(pb->pwm); 154 pwm_disable(pb->pwm);
152 return 0; 155 return 0;
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index 43edbada12d1..e14ce4d469f5 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -72,7 +72,7 @@ static int tosa_bl_get_brightness(struct backlight_device *dev)
72 return props->brightness; 72 return props->brightness;
73} 73}
74 74
75static struct backlight_ops bl_ops = { 75static const struct backlight_ops bl_ops = {
76 .get_brightness = tosa_bl_get_brightness, 76 .get_brightness = tosa_bl_get_brightness,
77 .update_status = tosa_bl_update_status, 77 .update_status = tosa_bl_update_status,
78}; 78};
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c
index 467bdb7efb23..e32add37a203 100644
--- a/drivers/video/backlight/wm831x_bl.c
+++ b/drivers/video/backlight/wm831x_bl.c
@@ -112,7 +112,7 @@ static int wm831x_backlight_get_brightness(struct backlight_device *bl)
112 return data->current_brightness; 112 return data->current_brightness;
113} 113}
114 114
115static struct backlight_ops wm831x_backlight_ops = { 115static const struct backlight_ops wm831x_backlight_ops = {
116 .options = BL_CORE_SUSPENDRESUME, 116 .options = BL_CORE_SUSPENDRESUME,
117 .update_status = wm831x_backlight_update_status, 117 .update_status = wm831x_backlight_update_status,
118 .get_brightness = wm831x_backlight_get_brightness, 118 .get_brightness = wm831x_backlight_get_brightness,
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index da7c01b39be2..3a561df2e8a2 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1573,15 +1573,15 @@ cyberpro_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1573 if (err) 1573 if (err)
1574 return err; 1574 return err;
1575 1575
1576 err = pci_request_regions(dev, name);
1577 if (err)
1578 return err;
1579
1580 err = -ENOMEM; 1576 err = -ENOMEM;
1581 cfb = cyberpro_alloc_fb_info(id->driver_data, name); 1577 cfb = cyberpro_alloc_fb_info(id->driver_data, name);
1582 if (!cfb) 1578 if (!cfb)
1583 goto failed_release; 1579 goto failed_release;
1584 1580
1581 err = pci_request_regions(dev, cfb->fb.fix.id);
1582 if (err)
1583 goto failed_regions;
1584
1585 cfb->dev = dev; 1585 cfb->dev = dev;
1586 cfb->region = pci_ioremap_bar(dev, 0); 1586 cfb->region = pci_ioremap_bar(dev, 0);
1587 if (!cfb->region) 1587 if (!cfb->region)
@@ -1633,10 +1633,10 @@ cyberpro_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1633failed: 1633failed:
1634 iounmap(cfb->region); 1634 iounmap(cfb->region);
1635failed_ioremap: 1635failed_ioremap:
1636 pci_release_regions(dev);
1637failed_regions:
1636 cyberpro_free_fb_info(cfb); 1638 cyberpro_free_fb_info(cfb);
1637failed_release: 1639failed_release:
1638 pci_release_regions(dev);
1639
1640 return err; 1640 return err;
1641} 1641}
1642 1642
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index c7c6455f1fa8..e192b058a688 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -189,11 +189,6 @@ static struct {
189 struct omapfb_color_key color_key; 189 struct omapfb_color_key color_key;
190} dispc; 190} dispc;
191 191
192static struct platform_device omapdss_device = {
193 .name = "omapdss",
194 .id = -1,
195};
196
197static void enable_lcd_clocks(int enable); 192static void enable_lcd_clocks(int enable);
198 193
199static void inline dispc_write_reg(int idx, u32 val) 194static void inline dispc_write_reg(int idx, u32 val)
@@ -920,20 +915,20 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *dev)
920 915
921static int get_dss_clocks(void) 916static int get_dss_clocks(void)
922{ 917{
923 dispc.dss_ick = clk_get(&omapdss_device.dev, "ick"); 918 dispc.dss_ick = clk_get(&dispc.fbdev->dssdev->dev, "ick");
924 if (IS_ERR(dispc.dss_ick)) { 919 if (IS_ERR(dispc.dss_ick)) {
925 dev_err(dispc.fbdev->dev, "can't get ick\n"); 920 dev_err(dispc.fbdev->dev, "can't get ick\n");
926 return PTR_ERR(dispc.dss_ick); 921 return PTR_ERR(dispc.dss_ick);
927 } 922 }
928 923
929 dispc.dss1_fck = clk_get(&omapdss_device.dev, "dss1_fck"); 924 dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck");
930 if (IS_ERR(dispc.dss1_fck)) { 925 if (IS_ERR(dispc.dss1_fck)) {
931 dev_err(dispc.fbdev->dev, "can't get dss1_fck\n"); 926 dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
932 clk_put(dispc.dss_ick); 927 clk_put(dispc.dss_ick);
933 return PTR_ERR(dispc.dss1_fck); 928 return PTR_ERR(dispc.dss1_fck);
934 } 929 }
935 930
936 dispc.dss_54m_fck = clk_get(&omapdss_device.dev, "tv_fck"); 931 dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "tv_fck");
937 if (IS_ERR(dispc.dss_54m_fck)) { 932 if (IS_ERR(dispc.dss_54m_fck)) {
938 dev_err(dispc.fbdev->dev, "can't get tv_fck\n"); 933 dev_err(dispc.fbdev->dev, "can't get tv_fck\n");
939 clk_put(dispc.dss_ick); 934 clk_put(dispc.dss_ick);
@@ -1385,12 +1380,6 @@ static int omap_dispc_init(struct omapfb_device *fbdev, int ext_mode,
1385 int skip_init = 0; 1380 int skip_init = 0;
1386 int i; 1381 int i;
1387 1382
1388 r = platform_device_register(&omapdss_device);
1389 if (r) {
1390 dev_err(fbdev->dev, "can't register omapdss device\n");
1391 return r;
1392 }
1393
1394 memset(&dispc, 0, sizeof(dispc)); 1383 memset(&dispc, 0, sizeof(dispc));
1395 1384
1396 dispc.base = ioremap(DISPC_BASE, SZ_1K); 1385 dispc.base = ioremap(DISPC_BASE, SZ_1K);
@@ -1534,7 +1523,6 @@ static void omap_dispc_cleanup(void)
1534 free_irq(INT_24XX_DSS_IRQ, dispc.fbdev); 1523 free_irq(INT_24XX_DSS_IRQ, dispc.fbdev);
1535 put_dss_clocks(); 1524 put_dss_clocks();
1536 iounmap(dispc.base); 1525 iounmap(dispc.base);
1537 platform_device_unregister(&omapdss_device);
1538} 1526}
1539 1527
1540const struct lcd_ctrl omap2_int_ctrl = { 1528const struct lcd_ctrl omap2_int_ctrl = {
diff --git a/drivers/video/omap/lcd_htcherald.c b/drivers/video/omap/lcd_htcherald.c
index a9007c5d1fad..4802419da83b 100644
--- a/drivers/video/omap/lcd_htcherald.c
+++ b/drivers/video/omap/lcd_htcherald.c
@@ -115,12 +115,12 @@ struct platform_driver htcherald_panel_driver = {
115 }, 115 },
116}; 116};
117 117
118static int htcherald_panel_drv_init(void) 118static int __init htcherald_panel_drv_init(void)
119{ 119{
120 return platform_driver_register(&htcherald_panel_driver); 120 return platform_driver_register(&htcherald_panel_driver);
121} 121}
122 122
123static void htcherald_panel_drv_cleanup(void) 123static void __exit htcherald_panel_drv_cleanup(void)
124{ 124{
125 platform_driver_unregister(&htcherald_panel_driver); 125 platform_driver_unregister(&htcherald_panel_driver);
126} 126}
diff --git a/drivers/video/omap/lcd_ldp.c b/drivers/video/omap/lcd_ldp.c
index 5bb7f6f14601..0f5952cae85e 100644
--- a/drivers/video/omap/lcd_ldp.c
+++ b/drivers/video/omap/lcd_ldp.c
@@ -24,7 +24,7 @@
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/delay.h> 26#include <linux/delay.h>
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl.h>
28 28
29#include <mach/gpio.h> 29#include <mach/gpio.h>
30#include <plat/mux.h> 30#include <plat/mux.h>
@@ -59,7 +59,7 @@
59#define TWL4030_VPLL2_DEV_GRP 0x33 59#define TWL4030_VPLL2_DEV_GRP 0x33
60#define TWL4030_VPLL2_DEDICATED 0x36 60#define TWL4030_VPLL2_DEDICATED 0x36
61 61
62#define t2_out(c, r, v) twl4030_i2c_write_u8(c, r, v) 62#define t2_out(c, r, v) twl_i2c_write_u8(c, r, v)
63 63
64 64
65static int ldp_panel_init(struct lcd_panel *panel, 65static int ldp_panel_init(struct lcd_panel *panel,
diff --git a/drivers/video/omap/lcd_omap2evm.c b/drivers/video/omap/lcd_omap2evm.c
index 006c2fe7360e..7e7a65c08452 100644
--- a/drivers/video/omap/lcd_omap2evm.c
+++ b/drivers/video/omap/lcd_omap2evm.c
@@ -24,7 +24,7 @@
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/gpio.h> 26#include <linux/gpio.h>
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl.h>
28 28
29#include <plat/mux.h> 29#include <plat/mux.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
@@ -61,9 +61,9 @@ static int omap2evm_panel_init(struct lcd_panel *panel,
61 gpio_direction_output(LCD_PANEL_LR, 1); 61 gpio_direction_output(LCD_PANEL_LR, 1);
62 gpio_direction_output(LCD_PANEL_UD, 1); 62 gpio_direction_output(LCD_PANEL_UD, 1);
63 63
64 twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN); 64 twl_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
65 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON); 65 twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
66 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF); 66 twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
67 bklight_level = 100; 67 bklight_level = 100;
68 68
69 return 0; 69 return 0;
@@ -101,7 +101,7 @@ static int omap2evm_bklight_setlevel(struct lcd_panel *panel,
101 u8 c; 101 u8 c;
102 if ((level >= 0) && (level <= 100)) { 102 if ((level >= 0) && (level <= 100)) {
103 c = (125 * (100 - level)) / 100 + 2; 103 c = (125 * (100 - level)) / 100 + 2;
104 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF); 104 twl_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF);
105 bklight_level = level; 105 bklight_level = level;
106 } 106 }
107 return 0; 107 return 0;
diff --git a/drivers/video/omap/lcd_omap3beagle.c b/drivers/video/omap/lcd_omap3beagle.c
index fc503d8f3c24..ca75cc2a87a5 100644
--- a/drivers/video/omap/lcd_omap3beagle.c
+++ b/drivers/video/omap/lcd_omap3beagle.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/i2c/twl4030.h> 26#include <linux/i2c/twl.h>
27 27
28#include <plat/mux.h> 28#include <plat/mux.h>
29#include <plat/mux.h> 29#include <plat/mux.h>
diff --git a/drivers/video/omap/lcd_omap3evm.c b/drivers/video/omap/lcd_omap3evm.c
index ae2edc4081a8..06840da0b094 100644
--- a/drivers/video/omap/lcd_omap3evm.c
+++ b/drivers/video/omap/lcd_omap3evm.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/i2c/twl4030.h> 26#include <linux/i2c/twl.h>
27 27
28#include <plat/mux.h> 28#include <plat/mux.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -63,9 +63,9 @@ static int omap3evm_panel_init(struct lcd_panel *panel,
63 gpio_direction_output(LCD_PANEL_LR, 1); 63 gpio_direction_output(LCD_PANEL_LR, 1);
64 gpio_direction_output(LCD_PANEL_UD, 1); 64 gpio_direction_output(LCD_PANEL_UD, 1);
65 65
66 twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN); 66 twl_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
67 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON); 67 twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
68 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF); 68 twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
69 bklight_level = 100; 69 bklight_level = 100;
70 70
71 return 0; 71 return 0;
@@ -102,7 +102,7 @@ static int omap3evm_bklight_setlevel(struct lcd_panel *panel,
102 u8 c; 102 u8 c;
103 if ((level >= 0) && (level <= 100)) { 103 if ((level >= 0) && (level <= 100)) {
104 c = (125 * (100 - level)) / 100 + 2; 104 c = (125 * (100 - level)) / 100 + 2;
105 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF); 105 twl_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF);
106 bklight_level = level; 106 bklight_level = level;
107 } 107 }
108 return 0; 108 return 0;
diff --git a/drivers/video/omap/lcd_overo.c b/drivers/video/omap/lcd_overo.c
index 56ee192e9ee2..564933ffac6e 100644
--- a/drivers/video/omap/lcd_overo.c
+++ b/drivers/video/omap/lcd_overo.c
@@ -21,7 +21,7 @@
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/i2c/twl4030.h> 24#include <linux/i2c/twl.h>
25 25
26#include <mach/gpio.h> 26#include <mach/gpio.h>
27#include <plat/mux.h> 27#include <plat/mux.h>
diff --git a/drivers/video/omap/omapfb.h b/drivers/video/omap/omapfb.h
index 46e4714014e8..af3c9e571ec3 100644
--- a/drivers/video/omap/omapfb.h
+++ b/drivers/video/omap/omapfb.h
@@ -203,6 +203,8 @@ struct omapfb_device {
203 203
204 struct omapfb_mem_desc mem_desc; 204 struct omapfb_mem_desc mem_desc;
205 struct fb_info *fb_info[OMAPFB_PLANE_NUM]; 205 struct fb_info *fb_info[OMAPFB_PLANE_NUM];
206
207 struct platform_device *dssdev; /* dummy dev for clocks */
206}; 208};
207 209
208#ifdef CONFIG_ARCH_OMAP1 210#ifdef CONFIG_ARCH_OMAP1
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index c7f59a5ccdbc..2c4f470fa086 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -83,6 +83,19 @@ static struct caps_table_struct color_caps[] = {
83 { 1 << OMAPFB_COLOR_YUY422, "YUY422", }, 83 { 1 << OMAPFB_COLOR_YUY422, "YUY422", },
84}; 84};
85 85
86static void omapdss_release(struct device *dev)
87{
88}
89
90/* dummy device for clocks */
91static struct platform_device omapdss_device = {
92 .name = "omapdss",
93 .id = -1,
94 .dev = {
95 .release = omapdss_release,
96 },
97};
98
86/* 99/*
87 * --------------------------------------------------------------------------- 100 * ---------------------------------------------------------------------------
88 * LCD panel 101 * LCD panel
@@ -1700,6 +1713,7 @@ static int omapfb_do_probe(struct platform_device *pdev,
1700 1713
1701 fbdev->dev = &pdev->dev; 1714 fbdev->dev = &pdev->dev;
1702 fbdev->panel = panel; 1715 fbdev->panel = panel;
1716 fbdev->dssdev = &omapdss_device;
1703 platform_set_drvdata(pdev, fbdev); 1717 platform_set_drvdata(pdev, fbdev);
1704 1718
1705 mutex_init(&fbdev->rqueue_mutex); 1719 mutex_init(&fbdev->rqueue_mutex);
@@ -1814,8 +1828,16 @@ cleanup:
1814 1828
1815static int omapfb_probe(struct platform_device *pdev) 1829static int omapfb_probe(struct platform_device *pdev)
1816{ 1830{
1831 int r;
1832
1817 BUG_ON(fbdev_pdev != NULL); 1833 BUG_ON(fbdev_pdev != NULL);
1818 1834
1835 r = platform_device_register(&omapdss_device);
1836 if (r) {
1837 dev_err(&pdev->dev, "can't register omapdss device\n");
1838 return r;
1839 }
1840
1819 /* Delay actual initialization until the LCD is registered */ 1841 /* Delay actual initialization until the LCD is registered */
1820 fbdev_pdev = pdev; 1842 fbdev_pdev = pdev;
1821 if (fbdev_panel != NULL) 1843 if (fbdev_panel != NULL)
@@ -1843,6 +1865,9 @@ static int omapfb_remove(struct platform_device *pdev)
1843 fbdev->state = OMAPFB_DISABLED; 1865 fbdev->state = OMAPFB_DISABLED;
1844 omapfb_free_resources(fbdev, saved_state); 1866 omapfb_free_resources(fbdev, saved_state);
1845 1867
1868 platform_device_unregister(&omapdss_device);
1869 fbdev->dssdev = NULL;
1870
1846 return 0; 1871 return 0;
1847} 1872}
1848 1873
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index fed7b1bda19c..1162603c72e5 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -83,13 +83,13 @@ static inline u32 rfbi_read_reg(int idx)
83 83
84static int rfbi_get_clocks(void) 84static int rfbi_get_clocks(void)
85{ 85{
86 rfbi.dss_ick = clk_get(rfbi.fbdev->dev, "ick"); 86 rfbi.dss_ick = clk_get(&dispc.fbdev->dssdev->dev, "ick");
87 if (IS_ERR(rfbi.dss_ick)) { 87 if (IS_ERR(rfbi.dss_ick)) {
88 dev_err(rfbi.fbdev->dev, "can't get ick\n"); 88 dev_err(rfbi.fbdev->dev, "can't get ick\n");
89 return PTR_ERR(rfbi.dss_ick); 89 return PTR_ERR(rfbi.dss_ick);
90 } 90 }
91 91
92 rfbi.dss1_fck = clk_get(rfbi.fbdev->dev, "dss1_fck"); 92 rfbi.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck");
93 if (IS_ERR(rfbi.dss1_fck)) { 93 if (IS_ERR(rfbi.dss1_fck)) {
94 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n"); 94 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
95 clk_put(rfbi.dss_ick); 95 clk_put(rfbi.dss_ick);
diff --git a/drivers/video/omap2/dss/Kconfig b/drivers/video/omap2/dss/Kconfig
index 71d8dec30635..c63ce767b277 100644
--- a/drivers/video/omap2/dss/Kconfig
+++ b/drivers/video/omap2/dss/Kconfig
@@ -25,6 +25,13 @@ config OMAP2_DSS_DEBUG_SUPPORT
25 This enables debug messages. You need to enable printing 25 This enables debug messages. You need to enable printing
26 with 'debug' module parameter. 26 with 'debug' module parameter.
27 27
28config OMAP2_DSS_COLLECT_IRQ_STATS
29 bool "Collect DSS IRQ statistics"
30 depends on OMAP2_DSS_DEBUG_SUPPORT
31 default n
32 help
33 Collect DSS IRQ statistics, printable via debugfs
34
28config OMAP2_DSS_RFBI 35config OMAP2_DSS_RFBI
29 bool "RFBI support" 36 bool "RFBI support"
30 default n 37 default n
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 29497a0c9a91..82918eec6d2e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -124,6 +124,7 @@ static void restore_all_ctx(void)
124 dss_clk_disable_all_no_ctx(); 124 dss_clk_disable_all_no_ctx();
125} 125}
126 126
127#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
127/* CLOCKS */ 128/* CLOCKS */
128static void core_dump_clocks(struct seq_file *s) 129static void core_dump_clocks(struct seq_file *s)
129{ 130{
@@ -149,6 +150,7 @@ static void core_dump_clocks(struct seq_file *s)
149 clocks[i]->usecount); 150 clocks[i]->usecount);
150 } 151 }
151} 152}
153#endif /* defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) */
152 154
153static int dss_get_clock(struct clk **clock, const char *clk_name) 155static int dss_get_clock(struct clk **clock, const char *clk_name)
154{ 156{
@@ -395,6 +397,14 @@ static int dss_initialize_debugfs(void)
395 debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, 397 debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
396 &dss_debug_dump_clocks, &dss_debug_fops); 398 &dss_debug_dump_clocks, &dss_debug_fops);
397 399
400 debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir,
401 &dispc_dump_irqs, &dss_debug_fops);
402
403#ifdef CONFIG_OMAP2_DSS_DSI
404 debugfs_create_file("dsi_irq", S_IRUGO, dss_debugfs_dir,
405 &dsi_dump_irqs, &dss_debug_fops);
406#endif
407
398 debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir, 408 debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir,
399 &dss_dump_regs, &dss_debug_fops); 409 &dss_dump_regs, &dss_debug_fops);
400 debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir, 410 debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir,
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 6dabf4b2f005..de8bfbac9e26 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -148,6 +148,12 @@ static const struct dispc_reg dispc_reg_att[] = { DISPC_GFX_ATTRIBUTES,
148 DISPC_VID_ATTRIBUTES(0), 148 DISPC_VID_ATTRIBUTES(0),
149 DISPC_VID_ATTRIBUTES(1) }; 149 DISPC_VID_ATTRIBUTES(1) };
150 150
151struct dispc_irq_stats {
152 unsigned long last_reset;
153 unsigned irq_count;
154 unsigned irqs[32];
155};
156
151static struct { 157static struct {
152 void __iomem *base; 158 void __iomem *base;
153 159
@@ -160,6 +166,11 @@ static struct {
160 struct work_struct error_work; 166 struct work_struct error_work;
161 167
162 u32 ctx[DISPC_SZ_REGS / sizeof(u32)]; 168 u32 ctx[DISPC_SZ_REGS / sizeof(u32)];
169
170#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
171 spinlock_t irq_stats_lock;
172 struct dispc_irq_stats irq_stats;
173#endif
163} dispc; 174} dispc;
164 175
165static void _omap_dispc_set_irqs(void); 176static void _omap_dispc_set_irqs(void);
@@ -1443,7 +1454,10 @@ static unsigned long calc_fclk_five_taps(u16 width, u16 height,
1443 do_div(tmp, 2 * out_height * ppl); 1454 do_div(tmp, 2 * out_height * ppl);
1444 fclk = tmp; 1455 fclk = tmp;
1445 1456
1446 if (height > 2 * out_height && ppl != out_width) { 1457 if (height > 2 * out_height) {
1458 if (ppl == out_width)
1459 return 0;
1460
1447 tmp = pclk * (height - 2 * out_height) * out_width; 1461 tmp = pclk * (height - 2 * out_height) * out_width;
1448 do_div(tmp, 2 * out_height * (ppl - out_width)); 1462 do_div(tmp, 2 * out_height * (ppl - out_width));
1449 fclk = max(fclk, (u32) tmp); 1463 fclk = max(fclk, (u32) tmp);
@@ -1623,7 +1637,7 @@ static int _dispc_setup_plane(enum omap_plane plane,
1623 DSSDBG("required fclk rate = %lu Hz\n", fclk); 1637 DSSDBG("required fclk rate = %lu Hz\n", fclk);
1624 DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate()); 1638 DSSDBG("current fclk rate = %lu Hz\n", dispc_fclk_rate());
1625 1639
1626 if (fclk > dispc_fclk_rate()) { 1640 if (!fclk || fclk > dispc_fclk_rate()) {
1627 DSSERR("failed to set up scaling, " 1641 DSSERR("failed to set up scaling, "
1628 "required fclk rate = %lu Hz, " 1642 "required fclk rate = %lu Hz, "
1629 "current fclk rate = %lu Hz\n", 1643 "current fclk rate = %lu Hz\n",
@@ -2247,6 +2261,50 @@ void dispc_dump_clocks(struct seq_file *s)
2247 enable_clocks(0); 2261 enable_clocks(0);
2248} 2262}
2249 2263
2264#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
2265void dispc_dump_irqs(struct seq_file *s)
2266{
2267 unsigned long flags;
2268 struct dispc_irq_stats stats;
2269
2270 spin_lock_irqsave(&dispc.irq_stats_lock, flags);
2271
2272 stats = dispc.irq_stats;
2273 memset(&dispc.irq_stats, 0, sizeof(dispc.irq_stats));
2274 dispc.irq_stats.last_reset = jiffies;
2275
2276 spin_unlock_irqrestore(&dispc.irq_stats_lock, flags);
2277
2278 seq_printf(s, "period %u ms\n",
2279 jiffies_to_msecs(jiffies - stats.last_reset));
2280
2281 seq_printf(s, "irqs %d\n", stats.irq_count);
2282#define PIS(x) \
2283 seq_printf(s, "%-20s %10d\n", #x, stats.irqs[ffs(DISPC_IRQ_##x)-1]);
2284
2285 PIS(FRAMEDONE);
2286 PIS(VSYNC);
2287 PIS(EVSYNC_EVEN);
2288 PIS(EVSYNC_ODD);
2289 PIS(ACBIAS_COUNT_STAT);
2290 PIS(PROG_LINE_NUM);
2291 PIS(GFX_FIFO_UNDERFLOW);
2292 PIS(GFX_END_WIN);
2293 PIS(PAL_GAMMA_MASK);
2294 PIS(OCP_ERR);
2295 PIS(VID1_FIFO_UNDERFLOW);
2296 PIS(VID1_END_WIN);
2297 PIS(VID2_FIFO_UNDERFLOW);
2298 PIS(VID2_END_WIN);
2299 PIS(SYNC_LOST);
2300 PIS(SYNC_LOST_DIGIT);
2301 PIS(WAKEUP);
2302#undef PIS
2303}
2304#else
2305void dispc_dump_irqs(struct seq_file *s) { }
2306#endif
2307
2250void dispc_dump_regs(struct seq_file *s) 2308void dispc_dump_regs(struct seq_file *s)
2251{ 2309{
2252#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dispc_read_reg(r)) 2310#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dispc_read_reg(r))
@@ -2665,6 +2723,13 @@ void dispc_irq_handler(void)
2665 2723
2666 irqstatus = dispc_read_reg(DISPC_IRQSTATUS); 2724 irqstatus = dispc_read_reg(DISPC_IRQSTATUS);
2667 2725
2726#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
2727 spin_lock(&dispc.irq_stats_lock);
2728 dispc.irq_stats.irq_count++;
2729 dss_collect_irq_stats(irqstatus, dispc.irq_stats.irqs);
2730 spin_unlock(&dispc.irq_stats_lock);
2731#endif
2732
2668#ifdef DEBUG 2733#ifdef DEBUG
2669 if (dss_debug) 2734 if (dss_debug)
2670 print_irq_status(irqstatus); 2735 print_irq_status(irqstatus);
@@ -3012,6 +3077,11 @@ int dispc_init(void)
3012 3077
3013 spin_lock_init(&dispc.irq_lock); 3078 spin_lock_init(&dispc.irq_lock);
3014 3079
3080#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
3081 spin_lock_init(&dispc.irq_stats_lock);
3082 dispc.irq_stats.last_reset = jiffies;
3083#endif
3084
3015 INIT_WORK(&dispc.error_work, dispc_error_worker); 3085 INIT_WORK(&dispc.error_work, dispc_error_worker);
3016 3086
3017 dispc.base = ioremap(DISPC_BASE, DISPC_SZ_REGS); 3087 dispc.base = ioremap(DISPC_BASE, DISPC_SZ_REGS);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 5936487b5def..6122178f5f85 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -204,6 +204,14 @@ struct dsi_update_region {
204 struct omap_dss_device *device; 204 struct omap_dss_device *device;
205}; 205};
206 206
207struct dsi_irq_stats {
208 unsigned long last_reset;
209 unsigned irq_count;
210 unsigned dsi_irqs[32];
211 unsigned vc_irqs[4][32];
212 unsigned cio_irqs[32];
213};
214
207static struct 215static struct
208{ 216{
209 void __iomem *base; 217 void __iomem *base;
@@ -258,6 +266,11 @@ static struct
258#endif 266#endif
259 int debug_read; 267 int debug_read;
260 int debug_write; 268 int debug_write;
269
270#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
271 spinlock_t irq_stats_lock;
272 struct dsi_irq_stats irq_stats;
273#endif
261} dsi; 274} dsi;
262 275
263#ifdef DEBUG 276#ifdef DEBUG
@@ -528,6 +541,12 @@ void dsi_irq_handler(void)
528 541
529 irqstatus = dsi_read_reg(DSI_IRQSTATUS); 542 irqstatus = dsi_read_reg(DSI_IRQSTATUS);
530 543
544#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
545 spin_lock(&dsi.irq_stats_lock);
546 dsi.irq_stats.irq_count++;
547 dss_collect_irq_stats(irqstatus, dsi.irq_stats.dsi_irqs);
548#endif
549
531 if (irqstatus & DSI_IRQ_ERROR_MASK) { 550 if (irqstatus & DSI_IRQ_ERROR_MASK) {
532 DSSERR("DSI error, irqstatus %x\n", irqstatus); 551 DSSERR("DSI error, irqstatus %x\n", irqstatus);
533 print_irq_status(irqstatus); 552 print_irq_status(irqstatus);
@@ -549,6 +568,10 @@ void dsi_irq_handler(void)
549 568
550 vcstatus = dsi_read_reg(DSI_VC_IRQSTATUS(i)); 569 vcstatus = dsi_read_reg(DSI_VC_IRQSTATUS(i));
551 570
571#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
572 dss_collect_irq_stats(vcstatus, dsi.irq_stats.vc_irqs[i]);
573#endif
574
552 if (vcstatus & DSI_VC_IRQ_BTA) 575 if (vcstatus & DSI_VC_IRQ_BTA)
553 complete(&dsi.bta_completion); 576 complete(&dsi.bta_completion);
554 577
@@ -568,6 +591,10 @@ void dsi_irq_handler(void)
568 if (irqstatus & DSI_IRQ_COMPLEXIO_ERR) { 591 if (irqstatus & DSI_IRQ_COMPLEXIO_ERR) {
569 ciostatus = dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS); 592 ciostatus = dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
570 593
594#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
595 dss_collect_irq_stats(ciostatus, dsi.irq_stats.cio_irqs);
596#endif
597
571 dsi_write_reg(DSI_COMPLEXIO_IRQ_STATUS, ciostatus); 598 dsi_write_reg(DSI_COMPLEXIO_IRQ_STATUS, ciostatus);
572 /* flush posted write */ 599 /* flush posted write */
573 dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS); 600 dsi_read_reg(DSI_COMPLEXIO_IRQ_STATUS);
@@ -579,6 +606,10 @@ void dsi_irq_handler(void)
579 dsi_write_reg(DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK); 606 dsi_write_reg(DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK);
580 /* flush posted write */ 607 /* flush posted write */
581 dsi_read_reg(DSI_IRQSTATUS); 608 dsi_read_reg(DSI_IRQSTATUS);
609
610#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
611 spin_unlock(&dsi.irq_stats_lock);
612#endif
582} 613}
583 614
584 615
@@ -797,12 +828,12 @@ static int dsi_pll_power(enum dsi_pll_power_state state)
797 828
798 /* PLL_PWR_STATUS */ 829 /* PLL_PWR_STATUS */
799 while (FLD_GET(dsi_read_reg(DSI_CLK_CTRL), 29, 28) != state) { 830 while (FLD_GET(dsi_read_reg(DSI_CLK_CTRL), 29, 28) != state) {
800 udelay(1); 831 if (++t > 1000) {
801 if (t++ > 1000) {
802 DSSERR("Failed to set DSI PLL power mode to %d\n", 832 DSSERR("Failed to set DSI PLL power mode to %d\n",
803 state); 833 state);
804 return -ENODEV; 834 return -ENODEV;
805 } 835 }
836 udelay(1);
806 } 837 }
807 838
808 return 0; 839 return 0;
@@ -1226,6 +1257,95 @@ void dsi_dump_clocks(struct seq_file *s)
1226 enable_clocks(0); 1257 enable_clocks(0);
1227} 1258}
1228 1259
1260#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
1261void dsi_dump_irqs(struct seq_file *s)
1262{
1263 unsigned long flags;
1264 struct dsi_irq_stats stats;
1265
1266 spin_lock_irqsave(&dsi.irq_stats_lock, flags);
1267
1268 stats = dsi.irq_stats;
1269 memset(&dsi.irq_stats, 0, sizeof(dsi.irq_stats));
1270 dsi.irq_stats.last_reset = jiffies;
1271
1272 spin_unlock_irqrestore(&dsi.irq_stats_lock, flags);
1273
1274 seq_printf(s, "period %u ms\n",
1275 jiffies_to_msecs(jiffies - stats.last_reset));
1276
1277 seq_printf(s, "irqs %d\n", stats.irq_count);
1278#define PIS(x) \
1279 seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]);
1280
1281 seq_printf(s, "-- DSI interrupts --\n");
1282 PIS(VC0);
1283 PIS(VC1);
1284 PIS(VC2);
1285 PIS(VC3);
1286 PIS(WAKEUP);
1287 PIS(RESYNC);
1288 PIS(PLL_LOCK);
1289 PIS(PLL_UNLOCK);
1290 PIS(PLL_RECALL);
1291 PIS(COMPLEXIO_ERR);
1292 PIS(HS_TX_TIMEOUT);
1293 PIS(LP_RX_TIMEOUT);
1294 PIS(TE_TRIGGER);
1295 PIS(ACK_TRIGGER);
1296 PIS(SYNC_LOST);
1297 PIS(LDO_POWER_GOOD);
1298 PIS(TA_TIMEOUT);
1299#undef PIS
1300
1301#define PIS(x) \
1302 seq_printf(s, "%-20s %10d %10d %10d %10d\n", #x, \
1303 stats.vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \
1304 stats.vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \
1305 stats.vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \
1306 stats.vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]);
1307
1308 seq_printf(s, "-- VC interrupts --\n");
1309 PIS(CS);
1310 PIS(ECC_CORR);
1311 PIS(PACKET_SENT);
1312 PIS(FIFO_TX_OVF);
1313 PIS(FIFO_RX_OVF);
1314 PIS(BTA);
1315 PIS(ECC_NO_CORR);
1316 PIS(FIFO_TX_UDF);
1317 PIS(PP_BUSY_CHANGE);
1318#undef PIS
1319
1320#define PIS(x) \
1321 seq_printf(s, "%-20s %10d\n", #x, \
1322 stats.cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]);
1323
1324 seq_printf(s, "-- CIO interrupts --\n");
1325 PIS(ERRSYNCESC1);
1326 PIS(ERRSYNCESC2);
1327 PIS(ERRSYNCESC3);
1328 PIS(ERRESC1);
1329 PIS(ERRESC2);
1330 PIS(ERRESC3);
1331 PIS(ERRCONTROL1);
1332 PIS(ERRCONTROL2);
1333 PIS(ERRCONTROL3);
1334 PIS(STATEULPS1);
1335 PIS(STATEULPS2);
1336 PIS(STATEULPS3);
1337 PIS(ERRCONTENTIONLP0_1);
1338 PIS(ERRCONTENTIONLP1_1);
1339 PIS(ERRCONTENTIONLP0_2);
1340 PIS(ERRCONTENTIONLP1_2);
1341 PIS(ERRCONTENTIONLP0_3);
1342 PIS(ERRCONTENTIONLP1_3);
1343 PIS(ULPSACTIVENOT_ALL0);
1344 PIS(ULPSACTIVENOT_ALL1);
1345#undef PIS
1346}
1347#endif
1348
1229void dsi_dump_regs(struct seq_file *s) 1349void dsi_dump_regs(struct seq_file *s)
1230{ 1350{
1231#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(r)) 1351#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(r))
@@ -1321,12 +1441,12 @@ static int dsi_complexio_power(enum dsi_complexio_power_state state)
1321 1441
1322 /* PWR_STATUS */ 1442 /* PWR_STATUS */
1323 while (FLD_GET(dsi_read_reg(DSI_COMPLEXIO_CFG1), 26, 25) != state) { 1443 while (FLD_GET(dsi_read_reg(DSI_COMPLEXIO_CFG1), 26, 25) != state) {
1324 udelay(1); 1444 if (++t > 1000) {
1325 if (t++ > 1000) {
1326 DSSERR("failed to set complexio power state to " 1445 DSSERR("failed to set complexio power state to "
1327 "%d\n", state); 1446 "%d\n", state);
1328 return -ENODEV; 1447 return -ENODEV;
1329 } 1448 }
1449 udelay(1);
1330 } 1450 }
1331 1451
1332 return 0; 1452 return 0;
@@ -1526,10 +1646,10 @@ static void dsi_complexio_uninit(void)
1526 1646
1527static int _dsi_wait_reset(void) 1647static int _dsi_wait_reset(void)
1528{ 1648{
1529 int i = 0; 1649 int t = 0;
1530 1650
1531 while (REG_GET(DSI_SYSSTATUS, 0, 0) == 0) { 1651 while (REG_GET(DSI_SYSSTATUS, 0, 0) == 0) {
1532 if (i++ > 5) { 1652 if (++t > 5) {
1533 DSSERR("soft reset failed\n"); 1653 DSSERR("soft reset failed\n");
1534 return -ENODEV; 1654 return -ENODEV;
1535 } 1655 }
@@ -1999,7 +2119,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc)
1999 return -EINVAL; 2119 return -EINVAL;
2000 } 2120 }
2001 2121
2002 data_id = data_type | channel << 6; 2122 data_id = data_type | dsi.vc[channel].dest_per << 6;
2003 2123
2004 r = (data_id << 0) | (data << 8) | (ecc << 24); 2124 r = (data_id << 0) | (data << 8) | (ecc << 24);
2005 2125
@@ -2011,7 +2131,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc)
2011int dsi_vc_send_null(int channel) 2131int dsi_vc_send_null(int channel)
2012{ 2132{
2013 u8 nullpkg[] = {0, 0, 0, 0}; 2133 u8 nullpkg[] = {0, 0, 0, 0};
2014 return dsi_vc_send_long(0, DSI_DT_NULL_PACKET, nullpkg, 4, 0); 2134 return dsi_vc_send_long(channel, DSI_DT_NULL_PACKET, nullpkg, 4, 0);
2015} 2135}
2016EXPORT_SYMBOL(dsi_vc_send_null); 2136EXPORT_SYMBOL(dsi_vc_send_null);
2017 2137
@@ -2058,7 +2178,7 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen)
2058 int r; 2178 int r;
2059 2179
2060 if (dsi.debug_read) 2180 if (dsi.debug_read)
2061 DSSDBG("dsi_vc_dcs_read(ch%d, dcs_cmd %u)\n", channel, dcs_cmd); 2181 DSSDBG("dsi_vc_dcs_read(ch%d, dcs_cmd %x)\n", channel, dcs_cmd);
2062 2182
2063 r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0); 2183 r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0);
2064 if (r) 2184 if (r)
@@ -2586,7 +2706,6 @@ static int dsi_update_screen_l4(struct omap_dss_device *dssdev,
2586 /* using fifo not empty */ 2706 /* using fifo not empty */
2587 /* TX_FIFO_NOT_EMPTY */ 2707 /* TX_FIFO_NOT_EMPTY */
2588 while (FLD_GET(dsi_read_reg(DSI_VC_CTRL(0)), 5, 5)) { 2708 while (FLD_GET(dsi_read_reg(DSI_VC_CTRL(0)), 5, 5)) {
2589 udelay(1);
2590 fifo_stalls++; 2709 fifo_stalls++;
2591 if (fifo_stalls > 0xfffff) { 2710 if (fifo_stalls > 0xfffff) {
2592 DSSERR("fifo stalls overflow, pixels left %d\n", 2711 DSSERR("fifo stalls overflow, pixels left %d\n",
@@ -2594,6 +2713,7 @@ static int dsi_update_screen_l4(struct omap_dss_device *dssdev,
2594 dsi_if_enable(0); 2713 dsi_if_enable(0);
2595 return -EIO; 2714 return -EIO;
2596 } 2715 }
2716 udelay(1);
2597 } 2717 }
2598#elif 1 2718#elif 1
2599 /* using fifo emptiness */ 2719 /* using fifo emptiness */
@@ -2812,11 +2932,15 @@ static int dsi_set_update_mode(struct omap_dss_device *dssdev,
2812 2932
2813static int dsi_set_te(struct omap_dss_device *dssdev, bool enable) 2933static int dsi_set_te(struct omap_dss_device *dssdev, bool enable)
2814{ 2934{
2815 int r; 2935 int r = 0;
2816 r = dssdev->driver->enable_te(dssdev, enable); 2936
2817 /* XXX for some reason, DSI TE breaks if we don't wait here. 2937 if (dssdev->driver->enable_te) {
2818 * Panel bug? Needs more studying */ 2938 r = dssdev->driver->enable_te(dssdev, enable);
2819 msleep(100); 2939 /* XXX for some reason, DSI TE breaks if we don't wait here.
2940 * Panel bug? Needs more studying */
2941 msleep(100);
2942 }
2943
2820 return r; 2944 return r;
2821} 2945}
2822 2946
@@ -3637,6 +3761,11 @@ int dsi_init(struct platform_device *pdev)
3637 spin_lock_init(&dsi.errors_lock); 3761 spin_lock_init(&dsi.errors_lock);
3638 dsi.errors = 0; 3762 dsi.errors = 0;
3639 3763
3764#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
3765 spin_lock_init(&dsi.irq_stats_lock);
3766 dsi.irq_stats.last_reset = jiffies;
3767#endif
3768
3640 init_completion(&dsi.bta_completion); 3769 init_completion(&dsi.bta_completion);
3641 init_completion(&dsi.update_completion); 3770 init_completion(&dsi.update_completion);
3642 3771
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 9b05ee65a15d..0a26b7d84d41 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -467,14 +467,14 @@ static irqreturn_t dss_irq_handler_omap3(int irq, void *arg)
467 467
468static int _omap_dss_wait_reset(void) 468static int _omap_dss_wait_reset(void)
469{ 469{
470 unsigned timeout = 1000; 470 int t = 0;
471 471
472 while (REG_GET(DSS_SYSSTATUS, 0, 0) == 0) { 472 while (REG_GET(DSS_SYSSTATUS, 0, 0) == 0) {
473 udelay(1); 473 if (++t > 1000) {
474 if (!--timeout) {
475 DSSERR("soft reset failed\n"); 474 DSSERR("soft reset failed\n");
476 return -ENODEV; 475 return -ENODEV;
477 } 476 }
477 udelay(1);
478 } 478 }
479 479
480 return 0; 480 return 0;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 8da5ac42151b..2bcb1245d6c2 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -240,6 +240,7 @@ int dsi_init(struct platform_device *pdev);
240void dsi_exit(void); 240void dsi_exit(void);
241 241
242void dsi_dump_clocks(struct seq_file *s); 242void dsi_dump_clocks(struct seq_file *s);
243void dsi_dump_irqs(struct seq_file *s);
243void dsi_dump_regs(struct seq_file *s); 244void dsi_dump_regs(struct seq_file *s);
244 245
245void dsi_save_context(void); 246void dsi_save_context(void);
@@ -268,6 +269,7 @@ int dpi_init_display(struct omap_dss_device *dssdev);
268int dispc_init(void); 269int dispc_init(void);
269void dispc_exit(void); 270void dispc_exit(void);
270void dispc_dump_clocks(struct seq_file *s); 271void dispc_dump_clocks(struct seq_file *s);
272void dispc_dump_irqs(struct seq_file *s);
271void dispc_dump_regs(struct seq_file *s); 273void dispc_dump_regs(struct seq_file *s);
272void dispc_irq_handler(void); 274void dispc_irq_handler(void);
273void dispc_fake_vsync_irq(void); 275void dispc_fake_vsync_irq(void);
@@ -367,4 +369,16 @@ void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t);
367unsigned long rfbi_get_max_tx_rate(void); 369unsigned long rfbi_get_max_tx_rate(void);
368int rfbi_init_display(struct omap_dss_device *display); 370int rfbi_init_display(struct omap_dss_device *display);
369 371
372
373#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
374static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
375{
376 int b;
377 for (b = 0; b < 32; ++b) {
378 if (irqstatus & (1 << b))
379 irq_arr[b]++;
380 }
381}
382#endif
383
370#endif 384#endif
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index d0b3006ad8a5..b936495c065d 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -120,7 +120,7 @@ static struct {
120 120
121 struct omap_dss_device *dssdev[2]; 121 struct omap_dss_device *dssdev[2];
122 122
123 struct kfifo *cmd_fifo; 123 struct kfifo cmd_fifo;
124 spinlock_t cmd_lock; 124 spinlock_t cmd_lock;
125 struct completion cmd_done; 125 struct completion cmd_done;
126 atomic_t cmd_fifo_full; 126 atomic_t cmd_fifo_full;
@@ -1011,20 +1011,20 @@ static void process_cmd_fifo(void)
1011 return; 1011 return;
1012 1012
1013 while (true) { 1013 while (true) {
1014 spin_lock_irqsave(rfbi.cmd_fifo->lock, flags); 1014 spin_lock_irqsave(&rfbi.cmd_lock, flags);
1015 1015
1016 len = __kfifo_get(rfbi.cmd_fifo, (unsigned char *)&p, 1016 len = kfifo_out(&rfbi.cmd_fifo, (unsigned char *)&p,
1017 sizeof(struct update_param)); 1017 sizeof(struct update_param));
1018 if (len == 0) { 1018 if (len == 0) {
1019 DSSDBG("nothing more in fifo\n"); 1019 DSSDBG("nothing more in fifo\n");
1020 atomic_set(&rfbi.cmd_pending, 0); 1020 atomic_set(&rfbi.cmd_pending, 0);
1021 spin_unlock_irqrestore(rfbi.cmd_fifo->lock, flags); 1021 spin_unlock_irqrestore(&rfbi.cmd_lock, flags);
1022 break; 1022 break;
1023 } 1023 }
1024 1024
1025 /* DSSDBG("fifo full %d\n", rfbi.cmd_fifo_full.counter);*/ 1025 /* DSSDBG("fifo full %d\n", rfbi.cmd_fifo_full.counter);*/
1026 1026
1027 spin_unlock_irqrestore(rfbi.cmd_fifo->lock, flags); 1027 spin_unlock_irqrestore(&rfbi.cmd_lock, flags);
1028 1028
1029 BUG_ON(len != sizeof(struct update_param)); 1029 BUG_ON(len != sizeof(struct update_param));
1030 BUG_ON(p.rfbi_module > 1); 1030 BUG_ON(p.rfbi_module > 1);
@@ -1052,25 +1052,25 @@ static void rfbi_push_cmd(struct update_param *p)
1052 unsigned long flags; 1052 unsigned long flags;
1053 int available; 1053 int available;
1054 1054
1055 spin_lock_irqsave(rfbi.cmd_fifo->lock, flags); 1055 spin_lock_irqsave(&rfbi.cmd_lock, flags);
1056 available = RFBI_CMD_FIFO_LEN_BYTES - 1056 available = RFBI_CMD_FIFO_LEN_BYTES -
1057 __kfifo_len(rfbi.cmd_fifo); 1057 kfifo_len(&rfbi.cmd_fifo);
1058 1058
1059/* DSSDBG("%d bytes left in fifo\n", available); */ 1059/* DSSDBG("%d bytes left in fifo\n", available); */
1060 if (available < sizeof(struct update_param)) { 1060 if (available < sizeof(struct update_param)) {
1061 DSSDBG("Going to wait because FIFO FULL..\n"); 1061 DSSDBG("Going to wait because FIFO FULL..\n");
1062 spin_unlock_irqrestore(rfbi.cmd_fifo->lock, flags); 1062 spin_unlock_irqrestore(&rfbi.cmd_lock, flags);
1063 atomic_inc(&rfbi.cmd_fifo_full); 1063 atomic_inc(&rfbi.cmd_fifo_full);
1064 wait_for_completion(&rfbi.cmd_done); 1064 wait_for_completion(&rfbi.cmd_done);
1065 /*DSSDBG("Woke up because fifo not full anymore\n");*/ 1065 /*DSSDBG("Woke up because fifo not full anymore\n");*/
1066 continue; 1066 continue;
1067 } 1067 }
1068 1068
1069 ret = __kfifo_put(rfbi.cmd_fifo, (unsigned char *)p, 1069 ret = kfifo_in(&rfbi.cmd_fifo, (unsigned char *)p,
1070 sizeof(struct update_param)); 1070 sizeof(struct update_param));
1071/* DSSDBG("pushed %d bytes\n", ret);*/ 1071/* DSSDBG("pushed %d bytes\n", ret);*/
1072 1072
1073 spin_unlock_irqrestore(rfbi.cmd_fifo->lock, flags); 1073 spin_unlock_irqrestore(&rfbi.cmd_lock, flags);
1074 1074
1075 BUG_ON(ret != sizeof(struct update_param)); 1075 BUG_ON(ret != sizeof(struct update_param));
1076 1076
@@ -1155,12 +1155,12 @@ int rfbi_init(void)
1155{ 1155{
1156 u32 rev; 1156 u32 rev;
1157 u32 l; 1157 u32 l;
1158 int r;
1158 1159
1159 spin_lock_init(&rfbi.cmd_lock); 1160 spin_lock_init(&rfbi.cmd_lock);
1160 rfbi.cmd_fifo = kfifo_alloc(RFBI_CMD_FIFO_LEN_BYTES, GFP_KERNEL, 1161 r = kfifo_alloc(&rfbi.cmd_fifo, RFBI_CMD_FIFO_LEN_BYTES, GFP_KERNEL);
1161 &rfbi.cmd_lock); 1162 if (r)
1162 if (IS_ERR(rfbi.cmd_fifo)) 1163 return r;
1163 return -ENOMEM;
1164 1164
1165 init_completion(&rfbi.cmd_done); 1165 init_completion(&rfbi.cmd_done);
1166 atomic_set(&rfbi.cmd_fifo_full, 0); 1166 atomic_set(&rfbi.cmd_fifo_full, 0);
@@ -1196,7 +1196,7 @@ void rfbi_exit(void)
1196{ 1196{
1197 DSSDBG("rfbi_exit\n"); 1197 DSSDBG("rfbi_exit\n");
1198 1198
1199 kfifo_free(rfbi.cmd_fifo); 1199 kfifo_free(&rfbi.cmd_fifo);
1200 1200
1201 iounmap(rfbi.base); 1201 iounmap(rfbi.base);
1202} 1202}
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index ef299839858a..d17caef6915a 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -1311,6 +1311,7 @@ static void omapfb_free_fbmem(struct fb_info *fbi)
1311 if (rg->vrfb.vaddr[0]) { 1311 if (rg->vrfb.vaddr[0]) {
1312 iounmap(rg->vrfb.vaddr[0]); 1312 iounmap(rg->vrfb.vaddr[0]);
1313 omap_vrfb_release_ctx(&rg->vrfb); 1313 omap_vrfb_release_ctx(&rg->vrfb);
1314 rg->vrfb.vaddr[0] = NULL;
1314 } 1315 }
1315 } 1316 }
1316 1317
@@ -2114,6 +2115,11 @@ static int omapfb_probe(struct platform_device *pdev)
2114 dssdev = NULL; 2115 dssdev = NULL;
2115 for_each_dss_dev(dssdev) { 2116 for_each_dss_dev(dssdev) {
2116 omap_dss_get_device(dssdev); 2117 omap_dss_get_device(dssdev);
2118 if (!dssdev->driver) {
2119 dev_err(&pdev->dev, "no driver for display\n");
2120 r = -EINVAL;
2121 goto cleanup;
2122 }
2117 fbdev->displays[fbdev->num_displays++] = dssdev; 2123 fbdev->displays[fbdev->num_displays++] = dssdev;
2118 } 2124 }
2119 2125
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 415858b421b3..825b665245bb 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1221,9 +1221,9 @@ static void setup_smart_timing(struct pxafb_info *fbi,
1221static int pxafb_smart_thread(void *arg) 1221static int pxafb_smart_thread(void *arg)
1222{ 1222{
1223 struct pxafb_info *fbi = arg; 1223 struct pxafb_info *fbi = arg;
1224 struct pxafb_mach_info *inf; 1224 struct pxafb_mach_info *inf = fbi->dev->platform_data;
1225 1225
1226 if (!fbi || !fbi->dev->platform_data->smart_update) { 1226 if (!inf->smart_update) {
1227 pr_err("%s: not properly initialized, thread terminated\n", 1227 pr_err("%s: not properly initialized, thread terminated\n",
1228 __func__); 1228 __func__);
1229 return -EINVAL; 1229 return -EINVAL;
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 10d8c4b4baeb..d8df17a7d5fc 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -680,7 +680,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
680 if (!viafb_gamma_table) 680 if (!viafb_gamma_table)
681 return -ENOMEM; 681 return -ENOMEM;
682 if (copy_from_user(viafb_gamma_table, argp, 682 if (copy_from_user(viafb_gamma_table, argp,
683 sizeof(viafb_gamma_table))) { 683 256 * sizeof(u32))) {
684 kfree(viafb_gamma_table); 684 kfree(viafb_gamma_table);
685 return -EFAULT; 685 return -EFAULT;
686 } 686 }
@@ -694,7 +694,7 @@ static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
694 return -ENOMEM; 694 return -ENOMEM;
695 viafb_get_gamma_table(viafb_gamma_table); 695 viafb_get_gamma_table(viafb_gamma_table);
696 if (copy_to_user(argp, viafb_gamma_table, 696 if (copy_to_user(argp, viafb_gamma_table,
697 sizeof(viafb_gamma_table))) { 697 256 * sizeof(u32))) {
698 kfree(viafb_gamma_table); 698 kfree(viafb_gamma_table);
699 return -EFAULT; 699 return -EFAULT;
700 } 700 }
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index d958b76430a2..088f32f29a6e 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -368,7 +368,7 @@ config ALIM7101_WDT
368 368
369config GEODE_WDT 369config GEODE_WDT
370 tristate "AMD Geode CS5535/CS5536 Watchdog" 370 tristate "AMD Geode CS5535/CS5536 Watchdog"
371 depends on MGEODE_LX 371 depends on CS5535_MFGPT
372 help 372 help
373 This driver enables a watchdog capability built into the 373 This driver enables a watchdog capability built into the
374 CS5535/CS5536 companion chips for the AMD Geode GX and LX 374 CS5535/CS5536 companion chips for the AMD Geode GX and LX
@@ -815,16 +815,6 @@ config PNX833X_WDT
815 timer has expired and no process has written to /dev/watchdog during 815 timer has expired and no process has written to /dev/watchdog during
816 that time. 816 that time.
817 817
818config WDT_RM9K_GPI
819 tristate "RM9000/GPI hardware watchdog"
820 depends on CPU_RM9000
821 help
822 Watchdog implementation using the GPI hardware found on
823 PMC-Sierra RM9xxx CPUs.
824
825 To compile this driver as a module, choose M here: the
826 module will be called rm9k_wdt.
827
828config SIBYTE_WDOG 818config SIBYTE_WDOG
829 tristate "Sibyte SoC hardware watchdog" 819 tristate "Sibyte SoC hardware watchdog"
830 depends on CPU_SB1 820 depends on CPU_SB1
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 89c045dc468e..475c61100069 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -109,7 +109,6 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o
109obj-$(CONFIG_INDYDOG) += indydog.o 109obj-$(CONFIG_INDYDOG) += indydog.o
110obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o 110obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
111obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o 111obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
112obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
113obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o 112obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
114obj-$(CONFIG_AR7_WDT) += ar7_wdt.o 113obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
115obj-$(CONFIG_TXX9_WDT) += txx9wdt.o 114obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
diff --git a/drivers/watchdog/adx_wdt.c b/drivers/watchdog/adx_wdt.c
index 9c6594473d3b..9d7d155364f8 100644
--- a/drivers/watchdog/adx_wdt.c
+++ b/drivers/watchdog/adx_wdt.c
@@ -242,14 +242,14 @@ static int __devinit adx_wdt_probe(struct platform_device *pdev)
242 } 242 }
243 243
244 res = devm_request_mem_region(&pdev->dev, res->start, 244 res = devm_request_mem_region(&pdev->dev, res->start,
245 res->end - res->start + 1, res->name); 245 resource_size(res), res->name);
246 if (!res) { 246 if (!res) {
247 dev_err(&pdev->dev, "cannot request I/O memory region\n"); 247 dev_err(&pdev->dev, "cannot request I/O memory region\n");
248 return -ENXIO; 248 return -ENXIO;
249 } 249 }
250 250
251 wdt->base = devm_ioremap_nocache(&pdev->dev, res->start, 251 wdt->base = devm_ioremap_nocache(&pdev->dev, res->start,
252 res->end - res->start + 1); 252 resource_size(res));
253 if (!wdt->base) { 253 if (!wdt->base) {
254 dev_err(&pdev->dev, "cannot remap I/O memory region\n"); 254 dev_err(&pdev->dev, "cannot remap I/O memory region\n");
255 return -ENXIO; 255 return -ENXIO;
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index e8ae638e5804..037847923dcb 100644
--- a/drivers/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
@@ -326,7 +326,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
326 return -ENOMEM; 326 return -ENOMEM;
327 } 327 }
328 328
329 wdt->regs = ioremap(regs->start, regs->end - regs->start + 1); 329 wdt->regs = ioremap(regs->start, resource_size(regs));
330 if (!wdt->regs) { 330 if (!wdt->regs) {
331 ret = -ENOMEM; 331 ret = -ENOMEM;
332 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 332 dev_dbg(&pdev->dev, "could not map I/O memory\n");
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 9d7520fa9e9c..887136de1857 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -221,7 +221,7 @@ static int __devinit davinci_wdt_probe(struct platform_device *pdev)
221 return -ENOENT; 221 return -ENOENT;
222 } 222 }
223 223
224 size = res->end - res->start + 1; 224 size = resource_size(res);
225 wdt_mem = request_mem_region(res->start, size, pdev->name); 225 wdt_mem = request_mem_region(res->start, size, pdev->name);
226 226
227 if (wdt_mem == NULL) { 227 if (wdt_mem == NULL) {
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
index 9acf0015a1e7..38252ff828ca 100644
--- a/drivers/watchdog/geodewdt.c
+++ b/drivers/watchdog/geodewdt.c
@@ -1,6 +1,7 @@
1/* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip 1/* Watchdog timer for machines with the CS5535/CS5536 companion chip
2 * 2 *
3 * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. 3 * Copyright (C) 2006-2007, Advanced Micro Devices, Inc.
4 * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk>
4 * 5 *
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
@@ -19,7 +20,7 @@
19#include <linux/reboot.h> 20#include <linux/reboot.h>
20#include <linux/uaccess.h> 21#include <linux/uaccess.h>
21 22
22#include <asm/geode.h> 23#include <linux/cs5535.h>
23 24
24#define GEODEWDT_HZ 500 25#define GEODEWDT_HZ 500
25#define GEODEWDT_SCALE 6 26#define GEODEWDT_SCALE 6
@@ -46,25 +47,25 @@ MODULE_PARM_DESC(nowayout,
46 47
47static struct platform_device *geodewdt_platform_device; 48static struct platform_device *geodewdt_platform_device;
48static unsigned long wdt_flags; 49static unsigned long wdt_flags;
49static int wdt_timer; 50static struct cs5535_mfgpt_timer *wdt_timer;
50static int safe_close; 51static int safe_close;
51 52
52static void geodewdt_ping(void) 53static void geodewdt_ping(void)
53{ 54{
54 /* Stop the counter */ 55 /* Stop the counter */
55 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 56 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
56 57
57 /* Reset the counter */ 58 /* Reset the counter */
58 geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 59 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
59 60
60 /* Enable the counter */ 61 /* Enable the counter */
61 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 62 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
62} 63}
63 64
64static void geodewdt_disable(void) 65static void geodewdt_disable(void)
65{ 66{
66 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 67 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
67 geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 68 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
68} 69}
69 70
70static int geodewdt_set_heartbeat(int val) 71static int geodewdt_set_heartbeat(int val)
@@ -72,10 +73,10 @@ static int geodewdt_set_heartbeat(int val)
72 if (val < 1 || val > GEODEWDT_MAX_SECONDS) 73 if (val < 1 || val > GEODEWDT_MAX_SECONDS)
73 return -EINVAL; 74 return -EINVAL;
74 75
75 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 76 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
76 geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); 77 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ);
77 geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 78 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
78 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 79 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
79 80
80 timeout = val; 81 timeout = val;
81 return 0; 82 return 0;
@@ -215,28 +216,25 @@ static struct miscdevice geodewdt_miscdev = {
215 216
216static int __devinit geodewdt_probe(struct platform_device *dev) 217static int __devinit geodewdt_probe(struct platform_device *dev)
217{ 218{
218 int ret, timer; 219 int ret;
219
220 timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
221 220
222 if (timer == -1) { 221 wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
222 if (!wdt_timer) {
223 printk(KERN_ERR "geodewdt: No timers were available\n"); 223 printk(KERN_ERR "geodewdt: No timers were available\n");
224 return -ENODEV; 224 return -ENODEV;
225 } 225 }
226 226
227 wdt_timer = timer;
228
229 /* Set up the timer */ 227 /* Set up the timer */
230 228
231 geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 229 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP,
232 GEODEWDT_SCALE | (3 << 8)); 230 GEODEWDT_SCALE | (3 << 8));
233 231
234 /* Set up comparator 2 to reset when the event fires */ 232 /* Set up comparator 2 to reset when the event fires */
235 geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); 233 cs5535_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1);
236 234
237 /* Set up the initial timeout */ 235 /* Set up the initial timeout */
238 236
239 geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, 237 cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2,
240 timeout * GEODEWDT_HZ); 238 timeout * GEODEWDT_HZ);
241 239
242 ret = misc_register(&geodewdt_miscdev); 240 ret = misc_register(&geodewdt_miscdev);
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index e44fbb31bc6f..c8a3bec26830 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -30,6 +30,7 @@
30 * document number 316972-004, 316973-012: 82801I (ICH9) 30 * document number 316972-004, 316973-012: 82801I (ICH9)
31 * document number 319973-002, 319974-002: 82801J (ICH10) 31 * document number 319973-002, 319974-002: 82801J (ICH10)
32 * document number 322169-001, 322170-001: 5 Series, 3400 Series (PCH) 32 * document number 322169-001, 322170-001: 5 Series, 3400 Series (PCH)
33 * document number 320066-003, 320257-008: EP80597 (IICH)
33 */ 34 */
34 35
35/* 36/*
@@ -100,6 +101,7 @@ enum iTCO_chipsets {
100 TCO_PCH, /* PCH Desktop Full Featured */ 101 TCO_PCH, /* PCH Desktop Full Featured */
101 TCO_PCHM, /* PCH Mobile Full Featured */ 102 TCO_PCHM, /* PCH Mobile Full Featured */
102 TCO_PCHMSFF, /* PCH Mobile SFF Full Featured */ 103 TCO_PCHMSFF, /* PCH Mobile SFF Full Featured */
104 TCO_EP80579, /* EP80579 */
103}; 105};
104 106
105static struct { 107static struct {
@@ -143,6 +145,7 @@ static struct {
143 {"PCH Desktop Full Featured", 2}, 145 {"PCH Desktop Full Featured", 2},
144 {"PCH Mobile Full Featured", 2}, 146 {"PCH Mobile Full Featured", 2},
145 {"PCH Mobile SFF Full Featured", 2}, 147 {"PCH Mobile SFF Full Featured", 2},
148 {"EP80579", 2},
146 {NULL, 0} 149 {NULL, 0}
147}; 150};
148 151
@@ -214,6 +217,7 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
214 { ITCO_PCI_DEVICE(0x3b00, TCO_PCH)}, 217 { ITCO_PCI_DEVICE(0x3b00, TCO_PCH)},
215 { ITCO_PCI_DEVICE(0x3b01, TCO_PCHM)}, 218 { ITCO_PCI_DEVICE(0x3b01, TCO_PCHM)},
216 { ITCO_PCI_DEVICE(0x3b0d, TCO_PCHMSFF)}, 219 { ITCO_PCI_DEVICE(0x3b0d, TCO_PCHMSFF)},
220 { ITCO_PCI_DEVICE(0x5031, TCO_EP80579)},
217 { 0, }, /* End of list */ 221 { 0, }, /* End of list */
218}; 222};
219MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); 223MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 83fa34b214b4..a2dc07c2ed49 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -350,7 +350,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
350 ret = -ENXIO; 350 ret = -ENXIO;
351 goto err_free; 351 goto err_free;
352 } 352 }
353 wdt->base = ioremap(res->start, res->end - res->start + 1); 353 wdt->base = ioremap(res->start, resource_size(res));
354 if (!wdt->base) { 354 if (!wdt->base) {
355 ret = -ENOMEM; 355 ret = -ENOMEM;
356 goto err_free; 356 goto err_free;
diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c
index acf589dc057c..a51dbe4c43da 100644
--- a/drivers/watchdog/mv64x60_wdt.c
+++ b/drivers/watchdog/mv64x60_wdt.c
@@ -275,7 +275,7 @@ static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
275 if (!r) 275 if (!r)
276 return -ENODEV; 276 return -ENODEV;
277 277
278 mv64x60_wdt_regs = ioremap(r->start, r->end - r->start + 1); 278 mv64x60_wdt_regs = ioremap(r->start, resource_size(r));
279 if (mv64x60_wdt_regs == NULL) 279 if (mv64x60_wdt_regs == NULL)
280 return -ENOMEM; 280 return -ENOMEM;
281 281
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 429ea99eaee5..c6aaf2845741 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -277,8 +277,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
277 goto err_busy; 277 goto err_busy;
278 } 278 }
279 279
280 mem = request_mem_region(res->start, res->end - res->start + 1, 280 mem = request_mem_region(res->start, resource_size(res), pdev->name);
281 pdev->name);
282 if (!mem) { 281 if (!mem) {
283 ret = -EBUSY; 282 ret = -EBUSY;
284 goto err_busy; 283 goto err_busy;
@@ -306,7 +305,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
306 goto err_clk; 305 goto err_clk;
307 } 306 }
308 307
309 wdev->base = ioremap(res->start, res->end - res->start + 1); 308 wdev->base = ioremap(res->start, resource_size(res));
310 if (!wdev->base) { 309 if (!wdev->base) {
311 ret = -ENOMEM; 310 ret = -ENOMEM;
312 goto err_ioremap; 311 goto err_ioremap;
@@ -358,7 +357,7 @@ err_clk:
358 kfree(wdev); 357 kfree(wdev);
359 358
360err_kzalloc: 359err_kzalloc:
361 release_mem_region(res->start, res->end - res->start + 1); 360 release_mem_region(res->start, resource_size(res));
362 361
363err_busy: 362err_busy:
364err_get_resource: 363err_get_resource:
@@ -383,7 +382,7 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)
383 return -ENOENT; 382 return -ENOENT;
384 383
385 misc_deregister(&(wdev->omap_wdt_miscdev)); 384 misc_deregister(&(wdev->omap_wdt_miscdev));
386 release_mem_region(res->start, res->end - res->start + 1); 385 release_mem_region(res->start, resource_size(res));
387 platform_set_drvdata(pdev, NULL); 386 platform_set_drvdata(pdev, NULL);
388 387
389 clk_put(wdev->ick); 388 clk_put(wdev->ick);
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 4d227b152001..430a5848a9a5 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -264,7 +264,7 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev)
264 return -ENOENT; 264 return -ENOENT;
265 } 265 }
266 266
267 size = res->end - res->start + 1; 267 size = resource_size(res);
268 wdt_mem = request_mem_region(res->start, size, pdev->name); 268 wdt_mem = request_mem_region(res->start, size, pdev->name);
269 269
270 if (wdt_mem == NULL) { 270 if (wdt_mem == NULL) {
diff --git a/drivers/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c
deleted file mode 100644
index bb66958b9433..000000000000
--- a/drivers/watchdog/rm9k_wdt.c
+++ /dev/null
@@ -1,419 +0,0 @@
1/*
2 * Watchdog implementation for GPI h/w found on PMC-Sierra RM9xxx
3 * chips.
4 *
5 * Copyright (C) 2004 by Basler Vision Technologies AG
6 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/platform_device.h>
24#include <linux/module.h>
25#include <linux/moduleparam.h>
26#include <linux/interrupt.h>
27#include <linux/fs.h>
28#include <linux/reboot.h>
29#include <linux/notifier.h>
30#include <linux/miscdevice.h>
31#include <linux/watchdog.h>
32#include <linux/io.h>
33#include <linux/uaccess.h>
34#include <asm/atomic.h>
35#include <asm/processor.h>
36#include <asm/system.h>
37#include <asm/rm9k-ocd.h>
38
39#include <rm9k_wdt.h>
40
41
42#define CLOCK 125000000
43#define MAX_TIMEOUT_SECONDS 32
44#define CPCCR 0x0080
45#define CPGIG1SR 0x0044
46#define CPGIG1ER 0x0054
47
48
49/* Function prototypes */
50static irqreturn_t wdt_gpi_irqhdl(int, void *);
51static void wdt_gpi_start(void);
52static void wdt_gpi_stop(void);
53static void wdt_gpi_set_timeout(unsigned int);
54static int wdt_gpi_open(struct inode *, struct file *);
55static int wdt_gpi_release(struct inode *, struct file *);
56static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t,
57 loff_t *);
58static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
59static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *);
60static const struct resource *wdt_gpi_get_resource(struct platform_device *,
61 const char *, unsigned int);
62static int __init wdt_gpi_probe(struct platform_device *);
63static int __exit wdt_gpi_remove(struct platform_device *);
64
65
66static const char wdt_gpi_name[] = "wdt_gpi";
67static atomic_t opencnt;
68static int expect_close;
69static int locked;
70
71
72/* These are set from device resources */
73static void __iomem *wd_regs;
74static unsigned int wd_irq, wd_ctr;
75
76
77/* Module arguments */
78static int timeout = MAX_TIMEOUT_SECONDS;
79module_param(timeout, int, 0444);
80MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds");
81
82static unsigned long resetaddr = 0xbffdc200;
83module_param(resetaddr, ulong, 0444);
84MODULE_PARM_DESC(resetaddr, "Address to write to to force a reset");
85
86static unsigned long flagaddr = 0xbffdc104;
87module_param(flagaddr, ulong, 0444);
88MODULE_PARM_DESC(flagaddr, "Address to write to boot flags to");
89
90static int powercycle;
91module_param(powercycle, bool, 0444);
92MODULE_PARM_DESC(powercycle, "Cycle power if watchdog expires");
93
94static int nowayout = WATCHDOG_NOWAYOUT;
95module_param(nowayout, bool, 0444);
96MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started");
97
98
99/* Kernel interfaces */
100static const struct file_operations fops = {
101 .owner = THIS_MODULE,
102 .open = wdt_gpi_open,
103 .release = wdt_gpi_release,
104 .write = wdt_gpi_write,
105 .unlocked_ioctl = wdt_gpi_ioctl,
106};
107
108static struct miscdevice miscdev = {
109 .minor = WATCHDOG_MINOR,
110 .name = wdt_gpi_name,
111 .fops = &fops,
112};
113
114static struct notifier_block wdt_gpi_shutdown = {
115 .notifier_call = wdt_gpi_notify,
116};
117
118
119/* Interrupt handler */
120static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt)
121{
122 if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1))
123 return IRQ_NONE;
124 __raw_writel(0x1, wd_regs + 0x0008);
125
126
127 printk(KERN_CRIT "%s: watchdog expired - resetting system\n",
128 wdt_gpi_name);
129
130 *(volatile char *) flagaddr |= 0x01;
131 *(volatile char *) resetaddr = powercycle ? 0x01 : 0x2;
132 iob();
133 while (1)
134 cpu_relax();
135}
136
137
138/* Watchdog functions */
139static void wdt_gpi_start(void)
140{
141 u32 reg;
142
143 lock_titan_regs();
144 reg = titan_readl(CPGIG1ER);
145 titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER);
146 iob();
147 unlock_titan_regs();
148}
149
150static void wdt_gpi_stop(void)
151{
152 u32 reg;
153
154 lock_titan_regs();
155 reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
156 titan_writel(reg, CPCCR);
157 reg = titan_readl(CPGIG1ER);
158 titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER);
159 iob();
160 unlock_titan_regs();
161}
162
163static void wdt_gpi_set_timeout(unsigned int to)
164{
165 u32 reg;
166 const u32 wdval = (to * CLOCK) & ~0x0000000f;
167
168 lock_titan_regs();
169 reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4));
170 titan_writel(reg, CPCCR);
171 wmb();
172 __raw_writel(wdval, wd_regs + 0x0000);
173 wmb();
174 titan_writel(reg | (0x2 << (wd_ctr * 4)), CPCCR);
175 wmb();
176 titan_writel(reg | (0x5 << (wd_ctr * 4)), CPCCR);
177 iob();
178 unlock_titan_regs();
179}
180
181
182/* /dev/watchdog operations */
183static int wdt_gpi_open(struct inode *inode, struct file *file)
184{
185 int res;
186
187 if (unlikely(atomic_dec_if_positive(&opencnt) < 0))
188 return -EBUSY;
189
190 expect_close = 0;
191 if (locked) {
192 module_put(THIS_MODULE);
193 free_irq(wd_irq, &miscdev);
194 locked = 0;
195 }
196
197 res = request_irq(wd_irq, wdt_gpi_irqhdl, IRQF_SHARED | IRQF_DISABLED,
198 wdt_gpi_name, &miscdev);
199 if (unlikely(res))
200 return res;
201
202 wdt_gpi_set_timeout(timeout);
203 wdt_gpi_start();
204
205 printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n",
206 wdt_gpi_name, timeout);
207 return nonseekable_open(inode, file);
208}
209
210static int wdt_gpi_release(struct inode *inode, struct file *file)
211{
212 if (nowayout) {
213 printk(KERN_INFO "%s: no way out - watchdog left running\n",
214 wdt_gpi_name);
215 __module_get(THIS_MODULE);
216 locked = 1;
217 } else {
218 if (expect_close) {
219 wdt_gpi_stop();
220 free_irq(wd_irq, &miscdev);
221 printk(KERN_INFO "%s: watchdog stopped\n",
222 wdt_gpi_name);
223 } else {
224 printk(KERN_CRIT "%s: unexpected close() -"
225 " watchdog left running\n",
226 wdt_gpi_name);
227 wdt_gpi_set_timeout(timeout);
228 __module_get(THIS_MODULE);
229 locked = 1;
230 }
231 }
232
233 atomic_inc(&opencnt);
234 return 0;
235}
236
237static ssize_t wdt_gpi_write(struct file *f, const char __user *d, size_t s,
238 loff_t *o)
239{
240 char val;
241
242 wdt_gpi_set_timeout(timeout);
243 expect_close = (s > 0) && !get_user(val, d) && (val == 'V');
244 return s ? 1 : 0;
245}
246
247static long wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
248{
249 long res = -ENOTTY;
250 const long size = _IOC_SIZE(cmd);
251 int stat;
252 void __user *argp = (void __user *)arg;
253 static struct watchdog_info wdinfo = {
254 .identity = "RM9xxx/GPI watchdog",
255 .firmware_version = 0,
256 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING
257 };
258
259 if (unlikely(_IOC_TYPE(cmd) != WATCHDOG_IOCTL_BASE))
260 return -ENOTTY;
261
262 if ((_IOC_DIR(cmd) & _IOC_READ)
263 && !access_ok(VERIFY_WRITE, arg, size))
264 return -EFAULT;
265
266 if ((_IOC_DIR(cmd) & _IOC_WRITE)
267 && !access_ok(VERIFY_READ, arg, size))
268 return -EFAULT;
269
270 expect_close = 0;
271
272 switch (cmd) {
273 case WDIOC_GETSUPPORT:
274 wdinfo.options = nowayout ?
275 WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING :
276 WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
277 WDIOF_MAGICCLOSE;
278 res = __copy_to_user(argp, &wdinfo, size) ? -EFAULT : size;
279 break;
280
281 case WDIOC_GETSTATUS:
282 break;
283
284 case WDIOC_GETBOOTSTATUS:
285 stat = (*(volatile char *) flagaddr & 0x01)
286 ? WDIOF_CARDRESET : 0;
287 res = __copy_to_user(argp, &stat, size) ?
288 -EFAULT : size;
289 break;
290
291 case WDIOC_SETOPTIONS:
292 break;
293
294 case WDIOC_KEEPALIVE:
295 wdt_gpi_set_timeout(timeout);
296 res = size;
297 break;
298
299 case WDIOC_SETTIMEOUT:
300 {
301 int val;
302 if (unlikely(__copy_from_user(&val, argp, size))) {
303 res = -EFAULT;
304 break;
305 }
306
307 if (val > MAX_TIMEOUT_SECONDS)
308 val = MAX_TIMEOUT_SECONDS;
309 timeout = val;
310 wdt_gpi_set_timeout(val);
311 res = size;
312 printk(KERN_INFO "%s: timeout set to %u seconds\n",
313 wdt_gpi_name, timeout);
314 }
315 break;
316
317 case WDIOC_GETTIMEOUT:
318 res = __copy_to_user(argp, &timeout, size) ?
319 -EFAULT : size;
320 break;
321 }
322
323 return res;
324}
325
326
327/* Shutdown notifier */
328static int wdt_gpi_notify(struct notifier_block *this, unsigned long code,
329 void *unused)
330{
331 if (code == SYS_DOWN || code == SYS_HALT)
332 wdt_gpi_stop();
333
334 return NOTIFY_DONE;
335}
336
337
338/* Init & exit procedures */
339static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
340 const char *name, unsigned int type)
341{
342 char buf[80];
343 if (snprintf(buf, sizeof(buf), "%s_0", name) >= sizeof(buf))
344 return NULL;
345 return platform_get_resource_byname(pdv, type, buf);
346}
347
348/* No hotplugging on the platform bus - use __devinit */
349static int __devinit wdt_gpi_probe(struct platform_device *pdv)
350{
351 int res;
352 const struct resource
353 * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS,
354 IORESOURCE_MEM),
355 * const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ,
356 IORESOURCE_IRQ),
357 * const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER,
358 0);
359
360 if (unlikely(!rr || !ri || !rc))
361 return -ENXIO;
362
363 wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start);
364 if (unlikely(!wd_regs))
365 return -ENOMEM;
366 wd_irq = ri->start;
367 wd_ctr = rc->start;
368 res = misc_register(&miscdev);
369 if (res)
370 iounmap(wd_regs);
371 else
372 register_reboot_notifier(&wdt_gpi_shutdown);
373 return res;
374}
375
376static int __devexit wdt_gpi_remove(struct platform_device *dev)
377{
378 int res;
379
380 unregister_reboot_notifier(&wdt_gpi_shutdown);
381 res = misc_deregister(&miscdev);
382 iounmap(wd_regs);
383 wd_regs = NULL;
384 return res;
385}
386
387
388/* Device driver init & exit */
389static struct platform_driver wgt_gpi_driver = {
390 .driver = {
391 .name = wdt_gpi_name,
392 .owner = THIS_MODULE,
393 },
394 .probe = wdt_gpi_probe,
395 .remove = __devexit_p(wdt_gpi_remove),
396};
397
398static int __init wdt_gpi_init_module(void)
399{
400 atomic_set(&opencnt, 1);
401 if (timeout > MAX_TIMEOUT_SECONDS)
402 timeout = MAX_TIMEOUT_SECONDS;
403 return platform_driver_register(&wdt_gpi_driver);
404}
405
406static void __exit wdt_gpi_cleanup_module(void)
407{
408 platform_driver_unregister(&wdt_gpi_driver);
409}
410
411module_init(wdt_gpi_init_module);
412module_exit(wdt_gpi_cleanup_module);
413
414MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>");
415MODULE_DESCRIPTION("Basler eXcite watchdog driver for gpi devices");
416MODULE_VERSION("0.1");
417MODULE_LICENSE("GPL");
418MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
419
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 85b93e15d011..8760a26ab2a3 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -421,7 +421,7 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
421 return -ENOENT; 421 return -ENOENT;
422 } 422 }
423 423
424 size = (res->end - res->start) + 1; 424 size = resource_size(res);
425 wdt_mem = request_mem_region(res->start, size, pdev->name); 425 wdt_mem = request_mem_region(res->start, size, pdev->name);
426 if (wdt_mem == NULL) { 426 if (wdt_mem == NULL) {
427 dev_err(dev, "failed to get memory region\n"); 427 dev_err(dev, "failed to get memory region\n");
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c
index 6adab77fbbb0..d635566e9307 100644
--- a/drivers/watchdog/txx9wdt.c
+++ b/drivers/watchdog/txx9wdt.c
@@ -214,12 +214,10 @@ static int __init txx9wdt_probe(struct platform_device *dev)
214 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 214 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
215 if (!res) 215 if (!res)
216 goto exit_busy; 216 goto exit_busy;
217 if (!devm_request_mem_region(&dev->dev, 217 if (!devm_request_mem_region(&dev->dev, res->start, resource_size(res),
218 res->start, res->end - res->start + 1,
219 "txx9wdt")) 218 "txx9wdt"))
220 goto exit_busy; 219 goto exit_busy;
221 txx9wdt_reg = devm_ioremap(&dev->dev, 220 txx9wdt_reg = devm_ioremap(&dev->dev, res->start, resource_size(res));
222 res->start, res->end - res->start + 1);
223 if (!txx9wdt_reg) 221 if (!txx9wdt_reg)
224 goto exit_busy; 222 goto exit_busy;
225 223
diff --git a/firmware/Makefile b/firmware/Makefile
index 6d5c3abd06be..1c00d05578f7 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -69,7 +69,8 @@ fw-shipped-$(CONFIG_E100) += e100/d101m_ucode.bin e100/d101s_ucode.bin \
69fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin 69fw-shipped-$(CONFIG_MYRI_SBUS) += myricom/lanai.bin
70fw-shipped-$(CONFIG_PCMCIA_PCNET) += cis/LA-PCM.cis cis/PCMLM28.cis \ 70fw-shipped-$(CONFIG_PCMCIA_PCNET) += cis/LA-PCM.cis cis/PCMLM28.cis \
71 cis/DP83903.cis cis/NE2K.cis \ 71 cis/DP83903.cis cis/NE2K.cis \
72 cis/tamarack.cis cis/PE-200.cis 72 cis/tamarack.cis cis/PE-200.cis \
73 cis/PE520.cis
73fw-shipped-$(CONFIG_PCMCIA_3C589) += cis/3CXEM556.cis 74fw-shipped-$(CONFIG_PCMCIA_3C589) += cis/3CXEM556.cis
74fw-shipped-$(CONFIG_PCMCIA_3C574) += cis/3CCFEM556.cis 75fw-shipped-$(CONFIG_PCMCIA_3C574) += cis/3CCFEM556.cis
75fw-shipped-$(CONFIG_SERIAL_8250_CS) += cis/MT5634ZLX.cis cis/RS-COM-2P.cis \ 76fw-shipped-$(CONFIG_SERIAL_8250_CS) += cis/MT5634ZLX.cis cis/RS-COM-2P.cis \
diff --git a/firmware/WHENCE b/firmware/WHENCE
index 34b5d0a036db..ac174feda7cb 100644
--- a/firmware/WHENCE
+++ b/firmware/WHENCE
@@ -601,6 +601,7 @@ File: cis/LA-PCM.cis
601 cis/NE2K.cis 601 cis/NE2K.cis
602 cis/tamarack.cis 602 cis/tamarack.cis
603 cis/PE-200.cis 603 cis/PE-200.cis
604 cis/PE520.cis
604 605
605Licence: GPL 606Licence: GPL
606 607
diff --git a/firmware/cis/PE520.cis.ihex b/firmware/cis/PE520.cis.ihex
new file mode 100644
index 000000000000..97a745b5496e
--- /dev/null
+++ b/firmware/cis/PE520.cis.ihex
@@ -0,0 +1,9 @@
1:1000000001030000FF152304014B544900504535FE
2:10001000323020504C55530050434D434941204508
3:10002000746865726E65740000FF20046101100041
4:10003000210206001A050101D00F0B1B09C101198D
5:0A00400001556530FFFF1400FF00BA
6:00000001FF
7#
8# Replacement CIS for PE520 ethernet card
9#
diff --git a/fs/Kconfig b/fs/Kconfig
index f8fccaaad628..64d44efad7a5 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -6,10 +6,6 @@ menu "File systems"
6 6
7if BLOCK 7if BLOCK
8 8
9config FS_JOURNAL_INFO
10 bool
11 default n
12
13source "fs/ext2/Kconfig" 9source "fs/ext2/Kconfig"
14source "fs/ext3/Kconfig" 10source "fs/ext3/Kconfig"
15source "fs/ext4/Kconfig" 11source "fs/ext4/Kconfig"
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 94f5110c4655..9f0bf13291e5 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -35,14 +35,13 @@ static int anon_inodefs_get_sb(struct file_system_type *fs_type, int flags,
35 mnt); 35 mnt);
36} 36}
37 37
38static int anon_inodefs_delete_dentry(struct dentry *dentry) 38/*
39 * anon_inodefs_dname() is called from d_path().
40 */
41static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen)
39{ 42{
40 /* 43 return dynamic_dname(dentry, buffer, buflen, "anon_inode:%s",
41 * We faked vfs to believe the dentry was hashed when we created it. 44 dentry->d_name.name);
42 * Now we restore the flag so that dput() will work correctly.
43 */
44 dentry->d_flags |= DCACHE_UNHASHED;
45 return 1;
46} 45}
47 46
48static struct file_system_type anon_inode_fs_type = { 47static struct file_system_type anon_inode_fs_type = {
@@ -51,7 +50,7 @@ static struct file_system_type anon_inode_fs_type = {
51 .kill_sb = kill_anon_super, 50 .kill_sb = kill_anon_super,
52}; 51};
53static const struct dentry_operations anon_inodefs_dentry_operations = { 52static const struct dentry_operations anon_inodefs_dentry_operations = {
54 .d_delete = anon_inodefs_delete_dentry, 53 .d_dname = anon_inodefs_dname,
55}; 54};
56 55
57/* 56/*
@@ -119,18 +118,16 @@ struct file *anon_inode_getfile(const char *name,
119 atomic_inc(&anon_inode_inode->i_count); 118 atomic_inc(&anon_inode_inode->i_count);
120 119
121 path.dentry->d_op = &anon_inodefs_dentry_operations; 120 path.dentry->d_op = &anon_inodefs_dentry_operations;
122 /* Do not publish this dentry inside the global dentry hash table */
123 path.dentry->d_flags &= ~DCACHE_UNHASHED;
124 d_instantiate(path.dentry, anon_inode_inode); 121 d_instantiate(path.dentry, anon_inode_inode);
125 122
126 error = -ENFILE; 123 error = -ENFILE;
127 file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops); 124 file = alloc_file(&path, OPEN_FMODE(flags), fops);
128 if (!file) 125 if (!file)
129 goto err_dput; 126 goto err_dput;
130 file->f_mapping = anon_inode_inode->i_mapping; 127 file->f_mapping = anon_inode_inode->i_mapping;
131 128
132 file->f_pos = 0; 129 file->f_pos = 0;
133 file->f_flags = O_RDWR | (flags & O_NONBLOCK); 130 file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
134 file->f_version = 0; 131 file->f_version = 0;
135 file->private_data = priv; 132 file->private_data = priv;
136 133
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index b639dcf7c778..346b69405363 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -32,7 +32,7 @@
32 32
33static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 33static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
34static int load_aout_library(struct file*); 34static int load_aout_library(struct file*);
35static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); 35static int aout_core_dump(struct coredump_params *cprm);
36 36
37static struct linux_binfmt aout_format = { 37static struct linux_binfmt aout_format = {
38 .module = THIS_MODULE, 38 .module = THIS_MODULE,
@@ -89,8 +89,9 @@ if (file->f_op->llseek) { \
89 * dumping of the process results in another error.. 89 * dumping of the process results in another error..
90 */ 90 */
91 91
92static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit) 92static int aout_core_dump(struct coredump_params *cprm)
93{ 93{
94 struct file *file = cprm->file;
94 mm_segment_t fs; 95 mm_segment_t fs;
95 int has_dumped = 0; 96 int has_dumped = 0;
96 unsigned long dump_start, dump_size; 97 unsigned long dump_start, dump_size;
@@ -108,16 +109,16 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, u
108 current->flags |= PF_DUMPCORE; 109 current->flags |= PF_DUMPCORE;
109 strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm)); 110 strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
110 dump.u_ar0 = offsetof(struct user, regs); 111 dump.u_ar0 = offsetof(struct user, regs);
111 dump.signal = signr; 112 dump.signal = cprm->signr;
112 aout_dump_thread(regs, &dump); 113 aout_dump_thread(cprm->regs, &dump);
113 114
114/* If the size of the dump file exceeds the rlimit, then see what would happen 115/* If the size of the dump file exceeds the rlimit, then see what would happen
115 if we wrote the stack, but not the data area. */ 116 if we wrote the stack, but not the data area. */
116 if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > limit) 117 if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > cprm->limit)
117 dump.u_dsize = 0; 118 dump.u_dsize = 0;
118 119
119/* Make sure we have enough room to write the stack and data areas. */ 120/* Make sure we have enough room to write the stack and data areas. */
120 if ((dump.u_ssize + 1) * PAGE_SIZE > limit) 121 if ((dump.u_ssize + 1) * PAGE_SIZE > cprm->limit)
121 dump.u_ssize = 0; 122 dump.u_ssize = 0;
122 123
123/* make sure we actually have a data and stack area to dump */ 124/* make sure we actually have a data and stack area to dump */
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 97b6e9efeb7f..edd90c49003c 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -45,7 +45,7 @@ static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *,
45 * don't even try. 45 * don't even try.
46 */ 46 */
47#ifdef CONFIG_ELF_CORE 47#ifdef CONFIG_ELF_CORE
48static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); 48static int elf_core_dump(struct coredump_params *cprm);
49#else 49#else
50#define elf_core_dump NULL 50#define elf_core_dump NULL
51#endif 51#endif
@@ -1272,8 +1272,9 @@ static int writenote(struct memelfnote *men, struct file *file,
1272} 1272}
1273#undef DUMP_WRITE 1273#undef DUMP_WRITE
1274 1274
1275#define DUMP_WRITE(addr, nr) \ 1275#define DUMP_WRITE(addr, nr) \
1276 if ((size += (nr)) > limit || !dump_write(file, (addr), (nr))) \ 1276 if ((size += (nr)) > cprm->limit || \
1277 !dump_write(cprm->file, (addr), (nr))) \
1277 goto end_coredump; 1278 goto end_coredump;
1278 1279
1279static void fill_elf_header(struct elfhdr *elf, int segs, 1280static void fill_elf_header(struct elfhdr *elf, int segs,
@@ -1901,7 +1902,7 @@ static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
1901 * and then they are actually written out. If we run out of core limit 1902 * and then they are actually written out. If we run out of core limit
1902 * we just truncate. 1903 * we just truncate.
1903 */ 1904 */
1904static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit) 1905static int elf_core_dump(struct coredump_params *cprm)
1905{ 1906{
1906 int has_dumped = 0; 1907 int has_dumped = 0;
1907 mm_segment_t fs; 1908 mm_segment_t fs;
@@ -1947,7 +1948,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
1947 * notes. This also sets up the file header. 1948 * notes. This also sets up the file header.
1948 */ 1949 */
1949 if (!fill_note_info(elf, segs + 1, /* including notes section */ 1950 if (!fill_note_info(elf, segs + 1, /* including notes section */
1950 &info, signr, regs)) 1951 &info, cprm->signr, cprm->regs))
1951 goto cleanup; 1952 goto cleanup;
1952 1953
1953 has_dumped = 1; 1954 has_dumped = 1;
@@ -2009,14 +2010,14 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
2009#endif 2010#endif
2010 2011
2011 /* write out the notes section */ 2012 /* write out the notes section */
2012 if (!write_note_info(&info, file, &foffset)) 2013 if (!write_note_info(&info, cprm->file, &foffset))
2013 goto end_coredump; 2014 goto end_coredump;
2014 2015
2015 if (elf_coredump_extra_notes_write(file, &foffset)) 2016 if (elf_coredump_extra_notes_write(cprm->file, &foffset))
2016 goto end_coredump; 2017 goto end_coredump;
2017 2018
2018 /* Align to page */ 2019 /* Align to page */
2019 if (!dump_seek(file, dataoff - foffset)) 2020 if (!dump_seek(cprm->file, dataoff - foffset))
2020 goto end_coredump; 2021 goto end_coredump;
2021 2022
2022 for (vma = first_vma(current, gate_vma); vma != NULL; 2023 for (vma = first_vma(current, gate_vma); vma != NULL;
@@ -2033,12 +2034,13 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
2033 page = get_dump_page(addr); 2034 page = get_dump_page(addr);
2034 if (page) { 2035 if (page) {
2035 void *kaddr = kmap(page); 2036 void *kaddr = kmap(page);
2036 stop = ((size += PAGE_SIZE) > limit) || 2037 stop = ((size += PAGE_SIZE) > cprm->limit) ||
2037 !dump_write(file, kaddr, PAGE_SIZE); 2038 !dump_write(cprm->file, kaddr,
2039 PAGE_SIZE);
2038 kunmap(page); 2040 kunmap(page);
2039 page_cache_release(page); 2041 page_cache_release(page);
2040 } else 2042 } else
2041 stop = !dump_seek(file, PAGE_SIZE); 2043 stop = !dump_seek(cprm->file, PAGE_SIZE);
2042 if (stop) 2044 if (stop)
2043 goto end_coredump; 2045 goto end_coredump;
2044 } 2046 }
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 7b055385db8e..c57d9ce5ff7e 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -76,7 +76,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *,
76 struct file *, struct mm_struct *); 76 struct file *, struct mm_struct *);
77 77
78#ifdef CONFIG_ELF_CORE 78#ifdef CONFIG_ELF_CORE
79static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *, unsigned long limit); 79static int elf_fdpic_core_dump(struct coredump_params *cprm);
80#endif 80#endif
81 81
82static struct linux_binfmt elf_fdpic_format = { 82static struct linux_binfmt elf_fdpic_format = {
@@ -171,6 +171,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
171#ifdef ELF_FDPIC_PLAT_INIT 171#ifdef ELF_FDPIC_PLAT_INIT
172 unsigned long dynaddr; 172 unsigned long dynaddr;
173#endif 173#endif
174#ifndef CONFIG_MMU
175 unsigned long stack_prot;
176#endif
174 struct file *interpreter = NULL; /* to shut gcc up */ 177 struct file *interpreter = NULL; /* to shut gcc up */
175 char *interpreter_name = NULL; 178 char *interpreter_name = NULL;
176 int executable_stack; 179 int executable_stack;
@@ -316,6 +319,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
316 * defunct, deceased, etc. after this point we have to exit via 319 * defunct, deceased, etc. after this point we have to exit via
317 * error_kill */ 320 * error_kill */
318 set_personality(PER_LINUX_FDPIC); 321 set_personality(PER_LINUX_FDPIC);
322 if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
323 current->personality |= READ_IMPLIES_EXEC;
319 set_binfmt(&elf_fdpic_format); 324 set_binfmt(&elf_fdpic_format);
320 325
321 current->mm->start_code = 0; 326 current->mm->start_code = 0;
@@ -377,9 +382,13 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
377 if (stack_size < PAGE_SIZE * 2) 382 if (stack_size < PAGE_SIZE * 2)
378 stack_size = PAGE_SIZE * 2; 383 stack_size = PAGE_SIZE * 2;
379 384
385 stack_prot = PROT_READ | PROT_WRITE;
386 if (executable_stack == EXSTACK_ENABLE_X ||
387 (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC))
388 stack_prot |= PROT_EXEC;
389
380 down_write(&current->mm->mmap_sem); 390 down_write(&current->mm->mmap_sem);
381 current->mm->start_brk = do_mmap(NULL, 0, stack_size, 391 current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot,
382 PROT_READ | PROT_WRITE | PROT_EXEC,
383 MAP_PRIVATE | MAP_ANONYMOUS | 392 MAP_PRIVATE | MAP_ANONYMOUS |
384 MAP_UNINITIALIZED | MAP_GROWSDOWN, 393 MAP_UNINITIALIZED | MAP_GROWSDOWN,
385 0); 394 0);
@@ -1326,8 +1335,9 @@ static int writenote(struct memelfnote *men, struct file *file)
1326#undef DUMP_WRITE 1335#undef DUMP_WRITE
1327#undef DUMP_SEEK 1336#undef DUMP_SEEK
1328 1337
1329#define DUMP_WRITE(addr, nr) \ 1338#define DUMP_WRITE(addr, nr) \
1330 if ((size += (nr)) > limit || !dump_write(file, (addr), (nr))) \ 1339 if ((size += (nr)) > cprm->limit || \
1340 !dump_write(cprm->file, (addr), (nr))) \
1331 goto end_coredump; 1341 goto end_coredump;
1332 1342
1333static inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs) 1343static inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs)
@@ -1582,8 +1592,7 @@ static int elf_fdpic_dump_segments(struct file *file, size_t *size,
1582 * and then they are actually written out. If we run out of core limit 1592 * and then they are actually written out. If we run out of core limit
1583 * we just truncate. 1593 * we just truncate.
1584 */ 1594 */
1585static int elf_fdpic_core_dump(long signr, struct pt_regs *regs, 1595static int elf_fdpic_core_dump(struct coredump_params *cprm)
1586 struct file *file, unsigned long limit)
1587{ 1596{
1588#define NUM_NOTES 6 1597#define NUM_NOTES 6
1589 int has_dumped = 0; 1598 int has_dumped = 0;
@@ -1642,7 +1651,7 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1642 goto cleanup; 1651 goto cleanup;
1643#endif 1652#endif
1644 1653
1645 if (signr) { 1654 if (cprm->signr) {
1646 struct core_thread *ct; 1655 struct core_thread *ct;
1647 struct elf_thread_status *tmp; 1656 struct elf_thread_status *tmp;
1648 1657
@@ -1661,14 +1670,14 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1661 int sz; 1670 int sz;
1662 1671
1663 tmp = list_entry(t, struct elf_thread_status, list); 1672 tmp = list_entry(t, struct elf_thread_status, list);
1664 sz = elf_dump_thread_status(signr, tmp); 1673 sz = elf_dump_thread_status(cprm->signr, tmp);
1665 thread_status_size += sz; 1674 thread_status_size += sz;
1666 } 1675 }
1667 } 1676 }
1668 1677
1669 /* now collect the dump for the current */ 1678 /* now collect the dump for the current */
1670 fill_prstatus(prstatus, current, signr); 1679 fill_prstatus(prstatus, current, cprm->signr);
1671 elf_core_copy_regs(&prstatus->pr_reg, regs); 1680 elf_core_copy_regs(&prstatus->pr_reg, cprm->regs);
1672 1681
1673 segs = current->mm->map_count; 1682 segs = current->mm->map_count;
1674#ifdef ELF_CORE_EXTRA_PHDRS 1683#ifdef ELF_CORE_EXTRA_PHDRS
@@ -1703,7 +1712,7 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1703 1712
1704 /* Try to dump the FPU. */ 1713 /* Try to dump the FPU. */
1705 if ((prstatus->pr_fpvalid = 1714 if ((prstatus->pr_fpvalid =
1706 elf_core_copy_task_fpregs(current, regs, fpu))) 1715 elf_core_copy_task_fpregs(current, cprm->regs, fpu)))
1707 fill_note(notes + numnote++, 1716 fill_note(notes + numnote++,
1708 "CORE", NT_PRFPREG, sizeof(*fpu), fpu); 1717 "CORE", NT_PRFPREG, sizeof(*fpu), fpu);
1709#ifdef ELF_CORE_COPY_XFPREGS 1718#ifdef ELF_CORE_COPY_XFPREGS
@@ -1774,7 +1783,7 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1774 1783
1775 /* write out the notes section */ 1784 /* write out the notes section */
1776 for (i = 0; i < numnote; i++) 1785 for (i = 0; i < numnote; i++)
1777 if (!writenote(notes + i, file)) 1786 if (!writenote(notes + i, cprm->file))
1778 goto end_coredump; 1787 goto end_coredump;
1779 1788
1780 /* write out the thread status notes section */ 1789 /* write out the thread status notes section */
@@ -1783,25 +1792,26 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1783 list_entry(t, struct elf_thread_status, list); 1792 list_entry(t, struct elf_thread_status, list);
1784 1793
1785 for (i = 0; i < tmp->num_notes; i++) 1794 for (i = 0; i < tmp->num_notes; i++)
1786 if (!writenote(&tmp->notes[i], file)) 1795 if (!writenote(&tmp->notes[i], cprm->file))
1787 goto end_coredump; 1796 goto end_coredump;
1788 } 1797 }
1789 1798
1790 if (!dump_seek(file, dataoff)) 1799 if (!dump_seek(cprm->file, dataoff))
1791 goto end_coredump; 1800 goto end_coredump;
1792 1801
1793 if (elf_fdpic_dump_segments(file, &size, &limit, mm_flags) < 0) 1802 if (elf_fdpic_dump_segments(cprm->file, &size, &cprm->limit,
1803 mm_flags) < 0)
1794 goto end_coredump; 1804 goto end_coredump;
1795 1805
1796#ifdef ELF_CORE_WRITE_EXTRA_DATA 1806#ifdef ELF_CORE_WRITE_EXTRA_DATA
1797 ELF_CORE_WRITE_EXTRA_DATA; 1807 ELF_CORE_WRITE_EXTRA_DATA;
1798#endif 1808#endif
1799 1809
1800 if (file->f_pos != offset) { 1810 if (cprm->file->f_pos != offset) {
1801 /* Sanity check */ 1811 /* Sanity check */
1802 printk(KERN_WARNING 1812 printk(KERN_WARNING
1803 "elf_core_dump: file->f_pos (%lld) != offset (%lld)\n", 1813 "elf_core_dump: file->f_pos (%lld) != offset (%lld)\n",
1804 file->f_pos, offset); 1814 cprm->file->f_pos, offset);
1805 } 1815 }
1806 1816
1807end_coredump: 1817end_coredump:
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index a2796651e756..d4a00ea1054c 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -87,7 +87,7 @@ static int load_flat_shared_library(int id, struct lib_info *p);
87#endif 87#endif
88 88
89static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs); 89static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs);
90static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); 90static int flat_core_dump(struct coredump_params *cprm);
91 91
92static struct linux_binfmt flat_format = { 92static struct linux_binfmt flat_format = {
93 .module = THIS_MODULE, 93 .module = THIS_MODULE,
@@ -102,10 +102,10 @@ static struct linux_binfmt flat_format = {
102 * Currently only a stub-function. 102 * Currently only a stub-function.
103 */ 103 */
104 104
105static int flat_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit) 105static int flat_core_dump(struct coredump_params *cprm)
106{ 106{
107 printk("Process %s:%d received signr %d and should have core dumped\n", 107 printk("Process %s:%d received signr %d and should have core dumped\n",
108 current->comm, current->pid, (int) signr); 108 current->comm, current->pid, (int) cprm->signr);
109 return(1); 109 return(1);
110} 110}
111 111
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
index eff74b9c9e77..2a9b5330cc5e 100644
--- a/fs/binfmt_som.c
+++ b/fs/binfmt_som.c
@@ -43,7 +43,7 @@ static int load_som_library(struct file *);
43 * don't even try. 43 * don't even try.
44 */ 44 */
45#if 0 45#if 0
46static int som_core_dump(long signr, struct pt_regs *regs, unsigned long limit); 46static int som_core_dump(struct coredump_params *cprm);
47#else 47#else
48#define som_core_dump NULL 48#define som_core_dump NULL
49#endif 49#endif
diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
index 402afe0a0bfb..7bb3c020e570 100644
--- a/fs/btrfs/Kconfig
+++ b/fs/btrfs/Kconfig
@@ -4,7 +4,6 @@ config BTRFS_FS
4 select LIBCRC32C 4 select LIBCRC32C
5 select ZLIB_INFLATE 5 select ZLIB_INFLATE
6 select ZLIB_DEFLATE 6 select ZLIB_DEFLATE
7 select FS_JOURNAL_INFO
8 help 7 help
9 Btrfs is a new filesystem with extents, writable snapshotting, 8 Btrfs is a new filesystem with extents, writable snapshotting,
10 support for multiple devices and many more features. 9 support for multiple devices and many more features.
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 52cbe47022bf..2e9e69987a82 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -94,7 +94,8 @@ static int btrfs_xattr_acl_get(struct dentry *dentry, const char *name,
94/* 94/*
95 * Needs to be called with fs_mutex held 95 * Needs to be called with fs_mutex held
96 */ 96 */
97static int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) 97static int btrfs_set_acl(struct btrfs_trans_handle *trans,
98 struct inode *inode, struct posix_acl *acl, int type)
98{ 99{
99 int ret, size = 0; 100 int ret, size = 0;
100 const char *name; 101 const char *name;
@@ -140,8 +141,7 @@ static int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
140 goto out; 141 goto out;
141 } 142 }
142 143
143 ret = __btrfs_setxattr(inode, name, value, size, 0); 144 ret = __btrfs_setxattr(trans, inode, name, value, size, 0);
144
145out: 145out:
146 kfree(value); 146 kfree(value);
147 147
@@ -154,7 +154,7 @@ out:
154static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, 154static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
155 const void *value, size_t size, int flags, int type) 155 const void *value, size_t size, int flags, int type)
156{ 156{
157 int ret = 0; 157 int ret;
158 struct posix_acl *acl = NULL; 158 struct posix_acl *acl = NULL;
159 159
160 if (value) { 160 if (value) {
@@ -167,7 +167,7 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
167 } 167 }
168 } 168 }
169 169
170 ret = btrfs_set_acl(dentry->d_inode, acl, type); 170 ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type);
171 171
172 posix_acl_release(acl); 172 posix_acl_release(acl);
173 173
@@ -196,7 +196,8 @@ int btrfs_check_acl(struct inode *inode, int mask)
196 * stuff has been fixed to work with that. If the locking stuff changes, we 196 * stuff has been fixed to work with that. If the locking stuff changes, we
197 * need to re-evaluate the acl locking stuff. 197 * need to re-evaluate the acl locking stuff.
198 */ 198 */
199int btrfs_init_acl(struct inode *inode, struct inode *dir) 199int btrfs_init_acl(struct btrfs_trans_handle *trans,
200 struct inode *inode, struct inode *dir)
200{ 201{
201 struct posix_acl *acl = NULL; 202 struct posix_acl *acl = NULL;
202 int ret = 0; 203 int ret = 0;
@@ -221,7 +222,8 @@ int btrfs_init_acl(struct inode *inode, struct inode *dir)
221 mode_t mode; 222 mode_t mode;
222 223
223 if (S_ISDIR(inode->i_mode)) { 224 if (S_ISDIR(inode->i_mode)) {
224 ret = btrfs_set_acl(inode, acl, ACL_TYPE_DEFAULT); 225 ret = btrfs_set_acl(trans, inode, acl,
226 ACL_TYPE_DEFAULT);
225 if (ret) 227 if (ret)
226 goto failed; 228 goto failed;
227 } 229 }
@@ -236,7 +238,7 @@ int btrfs_init_acl(struct inode *inode, struct inode *dir)
236 inode->i_mode = mode; 238 inode->i_mode = mode;
237 if (ret > 0) { 239 if (ret > 0) {
238 /* we need an acl */ 240 /* we need an acl */
239 ret = btrfs_set_acl(inode, clone, 241 ret = btrfs_set_acl(trans, inode, clone,
240 ACL_TYPE_ACCESS); 242 ACL_TYPE_ACCESS);
241 } 243 }
242 } 244 }
@@ -269,7 +271,7 @@ int btrfs_acl_chmod(struct inode *inode)
269 271
270 ret = posix_acl_chmod_masq(clone, inode->i_mode); 272 ret = posix_acl_chmod_masq(clone, inode->i_mode);
271 if (!ret) 273 if (!ret)
272 ret = btrfs_set_acl(inode, clone, ACL_TYPE_ACCESS); 274 ret = btrfs_set_acl(NULL, inode, clone, ACL_TYPE_ACCESS);
273 275
274 posix_acl_release(clone); 276 posix_acl_release(clone);
275 277
@@ -297,7 +299,8 @@ int btrfs_acl_chmod(struct inode *inode)
297 return 0; 299 return 0;
298} 300}
299 301
300int btrfs_init_acl(struct inode *inode, struct inode *dir) 302int btrfs_init_acl(struct btrfs_trans_handle *trans,
303 struct inode *inode, struct inode *dir)
301{ 304{
302 return 0; 305 return 0;
303} 306}
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index f6783a42f010..3f1f50d9d916 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -44,9 +44,6 @@ struct btrfs_inode {
44 */ 44 */
45 struct extent_io_tree io_failure_tree; 45 struct extent_io_tree io_failure_tree;
46 46
47 /* held while inesrting or deleting extents from files */
48 struct mutex extent_mutex;
49
50 /* held while logging the inode in tree-log.c */ 47 /* held while logging the inode in tree-log.c */
51 struct mutex log_mutex; 48 struct mutex log_mutex;
52 49
@@ -166,7 +163,7 @@ static inline struct btrfs_inode *BTRFS_I(struct inode *inode)
166 163
167static inline void btrfs_i_size_write(struct inode *inode, u64 size) 164static inline void btrfs_i_size_write(struct inode *inode, u64 size)
168{ 165{
169 inode->i_size = size; 166 i_size_write(inode, size);
170 BTRFS_I(inode)->disk_i_size = size; 167 BTRFS_I(inode)->disk_i_size = size;
171} 168}
172 169
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index ec96f3a6d536..c4bc570a396e 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -37,6 +37,11 @@ static int balance_node_right(struct btrfs_trans_handle *trans,
37 struct extent_buffer *src_buf); 37 struct extent_buffer *src_buf);
38static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, 38static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
39 struct btrfs_path *path, int level, int slot); 39 struct btrfs_path *path, int level, int slot);
40static int setup_items_for_insert(struct btrfs_trans_handle *trans,
41 struct btrfs_root *root, struct btrfs_path *path,
42 struct btrfs_key *cpu_key, u32 *data_size,
43 u32 total_data, u32 total_size, int nr);
44
40 45
41struct btrfs_path *btrfs_alloc_path(void) 46struct btrfs_path *btrfs_alloc_path(void)
42{ 47{
@@ -451,9 +456,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
451 extent_buffer_get(cow); 456 extent_buffer_get(cow);
452 spin_unlock(&root->node_lock); 457 spin_unlock(&root->node_lock);
453 458
454 btrfs_free_extent(trans, root, buf->start, buf->len, 459 btrfs_free_tree_block(trans, root, buf->start, buf->len,
455 parent_start, root->root_key.objectid, 460 parent_start, root->root_key.objectid, level);
456 level, 0);
457 free_extent_buffer(buf); 461 free_extent_buffer(buf);
458 add_root_to_dirty_list(root); 462 add_root_to_dirty_list(root);
459 } else { 463 } else {
@@ -468,9 +472,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
468 btrfs_set_node_ptr_generation(parent, parent_slot, 472 btrfs_set_node_ptr_generation(parent, parent_slot,
469 trans->transid); 473 trans->transid);
470 btrfs_mark_buffer_dirty(parent); 474 btrfs_mark_buffer_dirty(parent);
471 btrfs_free_extent(trans, root, buf->start, buf->len, 475 btrfs_free_tree_block(trans, root, buf->start, buf->len,
472 parent_start, root->root_key.objectid, 476 parent_start, root->root_key.objectid, level);
473 level, 0);
474 } 477 }
475 if (unlock_orig) 478 if (unlock_orig)
476 btrfs_tree_unlock(buf); 479 btrfs_tree_unlock(buf);
@@ -1030,8 +1033,8 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1030 btrfs_tree_unlock(mid); 1033 btrfs_tree_unlock(mid);
1031 /* once for the path */ 1034 /* once for the path */
1032 free_extent_buffer(mid); 1035 free_extent_buffer(mid);
1033 ret = btrfs_free_extent(trans, root, mid->start, mid->len, 1036 ret = btrfs_free_tree_block(trans, root, mid->start, mid->len,
1034 0, root->root_key.objectid, level, 1); 1037 0, root->root_key.objectid, level);
1035 /* once for the root ptr */ 1038 /* once for the root ptr */
1036 free_extent_buffer(mid); 1039 free_extent_buffer(mid);
1037 return ret; 1040 return ret;
@@ -1095,10 +1098,10 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1095 1); 1098 1);
1096 if (wret) 1099 if (wret)
1097 ret = wret; 1100 ret = wret;
1098 wret = btrfs_free_extent(trans, root, bytenr, 1101 wret = btrfs_free_tree_block(trans, root,
1099 blocksize, 0, 1102 bytenr, blocksize, 0,
1100 root->root_key.objectid, 1103 root->root_key.objectid,
1101 level, 0); 1104 level);
1102 if (wret) 1105 if (wret)
1103 ret = wret; 1106 ret = wret;
1104 } else { 1107 } else {
@@ -1143,9 +1146,8 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1143 wret = del_ptr(trans, root, path, level + 1, pslot); 1146 wret = del_ptr(trans, root, path, level + 1, pslot);
1144 if (wret) 1147 if (wret)
1145 ret = wret; 1148 ret = wret;
1146 wret = btrfs_free_extent(trans, root, bytenr, blocksize, 1149 wret = btrfs_free_tree_block(trans, root, bytenr, blocksize,
1147 0, root->root_key.objectid, 1150 0, root->root_key.objectid, level);
1148 level, 0);
1149 if (wret) 1151 if (wret)
1150 ret = wret; 1152 ret = wret;
1151 } else { 1153 } else {
@@ -2997,75 +2999,85 @@ again:
2997 return ret; 2999 return ret;
2998} 3000}
2999 3001
3000/* 3002static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans,
3001 * This function splits a single item into two items, 3003 struct btrfs_root *root,
3002 * giving 'new_key' to the new item and splitting the 3004 struct btrfs_path *path, int ins_len)
3003 * old one at split_offset (from the start of the item).
3004 *
3005 * The path may be released by this operation. After
3006 * the split, the path is pointing to the old item. The
3007 * new item is going to be in the same node as the old one.
3008 *
3009 * Note, the item being split must be smaller enough to live alone on
3010 * a tree block with room for one extra struct btrfs_item
3011 *
3012 * This allows us to split the item in place, keeping a lock on the
3013 * leaf the entire time.
3014 */
3015int btrfs_split_item(struct btrfs_trans_handle *trans,
3016 struct btrfs_root *root,
3017 struct btrfs_path *path,
3018 struct btrfs_key *new_key,
3019 unsigned long split_offset)
3020{ 3005{
3021 u32 item_size; 3006 struct btrfs_key key;
3022 struct extent_buffer *leaf; 3007 struct extent_buffer *leaf;
3023 struct btrfs_key orig_key; 3008 struct btrfs_file_extent_item *fi;
3024 struct btrfs_item *item; 3009 u64 extent_len = 0;
3025 struct btrfs_item *new_item; 3010 u32 item_size;
3026 int ret = 0; 3011 int ret;
3027 int slot;
3028 u32 nritems;
3029 u32 orig_offset;
3030 struct btrfs_disk_key disk_key;
3031 char *buf;
3032 3012
3033 leaf = path->nodes[0]; 3013 leaf = path->nodes[0];
3034 btrfs_item_key_to_cpu(leaf, &orig_key, path->slots[0]); 3014 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
3035 if (btrfs_leaf_free_space(root, leaf) >= sizeof(struct btrfs_item)) 3015
3036 goto split; 3016 BUG_ON(key.type != BTRFS_EXTENT_DATA_KEY &&
3017 key.type != BTRFS_EXTENT_CSUM_KEY);
3018
3019 if (btrfs_leaf_free_space(root, leaf) >= ins_len)
3020 return 0;
3037 3021
3038 item_size = btrfs_item_size_nr(leaf, path->slots[0]); 3022 item_size = btrfs_item_size_nr(leaf, path->slots[0]);
3023 if (key.type == BTRFS_EXTENT_DATA_KEY) {
3024 fi = btrfs_item_ptr(leaf, path->slots[0],
3025 struct btrfs_file_extent_item);
3026 extent_len = btrfs_file_extent_num_bytes(leaf, fi);
3027 }
3039 btrfs_release_path(root, path); 3028 btrfs_release_path(root, path);
3040 3029
3041 path->search_for_split = 1;
3042 path->keep_locks = 1; 3030 path->keep_locks = 1;
3043 3031 path->search_for_split = 1;
3044 ret = btrfs_search_slot(trans, root, &orig_key, path, 0, 1); 3032 ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
3045 path->search_for_split = 0; 3033 path->search_for_split = 0;
3034 if (ret < 0)
3035 goto err;
3046 3036
3037 ret = -EAGAIN;
3038 leaf = path->nodes[0];
3047 /* if our item isn't there or got smaller, return now */ 3039 /* if our item isn't there or got smaller, return now */
3048 if (ret != 0 || item_size != btrfs_item_size_nr(path->nodes[0], 3040 if (ret > 0 || item_size != btrfs_item_size_nr(leaf, path->slots[0]))
3049 path->slots[0])) { 3041 goto err;
3050 path->keep_locks = 0; 3042
3051 return -EAGAIN; 3043 if (key.type == BTRFS_EXTENT_DATA_KEY) {
3044 fi = btrfs_item_ptr(leaf, path->slots[0],
3045 struct btrfs_file_extent_item);
3046 if (extent_len != btrfs_file_extent_num_bytes(leaf, fi))
3047 goto err;
3052 } 3048 }
3053 3049
3054 btrfs_set_path_blocking(path); 3050 btrfs_set_path_blocking(path);
3055 ret = split_leaf(trans, root, &orig_key, path, 3051 ret = split_leaf(trans, root, &key, path, ins_len, 1);
3056 sizeof(struct btrfs_item), 1);
3057 path->keep_locks = 0;
3058 BUG_ON(ret); 3052 BUG_ON(ret);
3059 3053
3054 path->keep_locks = 0;
3060 btrfs_unlock_up_safe(path, 1); 3055 btrfs_unlock_up_safe(path, 1);
3056 return 0;
3057err:
3058 path->keep_locks = 0;
3059 return ret;
3060}
3061
3062static noinline int split_item(struct btrfs_trans_handle *trans,
3063 struct btrfs_root *root,
3064 struct btrfs_path *path,
3065 struct btrfs_key *new_key,
3066 unsigned long split_offset)
3067{
3068 struct extent_buffer *leaf;
3069 struct btrfs_item *item;
3070 struct btrfs_item *new_item;
3071 int slot;
3072 char *buf;
3073 u32 nritems;
3074 u32 item_size;
3075 u32 orig_offset;
3076 struct btrfs_disk_key disk_key;
3077
3061 leaf = path->nodes[0]; 3078 leaf = path->nodes[0];
3062 BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item)); 3079 BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item));
3063 3080
3064split:
3065 /*
3066 * make sure any changes to the path from split_leaf leave it
3067 * in a blocking state
3068 */
3069 btrfs_set_path_blocking(path); 3081 btrfs_set_path_blocking(path);
3070 3082
3071 item = btrfs_item_nr(leaf, path->slots[0]); 3083 item = btrfs_item_nr(leaf, path->slots[0]);
@@ -3073,19 +3085,19 @@ split:
3073 item_size = btrfs_item_size(leaf, item); 3085 item_size = btrfs_item_size(leaf, item);
3074 3086
3075 buf = kmalloc(item_size, GFP_NOFS); 3087 buf = kmalloc(item_size, GFP_NOFS);
3088 if (!buf)
3089 return -ENOMEM;
3090
3076 read_extent_buffer(leaf, buf, btrfs_item_ptr_offset(leaf, 3091 read_extent_buffer(leaf, buf, btrfs_item_ptr_offset(leaf,
3077 path->slots[0]), item_size); 3092 path->slots[0]), item_size);
3078 slot = path->slots[0] + 1;
3079 leaf = path->nodes[0];
3080 3093
3094 slot = path->slots[0] + 1;
3081 nritems = btrfs_header_nritems(leaf); 3095 nritems = btrfs_header_nritems(leaf);
3082
3083 if (slot != nritems) { 3096 if (slot != nritems) {
3084 /* shift the items */ 3097 /* shift the items */
3085 memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + 1), 3098 memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + 1),
3086 btrfs_item_nr_offset(slot), 3099 btrfs_item_nr_offset(slot),
3087 (nritems - slot) * sizeof(struct btrfs_item)); 3100 (nritems - slot) * sizeof(struct btrfs_item));
3088
3089 } 3101 }
3090 3102
3091 btrfs_cpu_key_to_disk(&disk_key, new_key); 3103 btrfs_cpu_key_to_disk(&disk_key, new_key);
@@ -3113,16 +3125,81 @@ split:
3113 item_size - split_offset); 3125 item_size - split_offset);
3114 btrfs_mark_buffer_dirty(leaf); 3126 btrfs_mark_buffer_dirty(leaf);
3115 3127
3116 ret = 0; 3128 BUG_ON(btrfs_leaf_free_space(root, leaf) < 0);
3117 if (btrfs_leaf_free_space(root, leaf) < 0) {
3118 btrfs_print_leaf(root, leaf);
3119 BUG();
3120 }
3121 kfree(buf); 3129 kfree(buf);
3130 return 0;
3131}
3132
3133/*
3134 * This function splits a single item into two items,
3135 * giving 'new_key' to the new item and splitting the
3136 * old one at split_offset (from the start of the item).
3137 *
3138 * The path may be released by this operation. After
3139 * the split, the path is pointing to the old item. The
3140 * new item is going to be in the same node as the old one.
3141 *
3142 * Note, the item being split must be smaller enough to live alone on
3143 * a tree block with room for one extra struct btrfs_item
3144 *
3145 * This allows us to split the item in place, keeping a lock on the
3146 * leaf the entire time.
3147 */
3148int btrfs_split_item(struct btrfs_trans_handle *trans,
3149 struct btrfs_root *root,
3150 struct btrfs_path *path,
3151 struct btrfs_key *new_key,
3152 unsigned long split_offset)
3153{
3154 int ret;
3155 ret = setup_leaf_for_split(trans, root, path,
3156 sizeof(struct btrfs_item));
3157 if (ret)
3158 return ret;
3159
3160 ret = split_item(trans, root, path, new_key, split_offset);
3122 return ret; 3161 return ret;
3123} 3162}
3124 3163
3125/* 3164/*
3165 * This function duplicate a item, giving 'new_key' to the new item.
3166 * It guarantees both items live in the same tree leaf and the new item
3167 * is contiguous with the original item.
3168 *
3169 * This allows us to split file extent in place, keeping a lock on the
3170 * leaf the entire time.
3171 */
3172int btrfs_duplicate_item(struct btrfs_trans_handle *trans,
3173 struct btrfs_root *root,
3174 struct btrfs_path *path,
3175 struct btrfs_key *new_key)
3176{
3177 struct extent_buffer *leaf;
3178 int ret;
3179 u32 item_size;
3180
3181 leaf = path->nodes[0];
3182 item_size = btrfs_item_size_nr(leaf, path->slots[0]);
3183 ret = setup_leaf_for_split(trans, root, path,
3184 item_size + sizeof(struct btrfs_item));
3185 if (ret)
3186 return ret;
3187
3188 path->slots[0]++;
3189 ret = setup_items_for_insert(trans, root, path, new_key, &item_size,
3190 item_size, item_size +
3191 sizeof(struct btrfs_item), 1);
3192 BUG_ON(ret);
3193
3194 leaf = path->nodes[0];
3195 memcpy_extent_buffer(leaf,
3196 btrfs_item_ptr_offset(leaf, path->slots[0]),
3197 btrfs_item_ptr_offset(leaf, path->slots[0] - 1),
3198 item_size);
3199 return 0;
3200}
3201
3202/*
3126 * make the item pointed to by the path smaller. new_size indicates 3203 * make the item pointed to by the path smaller. new_size indicates
3127 * how small to make it, and from_end tells us if we just chop bytes 3204 * how small to make it, and from_end tells us if we just chop bytes
3128 * off the end of the item or if we shift the item to chop bytes off 3205 * off the end of the item or if we shift the item to chop bytes off
@@ -3714,8 +3791,8 @@ static noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans,
3714 */ 3791 */
3715 btrfs_unlock_up_safe(path, 0); 3792 btrfs_unlock_up_safe(path, 0);
3716 3793
3717 ret = btrfs_free_extent(trans, root, leaf->start, leaf->len, 3794 ret = btrfs_free_tree_block(trans, root, leaf->start, leaf->len,
3718 0, root->root_key.objectid, 0, 0); 3795 0, root->root_key.objectid, 0);
3719 return ret; 3796 return ret;
3720} 3797}
3721/* 3798/*
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 444b3e9b92a4..9f806dd04c27 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -310,6 +310,9 @@ struct btrfs_header {
310#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \ 310#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
311 sizeof(struct btrfs_item) - \ 311 sizeof(struct btrfs_item) - \
312 sizeof(struct btrfs_file_extent_item)) 312 sizeof(struct btrfs_file_extent_item))
313#define BTRFS_MAX_XATTR_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
314 sizeof(struct btrfs_item) -\
315 sizeof(struct btrfs_dir_item))
313 316
314 317
315/* 318/*
@@ -859,8 +862,9 @@ struct btrfs_fs_info {
859 struct mutex ordered_operations_mutex; 862 struct mutex ordered_operations_mutex;
860 struct rw_semaphore extent_commit_sem; 863 struct rw_semaphore extent_commit_sem;
861 864
862 struct rw_semaphore subvol_sem; 865 struct rw_semaphore cleanup_work_sem;
863 866
867 struct rw_semaphore subvol_sem;
864 struct srcu_struct subvol_srcu; 868 struct srcu_struct subvol_srcu;
865 869
866 struct list_head trans_list; 870 struct list_head trans_list;
@@ -868,6 +872,9 @@ struct btrfs_fs_info {
868 struct list_head dead_roots; 872 struct list_head dead_roots;
869 struct list_head caching_block_groups; 873 struct list_head caching_block_groups;
870 874
875 spinlock_t delayed_iput_lock;
876 struct list_head delayed_iputs;
877
871 atomic_t nr_async_submits; 878 atomic_t nr_async_submits;
872 atomic_t async_submit_draining; 879 atomic_t async_submit_draining;
873 atomic_t nr_async_bios; 880 atomic_t nr_async_bios;
@@ -1034,12 +1041,12 @@ struct btrfs_root {
1034 int ref_cows; 1041 int ref_cows;
1035 int track_dirty; 1042 int track_dirty;
1036 int in_radix; 1043 int in_radix;
1044 int clean_orphans;
1037 1045
1038 u64 defrag_trans_start; 1046 u64 defrag_trans_start;
1039 struct btrfs_key defrag_progress; 1047 struct btrfs_key defrag_progress;
1040 struct btrfs_key defrag_max; 1048 struct btrfs_key defrag_max;
1041 int defrag_running; 1049 int defrag_running;
1042 int defrag_level;
1043 char *name; 1050 char *name;
1044 int in_sysfs; 1051 int in_sysfs;
1045 1052
@@ -1975,6 +1982,10 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
1975 u64 parent, u64 root_objectid, 1982 u64 parent, u64 root_objectid,
1976 struct btrfs_disk_key *key, int level, 1983 struct btrfs_disk_key *key, int level,
1977 u64 hint, u64 empty_size); 1984 u64 hint, u64 empty_size);
1985int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
1986 struct btrfs_root *root,
1987 u64 bytenr, u32 blocksize,
1988 u64 parent, u64 root_objectid, int level);
1978struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, 1989struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
1979 struct btrfs_root *root, 1990 struct btrfs_root *root,
1980 u64 bytenr, u32 blocksize, 1991 u64 bytenr, u32 blocksize,
@@ -2089,6 +2100,10 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
2089 struct btrfs_path *path, 2100 struct btrfs_path *path,
2090 struct btrfs_key *new_key, 2101 struct btrfs_key *new_key,
2091 unsigned long split_offset); 2102 unsigned long split_offset);
2103int btrfs_duplicate_item(struct btrfs_trans_handle *trans,
2104 struct btrfs_root *root,
2105 struct btrfs_path *path,
2106 struct btrfs_key *new_key);
2092int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root 2107int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
2093 *root, struct btrfs_key *key, struct btrfs_path *p, int 2108 *root, struct btrfs_key *key, struct btrfs_path *p, int
2094 ins_len, int cow); 2109 ins_len, int cow);
@@ -2196,9 +2211,10 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
2196 struct btrfs_path *path, 2211 struct btrfs_path *path,
2197 struct btrfs_dir_item *di); 2212 struct btrfs_dir_item *di);
2198int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans, 2213int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
2199 struct btrfs_root *root, const char *name, 2214 struct btrfs_root *root,
2200 u16 name_len, const void *data, u16 data_len, 2215 struct btrfs_path *path, u64 objectid,
2201 u64 dir); 2216 const char *name, u16 name_len,
2217 const void *data, u16 data_len);
2202struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, 2218struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
2203 struct btrfs_root *root, 2219 struct btrfs_root *root,
2204 struct btrfs_path *path, u64 dir, 2220 struct btrfs_path *path, u64 dir,
@@ -2292,7 +2308,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
2292 struct inode *inode, u64 new_size, 2308 struct inode *inode, u64 new_size,
2293 u32 min_type); 2309 u32 min_type);
2294 2310
2295int btrfs_start_delalloc_inodes(struct btrfs_root *root); 2311int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput);
2296int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end); 2312int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end);
2297int btrfs_writepages(struct address_space *mapping, 2313int btrfs_writepages(struct address_space *mapping,
2298 struct writeback_control *wbc); 2314 struct writeback_control *wbc);
@@ -2332,6 +2348,8 @@ int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode);
2332void btrfs_orphan_cleanup(struct btrfs_root *root); 2348void btrfs_orphan_cleanup(struct btrfs_root *root);
2333int btrfs_cont_expand(struct inode *inode, loff_t size); 2349int btrfs_cont_expand(struct inode *inode, loff_t size);
2334int btrfs_invalidate_inodes(struct btrfs_root *root); 2350int btrfs_invalidate_inodes(struct btrfs_root *root);
2351void btrfs_add_delayed_iput(struct inode *inode);
2352void btrfs_run_delayed_iputs(struct btrfs_root *root);
2335extern const struct dentry_operations btrfs_dentry_operations; 2353extern const struct dentry_operations btrfs_dentry_operations;
2336 2354
2337/* ioctl.c */ 2355/* ioctl.c */
@@ -2345,12 +2363,9 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
2345 int skip_pinned); 2363 int skip_pinned);
2346int btrfs_check_file(struct btrfs_root *root, struct inode *inode); 2364int btrfs_check_file(struct btrfs_root *root, struct inode *inode);
2347extern const struct file_operations btrfs_file_operations; 2365extern const struct file_operations btrfs_file_operations;
2348int btrfs_drop_extents(struct btrfs_trans_handle *trans, 2366int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode,
2349 struct btrfs_root *root, struct inode *inode, 2367 u64 start, u64 end, u64 *hint_byte, int drop_cache);
2350 u64 start, u64 end, u64 locked_end,
2351 u64 inline_limit, u64 *hint_block, int drop_cache);
2352int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, 2368int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
2353 struct btrfs_root *root,
2354 struct inode *inode, u64 start, u64 end); 2369 struct inode *inode, u64 start, u64 end);
2355int btrfs_release_file(struct inode *inode, struct file *file); 2370int btrfs_release_file(struct inode *inode, struct file *file);
2356 2371
@@ -2380,7 +2395,8 @@ int btrfs_check_acl(struct inode *inode, int mask);
2380#else 2395#else
2381#define btrfs_check_acl NULL 2396#define btrfs_check_acl NULL
2382#endif 2397#endif
2383int btrfs_init_acl(struct inode *inode, struct inode *dir); 2398int btrfs_init_acl(struct btrfs_trans_handle *trans,
2399 struct inode *inode, struct inode *dir);
2384int btrfs_acl_chmod(struct inode *inode); 2400int btrfs_acl_chmod(struct inode *inode);
2385 2401
2386/* relocation.c */ 2402/* relocation.c */
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index f3a6075519cc..e9103b3baa49 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -68,12 +68,12 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
68 * into the tree 68 * into the tree
69 */ 69 */
70int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans, 70int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
71 struct btrfs_root *root, const char *name, 71 struct btrfs_root *root,
72 u16 name_len, const void *data, u16 data_len, 72 struct btrfs_path *path, u64 objectid,
73 u64 dir) 73 const char *name, u16 name_len,
74 const void *data, u16 data_len)
74{ 75{
75 int ret = 0; 76 int ret = 0;
76 struct btrfs_path *path;
77 struct btrfs_dir_item *dir_item; 77 struct btrfs_dir_item *dir_item;
78 unsigned long name_ptr, data_ptr; 78 unsigned long name_ptr, data_ptr;
79 struct btrfs_key key, location; 79 struct btrfs_key key, location;
@@ -81,15 +81,11 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
81 struct extent_buffer *leaf; 81 struct extent_buffer *leaf;
82 u32 data_size; 82 u32 data_size;
83 83
84 key.objectid = dir; 84 BUG_ON(name_len + data_len > BTRFS_MAX_XATTR_SIZE(root));
85
86 key.objectid = objectid;
85 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY); 87 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
86 key.offset = btrfs_name_hash(name, name_len); 88 key.offset = btrfs_name_hash(name, name_len);
87 path = btrfs_alloc_path();
88 if (!path)
89 return -ENOMEM;
90 if (name_len + data_len + sizeof(struct btrfs_dir_item) >
91 BTRFS_LEAF_DATA_SIZE(root) - sizeof(struct btrfs_item))
92 return -ENOSPC;
93 89
94 data_size = sizeof(*dir_item) + name_len + data_len; 90 data_size = sizeof(*dir_item) + name_len + data_len;
95 dir_item = insert_with_overflow(trans, root, path, &key, data_size, 91 dir_item = insert_with_overflow(trans, root, path, &key, data_size,
@@ -117,7 +113,6 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
117 write_extent_buffer(leaf, data, data_ptr, data_len); 113 write_extent_buffer(leaf, data, data_ptr, data_len);
118 btrfs_mark_buffer_dirty(path->nodes[0]); 114 btrfs_mark_buffer_dirty(path->nodes[0]);
119 115
120 btrfs_free_path(path);
121 return ret; 116 return ret;
122} 117}
123 118
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 02b6afbd7450..009e3bd18f23 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -892,6 +892,8 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
892 root->stripesize = stripesize; 892 root->stripesize = stripesize;
893 root->ref_cows = 0; 893 root->ref_cows = 0;
894 root->track_dirty = 0; 894 root->track_dirty = 0;
895 root->in_radix = 0;
896 root->clean_orphans = 0;
895 897
896 root->fs_info = fs_info; 898 root->fs_info = fs_info;
897 root->objectid = objectid; 899 root->objectid = objectid;
@@ -928,7 +930,6 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
928 root->defrag_trans_start = fs_info->generation; 930 root->defrag_trans_start = fs_info->generation;
929 init_completion(&root->kobj_unregister); 931 init_completion(&root->kobj_unregister);
930 root->defrag_running = 0; 932 root->defrag_running = 0;
931 root->defrag_level = 0;
932 root->root_key.objectid = objectid; 933 root->root_key.objectid = objectid;
933 root->anon_super.s_root = NULL; 934 root->anon_super.s_root = NULL;
934 root->anon_super.s_dev = 0; 935 root->anon_super.s_dev = 0;
@@ -980,12 +981,12 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
980 981
981 while (1) { 982 while (1) {
982 ret = find_first_extent_bit(&log_root_tree->dirty_log_pages, 983 ret = find_first_extent_bit(&log_root_tree->dirty_log_pages,
983 0, &start, &end, EXTENT_DIRTY); 984 0, &start, &end, EXTENT_DIRTY | EXTENT_NEW);
984 if (ret) 985 if (ret)
985 break; 986 break;
986 987
987 clear_extent_dirty(&log_root_tree->dirty_log_pages, 988 clear_extent_bits(&log_root_tree->dirty_log_pages, start, end,
988 start, end, GFP_NOFS); 989 EXTENT_DIRTY | EXTENT_NEW, GFP_NOFS);
989 } 990 }
990 eb = fs_info->log_root_tree->node; 991 eb = fs_info->log_root_tree->node;
991 992
@@ -1210,8 +1211,10 @@ again:
1210 ret = radix_tree_insert(&fs_info->fs_roots_radix, 1211 ret = radix_tree_insert(&fs_info->fs_roots_radix,
1211 (unsigned long)root->root_key.objectid, 1212 (unsigned long)root->root_key.objectid,
1212 root); 1213 root);
1213 if (ret == 0) 1214 if (ret == 0) {
1214 root->in_radix = 1; 1215 root->in_radix = 1;
1216 root->clean_orphans = 1;
1217 }
1215 spin_unlock(&fs_info->fs_roots_radix_lock); 1218 spin_unlock(&fs_info->fs_roots_radix_lock);
1216 radix_tree_preload_end(); 1219 radix_tree_preload_end();
1217 if (ret) { 1220 if (ret) {
@@ -1225,10 +1228,6 @@ again:
1225 ret = btrfs_find_dead_roots(fs_info->tree_root, 1228 ret = btrfs_find_dead_roots(fs_info->tree_root,
1226 root->root_key.objectid); 1229 root->root_key.objectid);
1227 WARN_ON(ret); 1230 WARN_ON(ret);
1228
1229 if (!(fs_info->sb->s_flags & MS_RDONLY))
1230 btrfs_orphan_cleanup(root);
1231
1232 return root; 1231 return root;
1233fail: 1232fail:
1234 free_fs_root(root); 1233 free_fs_root(root);
@@ -1477,6 +1476,7 @@ static int cleaner_kthread(void *arg)
1477 1476
1478 if (!(root->fs_info->sb->s_flags & MS_RDONLY) && 1477 if (!(root->fs_info->sb->s_flags & MS_RDONLY) &&
1479 mutex_trylock(&root->fs_info->cleaner_mutex)) { 1478 mutex_trylock(&root->fs_info->cleaner_mutex)) {
1479 btrfs_run_delayed_iputs(root);
1480 btrfs_clean_old_snapshots(root); 1480 btrfs_clean_old_snapshots(root);
1481 mutex_unlock(&root->fs_info->cleaner_mutex); 1481 mutex_unlock(&root->fs_info->cleaner_mutex);
1482 } 1482 }
@@ -1606,6 +1606,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1606 INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_ATOMIC); 1606 INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_ATOMIC);
1607 INIT_LIST_HEAD(&fs_info->trans_list); 1607 INIT_LIST_HEAD(&fs_info->trans_list);
1608 INIT_LIST_HEAD(&fs_info->dead_roots); 1608 INIT_LIST_HEAD(&fs_info->dead_roots);
1609 INIT_LIST_HEAD(&fs_info->delayed_iputs);
1609 INIT_LIST_HEAD(&fs_info->hashers); 1610 INIT_LIST_HEAD(&fs_info->hashers);
1610 INIT_LIST_HEAD(&fs_info->delalloc_inodes); 1611 INIT_LIST_HEAD(&fs_info->delalloc_inodes);
1611 INIT_LIST_HEAD(&fs_info->ordered_operations); 1612 INIT_LIST_HEAD(&fs_info->ordered_operations);
@@ -1614,6 +1615,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1614 spin_lock_init(&fs_info->new_trans_lock); 1615 spin_lock_init(&fs_info->new_trans_lock);
1615 spin_lock_init(&fs_info->ref_cache_lock); 1616 spin_lock_init(&fs_info->ref_cache_lock);
1616 spin_lock_init(&fs_info->fs_roots_radix_lock); 1617 spin_lock_init(&fs_info->fs_roots_radix_lock);
1618 spin_lock_init(&fs_info->delayed_iput_lock);
1617 1619
1618 init_completion(&fs_info->kobj_unregister); 1620 init_completion(&fs_info->kobj_unregister);
1619 fs_info->tree_root = tree_root; 1621 fs_info->tree_root = tree_root;
@@ -1689,6 +1691,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1689 mutex_init(&fs_info->cleaner_mutex); 1691 mutex_init(&fs_info->cleaner_mutex);
1690 mutex_init(&fs_info->volume_mutex); 1692 mutex_init(&fs_info->volume_mutex);
1691 init_rwsem(&fs_info->extent_commit_sem); 1693 init_rwsem(&fs_info->extent_commit_sem);
1694 init_rwsem(&fs_info->cleanup_work_sem);
1692 init_rwsem(&fs_info->subvol_sem); 1695 init_rwsem(&fs_info->subvol_sem);
1693 1696
1694 btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); 1697 btrfs_init_free_cluster(&fs_info->meta_alloc_cluster);
@@ -2386,8 +2389,14 @@ int btrfs_commit_super(struct btrfs_root *root)
2386 int ret; 2389 int ret;
2387 2390
2388 mutex_lock(&root->fs_info->cleaner_mutex); 2391 mutex_lock(&root->fs_info->cleaner_mutex);
2392 btrfs_run_delayed_iputs(root);
2389 btrfs_clean_old_snapshots(root); 2393 btrfs_clean_old_snapshots(root);
2390 mutex_unlock(&root->fs_info->cleaner_mutex); 2394 mutex_unlock(&root->fs_info->cleaner_mutex);
2395
2396 /* wait until ongoing cleanup work done */
2397 down_write(&root->fs_info->cleanup_work_sem);
2398 up_write(&root->fs_info->cleanup_work_sem);
2399
2391 trans = btrfs_start_transaction(root, 1); 2400 trans = btrfs_start_transaction(root, 1);
2392 ret = btrfs_commit_transaction(trans, root); 2401 ret = btrfs_commit_transaction(trans, root);
2393 BUG_ON(ret); 2402 BUG_ON(ret);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 94627c4cc193..56e50137d0e6 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -195,6 +195,14 @@ static int exclude_super_stripes(struct btrfs_root *root,
195 int stripe_len; 195 int stripe_len;
196 int i, nr, ret; 196 int i, nr, ret;
197 197
198 if (cache->key.objectid < BTRFS_SUPER_INFO_OFFSET) {
199 stripe_len = BTRFS_SUPER_INFO_OFFSET - cache->key.objectid;
200 cache->bytes_super += stripe_len;
201 ret = add_excluded_extent(root, cache->key.objectid,
202 stripe_len);
203 BUG_ON(ret);
204 }
205
198 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { 206 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
199 bytenr = btrfs_sb_offset(i); 207 bytenr = btrfs_sb_offset(i);
200 ret = btrfs_rmap_block(&root->fs_info->mapping_tree, 208 ret = btrfs_rmap_block(&root->fs_info->mapping_tree,
@@ -255,7 +263,7 @@ static u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
255 if (ret) 263 if (ret)
256 break; 264 break;
257 265
258 if (extent_start == start) { 266 if (extent_start <= start) {
259 start = extent_end + 1; 267 start = extent_end + 1;
260 } else if (extent_start > start && extent_start < end) { 268 } else if (extent_start > start && extent_start < end) {
261 size = extent_start - start; 269 size = extent_start - start;
@@ -2880,9 +2888,9 @@ static noinline void flush_delalloc_async(struct btrfs_work *work)
2880 root = async->root; 2888 root = async->root;
2881 info = async->info; 2889 info = async->info;
2882 2890
2883 btrfs_start_delalloc_inodes(root); 2891 btrfs_start_delalloc_inodes(root, 0);
2884 wake_up(&info->flush_wait); 2892 wake_up(&info->flush_wait);
2885 btrfs_wait_ordered_extents(root, 0); 2893 btrfs_wait_ordered_extents(root, 0, 0);
2886 2894
2887 spin_lock(&info->lock); 2895 spin_lock(&info->lock);
2888 info->flushing = 0; 2896 info->flushing = 0;
@@ -2956,8 +2964,8 @@ static void flush_delalloc(struct btrfs_root *root,
2956 return; 2964 return;
2957 2965
2958flush: 2966flush:
2959 btrfs_start_delalloc_inodes(root); 2967 btrfs_start_delalloc_inodes(root, 0);
2960 btrfs_wait_ordered_extents(root, 0); 2968 btrfs_wait_ordered_extents(root, 0, 0);
2961 2969
2962 spin_lock(&info->lock); 2970 spin_lock(&info->lock);
2963 info->flushing = 0; 2971 info->flushing = 0;
@@ -3454,14 +3462,6 @@ static int update_block_group(struct btrfs_trans_handle *trans,
3454 else 3462 else
3455 old_val -= num_bytes; 3463 old_val -= num_bytes;
3456 btrfs_set_super_bytes_used(&info->super_copy, old_val); 3464 btrfs_set_super_bytes_used(&info->super_copy, old_val);
3457
3458 /* block accounting for root item */
3459 old_val = btrfs_root_used(&root->root_item);
3460 if (alloc)
3461 old_val += num_bytes;
3462 else
3463 old_val -= num_bytes;
3464 btrfs_set_root_used(&root->root_item, old_val);
3465 spin_unlock(&info->delalloc_lock); 3465 spin_unlock(&info->delalloc_lock);
3466 3466
3467 while (total) { 3467 while (total) {
@@ -4049,6 +4049,21 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans,
4049 return ret; 4049 return ret;
4050} 4050}
4051 4051
4052int btrfs_free_tree_block(struct btrfs_trans_handle *trans,
4053 struct btrfs_root *root,
4054 u64 bytenr, u32 blocksize,
4055 u64 parent, u64 root_objectid, int level)
4056{
4057 u64 used;
4058 spin_lock(&root->node_lock);
4059 used = btrfs_root_used(&root->root_item) - blocksize;
4060 btrfs_set_root_used(&root->root_item, used);
4061 spin_unlock(&root->node_lock);
4062
4063 return btrfs_free_extent(trans, root, bytenr, blocksize,
4064 parent, root_objectid, level, 0);
4065}
4066
4052static u64 stripe_align(struct btrfs_root *root, u64 val) 4067static u64 stripe_align(struct btrfs_root *root, u64 val)
4053{ 4068{
4054 u64 mask = ((u64)root->stripesize - 1); 4069 u64 mask = ((u64)root->stripesize - 1);
@@ -4578,7 +4593,6 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
4578{ 4593{
4579 int ret; 4594 int ret;
4580 u64 search_start = 0; 4595 u64 search_start = 0;
4581 struct btrfs_fs_info *info = root->fs_info;
4582 4596
4583 data = btrfs_get_alloc_profile(root, data); 4597 data = btrfs_get_alloc_profile(root, data);
4584again: 4598again:
@@ -4586,17 +4600,9 @@ again:
4586 * the only place that sets empty_size is btrfs_realloc_node, which 4600 * the only place that sets empty_size is btrfs_realloc_node, which
4587 * is not called recursively on allocations 4601 * is not called recursively on allocations
4588 */ 4602 */
4589 if (empty_size || root->ref_cows) { 4603 if (empty_size || root->ref_cows)
4590 if (!(data & BTRFS_BLOCK_GROUP_METADATA)) {
4591 ret = do_chunk_alloc(trans, root->fs_info->extent_root,
4592 2 * 1024 * 1024,
4593 BTRFS_BLOCK_GROUP_METADATA |
4594 (info->metadata_alloc_profile &
4595 info->avail_metadata_alloc_bits), 0);
4596 }
4597 ret = do_chunk_alloc(trans, root->fs_info->extent_root, 4604 ret = do_chunk_alloc(trans, root->fs_info->extent_root,
4598 num_bytes + 2 * 1024 * 1024, data, 0); 4605 num_bytes + 2 * 1024 * 1024, data, 0);
4599 }
4600 4606
4601 WARN_ON(num_bytes < root->sectorsize); 4607 WARN_ON(num_bytes < root->sectorsize);
4602 ret = find_free_extent(trans, root, num_bytes, empty_size, 4608 ret = find_free_extent(trans, root, num_bytes, empty_size,
@@ -4897,6 +4903,14 @@ static int alloc_tree_block(struct btrfs_trans_handle *trans,
4897 extent_op); 4903 extent_op);
4898 BUG_ON(ret); 4904 BUG_ON(ret);
4899 } 4905 }
4906
4907 if (root_objectid == root->root_key.objectid) {
4908 u64 used;
4909 spin_lock(&root->node_lock);
4910 used = btrfs_root_used(&root->root_item) + num_bytes;
4911 btrfs_set_root_used(&root->root_item, used);
4912 spin_unlock(&root->node_lock);
4913 }
4900 return ret; 4914 return ret;
4901} 4915}
4902 4916
@@ -4919,8 +4933,16 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
4919 btrfs_set_buffer_uptodate(buf); 4933 btrfs_set_buffer_uptodate(buf);
4920 4934
4921 if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) { 4935 if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) {
4922 set_extent_dirty(&root->dirty_log_pages, buf->start, 4936 /*
4923 buf->start + buf->len - 1, GFP_NOFS); 4937 * we allow two log transactions at a time, use different
4938 * EXENT bit to differentiate dirty pages.
4939 */
4940 if (root->log_transid % 2 == 0)
4941 set_extent_dirty(&root->dirty_log_pages, buf->start,
4942 buf->start + buf->len - 1, GFP_NOFS);
4943 else
4944 set_extent_new(&root->dirty_log_pages, buf->start,
4945 buf->start + buf->len - 1, GFP_NOFS);
4924 } else { 4946 } else {
4925 set_extent_dirty(&trans->transaction->dirty_pages, buf->start, 4947 set_extent_dirty(&trans->transaction->dirty_pages, buf->start,
4926 buf->start + buf->len - 1, GFP_NOFS); 4948 buf->start + buf->len - 1, GFP_NOFS);
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 77f759302e12..feaa13b105d9 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -179,18 +179,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
179 } 179 }
180 flags = em->flags; 180 flags = em->flags;
181 if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { 181 if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
182 if (em->start <= start && 182 if (testend && em->start + em->len >= start + len) {
183 (!testend || em->start + em->len >= start + len)) {
184 free_extent_map(em); 183 free_extent_map(em);
185 write_unlock(&em_tree->lock); 184 write_unlock(&em_tree->lock);
186 break; 185 break;
187 } 186 }
188 if (start < em->start) { 187 start = em->start + em->len;
189 len = em->start - start; 188 if (testend)
190 } else {
191 len = start + len - (em->start + em->len); 189 len = start + len - (em->start + em->len);
192 start = em->start + em->len;
193 }
194 free_extent_map(em); 190 free_extent_map(em);
195 write_unlock(&em_tree->lock); 191 write_unlock(&em_tree->lock);
196 continue; 192 continue;
@@ -265,319 +261,247 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
265 * If an extent intersects the range but is not entirely inside the range 261 * If an extent intersects the range but is not entirely inside the range
266 * it is either truncated or split. Anything entirely inside the range 262 * it is either truncated or split. Anything entirely inside the range
267 * is deleted from the tree. 263 * is deleted from the tree.
268 *
269 * inline_limit is used to tell this code which offsets in the file to keep
270 * if they contain inline extents.
271 */ 264 */
272noinline int btrfs_drop_extents(struct btrfs_trans_handle *trans, 265int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode,
273 struct btrfs_root *root, struct inode *inode, 266 u64 start, u64 end, u64 *hint_byte, int drop_cache)
274 u64 start, u64 end, u64 locked_end,
275 u64 inline_limit, u64 *hint_byte, int drop_cache)
276{ 267{
277 u64 extent_end = 0; 268 struct btrfs_root *root = BTRFS_I(inode)->root;
278 u64 search_start = start;
279 u64 ram_bytes = 0;
280 u64 disk_bytenr = 0;
281 u64 orig_locked_end = locked_end;
282 u8 compression;
283 u8 encryption;
284 u16 other_encoding = 0;
285 struct extent_buffer *leaf; 269 struct extent_buffer *leaf;
286 struct btrfs_file_extent_item *extent; 270 struct btrfs_file_extent_item *fi;
287 struct btrfs_path *path; 271 struct btrfs_path *path;
288 struct btrfs_key key; 272 struct btrfs_key key;
289 struct btrfs_file_extent_item old; 273 struct btrfs_key new_key;
290 int keep; 274 u64 search_start = start;
291 int slot; 275 u64 disk_bytenr = 0;
292 int bookend; 276 u64 num_bytes = 0;
293 int found_type = 0; 277 u64 extent_offset = 0;
294 int found_extent; 278 u64 extent_end = 0;
295 int found_inline; 279 int del_nr = 0;
280 int del_slot = 0;
281 int extent_type;
296 int recow; 282 int recow;
297 int ret; 283 int ret;
298 284
299 inline_limit = 0;
300 if (drop_cache) 285 if (drop_cache)
301 btrfs_drop_extent_cache(inode, start, end - 1, 0); 286 btrfs_drop_extent_cache(inode, start, end - 1, 0);
302 287
303 path = btrfs_alloc_path(); 288 path = btrfs_alloc_path();
304 if (!path) 289 if (!path)
305 return -ENOMEM; 290 return -ENOMEM;
291
306 while (1) { 292 while (1) {
307 recow = 0; 293 recow = 0;
308 btrfs_release_path(root, path);
309 ret = btrfs_lookup_file_extent(trans, root, path, inode->i_ino, 294 ret = btrfs_lookup_file_extent(trans, root, path, inode->i_ino,
310 search_start, -1); 295 search_start, -1);
311 if (ret < 0) 296 if (ret < 0)
312 goto out; 297 break;
313 if (ret > 0) { 298 if (ret > 0 && path->slots[0] > 0 && search_start == start) {
314 if (path->slots[0] == 0) { 299 leaf = path->nodes[0];
315 ret = 0; 300 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1);
316 goto out; 301 if (key.objectid == inode->i_ino &&
317 } 302 key.type == BTRFS_EXTENT_DATA_KEY)
318 path->slots[0]--; 303 path->slots[0]--;
319 } 304 }
305 ret = 0;
320next_slot: 306next_slot:
321 keep = 0;
322 bookend = 0;
323 found_extent = 0;
324 found_inline = 0;
325 compression = 0;
326 encryption = 0;
327 extent = NULL;
328 leaf = path->nodes[0]; 307 leaf = path->nodes[0];
329 slot = path->slots[0]; 308 if (path->slots[0] >= btrfs_header_nritems(leaf)) {
330 ret = 0; 309 BUG_ON(del_nr > 0);
331 btrfs_item_key_to_cpu(leaf, &key, slot); 310 ret = btrfs_next_leaf(root, path);
332 if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY && 311 if (ret < 0)
333 key.offset >= end) { 312 break;
334 goto out; 313 if (ret > 0) {
335 } 314 ret = 0;
336 if (btrfs_key_type(&key) > BTRFS_EXTENT_DATA_KEY || 315 break;
337 key.objectid != inode->i_ino) {
338 goto out;
339 }
340 if (recow) {
341 search_start = max(key.offset, start);
342 continue;
343 }
344 if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY) {
345 extent = btrfs_item_ptr(leaf, slot,
346 struct btrfs_file_extent_item);
347 found_type = btrfs_file_extent_type(leaf, extent);
348 compression = btrfs_file_extent_compression(leaf,
349 extent);
350 encryption = btrfs_file_extent_encryption(leaf,
351 extent);
352 other_encoding = btrfs_file_extent_other_encoding(leaf,
353 extent);
354 if (found_type == BTRFS_FILE_EXTENT_REG ||
355 found_type == BTRFS_FILE_EXTENT_PREALLOC) {
356 extent_end =
357 btrfs_file_extent_disk_bytenr(leaf,
358 extent);
359 if (extent_end)
360 *hint_byte = extent_end;
361
362 extent_end = key.offset +
363 btrfs_file_extent_num_bytes(leaf, extent);
364 ram_bytes = btrfs_file_extent_ram_bytes(leaf,
365 extent);
366 found_extent = 1;
367 } else if (found_type == BTRFS_FILE_EXTENT_INLINE) {
368 found_inline = 1;
369 extent_end = key.offset +
370 btrfs_file_extent_inline_len(leaf, extent);
371 } 316 }
317 leaf = path->nodes[0];
318 recow = 1;
319 }
320
321 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
322 if (key.objectid > inode->i_ino ||
323 key.type > BTRFS_EXTENT_DATA_KEY || key.offset >= end)
324 break;
325
326 fi = btrfs_item_ptr(leaf, path->slots[0],
327 struct btrfs_file_extent_item);
328 extent_type = btrfs_file_extent_type(leaf, fi);
329
330 if (extent_type == BTRFS_FILE_EXTENT_REG ||
331 extent_type == BTRFS_FILE_EXTENT_PREALLOC) {
332 disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
333 num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi);
334 extent_offset = btrfs_file_extent_offset(leaf, fi);
335 extent_end = key.offset +
336 btrfs_file_extent_num_bytes(leaf, fi);
337 } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
338 extent_end = key.offset +
339 btrfs_file_extent_inline_len(leaf, fi);
372 } else { 340 } else {
341 WARN_ON(1);
373 extent_end = search_start; 342 extent_end = search_start;
374 } 343 }
375 344
376 /* we found nothing we can drop */ 345 if (extent_end <= search_start) {
377 if ((!found_extent && !found_inline) || 346 path->slots[0]++;
378 search_start >= extent_end) {
379 int nextret;
380 u32 nritems;
381 nritems = btrfs_header_nritems(leaf);
382 if (slot >= nritems - 1) {
383 nextret = btrfs_next_leaf(root, path);
384 if (nextret)
385 goto out;
386 recow = 1;
387 } else {
388 path->slots[0]++;
389 }
390 goto next_slot; 347 goto next_slot;
391 } 348 }
392 349
393 if (end <= extent_end && start >= key.offset && found_inline) 350 search_start = max(key.offset, start);
394 *hint_byte = EXTENT_MAP_INLINE; 351 if (recow) {
395 352 btrfs_release_path(root, path);
396 if (found_extent) { 353 continue;
397 read_extent_buffer(leaf, &old, (unsigned long)extent,
398 sizeof(old));
399 }
400
401 if (end < extent_end && end >= key.offset) {
402 bookend = 1;
403 if (found_inline && start <= key.offset)
404 keep = 1;
405 } 354 }
406 355
407 if (bookend && found_extent) { 356 /*
408 if (locked_end < extent_end) { 357 * | - range to drop - |
409 ret = try_lock_extent(&BTRFS_I(inode)->io_tree, 358 * | -------- extent -------- |
410 locked_end, extent_end - 1, 359 */
411 GFP_NOFS); 360 if (start > key.offset && end < extent_end) {
412 if (!ret) { 361 BUG_ON(del_nr > 0);
413 btrfs_release_path(root, path); 362 BUG_ON(extent_type == BTRFS_FILE_EXTENT_INLINE);
414 lock_extent(&BTRFS_I(inode)->io_tree, 363
415 locked_end, extent_end - 1, 364 memcpy(&new_key, &key, sizeof(new_key));
416 GFP_NOFS); 365 new_key.offset = start;
417 locked_end = extent_end; 366 ret = btrfs_duplicate_item(trans, root, path,
418 continue; 367 &new_key);
419 } 368 if (ret == -EAGAIN) {
420 locked_end = extent_end; 369 btrfs_release_path(root, path);
370 continue;
421 } 371 }
422 disk_bytenr = le64_to_cpu(old.disk_bytenr); 372 if (ret < 0)
423 if (disk_bytenr != 0) { 373 break;
374
375 leaf = path->nodes[0];
376 fi = btrfs_item_ptr(leaf, path->slots[0] - 1,
377 struct btrfs_file_extent_item);
378 btrfs_set_file_extent_num_bytes(leaf, fi,
379 start - key.offset);
380
381 fi = btrfs_item_ptr(leaf, path->slots[0],
382 struct btrfs_file_extent_item);
383
384 extent_offset += start - key.offset;
385 btrfs_set_file_extent_offset(leaf, fi, extent_offset);
386 btrfs_set_file_extent_num_bytes(leaf, fi,
387 extent_end - start);
388 btrfs_mark_buffer_dirty(leaf);
389
390 if (disk_bytenr > 0) {
424 ret = btrfs_inc_extent_ref(trans, root, 391 ret = btrfs_inc_extent_ref(trans, root,
425 disk_bytenr, 392 disk_bytenr, num_bytes, 0,
426 le64_to_cpu(old.disk_num_bytes), 0, 393 root->root_key.objectid,
427 root->root_key.objectid, 394 new_key.objectid,
428 key.objectid, key.offset - 395 start - extent_offset);
429 le64_to_cpu(old.offset));
430 BUG_ON(ret); 396 BUG_ON(ret);
397 *hint_byte = disk_bytenr;
431 } 398 }
399 key.offset = start;
432 } 400 }
401 /*
402 * | ---- range to drop ----- |
403 * | -------- extent -------- |
404 */
405 if (start <= key.offset && end < extent_end) {
406 BUG_ON(extent_type == BTRFS_FILE_EXTENT_INLINE);
433 407
434 if (found_inline) { 408 memcpy(&new_key, &key, sizeof(new_key));
435 u64 mask = root->sectorsize - 1; 409 new_key.offset = end;
436 search_start = (extent_end + mask) & ~mask; 410 btrfs_set_item_key_safe(trans, root, path, &new_key);
437 } else 411
438 search_start = extent_end; 412 extent_offset += end - key.offset;
439 413 btrfs_set_file_extent_offset(leaf, fi, extent_offset);
440 /* truncate existing extent */ 414 btrfs_set_file_extent_num_bytes(leaf, fi,
441 if (start > key.offset) { 415 extent_end - end);
442 u64 new_num; 416 btrfs_mark_buffer_dirty(leaf);
443 u64 old_num; 417 if (disk_bytenr > 0) {
444 keep = 1; 418 inode_sub_bytes(inode, end - key.offset);
445 WARN_ON(start & (root->sectorsize - 1)); 419 *hint_byte = disk_bytenr;
446 if (found_extent) {
447 new_num = start - key.offset;
448 old_num = btrfs_file_extent_num_bytes(leaf,
449 extent);
450 *hint_byte =
451 btrfs_file_extent_disk_bytenr(leaf,
452 extent);
453 if (btrfs_file_extent_disk_bytenr(leaf,
454 extent)) {
455 inode_sub_bytes(inode, old_num -
456 new_num);
457 }
458 btrfs_set_file_extent_num_bytes(leaf,
459 extent, new_num);
460 btrfs_mark_buffer_dirty(leaf);
461 } else if (key.offset < inline_limit &&
462 (end > extent_end) &&
463 (inline_limit < extent_end)) {
464 u32 new_size;
465 new_size = btrfs_file_extent_calc_inline_size(
466 inline_limit - key.offset);
467 inode_sub_bytes(inode, extent_end -
468 inline_limit);
469 btrfs_set_file_extent_ram_bytes(leaf, extent,
470 new_size);
471 if (!compression && !encryption) {
472 btrfs_truncate_item(trans, root, path,
473 new_size, 1);
474 }
475 } 420 }
421 break;
476 } 422 }
477 /* delete the entire extent */
478 if (!keep) {
479 if (found_inline)
480 inode_sub_bytes(inode, extent_end -
481 key.offset);
482 ret = btrfs_del_item(trans, root, path);
483 /* TODO update progress marker and return */
484 BUG_ON(ret);
485 extent = NULL;
486 btrfs_release_path(root, path);
487 /* the extent will be freed later */
488 }
489 if (bookend && found_inline && start <= key.offset) {
490 u32 new_size;
491 new_size = btrfs_file_extent_calc_inline_size(
492 extent_end - end);
493 inode_sub_bytes(inode, end - key.offset);
494 btrfs_set_file_extent_ram_bytes(leaf, extent,
495 new_size);
496 if (!compression && !encryption)
497 ret = btrfs_truncate_item(trans, root, path,
498 new_size, 0);
499 BUG_ON(ret);
500 }
501 /* create bookend, splitting the extent in two */
502 if (bookend && found_extent) {
503 struct btrfs_key ins;
504 ins.objectid = inode->i_ino;
505 ins.offset = end;
506 btrfs_set_key_type(&ins, BTRFS_EXTENT_DATA_KEY);
507 423
508 btrfs_release_path(root, path); 424 search_start = extent_end;
509 path->leave_spinning = 1; 425 /*
510 ret = btrfs_insert_empty_item(trans, root, path, &ins, 426 * | ---- range to drop ----- |
511 sizeof(*extent)); 427 * | -------- extent -------- |
512 BUG_ON(ret); 428 */
429 if (start > key.offset && end >= extent_end) {
430 BUG_ON(del_nr > 0);
431 BUG_ON(extent_type == BTRFS_FILE_EXTENT_INLINE);
513 432
514 leaf = path->nodes[0]; 433 btrfs_set_file_extent_num_bytes(leaf, fi,
515 extent = btrfs_item_ptr(leaf, path->slots[0], 434 start - key.offset);
516 struct btrfs_file_extent_item); 435 btrfs_mark_buffer_dirty(leaf);
517 write_extent_buffer(leaf, &old, 436 if (disk_bytenr > 0) {
518 (unsigned long)extent, sizeof(old)); 437 inode_sub_bytes(inode, extent_end - start);
519 438 *hint_byte = disk_bytenr;
520 btrfs_set_file_extent_compression(leaf, extent, 439 }
521 compression); 440 if (end == extent_end)
522 btrfs_set_file_extent_encryption(leaf, extent, 441 break;
523 encryption);
524 btrfs_set_file_extent_other_encoding(leaf, extent,
525 other_encoding);
526 btrfs_set_file_extent_offset(leaf, extent,
527 le64_to_cpu(old.offset) + end - key.offset);
528 WARN_ON(le64_to_cpu(old.num_bytes) <
529 (extent_end - end));
530 btrfs_set_file_extent_num_bytes(leaf, extent,
531 extent_end - end);
532 442
533 /* 443 path->slots[0]++;
534 * set the ram bytes to the size of the full extent 444 goto next_slot;
535 * before splitting. This is a worst case flag,
536 * but its the best we can do because we don't know
537 * how splitting affects compression
538 */
539 btrfs_set_file_extent_ram_bytes(leaf, extent,
540 ram_bytes);
541 btrfs_set_file_extent_type(leaf, extent, found_type);
542
543 btrfs_unlock_up_safe(path, 1);
544 btrfs_mark_buffer_dirty(path->nodes[0]);
545 btrfs_set_lock_blocking(path->nodes[0]);
546
547 path->leave_spinning = 0;
548 btrfs_release_path(root, path);
549 if (disk_bytenr != 0)
550 inode_add_bytes(inode, extent_end - end);
551 } 445 }
552 446
553 if (found_extent && !keep) { 447 /*
554 u64 old_disk_bytenr = le64_to_cpu(old.disk_bytenr); 448 * | ---- range to drop ----- |
449 * | ------ extent ------ |
450 */
451 if (start <= key.offset && end >= extent_end) {
452 if (del_nr == 0) {
453 del_slot = path->slots[0];
454 del_nr = 1;
455 } else {
456 BUG_ON(del_slot + del_nr != path->slots[0]);
457 del_nr++;
458 }
555 459
556 if (old_disk_bytenr != 0) { 460 if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
557 inode_sub_bytes(inode, 461 inode_sub_bytes(inode,
558 le64_to_cpu(old.num_bytes)); 462 extent_end - key.offset);
463 extent_end = ALIGN(extent_end,
464 root->sectorsize);
465 } else if (disk_bytenr > 0) {
559 ret = btrfs_free_extent(trans, root, 466 ret = btrfs_free_extent(trans, root,
560 old_disk_bytenr, 467 disk_bytenr, num_bytes, 0,
561 le64_to_cpu(old.disk_num_bytes), 468 root->root_key.objectid,
562 0, root->root_key.objectid,
563 key.objectid, key.offset - 469 key.objectid, key.offset -
564 le64_to_cpu(old.offset)); 470 extent_offset);
565 BUG_ON(ret); 471 BUG_ON(ret);
566 *hint_byte = old_disk_bytenr; 472 inode_sub_bytes(inode,
473 extent_end - key.offset);
474 *hint_byte = disk_bytenr;
567 } 475 }
568 }
569 476
570 if (search_start >= end) { 477 if (end == extent_end)
571 ret = 0; 478 break;
572 goto out; 479
480 if (path->slots[0] + 1 < btrfs_header_nritems(leaf)) {
481 path->slots[0]++;
482 goto next_slot;
483 }
484
485 ret = btrfs_del_items(trans, root, path, del_slot,
486 del_nr);
487 BUG_ON(ret);
488
489 del_nr = 0;
490 del_slot = 0;
491
492 btrfs_release_path(root, path);
493 continue;
573 } 494 }
495
496 BUG_ON(1);
574 } 497 }
575out: 498
576 btrfs_free_path(path); 499 if (del_nr > 0) {
577 if (locked_end > orig_locked_end) { 500 ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
578 unlock_extent(&BTRFS_I(inode)->io_tree, orig_locked_end, 501 BUG_ON(ret);
579 locked_end - 1, GFP_NOFS);
580 } 502 }
503
504 btrfs_free_path(path);
581 return ret; 505 return ret;
582} 506}
583 507
@@ -620,23 +544,23 @@ static int extent_mergeable(struct extent_buffer *leaf, int slot,
620 * two or three. 544 * two or three.
621 */ 545 */
622int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, 546int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
623 struct btrfs_root *root,
624 struct inode *inode, u64 start, u64 end) 547 struct inode *inode, u64 start, u64 end)
625{ 548{
549 struct btrfs_root *root = BTRFS_I(inode)->root;
626 struct extent_buffer *leaf; 550 struct extent_buffer *leaf;
627 struct btrfs_path *path; 551 struct btrfs_path *path;
628 struct btrfs_file_extent_item *fi; 552 struct btrfs_file_extent_item *fi;
629 struct btrfs_key key; 553 struct btrfs_key key;
554 struct btrfs_key new_key;
630 u64 bytenr; 555 u64 bytenr;
631 u64 num_bytes; 556 u64 num_bytes;
632 u64 extent_end; 557 u64 extent_end;
633 u64 orig_offset; 558 u64 orig_offset;
634 u64 other_start; 559 u64 other_start;
635 u64 other_end; 560 u64 other_end;
636 u64 split = start; 561 u64 split;
637 u64 locked_end = end; 562 int del_nr = 0;
638 int extent_type; 563 int del_slot = 0;
639 int split_end = 1;
640 int ret; 564 int ret;
641 565
642 btrfs_drop_extent_cache(inode, start, end - 1, 0); 566 btrfs_drop_extent_cache(inode, start, end - 1, 0);
@@ -644,12 +568,10 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
644 path = btrfs_alloc_path(); 568 path = btrfs_alloc_path();
645 BUG_ON(!path); 569 BUG_ON(!path);
646again: 570again:
571 split = start;
647 key.objectid = inode->i_ino; 572 key.objectid = inode->i_ino;
648 key.type = BTRFS_EXTENT_DATA_KEY; 573 key.type = BTRFS_EXTENT_DATA_KEY;
649 if (split == start) 574 key.offset = split;
650 key.offset = split;
651 else
652 key.offset = split - 1;
653 575
654 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 576 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
655 if (ret > 0 && path->slots[0] > 0) 577 if (ret > 0 && path->slots[0] > 0)
@@ -661,8 +583,8 @@ again:
661 key.type != BTRFS_EXTENT_DATA_KEY); 583 key.type != BTRFS_EXTENT_DATA_KEY);
662 fi = btrfs_item_ptr(leaf, path->slots[0], 584 fi = btrfs_item_ptr(leaf, path->slots[0],
663 struct btrfs_file_extent_item); 585 struct btrfs_file_extent_item);
664 extent_type = btrfs_file_extent_type(leaf, fi); 586 BUG_ON(btrfs_file_extent_type(leaf, fi) !=
665 BUG_ON(extent_type != BTRFS_FILE_EXTENT_PREALLOC); 587 BTRFS_FILE_EXTENT_PREALLOC);
666 extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi); 588 extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi);
667 BUG_ON(key.offset > start || extent_end < end); 589 BUG_ON(key.offset > start || extent_end < end);
668 590
@@ -670,150 +592,91 @@ again:
670 num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); 592 num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi);
671 orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi); 593 orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi);
672 594
673 if (key.offset == start) 595 while (start > key.offset || end < extent_end) {
674 split = end; 596 if (key.offset == start)
675 597 split = end;
676 if (key.offset == start && extent_end == end) { 598
677 int del_nr = 0; 599 memcpy(&new_key, &key, sizeof(new_key));
678 int del_slot = 0; 600 new_key.offset = split;
679 other_start = end; 601 ret = btrfs_duplicate_item(trans, root, path, &new_key);
680 other_end = 0; 602 if (ret == -EAGAIN) {
681 if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino, 603 btrfs_release_path(root, path);
682 bytenr, &other_start, &other_end)) { 604 goto again;
683 extent_end = other_end;
684 del_slot = path->slots[0] + 1;
685 del_nr++;
686 ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
687 0, root->root_key.objectid,
688 inode->i_ino, orig_offset);
689 BUG_ON(ret);
690 }
691 other_start = 0;
692 other_end = start;
693 if (extent_mergeable(leaf, path->slots[0] - 1, inode->i_ino,
694 bytenr, &other_start, &other_end)) {
695 key.offset = other_start;
696 del_slot = path->slots[0];
697 del_nr++;
698 ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
699 0, root->root_key.objectid,
700 inode->i_ino, orig_offset);
701 BUG_ON(ret);
702 }
703 split_end = 0;
704 if (del_nr == 0) {
705 btrfs_set_file_extent_type(leaf, fi,
706 BTRFS_FILE_EXTENT_REG);
707 goto done;
708 } 605 }
606 BUG_ON(ret < 0);
709 607
710 fi = btrfs_item_ptr(leaf, del_slot - 1, 608 leaf = path->nodes[0];
609 fi = btrfs_item_ptr(leaf, path->slots[0] - 1,
711 struct btrfs_file_extent_item); 610 struct btrfs_file_extent_item);
712 btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG);
713 btrfs_set_file_extent_num_bytes(leaf, fi, 611 btrfs_set_file_extent_num_bytes(leaf, fi,
714 extent_end - key.offset); 612 split - key.offset);
613
614 fi = btrfs_item_ptr(leaf, path->slots[0],
615 struct btrfs_file_extent_item);
616
617 btrfs_set_file_extent_offset(leaf, fi, split - orig_offset);
618 btrfs_set_file_extent_num_bytes(leaf, fi,
619 extent_end - split);
715 btrfs_mark_buffer_dirty(leaf); 620 btrfs_mark_buffer_dirty(leaf);
716 621
717 ret = btrfs_del_items(trans, root, path, del_slot, del_nr); 622 ret = btrfs_inc_extent_ref(trans, root, bytenr, num_bytes, 0,
623 root->root_key.objectid,
624 inode->i_ino, orig_offset);
718 BUG_ON(ret); 625 BUG_ON(ret);
719 goto release;
720 } else if (split == start) {
721 if (locked_end < extent_end) {
722 ret = try_lock_extent(&BTRFS_I(inode)->io_tree,
723 locked_end, extent_end - 1, GFP_NOFS);
724 if (!ret) {
725 btrfs_release_path(root, path);
726 lock_extent(&BTRFS_I(inode)->io_tree,
727 locked_end, extent_end - 1, GFP_NOFS);
728 locked_end = extent_end;
729 goto again;
730 }
731 locked_end = extent_end;
732 }
733 btrfs_set_file_extent_num_bytes(leaf, fi, split - key.offset);
734 } else {
735 BUG_ON(key.offset != start);
736 key.offset = split;
737 btrfs_set_file_extent_offset(leaf, fi, key.offset -
738 orig_offset);
739 btrfs_set_file_extent_num_bytes(leaf, fi, extent_end - split);
740 btrfs_set_item_key_safe(trans, root, path, &key);
741 extent_end = split;
742 }
743 626
744 if (extent_end == end) { 627 if (split == start) {
745 split_end = 0; 628 key.offset = start;
746 extent_type = BTRFS_FILE_EXTENT_REG; 629 } else {
747 } 630 BUG_ON(start != key.offset);
748 if (extent_end == end && split == start) {
749 other_start = end;
750 other_end = 0;
751 if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino,
752 bytenr, &other_start, &other_end)) {
753 path->slots[0]++;
754 fi = btrfs_item_ptr(leaf, path->slots[0],
755 struct btrfs_file_extent_item);
756 key.offset = split;
757 btrfs_set_item_key_safe(trans, root, path, &key);
758 btrfs_set_file_extent_offset(leaf, fi, key.offset -
759 orig_offset);
760 btrfs_set_file_extent_num_bytes(leaf, fi,
761 other_end - split);
762 goto done;
763 }
764 }
765 if (extent_end == end && split == end) {
766 other_start = 0;
767 other_end = start;
768 if (extent_mergeable(leaf, path->slots[0] - 1 , inode->i_ino,
769 bytenr, &other_start, &other_end)) {
770 path->slots[0]--; 631 path->slots[0]--;
771 fi = btrfs_item_ptr(leaf, path->slots[0], 632 extent_end = end;
772 struct btrfs_file_extent_item);
773 btrfs_set_file_extent_num_bytes(leaf, fi, extent_end -
774 other_start);
775 goto done;
776 } 633 }
777 } 634 }
778 635
779 btrfs_mark_buffer_dirty(leaf);
780
781 ret = btrfs_inc_extent_ref(trans, root, bytenr, num_bytes, 0,
782 root->root_key.objectid,
783 inode->i_ino, orig_offset);
784 BUG_ON(ret);
785 btrfs_release_path(root, path);
786
787 key.offset = start;
788 ret = btrfs_insert_empty_item(trans, root, path, &key, sizeof(*fi));
789 BUG_ON(ret);
790
791 leaf = path->nodes[0];
792 fi = btrfs_item_ptr(leaf, path->slots[0], 636 fi = btrfs_item_ptr(leaf, path->slots[0],
793 struct btrfs_file_extent_item); 637 struct btrfs_file_extent_item);
794 btrfs_set_file_extent_generation(leaf, fi, trans->transid);
795 btrfs_set_file_extent_type(leaf, fi, extent_type);
796 btrfs_set_file_extent_disk_bytenr(leaf, fi, bytenr);
797 btrfs_set_file_extent_disk_num_bytes(leaf, fi, num_bytes);
798 btrfs_set_file_extent_offset(leaf, fi, key.offset - orig_offset);
799 btrfs_set_file_extent_num_bytes(leaf, fi, extent_end - key.offset);
800 btrfs_set_file_extent_ram_bytes(leaf, fi, num_bytes);
801 btrfs_set_file_extent_compression(leaf, fi, 0);
802 btrfs_set_file_extent_encryption(leaf, fi, 0);
803 btrfs_set_file_extent_other_encoding(leaf, fi, 0);
804done:
805 btrfs_mark_buffer_dirty(leaf);
806 638
807release: 639 other_start = end;
808 btrfs_release_path(root, path); 640 other_end = 0;
809 if (split_end && split == start) { 641 if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino,
810 split = end; 642 bytenr, &other_start, &other_end)) {
811 goto again; 643 extent_end = other_end;
644 del_slot = path->slots[0] + 1;
645 del_nr++;
646 ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
647 0, root->root_key.objectid,
648 inode->i_ino, orig_offset);
649 BUG_ON(ret);
812 } 650 }
813 if (locked_end > end) { 651 other_start = 0;
814 unlock_extent(&BTRFS_I(inode)->io_tree, end, locked_end - 1, 652 other_end = start;
815 GFP_NOFS); 653 if (extent_mergeable(leaf, path->slots[0] - 1, inode->i_ino,
654 bytenr, &other_start, &other_end)) {
655 key.offset = other_start;
656 del_slot = path->slots[0];
657 del_nr++;
658 ret = btrfs_free_extent(trans, root, bytenr, num_bytes,
659 0, root->root_key.objectid,
660 inode->i_ino, orig_offset);
661 BUG_ON(ret);
816 } 662 }
663 if (del_nr == 0) {
664 btrfs_set_file_extent_type(leaf, fi,
665 BTRFS_FILE_EXTENT_REG);
666 btrfs_mark_buffer_dirty(leaf);
667 goto out;
668 }
669
670 fi = btrfs_item_ptr(leaf, del_slot - 1,
671 struct btrfs_file_extent_item);
672 btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG);
673 btrfs_set_file_extent_num_bytes(leaf, fi,
674 extent_end - key.offset);
675 btrfs_mark_buffer_dirty(leaf);
676
677 ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
678 BUG_ON(ret);
679out:
817 btrfs_free_path(path); 680 btrfs_free_path(path);
818 return 0; 681 return 0;
819} 682}
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b3ad168a0bfc..5440bab23635 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -88,13 +88,14 @@ static noinline int cow_file_range(struct inode *inode,
88 u64 start, u64 end, int *page_started, 88 u64 start, u64 end, int *page_started,
89 unsigned long *nr_written, int unlock); 89 unsigned long *nr_written, int unlock);
90 90
91static int btrfs_init_inode_security(struct inode *inode, struct inode *dir) 91static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
92 struct inode *inode, struct inode *dir)
92{ 93{
93 int err; 94 int err;
94 95
95 err = btrfs_init_acl(inode, dir); 96 err = btrfs_init_acl(trans, inode, dir);
96 if (!err) 97 if (!err)
97 err = btrfs_xattr_security_init(inode, dir); 98 err = btrfs_xattr_security_init(trans, inode, dir);
98 return err; 99 return err;
99} 100}
100 101
@@ -188,8 +189,18 @@ static noinline int insert_inline_extent(struct btrfs_trans_handle *trans,
188 btrfs_mark_buffer_dirty(leaf); 189 btrfs_mark_buffer_dirty(leaf);
189 btrfs_free_path(path); 190 btrfs_free_path(path);
190 191
192 /*
193 * we're an inline extent, so nobody can
194 * extend the file past i_size without locking
195 * a page we already have locked.
196 *
197 * We must do any isize and inode updates
198 * before we unlock the pages. Otherwise we
199 * could end up racing with unlink.
200 */
191 BTRFS_I(inode)->disk_i_size = inode->i_size; 201 BTRFS_I(inode)->disk_i_size = inode->i_size;
192 btrfs_update_inode(trans, root, inode); 202 btrfs_update_inode(trans, root, inode);
203
193 return 0; 204 return 0;
194fail: 205fail:
195 btrfs_free_path(path); 206 btrfs_free_path(path);
@@ -230,8 +241,7 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
230 return 1; 241 return 1;
231 } 242 }
232 243
233 ret = btrfs_drop_extents(trans, root, inode, start, 244 ret = btrfs_drop_extents(trans, inode, start, aligned_end,
234 aligned_end, aligned_end, start,
235 &hint_byte, 1); 245 &hint_byte, 1);
236 BUG_ON(ret); 246 BUG_ON(ret);
237 247
@@ -416,7 +426,6 @@ again:
416 start, end, 426 start, end,
417 total_compressed, pages); 427 total_compressed, pages);
418 } 428 }
419 btrfs_end_transaction(trans, root);
420 if (ret == 0) { 429 if (ret == 0) {
421 /* 430 /*
422 * inline extent creation worked, we don't need 431 * inline extent creation worked, we don't need
@@ -430,9 +439,11 @@ again:
430 EXTENT_CLEAR_DELALLOC | 439 EXTENT_CLEAR_DELALLOC |
431 EXTENT_CLEAR_ACCOUNTING | 440 EXTENT_CLEAR_ACCOUNTING |
432 EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK); 441 EXTENT_SET_WRITEBACK | EXTENT_END_WRITEBACK);
433 ret = 0; 442
443 btrfs_end_transaction(trans, root);
434 goto free_pages_out; 444 goto free_pages_out;
435 } 445 }
446 btrfs_end_transaction(trans, root);
436 } 447 }
437 448
438 if (will_compress) { 449 if (will_compress) {
@@ -543,7 +554,6 @@ static noinline int submit_compressed_extents(struct inode *inode,
543 if (list_empty(&async_cow->extents)) 554 if (list_empty(&async_cow->extents))
544 return 0; 555 return 0;
545 556
546 trans = btrfs_join_transaction(root, 1);
547 557
548 while (!list_empty(&async_cow->extents)) { 558 while (!list_empty(&async_cow->extents)) {
549 async_extent = list_entry(async_cow->extents.next, 559 async_extent = list_entry(async_cow->extents.next,
@@ -590,19 +600,15 @@ retry:
590 lock_extent(io_tree, async_extent->start, 600 lock_extent(io_tree, async_extent->start,
591 async_extent->start + async_extent->ram_size - 1, 601 async_extent->start + async_extent->ram_size - 1,
592 GFP_NOFS); 602 GFP_NOFS);
593 /*
594 * here we're doing allocation and writeback of the
595 * compressed pages
596 */
597 btrfs_drop_extent_cache(inode, async_extent->start,
598 async_extent->start +
599 async_extent->ram_size - 1, 0);
600 603
604 trans = btrfs_join_transaction(root, 1);
601 ret = btrfs_reserve_extent(trans, root, 605 ret = btrfs_reserve_extent(trans, root,
602 async_extent->compressed_size, 606 async_extent->compressed_size,
603 async_extent->compressed_size, 607 async_extent->compressed_size,
604 0, alloc_hint, 608 0, alloc_hint,
605 (u64)-1, &ins, 1); 609 (u64)-1, &ins, 1);
610 btrfs_end_transaction(trans, root);
611
606 if (ret) { 612 if (ret) {
607 int i; 613 int i;
608 for (i = 0; i < async_extent->nr_pages; i++) { 614 for (i = 0; i < async_extent->nr_pages; i++) {
@@ -618,6 +624,14 @@ retry:
618 goto retry; 624 goto retry;
619 } 625 }
620 626
627 /*
628 * here we're doing allocation and writeback of the
629 * compressed pages
630 */
631 btrfs_drop_extent_cache(inode, async_extent->start,
632 async_extent->start +
633 async_extent->ram_size - 1, 0);
634
621 em = alloc_extent_map(GFP_NOFS); 635 em = alloc_extent_map(GFP_NOFS);
622 em->start = async_extent->start; 636 em->start = async_extent->start;
623 em->len = async_extent->ram_size; 637 em->len = async_extent->ram_size;
@@ -649,8 +663,6 @@ retry:
649 BTRFS_ORDERED_COMPRESSED); 663 BTRFS_ORDERED_COMPRESSED);
650 BUG_ON(ret); 664 BUG_ON(ret);
651 665
652 btrfs_end_transaction(trans, root);
653
654 /* 666 /*
655 * clear dirty, set writeback and unlock the pages. 667 * clear dirty, set writeback and unlock the pages.
656 */ 668 */
@@ -672,13 +684,11 @@ retry:
672 async_extent->nr_pages); 684 async_extent->nr_pages);
673 685
674 BUG_ON(ret); 686 BUG_ON(ret);
675 trans = btrfs_join_transaction(root, 1);
676 alloc_hint = ins.objectid + ins.offset; 687 alloc_hint = ins.objectid + ins.offset;
677 kfree(async_extent); 688 kfree(async_extent);
678 cond_resched(); 689 cond_resched();
679 } 690 }
680 691
681 btrfs_end_transaction(trans, root);
682 return 0; 692 return 0;
683} 693}
684 694
@@ -742,6 +752,7 @@ static noinline int cow_file_range(struct inode *inode,
742 EXTENT_CLEAR_DIRTY | 752 EXTENT_CLEAR_DIRTY |
743 EXTENT_SET_WRITEBACK | 753 EXTENT_SET_WRITEBACK |
744 EXTENT_END_WRITEBACK); 754 EXTENT_END_WRITEBACK);
755
745 *nr_written = *nr_written + 756 *nr_written = *nr_written +
746 (end - start + PAGE_CACHE_SIZE) / PAGE_CACHE_SIZE; 757 (end - start + PAGE_CACHE_SIZE) / PAGE_CACHE_SIZE;
747 *page_started = 1; 758 *page_started = 1;
@@ -1596,7 +1607,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
1596 struct inode *inode, u64 file_pos, 1607 struct inode *inode, u64 file_pos,
1597 u64 disk_bytenr, u64 disk_num_bytes, 1608 u64 disk_bytenr, u64 disk_num_bytes,
1598 u64 num_bytes, u64 ram_bytes, 1609 u64 num_bytes, u64 ram_bytes,
1599 u64 locked_end,
1600 u8 compression, u8 encryption, 1610 u8 compression, u8 encryption,
1601 u16 other_encoding, int extent_type) 1611 u16 other_encoding, int extent_type)
1602{ 1612{
@@ -1622,9 +1632,8 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
1622 * the caller is expected to unpin it and allow it to be merged 1632 * the caller is expected to unpin it and allow it to be merged
1623 * with the others. 1633 * with the others.
1624 */ 1634 */
1625 ret = btrfs_drop_extents(trans, root, inode, file_pos, 1635 ret = btrfs_drop_extents(trans, inode, file_pos, file_pos + num_bytes,
1626 file_pos + num_bytes, locked_end, 1636 &hint, 0);
1627 file_pos, &hint, 0);
1628 BUG_ON(ret); 1637 BUG_ON(ret);
1629 1638
1630 ins.objectid = inode->i_ino; 1639 ins.objectid = inode->i_ino;
@@ -1730,23 +1739,32 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
1730 } 1739 }
1731 } 1740 }
1732 1741
1733 trans = btrfs_join_transaction(root, 1);
1734
1735 if (!ordered_extent) 1742 if (!ordered_extent)
1736 ordered_extent = btrfs_lookup_ordered_extent(inode, start); 1743 ordered_extent = btrfs_lookup_ordered_extent(inode, start);
1737 BUG_ON(!ordered_extent); 1744 BUG_ON(!ordered_extent);
1738 if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) 1745 if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
1739 goto nocow; 1746 BUG_ON(!list_empty(&ordered_extent->list));
1747 ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent);
1748 if (!ret) {
1749 trans = btrfs_join_transaction(root, 1);
1750 ret = btrfs_update_inode(trans, root, inode);
1751 BUG_ON(ret);
1752 btrfs_end_transaction(trans, root);
1753 }
1754 goto out;
1755 }
1740 1756
1741 lock_extent(io_tree, ordered_extent->file_offset, 1757 lock_extent(io_tree, ordered_extent->file_offset,
1742 ordered_extent->file_offset + ordered_extent->len - 1, 1758 ordered_extent->file_offset + ordered_extent->len - 1,
1743 GFP_NOFS); 1759 GFP_NOFS);
1744 1760
1761 trans = btrfs_join_transaction(root, 1);
1762
1745 if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags)) 1763 if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags))
1746 compressed = 1; 1764 compressed = 1;
1747 if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) { 1765 if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
1748 BUG_ON(compressed); 1766 BUG_ON(compressed);
1749 ret = btrfs_mark_extent_written(trans, root, inode, 1767 ret = btrfs_mark_extent_written(trans, inode,
1750 ordered_extent->file_offset, 1768 ordered_extent->file_offset,
1751 ordered_extent->file_offset + 1769 ordered_extent->file_offset +
1752 ordered_extent->len); 1770 ordered_extent->len);
@@ -1758,8 +1776,6 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
1758 ordered_extent->disk_len, 1776 ordered_extent->disk_len,
1759 ordered_extent->len, 1777 ordered_extent->len,
1760 ordered_extent->len, 1778 ordered_extent->len,
1761 ordered_extent->file_offset +
1762 ordered_extent->len,
1763 compressed, 0, 0, 1779 compressed, 0, 0,
1764 BTRFS_FILE_EXTENT_REG); 1780 BTRFS_FILE_EXTENT_REG);
1765 unpin_extent_cache(&BTRFS_I(inode)->extent_tree, 1781 unpin_extent_cache(&BTRFS_I(inode)->extent_tree,
@@ -1770,22 +1786,20 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end)
1770 unlock_extent(io_tree, ordered_extent->file_offset, 1786 unlock_extent(io_tree, ordered_extent->file_offset,
1771 ordered_extent->file_offset + ordered_extent->len - 1, 1787 ordered_extent->file_offset + ordered_extent->len - 1,
1772 GFP_NOFS); 1788 GFP_NOFS);
1773nocow:
1774 add_pending_csums(trans, inode, ordered_extent->file_offset, 1789 add_pending_csums(trans, inode, ordered_extent->file_offset,
1775 &ordered_extent->list); 1790 &ordered_extent->list);
1776 1791
1777 mutex_lock(&BTRFS_I(inode)->extent_mutex); 1792 /* this also removes the ordered extent from the tree */
1778 btrfs_ordered_update_i_size(inode, ordered_extent); 1793 btrfs_ordered_update_i_size(inode, 0, ordered_extent);
1779 btrfs_update_inode(trans, root, inode); 1794 ret = btrfs_update_inode(trans, root, inode);
1780 btrfs_remove_ordered_extent(inode, ordered_extent); 1795 BUG_ON(ret);
1781 mutex_unlock(&BTRFS_I(inode)->extent_mutex); 1796 btrfs_end_transaction(trans, root);
1782 1797out:
1783 /* once for us */ 1798 /* once for us */
1784 btrfs_put_ordered_extent(ordered_extent); 1799 btrfs_put_ordered_extent(ordered_extent);
1785 /* once for the tree */ 1800 /* once for the tree */
1786 btrfs_put_ordered_extent(ordered_extent); 1801 btrfs_put_ordered_extent(ordered_extent);
1787 1802
1788 btrfs_end_transaction(trans, root);
1789 return 0; 1803 return 0;
1790} 1804}
1791 1805
@@ -2008,6 +2022,54 @@ zeroit:
2008 return -EIO; 2022 return -EIO;
2009} 2023}
2010 2024
2025struct delayed_iput {
2026 struct list_head list;
2027 struct inode *inode;
2028};
2029
2030void btrfs_add_delayed_iput(struct inode *inode)
2031{
2032 struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
2033 struct delayed_iput *delayed;
2034
2035 if (atomic_add_unless(&inode->i_count, -1, 1))
2036 return;
2037
2038 delayed = kmalloc(sizeof(*delayed), GFP_NOFS | __GFP_NOFAIL);
2039 delayed->inode = inode;
2040
2041 spin_lock(&fs_info->delayed_iput_lock);
2042 list_add_tail(&delayed->list, &fs_info->delayed_iputs);
2043 spin_unlock(&fs_info->delayed_iput_lock);
2044}
2045
2046void btrfs_run_delayed_iputs(struct btrfs_root *root)
2047{
2048 LIST_HEAD(list);
2049 struct btrfs_fs_info *fs_info = root->fs_info;
2050 struct delayed_iput *delayed;
2051 int empty;
2052
2053 spin_lock(&fs_info->delayed_iput_lock);
2054 empty = list_empty(&fs_info->delayed_iputs);
2055 spin_unlock(&fs_info->delayed_iput_lock);
2056 if (empty)
2057 return;
2058
2059 down_read(&root->fs_info->cleanup_work_sem);
2060 spin_lock(&fs_info->delayed_iput_lock);
2061 list_splice_init(&fs_info->delayed_iputs, &list);
2062 spin_unlock(&fs_info->delayed_iput_lock);
2063
2064 while (!list_empty(&list)) {
2065 delayed = list_entry(list.next, struct delayed_iput, list);
2066 list_del(&delayed->list);
2067 iput(delayed->inode);
2068 kfree(delayed);
2069 }
2070 up_read(&root->fs_info->cleanup_work_sem);
2071}
2072
2011/* 2073/*
2012 * This creates an orphan entry for the given inode in case something goes 2074 * This creates an orphan entry for the given inode in case something goes
2013 * wrong in the middle of an unlink/truncate. 2075 * wrong in the middle of an unlink/truncate.
@@ -2080,16 +2142,17 @@ void btrfs_orphan_cleanup(struct btrfs_root *root)
2080 struct inode *inode; 2142 struct inode *inode;
2081 int ret = 0, nr_unlink = 0, nr_truncate = 0; 2143 int ret = 0, nr_unlink = 0, nr_truncate = 0;
2082 2144
2083 path = btrfs_alloc_path(); 2145 if (!xchg(&root->clean_orphans, 0))
2084 if (!path)
2085 return; 2146 return;
2147
2148 path = btrfs_alloc_path();
2149 BUG_ON(!path);
2086 path->reada = -1; 2150 path->reada = -1;
2087 2151
2088 key.objectid = BTRFS_ORPHAN_OBJECTID; 2152 key.objectid = BTRFS_ORPHAN_OBJECTID;
2089 btrfs_set_key_type(&key, BTRFS_ORPHAN_ITEM_KEY); 2153 btrfs_set_key_type(&key, BTRFS_ORPHAN_ITEM_KEY);
2090 key.offset = (u64)-1; 2154 key.offset = (u64)-1;
2091 2155
2092
2093 while (1) { 2156 while (1) {
2094 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); 2157 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
2095 if (ret < 0) { 2158 if (ret < 0) {
@@ -2834,37 +2897,40 @@ out:
2834 * min_type is the minimum key type to truncate down to. If set to 0, this 2897 * min_type is the minimum key type to truncate down to. If set to 0, this
2835 * will kill all the items on this inode, including the INODE_ITEM_KEY. 2898 * will kill all the items on this inode, including the INODE_ITEM_KEY.
2836 */ 2899 */
2837noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, 2900int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
2838 struct btrfs_root *root, 2901 struct btrfs_root *root,
2839 struct inode *inode, 2902 struct inode *inode,
2840 u64 new_size, u32 min_type) 2903 u64 new_size, u32 min_type)
2841{ 2904{
2842 int ret;
2843 struct btrfs_path *path; 2905 struct btrfs_path *path;
2844 struct btrfs_key key;
2845 struct btrfs_key found_key;
2846 u32 found_type = (u8)-1;
2847 struct extent_buffer *leaf; 2906 struct extent_buffer *leaf;
2848 struct btrfs_file_extent_item *fi; 2907 struct btrfs_file_extent_item *fi;
2908 struct btrfs_key key;
2909 struct btrfs_key found_key;
2849 u64 extent_start = 0; 2910 u64 extent_start = 0;
2850 u64 extent_num_bytes = 0; 2911 u64 extent_num_bytes = 0;
2851 u64 extent_offset = 0; 2912 u64 extent_offset = 0;
2852 u64 item_end = 0; 2913 u64 item_end = 0;
2914 u64 mask = root->sectorsize - 1;
2915 u32 found_type = (u8)-1;
2853 int found_extent; 2916 int found_extent;
2854 int del_item; 2917 int del_item;
2855 int pending_del_nr = 0; 2918 int pending_del_nr = 0;
2856 int pending_del_slot = 0; 2919 int pending_del_slot = 0;
2857 int extent_type = -1; 2920 int extent_type = -1;
2858 int encoding; 2921 int encoding;
2859 u64 mask = root->sectorsize - 1; 2922 int ret;
2923 int err = 0;
2924
2925 BUG_ON(new_size > 0 && min_type != BTRFS_EXTENT_DATA_KEY);
2860 2926
2861 if (root->ref_cows) 2927 if (root->ref_cows)
2862 btrfs_drop_extent_cache(inode, new_size & (~mask), (u64)-1, 0); 2928 btrfs_drop_extent_cache(inode, new_size & (~mask), (u64)-1, 0);
2929
2863 path = btrfs_alloc_path(); 2930 path = btrfs_alloc_path();
2864 BUG_ON(!path); 2931 BUG_ON(!path);
2865 path->reada = -1; 2932 path->reada = -1;
2866 2933
2867 /* FIXME, add redo link to tree so we don't leak on crash */
2868 key.objectid = inode->i_ino; 2934 key.objectid = inode->i_ino;
2869 key.offset = (u64)-1; 2935 key.offset = (u64)-1;
2870 key.type = (u8)-1; 2936 key.type = (u8)-1;
@@ -2872,17 +2938,17 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
2872search_again: 2938search_again:
2873 path->leave_spinning = 1; 2939 path->leave_spinning = 1;
2874 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 2940 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
2875 if (ret < 0) 2941 if (ret < 0) {
2876 goto error; 2942 err = ret;
2943 goto out;
2944 }
2877 2945
2878 if (ret > 0) { 2946 if (ret > 0) {
2879 /* there are no items in the tree for us to truncate, we're 2947 /* there are no items in the tree for us to truncate, we're
2880 * done 2948 * done
2881 */ 2949 */
2882 if (path->slots[0] == 0) { 2950 if (path->slots[0] == 0)
2883 ret = 0; 2951 goto out;
2884 goto error;
2885 }
2886 path->slots[0]--; 2952 path->slots[0]--;
2887 } 2953 }
2888 2954
@@ -2917,28 +2983,17 @@ search_again:
2917 } 2983 }
2918 item_end--; 2984 item_end--;
2919 } 2985 }
2920 if (item_end < new_size) { 2986 if (found_type > min_type) {
2921 if (found_type == BTRFS_DIR_ITEM_KEY) 2987 del_item = 1;
2922 found_type = BTRFS_INODE_ITEM_KEY; 2988 } else {
2923 else if (found_type == BTRFS_EXTENT_ITEM_KEY) 2989 if (item_end < new_size)
2924 found_type = BTRFS_EXTENT_DATA_KEY;
2925 else if (found_type == BTRFS_EXTENT_DATA_KEY)
2926 found_type = BTRFS_XATTR_ITEM_KEY;
2927 else if (found_type == BTRFS_XATTR_ITEM_KEY)
2928 found_type = BTRFS_INODE_REF_KEY;
2929 else if (found_type)
2930 found_type--;
2931 else
2932 break; 2990 break;
2933 btrfs_set_key_type(&key, found_type); 2991 if (found_key.offset >= new_size)
2934 goto next; 2992 del_item = 1;
2993 else
2994 del_item = 0;
2935 } 2995 }
2936 if (found_key.offset >= new_size)
2937 del_item = 1;
2938 else
2939 del_item = 0;
2940 found_extent = 0; 2996 found_extent = 0;
2941
2942 /* FIXME, shrink the extent if the ref count is only 1 */ 2997 /* FIXME, shrink the extent if the ref count is only 1 */
2943 if (found_type != BTRFS_EXTENT_DATA_KEY) 2998 if (found_type != BTRFS_EXTENT_DATA_KEY)
2944 goto delete; 2999 goto delete;
@@ -3025,42 +3080,36 @@ delete:
3025 inode->i_ino, extent_offset); 3080 inode->i_ino, extent_offset);
3026 BUG_ON(ret); 3081 BUG_ON(ret);
3027 } 3082 }
3028next:
3029 if (path->slots[0] == 0) {
3030 if (pending_del_nr)
3031 goto del_pending;
3032 btrfs_release_path(root, path);
3033 if (found_type == BTRFS_INODE_ITEM_KEY)
3034 break;
3035 goto search_again;
3036 }
3037 3083
3038 path->slots[0]--; 3084 if (found_type == BTRFS_INODE_ITEM_KEY)
3039 if (pending_del_nr && 3085 break;
3040 path->slots[0] + 1 != pending_del_slot) { 3086
3041 struct btrfs_key debug; 3087 if (path->slots[0] == 0 ||
3042del_pending: 3088 path->slots[0] != pending_del_slot) {
3043 btrfs_item_key_to_cpu(path->nodes[0], &debug, 3089 if (root->ref_cows) {
3044 pending_del_slot); 3090 err = -EAGAIN;
3045 ret = btrfs_del_items(trans, root, path, 3091 goto out;
3046 pending_del_slot, 3092 }
3047 pending_del_nr); 3093 if (pending_del_nr) {
3048 BUG_ON(ret); 3094 ret = btrfs_del_items(trans, root, path,
3049 pending_del_nr = 0; 3095 pending_del_slot,
3096 pending_del_nr);
3097 BUG_ON(ret);
3098 pending_del_nr = 0;
3099 }
3050 btrfs_release_path(root, path); 3100 btrfs_release_path(root, path);
3051 if (found_type == BTRFS_INODE_ITEM_KEY)
3052 break;
3053 goto search_again; 3101 goto search_again;
3102 } else {
3103 path->slots[0]--;
3054 } 3104 }
3055 } 3105 }
3056 ret = 0; 3106out:
3057error:
3058 if (pending_del_nr) { 3107 if (pending_del_nr) {
3059 ret = btrfs_del_items(trans, root, path, pending_del_slot, 3108 ret = btrfs_del_items(trans, root, path, pending_del_slot,
3060 pending_del_nr); 3109 pending_del_nr);
3061 } 3110 }
3062 btrfs_free_path(path); 3111 btrfs_free_path(path);
3063 return ret; 3112 return err;
3064} 3113}
3065 3114
3066/* 3115/*
@@ -3180,10 +3229,6 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
3180 if (size <= hole_start) 3229 if (size <= hole_start)
3181 return 0; 3230 return 0;
3182 3231
3183 err = btrfs_truncate_page(inode->i_mapping, inode->i_size);
3184 if (err)
3185 return err;
3186
3187 while (1) { 3232 while (1) {
3188 struct btrfs_ordered_extent *ordered; 3233 struct btrfs_ordered_extent *ordered;
3189 btrfs_wait_ordered_range(inode, hole_start, 3234 btrfs_wait_ordered_range(inode, hole_start,
@@ -3196,9 +3241,6 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
3196 btrfs_put_ordered_extent(ordered); 3241 btrfs_put_ordered_extent(ordered);
3197 } 3242 }
3198 3243
3199 trans = btrfs_start_transaction(root, 1);
3200 btrfs_set_trans_block_group(trans, inode);
3201
3202 cur_offset = hole_start; 3244 cur_offset = hole_start;
3203 while (1) { 3245 while (1) {
3204 em = btrfs_get_extent(inode, NULL, 0, cur_offset, 3246 em = btrfs_get_extent(inode, NULL, 0, cur_offset,
@@ -3206,40 +3248,120 @@ int btrfs_cont_expand(struct inode *inode, loff_t size)
3206 BUG_ON(IS_ERR(em) || !em); 3248 BUG_ON(IS_ERR(em) || !em);
3207 last_byte = min(extent_map_end(em), block_end); 3249 last_byte = min(extent_map_end(em), block_end);
3208 last_byte = (last_byte + mask) & ~mask; 3250 last_byte = (last_byte + mask) & ~mask;
3209 if (test_bit(EXTENT_FLAG_VACANCY, &em->flags)) { 3251 if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
3210 u64 hint_byte = 0; 3252 u64 hint_byte = 0;
3211 hole_size = last_byte - cur_offset; 3253 hole_size = last_byte - cur_offset;
3212 err = btrfs_drop_extents(trans, root, inode,
3213 cur_offset,
3214 cur_offset + hole_size,
3215 block_end,
3216 cur_offset, &hint_byte, 1);
3217 if (err)
3218 break;
3219 3254
3220 err = btrfs_reserve_metadata_space(root, 1); 3255 err = btrfs_reserve_metadata_space(root, 2);
3221 if (err) 3256 if (err)
3222 break; 3257 break;
3223 3258
3259 trans = btrfs_start_transaction(root, 1);
3260 btrfs_set_trans_block_group(trans, inode);
3261
3262 err = btrfs_drop_extents(trans, inode, cur_offset,
3263 cur_offset + hole_size,
3264 &hint_byte, 1);
3265 BUG_ON(err);
3266
3224 err = btrfs_insert_file_extent(trans, root, 3267 err = btrfs_insert_file_extent(trans, root,
3225 inode->i_ino, cur_offset, 0, 3268 inode->i_ino, cur_offset, 0,
3226 0, hole_size, 0, hole_size, 3269 0, hole_size, 0, hole_size,
3227 0, 0, 0); 3270 0, 0, 0);
3271 BUG_ON(err);
3272
3228 btrfs_drop_extent_cache(inode, hole_start, 3273 btrfs_drop_extent_cache(inode, hole_start,
3229 last_byte - 1, 0); 3274 last_byte - 1, 0);
3230 btrfs_unreserve_metadata_space(root, 1); 3275
3276 btrfs_end_transaction(trans, root);
3277 btrfs_unreserve_metadata_space(root, 2);
3231 } 3278 }
3232 free_extent_map(em); 3279 free_extent_map(em);
3233 cur_offset = last_byte; 3280 cur_offset = last_byte;
3234 if (err || cur_offset >= block_end) 3281 if (cur_offset >= block_end)
3235 break; 3282 break;
3236 } 3283 }
3237 3284
3238 btrfs_end_transaction(trans, root);
3239 unlock_extent(io_tree, hole_start, block_end - 1, GFP_NOFS); 3285 unlock_extent(io_tree, hole_start, block_end - 1, GFP_NOFS);
3240 return err; 3286 return err;
3241} 3287}
3242 3288
3289static int btrfs_setattr_size(struct inode *inode, struct iattr *attr)
3290{
3291 struct btrfs_root *root = BTRFS_I(inode)->root;
3292 struct btrfs_trans_handle *trans;
3293 unsigned long nr;
3294 int ret;
3295
3296 if (attr->ia_size == inode->i_size)
3297 return 0;
3298
3299 if (attr->ia_size > inode->i_size) {
3300 unsigned long limit;
3301 limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
3302 if (attr->ia_size > inode->i_sb->s_maxbytes)
3303 return -EFBIG;
3304 if (limit != RLIM_INFINITY && attr->ia_size > limit) {
3305 send_sig(SIGXFSZ, current, 0);
3306 return -EFBIG;
3307 }
3308 }
3309
3310 ret = btrfs_reserve_metadata_space(root, 1);
3311 if (ret)
3312 return ret;
3313
3314 trans = btrfs_start_transaction(root, 1);
3315 btrfs_set_trans_block_group(trans, inode);
3316
3317 ret = btrfs_orphan_add(trans, inode);
3318 BUG_ON(ret);
3319
3320 nr = trans->blocks_used;
3321 btrfs_end_transaction(trans, root);
3322 btrfs_unreserve_metadata_space(root, 1);
3323 btrfs_btree_balance_dirty(root, nr);
3324
3325 if (attr->ia_size > inode->i_size) {
3326 ret = btrfs_cont_expand(inode, attr->ia_size);
3327 if (ret) {
3328 btrfs_truncate(inode);
3329 return ret;
3330 }
3331
3332 i_size_write(inode, attr->ia_size);
3333 btrfs_ordered_update_i_size(inode, inode->i_size, NULL);
3334
3335 trans = btrfs_start_transaction(root, 1);
3336 btrfs_set_trans_block_group(trans, inode);
3337
3338 ret = btrfs_update_inode(trans, root, inode);
3339 BUG_ON(ret);
3340 if (inode->i_nlink > 0) {
3341 ret = btrfs_orphan_del(trans, inode);
3342 BUG_ON(ret);
3343 }
3344 nr = trans->blocks_used;
3345 btrfs_end_transaction(trans, root);
3346 btrfs_btree_balance_dirty(root, nr);
3347 return 0;
3348 }
3349
3350 /*
3351 * We're truncating a file that used to have good data down to
3352 * zero. Make sure it gets into the ordered flush list so that
3353 * any new writes get down to disk quickly.
3354 */
3355 if (attr->ia_size == 0)
3356 BTRFS_I(inode)->ordered_data_close = 1;
3357
3358 /* we don't support swapfiles, so vmtruncate shouldn't fail */
3359 ret = vmtruncate(inode, attr->ia_size);
3360 BUG_ON(ret);
3361
3362 return 0;
3363}
3364
3243static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) 3365static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
3244{ 3366{
3245 struct inode *inode = dentry->d_inode; 3367 struct inode *inode = dentry->d_inode;
@@ -3250,23 +3372,14 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
3250 return err; 3372 return err;
3251 3373
3252 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { 3374 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {
3253 if (attr->ia_size > inode->i_size) { 3375 err = btrfs_setattr_size(inode, attr);
3254 err = btrfs_cont_expand(inode, attr->ia_size); 3376 if (err)
3255 if (err) 3377 return err;
3256 return err;
3257 } else if (inode->i_size > 0 &&
3258 attr->ia_size == 0) {
3259
3260 /* we're truncating a file that used to have good
3261 * data down to zero. Make sure it gets into
3262 * the ordered flush list so that any new writes
3263 * get down to disk quickly.
3264 */
3265 BTRFS_I(inode)->ordered_data_close = 1;
3266 }
3267 } 3378 }
3379 attr->ia_valid &= ~ATTR_SIZE;
3268 3380
3269 err = inode_setattr(inode, attr); 3381 if (attr->ia_valid)
3382 err = inode_setattr(inode, attr);
3270 3383
3271 if (!err && ((attr->ia_valid & ATTR_MODE))) 3384 if (!err && ((attr->ia_valid & ATTR_MODE)))
3272 err = btrfs_acl_chmod(inode); 3385 err = btrfs_acl_chmod(inode);
@@ -3287,36 +3400,43 @@ void btrfs_delete_inode(struct inode *inode)
3287 } 3400 }
3288 btrfs_wait_ordered_range(inode, 0, (u64)-1); 3401 btrfs_wait_ordered_range(inode, 0, (u64)-1);
3289 3402
3403 if (root->fs_info->log_root_recovering) {
3404 BUG_ON(!list_empty(&BTRFS_I(inode)->i_orphan));
3405 goto no_delete;
3406 }
3407
3290 if (inode->i_nlink > 0) { 3408 if (inode->i_nlink > 0) {
3291 BUG_ON(btrfs_root_refs(&root->root_item) != 0); 3409 BUG_ON(btrfs_root_refs(&root->root_item) != 0);
3292 goto no_delete; 3410 goto no_delete;
3293 } 3411 }
3294 3412
3295 btrfs_i_size_write(inode, 0); 3413 btrfs_i_size_write(inode, 0);
3296 trans = btrfs_join_transaction(root, 1);
3297 3414
3298 btrfs_set_trans_block_group(trans, inode); 3415 while (1) {
3299 ret = btrfs_truncate_inode_items(trans, root, inode, inode->i_size, 0); 3416 trans = btrfs_start_transaction(root, 1);
3300 if (ret) { 3417 btrfs_set_trans_block_group(trans, inode);
3301 btrfs_orphan_del(NULL, inode); 3418 ret = btrfs_truncate_inode_items(trans, root, inode, 0, 0);
3302 goto no_delete_lock;
3303 }
3304 3419
3305 btrfs_orphan_del(trans, inode); 3420 if (ret != -EAGAIN)
3421 break;
3306 3422
3307 nr = trans->blocks_used; 3423 nr = trans->blocks_used;
3308 clear_inode(inode); 3424 btrfs_end_transaction(trans, root);
3425 trans = NULL;
3426 btrfs_btree_balance_dirty(root, nr);
3427 }
3309 3428
3310 btrfs_end_transaction(trans, root); 3429 if (ret == 0) {
3311 btrfs_btree_balance_dirty(root, nr); 3430 ret = btrfs_orphan_del(trans, inode);
3312 return; 3431 BUG_ON(ret);
3432 }
3313 3433
3314no_delete_lock:
3315 nr = trans->blocks_used; 3434 nr = trans->blocks_used;
3316 btrfs_end_transaction(trans, root); 3435 btrfs_end_transaction(trans, root);
3317 btrfs_btree_balance_dirty(root, nr); 3436 btrfs_btree_balance_dirty(root, nr);
3318no_delete: 3437no_delete:
3319 clear_inode(inode); 3438 clear_inode(inode);
3439 return;
3320} 3440}
3321 3441
3322/* 3442/*
@@ -3569,7 +3689,6 @@ static noinline void init_btrfs_i(struct inode *inode)
3569 INIT_LIST_HEAD(&BTRFS_I(inode)->ordered_operations); 3689 INIT_LIST_HEAD(&BTRFS_I(inode)->ordered_operations);
3570 RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node); 3690 RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
3571 btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); 3691 btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree);
3572 mutex_init(&BTRFS_I(inode)->extent_mutex);
3573 mutex_init(&BTRFS_I(inode)->log_mutex); 3692 mutex_init(&BTRFS_I(inode)->log_mutex);
3574} 3693}
3575 3694
@@ -3695,6 +3814,13 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
3695 } 3814 }
3696 srcu_read_unlock(&root->fs_info->subvol_srcu, index); 3815 srcu_read_unlock(&root->fs_info->subvol_srcu, index);
3697 3816
3817 if (root != sub_root) {
3818 down_read(&root->fs_info->cleanup_work_sem);
3819 if (!(inode->i_sb->s_flags & MS_RDONLY))
3820 btrfs_orphan_cleanup(sub_root);
3821 up_read(&root->fs_info->cleanup_work_sem);
3822 }
3823
3698 return inode; 3824 return inode;
3699} 3825}
3700 3826
@@ -4219,7 +4345,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4219 if (IS_ERR(inode)) 4345 if (IS_ERR(inode))
4220 goto out_unlock; 4346 goto out_unlock;
4221 4347
4222 err = btrfs_init_inode_security(inode, dir); 4348 err = btrfs_init_inode_security(trans, inode, dir);
4223 if (err) { 4349 if (err) {
4224 drop_inode = 1; 4350 drop_inode = 1;
4225 goto out_unlock; 4351 goto out_unlock;
@@ -4290,7 +4416,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4290 if (IS_ERR(inode)) 4416 if (IS_ERR(inode))
4291 goto out_unlock; 4417 goto out_unlock;
4292 4418
4293 err = btrfs_init_inode_security(inode, dir); 4419 err = btrfs_init_inode_security(trans, inode, dir);
4294 if (err) { 4420 if (err) {
4295 drop_inode = 1; 4421 drop_inode = 1;
4296 goto out_unlock; 4422 goto out_unlock;
@@ -4336,6 +4462,10 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4336 if (inode->i_nlink == 0) 4462 if (inode->i_nlink == 0)
4337 return -ENOENT; 4463 return -ENOENT;
4338 4464
4465 /* do not allow sys_link's with other subvols of the same device */
4466 if (root->objectid != BTRFS_I(inode)->root->objectid)
4467 return -EPERM;
4468
4339 /* 4469 /*
4340 * 1 item for inode ref 4470 * 1 item for inode ref
4341 * 2 items for dir items 4471 * 2 items for dir items
@@ -4423,7 +4553,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
4423 4553
4424 drop_on_err = 1; 4554 drop_on_err = 1;
4425 4555
4426 err = btrfs_init_inode_security(inode, dir); 4556 err = btrfs_init_inode_security(trans, inode, dir);
4427 if (err) 4557 if (err)
4428 goto out_fail; 4558 goto out_fail;
4429 4559
@@ -5074,17 +5204,20 @@ static void btrfs_truncate(struct inode *inode)
5074 unsigned long nr; 5204 unsigned long nr;
5075 u64 mask = root->sectorsize - 1; 5205 u64 mask = root->sectorsize - 1;
5076 5206
5077 if (!S_ISREG(inode->i_mode)) 5207 if (!S_ISREG(inode->i_mode)) {
5078 return; 5208 WARN_ON(1);
5079 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
5080 return; 5209 return;
5210 }
5081 5211
5082 ret = btrfs_truncate_page(inode->i_mapping, inode->i_size); 5212 ret = btrfs_truncate_page(inode->i_mapping, inode->i_size);
5083 if (ret) 5213 if (ret)
5084 return; 5214 return;
5215
5085 btrfs_wait_ordered_range(inode, inode->i_size & (~mask), (u64)-1); 5216 btrfs_wait_ordered_range(inode, inode->i_size & (~mask), (u64)-1);
5217 btrfs_ordered_update_i_size(inode, inode->i_size, NULL);
5086 5218
5087 trans = btrfs_start_transaction(root, 1); 5219 trans = btrfs_start_transaction(root, 1);
5220 btrfs_set_trans_block_group(trans, inode);
5088 5221
5089 /* 5222 /*
5090 * setattr is responsible for setting the ordered_data_close flag, 5223 * setattr is responsible for setting the ordered_data_close flag,
@@ -5106,21 +5239,32 @@ static void btrfs_truncate(struct inode *inode)
5106 if (inode->i_size == 0 && BTRFS_I(inode)->ordered_data_close) 5239 if (inode->i_size == 0 && BTRFS_I(inode)->ordered_data_close)
5107 btrfs_add_ordered_operation(trans, root, inode); 5240 btrfs_add_ordered_operation(trans, root, inode);
5108 5241
5109 btrfs_set_trans_block_group(trans, inode); 5242 while (1) {
5110 btrfs_i_size_write(inode, inode->i_size); 5243 ret = btrfs_truncate_inode_items(trans, root, inode,
5244 inode->i_size,
5245 BTRFS_EXTENT_DATA_KEY);
5246 if (ret != -EAGAIN)
5247 break;
5111 5248
5112 ret = btrfs_orphan_add(trans, inode); 5249 ret = btrfs_update_inode(trans, root, inode);
5113 if (ret) 5250 BUG_ON(ret);
5114 goto out; 5251
5115 /* FIXME, add redo link to tree so we don't leak on crash */ 5252 nr = trans->blocks_used;
5116 ret = btrfs_truncate_inode_items(trans, root, inode, inode->i_size, 5253 btrfs_end_transaction(trans, root);
5117 BTRFS_EXTENT_DATA_KEY); 5254 btrfs_btree_balance_dirty(root, nr);
5118 btrfs_update_inode(trans, root, inode); 5255
5256 trans = btrfs_start_transaction(root, 1);
5257 btrfs_set_trans_block_group(trans, inode);
5258 }
5119 5259
5120 ret = btrfs_orphan_del(trans, inode); 5260 if (ret == 0 && inode->i_nlink > 0) {
5261 ret = btrfs_orphan_del(trans, inode);
5262 BUG_ON(ret);
5263 }
5264
5265 ret = btrfs_update_inode(trans, root, inode);
5121 BUG_ON(ret); 5266 BUG_ON(ret);
5122 5267
5123out:
5124 nr = trans->blocks_used; 5268 nr = trans->blocks_used;
5125 ret = btrfs_end_transaction_throttle(trans, root); 5269 ret = btrfs_end_transaction_throttle(trans, root);
5126 BUG_ON(ret); 5270 BUG_ON(ret);
@@ -5217,9 +5361,9 @@ void btrfs_destroy_inode(struct inode *inode)
5217 5361
5218 spin_lock(&root->list_lock); 5362 spin_lock(&root->list_lock);
5219 if (!list_empty(&BTRFS_I(inode)->i_orphan)) { 5363 if (!list_empty(&BTRFS_I(inode)->i_orphan)) {
5220 printk(KERN_ERR "BTRFS: inode %lu: inode still on the orphan" 5364 printk(KERN_INFO "BTRFS: inode %lu still on the orphan list\n",
5221 " list\n", inode->i_ino); 5365 inode->i_ino);
5222 dump_stack(); 5366 list_del_init(&BTRFS_I(inode)->i_orphan);
5223 } 5367 }
5224 spin_unlock(&root->list_lock); 5368 spin_unlock(&root->list_lock);
5225 5369
@@ -5476,7 +5620,7 @@ out_fail:
5476 * some fairly slow code that needs optimization. This walks the list 5620 * some fairly slow code that needs optimization. This walks the list
5477 * of all the inodes with pending delalloc and forces them to disk. 5621 * of all the inodes with pending delalloc and forces them to disk.
5478 */ 5622 */
5479int btrfs_start_delalloc_inodes(struct btrfs_root *root) 5623int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput)
5480{ 5624{
5481 struct list_head *head = &root->fs_info->delalloc_inodes; 5625 struct list_head *head = &root->fs_info->delalloc_inodes;
5482 struct btrfs_inode *binode; 5626 struct btrfs_inode *binode;
@@ -5495,7 +5639,10 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root)
5495 spin_unlock(&root->fs_info->delalloc_lock); 5639 spin_unlock(&root->fs_info->delalloc_lock);
5496 if (inode) { 5640 if (inode) {
5497 filemap_flush(inode->i_mapping); 5641 filemap_flush(inode->i_mapping);
5498 iput(inode); 5642 if (delay_iput)
5643 btrfs_add_delayed_iput(inode);
5644 else
5645 iput(inode);
5499 } 5646 }
5500 cond_resched(); 5647 cond_resched();
5501 spin_lock(&root->fs_info->delalloc_lock); 5648 spin_lock(&root->fs_info->delalloc_lock);
@@ -5569,7 +5716,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
5569 if (IS_ERR(inode)) 5716 if (IS_ERR(inode))
5570 goto out_unlock; 5717 goto out_unlock;
5571 5718
5572 err = btrfs_init_inode_security(inode, dir); 5719 err = btrfs_init_inode_security(trans, inode, dir);
5573 if (err) { 5720 if (err) {
5574 drop_inode = 1; 5721 drop_inode = 1;
5575 goto out_unlock; 5722 goto out_unlock;
@@ -5641,10 +5788,10 @@ out_fail:
5641 return err; 5788 return err;
5642} 5789}
5643 5790
5644static int prealloc_file_range(struct btrfs_trans_handle *trans, 5791static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
5645 struct inode *inode, u64 start, u64 end, 5792 u64 alloc_hint, int mode)
5646 u64 locked_end, u64 alloc_hint, int mode)
5647{ 5793{
5794 struct btrfs_trans_handle *trans;
5648 struct btrfs_root *root = BTRFS_I(inode)->root; 5795 struct btrfs_root *root = BTRFS_I(inode)->root;
5649 struct btrfs_key ins; 5796 struct btrfs_key ins;
5650 u64 alloc_size; 5797 u64 alloc_size;
@@ -5655,43 +5802,56 @@ static int prealloc_file_range(struct btrfs_trans_handle *trans,
5655 while (num_bytes > 0) { 5802 while (num_bytes > 0) {
5656 alloc_size = min(num_bytes, root->fs_info->max_extent); 5803 alloc_size = min(num_bytes, root->fs_info->max_extent);
5657 5804
5658 ret = btrfs_reserve_metadata_space(root, 1); 5805 trans = btrfs_start_transaction(root, 1);
5659 if (ret)
5660 goto out;
5661 5806
5662 ret = btrfs_reserve_extent(trans, root, alloc_size, 5807 ret = btrfs_reserve_extent(trans, root, alloc_size,
5663 root->sectorsize, 0, alloc_hint, 5808 root->sectorsize, 0, alloc_hint,
5664 (u64)-1, &ins, 1); 5809 (u64)-1, &ins, 1);
5665 if (ret) { 5810 if (ret) {
5666 WARN_ON(1); 5811 WARN_ON(1);
5667 goto out; 5812 goto stop_trans;
5813 }
5814
5815 ret = btrfs_reserve_metadata_space(root, 3);
5816 if (ret) {
5817 btrfs_free_reserved_extent(root, ins.objectid,
5818 ins.offset);
5819 goto stop_trans;
5668 } 5820 }
5821
5669 ret = insert_reserved_file_extent(trans, inode, 5822 ret = insert_reserved_file_extent(trans, inode,
5670 cur_offset, ins.objectid, 5823 cur_offset, ins.objectid,
5671 ins.offset, ins.offset, 5824 ins.offset, ins.offset,
5672 ins.offset, locked_end, 5825 ins.offset, 0, 0, 0,
5673 0, 0, 0,
5674 BTRFS_FILE_EXTENT_PREALLOC); 5826 BTRFS_FILE_EXTENT_PREALLOC);
5675 BUG_ON(ret); 5827 BUG_ON(ret);
5676 btrfs_drop_extent_cache(inode, cur_offset, 5828 btrfs_drop_extent_cache(inode, cur_offset,
5677 cur_offset + ins.offset -1, 0); 5829 cur_offset + ins.offset -1, 0);
5830
5678 num_bytes -= ins.offset; 5831 num_bytes -= ins.offset;
5679 cur_offset += ins.offset; 5832 cur_offset += ins.offset;
5680 alloc_hint = ins.objectid + ins.offset; 5833 alloc_hint = ins.objectid + ins.offset;
5681 btrfs_unreserve_metadata_space(root, 1); 5834
5682 }
5683out:
5684 if (cur_offset > start) {
5685 inode->i_ctime = CURRENT_TIME; 5835 inode->i_ctime = CURRENT_TIME;
5686 BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; 5836 BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC;
5687 if (!(mode & FALLOC_FL_KEEP_SIZE) && 5837 if (!(mode & FALLOC_FL_KEEP_SIZE) &&
5688 cur_offset > i_size_read(inode)) 5838 cur_offset > inode->i_size) {
5689 btrfs_i_size_write(inode, cur_offset); 5839 i_size_write(inode, cur_offset);
5840 btrfs_ordered_update_i_size(inode, cur_offset, NULL);
5841 }
5842
5690 ret = btrfs_update_inode(trans, root, inode); 5843 ret = btrfs_update_inode(trans, root, inode);
5691 BUG_ON(ret); 5844 BUG_ON(ret);
5845
5846 btrfs_end_transaction(trans, root);
5847 btrfs_unreserve_metadata_space(root, 3);
5692 } 5848 }
5849 return ret;
5693 5850
5851stop_trans:
5852 btrfs_end_transaction(trans, root);
5694 return ret; 5853 return ret;
5854
5695} 5855}
5696 5856
5697static long btrfs_fallocate(struct inode *inode, int mode, 5857static long btrfs_fallocate(struct inode *inode, int mode,
@@ -5705,8 +5865,6 @@ static long btrfs_fallocate(struct inode *inode, int mode,
5705 u64 locked_end; 5865 u64 locked_end;
5706 u64 mask = BTRFS_I(inode)->root->sectorsize - 1; 5866 u64 mask = BTRFS_I(inode)->root->sectorsize - 1;
5707 struct extent_map *em; 5867 struct extent_map *em;
5708 struct btrfs_trans_handle *trans;
5709 struct btrfs_root *root;
5710 int ret; 5868 int ret;
5711 5869
5712 alloc_start = offset & ~mask; 5870 alloc_start = offset & ~mask;
@@ -5725,9 +5883,7 @@ static long btrfs_fallocate(struct inode *inode, int mode,
5725 goto out; 5883 goto out;
5726 } 5884 }
5727 5885
5728 root = BTRFS_I(inode)->root; 5886 ret = btrfs_check_data_free_space(BTRFS_I(inode)->root, inode,
5729
5730 ret = btrfs_check_data_free_space(root, inode,
5731 alloc_end - alloc_start); 5887 alloc_end - alloc_start);
5732 if (ret) 5888 if (ret)
5733 goto out; 5889 goto out;
@@ -5736,12 +5892,6 @@ static long btrfs_fallocate(struct inode *inode, int mode,
5736 while (1) { 5892 while (1) {
5737 struct btrfs_ordered_extent *ordered; 5893 struct btrfs_ordered_extent *ordered;
5738 5894
5739 trans = btrfs_start_transaction(BTRFS_I(inode)->root, 1);
5740 if (!trans) {
5741 ret = -EIO;
5742 goto out_free;
5743 }
5744
5745 /* the extent lock is ordered inside the running 5895 /* the extent lock is ordered inside the running
5746 * transaction 5896 * transaction
5747 */ 5897 */
@@ -5755,8 +5905,6 @@ static long btrfs_fallocate(struct inode *inode, int mode,
5755 btrfs_put_ordered_extent(ordered); 5905 btrfs_put_ordered_extent(ordered);
5756 unlock_extent(&BTRFS_I(inode)->io_tree, 5906 unlock_extent(&BTRFS_I(inode)->io_tree,
5757 alloc_start, locked_end, GFP_NOFS); 5907 alloc_start, locked_end, GFP_NOFS);
5758 btrfs_end_transaction(trans, BTRFS_I(inode)->root);
5759
5760 /* 5908 /*
5761 * we can't wait on the range with the transaction 5909 * we can't wait on the range with the transaction
5762 * running or with the extent lock held 5910 * running or with the extent lock held
@@ -5777,10 +5925,12 @@ static long btrfs_fallocate(struct inode *inode, int mode,
5777 BUG_ON(IS_ERR(em) || !em); 5925 BUG_ON(IS_ERR(em) || !em);
5778 last_byte = min(extent_map_end(em), alloc_end); 5926 last_byte = min(extent_map_end(em), alloc_end);
5779 last_byte = (last_byte + mask) & ~mask; 5927 last_byte = (last_byte + mask) & ~mask;
5780 if (em->block_start == EXTENT_MAP_HOLE) { 5928 if (em->block_start == EXTENT_MAP_HOLE ||
5781 ret = prealloc_file_range(trans, inode, cur_offset, 5929 (cur_offset >= inode->i_size &&
5782 last_byte, locked_end + 1, 5930 !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) {
5783 alloc_hint, mode); 5931 ret = prealloc_file_range(inode,
5932 cur_offset, last_byte,
5933 alloc_hint, mode);
5784 if (ret < 0) { 5934 if (ret < 0) {
5785 free_extent_map(em); 5935 free_extent_map(em);
5786 break; 5936 break;
@@ -5799,9 +5949,8 @@ static long btrfs_fallocate(struct inode *inode, int mode,
5799 unlock_extent(&BTRFS_I(inode)->io_tree, alloc_start, locked_end, 5949 unlock_extent(&BTRFS_I(inode)->io_tree, alloc_start, locked_end,
5800 GFP_NOFS); 5950 GFP_NOFS);
5801 5951
5802 btrfs_end_transaction(trans, BTRFS_I(inode)->root); 5952 btrfs_free_reserved_data_space(BTRFS_I(inode)->root, inode,
5803out_free: 5953 alloc_end - alloc_start);
5804 btrfs_free_reserved_data_space(root, inode, alloc_end - alloc_start);
5805out: 5954out:
5806 mutex_unlock(&inode->i_mutex); 5955 mutex_unlock(&inode->i_mutex);
5807 return ret; 5956 return ret;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index cdbb054102b9..645a17927a8f 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -237,7 +237,6 @@ static noinline int create_subvol(struct btrfs_root *root,
237 u64 objectid; 237 u64 objectid;
238 u64 new_dirid = BTRFS_FIRST_FREE_OBJECTID; 238 u64 new_dirid = BTRFS_FIRST_FREE_OBJECTID;
239 u64 index = 0; 239 u64 index = 0;
240 unsigned long nr = 1;
241 240
242 /* 241 /*
243 * 1 - inode item 242 * 1 - inode item
@@ -290,7 +289,7 @@ static noinline int create_subvol(struct btrfs_root *root,
290 btrfs_set_root_generation(&root_item, trans->transid); 289 btrfs_set_root_generation(&root_item, trans->transid);
291 btrfs_set_root_level(&root_item, 0); 290 btrfs_set_root_level(&root_item, 0);
292 btrfs_set_root_refs(&root_item, 1); 291 btrfs_set_root_refs(&root_item, 1);
293 btrfs_set_root_used(&root_item, 0); 292 btrfs_set_root_used(&root_item, leaf->len);
294 btrfs_set_root_last_snapshot(&root_item, 0); 293 btrfs_set_root_last_snapshot(&root_item, 0);
295 294
296 memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress)); 295 memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress));
@@ -342,24 +341,21 @@ static noinline int create_subvol(struct btrfs_root *root,
342 341
343 d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry)); 342 d_instantiate(dentry, btrfs_lookup_dentry(dir, dentry));
344fail: 343fail:
345 nr = trans->blocks_used;
346 err = btrfs_commit_transaction(trans, root); 344 err = btrfs_commit_transaction(trans, root);
347 if (err && !ret) 345 if (err && !ret)
348 ret = err; 346 ret = err;
349 347
350 btrfs_unreserve_metadata_space(root, 6); 348 btrfs_unreserve_metadata_space(root, 6);
351 btrfs_btree_balance_dirty(root, nr);
352 return ret; 349 return ret;
353} 350}
354 351
355static int create_snapshot(struct btrfs_root *root, struct dentry *dentry, 352static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
356 char *name, int namelen) 353 char *name, int namelen)
357{ 354{
355 struct inode *inode;
358 struct btrfs_pending_snapshot *pending_snapshot; 356 struct btrfs_pending_snapshot *pending_snapshot;
359 struct btrfs_trans_handle *trans; 357 struct btrfs_trans_handle *trans;
360 int ret = 0; 358 int ret;
361 int err;
362 unsigned long nr = 0;
363 359
364 if (!root->ref_cows) 360 if (!root->ref_cows)
365 return -EINVAL; 361 return -EINVAL;
@@ -372,20 +368,20 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
372 */ 368 */
373 ret = btrfs_reserve_metadata_space(root, 6); 369 ret = btrfs_reserve_metadata_space(root, 6);
374 if (ret) 370 if (ret)
375 goto fail_unlock; 371 goto fail;
376 372
377 pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_NOFS); 373 pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_NOFS);
378 if (!pending_snapshot) { 374 if (!pending_snapshot) {
379 ret = -ENOMEM; 375 ret = -ENOMEM;
380 btrfs_unreserve_metadata_space(root, 6); 376 btrfs_unreserve_metadata_space(root, 6);
381 goto fail_unlock; 377 goto fail;
382 } 378 }
383 pending_snapshot->name = kmalloc(namelen + 1, GFP_NOFS); 379 pending_snapshot->name = kmalloc(namelen + 1, GFP_NOFS);
384 if (!pending_snapshot->name) { 380 if (!pending_snapshot->name) {
385 ret = -ENOMEM; 381 ret = -ENOMEM;
386 kfree(pending_snapshot); 382 kfree(pending_snapshot);
387 btrfs_unreserve_metadata_space(root, 6); 383 btrfs_unreserve_metadata_space(root, 6);
388 goto fail_unlock; 384 goto fail;
389 } 385 }
390 memcpy(pending_snapshot->name, name, namelen); 386 memcpy(pending_snapshot->name, name, namelen);
391 pending_snapshot->name[namelen] = '\0'; 387 pending_snapshot->name[namelen] = '\0';
@@ -395,10 +391,19 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry,
395 pending_snapshot->root = root; 391 pending_snapshot->root = root;
396 list_add(&pending_snapshot->list, 392 list_add(&pending_snapshot->list,
397 &trans->transaction->pending_snapshots); 393 &trans->transaction->pending_snapshots);
398 err = btrfs_commit_transaction(trans, root); 394 ret = btrfs_commit_transaction(trans, root);
395 BUG_ON(ret);
396 btrfs_unreserve_metadata_space(root, 6);
399 397
400fail_unlock: 398 inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry);
401 btrfs_btree_balance_dirty(root, nr); 399 if (IS_ERR(inode)) {
400 ret = PTR_ERR(inode);
401 goto fail;
402 }
403 BUG_ON(!inode);
404 d_instantiate(dentry, inode);
405 ret = 0;
406fail:
402 return ret; 407 return ret;
403} 408}
404 409
@@ -1027,8 +1032,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1027 BUG_ON(!trans); 1032 BUG_ON(!trans);
1028 1033
1029 /* punch hole in destination first */ 1034 /* punch hole in destination first */
1030 btrfs_drop_extents(trans, root, inode, off, off + len, 1035 btrfs_drop_extents(trans, inode, off, off + len, &hint_byte, 1);
1031 off + len, 0, &hint_byte, 1);
1032 1036
1033 /* clone data */ 1037 /* clone data */
1034 key.objectid = src->i_ino; 1038 key.objectid = src->i_ino;
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 5799bc46a309..b10a49d4bc6a 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -291,16 +291,16 @@ int btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry)
291 291
292/* 292/*
293 * remove an ordered extent from the tree. No references are dropped 293 * remove an ordered extent from the tree. No references are dropped
294 * but, anyone waiting on this extent is woken up. 294 * and you must wake_up entry->wait. You must hold the tree mutex
295 * while you call this function.
295 */ 296 */
296int btrfs_remove_ordered_extent(struct inode *inode, 297static int __btrfs_remove_ordered_extent(struct inode *inode,
297 struct btrfs_ordered_extent *entry) 298 struct btrfs_ordered_extent *entry)
298{ 299{
299 struct btrfs_ordered_inode_tree *tree; 300 struct btrfs_ordered_inode_tree *tree;
300 struct rb_node *node; 301 struct rb_node *node;
301 302
302 tree = &BTRFS_I(inode)->ordered_tree; 303 tree = &BTRFS_I(inode)->ordered_tree;
303 mutex_lock(&tree->mutex);
304 node = &entry->rb_node; 304 node = &entry->rb_node;
305 rb_erase(node, &tree->tree); 305 rb_erase(node, &tree->tree);
306 tree->last = NULL; 306 tree->last = NULL;
@@ -326,16 +326,34 @@ int btrfs_remove_ordered_extent(struct inode *inode,
326 } 326 }
327 spin_unlock(&BTRFS_I(inode)->root->fs_info->ordered_extent_lock); 327 spin_unlock(&BTRFS_I(inode)->root->fs_info->ordered_extent_lock);
328 328
329 return 0;
330}
331
332/*
333 * remove an ordered extent from the tree. No references are dropped
334 * but any waiters are woken.
335 */
336int btrfs_remove_ordered_extent(struct inode *inode,
337 struct btrfs_ordered_extent *entry)
338{
339 struct btrfs_ordered_inode_tree *tree;
340 int ret;
341
342 tree = &BTRFS_I(inode)->ordered_tree;
343 mutex_lock(&tree->mutex);
344 ret = __btrfs_remove_ordered_extent(inode, entry);
329 mutex_unlock(&tree->mutex); 345 mutex_unlock(&tree->mutex);
330 wake_up(&entry->wait); 346 wake_up(&entry->wait);
331 return 0; 347
348 return ret;
332} 349}
333 350
334/* 351/*
335 * wait for all the ordered extents in a root. This is done when balancing 352 * wait for all the ordered extents in a root. This is done when balancing
336 * space between drives. 353 * space between drives.
337 */ 354 */
338int btrfs_wait_ordered_extents(struct btrfs_root *root, int nocow_only) 355int btrfs_wait_ordered_extents(struct btrfs_root *root,
356 int nocow_only, int delay_iput)
339{ 357{
340 struct list_head splice; 358 struct list_head splice;
341 struct list_head *cur; 359 struct list_head *cur;
@@ -372,7 +390,10 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nocow_only)
372 if (inode) { 390 if (inode) {
373 btrfs_start_ordered_extent(inode, ordered, 1); 391 btrfs_start_ordered_extent(inode, ordered, 1);
374 btrfs_put_ordered_extent(ordered); 392 btrfs_put_ordered_extent(ordered);
375 iput(inode); 393 if (delay_iput)
394 btrfs_add_delayed_iput(inode);
395 else
396 iput(inode);
376 } else { 397 } else {
377 btrfs_put_ordered_extent(ordered); 398 btrfs_put_ordered_extent(ordered);
378 } 399 }
@@ -430,7 +451,7 @@ again:
430 btrfs_wait_ordered_range(inode, 0, (u64)-1); 451 btrfs_wait_ordered_range(inode, 0, (u64)-1);
431 else 452 else
432 filemap_flush(inode->i_mapping); 453 filemap_flush(inode->i_mapping);
433 iput(inode); 454 btrfs_add_delayed_iput(inode);
434 } 455 }
435 456
436 cond_resched(); 457 cond_resched();
@@ -589,7 +610,7 @@ out:
589 * After an extent is done, call this to conditionally update the on disk 610 * After an extent is done, call this to conditionally update the on disk
590 * i_size. i_size is updated to cover any fully written part of the file. 611 * i_size. i_size is updated to cover any fully written part of the file.
591 */ 612 */
592int btrfs_ordered_update_i_size(struct inode *inode, 613int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
593 struct btrfs_ordered_extent *ordered) 614 struct btrfs_ordered_extent *ordered)
594{ 615{
595 struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree; 616 struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree;
@@ -597,18 +618,30 @@ int btrfs_ordered_update_i_size(struct inode *inode,
597 u64 disk_i_size; 618 u64 disk_i_size;
598 u64 new_i_size; 619 u64 new_i_size;
599 u64 i_size_test; 620 u64 i_size_test;
621 u64 i_size = i_size_read(inode);
600 struct rb_node *node; 622 struct rb_node *node;
623 struct rb_node *prev = NULL;
601 struct btrfs_ordered_extent *test; 624 struct btrfs_ordered_extent *test;
625 int ret = 1;
626
627 if (ordered)
628 offset = entry_end(ordered);
602 629
603 mutex_lock(&tree->mutex); 630 mutex_lock(&tree->mutex);
604 disk_i_size = BTRFS_I(inode)->disk_i_size; 631 disk_i_size = BTRFS_I(inode)->disk_i_size;
605 632
633 /* truncate file */
634 if (disk_i_size > i_size) {
635 BTRFS_I(inode)->disk_i_size = i_size;
636 ret = 0;
637 goto out;
638 }
639
606 /* 640 /*
607 * if the disk i_size is already at the inode->i_size, or 641 * if the disk i_size is already at the inode->i_size, or
608 * this ordered extent is inside the disk i_size, we're done 642 * this ordered extent is inside the disk i_size, we're done
609 */ 643 */
610 if (disk_i_size >= inode->i_size || 644 if (disk_i_size == i_size || offset <= disk_i_size) {
611 ordered->file_offset + ordered->len <= disk_i_size) {
612 goto out; 645 goto out;
613 } 646 }
614 647
@@ -616,8 +649,7 @@ int btrfs_ordered_update_i_size(struct inode *inode,
616 * we can't update the disk_isize if there are delalloc bytes 649 * we can't update the disk_isize if there are delalloc bytes
617 * between disk_i_size and this ordered extent 650 * between disk_i_size and this ordered extent
618 */ 651 */
619 if (test_range_bit(io_tree, disk_i_size, 652 if (test_range_bit(io_tree, disk_i_size, offset - 1,
620 ordered->file_offset + ordered->len - 1,
621 EXTENT_DELALLOC, 0, NULL)) { 653 EXTENT_DELALLOC, 0, NULL)) {
622 goto out; 654 goto out;
623 } 655 }
@@ -626,20 +658,32 @@ int btrfs_ordered_update_i_size(struct inode *inode,
626 * if we find an ordered extent then we can't update disk i_size 658 * if we find an ordered extent then we can't update disk i_size
627 * yet 659 * yet
628 */ 660 */
629 node = &ordered->rb_node; 661 if (ordered) {
630 while (1) { 662 node = rb_prev(&ordered->rb_node);
631 node = rb_prev(node); 663 } else {
632 if (!node) 664 prev = tree_search(tree, offset);
633 break; 665 /*
666 * we insert file extents without involving ordered struct,
667 * so there should be no ordered struct cover this offset
668 */
669 if (prev) {
670 test = rb_entry(prev, struct btrfs_ordered_extent,
671 rb_node);
672 BUG_ON(offset_in_entry(test, offset));
673 }
674 node = prev;
675 }
676 while (node) {
634 test = rb_entry(node, struct btrfs_ordered_extent, rb_node); 677 test = rb_entry(node, struct btrfs_ordered_extent, rb_node);
635 if (test->file_offset + test->len <= disk_i_size) 678 if (test->file_offset + test->len <= disk_i_size)
636 break; 679 break;
637 if (test->file_offset >= inode->i_size) 680 if (test->file_offset >= i_size)
638 break; 681 break;
639 if (test->file_offset >= disk_i_size) 682 if (test->file_offset >= disk_i_size)
640 goto out; 683 goto out;
684 node = rb_prev(node);
641 } 685 }
642 new_i_size = min_t(u64, entry_end(ordered), i_size_read(inode)); 686 new_i_size = min_t(u64, offset, i_size);
643 687
644 /* 688 /*
645 * at this point, we know we can safely update i_size to at least 689 * at this point, we know we can safely update i_size to at least
@@ -647,7 +691,14 @@ int btrfs_ordered_update_i_size(struct inode *inode,
647 * walk forward and see if ios from higher up in the file have 691 * walk forward and see if ios from higher up in the file have
648 * finished. 692 * finished.
649 */ 693 */
650 node = rb_next(&ordered->rb_node); 694 if (ordered) {
695 node = rb_next(&ordered->rb_node);
696 } else {
697 if (prev)
698 node = rb_next(prev);
699 else
700 node = rb_first(&tree->tree);
701 }
651 i_size_test = 0; 702 i_size_test = 0;
652 if (node) { 703 if (node) {
653 /* 704 /*
@@ -655,10 +706,10 @@ int btrfs_ordered_update_i_size(struct inode *inode,
655 * between our ordered extent and the next one. 706 * between our ordered extent and the next one.
656 */ 707 */
657 test = rb_entry(node, struct btrfs_ordered_extent, rb_node); 708 test = rb_entry(node, struct btrfs_ordered_extent, rb_node);
658 if (test->file_offset > entry_end(ordered)) 709 if (test->file_offset > offset)
659 i_size_test = test->file_offset; 710 i_size_test = test->file_offset;
660 } else { 711 } else {
661 i_size_test = i_size_read(inode); 712 i_size_test = i_size;
662 } 713 }
663 714
664 /* 715 /*
@@ -667,15 +718,25 @@ int btrfs_ordered_update_i_size(struct inode *inode,
667 * are no delalloc bytes in this area, it is safe to update 718 * are no delalloc bytes in this area, it is safe to update
668 * disk_i_size to the end of the region. 719 * disk_i_size to the end of the region.
669 */ 720 */
670 if (i_size_test > entry_end(ordered) && 721 if (i_size_test > offset &&
671 !test_range_bit(io_tree, entry_end(ordered), i_size_test - 1, 722 !test_range_bit(io_tree, offset, i_size_test - 1,
672 EXTENT_DELALLOC, 0, NULL)) { 723 EXTENT_DELALLOC, 0, NULL)) {
673 new_i_size = min_t(u64, i_size_test, i_size_read(inode)); 724 new_i_size = min_t(u64, i_size_test, i_size);
674 } 725 }
675 BTRFS_I(inode)->disk_i_size = new_i_size; 726 BTRFS_I(inode)->disk_i_size = new_i_size;
727 ret = 0;
676out: 728out:
729 /*
730 * we need to remove the ordered extent with the tree lock held
731 * so that other people calling this function don't find our fully
732 * processed ordered entry and skip updating the i_size
733 */
734 if (ordered)
735 __btrfs_remove_ordered_extent(inode, ordered);
677 mutex_unlock(&tree->mutex); 736 mutex_unlock(&tree->mutex);
678 return 0; 737 if (ordered)
738 wake_up(&ordered->wait);
739 return ret;
679} 740}
680 741
681/* 742/*
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index f82e87488ca8..1fe1282ef47c 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -150,12 +150,13 @@ void btrfs_start_ordered_extent(struct inode *inode,
150int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len); 150int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len);
151struct btrfs_ordered_extent * 151struct btrfs_ordered_extent *
152btrfs_lookup_first_ordered_extent(struct inode * inode, u64 file_offset); 152btrfs_lookup_first_ordered_extent(struct inode * inode, u64 file_offset);
153int btrfs_ordered_update_i_size(struct inode *inode, 153int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
154 struct btrfs_ordered_extent *ordered); 154 struct btrfs_ordered_extent *ordered);
155int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, u32 *sum); 155int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr, u32 *sum);
156int btrfs_wait_ordered_extents(struct btrfs_root *root, int nocow_only);
157int btrfs_run_ordered_operations(struct btrfs_root *root, int wait); 156int btrfs_run_ordered_operations(struct btrfs_root *root, int wait);
158int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans, 157int btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
159 struct btrfs_root *root, 158 struct btrfs_root *root,
160 struct inode *inode); 159 struct inode *inode);
160int btrfs_wait_ordered_extents(struct btrfs_root *root,
161 int nocow_only, int delay_iput);
161#endif 162#endif
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index cfcc93c93a7b..a9728680eca8 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1561,6 +1561,20 @@ static int invalidate_extent_cache(struct btrfs_root *root,
1561 return 0; 1561 return 0;
1562} 1562}
1563 1563
1564static void put_inodes(struct list_head *list)
1565{
1566 struct inodevec *ivec;
1567 while (!list_empty(list)) {
1568 ivec = list_entry(list->next, struct inodevec, list);
1569 list_del(&ivec->list);
1570 while (ivec->nr > 0) {
1571 ivec->nr--;
1572 iput(ivec->inode[ivec->nr]);
1573 }
1574 kfree(ivec);
1575 }
1576}
1577
1564static int find_next_key(struct btrfs_path *path, int level, 1578static int find_next_key(struct btrfs_path *path, int level,
1565 struct btrfs_key *key) 1579 struct btrfs_key *key)
1566 1580
@@ -1723,6 +1737,11 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
1723 1737
1724 btrfs_btree_balance_dirty(root, nr); 1738 btrfs_btree_balance_dirty(root, nr);
1725 1739
1740 /*
1741 * put inodes outside transaction, otherwise we may deadlock.
1742 */
1743 put_inodes(&inode_list);
1744
1726 if (replaced && rc->stage == UPDATE_DATA_PTRS) 1745 if (replaced && rc->stage == UPDATE_DATA_PTRS)
1727 invalidate_extent_cache(root, &key, &next_key); 1746 invalidate_extent_cache(root, &key, &next_key);
1728 } 1747 }
@@ -1752,19 +1771,7 @@ out:
1752 1771
1753 btrfs_btree_balance_dirty(root, nr); 1772 btrfs_btree_balance_dirty(root, nr);
1754 1773
1755 /* 1774 put_inodes(&inode_list);
1756 * put inodes while we aren't holding the tree locks
1757 */
1758 while (!list_empty(&inode_list)) {
1759 struct inodevec *ivec;
1760 ivec = list_entry(inode_list.next, struct inodevec, list);
1761 list_del(&ivec->list);
1762 while (ivec->nr > 0) {
1763 ivec->nr--;
1764 iput(ivec->inode[ivec->nr]);
1765 }
1766 kfree(ivec);
1767 }
1768 1775
1769 if (replaced && rc->stage == UPDATE_DATA_PTRS) 1776 if (replaced && rc->stage == UPDATE_DATA_PTRS)
1770 invalidate_extent_cache(root, &key, &next_key); 1777 invalidate_extent_cache(root, &key, &next_key);
@@ -3534,8 +3541,8 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
3534 (unsigned long long)rc->block_group->key.objectid, 3541 (unsigned long long)rc->block_group->key.objectid,
3535 (unsigned long long)rc->block_group->flags); 3542 (unsigned long long)rc->block_group->flags);
3536 3543
3537 btrfs_start_delalloc_inodes(fs_info->tree_root); 3544 btrfs_start_delalloc_inodes(fs_info->tree_root, 0);
3538 btrfs_wait_ordered_extents(fs_info->tree_root, 0); 3545 btrfs_wait_ordered_extents(fs_info->tree_root, 0, 0);
3539 3546
3540 while (1) { 3547 while (1) {
3541 rc->extents_found = 0; 3548 rc->extents_found = 0;
@@ -3755,6 +3762,7 @@ out:
3755 BTRFS_DATA_RELOC_TREE_OBJECTID); 3762 BTRFS_DATA_RELOC_TREE_OBJECTID);
3756 if (IS_ERR(fs_root)) 3763 if (IS_ERR(fs_root))
3757 err = PTR_ERR(fs_root); 3764 err = PTR_ERR(fs_root);
3765 btrfs_orphan_cleanup(fs_root);
3758 } 3766 }
3759 return err; 3767 return err;
3760} 3768}
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 752a5463bf53..3f9b45704fcd 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -128,6 +128,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
128 substring_t args[MAX_OPT_ARGS]; 128 substring_t args[MAX_OPT_ARGS];
129 char *p, *num; 129 char *p, *num;
130 int intarg; 130 int intarg;
131 int ret = 0;
131 132
132 if (!options) 133 if (!options)
133 return 0; 134 return 0;
@@ -262,12 +263,18 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
262 case Opt_discard: 263 case Opt_discard:
263 btrfs_set_opt(info->mount_opt, DISCARD); 264 btrfs_set_opt(info->mount_opt, DISCARD);
264 break; 265 break;
266 case Opt_err:
267 printk(KERN_INFO "btrfs: unrecognized mount option "
268 "'%s'\n", p);
269 ret = -EINVAL;
270 goto out;
265 default: 271 default:
266 break; 272 break;
267 } 273 }
268 } 274 }
275out:
269 kfree(options); 276 kfree(options);
270 return 0; 277 return ret;
271} 278}
272 279
273/* 280/*
@@ -405,8 +412,8 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
405 return 0; 412 return 0;
406 } 413 }
407 414
408 btrfs_start_delalloc_inodes(root); 415 btrfs_start_delalloc_inodes(root, 0);
409 btrfs_wait_ordered_extents(root, 0); 416 btrfs_wait_ordered_extents(root, 0, 0);
410 417
411 trans = btrfs_start_transaction(root, 1); 418 trans = btrfs_start_transaction(root, 1);
412 ret = btrfs_commit_transaction(trans, root); 419 ret = btrfs_commit_transaction(trans, root);
@@ -450,6 +457,8 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
450 seq_puts(seq, ",notreelog"); 457 seq_puts(seq, ",notreelog");
451 if (btrfs_test_opt(root, FLUSHONCOMMIT)) 458 if (btrfs_test_opt(root, FLUSHONCOMMIT))
452 seq_puts(seq, ",flushoncommit"); 459 seq_puts(seq, ",flushoncommit");
460 if (btrfs_test_opt(root, DISCARD))
461 seq_puts(seq, ",discard");
453 if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) 462 if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
454 seq_puts(seq, ",noacl"); 463 seq_puts(seq, ",noacl");
455 return 0; 464 return 0;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index c207e8c32c9b..b2acc79f1b34 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -333,6 +333,9 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
333 memset(trans, 0, sizeof(*trans)); 333 memset(trans, 0, sizeof(*trans));
334 kmem_cache_free(btrfs_trans_handle_cachep, trans); 334 kmem_cache_free(btrfs_trans_handle_cachep, trans);
335 335
336 if (throttle)
337 btrfs_run_delayed_iputs(root);
338
336 return 0; 339 return 0;
337} 340}
338 341
@@ -354,7 +357,7 @@ int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans,
354 * those extents are sent to disk but does not wait on them 357 * those extents are sent to disk but does not wait on them
355 */ 358 */
356int btrfs_write_marked_extents(struct btrfs_root *root, 359int btrfs_write_marked_extents(struct btrfs_root *root,
357 struct extent_io_tree *dirty_pages) 360 struct extent_io_tree *dirty_pages, int mark)
358{ 361{
359 int ret; 362 int ret;
360 int err = 0; 363 int err = 0;
@@ -367,7 +370,7 @@ int btrfs_write_marked_extents(struct btrfs_root *root,
367 370
368 while (1) { 371 while (1) {
369 ret = find_first_extent_bit(dirty_pages, start, &start, &end, 372 ret = find_first_extent_bit(dirty_pages, start, &start, &end,
370 EXTENT_DIRTY); 373 mark);
371 if (ret) 374 if (ret)
372 break; 375 break;
373 while (start <= end) { 376 while (start <= end) {
@@ -413,7 +416,7 @@ int btrfs_write_marked_extents(struct btrfs_root *root,
413 * on all the pages and clear them from the dirty pages state tree 416 * on all the pages and clear them from the dirty pages state tree
414 */ 417 */
415int btrfs_wait_marked_extents(struct btrfs_root *root, 418int btrfs_wait_marked_extents(struct btrfs_root *root,
416 struct extent_io_tree *dirty_pages) 419 struct extent_io_tree *dirty_pages, int mark)
417{ 420{
418 int ret; 421 int ret;
419 int err = 0; 422 int err = 0;
@@ -425,12 +428,12 @@ int btrfs_wait_marked_extents(struct btrfs_root *root,
425 unsigned long index; 428 unsigned long index;
426 429
427 while (1) { 430 while (1) {
428 ret = find_first_extent_bit(dirty_pages, 0, &start, &end, 431 ret = find_first_extent_bit(dirty_pages, start, &start, &end,
429 EXTENT_DIRTY); 432 mark);
430 if (ret) 433 if (ret)
431 break; 434 break;
432 435
433 clear_extent_dirty(dirty_pages, start, end, GFP_NOFS); 436 clear_extent_bits(dirty_pages, start, end, mark, GFP_NOFS);
434 while (start <= end) { 437 while (start <= end) {
435 index = start >> PAGE_CACHE_SHIFT; 438 index = start >> PAGE_CACHE_SHIFT;
436 start = (u64)(index + 1) << PAGE_CACHE_SHIFT; 439 start = (u64)(index + 1) << PAGE_CACHE_SHIFT;
@@ -460,13 +463,13 @@ int btrfs_wait_marked_extents(struct btrfs_root *root,
460 * those extents are on disk for transaction or log commit 463 * those extents are on disk for transaction or log commit
461 */ 464 */
462int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, 465int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
463 struct extent_io_tree *dirty_pages) 466 struct extent_io_tree *dirty_pages, int mark)
464{ 467{
465 int ret; 468 int ret;
466 int ret2; 469 int ret2;
467 470
468 ret = btrfs_write_marked_extents(root, dirty_pages); 471 ret = btrfs_write_marked_extents(root, dirty_pages, mark);
469 ret2 = btrfs_wait_marked_extents(root, dirty_pages); 472 ret2 = btrfs_wait_marked_extents(root, dirty_pages, mark);
470 return ret || ret2; 473 return ret || ret2;
471} 474}
472 475
@@ -479,7 +482,8 @@ int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
479 return filemap_write_and_wait(btree_inode->i_mapping); 482 return filemap_write_and_wait(btree_inode->i_mapping);
480 } 483 }
481 return btrfs_write_and_wait_marked_extents(root, 484 return btrfs_write_and_wait_marked_extents(root,
482 &trans->transaction->dirty_pages); 485 &trans->transaction->dirty_pages,
486 EXTENT_DIRTY);
483} 487}
484 488
485/* 489/*
@@ -497,13 +501,16 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
497{ 501{
498 int ret; 502 int ret;
499 u64 old_root_bytenr; 503 u64 old_root_bytenr;
504 u64 old_root_used;
500 struct btrfs_root *tree_root = root->fs_info->tree_root; 505 struct btrfs_root *tree_root = root->fs_info->tree_root;
501 506
507 old_root_used = btrfs_root_used(&root->root_item);
502 btrfs_write_dirty_block_groups(trans, root); 508 btrfs_write_dirty_block_groups(trans, root);
503 509
504 while (1) { 510 while (1) {
505 old_root_bytenr = btrfs_root_bytenr(&root->root_item); 511 old_root_bytenr = btrfs_root_bytenr(&root->root_item);
506 if (old_root_bytenr == root->node->start) 512 if (old_root_bytenr == root->node->start &&
513 old_root_used == btrfs_root_used(&root->root_item))
507 break; 514 break;
508 515
509 btrfs_set_root_node(&root->root_item, root->node); 516 btrfs_set_root_node(&root->root_item, root->node);
@@ -512,6 +519,7 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
512 &root->root_item); 519 &root->root_item);
513 BUG_ON(ret); 520 BUG_ON(ret);
514 521
522 old_root_used = btrfs_root_used(&root->root_item);
515 ret = btrfs_write_dirty_block_groups(trans, root); 523 ret = btrfs_write_dirty_block_groups(trans, root);
516 BUG_ON(ret); 524 BUG_ON(ret);
517 } 525 }
@@ -795,7 +803,6 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
795 memcpy(&pending->root_key, &key, sizeof(key)); 803 memcpy(&pending->root_key, &key, sizeof(key));
796fail: 804fail:
797 kfree(new_root_item); 805 kfree(new_root_item);
798 btrfs_unreserve_metadata_space(root, 6);
799 return ret; 806 return ret;
800} 807}
801 808
@@ -807,7 +814,6 @@ static noinline int finish_pending_snapshot(struct btrfs_fs_info *fs_info,
807 u64 index = 0; 814 u64 index = 0;
808 struct btrfs_trans_handle *trans; 815 struct btrfs_trans_handle *trans;
809 struct inode *parent_inode; 816 struct inode *parent_inode;
810 struct inode *inode;
811 struct btrfs_root *parent_root; 817 struct btrfs_root *parent_root;
812 818
813 parent_inode = pending->dentry->d_parent->d_inode; 819 parent_inode = pending->dentry->d_parent->d_inode;
@@ -839,8 +845,6 @@ static noinline int finish_pending_snapshot(struct btrfs_fs_info *fs_info,
839 845
840 BUG_ON(ret); 846 BUG_ON(ret);
841 847
842 inode = btrfs_lookup_dentry(parent_inode, pending->dentry);
843 d_instantiate(pending->dentry, inode);
844fail: 848fail:
845 btrfs_end_transaction(trans, fs_info->fs_root); 849 btrfs_end_transaction(trans, fs_info->fs_root);
846 return ret; 850 return ret;
@@ -994,11 +998,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
994 mutex_unlock(&root->fs_info->trans_mutex); 998 mutex_unlock(&root->fs_info->trans_mutex);
995 999
996 if (flush_on_commit) { 1000 if (flush_on_commit) {
997 btrfs_start_delalloc_inodes(root); 1001 btrfs_start_delalloc_inodes(root, 1);
998 ret = btrfs_wait_ordered_extents(root, 0); 1002 ret = btrfs_wait_ordered_extents(root, 0, 1);
999 BUG_ON(ret); 1003 BUG_ON(ret);
1000 } else if (snap_pending) { 1004 } else if (snap_pending) {
1001 ret = btrfs_wait_ordered_extents(root, 1); 1005 ret = btrfs_wait_ordered_extents(root, 0, 1);
1002 BUG_ON(ret); 1006 BUG_ON(ret);
1003 } 1007 }
1004 1008
@@ -1116,6 +1120,10 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1116 current->journal_info = NULL; 1120 current->journal_info = NULL;
1117 1121
1118 kmem_cache_free(btrfs_trans_handle_cachep, trans); 1122 kmem_cache_free(btrfs_trans_handle_cachep, trans);
1123
1124 if (current != root->fs_info->transaction_kthread)
1125 btrfs_run_delayed_iputs(root);
1126
1119 return ret; 1127 return ret;
1120} 1128}
1121 1129
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index d4e3e7a6938c..93c7ccb33118 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -107,10 +107,10 @@ void btrfs_throttle(struct btrfs_root *root);
107int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans, 107int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans,
108 struct btrfs_root *root); 108 struct btrfs_root *root);
109int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, 109int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
110 struct extent_io_tree *dirty_pages); 110 struct extent_io_tree *dirty_pages, int mark);
111int btrfs_write_marked_extents(struct btrfs_root *root, 111int btrfs_write_marked_extents(struct btrfs_root *root,
112 struct extent_io_tree *dirty_pages); 112 struct extent_io_tree *dirty_pages, int mark);
113int btrfs_wait_marked_extents(struct btrfs_root *root, 113int btrfs_wait_marked_extents(struct btrfs_root *root,
114 struct extent_io_tree *dirty_pages); 114 struct extent_io_tree *dirty_pages, int mark);
115int btrfs_transaction_in_commit(struct btrfs_fs_info *info); 115int btrfs_transaction_in_commit(struct btrfs_fs_info *info);
116#endif 116#endif
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 741666a7676a..4a9434b622ec 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -542,8 +542,8 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
542 542
543 saved_nbytes = inode_get_bytes(inode); 543 saved_nbytes = inode_get_bytes(inode);
544 /* drop any overlapping extents */ 544 /* drop any overlapping extents */
545 ret = btrfs_drop_extents(trans, root, inode, 545 ret = btrfs_drop_extents(trans, inode, start, extent_end,
546 start, extent_end, extent_end, start, &alloc_hint, 1); 546 &alloc_hint, 1);
547 BUG_ON(ret); 547 BUG_ON(ret);
548 548
549 if (found_type == BTRFS_FILE_EXTENT_REG || 549 if (found_type == BTRFS_FILE_EXTENT_REG ||
@@ -930,6 +930,17 @@ out_nowrite:
930 return 0; 930 return 0;
931} 931}
932 932
933static int insert_orphan_item(struct btrfs_trans_handle *trans,
934 struct btrfs_root *root, u64 offset)
935{
936 int ret;
937 ret = btrfs_find_orphan_item(root, offset);
938 if (ret > 0)
939 ret = btrfs_insert_orphan_item(trans, root, offset);
940 return ret;
941}
942
943
933/* 944/*
934 * There are a few corners where the link count of the file can't 945 * There are a few corners where the link count of the file can't
935 * be properly maintained during replay. So, instead of adding 946 * be properly maintained during replay. So, instead of adding
@@ -997,9 +1008,13 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
997 } 1008 }
998 BTRFS_I(inode)->index_cnt = (u64)-1; 1009 BTRFS_I(inode)->index_cnt = (u64)-1;
999 1010
1000 if (inode->i_nlink == 0 && S_ISDIR(inode->i_mode)) { 1011 if (inode->i_nlink == 0) {
1001 ret = replay_dir_deletes(trans, root, NULL, path, 1012 if (S_ISDIR(inode->i_mode)) {
1002 inode->i_ino, 1); 1013 ret = replay_dir_deletes(trans, root, NULL, path,
1014 inode->i_ino, 1);
1015 BUG_ON(ret);
1016 }
1017 ret = insert_orphan_item(trans, root, inode->i_ino);
1003 BUG_ON(ret); 1018 BUG_ON(ret);
1004 } 1019 }
1005 btrfs_free_path(path); 1020 btrfs_free_path(path);
@@ -1587,7 +1602,6 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
1587 /* inode keys are done during the first stage */ 1602 /* inode keys are done during the first stage */
1588 if (key.type == BTRFS_INODE_ITEM_KEY && 1603 if (key.type == BTRFS_INODE_ITEM_KEY &&
1589 wc->stage == LOG_WALK_REPLAY_INODES) { 1604 wc->stage == LOG_WALK_REPLAY_INODES) {
1590 struct inode *inode;
1591 struct btrfs_inode_item *inode_item; 1605 struct btrfs_inode_item *inode_item;
1592 u32 mode; 1606 u32 mode;
1593 1607
@@ -1603,31 +1617,16 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
1603 eb, i, &key); 1617 eb, i, &key);
1604 BUG_ON(ret); 1618 BUG_ON(ret);
1605 1619
1606 /* for regular files, truncate away 1620 /* for regular files, make sure corresponding
1607 * extents past the new EOF 1621 * orhpan item exist. extents past the new EOF
1622 * will be truncated later by orphan cleanup.
1608 */ 1623 */
1609 if (S_ISREG(mode)) { 1624 if (S_ISREG(mode)) {
1610 inode = read_one_inode(root, 1625 ret = insert_orphan_item(wc->trans, root,
1611 key.objectid); 1626 key.objectid);
1612 BUG_ON(!inode);
1613
1614 ret = btrfs_truncate_inode_items(wc->trans,
1615 root, inode, inode->i_size,
1616 BTRFS_EXTENT_DATA_KEY);
1617 BUG_ON(ret); 1627 BUG_ON(ret);
1618
1619 /* if the nlink count is zero here, the iput
1620 * will free the inode. We bump it to make
1621 * sure it doesn't get freed until the link
1622 * count fixup is done
1623 */
1624 if (inode->i_nlink == 0) {
1625 btrfs_inc_nlink(inode);
1626 btrfs_update_inode(wc->trans,
1627 root, inode);
1628 }
1629 iput(inode);
1630 } 1628 }
1629
1631 ret = link_to_fixup_dir(wc->trans, root, 1630 ret = link_to_fixup_dir(wc->trans, root,
1632 path, key.objectid); 1631 path, key.objectid);
1633 BUG_ON(ret); 1632 BUG_ON(ret);
@@ -1977,10 +1976,11 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
1977{ 1976{
1978 int index1; 1977 int index1;
1979 int index2; 1978 int index2;
1979 int mark;
1980 int ret; 1980 int ret;
1981 struct btrfs_root *log = root->log_root; 1981 struct btrfs_root *log = root->log_root;
1982 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; 1982 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
1983 u64 log_transid = 0; 1983 unsigned long log_transid = 0;
1984 1984
1985 mutex_lock(&root->log_mutex); 1985 mutex_lock(&root->log_mutex);
1986 index1 = root->log_transid % 2; 1986 index1 = root->log_transid % 2;
@@ -2014,24 +2014,29 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2014 goto out; 2014 goto out;
2015 } 2015 }
2016 2016
2017 log_transid = root->log_transid;
2018 if (log_transid % 2 == 0)
2019 mark = EXTENT_DIRTY;
2020 else
2021 mark = EXTENT_NEW;
2022
2017 /* we start IO on all the marked extents here, but we don't actually 2023 /* we start IO on all the marked extents here, but we don't actually
2018 * wait for them until later. 2024 * wait for them until later.
2019 */ 2025 */
2020 ret = btrfs_write_marked_extents(log, &log->dirty_log_pages); 2026 ret = btrfs_write_marked_extents(log, &log->dirty_log_pages, mark);
2021 BUG_ON(ret); 2027 BUG_ON(ret);
2022 2028
2023 btrfs_set_root_node(&log->root_item, log->node); 2029 btrfs_set_root_node(&log->root_item, log->node);
2024 2030
2025 root->log_batch = 0; 2031 root->log_batch = 0;
2026 log_transid = root->log_transid;
2027 root->log_transid++; 2032 root->log_transid++;
2028 log->log_transid = root->log_transid; 2033 log->log_transid = root->log_transid;
2029 root->log_start_pid = 0; 2034 root->log_start_pid = 0;
2030 smp_mb(); 2035 smp_mb();
2031 /* 2036 /*
2032 * log tree has been flushed to disk, new modifications of 2037 * IO has been started, blocks of the log tree have WRITTEN flag set
2033 * the log will be written to new positions. so it's safe to 2038 * in their headers. new modifications of the log will be written to
2034 * allow log writers to go in. 2039 * new positions. so it's safe to allow log writers to go in.
2035 */ 2040 */
2036 mutex_unlock(&root->log_mutex); 2041 mutex_unlock(&root->log_mutex);
2037 2042
@@ -2052,7 +2057,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2052 2057
2053 index2 = log_root_tree->log_transid % 2; 2058 index2 = log_root_tree->log_transid % 2;
2054 if (atomic_read(&log_root_tree->log_commit[index2])) { 2059 if (atomic_read(&log_root_tree->log_commit[index2])) {
2055 btrfs_wait_marked_extents(log, &log->dirty_log_pages); 2060 btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark);
2056 wait_log_commit(trans, log_root_tree, 2061 wait_log_commit(trans, log_root_tree,
2057 log_root_tree->log_transid); 2062 log_root_tree->log_transid);
2058 mutex_unlock(&log_root_tree->log_mutex); 2063 mutex_unlock(&log_root_tree->log_mutex);
@@ -2072,16 +2077,17 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2072 * check the full commit flag again 2077 * check the full commit flag again
2073 */ 2078 */
2074 if (root->fs_info->last_trans_log_full_commit == trans->transid) { 2079 if (root->fs_info->last_trans_log_full_commit == trans->transid) {
2075 btrfs_wait_marked_extents(log, &log->dirty_log_pages); 2080 btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark);
2076 mutex_unlock(&log_root_tree->log_mutex); 2081 mutex_unlock(&log_root_tree->log_mutex);
2077 ret = -EAGAIN; 2082 ret = -EAGAIN;
2078 goto out_wake_log_root; 2083 goto out_wake_log_root;
2079 } 2084 }
2080 2085
2081 ret = btrfs_write_and_wait_marked_extents(log_root_tree, 2086 ret = btrfs_write_and_wait_marked_extents(log_root_tree,
2082 &log_root_tree->dirty_log_pages); 2087 &log_root_tree->dirty_log_pages,
2088 EXTENT_DIRTY | EXTENT_NEW);
2083 BUG_ON(ret); 2089 BUG_ON(ret);
2084 btrfs_wait_marked_extents(log, &log->dirty_log_pages); 2090 btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark);
2085 2091
2086 btrfs_set_super_log_root(&root->fs_info->super_for_commit, 2092 btrfs_set_super_log_root(&root->fs_info->super_for_commit,
2087 log_root_tree->node->start); 2093 log_root_tree->node->start);
@@ -2147,12 +2153,12 @@ int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root)
2147 2153
2148 while (1) { 2154 while (1) {
2149 ret = find_first_extent_bit(&log->dirty_log_pages, 2155 ret = find_first_extent_bit(&log->dirty_log_pages,
2150 0, &start, &end, EXTENT_DIRTY); 2156 0, &start, &end, EXTENT_DIRTY | EXTENT_NEW);
2151 if (ret) 2157 if (ret)
2152 break; 2158 break;
2153 2159
2154 clear_extent_dirty(&log->dirty_log_pages, 2160 clear_extent_bits(&log->dirty_log_pages, start, end,
2155 start, end, GFP_NOFS); 2161 EXTENT_DIRTY | EXTENT_NEW, GFP_NOFS);
2156 } 2162 }
2157 2163
2158 if (log->log_transid > 0) { 2164 if (log->log_transid > 0) {
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7eda483d7b5a..198cff28766d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2209,7 +2209,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
2209 max_chunk_size = 10 * calc_size; 2209 max_chunk_size = 10 * calc_size;
2210 min_stripe_size = 64 * 1024 * 1024; 2210 min_stripe_size = 64 * 1024 * 1024;
2211 } else if (type & BTRFS_BLOCK_GROUP_METADATA) { 2211 } else if (type & BTRFS_BLOCK_GROUP_METADATA) {
2212 max_chunk_size = 4 * calc_size; 2212 max_chunk_size = 256 * 1024 * 1024;
2213 min_stripe_size = 32 * 1024 * 1024; 2213 min_stripe_size = 32 * 1024 * 1024;
2214 } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) { 2214 } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
2215 calc_size = 8 * 1024 * 1024; 2215 calc_size = 8 * 1024 * 1024;
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index b6dd5967c48a..193b58f7d3f3 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -85,22 +85,23 @@ out:
85 return ret; 85 return ret;
86} 86}
87 87
88int __btrfs_setxattr(struct inode *inode, const char *name, 88static int do_setxattr(struct btrfs_trans_handle *trans,
89 const void *value, size_t size, int flags) 89 struct inode *inode, const char *name,
90 const void *value, size_t size, int flags)
90{ 91{
91 struct btrfs_dir_item *di; 92 struct btrfs_dir_item *di;
92 struct btrfs_root *root = BTRFS_I(inode)->root; 93 struct btrfs_root *root = BTRFS_I(inode)->root;
93 struct btrfs_trans_handle *trans;
94 struct btrfs_path *path; 94 struct btrfs_path *path;
95 int ret = 0, mod = 0; 95 size_t name_len = strlen(name);
96 int ret = 0;
97
98 if (name_len + size > BTRFS_MAX_XATTR_SIZE(root))
99 return -ENOSPC;
96 100
97 path = btrfs_alloc_path(); 101 path = btrfs_alloc_path();
98 if (!path) 102 if (!path)
99 return -ENOMEM; 103 return -ENOMEM;
100 104
101 trans = btrfs_join_transaction(root, 1);
102 btrfs_set_trans_block_group(trans, inode);
103
104 /* first lets see if we already have this xattr */ 105 /* first lets see if we already have this xattr */
105 di = btrfs_lookup_xattr(trans, root, path, inode->i_ino, name, 106 di = btrfs_lookup_xattr(trans, root, path, inode->i_ino, name,
106 strlen(name), -1); 107 strlen(name), -1);
@@ -118,15 +119,12 @@ int __btrfs_setxattr(struct inode *inode, const char *name,
118 } 119 }
119 120
120 ret = btrfs_delete_one_dir_name(trans, root, path, di); 121 ret = btrfs_delete_one_dir_name(trans, root, path, di);
121 if (ret) 122 BUG_ON(ret);
122 goto out;
123 btrfs_release_path(root, path); 123 btrfs_release_path(root, path);
124 124
125 /* if we don't have a value then we are removing the xattr */ 125 /* if we don't have a value then we are removing the xattr */
126 if (!value) { 126 if (!value)
127 mod = 1;
128 goto out; 127 goto out;
129 }
130 } else { 128 } else {
131 btrfs_release_path(root, path); 129 btrfs_release_path(root, path);
132 130
@@ -138,20 +136,45 @@ int __btrfs_setxattr(struct inode *inode, const char *name,
138 } 136 }
139 137
140 /* ok we have to create a completely new xattr */ 138 /* ok we have to create a completely new xattr */
141 ret = btrfs_insert_xattr_item(trans, root, name, strlen(name), 139 ret = btrfs_insert_xattr_item(trans, root, path, inode->i_ino,
142 value, size, inode->i_ino); 140 name, name_len, value, size);
141 BUG_ON(ret);
142out:
143 btrfs_free_path(path);
144 return ret;
145}
146
147int __btrfs_setxattr(struct btrfs_trans_handle *trans,
148 struct inode *inode, const char *name,
149 const void *value, size_t size, int flags)
150{
151 struct btrfs_root *root = BTRFS_I(inode)->root;
152 int ret;
153
154 if (trans)
155 return do_setxattr(trans, inode, name, value, size, flags);
156
157 ret = btrfs_reserve_metadata_space(root, 2);
143 if (ret) 158 if (ret)
144 goto out; 159 return ret;
145 mod = 1;
146 160
147out: 161 trans = btrfs_start_transaction(root, 1);
148 if (mod) { 162 if (!trans) {
149 inode->i_ctime = CURRENT_TIME; 163 ret = -ENOMEM;
150 ret = btrfs_update_inode(trans, root, inode); 164 goto out;
151 } 165 }
166 btrfs_set_trans_block_group(trans, inode);
152 167
153 btrfs_end_transaction(trans, root); 168 ret = do_setxattr(trans, inode, name, value, size, flags);
154 btrfs_free_path(path); 169 if (ret)
170 goto out;
171
172 inode->i_ctime = CURRENT_TIME;
173 ret = btrfs_update_inode(trans, root, inode);
174 BUG_ON(ret);
175out:
176 btrfs_end_transaction_throttle(trans, root);
177 btrfs_unreserve_metadata_space(root, 2);
155 return ret; 178 return ret;
156} 179}
157 180
@@ -314,7 +337,9 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
314 337
315 if (size == 0) 338 if (size == 0)
316 value = ""; /* empty EA, do not remove */ 339 value = ""; /* empty EA, do not remove */
317 return __btrfs_setxattr(dentry->d_inode, name, value, size, flags); 340
341 return __btrfs_setxattr(NULL, dentry->d_inode, name, value, size,
342 flags);
318} 343}
319 344
320int btrfs_removexattr(struct dentry *dentry, const char *name) 345int btrfs_removexattr(struct dentry *dentry, const char *name)
@@ -329,10 +354,13 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
329 354
330 if (!btrfs_is_valid_xattr(name)) 355 if (!btrfs_is_valid_xattr(name))
331 return -EOPNOTSUPP; 356 return -EOPNOTSUPP;
332 return __btrfs_setxattr(dentry->d_inode, name, NULL, 0, XATTR_REPLACE); 357
358 return __btrfs_setxattr(NULL, dentry->d_inode, name, NULL, 0,
359 XATTR_REPLACE);
333} 360}
334 361
335int btrfs_xattr_security_init(struct inode *inode, struct inode *dir) 362int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
363 struct inode *inode, struct inode *dir)
336{ 364{
337 int err; 365 int err;
338 size_t len; 366 size_t len;
@@ -354,7 +382,7 @@ int btrfs_xattr_security_init(struct inode *inode, struct inode *dir)
354 } else { 382 } else {
355 strcpy(name, XATTR_SECURITY_PREFIX); 383 strcpy(name, XATTR_SECURITY_PREFIX);
356 strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix); 384 strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix);
357 err = __btrfs_setxattr(inode, name, value, len, 0); 385 err = __btrfs_setxattr(trans, inode, name, value, len, 0);
358 kfree(name); 386 kfree(name);
359 } 387 }
360 388
diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h
index c71e9c3cf3f7..721efa0346e0 100644
--- a/fs/btrfs/xattr.h
+++ b/fs/btrfs/xattr.h
@@ -27,15 +27,16 @@ extern struct xattr_handler *btrfs_xattr_handlers[];
27 27
28extern ssize_t __btrfs_getxattr(struct inode *inode, const char *name, 28extern ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
29 void *buffer, size_t size); 29 void *buffer, size_t size);
30extern int __btrfs_setxattr(struct inode *inode, const char *name, 30extern int __btrfs_setxattr(struct btrfs_trans_handle *trans,
31 const void *value, size_t size, int flags); 31 struct inode *inode, const char *name,
32 32 const void *value, size_t size, int flags);
33extern ssize_t btrfs_getxattr(struct dentry *dentry, const char *name, 33extern ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,
34 void *buffer, size_t size); 34 void *buffer, size_t size);
35extern int btrfs_setxattr(struct dentry *dentry, const char *name, 35extern int btrfs_setxattr(struct dentry *dentry, const char *name,
36 const void *value, size_t size, int flags); 36 const void *value, size_t size, int flags);
37extern int btrfs_removexattr(struct dentry *dentry, const char *name); 37extern int btrfs_removexattr(struct dentry *dentry, const char *name);
38 38
39extern int btrfs_xattr_security_init(struct inode *inode, struct inode *dir); 39extern int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
40 struct inode *inode, struct inode *dir);
40 41
41#endif /* __XATTR__ */ 42#endif /* __XATTR__ */
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 094ea65afc85..7b2600b380d7 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -5,7 +5,9 @@ have duplicated data). Fix oops in cifs_lookup. Workaround problem
5mounting to OS/400 Netserve. Fix oops in cifs_get_tcp_session. 5mounting to OS/400 Netserve. Fix oops in cifs_get_tcp_session.
6Disable use of server inode numbers when server only 6Disable use of server inode numbers when server only
7partially supports them (e.g. for one server querying inode numbers on 7partially supports them (e.g. for one server querying inode numbers on
8FindFirst fails but QPathInfo queries works). 8FindFirst fails but QPathInfo queries works). Fix oops with dfs in
9cifs_put_smb_ses. Fix mmap to work on directio mounts (needed
10for OpenOffice when on forcedirectio mount e.g.)
9 11
10Version 1.60 12Version 1.60
11------------- 13-------------
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 29f1da761bbf..8c6a03627176 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -758,7 +758,7 @@ const struct file_operations cifs_file_ops = {
758}; 758};
759 759
760const struct file_operations cifs_file_direct_ops = { 760const struct file_operations cifs_file_direct_ops = {
761 /* no mmap, no aio, no readv - 761 /* no aio, no readv -
762 BB reevaluate whether they can be done with directio, no cache */ 762 BB reevaluate whether they can be done with directio, no cache */
763 .read = cifs_user_read, 763 .read = cifs_user_read,
764 .write = cifs_user_write, 764 .write = cifs_user_write,
@@ -767,6 +767,7 @@ const struct file_operations cifs_file_direct_ops = {
767 .lock = cifs_lock, 767 .lock = cifs_lock,
768 .fsync = cifs_fsync, 768 .fsync = cifs_fsync,
769 .flush = cifs_flush, 769 .flush = cifs_flush,
770 .mmap = cifs_file_mmap,
770 .splice_read = generic_file_splice_read, 771 .splice_read = generic_file_splice_read,
771#ifdef CONFIG_CIFS_POSIX 772#ifdef CONFIG_CIFS_POSIX
772 .unlocked_ioctl = cifs_ioctl, 773 .unlocked_ioctl = cifs_ioctl,
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 63ea83ff687f..3bbcaa716b3c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2287,12 +2287,12 @@ int
2287cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, 2287cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2288 char *mount_data_global, const char *devname) 2288 char *mount_data_global, const char *devname)
2289{ 2289{
2290 int rc = 0; 2290 int rc;
2291 int xid; 2291 int xid;
2292 struct smb_vol *volume_info; 2292 struct smb_vol *volume_info;
2293 struct cifsSesInfo *pSesInfo = NULL; 2293 struct cifsSesInfo *pSesInfo;
2294 struct cifsTconInfo *tcon = NULL; 2294 struct cifsTconInfo *tcon;
2295 struct TCP_Server_Info *srvTcp = NULL; 2295 struct TCP_Server_Info *srvTcp;
2296 char *full_path; 2296 char *full_path;
2297 char *mount_data = mount_data_global; 2297 char *mount_data = mount_data_global;
2298#ifdef CONFIG_CIFS_DFS_UPCALL 2298#ifdef CONFIG_CIFS_DFS_UPCALL
@@ -2301,6 +2301,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2301 int referral_walks_count = 0; 2301 int referral_walks_count = 0;
2302try_mount_again: 2302try_mount_again:
2303#endif 2303#endif
2304 rc = 0;
2305 tcon = NULL;
2306 pSesInfo = NULL;
2307 srvTcp = NULL;
2304 full_path = NULL; 2308 full_path = NULL;
2305 2309
2306 xid = GetXid(); 2310 xid = GetXid();
@@ -2597,6 +2601,7 @@ remote_path_check:
2597 2601
2598 cleanup_volume_info(&volume_info); 2602 cleanup_volume_info(&volume_info);
2599 referral_walks_count++; 2603 referral_walks_count++;
2604 FreeXid(xid);
2600 goto try_mount_again; 2605 goto try_mount_again;
2601 } 2606 }
2602#else /* No DFS support, return error on mount */ 2607#else /* No DFS support, return error on mount */
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 14cbc831422a..332dd00f0894 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1600,8 +1600,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd,
1600 case KDSKBMETA: 1600 case KDSKBMETA:
1601 case KDSKBLED: 1601 case KDSKBLED:
1602 case KDSETLED: 1602 case KDSETLED:
1603 /* SG stuff */
1604 case SG_SET_TRANSFORM:
1605 /* AUTOFS */ 1603 /* AUTOFS */
1606 case AUTOFS_IOC_READY: 1604 case AUTOFS_IOC_READY:
1607 case AUTOFS_IOC_FAIL: 1605 case AUTOFS_IOC_FAIL:
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 4012885d027f..e82adc2debb7 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1206,7 +1206,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1206 * NOTE: filesystems with their own locking have to handle this 1206 * NOTE: filesystems with their own locking have to handle this
1207 * on their own. 1207 * on their own.
1208 */ 1208 */
1209 if (dio->flags & DIO_LOCKING) { 1209 if (flags & DIO_LOCKING) {
1210 if (unlikely((rw & WRITE) && retval < 0)) { 1210 if (unlikely((rw & WRITE) && retval < 0)) {
1211 loff_t isize = i_size_read(inode); 1211 loff_t isize = i_size_read(inode);
1212 if (end > isize) 1212 if (end > isize)
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 2dda5ade75bc..8f006a0d6076 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -62,7 +62,7 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
62 struct inode *lower_inode = 62 struct inode *lower_inode =
63 ecryptfs_inode_to_lower(dentry->d_inode); 63 ecryptfs_inode_to_lower(dentry->d_inode);
64 64
65 fsstack_copy_attr_all(dentry->d_inode, lower_inode, NULL); 65 fsstack_copy_attr_all(dentry->d_inode, lower_inode);
66 } 66 }
67out: 67out:
68 return rc; 68 return rc;
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 056fed62d0de..429ca0b3ba08 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -626,9 +626,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
626 lower_new_dir_dentry->d_inode, lower_new_dentry); 626 lower_new_dir_dentry->d_inode, lower_new_dentry);
627 if (rc) 627 if (rc)
628 goto out_lock; 628 goto out_lock;
629 fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode, NULL); 629 fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
630 if (new_dir != old_dir) 630 if (new_dir != old_dir)
631 fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode, NULL); 631 fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode);
632out_lock: 632out_lock:
633 unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); 633 unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
634 dput(lower_new_dentry->d_parent); 634 dput(lower_new_dentry->d_parent);
@@ -967,7 +967,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
967 rc = notify_change(lower_dentry, ia); 967 rc = notify_change(lower_dentry, ia);
968 mutex_unlock(&lower_dentry->d_inode->i_mutex); 968 mutex_unlock(&lower_dentry->d_inode->i_mutex);
969out: 969out:
970 fsstack_copy_attr_all(inode, lower_inode, NULL); 970 fsstack_copy_attr_all(inode, lower_inode);
971 return rc; 971 return rc;
972} 972}
973 973
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 101fe4c7b1ee..567bc4b9f70a 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -189,7 +189,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
189 init_special_inode(inode, lower_inode->i_mode, 189 init_special_inode(inode, lower_inode->i_mode,
190 lower_inode->i_rdev); 190 lower_inode->i_rdev);
191 dentry->d_op = &ecryptfs_dops; 191 dentry->d_op = &ecryptfs_dops;
192 fsstack_copy_attr_all(inode, lower_inode, NULL); 192 fsstack_copy_attr_all(inode, lower_inode);
193 /* This size will be overwritten for real files w/ headers and 193 /* This size will be overwritten for real files w/ headers and
194 * other metadata */ 194 * other metadata */
195 fsstack_copy_inode_size(inode, lower_inode); 195 fsstack_copy_inode_size(inode, lower_inode);
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 8b47e4200e65..d26402ff06ea 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -339,7 +339,7 @@ struct file *eventfd_file_create(unsigned int count, int flags)
339 ctx->flags = flags; 339 ctx->flags = flags;
340 340
341 file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, 341 file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx,
342 flags & EFD_SHARED_FCNTL_FLAGS); 342 O_RDWR | (flags & EFD_SHARED_FCNTL_FLAGS));
343 if (IS_ERR(file)) 343 if (IS_ERR(file))
344 eventfd_free_ctx(ctx); 344 eventfd_free_ctx(ctx);
345 345
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 366c503f9657..bd056a5b4efc 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1206,7 +1206,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
1206 * a file structure and a free file descriptor. 1206 * a file structure and a free file descriptor.
1207 */ 1207 */
1208 error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep, 1208 error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep,
1209 flags & O_CLOEXEC); 1209 O_RDWR | (flags & O_CLOEXEC));
1210 if (error < 0) 1210 if (error < 0)
1211 ep_free(ep); 1211 ep_free(ep);
1212 1212
diff --git a/fs/exec.c b/fs/exec.c
index 623a5cc3076a..632b02e34ec7 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -826,7 +826,9 @@ static int de_thread(struct task_struct *tsk)
826 attach_pid(tsk, PIDTYPE_PID, task_pid(leader)); 826 attach_pid(tsk, PIDTYPE_PID, task_pid(leader));
827 transfer_pid(leader, tsk, PIDTYPE_PGID); 827 transfer_pid(leader, tsk, PIDTYPE_PGID);
828 transfer_pid(leader, tsk, PIDTYPE_SID); 828 transfer_pid(leader, tsk, PIDTYPE_SID);
829
829 list_replace_rcu(&leader->tasks, &tsk->tasks); 830 list_replace_rcu(&leader->tasks, &tsk->tasks);
831 list_replace_init(&leader->sibling, &tsk->sibling);
830 832
831 tsk->group_leader = tsk; 833 tsk->group_leader = tsk;
832 leader->group_leader = tsk; 834 leader->group_leader = tsk;
@@ -1761,17 +1763,20 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1761 struct mm_struct *mm = current->mm; 1763 struct mm_struct *mm = current->mm;
1762 struct linux_binfmt * binfmt; 1764 struct linux_binfmt * binfmt;
1763 struct inode * inode; 1765 struct inode * inode;
1764 struct file * file;
1765 const struct cred *old_cred; 1766 const struct cred *old_cred;
1766 struct cred *cred; 1767 struct cred *cred;
1767 int retval = 0; 1768 int retval = 0;
1768 int flag = 0; 1769 int flag = 0;
1769 int ispipe = 0; 1770 int ispipe = 0;
1770 unsigned long core_limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1771 char **helper_argv = NULL; 1771 char **helper_argv = NULL;
1772 int helper_argc = 0; 1772 int helper_argc = 0;
1773 int dump_count = 0; 1773 int dump_count = 0;
1774 static atomic_t core_dump_count = ATOMIC_INIT(0); 1774 static atomic_t core_dump_count = ATOMIC_INIT(0);
1775 struct coredump_params cprm = {
1776 .signr = signr,
1777 .regs = regs,
1778 .limit = current->signal->rlim[RLIMIT_CORE].rlim_cur,
1779 };
1775 1780
1776 audit_core_dumps(signr); 1781 audit_core_dumps(signr);
1777 1782
@@ -1827,15 +1832,15 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1827 ispipe = format_corename(corename, signr); 1832 ispipe = format_corename(corename, signr);
1828 unlock_kernel(); 1833 unlock_kernel();
1829 1834
1830 if ((!ispipe) && (core_limit < binfmt->min_coredump)) 1835 if ((!ispipe) && (cprm.limit < binfmt->min_coredump))
1831 goto fail_unlock; 1836 goto fail_unlock;
1832 1837
1833 if (ispipe) { 1838 if (ispipe) {
1834 if (core_limit == 0) { 1839 if (cprm.limit == 0) {
1835 /* 1840 /*
1836 * Normally core limits are irrelevant to pipes, since 1841 * Normally core limits are irrelevant to pipes, since
1837 * we're not writing to the file system, but we use 1842 * we're not writing to the file system, but we use
1838 * core_limit of 0 here as a speacial value. Any 1843 * cprm.limit of 0 here as a speacial value. Any
1839 * non-zero limit gets set to RLIM_INFINITY below, but 1844 * non-zero limit gets set to RLIM_INFINITY below, but
1840 * a limit of 0 skips the dump. This is a consistent 1845 * a limit of 0 skips the dump. This is a consistent
1841 * way to catch recursive crashes. We can still crash 1846 * way to catch recursive crashes. We can still crash
@@ -1868,25 +1873,25 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1868 goto fail_dropcount; 1873 goto fail_dropcount;
1869 } 1874 }
1870 1875
1871 core_limit = RLIM_INFINITY; 1876 cprm.limit = RLIM_INFINITY;
1872 1877
1873 /* SIGPIPE can happen, but it's just never processed */ 1878 /* SIGPIPE can happen, but it's just never processed */
1874 if (call_usermodehelper_pipe(helper_argv[0], helper_argv, NULL, 1879 if (call_usermodehelper_pipe(helper_argv[0], helper_argv, NULL,
1875 &file)) { 1880 &cprm.file)) {
1876 printk(KERN_INFO "Core dump to %s pipe failed\n", 1881 printk(KERN_INFO "Core dump to %s pipe failed\n",
1877 corename); 1882 corename);
1878 goto fail_dropcount; 1883 goto fail_dropcount;
1879 } 1884 }
1880 } else 1885 } else
1881 file = filp_open(corename, 1886 cprm.file = filp_open(corename,
1882 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag, 1887 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
1883 0600); 1888 0600);
1884 if (IS_ERR(file)) 1889 if (IS_ERR(cprm.file))
1885 goto fail_dropcount; 1890 goto fail_dropcount;
1886 inode = file->f_path.dentry->d_inode; 1891 inode = cprm.file->f_path.dentry->d_inode;
1887 if (inode->i_nlink > 1) 1892 if (inode->i_nlink > 1)
1888 goto close_fail; /* multiple links - don't dump */ 1893 goto close_fail; /* multiple links - don't dump */
1889 if (!ispipe && d_unhashed(file->f_path.dentry)) 1894 if (!ispipe && d_unhashed(cprm.file->f_path.dentry))
1890 goto close_fail; 1895 goto close_fail;
1891 1896
1892 /* AK: actually i see no reason to not allow this for named pipes etc., 1897 /* AK: actually i see no reason to not allow this for named pipes etc.,
@@ -1899,21 +1904,22 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
1899 */ 1904 */
1900 if (inode->i_uid != current_fsuid()) 1905 if (inode->i_uid != current_fsuid())
1901 goto close_fail; 1906 goto close_fail;
1902 if (!file->f_op) 1907 if (!cprm.file->f_op)
1903 goto close_fail; 1908 goto close_fail;
1904 if (!file->f_op->write) 1909 if (!cprm.file->f_op->write)
1905 goto close_fail; 1910 goto close_fail;
1906 if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0) 1911 if (!ispipe &&
1912 do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file) != 0)
1907 goto close_fail; 1913 goto close_fail;
1908 1914
1909 retval = binfmt->core_dump(signr, regs, file, core_limit); 1915 retval = binfmt->core_dump(&cprm);
1910 1916
1911 if (retval) 1917 if (retval)
1912 current->signal->group_exit_code |= 0x80; 1918 current->signal->group_exit_code |= 0x80;
1913close_fail: 1919close_fail:
1914 if (ispipe && core_pipe_limit) 1920 if (ispipe && core_pipe_limit)
1915 wait_for_dump_helpers(file); 1921 wait_for_dump_helpers(cprm.file);
1916 filp_close(file, NULL); 1922 filp_close(cprm.file, NULL);
1917fail_dropcount: 1923fail_dropcount:
1918 if (dump_count) 1924 if (dump_count)
1919 atomic_dec(&core_dump_count); 1925 atomic_dec(&core_dump_count);
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 698a8636d39c..2afbcebeda71 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -738,13 +738,28 @@ static int exofs_write_begin_export(struct file *file,
738 fsdata); 738 fsdata);
739} 739}
740 740
741static int exofs_write_end(struct file *file, struct address_space *mapping,
742 loff_t pos, unsigned len, unsigned copied,
743 struct page *page, void *fsdata)
744{
745 struct inode *inode = mapping->host;
746 /* According to comment in simple_write_end i_mutex is held */
747 loff_t i_size = inode->i_size;
748 int ret;
749
750 ret = simple_write_end(file, mapping,pos, len, copied, page, fsdata);
751 if (i_size != inode->i_size)
752 mark_inode_dirty(inode);
753 return ret;
754}
755
741const struct address_space_operations exofs_aops = { 756const struct address_space_operations exofs_aops = {
742 .readpage = exofs_readpage, 757 .readpage = exofs_readpage,
743 .readpages = exofs_readpages, 758 .readpages = exofs_readpages,
744 .writepage = exofs_writepage, 759 .writepage = exofs_writepage,
745 .writepages = exofs_writepages, 760 .writepages = exofs_writepages,
746 .write_begin = exofs_write_begin_export, 761 .write_begin = exofs_write_begin_export,
747 .write_end = simple_write_end, 762 .write_end = exofs_write_end,
748}; 763};
749 764
750/****************************************************************************** 765/******************************************************************************
diff --git a/fs/exofs/pnfs.h b/fs/exofs/pnfs.h
index 423033addd1f..c52e9888b8ab 100644
--- a/fs/exofs/pnfs.h
+++ b/fs/exofs/pnfs.h
@@ -15,13 +15,7 @@
15#ifndef __EXOFS_PNFS_H__ 15#ifndef __EXOFS_PNFS_H__
16#define __EXOFS_PNFS_H__ 16#define __EXOFS_PNFS_H__
17 17
18#if defined(CONFIG_PNFS) 18#if ! defined(__PNFS_OSD_XDR_H__)
19
20
21/* FIXME: move this file to: linux/exportfs/pnfs_osd_xdr.h */
22#include "../nfs/objlayout/pnfs_osd_xdr.h"
23
24#else /* defined(CONFIG_PNFS) */
25 19
26enum pnfs_iomode { 20enum pnfs_iomode {
27 IOMODE_READ = 1, 21 IOMODE_READ = 1,
@@ -46,6 +40,6 @@ struct pnfs_osd_data_map {
46 u32 odm_raid_algorithm; 40 u32 odm_raid_algorithm;
47}; 41};
48 42
49#endif /* else defined(CONFIG_PNFS) */ 43#endif /* ! defined(__PNFS_OSD_XDR_H__) */
50 44
51#endif /* __EXOFS_PNFS_H__ */ 45#endif /* __EXOFS_PNFS_H__ */
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index ad14227f509e..455e6e6e5cb9 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -970,7 +970,7 @@ static int ext3_get_block(struct inode *inode, sector_t iblock,
970 if (max_blocks > DIO_MAX_BLOCKS) 970 if (max_blocks > DIO_MAX_BLOCKS)
971 max_blocks = DIO_MAX_BLOCKS; 971 max_blocks = DIO_MAX_BLOCKS;
972 handle = ext3_journal_start(inode, DIO_CREDITS + 972 handle = ext3_journal_start(inode, DIO_CREDITS +
973 2 * EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb)); 973 EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb));
974 if (IS_ERR(handle)) { 974 if (IS_ERR(handle)) {
975 ret = PTR_ERR(handle); 975 ret = PTR_ERR(handle);
976 goto out; 976 goto out;
@@ -3146,8 +3146,8 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
3146 3146
3147 /* (user+group)*(old+new) structure, inode write (sb, 3147 /* (user+group)*(old+new) structure, inode write (sb,
3148 * inode block, ? - but truncate inode update has it) */ 3148 * inode block, ? - but truncate inode update has it) */
3149 handle = ext3_journal_start(inode, 2*(EXT3_QUOTA_INIT_BLOCKS(inode->i_sb)+ 3149 handle = ext3_journal_start(inode, EXT3_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)+
3150 EXT3_QUOTA_DEL_BLOCKS(inode->i_sb))+3); 3150 EXT3_MAXQUOTAS_DEL_BLOCKS(inode->i_sb)+3);
3151 if (IS_ERR(handle)) { 3151 if (IS_ERR(handle)) {
3152 error = PTR_ERR(handle); 3152 error = PTR_ERR(handle);
3153 goto err_out; 3153 goto err_out;
@@ -3239,7 +3239,7 @@ static int ext3_writepage_trans_blocks(struct inode *inode)
3239#ifdef CONFIG_QUOTA 3239#ifdef CONFIG_QUOTA
3240 /* We know that structure was already allocated during vfs_dq_init so 3240 /* We know that structure was already allocated during vfs_dq_init so
3241 * we will be updating only the data blocks + inodes */ 3241 * we will be updating only the data blocks + inodes */
3242 ret += 2*EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb); 3242 ret += EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
3243#endif 3243#endif
3244 3244
3245 return ret; 3245 return ret;
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index aad6400c9b77..7b0e44f7d66f 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1699,7 +1699,7 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode,
1699retry: 1699retry:
1700 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 1700 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
1701 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + 1701 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
1702 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); 1702 EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1703 if (IS_ERR(handle)) 1703 if (IS_ERR(handle))
1704 return PTR_ERR(handle); 1704 return PTR_ERR(handle);
1705 1705
@@ -1733,7 +1733,7 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry,
1733retry: 1733retry:
1734 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 1734 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
1735 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + 1735 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
1736 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); 1736 EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1737 if (IS_ERR(handle)) 1737 if (IS_ERR(handle))
1738 return PTR_ERR(handle); 1738 return PTR_ERR(handle);
1739 1739
@@ -1769,7 +1769,7 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
1769retry: 1769retry:
1770 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 1770 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
1771 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 + 1771 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3 +
1772 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); 1772 EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1773 if (IS_ERR(handle)) 1773 if (IS_ERR(handle))
1774 return PTR_ERR(handle); 1774 return PTR_ERR(handle);
1775 1775
@@ -1920,7 +1920,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
1920 struct ext3_iloc iloc; 1920 struct ext3_iloc iloc;
1921 int err = 0, rc; 1921 int err = 0, rc;
1922 1922
1923 lock_super(sb); 1923 mutex_lock(&EXT3_SB(sb)->s_orphan_lock);
1924 if (!list_empty(&EXT3_I(inode)->i_orphan)) 1924 if (!list_empty(&EXT3_I(inode)->i_orphan))
1925 goto out_unlock; 1925 goto out_unlock;
1926 1926
@@ -1929,9 +1929,13 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
1929 1929
1930 /* @@@ FIXME: Observation from aviro: 1930 /* @@@ FIXME: Observation from aviro:
1931 * I think I can trigger J_ASSERT in ext3_orphan_add(). We block 1931 * I think I can trigger J_ASSERT in ext3_orphan_add(). We block
1932 * here (on lock_super()), so race with ext3_link() which might bump 1932 * here (on s_orphan_lock), so race with ext3_link() which might bump
1933 * ->i_nlink. For, say it, character device. Not a regular file, 1933 * ->i_nlink. For, say it, character device. Not a regular file,
1934 * not a directory, not a symlink and ->i_nlink > 0. 1934 * not a directory, not a symlink and ->i_nlink > 0.
1935 *
1936 * tytso, 4/25/2009: I'm not sure how that could happen;
1937 * shouldn't the fs core protect us from these sort of
1938 * unlink()/link() races?
1935 */ 1939 */
1936 J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 1940 J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1937 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0); 1941 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
@@ -1968,7 +1972,7 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
1968 jbd_debug(4, "orphan inode %lu will point to %d\n", 1972 jbd_debug(4, "orphan inode %lu will point to %d\n",
1969 inode->i_ino, NEXT_ORPHAN(inode)); 1973 inode->i_ino, NEXT_ORPHAN(inode));
1970out_unlock: 1974out_unlock:
1971 unlock_super(sb); 1975 mutex_unlock(&EXT3_SB(sb)->s_orphan_lock);
1972 ext3_std_error(inode->i_sb, err); 1976 ext3_std_error(inode->i_sb, err);
1973 return err; 1977 return err;
1974} 1978}
@@ -1986,11 +1990,9 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
1986 struct ext3_iloc iloc; 1990 struct ext3_iloc iloc;
1987 int err = 0; 1991 int err = 0;
1988 1992
1989 lock_super(inode->i_sb); 1993 mutex_lock(&EXT3_SB(inode->i_sb)->s_orphan_lock);
1990 if (list_empty(&ei->i_orphan)) { 1994 if (list_empty(&ei->i_orphan))
1991 unlock_super(inode->i_sb); 1995 goto out;
1992 return 0;
1993 }
1994 1996
1995 ino_next = NEXT_ORPHAN(inode); 1997 ino_next = NEXT_ORPHAN(inode);
1996 prev = ei->i_orphan.prev; 1998 prev = ei->i_orphan.prev;
@@ -2040,7 +2042,7 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
2040out_err: 2042out_err:
2041 ext3_std_error(inode->i_sb, err); 2043 ext3_std_error(inode->i_sb, err);
2042out: 2044out:
2043 unlock_super(inode->i_sb); 2045 mutex_unlock(&EXT3_SB(inode->i_sb)->s_orphan_lock);
2044 return err; 2046 return err;
2045 2047
2046out_brelse: 2048out_brelse:
@@ -2175,7 +2177,7 @@ static int ext3_symlink (struct inode * dir,
2175retry: 2177retry:
2176 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 2178 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
2177 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 + 2179 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 5 +
2178 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); 2180 EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
2179 if (IS_ERR(handle)) 2181 if (IS_ERR(handle))
2180 return PTR_ERR(handle); 2182 return PTR_ERR(handle);
2181 2183
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 5f83b6179178..54351ac7cef9 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -209,7 +209,7 @@ static int setup_new_group_blocks(struct super_block *sb,
209 if (IS_ERR(handle)) 209 if (IS_ERR(handle))
210 return PTR_ERR(handle); 210 return PTR_ERR(handle);
211 211
212 lock_super(sb); 212 mutex_lock(&sbi->s_resize_lock);
213 if (input->group != sbi->s_groups_count) { 213 if (input->group != sbi->s_groups_count) {
214 err = -EBUSY; 214 err = -EBUSY;
215 goto exit_journal; 215 goto exit_journal;
@@ -324,7 +324,7 @@ exit_bh:
324 brelse(bh); 324 brelse(bh);
325 325
326exit_journal: 326exit_journal:
327 unlock_super(sb); 327 mutex_unlock(&sbi->s_resize_lock);
328 if ((err2 = ext3_journal_stop(handle)) && !err) 328 if ((err2 = ext3_journal_stop(handle)) && !err)
329 err = err2; 329 err = err2;
330 330
@@ -662,11 +662,12 @@ exit_free:
662 * important part is that the new block and inode counts are in the backup 662 * important part is that the new block and inode counts are in the backup
663 * superblocks, and the location of the new group metadata in the GDT backups. 663 * superblocks, and the location of the new group metadata in the GDT backups.
664 * 664 *
665 * We do not need lock_super() for this, because these blocks are not 665 * We do not need take the s_resize_lock for this, because these
666 * otherwise touched by the filesystem code when it is mounted. We don't 666 * blocks are not otherwise touched by the filesystem code when it is
667 * need to worry about last changing from sbi->s_groups_count, because the 667 * mounted. We don't need to worry about last changing from
668 * worst that can happen is that we do not copy the full number of backups 668 * sbi->s_groups_count, because the worst that can happen is that we
669 * at this time. The resize which changed s_groups_count will backup again. 669 * do not copy the full number of backups at this time. The resize
670 * which changed s_groups_count will backup again.
670 */ 671 */
671static void update_backups(struct super_block *sb, 672static void update_backups(struct super_block *sb,
672 int blk_off, char *data, int size) 673 int blk_off, char *data, int size)
@@ -825,7 +826,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
825 goto exit_put; 826 goto exit_put;
826 } 827 }
827 828
828 lock_super(sb); 829 mutex_lock(&sbi->s_resize_lock);
829 if (input->group != sbi->s_groups_count) { 830 if (input->group != sbi->s_groups_count) {
830 ext3_warning(sb, __func__, 831 ext3_warning(sb, __func__,
831 "multiple resizers run on filesystem!"); 832 "multiple resizers run on filesystem!");
@@ -856,7 +857,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
856 /* 857 /*
857 * OK, now we've set up the new group. Time to make it active. 858 * OK, now we've set up the new group. Time to make it active.
858 * 859 *
859 * Current kernels don't lock all allocations via lock_super(), 860 * We do not lock all allocations via s_resize_lock
860 * so we have to be safe wrt. concurrent accesses the group 861 * so we have to be safe wrt. concurrent accesses the group
861 * data. So we need to be careful to set all of the relevant 862 * data. So we need to be careful to set all of the relevant
862 * group descriptor data etc. *before* we enable the group. 863 * group descriptor data etc. *before* we enable the group.
@@ -900,12 +901,12 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
900 * 901 *
901 * The precise rules we use are: 902 * The precise rules we use are:
902 * 903 *
903 * * Writers of s_groups_count *must* hold lock_super 904 * * Writers of s_groups_count *must* hold s_resize_lock
904 * AND 905 * AND
905 * * Writers must perform a smp_wmb() after updating all dependent 906 * * Writers must perform a smp_wmb() after updating all dependent
906 * data and before modifying the groups count 907 * data and before modifying the groups count
907 * 908 *
908 * * Readers must hold lock_super() over the access 909 * * Readers must hold s_resize_lock over the access
909 * OR 910 * OR
910 * * Readers must perform an smp_rmb() after reading the groups count 911 * * Readers must perform an smp_rmb() after reading the groups count
911 * and before reading any dependent data. 912 * and before reading any dependent data.
@@ -936,7 +937,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
936 ext3_journal_dirty_metadata(handle, sbi->s_sbh); 937 ext3_journal_dirty_metadata(handle, sbi->s_sbh);
937 938
938exit_journal: 939exit_journal:
939 unlock_super(sb); 940 mutex_unlock(&sbi->s_resize_lock);
940 if ((err2 = ext3_journal_stop(handle)) && !err) 941 if ((err2 = ext3_journal_stop(handle)) && !err)
941 err = err2; 942 err = err2;
942 if (!err) { 943 if (!err) {
@@ -973,7 +974,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
973 974
974 /* We don't need to worry about locking wrt other resizers just 975 /* We don't need to worry about locking wrt other resizers just
975 * yet: we're going to revalidate es->s_blocks_count after 976 * yet: we're going to revalidate es->s_blocks_count after
976 * taking lock_super() below. */ 977 * taking the s_resize_lock below. */
977 o_blocks_count = le32_to_cpu(es->s_blocks_count); 978 o_blocks_count = le32_to_cpu(es->s_blocks_count);
978 o_groups_count = EXT3_SB(sb)->s_groups_count; 979 o_groups_count = EXT3_SB(sb)->s_groups_count;
979 980
@@ -1045,11 +1046,11 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1045 goto exit_put; 1046 goto exit_put;
1046 } 1047 }
1047 1048
1048 lock_super(sb); 1049 mutex_lock(&EXT3_SB(sb)->s_resize_lock);
1049 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) { 1050 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) {
1050 ext3_warning(sb, __func__, 1051 ext3_warning(sb, __func__,
1051 "multiple resizers run on filesystem!"); 1052 "multiple resizers run on filesystem!");
1052 unlock_super(sb); 1053 mutex_unlock(&EXT3_SB(sb)->s_resize_lock);
1053 ext3_journal_stop(handle); 1054 ext3_journal_stop(handle);
1054 err = -EBUSY; 1055 err = -EBUSY;
1055 goto exit_put; 1056 goto exit_put;
@@ -1059,13 +1060,13 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1059 EXT3_SB(sb)->s_sbh))) { 1060 EXT3_SB(sb)->s_sbh))) {
1060 ext3_warning(sb, __func__, 1061 ext3_warning(sb, __func__,
1061 "error %d on journal write access", err); 1062 "error %d on journal write access", err);
1062 unlock_super(sb); 1063 mutex_unlock(&EXT3_SB(sb)->s_resize_lock);
1063 ext3_journal_stop(handle); 1064 ext3_journal_stop(handle);
1064 goto exit_put; 1065 goto exit_put;
1065 } 1066 }
1066 es->s_blocks_count = cpu_to_le32(o_blocks_count + add); 1067 es->s_blocks_count = cpu_to_le32(o_blocks_count + add);
1067 ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); 1068 ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1068 unlock_super(sb); 1069 mutex_unlock(&EXT3_SB(sb)->s_resize_lock);
1069 ext3_debug("freeing blocks %lu through "E3FSBLK"\n", o_blocks_count, 1070 ext3_debug("freeing blocks %lu through "E3FSBLK"\n", o_blocks_count,
1070 o_blocks_count + add); 1071 o_blocks_count + add);
1071 ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks); 1072 ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 7ad1e8c30bd0..afa2b569da10 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1928,6 +1928,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1928 sb->dq_op = &ext3_quota_operations; 1928 sb->dq_op = &ext3_quota_operations;
1929#endif 1929#endif
1930 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ 1930 INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
1931 mutex_init(&sbi->s_orphan_lock);
1932 mutex_init(&sbi->s_resize_lock);
1931 1933
1932 sb->s_root = NULL; 1934 sb->s_root = NULL;
1933 1935
@@ -2014,14 +2016,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
2014 } 2016 }
2015 2017
2016 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); 2018 ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY);
2017 /* 2019
2018 * akpm: core read_super() calls in here with the superblock locked.
2019 * That deadlocks, because orphan cleanup needs to lock the superblock
2020 * in numerous places. Here we just pop the lock - it's relatively
2021 * harmless, because we are now ready to accept write_super() requests,
2022 * and aviro says that's the only reason for hanging onto the
2023 * superblock lock.
2024 */
2025 EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; 2020 EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS;
2026 ext3_orphan_cleanup(sb, es); 2021 ext3_orphan_cleanup(sb, es);
2027 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; 2022 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS;
@@ -2403,13 +2398,11 @@ static void ext3_mark_recovery_complete(struct super_block * sb,
2403 if (journal_flush(journal) < 0) 2398 if (journal_flush(journal) < 0)
2404 goto out; 2399 goto out;
2405 2400
2406 lock_super(sb);
2407 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && 2401 if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) &&
2408 sb->s_flags & MS_RDONLY) { 2402 sb->s_flags & MS_RDONLY) {
2409 EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); 2403 EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
2410 ext3_commit_super(sb, es, 1); 2404 ext3_commit_super(sb, es, 1);
2411 } 2405 }
2412 unlock_super(sb);
2413 2406
2414out: 2407out:
2415 journal_unlock_updates(journal); 2408 journal_unlock_updates(journal);
@@ -2601,13 +2594,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2601 (sbi->s_mount_state & EXT3_VALID_FS)) 2594 (sbi->s_mount_state & EXT3_VALID_FS))
2602 es->s_state = cpu_to_le16(sbi->s_mount_state); 2595 es->s_state = cpu_to_le16(sbi->s_mount_state);
2603 2596
2604 /*
2605 * We have to unlock super so that we can wait for
2606 * transactions.
2607 */
2608 unlock_super(sb);
2609 ext3_mark_recovery_complete(sb, es); 2597 ext3_mark_recovery_complete(sb, es);
2610 lock_super(sb);
2611 } else { 2598 } else {
2612 __le32 ret; 2599 __le32 ret;
2613 if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb, 2600 if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index e5f6774846e4..9ed1bb1f319f 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -2,7 +2,6 @@ config EXT4_FS
2 tristate "The Extended 4 (ext4) filesystem" 2 tristate "The Extended 4 (ext4) filesystem"
3 select JBD2 3 select JBD2
4 select CRC16 4 select CRC16
5 select FS_JOURNAL_INFO
6 help 5 help
7 This is the next generation of the ext3 filesystem. 6 This is the next generation of the ext3 filesystem.
8 7
@@ -29,6 +28,7 @@ config EXT4_FS
29 28
30config EXT4_USE_FOR_EXT23 29config EXT4_USE_FOR_EXT23
31 bool "Use ext4 for ext2/ext3 file systems" 30 bool "Use ext4 for ext2/ext3 file systems"
31 depends on EXT4_FS
32 depends on EXT3_FS=n || EXT2_FS=n 32 depends on EXT3_FS=n || EXT2_FS=n
33 default y 33 default y
34 help 34 help
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 4df8621ec31c..a60ab9aad57d 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -16,7 +16,6 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/version.h>
20#include <linux/blkdev.h> 19#include <linux/blkdev.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
22#include "ext4.h" 21#include "ext4.h"
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ab31e65d46d0..af7b62699ea9 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -699,11 +699,17 @@ struct ext4_inode_info {
699 unsigned int i_reserved_meta_blocks; 699 unsigned int i_reserved_meta_blocks;
700 unsigned int i_allocated_meta_blocks; 700 unsigned int i_allocated_meta_blocks;
701 unsigned short i_delalloc_reserved_flag; 701 unsigned short i_delalloc_reserved_flag;
702 sector_t i_da_metadata_calc_last_lblock;
703 int i_da_metadata_calc_len;
702 704
703 /* on-disk additional length */ 705 /* on-disk additional length */
704 __u16 i_extra_isize; 706 __u16 i_extra_isize;
705 707
706 spinlock_t i_block_reservation_lock; 708 spinlock_t i_block_reservation_lock;
709#ifdef CONFIG_QUOTA
710 /* quota space reservation, managed internally by quota code */
711 qsize_t i_reserved_quota;
712#endif
707 713
708 /* completed async DIOs that might need unwritten extents handling */ 714 /* completed async DIOs that might need unwritten extents handling */
709 struct list_head i_aio_dio_complete_list; 715 struct list_head i_aio_dio_complete_list;
@@ -1435,7 +1441,7 @@ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1435extern int ext4_block_truncate_page(handle_t *handle, 1441extern int ext4_block_truncate_page(handle_t *handle,
1436 struct address_space *mapping, loff_t from); 1442 struct address_space *mapping, loff_t from);
1437extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); 1443extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
1438extern qsize_t ext4_get_reserved_space(struct inode *inode); 1444extern qsize_t *ext4_get_reserved_space(struct inode *inode);
1439extern int flush_aio_dio_completed_IO(struct inode *inode); 1445extern int flush_aio_dio_completed_IO(struct inode *inode);
1440/* ioctl.c */ 1446/* ioctl.c */
1441extern long ext4_ioctl(struct file *, unsigned int, unsigned long); 1447extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h
index 2ca686454e87..bdb6ce7e2eb4 100644
--- a/fs/ext4/ext4_extents.h
+++ b/fs/ext4/ext4_extents.h
@@ -225,7 +225,8 @@ static inline void ext4_ext_mark_initialized(struct ext4_extent *ext)
225 ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext)); 225 ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext));
226} 226}
227 227
228extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks); 228extern int ext4_ext_calc_metadata_amount(struct inode *inode,
229 sector_t lblocks);
229extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex); 230extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex);
230extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); 231extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
231extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); 232extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 3a7928f825e4..7d7b74e94687 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -296,29 +296,44 @@ static inline int ext4_ext_space_root_idx(struct inode *inode, int check)
296 * to allocate @blocks 296 * to allocate @blocks
297 * Worse case is one block per extent 297 * Worse case is one block per extent
298 */ 298 */
299int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks) 299int ext4_ext_calc_metadata_amount(struct inode *inode, sector_t lblock)
300{ 300{
301 int lcap, icap, rcap, leafs, idxs, num; 301 struct ext4_inode_info *ei = EXT4_I(inode);
302 int newextents = blocks; 302 int idxs, num = 0;
303
304 rcap = ext4_ext_space_root_idx(inode, 0);
305 lcap = ext4_ext_space_block(inode, 0);
306 icap = ext4_ext_space_block_idx(inode, 0);
307 303
308 /* number of new leaf blocks needed */ 304 idxs = ((inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
309 num = leafs = (newextents + lcap - 1) / lcap; 305 / sizeof(struct ext4_extent_idx));
310 306
311 /* 307 /*
312 * Worse case, we need separate index block(s) 308 * If the new delayed allocation block is contiguous with the
313 * to link all new leaf blocks 309 * previous da block, it can share index blocks with the
310 * previous block, so we only need to allocate a new index
311 * block every idxs leaf blocks. At ldxs**2 blocks, we need
312 * an additional index block, and at ldxs**3 blocks, yet
313 * another index blocks.
314 */ 314 */
315 idxs = (leafs + icap - 1) / icap; 315 if (ei->i_da_metadata_calc_len &&
316 do { 316 ei->i_da_metadata_calc_last_lblock+1 == lblock) {
317 num += idxs; 317 if ((ei->i_da_metadata_calc_len % idxs) == 0)
318 idxs = (idxs + icap - 1) / icap; 318 num++;
319 } while (idxs > rcap); 319 if ((ei->i_da_metadata_calc_len % (idxs*idxs)) == 0)
320 num++;
321 if ((ei->i_da_metadata_calc_len % (idxs*idxs*idxs)) == 0) {
322 num++;
323 ei->i_da_metadata_calc_len = 0;
324 } else
325 ei->i_da_metadata_calc_len++;
326 ei->i_da_metadata_calc_last_lblock++;
327 return num;
328 }
320 329
321 return num; 330 /*
331 * In the worst case we need a new set of index blocks at
332 * every level of the inode's extent tree.
333 */
334 ei->i_da_metadata_calc_len = 1;
335 ei->i_da_metadata_calc_last_lblock = lblock;
336 return ext_depth(inode) + 1;
322} 337}
323 338
324static int 339static int
@@ -3023,6 +3038,14 @@ out:
3023 return err; 3038 return err;
3024} 3039}
3025 3040
3041static void unmap_underlying_metadata_blocks(struct block_device *bdev,
3042 sector_t block, int count)
3043{
3044 int i;
3045 for (i = 0; i < count; i++)
3046 unmap_underlying_metadata(bdev, block + i);
3047}
3048
3026static int 3049static int
3027ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, 3050ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
3028 ext4_lblk_t iblock, unsigned int max_blocks, 3051 ext4_lblk_t iblock, unsigned int max_blocks,
@@ -3098,6 +3121,18 @@ out:
3098 } else 3121 } else
3099 allocated = ret; 3122 allocated = ret;
3100 set_buffer_new(bh_result); 3123 set_buffer_new(bh_result);
3124 /*
3125 * if we allocated more blocks than requested
3126 * we need to make sure we unmap the extra block
3127 * allocated. The actual needed block will get
3128 * unmapped later when we find the buffer_head marked
3129 * new.
3130 */
3131 if (allocated > max_blocks) {
3132 unmap_underlying_metadata_blocks(inode->i_sb->s_bdev,
3133 newblock + max_blocks,
3134 allocated - max_blocks);
3135 }
3101map_out: 3136map_out:
3102 set_buffer_mapped(bh_result); 3137 set_buffer_mapped(bh_result);
3103out1: 3138out1:
@@ -3190,7 +3225,13 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
3190 * this situation is possible, though, _during_ tree modification; 3225 * this situation is possible, though, _during_ tree modification;
3191 * this is why assert can't be put in ext4_ext_find_extent() 3226 * this is why assert can't be put in ext4_ext_find_extent()
3192 */ 3227 */
3193 BUG_ON(path[depth].p_ext == NULL && depth != 0); 3228 if (path[depth].p_ext == NULL && depth != 0) {
3229 ext4_error(inode->i_sb, __func__, "bad extent address "
3230 "inode: %lu, iblock: %d, depth: %d",
3231 inode->i_ino, iblock, depth);
3232 err = -EIO;
3233 goto out2;
3234 }
3194 eh = path[depth].p_hdr; 3235 eh = path[depth].p_hdr;
3195 3236
3196 ex = path[depth].p_ext; 3237 ex = path[depth].p_ext;
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 0b22497d92e1..98bd140aad01 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -88,9 +88,21 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
88 return ext4_force_commit(inode->i_sb); 88 return ext4_force_commit(inode->i_sb);
89 89
90 commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid; 90 commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid;
91 if (jbd2_log_start_commit(journal, commit_tid)) 91 if (jbd2_log_start_commit(journal, commit_tid)) {
92 /*
93 * When the journal is on a different device than the
94 * fs data disk, we need to issue the barrier in
95 * writeback mode. (In ordered mode, the jbd2 layer
96 * will take care of issuing the barrier. In
97 * data=journal, all of the data blocks are written to
98 * the journal device.)
99 */
100 if (ext4_should_writeback_data(inode) &&
101 (journal->j_fs_dev != journal->j_dev) &&
102 (journal->j_flags & JBD2_BARRIER))
103 blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
92 jbd2_log_wait_commit(journal, commit_tid); 104 jbd2_log_wait_commit(journal, commit_tid);
93 else if (journal->j_flags & JBD2_BARRIER) 105 } else if (journal->j_flags & JBD2_BARRIER)
94 blkdev_issue_flush(inode->i_sb->s_bdev, NULL); 106 blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
95 return ret; 107 return ret;
96} 108}
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5352db1a3086..c818972c8302 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1003,83 +1003,94 @@ out:
1003 return err; 1003 return err;
1004} 1004}
1005 1005
1006qsize_t ext4_get_reserved_space(struct inode *inode) 1006#ifdef CONFIG_QUOTA
1007qsize_t *ext4_get_reserved_space(struct inode *inode)
1007{ 1008{
1008 unsigned long long total; 1009 return &EXT4_I(inode)->i_reserved_quota;
1009
1010 spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
1011 total = EXT4_I(inode)->i_reserved_data_blocks +
1012 EXT4_I(inode)->i_reserved_meta_blocks;
1013 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1014
1015 return (total << inode->i_blkbits);
1016} 1010}
1011#endif
1012
1017/* 1013/*
1018 * Calculate the number of metadata blocks need to reserve 1014 * Calculate the number of metadata blocks need to reserve
1019 * to allocate @blocks for non extent file based file 1015 * to allocate a new block at @lblocks for non extent file based file
1020 */ 1016 */
1021static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks) 1017static int ext4_indirect_calc_metadata_amount(struct inode *inode,
1018 sector_t lblock)
1022{ 1019{
1023 int icap = EXT4_ADDR_PER_BLOCK(inode->i_sb); 1020 struct ext4_inode_info *ei = EXT4_I(inode);
1024 int ind_blks, dind_blks, tind_blks; 1021 int dind_mask = EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1;
1025 1022 int blk_bits;
1026 /* number of new indirect blocks needed */
1027 ind_blks = (blocks + icap - 1) / icap;
1028 1023
1029 dind_blks = (ind_blks + icap - 1) / icap; 1024 if (lblock < EXT4_NDIR_BLOCKS)
1025 return 0;
1030 1026
1031 tind_blks = 1; 1027 lblock -= EXT4_NDIR_BLOCKS;
1032 1028
1033 return ind_blks + dind_blks + tind_blks; 1029 if (ei->i_da_metadata_calc_len &&
1030 (lblock & dind_mask) == ei->i_da_metadata_calc_last_lblock) {
1031 ei->i_da_metadata_calc_len++;
1032 return 0;
1033 }
1034 ei->i_da_metadata_calc_last_lblock = lblock & dind_mask;
1035 ei->i_da_metadata_calc_len = 1;
1036 blk_bits = roundup_pow_of_two(lblock + 1);
1037 return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1;
1034} 1038}
1035 1039
1036/* 1040/*
1037 * Calculate the number of metadata blocks need to reserve 1041 * Calculate the number of metadata blocks need to reserve
1038 * to allocate given number of blocks 1042 * to allocate a block located at @lblock
1039 */ 1043 */
1040static int ext4_calc_metadata_amount(struct inode *inode, int blocks) 1044static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock)
1041{ 1045{
1042 if (!blocks)
1043 return 0;
1044
1045 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) 1046 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1046 return ext4_ext_calc_metadata_amount(inode, blocks); 1047 return ext4_ext_calc_metadata_amount(inode, lblock);
1047 1048
1048 return ext4_indirect_calc_metadata_amount(inode, blocks); 1049 return ext4_indirect_calc_metadata_amount(inode, lblock);
1049} 1050}
1050 1051
1052/*
1053 * Called with i_data_sem down, which is important since we can call
1054 * ext4_discard_preallocations() from here.
1055 */
1051static void ext4_da_update_reserve_space(struct inode *inode, int used) 1056static void ext4_da_update_reserve_space(struct inode *inode, int used)
1052{ 1057{
1053 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1058 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1054 int total, mdb, mdb_free; 1059 struct ext4_inode_info *ei = EXT4_I(inode);
1055 1060 int mdb_free = 0;
1056 spin_lock(&EXT4_I(inode)->i_block_reservation_lock); 1061
1057 /* recalculate the number of metablocks still need to be reserved */ 1062 spin_lock(&ei->i_block_reservation_lock);
1058 total = EXT4_I(inode)->i_reserved_data_blocks - used; 1063 if (unlikely(used > ei->i_reserved_data_blocks)) {
1059 mdb = ext4_calc_metadata_amount(inode, total); 1064 ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d "
1060 1065 "with only %d reserved data blocks\n",
1061 /* figure out how many metablocks to release */ 1066 __func__, inode->i_ino, used,
1062 BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks); 1067 ei->i_reserved_data_blocks);
1063 mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb; 1068 WARN_ON(1);
1064 1069 used = ei->i_reserved_data_blocks;
1065 if (mdb_free) { 1070 }
1066 /* Account for allocated meta_blocks */ 1071
1067 mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks; 1072 /* Update per-inode reservations */
1068 1073 ei->i_reserved_data_blocks -= used;
1069 /* update fs dirty blocks counter */ 1074 used += ei->i_allocated_meta_blocks;
1075 ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
1076 ei->i_allocated_meta_blocks = 0;
1077 percpu_counter_sub(&sbi->s_dirtyblocks_counter, used);
1078
1079 if (ei->i_reserved_data_blocks == 0) {
1080 /*
1081 * We can release all of the reserved metadata blocks
1082 * only when we have written all of the delayed
1083 * allocation blocks.
1084 */
1085 mdb_free = ei->i_reserved_meta_blocks;
1086 ei->i_reserved_meta_blocks = 0;
1087 ei->i_da_metadata_calc_len = 0;
1070 percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free); 1088 percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free);
1071 EXT4_I(inode)->i_allocated_meta_blocks = 0;
1072 EXT4_I(inode)->i_reserved_meta_blocks = mdb;
1073 } 1089 }
1074
1075 /* update per-inode reservations */
1076 BUG_ON(used > EXT4_I(inode)->i_reserved_data_blocks);
1077 EXT4_I(inode)->i_reserved_data_blocks -= used;
1078 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1090 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1079 1091
1080 /* 1092 /* Update quota subsystem */
1081 * free those over-booking quota for metadata blocks 1093 vfs_dq_claim_block(inode, used);
1082 */
1083 if (mdb_free) 1094 if (mdb_free)
1084 vfs_dq_release_reservation_block(inode, mdb_free); 1095 vfs_dq_release_reservation_block(inode, mdb_free);
1085 1096
@@ -1088,7 +1099,8 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1088 * there aren't any writers on the inode, we can discard the 1099 * there aren't any writers on the inode, we can discard the
1089 * inode's preallocations. 1100 * inode's preallocations.
1090 */ 1101 */
1091 if (!total && (atomic_read(&inode->i_writecount) == 0)) 1102 if ((ei->i_reserved_data_blocks == 0) &&
1103 (atomic_read(&inode->i_writecount) == 0))
1092 ext4_discard_preallocations(inode); 1104 ext4_discard_preallocations(inode);
1093} 1105}
1094 1106
@@ -1797,11 +1809,15 @@ static int ext4_journalled_write_end(struct file *file,
1797 return ret ? ret : copied; 1809 return ret ? ret : copied;
1798} 1810}
1799 1811
1800static int ext4_da_reserve_space(struct inode *inode, int nrblocks) 1812/*
1813 * Reserve a single block located at lblock
1814 */
1815static int ext4_da_reserve_space(struct inode *inode, sector_t lblock)
1801{ 1816{
1802 int retries = 0; 1817 int retries = 0;
1803 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1818 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1804 unsigned long md_needed, mdblocks, total = 0; 1819 struct ext4_inode_info *ei = EXT4_I(inode);
1820 unsigned long md_needed, md_reserved;
1805 1821
1806 /* 1822 /*
1807 * recalculate the amount of metadata blocks to reserve 1823 * recalculate the amount of metadata blocks to reserve
@@ -1809,86 +1825,90 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
1809 * worse case is one extent per block 1825 * worse case is one extent per block
1810 */ 1826 */
1811repeat: 1827repeat:
1812 spin_lock(&EXT4_I(inode)->i_block_reservation_lock); 1828 spin_lock(&ei->i_block_reservation_lock);
1813 total = EXT4_I(inode)->i_reserved_data_blocks + nrblocks; 1829 md_reserved = ei->i_reserved_meta_blocks;
1814 mdblocks = ext4_calc_metadata_amount(inode, total); 1830 md_needed = ext4_calc_metadata_amount(inode, lblock);
1815 BUG_ON(mdblocks < EXT4_I(inode)->i_reserved_meta_blocks); 1831 spin_unlock(&ei->i_block_reservation_lock);
1816
1817 md_needed = mdblocks - EXT4_I(inode)->i_reserved_meta_blocks;
1818 total = md_needed + nrblocks;
1819 1832
1820 /* 1833 /*
1821 * Make quota reservation here to prevent quota overflow 1834 * Make quota reservation here to prevent quota overflow
1822 * later. Real quota accounting is done at pages writeout 1835 * later. Real quota accounting is done at pages writeout
1823 * time. 1836 * time.
1824 */ 1837 */
1825 if (vfs_dq_reserve_block(inode, total)) { 1838 if (vfs_dq_reserve_block(inode, md_needed + 1)) {
1826 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1839 /*
1840 * We tend to badly over-estimate the amount of
1841 * metadata blocks which are needed, so if we have
1842 * reserved any metadata blocks, try to force out the
1843 * inode and see if we have any better luck.
1844 */
1845 if (md_reserved && retries++ <= 3)
1846 goto retry;
1827 return -EDQUOT; 1847 return -EDQUOT;
1828 } 1848 }
1829 1849
1830 if (ext4_claim_free_blocks(sbi, total)) { 1850 if (ext4_claim_free_blocks(sbi, md_needed + 1)) {
1831 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1851 vfs_dq_release_reservation_block(inode, md_needed + 1);
1832 vfs_dq_release_reservation_block(inode, total);
1833 if (ext4_should_retry_alloc(inode->i_sb, &retries)) { 1852 if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
1853 retry:
1854 if (md_reserved)
1855 write_inode_now(inode, (retries == 3));
1834 yield(); 1856 yield();
1835 goto repeat; 1857 goto repeat;
1836 } 1858 }
1837 return -ENOSPC; 1859 return -ENOSPC;
1838 } 1860 }
1839 EXT4_I(inode)->i_reserved_data_blocks += nrblocks; 1861 spin_lock(&ei->i_block_reservation_lock);
1840 EXT4_I(inode)->i_reserved_meta_blocks = mdblocks; 1862 ei->i_reserved_data_blocks++;
1863 ei->i_reserved_meta_blocks += md_needed;
1864 spin_unlock(&ei->i_block_reservation_lock);
1841 1865
1842 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1843 return 0; /* success */ 1866 return 0; /* success */
1844} 1867}
1845 1868
1846static void ext4_da_release_space(struct inode *inode, int to_free) 1869static void ext4_da_release_space(struct inode *inode, int to_free)
1847{ 1870{
1848 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1871 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1849 int total, mdb, mdb_free, release; 1872 struct ext4_inode_info *ei = EXT4_I(inode);
1850 1873
1851 if (!to_free) 1874 if (!to_free)
1852 return; /* Nothing to release, exit */ 1875 return; /* Nothing to release, exit */
1853 1876
1854 spin_lock(&EXT4_I(inode)->i_block_reservation_lock); 1877 spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
1855 1878
1856 if (!EXT4_I(inode)->i_reserved_data_blocks) { 1879 if (unlikely(to_free > ei->i_reserved_data_blocks)) {
1857 /* 1880 /*
1858 * if there is no reserved blocks, but we try to free some 1881 * if there aren't enough reserved blocks, then the
1859 * then the counter is messed up somewhere. 1882 * counter is messed up somewhere. Since this
1860 * but since this function is called from invalidate 1883 * function is called from invalidate page, it's
1861 * page, it's harmless to return without any action 1884 * harmless to return without any action.
1862 */ 1885 */
1863 printk(KERN_INFO "ext4 delalloc try to release %d reserved " 1886 ext4_msg(inode->i_sb, KERN_NOTICE, "ext4_da_release_space: "
1864 "blocks for inode %lu, but there is no reserved " 1887 "ino %lu, to_free %d with only %d reserved "
1865 "data blocks\n", to_free, inode->i_ino); 1888 "data blocks\n", inode->i_ino, to_free,
1866 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1889 ei->i_reserved_data_blocks);
1867 return; 1890 WARN_ON(1);
1891 to_free = ei->i_reserved_data_blocks;
1868 } 1892 }
1893 ei->i_reserved_data_blocks -= to_free;
1869 1894
1870 /* recalculate the number of metablocks still need to be reserved */ 1895 if (ei->i_reserved_data_blocks == 0) {
1871 total = EXT4_I(inode)->i_reserved_data_blocks - to_free; 1896 /*
1872 mdb = ext4_calc_metadata_amount(inode, total); 1897 * We can release all of the reserved metadata blocks
1873 1898 * only when we have written all of the delayed
1874 /* figure out how many metablocks to release */ 1899 * allocation blocks.
1875 BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks); 1900 */
1876 mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb; 1901 to_free += ei->i_reserved_meta_blocks;
1877 1902 ei->i_reserved_meta_blocks = 0;
1878 release = to_free + mdb_free; 1903 ei->i_da_metadata_calc_len = 0;
1879 1904 }
1880 /* update fs dirty blocks counter for truncate case */
1881 percpu_counter_sub(&sbi->s_dirtyblocks_counter, release);
1882 1905
1883 /* update per-inode reservations */ 1906 /* update fs dirty blocks counter */
1884 BUG_ON(to_free > EXT4_I(inode)->i_reserved_data_blocks); 1907 percpu_counter_sub(&sbi->s_dirtyblocks_counter, to_free);
1885 EXT4_I(inode)->i_reserved_data_blocks -= to_free;
1886 1908
1887 BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
1888 EXT4_I(inode)->i_reserved_meta_blocks = mdb;
1889 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1909 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1890 1910
1891 vfs_dq_release_reservation_block(inode, release); 1911 vfs_dq_release_reservation_block(inode, to_free);
1892} 1912}
1893 1913
1894static void ext4_da_page_release_reservation(struct page *page, 1914static void ext4_da_page_release_reservation(struct page *page,
@@ -2494,7 +2514,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
2494 * XXX: __block_prepare_write() unmaps passed block, 2514 * XXX: __block_prepare_write() unmaps passed block,
2495 * is it OK? 2515 * is it OK?
2496 */ 2516 */
2497 ret = ext4_da_reserve_space(inode, 1); 2517 ret = ext4_da_reserve_space(inode, iblock);
2498 if (ret) 2518 if (ret)
2499 /* not enough space to reserve */ 2519 /* not enough space to reserve */
2500 return ret; 2520 return ret;
@@ -2968,8 +2988,7 @@ retry:
2968out_writepages: 2988out_writepages:
2969 if (!no_nrwrite_index_update) 2989 if (!no_nrwrite_index_update)
2970 wbc->no_nrwrite_index_update = 0; 2990 wbc->no_nrwrite_index_update = 0;
2971 if (wbc->nr_to_write > nr_to_writebump) 2991 wbc->nr_to_write -= nr_to_writebump;
2972 wbc->nr_to_write -= nr_to_writebump;
2973 wbc->range_start = range_start; 2992 wbc->range_start = range_start;
2974 trace_ext4_da_writepages_result(inode, wbc, ret, pages_written); 2993 trace_ext4_da_writepages_result(inode, wbc, ret, pages_written);
2975 return ret; 2994 return ret;
@@ -2994,11 +3013,18 @@ static int ext4_nonda_switch(struct super_block *sb)
2994 if (2 * free_blocks < 3 * dirty_blocks || 3013 if (2 * free_blocks < 3 * dirty_blocks ||
2995 free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) { 3014 free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) {
2996 /* 3015 /*
2997 * free block count is less that 150% of dirty blocks 3016 * free block count is less than 150% of dirty blocks
2998 * or free blocks is less that watermark 3017 * or free blocks is less than watermark
2999 */ 3018 */
3000 return 1; 3019 return 1;
3001 } 3020 }
3021 /*
3022 * Even if we don't switch but are nearing capacity,
3023 * start pushing delalloc when 1/2 of free blocks are dirty.
3024 */
3025 if (free_blocks < 2 * dirty_blocks)
3026 writeback_inodes_sb_if_idle(sb);
3027
3002 return 0; 3028 return 0;
3003} 3029}
3004 3030
@@ -4794,6 +4820,9 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4794 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32; 4820 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
4795 inode->i_size = ext4_isize(raw_inode); 4821 inode->i_size = ext4_isize(raw_inode);
4796 ei->i_disksize = inode->i_size; 4822 ei->i_disksize = inode->i_size;
4823#ifdef CONFIG_QUOTA
4824 ei->i_reserved_quota = 0;
4825#endif
4797 inode->i_generation = le32_to_cpu(raw_inode->i_generation); 4826 inode->i_generation = le32_to_cpu(raw_inode->i_generation);
4798 ei->i_block_group = iloc.block_group; 4827 ei->i_block_group = iloc.block_group;
4799 ei->i_last_alloc_group = ~0; 4828 ei->i_last_alloc_group = ~0;
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index b1fd3daadc9c..d34afad3e137 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2755,12 +2755,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2755 if (!(ac->ac_flags & EXT4_MB_DELALLOC_RESERVED)) 2755 if (!(ac->ac_flags & EXT4_MB_DELALLOC_RESERVED))
2756 /* release all the reserved blocks if non delalloc */ 2756 /* release all the reserved blocks if non delalloc */
2757 percpu_counter_sub(&sbi->s_dirtyblocks_counter, reserv_blks); 2757 percpu_counter_sub(&sbi->s_dirtyblocks_counter, reserv_blks);
2758 else {
2759 percpu_counter_sub(&sbi->s_dirtyblocks_counter,
2760 ac->ac_b_ex.fe_len);
2761 /* convert reserved quota blocks to real quota blocks */
2762 vfs_dq_claim_block(ac->ac_inode, ac->ac_b_ex.fe_len);
2763 }
2764 2758
2765 if (sbi->s_log_groups_per_flex) { 2759 if (sbi->s_log_groups_per_flex) {
2766 ext4_group_t flex_group = ext4_flex_group(sbi, 2760 ext4_group_t flex_group = ext4_flex_group(sbi,
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 0ca811061bc7..436521cae456 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -17,7 +17,6 @@
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/version.h>
21#include <linux/blkdev.h> 20#include <linux/blkdev.h>
22#include <linux/mutex.h> 21#include <linux/mutex.h>
23#include "ext4_jbd2.h" 22#include "ext4_jbd2.h"
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 827bde1f2594..735c20d5fd56 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -702,8 +702,12 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
702 ei->i_reserved_data_blocks = 0; 702 ei->i_reserved_data_blocks = 0;
703 ei->i_reserved_meta_blocks = 0; 703 ei->i_reserved_meta_blocks = 0;
704 ei->i_allocated_meta_blocks = 0; 704 ei->i_allocated_meta_blocks = 0;
705 ei->i_da_metadata_calc_len = 0;
705 ei->i_delalloc_reserved_flag = 0; 706 ei->i_delalloc_reserved_flag = 0;
706 spin_lock_init(&(ei->i_block_reservation_lock)); 707 spin_lock_init(&(ei->i_block_reservation_lock));
708#ifdef CONFIG_QUOTA
709 ei->i_reserved_quota = 0;
710#endif
707 INIT_LIST_HEAD(&ei->i_aio_dio_complete_list); 711 INIT_LIST_HEAD(&ei->i_aio_dio_complete_list);
708 ei->cur_aio_dio = NULL; 712 ei->cur_aio_dio = NULL;
709 ei->i_sync_tid = 0; 713 ei->i_sync_tid = 0;
@@ -1014,7 +1018,9 @@ static const struct dquot_operations ext4_quota_operations = {
1014 .reserve_space = dquot_reserve_space, 1018 .reserve_space = dquot_reserve_space,
1015 .claim_space = dquot_claim_space, 1019 .claim_space = dquot_claim_space,
1016 .release_rsv = dquot_release_reserved_space, 1020 .release_rsv = dquot_release_reserved_space,
1021#ifdef CONFIG_QUOTA
1017 .get_reserved_space = ext4_get_reserved_space, 1022 .get_reserved_space = ext4_get_reserved_space,
1023#endif
1018 .alloc_inode = dquot_alloc_inode, 1024 .alloc_inode = dquot_alloc_inode,
1019 .free_space = dquot_free_space, 1025 .free_space = dquot_free_space,
1020 .free_inode = dquot_free_inode, 1026 .free_inode = dquot_free_inode,
@@ -2169,9 +2175,9 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a,
2169 struct super_block *sb = sbi->s_buddy_cache->i_sb; 2175 struct super_block *sb = sbi->s_buddy_cache->i_sb;
2170 2176
2171 return snprintf(buf, PAGE_SIZE, "%llu\n", 2177 return snprintf(buf, PAGE_SIZE, "%llu\n",
2172 sbi->s_kbytes_written + 2178 (unsigned long long)(sbi->s_kbytes_written +
2173 ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - 2179 ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) -
2174 EXT4_SB(sb)->s_sectors_written_start) >> 1)); 2180 EXT4_SB(sb)->s_sectors_written_start) >> 1)));
2175} 2181}
2176 2182
2177static ssize_t inode_readahead_blks_store(struct ext4_attr *a, 2183static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
@@ -4000,6 +4006,7 @@ static inline void unregister_as_ext2(void)
4000{ 4006{
4001 unregister_filesystem(&ext2_fs_type); 4007 unregister_filesystem(&ext2_fs_type);
4002} 4008}
4009MODULE_ALIAS("ext2");
4003#else 4010#else
4004static inline void register_as_ext2(void) { } 4011static inline void register_as_ext2(void) { }
4005static inline void unregister_as_ext2(void) { } 4012static inline void unregister_as_ext2(void) { }
@@ -4026,6 +4033,7 @@ static inline void unregister_as_ext3(void)
4026{ 4033{
4027 unregister_filesystem(&ext3_fs_type); 4034 unregister_filesystem(&ext3_fs_type);
4028} 4035}
4036MODULE_ALIAS("ext3");
4029#else 4037#else
4030static inline void register_as_ext3(void) { } 4038static inline void register_as_ext3(void) { }
4031static inline void unregister_as_ext3(void) { } 4039static inline void unregister_as_ext3(void) { }
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 83218bebbc7c..f3a2f7ed45aa 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1332,6 +1332,8 @@ retry:
1332 goto cleanup; 1332 goto cleanup;
1333 kfree(b_entry_name); 1333 kfree(b_entry_name);
1334 kfree(buffer); 1334 kfree(buffer);
1335 b_entry_name = NULL;
1336 buffer = NULL;
1335 brelse(is->iloc.bh); 1337 brelse(is->iloc.bh);
1336 kfree(is); 1338 kfree(is);
1337 kfree(bs); 1339 kfree(bs);
diff --git a/fs/file_table.c b/fs/file_table.c
index 0afacf654398..69652c5bd5f0 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -186,10 +186,8 @@ struct file *alloc_file(struct path *path, fmode_t mode,
186 * that we can do debugging checks at __fput() 186 * that we can do debugging checks at __fput()
187 */ 187 */
188 if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { 188 if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) {
189 int error = 0;
190 file_take_write(file); 189 file_take_write(file);
191 error = mnt_clone_write(path->mnt); 190 WARN_ON(mnt_clone_write(path->mnt));
192 WARN_ON(error);
193 } 191 }
194 ima_counts_get(file); 192 ima_counts_get(file);
195 return file; 193 return file;
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 49bc1b8e8f19..1a7c42c64ff4 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -242,6 +242,7 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
242/** 242/**
243 * bdi_start_writeback - start writeback 243 * bdi_start_writeback - start writeback
244 * @bdi: the backing device to write from 244 * @bdi: the backing device to write from
245 * @sb: write inodes from this super_block
245 * @nr_pages: the number of pages to write 246 * @nr_pages: the number of pages to write
246 * 247 *
247 * Description: 248 * Description:
@@ -1187,6 +1188,23 @@ void writeback_inodes_sb(struct super_block *sb)
1187EXPORT_SYMBOL(writeback_inodes_sb); 1188EXPORT_SYMBOL(writeback_inodes_sb);
1188 1189
1189/** 1190/**
1191 * writeback_inodes_sb_if_idle - start writeback if none underway
1192 * @sb: the superblock
1193 *
1194 * Invoke writeback_inodes_sb if no writeback is currently underway.
1195 * Returns 1 if writeback was started, 0 if not.
1196 */
1197int writeback_inodes_sb_if_idle(struct super_block *sb)
1198{
1199 if (!writeback_in_progress(sb->s_bdi)) {
1200 writeback_inodes_sb(sb);
1201 return 1;
1202 } else
1203 return 0;
1204}
1205EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
1206
1207/**
1190 * sync_inodes_sb - sync sb inode pages 1208 * sync_inodes_sb - sync sb inode pages
1191 * @sb: the superblock 1209 * @sb: the superblock
1192 * 1210 *
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig
index b192c661caa6..4dcddf83326f 100644
--- a/fs/gfs2/Kconfig
+++ b/fs/gfs2/Kconfig
@@ -10,7 +10,6 @@ config GFS2_FS
10 select SLOW_WORK 10 select SLOW_WORK
11 select QUOTA 11 select QUOTA
12 select QUOTACTL 12 select QUOTACTL
13 select FS_JOURNAL_INFO
14 help 13 help
15 A cluster filesystem. 14 A cluster filesystem.
16 15
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 4eb308aa3234..a6abbae8a278 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -569,6 +569,40 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
569 return ret; 569 return ret;
570} 570}
571 571
572/**
573 * gfs2_file_aio_write - Perform a write to a file
574 * @iocb: The io context
575 * @iov: The data to write
576 * @nr_segs: Number of @iov segments
577 * @pos: The file position
578 *
579 * We have to do a lock/unlock here to refresh the inode size for
580 * O_APPEND writes, otherwise we can land up writing at the wrong
581 * offset. There is still a race, but provided the app is using its
582 * own file locking, this will make O_APPEND work as expected.
583 *
584 */
585
586static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
587 unsigned long nr_segs, loff_t pos)
588{
589 struct file *file = iocb->ki_filp;
590
591 if (file->f_flags & O_APPEND) {
592 struct dentry *dentry = file->f_dentry;
593 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
594 struct gfs2_holder gh;
595 int ret;
596
597 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
598 if (ret)
599 return ret;
600 gfs2_glock_dq_uninit(&gh);
601 }
602
603 return generic_file_aio_write(iocb, iov, nr_segs, pos);
604}
605
572#ifdef CONFIG_GFS2_FS_LOCKING_DLM 606#ifdef CONFIG_GFS2_FS_LOCKING_DLM
573 607
574/** 608/**
@@ -711,7 +745,7 @@ const struct file_operations gfs2_file_fops = {
711 .read = do_sync_read, 745 .read = do_sync_read,
712 .aio_read = generic_file_aio_read, 746 .aio_read = generic_file_aio_read,
713 .write = do_sync_write, 747 .write = do_sync_write,
714 .aio_write = generic_file_aio_write, 748 .aio_write = gfs2_file_aio_write,
715 .unlocked_ioctl = gfs2_ioctl, 749 .unlocked_ioctl = gfs2_ioctl,
716 .mmap = gfs2_mmap, 750 .mmap = gfs2_mmap,
717 .open = gfs2_open, 751 .open = gfs2_open,
@@ -741,7 +775,7 @@ const struct file_operations gfs2_file_fops_nolock = {
741 .read = do_sync_read, 775 .read = do_sync_read,
742 .aio_read = generic_file_aio_read, 776 .aio_read = generic_file_aio_read,
743 .write = do_sync_write, 777 .write = do_sync_write,
744 .aio_write = generic_file_aio_write, 778 .aio_write = gfs2_file_aio_write,
745 .unlocked_ioctl = gfs2_ioctl, 779 .unlocked_ioctl = gfs2_ioctl,
746 .mmap = gfs2_mmap, 780 .mmap = gfs2_mmap,
747 .open = gfs2_open, 781 .open = gfs2_open,
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 3ff32fa793da..6e220f4eee7d 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -125,7 +125,7 @@ static struct inode *gfs2_iget_skip(struct super_block *sb,
125 * directory entry when gfs2_inode_lookup() is invoked. Part of the code 125 * directory entry when gfs2_inode_lookup() is invoked. Part of the code
126 * segment inside gfs2_inode_lookup code needs to get moved around. 126 * segment inside gfs2_inode_lookup code needs to get moved around.
127 * 127 *
128 * Clean up I_LOCK and I_NEW as well. 128 * Clears I_NEW as well.
129 **/ 129 **/
130 130
131void gfs2_set_iop(struct inode *inode) 131void gfs2_set_iop(struct inode *inode)
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index cb8d7a93d5ec..6f68a5f18eb8 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -121,7 +121,7 @@ struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp)
121 if (aspace) { 121 if (aspace) {
122 mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); 122 mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS);
123 aspace->i_mapping->a_ops = &aspace_aops; 123 aspace->i_mapping->a_ops = &aspace_aops;
124 aspace->i_size = ~0ULL; 124 aspace->i_size = MAX_LFS_FILESIZE;
125 ip = GFS2_I(aspace); 125 ip = GFS2_I(aspace);
126 clear_bit(GIF_USER, &ip->i_flags); 126 clear_bit(GIF_USER, &ip->i_flags);
127 insert_inode_hash(aspace); 127 insert_inode_hash(aspace);
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 247436c10deb..78f73ca1ef3e 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -748,7 +748,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
748 struct gfs2_rgrpd *nrgd; 748 struct gfs2_rgrpd *nrgd;
749 unsigned int num_gh; 749 unsigned int num_gh;
750 int dir_rename = 0; 750 int dir_rename = 0;
751 int alloc_required; 751 int alloc_required = 0;
752 unsigned int x; 752 unsigned int x;
753 int error; 753 int error;
754 754
@@ -867,7 +867,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
867 goto out_gunlock; 867 goto out_gunlock;
868 } 868 }
869 869
870 alloc_required = error = gfs2_diradd_alloc_required(ndir, &ndentry->d_name); 870 if (nip == NULL)
871 alloc_required = gfs2_diradd_alloc_required(ndir, &ndentry->d_name);
872 error = alloc_required;
871 if (error < 0) 873 if (error < 0)
872 goto out_gunlock; 874 goto out_gunlock;
873 error = 0; 875 error = 0;
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 8a04108e0c22..c2ebdf2c01d4 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -1296,6 +1296,7 @@ fail:
1296 1296
1297int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) 1297int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data)
1298{ 1298{
1299 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1299 struct gfs2_ea_location el; 1300 struct gfs2_ea_location el;
1300 struct buffer_head *dibh; 1301 struct buffer_head *dibh;
1301 int error; 1302 int error;
@@ -1305,16 +1306,17 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data)
1305 return error; 1306 return error;
1306 1307
1307 if (GFS2_EA_IS_STUFFED(el.el_ea)) { 1308 if (GFS2_EA_IS_STUFFED(el.el_ea)) {
1308 error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0); 1309 error = gfs2_trans_begin(sdp, RES_DINODE + RES_EATTR, 0);
1309 if (error) 1310 if (error == 0) {
1310 return error; 1311 gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1);
1311 1312 memcpy(GFS2_EA2DATA(el.el_ea), data,
1312 gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); 1313 GFS2_EA_DATA_LEN(el.el_ea));
1313 memcpy(GFS2_EA2DATA(el.el_ea), data, 1314 }
1314 GFS2_EA_DATA_LEN(el.el_ea)); 1315 } else {
1315 } else
1316 error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); 1316 error = ea_acl_chmod_unstuffed(ip, el.el_ea, data);
1317 }
1317 1318
1319 brelse(el.el_bh);
1318 if (error) 1320 if (error)
1319 return error; 1321 return error;
1320 1322
@@ -1327,8 +1329,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data)
1327 brelse(dibh); 1329 brelse(dibh);
1328 } 1330 }
1329 1331
1330 gfs2_trans_end(GFS2_SB(&ip->i_inode)); 1332 gfs2_trans_end(sdp);
1331
1332 return error; 1333 return error;
1333} 1334}
1334 1335
diff --git a/fs/inode.c b/fs/inode.c
index 06c1f02de611..03dfeb2e3928 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -113,7 +113,7 @@ static void wake_up_inode(struct inode *inode)
113 * Prevent speculative execution through spin_unlock(&inode_lock); 113 * Prevent speculative execution through spin_unlock(&inode_lock);
114 */ 114 */
115 smp_mb(); 115 smp_mb();
116 wake_up_bit(&inode->i_state, __I_LOCK); 116 wake_up_bit(&inode->i_state, __I_NEW);
117} 117}
118 118
119/** 119/**
@@ -690,17 +690,17 @@ void unlock_new_inode(struct inode *inode)
690 } 690 }
691#endif 691#endif
692 /* 692 /*
693 * This is special! We do not need the spinlock when clearing I_LOCK, 693 * This is special! We do not need the spinlock when clearing I_NEW,
694 * because we're guaranteed that nobody else tries to do anything about 694 * because we're guaranteed that nobody else tries to do anything about
695 * the state of the inode when it is locked, as we just created it (so 695 * the state of the inode when it is locked, as we just created it (so
696 * there can be no old holders that haven't tested I_LOCK). 696 * there can be no old holders that haven't tested I_NEW).
697 * However we must emit the memory barrier so that other CPUs reliably 697 * However we must emit the memory barrier so that other CPUs reliably
698 * see the clearing of I_LOCK after the other inode initialisation has 698 * see the clearing of I_NEW after the other inode initialisation has
699 * completed. 699 * completed.
700 */ 700 */
701 smp_mb(); 701 smp_mb();
702 WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW)); 702 WARN_ON(!(inode->i_state & I_NEW));
703 inode->i_state &= ~(I_LOCK|I_NEW); 703 inode->i_state &= ~I_NEW;
704 wake_up_inode(inode); 704 wake_up_inode(inode);
705} 705}
706EXPORT_SYMBOL(unlock_new_inode); 706EXPORT_SYMBOL(unlock_new_inode);
@@ -731,7 +731,7 @@ static struct inode *get_new_inode(struct super_block *sb,
731 goto set_failed; 731 goto set_failed;
732 732
733 __inode_add_to_lists(sb, head, inode); 733 __inode_add_to_lists(sb, head, inode);
734 inode->i_state = I_LOCK|I_NEW; 734 inode->i_state = I_NEW;
735 spin_unlock(&inode_lock); 735 spin_unlock(&inode_lock);
736 736
737 /* Return the locked inode with I_NEW set, the 737 /* Return the locked inode with I_NEW set, the
@@ -778,7 +778,7 @@ static struct inode *get_new_inode_fast(struct super_block *sb,
778 if (!old) { 778 if (!old) {
779 inode->i_ino = ino; 779 inode->i_ino = ino;
780 __inode_add_to_lists(sb, head, inode); 780 __inode_add_to_lists(sb, head, inode);
781 inode->i_state = I_LOCK|I_NEW; 781 inode->i_state = I_NEW;
782 spin_unlock(&inode_lock); 782 spin_unlock(&inode_lock);
783 783
784 /* Return the locked inode with I_NEW set, the 784 /* Return the locked inode with I_NEW set, the
@@ -1083,7 +1083,7 @@ int insert_inode_locked(struct inode *inode)
1083 ino_t ino = inode->i_ino; 1083 ino_t ino = inode->i_ino;
1084 struct hlist_head *head = inode_hashtable + hash(sb, ino); 1084 struct hlist_head *head = inode_hashtable + hash(sb, ino);
1085 1085
1086 inode->i_state |= I_LOCK|I_NEW; 1086 inode->i_state |= I_NEW;
1087 while (1) { 1087 while (1) {
1088 struct hlist_node *node; 1088 struct hlist_node *node;
1089 struct inode *old = NULL; 1089 struct inode *old = NULL;
@@ -1120,7 +1120,7 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
1120 struct super_block *sb = inode->i_sb; 1120 struct super_block *sb = inode->i_sb;
1121 struct hlist_head *head = inode_hashtable + hash(sb, hashval); 1121 struct hlist_head *head = inode_hashtable + hash(sb, hashval);
1122 1122
1123 inode->i_state |= I_LOCK|I_NEW; 1123 inode->i_state |= I_NEW;
1124 1124
1125 while (1) { 1125 while (1) {
1126 struct hlist_node *node; 1126 struct hlist_node *node;
@@ -1510,7 +1510,7 @@ EXPORT_SYMBOL(inode_wait);
1510 * until the deletion _might_ have completed. Callers are responsible 1510 * until the deletion _might_ have completed. Callers are responsible
1511 * to recheck inode state. 1511 * to recheck inode state.
1512 * 1512 *
1513 * It doesn't matter if I_LOCK is not set initially, a call to 1513 * It doesn't matter if I_NEW is not set initially, a call to
1514 * wake_up_inode() after removing from the hash list will DTRT. 1514 * wake_up_inode() after removing from the hash list will DTRT.
1515 * 1515 *
1516 * This is called with inode_lock held. 1516 * This is called with inode_lock held.
@@ -1518,8 +1518,8 @@ EXPORT_SYMBOL(inode_wait);
1518static void __wait_on_freeing_inode(struct inode *inode) 1518static void __wait_on_freeing_inode(struct inode *inode)
1519{ 1519{
1520 wait_queue_head_t *wq; 1520 wait_queue_head_t *wq;
1521 DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK); 1521 DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW);
1522 wq = bit_waitqueue(&inode->i_state, __I_LOCK); 1522 wq = bit_waitqueue(&inode->i_state, __I_NEW);
1523 prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); 1523 prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
1524 spin_unlock(&inode_lock); 1524 spin_unlock(&inode_lock);
1525 schedule(); 1525 schedule();
diff --git a/fs/internal.h b/fs/internal.h
index f67cd141d9a8..e96a1667d749 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -85,3 +85,10 @@ extern struct file *get_empty_filp(void);
85 * super.c 85 * super.c
86 */ 86 */
87extern int do_remount_sb(struct super_block *, int, void *, int); 87extern int do_remount_sb(struct super_block *, int, void *, int);
88
89/*
90 * open.c
91 */
92struct nameidata;
93extern struct file *nameidata_to_filp(struct nameidata *);
94extern void release_open_intent(struct nameidata *);
diff --git a/fs/jbd/Kconfig b/fs/jbd/Kconfig
index a8408983abd4..4e28beeed157 100644
--- a/fs/jbd/Kconfig
+++ b/fs/jbd/Kconfig
@@ -1,6 +1,5 @@
1config JBD 1config JBD
2 tristate 2 tristate
3 select FS_JOURNAL_INFO
4 help 3 help
5 This is a generic journalling layer for block devices. It is 4 This is a generic journalling layer for block devices. It is
6 currently used by the ext3 file system, but it could also be 5 currently used by the ext3 file system, but it could also be
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 4160afad6d00..bd224eec9b07 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1913,7 +1913,7 @@ static void __init jbd_create_debugfs_entry(void)
1913{ 1913{
1914 jbd_debugfs_dir = debugfs_create_dir("jbd", NULL); 1914 jbd_debugfs_dir = debugfs_create_dir("jbd", NULL);
1915 if (jbd_debugfs_dir) 1915 if (jbd_debugfs_dir)
1916 jbd_debug = debugfs_create_u8("jbd-debug", S_IRUGO, 1916 jbd_debug = debugfs_create_u8("jbd-debug", S_IRUGO | S_IWUSR,
1917 jbd_debugfs_dir, 1917 jbd_debugfs_dir,
1918 &journal_enable_debug); 1918 &journal_enable_debug);
1919} 1919}
diff --git a/fs/jbd2/Kconfig b/fs/jbd2/Kconfig
index 0f7d1ceafdfd..f32f346f4b0a 100644
--- a/fs/jbd2/Kconfig
+++ b/fs/jbd2/Kconfig
@@ -1,7 +1,6 @@
1config JBD2 1config JBD2
2 tristate 2 tristate
3 select CRC32 3 select CRC32
4 select FS_JOURNAL_INFO
5 help 4 help
6 This is a generic journaling layer for block devices that support 5 This is a generic journaling layer for block devices that support
7 both 32-bit and 64-bit block numbers. It is currently used by 6 both 32-bit and 64-bit block numbers. It is currently used by
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index ca0f5eb62b20..886849370950 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -22,6 +22,7 @@
22#include <linux/jbd2.h> 22#include <linux/jbd2.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/blkdev.h>
25#include <trace/events/jbd2.h> 26#include <trace/events/jbd2.h>
26 27
27/* 28/*
@@ -515,6 +516,20 @@ int jbd2_cleanup_journal_tail(journal_t *journal)
515 journal->j_tail_sequence = first_tid; 516 journal->j_tail_sequence = first_tid;
516 journal->j_tail = blocknr; 517 journal->j_tail = blocknr;
517 spin_unlock(&journal->j_state_lock); 518 spin_unlock(&journal->j_state_lock);
519
520 /*
521 * If there is an external journal, we need to make sure that
522 * any data blocks that were recently written out --- perhaps
523 * by jbd2_log_do_checkpoint() --- are flushed out before we
524 * drop the transactions from the external journal. It's
525 * unlikely this will be necessary, especially with a
526 * appropriately sized journal, but we need this to guarantee
527 * correctness. Fortunately jbd2_cleanup_journal_tail()
528 * doesn't get called all that often.
529 */
530 if ((journal->j_fs_dev != journal->j_dev) &&
531 (journal->j_flags & JBD2_BARRIER))
532 blkdev_issue_flush(journal->j_fs_dev, NULL);
518 if (!(journal->j_flags & JBD2_ABORT)) 533 if (!(journal->j_flags & JBD2_ABORT))
519 jbd2_journal_update_superblock(journal, 1); 534 jbd2_journal_update_superblock(journal, 1);
520 return 0; 535 return 0;
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 6a10238d2c63..1bc74b6f26d2 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -259,6 +259,7 @@ static int journal_submit_data_buffers(journal_t *journal,
259 ret = err; 259 ret = err;
260 spin_lock(&journal->j_list_lock); 260 spin_lock(&journal->j_list_lock);
261 J_ASSERT(jinode->i_transaction == commit_transaction); 261 J_ASSERT(jinode->i_transaction == commit_transaction);
262 commit_transaction->t_flushed_data_blocks = 1;
262 jinode->i_flags &= ~JI_COMMIT_RUNNING; 263 jinode->i_flags &= ~JI_COMMIT_RUNNING;
263 wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING); 264 wake_up_bit(&jinode->i_flags, __JI_COMMIT_RUNNING);
264 } 265 }
@@ -708,8 +709,17 @@ start_journal_io:
708 } 709 }
709 } 710 }
710 711
711 /* Done it all: now write the commit record asynchronously. */ 712 /*
713 * If the journal is not located on the file system device,
714 * then we must flush the file system device before we issue
715 * the commit record
716 */
717 if (commit_transaction->t_flushed_data_blocks &&
718 (journal->j_fs_dev != journal->j_dev) &&
719 (journal->j_flags & JBD2_BARRIER))
720 blkdev_issue_flush(journal->j_fs_dev, NULL);
712 721
722 /* Done it all: now write the commit record asynchronously. */
713 if (JBD2_HAS_INCOMPAT_FEATURE(journal, 723 if (JBD2_HAS_INCOMPAT_FEATURE(journal,
714 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) { 724 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
715 err = journal_submit_commit_record(journal, commit_transaction, 725 err = journal_submit_commit_record(journal, commit_transaction,
@@ -720,13 +730,6 @@ start_journal_io:
720 blkdev_issue_flush(journal->j_dev, NULL); 730 blkdev_issue_flush(journal->j_dev, NULL);
721 } 731 }
722 732
723 /*
724 * This is the right place to wait for data buffers both for ASYNC
725 * and !ASYNC commit. If commit is ASYNC, we need to wait only after
726 * the commit block went to disk (which happens above). If commit is
727 * SYNC, we need to wait for data buffers before we start writing
728 * commit block, which happens below in such setting.
729 */
730 err = journal_finish_inode_data_buffers(journal, commit_transaction); 733 err = journal_finish_inode_data_buffers(journal, commit_transaction);
731 if (err) { 734 if (err) {
732 printk(KERN_WARNING 735 printk(KERN_WARNING
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index b7ca3a92a4db..ac0d027595d0 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -814,7 +814,7 @@ static journal_t * journal_init_common (void)
814 journal_t *journal; 814 journal_t *journal;
815 int err; 815 int err;
816 816
817 journal = kzalloc(sizeof(*journal), GFP_KERNEL|__GFP_NOFAIL); 817 journal = kzalloc(sizeof(*journal), GFP_KERNEL);
818 if (!journal) 818 if (!journal)
819 goto fail; 819 goto fail;
820 820
@@ -2115,7 +2115,8 @@ static void __init jbd2_create_debugfs_entry(void)
2115{ 2115{
2116 jbd2_debugfs_dir = debugfs_create_dir("jbd2", NULL); 2116 jbd2_debugfs_dir = debugfs_create_dir("jbd2", NULL);
2117 if (jbd2_debugfs_dir) 2117 if (jbd2_debugfs_dir)
2118 jbd2_debug = debugfs_create_u8(JBD2_DEBUG_NAME, S_IRUGO, 2118 jbd2_debug = debugfs_create_u8(JBD2_DEBUG_NAME,
2119 S_IRUGO | S_IWUSR,
2119 jbd2_debugfs_dir, 2120 jbd2_debugfs_dir,
2120 &jbd2_journal_enable_debug); 2121 &jbd2_journal_enable_debug);
2121} 2122}
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index f26e4d03ada5..d945ea76b445 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1292,7 +1292,7 @@ int txCommit(tid_t tid, /* transaction identifier */
1292 */ 1292 */
1293 /* 1293 /*
1294 * I believe this code is no longer needed. Splitting I_LOCK 1294 * I believe this code is no longer needed. Splitting I_LOCK
1295 * into two bits, I_LOCK and I_SYNC should prevent this 1295 * into two bits, I_NEW and I_SYNC should prevent this
1296 * deadlock as well. But since I don't have a JFS testload 1296 * deadlock as well. But since I don't have a JFS testload
1297 * to verify this, only a trivial s/I_LOCK/I_SYNC/ was done. 1297 * to verify this, only a trivial s/I_LOCK/I_SYNC/ was done.
1298 * Joern 1298 * Joern
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 2234c73fc577..d929a822a74e 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -524,7 +524,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
524 * Page cache is indexed by long. 524 * Page cache is indexed by long.
525 * I would use MAX_LFS_FILESIZE, but it's only half as big 525 * I would use MAX_LFS_FILESIZE, but it's only half as big
526 */ 526 */
527 sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, sb->s_maxbytes); 527 sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes);
528#endif 528#endif
529 sb->s_time_gran = 1; 529 sb->s_time_gran = 1;
530 return 0; 530 return 0;
diff --git a/fs/namei.c b/fs/namei.c
index d2783c8a770b..b55440baf7ab 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -37,8 +37,6 @@
37 37
38#include "internal.h" 38#include "internal.h"
39 39
40#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
41
42/* [Feb-1997 T. Schoebel-Theuer] 40/* [Feb-1997 T. Schoebel-Theuer]
43 * Fundamental changes in the pathname lookup mechanisms (namei) 41 * Fundamental changes in the pathname lookup mechanisms (namei)
44 * were necessary because of omirr. The reason is that omirr needs 42 * were necessary because of omirr. The reason is that omirr needs
@@ -234,6 +232,7 @@ int generic_permission(struct inode *inode, int mask,
234 /* 232 /*
235 * Searching includes executable on directories, else just read. 233 * Searching includes executable on directories, else just read.
236 */ 234 */
235 mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
237 if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE))) 236 if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE)))
238 if (capable(CAP_DAC_READ_SEARCH)) 237 if (capable(CAP_DAC_READ_SEARCH))
239 return 0; 238 return 0;
@@ -1640,6 +1639,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
1640 if (filp == NULL) 1639 if (filp == NULL)
1641 return ERR_PTR(-ENFILE); 1640 return ERR_PTR(-ENFILE);
1642 nd.intent.open.file = filp; 1641 nd.intent.open.file = filp;
1642 filp->f_flags = open_flag;
1643 nd.intent.open.flags = flag; 1643 nd.intent.open.flags = flag;
1644 nd.intent.open.create_mode = 0; 1644 nd.intent.open.create_mode = 0;
1645 error = do_path_lookup(dfd, pathname, 1645 error = do_path_lookup(dfd, pathname,
@@ -1685,6 +1685,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
1685 if (filp == NULL) 1685 if (filp == NULL)
1686 goto exit_parent; 1686 goto exit_parent;
1687 nd.intent.open.file = filp; 1687 nd.intent.open.file = filp;
1688 filp->f_flags = open_flag;
1688 nd.intent.open.flags = flag; 1689 nd.intent.open.flags = flag;
1689 nd.intent.open.create_mode = mode; 1690 nd.intent.open.create_mode = mode;
1690 dir = nd.path.dentry; 1691 dir = nd.path.dentry;
@@ -1725,7 +1726,7 @@ do_last:
1725 mnt_drop_write(nd.path.mnt); 1726 mnt_drop_write(nd.path.mnt);
1726 goto exit; 1727 goto exit;
1727 } 1728 }
1728 filp = nameidata_to_filp(&nd, open_flag); 1729 filp = nameidata_to_filp(&nd);
1729 mnt_drop_write(nd.path.mnt); 1730 mnt_drop_write(nd.path.mnt);
1730 if (nd.root.mnt) 1731 if (nd.root.mnt)
1731 path_put(&nd.root); 1732 path_put(&nd.root);
@@ -1764,7 +1765,7 @@ do_last:
1764 1765
1765 path_to_nameidata(&path, &nd); 1766 path_to_nameidata(&path, &nd);
1766 error = -EISDIR; 1767 error = -EISDIR;
1767 if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode)) 1768 if (S_ISDIR(path.dentry->d_inode->i_mode))
1768 goto exit; 1769 goto exit;
1769ok: 1770ok:
1770 /* 1771 /*
@@ -1789,7 +1790,7 @@ ok:
1789 mnt_drop_write(nd.path.mnt); 1790 mnt_drop_write(nd.path.mnt);
1790 goto exit; 1791 goto exit;
1791 } 1792 }
1792 filp = nameidata_to_filp(&nd, open_flag); 1793 filp = nameidata_to_filp(&nd);
1793 if (!IS_ERR(filp)) { 1794 if (!IS_ERR(filp)) {
1794 error = ima_path_check(&filp->f_path, filp->f_mode & 1795 error = ima_path_check(&filp->f_path, filp->f_mode &
1795 (MAY_READ | MAY_WRITE | MAY_EXEC)); 1796 (MAY_READ | MAY_WRITE | MAY_EXEC));
diff --git a/fs/namespace.c b/fs/namespace.c
index faab1273281e..7d70d63ceb29 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2068,7 +2068,7 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
2068 * create_mnt_ns - creates a private namespace and adds a root filesystem 2068 * create_mnt_ns - creates a private namespace and adds a root filesystem
2069 * @mnt: pointer to the new root filesystem mountpoint 2069 * @mnt: pointer to the new root filesystem mountpoint
2070 */ 2070 */
2071static struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt) 2071struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
2072{ 2072{
2073 struct mnt_namespace *new_ns; 2073 struct mnt_namespace *new_ns;
2074 2074
@@ -2080,6 +2080,7 @@ static struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt)
2080 } 2080 }
2081 return new_ns; 2081 return new_ns;
2082} 2082}
2083EXPORT_SYMBOL(create_mnt_ns);
2083 2084
2084SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, 2085SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
2085 char __user *, type, unsigned long, flags, void __user *, data) 2086 char __user *, type, unsigned long, flags, void __user *, data)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 2c5ace4f00a7..3c7f03b669fb 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1615,6 +1615,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1615 goto out; 1615 goto out;
1616 1616
1617 new_dentry = dentry; 1617 new_dentry = dentry;
1618 rehash = NULL;
1618 new_inode = NULL; 1619 new_inode = NULL;
1619 } 1620 }
1620 } 1621 }
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d5b112bcf3de..ce907efc5508 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2648,13 +2648,21 @@ out_freepage:
2648static int nfs_follow_remote_path(struct vfsmount *root_mnt, 2648static int nfs_follow_remote_path(struct vfsmount *root_mnt,
2649 const char *export_path, struct vfsmount *mnt_target) 2649 const char *export_path, struct vfsmount *mnt_target)
2650{ 2650{
2651 struct mnt_namespace *ns_private;
2651 struct nameidata nd; 2652 struct nameidata nd;
2652 struct super_block *s; 2653 struct super_block *s;
2653 int ret; 2654 int ret;
2654 2655
2656 ns_private = create_mnt_ns(root_mnt);
2657 ret = PTR_ERR(ns_private);
2658 if (IS_ERR(ns_private))
2659 goto out_mntput;
2660
2655 ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt, 2661 ret = vfs_path_lookup(root_mnt->mnt_root, root_mnt,
2656 export_path, LOOKUP_FOLLOW, &nd); 2662 export_path, LOOKUP_FOLLOW, &nd);
2657 2663
2664 put_mnt_ns(ns_private);
2665
2658 if (ret != 0) 2666 if (ret != 0)
2659 goto out_err; 2667 goto out_err;
2660 2668
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 1c12177b908c..55c8e63af0be 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -89,7 +89,7 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
89 int flags = nfsexp_flags(rqstp, exp); 89 int flags = nfsexp_flags(rqstp, exp);
90 90
91 /* Check if the request originated from a secure port. */ 91 /* Check if the request originated from a secure port. */
92 if (!rqstp->rq_secure && (flags & NFSEXP_INSECURE_PORT)) { 92 if (!rqstp->rq_secure && !(flags & NFSEXP_INSECURE_PORT)) {
93 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); 93 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
94 dprintk(KERN_WARNING 94 dprintk(KERN_WARNING
95 "nfsd: request from insecure port %s!\n", 95 "nfsd: request from insecure port %s!\n",
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7c2e337d05af..c194793b642b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -780,12 +780,9 @@ static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
780 int (*fsync) (struct file *, struct dentry *, int); 780 int (*fsync) (struct file *, struct dentry *, int);
781 int err; 781 int err;
782 782
783 err = filemap_fdatawrite(inode->i_mapping); 783 err = filemap_write_and_wait(inode->i_mapping);
784 if (err == 0 && fop && (fsync = fop->fsync)) 784 if (err == 0 && fop && (fsync = fop->fsync))
785 err = fsync(filp, dp, 0); 785 err = fsync(filp, dp, 0);
786 if (err == 0)
787 err = filemap_fdatawait(inode->i_mapping);
788
789 return err; 786 return err;
790} 787}
791 788
diff --git a/fs/nilfs2/Kconfig b/fs/nilfs2/Kconfig
index 1225af7b2166..251da07b2a1d 100644
--- a/fs/nilfs2/Kconfig
+++ b/fs/nilfs2/Kconfig
@@ -2,7 +2,6 @@ config NILFS2_FS
2 tristate "NILFS2 file system support (EXPERIMENTAL)" 2 tristate "NILFS2 file system support (EXPERIMENTAL)"
3 depends on EXPERIMENTAL 3 depends on EXPERIMENTAL
4 select CRC32 4 select CRC32
5 select FS_JOURNAL_INFO
6 help 5 help
7 NILFS2 is a log-structured file system (LFS) supporting continuous 6 NILFS2 is a log-structured file system (LFS) supporting continuous
8 snapshotting. In addition to versioning capability of the entire 7 snapshotting. In addition to versioning capability of the entire
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c
index f4a14ea2ed9c..effdbdbe6c11 100644
--- a/fs/nilfs2/bmap.c
+++ b/fs/nilfs2/bmap.c
@@ -417,8 +417,8 @@ __u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *bmap,
417 417
418 key = page_index(bh->b_page) << (PAGE_CACHE_SHIFT - 418 key = page_index(bh->b_page) << (PAGE_CACHE_SHIFT -
419 bmap->b_inode->i_blkbits); 419 bmap->b_inode->i_blkbits);
420 for (pbh = page_buffers(bh->b_page); pbh != bh; 420 for (pbh = page_buffers(bh->b_page); pbh != bh; pbh = pbh->b_this_page)
421 pbh = pbh->b_this_page, key++); 421 key++;
422 422
423 return key; 423 return key;
424} 424}
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
index d5ad54e204a5..18737818db63 100644
--- a/fs/nilfs2/cpfile.c
+++ b/fs/nilfs2/cpfile.c
@@ -328,19 +328,24 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
328 tnicps += nicps; 328 tnicps += nicps;
329 nilfs_mdt_mark_buffer_dirty(cp_bh); 329 nilfs_mdt_mark_buffer_dirty(cp_bh);
330 nilfs_mdt_mark_dirty(cpfile); 330 nilfs_mdt_mark_dirty(cpfile);
331 if (!nilfs_cpfile_is_in_first(cpfile, cno) && 331 if (!nilfs_cpfile_is_in_first(cpfile, cno)) {
332 (count = nilfs_cpfile_block_sub_valid_checkpoints( 332 count =
333 cpfile, cp_bh, kaddr, nicps)) == 0) { 333 nilfs_cpfile_block_sub_valid_checkpoints(
334 /* make hole */ 334 cpfile, cp_bh, kaddr, nicps);
335 kunmap_atomic(kaddr, KM_USER0); 335 if (count == 0) {
336 brelse(cp_bh); 336 /* make hole */
337 ret = nilfs_cpfile_delete_checkpoint_block( 337 kunmap_atomic(kaddr, KM_USER0);
338 cpfile, cno); 338 brelse(cp_bh);
339 if (ret == 0) 339 ret =
340 continue; 340 nilfs_cpfile_delete_checkpoint_block(
341 printk(KERN_ERR "%s: cannot delete block\n", 341 cpfile, cno);
342 __func__); 342 if (ret == 0)
343 break; 343 continue;
344 printk(KERN_ERR
345 "%s: cannot delete block\n",
346 __func__);
347 break;
348 }
344 } 349 }
345 } 350 }
346 351
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c
index d369ac718277..236753df5cdf 100644
--- a/fs/nilfs2/direct.c
+++ b/fs/nilfs2/direct.c
@@ -51,11 +51,11 @@ static int nilfs_direct_lookup(const struct nilfs_bmap *bmap,
51 struct nilfs_direct *direct; 51 struct nilfs_direct *direct;
52 __u64 ptr; 52 __u64 ptr;
53 53
54 direct = (struct nilfs_direct *)bmap; 54 direct = (struct nilfs_direct *)bmap; /* XXX: use macro for level 1 */
55 if ((key > NILFS_DIRECT_KEY_MAX) || 55 if (key > NILFS_DIRECT_KEY_MAX || level != 1)
56 (level != 1) || /* XXX: use macro for level 1 */ 56 return -ENOENT;
57 ((ptr = nilfs_direct_get_ptr(direct, key)) == 57 ptr = nilfs_direct_get_ptr(direct, key);
58 NILFS_BMAP_INVALID_PTR)) 58 if (ptr == NILFS_BMAP_INVALID_PTR)
59 return -ENOENT; 59 return -ENOENT;
60 60
61 if (ptrp != NULL) 61 if (ptrp != NULL)
@@ -73,9 +73,10 @@ static int nilfs_direct_lookup_contig(const struct nilfs_bmap *bmap,
73 sector_t blocknr; 73 sector_t blocknr;
74 int ret, cnt; 74 int ret, cnt;
75 75
76 if (key > NILFS_DIRECT_KEY_MAX || 76 if (key > NILFS_DIRECT_KEY_MAX)
77 (ptr = nilfs_direct_get_ptr(direct, key)) == 77 return -ENOENT;
78 NILFS_BMAP_INVALID_PTR) 78 ptr = nilfs_direct_get_ptr(direct, key);
79 if (ptr == NILFS_BMAP_INVALID_PTR)
79 return -ENOENT; 80 return -ENOENT;
80 81
81 if (NILFS_BMAP_USE_VBN(bmap)) { 82 if (NILFS_BMAP_USE_VBN(bmap)) {
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index f6af76042d80..d6b2b83de363 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -480,7 +480,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
480 unsigned int cmd, void __user *argp) 480 unsigned int cmd, void __user *argp)
481{ 481{
482 struct nilfs_argv argv[5]; 482 struct nilfs_argv argv[5];
483 const static size_t argsz[5] = { 483 static const size_t argsz[5] = {
484 sizeof(struct nilfs_vdesc), 484 sizeof(struct nilfs_vdesc),
485 sizeof(struct nilfs_period), 485 sizeof(struct nilfs_period),
486 sizeof(__u64), 486 sizeof(__u64),
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 9938034762cc..dc2505abb6d7 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -530,7 +530,7 @@ err_corrupt_attr:
530 * the ntfs inode. 530 * the ntfs inode.
531 * 531 *
532 * Q: What locks are held when the function is called? 532 * Q: What locks are held when the function is called?
533 * A: i_state has I_LOCK set, hence the inode is locked, also 533 * A: i_state has I_NEW set, hence the inode is locked, also
534 * i_count is set to 1, so it is not going to go away 534 * i_count is set to 1, so it is not going to go away
535 * i_flags is set to 0 and we have no business touching it. Only an ioctl() 535 * i_flags is set to 0 and we have no business touching it. Only an ioctl()
536 * is allowed to write to them. We should of course be honouring them but 536 * is allowed to write to them. We should of course be honouring them but
@@ -1207,7 +1207,7 @@ err_out:
1207 * necessary fields in @vi as well as initializing the ntfs inode. 1207 * necessary fields in @vi as well as initializing the ntfs inode.
1208 * 1208 *
1209 * Q: What locks are held when the function is called? 1209 * Q: What locks are held when the function is called?
1210 * A: i_state has I_LOCK set, hence the inode is locked, also 1210 * A: i_state has I_NEW set, hence the inode is locked, also
1211 * i_count is set to 1, so it is not going to go away 1211 * i_count is set to 1, so it is not going to go away
1212 * 1212 *
1213 * Return 0 on success and -errno on error. In the error case, the inode will 1213 * Return 0 on success and -errno on error. In the error case, the inode will
@@ -1474,7 +1474,7 @@ err_out:
1474 * normal directory inodes. 1474 * normal directory inodes.
1475 * 1475 *
1476 * Q: What locks are held when the function is called? 1476 * Q: What locks are held when the function is called?
1477 * A: i_state has I_LOCK set, hence the inode is locked, also 1477 * A: i_state has I_NEW set, hence the inode is locked, also
1478 * i_count is set to 1, so it is not going to go away 1478 * i_count is set to 1, so it is not going to go away
1479 * 1479 *
1480 * Return 0 on success and -errno on error. In the error case, the inode will 1480 * Return 0 on success and -errno on error. In the error case, the inode will
diff --git a/fs/ocfs2/Kconfig b/fs/ocfs2/Kconfig
index 701b7a3a872e..0d840669698e 100644
--- a/fs/ocfs2/Kconfig
+++ b/fs/ocfs2/Kconfig
@@ -6,6 +6,7 @@ config OCFS2_FS
6 select CRC32 6 select CRC32
7 select QUOTA 7 select QUOTA
8 select QUOTA_TREE 8 select QUOTA_TREE
9 select FS_POSIX_ACL
9 help 10 help
10 OCFS2 is a general purpose extent based shared disk cluster file 11 OCFS2 is a general purpose extent based shared disk cluster file
11 system with many similarities to ext3. It supports 64 bit inode 12 system with many similarities to ext3. It supports 64 bit inode
@@ -74,12 +75,3 @@ config OCFS2_DEBUG_FS
74 This option will enable expensive consistency checks. Enable 75 This option will enable expensive consistency checks. Enable
75 this option for debugging only as it is likely to decrease 76 this option for debugging only as it is likely to decrease
76 performance of the filesystem. 77 performance of the filesystem.
77
78config OCFS2_FS_POSIX_ACL
79 bool "OCFS2 POSIX Access Control Lists"
80 depends on OCFS2_FS
81 select FS_POSIX_ACL
82 default n
83 help
84 Posix Access Control Lists (ACLs) support permissions for users and
85 groups beyond the owner/group/world scheme.
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 31f25ce32c97..600d2d2ade11 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -39,11 +39,8 @@ ocfs2-objs := \
39 ver.o \ 39 ver.o \
40 quota_local.o \ 40 quota_local.o \
41 quota_global.o \ 41 quota_global.o \
42 xattr.o 42 xattr.o \
43 43 acl.o
44ifeq ($(CONFIG_OCFS2_FS_POSIX_ACL),y)
45ocfs2-objs += acl.o
46endif
47 44
48ocfs2_stackglue-objs := stackglue.o 45ocfs2_stackglue-objs := stackglue.o
49ocfs2_stack_o2cb-objs := stack_o2cb.o 46ocfs2_stack_o2cb-objs := stack_o2cb.o
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index e3e47415d851..0501974bedd0 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -98,15 +98,11 @@ static struct posix_acl *ocfs2_get_acl_nolock(struct inode *inode,
98 int type, 98 int type,
99 struct buffer_head *di_bh) 99 struct buffer_head *di_bh)
100{ 100{
101 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
102 int name_index; 101 int name_index;
103 char *value = NULL; 102 char *value = NULL;
104 struct posix_acl *acl; 103 struct posix_acl *acl;
105 int retval; 104 int retval;
106 105
107 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
108 return NULL;
109
110 switch (type) { 106 switch (type) {
111 case ACL_TYPE_ACCESS: 107 case ACL_TYPE_ACCESS:
112 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS; 108 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
index 8f6389ed4da5..5c5d31f05853 100644
--- a/fs/ocfs2/acl.h
+++ b/fs/ocfs2/acl.h
@@ -26,8 +26,6 @@ struct ocfs2_acl_entry {
26 __le32 e_id; 26 __le32 e_id;
27}; 27};
28 28
29#ifdef CONFIG_OCFS2_FS_POSIX_ACL
30
31extern int ocfs2_check_acl(struct inode *, int); 29extern int ocfs2_check_acl(struct inode *, int);
32extern int ocfs2_acl_chmod(struct inode *); 30extern int ocfs2_acl_chmod(struct inode *);
33extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, 31extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
@@ -35,24 +33,4 @@ extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
35 struct ocfs2_alloc_context *, 33 struct ocfs2_alloc_context *,
36 struct ocfs2_alloc_context *); 34 struct ocfs2_alloc_context *);
37 35
38#else /* CONFIG_OCFS2_FS_POSIX_ACL*/
39
40#define ocfs2_check_acl NULL
41static inline int ocfs2_acl_chmod(struct inode *inode)
42{
43 return 0;
44}
45static inline int ocfs2_init_acl(handle_t *handle,
46 struct inode *inode,
47 struct inode *dir,
48 struct buffer_head *di_bh,
49 struct buffer_head *dir_bh,
50 struct ocfs2_alloc_context *meta_ac,
51 struct ocfs2_alloc_context *data_ac)
52{
53 return 0;
54}
55
56#endif /* CONFIG_OCFS2_FS_POSIX_ACL*/
57
58#endif /* OCFS2_ACL_H */ 36#endif /* OCFS2_ACL_H */
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index fb4e672579b8..d17bdc718f74 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1765,9 +1765,9 @@ set_and_inc:
1765 * 1765 *
1766 * The array index of the subtree root is passed back. 1766 * The array index of the subtree root is passed back.
1767 */ 1767 */
1768static int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et, 1768int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et,
1769 struct ocfs2_path *left, 1769 struct ocfs2_path *left,
1770 struct ocfs2_path *right) 1770 struct ocfs2_path *right)
1771{ 1771{
1772 int i = 0; 1772 int i = 0;
1773 1773
@@ -2872,8 +2872,8 @@ out:
2872 * This looks similar, but is subtly different to 2872 * This looks similar, but is subtly different to
2873 * ocfs2_find_cpos_for_left_leaf(). 2873 * ocfs2_find_cpos_for_left_leaf().
2874 */ 2874 */
2875static int ocfs2_find_cpos_for_right_leaf(struct super_block *sb, 2875int ocfs2_find_cpos_for_right_leaf(struct super_block *sb,
2876 struct ocfs2_path *path, u32 *cpos) 2876 struct ocfs2_path *path, u32 *cpos)
2877{ 2877{
2878 int i, j, ret = 0; 2878 int i, j, ret = 0;
2879 u64 blkno; 2879 u64 blkno;
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h
index 9c122d574464..1db4359ccb90 100644
--- a/fs/ocfs2/alloc.h
+++ b/fs/ocfs2/alloc.h
@@ -317,4 +317,9 @@ int ocfs2_path_bh_journal_access(handle_t *handle,
317int ocfs2_journal_access_path(struct ocfs2_caching_info *ci, 317int ocfs2_journal_access_path(struct ocfs2_caching_info *ci,
318 handle_t *handle, 318 handle_t *handle,
319 struct ocfs2_path *path); 319 struct ocfs2_path *path);
320int ocfs2_find_cpos_for_right_leaf(struct super_block *sb,
321 struct ocfs2_path *path, u32 *cpos);
322int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et,
323 struct ocfs2_path *left,
324 struct ocfs2_path *right);
320#endif /* OCFS2_ALLOC_H */ 325#endif /* OCFS2_ALLOC_H */
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index c452d116b892..eda5b8bcddd5 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -176,7 +176,8 @@ static void o2hb_write_timeout(struct work_struct *work)
176 176
177static void o2hb_arm_write_timeout(struct o2hb_region *reg) 177static void o2hb_arm_write_timeout(struct o2hb_region *reg)
178{ 178{
179 mlog(0, "Queue write timeout for %u ms\n", O2HB_MAX_WRITE_TIMEOUT_MS); 179 mlog(ML_HEARTBEAT, "Queue write timeout for %u ms\n",
180 O2HB_MAX_WRITE_TIMEOUT_MS);
180 181
181 cancel_delayed_work(&reg->hr_write_timeout_work); 182 cancel_delayed_work(&reg->hr_write_timeout_work);
182 reg->hr_last_timeout_start = jiffies; 183 reg->hr_last_timeout_start = jiffies;
@@ -874,7 +875,8 @@ static int o2hb_thread(void *data)
874 do_gettimeofday(&after_hb); 875 do_gettimeofday(&after_hb);
875 elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); 876 elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb);
876 877
877 mlog(0, "start = %lu.%lu, end = %lu.%lu, msec = %u\n", 878 mlog(ML_HEARTBEAT,
879 "start = %lu.%lu, end = %lu.%lu, msec = %u\n",
878 before_hb.tv_sec, (unsigned long) before_hb.tv_usec, 880 before_hb.tv_sec, (unsigned long) before_hb.tv_usec,
879 after_hb.tv_sec, (unsigned long) after_hb.tv_usec, 881 after_hb.tv_sec, (unsigned long) after_hb.tv_usec,
880 elapsed_msec); 882 elapsed_msec);
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index 7ee6188bc79a..c81142e3ef84 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -35,6 +35,10 @@
35 * cluster references throughout where nodes are looked up */ 35 * cluster references throughout where nodes are looked up */
36struct o2nm_cluster *o2nm_single_cluster = NULL; 36struct o2nm_cluster *o2nm_single_cluster = NULL;
37 37
38char *o2nm_fence_method_desc[O2NM_FENCE_METHODS] = {
39 "reset", /* O2NM_FENCE_RESET */
40 "panic", /* O2NM_FENCE_PANIC */
41};
38 42
39struct o2nm_node *o2nm_get_node_by_num(u8 node_num) 43struct o2nm_node *o2nm_get_node_by_num(u8 node_num)
40{ 44{
@@ -579,6 +583,43 @@ static ssize_t o2nm_cluster_attr_reconnect_delay_ms_write(
579 return o2nm_cluster_attr_write(page, count, 583 return o2nm_cluster_attr_write(page, count,
580 &cluster->cl_reconnect_delay_ms); 584 &cluster->cl_reconnect_delay_ms);
581} 585}
586
587static ssize_t o2nm_cluster_attr_fence_method_read(
588 struct o2nm_cluster *cluster, char *page)
589{
590 ssize_t ret = 0;
591
592 if (cluster)
593 ret = sprintf(page, "%s\n",
594 o2nm_fence_method_desc[cluster->cl_fence_method]);
595 return ret;
596}
597
598static ssize_t o2nm_cluster_attr_fence_method_write(
599 struct o2nm_cluster *cluster, const char *page, size_t count)
600{
601 unsigned int i;
602
603 if (page[count - 1] != '\n')
604 goto bail;
605
606 for (i = 0; i < O2NM_FENCE_METHODS; ++i) {
607 if (count != strlen(o2nm_fence_method_desc[i]) + 1)
608 continue;
609 if (strncasecmp(page, o2nm_fence_method_desc[i], count - 1))
610 continue;
611 if (cluster->cl_fence_method != i) {
612 printk(KERN_INFO "ocfs2: Changing fence method to %s\n",
613 o2nm_fence_method_desc[i]);
614 cluster->cl_fence_method = i;
615 }
616 return count;
617 }
618
619bail:
620 return -EINVAL;
621}
622
582static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { 623static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = {
583 .attr = { .ca_owner = THIS_MODULE, 624 .attr = { .ca_owner = THIS_MODULE,
584 .ca_name = "idle_timeout_ms", 625 .ca_name = "idle_timeout_ms",
@@ -603,10 +644,19 @@ static struct o2nm_cluster_attribute o2nm_cluster_attr_reconnect_delay_ms = {
603 .store = o2nm_cluster_attr_reconnect_delay_ms_write, 644 .store = o2nm_cluster_attr_reconnect_delay_ms_write,
604}; 645};
605 646
647static struct o2nm_cluster_attribute o2nm_cluster_attr_fence_method = {
648 .attr = { .ca_owner = THIS_MODULE,
649 .ca_name = "fence_method",
650 .ca_mode = S_IRUGO | S_IWUSR },
651 .show = o2nm_cluster_attr_fence_method_read,
652 .store = o2nm_cluster_attr_fence_method_write,
653};
654
606static struct configfs_attribute *o2nm_cluster_attrs[] = { 655static struct configfs_attribute *o2nm_cluster_attrs[] = {
607 &o2nm_cluster_attr_idle_timeout_ms.attr, 656 &o2nm_cluster_attr_idle_timeout_ms.attr,
608 &o2nm_cluster_attr_keepalive_delay_ms.attr, 657 &o2nm_cluster_attr_keepalive_delay_ms.attr,
609 &o2nm_cluster_attr_reconnect_delay_ms.attr, 658 &o2nm_cluster_attr_reconnect_delay_ms.attr,
659 &o2nm_cluster_attr_fence_method.attr,
610 NULL, 660 NULL,
611}; 661};
612static ssize_t o2nm_cluster_show(struct config_item *item, 662static ssize_t o2nm_cluster_show(struct config_item *item,
@@ -778,6 +828,7 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g
778 cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; 828 cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT;
779 cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; 829 cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT;
780 cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; 830 cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT;
831 cluster->cl_fence_method = O2NM_FENCE_RESET;
781 832
782 ret = &cluster->cl_group; 833 ret = &cluster->cl_group;
783 o2nm_single_cluster = cluster; 834 o2nm_single_cluster = cluster;
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h
index c992ea0da4ad..09ea2d388bbb 100644
--- a/fs/ocfs2/cluster/nodemanager.h
+++ b/fs/ocfs2/cluster/nodemanager.h
@@ -33,6 +33,12 @@
33#include <linux/configfs.h> 33#include <linux/configfs.h>
34#include <linux/rbtree.h> 34#include <linux/rbtree.h>
35 35
36enum o2nm_fence_method {
37 O2NM_FENCE_RESET = 0,
38 O2NM_FENCE_PANIC,
39 O2NM_FENCE_METHODS, /* Number of fence methods */
40};
41
36struct o2nm_node { 42struct o2nm_node {
37 spinlock_t nd_lock; 43 spinlock_t nd_lock;
38 struct config_item nd_item; 44 struct config_item nd_item;
@@ -58,6 +64,7 @@ struct o2nm_cluster {
58 unsigned int cl_idle_timeout_ms; 64 unsigned int cl_idle_timeout_ms;
59 unsigned int cl_keepalive_delay_ms; 65 unsigned int cl_keepalive_delay_ms;
60 unsigned int cl_reconnect_delay_ms; 66 unsigned int cl_reconnect_delay_ms;
67 enum o2nm_fence_method cl_fence_method;
61 68
62 /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ 69 /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
63 unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; 70 unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c
index bbacf7da48a4..639024033fce 100644
--- a/fs/ocfs2/cluster/quorum.c
+++ b/fs/ocfs2/cluster/quorum.c
@@ -74,8 +74,20 @@ static void o2quo_fence_self(void)
74 * threads can still schedule, etc, etc */ 74 * threads can still schedule, etc, etc */
75 o2hb_stop_all_regions(); 75 o2hb_stop_all_regions();
76 76
77 printk("ocfs2 is very sorry to be fencing this system by restarting\n"); 77 switch (o2nm_single_cluster->cl_fence_method) {
78 emergency_restart(); 78 case O2NM_FENCE_PANIC:
79 panic("*** ocfs2 is very sorry to be fencing this system by "
80 "panicing ***\n");
81 break;
82 default:
83 WARN_ON(o2nm_single_cluster->cl_fence_method >=
84 O2NM_FENCE_METHODS);
85 case O2NM_FENCE_RESET:
86 printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this "
87 "system by restarting ***\n");
88 emergency_restart();
89 break;
90 };
79} 91}
80 92
81/* Indicate that a timeout occured on a hearbeat region write. The 93/* Indicate that a timeout occured on a hearbeat region write. The
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index d9fa3d22e17c..2f9e4e19a4f2 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -2589,6 +2589,14 @@ retry:
2589 "begin reco msg (%d)\n", dlm->name, nodenum, ret); 2589 "begin reco msg (%d)\n", dlm->name, nodenum, ret);
2590 ret = 0; 2590 ret = 0;
2591 } 2591 }
2592 if (ret == -EAGAIN) {
2593 mlog(0, "%s: trying to start recovery of node "
2594 "%u, but node %u is waiting for last recovery "
2595 "to complete, backoff for a bit\n", dlm->name,
2596 dead_node, nodenum);
2597 msleep(100);
2598 goto retry;
2599 }
2592 if (ret < 0) { 2600 if (ret < 0) {
2593 struct dlm_lock_resource *res; 2601 struct dlm_lock_resource *res;
2594 /* this is now a serious problem, possibly ENOMEM 2602 /* this is now a serious problem, possibly ENOMEM
@@ -2608,14 +2616,6 @@ retry:
2608 * another ENOMEM */ 2616 * another ENOMEM */
2609 msleep(100); 2617 msleep(100);
2610 goto retry; 2618 goto retry;
2611 } else if (ret == EAGAIN) {
2612 mlog(0, "%s: trying to start recovery of node "
2613 "%u, but node %u is waiting for last recovery "
2614 "to complete, backoff for a bit\n", dlm->name,
2615 dead_node, nodenum);
2616 /* TODO Look into replacing msleep with cond_resched() */
2617 msleep(100);
2618 goto retry;
2619 } 2619 }
2620 } 2620 }
2621 2621
@@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data,
2639 dlm->name, br->node_idx, br->dead_node, 2639 dlm->name, br->node_idx, br->dead_node,
2640 dlm->reco.dead_node, dlm->reco.new_master); 2640 dlm->reco.dead_node, dlm->reco.new_master);
2641 spin_unlock(&dlm->spinlock); 2641 spin_unlock(&dlm->spinlock);
2642 return EAGAIN; 2642 return -EAGAIN;
2643 } 2643 }
2644 spin_unlock(&dlm->spinlock); 2644 spin_unlock(&dlm->spinlock);
2645 2645
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 843db64e9d4a..d35a27f4523e 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -37,6 +37,7 @@
37#include "extent_map.h" 37#include "extent_map.h"
38#include "inode.h" 38#include "inode.h"
39#include "super.h" 39#include "super.h"
40#include "symlink.h"
40 41
41#include "buffer_head_io.h" 42#include "buffer_head_io.h"
42 43
@@ -703,6 +704,12 @@ out:
703 return ret; 704 return ret;
704} 705}
705 706
707/*
708 * The ocfs2_fiemap_inline() may be a little bit misleading, since
709 * it not only handles the fiemap for inlined files, but also deals
710 * with the fast symlink, cause they have no difference for extent
711 * mapping per se.
712 */
706static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh, 713static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
707 struct fiemap_extent_info *fieinfo, 714 struct fiemap_extent_info *fieinfo,
708 u64 map_start) 715 u64 map_start)
@@ -715,11 +722,18 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
715 struct ocfs2_inode_info *oi = OCFS2_I(inode); 722 struct ocfs2_inode_info *oi = OCFS2_I(inode);
716 723
717 di = (struct ocfs2_dinode *)di_bh->b_data; 724 di = (struct ocfs2_dinode *)di_bh->b_data;
718 id_count = le16_to_cpu(di->id2.i_data.id_count); 725 if (ocfs2_inode_is_fast_symlink(inode))
726 id_count = ocfs2_fast_symlink_chars(inode->i_sb);
727 else
728 id_count = le16_to_cpu(di->id2.i_data.id_count);
719 729
720 if (map_start < id_count) { 730 if (map_start < id_count) {
721 phys = oi->ip_blkno << inode->i_sb->s_blocksize_bits; 731 phys = oi->ip_blkno << inode->i_sb->s_blocksize_bits;
722 phys += offsetof(struct ocfs2_dinode, id2.i_data.id_data); 732 if (ocfs2_inode_is_fast_symlink(inode))
733 phys += offsetof(struct ocfs2_dinode, id2.i_symlink);
734 else
735 phys += offsetof(struct ocfs2_dinode,
736 id2.i_data.id_data);
723 737
724 ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count, 738 ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count,
725 flags); 739 flags);
@@ -756,9 +770,10 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
756 down_read(&OCFS2_I(inode)->ip_alloc_sem); 770 down_read(&OCFS2_I(inode)->ip_alloc_sem);
757 771
758 /* 772 /*
759 * Handle inline-data separately. 773 * Handle inline-data and fast symlink separately.
760 */ 774 */
761 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 775 if ((OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) ||
776 ocfs2_inode_is_fast_symlink(inode)) {
762 ret = ocfs2_fiemap_inline(inode, di_bh, fieinfo, map_start); 777 ret = ocfs2_fiemap_inline(inode, di_bh, fieinfo, map_start);
763 goto out_unlock; 778 goto out_unlock;
764 } 779 }
@@ -786,6 +801,8 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
786 fe_flags = 0; 801 fe_flags = 0;
787 if (rec.e_flags & OCFS2_EXT_UNWRITTEN) 802 if (rec.e_flags & OCFS2_EXT_UNWRITTEN)
788 fe_flags |= FIEMAP_EXTENT_UNWRITTEN; 803 fe_flags |= FIEMAP_EXTENT_UNWRITTEN;
804 if (rec.e_flags & OCFS2_EXT_REFCOUNTED)
805 fe_flags |= FIEMAP_EXTENT_SHARED;
789 if (is_last) 806 if (is_last)
790 fe_flags |= FIEMAP_EXTENT_LAST; 807 fe_flags |= FIEMAP_EXTENT_LAST;
791 len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits; 808 len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 3d30a1c974a8..06ccf6a86d35 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1772,7 +1772,8 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
1772 loff_t *ppos, 1772 loff_t *ppos,
1773 size_t count, 1773 size_t count,
1774 int appending, 1774 int appending,
1775 int *direct_io) 1775 int *direct_io,
1776 int *has_refcount)
1776{ 1777{
1777 int ret = 0, meta_level = 0; 1778 int ret = 0, meta_level = 0;
1778 struct inode *inode = dentry->d_inode; 1779 struct inode *inode = dentry->d_inode;
@@ -1833,6 +1834,8 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
1833 saved_pos, 1834 saved_pos,
1834 count, 1835 count,
1835 &meta_level); 1836 &meta_level);
1837 if (has_refcount)
1838 *has_refcount = 1;
1836 } 1839 }
1837 1840
1838 if (ret < 0) { 1841 if (ret < 0) {
@@ -1856,6 +1859,10 @@ static int ocfs2_prepare_inode_for_write(struct dentry *dentry,
1856 break; 1859 break;
1857 } 1860 }
1858 1861
1862 if (has_refcount && *has_refcount == 1) {
1863 *direct_io = 0;
1864 break;
1865 }
1859 /* 1866 /*
1860 * Allowing concurrent direct writes means 1867 * Allowing concurrent direct writes means
1861 * i_size changes wouldn't be synchronized, so 1868 * i_size changes wouldn't be synchronized, so
@@ -1899,7 +1906,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1899 loff_t pos) 1906 loff_t pos)
1900{ 1907{
1901 int ret, direct_io, appending, rw_level, have_alloc_sem = 0; 1908 int ret, direct_io, appending, rw_level, have_alloc_sem = 0;
1902 int can_do_direct; 1909 int can_do_direct, has_refcount = 0;
1903 ssize_t written = 0; 1910 ssize_t written = 0;
1904 size_t ocount; /* original count */ 1911 size_t ocount; /* original count */
1905 size_t count; /* after file limit checks */ 1912 size_t count; /* after file limit checks */
@@ -1942,7 +1949,7 @@ relock:
1942 can_do_direct = direct_io; 1949 can_do_direct = direct_io;
1943 ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos, 1950 ret = ocfs2_prepare_inode_for_write(file->f_path.dentry, ppos,
1944 iocb->ki_left, appending, 1951 iocb->ki_left, appending,
1945 &can_do_direct); 1952 &can_do_direct, &has_refcount);
1946 if (ret < 0) { 1953 if (ret < 0) {
1947 mlog_errno(ret); 1954 mlog_errno(ret);
1948 goto out; 1955 goto out;
@@ -2006,14 +2013,16 @@ out_dio:
2006 /* buffered aio wouldn't have proper lock coverage today */ 2013 /* buffered aio wouldn't have proper lock coverage today */
2007 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); 2014 BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
2008 2015
2009 if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode)) { 2016 if ((file->f_flags & O_DSYNC && !direct_io) || IS_SYNC(inode) ||
2017 (file->f_flags & O_DIRECT && has_refcount)) {
2010 ret = filemap_fdatawrite_range(file->f_mapping, pos, 2018 ret = filemap_fdatawrite_range(file->f_mapping, pos,
2011 pos + count - 1); 2019 pos + count - 1);
2012 if (ret < 0) 2020 if (ret < 0)
2013 written = ret; 2021 written = ret;
2014 2022
2015 if (!ret && (old_size != i_size_read(inode) || 2023 if (!ret && (old_size != i_size_read(inode) ||
2016 old_clusters != OCFS2_I(inode)->ip_clusters)) { 2024 old_clusters != OCFS2_I(inode)->ip_clusters ||
2025 has_refcount)) {
2017 ret = jbd2_journal_force_commit(osb->journal->j_journal); 2026 ret = jbd2_journal_force_commit(osb->journal->j_journal);
2018 if (ret < 0) 2027 if (ret < 0)
2019 written = ret; 2028 written = ret;
@@ -2062,7 +2071,7 @@ static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
2062 int ret; 2071 int ret;
2063 2072
2064 ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos, 2073 ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos,
2065 sd->total_len, 0, NULL); 2074 sd->total_len, 0, NULL, NULL);
2066 if (ret < 0) { 2075 if (ret < 0) {
2067 mlog_errno(ret); 2076 mlog_errno(ret);
2068 return ret; 2077 return ret;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index f010b22b1c44..50fb26a6a5f5 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2108,6 +2108,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
2108 } 2108 }
2109 did_quota_inode = 1; 2109 did_quota_inode = 1;
2110 2110
2111 inode->i_nlink = 0;
2111 /* do the real work now. */ 2112 /* do the real work now. */
2112 status = ocfs2_mknod_locked(osb, dir, inode, 2113 status = ocfs2_mknod_locked(osb, dir, inode,
2113 0, &new_di_bh, parent_di_bh, handle, 2114 0, &new_di_bh, parent_di_bh, handle,
@@ -2136,6 +2137,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
2136 if (status < 0) 2137 if (status < 0)
2137 mlog_errno(status); 2138 mlog_errno(status);
2138 2139
2140 insert_inode_hash(inode);
2139leave: 2141leave:
2140 if (status < 0 && did_quota_inode) 2142 if (status < 0 && did_quota_inode)
2141 vfs_dq_free_inode(inode); 2143 vfs_dq_free_inode(inode);
@@ -2267,6 +2269,8 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2267 di = (struct ocfs2_dinode *)di_bh->b_data; 2269 di = (struct ocfs2_dinode *)di_bh->b_data;
2268 le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL); 2270 le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL);
2269 di->i_orphaned_slot = 0; 2271 di->i_orphaned_slot = 0;
2272 inode->i_nlink = 1;
2273 ocfs2_set_links_count(di, inode->i_nlink);
2270 ocfs2_journal_dirty(handle, di_bh); 2274 ocfs2_journal_dirty(handle, di_bh);
2271 2275
2272 status = ocfs2_add_entry(handle, dentry, inode, 2276 status = ocfs2_add_entry(handle, dentry, inode,
@@ -2284,7 +2288,6 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
2284 goto out_commit; 2288 goto out_commit;
2285 } 2289 }
2286 2290
2287 insert_inode_hash(inode);
2288 dentry->d_op = &ocfs2_dentry_ops; 2291 dentry->d_op = &ocfs2_dentry_ops;
2289 d_instantiate(dentry, inode); 2292 d_instantiate(dentry, inode);
2290 status = 0; 2293 status = 0;
@@ -2326,4 +2329,5 @@ const struct inode_operations ocfs2_dir_iops = {
2326 .getxattr = generic_getxattr, 2329 .getxattr = generic_getxattr,
2327 .listxattr = ocfs2_listxattr, 2330 .listxattr = ocfs2_listxattr,
2328 .removexattr = generic_removexattr, 2331 .removexattr = generic_removexattr,
2332 .fiemap = ocfs2_fiemap,
2329}; 2333};
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index d963d8638709..9362eea7424b 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -245,9 +245,11 @@ enum ocfs2_mount_options
245 OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */ 245 OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */
246 OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */ 246 OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */
247 OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */ 247 OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */
248 OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* POSIX access control lists */ 248 OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* Force POSIX access control lists */
249 OCFS2_MOUNT_USRQUOTA = 1 << 9, /* We support user quotas */ 249 OCFS2_MOUNT_NO_POSIX_ACL = 1 << 9, /* Disable POSIX access
250 OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */ 250 control lists */
251 OCFS2_MOUNT_USRQUOTA = 1 << 10, /* We support user quotas */
252 OCFS2_MOUNT_GRPQUOTA = 1 << 11, /* We support group quotas */
251}; 253};
252 254
253#define OCFS2_OSB_SOFT_RO 0x0001 255#define OCFS2_OSB_SOFT_RO 0x0001
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index e9431e4a5e7c..1a1a679e51b5 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -1202,7 +1202,7 @@ struct ocfs2_local_disk_dqinfo {
1202/* Header of one chunk of a quota file */ 1202/* Header of one chunk of a quota file */
1203struct ocfs2_local_disk_chunk { 1203struct ocfs2_local_disk_chunk {
1204 __le32 dqc_free; /* Number of free entries in the bitmap */ 1204 __le32 dqc_free; /* Number of free entries in the bitmap */
1205 u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding 1205 __u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding
1206 * chunk of quota file */ 1206 * chunk of quota file */
1207}; 1207};
1208 1208
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 30967e3f5e43..74db2be75dd6 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -276,7 +276,7 @@ static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb,
276 spin_unlock(&osb->osb_lock); 276 spin_unlock(&osb->osb_lock);
277} 277}
278 278
279void ocfs2_kref_remove_refcount_tree(struct kref *kref) 279static void ocfs2_kref_remove_refcount_tree(struct kref *kref)
280{ 280{
281 struct ocfs2_refcount_tree *tree = 281 struct ocfs2_refcount_tree *tree =
282 container_of(kref, struct ocfs2_refcount_tree, rf_getcnt); 282 container_of(kref, struct ocfs2_refcount_tree, rf_getcnt);
@@ -524,23 +524,6 @@ out:
524 return ret; 524 return ret;
525} 525}
526 526
527int ocfs2_lock_refcount_tree_by_inode(struct inode *inode, int rw,
528 struct ocfs2_refcount_tree **ret_tree,
529 struct buffer_head **ref_bh)
530{
531 int ret;
532 u64 ref_blkno;
533
534 ret = ocfs2_get_refcount_block(inode, &ref_blkno);
535 if (ret) {
536 mlog_errno(ret);
537 return ret;
538 }
539
540 return ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno,
541 rw, ret_tree, ref_bh);
542}
543
544void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, 527void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb,
545 struct ocfs2_refcount_tree *tree, int rw) 528 struct ocfs2_refcount_tree *tree, int rw)
546{ 529{
@@ -969,6 +952,103 @@ out:
969} 952}
970 953
971/* 954/*
955 * Find the end range for a leaf refcount block indicated by
956 * el->l_recs[index].e_blkno.
957 */
958static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
959 struct buffer_head *ref_root_bh,
960 struct ocfs2_extent_block *eb,
961 struct ocfs2_extent_list *el,
962 int index, u32 *cpos_end)
963{
964 int ret, i, subtree_root;
965 u32 cpos;
966 u64 blkno;
967 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
968 struct ocfs2_path *left_path = NULL, *right_path = NULL;
969 struct ocfs2_extent_tree et;
970 struct ocfs2_extent_list *tmp_el;
971
972 if (index < le16_to_cpu(el->l_next_free_rec) - 1) {
973 /*
974 * We have a extent rec after index, so just use the e_cpos
975 * of the next extent rec.
976 */
977 *cpos_end = le32_to_cpu(el->l_recs[index+1].e_cpos);
978 return 0;
979 }
980
981 if (!eb || (eb && !eb->h_next_leaf_blk)) {
982 /*
983 * We are the last extent rec, so any high cpos should
984 * be stored in this leaf refcount block.
985 */
986 *cpos_end = UINT_MAX;
987 return 0;
988 }
989
990 /*
991 * If the extent block isn't the last one, we have to find
992 * the subtree root between this extent block and the next
993 * leaf extent block and get the corresponding e_cpos from
994 * the subroot. Otherwise we may corrupt the b-tree.
995 */
996 ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh);
997
998 left_path = ocfs2_new_path_from_et(&et);
999 if (!left_path) {
1000 ret = -ENOMEM;
1001 mlog_errno(ret);
1002 goto out;
1003 }
1004
1005 cpos = le32_to_cpu(eb->h_list.l_recs[index].e_cpos);
1006 ret = ocfs2_find_path(ci, left_path, cpos);
1007 if (ret) {
1008 mlog_errno(ret);
1009 goto out;
1010 }
1011
1012 right_path = ocfs2_new_path_from_path(left_path);
1013 if (!right_path) {
1014 ret = -ENOMEM;
1015 mlog_errno(ret);
1016 goto out;
1017 }
1018
1019 ret = ocfs2_find_cpos_for_right_leaf(sb, left_path, &cpos);
1020 if (ret) {
1021 mlog_errno(ret);
1022 goto out;
1023 }
1024
1025 ret = ocfs2_find_path(ci, right_path, cpos);
1026 if (ret) {
1027 mlog_errno(ret);
1028 goto out;
1029 }
1030
1031 subtree_root = ocfs2_find_subtree_root(&et, left_path,
1032 right_path);
1033
1034 tmp_el = left_path->p_node[subtree_root].el;
1035 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr;
1036 for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) {
1037 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) {
1038 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos);
1039 break;
1040 }
1041 }
1042
1043 BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec));
1044
1045out:
1046 ocfs2_free_path(left_path);
1047 ocfs2_free_path(right_path);
1048 return ret;
1049}
1050
1051/*
972 * Given a cpos and len, try to find the refcount record which contains cpos. 1052 * Given a cpos and len, try to find the refcount record which contains cpos.
973 * 1. If cpos can be found in one refcount record, return the record. 1053 * 1. If cpos can be found in one refcount record, return the record.
974 * 2. If cpos can't be found, return a fake record which start from cpos 1054 * 2. If cpos can't be found, return a fake record which start from cpos
@@ -983,10 +1063,10 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci,
983 struct buffer_head **ret_bh) 1063 struct buffer_head **ret_bh)
984{ 1064{
985 int ret = 0, i, found; 1065 int ret = 0, i, found;
986 u32 low_cpos; 1066 u32 low_cpos, uninitialized_var(cpos_end);
987 struct ocfs2_extent_list *el; 1067 struct ocfs2_extent_list *el;
988 struct ocfs2_extent_rec *tmp, *rec = NULL; 1068 struct ocfs2_extent_rec *rec = NULL;
989 struct ocfs2_extent_block *eb; 1069 struct ocfs2_extent_block *eb = NULL;
990 struct buffer_head *eb_bh = NULL, *ref_leaf_bh = NULL; 1070 struct buffer_head *eb_bh = NULL, *ref_leaf_bh = NULL;
991 struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 1071 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
992 struct ocfs2_refcount_block *rb = 1072 struct ocfs2_refcount_block *rb =
@@ -1034,12 +1114,16 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci,
1034 } 1114 }
1035 } 1115 }
1036 1116
1037 /* adjust len when we have ocfs2_extent_rec after it. */ 1117 if (found) {
1038 if (found && i < le16_to_cpu(el->l_next_free_rec) - 1) { 1118 ret = ocfs2_get_refcount_cpos_end(ci, ref_root_bh,
1039 tmp = &el->l_recs[i+1]; 1119 eb, el, i, &cpos_end);
1120 if (ret) {
1121 mlog_errno(ret);
1122 goto out;
1123 }
1040 1124
1041 if (le32_to_cpu(tmp->e_cpos) < cpos + len) 1125 if (cpos_end < low_cpos + len)
1042 len = le32_to_cpu(tmp->e_cpos) - cpos; 1126 len = cpos_end - low_cpos;
1043 } 1127 }
1044 1128
1045 ret = ocfs2_read_refcount_block(ci, le64_to_cpu(rec->e_blkno), 1129 ret = ocfs2_read_refcount_block(ci, le64_to_cpu(rec->e_blkno),
@@ -1418,7 +1502,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
1418 1502
1419 /* change old and new rl_used accordingly. */ 1503 /* change old and new rl_used accordingly. */
1420 le16_add_cpu(&rl->rl_used, -num_moved); 1504 le16_add_cpu(&rl->rl_used, -num_moved);
1421 new_rl->rl_used = cpu_to_le32(num_moved); 1505 new_rl->rl_used = cpu_to_le16(num_moved);
1422 1506
1423 sort(&rl->rl_recs, le16_to_cpu(rl->rl_used), 1507 sort(&rl->rl_recs, le16_to_cpu(rl->rl_used),
1424 sizeof(struct ocfs2_refcount_rec), 1508 sizeof(struct ocfs2_refcount_rec),
@@ -1797,7 +1881,8 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
1797 recs_need++; 1881 recs_need++;
1798 1882
1799 /* If the leaf block don't have enough record, expand it. */ 1883 /* If the leaf block don't have enough record, expand it. */
1800 if (le16_to_cpu(rf_list->rl_used) + recs_need > rf_list->rl_count) { 1884 if (le16_to_cpu(rf_list->rl_used) + recs_need >
1885 le16_to_cpu(rf_list->rl_count)) {
1801 struct ocfs2_refcount_rec tmp_rec; 1886 struct ocfs2_refcount_rec tmp_rec;
1802 u64 cpos = le64_to_cpu(orig_rec->r_cpos); 1887 u64 cpos = le64_to_cpu(orig_rec->r_cpos);
1803 len = le32_to_cpu(orig_rec->r_clusters); 1888 len = le32_to_cpu(orig_rec->r_clusters);
@@ -1859,7 +1944,7 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
1859 memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec)); 1944 memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec));
1860 le64_add_cpu(&tail_rec->r_cpos, 1945 le64_add_cpu(&tail_rec->r_cpos,
1861 le32_to_cpu(tail_rec->r_clusters) - len); 1946 le32_to_cpu(tail_rec->r_clusters) - len);
1862 tail_rec->r_clusters = le32_to_cpu(len); 1947 tail_rec->r_clusters = cpu_to_le32(len);
1863 } 1948 }
1864 1949
1865 /* 1950 /*
@@ -3840,8 +3925,7 @@ static int ocfs2_add_refcounted_extent(struct inode *inode,
3840 } 3925 }
3841 3926
3842 ret = ocfs2_insert_extent(handle, et, cpos, 3927 ret = ocfs2_insert_extent(handle, et, cpos,
3843 cpu_to_le64(ocfs2_clusters_to_blocks(inode->i_sb, 3928 ocfs2_clusters_to_blocks(inode->i_sb, p_cluster),
3844 p_cluster)),
3845 num_clusters, ext_flags, meta_ac); 3929 num_clusters, ext_flags, meta_ac);
3846 if (ret) { 3930 if (ret) {
3847 mlog_errno(ret); 3931 mlog_errno(ret);
@@ -4253,8 +4337,8 @@ static int ocfs2_user_path_parent(const char __user *path,
4253 * @new_dentry: target dentry 4337 * @new_dentry: target dentry
4254 * @preserve: if true, preserve all file attributes 4338 * @preserve: if true, preserve all file attributes
4255 */ 4339 */
4256int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, 4340static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
4257 struct dentry *new_dentry, bool preserve) 4341 struct dentry *new_dentry, bool preserve)
4258{ 4342{
4259 struct inode *inode = old_dentry->d_inode; 4343 struct inode *inode = old_dentry->d_inode;
4260 int error; 4344 int error;
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index ff4c798a5635..da78a2a334fd 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -814,7 +814,7 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing,
814static int user_cluster_connect(struct ocfs2_cluster_connection *conn) 814static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
815{ 815{
816 dlm_lockspace_t *fsdlm; 816 dlm_lockspace_t *fsdlm;
817 struct ocfs2_live_connection *control; 817 struct ocfs2_live_connection *uninitialized_var(control);
818 int rc = 0; 818 int rc = 0;
819 819
820 BUG_ON(conn == NULL); 820 BUG_ON(conn == NULL);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 14f47d2bfe02..26069917a9f5 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -100,6 +100,8 @@ struct mount_options
100static int ocfs2_parse_options(struct super_block *sb, char *options, 100static int ocfs2_parse_options(struct super_block *sb, char *options,
101 struct mount_options *mopt, 101 struct mount_options *mopt,
102 int is_remount); 102 int is_remount);
103static int ocfs2_check_set_options(struct super_block *sb,
104 struct mount_options *options);
103static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt); 105static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt);
104static void ocfs2_put_super(struct super_block *sb); 106static void ocfs2_put_super(struct super_block *sb);
105static int ocfs2_mount_volume(struct super_block *sb); 107static int ocfs2_mount_volume(struct super_block *sb);
@@ -600,7 +602,8 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
600 602
601 lock_kernel(); 603 lock_kernel();
602 604
603 if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) { 605 if (!ocfs2_parse_options(sb, data, &parsed_options, 1) ||
606 !ocfs2_check_set_options(sb, &parsed_options)) {
604 ret = -EINVAL; 607 ret = -EINVAL;
605 goto out; 608 goto out;
606 } 609 }
@@ -691,8 +694,6 @@ unlock_osb:
691 if (!ret) { 694 if (!ret) {
692 /* Only save off the new mount options in case of a successful 695 /* Only save off the new mount options in case of a successful
693 * remount. */ 696 * remount. */
694 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
695 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
696 osb->s_mount_opt = parsed_options.mount_opt; 697 osb->s_mount_opt = parsed_options.mount_opt;
697 osb->s_atime_quantum = parsed_options.atime_quantum; 698 osb->s_atime_quantum = parsed_options.atime_quantum;
698 osb->preferred_slot = parsed_options.slot; 699 osb->preferred_slot = parsed_options.slot;
@@ -701,6 +702,10 @@ unlock_osb:
701 702
702 if (!ocfs2_is_hard_readonly(osb)) 703 if (!ocfs2_is_hard_readonly(osb))
703 ocfs2_set_journal_params(osb); 704 ocfs2_set_journal_params(osb);
705
706 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
707 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ?
708 MS_POSIXACL : 0);
704 } 709 }
705out: 710out:
706 unlock_kernel(); 711 unlock_kernel();
@@ -1011,31 +1016,16 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
1011 brelse(bh); 1016 brelse(bh);
1012 bh = NULL; 1017 bh = NULL;
1013 1018
1014 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) 1019 if (!ocfs2_check_set_options(sb, &parsed_options)) {
1015 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; 1020 status = -EINVAL;
1016 1021 goto read_super_error;
1022 }
1017 osb->s_mount_opt = parsed_options.mount_opt; 1023 osb->s_mount_opt = parsed_options.mount_opt;
1018 osb->s_atime_quantum = parsed_options.atime_quantum; 1024 osb->s_atime_quantum = parsed_options.atime_quantum;
1019 osb->preferred_slot = parsed_options.slot; 1025 osb->preferred_slot = parsed_options.slot;
1020 osb->osb_commit_interval = parsed_options.commit_interval; 1026 osb->osb_commit_interval = parsed_options.commit_interval;
1021 osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); 1027 osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt);
1022 osb->local_alloc_bits = osb->local_alloc_default_bits; 1028 osb->local_alloc_bits = osb->local_alloc_default_bits;
1023 if (osb->s_mount_opt & OCFS2_MOUNT_USRQUOTA &&
1024 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1025 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1026 status = -EINVAL;
1027 mlog(ML_ERROR, "User quotas were requested, but this "
1028 "filesystem does not have the feature enabled.\n");
1029 goto read_super_error;
1030 }
1031 if (osb->s_mount_opt & OCFS2_MOUNT_GRPQUOTA &&
1032 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1033 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1034 status = -EINVAL;
1035 mlog(ML_ERROR, "Group quotas were requested, but this "
1036 "filesystem does not have the feature enabled.\n");
1037 goto read_super_error;
1038 }
1039 1029
1040 status = ocfs2_verify_userspace_stack(osb, &parsed_options); 1030 status = ocfs2_verify_userspace_stack(osb, &parsed_options);
1041 if (status) 1031 if (status)
@@ -1245,6 +1235,40 @@ static struct file_system_type ocfs2_fs_type = {
1245 .next = NULL 1235 .next = NULL
1246}; 1236};
1247 1237
1238static int ocfs2_check_set_options(struct super_block *sb,
1239 struct mount_options *options)
1240{
1241 if (options->mount_opt & OCFS2_MOUNT_USRQUOTA &&
1242 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1243 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1244 mlog(ML_ERROR, "User quotas were requested, but this "
1245 "filesystem does not have the feature enabled.\n");
1246 return 0;
1247 }
1248 if (options->mount_opt & OCFS2_MOUNT_GRPQUOTA &&
1249 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1250 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1251 mlog(ML_ERROR, "Group quotas were requested, but this "
1252 "filesystem does not have the feature enabled.\n");
1253 return 0;
1254 }
1255 if (options->mount_opt & OCFS2_MOUNT_POSIX_ACL &&
1256 !OCFS2_HAS_INCOMPAT_FEATURE(sb, OCFS2_FEATURE_INCOMPAT_XATTR)) {
1257 mlog(ML_ERROR, "ACL support requested but extended attributes "
1258 "feature is not enabled\n");
1259 return 0;
1260 }
1261 /* No ACL setting specified? Use XATTR feature... */
1262 if (!(options->mount_opt & (OCFS2_MOUNT_POSIX_ACL |
1263 OCFS2_MOUNT_NO_POSIX_ACL))) {
1264 if (OCFS2_HAS_INCOMPAT_FEATURE(sb, OCFS2_FEATURE_INCOMPAT_XATTR))
1265 options->mount_opt |= OCFS2_MOUNT_POSIX_ACL;
1266 else
1267 options->mount_opt |= OCFS2_MOUNT_NO_POSIX_ACL;
1268 }
1269 return 1;
1270}
1271
1248static int ocfs2_parse_options(struct super_block *sb, 1272static int ocfs2_parse_options(struct super_block *sb,
1249 char *options, 1273 char *options,
1250 struct mount_options *mopt, 1274 struct mount_options *mopt,
@@ -1392,40 +1416,19 @@ static int ocfs2_parse_options(struct super_block *sb,
1392 mopt->mount_opt |= OCFS2_MOUNT_INODE64; 1416 mopt->mount_opt |= OCFS2_MOUNT_INODE64;
1393 break; 1417 break;
1394 case Opt_usrquota: 1418 case Opt_usrquota:
1395 /* We check only on remount, otherwise features
1396 * aren't yet initialized. */
1397 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1398 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1399 mlog(ML_ERROR, "User quota requested but "
1400 "filesystem feature is not set\n");
1401 status = 0;
1402 goto bail;
1403 }
1404 mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA; 1419 mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA;
1405 break; 1420 break;
1406 case Opt_grpquota: 1421 case Opt_grpquota:
1407 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1408 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1409 mlog(ML_ERROR, "Group quota requested but "
1410 "filesystem feature is not set\n");
1411 status = 0;
1412 goto bail;
1413 }
1414 mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA; 1422 mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA;
1415 break; 1423 break;
1416#ifdef CONFIG_OCFS2_FS_POSIX_ACL
1417 case Opt_acl: 1424 case Opt_acl:
1418 mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL; 1425 mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL;
1426 mopt->mount_opt &= ~OCFS2_MOUNT_NO_POSIX_ACL;
1419 break; 1427 break;
1420 case Opt_noacl: 1428 case Opt_noacl:
1429 mopt->mount_opt |= OCFS2_MOUNT_NO_POSIX_ACL;
1421 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; 1430 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
1422 break; 1431 break;
1423#else
1424 case Opt_acl:
1425 case Opt_noacl:
1426 printk(KERN_INFO "ocfs2 (no)acl options not supported\n");
1427 break;
1428#endif
1429 default: 1432 default:
1430 mlog(ML_ERROR, 1433 mlog(ML_ERROR,
1431 "Unrecognized mount option \"%s\" " 1434 "Unrecognized mount option \"%s\" "
@@ -1502,12 +1505,10 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1502 if (opts & OCFS2_MOUNT_INODE64) 1505 if (opts & OCFS2_MOUNT_INODE64)
1503 seq_printf(s, ",inode64"); 1506 seq_printf(s, ",inode64");
1504 1507
1505#ifdef CONFIG_OCFS2_FS_POSIX_ACL
1506 if (opts & OCFS2_MOUNT_POSIX_ACL) 1508 if (opts & OCFS2_MOUNT_POSIX_ACL)
1507 seq_printf(s, ",acl"); 1509 seq_printf(s, ",acl");
1508 else 1510 else
1509 seq_printf(s, ",noacl"); 1511 seq_printf(s, ",noacl");
1510#endif
1511 1512
1512 return 0; 1513 return 0;
1513} 1514}
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index e3421030a69f..49b133ccbf11 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -163,6 +163,7 @@ const struct inode_operations ocfs2_symlink_inode_operations = {
163 .getxattr = generic_getxattr, 163 .getxattr = generic_getxattr,
164 .listxattr = ocfs2_listxattr, 164 .listxattr = ocfs2_listxattr,
165 .removexattr = generic_removexattr, 165 .removexattr = generic_removexattr,
166 .fiemap = ocfs2_fiemap,
166}; 167};
167const struct inode_operations ocfs2_fast_symlink_inode_operations = { 168const struct inode_operations ocfs2_fast_symlink_inode_operations = {
168 .readlink = ocfs2_readlink, 169 .readlink = ocfs2_readlink,
@@ -174,4 +175,5 @@ const struct inode_operations ocfs2_fast_symlink_inode_operations = {
174 .getxattr = generic_getxattr, 175 .getxattr = generic_getxattr,
175 .listxattr = ocfs2_listxattr, 176 .listxattr = ocfs2_listxattr,
176 .removexattr = generic_removexattr, 177 .removexattr = generic_removexattr,
178 .fiemap = ocfs2_fiemap,
177}; 179};
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 43c114831c0d..8fc6fb071c6d 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -98,10 +98,8 @@ static struct ocfs2_xattr_def_value_root def_xv = {
98 98
99struct xattr_handler *ocfs2_xattr_handlers[] = { 99struct xattr_handler *ocfs2_xattr_handlers[] = {
100 &ocfs2_xattr_user_handler, 100 &ocfs2_xattr_user_handler,
101#ifdef CONFIG_OCFS2_FS_POSIX_ACL
102 &ocfs2_xattr_acl_access_handler, 101 &ocfs2_xattr_acl_access_handler,
103 &ocfs2_xattr_acl_default_handler, 102 &ocfs2_xattr_acl_default_handler,
104#endif
105 &ocfs2_xattr_trusted_handler, 103 &ocfs2_xattr_trusted_handler,
106 &ocfs2_xattr_security_handler, 104 &ocfs2_xattr_security_handler,
107 NULL 105 NULL
@@ -109,12 +107,10 @@ struct xattr_handler *ocfs2_xattr_handlers[] = {
109 107
110static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { 108static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = {
111 [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, 109 [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler,
112#ifdef CONFIG_OCFS2_FS_POSIX_ACL
113 [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS] 110 [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS]
114 = &ocfs2_xattr_acl_access_handler, 111 = &ocfs2_xattr_acl_access_handler,
115 [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT] 112 [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT]
116 = &ocfs2_xattr_acl_default_handler, 113 = &ocfs2_xattr_acl_default_handler,
117#endif
118 [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler, 114 [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler,
119 [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler, 115 [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler,
120}; 116};
@@ -6064,7 +6060,7 @@ static int ocfs2_value_metas_in_xattr_header(struct super_block *sb,
6064 * to the extent block, so just calculate a maximum record num. 6060 * to the extent block, so just calculate a maximum record num.
6065 */ 6061 */
6066 if (!xv->xr_list.l_tree_depth) 6062 if (!xv->xr_list.l_tree_depth)
6067 *num_recs += xv->xr_list.l_next_free_rec; 6063 *num_recs += le16_to_cpu(xv->xr_list.l_next_free_rec);
6068 else 6064 else
6069 *num_recs += ocfs2_clusters_for_bytes(sb, 6065 *num_recs += ocfs2_clusters_for_bytes(sb,
6070 XATTR_SIZE_MAX); 6066 XATTR_SIZE_MAX);
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
index 08e36389f56d..abd72a47f520 100644
--- a/fs/ocfs2/xattr.h
+++ b/fs/ocfs2/xattr.h
@@ -40,10 +40,8 @@ struct ocfs2_security_xattr_info {
40extern struct xattr_handler ocfs2_xattr_user_handler; 40extern struct xattr_handler ocfs2_xattr_user_handler;
41extern struct xattr_handler ocfs2_xattr_trusted_handler; 41extern struct xattr_handler ocfs2_xattr_trusted_handler;
42extern struct xattr_handler ocfs2_xattr_security_handler; 42extern struct xattr_handler ocfs2_xattr_security_handler;
43#ifdef CONFIG_OCFS2_FS_POSIX_ACL
44extern struct xattr_handler ocfs2_xattr_acl_access_handler; 43extern struct xattr_handler ocfs2_xattr_acl_access_handler;
45extern struct xattr_handler ocfs2_xattr_acl_default_handler; 44extern struct xattr_handler ocfs2_xattr_acl_default_handler;
46#endif
47extern struct xattr_handler *ocfs2_xattr_handlers[]; 45extern struct xattr_handler *ocfs2_xattr_handlers[];
48 46
49ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); 47ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
diff --git a/fs/open.c b/fs/open.c
index ca69241796bd..040cef72bc00 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -821,15 +821,14 @@ static inline int __get_file_write_access(struct inode *inode,
821} 821}
822 822
823static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, 823static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
824 int flags, struct file *f, 824 struct file *f,
825 int (*open)(struct inode *, struct file *), 825 int (*open)(struct inode *, struct file *),
826 const struct cred *cred) 826 const struct cred *cred)
827{ 827{
828 struct inode *inode; 828 struct inode *inode;
829 int error; 829 int error;
830 830
831 f->f_flags = flags; 831 f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK |
832 f->f_mode = (__force fmode_t)((flags+1) & O_ACCMODE) | FMODE_LSEEK |
833 FMODE_PREAD | FMODE_PWRITE; 832 FMODE_PREAD | FMODE_PWRITE;
834 inode = dentry->d_inode; 833 inode = dentry->d_inode;
835 if (f->f_mode & FMODE_WRITE) { 834 if (f->f_mode & FMODE_WRITE) {
@@ -930,7 +929,6 @@ struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry
930 if (IS_ERR(dentry)) 929 if (IS_ERR(dentry))
931 goto out_err; 930 goto out_err;
932 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt), 931 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt),
933 nd->intent.open.flags - 1,
934 nd->intent.open.file, 932 nd->intent.open.file,
935 open, cred); 933 open, cred);
936out: 934out:
@@ -949,7 +947,7 @@ EXPORT_SYMBOL_GPL(lookup_instantiate_filp);
949 * 947 *
950 * Note that this function destroys the original nameidata 948 * Note that this function destroys the original nameidata
951 */ 949 */
952struct file *nameidata_to_filp(struct nameidata *nd, int flags) 950struct file *nameidata_to_filp(struct nameidata *nd)
953{ 951{
954 const struct cred *cred = current_cred(); 952 const struct cred *cred = current_cred();
955 struct file *filp; 953 struct file *filp;
@@ -958,7 +956,7 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
958 filp = nd->intent.open.file; 956 filp = nd->intent.open.file;
959 /* Has the filesystem initialised the file for us? */ 957 /* Has the filesystem initialised the file for us? */
960 if (filp->f_path.dentry == NULL) 958 if (filp->f_path.dentry == NULL)
961 filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, 959 filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp,
962 NULL, cred); 960 NULL, cred);
963 else 961 else
964 path_put(&nd->path); 962 path_put(&nd->path);
@@ -997,7 +995,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
997 return ERR_PTR(error); 995 return ERR_PTR(error);
998 } 996 }
999 997
1000 return __dentry_open(dentry, mnt, flags, f, NULL, cred); 998 f->f_flags = flags;
999 return __dentry_open(dentry, mnt, f, NULL, cred);
1001} 1000}
1002EXPORT_SYMBOL(dentry_open); 1001EXPORT_SYMBOL(dentry_open);
1003 1002
diff --git a/fs/pipe.c b/fs/pipe.c
index 43d79da5c57e..37ba29ff3158 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -906,17 +906,6 @@ void free_pipe_info(struct inode *inode)
906} 906}
907 907
908static struct vfsmount *pipe_mnt __read_mostly; 908static struct vfsmount *pipe_mnt __read_mostly;
909static int pipefs_delete_dentry(struct dentry *dentry)
910{
911 /*
912 * At creation time, we pretended this dentry was hashed
913 * (by clearing DCACHE_UNHASHED bit in d_flags)
914 * At delete time, we restore the truth : not hashed.
915 * (so that dput() can proceed correctly)
916 */
917 dentry->d_flags |= DCACHE_UNHASHED;
918 return 0;
919}
920 909
921/* 910/*
922 * pipefs_dname() is called from d_path(). 911 * pipefs_dname() is called from d_path().
@@ -928,7 +917,6 @@ static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen)
928} 917}
929 918
930static const struct dentry_operations pipefs_dentry_operations = { 919static const struct dentry_operations pipefs_dentry_operations = {
931 .d_delete = pipefs_delete_dentry,
932 .d_dname = pipefs_dname, 920 .d_dname = pipefs_dname,
933}; 921};
934 922
@@ -989,12 +977,6 @@ struct file *create_write_pipe(int flags)
989 path.mnt = mntget(pipe_mnt); 977 path.mnt = mntget(pipe_mnt);
990 978
991 path.dentry->d_op = &pipefs_dentry_operations; 979 path.dentry->d_op = &pipefs_dentry_operations;
992 /*
993 * We dont want to publish this dentry into global dentry hash table.
994 * We pretend dentry is already hashed, by unsetting DCACHE_UNHASHED
995 * This permits a working /proc/$pid/fd/XXX on pipes
996 */
997 path.dentry->d_flags &= ~DCACHE_UNHASHED;
998 d_instantiate(path.dentry, inode); 980 d_instantiate(path.dentry, inode);
999 981
1000 err = -ENFILE; 982 err = -ENFILE;
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 4badde179b18..13b5d0708175 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -134,13 +134,16 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
134 * simple bit tests. 134 * simple bit tests.
135 */ 135 */
136static const char *task_state_array[] = { 136static const char *task_state_array[] = {
137 "R (running)", /* 0 */ 137 "R (running)", /* 0 */
138 "S (sleeping)", /* 1 */ 138 "S (sleeping)", /* 1 */
139 "D (disk sleep)", /* 2 */ 139 "D (disk sleep)", /* 2 */
140 "T (stopped)", /* 4 */ 140 "T (stopped)", /* 4 */
141 "T (tracing stop)", /* 8 */ 141 "t (tracing stop)", /* 8 */
142 "Z (zombie)", /* 16 */ 142 "Z (zombie)", /* 16 */
143 "X (dead)" /* 32 */ 143 "X (dead)", /* 32 */
144 "x (dead)", /* 64 */
145 "K (wakekill)", /* 128 */
146 "W (waking)", /* 256 */
144}; 147};
145 148
146static inline const char *get_task_state(struct task_struct *tsk) 149static inline const char *get_task_state(struct task_struct *tsk)
@@ -148,6 +151,8 @@ static inline const char *get_task_state(struct task_struct *tsk)
148 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; 151 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state;
149 const char **p = &task_state_array[0]; 152 const char **p = &task_state_array[0];
150 153
154 BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array));
155
151 while (state) { 156 while (state) {
152 p++; 157 p++;
153 state >>= 1; 158 state >>= 1;
@@ -322,94 +327,6 @@ static inline void task_context_switch_counts(struct seq_file *m,
322 p->nivcsw); 327 p->nivcsw);
323} 328}
324 329
325#ifdef CONFIG_MMU
326
327struct stack_stats {
328 struct vm_area_struct *vma;
329 unsigned long startpage;
330 unsigned long usage;
331};
332
333static int stack_usage_pte_range(pmd_t *pmd, unsigned long addr,
334 unsigned long end, struct mm_walk *walk)
335{
336 struct stack_stats *ss = walk->private;
337 struct vm_area_struct *vma = ss->vma;
338 pte_t *pte, ptent;
339 spinlock_t *ptl;
340 int ret = 0;
341
342 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
343 for (; addr != end; pte++, addr += PAGE_SIZE) {
344 ptent = *pte;
345
346#ifdef CONFIG_STACK_GROWSUP
347 if (pte_present(ptent) || is_swap_pte(ptent))
348 ss->usage = addr - ss->startpage + PAGE_SIZE;
349#else
350 if (pte_present(ptent) || is_swap_pte(ptent)) {
351 ss->usage = ss->startpage - addr + PAGE_SIZE;
352 pte++;
353 ret = 1;
354 break;
355 }
356#endif
357 }
358 pte_unmap_unlock(pte - 1, ptl);
359 cond_resched();
360 return ret;
361}
362
363static inline unsigned long get_stack_usage_in_bytes(struct vm_area_struct *vma,
364 struct task_struct *task)
365{
366 struct stack_stats ss;
367 struct mm_walk stack_walk = {
368 .pmd_entry = stack_usage_pte_range,
369 .mm = vma->vm_mm,
370 .private = &ss,
371 };
372
373 if (!vma->vm_mm || is_vm_hugetlb_page(vma))
374 return 0;
375
376 ss.vma = vma;
377 ss.startpage = task->stack_start & PAGE_MASK;
378 ss.usage = 0;
379
380#ifdef CONFIG_STACK_GROWSUP
381 walk_page_range(KSTK_ESP(task) & PAGE_MASK, vma->vm_end,
382 &stack_walk);
383#else
384 walk_page_range(vma->vm_start, (KSTK_ESP(task) & PAGE_MASK) + PAGE_SIZE,
385 &stack_walk);
386#endif
387 return ss.usage;
388}
389
390static inline void task_show_stack_usage(struct seq_file *m,
391 struct task_struct *task)
392{
393 struct vm_area_struct *vma;
394 struct mm_struct *mm = get_task_mm(task);
395
396 if (mm) {
397 down_read(&mm->mmap_sem);
398 vma = find_vma(mm, task->stack_start);
399 if (vma)
400 seq_printf(m, "Stack usage:\t%lu kB\n",
401 get_stack_usage_in_bytes(vma, task) >> 10);
402
403 up_read(&mm->mmap_sem);
404 mmput(mm);
405 }
406}
407#else
408static void task_show_stack_usage(struct seq_file *m, struct task_struct *task)
409{
410}
411#endif /* CONFIG_MMU */
412
413static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) 330static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
414{ 331{
415 seq_printf(m, "Cpus_allowed:\t"); 332 seq_printf(m, "Cpus_allowed:\t");
@@ -440,7 +357,6 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
440 task_show_regs(m, task); 357 task_show_regs(m, task);
441#endif 358#endif
442 task_context_switch_counts(m, task); 359 task_context_switch_counts(m, task);
443 task_show_stack_usage(m, task);
444 return 0; 360 return 0;
445} 361}
446 362
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 47c03f4336b8..f277c4a111cb 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -361,12 +361,11 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
361 if (!pte_present(ptent)) 361 if (!pte_present(ptent))
362 continue; 362 continue;
363 363
364 mss->resident += PAGE_SIZE;
365
366 page = vm_normal_page(vma, addr, ptent); 364 page = vm_normal_page(vma, addr, ptent);
367 if (!page) 365 if (!page)
368 continue; 366 continue;
369 367
368 mss->resident += PAGE_SIZE;
370 /* Accumulate the size in pages that have been accessed. */ 369 /* Accumulate the size in pages that have been accessed. */
371 if (pte_young(ptent) || PageReferenced(page)) 370 if (pte_young(ptent) || PageReferenced(page))
372 mss->referenced += PAGE_SIZE; 371 mss->referenced += PAGE_SIZE;
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index cd6bb9a33c13..3fc62b097bed 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -323,6 +323,30 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)
323} 323}
324EXPORT_SYMBOL(dquot_mark_dquot_dirty); 324EXPORT_SYMBOL(dquot_mark_dquot_dirty);
325 325
326/* Dirtify all the dquots - this can block when journalling */
327static inline int mark_all_dquot_dirty(struct dquot * const *dquot)
328{
329 int ret, err, cnt;
330
331 ret = err = 0;
332 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
333 if (dquot[cnt])
334 /* Even in case of error we have to continue */
335 ret = mark_dquot_dirty(dquot[cnt]);
336 if (!err)
337 err = ret;
338 }
339 return err;
340}
341
342static inline void dqput_all(struct dquot **dquot)
343{
344 unsigned int cnt;
345
346 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
347 dqput(dquot[cnt]);
348}
349
326/* This function needs dq_list_lock */ 350/* This function needs dq_list_lock */
327static inline int clear_dquot_dirty(struct dquot *dquot) 351static inline int clear_dquot_dirty(struct dquot *dquot)
328{ 352{
@@ -1268,8 +1292,7 @@ int dquot_initialize(struct inode *inode, int type)
1268out_err: 1292out_err:
1269 up_write(&sb_dqopt(sb)->dqptr_sem); 1293 up_write(&sb_dqopt(sb)->dqptr_sem);
1270 /* Drop unused references */ 1294 /* Drop unused references */
1271 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1295 dqput_all(got);
1272 dqput(got[cnt]);
1273 return ret; 1296 return ret;
1274} 1297}
1275EXPORT_SYMBOL(dquot_initialize); 1298EXPORT_SYMBOL(dquot_initialize);
@@ -1288,9 +1311,7 @@ int dquot_drop(struct inode *inode)
1288 inode->i_dquot[cnt] = NULL; 1311 inode->i_dquot[cnt] = NULL;
1289 } 1312 }
1290 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1313 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1291 1314 dqput_all(put);
1292 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1293 dqput(put[cnt]);
1294 return 0; 1315 return 0;
1295} 1316}
1296EXPORT_SYMBOL(dquot_drop); 1317EXPORT_SYMBOL(dquot_drop);
@@ -1319,6 +1340,70 @@ void vfs_dq_drop(struct inode *inode)
1319EXPORT_SYMBOL(vfs_dq_drop); 1340EXPORT_SYMBOL(vfs_dq_drop);
1320 1341
1321/* 1342/*
1343 * inode_reserved_space is managed internally by quota, and protected by
1344 * i_lock similar to i_blocks+i_bytes.
1345 */
1346static qsize_t *inode_reserved_space(struct inode * inode)
1347{
1348 /* Filesystem must explicitly define it's own method in order to use
1349 * quota reservation interface */
1350 BUG_ON(!inode->i_sb->dq_op->get_reserved_space);
1351 return inode->i_sb->dq_op->get_reserved_space(inode);
1352}
1353
1354static void inode_add_rsv_space(struct inode *inode, qsize_t number)
1355{
1356 spin_lock(&inode->i_lock);
1357 *inode_reserved_space(inode) += number;
1358 spin_unlock(&inode->i_lock);
1359}
1360
1361
1362static void inode_claim_rsv_space(struct inode *inode, qsize_t number)
1363{
1364 spin_lock(&inode->i_lock);
1365 *inode_reserved_space(inode) -= number;
1366 __inode_add_bytes(inode, number);
1367 spin_unlock(&inode->i_lock);
1368}
1369
1370static void inode_sub_rsv_space(struct inode *inode, qsize_t number)
1371{
1372 spin_lock(&inode->i_lock);
1373 *inode_reserved_space(inode) -= number;
1374 spin_unlock(&inode->i_lock);
1375}
1376
1377static qsize_t inode_get_rsv_space(struct inode *inode)
1378{
1379 qsize_t ret;
1380
1381 if (!inode->i_sb->dq_op->get_reserved_space)
1382 return 0;
1383 spin_lock(&inode->i_lock);
1384 ret = *inode_reserved_space(inode);
1385 spin_unlock(&inode->i_lock);
1386 return ret;
1387}
1388
1389static void inode_incr_space(struct inode *inode, qsize_t number,
1390 int reserve)
1391{
1392 if (reserve)
1393 inode_add_rsv_space(inode, number);
1394 else
1395 inode_add_bytes(inode, number);
1396}
1397
1398static void inode_decr_space(struct inode *inode, qsize_t number, int reserve)
1399{
1400 if (reserve)
1401 inode_sub_rsv_space(inode, number);
1402 else
1403 inode_sub_bytes(inode, number);
1404}
1405
1406/*
1322 * Following four functions update i_blocks+i_bytes fields and 1407 * Following four functions update i_blocks+i_bytes fields and
1323 * quota information (together with appropriate checks) 1408 * quota information (together with appropriate checks)
1324 * NOTE: We absolutely rely on the fact that caller dirties 1409 * NOTE: We absolutely rely on the fact that caller dirties
@@ -1336,6 +1421,21 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
1336 int cnt, ret = QUOTA_OK; 1421 int cnt, ret = QUOTA_OK;
1337 char warntype[MAXQUOTAS]; 1422 char warntype[MAXQUOTAS];
1338 1423
1424 /*
1425 * First test before acquiring mutex - solves deadlocks when we
1426 * re-enter the quota code and are already holding the mutex
1427 */
1428 if (IS_NOQUOTA(inode)) {
1429 inode_incr_space(inode, number, reserve);
1430 goto out;
1431 }
1432
1433 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1434 if (IS_NOQUOTA(inode)) {
1435 inode_incr_space(inode, number, reserve);
1436 goto out_unlock;
1437 }
1438
1339 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1439 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1340 warntype[cnt] = QUOTA_NL_NOWARN; 1440 warntype[cnt] = QUOTA_NL_NOWARN;
1341 1441
@@ -1346,7 +1446,8 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
1346 if (check_bdq(inode->i_dquot[cnt], number, warn, warntype+cnt) 1446 if (check_bdq(inode->i_dquot[cnt], number, warn, warntype+cnt)
1347 == NO_QUOTA) { 1447 == NO_QUOTA) {
1348 ret = NO_QUOTA; 1448 ret = NO_QUOTA;
1349 goto out_unlock; 1449 spin_unlock(&dq_data_lock);
1450 goto out_flush_warn;
1350 } 1451 }
1351 } 1452 }
1352 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1453 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
@@ -1357,64 +1458,29 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
1357 else 1458 else
1358 dquot_incr_space(inode->i_dquot[cnt], number); 1459 dquot_incr_space(inode->i_dquot[cnt], number);
1359 } 1460 }
1360 if (!reserve) 1461 inode_incr_space(inode, number, reserve);
1361 inode_add_bytes(inode, number);
1362out_unlock:
1363 spin_unlock(&dq_data_lock); 1462 spin_unlock(&dq_data_lock);
1463
1464 if (reserve)
1465 goto out_flush_warn;
1466 mark_all_dquot_dirty(inode->i_dquot);
1467out_flush_warn:
1364 flush_warnings(inode->i_dquot, warntype); 1468 flush_warnings(inode->i_dquot, warntype);
1469out_unlock:
1470 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1471out:
1365 return ret; 1472 return ret;
1366} 1473}
1367 1474
1368int dquot_alloc_space(struct inode *inode, qsize_t number, int warn) 1475int dquot_alloc_space(struct inode *inode, qsize_t number, int warn)
1369{ 1476{
1370 int cnt, ret = QUOTA_OK; 1477 return __dquot_alloc_space(inode, number, warn, 0);
1371
1372 /*
1373 * First test before acquiring mutex - solves deadlocks when we
1374 * re-enter the quota code and are already holding the mutex
1375 */
1376 if (IS_NOQUOTA(inode)) {
1377 inode_add_bytes(inode, number);
1378 goto out;
1379 }
1380
1381 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1382 if (IS_NOQUOTA(inode)) {
1383 inode_add_bytes(inode, number);
1384 goto out_unlock;
1385 }
1386
1387 ret = __dquot_alloc_space(inode, number, warn, 0);
1388 if (ret == NO_QUOTA)
1389 goto out_unlock;
1390
1391 /* Dirtify all the dquots - this can block when journalling */
1392 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1393 if (inode->i_dquot[cnt])
1394 mark_dquot_dirty(inode->i_dquot[cnt]);
1395out_unlock:
1396 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1397out:
1398 return ret;
1399} 1478}
1400EXPORT_SYMBOL(dquot_alloc_space); 1479EXPORT_SYMBOL(dquot_alloc_space);
1401 1480
1402int dquot_reserve_space(struct inode *inode, qsize_t number, int warn) 1481int dquot_reserve_space(struct inode *inode, qsize_t number, int warn)
1403{ 1482{
1404 int ret = QUOTA_OK; 1483 return __dquot_alloc_space(inode, number, warn, 1);
1405
1406 if (IS_NOQUOTA(inode))
1407 goto out;
1408
1409 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1410 if (IS_NOQUOTA(inode))
1411 goto out_unlock;
1412
1413 ret = __dquot_alloc_space(inode, number, warn, 1);
1414out_unlock:
1415 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1416out:
1417 return ret;
1418} 1484}
1419EXPORT_SYMBOL(dquot_reserve_space); 1485EXPORT_SYMBOL(dquot_reserve_space);
1420 1486
@@ -1455,10 +1521,7 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number)
1455warn_put_all: 1521warn_put_all:
1456 spin_unlock(&dq_data_lock); 1522 spin_unlock(&dq_data_lock);
1457 if (ret == QUOTA_OK) 1523 if (ret == QUOTA_OK)
1458 /* Dirtify all the dquots - this can block when journalling */ 1524 mark_all_dquot_dirty(inode->i_dquot);
1459 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1460 if (inode->i_dquot[cnt])
1461 mark_dquot_dirty(inode->i_dquot[cnt]);
1462 flush_warnings(inode->i_dquot, warntype); 1525 flush_warnings(inode->i_dquot, warntype);
1463 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1526 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1464 return ret; 1527 return ret;
@@ -1471,14 +1534,14 @@ int dquot_claim_space(struct inode *inode, qsize_t number)
1471 int ret = QUOTA_OK; 1534 int ret = QUOTA_OK;
1472 1535
1473 if (IS_NOQUOTA(inode)) { 1536 if (IS_NOQUOTA(inode)) {
1474 inode_add_bytes(inode, number); 1537 inode_claim_rsv_space(inode, number);
1475 goto out; 1538 goto out;
1476 } 1539 }
1477 1540
1478 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1541 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1479 if (IS_NOQUOTA(inode)) { 1542 if (IS_NOQUOTA(inode)) {
1480 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1543 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1481 inode_add_bytes(inode, number); 1544 inode_claim_rsv_space(inode, number);
1482 goto out; 1545 goto out;
1483 } 1546 }
1484 1547
@@ -1490,12 +1553,9 @@ int dquot_claim_space(struct inode *inode, qsize_t number)
1490 number); 1553 number);
1491 } 1554 }
1492 /* Update inode bytes */ 1555 /* Update inode bytes */
1493 inode_add_bytes(inode, number); 1556 inode_claim_rsv_space(inode, number);
1494 spin_unlock(&dq_data_lock); 1557 spin_unlock(&dq_data_lock);
1495 /* Dirtify all the dquots - this can block when journalling */ 1558 mark_all_dquot_dirty(inode->i_dquot);
1496 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1497 if (inode->i_dquot[cnt])
1498 mark_dquot_dirty(inode->i_dquot[cnt]);
1499 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1559 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1500out: 1560out:
1501 return ret; 1561 return ret;
@@ -1503,38 +1563,9 @@ out:
1503EXPORT_SYMBOL(dquot_claim_space); 1563EXPORT_SYMBOL(dquot_claim_space);
1504 1564
1505/* 1565/*
1506 * Release reserved quota space
1507 */
1508void dquot_release_reserved_space(struct inode *inode, qsize_t number)
1509{
1510 int cnt;
1511
1512 if (IS_NOQUOTA(inode))
1513 goto out;
1514
1515 down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1516 if (IS_NOQUOTA(inode))
1517 goto out_unlock;
1518
1519 spin_lock(&dq_data_lock);
1520 /* Release reserved dquots */
1521 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1522 if (inode->i_dquot[cnt])
1523 dquot_free_reserved_space(inode->i_dquot[cnt], number);
1524 }
1525 spin_unlock(&dq_data_lock);
1526
1527out_unlock:
1528 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1529out:
1530 return;
1531}
1532EXPORT_SYMBOL(dquot_release_reserved_space);
1533
1534/*
1535 * This operation can block, but only after everything is updated 1566 * This operation can block, but only after everything is updated
1536 */ 1567 */
1537int dquot_free_space(struct inode *inode, qsize_t number) 1568int __dquot_free_space(struct inode *inode, qsize_t number, int reserve)
1538{ 1569{
1539 unsigned int cnt; 1570 unsigned int cnt;
1540 char warntype[MAXQUOTAS]; 1571 char warntype[MAXQUOTAS];
@@ -1543,7 +1574,7 @@ int dquot_free_space(struct inode *inode, qsize_t number)
1543 * re-enter the quota code and are already holding the mutex */ 1574 * re-enter the quota code and are already holding the mutex */
1544 if (IS_NOQUOTA(inode)) { 1575 if (IS_NOQUOTA(inode)) {
1545out_sub: 1576out_sub:
1546 inode_sub_bytes(inode, number); 1577 inode_decr_space(inode, number, reserve);
1547 return QUOTA_OK; 1578 return QUOTA_OK;
1548 } 1579 }
1549 1580
@@ -1558,21 +1589,40 @@ out_sub:
1558 if (!inode->i_dquot[cnt]) 1589 if (!inode->i_dquot[cnt])
1559 continue; 1590 continue;
1560 warntype[cnt] = info_bdq_free(inode->i_dquot[cnt], number); 1591 warntype[cnt] = info_bdq_free(inode->i_dquot[cnt], number);
1561 dquot_decr_space(inode->i_dquot[cnt], number); 1592 if (reserve)
1593 dquot_free_reserved_space(inode->i_dquot[cnt], number);
1594 else
1595 dquot_decr_space(inode->i_dquot[cnt], number);
1562 } 1596 }
1563 inode_sub_bytes(inode, number); 1597 inode_decr_space(inode, number, reserve);
1564 spin_unlock(&dq_data_lock); 1598 spin_unlock(&dq_data_lock);
1565 /* Dirtify all the dquots - this can block when journalling */ 1599
1566 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1600 if (reserve)
1567 if (inode->i_dquot[cnt]) 1601 goto out_unlock;
1568 mark_dquot_dirty(inode->i_dquot[cnt]); 1602 mark_all_dquot_dirty(inode->i_dquot);
1603out_unlock:
1569 flush_warnings(inode->i_dquot, warntype); 1604 flush_warnings(inode->i_dquot, warntype);
1570 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1605 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1571 return QUOTA_OK; 1606 return QUOTA_OK;
1572} 1607}
1608
1609int dquot_free_space(struct inode *inode, qsize_t number)
1610{
1611 return __dquot_free_space(inode, number, 0);
1612}
1573EXPORT_SYMBOL(dquot_free_space); 1613EXPORT_SYMBOL(dquot_free_space);
1574 1614
1575/* 1615/*
1616 * Release reserved quota space
1617 */
1618void dquot_release_reserved_space(struct inode *inode, qsize_t number)
1619{
1620 __dquot_free_space(inode, number, 1);
1621
1622}
1623EXPORT_SYMBOL(dquot_release_reserved_space);
1624
1625/*
1576 * This operation can block, but only after everything is updated 1626 * This operation can block, but only after everything is updated
1577 */ 1627 */
1578int dquot_free_inode(const struct inode *inode, qsize_t number) 1628int dquot_free_inode(const struct inode *inode, qsize_t number)
@@ -1599,10 +1649,7 @@ int dquot_free_inode(const struct inode *inode, qsize_t number)
1599 dquot_decr_inodes(inode->i_dquot[cnt], number); 1649 dquot_decr_inodes(inode->i_dquot[cnt], number);
1600 } 1650 }
1601 spin_unlock(&dq_data_lock); 1651 spin_unlock(&dq_data_lock);
1602 /* Dirtify all the dquots - this can block when journalling */ 1652 mark_all_dquot_dirty(inode->i_dquot);
1603 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1604 if (inode->i_dquot[cnt])
1605 mark_dquot_dirty(inode->i_dquot[cnt]);
1606 flush_warnings(inode->i_dquot, warntype); 1653 flush_warnings(inode->i_dquot, warntype);
1607 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1654 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1608 return QUOTA_OK; 1655 return QUOTA_OK;
@@ -1610,19 +1657,6 @@ int dquot_free_inode(const struct inode *inode, qsize_t number)
1610EXPORT_SYMBOL(dquot_free_inode); 1657EXPORT_SYMBOL(dquot_free_inode);
1611 1658
1612/* 1659/*
1613 * call back function, get reserved quota space from underlying fs
1614 */
1615qsize_t dquot_get_reserved_space(struct inode *inode)
1616{
1617 qsize_t reserved_space = 0;
1618
1619 if (sb_any_quota_active(inode->i_sb) &&
1620 inode->i_sb->dq_op->get_reserved_space)
1621 reserved_space = inode->i_sb->dq_op->get_reserved_space(inode);
1622 return reserved_space;
1623}
1624
1625/*
1626 * Transfer the number of inode and blocks from one diskquota to an other. 1660 * Transfer the number of inode and blocks from one diskquota to an other.
1627 * 1661 *
1628 * This operation can block, but only after everything is updated 1662 * This operation can block, but only after everything is updated
@@ -1665,7 +1699,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1665 } 1699 }
1666 spin_lock(&dq_data_lock); 1700 spin_lock(&dq_data_lock);
1667 cur_space = inode_get_bytes(inode); 1701 cur_space = inode_get_bytes(inode);
1668 rsv_space = dquot_get_reserved_space(inode); 1702 rsv_space = inode_get_rsv_space(inode);
1669 space = cur_space + rsv_space; 1703 space = cur_space + rsv_space;
1670 /* Build the transfer_from list and check the limits */ 1704 /* Build the transfer_from list and check the limits */
1671 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1705 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
@@ -1709,25 +1743,18 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1709 spin_unlock(&dq_data_lock); 1743 spin_unlock(&dq_data_lock);
1710 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1744 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1711 1745
1712 /* Dirtify all the dquots - this can block when journalling */ 1746 mark_all_dquot_dirty(transfer_from);
1713 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1747 mark_all_dquot_dirty(transfer_to);
1714 if (transfer_from[cnt]) 1748 /* The reference we got is transferred to the inode */
1715 mark_dquot_dirty(transfer_from[cnt]); 1749 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1716 if (transfer_to[cnt]) { 1750 transfer_to[cnt] = NULL;
1717 mark_dquot_dirty(transfer_to[cnt]);
1718 /* The reference we got is transferred to the inode */
1719 transfer_to[cnt] = NULL;
1720 }
1721 }
1722warn_put_all: 1751warn_put_all:
1723 flush_warnings(transfer_to, warntype_to); 1752 flush_warnings(transfer_to, warntype_to);
1724 flush_warnings(transfer_from, warntype_from_inodes); 1753 flush_warnings(transfer_from, warntype_from_inodes);
1725 flush_warnings(transfer_from, warntype_from_space); 1754 flush_warnings(transfer_from, warntype_from_space);
1726put_all: 1755put_all:
1727 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1756 dqput_all(transfer_from);
1728 dqput(transfer_from[cnt]); 1757 dqput_all(transfer_to);
1729 dqput(transfer_to[cnt]);
1730 }
1731 return ret; 1758 return ret;
1732over_quota: 1759over_quota:
1733 spin_unlock(&dq_data_lock); 1760 spin_unlock(&dq_data_lock);
diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 3dfc23e02135..e3da02f4986f 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -97,8 +97,11 @@ static int v2_read_file_info(struct super_block *sb, int type)
97 unsigned int version; 97 unsigned int version;
98 98
99 if (!v2_read_header(sb, type, &dqhead)) 99 if (!v2_read_header(sb, type, &dqhead))
100 return 0; 100 return -1;
101 version = le32_to_cpu(dqhead.dqh_version); 101 version = le32_to_cpu(dqhead.dqh_version);
102 if ((info->dqi_fmt_id == QFMT_VFS_V0 && version != 0) ||
103 (info->dqi_fmt_id == QFMT_VFS_V1 && version != 1))
104 return -1;
102 105
103 size = sb->s_op->quota_read(sb, type, (char *)&dinfo, 106 size = sb->s_op->quota_read(sb, type, (char *)&dinfo,
104 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); 107 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
@@ -120,8 +123,8 @@ static int v2_read_file_info(struct super_block *sb, int type)
120 info->dqi_maxilimit = 0xffffffff; 123 info->dqi_maxilimit = 0xffffffff;
121 } else { 124 } else {
122 /* used space is stored as unsigned 64-bit value */ 125 /* used space is stored as unsigned 64-bit value */
123 info->dqi_maxblimit = 0xffffffffffffffff; /* 2^64-1 */ 126 info->dqi_maxblimit = 0xffffffffffffffffULL; /* 2^64-1 */
124 info->dqi_maxilimit = 0xffffffffffffffff; 127 info->dqi_maxilimit = 0xffffffffffffffffULL;
125 } 128 }
126 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); 129 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
127 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); 130 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 32fae4040ebf..2efc57173fd7 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -60,7 +60,7 @@ const struct inode_operations ramfs_file_inode_operations = {
60 */ 60 */
61int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) 61int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
62{ 62{
63 unsigned long npages, xpages, loop, limit; 63 unsigned long npages, xpages, loop;
64 struct page *pages; 64 struct page *pages;
65 unsigned order; 65 unsigned order;
66 void *data; 66 void *data;
diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig
index ac7cd75c86f8..513f431038f9 100644
--- a/fs/reiserfs/Kconfig
+++ b/fs/reiserfs/Kconfig
@@ -1,7 +1,6 @@
1config REISERFS_FS 1config REISERFS_FS
2 tristate "Reiserfs support" 2 tristate "Reiserfs support"
3 select CRC32 3 select CRC32
4 select FS_JOURNAL_INFO
5 help 4 help
6 Stores not just filenames but the files themselves in a balanced 5 Stores not just filenames but the files themselves in a balanced
7 tree. Uses journalling. 6 tree. Uses journalling.
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 685495707181..65c872761177 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -1277,7 +1277,10 @@ int reiserfs_init_bitmap_cache(struct super_block *sb)
1277 struct reiserfs_bitmap_info *bitmap; 1277 struct reiserfs_bitmap_info *bitmap;
1278 unsigned int bmap_nr = reiserfs_bmap_count(sb); 1278 unsigned int bmap_nr = reiserfs_bmap_count(sb);
1279 1279
1280 /* Avoid lock recursion in fault case */
1281 reiserfs_write_unlock(sb);
1280 bitmap = vmalloc(sizeof(*bitmap) * bmap_nr); 1282 bitmap = vmalloc(sizeof(*bitmap) * bmap_nr);
1283 reiserfs_write_lock(sb);
1281 if (bitmap == NULL) 1284 if (bitmap == NULL)
1282 return -ENOMEM; 1285 return -ENOMEM;
1283 1286
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 3a28e7751b3c..9087b10209e6 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -31,11 +31,12 @@ void reiserfs_delete_inode(struct inode *inode)
31 JOURNAL_PER_BALANCE_CNT * 2 + 31 JOURNAL_PER_BALANCE_CNT * 2 +
32 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); 32 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
33 struct reiserfs_transaction_handle th; 33 struct reiserfs_transaction_handle th;
34 int depth;
34 int err; 35 int err;
35 36
36 truncate_inode_pages(&inode->i_data, 0); 37 truncate_inode_pages(&inode->i_data, 0);
37 38
38 reiserfs_write_lock(inode->i_sb); 39 depth = reiserfs_write_lock_once(inode->i_sb);
39 40
40 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ 41 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
41 if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ 42 if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
@@ -74,7 +75,7 @@ void reiserfs_delete_inode(struct inode *inode)
74 out: 75 out:
75 clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */ 76 clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */
76 inode->i_blocks = 0; 77 inode->i_blocks = 0;
77 reiserfs_write_unlock(inode->i_sb); 78 reiserfs_write_unlock_once(inode->i_sb, depth);
78} 79}
79 80
80static void _make_cpu_key(struct cpu_key *key, int version, __u32 dirid, 81static void _make_cpu_key(struct cpu_key *key, int version, __u32 dirid,
@@ -2538,6 +2539,12 @@ static int reiserfs_writepage(struct page *page, struct writeback_control *wbc)
2538 return reiserfs_write_full_page(page, wbc); 2539 return reiserfs_write_full_page(page, wbc);
2539} 2540}
2540 2541
2542static void reiserfs_truncate_failed_write(struct inode *inode)
2543{
2544 truncate_inode_pages(inode->i_mapping, inode->i_size);
2545 reiserfs_truncate_file(inode, 0);
2546}
2547
2541static int reiserfs_write_begin(struct file *file, 2548static int reiserfs_write_begin(struct file *file,
2542 struct address_space *mapping, 2549 struct address_space *mapping,
2543 loff_t pos, unsigned len, unsigned flags, 2550 loff_t pos, unsigned len, unsigned flags,
@@ -2604,6 +2611,8 @@ static int reiserfs_write_begin(struct file *file,
2604 if (ret) { 2611 if (ret) {
2605 unlock_page(page); 2612 unlock_page(page);
2606 page_cache_release(page); 2613 page_cache_release(page);
2614 /* Truncate allocated blocks */
2615 reiserfs_truncate_failed_write(inode);
2607 } 2616 }
2608 return ret; 2617 return ret;
2609} 2618}
@@ -2701,9 +2710,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
2701 ** transaction tracking stuff when the size changes. So, we have 2710 ** transaction tracking stuff when the size changes. So, we have
2702 ** to do the i_size updates here. 2711 ** to do the i_size updates here.
2703 */ 2712 */
2704 pos += copied; 2713 if (pos + copied > inode->i_size) {
2705
2706 if (pos > inode->i_size) {
2707 struct reiserfs_transaction_handle myth; 2714 struct reiserfs_transaction_handle myth;
2708 lock_depth = reiserfs_write_lock_once(inode->i_sb); 2715 lock_depth = reiserfs_write_lock_once(inode->i_sb);
2709 locked = true; 2716 locked = true;
@@ -2721,7 +2728,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
2721 goto journal_error; 2728 goto journal_error;
2722 2729
2723 reiserfs_update_inode_transaction(inode); 2730 reiserfs_update_inode_transaction(inode);
2724 inode->i_size = pos; 2731 inode->i_size = pos + copied;
2725 /* 2732 /*
2726 * this will just nest into our transaction. It's important 2733 * this will just nest into our transaction. It's important
2727 * to use mark_inode_dirty so the inode gets pushed around on the 2734 * to use mark_inode_dirty so the inode gets pushed around on the
@@ -2751,6 +2758,10 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
2751 reiserfs_write_unlock_once(inode->i_sb, lock_depth); 2758 reiserfs_write_unlock_once(inode->i_sb, lock_depth);
2752 unlock_page(page); 2759 unlock_page(page);
2753 page_cache_release(page); 2760 page_cache_release(page);
2761
2762 if (pos + len > inode->i_size)
2763 reiserfs_truncate_failed_write(inode);
2764
2754 return ret == 0 ? copied : ret; 2765 return ret == 0 ? copied : ret;
2755 2766
2756 journal_error: 2767 journal_error:
@@ -3051,13 +3062,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
3051int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) 3062int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3052{ 3063{
3053 struct inode *inode = dentry->d_inode; 3064 struct inode *inode = dentry->d_inode;
3054 int error;
3055 unsigned int ia_valid; 3065 unsigned int ia_valid;
3066 int depth;
3067 int error;
3056 3068
3057 /* must be turned off for recursive notify_change calls */ 3069 /* must be turned off for recursive notify_change calls */
3058 ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); 3070 ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
3059 3071
3060 reiserfs_write_lock(inode->i_sb); 3072 depth = reiserfs_write_lock_once(inode->i_sb);
3061 if (attr->ia_valid & ATTR_SIZE) { 3073 if (attr->ia_valid & ATTR_SIZE) {
3062 /* version 2 items will be caught by the s_maxbytes check 3074 /* version 2 items will be caught by the s_maxbytes check
3063 ** done for us in vmtruncate 3075 ** done for us in vmtruncate
@@ -3138,8 +3150,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3138 journal_end(&th, inode->i_sb, jbegin_count); 3150 journal_end(&th, inode->i_sb, jbegin_count);
3139 } 3151 }
3140 } 3152 }
3141 if (!error) 3153 if (!error) {
3154 /*
3155 * Relax the lock here, as it might truncate the
3156 * inode pages and wait for inode pages locks.
3157 * To release such page lock, the owner needs the
3158 * reiserfs lock
3159 */
3160 reiserfs_write_unlock_once(inode->i_sb, depth);
3142 error = inode_setattr(inode, attr); 3161 error = inode_setattr(inode, attr);
3162 depth = reiserfs_write_lock_once(inode->i_sb);
3163 }
3143 } 3164 }
3144 3165
3145 if (!error && reiserfs_posixacl(inode->i_sb)) { 3166 if (!error && reiserfs_posixacl(inode->i_sb)) {
@@ -3148,7 +3169,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3148 } 3169 }
3149 3170
3150 out: 3171 out:
3151 reiserfs_write_unlock(inode->i_sb); 3172 reiserfs_write_unlock_once(inode->i_sb, depth);
3173
3152 return error; 3174 return error;
3153} 3175}
3154 3176
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index ace77451ceb1..f53505de0712 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -104,9 +104,10 @@ setflags_out:
104 err = put_user(inode->i_generation, (int __user *)arg); 104 err = put_user(inode->i_generation, (int __user *)arg);
105 break; 105 break;
106 case REISERFS_IOC_SETVERSION: 106 case REISERFS_IOC_SETVERSION:
107 if (!is_owner_or_cap(inode)) 107 if (!is_owner_or_cap(inode)) {
108 err = -EPERM; 108 err = -EPERM;
109 break; 109 break;
110 }
110 err = mnt_want_write(filp->f_path.mnt); 111 err = mnt_want_write(filp->f_path.mnt);
111 if (err) 112 if (err)
112 break; 113 break;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 2f8a7e7b8dab..83ac4d3b3cb0 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2009,10 +2009,11 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
2009 destroy_workqueue(commit_wq); 2009 destroy_workqueue(commit_wq);
2010 commit_wq = NULL; 2010 commit_wq = NULL;
2011 } 2011 }
2012 reiserfs_write_lock(sb);
2013 2012
2014 free_journal_ram(sb); 2013 free_journal_ram(sb);
2015 2014
2015 reiserfs_write_lock(sb);
2016
2016 return 0; 2017 return 0;
2017} 2018}
2018 2019
@@ -2758,11 +2759,18 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
2758 struct reiserfs_journal *journal; 2759 struct reiserfs_journal *journal;
2759 struct reiserfs_journal_list *jl; 2760 struct reiserfs_journal_list *jl;
2760 char b[BDEVNAME_SIZE]; 2761 char b[BDEVNAME_SIZE];
2762 int ret;
2761 2763
2764 /*
2765 * Unlock here to avoid various RECLAIM-FS-ON <-> IN-RECLAIM-FS
2766 * dependency inversion warnings.
2767 */
2768 reiserfs_write_unlock(sb);
2762 journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal)); 2769 journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal));
2763 if (!journal) { 2770 if (!journal) {
2764 reiserfs_warning(sb, "journal-1256", 2771 reiserfs_warning(sb, "journal-1256",
2765 "unable to get memory for journal structure"); 2772 "unable to get memory for journal structure");
2773 reiserfs_write_lock(sb);
2766 return 1; 2774 return 1;
2767 } 2775 }
2768 memset(journal, 0, sizeof(struct reiserfs_journal)); 2776 memset(journal, 0, sizeof(struct reiserfs_journal));
@@ -2771,10 +2779,12 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
2771 INIT_LIST_HEAD(&journal->j_working_list); 2779 INIT_LIST_HEAD(&journal->j_working_list);
2772 INIT_LIST_HEAD(&journal->j_journal_list); 2780 INIT_LIST_HEAD(&journal->j_journal_list);
2773 journal->j_persistent_trans = 0; 2781 journal->j_persistent_trans = 0;
2774 if (reiserfs_allocate_list_bitmaps(sb, 2782 ret = reiserfs_allocate_list_bitmaps(sb, journal->j_list_bitmap,
2775 journal->j_list_bitmap, 2783 reiserfs_bmap_count(sb));
2776 reiserfs_bmap_count(sb))) 2784 reiserfs_write_lock(sb);
2785 if (ret)
2777 goto free_and_return; 2786 goto free_and_return;
2787
2778 allocate_bitmap_nodes(sb); 2788 allocate_bitmap_nodes(sb);
2779 2789
2780 /* reserved for journal area support */ 2790 /* reserved for journal area support */
diff --git a/fs/reiserfs/lock.c b/fs/reiserfs/lock.c
index ee2cfc0fd8a7..b87aa2c1afc1 100644
--- a/fs/reiserfs/lock.c
+++ b/fs/reiserfs/lock.c
@@ -86,3 +86,12 @@ void reiserfs_check_lock_depth(struct super_block *sb, char *caller)
86 reiserfs_panic(sb, "%s called without kernel lock held %d", 86 reiserfs_panic(sb, "%s called without kernel lock held %d",
87 caller); 87 caller);
88} 88}
89
90#ifdef CONFIG_REISERFS_CHECK
91void reiserfs_lock_check_recursive(struct super_block *sb)
92{
93 struct reiserfs_sb_info *sb_i = REISERFS_SB(sb);
94
95 WARN_ONCE((sb_i->lock_depth > 0), "Unwanted recursive reiserfs lock!\n");
96}
97#endif
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index e296ff72a6cc..9d4dcf0b07cb 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -921,6 +921,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
921 struct reiserfs_transaction_handle th; 921 struct reiserfs_transaction_handle th;
922 int jbegin_count; 922 int jbegin_count;
923 unsigned long savelink; 923 unsigned long savelink;
924 int depth;
924 925
925 inode = dentry->d_inode; 926 inode = dentry->d_inode;
926 927
@@ -932,7 +933,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
932 JOURNAL_PER_BALANCE_CNT * 2 + 2 + 933 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
933 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 934 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
934 935
935 reiserfs_write_lock(dir->i_sb); 936 depth = reiserfs_write_lock_once(dir->i_sb);
936 retval = journal_begin(&th, dir->i_sb, jbegin_count); 937 retval = journal_begin(&th, dir->i_sb, jbegin_count);
937 if (retval) 938 if (retval)
938 goto out_unlink; 939 goto out_unlink;
@@ -993,7 +994,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
993 994
994 retval = journal_end(&th, dir->i_sb, jbegin_count); 995 retval = journal_end(&th, dir->i_sb, jbegin_count);
995 reiserfs_check_path(&path); 996 reiserfs_check_path(&path);
996 reiserfs_write_unlock(dir->i_sb); 997 reiserfs_write_unlock_once(dir->i_sb, depth);
997 return retval; 998 return retval;
998 999
999 end_unlink: 1000 end_unlink:
@@ -1003,7 +1004,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
1003 if (err) 1004 if (err)
1004 retval = err; 1005 retval = err;
1005 out_unlink: 1006 out_unlink:
1006 reiserfs_write_unlock(dir->i_sb); 1007 reiserfs_write_unlock_once(dir->i_sb, depth);
1007 return retval; 1008 return retval;
1008} 1009}
1009 1010
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 8c7033a8b67e..81f09fab8ae4 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -83,7 +83,8 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry)
83 BUG_ON(!mutex_is_locked(&dir->i_mutex)); 83 BUG_ON(!mutex_is_locked(&dir->i_mutex));
84 vfs_dq_init(dir); 84 vfs_dq_init(dir);
85 85
86 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 86 reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex,
87 I_MUTEX_CHILD, dir->i_sb);
87 error = dir->i_op->unlink(dir, dentry); 88 error = dir->i_op->unlink(dir, dentry);
88 mutex_unlock(&dentry->d_inode->i_mutex); 89 mutex_unlock(&dentry->d_inode->i_mutex);
89 90
@@ -98,7 +99,8 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry)
98 BUG_ON(!mutex_is_locked(&dir->i_mutex)); 99 BUG_ON(!mutex_is_locked(&dir->i_mutex));
99 vfs_dq_init(dir); 100 vfs_dq_init(dir);
100 101
101 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); 102 reiserfs_mutex_lock_nested_safe(&dentry->d_inode->i_mutex,
103 I_MUTEX_CHILD, dir->i_sb);
102 dentry_unhash(dentry); 104 dentry_unhash(dentry);
103 error = dir->i_op->rmdir(dir, dentry); 105 error = dir->i_op->rmdir(dir, dentry);
104 if (!error) 106 if (!error)
@@ -235,16 +237,22 @@ static int reiserfs_for_each_xattr(struct inode *inode,
235 if (IS_PRIVATE(inode) || get_inode_sd_version(inode) == STAT_DATA_V1) 237 if (IS_PRIVATE(inode) || get_inode_sd_version(inode) == STAT_DATA_V1)
236 return 0; 238 return 0;
237 239
240 reiserfs_write_unlock(inode->i_sb);
238 dir = open_xa_dir(inode, XATTR_REPLACE); 241 dir = open_xa_dir(inode, XATTR_REPLACE);
239 if (IS_ERR(dir)) { 242 if (IS_ERR(dir)) {
240 err = PTR_ERR(dir); 243 err = PTR_ERR(dir);
244 reiserfs_write_lock(inode->i_sb);
241 goto out; 245 goto out;
242 } else if (!dir->d_inode) { 246 } else if (!dir->d_inode) {
243 err = 0; 247 err = 0;
248 reiserfs_write_lock(inode->i_sb);
244 goto out_dir; 249 goto out_dir;
245 } 250 }
246 251
247 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); 252 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR);
253
254 reiserfs_write_lock(inode->i_sb);
255
248 buf.xadir = dir; 256 buf.xadir = dir;
249 err = reiserfs_readdir_dentry(dir, &buf, fill_with_dentries, &pos); 257 err = reiserfs_readdir_dentry(dir, &buf, fill_with_dentries, &pos);
250 while ((err == 0 || err == -ENOSPC) && buf.count) { 258 while ((err == 0 || err == -ENOSPC) && buf.count) {
@@ -283,8 +291,9 @@ static int reiserfs_for_each_xattr(struct inode *inode,
283 err = journal_begin(&th, inode->i_sb, blocks); 291 err = journal_begin(&th, inode->i_sb, blocks);
284 if (!err) { 292 if (!err) {
285 int jerror; 293 int jerror;
286 mutex_lock_nested(&dir->d_parent->d_inode->i_mutex, 294 reiserfs_mutex_lock_nested_safe(
287 I_MUTEX_XATTR); 295 &dir->d_parent->d_inode->i_mutex,
296 I_MUTEX_XATTR, inode->i_sb);
288 err = action(dir, data); 297 err = action(dir, data);
289 jerror = journal_end(&th, inode->i_sb, blocks); 298 jerror = journal_end(&th, inode->i_sb, blocks);
290 mutex_unlock(&dir->d_parent->d_inode->i_mutex); 299 mutex_unlock(&dir->d_parent->d_inode->i_mutex);
@@ -443,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name)
443 } 452 }
444 453
445 if (dentry->d_inode) { 454 if (dentry->d_inode) {
455 reiserfs_write_lock(inode->i_sb);
446 err = xattr_unlink(xadir->d_inode, dentry); 456 err = xattr_unlink(xadir->d_inode, dentry);
457 reiserfs_write_unlock(inode->i_sb);
447 update_ctime(inode); 458 update_ctime(inode);
448 } 459 }
449 460
@@ -477,15 +488,24 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
477 if (get_inode_sd_version(inode) == STAT_DATA_V1) 488 if (get_inode_sd_version(inode) == STAT_DATA_V1)
478 return -EOPNOTSUPP; 489 return -EOPNOTSUPP;
479 490
480 if (!buffer) 491 reiserfs_write_unlock(inode->i_sb);
481 return lookup_and_delete_xattr(inode, name); 492
493 if (!buffer) {
494 err = lookup_and_delete_xattr(inode, name);
495 reiserfs_write_lock(inode->i_sb);
496 return err;
497 }
482 498
483 dentry = xattr_lookup(inode, name, flags); 499 dentry = xattr_lookup(inode, name, flags);
484 if (IS_ERR(dentry)) 500 if (IS_ERR(dentry)) {
501 reiserfs_write_lock(inode->i_sb);
485 return PTR_ERR(dentry); 502 return PTR_ERR(dentry);
503 }
486 504
487 down_write(&REISERFS_I(inode)->i_xattr_sem); 505 down_write(&REISERFS_I(inode)->i_xattr_sem);
488 506
507 reiserfs_write_lock(inode->i_sb);
508
489 xahash = xattr_hash(buffer, buffer_size); 509 xahash = xattr_hash(buffer, buffer_size);
490 while (buffer_pos < buffer_size || buffer_pos == 0) { 510 while (buffer_pos < buffer_size || buffer_pos == 0) {
491 size_t chunk; 511 size_t chunk;
@@ -540,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
540 .ia_size = buffer_size, 560 .ia_size = buffer_size,
541 .ia_valid = ATTR_SIZE | ATTR_CTIME, 561 .ia_valid = ATTR_SIZE | ATTR_CTIME,
542 }; 562 };
563
564 reiserfs_write_unlock(inode->i_sb);
543 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); 565 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR);
544 down_write(&dentry->d_inode->i_alloc_sem); 566 down_write(&dentry->d_inode->i_alloc_sem);
567 reiserfs_write_lock(inode->i_sb);
568
545 err = reiserfs_setattr(dentry, &newattrs); 569 err = reiserfs_setattr(dentry, &newattrs);
546 up_write(&dentry->d_inode->i_alloc_sem); 570 up_write(&dentry->d_inode->i_alloc_sem);
547 mutex_unlock(&dentry->d_inode->i_mutex); 571 mutex_unlock(&dentry->d_inode->i_mutex);
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index cc32e6ada67b..dd20a7883f0f 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode)
455 return 0; 455 return 0;
456 } 456 }
457 457
458 reiserfs_write_unlock(inode->i_sb);
458 acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); 459 acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
460 reiserfs_write_lock(inode->i_sb);
459 if (!acl) 461 if (!acl)
460 return 0; 462 return 0;
461 if (IS_ERR(acl)) 463 if (IS_ERR(acl))
diff --git a/fs/signalfd.c b/fs/signalfd.c
index b07565c94386..1dabe4ee02fe 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -236,7 +236,7 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
236 * anon_inode_getfd() will install the fd. 236 * anon_inode_getfd() will install the fd.
237 */ 237 */
238 ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, 238 ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx,
239 flags & (O_CLOEXEC | O_NONBLOCK)); 239 O_RDWR | (flags & (O_CLOEXEC | O_NONBLOCK)));
240 if (ufd < 0) 240 if (ufd < 0)
241 kfree(ctx); 241 kfree(ctx);
242 } else { 242 } else {
diff --git a/fs/stack.c b/fs/stack.c
index 67716f6a1a4a..4a6f7f440658 100644
--- a/fs/stack.c
+++ b/fs/stack.c
@@ -7,18 +7,63 @@
7 * This function cannot be inlined since i_size_{read,write} is rather 7 * This function cannot be inlined since i_size_{read,write} is rather
8 * heavy-weight on 32-bit systems 8 * heavy-weight on 32-bit systems
9 */ 9 */
10void fsstack_copy_inode_size(struct inode *dst, const struct inode *src) 10void fsstack_copy_inode_size(struct inode *dst, struct inode *src)
11{ 11{
12 i_size_write(dst, i_size_read((struct inode *)src)); 12 loff_t i_size;
13 dst->i_blocks = src->i_blocks; 13 blkcnt_t i_blocks;
14
15 /*
16 * i_size_read() includes its own seqlocking and protection from
17 * preemption (see include/linux/fs.h): we need nothing extra for
18 * that here, and prefer to avoid nesting locks than attempt to keep
19 * i_size and i_blocks in sync together.
20 */
21 i_size = i_size_read(src);
22
23 /*
24 * But if CONFIG_LBDAF (on 32-bit), we ought to make an effort to
25 * keep the two halves of i_blocks in sync despite SMP or PREEMPT -
26 * though stat's generic_fillattr() doesn't bother, and we won't be
27 * applying quotas (where i_blocks does become important) at the
28 * upper level.
29 *
30 * We don't actually know what locking is used at the lower level;
31 * but if it's a filesystem that supports quotas, it will be using
32 * i_lock as in inode_add_bytes(). tmpfs uses other locking, and
33 * its 32-bit is (just) able to exceed 2TB i_size with the aid of
34 * holes; but its i_blocks cannot carry into the upper long without
35 * almost 2TB swap - let's ignore that case.
36 */
37 if (sizeof(i_blocks) > sizeof(long))
38 spin_lock(&src->i_lock);
39 i_blocks = src->i_blocks;
40 if (sizeof(i_blocks) > sizeof(long))
41 spin_unlock(&src->i_lock);
42
43 /*
44 * If CONFIG_SMP or CONFIG_PREEMPT on 32-bit, it's vital for
45 * fsstack_copy_inode_size() to hold some lock around
46 * i_size_write(), otherwise i_size_read() may spin forever (see
47 * include/linux/fs.h). We don't necessarily hold i_mutex when this
48 * is called, so take i_lock for that case.
49 *
50 * And if CONFIG_LBADF (on 32-bit), continue our effort to keep the
51 * two halves of i_blocks in sync despite SMP or PREEMPT: use i_lock
52 * for that case too, and do both at once by combining the tests.
53 *
54 * There is none of this locking overhead in the 64-bit case.
55 */
56 if (sizeof(i_size) > sizeof(long) || sizeof(i_blocks) > sizeof(long))
57 spin_lock(&dst->i_lock);
58 i_size_write(dst, i_size);
59 dst->i_blocks = i_blocks;
60 if (sizeof(i_size) > sizeof(long) || sizeof(i_blocks) > sizeof(long))
61 spin_unlock(&dst->i_lock);
14} 62}
15EXPORT_SYMBOL_GPL(fsstack_copy_inode_size); 63EXPORT_SYMBOL_GPL(fsstack_copy_inode_size);
16 64
17/* copy all attributes; get_nlinks is optional way to override the i_nlink 65/* copy all attributes */
18 * copying 66void fsstack_copy_attr_all(struct inode *dest, const struct inode *src)
19 */
20void fsstack_copy_attr_all(struct inode *dest, const struct inode *src,
21 int (*get_nlinks)(struct inode *))
22{ 67{
23 dest->i_mode = src->i_mode; 68 dest->i_mode = src->i_mode;
24 dest->i_uid = src->i_uid; 69 dest->i_uid = src->i_uid;
@@ -29,14 +74,6 @@ void fsstack_copy_attr_all(struct inode *dest, const struct inode *src,
29 dest->i_ctime = src->i_ctime; 74 dest->i_ctime = src->i_ctime;
30 dest->i_blkbits = src->i_blkbits; 75 dest->i_blkbits = src->i_blkbits;
31 dest->i_flags = src->i_flags; 76 dest->i_flags = src->i_flags;
32 77 dest->i_nlink = src->i_nlink;
33 /*
34 * Update the nlinks AFTER updating the above fields, because the
35 * get_links callback may depend on them.
36 */
37 if (!get_nlinks)
38 dest->i_nlink = src->i_nlink;
39 else
40 dest->i_nlink = (*get_nlinks)(dest);
41} 78}
42EXPORT_SYMBOL_GPL(fsstack_copy_attr_all); 79EXPORT_SYMBOL_GPL(fsstack_copy_attr_all);
diff --git a/fs/stat.c b/fs/stat.c
index 075694e31d8b..c4ecd52c5737 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -401,9 +401,9 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
401} 401}
402#endif /* __ARCH_WANT_STAT64 */ 402#endif /* __ARCH_WANT_STAT64 */
403 403
404void inode_add_bytes(struct inode *inode, loff_t bytes) 404/* Caller is here responsible for sufficient locking (ie. inode->i_lock) */
405void __inode_add_bytes(struct inode *inode, loff_t bytes)
405{ 406{
406 spin_lock(&inode->i_lock);
407 inode->i_blocks += bytes >> 9; 407 inode->i_blocks += bytes >> 9;
408 bytes &= 511; 408 bytes &= 511;
409 inode->i_bytes += bytes; 409 inode->i_bytes += bytes;
@@ -411,6 +411,12 @@ void inode_add_bytes(struct inode *inode, loff_t bytes)
411 inode->i_blocks++; 411 inode->i_blocks++;
412 inode->i_bytes -= 512; 412 inode->i_bytes -= 512;
413 } 413 }
414}
415
416void inode_add_bytes(struct inode *inode, loff_t bytes)
417{
418 spin_lock(&inode->i_lock);
419 __inode_add_bytes(inode, bytes);
414 spin_unlock(&inode->i_lock); 420 spin_unlock(&inode->i_lock);
415} 421}
416 422
diff --git a/fs/super.c b/fs/super.c
index 19eb70b374bc..aff046b0fe78 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -901,8 +901,9 @@ int get_sb_single(struct file_system_type *fs_type,
901 return error; 901 return error;
902 } 902 }
903 s->s_flags |= MS_ACTIVE; 903 s->s_flags |= MS_ACTIVE;
904 } else {
905 do_remount_sb(s, flags, data, 0);
904 } 906 }
905 do_remount_sb(s, flags, data, 0);
906 simple_set_mnt(mnt, s); 907 simple_set_mnt(mnt, s);
907 return 0; 908 return 0;
908} 909}
diff --git a/fs/sync.c b/fs/sync.c
index 36752a683481..418727a2a239 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -355,6 +355,7 @@ SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
355{ 355{
356 int ret; 356 int ret;
357 struct file *file; 357 struct file *file;
358 struct address_space *mapping;
358 loff_t endbyte; /* inclusive */ 359 loff_t endbyte; /* inclusive */
359 int fput_needed; 360 int fput_needed;
360 umode_t i_mode; 361 umode_t i_mode;
@@ -405,7 +406,28 @@ SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
405 !S_ISLNK(i_mode)) 406 !S_ISLNK(i_mode))
406 goto out_put; 407 goto out_put;
407 408
408 ret = do_sync_mapping_range(file->f_mapping, offset, endbyte, flags); 409 mapping = file->f_mapping;
410 if (!mapping) {
411 ret = -EINVAL;
412 goto out_put;
413 }
414
415 ret = 0;
416 if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
417 ret = filemap_fdatawait_range(mapping, offset, endbyte);
418 if (ret < 0)
419 goto out_put;
420 }
421
422 if (flags & SYNC_FILE_RANGE_WRITE) {
423 ret = filemap_fdatawrite_range(mapping, offset, endbyte);
424 if (ret < 0)
425 goto out_put;
426 }
427
428 if (flags & SYNC_FILE_RANGE_WAIT_AFTER)
429 ret = filemap_fdatawait_range(mapping, offset, endbyte);
430
409out_put: 431out_put:
410 fput_light(file, fput_needed); 432 fput_light(file, fput_needed);
411out: 433out:
@@ -437,38 +459,3 @@ asmlinkage long SyS_sync_file_range2(long fd, long flags,
437} 459}
438SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2); 460SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2);
439#endif 461#endif
440
441/*
442 * `endbyte' is inclusive
443 */
444int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
445 loff_t endbyte, unsigned int flags)
446{
447 int ret;
448
449 if (!mapping) {
450 ret = -EINVAL;
451 goto out;
452 }
453
454 ret = 0;
455 if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
456 ret = filemap_fdatawait_range(mapping, offset, endbyte);
457 if (ret < 0)
458 goto out;
459 }
460
461 if (flags & SYNC_FILE_RANGE_WRITE) {
462 ret = __filemap_fdatawrite_range(mapping, offset, endbyte,
463 WB_SYNC_ALL);
464 if (ret < 0)
465 goto out;
466 }
467
468 if (flags & SYNC_FILE_RANGE_WAIT_AFTER) {
469 ret = filemap_fdatawait_range(mapping, offset, endbyte);
470 }
471out:
472 return ret;
473}
474EXPORT_SYMBOL_GPL(do_sync_mapping_range);
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 60c702bc10ae..a0a500af24a1 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -483,7 +483,8 @@ void unmap_bin_file(struct sysfs_dirent *attr_sd)
483 * @attr: attribute descriptor. 483 * @attr: attribute descriptor.
484 */ 484 */
485 485
486int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr) 486int sysfs_create_bin_file(struct kobject *kobj,
487 const struct bin_attribute *attr)
487{ 488{
488 BUG_ON(!kobj || !kobj->sd || !attr); 489 BUG_ON(!kobj || !kobj->sd || !attr);
489 490
@@ -497,7 +498,8 @@ int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
497 * @attr: attribute descriptor. 498 * @attr: attribute descriptor.
498 */ 499 */
499 500
500void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr) 501void sysfs_remove_bin_file(struct kobject *kobj,
502 const struct bin_attribute *attr)
501{ 503{
502 sysfs_hash_and_remove(kobj->sd, attr->attr.name); 504 sysfs_hash_and_remove(kobj->sd, attr->attr.name);
503} 505}
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index f05f2303a8b8..699f371b9f12 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -106,8 +106,10 @@ static struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd)
106 return NULL; 106 return NULL;
107 107
108 t = atomic_cmpxchg(&sd->s_active, v, v + 1); 108 t = atomic_cmpxchg(&sd->s_active, v, v + 1);
109 if (likely(t == v)) 109 if (likely(t == v)) {
110 rwsem_acquire_read(&sd->dep_map, 0, 1, _RET_IP_);
110 return sd; 111 return sd;
112 }
111 if (t < 0) 113 if (t < 0)
112 return NULL; 114 return NULL;
113 115
@@ -130,6 +132,7 @@ static void sysfs_put_active(struct sysfs_dirent *sd)
130 if (unlikely(!sd)) 132 if (unlikely(!sd))
131 return; 133 return;
132 134
135 rwsem_release(&sd->dep_map, 1, _RET_IP_);
133 v = atomic_dec_return(&sd->s_active); 136 v = atomic_dec_return(&sd->s_active);
134 if (likely(v != SD_DEACTIVATED_BIAS)) 137 if (likely(v != SD_DEACTIVATED_BIAS))
135 return; 138 return;
@@ -194,15 +197,21 @@ static void sysfs_deactivate(struct sysfs_dirent *sd)
194 BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); 197 BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED));
195 sd->s_sibling = (void *)&wait; 198 sd->s_sibling = (void *)&wait;
196 199
200 rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_);
197 /* atomic_add_return() is a mb(), put_active() will always see 201 /* atomic_add_return() is a mb(), put_active() will always see
198 * the updated sd->s_sibling. 202 * the updated sd->s_sibling.
199 */ 203 */
200 v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active); 204 v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active);
201 205
202 if (v != SD_DEACTIVATED_BIAS) 206 if (v != SD_DEACTIVATED_BIAS) {
207 lock_contended(&sd->dep_map, _RET_IP_);
203 wait_for_completion(&wait); 208 wait_for_completion(&wait);
209 }
204 210
205 sd->s_sibling = NULL; 211 sd->s_sibling = NULL;
212
213 lock_acquired(&sd->dep_map, _RET_IP_);
214 rwsem_release(&sd->dep_map, 1, _RET_IP_);
206} 215}
207 216
208static int sysfs_alloc_ino(ino_t *pino) 217static int sysfs_alloc_ino(ino_t *pino)
@@ -345,6 +354,7 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type)
345 354
346 atomic_set(&sd->s_count, 1); 355 atomic_set(&sd->s_count, 1);
347 atomic_set(&sd->s_active, 0); 356 atomic_set(&sd->s_active, 0);
357 sysfs_dirent_init_lockdep(sd);
348 358
349 sd->s_name = name; 359 sd->s_name = name;
350 sd->s_mode = mode; 360 sd->s_mode = mode;
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index ca52e7b9d8f8..cdd9377a6e06 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -8,6 +8,7 @@
8 * This file is released under the GPLv2. 8 * This file is released under the GPLv2.
9 */ 9 */
10 10
11#include <linux/lockdep.h>
11#include <linux/fs.h> 12#include <linux/fs.h>
12 13
13struct sysfs_open_dirent; 14struct sysfs_open_dirent;
@@ -50,6 +51,9 @@ struct sysfs_inode_attrs {
50struct sysfs_dirent { 51struct sysfs_dirent {
51 atomic_t s_count; 52 atomic_t s_count;
52 atomic_t s_active; 53 atomic_t s_active;
54#ifdef CONFIG_DEBUG_LOCK_ALLOC
55 struct lockdep_map dep_map;
56#endif
53 struct sysfs_dirent *s_parent; 57 struct sysfs_dirent *s_parent;
54 struct sysfs_dirent *s_sibling; 58 struct sysfs_dirent *s_sibling;
55 const char *s_name; 59 const char *s_name;
@@ -84,6 +88,17 @@ static inline unsigned int sysfs_type(struct sysfs_dirent *sd)
84 return sd->s_flags & SYSFS_TYPE_MASK; 88 return sd->s_flags & SYSFS_TYPE_MASK;
85} 89}
86 90
91#ifdef CONFIG_DEBUG_LOCK_ALLOC
92#define sysfs_dirent_init_lockdep(sd) \
93do { \
94 static struct lock_class_key __key; \
95 \
96 lockdep_init_map(&sd->dep_map, "s_active", &__key, 0); \
97} while(0)
98#else
99#define sysfs_dirent_init_lockdep(sd) do {} while(0)
100#endif
101
87/* 102/*
88 * Context structure to be used while adding/removing nodes. 103 * Context structure to be used while adding/removing nodes.
89 */ 104 */
diff --git a/fs/timerfd.c b/fs/timerfd.c
index b042bd7034b1..1bfc95ad5f71 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -200,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
200 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); 200 hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS);
201 201
202 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, 202 ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
203 flags & TFD_SHARED_FCNTL_FLAGS); 203 O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS));
204 if (ufd < 0) 204 if (ufd < 0)
205 kfree(ctx); 205 kfree(ctx);
206 206
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 39849f887e72..16a6444330ec 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -45,7 +45,7 @@
45 * 45 *
46 * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the 46 * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the
47 * read-ahead path does not lock it ("sys_read -> generic_file_aio_read -> 47 * read-ahead path does not lock it ("sys_read -> generic_file_aio_read ->
48 * ondemand_readahead -> readpage"). In case of readahead, @I_LOCK flag is not 48 * ondemand_readahead -> readpage"). In case of readahead, @I_SYNC flag is not
49 * set as well. However, UBIFS disables readahead. 49 * set as well. However, UBIFS disables readahead.
50 */ 50 */
51 51
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 618c2701d3a7..e5a3d8e96bb7 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -54,6 +54,7 @@
54 */ 54 */
55 55
56#include <linux/pagemap.h> 56#include <linux/pagemap.h>
57#include <linux/list_sort.h>
57#include "ubifs.h" 58#include "ubifs.h"
58 59
59/* 60/*
@@ -108,101 +109,6 @@ static int switch_gc_head(struct ubifs_info *c)
108} 109}
109 110
110/** 111/**
111 * list_sort - sort a list.
112 * @priv: private data, passed to @cmp
113 * @head: the list to sort
114 * @cmp: the elements comparison function
115 *
116 * This function has been implemented by Mark J Roberts <mjr@znex.org>. It
117 * implements "merge sort" which has O(nlog(n)) complexity. The list is sorted
118 * in ascending order.
119 *
120 * The comparison function @cmp is supposed to return a negative value if @a is
121 * than @b, and a positive value if @a is greater than @b. If @a and @b are
122 * equivalent, then it does not matter what this function returns.
123 */
124static void list_sort(void *priv, struct list_head *head,
125 int (*cmp)(void *priv, struct list_head *a,
126 struct list_head *b))
127{
128 struct list_head *p, *q, *e, *list, *tail, *oldhead;
129 int insize, nmerges, psize, qsize, i;
130
131 if (list_empty(head))
132 return;
133
134 list = head->next;
135 list_del(head);
136 insize = 1;
137 for (;;) {
138 p = oldhead = list;
139 list = tail = NULL;
140 nmerges = 0;
141
142 while (p) {
143 nmerges++;
144 q = p;
145 psize = 0;
146 for (i = 0; i < insize; i++) {
147 psize++;
148 q = q->next == oldhead ? NULL : q->next;
149 if (!q)
150 break;
151 }
152
153 qsize = insize;
154 while (psize > 0 || (qsize > 0 && q)) {
155 if (!psize) {
156 e = q;
157 q = q->next;
158 qsize--;
159 if (q == oldhead)
160 q = NULL;
161 } else if (!qsize || !q) {
162 e = p;
163 p = p->next;
164 psize--;
165 if (p == oldhead)
166 p = NULL;
167 } else if (cmp(priv, p, q) <= 0) {
168 e = p;
169 p = p->next;
170 psize--;
171 if (p == oldhead)
172 p = NULL;
173 } else {
174 e = q;
175 q = q->next;
176 qsize--;
177 if (q == oldhead)
178 q = NULL;
179 }
180 if (tail)
181 tail->next = e;
182 else
183 list = e;
184 e->prev = tail;
185 tail = e;
186 }
187 p = q;
188 }
189
190 tail->next = list;
191 list->prev = tail;
192
193 if (nmerges <= 1)
194 break;
195
196 insize *= 2;
197 }
198
199 head->next = list;
200 head->prev = list->prev;
201 list->prev->next = head;
202 list->prev = head;
203}
204
205/**
206 * data_nodes_cmp - compare 2 data nodes. 112 * data_nodes_cmp - compare 2 data nodes.
207 * @priv: UBIFS file-system description object 113 * @priv: UBIFS file-system description object
208 * @a: first data node 114 * @a: first data node
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c
index 2512125dfa7c..883ca5ab8af5 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/linux-2.6/xfs_acl.c
@@ -251,8 +251,9 @@ xfs_set_mode(struct inode *inode, mode_t mode)
251 if (mode != inode->i_mode) { 251 if (mode != inode->i_mode) {
252 struct iattr iattr; 252 struct iattr iattr;
253 253
254 iattr.ia_valid = ATTR_MODE; 254 iattr.ia_valid = ATTR_MODE | ATTR_CTIME;
255 iattr.ia_mode = mode; 255 iattr.ia_mode = mode;
256 iattr.ia_ctime = current_fs_time(inode->i_sb);
256 257
257 error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); 258 error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL);
258 } 259 }
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 1d5b298ba8b2..225946012d0b 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -794,7 +794,7 @@ xfs_setup_inode(
794 struct inode *inode = &ip->i_vnode; 794 struct inode *inode = &ip->i_vnode;
795 795
796 inode->i_ino = ip->i_ino; 796 inode->i_ino = ip->i_ino;
797 inode->i_state = I_NEW|I_LOCK; 797 inode->i_state = I_NEW;
798 inode_add_to_lists(ip->i_mount->m_super, inode); 798 inode_add_to_lists(ip->i_mount->m_super, inode);
799 799
800 inode->i_mode = ip->i_d.di_mode; 800 inode->i_mode = ip->i_d.di_mode;
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
index c40834bdee58..c22a608321a3 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -33,51 +33,55 @@ struct xfs_dquot;
33struct xlog_ticket; 33struct xlog_ticket;
34struct log; 34struct log;
35 35
36DECLARE_EVENT_CLASS(xfs_attr_list_class,
37 TP_PROTO(struct xfs_attr_list_context *ctx),
38 TP_ARGS(ctx),
39 TP_STRUCT__entry(
40 __field(dev_t, dev)
41 __field(xfs_ino_t, ino)
42 __field(u32, hashval)
43 __field(u32, blkno)
44 __field(u32, offset)
45 __field(void *, alist)
46 __field(int, bufsize)
47 __field(int, count)
48 __field(int, firstu)
49 __field(int, dupcnt)
50 __field(int, flags)
51 ),
52 TP_fast_assign(
53 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
54 __entry->ino = ctx->dp->i_ino;
55 __entry->hashval = ctx->cursor->hashval;
56 __entry->blkno = ctx->cursor->blkno;
57 __entry->offset = ctx->cursor->offset;
58 __entry->alist = ctx->alist;
59 __entry->bufsize = ctx->bufsize;
60 __entry->count = ctx->count;
61 __entry->firstu = ctx->firstu;
62 __entry->flags = ctx->flags;
63 ),
64 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
65 "alist 0x%p size %u count %u firstu %u flags %d %s",
66 MAJOR(__entry->dev), MINOR(__entry->dev),
67 __entry->ino,
68 __entry->hashval,
69 __entry->blkno,
70 __entry->offset,
71 __entry->dupcnt,
72 __entry->alist,
73 __entry->bufsize,
74 __entry->count,
75 __entry->firstu,
76 __entry->flags,
77 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
78 )
79)
80
36#define DEFINE_ATTR_LIST_EVENT(name) \ 81#define DEFINE_ATTR_LIST_EVENT(name) \
37TRACE_EVENT(name, \ 82DEFINE_EVENT(xfs_attr_list_class, name, \
38 TP_PROTO(struct xfs_attr_list_context *ctx), \ 83 TP_PROTO(struct xfs_attr_list_context *ctx), \
39 TP_ARGS(ctx), \ 84 TP_ARGS(ctx))
40 TP_STRUCT__entry( \
41 __field(dev_t, dev) \
42 __field(xfs_ino_t, ino) \
43 __field(u32, hashval) \
44 __field(u32, blkno) \
45 __field(u32, offset) \
46 __field(void *, alist) \
47 __field(int, bufsize) \
48 __field(int, count) \
49 __field(int, firstu) \
50 __field(int, dupcnt) \
51 __field(int, flags) \
52 ), \
53 TP_fast_assign( \
54 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; \
55 __entry->ino = ctx->dp->i_ino; \
56 __entry->hashval = ctx->cursor->hashval; \
57 __entry->blkno = ctx->cursor->blkno; \
58 __entry->offset = ctx->cursor->offset; \
59 __entry->alist = ctx->alist; \
60 __entry->bufsize = ctx->bufsize; \
61 __entry->count = ctx->count; \
62 __entry->firstu = ctx->firstu; \
63 __entry->flags = ctx->flags; \
64 ), \
65 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " \
66 "alist 0x%p size %u count %u firstu %u flags %d %s", \
67 MAJOR(__entry->dev), MINOR(__entry->dev), \
68 __entry->ino, \
69 __entry->hashval, \
70 __entry->blkno, \
71 __entry->offset, \
72 __entry->dupcnt, \
73 __entry->alist, \
74 __entry->bufsize, \
75 __entry->count, \
76 __entry->firstu, \
77 __entry->flags, \
78 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) \
79 ) \
80)
81DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf); 85DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
82DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all); 86DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
83DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf); 87DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
@@ -178,91 +182,99 @@ TRACE_EVENT(xfs_iext_insert,
178 (char *)__entry->caller_ip) 182 (char *)__entry->caller_ip)
179); 183);
180 184
185DECLARE_EVENT_CLASS(xfs_bmap_class,
186 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
187 unsigned long caller_ip),
188 TP_ARGS(ip, idx, state, caller_ip),
189 TP_STRUCT__entry(
190 __field(dev_t, dev)
191 __field(xfs_ino_t, ino)
192 __field(xfs_extnum_t, idx)
193 __field(xfs_fileoff_t, startoff)
194 __field(xfs_fsblock_t, startblock)
195 __field(xfs_filblks_t, blockcount)
196 __field(xfs_exntst_t, state)
197 __field(int, bmap_state)
198 __field(unsigned long, caller_ip)
199 ),
200 TP_fast_assign(
201 struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ?
202 ip->i_afp : &ip->i_df;
203 struct xfs_bmbt_irec r;
204
205 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
206 __entry->dev = VFS_I(ip)->i_sb->s_dev;
207 __entry->ino = ip->i_ino;
208 __entry->idx = idx;
209 __entry->startoff = r.br_startoff;
210 __entry->startblock = r.br_startblock;
211 __entry->blockcount = r.br_blockcount;
212 __entry->state = r.br_state;
213 __entry->bmap_state = state;
214 __entry->caller_ip = caller_ip;
215 ),
216 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
217 "offset %lld block %s count %lld flag %d caller %pf",
218 MAJOR(__entry->dev), MINOR(__entry->dev),
219 __entry->ino,
220 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
221 (long)__entry->idx,
222 __entry->startoff,
223 xfs_fmtfsblock(__entry->startblock),
224 __entry->blockcount,
225 __entry->state,
226 (char *)__entry->caller_ip)
227)
228
181#define DEFINE_BMAP_EVENT(name) \ 229#define DEFINE_BMAP_EVENT(name) \
182TRACE_EVENT(name, \ 230DEFINE_EVENT(xfs_bmap_class, name, \
183 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \ 231 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
184 unsigned long caller_ip), \ 232 unsigned long caller_ip), \
185 TP_ARGS(ip, idx, state, caller_ip), \ 233 TP_ARGS(ip, idx, state, caller_ip))
186 TP_STRUCT__entry( \
187 __field(dev_t, dev) \
188 __field(xfs_ino_t, ino) \
189 __field(xfs_extnum_t, idx) \
190 __field(xfs_fileoff_t, startoff) \
191 __field(xfs_fsblock_t, startblock) \
192 __field(xfs_filblks_t, blockcount) \
193 __field(xfs_exntst_t, state) \
194 __field(int, bmap_state) \
195 __field(unsigned long, caller_ip) \
196 ), \
197 TP_fast_assign( \
198 struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ? \
199 ip->i_afp : &ip->i_df; \
200 struct xfs_bmbt_irec r; \
201 \
202 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r); \
203 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
204 __entry->ino = ip->i_ino; \
205 __entry->idx = idx; \
206 __entry->startoff = r.br_startoff; \
207 __entry->startblock = r.br_startblock; \
208 __entry->blockcount = r.br_blockcount; \
209 __entry->state = r.br_state; \
210 __entry->bmap_state = state; \
211 __entry->caller_ip = caller_ip; \
212 ), \
213 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld " \
214 "offset %lld block %s count %lld flag %d caller %pf", \
215 MAJOR(__entry->dev), MINOR(__entry->dev), \
216 __entry->ino, \
217 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), \
218 (long)__entry->idx, \
219 __entry->startoff, \
220 xfs_fmtfsblock(__entry->startblock), \
221 __entry->blockcount, \
222 __entry->state, \
223 (char *)__entry->caller_ip) \
224)
225
226DEFINE_BMAP_EVENT(xfs_iext_remove); 234DEFINE_BMAP_EVENT(xfs_iext_remove);
227DEFINE_BMAP_EVENT(xfs_bmap_pre_update); 235DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
228DEFINE_BMAP_EVENT(xfs_bmap_post_update); 236DEFINE_BMAP_EVENT(xfs_bmap_post_update);
229DEFINE_BMAP_EVENT(xfs_extlist); 237DEFINE_BMAP_EVENT(xfs_extlist);
230 238
231#define DEFINE_BUF_EVENT(tname) \ 239DECLARE_EVENT_CLASS(xfs_buf_class,
232TRACE_EVENT(tname, \ 240 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
233 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \ 241 TP_ARGS(bp, caller_ip),
234 TP_ARGS(bp, caller_ip), \ 242 TP_STRUCT__entry(
235 TP_STRUCT__entry( \ 243 __field(dev_t, dev)
236 __field(dev_t, dev) \ 244 __field(xfs_daddr_t, bno)
237 __field(xfs_daddr_t, bno) \ 245 __field(size_t, buffer_length)
238 __field(size_t, buffer_length) \ 246 __field(int, hold)
239 __field(int, hold) \ 247 __field(int, pincount)
240 __field(int, pincount) \ 248 __field(unsigned, lockval)
241 __field(unsigned, lockval) \ 249 __field(unsigned, flags)
242 __field(unsigned, flags) \ 250 __field(unsigned long, caller_ip)
243 __field(unsigned long, caller_ip) \ 251 ),
244 ), \ 252 TP_fast_assign(
245 TP_fast_assign( \ 253 __entry->dev = bp->b_target->bt_dev;
246 __entry->dev = bp->b_target->bt_dev; \ 254 __entry->bno = bp->b_bn;
247 __entry->bno = bp->b_bn; \ 255 __entry->buffer_length = bp->b_buffer_length;
248 __entry->buffer_length = bp->b_buffer_length; \ 256 __entry->hold = atomic_read(&bp->b_hold);
249 __entry->hold = atomic_read(&bp->b_hold); \ 257 __entry->pincount = atomic_read(&bp->b_pin_count);
250 __entry->pincount = atomic_read(&bp->b_pin_count); \ 258 __entry->lockval = xfs_buf_lock_value(bp);
251 __entry->lockval = xfs_buf_lock_value(bp); \ 259 __entry->flags = bp->b_flags;
252 __entry->flags = bp->b_flags; \ 260 __entry->caller_ip = caller_ip;
253 __entry->caller_ip = caller_ip; \ 261 ),
254 ), \ 262 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
255 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ 263 "lock %d flags %s caller %pf",
256 "lock %d flags %s caller %pf", \ 264 MAJOR(__entry->dev), MINOR(__entry->dev),
257 MAJOR(__entry->dev), MINOR(__entry->dev), \ 265 (unsigned long long)__entry->bno,
258 (unsigned long long)__entry->bno, \ 266 __entry->buffer_length,
259 __entry->buffer_length, \ 267 __entry->hold,
260 __entry->hold, \ 268 __entry->pincount,
261 __entry->pincount, \ 269 __entry->lockval,
262 __entry->lockval, \ 270 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
263 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \ 271 (void *)__entry->caller_ip)
264 (void *)__entry->caller_ip) \
265) 272)
273
274#define DEFINE_BUF_EVENT(name) \
275DEFINE_EVENT(xfs_buf_class, name, \
276 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
277 TP_ARGS(bp, caller_ip))
266DEFINE_BUF_EVENT(xfs_buf_init); 278DEFINE_BUF_EVENT(xfs_buf_init);
267DEFINE_BUF_EVENT(xfs_buf_free); 279DEFINE_BUF_EVENT(xfs_buf_free);
268DEFINE_BUF_EVENT(xfs_buf_hold); 280DEFINE_BUF_EVENT(xfs_buf_hold);
@@ -299,41 +311,45 @@ DEFINE_BUF_EVENT(xfs_reset_dqcounts);
299DEFINE_BUF_EVENT(xfs_inode_item_push); 311DEFINE_BUF_EVENT(xfs_inode_item_push);
300 312
301/* pass flags explicitly */ 313/* pass flags explicitly */
302#define DEFINE_BUF_FLAGS_EVENT(tname) \ 314DECLARE_EVENT_CLASS(xfs_buf_flags_class,
303TRACE_EVENT(tname, \ 315 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
304 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \ 316 TP_ARGS(bp, flags, caller_ip),
305 TP_ARGS(bp, flags, caller_ip), \ 317 TP_STRUCT__entry(
306 TP_STRUCT__entry( \ 318 __field(dev_t, dev)
307 __field(dev_t, dev) \ 319 __field(xfs_daddr_t, bno)
308 __field(xfs_daddr_t, bno) \ 320 __field(size_t, buffer_length)
309 __field(size_t, buffer_length) \ 321 __field(int, hold)
310 __field(int, hold) \ 322 __field(int, pincount)
311 __field(int, pincount) \ 323 __field(unsigned, lockval)
312 __field(unsigned, lockval) \ 324 __field(unsigned, flags)
313 __field(unsigned, flags) \ 325 __field(unsigned long, caller_ip)
314 __field(unsigned long, caller_ip) \ 326 ),
315 ), \ 327 TP_fast_assign(
316 TP_fast_assign( \ 328 __entry->dev = bp->b_target->bt_dev;
317 __entry->dev = bp->b_target->bt_dev; \ 329 __entry->bno = bp->b_bn;
318 __entry->bno = bp->b_bn; \ 330 __entry->buffer_length = bp->b_buffer_length;
319 __entry->buffer_length = bp->b_buffer_length; \ 331 __entry->flags = flags;
320 __entry->flags = flags; \ 332 __entry->hold = atomic_read(&bp->b_hold);
321 __entry->hold = atomic_read(&bp->b_hold); \ 333 __entry->pincount = atomic_read(&bp->b_pin_count);
322 __entry->pincount = atomic_read(&bp->b_pin_count); \ 334 __entry->lockval = xfs_buf_lock_value(bp);
323 __entry->lockval = xfs_buf_lock_value(bp); \ 335 __entry->caller_ip = caller_ip;
324 __entry->caller_ip = caller_ip; \ 336 ),
325 ), \ 337 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
326 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ 338 "lock %d flags %s caller %pf",
327 "lock %d flags %s caller %pf", \ 339 MAJOR(__entry->dev), MINOR(__entry->dev),
328 MAJOR(__entry->dev), MINOR(__entry->dev), \ 340 (unsigned long long)__entry->bno,
329 (unsigned long long)__entry->bno, \ 341 __entry->buffer_length,
330 __entry->buffer_length, \ 342 __entry->hold,
331 __entry->hold, \ 343 __entry->pincount,
332 __entry->pincount, \ 344 __entry->lockval,
333 __entry->lockval, \ 345 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
334 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), \ 346 (void *)__entry->caller_ip)
335 (void *)__entry->caller_ip) \
336) 347)
348
349#define DEFINE_BUF_FLAGS_EVENT(name) \
350DEFINE_EVENT(xfs_buf_flags_class, name, \
351 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
352 TP_ARGS(bp, flags, caller_ip))
337DEFINE_BUF_FLAGS_EVENT(xfs_buf_find); 353DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
338DEFINE_BUF_FLAGS_EVENT(xfs_buf_get); 354DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
339DEFINE_BUF_FLAGS_EVENT(xfs_buf_read); 355DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
@@ -376,55 +392,58 @@ TRACE_EVENT(xfs_buf_ioerror,
376 (void *)__entry->caller_ip) 392 (void *)__entry->caller_ip)
377); 393);
378 394
379#define DEFINE_BUF_ITEM_EVENT(tname) \ 395DECLARE_EVENT_CLASS(xfs_buf_item_class,
380TRACE_EVENT(tname, \ 396 TP_PROTO(struct xfs_buf_log_item *bip),
381 TP_PROTO(struct xfs_buf_log_item *bip), \ 397 TP_ARGS(bip),
382 TP_ARGS(bip), \ 398 TP_STRUCT__entry(
383 TP_STRUCT__entry( \ 399 __field(dev_t, dev)
384 __field(dev_t, dev) \ 400 __field(xfs_daddr_t, buf_bno)
385 __field(xfs_daddr_t, buf_bno) \ 401 __field(size_t, buf_len)
386 __field(size_t, buf_len) \ 402 __field(int, buf_hold)
387 __field(int, buf_hold) \ 403 __field(int, buf_pincount)
388 __field(int, buf_pincount) \ 404 __field(int, buf_lockval)
389 __field(int, buf_lockval) \ 405 __field(unsigned, buf_flags)
390 __field(unsigned, buf_flags) \ 406 __field(unsigned, bli_recur)
391 __field(unsigned, bli_recur) \ 407 __field(int, bli_refcount)
392 __field(int, bli_refcount) \ 408 __field(unsigned, bli_flags)
393 __field(unsigned, bli_flags) \ 409 __field(void *, li_desc)
394 __field(void *, li_desc) \ 410 __field(unsigned, li_flags)
395 __field(unsigned, li_flags) \ 411 ),
396 ), \ 412 TP_fast_assign(
397 TP_fast_assign( \ 413 __entry->dev = bip->bli_buf->b_target->bt_dev;
398 __entry->dev = bip->bli_buf->b_target->bt_dev; \ 414 __entry->bli_flags = bip->bli_flags;
399 __entry->bli_flags = bip->bli_flags; \ 415 __entry->bli_recur = bip->bli_recur;
400 __entry->bli_recur = bip->bli_recur; \ 416 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
401 __entry->bli_refcount = atomic_read(&bip->bli_refcount); \ 417 __entry->buf_bno = bip->bli_buf->b_bn;
402 __entry->buf_bno = bip->bli_buf->b_bn; \ 418 __entry->buf_len = bip->bli_buf->b_buffer_length;
403 __entry->buf_len = bip->bli_buf->b_buffer_length; \ 419 __entry->buf_flags = bip->bli_buf->b_flags;
404 __entry->buf_flags = bip->bli_buf->b_flags; \ 420 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
405 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); \ 421 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
406 __entry->buf_pincount = \ 422 __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf);
407 atomic_read(&bip->bli_buf->b_pin_count); \ 423 __entry->li_desc = bip->bli_item.li_desc;
408 __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf); \ 424 __entry->li_flags = bip->bli_item.li_flags;
409 __entry->li_desc = bip->bli_item.li_desc; \ 425 ),
410 __entry->li_flags = bip->bli_item.li_flags; \ 426 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
411 ), \ 427 "lock %d flags %s recur %d refcount %d bliflags %s "
412 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " \ 428 "lidesc 0x%p liflags %s",
413 "lock %d flags %s recur %d refcount %d bliflags %s " \ 429 MAJOR(__entry->dev), MINOR(__entry->dev),
414 "lidesc 0x%p liflags %s", \ 430 (unsigned long long)__entry->buf_bno,
415 MAJOR(__entry->dev), MINOR(__entry->dev), \ 431 __entry->buf_len,
416 (unsigned long long)__entry->buf_bno, \ 432 __entry->buf_hold,
417 __entry->buf_len, \ 433 __entry->buf_pincount,
418 __entry->buf_hold, \ 434 __entry->buf_lockval,
419 __entry->buf_pincount, \ 435 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
420 __entry->buf_lockval, \ 436 __entry->bli_recur,
421 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), \ 437 __entry->bli_refcount,
422 __entry->bli_recur, \ 438 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
423 __entry->bli_refcount, \ 439 __entry->li_desc,
424 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), \ 440 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
425 __entry->li_desc, \
426 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) \
427) 441)
442
443#define DEFINE_BUF_ITEM_EVENT(name) \
444DEFINE_EVENT(xfs_buf_item_class, name, \
445 TP_PROTO(struct xfs_buf_log_item *bip), \
446 TP_ARGS(bip))
428DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); 447DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
429DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); 448DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
430DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); 449DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
@@ -450,78 +469,90 @@ DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
450DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release); 469DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
451DEFINE_BUF_ITEM_EVENT(xfs_trans_binval); 470DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
452 471
472DECLARE_EVENT_CLASS(xfs_lock_class,
473 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
474 unsigned long caller_ip),
475 TP_ARGS(ip, lock_flags, caller_ip),
476 TP_STRUCT__entry(
477 __field(dev_t, dev)
478 __field(xfs_ino_t, ino)
479 __field(int, lock_flags)
480 __field(unsigned long, caller_ip)
481 ),
482 TP_fast_assign(
483 __entry->dev = VFS_I(ip)->i_sb->s_dev;
484 __entry->ino = ip->i_ino;
485 __entry->lock_flags = lock_flags;
486 __entry->caller_ip = caller_ip;
487 ),
488 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
489 MAJOR(__entry->dev), MINOR(__entry->dev),
490 __entry->ino,
491 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
492 (void *)__entry->caller_ip)
493)
494
453#define DEFINE_LOCK_EVENT(name) \ 495#define DEFINE_LOCK_EVENT(name) \
454TRACE_EVENT(name, \ 496DEFINE_EVENT(xfs_lock_class, name, \
455 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \ 497 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
456 unsigned long caller_ip), \ 498 unsigned long caller_ip), \
457 TP_ARGS(ip, lock_flags, caller_ip), \ 499 TP_ARGS(ip, lock_flags, caller_ip))
458 TP_STRUCT__entry( \
459 __field(dev_t, dev) \
460 __field(xfs_ino_t, ino) \
461 __field(int, lock_flags) \
462 __field(unsigned long, caller_ip) \
463 ), \
464 TP_fast_assign( \
465 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
466 __entry->ino = ip->i_ino; \
467 __entry->lock_flags = lock_flags; \
468 __entry->caller_ip = caller_ip; \
469 ), \
470 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf", \
471 MAJOR(__entry->dev), MINOR(__entry->dev), \
472 __entry->ino, \
473 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), \
474 (void *)__entry->caller_ip) \
475)
476
477DEFINE_LOCK_EVENT(xfs_ilock); 500DEFINE_LOCK_EVENT(xfs_ilock);
478DEFINE_LOCK_EVENT(xfs_ilock_nowait); 501DEFINE_LOCK_EVENT(xfs_ilock_nowait);
479DEFINE_LOCK_EVENT(xfs_ilock_demote); 502DEFINE_LOCK_EVENT(xfs_ilock_demote);
480DEFINE_LOCK_EVENT(xfs_iunlock); 503DEFINE_LOCK_EVENT(xfs_iunlock);
481 504
505DECLARE_EVENT_CLASS(xfs_iget_class,
506 TP_PROTO(struct xfs_inode *ip),
507 TP_ARGS(ip),
508 TP_STRUCT__entry(
509 __field(dev_t, dev)
510 __field(xfs_ino_t, ino)
511 ),
512 TP_fast_assign(
513 __entry->dev = VFS_I(ip)->i_sb->s_dev;
514 __entry->ino = ip->i_ino;
515 ),
516 TP_printk("dev %d:%d ino 0x%llx",
517 MAJOR(__entry->dev), MINOR(__entry->dev),
518 __entry->ino)
519)
520
482#define DEFINE_IGET_EVENT(name) \ 521#define DEFINE_IGET_EVENT(name) \
483TRACE_EVENT(name, \ 522DEFINE_EVENT(xfs_iget_class, name, \
484 TP_PROTO(struct xfs_inode *ip), \ 523 TP_PROTO(struct xfs_inode *ip), \
485 TP_ARGS(ip), \ 524 TP_ARGS(ip))
486 TP_STRUCT__entry( \
487 __field(dev_t, dev) \
488 __field(xfs_ino_t, ino) \
489 ), \
490 TP_fast_assign( \
491 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
492 __entry->ino = ip->i_ino; \
493 ), \
494 TP_printk("dev %d:%d ino 0x%llx", \
495 MAJOR(__entry->dev), MINOR(__entry->dev), \
496 __entry->ino) \
497)
498DEFINE_IGET_EVENT(xfs_iget_skip); 525DEFINE_IGET_EVENT(xfs_iget_skip);
499DEFINE_IGET_EVENT(xfs_iget_reclaim); 526DEFINE_IGET_EVENT(xfs_iget_reclaim);
500DEFINE_IGET_EVENT(xfs_iget_found); 527DEFINE_IGET_EVENT(xfs_iget_found);
501DEFINE_IGET_EVENT(xfs_iget_alloc); 528DEFINE_IGET_EVENT(xfs_iget_alloc);
502 529
530DECLARE_EVENT_CLASS(xfs_inode_class,
531 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
532 TP_ARGS(ip, caller_ip),
533 TP_STRUCT__entry(
534 __field(dev_t, dev)
535 __field(xfs_ino_t, ino)
536 __field(int, count)
537 __field(unsigned long, caller_ip)
538 ),
539 TP_fast_assign(
540 __entry->dev = VFS_I(ip)->i_sb->s_dev;
541 __entry->ino = ip->i_ino;
542 __entry->count = atomic_read(&VFS_I(ip)->i_count);
543 __entry->caller_ip = caller_ip;
544 ),
545 TP_printk("dev %d:%d ino 0x%llx count %d caller %pf",
546 MAJOR(__entry->dev), MINOR(__entry->dev),
547 __entry->ino,
548 __entry->count,
549 (char *)__entry->caller_ip)
550)
551
503#define DEFINE_INODE_EVENT(name) \ 552#define DEFINE_INODE_EVENT(name) \
504TRACE_EVENT(name, \ 553DEFINE_EVENT(xfs_inode_class, name, \
505 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \ 554 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
506 TP_ARGS(ip, caller_ip), \ 555 TP_ARGS(ip, caller_ip))
507 TP_STRUCT__entry( \
508 __field(dev_t, dev) \
509 __field(xfs_ino_t, ino) \
510 __field(int, count) \
511 __field(unsigned long, caller_ip) \
512 ), \
513 TP_fast_assign( \
514 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
515 __entry->ino = ip->i_ino; \
516 __entry->count = atomic_read(&VFS_I(ip)->i_count); \
517 __entry->caller_ip = caller_ip; \
518 ), \
519 TP_printk("dev %d:%d ino 0x%llx count %d caller %pf", \
520 MAJOR(__entry->dev), MINOR(__entry->dev), \
521 __entry->ino, \
522 __entry->count, \
523 (char *)__entry->caller_ip) \
524)
525DEFINE_INODE_EVENT(xfs_ihold); 556DEFINE_INODE_EVENT(xfs_ihold);
526DEFINE_INODE_EVENT(xfs_irele); 557DEFINE_INODE_EVENT(xfs_irele);
527/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */ 558/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
@@ -529,55 +560,59 @@ DEFINE_INODE_EVENT(xfs_inode);
529#define xfs_itrace_entry(ip) \ 560#define xfs_itrace_entry(ip) \
530 trace_xfs_inode(ip, _THIS_IP_) 561 trace_xfs_inode(ip, _THIS_IP_)
531 562
532#define DEFINE_DQUOT_EVENT(tname) \ 563DECLARE_EVENT_CLASS(xfs_dquot_class,
533TRACE_EVENT(tname, \ 564 TP_PROTO(struct xfs_dquot *dqp),
534 TP_PROTO(struct xfs_dquot *dqp), \ 565 TP_ARGS(dqp),
535 TP_ARGS(dqp), \ 566 TP_STRUCT__entry(
536 TP_STRUCT__entry( \ 567 __field(dev_t, dev)
537 __field(dev_t, dev) \ 568 __field(__be32, id)
538 __field(__be32, id) \ 569 __field(unsigned, flags)
539 __field(unsigned, flags) \ 570 __field(unsigned, nrefs)
540 __field(unsigned, nrefs) \ 571 __field(unsigned long long, res_bcount)
541 __field(unsigned long long, res_bcount) \ 572 __field(unsigned long long, bcount)
542 __field(unsigned long long, bcount) \ 573 __field(unsigned long long, icount)
543 __field(unsigned long long, icount) \ 574 __field(unsigned long long, blk_hardlimit)
544 __field(unsigned long long, blk_hardlimit) \ 575 __field(unsigned long long, blk_softlimit)
545 __field(unsigned long long, blk_softlimit) \ 576 __field(unsigned long long, ino_hardlimit)
546 __field(unsigned long long, ino_hardlimit) \ 577 __field(unsigned long long, ino_softlimit)
547 __field(unsigned long long, ino_softlimit) \
548 ), \
549 TP_fast_assign( \
550 __entry->dev = dqp->q_mount->m_super->s_dev; \
551 __entry->id = dqp->q_core.d_id; \
552 __entry->flags = dqp->dq_flags; \
553 __entry->nrefs = dqp->q_nrefs; \
554 __entry->res_bcount = dqp->q_res_bcount; \
555 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); \
556 __entry->icount = be64_to_cpu(dqp->q_core.d_icount); \
557 __entry->blk_hardlimit = \
558 be64_to_cpu(dqp->q_core.d_blk_hardlimit); \
559 __entry->blk_softlimit = \
560 be64_to_cpu(dqp->q_core.d_blk_softlimit); \
561 __entry->ino_hardlimit = \
562 be64_to_cpu(dqp->q_core.d_ino_hardlimit); \
563 __entry->ino_softlimit = \
564 be64_to_cpu(dqp->q_core.d_ino_softlimit); \
565 ), \ 578 ), \
566 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " \ 579 TP_fast_assign(
567 "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] " \ 580 __entry->dev = dqp->q_mount->m_super->s_dev;
568 "icnt 0x%llx [hard 0x%llx | soft 0x%llx]", \ 581 __entry->id = dqp->q_core.d_id;
569 MAJOR(__entry->dev), MINOR(__entry->dev), \ 582 __entry->flags = dqp->dq_flags;
570 be32_to_cpu(__entry->id), \ 583 __entry->nrefs = dqp->q_nrefs;
571 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), \ 584 __entry->res_bcount = dqp->q_res_bcount;
572 __entry->nrefs, \ 585 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
573 __entry->res_bcount, \ 586 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
574 __entry->bcount, \ 587 __entry->blk_hardlimit =
575 __entry->blk_hardlimit, \ 588 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
576 __entry->blk_softlimit, \ 589 __entry->blk_softlimit =
577 __entry->icount, \ 590 be64_to_cpu(dqp->q_core.d_blk_softlimit);
578 __entry->ino_hardlimit, \ 591 __entry->ino_hardlimit =
579 __entry->ino_softlimit) \ 592 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
593 __entry->ino_softlimit =
594 be64_to_cpu(dqp->q_core.d_ino_softlimit);
595 ),
596 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
597 "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] "
598 "icnt 0x%llx [hard 0x%llx | soft 0x%llx]",
599 MAJOR(__entry->dev), MINOR(__entry->dev),
600 be32_to_cpu(__entry->id),
601 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
602 __entry->nrefs,
603 __entry->res_bcount,
604 __entry->bcount,
605 __entry->blk_hardlimit,
606 __entry->blk_softlimit,
607 __entry->icount,
608 __entry->ino_hardlimit,
609 __entry->ino_softlimit)
580) 610)
611
612#define DEFINE_DQUOT_EVENT(name) \
613DEFINE_EVENT(xfs_dquot_class, name, \
614 TP_PROTO(struct xfs_dquot *dqp), \
615 TP_ARGS(dqp))
581DEFINE_DQUOT_EVENT(xfs_dqadjust); 616DEFINE_DQUOT_EVENT(xfs_dqadjust);
582DEFINE_DQUOT_EVENT(xfs_dqshake_dirty); 617DEFINE_DQUOT_EVENT(xfs_dqshake_dirty);
583DEFINE_DQUOT_EVENT(xfs_dqshake_unlink); 618DEFINE_DQUOT_EVENT(xfs_dqshake_unlink);
@@ -610,72 +645,75 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_done);
610DEFINE_IGET_EVENT(xfs_dquot_dqalloc); 645DEFINE_IGET_EVENT(xfs_dquot_dqalloc);
611DEFINE_IGET_EVENT(xfs_dquot_dqdetach); 646DEFINE_IGET_EVENT(xfs_dquot_dqdetach);
612 647
648DECLARE_EVENT_CLASS(xfs_loggrant_class,
649 TP_PROTO(struct log *log, struct xlog_ticket *tic),
650 TP_ARGS(log, tic),
651 TP_STRUCT__entry(
652 __field(dev_t, dev)
653 __field(unsigned, trans_type)
654 __field(char, ocnt)
655 __field(char, cnt)
656 __field(int, curr_res)
657 __field(int, unit_res)
658 __field(unsigned int, flags)
659 __field(void *, reserve_headq)
660 __field(void *, write_headq)
661 __field(int, grant_reserve_cycle)
662 __field(int, grant_reserve_bytes)
663 __field(int, grant_write_cycle)
664 __field(int, grant_write_bytes)
665 __field(int, curr_cycle)
666 __field(int, curr_block)
667 __field(xfs_lsn_t, tail_lsn)
668 ),
669 TP_fast_assign(
670 __entry->dev = log->l_mp->m_super->s_dev;
671 __entry->trans_type = tic->t_trans_type;
672 __entry->ocnt = tic->t_ocnt;
673 __entry->cnt = tic->t_cnt;
674 __entry->curr_res = tic->t_curr_res;
675 __entry->unit_res = tic->t_unit_res;
676 __entry->flags = tic->t_flags;
677 __entry->reserve_headq = log->l_reserve_headq;
678 __entry->write_headq = log->l_write_headq;
679 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle;
680 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes;
681 __entry->grant_write_cycle = log->l_grant_write_cycle;
682 __entry->grant_write_bytes = log->l_grant_write_bytes;
683 __entry->curr_cycle = log->l_curr_cycle;
684 __entry->curr_block = log->l_curr_block;
685 __entry->tail_lsn = log->l_tail_lsn;
686 ),
687 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
688 "t_unit_res %u t_flags %s reserve_headq 0x%p "
689 "write_headq 0x%p grant_reserve_cycle %d "
690 "grant_reserve_bytes %d grant_write_cycle %d "
691 "grant_write_bytes %d curr_cycle %d curr_block %d "
692 "tail_cycle %d tail_block %d",
693 MAJOR(__entry->dev), MINOR(__entry->dev),
694 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
695 __entry->ocnt,
696 __entry->cnt,
697 __entry->curr_res,
698 __entry->unit_res,
699 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
700 __entry->reserve_headq,
701 __entry->write_headq,
702 __entry->grant_reserve_cycle,
703 __entry->grant_reserve_bytes,
704 __entry->grant_write_cycle,
705 __entry->grant_write_bytes,
706 __entry->curr_cycle,
707 __entry->curr_block,
708 CYCLE_LSN(__entry->tail_lsn),
709 BLOCK_LSN(__entry->tail_lsn)
710 )
711)
613 712
614#define DEFINE_LOGGRANT_EVENT(tname) \ 713#define DEFINE_LOGGRANT_EVENT(name) \
615TRACE_EVENT(tname, \ 714DEFINE_EVENT(xfs_loggrant_class, name, \
616 TP_PROTO(struct log *log, struct xlog_ticket *tic), \ 715 TP_PROTO(struct log *log, struct xlog_ticket *tic), \
617 TP_ARGS(log, tic), \ 716 TP_ARGS(log, tic))
618 TP_STRUCT__entry( \
619 __field(dev_t, dev) \
620 __field(unsigned, trans_type) \
621 __field(char, ocnt) \
622 __field(char, cnt) \
623 __field(int, curr_res) \
624 __field(int, unit_res) \
625 __field(unsigned int, flags) \
626 __field(void *, reserve_headq) \
627 __field(void *, write_headq) \
628 __field(int, grant_reserve_cycle) \
629 __field(int, grant_reserve_bytes) \
630 __field(int, grant_write_cycle) \
631 __field(int, grant_write_bytes) \
632 __field(int, curr_cycle) \
633 __field(int, curr_block) \
634 __field(xfs_lsn_t, tail_lsn) \
635 ), \
636 TP_fast_assign( \
637 __entry->dev = log->l_mp->m_super->s_dev; \
638 __entry->trans_type = tic->t_trans_type; \
639 __entry->ocnt = tic->t_ocnt; \
640 __entry->cnt = tic->t_cnt; \
641 __entry->curr_res = tic->t_curr_res; \
642 __entry->unit_res = tic->t_unit_res; \
643 __entry->flags = tic->t_flags; \
644 __entry->reserve_headq = log->l_reserve_headq; \
645 __entry->write_headq = log->l_write_headq; \
646 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle; \
647 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes; \
648 __entry->grant_write_cycle = log->l_grant_write_cycle; \
649 __entry->grant_write_bytes = log->l_grant_write_bytes; \
650 __entry->curr_cycle = log->l_curr_cycle; \
651 __entry->curr_block = log->l_curr_block; \
652 __entry->tail_lsn = log->l_tail_lsn; \
653 ), \
654 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u " \
655 "t_unit_res %u t_flags %s reserve_headq 0x%p " \
656 "write_headq 0x%p grant_reserve_cycle %d " \
657 "grant_reserve_bytes %d grant_write_cycle %d " \
658 "grant_write_bytes %d curr_cycle %d curr_block %d " \
659 "tail_cycle %d tail_block %d", \
660 MAJOR(__entry->dev), MINOR(__entry->dev), \
661 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES), \
662 __entry->ocnt, \
663 __entry->cnt, \
664 __entry->curr_res, \
665 __entry->unit_res, \
666 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), \
667 __entry->reserve_headq, \
668 __entry->write_headq, \
669 __entry->grant_reserve_cycle, \
670 __entry->grant_reserve_bytes, \
671 __entry->grant_write_cycle, \
672 __entry->grant_write_bytes, \
673 __entry->curr_cycle, \
674 __entry->curr_block, \
675 CYCLE_LSN(__entry->tail_lsn), \
676 BLOCK_LSN(__entry->tail_lsn) \
677 ) \
678)
679DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); 717DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
680DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); 718DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
681DEFINE_LOGGRANT_EVENT(xfs_log_reserve); 719DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
@@ -815,7 +853,7 @@ TRACE_EVENT(name, \
815 ), \ 853 ), \
816 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \ 854 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
817 "offset 0x%llx count %zd flags %s " \ 855 "offset 0x%llx count %zd flags %s " \
818 "startoff 0x%llx startblock 0x%llx blockcount 0x%llx", \ 856 "startoff 0x%llx startblock %s blockcount 0x%llx", \
819 MAJOR(__entry->dev), MINOR(__entry->dev), \ 857 MAJOR(__entry->dev), MINOR(__entry->dev), \
820 __entry->ino, \ 858 __entry->ino, \
821 __entry->size, \ 859 __entry->size, \
@@ -824,7 +862,7 @@ TRACE_EVENT(name, \
824 __entry->count, \ 862 __entry->count, \
825 __print_flags(__entry->flags, "|", BMAPI_FLAGS), \ 863 __print_flags(__entry->flags, "|", BMAPI_FLAGS), \
826 __entry->startoff, \ 864 __entry->startoff, \
827 __entry->startblock, \ 865 xfs_fmtfsblock(__entry->startblock), \
828 __entry->blockcount) \ 866 __entry->blockcount) \
829) 867)
830DEFINE_IOMAP_EVENT(xfs_iomap_enter); 868DEFINE_IOMAP_EVENT(xfs_iomap_enter);
@@ -897,28 +935,32 @@ TRACE_EVENT(xfs_itruncate_start,
897 __entry->toss_finish) 935 __entry->toss_finish)
898); 936);
899 937
938DECLARE_EVENT_CLASS(xfs_itrunc_class,
939 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
940 TP_ARGS(ip, new_size),
941 TP_STRUCT__entry(
942 __field(dev_t, dev)
943 __field(xfs_ino_t, ino)
944 __field(xfs_fsize_t, size)
945 __field(xfs_fsize_t, new_size)
946 ),
947 TP_fast_assign(
948 __entry->dev = VFS_I(ip)->i_sb->s_dev;
949 __entry->ino = ip->i_ino;
950 __entry->size = ip->i_d.di_size;
951 __entry->new_size = new_size;
952 ),
953 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
954 MAJOR(__entry->dev), MINOR(__entry->dev),
955 __entry->ino,
956 __entry->size,
957 __entry->new_size)
958)
959
900#define DEFINE_ITRUNC_EVENT(name) \ 960#define DEFINE_ITRUNC_EVENT(name) \
901TRACE_EVENT(name, \ 961DEFINE_EVENT(xfs_itrunc_class, name, \
902 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \ 962 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
903 TP_ARGS(ip, new_size), \ 963 TP_ARGS(ip, new_size))
904 TP_STRUCT__entry( \
905 __field(dev_t, dev) \
906 __field(xfs_ino_t, ino) \
907 __field(xfs_fsize_t, size) \
908 __field(xfs_fsize_t, new_size) \
909 ), \
910 TP_fast_assign( \
911 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
912 __entry->ino = ip->i_ino; \
913 __entry->size = ip->i_d.di_size; \
914 __entry->new_size = new_size; \
915 ), \
916 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", \
917 MAJOR(__entry->dev), MINOR(__entry->dev), \
918 __entry->ino, \
919 __entry->size, \
920 __entry->new_size) \
921)
922DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start); 964DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
923DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end); 965DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
924 966
@@ -1037,28 +1079,28 @@ TRACE_EVENT(xfs_alloc_unbusy,
1037 1079
1038TRACE_EVENT(xfs_alloc_busysearch, 1080TRACE_EVENT(xfs_alloc_busysearch,
1039 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, 1081 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1040 xfs_extlen_t len, int found), 1082 xfs_extlen_t len, xfs_lsn_t lsn),
1041 TP_ARGS(mp, agno, agbno, len, found), 1083 TP_ARGS(mp, agno, agbno, len, lsn),
1042 TP_STRUCT__entry( 1084 TP_STRUCT__entry(
1043 __field(dev_t, dev) 1085 __field(dev_t, dev)
1044 __field(xfs_agnumber_t, agno) 1086 __field(xfs_agnumber_t, agno)
1045 __field(xfs_agblock_t, agbno) 1087 __field(xfs_agblock_t, agbno)
1046 __field(xfs_extlen_t, len) 1088 __field(xfs_extlen_t, len)
1047 __field(int, found) 1089 __field(xfs_lsn_t, lsn)
1048 ), 1090 ),
1049 TP_fast_assign( 1091 TP_fast_assign(
1050 __entry->dev = mp->m_super->s_dev; 1092 __entry->dev = mp->m_super->s_dev;
1051 __entry->agno = agno; 1093 __entry->agno = agno;
1052 __entry->agbno = agbno; 1094 __entry->agbno = agbno;
1053 __entry->len = len; 1095 __entry->len = len;
1054 __entry->found = found; 1096 __entry->lsn = lsn;
1055 ), 1097 ),
1056 TP_printk("dev %d:%d agno %u agbno %u len %u %s", 1098 TP_printk("dev %d:%d agno %u agbno %u len %u force lsn 0x%llx",
1057 MAJOR(__entry->dev), MINOR(__entry->dev), 1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1058 __entry->agno, 1100 __entry->agno,
1059 __entry->agbno, 1101 __entry->agbno,
1060 __entry->len, 1102 __entry->len,
1061 __print_symbolic(__entry->found, XFS_BUSY_STATES)) 1103 __entry->lsn)
1062); 1104);
1063 1105
1064TRACE_EVENT(xfs_agf, 1106TRACE_EVENT(xfs_agf,
@@ -1152,77 +1194,80 @@ TRACE_EVENT(xfs_free_extent,
1152 1194
1153); 1195);
1154 1196
1155#define DEFINE_ALLOC_EVENT(name) \ 1197DECLARE_EVENT_CLASS(xfs_alloc_class,
1156TRACE_EVENT(name, \ 1198 TP_PROTO(struct xfs_alloc_arg *args),
1157 TP_PROTO(struct xfs_alloc_arg *args), \ 1199 TP_ARGS(args),
1158 TP_ARGS(args), \ 1200 TP_STRUCT__entry(
1159 TP_STRUCT__entry( \ 1201 __field(dev_t, dev)
1160 __field(dev_t, dev) \ 1202 __field(xfs_agnumber_t, agno)
1161 __field(xfs_agnumber_t, agno) \ 1203 __field(xfs_agblock_t, agbno)
1162 __field(xfs_agblock_t, agbno) \ 1204 __field(xfs_extlen_t, minlen)
1163 __field(xfs_extlen_t, minlen) \ 1205 __field(xfs_extlen_t, maxlen)
1164 __field(xfs_extlen_t, maxlen) \ 1206 __field(xfs_extlen_t, mod)
1165 __field(xfs_extlen_t, mod) \ 1207 __field(xfs_extlen_t, prod)
1166 __field(xfs_extlen_t, prod) \ 1208 __field(xfs_extlen_t, minleft)
1167 __field(xfs_extlen_t, minleft) \ 1209 __field(xfs_extlen_t, total)
1168 __field(xfs_extlen_t, total) \ 1210 __field(xfs_extlen_t, alignment)
1169 __field(xfs_extlen_t, alignment) \ 1211 __field(xfs_extlen_t, minalignslop)
1170 __field(xfs_extlen_t, minalignslop) \ 1212 __field(xfs_extlen_t, len)
1171 __field(xfs_extlen_t, len) \ 1213 __field(short, type)
1172 __field(short, type) \ 1214 __field(short, otype)
1173 __field(short, otype) \ 1215 __field(char, wasdel)
1174 __field(char, wasdel) \ 1216 __field(char, wasfromfl)
1175 __field(char, wasfromfl) \ 1217 __field(char, isfl)
1176 __field(char, isfl) \ 1218 __field(char, userdata)
1177 __field(char, userdata) \ 1219 __field(xfs_fsblock_t, firstblock)
1178 __field(xfs_fsblock_t, firstblock) \ 1220 ),
1179 ), \ 1221 TP_fast_assign(
1180 TP_fast_assign( \ 1222 __entry->dev = args->mp->m_super->s_dev;
1181 __entry->dev = args->mp->m_super->s_dev; \ 1223 __entry->agno = args->agno;
1182 __entry->agno = args->agno; \ 1224 __entry->agbno = args->agbno;
1183 __entry->agbno = args->agbno; \ 1225 __entry->minlen = args->minlen;
1184 __entry->minlen = args->minlen; \ 1226 __entry->maxlen = args->maxlen;
1185 __entry->maxlen = args->maxlen; \ 1227 __entry->mod = args->mod;
1186 __entry->mod = args->mod; \ 1228 __entry->prod = args->prod;
1187 __entry->prod = args->prod; \ 1229 __entry->minleft = args->minleft;
1188 __entry->minleft = args->minleft; \ 1230 __entry->total = args->total;
1189 __entry->total = args->total; \ 1231 __entry->alignment = args->alignment;
1190 __entry->alignment = args->alignment; \ 1232 __entry->minalignslop = args->minalignslop;
1191 __entry->minalignslop = args->minalignslop; \ 1233 __entry->len = args->len;
1192 __entry->len = args->len; \ 1234 __entry->type = args->type;
1193 __entry->type = args->type; \ 1235 __entry->otype = args->otype;
1194 __entry->otype = args->otype; \ 1236 __entry->wasdel = args->wasdel;
1195 __entry->wasdel = args->wasdel; \ 1237 __entry->wasfromfl = args->wasfromfl;
1196 __entry->wasfromfl = args->wasfromfl; \ 1238 __entry->isfl = args->isfl;
1197 __entry->isfl = args->isfl; \ 1239 __entry->userdata = args->userdata;
1198 __entry->userdata = args->userdata; \ 1240 __entry->firstblock = args->firstblock;
1199 __entry->firstblock = args->firstblock; \ 1241 ),
1200 ), \ 1242 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1201 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " \ 1243 "prod %u minleft %u total %u alignment %u minalignslop %u "
1202 "prod %u minleft %u total %u alignment %u minalignslop %u " \ 1244 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1203 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d " \ 1245 "userdata %d firstblock 0x%llx",
1204 "userdata %d firstblock 0x%llx", \ 1246 MAJOR(__entry->dev), MINOR(__entry->dev),
1205 MAJOR(__entry->dev), MINOR(__entry->dev), \ 1247 __entry->agno,
1206 __entry->agno, \ 1248 __entry->agbno,
1207 __entry->agbno, \ 1249 __entry->minlen,
1208 __entry->minlen, \ 1250 __entry->maxlen,
1209 __entry->maxlen, \ 1251 __entry->mod,
1210 __entry->mod, \ 1252 __entry->prod,
1211 __entry->prod, \ 1253 __entry->minleft,
1212 __entry->minleft, \ 1254 __entry->total,
1213 __entry->total, \ 1255 __entry->alignment,
1214 __entry->alignment, \ 1256 __entry->minalignslop,
1215 __entry->minalignslop, \ 1257 __entry->len,
1216 __entry->len, \ 1258 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1217 __print_symbolic(__entry->type, XFS_ALLOC_TYPES), \ 1259 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1218 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), \ 1260 __entry->wasdel,
1219 __entry->wasdel, \ 1261 __entry->wasfromfl,
1220 __entry->wasfromfl, \ 1262 __entry->isfl,
1221 __entry->isfl, \ 1263 __entry->userdata,
1222 __entry->userdata, \ 1264 __entry->firstblock)
1223 __entry->firstblock) \
1224) 1265)
1225 1266
1267#define DEFINE_ALLOC_EVENT(name) \
1268DEFINE_EVENT(xfs_alloc_class, name, \
1269 TP_PROTO(struct xfs_alloc_arg *args), \
1270 TP_ARGS(args))
1226DEFINE_ALLOC_EVENT(xfs_alloc_exact_done); 1271DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1227DEFINE_ALLOC_EVENT(xfs_alloc_exact_error); 1272DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1228DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft); 1273DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
@@ -1245,92 +1290,100 @@ DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1245DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed); 1290DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1246DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed); 1291DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1247 1292
1248#define DEFINE_DIR2_TRACE(tname) \ 1293DECLARE_EVENT_CLASS(xfs_dir2_class,
1249TRACE_EVENT(tname, \ 1294 TP_PROTO(struct xfs_da_args *args),
1295 TP_ARGS(args),
1296 TP_STRUCT__entry(
1297 __field(dev_t, dev)
1298 __field(xfs_ino_t, ino)
1299 __dynamic_array(char, name, args->namelen)
1300 __field(int, namelen)
1301 __field(xfs_dahash_t, hashval)
1302 __field(xfs_ino_t, inumber)
1303 __field(int, op_flags)
1304 ),
1305 TP_fast_assign(
1306 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1307 __entry->ino = args->dp->i_ino;
1308 if (args->namelen)
1309 memcpy(__get_str(name), args->name, args->namelen);
1310 __entry->namelen = args->namelen;
1311 __entry->hashval = args->hashval;
1312 __entry->inumber = args->inumber;
1313 __entry->op_flags = args->op_flags;
1314 ),
1315 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1316 "inumber 0x%llx op_flags %s",
1317 MAJOR(__entry->dev), MINOR(__entry->dev),
1318 __entry->ino,
1319 __entry->namelen,
1320 __entry->namelen ? __get_str(name) : NULL,
1321 __entry->namelen,
1322 __entry->hashval,
1323 __entry->inumber,
1324 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1325)
1326
1327#define DEFINE_DIR2_EVENT(name) \
1328DEFINE_EVENT(xfs_dir2_class, name, \
1250 TP_PROTO(struct xfs_da_args *args), \ 1329 TP_PROTO(struct xfs_da_args *args), \
1251 TP_ARGS(args), \ 1330 TP_ARGS(args))
1252 TP_STRUCT__entry( \ 1331DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1253 __field(dev_t, dev) \ 1332DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1254 __field(xfs_ino_t, ino) \ 1333DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1255 __dynamic_array(char, name, args->namelen) \ 1334DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1256 __field(int, namelen) \ 1335DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1257 __field(xfs_dahash_t, hashval) \ 1336DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1258 __field(xfs_ino_t, inumber) \ 1337DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1259 __field(int, op_flags) \ 1338DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1260 ), \ 1339DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1261 TP_fast_assign( \ 1340DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1262 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \ 1341DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1263 __entry->ino = args->dp->i_ino; \ 1342DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1264 if (args->namelen) \ 1343DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1265 memcpy(__get_str(name), args->name, args->namelen); \ 1344DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1266 __entry->namelen = args->namelen; \ 1345DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1267 __entry->hashval = args->hashval; \ 1346DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1268 __entry->inumber = args->inumber; \ 1347DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1269 __entry->op_flags = args->op_flags; \ 1348DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1270 ), \ 1349DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1271 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " \ 1350DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1272 "inumber 0x%llx op_flags %s", \ 1351DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1273 MAJOR(__entry->dev), MINOR(__entry->dev), \ 1352DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1274 __entry->ino, \ 1353DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1275 __entry->namelen, \ 1354DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1276 __entry->namelen ? __get_str(name) : NULL, \ 1355DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1277 __entry->namelen, \ 1356
1278 __entry->hashval, \ 1357DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1279 __entry->inumber, \ 1358 TP_PROTO(struct xfs_da_args *args, int idx),
1280 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) \ 1359 TP_ARGS(args, idx),
1360 TP_STRUCT__entry(
1361 __field(dev_t, dev)
1362 __field(xfs_ino_t, ino)
1363 __field(int, op_flags)
1364 __field(int, idx)
1365 ),
1366 TP_fast_assign(
1367 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1368 __entry->ino = args->dp->i_ino;
1369 __entry->op_flags = args->op_flags;
1370 __entry->idx = idx;
1371 ),
1372 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1373 MAJOR(__entry->dev), MINOR(__entry->dev),
1374 __entry->ino,
1375 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1376 __entry->idx)
1281) 1377)
1282DEFINE_DIR2_TRACE(xfs_dir2_sf_addname);
1283DEFINE_DIR2_TRACE(xfs_dir2_sf_create);
1284DEFINE_DIR2_TRACE(xfs_dir2_sf_lookup);
1285DEFINE_DIR2_TRACE(xfs_dir2_sf_replace);
1286DEFINE_DIR2_TRACE(xfs_dir2_sf_removename);
1287DEFINE_DIR2_TRACE(xfs_dir2_sf_toino4);
1288DEFINE_DIR2_TRACE(xfs_dir2_sf_toino8);
1289DEFINE_DIR2_TRACE(xfs_dir2_sf_to_block);
1290DEFINE_DIR2_TRACE(xfs_dir2_block_addname);
1291DEFINE_DIR2_TRACE(xfs_dir2_block_lookup);
1292DEFINE_DIR2_TRACE(xfs_dir2_block_replace);
1293DEFINE_DIR2_TRACE(xfs_dir2_block_removename);
1294DEFINE_DIR2_TRACE(xfs_dir2_block_to_sf);
1295DEFINE_DIR2_TRACE(xfs_dir2_block_to_leaf);
1296DEFINE_DIR2_TRACE(xfs_dir2_leaf_addname);
1297DEFINE_DIR2_TRACE(xfs_dir2_leaf_lookup);
1298DEFINE_DIR2_TRACE(xfs_dir2_leaf_replace);
1299DEFINE_DIR2_TRACE(xfs_dir2_leaf_removename);
1300DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_block);
1301DEFINE_DIR2_TRACE(xfs_dir2_leaf_to_node);
1302DEFINE_DIR2_TRACE(xfs_dir2_node_addname);
1303DEFINE_DIR2_TRACE(xfs_dir2_node_lookup);
1304DEFINE_DIR2_TRACE(xfs_dir2_node_replace);
1305DEFINE_DIR2_TRACE(xfs_dir2_node_removename);
1306DEFINE_DIR2_TRACE(xfs_dir2_node_to_leaf);
1307 1378
1308#define DEFINE_DIR2_SPACE_TRACE(tname) \ 1379#define DEFINE_DIR2_SPACE_EVENT(name) \
1309TRACE_EVENT(tname, \ 1380DEFINE_EVENT(xfs_dir2_space_class, name, \
1310 TP_PROTO(struct xfs_da_args *args, int idx), \ 1381 TP_PROTO(struct xfs_da_args *args, int idx), \
1311 TP_ARGS(args, idx), \ 1382 TP_ARGS(args, idx))
1312 TP_STRUCT__entry( \ 1383DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1313 __field(dev_t, dev) \ 1384DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1314 __field(xfs_ino_t, ino) \ 1385DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1315 __field(int, op_flags) \ 1386DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1316 __field(int, idx) \
1317 ), \
1318 TP_fast_assign( \
1319 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; \
1320 __entry->ino = args->dp->i_ino; \
1321 __entry->op_flags = args->op_flags; \
1322 __entry->idx = idx; \
1323 ), \
1324 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", \
1325 MAJOR(__entry->dev), MINOR(__entry->dev), \
1326 __entry->ino, \
1327 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), \
1328 __entry->idx) \
1329)
1330DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_add);
1331DEFINE_DIR2_SPACE_TRACE(xfs_dir2_leafn_remove);
1332DEFINE_DIR2_SPACE_TRACE(xfs_dir2_grow_inode);
1333DEFINE_DIR2_SPACE_TRACE(xfs_dir2_shrink_inode);
1334 1387
1335TRACE_EVENT(xfs_dir2_leafn_moveents, 1388TRACE_EVENT(xfs_dir2_leafn_moveents,
1336 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count), 1389 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index a1c65fc6d9c4..275b1f4f9430 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -2563,43 +2563,41 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
2563 xfs_mount_t *mp; 2563 xfs_mount_t *mp;
2564 xfs_perag_busy_t *bsy; 2564 xfs_perag_busy_t *bsy;
2565 xfs_agblock_t uend, bend; 2565 xfs_agblock_t uend, bend;
2566 xfs_lsn_t lsn; 2566 xfs_lsn_t lsn = 0;
2567 int cnt; 2567 int cnt;
2568 2568
2569 mp = tp->t_mountp; 2569 mp = tp->t_mountp;
2570 2570
2571 spin_lock(&mp->m_perag[agno].pagb_lock); 2571 spin_lock(&mp->m_perag[agno].pagb_lock);
2572 cnt = mp->m_perag[agno].pagb_count;
2573 2572
2574 uend = bno + len - 1; 2573 uend = bno + len - 1;
2575 2574
2576 /* search pagb_list for this slot, skipping open slots */ 2575 /*
2577 for (bsy = mp->m_perag[agno].pagb_list; cnt; bsy++) { 2576 * search pagb_list for this slot, skipping open slots. We have to
2577 * search the entire array as there may be multiple overlaps and
2578 * we have to get the most recent LSN for the log force to push out
2579 * all the transactions that span the range.
2580 */
2581 for (cnt = 0; cnt < mp->m_perag[agno].pagb_count; cnt++) {
2582 bsy = &mp->m_perag[agno].pagb_list[cnt];
2583 if (!bsy->busy_tp)
2584 continue;
2578 2585
2579 /* 2586 bend = bsy->busy_start + bsy->busy_length - 1;
2580 * (start1,length1) within (start2, length2) 2587 if (bno > bend || uend < bsy->busy_start)
2581 */ 2588 continue;
2582 if (bsy->busy_tp != NULL) {
2583 bend = bsy->busy_start + bsy->busy_length - 1;
2584 if ((bno > bend) || (uend < bsy->busy_start)) {
2585 cnt--;
2586 } else {
2587 break;
2588 }
2589 }
2590 }
2591 2589
2592 trace_xfs_alloc_busysearch(mp, agno, bno, len, !!cnt); 2590 /* (start1,length1) within (start2, length2) */
2591 if (XFS_LSN_CMP(bsy->busy_tp->t_commit_lsn, lsn) > 0)
2592 lsn = bsy->busy_tp->t_commit_lsn;
2593 }
2594 spin_unlock(&mp->m_perag[agno].pagb_lock);
2595 trace_xfs_alloc_busysearch(tp->t_mountp, agno, bno, len, lsn);
2593 2596
2594 /* 2597 /*
2595 * If a block was found, force the log through the LSN of the 2598 * If a block was found, force the log through the LSN of the
2596 * transaction that freed the block 2599 * transaction that freed the block
2597 */ 2600 */
2598 if (cnt) { 2601 if (lsn)
2599 lsn = bsy->busy_tp->t_commit_lsn;
2600 spin_unlock(&mp->m_perag[agno].pagb_lock);
2601 xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC); 2602 xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC);
2602 } else {
2603 spin_unlock(&mp->m_perag[agno].pagb_lock);
2604 }
2605} 2603}
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 0de36c2a46f1..fa402a6bbbcf 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -91,7 +91,7 @@ xfs_inode_alloc(
91 ip->i_new_size = 0; 91 ip->i_new_size = 0;
92 92
93 /* prevent anyone from using this yet */ 93 /* prevent anyone from using this yet */
94 VFS_I(ip)->i_state = I_NEW|I_LOCK; 94 VFS_I(ip)->i_state = I_NEW;
95 95
96 return ip; 96 return ip;
97} 97}
@@ -217,7 +217,7 @@ xfs_iget_cache_hit(
217 trace_xfs_iget_reclaim(ip); 217 trace_xfs_iget_reclaim(ip);
218 goto out_error; 218 goto out_error;
219 } 219 }
220 inode->i_state = I_LOCK|I_NEW; 220 inode->i_state = I_NEW;
221 } else { 221 } else {
222 /* If the VFS inode is being torn down, pause and try again. */ 222 /* If the VFS inode is being torn down, pause and try again. */
223 if (!igrab(inode)) { 223 if (!igrab(inode)) {
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index ce278b3ae7fc..391d36b0e68c 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2841,10 +2841,14 @@ xfs_iflush(
2841 mp = ip->i_mount; 2841 mp = ip->i_mount;
2842 2842
2843 /* 2843 /*
2844 * If the inode isn't dirty, then just release the inode 2844 * If the inode isn't dirty, then just release the inode flush lock and
2845 * flush lock and do nothing. 2845 * do nothing. Treat stale inodes the same; we cannot rely on the
2846 * backing buffer remaining stale in cache for the remaining life of
2847 * the stale inode and so xfs_itobp() below may give us a buffer that
2848 * no longer contains inodes below. Doing this stale check here also
2849 * avoids forcing the log on pinned, stale inodes.
2846 */ 2850 */
2847 if (xfs_inode_clean(ip)) { 2851 if (xfs_inode_clean(ip) || xfs_iflags_test(ip, XFS_ISTALE)) {
2848 xfs_ifunlock(ip); 2852 xfs_ifunlock(ip);
2849 return 0; 2853 return 0;
2850 } 2854 }
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 6558ffd8d140..6f268756bf36 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -70,7 +70,6 @@ xfs_setattr(
70 uint commit_flags=0; 70 uint commit_flags=0;
71 uid_t uid=0, iuid=0; 71 uid_t uid=0, iuid=0;
72 gid_t gid=0, igid=0; 72 gid_t gid=0, igid=0;
73 int timeflags = 0;
74 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; 73 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
75 int need_iolock = 1; 74 int need_iolock = 1;
76 75
@@ -135,16 +134,13 @@ xfs_setattr(
135 if (flags & XFS_ATTR_NOLOCK) 134 if (flags & XFS_ATTR_NOLOCK)
136 need_iolock = 0; 135 need_iolock = 0;
137 if (!(mask & ATTR_SIZE)) { 136 if (!(mask & ATTR_SIZE)) {
138 if ((mask != (ATTR_CTIME|ATTR_ATIME|ATTR_MTIME)) || 137 tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
139 (mp->m_flags & XFS_MOUNT_WSYNC)) { 138 commit_flags = 0;
140 tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); 139 code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp),
141 commit_flags = 0; 140 0, 0, 0);
142 if ((code = xfs_trans_reserve(tp, 0, 141 if (code) {
143 XFS_ICHANGE_LOG_RES(mp), 0, 142 lock_flags = 0;
144 0, 0))) { 143 goto error_return;
145 lock_flags = 0;
146 goto error_return;
147 }
148 } 144 }
149 } else { 145 } else {
150 if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) && 146 if (DM_EVENT_ENABLED(ip, DM_EVENT_TRUNCATE) &&
@@ -295,15 +291,23 @@ xfs_setattr(
295 * or we are explicitly asked to change it. This handles 291 * or we are explicitly asked to change it. This handles
296 * the semantic difference between truncate() and ftruncate() 292 * the semantic difference between truncate() and ftruncate()
297 * as implemented in the VFS. 293 * as implemented in the VFS.
294 *
295 * The regular truncate() case without ATTR_CTIME and ATTR_MTIME
296 * is a special case where we need to update the times despite
297 * not having these flags set. For all other operations the
298 * VFS set these flags explicitly if it wants a timestamp
299 * update.
298 */ 300 */
299 if (iattr->ia_size != ip->i_size || (mask & ATTR_CTIME)) 301 if (iattr->ia_size != ip->i_size &&
300 timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; 302 (!(mask & (ATTR_CTIME | ATTR_MTIME)))) {
303 iattr->ia_ctime = iattr->ia_mtime =
304 current_fs_time(inode->i_sb);
305 mask |= ATTR_CTIME | ATTR_MTIME;
306 }
301 307
302 if (iattr->ia_size > ip->i_size) { 308 if (iattr->ia_size > ip->i_size) {
303 ip->i_d.di_size = iattr->ia_size; 309 ip->i_d.di_size = iattr->ia_size;
304 ip->i_size = iattr->ia_size; 310 ip->i_size = iattr->ia_size;
305 if (!(flags & XFS_ATTR_DMI))
306 xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
307 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 311 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
308 } else if (iattr->ia_size <= ip->i_size || 312 } else if (iattr->ia_size <= ip->i_size ||
309 (iattr->ia_size == 0 && ip->i_d.di_nextents)) { 313 (iattr->ia_size == 0 && ip->i_d.di_nextents)) {
@@ -374,9 +378,6 @@ xfs_setattr(
374 ip->i_d.di_gid = gid; 378 ip->i_d.di_gid = gid;
375 inode->i_gid = gid; 379 inode->i_gid = gid;
376 } 380 }
377
378 xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
379 timeflags |= XFS_ICHGTIME_CHG;
380 } 381 }
381 382
382 /* 383 /*
@@ -393,51 +394,37 @@ xfs_setattr(
393 394
394 inode->i_mode &= S_IFMT; 395 inode->i_mode &= S_IFMT;
395 inode->i_mode |= mode & ~S_IFMT; 396 inode->i_mode |= mode & ~S_IFMT;
396
397 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
398 timeflags |= XFS_ICHGTIME_CHG;
399 } 397 }
400 398
401 /* 399 /*
402 * Change file access or modified times. 400 * Change file access or modified times.
403 */ 401 */
404 if (mask & (ATTR_ATIME|ATTR_MTIME)) { 402 if (mask & ATTR_ATIME) {
405 if (mask & ATTR_ATIME) { 403 inode->i_atime = iattr->ia_atime;
406 inode->i_atime = iattr->ia_atime; 404 ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
407 ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; 405 ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
408 ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; 406 ip->i_update_core = 1;
409 ip->i_update_core = 1;
410 }
411 if (mask & ATTR_MTIME) {
412 inode->i_mtime = iattr->ia_mtime;
413 ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
414 ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
415 timeflags &= ~XFS_ICHGTIME_MOD;
416 timeflags |= XFS_ICHGTIME_CHG;
417 }
418 if (tp && (mask & (ATTR_MTIME_SET|ATTR_ATIME_SET)))
419 xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
420 } 407 }
421 408 if (mask & ATTR_CTIME) {
422 /*
423 * Change file inode change time only if ATTR_CTIME set
424 * AND we have been called by a DMI function.
425 */
426
427 if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) {
428 inode->i_ctime = iattr->ia_ctime; 409 inode->i_ctime = iattr->ia_ctime;
429 ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; 410 ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
430 ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; 411 ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
431 ip->i_update_core = 1; 412 ip->i_update_core = 1;
432 timeflags &= ~XFS_ICHGTIME_CHG; 413 }
414 if (mask & ATTR_MTIME) {
415 inode->i_mtime = iattr->ia_mtime;
416 ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
417 ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
418 ip->i_update_core = 1;
433 } 419 }
434 420
435 /* 421 /*
436 * Send out timestamp changes that need to be set to the 422 * And finally, log the inode core if any attribute in it
437 * current time. Not done when called by a DMI function. 423 * has been changed.
438 */ 424 */
439 if (timeflags && !(flags & XFS_ATTR_DMI)) 425 if (mask & (ATTR_UID|ATTR_GID|ATTR_MODE|
440 xfs_ichgtime(ip, timeflags); 426 ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
427 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
441 428
442 XFS_STATS_INC(xs_ig_attrchg); 429 XFS_STATS_INC(xs_ig_attrchg);
443 430
@@ -452,12 +439,10 @@ xfs_setattr(
452 * mix so this probably isn't worth the trouble to optimize. 439 * mix so this probably isn't worth the trouble to optimize.
453 */ 440 */
454 code = 0; 441 code = 0;
455 if (tp) { 442 if (mp->m_flags & XFS_MOUNT_WSYNC)
456 if (mp->m_flags & XFS_MOUNT_WSYNC) 443 xfs_trans_set_sync(tp);
457 xfs_trans_set_sync(tp);
458 444
459 code = xfs_trans_commit(tp, commit_flags); 445 code = xfs_trans_commit(tp, commit_flags);
460 }
461 446
462 xfs_iunlock(ip, lock_flags); 447 xfs_iunlock(ip, lock_flags);
463 448
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 29245c6b5c0e..0ea5ef4eb6a9 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -224,8 +224,6 @@ struct acpi_processor {
224 struct acpi_processor_throttling throttling; 224 struct acpi_processor_throttling throttling;
225 struct acpi_processor_limit limit; 225 struct acpi_processor_limit limit;
226 struct thermal_cooling_device *cdev; 226 struct thermal_cooling_device *cdev;
227 /* the _PDC objects for this processor, if any */
228 struct acpi_object_list *pdc;
229}; 227};
230 228
231struct acpi_processor_errata { 229struct acpi_processor_errata {
@@ -257,9 +255,6 @@ int acpi_processor_notify_smm(struct module *calling_module);
257DECLARE_PER_CPU(struct acpi_processor *, processors); 255DECLARE_PER_CPU(struct acpi_processor *, processors);
258extern struct acpi_processor_errata errata; 256extern struct acpi_processor_errata errata;
259 257
260void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
261void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr);
262
263#ifdef ARCH_HAS_POWER_INIT 258#ifdef ARCH_HAS_POWER_INIT
264void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 259void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
265 unsigned int cpu); 260 unsigned int cpu);
@@ -325,6 +320,9 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
325 320
326#endif /* CONFIG_CPU_FREQ */ 321#endif /* CONFIG_CPU_FREQ */
327 322
323/* in processor_pdc.c */
324void acpi_processor_set_pdc(acpi_handle handle);
325
328/* in processor_throttling.c */ 326/* in processor_throttling.c */
329int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 327int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
330int acpi_processor_get_throttling_info(struct acpi_processor *pr); 328int acpi_processor_get_throttling_info(struct acpi_processor *pr);
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index 681ddf3e844c..fcd268ce0674 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -51,7 +51,7 @@
51#endif 51#endif
52 52
53/* 53/*
54 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using 54 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
55 * the O_SYNC flag. We continue to use the existing numerical value 55 * the O_SYNC flag. We continue to use the existing numerical value
56 * for O_DSYNC semantics now, but using the correct symbolic name for it. 56 * for O_DSYNC semantics now, but using the correct symbolic name for it.
57 * This new value is used to request true Posix O_SYNC semantics. It is 57 * This new value is used to request true Posix O_SYNC semantics. It is
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 19ef8ebdc662..ffac157fb5b2 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -296,6 +296,7 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
296#define DRM_MASTER 0x2 296#define DRM_MASTER 0x2
297#define DRM_ROOT_ONLY 0x4 297#define DRM_ROOT_ONLY 0x4
298#define DRM_CONTROL_ALLOW 0x8 298#define DRM_CONTROL_ALLOW 0x8
299#define DRM_UNLOCKED 0x10
299 300
300struct drm_ioctl_desc { 301struct drm_ioctl_desc {
301 unsigned int cmd; 302 unsigned int cmd;
@@ -1128,8 +1129,8 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
1128 /* Driver support (drm_drv.h) */ 1129 /* Driver support (drm_drv.h) */
1129extern int drm_init(struct drm_driver *driver); 1130extern int drm_init(struct drm_driver *driver);
1130extern void drm_exit(struct drm_driver *driver); 1131extern void drm_exit(struct drm_driver *driver);
1131extern int drm_ioctl(struct inode *inode, struct file *filp, 1132extern long drm_ioctl(struct file *filp,
1132 unsigned int cmd, unsigned long arg); 1133 unsigned int cmd, unsigned long arg);
1133extern long drm_compat_ioctl(struct file *filp, 1134extern long drm_compat_ioctl(struct file *filp,
1134 unsigned int cmd, unsigned long arg); 1135 unsigned int cmd, unsigned long arg);
1135extern int drm_lastclose(struct drm_device *dev); 1136extern int drm_lastclose(struct drm_device *dev);
@@ -1407,7 +1408,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
1407 struct drm_ati_pcigart_info * gart_info); 1408 struct drm_ati_pcigart_info * gart_info);
1408 1409
1409extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, 1410extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1410 size_t align, dma_addr_t maxaddr); 1411 size_t align);
1411extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); 1412extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1412extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); 1413extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1413 1414
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 43009bc2e757..bc4fdf27bd2e 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -160,6 +160,7 @@ struct drm_mode_get_encoder {
160#define DRM_MODE_CONNECTOR_HDMIA 11 160#define DRM_MODE_CONNECTOR_HDMIA 11
161#define DRM_MODE_CONNECTOR_HDMIB 12 161#define DRM_MODE_CONNECTOR_HDMIB 12
162#define DRM_MODE_CONNECTOR_TV 13 162#define DRM_MODE_CONNECTOR_TV 13
163#define DRM_MODE_CONNECTOR_eDP 14
163 164
164struct drm_mode_get_connector { 165struct drm_mode_get_connector {
165 166
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index ec3f5e80a5df..b64a8d7cdf6d 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -188,6 +188,7 @@ typedef struct _drm_i915_sarea {
188#define DRM_I915_GEM_MADVISE 0x26 188#define DRM_I915_GEM_MADVISE 0x26
189#define DRM_I915_OVERLAY_PUT_IMAGE 0x27 189#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
190#define DRM_I915_OVERLAY_ATTRS 0x28 190#define DRM_I915_OVERLAY_ATTRS 0x28
191#define DRM_I915_GEM_EXECBUFFER2 0x29
191 192
192#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 193#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
193#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 194#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -207,6 +208,7 @@ typedef struct _drm_i915_sarea {
207#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 208#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
208#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 209#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
209#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 210#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
211#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
210#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 212#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
211#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 213#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
212#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 214#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
@@ -272,6 +274,7 @@ typedef struct drm_i915_irq_wait {
272#define I915_PARAM_NUM_FENCES_AVAIL 6 274#define I915_PARAM_NUM_FENCES_AVAIL 6
273#define I915_PARAM_HAS_OVERLAY 7 275#define I915_PARAM_HAS_OVERLAY 7
274#define I915_PARAM_HAS_PAGEFLIPPING 8 276#define I915_PARAM_HAS_PAGEFLIPPING 8
277#define I915_PARAM_HAS_EXECBUF2 9
275 278
276typedef struct drm_i915_getparam { 279typedef struct drm_i915_getparam {
277 int param; 280 int param;
@@ -567,6 +570,57 @@ struct drm_i915_gem_execbuffer {
567 __u64 cliprects_ptr; 570 __u64 cliprects_ptr;
568}; 571};
569 572
573struct drm_i915_gem_exec_object2 {
574 /**
575 * User's handle for a buffer to be bound into the GTT for this
576 * operation.
577 */
578 __u32 handle;
579
580 /** Number of relocations to be performed on this buffer */
581 __u32 relocation_count;
582 /**
583 * Pointer to array of struct drm_i915_gem_relocation_entry containing
584 * the relocations to be performed in this buffer.
585 */
586 __u64 relocs_ptr;
587
588 /** Required alignment in graphics aperture */
589 __u64 alignment;
590
591 /**
592 * Returned value of the updated offset of the object, for future
593 * presumed_offset writes.
594 */
595 __u64 offset;
596
597#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
598 __u64 flags;
599 __u64 rsvd1;
600 __u64 rsvd2;
601};
602
603struct drm_i915_gem_execbuffer2 {
604 /**
605 * List of gem_exec_object2 structs
606 */
607 __u64 buffers_ptr;
608 __u32 buffer_count;
609
610 /** Offset in the batchbuffer to start execution from. */
611 __u32 batch_start_offset;
612 /** Bytes used in batchbuffer from batch_start_offset */
613 __u32 batch_len;
614 __u32 DR1;
615 __u32 DR4;
616 __u32 num_cliprects;
617 /** This is a struct drm_clip_rect *cliprects */
618 __u64 cliprects_ptr;
619 __u64 flags; /* currently unused */
620 __u64 rsvd1;
621 __u64 rsvd2;
622};
623
570struct drm_i915_gem_pin { 624struct drm_i915_gem_pin {
571 /** Handle of the buffer to be pinned. */ 625 /** Handle of the buffer to be pinned. */
572 __u32 handle; 626 __u32 handle;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index f72914db2a11..756f831cbdd5 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -118,6 +118,7 @@ header-y += mtio.h
118header-y += ncp_no.h 118header-y += ncp_no.h
119header-y += neighbour.h 119header-y += neighbour.h
120header-y += net_dropmon.h 120header-y += net_dropmon.h
121header-y += net_tstamp.h
121header-y += netfilter_arp.h 122header-y += netfilter_arp.h
122header-y += netrom.h 123header-y += netrom.h
123header-y += nfs2.h 124header-y += nfs2.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ce945d4845fc..36924255c0d5 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -251,6 +251,7 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
251void __init acpi_no_s4_hw_signature(void); 251void __init acpi_no_s4_hw_signature(void);
252void __init acpi_old_suspend_ordering(void); 252void __init acpi_old_suspend_ordering(void);
253void __init acpi_s4_no_nvs(void); 253void __init acpi_s4_no_nvs(void);
254void __init acpi_set_sci_en_on_resume(void);
254#endif /* CONFIG_PM_SLEEP */ 255#endif /* CONFIG_PM_SLEEP */
255 256
256struct acpi_osc_context { 257struct acpi_osc_context {
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 0f5f57858a23..8c4f884db6b4 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -36,18 +36,18 @@ struct backlight_device;
36struct fb_info; 36struct fb_info;
37 37
38struct backlight_ops { 38struct backlight_ops {
39 unsigned int options; 39 const unsigned int options;
40 40
41#define BL_CORE_SUSPENDRESUME (1 << 0) 41#define BL_CORE_SUSPENDRESUME (1 << 0)
42 42
43 /* Notify the backlight driver some property has changed */ 43 /* Notify the backlight driver some property has changed */
44 int (*update_status)(struct backlight_device *); 44 int (* const update_status)(struct backlight_device *);
45 /* Return the current backlight brightness (accounting for power, 45 /* Return the current backlight brightness (accounting for power,
46 fb_blank etc.) */ 46 fb_blank etc.) */
47 int (*get_brightness)(struct backlight_device *); 47 int (* const get_brightness)(struct backlight_device *);
48 /* Check if given framebuffer device is the one bound to this backlight; 48 /* Check if given framebuffer device is the one bound to this backlight;
49 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 49 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
50 int (*check_fb)(struct fb_info *); 50 int (* const check_fb)(struct fb_info *);
51}; 51};
52 52
53/* This structure defines all the properties of a backlight */ 53/* This structure defines all the properties of a backlight */
@@ -86,7 +86,7 @@ struct backlight_device {
86 registered this device has been unloaded, and if class_get_devdata() 86 registered this device has been unloaded, and if class_get_devdata()
87 points to something in the body of that driver, it is also invalid. */ 87 points to something in the body of that driver, it is also invalid. */
88 struct mutex ops_lock; 88 struct mutex ops_lock;
89 struct backlight_ops *ops; 89 const struct backlight_ops *ops;
90 90
91 /* The framebuffer notifier block */ 91 /* The framebuffer notifier block */
92 struct notifier_block fb_notif; 92 struct notifier_block fb_notif;
@@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd)
103} 103}
104 104
105extern struct backlight_device *backlight_device_register(const char *name, 105extern struct backlight_device *backlight_device_register(const char *name,
106 struct device *dev, void *devdata, struct backlight_ops *ops); 106 struct device *dev, void *devdata, const struct backlight_ops *ops);
107extern void backlight_device_unregister(struct backlight_device *bd); 107extern void backlight_device_unregister(struct backlight_device *bd);
108extern void backlight_force_update(struct backlight_device *bd, 108extern void backlight_force_update(struct backlight_device *bd,
109 enum backlight_update_reason reason); 109 enum backlight_update_reason reason);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index aece486ac734..cd4349bdc34e 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -68,6 +68,14 @@ struct linux_binprm{
68 68
69#define BINPRM_MAX_RECURSION 4 69#define BINPRM_MAX_RECURSION 4
70 70
71/* Function parameter for binfmt->coredump */
72struct coredump_params {
73 long signr;
74 struct pt_regs *regs;
75 struct file *file;
76 unsigned long limit;
77};
78
71/* 79/*
72 * This structure defines the functions that are used to load the binary formats that 80 * This structure defines the functions that are used to load the binary formats that
73 * linux accepts. 81 * linux accepts.
@@ -77,7 +85,7 @@ struct linux_binfmt {
77 struct module *module; 85 struct module *module;
78 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); 86 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
79 int (*load_shlib)(struct file *); 87 int (*load_shlib)(struct file *);
80 int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); 88 int (*core_dump)(struct coredump_params *cprm);
81 unsigned long min_coredump; /* minimal dump size */ 89 unsigned long min_coredump; /* minimal dump size */
82 int hasvdso; 90 int hasvdso;
83}; 91};
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 784a919aa0d0..9b98173a8184 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -845,7 +845,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
845 * blk_rq_err_bytes() : bytes left till the next error boundary 845 * blk_rq_err_bytes() : bytes left till the next error boundary
846 * blk_rq_sectors() : sectors left in the entire request 846 * blk_rq_sectors() : sectors left in the entire request
847 * blk_rq_cur_sectors() : sectors left in the current segment 847 * blk_rq_cur_sectors() : sectors left in the current segment
848 * blk_rq_err_sectors() : sectors left till the next error boundary
849 */ 848 */
850static inline sector_t blk_rq_pos(const struct request *rq) 849static inline sector_t blk_rq_pos(const struct request *rq)
851{ 850{
@@ -874,11 +873,6 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
874 return blk_rq_cur_bytes(rq) >> 9; 873 return blk_rq_cur_bytes(rq) >> 9;
875} 874}
876 875
877static inline unsigned int blk_rq_err_sectors(const struct request *rq)
878{
879 return blk_rq_err_bytes(rq) >> 9;
880}
881
882/* 876/*
883 * Request issue related functions. 877 * Request issue related functions.
884 */ 878 */
@@ -1116,11 +1110,18 @@ static inline int queue_alignment_offset(struct request_queue *q)
1116 return q->limits.alignment_offset; 1110 return q->limits.alignment_offset;
1117} 1111}
1118 1112
1113static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset)
1114{
1115 unsigned int granularity = max(lim->physical_block_size, lim->io_min);
1116
1117 offset &= granularity - 1;
1118 return (granularity + lim->alignment_offset - offset) & (granularity - 1);
1119}
1120
1119static inline int queue_sector_alignment_offset(struct request_queue *q, 1121static inline int queue_sector_alignment_offset(struct request_queue *q,
1120 sector_t sector) 1122 sector_t sector)
1121{ 1123{
1122 return ((sector << 9) - q->limits.alignment_offset) 1124 return queue_limit_alignment_offset(&q->limits, sector << 9);
1123 & (q->limits.io_min - 1);
1124} 1125}
1125 1126
1126static inline int bdev_alignment_offset(struct block_device *bdev) 1127static inline int bdev_alignment_offset(struct block_device *bdev)
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 12ff8c3f1d05..5032b9a31ae7 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -25,7 +25,7 @@ static void *malloc(int size)
25 void *p; 25 void *p;
26 26
27 if (size < 0) 27 if (size < 0)
28 error("Malloc error"); 28 return NULL;
29 if (!malloc_ptr) 29 if (!malloc_ptr)
30 malloc_ptr = free_mem_ptr; 30 malloc_ptr = free_mem_ptr;
31 31
@@ -35,7 +35,7 @@ static void *malloc(int size)
35 malloc_ptr += size; 35 malloc_ptr += size;
36 36
37 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) 37 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
38 error("Out of memory"); 38 return NULL;
39 39
40 malloc_count++; 40 malloc_count++;
41 return p; 41 return p;
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h
new file mode 100644
index 000000000000..987229752519
--- /dev/null
+++ b/include/linux/decompress/unlzo.h
@@ -0,0 +1,10 @@
1#ifndef DECOMPRESS_UNLZO_H
2#define DECOMPRESS_UNLZO_H
3
4int unlzo(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *pos,
9 void(*error)(char *x));
10#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index 2a73d9bcbc9c..a62799f2ab00 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -166,9 +166,9 @@ struct driver_attribute driver_attr_##_name = \
166 __ATTR(_name, _mode, _show, _store) 166 __ATTR(_name, _mode, _show, _store)
167 167
168extern int __must_check driver_create_file(struct device_driver *driver, 168extern int __must_check driver_create_file(struct device_driver *driver,
169 struct driver_attribute *attr); 169 const struct driver_attribute *attr);
170extern void driver_remove_file(struct device_driver *driver, 170extern void driver_remove_file(struct device_driver *driver,
171 struct driver_attribute *attr); 171 const struct driver_attribute *attr);
172 172
173extern int __must_check driver_add_kobj(struct device_driver *drv, 173extern int __must_check driver_add_kobj(struct device_driver *drv,
174 struct kobject *kobj, 174 struct kobject *kobj,
@@ -319,13 +319,13 @@ struct device_attribute {
319struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 319struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
320 320
321extern int __must_check device_create_file(struct device *device, 321extern int __must_check device_create_file(struct device *device,
322 struct device_attribute *entry); 322 const struct device_attribute *entry);
323extern void device_remove_file(struct device *dev, 323extern void device_remove_file(struct device *dev,
324 struct device_attribute *attr); 324 const struct device_attribute *attr);
325extern int __must_check device_create_bin_file(struct device *dev, 325extern int __must_check device_create_bin_file(struct device *dev,
326 struct bin_attribute *attr); 326 const struct bin_attribute *attr);
327extern void device_remove_bin_file(struct device *dev, 327extern void device_remove_bin_file(struct device *dev,
328 struct bin_attribute *attr); 328 const struct bin_attribute *attr);
329extern int device_schedule_callback_owner(struct device *dev, 329extern int device_schedule_callback_owner(struct device *dev,
330 void (*func)(struct device *dev), struct module *owner); 330 void (*func)(struct device *dev), struct module *owner);
331 331
diff --git a/include/linux/dst.h b/include/linux/dst.h
deleted file mode 100644
index e26fed84b1aa..000000000000
--- a/include/linux/dst.h
+++ /dev/null
@@ -1,587 +0,0 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DST_H
17#define __DST_H
18
19#include <linux/types.h>
20#include <linux/connector.h>
21
22#define DST_NAMELEN 32
23#define DST_NAME "dst"
24
25enum {
26 /* Remove node with given id from storage */
27 DST_DEL_NODE = 0,
28 /* Add remote node with given id to the storage */
29 DST_ADD_REMOTE,
30 /* Add local node with given id to the storage to be exported and used by remote peers */
31 DST_ADD_EXPORT,
32 /* Crypto initialization command (hash/cipher used to protect the connection) */
33 DST_CRYPTO,
34 /* Security attributes for given connection (permissions for example) */
35 DST_SECURITY,
36 /* Register given node in the block layer subsystem */
37 DST_START,
38 DST_CMD_MAX
39};
40
41struct dst_ctl
42{
43 /* Storage name */
44 char name[DST_NAMELEN];
45 /* Command flags */
46 __u32 flags;
47 /* Command itself (see above) */
48 __u32 cmd;
49 /* Maximum number of pages per single request in this device */
50 __u32 max_pages;
51 /* Stale/error transaction scanning timeout in milliseconds */
52 __u32 trans_scan_timeout;
53 /* Maximum number of retry sends before completing transaction as broken */
54 __u32 trans_max_retries;
55 /* Storage size */
56 __u64 size;
57};
58
59/* Reply command carries completion status */
60struct dst_ctl_ack
61{
62 struct cn_msg msg;
63 int error;
64 int unused[3];
65};
66
67/*
68 * Unfortunaltely socket address structure is not exported to userspace
69 * and is redefined there.
70 */
71#define SADDR_MAX_DATA 128
72
73struct saddr {
74 /* address family, AF_xxx */
75 unsigned short sa_family;
76 /* 14 bytes of protocol address */
77 char sa_data[SADDR_MAX_DATA];
78 /* Number of bytes used in sa_data */
79 unsigned short sa_data_len;
80};
81
82/* Address structure */
83struct dst_network_ctl
84{
85 /* Socket type: datagram, stream...*/
86 unsigned int type;
87 /* Let me guess, is it a Jupiter diameter? */
88 unsigned int proto;
89 /* Peer's address */
90 struct saddr addr;
91};
92
93struct dst_crypto_ctl
94{
95 /* Cipher and hash names */
96 char cipher_algo[DST_NAMELEN];
97 char hash_algo[DST_NAMELEN];
98
99 /* Key sizes. Can be zero for digest for example */
100 unsigned int cipher_keysize, hash_keysize;
101 /* Alignment. Calculated by the DST itself. */
102 unsigned int crypto_attached_size;
103 /* Number of threads to perform crypto operations */
104 int thread_num;
105};
106
107/* Export security attributes have this bits checked in when client connects */
108#define DST_PERM_READ (1<<0)
109#define DST_PERM_WRITE (1<<1)
110
111/*
112 * Right now it is simple model, where each remote address
113 * is assigned to set of permissions it is allowed to perform.
114 * In real world block device does not know anything but
115 * reading and writing, so it should be more than enough.
116 */
117struct dst_secure_user
118{
119 unsigned int permissions;
120 struct saddr addr;
121};
122
123/*
124 * Export control command: device to export and network address to accept
125 * clients to work with given device
126 */
127struct dst_export_ctl
128{
129 char device[DST_NAMELEN];
130 struct dst_network_ctl ctl;
131};
132
133enum {
134 DST_CFG = 1, /* Request remote configuration */
135 DST_IO, /* IO command */
136 DST_IO_RESPONSE, /* IO response */
137 DST_PING, /* Keepalive message */
138 DST_NCMD_MAX,
139};
140
141struct dst_cmd
142{
143 /* Network command itself, see above */
144 __u32 cmd;
145 /*
146 * Size of the attached data
147 * (in most cases, for READ command it means how many bytes were requested)
148 */
149 __u32 size;
150 /* Crypto size: number of attached bytes with digest/hmac */
151 __u32 csize;
152 /* Here we can carry secret data */
153 __u32 reserved;
154 /* Read/write bits, see how they are encoded in bio structure */
155 __u64 rw;
156 /* BIO flags */
157 __u64 flags;
158 /* Unique command id (like transaction ID) */
159 __u64 id;
160 /* Sector to start IO from */
161 __u64 sector;
162 /* Hash data is placed after this header */
163 __u8 hash[0];
164};
165
166/*
167 * Convert command to/from network byte order.
168 * We do not use hton*() functions, since there is
169 * no 64-bit implementation.
170 */
171static inline void dst_convert_cmd(struct dst_cmd *c)
172{
173 c->cmd = __cpu_to_be32(c->cmd);
174 c->csize = __cpu_to_be32(c->csize);
175 c->size = __cpu_to_be32(c->size);
176 c->sector = __cpu_to_be64(c->sector);
177 c->id = __cpu_to_be64(c->id);
178 c->flags = __cpu_to_be64(c->flags);
179 c->rw = __cpu_to_be64(c->rw);
180}
181
182/* Transaction id */
183typedef __u64 dst_gen_t;
184
185#ifdef __KERNEL__
186
187#include <linux/blkdev.h>
188#include <linux/bio.h>
189#include <linux/device.h>
190#include <linux/mempool.h>
191#include <linux/net.h>
192#include <linux/poll.h>
193#include <linux/rbtree.h>
194
195#ifdef CONFIG_DST_DEBUG
196#define dprintk(f, a...) printk(KERN_NOTICE f, ##a)
197#else
198static inline void __attribute__ ((format (printf, 1, 2)))
199 dprintk(const char *fmt, ...) {}
200#endif
201
202struct dst_node;
203
204struct dst_trans
205{
206 /* DST node we are working with */
207 struct dst_node *n;
208
209 /* Entry inside transaction tree */
210 struct rb_node trans_entry;
211
212 /* Merlin kills this transaction when this memory cell equals zero */
213 atomic_t refcnt;
214
215 /* How this transaction should be processed by crypto engine */
216 short enc;
217 /* How many times this transaction was resent */
218 short retries;
219 /* Completion status */
220 int error;
221
222 /* When did we send it to the remote peer */
223 long send_time;
224
225 /* My name is...
226 * Well, computers does not speak, they have unique id instead */
227 dst_gen_t gen;
228
229 /* Block IO we are working with */
230 struct bio *bio;
231
232 /* Network command for above block IO request */
233 struct dst_cmd cmd;
234};
235
236struct dst_crypto_engine
237{
238 /* What should we do with all block requests */
239 struct crypto_hash *hash;
240 struct crypto_ablkcipher *cipher;
241
242 /* Pool of pages used to encrypt data into before sending */
243 int page_num;
244 struct page **pages;
245
246 /* What to do with current request */
247 int enc;
248 /* Who we are and where do we go */
249 struct scatterlist *src, *dst;
250
251 /* Maximum timeout waiting for encryption to be completed */
252 long timeout;
253 /* IV is a 64-bit sequential counter */
254 u64 iv;
255
256 /* Secret data */
257 void *private;
258
259 /* Cached temporary data lives here */
260 int size;
261 void *data;
262};
263
264struct dst_state
265{
266 /* The main state protection */
267 struct mutex state_lock;
268
269 /* Polling machinery for sockets */
270 wait_queue_t wait;
271 wait_queue_head_t *whead;
272 /* Most of events are being waited here */
273 wait_queue_head_t thread_wait;
274
275 /* Who owns this? */
276 struct dst_node *node;
277
278 /* Network address for this state */
279 struct dst_network_ctl ctl;
280
281 /* Permissions to work with: read-only or rw connection */
282 u32 permissions;
283
284 /* Called when we need to clean private data */
285 void (* cleanup)(struct dst_state *st);
286
287 /* Used by the server: BIO completion queues BIOs here */
288 struct list_head request_list;
289 spinlock_t request_lock;
290
291 /* Guess what? No, it is not number of planets */
292 atomic_t refcnt;
293
294 /* This flags is set when connection should be dropped */
295 int need_exit;
296
297 /*
298 * Socket to work with. Second pointer is used for
299 * lockless check if socket was changed before performing
300 * next action (like working with cached polling result)
301 */
302 struct socket *socket, *read_socket;
303
304 /* Cached preallocated data */
305 void *data;
306 unsigned int size;
307
308 /* Currently processed command */
309 struct dst_cmd cmd;
310};
311
312struct dst_info
313{
314 /* Device size */
315 u64 size;
316
317 /* Local device name for export devices */
318 char local[DST_NAMELEN];
319
320 /* Network setup */
321 struct dst_network_ctl net;
322
323 /* Sysfs bits use this */
324 struct device device;
325};
326
327struct dst_node
328{
329 struct list_head node_entry;
330
331 /* Hi, my name is stored here */
332 char name[DST_NAMELEN];
333 /* My cache name is stored here */
334 char cache_name[DST_NAMELEN];
335
336 /* Block device attached to given node.
337 * Only valid for exporting nodes */
338 struct block_device *bdev;
339 /* Network state machine for given peer */
340 struct dst_state *state;
341
342 /* Block IO machinery */
343 struct request_queue *queue;
344 struct gendisk *disk;
345
346 /* Number of threads in processing pool */
347 int thread_num;
348 /* Maximum number of pages in single IO */
349 int max_pages;
350
351 /* I'm that big in bytes */
352 loff_t size;
353
354 /* Exported to userspace node information */
355 struct dst_info *info;
356
357 /*
358 * Security attribute list.
359 * Used only by exporting node currently.
360 */
361 struct list_head security_list;
362 struct mutex security_lock;
363
364 /*
365 * When this unerflows below zero, university collapses.
366 * But this will not happen, since node will be freed,
367 * when reference counter reaches zero.
368 */
369 atomic_t refcnt;
370
371 /* How precisely should I be started? */
372 int (*start)(struct dst_node *);
373
374 /* Crypto capabilities */
375 struct dst_crypto_ctl crypto;
376 u8 *hash_key;
377 u8 *cipher_key;
378
379 /* Pool of processing thread */
380 struct thread_pool *pool;
381
382 /* Transaction IDs live here */
383 atomic_long_t gen;
384
385 /*
386 * How frequently and how many times transaction
387 * tree should be scanned to drop stale objects.
388 */
389 long trans_scan_timeout;
390 int trans_max_retries;
391
392 /* Small gnomes live here */
393 struct rb_root trans_root;
394 struct mutex trans_lock;
395
396 /*
397 * Transaction cache/memory pool.
398 * It is big enough to contain not only transaction
399 * itself, but additional crypto data (digest/hmac).
400 */
401 struct kmem_cache *trans_cache;
402 mempool_t *trans_pool;
403
404 /* This entity scans transaction tree */
405 struct delayed_work trans_work;
406
407 wait_queue_head_t wait;
408};
409
410/* Kernel representation of the security attribute */
411struct dst_secure
412{
413 struct list_head sec_entry;
414 struct dst_secure_user sec;
415};
416
417int dst_process_bio(struct dst_node *n, struct bio *bio);
418
419int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r);
420int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le);
421
422static inline struct dst_state *dst_state_get(struct dst_state *st)
423{
424 BUG_ON(atomic_read(&st->refcnt) == 0);
425 atomic_inc(&st->refcnt);
426 return st;
427}
428
429void dst_state_put(struct dst_state *st);
430
431struct dst_state *dst_state_alloc(struct dst_node *n);
432int dst_state_socket_create(struct dst_state *st);
433void dst_state_socket_release(struct dst_state *st);
434
435void dst_state_exit_connected(struct dst_state *st);
436
437int dst_state_schedule_receiver(struct dst_state *st);
438
439void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str);
440
441static inline void dst_state_lock(struct dst_state *st)
442{
443 mutex_lock(&st->state_lock);
444}
445
446static inline void dst_state_unlock(struct dst_state *st)
447{
448 mutex_unlock(&st->state_lock);
449}
450
451void dst_poll_exit(struct dst_state *st);
452int dst_poll_init(struct dst_state *st);
453
454static inline unsigned int dst_state_poll(struct dst_state *st)
455{
456 unsigned int revents = POLLHUP | POLLERR;
457
458 dst_state_lock(st);
459 if (st->socket)
460 revents = st->socket->ops->poll(NULL, st->socket, NULL);
461 dst_state_unlock(st);
462
463 return revents;
464}
465
466static inline int dst_thread_setup(void *private, void *data)
467{
468 return 0;
469}
470
471void dst_node_put(struct dst_node *n);
472
473static inline struct dst_node *dst_node_get(struct dst_node *n)
474{
475 atomic_inc(&n->refcnt);
476 return n;
477}
478
479int dst_data_recv(struct dst_state *st, void *data, unsigned int size);
480int dst_recv_cdata(struct dst_state *st, void *cdata);
481int dst_data_send_header(struct socket *sock,
482 void *data, unsigned int size, int more);
483
484int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio);
485
486int dst_process_io(struct dst_state *st);
487int dst_export_crypto(struct dst_node *n, struct bio *bio);
488int dst_export_send_bio(struct bio *bio);
489int dst_start_export(struct dst_node *n);
490
491int __init dst_export_init(void);
492void dst_export_exit(void);
493
494/* Private structure for export block IO requests */
495struct dst_export_priv
496{
497 struct list_head request_entry;
498 struct dst_state *state;
499 struct bio *bio;
500 struct dst_cmd cmd;
501};
502
503static inline void dst_trans_get(struct dst_trans *t)
504{
505 atomic_inc(&t->refcnt);
506}
507
508struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen);
509int dst_trans_remove(struct dst_trans *t);
510int dst_trans_remove_nolock(struct dst_trans *t);
511void dst_trans_put(struct dst_trans *t);
512
513/*
514 * Convert bio into network command.
515 */
516static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd,
517 u32 command, u64 id)
518{
519 cmd->cmd = command;
520 cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS;
521 cmd->rw = bio->bi_rw;
522 cmd->size = bio->bi_size;
523 cmd->csize = 0;
524 cmd->id = id;
525 cmd->sector = bio->bi_sector;
526};
527
528int dst_trans_send(struct dst_trans *t);
529int dst_trans_crypto(struct dst_trans *t);
530
531int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl);
532void dst_node_crypto_exit(struct dst_node *n);
533
534static inline int dst_need_crypto(struct dst_node *n)
535{
536 struct dst_crypto_ctl *c = &n->crypto;
537 /*
538 * Logical OR is appropriate here, but boolean one produces
539 * more optimal code, so it is used instead.
540 */
541 return (c->hash_algo[0] | c->cipher_algo[0]);
542}
543
544int dst_node_trans_init(struct dst_node *n, unsigned int size);
545void dst_node_trans_exit(struct dst_node *n);
546
547/*
548 * Pool of threads.
549 * Ready list contains threads currently free to be used,
550 * active one contains threads with some work scheduled for them.
551 * Caller can wait in given queue when thread is ready.
552 */
553struct thread_pool
554{
555 int thread_num;
556 struct mutex thread_lock;
557 struct list_head ready_list, active_list;
558
559 wait_queue_head_t wait;
560};
561
562void thread_pool_del_worker(struct thread_pool *p);
563void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id);
564int thread_pool_add_worker(struct thread_pool *p,
565 char *name,
566 unsigned int id,
567 void *(* init)(void *data),
568 void (* cleanup)(void *data),
569 void *data);
570
571void thread_pool_destroy(struct thread_pool *p);
572struct thread_pool *thread_pool_create(int num, char *name,
573 void *(* init)(void *data),
574 void (* cleanup)(void *data),
575 void *data);
576
577int thread_pool_schedule(struct thread_pool *p,
578 int (* setup)(void *stored_private, void *setup_data),
579 int (* action)(void *stored_private, void *setup_data),
580 void *setup_data, long timeout);
581int thread_pool_schedule_private(struct thread_pool *p,
582 int (* setup)(void *private, void *data),
583 int (* action)(void *private, void *data),
584 void *data, long timeout, void *id);
585
586#endif /* __KERNEL__ */
587#endif /* __DST_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 90a4ed0ea0e5..0cc4d55151b7 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -361,7 +361,7 @@ typedef struct elf64_shdr {
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
364#define NT_PRXSTATUS 0x300 /* s390 upper register halves */ 364#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
365 365
366 366
367/* Note header in a PT_NOTE section */ 367/* Note header in a PT_NOTE section */
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index 90d1c2184112..9a33c5f7e126 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -42,6 +42,8 @@ enum enclosure_status {
42 ENCLOSURE_STATUS_NOT_INSTALLED, 42 ENCLOSURE_STATUS_NOT_INSTALLED,
43 ENCLOSURE_STATUS_UNKNOWN, 43 ENCLOSURE_STATUS_UNKNOWN,
44 ENCLOSURE_STATUS_UNAVAILABLE, 44 ENCLOSURE_STATUS_UNAVAILABLE,
45 /* last element for counting purposes */
46 ENCLOSURE_STATUS_MAX
45}; 47};
46 48
47/* SFF-8485 activity light settings */ 49/* SFF-8485 activity light settings */
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index f07f34de2f0e..258088ab3c6b 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -72,6 +72,8 @@ struct ext3_sb_info {
72 struct inode * s_journal_inode; 72 struct inode * s_journal_inode;
73 struct journal_s * s_journal; 73 struct journal_s * s_journal;
74 struct list_head s_orphan; 74 struct list_head s_orphan;
75 struct mutex s_orphan_lock;
76 struct mutex s_resize_lock;
75 unsigned long s_commit_interval; 77 unsigned long s_commit_interval;
76 struct block_device *journal_bdev; 78 struct block_device *journal_bdev;
77#ifdef CONFIG_JBD_DEBUG 79#ifdef CONFIG_JBD_DEBUG
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index cf82d519be40..d7b5ddca99c2 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -44,13 +44,13 @@
44 44
45#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ 45#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
46 EXT3_XATTR_TRANS_BLOCKS - 2 + \ 46 EXT3_XATTR_TRANS_BLOCKS - 2 + \
47 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) 47 EXT3_MAXQUOTAS_TRANS_BLOCKS(sb))
48 48
49/* Delete operations potentially hit one directory's namespace plus an 49/* Delete operations potentially hit one directory's namespace plus an
50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be 50 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
51 * generous. We can grow the delete transaction later if necessary. */ 51 * generous. We can grow the delete transaction later if necessary. */
52 52
53#define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) 53#define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64)
54 54
55/* Define an arbitrary limit for the amount of data we will anticipate 55/* Define an arbitrary limit for the amount of data we will anticipate
56 * writing to any given transaction. For unbounded transactions such as 56 * writing to any given transaction. For unbounded transactions such as
@@ -86,6 +86,9 @@
86#define EXT3_QUOTA_INIT_BLOCKS(sb) 0 86#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
87#define EXT3_QUOTA_DEL_BLOCKS(sb) 0 87#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
88#endif 88#endif
89#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
90#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
91#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
89 92
90int 93int
91ext3_mark_iloc_dirty(handle_t *handle, 94ext3_mark_iloc_dirty(handle_t *handle,
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h
index 934e22d65801..d830747f5c0b 100644
--- a/include/linux/fiemap.h
+++ b/include/linux/fiemap.h
@@ -62,5 +62,7 @@ struct fiemap {
62#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively 62#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
63 * support extents. Result 63 * support extents. Result
64 * merged for efficiency. */ 64 * merged for efficiency. */
65#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other
66 * files. */
65 67
66#endif /* _LINUX_FIEMAP_H */ 68#endif /* _LINUX_FIEMAP_H */
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index c6b3ca3af6df..1f716d9f714b 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -340,6 +340,9 @@ struct fw_cdev_send_response {
340 * The @closure field is passed back to userspace in the response event. 340 * The @closure field is passed back to userspace in the response event.
341 * The @handle field is an out parameter, returning a handle to the allocated 341 * The @handle field is an out parameter, returning a handle to the allocated
342 * range to be used for later deallocation of the range. 342 * range to be used for later deallocation of the range.
343 *
344 * The address range is allocated on all local nodes. The address allocation
345 * is exclusive except for the FCP command and response registers.
343 */ 346 */
344struct fw_cdev_allocate { 347struct fw_cdev_allocate {
345 __u64 offset; 348 __u64 offset;
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 9416a461b696..a0e67150a729 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -248,8 +248,8 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
248 void *data, size_t length, 248 void *data, size_t length,
249 void *callback_data); 249 void *callback_data);
250/* 250/*
251 * Important note: The callback must guarantee that either fw_send_response() 251 * Important note: Except for the FCP registers, the callback must guarantee
252 * or kfree() is called on the @request. 252 * that either fw_send_response() or kfree() is called on the @request.
253 */ 253 */
254typedef void (*fw_address_callback_t)(struct fw_card *card, 254typedef void (*fw_address_callback_t)(struct fw_card *card,
255 struct fw_request *request, 255 struct fw_request *request,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 66bc0a54b284..9147ca88f253 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1095,10 +1095,6 @@ struct file_lock {
1095 1095
1096extern void send_sigio(struct fown_struct *fown, int fd, int band); 1096extern void send_sigio(struct fown_struct *fown, int fd, int band);
1097 1097
1098/* fs/sync.c */
1099extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1100 loff_t endbyte, unsigned int flags);
1101
1102#ifdef CONFIG_FILE_LOCKING 1098#ifdef CONFIG_FILE_LOCKING
1103extern int fcntl_getlk(struct file *, struct flock __user *); 1099extern int fcntl_getlk(struct file *, struct flock __user *);
1104extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 1100extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
@@ -1591,7 +1587,7 @@ struct super_operations {
1591 * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at 1587 * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at
1592 * various stages of removing an inode. 1588 * various stages of removing an inode.
1593 * 1589 *
1594 * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. 1590 * Two bits are used for locking and completion notification, I_NEW and I_SYNC.
1595 * 1591 *
1596 * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on 1592 * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on
1597 * fdatasync(). i_atime is the usual cause. 1593 * fdatasync(). i_atime is the usual cause.
@@ -1600,8 +1596,14 @@ struct super_operations {
1600 * don't have to write inode on fdatasync() when only 1596 * don't have to write inode on fdatasync() when only
1601 * mtime has changed in it. 1597 * mtime has changed in it.
1602 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. 1598 * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean.
1603 * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both 1599 * I_NEW Serves as both a mutex and completion notification.
1604 * are cleared by unlock_new_inode(), called from iget(). 1600 * New inodes set I_NEW. If two processes both create
1601 * the same inode, one of them will release its inode and
1602 * wait for I_NEW to be released before returning.
1603 * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
1604 * also cause waiting on I_NEW, without I_NEW actually
1605 * being set. find_inode() uses this to prevent returning
1606 * nearly-dead inodes.
1605 * I_WILL_FREE Must be set when calling write_inode_now() if i_count 1607 * I_WILL_FREE Must be set when calling write_inode_now() if i_count
1606 * is zero. I_FREEING must be set when I_WILL_FREE is 1608 * is zero. I_FREEING must be set when I_WILL_FREE is
1607 * cleared. 1609 * cleared.
@@ -1615,35 +1617,23 @@ struct super_operations {
1615 * prohibited for many purposes. iget() must wait for 1617 * prohibited for many purposes. iget() must wait for
1616 * the inode to be completely released, then create it 1618 * the inode to be completely released, then create it
1617 * anew. Other functions will just ignore such inodes, 1619 * anew. Other functions will just ignore such inodes,
1618 * if appropriate. I_LOCK is used for waiting. 1620 * if appropriate. I_NEW is used for waiting.
1619 * 1621 *
1620 * I_LOCK Serves as both a mutex and completion notification. 1622 * I_SYNC Synchonized write of dirty inode data. The bits is
1621 * New inodes set I_LOCK. If two processes both create 1623 * set during data writeback, and cleared with a wakeup
1622 * the same inode, one of them will release its inode and 1624 * on the bit address once it is done.
1623 * wait for I_LOCK to be released before returning.
1624 * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
1625 * also cause waiting on I_LOCK, without I_LOCK actually
1626 * being set. find_inode() uses this to prevent returning
1627 * nearly-dead inodes.
1628 * I_SYNC Similar to I_LOCK, but limited in scope to writeback
1629 * of inode dirty data. Having a separate lock for this
1630 * purpose reduces latency and prevents some filesystem-
1631 * specific deadlocks.
1632 * 1625 *
1633 * Q: What is the difference between I_WILL_FREE and I_FREEING? 1626 * Q: What is the difference between I_WILL_FREE and I_FREEING?
1634 * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on
1635 * I_CLEAR? If not, why?
1636 */ 1627 */
1637#define I_DIRTY_SYNC 1 1628#define I_DIRTY_SYNC 1
1638#define I_DIRTY_DATASYNC 2 1629#define I_DIRTY_DATASYNC 2
1639#define I_DIRTY_PAGES 4 1630#define I_DIRTY_PAGES 4
1640#define I_NEW 8 1631#define __I_NEW 3
1632#define I_NEW (1 << __I_NEW)
1641#define I_WILL_FREE 16 1633#define I_WILL_FREE 16
1642#define I_FREEING 32 1634#define I_FREEING 32
1643#define I_CLEAR 64 1635#define I_CLEAR 64
1644#define __I_LOCK 7 1636#define __I_SYNC 7
1645#define I_LOCK (1 << __I_LOCK)
1646#define __I_SYNC 8
1647#define I_SYNC (1 << __I_SYNC) 1637#define I_SYNC (1 << __I_SYNC)
1648 1638
1649#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1639#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
@@ -2307,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations;
2307extern int generic_readlink(struct dentry *, char __user *, int); 2297extern int generic_readlink(struct dentry *, char __user *, int);
2308extern void generic_fillattr(struct inode *, struct kstat *); 2298extern void generic_fillattr(struct inode *, struct kstat *);
2309extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2299extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2300void __inode_add_bytes(struct inode *inode, loff_t bytes);
2310void inode_add_bytes(struct inode *inode, loff_t bytes); 2301void inode_add_bytes(struct inode *inode, loff_t bytes);
2311void inode_sub_bytes(struct inode *inode, loff_t bytes); 2302void inode_sub_bytes(struct inode *inode, loff_t bytes);
2312loff_t inode_get_bytes(struct inode *inode); 2303loff_t inode_get_bytes(struct inode *inode);
@@ -2472,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2472 2463
2473int __init get_filesystem_list(char *buf); 2464int __init get_filesystem_list(char *buf);
2474 2465
2466#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
2467#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE))
2468
2475#endif /* __KERNEL__ */ 2469#endif /* __KERNEL__ */
2476#endif /* _LINUX_FS_H */ 2470#endif /* _LINUX_FS_H */
diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h
index bb516ceeefc9..da317c7163ab 100644
--- a/include/linux/fs_stack.h
+++ b/include/linux/fs_stack.h
@@ -8,10 +8,8 @@
8#include <linux/fs.h> 8#include <linux/fs.h>
9 9
10/* externs for fs/stack.c */ 10/* externs for fs/stack.c */
11extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, 11extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src);
12 int (*get_nlinks)(struct inode *)); 12extern void fsstack_copy_inode_size(struct inode *dst, struct inode *src);
13
14extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src);
15 13
16/* inlines */ 14/* inlines */
17static inline void fsstack_copy_attr_atime(struct inode *dest, 15static inline void fsstack_copy_attr_atime(struct inode *dest,
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 211ff4497269..ab2cc20e21a5 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -46,7 +46,7 @@ void kmap_flush_unused(void);
46 46
47static inline unsigned int nr_free_highpages(void) { return 0; } 47static inline unsigned int nr_free_highpages(void) { return 0; }
48 48
49#define totalhigh_pages 0 49#define totalhigh_pages 0UL
50 50
51#ifndef ARCH_HAS_KMAP 51#ifndef ARCH_HAS_KMAP
52static inline void *kmap(struct page *page) 52static inline void *kmap(struct page *page)
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index fc5db826b48e..02c9af374741 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data {
89 unsigned short unlock_key2; /* Unlock Key 2 */ 89 unsigned short unlock_key2; /* Unlock Key 2 */
90}; 90};
91 91
92struct adp5588_gpio_platform_data {
93 unsigned gpio_start; /* GPIO Chip base # */
94 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
95 int (*setup)(struct i2c_client *client,
96 int gpio, unsigned ngpio,
97 void *context);
98 int (*teardown)(struct i2c_client *client,
99 int gpio, unsigned ngpio,
100 void *context);
101 void *context;
102};
103
92#endif 104#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index d9724a28c0c2..163c840437d6 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -832,7 +832,7 @@ struct ieee80211_ht_cap {
832#define IEEE80211_HT_CAP_DELAY_BA 0x0400 832#define IEEE80211_HT_CAP_DELAY_BA 0x0400
833#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 833#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
834#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 834#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
835#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000 835#define IEEE80211_HT_CAP_RESERVED 0x2000
836#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 836#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
837#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 837#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
838 838
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 699e85c01a4d..b2304929434e 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -81,6 +81,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
81#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 81#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
82#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) 82#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
83#define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) 83#define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER)
84#define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK)
84#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ 85#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
85 ACCEPT_SOURCE_ROUTE) 86 ACCEPT_SOURCE_ROUTE)
86#define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) 87#define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 5ed8b9c50355..abec69b63d7e 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -111,12 +111,6 @@ extern struct cred init_cred;
111# define INIT_PERF_EVENTS(tsk) 111# define INIT_PERF_EVENTS(tsk)
112#endif 112#endif
113 113
114#ifdef CONFIG_FS_JOURNAL_INFO
115#define INIT_JOURNAL_INFO .journal_info = NULL,
116#else
117#define INIT_JOURNAL_INFO
118#endif
119
120/* 114/*
121 * INIT_TASK is used to set up the first task table, touch at 115 * INIT_TASK is used to set up the first task table, touch at
122 * your own risk!. Base=0, limit=0x1fffff (=2MB) 116 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -168,6 +162,7 @@ extern struct cred init_cred;
168 .signal = {{0}}}, \ 162 .signal = {{0}}}, \
169 .blocked = {{0}}, \ 163 .blocked = {{0}}, \
170 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \ 164 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
165 .journal_info = NULL, \
171 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 166 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
172 .fs_excl = ATOMIC_INIT(0), \ 167 .fs_excl = ATOMIC_INIT(0), \
173 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ 168 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
@@ -178,7 +173,6 @@ extern struct cred init_cred;
178 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 173 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
179 }, \ 174 }, \
180 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 175 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
181 INIT_JOURNAL_INFO \
182 INIT_IDS \ 176 INIT_IDS \
183 INIT_PERF_EVENTS(tsk) \ 177 INIT_PERF_EVENTS(tsk) \
184 INIT_TRACE_IRQFLAGS \ 178 INIT_TRACE_IRQFLAGS \
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index f1011f7f3d41..638ce4554c76 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -653,6 +653,7 @@ struct transaction_s
653 * waiting for it to finish. 653 * waiting for it to finish.
654 */ 654 */
655 unsigned int t_synchronous_commit:1; 655 unsigned int t_synchronous_commit:1;
656 unsigned int t_flushed_data_blocks:1;
656 657
657 /* 658 /*
658 * For use by the filesystem to store fs-specific data 659 * For use by the filesystem to store fs-specific data
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index ad6bdf5a5970..7c6b32a1421c 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * A simple kernel FIFO implementation. 2 * A generic kernel FIFO implementation.
3 * 3 *
4 * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net>
4 * Copyright (C) 2004 Stelian Pop <stelian@popies.net> 5 * Copyright (C) 2004 Stelian Pop <stelian@popies.net>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -18,6 +19,25 @@
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * 20 *
20 */ 21 */
22
23/*
24 * Howto porting drivers to the new generic fifo API:
25 *
26 * - Modify the declaration of the "struct kfifo *" object into a
27 * in-place "struct kfifo" object
28 * - Init the in-place object with kfifo_alloc() or kfifo_init()
29 * Note: The address of the in-place "struct kfifo" object must be
30 * passed as the first argument to this functions
31 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get
32 * into kfifo_out
33 * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get
34 * into kfifo_out_locked
35 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc
36 * must be passed now to the kfifo_in_locked and kfifo_out_locked
37 * as the last parameter.
38 * - All formerly name __kfifo_* functions has been renamed into kfifo_*
39 */
40
21#ifndef _LINUX_KFIFO_H 41#ifndef _LINUX_KFIFO_H
22#define _LINUX_KFIFO_H 42#define _LINUX_KFIFO_H
23 43
@@ -29,124 +49,562 @@ struct kfifo {
29 unsigned int size; /* the size of the allocated buffer */ 49 unsigned int size; /* the size of the allocated buffer */
30 unsigned int in; /* data is added at offset (in % size) */ 50 unsigned int in; /* data is added at offset (in % size) */
31 unsigned int out; /* data is extracted from off. (out % size) */ 51 unsigned int out; /* data is extracted from off. (out % size) */
32 spinlock_t *lock; /* protects concurrent modifications */
33}; 52};
34 53
35extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, 54/*
36 gfp_t gfp_mask, spinlock_t *lock); 55 * Macros for declaration and initialization of the kfifo datatype
37extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, 56 */
38 spinlock_t *lock); 57
58/* helper macro */
59#define __kfifo_initializer(s, b) \
60 (struct kfifo) { \
61 .size = s, \
62 .in = 0, \
63 .out = 0, \
64 .buffer = b \
65 }
66
67/**
68 * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer
69 * @name: name of the declared kfifo datatype
70 * @size: size of the fifo buffer
71 *
72 * Note1: the macro can be used inside struct or union declaration
73 * Note2: the macro creates two objects:
74 * A kfifo object with the given name and a buffer for the kfifo
75 * object named name##kfifo_buffer
76 */
77#define DECLARE_KFIFO(name, size) \
78union { \
79 struct kfifo name; \
80 unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \
81}
82
83/**
84 * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO
85 * @name: name of the declared kfifo datatype
86 */
87#define INIT_KFIFO(name) \
88 name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
89 sizeof(struct kfifo), name##kfifo_buffer)
90
91/**
92 * DEFINE_KFIFO - macro to define and initialize a kfifo
93 * @name: name of the declared kfifo datatype
94 * @size: size of the fifo buffer
95 *
96 * Note1: the macro can be used for global and local kfifo data type variables
97 * Note2: the macro creates two objects:
98 * A kfifo object with the given name and a buffer for the kfifo
99 * object named name##kfifo_buffer
100 */
101#define DEFINE_KFIFO(name, size) \
102 unsigned char name##kfifo_buffer[size]; \
103 struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer)
104
105#undef __kfifo_initializer
106
107extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer,
108 unsigned int size);
109extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size,
110 gfp_t gfp_mask);
39extern void kfifo_free(struct kfifo *fifo); 111extern void kfifo_free(struct kfifo *fifo);
40extern unsigned int __kfifo_put(struct kfifo *fifo, 112extern unsigned int kfifo_in(struct kfifo *fifo,
41 const unsigned char *buffer, unsigned int len); 113 const unsigned char *from, unsigned int len);
42extern unsigned int __kfifo_get(struct kfifo *fifo, 114extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
43 unsigned char *buffer, unsigned int len); 115 unsigned char *to, unsigned int len);
44 116
45/** 117/**
46 * __kfifo_reset - removes the entire FIFO contents, no locking version 118 * kfifo_reset - removes the entire FIFO contents
47 * @fifo: the fifo to be emptied. 119 * @fifo: the fifo to be emptied.
48 */ 120 */
49static inline void __kfifo_reset(struct kfifo *fifo) 121static inline void kfifo_reset(struct kfifo *fifo)
50{ 122{
51 fifo->in = fifo->out = 0; 123 fifo->in = fifo->out = 0;
52} 124}
53 125
54/** 126/**
55 * kfifo_reset - removes the entire FIFO contents 127 * kfifo_reset_out - skip FIFO contents
56 * @fifo: the fifo to be emptied. 128 * @fifo: the fifo to be emptied.
57 */ 129 */
58static inline void kfifo_reset(struct kfifo *fifo) 130static inline void kfifo_reset_out(struct kfifo *fifo)
59{ 131{
60 unsigned long flags; 132 smp_mb();
133 fifo->out = fifo->in;
134}
61 135
62 spin_lock_irqsave(fifo->lock, flags); 136/**
137 * kfifo_size - returns the size of the fifo in bytes
138 * @fifo: the fifo to be used.
139 */
140static inline __must_check unsigned int kfifo_size(struct kfifo *fifo)
141{
142 return fifo->size;
143}
63 144
64 __kfifo_reset(fifo); 145/**
146 * kfifo_len - returns the number of used bytes in the FIFO
147 * @fifo: the fifo to be used.
148 */
149static inline unsigned int kfifo_len(struct kfifo *fifo)
150{
151 register unsigned int out;
65 152
66 spin_unlock_irqrestore(fifo->lock, flags); 153 out = fifo->out;
154 smp_rmb();
155 return fifo->in - out;
67} 156}
68 157
69/** 158/**
70 * kfifo_put - puts some data into the FIFO 159 * kfifo_is_empty - returns true if the fifo is empty
71 * @fifo: the fifo to be used. 160 * @fifo: the fifo to be used.
72 * @buffer: the data to be added. 161 */
73 * @len: the length of the data to be added. 162static inline __must_check int kfifo_is_empty(struct kfifo *fifo)
163{
164 return fifo->in == fifo->out;
165}
166
167/**
168 * kfifo_is_full - returns true if the fifo is full
169 * @fifo: the fifo to be used.
170 */
171static inline __must_check int kfifo_is_full(struct kfifo *fifo)
172{
173 return kfifo_len(fifo) == kfifo_size(fifo);
174}
175
176/**
177 * kfifo_avail - returns the number of bytes available in the FIFO
178 * @fifo: the fifo to be used.
179 */
180static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo)
181{
182 return kfifo_size(fifo) - kfifo_len(fifo);
183}
184
185/**
186 * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking
187 * @fifo: the fifo to be used.
188 * @from: the data to be added.
189 * @n: the length of the data to be added.
190 * @lock: pointer to the spinlock to use for locking.
74 * 191 *
75 * This function copies at most @len bytes from the @buffer into 192 * This function copies at most @len bytes from the @from buffer into
76 * the FIFO depending on the free space, and returns the number of 193 * the FIFO depending on the free space, and returns the number of
77 * bytes copied. 194 * bytes copied.
78 */ 195 */
79static inline unsigned int kfifo_put(struct kfifo *fifo, 196static inline unsigned int kfifo_in_locked(struct kfifo *fifo,
80 const unsigned char *buffer, unsigned int len) 197 const unsigned char *from, unsigned int n, spinlock_t *lock)
81{ 198{
82 unsigned long flags; 199 unsigned long flags;
83 unsigned int ret; 200 unsigned int ret;
84 201
85 spin_lock_irqsave(fifo->lock, flags); 202 spin_lock_irqsave(lock, flags);
86 203
87 ret = __kfifo_put(fifo, buffer, len); 204 ret = kfifo_in(fifo, from, n);
88 205
89 spin_unlock_irqrestore(fifo->lock, flags); 206 spin_unlock_irqrestore(lock, flags);
90 207
91 return ret; 208 return ret;
92} 209}
93 210
94/** 211/**
95 * kfifo_get - gets some data from the FIFO 212 * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking
96 * @fifo: the fifo to be used. 213 * @fifo: the fifo to be used.
97 * @buffer: where the data must be copied. 214 * @to: where the data must be copied.
98 * @len: the size of the destination buffer. 215 * @n: the size of the destination buffer.
216 * @lock: pointer to the spinlock to use for locking.
99 * 217 *
100 * This function copies at most @len bytes from the FIFO into the 218 * This function copies at most @len bytes from the FIFO into the
101 * @buffer and returns the number of copied bytes. 219 * @to buffer and returns the number of copied bytes.
102 */ 220 */
103static inline unsigned int kfifo_get(struct kfifo *fifo, 221static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
104 unsigned char *buffer, unsigned int len) 222 unsigned char *to, unsigned int n, spinlock_t *lock)
105{ 223{
106 unsigned long flags; 224 unsigned long flags;
107 unsigned int ret; 225 unsigned int ret;
108 226
109 spin_lock_irqsave(fifo->lock, flags); 227 spin_lock_irqsave(lock, flags);
110 228
111 ret = __kfifo_get(fifo, buffer, len); 229 ret = kfifo_out(fifo, to, n);
112 230
113 /* 231 /*
114 * optimization: if the FIFO is empty, set the indices to 0 232 * optimization: if the FIFO is empty, set the indices to 0
115 * so we don't wrap the next time 233 * so we don't wrap the next time
116 */ 234 */
117 if (fifo->in == fifo->out) 235 if (kfifo_is_empty(fifo))
118 fifo->in = fifo->out = 0; 236 kfifo_reset(fifo);
237
238 spin_unlock_irqrestore(lock, flags);
239
240 return ret;
241}
242
243extern void kfifo_skip(struct kfifo *fifo, unsigned int len);
244
245extern __must_check unsigned int kfifo_from_user(struct kfifo *fifo,
246 const void __user *from, unsigned int n);
247
248extern __must_check unsigned int kfifo_to_user(struct kfifo *fifo,
249 void __user *to, unsigned int n);
250
251/*
252 * __kfifo_add_out internal helper function for updating the out offset
253 */
254static inline void __kfifo_add_out(struct kfifo *fifo,
255 unsigned int off)
256{
257 smp_mb();
258 fifo->out += off;
259}
260
261/*
262 * __kfifo_add_in internal helper function for updating the in offset
263 */
264static inline void __kfifo_add_in(struct kfifo *fifo,
265 unsigned int off)
266{
267 smp_wmb();
268 fifo->in += off;
269}
270
271/*
272 * __kfifo_off internal helper function for calculating the index of a
273 * given offeset
274 */
275static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off)
276{
277 return off & (fifo->size - 1);
278}
279
280/*
281 * __kfifo_peek_n internal helper function for determinate the length of
282 * the next record in the fifo
283 */
284static inline unsigned int __kfifo_peek_n(struct kfifo *fifo,
285 unsigned int recsize)
286{
287#define __KFIFO_GET(fifo, off, shift) \
288 ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift))
289
290 unsigned int l;
291
292 l = __KFIFO_GET(fifo, 0, 0);
293
294 if (--recsize)
295 l |= __KFIFO_GET(fifo, 1, 8);
296
297 return l;
298#undef __KFIFO_GET
299}
300
301/*
302 * __kfifo_poke_n internal helper function for storing the length of
303 * the next record into the fifo
304 */
305static inline void __kfifo_poke_n(struct kfifo *fifo,
306 unsigned int recsize, unsigned int n)
307{
308#define __KFIFO_PUT(fifo, off, val, shift) \
309 ( \
310 (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \
311 (unsigned char)((val) >> (shift)) \
312 )
119 313
120 spin_unlock_irqrestore(fifo->lock, flags); 314 __KFIFO_PUT(fifo, 0, n, 0);
121 315
316 if (--recsize)
317 __KFIFO_PUT(fifo, 1, n, 8);
318#undef __KFIFO_PUT
319}
320
321/*
322 * __kfifo_in_... internal functions for put date into the fifo
323 * do not call it directly, use kfifo_in_rec() instead
324 */
325extern unsigned int __kfifo_in_n(struct kfifo *fifo,
326 const void *from, unsigned int n, unsigned int recsize);
327
328extern unsigned int __kfifo_in_generic(struct kfifo *fifo,
329 const void *from, unsigned int n, unsigned int recsize);
330
331static inline unsigned int __kfifo_in_rec(struct kfifo *fifo,
332 const void *from, unsigned int n, unsigned int recsize)
333{
334 unsigned int ret;
335
336 ret = __kfifo_in_n(fifo, from, n, recsize);
337
338 if (likely(ret == 0)) {
339 if (recsize)
340 __kfifo_poke_n(fifo, recsize, n);
341 __kfifo_add_in(fifo, n + recsize);
342 }
122 return ret; 343 return ret;
123} 344}
124 345
125/** 346/**
126 * __kfifo_len - returns the number of bytes available in the FIFO, no locking version 347 * kfifo_in_rec - puts some record data into the FIFO
127 * @fifo: the fifo to be used. 348 * @fifo: the fifo to be used.
349 * @from: the data to be added.
350 * @n: the length of the data to be added.
351 * @recsize: size of record field
352 *
353 * This function copies @n bytes from the @from into the FIFO and returns
354 * the number of bytes which cannot be copied.
355 * A returned value greater than the @n value means that the record doesn't
356 * fit into the buffer.
357 *
358 * Note that with only one concurrent reader and one concurrent
359 * writer, you don't need extra locking to use these functions.
128 */ 360 */
129static inline unsigned int __kfifo_len(struct kfifo *fifo) 361static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo,
362 void *from, unsigned int n, unsigned int recsize)
130{ 363{
131 return fifo->in - fifo->out; 364 if (!__builtin_constant_p(recsize))
365 return __kfifo_in_generic(fifo, from, n, recsize);
366 return __kfifo_in_rec(fifo, from, n, recsize);
367}
368
369/*
370 * __kfifo_out_... internal functions for get date from the fifo
371 * do not call it directly, use kfifo_out_rec() instead
372 */
373extern unsigned int __kfifo_out_n(struct kfifo *fifo,
374 void *to, unsigned int reclen, unsigned int recsize);
375
376extern unsigned int __kfifo_out_generic(struct kfifo *fifo,
377 void *to, unsigned int n,
378 unsigned int recsize, unsigned int *total);
379
380static inline unsigned int __kfifo_out_rec(struct kfifo *fifo,
381 void *to, unsigned int n, unsigned int recsize,
382 unsigned int *total)
383{
384 unsigned int l;
385
386 if (!recsize) {
387 l = n;
388 if (total)
389 *total = l;
390 } else {
391 l = __kfifo_peek_n(fifo, recsize);
392 if (total)
393 *total = l;
394 if (n < l)
395 return l;
396 }
397
398 return __kfifo_out_n(fifo, to, l, recsize);
132} 399}
133 400
134/** 401/**
135 * kfifo_len - returns the number of bytes available in the FIFO 402 * kfifo_out_rec - gets some record data from the FIFO
136 * @fifo: the fifo to be used. 403 * @fifo: the fifo to be used.
404 * @to: where the data must be copied.
405 * @n: the size of the destination buffer.
406 * @recsize: size of record field
407 * @total: pointer where the total number of to copied bytes should stored
408 *
409 * This function copies at most @n bytes from the FIFO to @to and returns the
410 * number of bytes which cannot be copied.
411 * A returned value greater than the @n value means that the record doesn't
412 * fit into the @to buffer.
413 *
414 * Note that with only one concurrent reader and one concurrent
415 * writer, you don't need extra locking to use these functions.
137 */ 416 */
138static inline unsigned int kfifo_len(struct kfifo *fifo) 417static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo,
418 void *to, unsigned int n, unsigned int recsize,
419 unsigned int *total)
420
139{ 421{
140 unsigned long flags; 422 if (!__builtin_constant_p(recsize))
141 unsigned int ret; 423 return __kfifo_out_generic(fifo, to, n, recsize, total);
424 return __kfifo_out_rec(fifo, to, n, recsize, total);
425}
426
427/*
428 * __kfifo_from_user_... internal functions for transfer from user space into
429 * the fifo. do not call it directly, use kfifo_from_user_rec() instead
430 */
431extern unsigned int __kfifo_from_user_n(struct kfifo *fifo,
432 const void __user *from, unsigned int n, unsigned int recsize);
142 433
143 spin_lock_irqsave(fifo->lock, flags); 434extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo,
435 const void __user *from, unsigned int n, unsigned int recsize);
144 436
145 ret = __kfifo_len(fifo); 437static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo,
438 const void __user *from, unsigned int n, unsigned int recsize)
439{
440 unsigned int ret;
146 441
147 spin_unlock_irqrestore(fifo->lock, flags); 442 ret = __kfifo_from_user_n(fifo, from, n, recsize);
148 443
444 if (likely(ret == 0)) {
445 if (recsize)
446 __kfifo_poke_n(fifo, recsize, n);
447 __kfifo_add_in(fifo, n + recsize);
448 }
149 return ret; 449 return ret;
150} 450}
151 451
452/**
453 * kfifo_from_user_rec - puts some data from user space into the FIFO
454 * @fifo: the fifo to be used.
455 * @from: pointer to the data to be added.
456 * @n: the length of the data to be added.
457 * @recsize: size of record field
458 *
459 * This function copies @n bytes from the @from into the
460 * FIFO and returns the number of bytes which cannot be copied.
461 *
462 * If the returned value is equal or less the @n value, the copy_from_user()
463 * functions has failed. Otherwise the record doesn't fit into the buffer.
464 *
465 * Note that with only one concurrent reader and one concurrent
466 * writer, you don't need extra locking to use these functions.
467 */
468static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo,
469 const void __user *from, unsigned int n, unsigned int recsize)
470{
471 if (!__builtin_constant_p(recsize))
472 return __kfifo_from_user_generic(fifo, from, n, recsize);
473 return __kfifo_from_user_rec(fifo, from, n, recsize);
474}
475
476/*
477 * __kfifo_to_user_... internal functions for transfer fifo data into user space
478 * do not call it directly, use kfifo_to_user_rec() instead
479 */
480extern unsigned int __kfifo_to_user_n(struct kfifo *fifo,
481 void __user *to, unsigned int n, unsigned int reclen,
482 unsigned int recsize);
483
484extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo,
485 void __user *to, unsigned int n, unsigned int recsize,
486 unsigned int *total);
487
488static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo,
489 void __user *to, unsigned int n,
490 unsigned int recsize, unsigned int *total)
491{
492 unsigned int l;
493
494 if (!recsize) {
495 l = n;
496 if (total)
497 *total = l;
498 } else {
499 l = __kfifo_peek_n(fifo, recsize);
500 if (total)
501 *total = l;
502 if (n < l)
503 return l;
504 }
505
506 return __kfifo_to_user_n(fifo, to, n, l, recsize);
507}
508
509/**
510 * kfifo_to_user_rec - gets data from the FIFO and write it to user space
511 * @fifo: the fifo to be used.
512 * @to: where the data must be copied.
513 * @n: the size of the destination buffer.
514 * @recsize: size of record field
515 * @total: pointer where the total number of to copied bytes should stored
516 *
517 * This function copies at most @n bytes from the FIFO to the @to.
518 * In case of an error, the function returns the number of bytes which cannot
519 * be copied.
520 * If the returned value is equal or less the @n value, the copy_to_user()
521 * functions has failed. Otherwise the record doesn't fit into the @to buffer.
522 *
523 * Note that with only one concurrent reader and one concurrent
524 * writer, you don't need extra locking to use these functions.
525 */
526static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo,
527 void __user *to, unsigned int n, unsigned int recsize,
528 unsigned int *total)
529{
530 if (!__builtin_constant_p(recsize))
531 return __kfifo_to_user_generic(fifo, to, n, recsize, total);
532 return __kfifo_to_user_rec(fifo, to, n, recsize, total);
533}
534
535/*
536 * __kfifo_peek_... internal functions for peek into the next fifo record
537 * do not call it directly, use kfifo_peek_rec() instead
538 */
539extern unsigned int __kfifo_peek_generic(struct kfifo *fifo,
540 unsigned int recsize);
541
542/**
543 * kfifo_peek_rec - gets the size of the next FIFO record data
544 * @fifo: the fifo to be used.
545 * @recsize: size of record field
546 *
547 * This function returns the size of the next FIFO record in number of bytes
548 */
549static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo,
550 unsigned int recsize)
551{
552 if (!__builtin_constant_p(recsize))
553 return __kfifo_peek_generic(fifo, recsize);
554 if (!recsize)
555 return kfifo_len(fifo);
556 return __kfifo_peek_n(fifo, recsize);
557}
558
559/*
560 * __kfifo_skip_... internal functions for skip the next fifo record
561 * do not call it directly, use kfifo_skip_rec() instead
562 */
563extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize);
564
565static inline void __kfifo_skip_rec(struct kfifo *fifo,
566 unsigned int recsize)
567{
568 unsigned int l;
569
570 if (recsize) {
571 l = __kfifo_peek_n(fifo, recsize);
572
573 if (l + recsize <= kfifo_len(fifo)) {
574 __kfifo_add_out(fifo, l + recsize);
575 return;
576 }
577 }
578 kfifo_reset_out(fifo);
579}
580
581/**
582 * kfifo_skip_rec - skip the next fifo out record
583 * @fifo: the fifo to be used.
584 * @recsize: size of record field
585 *
586 * This function skips the next FIFO record
587 */
588static inline void kfifo_skip_rec(struct kfifo *fifo,
589 unsigned int recsize)
590{
591 if (!__builtin_constant_p(recsize))
592 __kfifo_skip_generic(fifo, recsize);
593 else
594 __kfifo_skip_rec(fifo, recsize);
595}
596
597/**
598 * kfifo_avail_rec - returns the number of bytes available in a record FIFO
599 * @fifo: the fifo to be used.
600 * @recsize: size of record field
601 */
602static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo,
603 unsigned int recsize)
604{
605 unsigned int l = kfifo_size(fifo) - kfifo_len(fifo);
606
607 return (l > recsize) ? l - recsize : 0;
608}
609
152#endif 610#endif
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 6adcc297e354..19ec41a183f5 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -29,8 +29,7 @@ struct pt_regs;
29 * 29 *
30 * On some architectures it is required to skip a breakpoint 30 * On some architectures it is required to skip a breakpoint
31 * exception when it occurs after a breakpoint has been removed. 31 * exception when it occurs after a breakpoint has been removed.
32 * This can be implemented in the architecture specific portion of 32 * This can be implemented in the architecture specific portion of kgdb.
33 * for kgdb.
34 */ 33 */
35extern int kgdb_skipexception(int exception, struct pt_regs *regs); 34extern int kgdb_skipexception(int exception, struct pt_regs *regs);
36 35
@@ -65,7 +64,7 @@ struct uart_port;
65/** 64/**
66 * kgdb_breakpoint - compiled in breakpoint 65 * kgdb_breakpoint - compiled in breakpoint
67 * 66 *
68 * This will be impelmented a static inline per architecture. This 67 * This will be implemented as a static inline per architecture. This
69 * function is called by the kgdb core to execute an architecture 68 * function is called by the kgdb core to execute an architecture
70 * specific trap to cause kgdb to enter the exception processing. 69 * specific trap to cause kgdb to enter the exception processing.
71 * 70 *
@@ -190,7 +189,7 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
190 * @flags: Current IRQ state 189 * @flags: Current IRQ state
191 * 190 *
192 * On SMP systems, we need to get the attention of the other CPUs 191 * On SMP systems, we need to get the attention of the other CPUs
193 * and get them be in a known state. This should do what is needed 192 * and get them into a known state. This should do what is needed
194 * to get the other CPUs to call kgdb_wait(). Note that on some arches, 193 * to get the other CPUs to call kgdb_wait(). Note that on some arches,
195 * the NMI approach is not used for rounding up all the CPUs. For example, 194 * the NMI approach is not used for rounding up all the CPUs. For example,
196 * in case of MIPS, smp_call_function() is used to roundup CPUs. In 195 * in case of MIPS, smp_call_function() is used to roundup CPUs. In
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index e880d4cf9e22..08d7dc4ddf40 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -36,6 +36,56 @@ int kmemcheck_hide_addr(unsigned long address);
36 36
37bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); 37bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
38 38
39/*
40 * Bitfield annotations
41 *
42 * How to use: If you have a struct using bitfields, for example
43 *
44 * struct a {
45 * int x:8, y:8;
46 * };
47 *
48 * then this should be rewritten as
49 *
50 * struct a {
51 * kmemcheck_bitfield_begin(flags);
52 * int x:8, y:8;
53 * kmemcheck_bitfield_end(flags);
54 * };
55 *
56 * Now the "flags_begin" and "flags_end" members may be used to refer to the
57 * beginning and end, respectively, of the bitfield (and things like
58 * &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
59 * fields should be annotated:
60 *
61 * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
62 * kmemcheck_annotate_bitfield(a, flags);
63 */
64#define kmemcheck_bitfield_begin(name) \
65 int name##_begin[0];
66
67#define kmemcheck_bitfield_end(name) \
68 int name##_end[0];
69
70#define kmemcheck_annotate_bitfield(ptr, name) \
71 do { \
72 int _n; \
73 \
74 if (!ptr) \
75 break; \
76 \
77 _n = (long) &((ptr)->name##_end) \
78 - (long) &((ptr)->name##_begin); \
79 MAYBE_BUILD_BUG_ON(_n < 0); \
80 \
81 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
82 } while (0)
83
84#define kmemcheck_annotate_variable(var) \
85 do { \
86 kmemcheck_mark_initialized(&(var), sizeof(var)); \
87 } while (0) \
88
39#else 89#else
40#define kmemcheck_enabled 0 90#define kmemcheck_enabled 0
41 91
@@ -106,60 +156,16 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
106 return true; 156 return true;
107} 157}
108 158
109#endif /* CONFIG_KMEMCHECK */ 159#define kmemcheck_bitfield_begin(name)
110 160#define kmemcheck_bitfield_end(name)
111/* 161#define kmemcheck_annotate_bitfield(ptr, name) \
112 * Bitfield annotations 162 do { \
113 * 163 } while (0)
114 * How to use: If you have a struct using bitfields, for example
115 *
116 * struct a {
117 * int x:8, y:8;
118 * };
119 *
120 * then this should be rewritten as
121 *
122 * struct a {
123 * kmemcheck_bitfield_begin(flags);
124 * int x:8, y:8;
125 * kmemcheck_bitfield_end(flags);
126 * };
127 *
128 * Now the "flags_begin" and "flags_end" members may be used to refer to the
129 * beginning and end, respectively, of the bitfield (and things like
130 * &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
131 * fields should be annotated:
132 *
133 * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
134 * kmemcheck_annotate_bitfield(a, flags);
135 *
136 * Note: We provide the same definitions for both kmemcheck and non-
137 * kmemcheck kernels. This makes it harder to introduce accidental errors. It
138 * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield().
139 */
140#define kmemcheck_bitfield_begin(name) \
141 int name##_begin[0];
142
143#define kmemcheck_bitfield_end(name) \
144 int name##_end[0];
145 164
146#define kmemcheck_annotate_bitfield(ptr, name) \ 165#define kmemcheck_annotate_variable(var) \
147 do { \ 166 do { \
148 int _n; \
149 \
150 if (!ptr) \
151 break; \
152 \
153 _n = (long) &((ptr)->name##_end) \
154 - (long) &((ptr)->name##_begin); \
155 MAYBE_BUILD_BUG_ON(_n < 0); \
156 \
157 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
158 } while (0) 167 } while (0)
159 168
160#define kmemcheck_annotate_variable(var) \ 169#endif /* CONFIG_KMEMCHECK */
161 do { \
162 kmemcheck_mark_initialized(&(var), sizeof(var)); \
163 } while (0) \
164 170
165#endif /* LINUX_KMEMCHECK_H */ 171#endif /* LINUX_KMEMCHECK_H */
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 3c7497d46ee9..99d9a6766f7e 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -32,8 +32,7 @@ extern void kmemleak_padding(const void *ptr, unsigned long offset,
32 size_t size) __ref; 32 size_t size) __ref;
33extern void kmemleak_not_leak(const void *ptr) __ref; 33extern void kmemleak_not_leak(const void *ptr) __ref;
34extern void kmemleak_ignore(const void *ptr) __ref; 34extern void kmemleak_ignore(const void *ptr) __ref;
35extern void kmemleak_scan_area(const void *ptr, unsigned long offset, 35extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
36 size_t length, gfp_t gfp) __ref;
37extern void kmemleak_no_scan(const void *ptr) __ref; 36extern void kmemleak_no_scan(const void *ptr) __ref;
38 37
39static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, 38static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
@@ -84,8 +83,7 @@ static inline void kmemleak_not_leak(const void *ptr)
84static inline void kmemleak_ignore(const void *ptr) 83static inline void kmemleak_ignore(const void *ptr)
85{ 84{
86} 85}
87static inline void kmemleak_scan_area(const void *ptr, unsigned long offset, 86static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
88 size_t length, gfp_t gfp)
89{ 87{
90} 88}
91static inline void kmemleak_erase(void **ptr) 89static inline void kmemleak_erase(void **ptr)
diff --git a/include/linux/leds-lp3944.h b/include/linux/leds-lp3944.h
index afc9f9fd70f5..2618aa9063bc 100644
--- a/include/linux/leds-lp3944.h
+++ b/include/linux/leds-lp3944.h
@@ -12,9 +12,6 @@
12#ifndef __LINUX_LEDS_LP3944_H 12#ifndef __LINUX_LEDS_LP3944_H
13#define __LINUX_LEDS_LP3944_H 13#define __LINUX_LEDS_LP3944_H
14 14
15#include <linux/leds.h>
16#include <linux/workqueue.h>
17
18#define LP3944_LED0 0 15#define LP3944_LED0 0
19#define LP3944_LED1 1 16#define LP3944_LED1 1
20#define LP3944_LED2 2 17#define LP3944_LED2 2
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h
index 96eea90f01a8..f158eb1149aa 100644
--- a/include/linux/leds-pca9532.h
+++ b/include/linux/leds-pca9532.h
@@ -32,7 +32,7 @@ struct pca9532_led {
32 struct i2c_client *client; 32 struct i2c_client *client;
33 char *name; 33 char *name;
34 struct led_classdev ldev; 34 struct led_classdev ldev;
35 struct work_struct work; 35 struct work_struct work;
36 enum pca9532_type type; 36 enum pca9532_type type;
37 enum pca9532_state state; 37 enum pca9532_state state;
38}; 38};
diff --git a/include/linux/leds-regulator.h b/include/linux/leds-regulator.h
new file mode 100644
index 000000000000..5a8eb389aab8
--- /dev/null
+++ b/include/linux/leds-regulator.h
@@ -0,0 +1,46 @@
1/*
2 * leds-regulator.h - platform data structure for regulator driven LEDs.
3 *
4 * Copyright (C) 2009 Antonio Ospite <ospite@studenti.unina.it>
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef __LINUX_LEDS_REGULATOR_H
13#define __LINUX_LEDS_REGULATOR_H
14
15/*
16 * Use "vled" as supply id when declaring the regulator consumer:
17 *
18 * static struct regulator_consumer_supply pcap_regulator_VVIB_consumers [] = {
19 * { .dev_name = "leds-regulator.0", supply = "vled" },
20 * };
21 *
22 * If you have several regulator driven LEDs, you can append a numerical id to
23 * .dev_name as done above, and use the same id when declaring the platform
24 * device:
25 *
26 * static struct led_regulator_platform_data a780_vibrator_data = {
27 * .name = "a780::vibrator",
28 * };
29 *
30 * static struct platform_device a780_vibrator = {
31 * .name = "leds-regulator",
32 * .id = 0,
33 * .dev = {
34 * .platform_data = &a780_vibrator_data,
35 * },
36 * };
37 */
38
39#include <linux/leds.h>
40
41struct led_regulator_platform_data {
42 char *name; /* LED name as expected by LED class */
43 enum led_brightness brightness; /* initial brightness value */
44};
45
46#endif /* __LINUX_LEDS_REGULATOR_H */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6a9c4ddd3d95..73112250862c 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -354,6 +354,9 @@ enum {
354 /* max tries if error condition is still set after ->error_handler */ 354 /* max tries if error condition is still set after ->error_handler */
355 ATA_EH_MAX_TRIES = 5, 355 ATA_EH_MAX_TRIES = 5,
356 356
357 /* sometimes resuming a link requires several retries */
358 ATA_LINK_RESUME_TRIES = 5,
359
357 /* how hard are we gonna try to probe/recover devices */ 360 /* how hard are we gonna try to probe/recover devices */
358 ATA_PROBE_MAX_TRIES = 3, 361 ATA_PROBE_MAX_TRIES = 3,
359 ATA_EH_DEV_TRIES = 3, 362 ATA_EH_DEV_TRIES = 3,
diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h
new file mode 100644
index 000000000000..1a2df2efb771
--- /dev/null
+++ b/include/linux/list_sort.h
@@ -0,0 +1,11 @@
1#ifndef _LINUX_LIST_SORT_H
2#define _LINUX_LIST_SORT_H
3
4#include <linux/types.h>
5
6struct list_head;
7
8void list_sort(void *priv, struct list_head *head,
9 int (*cmp)(void *priv, struct list_head *a,
10 struct list_head *b));
11#endif
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 37fa19b34ef5..1adfe779eb99 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -50,6 +50,19 @@ struct memory_notify {
50 int status_change_nid; 50 int status_change_nid;
51}; 51};
52 52
53/*
54 * During pageblock isolation, count the number of pages within the
55 * range [start_pfn, start_pfn + nr_pages) which are owned by code
56 * in the notifier chain.
57 */
58#define MEM_ISOLATE_COUNT (1<<0)
59
60struct memory_isolate_notify {
61 unsigned long start_pfn; /* Start of range to check */
62 unsigned int nr_pages; /* # pages in range to check */
63 unsigned int pages_found; /* # pages owned found by callbacks */
64};
65
53struct notifier_block; 66struct notifier_block;
54struct mem_section; 67struct mem_section;
55 68
@@ -76,14 +89,28 @@ static inline int memory_notify(unsigned long val, void *v)
76{ 89{
77 return 0; 90 return 0;
78} 91}
92static inline int register_memory_isolate_notifier(struct notifier_block *nb)
93{
94 return 0;
95}
96static inline void unregister_memory_isolate_notifier(struct notifier_block *nb)
97{
98}
99static inline int memory_isolate_notify(unsigned long val, void *v)
100{
101 return 0;
102}
79#else 103#else
80extern int register_memory_notifier(struct notifier_block *nb); 104extern int register_memory_notifier(struct notifier_block *nb);
81extern void unregister_memory_notifier(struct notifier_block *nb); 105extern void unregister_memory_notifier(struct notifier_block *nb);
106extern int register_memory_isolate_notifier(struct notifier_block *nb);
107extern void unregister_memory_isolate_notifier(struct notifier_block *nb);
82extern int register_new_memory(int, struct mem_section *); 108extern int register_new_memory(int, struct mem_section *);
83extern int unregister_memory_section(struct mem_section *); 109extern int unregister_memory_section(struct mem_section *);
84extern int memory_dev_init(void); 110extern int memory_dev_init(void);
85extern int remove_memory_block(unsigned long, struct mem_section *, int); 111extern int remove_memory_block(unsigned long, struct mem_section *, int);
86extern int memory_notify(unsigned long val, void *v); 112extern int memory_notify(unsigned long val, void *v);
113extern int memory_isolate_notify(unsigned long val, void *v);
87extern struct memory_block *find_memory_block(struct mem_section *); 114extern struct memory_block *find_memory_block(struct mem_section *);
88#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 115#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
89enum mem_add_context { BOOT, HOTPLUG }; 116enum mem_add_context { BOOT, HOTPLUG };
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index 415c228743d5..fd322aca33ba 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -41,6 +41,23 @@ struct wm831x_battery_pdata {
41 int timeout; /** Charge cycle timeout, in minutes */ 41 int timeout; /** Charge cycle timeout, in minutes */
42}; 42};
43 43
44/**
45 * Configuration for the WM831x DC-DC BuckWise convertors. This
46 * should be passed as driver_data in the regulator_init_data.
47 *
48 * Currently all the configuration is for the fast DVS switching
49 * support of the devices. This allows MFPs on the device to be
50 * configured as an input to switch between two output voltages,
51 * allowing voltage transitions without the expense of an access over
52 * I2C or SPI buses.
53 */
54struct wm831x_buckv_pdata {
55 int dvs_gpio; /** CPU GPIO to use for DVS switching */
56 int dvs_control_src; /** Hardware DVS source to use (1 or 2) */
57 int dvs_init_state; /** DVS state to expect on startup */
58 int dvs_state_gpio; /** CPU GPIO to use for monitoring status */
59};
60
44/* Sources for status LED configuration. Values are register values 61/* Sources for status LED configuration. Values are register values
45 * plus 1 to allow for a zero default for preserve. 62 * plus 1 to allow for a zero default for preserve.
46 */ 63 */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 849b4a61bd8f..2265f28eb47a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1037,6 +1037,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1037extern void remove_active_range(unsigned int nid, unsigned long start_pfn, 1037extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1038 unsigned long end_pfn); 1038 unsigned long end_pfn);
1039extern void remove_all_active_ranges(void); 1039extern void remove_all_active_ranges(void);
1040void sort_node_map(void);
1041unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
1042 unsigned long end_pfn);
1040extern unsigned long absent_pages_in_range(unsigned long start_pfn, 1043extern unsigned long absent_pages_in_range(unsigned long start_pfn,
1041 unsigned long end_pfn); 1044 unsigned long end_pfn);
1042extern void get_pfn_range_for_nid(unsigned int nid, 1045extern void get_pfn_range_for_nid(unsigned int nid,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 84a524afb3dc..84d020bed083 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -123,6 +123,8 @@ struct vm_region {
123 struct file *vm_file; /* the backing file or NULL */ 123 struct file *vm_file; /* the backing file or NULL */
124 124
125 atomic_t vm_usage; /* region usage count */ 125 atomic_t vm_usage; /* region usage count */
126 bool vm_icache_flushed : 1; /* true if the icache has been flushed for
127 * this region */
126}; 128};
127 129
128/* 130/*
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 8a5509877192..ee24ef8ab616 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -1,8 +1,6 @@
1#ifndef LINUX_MM_DEBUG_H 1#ifndef LINUX_MM_DEBUG_H
2#define LINUX_MM_DEBUG_H 1 2#define LINUX_MM_DEBUG_H 1
3 3
4#include <linux/autoconf.h>
5
6#ifdef CONFIG_DEBUG_VM 4#ifdef CONFIG_DEBUG_VM
7#define VM_BUG_ON(cond) BUG_ON(cond) 5#define VM_BUG_ON(cond) BUG_ON(cond)
8#else 6#else
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6f7561730d88..30fe668c2542 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -15,7 +15,7 @@
15#include <linux/seqlock.h> 15#include <linux/seqlock.h>
16#include <linux/nodemask.h> 16#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 17#include <linux/pageblock-flags.h>
18#include <linux/bounds.h> 18#include <generated/bounds.h>
19#include <asm/atomic.h> 19#include <asm/atomic.h>
20#include <asm/page.h> 20#include <asm/page.h>
21 21
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index d9ebf1037dfa..d74785c2393a 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -23,6 +23,7 @@ struct proc_mounts {
23 23
24struct fs_struct; 24struct fs_struct;
25 25
26extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
26extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 27extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
27 struct fs_struct *); 28 struct fs_struct *);
28extern void put_mnt_ns(struct mnt_namespace *ns); 29extern void put_mnt_ns(struct mnt_namespace *ns);
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 028946750289..05b441d93642 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -72,8 +72,6 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
72 72
73extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 73extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
74 int (*open)(struct inode *, struct file *)); 74 int (*open)(struct inode *, struct file *));
75extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
76extern void release_open_intent(struct nameidata *);
77 75
78extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 76extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
79 77
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index feee2ba8d06a..5b59f35dcb8f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -8,7 +8,7 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#ifndef __GENERATING_BOUNDS_H 9#ifndef __GENERATING_BOUNDS_H
10#include <linux/mm_types.h> 10#include <linux/mm_types.h>
11#include <linux/bounds.h> 11#include <generated/bounds.h>
12#endif /* !__GENERATING_BOUNDS_H */ 12#endif /* !__GENERATING_BOUNDS_H */
13 13
14/* 14/*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index bf1e67080849..174e5392e51e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -243,6 +243,7 @@ struct pci_dev {
243 unsigned int d2_support:1; /* Low power state D2 is supported */ 243 unsigned int d2_support:1; /* Low power state D2 is supported */
244 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 244 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
245 unsigned int wakeup_prepared:1; 245 unsigned int wakeup_prepared:1;
246 unsigned int d3_delay; /* D3->D0 transition time in ms */
246 247
247#ifdef CONFIG_PCIEASPM 248#ifdef CONFIG_PCIEASPM
248 struct pcie_link_state *link_state; /* ASPM link state. */ 249 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -566,6 +567,9 @@ void pcibios_align_resource(void *, struct resource *, resource_size_t,
566 resource_size_t); 567 resource_size_t);
567void pcibios_update_irq(struct pci_dev *, int irq); 568void pcibios_update_irq(struct pci_dev *, int irq);
568 569
570/* Weak but can be overriden by arch */
571void pci_fixup_cardbus(struct pci_bus *);
572
569/* Generic PCI functions used internally */ 573/* Generic PCI functions used internally */
570 574
571extern struct pci_bus *pci_find_bus(int domain, int busnr); 575extern struct pci_bus *pci_find_bus(int domain, int busnr);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index b1368b8f6572..7968defd2fa7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -447,6 +447,7 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
447int phy_device_register(struct phy_device *phy); 447int phy_device_register(struct phy_device *phy);
448int phy_clear_interrupt(struct phy_device *phydev); 448int phy_clear_interrupt(struct phy_device *phydev);
449int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 449int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
450int phy_init_hw(struct phy_device *phydev);
450int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, 451int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
451 u32 flags, phy_interface_t interface); 452 u32 flags, phy_interface_t interface);
452struct phy_device * phy_attach(struct net_device *dev, 453struct phy_device * phy_attach(struct net_device *dev,
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 7fc194aef8c2..2110a81c5e2a 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -2,13 +2,25 @@
2#define _LINUX_POISON_H 2#define _LINUX_POISON_H
3 3
4/********** include/linux/list.h **********/ 4/********** include/linux/list.h **********/
5
6/*
7 * Architectures might want to move the poison pointer offset
8 * into some well-recognized area such as 0xdead000000000000,
9 * that is also not mappable by user-space exploits:
10 */
11#ifdef CONFIG_ILLEGAL_POINTER_VALUE
12# define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL)
13#else
14# define POISON_POINTER_DELTA 0
15#endif
16
5/* 17/*
6 * These are non-NULL pointers that will result in page faults 18 * These are non-NULL pointers that will result in page faults
7 * under normal circumstances, used to verify that nobody uses 19 * under normal circumstances, used to verify that nobody uses
8 * non-initialized list entries. 20 * non-initialized list entries.
9 */ 21 */
10#define LIST_POISON1 ((void *) 0x00100100) 22#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA)
11#define LIST_POISON2 ((void *) 0x00200200) 23#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA)
12 24
13/********** include/linux/timer.h **********/ 25/********** include/linux/timer.h **********/
14/* 26/*
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 7a9754c96775..01b3d759f1fc 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -10,7 +10,7 @@ struct platform_pwm_backlight_data {
10 unsigned int dft_brightness; 10 unsigned int dft_brightness;
11 unsigned int pwm_period_ns; 11 unsigned int pwm_period_ns;
12 int (*init)(struct device *dev); 12 int (*init)(struct device *dev);
13 int (*notify)(int brightness); 13 int (*notify)(struct device *dev, int brightness);
14 void (*exit)(struct device *dev); 14 void (*exit)(struct device *dev);
15}; 15};
16 16
diff --git a/include/linux/quota.h b/include/linux/quota.h
index e70e62194243..a6861f117480 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -315,8 +315,9 @@ struct dquot_operations {
315 int (*claim_space) (struct inode *, qsize_t); 315 int (*claim_space) (struct inode *, qsize_t);
316 /* release rsved quota for delayed alloc */ 316 /* release rsved quota for delayed alloc */
317 void (*release_rsv) (struct inode *, qsize_t); 317 void (*release_rsv) (struct inode *, qsize_t);
318 /* get reserved quota for delayed alloc */ 318 /* get reserved quota for delayed alloc, value returned is managed by
319 qsize_t (*get_reserved_space) (struct inode *); 319 * quota code only */
320 qsize_t *(*get_reserved_space) (struct inode *);
320}; 321};
321 322
322/* Operations handling requests from userspace */ 323/* Operations handling requests from userspace */
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index c4ba9a78721e..96cc307ed9f4 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -101,4 +101,9 @@ static inline void exit_rcu(void)
101{ 101{
102} 102}
103 103
104static inline int rcu_preempt_depth(void)
105{
106 return 0;
107}
108
104#endif /* __LINUX_RCUTINY_H */ 109#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index c93eee5911b0..8044b1b94333 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -45,6 +45,12 @@ extern void __rcu_read_unlock(void);
45extern void synchronize_rcu(void); 45extern void synchronize_rcu(void);
46extern void exit_rcu(void); 46extern void exit_rcu(void);
47 47
48/*
49 * Defined as macro as it is a very low level header
50 * included from areas that don't even know about current
51 */
52#define rcu_preempt_depth() (current->rcu_read_lock_nesting)
53
48#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 54#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
49 55
50static inline void __rcu_read_lock(void) 56static inline void __rcu_read_lock(void)
@@ -63,6 +69,11 @@ static inline void exit_rcu(void)
63{ 69{
64} 70}
65 71
72static inline int rcu_preempt_depth(void)
73{
74 return 0;
75}
76
66#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ 77#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
67 78
68static inline void __rcu_read_lock_bh(void) 79static inline void __rcu_read_lock_bh(void)
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 490c5b37b6d7..030d92255c7a 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -35,6 +35,8 @@
35#ifndef __LINUX_REGULATOR_CONSUMER_H_ 35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_ 36#define __LINUX_REGULATOR_CONSUMER_H_
37 37
38#include <linux/device.h>
39
38/* 40/*
39 * Regulator operating modes. 41 * Regulator operating modes.
40 * 42 *
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 87f5f176d4ef..234a8476cba8 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -43,16 +43,20 @@ struct regulator;
43/** 43/**
44 * struct regulator_state - regulator state during low power system states 44 * struct regulator_state - regulator state during low power system states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power
47 * state. One of enabled or disabled must be set for the
48 * configuration to be applied.
47 * 49 *
48 * @uV: Operating voltage during suspend. 50 * @uV: Operating voltage during suspend.
49 * @mode: Operating mode during suspend. 51 * @mode: Operating mode during suspend.
50 * @enabled: Enabled during suspend. 52 * @enabled: Enabled during suspend.
53 * @disabled: Disabled during suspend.
51 */ 54 */
52struct regulator_state { 55struct regulator_state {
53 int uV; /* suspend voltage */ 56 int uV; /* suspend voltage */
54 unsigned int mode; /* suspend regulator operating mode */ 57 unsigned int mode; /* suspend regulator operating mode */
55 int enabled; /* is regulator enabled in this suspend state */ 58 int enabled; /* is regulator enabled in this suspend state */
59 int disabled; /* is the regulator disbled in this suspend state */
56}; 60};
57 61
58/** 62/**
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h
new file mode 100644
index 000000000000..9936763621c7
--- /dev/null
+++ b/include/linux/regulator/max8660.h
@@ -0,0 +1,57 @@
1/*
2 * max8660.h -- Voltage regulation for the Maxim 8660/8661
3 *
4 * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K.
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; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __LINUX_REGULATOR_MAX8660_H
21#define __LINUX_REGULATOR_MAX8660_H
22
23#include <linux/regulator/machine.h>
24
25enum {
26 MAX8660_V3,
27 MAX8660_V4,
28 MAX8660_V5,
29 MAX8660_V6,
30 MAX8660_V7,
31 MAX8660_V_END,
32};
33
34/**
35 * max8660_subdev_data - regulator subdev data
36 * @id: regulator id
37 * @name: regulator name
38 * @platform_data: regulator init data
39 */
40struct max8660_subdev_data {
41 int id;
42 char *name;
43 struct regulator_init_data *platform_data;
44};
45
46/**
47 * max8660_platform_data - platform data for max8660
48 * @num_subdevs: number of regulators used
49 * @subdevs: pointer to regulators used
50 * @en34_is_high: if EN34 is driven high, regulators cannot be en-/disabled.
51 */
52struct max8660_platform_data {
53 int num_subdevs;
54 struct max8660_subdev_data *subdevs;
55 unsigned en34_is_high:1;
56};
57#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index c96c1858fe2c..1ba3cf6edfbb 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -62,6 +62,12 @@ void reiserfs_write_unlock(struct super_block *s);
62int reiserfs_write_lock_once(struct super_block *s); 62int reiserfs_write_lock_once(struct super_block *s);
63void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); 63void reiserfs_write_unlock_once(struct super_block *s, int lock_depth);
64 64
65#ifdef CONFIG_REISERFS_CHECK
66void reiserfs_lock_check_recursive(struct super_block *s);
67#else
68static inline void reiserfs_lock_check_recursive(struct super_block *s) { }
69#endif
70
65/* 71/*
66 * Several mutexes depend on the write lock. 72 * Several mutexes depend on the write lock.
67 * However sometimes we want to relax the write lock while we hold 73 * However sometimes we want to relax the write lock while we hold
@@ -92,11 +98,31 @@ void reiserfs_write_unlock_once(struct super_block *s, int lock_depth);
92static inline void reiserfs_mutex_lock_safe(struct mutex *m, 98static inline void reiserfs_mutex_lock_safe(struct mutex *m,
93 struct super_block *s) 99 struct super_block *s)
94{ 100{
101 reiserfs_lock_check_recursive(s);
95 reiserfs_write_unlock(s); 102 reiserfs_write_unlock(s);
96 mutex_lock(m); 103 mutex_lock(m);
97 reiserfs_write_lock(s); 104 reiserfs_write_lock(s);
98} 105}
99 106
107static inline void
108reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass,
109 struct super_block *s)
110{
111 reiserfs_lock_check_recursive(s);
112 reiserfs_write_unlock(s);
113 mutex_lock_nested(m, subclass);
114 reiserfs_write_lock(s);
115}
116
117static inline void
118reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s)
119{
120 reiserfs_lock_check_recursive(s);
121 reiserfs_write_unlock(s);
122 down_read(sem);
123 reiserfs_write_lock(s);
124}
125
100/* 126/*
101 * When we schedule, we usually want to also release the write lock, 127 * When we schedule, we usually want to also release the write lock,
102 * according to the previous bkl based locking scheme of reiserfs. 128 * according to the previous bkl based locking scheme of reiserfs.
diff --git a/include/linux/resource.h b/include/linux/resource.h
index 40fc7e626082..f1e914eefeab 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -3,8 +3,6 @@
3 3
4#include <linux/time.h> 4#include <linux/time.h>
5 5
6struct task_struct;
7
8/* 6/*
9 * Resource control/accounting header file for linux 7 * Resource control/accounting header file for linux
10 */ 8 */
@@ -70,6 +68,12 @@ struct rlimit {
70 */ 68 */
71#include <asm/resource.h> 69#include <asm/resource.h>
72 70
71#ifdef __KERNEL__
72
73struct task_struct;
74
73int getrusage(struct task_struct *p, int who, struct rusage __user *ru); 75int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
74 76
77#endif /* __KERNEL__ */
78
75#endif 79#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 244c287a5ac1..8d4991be9d53 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -192,6 +192,12 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
192#define TASK_DEAD 64 192#define TASK_DEAD 64
193#define TASK_WAKEKILL 128 193#define TASK_WAKEKILL 128
194#define TASK_WAKING 256 194#define TASK_WAKING 256
195#define TASK_STATE_MAX 512
196
197#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW"
198
199extern char ___assert_task_state[1 - 2*!!(
200 sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)];
195 201
196/* Convenience macros for the sake of set_task_state */ 202/* Convenience macros for the sake of set_task_state */
197#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) 203#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
@@ -1091,7 +1097,8 @@ struct sched_class {
1091 enum cpu_idle_type idle); 1097 enum cpu_idle_type idle);
1092 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1098 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1093 void (*post_schedule) (struct rq *this_rq); 1099 void (*post_schedule) (struct rq *this_rq);
1094 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 1100 void (*task_waking) (struct rq *this_rq, struct task_struct *task);
1101 void (*task_woken) (struct rq *this_rq, struct task_struct *task);
1095 1102
1096 void (*set_cpus_allowed)(struct task_struct *p, 1103 void (*set_cpus_allowed)(struct task_struct *p,
1097 const struct cpumask *newmask); 1104 const struct cpumask *newmask);
@@ -1115,7 +1122,7 @@ struct sched_class {
1115 struct task_struct *task); 1122 struct task_struct *task);
1116 1123
1117#ifdef CONFIG_FAIR_GROUP_SCHED 1124#ifdef CONFIG_FAIR_GROUP_SCHED
1118 void (*moved_group) (struct task_struct *p); 1125 void (*moved_group) (struct task_struct *p, int on_rq);
1119#endif 1126#endif
1120}; 1127};
1121 1128
@@ -1446,10 +1453,8 @@ struct task_struct {
1446 gfp_t lockdep_reclaim_gfp; 1453 gfp_t lockdep_reclaim_gfp;
1447#endif 1454#endif
1448 1455
1449#ifdef CONFIG_FS_JOURNAL_INFO
1450/* journalling filesystem info */ 1456/* journalling filesystem info */
1451 void *journal_info; 1457 void *journal_info;
1452#endif
1453 1458
1454/* stacked block device info */ 1459/* stacked block device info */
1455 struct bio *bio_list, **bio_tail; 1460 struct bio *bio_list, **bio_tail;
@@ -1555,7 +1560,7 @@ struct task_struct {
1555}; 1560};
1556 1561
1557/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1562/* Future-safe accessor for struct task_struct's cpus_allowed. */
1558#define tsk_cpumask(tsk) (&(tsk)->cpus_allowed) 1563#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1559 1564
1560/* 1565/*
1561 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 1566 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
@@ -2596,7 +2601,27 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2596} 2601}
2597#endif /* CONFIG_MM_OWNER */ 2602#endif /* CONFIG_MM_OWNER */
2598 2603
2599#define TASK_STATE_TO_CHAR_STR "RSDTtZX" 2604static inline unsigned long task_rlimit(const struct task_struct *tsk,
2605 unsigned int limit)
2606{
2607 return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur);
2608}
2609
2610static inline unsigned long task_rlimit_max(const struct task_struct *tsk,
2611 unsigned int limit)
2612{
2613 return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max);
2614}
2615
2616static inline unsigned long rlimit(unsigned int limit)
2617{
2618 return task_rlimit(current, limit);
2619}
2620
2621static inline unsigned long rlimit_max(unsigned int limit)
2622{
2623 return task_rlimit_max(current, limit);
2624}
2600 2625
2601#endif /* __KERNEL__ */ 2626#endif /* __KERNEL__ */
2602 2627
diff --git a/include/linux/security.h b/include/linux/security.h
index 466cbadbd1ef..2c627d361c02 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -95,8 +95,13 @@ struct seq_file;
95extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 95extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
96extern int cap_netlink_recv(struct sk_buff *skb, int cap); 96extern int cap_netlink_recv(struct sk_buff *skb, int cap);
97 97
98#ifdef CONFIG_MMU
98extern unsigned long mmap_min_addr; 99extern unsigned long mmap_min_addr;
99extern unsigned long dac_mmap_min_addr; 100extern unsigned long dac_mmap_min_addr;
101#else
102#define dac_mmap_min_addr 0UL
103#endif
104
100/* 105/*
101 * Values used in the task_security_ops calls 106 * Values used in the task_security_ops calls
102 */ 107 */
@@ -121,6 +126,7 @@ struct request_sock;
121#define LSM_UNSAFE_PTRACE 2 126#define LSM_UNSAFE_PTRACE 2
122#define LSM_UNSAFE_PTRACE_CAP 4 127#define LSM_UNSAFE_PTRACE_CAP 4
123 128
129#ifdef CONFIG_MMU
124/* 130/*
125 * If a hint addr is less than mmap_min_addr change hint to be as 131 * If a hint addr is less than mmap_min_addr change hint to be as
126 * low as possible but still greater than mmap_min_addr 132 * low as possible but still greater than mmap_min_addr
@@ -135,6 +141,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
135} 141}
136extern int mmap_min_addr_handler(struct ctl_table *table, int write, 142extern int mmap_min_addr_handler(struct ctl_table *table, int write,
137 void __user *buffer, size_t *lenp, loff_t *ppos); 143 void __user *buffer, size_t *lenp, loff_t *ppos);
144#endif
138 145
139#ifdef CONFIG_SECURITY 146#ifdef CONFIG_SECURITY
140 147
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 34c4475ac4a2..4f95c1aac2fd 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -111,6 +111,7 @@
111#define SONYPI_EVENT_VOLUME_INC_PRESSED 69 111#define SONYPI_EVENT_VOLUME_INC_PRESSED 69
112#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 112#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70
113#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 113#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71
114#define SONYPI_EVENT_MEDIA_PRESSED 72
114 115
115/* get/set brightness */ 116/* get/set brightness */
116#define SONYPI_IOCGBRT _IOR('v', 0, __u8) 117#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h
new file mode 100644
index 000000000000..51b3e771a9a3
--- /dev/null
+++ b/include/linux/spi/dw_spi.h
@@ -0,0 +1,212 @@
1#ifndef DW_SPI_HEADER_H
2#define DW_SPI_HEADER_H
3#include <linux/io.h>
4
5/* Bit fields in CTRLR0 */
6#define SPI_DFS_OFFSET 0
7
8#define SPI_FRF_OFFSET 4
9#define SPI_FRF_SPI 0x0
10#define SPI_FRF_SSP 0x1
11#define SPI_FRF_MICROWIRE 0x2
12#define SPI_FRF_RESV 0x3
13
14#define SPI_MODE_OFFSET 6
15#define SPI_SCPH_OFFSET 6
16#define SPI_SCOL_OFFSET 7
17#define SPI_TMOD_OFFSET 8
18#define SPI_TMOD_TR 0x0 /* xmit & recv */
19#define SPI_TMOD_TO 0x1 /* xmit only */
20#define SPI_TMOD_RO 0x2 /* recv only */
21#define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */
22
23#define SPI_SLVOE_OFFSET 10
24#define SPI_SRL_OFFSET 11
25#define SPI_CFS_OFFSET 12
26
27/* Bit fields in SR, 7 bits */
28#define SR_MASK 0x7f /* cover 7 bits */
29#define SR_BUSY (1 << 0)
30#define SR_TF_NOT_FULL (1 << 1)
31#define SR_TF_EMPT (1 << 2)
32#define SR_RF_NOT_EMPT (1 << 3)
33#define SR_RF_FULL (1 << 4)
34#define SR_TX_ERR (1 << 5)
35#define SR_DCOL (1 << 6)
36
37/* Bit fields in ISR, IMR, RISR, 7 bits */
38#define SPI_INT_TXEI (1 << 0)
39#define SPI_INT_TXOI (1 << 1)
40#define SPI_INT_RXUI (1 << 2)
41#define SPI_INT_RXOI (1 << 3)
42#define SPI_INT_RXFI (1 << 4)
43#define SPI_INT_MSTI (1 << 5)
44
45/* TX RX interrupt level threshhold, max can be 256 */
46#define SPI_INT_THRESHOLD 32
47
48enum dw_ssi_type {
49 SSI_MOTO_SPI = 0,
50 SSI_TI_SSP,
51 SSI_NS_MICROWIRE,
52};
53
54struct dw_spi_reg {
55 u32 ctrl0;
56 u32 ctrl1;
57 u32 ssienr;
58 u32 mwcr;
59 u32 ser;
60 u32 baudr;
61 u32 txfltr;
62 u32 rxfltr;
63 u32 txflr;
64 u32 rxflr;
65 u32 sr;
66 u32 imr;
67 u32 isr;
68 u32 risr;
69 u32 txoicr;
70 u32 rxoicr;
71 u32 rxuicr;
72 u32 msticr;
73 u32 icr;
74 u32 dmacr;
75 u32 dmatdlr;
76 u32 dmardlr;
77 u32 idr;
78 u32 version;
79 u32 dr; /* Currently oper as 32 bits,
80 though only low 16 bits matters */
81} __packed;
82
83struct dw_spi {
84 struct spi_master *master;
85 struct spi_device *cur_dev;
86 struct device *parent_dev;
87 enum dw_ssi_type type;
88
89 void __iomem *regs;
90 unsigned long paddr;
91 u32 iolen;
92 int irq;
93 u32 max_freq; /* max bus freq supported */
94
95 u16 bus_num;
96 u16 num_cs; /* supported slave numbers */
97
98 /* Driver message queue */
99 struct workqueue_struct *workqueue;
100 struct work_struct pump_messages;
101 spinlock_t lock;
102 struct list_head queue;
103 int busy;
104 int run;
105
106 /* Message Transfer pump */
107 struct tasklet_struct pump_transfers;
108
109 /* Current message transfer state info */
110 struct spi_message *cur_msg;
111 struct spi_transfer *cur_transfer;
112 struct chip_data *cur_chip;
113 struct chip_data *prev_chip;
114 size_t len;
115 void *tx;
116 void *tx_end;
117 void *rx;
118 void *rx_end;
119 int dma_mapped;
120 dma_addr_t rx_dma;
121 dma_addr_t tx_dma;
122 size_t rx_map_len;
123 size_t tx_map_len;
124 u8 n_bytes; /* current is a 1/2 bytes op */
125 u8 max_bits_per_word; /* maxim is 16b */
126 u32 dma_width;
127 int cs_change;
128 int (*write)(struct dw_spi *dws);
129 int (*read)(struct dw_spi *dws);
130 irqreturn_t (*transfer_handler)(struct dw_spi *dws);
131 void (*cs_control)(u32 command);
132
133 /* Dma info */
134 int dma_inited;
135 struct dma_chan *txchan;
136 struct dma_chan *rxchan;
137 int txdma_done;
138 int rxdma_done;
139 u64 tx_param;
140 u64 rx_param;
141 struct device *dma_dev;
142 dma_addr_t dma_addr;
143
144 /* Bus interface info */
145 void *priv;
146#ifdef CONFIG_DEBUG_FS
147 struct dentry *debugfs;
148#endif
149};
150
151#define dw_readl(dw, name) \
152 __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name))
153#define dw_writel(dw, name, val) \
154 __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name))
155#define dw_readw(dw, name) \
156 __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name))
157#define dw_writew(dw, name, val) \
158 __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name))
159
160static inline void spi_enable_chip(struct dw_spi *dws, int enable)
161{
162 dw_writel(dws, ssienr, (enable ? 1 : 0));
163}
164
165static inline void spi_set_clk(struct dw_spi *dws, u16 div)
166{
167 dw_writel(dws, baudr, div);
168}
169
170static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
171{
172 if (cs > dws->num_cs)
173 return;
174 dw_writel(dws, ser, 1 << cs);
175}
176
177/* Disable IRQ bits */
178static inline void spi_mask_intr(struct dw_spi *dws, u32 mask)
179{
180 u32 new_mask;
181
182 new_mask = dw_readl(dws, imr) & ~mask;
183 dw_writel(dws, imr, new_mask);
184}
185
186/* Enable IRQ bits */
187static inline void spi_umask_intr(struct dw_spi *dws, u32 mask)
188{
189 u32 new_mask;
190
191 new_mask = dw_readl(dws, imr) | mask;
192 dw_writel(dws, imr, new_mask);
193}
194
195/*
196 * Each SPI slave device to work with dw_api controller should
197 * has such a structure claiming its working mode (PIO/DMA etc),
198 * which can be save in the "controller_data" member of the
199 * struct spi_device
200 */
201struct dw_spi_chip {
202 u8 poll_mode; /* 0 for contoller polling mode */
203 u8 type; /* SPI/SSP/Micrwire */
204 u8 enable_dma;
205 void (*cs_control)(u32 command);
206};
207
208extern int dw_spi_add_host(struct dw_spi *dws);
209extern void dw_spi_remove_host(struct dw_spi *dws);
210extern int dw_spi_suspend_host(struct dw_spi *dws);
211extern int dw_spi_resume_host(struct dw_spi *dws);
212#endif /* DW_SPI_HEADER_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b7c7fcf7790b..feee739afe21 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -195,7 +195,7 @@ struct perf_event_attr;
195 static const struct syscall_metadata __used \ 195 static const struct syscall_metadata __used \
196 __attribute__((__aligned__(4))) \ 196 __attribute__((__aligned__(4))) \
197 __attribute__((section("__syscalls_metadata"))) \ 197 __attribute__((section("__syscalls_metadata"))) \
198 __syscall_meta_##sname = { \ 198 __syscall_meta__##sname = { \
199 .name = "sys_"#sname, \ 199 .name = "sys_"#sname, \
200 .nb_args = 0, \ 200 .nb_args = 0, \
201 .enter_event = &event_enter__##sname, \ 201 .enter_event = &event_enter__##sname, \
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 877ba039e6a4..bd27fbc9db62 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -482,6 +482,7 @@ enum
482 NET_IPV4_CONF_ARP_ACCEPT=21, 482 NET_IPV4_CONF_ARP_ACCEPT=21,
483 NET_IPV4_CONF_ARP_NOTIFY=22, 483 NET_IPV4_CONF_ARP_NOTIFY=22,
484 NET_IPV4_CONF_ACCEPT_LOCAL=23, 484 NET_IPV4_CONF_ACCEPT_LOCAL=23,
485 NET_IPV4_CONF_SRC_VMARK=24,
485 __NET_IPV4_CONF_MAX 486 __NET_IPV4_CONF_MAX
486}; 487};
487 488
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 9d68fed50f11..cfa83083a2d4 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
99void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 99void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
100 100
101int __must_check sysfs_create_bin_file(struct kobject *kobj, 101int __must_check sysfs_create_bin_file(struct kobject *kobj,
102 struct bin_attribute *attr); 102 const struct bin_attribute *attr);
103void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); 103void sysfs_remove_bin_file(struct kobject *kobj,
104 const struct bin_attribute *attr);
104 105
105int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, 106int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
106 const char *name); 107 const char *name);
@@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj,
175} 176}
176 177
177static inline int sysfs_create_bin_file(struct kobject *kobj, 178static inline int sysfs_create_bin_file(struct kobject *kobj,
178 struct bin_attribute *attr) 179 const struct bin_attribute *attr)
179{ 180{
180 return 0; 181 return 0;
181} 182}
182 183
183static inline void sysfs_remove_bin_file(struct kobject *kobj, 184static inline void sysfs_remove_bin_file(struct kobject *kobj,
184 struct bin_attribute *attr) 185 const struct bin_attribute *attr)
185{ 186{
186} 187}
187 188
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 6b58367d145e..d512d98dfb7d 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -94,6 +94,7 @@ static inline unsigned long __copy_from_user_nocache(void *to,
94 * happens, handle that and return -EFAULT. 94 * happens, handle that and return -EFAULT.
95 */ 95 */
96extern long probe_kernel_read(void *dst, void *src, size_t size); 96extern long probe_kernel_read(void *dst, void *src, size_t size);
97extern long __probe_kernel_read(void *dst, void *src, size_t size);
97 98
98/* 99/*
99 * probe_kernel_write(): safely attempt to write to a location 100 * probe_kernel_write(): safely attempt to write to a location
@@ -104,6 +105,7 @@ extern long probe_kernel_read(void *dst, void *src, size_t size);
104 * Safely write to address @dst from the buffer at @src. If a kernel fault 105 * Safely write to address @dst from the buffer at @src. If a kernel fault
105 * happens, handle that and return -EFAULT. 106 * happens, handle that and return -EFAULT.
106 */ 107 */
107extern long probe_kernel_write(void *dst, void *src, size_t size); 108extern long notrace probe_kernel_write(void *dst, void *src, size_t size);
109extern long notrace __probe_kernel_write(void *dst, void *src, size_t size);
108 110
109#endif /* __LINUX_UACCESS_H__ */ 111#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index acf6e457c04b..1819396ed501 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -16,6 +16,7 @@
16#include <linux/kref.h> 16#include <linux/kref.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/sysrq.h> 18#include <linux/sysrq.h>
19#include <linux/kfifo.h>
19 20
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 21#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ 22#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
@@ -94,7 +95,7 @@ struct usb_serial_port {
94 unsigned char *bulk_out_buffer; 95 unsigned char *bulk_out_buffer;
95 int bulk_out_size; 96 int bulk_out_size;
96 struct urb *write_urb; 97 struct urb *write_urb;
97 struct kfifo *write_fifo; 98 struct kfifo write_fifo;
98 int write_urb_busy; 99 int write_urb_busy;
99 __u8 bulk_out_endpointAddress; 100 __u8 bulk_out_endpointAddress;
100 101
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index 79b9837d9ca0..cf97b5b9d1fe 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -1,4 +1,4 @@
1#include <linux/utsrelease.h> 1#include <generated/utsrelease.h>
2#include <linux/module.h> 2#include <linux/module.h>
3 3
4/* Simply sanity version stamp for modules. */ 4/* Simply sanity version stamp for modules. */
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 3fb9944e50a6..d5dd0bc408fd 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -84,6 +84,8 @@ struct vt_setactivate {
84 84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ 85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86 86
87#ifdef __KERNEL__
88
87#ifdef CONFIG_VT_CONSOLE 89#ifdef CONFIG_VT_CONSOLE
88 90
89extern int vt_kmsg_redirect(int new); 91extern int vt_kmsg_redirect(int new);
@@ -97,6 +99,8 @@ static inline int vt_kmsg_redirect(int new)
97 99
98#endif 100#endif
99 101
102#endif /* __KERNEL__ */
103
100#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1) 104#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
101 105
102#endif /* _LINUX_VT_H */ 106#endif /* _LINUX_VT_H */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 705f01fe413a..76e8903cd204 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -70,6 +70,7 @@ struct writeback_control {
70struct bdi_writeback; 70struct bdi_writeback;
71int inode_wait(void *); 71int inode_wait(void *);
72void writeback_inodes_sb(struct super_block *); 72void writeback_inodes_sb(struct super_block *);
73int writeback_inodes_sb_if_idle(struct super_block *);
73void sync_inodes_sb(struct super_block *); 74void sync_inodes_sb(struct super_block *);
74void writeback_inodes_wbc(struct writeback_control *wbc); 75void writeback_inodes_wbc(struct writeback_control *wbc);
75long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 76long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
@@ -79,8 +80,7 @@ void wakeup_flusher_threads(long nr_pages);
79static inline void wait_on_inode(struct inode *inode) 80static inline void wait_on_inode(struct inode *inode)
80{ 81{
81 might_sleep(); 82 might_sleep();
82 wait_on_bit(&inode->i_state, __I_LOCK, inode_wait, 83 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE);
83 TASK_UNINTERRUPTIBLE);
84} 84}
85static inline void inode_sync_wait(struct inode *inode) 85static inline void inode_sync_wait(struct inode *inode)
86{ 86{
diff --git a/include/net/ip.h b/include/net/ip.h
index 85108cfbb1ae..d9a0e74d8923 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -326,6 +326,22 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
326 326
327#endif 327#endif
328 328
329static inline int sk_mc_loop(struct sock *sk)
330{
331 if (!sk)
332 return 1;
333 switch (sk->sk_family) {
334 case AF_INET:
335 return inet_sk(sk)->mc_loop;
336#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
337 case AF_INET6:
338 return inet6_sk(sk)->mc_loop;
339#endif
340 }
341 __WARN();
342 return 1;
343}
344
329extern int ip_call_ra_chain(struct sk_buff *skb); 345extern int ip_call_ra_chain(struct sk_buff *skb);
330 346
331/* 347/*
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2aff4906b2ae..0bf369752274 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -547,7 +547,6 @@ enum mac80211_rx_flags {
547 * unspecified depending on the hardware capabilities flags 547 * unspecified depending on the hardware capabilities flags
548 * @IEEE80211_HW_SIGNAL_* 548 * @IEEE80211_HW_SIGNAL_*
549 * @noise: noise when receiving this frame, in dBm. 549 * @noise: noise when receiving this frame, in dBm.
550 * @qual: overall signal quality indication, in percent (0-100).
551 * @antenna: antenna used 550 * @antenna: antenna used
552 * @rate_idx: index of data rate into band's supported rates or MCS index if 551 * @rate_idx: index of data rate into band's supported rates or MCS index if
553 * HT rates are use (RX_FLAG_HT) 552 * HT rates are use (RX_FLAG_HT)
@@ -559,7 +558,6 @@ struct ieee80211_rx_status {
559 int freq; 558 int freq;
560 int signal; 559 int signal;
561 int noise; 560 int noise;
562 int __deprecated qual;
563 int antenna; 561 int antenna;
564 int rate_idx; 562 int rate_idx;
565 int flag; 563 int flag;
@@ -1737,6 +1735,12 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
1737 local_bh_enable(); 1735 local_bh_enable();
1738} 1736}
1739 1737
1738/*
1739 * The TX headroom reserved by mac80211 for its own tx_status functions.
1740 * This is enough for the radiotap header.
1741 */
1742#define IEEE80211_TX_STATUS_HEADROOM 13
1743
1740/** 1744/**
1741 * ieee80211_tx_status - transmit status callback 1745 * ieee80211_tx_status - transmit status callback
1742 * 1746 *
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7394e3bc8f4b..ff92b46f5153 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -28,6 +28,7 @@
28#include <linux/mutex.h> 28#include <linux/mutex.h>
29#include <linux/timer.h> 29#include <linux/timer.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/kfifo.h>
31#include <scsi/iscsi_proto.h> 32#include <scsi/iscsi_proto.h>
32#include <scsi/iscsi_if.h> 33#include <scsi/iscsi_if.h>
33#include <scsi/scsi_transport_iscsi.h> 34#include <scsi/scsi_transport_iscsi.h>
@@ -231,7 +232,7 @@ struct iscsi_conn {
231}; 232};
232 233
233struct iscsi_pool { 234struct iscsi_pool {
234 struct kfifo *queue; /* FIFO Queue */ 235 struct kfifo queue; /* FIFO Queue */
235 void **pool; /* Pool of elements */ 236 void **pool; /* Pool of elements */
236 int max; /* Max number of elements */ 237 int max; /* Max number of elements */
237}; 238};
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 9e3182e659db..741ae7ed4394 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -80,7 +80,7 @@ struct iscsi_tcp_task {
80 int data_offset; 80 int data_offset;
81 struct iscsi_r2t_info *r2t; /* in progress solict R2T */ 81 struct iscsi_r2t_info *r2t; /* in progress solict R2T */
82 struct iscsi_pool r2tpool; 82 struct iscsi_pool r2tpool;
83 struct kfifo *r2tqueue; 83 struct kfifo r2tqueue;
84 void *dd_data; 84 void *dd_data;
85}; 85};
86 86
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h
index ba615e4c1d7c..f4105c91af53 100644
--- a/include/scsi/libsrp.h
+++ b/include/scsi/libsrp.h
@@ -2,6 +2,7 @@
2#define __LIBSRP_H__ 2#define __LIBSRP_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/kfifo.h>
5#include <scsi/scsi_cmnd.h> 6#include <scsi/scsi_cmnd.h>
6#include <scsi/scsi_host.h> 7#include <scsi/scsi_host.h>
7#include <scsi/srp.h> 8#include <scsi/srp.h>
@@ -21,7 +22,7 @@ struct srp_buf {
21struct srp_queue { 22struct srp_queue {
22 void *pool; 23 void *pool;
23 void *items; 24 void *items;
24 struct kfifo *queue; 25 struct kfifo queue;
25 spinlock_t lock; 26 spinlock_t lock;
26}; 27};
27 28
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index 39d6d1097153..a8f370126632 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -142,6 +142,7 @@ struct osd_request {
142 struct _osd_io_info { 142 struct _osd_io_info {
143 struct bio *bio; 143 struct bio *bio;
144 u64 total_bytes; 144 u64 total_bytes;
145 u64 residual;
145 struct request *req; 146 struct request *req;
146 struct _osd_req_data_segment *last_seg; 147 struct _osd_req_data_segment *last_seg;
147 u8 *pad_buff; 148 u8 *pad_buff;
@@ -150,12 +151,14 @@ struct osd_request {
150 gfp_t alloc_flags; 151 gfp_t alloc_flags;
151 unsigned timeout; 152 unsigned timeout;
152 unsigned retries; 153 unsigned retries;
154 unsigned sense_len;
153 u8 sense[OSD_MAX_SENSE_LEN]; 155 u8 sense[OSD_MAX_SENSE_LEN];
154 enum osd_attributes_mode attributes_mode; 156 enum osd_attributes_mode attributes_mode;
155 157
156 osd_req_done_fn *async_done; 158 osd_req_done_fn *async_done;
157 void *async_private; 159 void *async_private;
158 int async_error; 160 int async_error;
161 int req_errors;
159}; 162};
160 163
161static inline bool osd_req_is_ver1(struct osd_request *or) 164static inline bool osd_req_is_ver1(struct osd_request *or)
@@ -297,8 +300,6 @@ enum osd_err_priority {
297}; 300};
298 301
299struct osd_sense_info { 302struct osd_sense_info {
300 u64 out_resid; /* Zero on success otherwise out residual */
301 u64 in_resid; /* Zero on success otherwise in residual */
302 enum osd_err_priority osd_err_pri; 303 enum osd_err_priority osd_err_pri;
303 304
304 int key; /* one of enum scsi_sense_keys */ 305 int key; /* one of enum scsi_sense_keys */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 2fdd36df41f6..4a46a60c2077 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -414,7 +414,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
414 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 414 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
415 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 415 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
416 offsetof(typeof(field), item), \ 416 offsetof(typeof(field), item), \
417 sizeof(field.item), 0, FILTER_OTHER); \ 417 sizeof(field.item), \
418 is_signed_type(type), FILTER_OTHER); \
418 if (ret) \ 419 if (ret) \
419 return ret; 420 return ret;
420 421
@@ -422,8 +423,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
422#define __dynamic_array(type, item, len) \ 423#define __dynamic_array(type, item, len) \
423 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ 424 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \
424 offsetof(typeof(field), __data_loc_##item), \ 425 offsetof(typeof(field), __data_loc_##item), \
425 sizeof(field.__data_loc_##item), 0, \ 426 sizeof(field.__data_loc_##item), \
426 FILTER_OTHER); 427 is_signed_type(type), FILTER_OTHER);
427 428
428#undef __string 429#undef __string
429#define __string(item, src) __dynamic_array(char, item, -1) 430#define __string(item, src) __dynamic_array(char, item, -1)
diff --git a/init/Kconfig b/init/Kconfig
index 06dab27c18d9..ada48441aff8 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -115,10 +115,13 @@ config HAVE_KERNEL_BZIP2
115config HAVE_KERNEL_LZMA 115config HAVE_KERNEL_LZMA
116 bool 116 bool
117 117
118config HAVE_KERNEL_LZO
119 bool
120
118choice 121choice
119 prompt "Kernel compression mode" 122 prompt "Kernel compression mode"
120 default KERNEL_GZIP 123 default KERNEL_GZIP
121 depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA 124 depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_LZO
122 help 125 help
123 The linux kernel is a kind of self-extracting executable. 126 The linux kernel is a kind of self-extracting executable.
124 Several compression algorithms are available, which differ 127 Several compression algorithms are available, which differ
@@ -141,9 +144,8 @@ config KERNEL_GZIP
141 bool "Gzip" 144 bool "Gzip"
142 depends on HAVE_KERNEL_GZIP 145 depends on HAVE_KERNEL_GZIP
143 help 146 help
144 The old and tried gzip compression. Its compression ratio is 147 The old and tried gzip compression. It provides a good balance
145 the poorest among the 3 choices; however its speed (both 148 between compression ratio and decompression speed.
146 compression and decompression) is the fastest.
147 149
148config KERNEL_BZIP2 150config KERNEL_BZIP2
149 bool "Bzip2" 151 bool "Bzip2"
@@ -164,6 +166,14 @@ config KERNEL_LZMA
164 two. Compression is slowest. The kernel size is about 33% 166 two. Compression is slowest. The kernel size is about 33%
165 smaller with LZMA in comparison to gzip. 167 smaller with LZMA in comparison to gzip.
166 168
169config KERNEL_LZO
170 bool "LZO"
171 depends on HAVE_KERNEL_LZO
172 help
173 Its compression ratio is the poorest among the 4. The kernel
174 size is about about 10% bigger than gzip; however its speed
175 (both compression and decompression) is the fastest.
176
167endchoice 177endchoice
168 178
169config SWAP 179config SWAP
diff --git a/init/Makefile b/init/Makefile
index 4a243df426f7..0bf677aa0872 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -15,12 +15,8 @@ mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
15mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o 15mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
16mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o 16mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o
17 17
18# files to be removed upon make clean
19clean-files := ../include/linux/compile.h
20
21# dependencies on generated files need to be listed explicitly 18# dependencies on generated files need to be listed explicitly
22 19$(obj)/version.o: include/generated/compile.h
23$(obj)/version.o: include/linux/compile.h
24 20
25# compile.h changes depending on hostname, generation number, etc, 21# compile.h changes depending on hostname, generation number, etc,
26# so we regenerate it always. 22# so we regenerate it always.
@@ -30,7 +26,7 @@ $(obj)/version.o: include/linux/compile.h
30 chk_compile.h = : 26 chk_compile.h = :
31 quiet_chk_compile.h = echo ' CHK $@' 27 quiet_chk_compile.h = echo ' CHK $@'
32silent_chk_compile.h = : 28silent_chk_compile.h = :
33include/linux/compile.h: FORCE 29include/generated/compile.h: FORCE
34 @$($(quiet)chk_compile.h) 30 @$($(quiet)chk_compile.h)
35 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ 31 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
36 "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)" 32 "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)"
diff --git a/init/initramfs.c b/init/initramfs.c
index 4c00edc59689..b37d34beb90b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -413,7 +413,7 @@ static unsigned my_inptr; /* index of next byte to be processed in inbuf */
413 413
414static char * __init unpack_to_rootfs(char *buf, unsigned len) 414static char * __init unpack_to_rootfs(char *buf, unsigned len)
415{ 415{
416 int written; 416 int written, res;
417 decompress_fn decompress; 417 decompress_fn decompress;
418 const char *compress_name; 418 const char *compress_name;
419 static __initdata char msg_buf[64]; 419 static __initdata char msg_buf[64];
@@ -445,10 +445,12 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
445 } 445 }
446 this_header = 0; 446 this_header = 0;
447 decompress = decompress_method(buf, len, &compress_name); 447 decompress = decompress_method(buf, len, &compress_name);
448 if (decompress) 448 if (decompress) {
449 decompress(buf, len, NULL, flush_buffer, NULL, 449 res = decompress(buf, len, NULL, flush_buffer, NULL,
450 &my_inptr, error); 450 &my_inptr, error);
451 else if (compress_name) { 451 if (res)
452 error("decompressor failed");
453 } else if (compress_name) {
452 if (!message) { 454 if (!message) {
453 snprintf(msg_buf, sizeof msg_buf, 455 snprintf(msg_buf, sizeof msg_buf,
454 "compression method %s not configured", 456 "compression method %s not configured",
diff --git a/init/main.c b/init/main.c
index c3db4a98b369..dac44a9356a5 100644
--- a/init/main.c
+++ b/init/main.c
@@ -369,12 +369,6 @@ static void __init smp_init(void)
369{ 369{
370 unsigned int cpu; 370 unsigned int cpu;
371 371
372 /*
373 * Set up the current CPU as possible to migrate to.
374 * The other ones will be done by cpu_up/cpu_down()
375 */
376 set_cpu_active(smp_processor_id(), true);
377
378 /* FIXME: This should be done in userspace --RR */ 372 /* FIXME: This should be done in userspace --RR */
379 for_each_present_cpu(cpu) { 373 for_each_present_cpu(cpu) {
380 if (num_online_cpus() >= setup_max_cpus) 374 if (num_online_cpus() >= setup_max_cpus)
@@ -486,6 +480,7 @@ static void __init boot_cpu_init(void)
486 int cpu = smp_processor_id(); 480 int cpu = smp_processor_id();
487 /* Mark the boot cpu "present", "online" etc for SMP and UP case */ 481 /* Mark the boot cpu "present", "online" etc for SMP and UP case */
488 set_cpu_online(cpu, true); 482 set_cpu_online(cpu, true);
483 set_cpu_active(cpu, true);
489 set_cpu_present(cpu, true); 484 set_cpu_present(cpu, true);
490 set_cpu_possible(cpu, true); 485 set_cpu_possible(cpu, true);
491} 486}
diff --git a/init/version.c b/init/version.c
index 52a8b98642b8..adff586401a5 100644
--- a/init/version.c
+++ b/init/version.c
@@ -6,11 +6,11 @@
6 * May be freely distributed as part of Linux. 6 * May be freely distributed as part of Linux.
7 */ 7 */
8 8
9#include <linux/compile.h> 9#include <generated/compile.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/uts.h> 11#include <linux/uts.h>
12#include <linux/utsname.h> 12#include <linux/utsname.h>
13#include <linux/utsrelease.h> 13#include <generated/utsrelease.h>
14#include <linux/version.h> 14#include <linux/version.h>
15 15
16#ifndef CONFIG_KALLSYMS 16#ifndef CONFIG_KALLSYMS
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 2451dc6f3282..4b05bd9479db 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -277,7 +277,7 @@ static void untag_chunk(struct node *p)
277 owner->root = NULL; 277 owner->root = NULL;
278 } 278 }
279 279
280 for (i = j = 0; i < size; i++, j++) { 280 for (i = j = 0; j <= size; i++, j++) {
281 struct audit_tree *s; 281 struct audit_tree *s;
282 if (&chunk->owners[j] == p) { 282 if (&chunk->owners[j] == p) {
283 list_del_init(&p->list); 283 list_del_init(&p->list);
@@ -290,7 +290,7 @@ static void untag_chunk(struct node *p)
290 if (!s) /* result of earlier fallback */ 290 if (!s) /* result of earlier fallback */
291 continue; 291 continue;
292 get_tree(s); 292 get_tree(s);
293 list_replace_init(&chunk->owners[i].list, &new->owners[j].list); 293 list_replace_init(&chunk->owners[j].list, &new->owners[i].list);
294 } 294 }
295 295
296 list_replace_rcu(&chunk->hash, &new->hash); 296 list_replace_rcu(&chunk->hash, &new->hash);
@@ -373,15 +373,17 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
373 for (n = 0; n < old->count; n++) { 373 for (n = 0; n < old->count; n++) {
374 if (old->owners[n].owner == tree) { 374 if (old->owners[n].owner == tree) {
375 spin_unlock(&hash_lock); 375 spin_unlock(&hash_lock);
376 put_inotify_watch(watch); 376 put_inotify_watch(&old->watch);
377 return 0; 377 return 0;
378 } 378 }
379 } 379 }
380 spin_unlock(&hash_lock); 380 spin_unlock(&hash_lock);
381 381
382 chunk = alloc_chunk(old->count + 1); 382 chunk = alloc_chunk(old->count + 1);
383 if (!chunk) 383 if (!chunk) {
384 put_inotify_watch(&old->watch);
384 return -ENOMEM; 385 return -ENOMEM;
386 }
385 387
386 mutex_lock(&inode->inotify_mutex); 388 mutex_lock(&inode->inotify_mutex);
387 if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { 389 if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) {
@@ -425,7 +427,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
425 spin_unlock(&hash_lock); 427 spin_unlock(&hash_lock);
426 inotify_evict_watch(&old->watch); 428 inotify_evict_watch(&old->watch);
427 mutex_unlock(&inode->inotify_mutex); 429 mutex_unlock(&inode->inotify_mutex);
428 put_inotify_watch(&old->watch); 430 put_inotify_watch(&old->watch); /* pair to inotify_find_watch */
431 put_inotify_watch(&old->watch); /* and kill it */
429 return 0; 432 return 0;
430} 433}
431 434
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 267e484f0198..fc0f928167e7 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -250,7 +250,6 @@ struct audit_context {
250#endif 250#endif
251}; 251};
252 252
253#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
254static inline int open_arg(int flags, int mask) 253static inline int open_arg(int flags, int mask)
255{ 254{
256 int n = ACC_MODE(flags); 255 int n = ACC_MODE(flags);
diff --git a/kernel/bounds.c b/kernel/bounds.c
index 3c5301381837..98a51f26c136 100644
--- a/kernel/bounds.c
+++ b/kernel/bounds.c
@@ -12,7 +12,7 @@
12 12
13void foo(void) 13void foo(void)
14{ 14{
15 /* The enum constants to put into include/linux/bounds.h */ 15 /* The enum constants to put into include/generated/bounds.h */
16 DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS); 16 DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
17 DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES); 17 DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
18 /* End of constants */ 18 /* End of constants */
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 0249f4be9b5c..1fbcc748044a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2468,7 +2468,6 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
2468 /* make sure l doesn't vanish out from under us */ 2468 /* make sure l doesn't vanish out from under us */
2469 down_write(&l->mutex); 2469 down_write(&l->mutex);
2470 mutex_unlock(&cgrp->pidlist_mutex); 2470 mutex_unlock(&cgrp->pidlist_mutex);
2471 l->use_count++;
2472 return l; 2471 return l;
2473 } 2472 }
2474 } 2473 }
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 291ac586f37f..1c8ddd6ee940 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -209,6 +209,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
209 return -ENOMEM; 209 return -ENOMEM;
210 210
211 cpu_hotplug_begin(); 211 cpu_hotplug_begin();
212 set_cpu_active(cpu, false);
212 err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, 213 err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
213 hcpu, -1, &nr_calls); 214 hcpu, -1, &nr_calls);
214 if (err == NOTIFY_BAD) { 215 if (err == NOTIFY_BAD) {
@@ -280,18 +281,6 @@ int __ref cpu_down(unsigned int cpu)
280 goto out; 281 goto out;
281 } 282 }
282 283
283 set_cpu_active(cpu, false);
284
285 /*
286 * Make sure the all cpus did the reschedule and are not
287 * using stale version of the cpu_active_mask.
288 * This is not strictly necessary becuase stop_machine()
289 * that we run down the line already provides the required
290 * synchronization. But it's really a side effect and we do not
291 * want to depend on the innards of the stop_machine here.
292 */
293 synchronize_sched();
294
295 err = _cpu_down(cpu, 0); 284 err = _cpu_down(cpu, 0);
296 285
297out: 286out:
@@ -382,19 +371,12 @@ int disable_nonboot_cpus(void)
382 return error; 371 return error;
383 cpu_maps_update_begin(); 372 cpu_maps_update_begin();
384 first_cpu = cpumask_first(cpu_online_mask); 373 first_cpu = cpumask_first(cpu_online_mask);
385 /* We take down all of the non-boot CPUs in one shot to avoid races 374 /*
375 * We take down all of the non-boot CPUs in one shot to avoid races
386 * with the userspace trying to use the CPU hotplug at the same time 376 * with the userspace trying to use the CPU hotplug at the same time
387 */ 377 */
388 cpumask_clear(frozen_cpus); 378 cpumask_clear(frozen_cpus);
389 379
390 for_each_online_cpu(cpu) {
391 if (cpu == first_cpu)
392 continue;
393 set_cpu_active(cpu, false);
394 }
395
396 synchronize_sched();
397
398 printk("Disabling non-boot CPUs ...\n"); 380 printk("Disabling non-boot CPUs ...\n");
399 for_each_online_cpu(cpu) { 381 for_each_online_cpu(cpu) {
400 if (cpu == first_cpu) 382 if (cpu == first_cpu)
diff --git a/kernel/exit.c b/kernel/exit.c
index 5962d7ccf243..546774a31a66 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -68,10 +68,10 @@ static void __unhash_process(struct task_struct *p)
68 detach_pid(p, PIDTYPE_SID); 68 detach_pid(p, PIDTYPE_SID);
69 69
70 list_del_rcu(&p->tasks); 70 list_del_rcu(&p->tasks);
71 list_del_init(&p->sibling);
71 __get_cpu_var(process_counts)--; 72 __get_cpu_var(process_counts)--;
72 } 73 }
73 list_del_rcu(&p->thread_group); 74 list_del_rcu(&p->thread_group);
74 list_del_init(&p->sibling);
75} 75}
76 76
77/* 77/*
@@ -736,12 +736,9 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
736/* 736/*
737* Any that need to be release_task'd are put on the @dead list. 737* Any that need to be release_task'd are put on the @dead list.
738 */ 738 */
739static void reparent_thread(struct task_struct *father, struct task_struct *p, 739static void reparent_leader(struct task_struct *father, struct task_struct *p,
740 struct list_head *dead) 740 struct list_head *dead)
741{ 741{
742 if (p->pdeath_signal)
743 group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
744
745 list_move_tail(&p->sibling, &p->real_parent->children); 742 list_move_tail(&p->sibling, &p->real_parent->children);
746 743
747 if (task_detached(p)) 744 if (task_detached(p))
@@ -780,12 +777,18 @@ static void forget_original_parent(struct task_struct *father)
780 reaper = find_new_reaper(father); 777 reaper = find_new_reaper(father);
781 778
782 list_for_each_entry_safe(p, n, &father->children, sibling) { 779 list_for_each_entry_safe(p, n, &father->children, sibling) {
783 p->real_parent = reaper; 780 struct task_struct *t = p;
784 if (p->parent == father) { 781 do {
785 BUG_ON(task_ptrace(p)); 782 t->real_parent = reaper;
786 p->parent = p->real_parent; 783 if (t->parent == father) {
787 } 784 BUG_ON(task_ptrace(t));
788 reparent_thread(father, p, &dead_children); 785 t->parent = t->real_parent;
786 }
787 if (t->pdeath_signal)
788 group_send_sig_info(t->pdeath_signal,
789 SEND_SIG_NOINFO, t);
790 } while_each_thread(p, t);
791 reparent_leader(father, p, &dead_children);
789 } 792 }
790 write_unlock_irq(&tasklist_lock); 793 write_unlock_irq(&tasklist_lock);
791 794
@@ -1551,14 +1554,9 @@ static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk)
1551 struct task_struct *p; 1554 struct task_struct *p;
1552 1555
1553 list_for_each_entry(p, &tsk->children, sibling) { 1556 list_for_each_entry(p, &tsk->children, sibling) {
1554 /* 1557 int ret = wait_consider_task(wo, 0, p);
1555 * Do not consider detached threads. 1558 if (ret)
1556 */ 1559 return ret;
1557 if (!task_detached(p)) {
1558 int ret = wait_consider_task(wo, 0, p);
1559 if (ret)
1560 return ret;
1561 }
1562 } 1560 }
1563 1561
1564 return 0; 1562 return 0;
diff --git a/kernel/fork.c b/kernel/fork.c
index 202a0ba63d3c..5b2959b3ffc2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1291,7 +1291,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1291 } 1291 }
1292 1292
1293 if (likely(p->pid)) { 1293 if (likely(p->pid)) {
1294 list_add_tail(&p->sibling, &p->real_parent->children);
1295 tracehook_finish_clone(p, clone_flags, trace); 1294 tracehook_finish_clone(p, clone_flags, trace);
1296 1295
1297 if (thread_group_leader(p)) { 1296 if (thread_group_leader(p)) {
@@ -1303,6 +1302,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1303 p->signal->tty = tty_kref_get(current->signal->tty); 1302 p->signal->tty = tty_kref_get(current->signal->tty);
1304 attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); 1303 attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
1305 attach_pid(p, PIDTYPE_SID, task_session(current)); 1304 attach_pid(p, PIDTYPE_SID, task_session(current));
1305 list_add_tail(&p->sibling, &p->real_parent->children);
1306 list_add_tail_rcu(&p->tasks, &init_task.tasks); 1306 list_add_tail_rcu(&p->tasks, &init_task.tasks);
1307 __get_cpu_var(process_counts)++; 1307 __get_cpu_var(process_counts)++;
1308 } 1308 }
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index dbcbf6a33a08..50dbd5999588 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -40,6 +40,7 @@
40#include <linux/percpu.h> 40#include <linux/percpu.h>
41#include <linux/sched.h> 41#include <linux/sched.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/cpu.h>
43#include <linux/smp.h> 44#include <linux/smp.h>
44 45
45#include <linux/hw_breakpoint.h> 46#include <linux/hw_breakpoint.h>
@@ -388,7 +389,8 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
388 if (!cpu_events) 389 if (!cpu_events)
389 return ERR_PTR(-ENOMEM); 390 return ERR_PTR(-ENOMEM);
390 391
391 for_each_possible_cpu(cpu) { 392 get_online_cpus();
393 for_each_online_cpu(cpu) {
392 pevent = per_cpu_ptr(cpu_events, cpu); 394 pevent = per_cpu_ptr(cpu_events, cpu);
393 bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered); 395 bp = perf_event_create_kernel_counter(attr, cpu, -1, triggered);
394 396
@@ -399,18 +401,20 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
399 goto fail; 401 goto fail;
400 } 402 }
401 } 403 }
404 put_online_cpus();
402 405
403 return cpu_events; 406 return cpu_events;
404 407
405fail: 408fail:
406 for_each_possible_cpu(cpu) { 409 for_each_online_cpu(cpu) {
407 pevent = per_cpu_ptr(cpu_events, cpu); 410 pevent = per_cpu_ptr(cpu_events, cpu);
408 if (IS_ERR(*pevent)) 411 if (IS_ERR(*pevent))
409 break; 412 break;
410 unregister_hw_breakpoint(*pevent); 413 unregister_hw_breakpoint(*pevent);
411 } 414 }
415 put_online_cpus();
416
412 free_percpu(cpu_events); 417 free_percpu(cpu_events);
413 /* return the error if any */
414 return ERR_PTR(err); 418 return ERR_PTR(err);
415} 419}
416EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint); 420EXPORT_SYMBOL_GPL(register_wide_hw_breakpoint);
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 433e9fcc1fc5..a9a93d9ee7a7 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -21,7 +21,7 @@
21#include <linux/hardirq.h> 21#include <linux/hardirq.h>
22#include <linux/elf.h> 22#include <linux/elf.h>
23#include <linux/elfcore.h> 23#include <linux/elfcore.h>
24#include <linux/utsrelease.h> 24#include <generated/utsrelease.h>
25#include <linux/utsname.h> 25#include <linux/utsname.h>
26#include <linux/numa.h> 26#include <linux/numa.h>
27#include <linux/suspend.h> 27#include <linux/suspend.h>
diff --git a/kernel/kfifo.c b/kernel/kfifo.c
index 3765ff3c1bbe..e92d519f93b1 100644
--- a/kernel/kfifo.c
+++ b/kernel/kfifo.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * A simple kernel FIFO implementation. 2 * A generic kernel FIFO implementation.
3 * 3 *
4 * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net>
4 * Copyright (C) 2004 Stelian Pop <stelian@popies.net> 5 * Copyright (C) 2004 Stelian Pop <stelian@popies.net>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -25,50 +26,48 @@
25#include <linux/err.h> 26#include <linux/err.h>
26#include <linux/kfifo.h> 27#include <linux/kfifo.h>
27#include <linux/log2.h> 28#include <linux/log2.h>
29#include <linux/uaccess.h>
30
31static void _kfifo_init(struct kfifo *fifo, unsigned char *buffer,
32 unsigned int size)
33{
34 fifo->buffer = buffer;
35 fifo->size = size;
36
37 kfifo_reset(fifo);
38}
28 39
29/** 40/**
30 * kfifo_init - allocates a new FIFO using a preallocated buffer 41 * kfifo_init - initialize a FIFO using a preallocated buffer
42 * @fifo: the fifo to assign the buffer
31 * @buffer: the preallocated buffer to be used. 43 * @buffer: the preallocated buffer to be used.
32 * @size: the size of the internal buffer, this have to be a power of 2. 44 * @size: the size of the internal buffer, this have to be a power of 2.
33 * @gfp_mask: get_free_pages mask, passed to kmalloc()
34 * @lock: the lock to be used to protect the fifo buffer
35 * 45 *
36 * Do NOT pass the kfifo to kfifo_free() after use! Simply free the
37 * &struct kfifo with kfree().
38 */ 46 */
39struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, 47void kfifo_init(struct kfifo *fifo, unsigned char *buffer, unsigned int size)
40 gfp_t gfp_mask, spinlock_t *lock)
41{ 48{
42 struct kfifo *fifo;
43
44 /* size must be a power of 2 */ 49 /* size must be a power of 2 */
45 BUG_ON(!is_power_of_2(size)); 50 BUG_ON(!is_power_of_2(size));
46 51
47 fifo = kmalloc(sizeof(struct kfifo), gfp_mask); 52 _kfifo_init(fifo, buffer, size);
48 if (!fifo)
49 return ERR_PTR(-ENOMEM);
50
51 fifo->buffer = buffer;
52 fifo->size = size;
53 fifo->in = fifo->out = 0;
54 fifo->lock = lock;
55
56 return fifo;
57} 53}
58EXPORT_SYMBOL(kfifo_init); 54EXPORT_SYMBOL(kfifo_init);
59 55
60/** 56/**
61 * kfifo_alloc - allocates a new FIFO and its internal buffer 57 * kfifo_alloc - allocates a new FIFO internal buffer
62 * @size: the size of the internal buffer to be allocated. 58 * @fifo: the fifo to assign then new buffer
59 * @size: the size of the buffer to be allocated, this have to be a power of 2.
63 * @gfp_mask: get_free_pages mask, passed to kmalloc() 60 * @gfp_mask: get_free_pages mask, passed to kmalloc()
64 * @lock: the lock to be used to protect the fifo buffer 61 *
62 * This function dynamically allocates a new fifo internal buffer
65 * 63 *
66 * The size will be rounded-up to a power of 2. 64 * The size will be rounded-up to a power of 2.
65 * The buffer will be release with kfifo_free().
66 * Return 0 if no error, otherwise the an error code
67 */ 67 */
68struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock) 68int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask)
69{ 69{
70 unsigned char *buffer; 70 unsigned char *buffer;
71 struct kfifo *ret;
72 71
73 /* 72 /*
74 * round up to the next power of 2, since our 'let the indices 73 * round up to the next power of 2, since our 'let the indices
@@ -80,48 +79,91 @@ struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock)
80 } 79 }
81 80
82 buffer = kmalloc(size, gfp_mask); 81 buffer = kmalloc(size, gfp_mask);
83 if (!buffer) 82 if (!buffer) {
84 return ERR_PTR(-ENOMEM); 83 _kfifo_init(fifo, 0, 0);
85 84 return -ENOMEM;
86 ret = kfifo_init(buffer, size, gfp_mask, lock); 85 }
87 86
88 if (IS_ERR(ret)) 87 _kfifo_init(fifo, buffer, size);
89 kfree(buffer);
90 88
91 return ret; 89 return 0;
92} 90}
93EXPORT_SYMBOL(kfifo_alloc); 91EXPORT_SYMBOL(kfifo_alloc);
94 92
95/** 93/**
96 * kfifo_free - frees the FIFO 94 * kfifo_free - frees the FIFO internal buffer
97 * @fifo: the fifo to be freed. 95 * @fifo: the fifo to be freed.
98 */ 96 */
99void kfifo_free(struct kfifo *fifo) 97void kfifo_free(struct kfifo *fifo)
100{ 98{
101 kfree(fifo->buffer); 99 kfree(fifo->buffer);
102 kfree(fifo);
103} 100}
104EXPORT_SYMBOL(kfifo_free); 101EXPORT_SYMBOL(kfifo_free);
105 102
106/** 103/**
107 * __kfifo_put - puts some data into the FIFO, no locking version 104 * kfifo_skip - skip output data
108 * @fifo: the fifo to be used. 105 * @fifo: the fifo to be used.
109 * @buffer: the data to be added. 106 * @len: number of bytes to skip
110 * @len: the length of the data to be added.
111 *
112 * This function copies at most @len bytes from the @buffer into
113 * the FIFO depending on the free space, and returns the number of
114 * bytes copied.
115 *
116 * Note that with only one concurrent reader and one concurrent
117 * writer, you don't need extra locking to use these functions.
118 */ 107 */
119unsigned int __kfifo_put(struct kfifo *fifo, 108void kfifo_skip(struct kfifo *fifo, unsigned int len)
120 const unsigned char *buffer, unsigned int len) 109{
110 if (len < kfifo_len(fifo)) {
111 __kfifo_add_out(fifo, len);
112 return;
113 }
114 kfifo_reset_out(fifo);
115}
116EXPORT_SYMBOL(kfifo_skip);
117
118static inline void __kfifo_in_data(struct kfifo *fifo,
119 const void *from, unsigned int len, unsigned int off)
121{ 120{
122 unsigned int l; 121 unsigned int l;
123 122
124 len = min(len, fifo->size - fifo->in + fifo->out); 123 /*
124 * Ensure that we sample the fifo->out index -before- we
125 * start putting bytes into the kfifo.
126 */
127
128 smp_mb();
129
130 off = __kfifo_off(fifo, fifo->in + off);
131
132 /* first put the data starting from fifo->in to buffer end */
133 l = min(len, fifo->size - off);
134 memcpy(fifo->buffer + off, from, l);
135
136 /* then put the rest (if any) at the beginning of the buffer */
137 memcpy(fifo->buffer, from + l, len - l);
138}
139
140static inline void __kfifo_out_data(struct kfifo *fifo,
141 void *to, unsigned int len, unsigned int off)
142{
143 unsigned int l;
144
145 /*
146 * Ensure that we sample the fifo->in index -before- we
147 * start removing bytes from the kfifo.
148 */
149
150 smp_rmb();
151
152 off = __kfifo_off(fifo, fifo->out + off);
153
154 /* first get the data from fifo->out until the end of the buffer */
155 l = min(len, fifo->size - off);
156 memcpy(to, fifo->buffer + off, l);
157
158 /* then get the rest (if any) from the beginning of the buffer */
159 memcpy(to + l, fifo->buffer, len - l);
160}
161
162static inline unsigned int __kfifo_from_user_data(struct kfifo *fifo,
163 const void __user *from, unsigned int len, unsigned int off)
164{
165 unsigned int l;
166 int ret;
125 167
126 /* 168 /*
127 * Ensure that we sample the fifo->out index -before- we 169 * Ensure that we sample the fifo->out index -before- we
@@ -130,68 +172,229 @@ unsigned int __kfifo_put(struct kfifo *fifo,
130 172
131 smp_mb(); 173 smp_mb();
132 174
175 off = __kfifo_off(fifo, fifo->in + off);
176
133 /* first put the data starting from fifo->in to buffer end */ 177 /* first put the data starting from fifo->in to buffer end */
134 l = min(len, fifo->size - (fifo->in & (fifo->size - 1))); 178 l = min(len, fifo->size - off);
135 memcpy(fifo->buffer + (fifo->in & (fifo->size - 1)), buffer, l); 179 ret = copy_from_user(fifo->buffer + off, from, l);
180
181 if (unlikely(ret))
182 return ret + len - l;
136 183
137 /* then put the rest (if any) at the beginning of the buffer */ 184 /* then put the rest (if any) at the beginning of the buffer */
138 memcpy(fifo->buffer, buffer + l, len - l); 185 return copy_from_user(fifo->buffer, from + l, len - l);
186}
187
188static inline unsigned int __kfifo_to_user_data(struct kfifo *fifo,
189 void __user *to, unsigned int len, unsigned int off)
190{
191 unsigned int l;
192 int ret;
139 193
140 /* 194 /*
141 * Ensure that we add the bytes to the kfifo -before- 195 * Ensure that we sample the fifo->in index -before- we
142 * we update the fifo->in index. 196 * start removing bytes from the kfifo.
143 */ 197 */
144 198
145 smp_wmb(); 199 smp_rmb();
200
201 off = __kfifo_off(fifo, fifo->out + off);
202
203 /* first get the data from fifo->out until the end of the buffer */
204 l = min(len, fifo->size - off);
205 ret = copy_to_user(to, fifo->buffer + off, l);
206
207 if (unlikely(ret))
208 return ret + len - l;
209
210 /* then get the rest (if any) from the beginning of the buffer */
211 return copy_to_user(to + l, fifo->buffer, len - l);
212}
213
214unsigned int __kfifo_in_n(struct kfifo *fifo,
215 const void *from, unsigned int len, unsigned int recsize)
216{
217 if (kfifo_avail(fifo) < len + recsize)
218 return len + 1;
219
220 __kfifo_in_data(fifo, from, len, recsize);
221 return 0;
222}
223EXPORT_SYMBOL(__kfifo_in_n);
146 224
147 fifo->in += len; 225/**
226 * kfifo_in - puts some data into the FIFO
227 * @fifo: the fifo to be used.
228 * @from: the data to be added.
229 * @len: the length of the data to be added.
230 *
231 * This function copies at most @len bytes from the @from buffer into
232 * the FIFO depending on the free space, and returns the number of
233 * bytes copied.
234 *
235 * Note that with only one concurrent reader and one concurrent
236 * writer, you don't need extra locking to use these functions.
237 */
238unsigned int kfifo_in(struct kfifo *fifo, const unsigned char *from,
239 unsigned int len)
240{
241 len = min(kfifo_avail(fifo), len);
148 242
243 __kfifo_in_data(fifo, from, len, 0);
244 __kfifo_add_in(fifo, len);
149 return len; 245 return len;
150} 246}
151EXPORT_SYMBOL(__kfifo_put); 247EXPORT_SYMBOL(kfifo_in);
248
249unsigned int __kfifo_in_generic(struct kfifo *fifo,
250 const void *from, unsigned int len, unsigned int recsize)
251{
252 return __kfifo_in_rec(fifo, from, len, recsize);
253}
254EXPORT_SYMBOL(__kfifo_in_generic);
255
256unsigned int __kfifo_out_n(struct kfifo *fifo,
257 void *to, unsigned int len, unsigned int recsize)
258{
259 if (kfifo_len(fifo) < len + recsize)
260 return len;
261
262 __kfifo_out_data(fifo, to, len, recsize);
263 __kfifo_add_out(fifo, len + recsize);
264 return 0;
265}
266EXPORT_SYMBOL(__kfifo_out_n);
152 267
153/** 268/**
154 * __kfifo_get - gets some data from the FIFO, no locking version 269 * kfifo_out - gets some data from the FIFO
155 * @fifo: the fifo to be used. 270 * @fifo: the fifo to be used.
156 * @buffer: where the data must be copied. 271 * @to: where the data must be copied.
157 * @len: the size of the destination buffer. 272 * @len: the size of the destination buffer.
158 * 273 *
159 * This function copies at most @len bytes from the FIFO into the 274 * This function copies at most @len bytes from the FIFO into the
160 * @buffer and returns the number of copied bytes. 275 * @to buffer and returns the number of copied bytes.
161 * 276 *
162 * Note that with only one concurrent reader and one concurrent 277 * Note that with only one concurrent reader and one concurrent
163 * writer, you don't need extra locking to use these functions. 278 * writer, you don't need extra locking to use these functions.
164 */ 279 */
165unsigned int __kfifo_get(struct kfifo *fifo, 280unsigned int kfifo_out(struct kfifo *fifo, unsigned char *to, unsigned int len)
166 unsigned char *buffer, unsigned int len)
167{ 281{
168 unsigned int l; 282 len = min(kfifo_len(fifo), len);
169 283
170 len = min(len, fifo->in - fifo->out); 284 __kfifo_out_data(fifo, to, len, 0);
285 __kfifo_add_out(fifo, len);
171 286
172 /* 287 return len;
173 * Ensure that we sample the fifo->in index -before- we 288}
174 * start removing bytes from the kfifo. 289EXPORT_SYMBOL(kfifo_out);
175 */
176 290
177 smp_rmb(); 291unsigned int __kfifo_out_generic(struct kfifo *fifo,
292 void *to, unsigned int len, unsigned int recsize,
293 unsigned int *total)
294{
295 return __kfifo_out_rec(fifo, to, len, recsize, total);
296}
297EXPORT_SYMBOL(__kfifo_out_generic);
178 298
179 /* first get the data from fifo->out until the end of the buffer */ 299unsigned int __kfifo_from_user_n(struct kfifo *fifo,
180 l = min(len, fifo->size - (fifo->out & (fifo->size - 1))); 300 const void __user *from, unsigned int len, unsigned int recsize)
181 memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)), l); 301{
302 if (kfifo_avail(fifo) < len + recsize)
303 return len + 1;
182 304
183 /* then get the rest (if any) from the beginning of the buffer */ 305 return __kfifo_from_user_data(fifo, from, len, recsize);
184 memcpy(buffer + l, fifo->buffer, len - l); 306}
307EXPORT_SYMBOL(__kfifo_from_user_n);
185 308
186 /* 309/**
187 * Ensure that we remove the bytes from the kfifo -before- 310 * kfifo_from_user - puts some data from user space into the FIFO
188 * we update the fifo->out index. 311 * @fifo: the fifo to be used.
189 */ 312 * @from: pointer to the data to be added.
313 * @len: the length of the data to be added.
314 *
315 * This function copies at most @len bytes from the @from into the
316 * FIFO depending and returns the number of copied bytes.
317 *
318 * Note that with only one concurrent reader and one concurrent
319 * writer, you don't need extra locking to use these functions.
320 */
321unsigned int kfifo_from_user(struct kfifo *fifo,
322 const void __user *from, unsigned int len)
323{
324 len = min(kfifo_avail(fifo), len);
325 len -= __kfifo_from_user_data(fifo, from, len, 0);
326 __kfifo_add_in(fifo, len);
327 return len;
328}
329EXPORT_SYMBOL(kfifo_from_user);
190 330
191 smp_mb(); 331unsigned int __kfifo_from_user_generic(struct kfifo *fifo,
332 const void __user *from, unsigned int len, unsigned int recsize)
333{
334 return __kfifo_from_user_rec(fifo, from, len, recsize);
335}
336EXPORT_SYMBOL(__kfifo_from_user_generic);
192 337
193 fifo->out += len; 338unsigned int __kfifo_to_user_n(struct kfifo *fifo,
339 void __user *to, unsigned int len, unsigned int reclen,
340 unsigned int recsize)
341{
342 unsigned int ret;
343
344 if (kfifo_len(fifo) < reclen + recsize)
345 return len;
346
347 ret = __kfifo_to_user_data(fifo, to, reclen, recsize);
194 348
349 if (likely(ret == 0))
350 __kfifo_add_out(fifo, reclen + recsize);
351
352 return ret;
353}
354EXPORT_SYMBOL(__kfifo_to_user_n);
355
356/**
357 * kfifo_to_user - gets data from the FIFO and write it to user space
358 * @fifo: the fifo to be used.
359 * @to: where the data must be copied.
360 * @len: the size of the destination buffer.
361 *
362 * This function copies at most @len bytes from the FIFO into the
363 * @to buffer and returns the number of copied bytes.
364 *
365 * Note that with only one concurrent reader and one concurrent
366 * writer, you don't need extra locking to use these functions.
367 */
368unsigned int kfifo_to_user(struct kfifo *fifo,
369 void __user *to, unsigned int len)
370{
371 len = min(kfifo_len(fifo), len);
372 len -= __kfifo_to_user_data(fifo, to, len, 0);
373 __kfifo_add_out(fifo, len);
195 return len; 374 return len;
196} 375}
197EXPORT_SYMBOL(__kfifo_get); 376EXPORT_SYMBOL(kfifo_to_user);
377
378unsigned int __kfifo_to_user_generic(struct kfifo *fifo,
379 void __user *to, unsigned int len, unsigned int recsize,
380 unsigned int *total)
381{
382 return __kfifo_to_user_rec(fifo, to, len, recsize, total);
383}
384EXPORT_SYMBOL(__kfifo_to_user_generic);
385
386unsigned int __kfifo_peek_generic(struct kfifo *fifo, unsigned int recsize)
387{
388 if (recsize == 0)
389 return kfifo_avail(fifo);
390
391 return __kfifo_peek_n(fifo, recsize);
392}
393EXPORT_SYMBOL(__kfifo_peek_generic);
394
395void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize)
396{
397 __kfifo_skip_rec(fifo, recsize);
398}
399EXPORT_SYMBOL(__kfifo_skip_generic);
400
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 25b103190364..bf0e231d9702 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -520,13 +520,15 @@ int call_usermodehelper_pipe(char *path, char **argv, char **envp,
520 return -ENOMEM; 520 return -ENOMEM;
521 521
522 ret = call_usermodehelper_stdinpipe(sub_info, filp); 522 ret = call_usermodehelper_stdinpipe(sub_info, filp);
523 if (ret < 0) 523 if (ret < 0) {
524 goto out; 524 call_usermodehelper_freeinfo(sub_info);
525 return ret;
526 }
525 527
526 return call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC); 528 ret = call_usermodehelper_exec(sub_info, UMH_WAIT_EXEC);
529 if (ret < 0) /* Failed to execute helper, close pipe */
530 filp_close(*filp, NULL);
527 531
528 out:
529 call_usermodehelper_freeinfo(sub_info);
530 return ret; 532 return ret;
531} 533}
532EXPORT_SYMBOL(call_usermodehelper_pipe); 534EXPORT_SYMBOL(call_usermodehelper_pipe);
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index e5342a344c43..b7df302a0204 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1035,7 +1035,7 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
1035 /* Pre-allocate memory for max kretprobe instances */ 1035 /* Pre-allocate memory for max kretprobe instances */
1036 if (rp->maxactive <= 0) { 1036 if (rp->maxactive <= 0) {
1037#ifdef CONFIG_PREEMPT 1037#ifdef CONFIG_PREEMPT
1038 rp->maxactive = max(10, 2 * num_possible_cpus()); 1038 rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus());
1039#else 1039#else
1040 rp->maxactive = num_possible_cpus(); 1040 rp->maxactive = num_possible_cpus();
1041#endif 1041#endif
diff --git a/kernel/kthread.c b/kernel/kthread.c
index ab7ae57773e1..fbb6222fe7e0 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -150,6 +150,29 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
150EXPORT_SYMBOL(kthread_create); 150EXPORT_SYMBOL(kthread_create);
151 151
152/** 152/**
153 * kthread_bind - bind a just-created kthread to a cpu.
154 * @p: thread created by kthread_create().
155 * @cpu: cpu (might not be online, must be possible) for @k to run on.
156 *
157 * Description: This function is equivalent to set_cpus_allowed(),
158 * except that @cpu doesn't need to be online, and the thread must be
159 * stopped (i.e., just returned from kthread_create()).
160 */
161void kthread_bind(struct task_struct *p, unsigned int cpu)
162{
163 /* Must have done schedule() in kthread() before we set_task_cpu */
164 if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) {
165 WARN_ON(1);
166 return;
167 }
168
169 p->cpus_allowed = cpumask_of_cpu(cpu);
170 p->rt.nr_cpus_allowed = 1;
171 p->flags |= PF_THREAD_BOUND;
172}
173EXPORT_SYMBOL(kthread_bind);
174
175/**
153 * kthread_stop - stop a thread created by kthread_create(). 176 * kthread_stop - stop a thread created by kthread_create().
154 * @k: thread created by kthread_create(). 177 * @k: thread created by kthread_create().
155 * 178 *
diff --git a/kernel/module.c b/kernel/module.c
index a65dc787a27b..f82386bd9ee9 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1010,6 +1010,12 @@ static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs,
1010 * J. Corbet <corbet@lwn.net> 1010 * J. Corbet <corbet@lwn.net>
1011 */ 1011 */
1012#if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS) 1012#if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS)
1013
1014static inline bool sect_empty(const Elf_Shdr *sect)
1015{
1016 return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
1017}
1018
1013struct module_sect_attr 1019struct module_sect_attr
1014{ 1020{
1015 struct module_attribute mattr; 1021 struct module_attribute mattr;
@@ -1051,8 +1057,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
1051 1057
1052 /* Count loaded sections and allocate structures */ 1058 /* Count loaded sections and allocate structures */
1053 for (i = 0; i < nsect; i++) 1059 for (i = 0; i < nsect; i++)
1054 if (sechdrs[i].sh_flags & SHF_ALLOC 1060 if (!sect_empty(&sechdrs[i]))
1055 && sechdrs[i].sh_size)
1056 nloaded++; 1061 nloaded++;
1057 size[0] = ALIGN(sizeof(*sect_attrs) 1062 size[0] = ALIGN(sizeof(*sect_attrs)
1058 + nloaded * sizeof(sect_attrs->attrs[0]), 1063 + nloaded * sizeof(sect_attrs->attrs[0]),
@@ -1070,9 +1075,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
1070 sattr = &sect_attrs->attrs[0]; 1075 sattr = &sect_attrs->attrs[0];
1071 gattr = &sect_attrs->grp.attrs[0]; 1076 gattr = &sect_attrs->grp.attrs[0];
1072 for (i = 0; i < nsect; i++) { 1077 for (i = 0; i < nsect; i++) {
1073 if (! (sechdrs[i].sh_flags & SHF_ALLOC)) 1078 if (sect_empty(&sechdrs[i]))
1074 continue;
1075 if (!sechdrs[i].sh_size)
1076 continue; 1079 continue;
1077 sattr->address = sechdrs[i].sh_addr; 1080 sattr->address = sechdrs[i].sh_addr;
1078 sattr->name = kstrdup(secstrings + sechdrs[i].sh_name, 1081 sattr->name = kstrdup(secstrings + sechdrs[i].sh_name,
@@ -1156,7 +1159,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect,
1156 /* Count notes sections and allocate structures. */ 1159 /* Count notes sections and allocate structures. */
1157 notes = 0; 1160 notes = 0;
1158 for (i = 0; i < nsect; i++) 1161 for (i = 0; i < nsect; i++)
1159 if ((sechdrs[i].sh_flags & SHF_ALLOC) && 1162 if (!sect_empty(&sechdrs[i]) &&
1160 (sechdrs[i].sh_type == SHT_NOTE)) 1163 (sechdrs[i].sh_type == SHT_NOTE))
1161 ++notes; 1164 ++notes;
1162 1165
@@ -1172,7 +1175,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect,
1172 notes_attrs->notes = notes; 1175 notes_attrs->notes = notes;
1173 nattr = &notes_attrs->attrs[0]; 1176 nattr = &notes_attrs->attrs[0];
1174 for (loaded = i = 0; i < nsect; ++i) { 1177 for (loaded = i = 0; i < nsect; ++i) {
1175 if (!(sechdrs[i].sh_flags & SHF_ALLOC)) 1178 if (sect_empty(&sechdrs[i]))
1176 continue; 1179 continue;
1177 if (sechdrs[i].sh_type == SHT_NOTE) { 1180 if (sechdrs[i].sh_type == SHT_NOTE) {
1178 nattr->attr.name = mod->sect_attrs->attrs[loaded].name; 1181 nattr->attr.name = mod->sect_attrs->attrs[loaded].name;
@@ -1910,9 +1913,7 @@ static void kmemleak_load_module(struct module *mod, Elf_Ehdr *hdr,
1910 unsigned int i; 1913 unsigned int i;
1911 1914
1912 /* only scan the sections containing data */ 1915 /* only scan the sections containing data */
1913 kmemleak_scan_area(mod->module_core, (unsigned long)mod - 1916 kmemleak_scan_area(mod, sizeof(struct module), GFP_KERNEL);
1914 (unsigned long)mod->module_core,
1915 sizeof(struct module), GFP_KERNEL);
1916 1917
1917 for (i = 1; i < hdr->e_shnum; i++) { 1918 for (i = 1; i < hdr->e_shnum; i++) {
1918 if (!(sechdrs[i].sh_flags & SHF_ALLOC)) 1919 if (!(sechdrs[i].sh_flags & SHF_ALLOC))
@@ -1921,8 +1922,7 @@ static void kmemleak_load_module(struct module *mod, Elf_Ehdr *hdr,
1921 && strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) != 0) 1922 && strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) != 0)
1922 continue; 1923 continue;
1923 1924
1924 kmemleak_scan_area(mod->module_core, sechdrs[i].sh_addr - 1925 kmemleak_scan_area((void *)sechdrs[i].sh_addr,
1925 (unsigned long)mod->module_core,
1926 sechdrs[i].sh_size, GFP_KERNEL); 1926 sechdrs[i].sh_size, GFP_KERNEL);
1927 } 1927 }
1928} 1928}
@@ -2250,6 +2250,12 @@ static noinline struct module *load_module(void __user *umod,
2250 "_ftrace_events", 2250 "_ftrace_events",
2251 sizeof(*mod->trace_events), 2251 sizeof(*mod->trace_events),
2252 &mod->num_trace_events); 2252 &mod->num_trace_events);
2253 /*
2254 * This section contains pointers to allocated objects in the trace
2255 * code and not scanning it leads to false positives.
2256 */
2257 kmemleak_scan_area(mod->trace_events, sizeof(*mod->trace_events) *
2258 mod->num_trace_events, GFP_KERNEL);
2253#endif 2259#endif
2254#ifdef CONFIG_FTRACE_MCOUNT_RECORD 2260#ifdef CONFIG_FTRACE_MCOUNT_RECORD
2255 /* sechdrs[0].sh_size is always zero */ 2261 /* sechdrs[0].sh_size is always zero */
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 5b987b4a98a8..27f69a04541d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1618,7 +1618,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
1618 * offline CPU and activate it when the CPU comes up, but 1618 * offline CPU and activate it when the CPU comes up, but
1619 * that's for later. 1619 * that's for later.
1620 */ 1620 */
1621 if (!cpu_isset(cpu, cpu_online_map)) 1621 if (!cpu_online(cpu))
1622 return ERR_PTR(-ENODEV); 1622 return ERR_PTR(-ENODEV);
1623 1623
1624 cpuctx = &per_cpu(perf_cpu_context, cpu); 1624 cpuctx = &per_cpu(perf_cpu_context, cpu);
@@ -4725,7 +4725,7 @@ SYSCALL_DEFINE5(perf_event_open,
4725 if (IS_ERR(event)) 4725 if (IS_ERR(event))
4726 goto err_put_context; 4726 goto err_put_context;
4727 4727
4728 err = anon_inode_getfd("[perf_event]", &perf_fops, event, 0); 4728 err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR);
4729 if (err < 0) 4729 if (err < 0)
4730 goto err_free_put_context; 4730 goto err_free_put_context;
4731 4731
@@ -5149,7 +5149,7 @@ int perf_event_init_task(struct task_struct *child)
5149 GFP_KERNEL); 5149 GFP_KERNEL);
5150 if (!child_ctx) { 5150 if (!child_ctx) {
5151 ret = -ENOMEM; 5151 ret = -ENOMEM;
5152 goto exit; 5152 break;
5153 } 5153 }
5154 5154
5155 __perf_event_init_context(child_ctx, child); 5155 __perf_event_init_context(child_ctx, child);
@@ -5165,7 +5165,7 @@ int perf_event_init_task(struct task_struct *child)
5165 } 5165 }
5166 } 5166 }
5167 5167
5168 if (inherited_all) { 5168 if (child_ctx && inherited_all) {
5169 /* 5169 /*
5170 * Mark the child context as a clone of the parent 5170 * Mark the child context as a clone of the parent
5171 * context, or of whatever the parent is a clone of. 5171 * context, or of whatever the parent is a clone of.
@@ -5185,7 +5185,6 @@ int perf_event_init_task(struct task_struct *child)
5185 get_ctx(child_ctx->parent_ctx); 5185 get_ctx(child_ctx->parent_ctx);
5186 } 5186 }
5187 5187
5188exit:
5189 mutex_unlock(&parent_ctx->mutex); 5188 mutex_unlock(&parent_ctx->mutex);
5190 5189
5191 perf_unpin_context(parent_ctx); 5190 perf_unpin_context(parent_ctx);
diff --git a/kernel/printk.c b/kernel/printk.c
index 1ded8e7dd19b..17463ca2e229 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1412,7 +1412,7 @@ static LIST_HEAD(dump_list);
1412 1412
1413/** 1413/**
1414 * kmsg_dump_register - register a kernel log dumper. 1414 * kmsg_dump_register - register a kernel log dumper.
1415 * @dump: pointer to the kmsg_dumper structure 1415 * @dumper: pointer to the kmsg_dumper structure
1416 * 1416 *
1417 * Adds a kernel log dumper to the system. The dump callback in the 1417 * Adds a kernel log dumper to the system. The dump callback in the
1418 * structure will be called when the kernel oopses or panics and must be 1418 * structure will be called when the kernel oopses or panics and must be
@@ -1442,7 +1442,7 @@ EXPORT_SYMBOL_GPL(kmsg_dump_register);
1442 1442
1443/** 1443/**
1444 * kmsg_dump_unregister - unregister a kmsg dumper. 1444 * kmsg_dump_unregister - unregister a kmsg dumper.
1445 * @dump: pointer to the kmsg_dumper structure 1445 * @dumper: pointer to the kmsg_dumper structure
1446 * 1446 *
1447 * Removes a dump device from the system. Returns zero on success and 1447 * Removes a dump device from the system. Returns zero on success and
1448 * %-EINVAL otherwise. 1448 * %-EINVAL otherwise.
diff --git a/kernel/resource.c b/kernel/resource.c
index dc15686b7a77..af96c1e4b54b 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -308,37 +308,37 @@ static int find_resource(struct resource *root, struct resource *new,
308 void *alignf_data) 308 void *alignf_data)
309{ 309{
310 struct resource *this = root->child; 310 struct resource *this = root->child;
311 resource_size_t start, end; 311 struct resource tmp = *new;
312 312
313 start = root->start; 313 tmp.start = root->start;
314 /* 314 /*
315 * Skip past an allocated resource that starts at 0, since the assignment 315 * Skip past an allocated resource that starts at 0, since the assignment
316 * of this->start - 1 to new->end below would cause an underflow. 316 * of this->start - 1 to tmp->end below would cause an underflow.
317 */ 317 */
318 if (this && this->start == 0) { 318 if (this && this->start == 0) {
319 start = this->end + 1; 319 tmp.start = this->end + 1;
320 this = this->sibling; 320 this = this->sibling;
321 } 321 }
322 for(;;) { 322 for(;;) {
323 if (this) 323 if (this)
324 end = this->start - 1; 324 tmp.end = this->start - 1;
325 else 325 else
326 end = root->end; 326 tmp.end = root->end;
327 if (start < min) 327 if (tmp.start < min)
328 start = min; 328 tmp.start = min;
329 if (end > max) 329 if (tmp.end > max)
330 end = max; 330 tmp.end = max;
331 start = ALIGN(start, align); 331 tmp.start = ALIGN(tmp.start, align);
332 if (alignf) 332 if (alignf)
333 alignf(alignf_data, new, size, align); 333 alignf(alignf_data, &tmp, size, align);
334 if (start < end && end - start >= size - 1) { 334 if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) {
335 new->start = start; 335 new->start = tmp.start;
336 new->end = start + size - 1; 336 new->end = tmp.start + size - 1;
337 return 0; 337 return 0;
338 } 338 }
339 if (!this) 339 if (!this)
340 break; 340 break;
341 start = this->end + 1; 341 tmp.start = this->end + 1;
342 this = this->sibling; 342 this = this->sibling;
343 } 343 }
344 return -EBUSY; 344 return -EBUSY;
diff --git a/kernel/sched.c b/kernel/sched.c
index d6527ac0f6e7..e507af086b42 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2002,39 +2002,6 @@ static inline void check_class_changed(struct rq *rq, struct task_struct *p,
2002 p->sched_class->prio_changed(rq, p, oldprio, running); 2002 p->sched_class->prio_changed(rq, p, oldprio, running);
2003} 2003}
2004 2004
2005/**
2006 * kthread_bind - bind a just-created kthread to a cpu.
2007 * @p: thread created by kthread_create().
2008 * @cpu: cpu (might not be online, must be possible) for @k to run on.
2009 *
2010 * Description: This function is equivalent to set_cpus_allowed(),
2011 * except that @cpu doesn't need to be online, and the thread must be
2012 * stopped (i.e., just returned from kthread_create()).
2013 *
2014 * Function lives here instead of kthread.c because it messes with
2015 * scheduler internals which require locking.
2016 */
2017void kthread_bind(struct task_struct *p, unsigned int cpu)
2018{
2019 struct rq *rq = cpu_rq(cpu);
2020 unsigned long flags;
2021
2022 /* Must have done schedule() in kthread() before we set_task_cpu */
2023 if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE)) {
2024 WARN_ON(1);
2025 return;
2026 }
2027
2028 raw_spin_lock_irqsave(&rq->lock, flags);
2029 update_rq_clock(rq);
2030 set_task_cpu(p, cpu);
2031 p->cpus_allowed = cpumask_of_cpu(cpu);
2032 p->rt.nr_cpus_allowed = 1;
2033 p->flags |= PF_THREAD_BOUND;
2034 raw_spin_unlock_irqrestore(&rq->lock, flags);
2035}
2036EXPORT_SYMBOL(kthread_bind);
2037
2038#ifdef CONFIG_SMP 2005#ifdef CONFIG_SMP
2039/* 2006/*
2040 * Is this task likely cache-hot: 2007 * Is this task likely cache-hot:
@@ -2044,6 +2011,9 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
2044{ 2011{
2045 s64 delta; 2012 s64 delta;
2046 2013
2014 if (p->sched_class != &fair_sched_class)
2015 return 0;
2016
2047 /* 2017 /*
2048 * Buddy candidates are cache hot: 2018 * Buddy candidates are cache hot:
2049 */ 2019 */
@@ -2052,9 +2022,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
2052 &p->se == cfs_rq_of(&p->se)->last)) 2022 &p->se == cfs_rq_of(&p->se)->last))
2053 return 1; 2023 return 1;
2054 2024
2055 if (p->sched_class != &fair_sched_class)
2056 return 0;
2057
2058 if (sysctl_sched_migration_cost == -1) 2025 if (sysctl_sched_migration_cost == -1)
2059 return 1; 2026 return 1;
2060 if (sysctl_sched_migration_cost == 0) 2027 if (sysctl_sched_migration_cost == 0)
@@ -2065,22 +2032,23 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
2065 return delta < (s64)sysctl_sched_migration_cost; 2032 return delta < (s64)sysctl_sched_migration_cost;
2066} 2033}
2067 2034
2068
2069void set_task_cpu(struct task_struct *p, unsigned int new_cpu) 2035void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
2070{ 2036{
2071 int old_cpu = task_cpu(p); 2037#ifdef CONFIG_SCHED_DEBUG
2072 struct cfs_rq *old_cfsrq = task_cfs_rq(p), 2038 /*
2073 *new_cfsrq = cpu_cfs_rq(old_cfsrq, new_cpu); 2039 * We should never call set_task_cpu() on a blocked task,
2040 * ttwu() will sort out the placement.
2041 */
2042 WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING &&
2043 !(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
2044#endif
2074 2045
2075 trace_sched_migrate_task(p, new_cpu); 2046 trace_sched_migrate_task(p, new_cpu);
2076 2047
2077 if (old_cpu != new_cpu) { 2048 if (task_cpu(p) != new_cpu) {
2078 p->se.nr_migrations++; 2049 p->se.nr_migrations++;
2079 perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 2050 perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, 1, NULL, 0);
2080 1, 1, NULL, 0);
2081 } 2051 }
2082 p->se.vruntime -= old_cfsrq->min_vruntime -
2083 new_cfsrq->min_vruntime;
2084 2052
2085 __set_task_cpu(p, new_cpu); 2053 __set_task_cpu(p, new_cpu);
2086} 2054}
@@ -2105,13 +2073,10 @@ migrate_task(struct task_struct *p, int dest_cpu, struct migration_req *req)
2105 2073
2106 /* 2074 /*
2107 * If the task is not on a runqueue (and not running), then 2075 * If the task is not on a runqueue (and not running), then
2108 * it is sufficient to simply update the task's cpu field. 2076 * the next wake-up will properly place the task.
2109 */ 2077 */
2110 if (!p->se.on_rq && !task_running(rq, p)) { 2078 if (!p->se.on_rq && !task_running(rq, p))
2111 update_rq_clock(rq);
2112 set_task_cpu(p, dest_cpu);
2113 return 0; 2079 return 0;
2114 }
2115 2080
2116 init_completion(&req->done); 2081 init_completion(&req->done);
2117 req->task = p; 2082 req->task = p;
@@ -2317,10 +2282,73 @@ void task_oncpu_function_call(struct task_struct *p,
2317} 2282}
2318 2283
2319#ifdef CONFIG_SMP 2284#ifdef CONFIG_SMP
2285static int select_fallback_rq(int cpu, struct task_struct *p)
2286{
2287 int dest_cpu;
2288 const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu));
2289
2290 /* Look for allowed, online CPU in same node. */
2291 for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask)
2292 if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
2293 return dest_cpu;
2294
2295 /* Any allowed, online CPU? */
2296 dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_active_mask);
2297 if (dest_cpu < nr_cpu_ids)
2298 return dest_cpu;
2299
2300 /* No more Mr. Nice Guy. */
2301 if (dest_cpu >= nr_cpu_ids) {
2302 rcu_read_lock();
2303 cpuset_cpus_allowed_locked(p, &p->cpus_allowed);
2304 rcu_read_unlock();
2305 dest_cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed);
2306
2307 /*
2308 * Don't tell them about moving exiting tasks or
2309 * kernel threads (both mm NULL), since they never
2310 * leave kernel.
2311 */
2312 if (p->mm && printk_ratelimit()) {
2313 printk(KERN_INFO "process %d (%s) no "
2314 "longer affine to cpu%d\n",
2315 task_pid_nr(p), p->comm, cpu);
2316 }
2317 }
2318
2319 return dest_cpu;
2320}
2321
2322/*
2323 * Called from:
2324 *
2325 * - fork, @p is stable because it isn't on the tasklist yet
2326 *
2327 * - exec, @p is unstable, retry loop
2328 *
2329 * - wake-up, we serialize ->cpus_allowed against TASK_WAKING so
2330 * we should be good.
2331 */
2320static inline 2332static inline
2321int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags) 2333int select_task_rq(struct task_struct *p, int sd_flags, int wake_flags)
2322{ 2334{
2323 return p->sched_class->select_task_rq(p, sd_flags, wake_flags); 2335 int cpu = p->sched_class->select_task_rq(p, sd_flags, wake_flags);
2336
2337 /*
2338 * In order not to call set_task_cpu() on a blocking task we need
2339 * to rely on ttwu() to place the task on a valid ->cpus_allowed
2340 * cpu.
2341 *
2342 * Since this is common to all placement strategies, this lives here.
2343 *
2344 * [ this allows ->select_task() to simply return task_cpu(p) and
2345 * not worry about this generic constraint ]
2346 */
2347 if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
2348 !cpu_online(cpu)))
2349 cpu = select_fallback_rq(task_cpu(p), p);
2350
2351 return cpu;
2324} 2352}
2325#endif 2353#endif
2326 2354
@@ -2375,6 +2403,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
2375 if (task_contributes_to_load(p)) 2403 if (task_contributes_to_load(p))
2376 rq->nr_uninterruptible--; 2404 rq->nr_uninterruptible--;
2377 p->state = TASK_WAKING; 2405 p->state = TASK_WAKING;
2406
2407 if (p->sched_class->task_waking)
2408 p->sched_class->task_waking(rq, p);
2409
2378 __task_rq_unlock(rq); 2410 __task_rq_unlock(rq);
2379 2411
2380 cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags); 2412 cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
@@ -2438,8 +2470,8 @@ out_running:
2438 2470
2439 p->state = TASK_RUNNING; 2471 p->state = TASK_RUNNING;
2440#ifdef CONFIG_SMP 2472#ifdef CONFIG_SMP
2441 if (p->sched_class->task_wake_up) 2473 if (p->sched_class->task_woken)
2442 p->sched_class->task_wake_up(rq, p); 2474 p->sched_class->task_woken(rq, p);
2443 2475
2444 if (unlikely(rq->idle_stamp)) { 2476 if (unlikely(rq->idle_stamp)) {
2445 u64 delta = rq->clock - rq->idle_stamp; 2477 u64 delta = rq->clock - rq->idle_stamp;
@@ -2538,14 +2570,6 @@ static void __sched_fork(struct task_struct *p)
2538#ifdef CONFIG_PREEMPT_NOTIFIERS 2570#ifdef CONFIG_PREEMPT_NOTIFIERS
2539 INIT_HLIST_HEAD(&p->preempt_notifiers); 2571 INIT_HLIST_HEAD(&p->preempt_notifiers);
2540#endif 2572#endif
2541
2542 /*
2543 * We mark the process as running here, but have not actually
2544 * inserted it onto the runqueue yet. This guarantees that
2545 * nobody will actually run it, and a signal or other external
2546 * event cannot wake it up and insert it on the runqueue either.
2547 */
2548 p->state = TASK_RUNNING;
2549} 2573}
2550 2574
2551/* 2575/*
@@ -2556,6 +2580,12 @@ void sched_fork(struct task_struct *p, int clone_flags)
2556 int cpu = get_cpu(); 2580 int cpu = get_cpu();
2557 2581
2558 __sched_fork(p); 2582 __sched_fork(p);
2583 /*
2584 * We mark the process as waking here. This guarantees that
2585 * nobody will actually run it, and a signal or other external
2586 * event cannot wake it up and insert it on the runqueue either.
2587 */
2588 p->state = TASK_WAKING;
2559 2589
2560 /* 2590 /*
2561 * Revert to default priority/policy on fork if requested. 2591 * Revert to default priority/policy on fork if requested.
@@ -2624,14 +2654,15 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
2624 struct rq *rq; 2654 struct rq *rq;
2625 2655
2626 rq = task_rq_lock(p, &flags); 2656 rq = task_rq_lock(p, &flags);
2627 BUG_ON(p->state != TASK_RUNNING); 2657 BUG_ON(p->state != TASK_WAKING);
2658 p->state = TASK_RUNNING;
2628 update_rq_clock(rq); 2659 update_rq_clock(rq);
2629 activate_task(rq, p, 0); 2660 activate_task(rq, p, 0);
2630 trace_sched_wakeup_new(rq, p, 1); 2661 trace_sched_wakeup_new(rq, p, 1);
2631 check_preempt_curr(rq, p, WF_FORK); 2662 check_preempt_curr(rq, p, WF_FORK);
2632#ifdef CONFIG_SMP 2663#ifdef CONFIG_SMP
2633 if (p->sched_class->task_wake_up) 2664 if (p->sched_class->task_woken)
2634 p->sched_class->task_wake_up(rq, p); 2665 p->sched_class->task_woken(rq, p);
2635#endif 2666#endif
2636 task_rq_unlock(rq, &flags); 2667 task_rq_unlock(rq, &flags);
2637} 2668}
@@ -3101,21 +3132,36 @@ static void double_rq_unlock(struct rq *rq1, struct rq *rq2)
3101} 3132}
3102 3133
3103/* 3134/*
3104 * If dest_cpu is allowed for this process, migrate the task to it. 3135 * sched_exec - execve() is a valuable balancing opportunity, because at
3105 * This is accomplished by forcing the cpu_allowed mask to only 3136 * this point the task has the smallest effective memory and cache footprint.
3106 * allow dest_cpu, which will force the cpu onto dest_cpu. Then
3107 * the cpu_allowed mask is restored.
3108 */ 3137 */
3109static void sched_migrate_task(struct task_struct *p, int dest_cpu) 3138void sched_exec(void)
3110{ 3139{
3140 struct task_struct *p = current;
3111 struct migration_req req; 3141 struct migration_req req;
3142 int dest_cpu, this_cpu;
3112 unsigned long flags; 3143 unsigned long flags;
3113 struct rq *rq; 3144 struct rq *rq;
3114 3145
3146again:
3147 this_cpu = get_cpu();
3148 dest_cpu = select_task_rq(p, SD_BALANCE_EXEC, 0);
3149 if (dest_cpu == this_cpu) {
3150 put_cpu();
3151 return;
3152 }
3153
3115 rq = task_rq_lock(p, &flags); 3154 rq = task_rq_lock(p, &flags);
3155 put_cpu();
3156
3157 /*
3158 * select_task_rq() can race against ->cpus_allowed
3159 */
3116 if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed) 3160 if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed)
3117 || unlikely(!cpu_active(dest_cpu))) 3161 || unlikely(!cpu_active(dest_cpu))) {
3118 goto out; 3162 task_rq_unlock(rq, &flags);
3163 goto again;
3164 }
3119 3165
3120 /* force the process onto the specified CPU */ 3166 /* force the process onto the specified CPU */
3121 if (migrate_task(p, dest_cpu, &req)) { 3167 if (migrate_task(p, dest_cpu, &req)) {
@@ -3130,24 +3176,10 @@ static void sched_migrate_task(struct task_struct *p, int dest_cpu)
3130 3176
3131 return; 3177 return;
3132 } 3178 }
3133out:
3134 task_rq_unlock(rq, &flags); 3179 task_rq_unlock(rq, &flags);
3135} 3180}
3136 3181
3137/* 3182/*
3138 * sched_exec - execve() is a valuable balancing opportunity, because at
3139 * this point the task has the smallest effective memory and cache footprint.
3140 */
3141void sched_exec(void)
3142{
3143 int new_cpu, this_cpu = get_cpu();
3144 new_cpu = select_task_rq(current, SD_BALANCE_EXEC, 0);
3145 put_cpu();
3146 if (new_cpu != this_cpu)
3147 sched_migrate_task(current, new_cpu);
3148}
3149
3150/*
3151 * pull_task - move a task from a remote runqueue to the local runqueue. 3183 * pull_task - move a task from a remote runqueue to the local runqueue.
3152 * Both runqueues must be locked. 3184 * Both runqueues must be locked.
3153 */ 3185 */
@@ -5911,14 +5943,15 @@ EXPORT_SYMBOL(wait_for_completion_killable);
5911 */ 5943 */
5912bool try_wait_for_completion(struct completion *x) 5944bool try_wait_for_completion(struct completion *x)
5913{ 5945{
5946 unsigned long flags;
5914 int ret = 1; 5947 int ret = 1;
5915 5948
5916 spin_lock_irq(&x->wait.lock); 5949 spin_lock_irqsave(&x->wait.lock, flags);
5917 if (!x->done) 5950 if (!x->done)
5918 ret = 0; 5951 ret = 0;
5919 else 5952 else
5920 x->done--; 5953 x->done--;
5921 spin_unlock_irq(&x->wait.lock); 5954 spin_unlock_irqrestore(&x->wait.lock, flags);
5922 return ret; 5955 return ret;
5923} 5956}
5924EXPORT_SYMBOL(try_wait_for_completion); 5957EXPORT_SYMBOL(try_wait_for_completion);
@@ -5933,12 +5966,13 @@ EXPORT_SYMBOL(try_wait_for_completion);
5933 */ 5966 */
5934bool completion_done(struct completion *x) 5967bool completion_done(struct completion *x)
5935{ 5968{
5969 unsigned long flags;
5936 int ret = 1; 5970 int ret = 1;
5937 5971
5938 spin_lock_irq(&x->wait.lock); 5972 spin_lock_irqsave(&x->wait.lock, flags);
5939 if (!x->done) 5973 if (!x->done)
5940 ret = 0; 5974 ret = 0;
5941 spin_unlock_irq(&x->wait.lock); 5975 spin_unlock_irqrestore(&x->wait.lock, flags);
5942 return ret; 5976 return ret;
5943} 5977}
5944EXPORT_SYMBOL(completion_done); 5978EXPORT_SYMBOL(completion_done);
@@ -6457,7 +6491,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
6457 return -EINVAL; 6491 return -EINVAL;
6458 6492
6459 retval = -ESRCH; 6493 retval = -ESRCH;
6460 read_lock(&tasklist_lock); 6494 rcu_read_lock();
6461 p = find_process_by_pid(pid); 6495 p = find_process_by_pid(pid);
6462 if (p) { 6496 if (p) {
6463 retval = security_task_getscheduler(p); 6497 retval = security_task_getscheduler(p);
@@ -6465,7 +6499,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
6465 retval = p->policy 6499 retval = p->policy
6466 | (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0); 6500 | (p->sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0);
6467 } 6501 }
6468 read_unlock(&tasklist_lock); 6502 rcu_read_unlock();
6469 return retval; 6503 return retval;
6470} 6504}
6471 6505
@@ -6483,7 +6517,7 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
6483 if (!param || pid < 0) 6517 if (!param || pid < 0)
6484 return -EINVAL; 6518 return -EINVAL;
6485 6519
6486 read_lock(&tasklist_lock); 6520 rcu_read_lock();
6487 p = find_process_by_pid(pid); 6521 p = find_process_by_pid(pid);
6488 retval = -ESRCH; 6522 retval = -ESRCH;
6489 if (!p) 6523 if (!p)
@@ -6494,7 +6528,7 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
6494 goto out_unlock; 6528 goto out_unlock;
6495 6529
6496 lp.sched_priority = p->rt_priority; 6530 lp.sched_priority = p->rt_priority;
6497 read_unlock(&tasklist_lock); 6531 rcu_read_unlock();
6498 6532
6499 /* 6533 /*
6500 * This one might sleep, we cannot do it with a spinlock held ... 6534 * This one might sleep, we cannot do it with a spinlock held ...
@@ -6504,7 +6538,7 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
6504 return retval; 6538 return retval;
6505 6539
6506out_unlock: 6540out_unlock:
6507 read_unlock(&tasklist_lock); 6541 rcu_read_unlock();
6508 return retval; 6542 return retval;
6509} 6543}
6510 6544
@@ -6515,22 +6549,18 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
6515 int retval; 6549 int retval;
6516 6550
6517 get_online_cpus(); 6551 get_online_cpus();
6518 read_lock(&tasklist_lock); 6552 rcu_read_lock();
6519 6553
6520 p = find_process_by_pid(pid); 6554 p = find_process_by_pid(pid);
6521 if (!p) { 6555 if (!p) {
6522 read_unlock(&tasklist_lock); 6556 rcu_read_unlock();
6523 put_online_cpus(); 6557 put_online_cpus();
6524 return -ESRCH; 6558 return -ESRCH;
6525 } 6559 }
6526 6560
6527 /* 6561 /* Prevent p going away */
6528 * It is not safe to call set_cpus_allowed with the
6529 * tasklist_lock held. We will bump the task_struct's
6530 * usage count and then drop tasklist_lock.
6531 */
6532 get_task_struct(p); 6562 get_task_struct(p);
6533 read_unlock(&tasklist_lock); 6563 rcu_read_unlock();
6534 6564
6535 if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) { 6565 if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) {
6536 retval = -ENOMEM; 6566 retval = -ENOMEM;
@@ -6616,7 +6646,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask)
6616 int retval; 6646 int retval;
6617 6647
6618 get_online_cpus(); 6648 get_online_cpus();
6619 read_lock(&tasklist_lock); 6649 rcu_read_lock();
6620 6650
6621 retval = -ESRCH; 6651 retval = -ESRCH;
6622 p = find_process_by_pid(pid); 6652 p = find_process_by_pid(pid);
@@ -6632,7 +6662,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask)
6632 task_rq_unlock(rq, &flags); 6662 task_rq_unlock(rq, &flags);
6633 6663
6634out_unlock: 6664out_unlock:
6635 read_unlock(&tasklist_lock); 6665 rcu_read_unlock();
6636 put_online_cpus(); 6666 put_online_cpus();
6637 6667
6638 return retval; 6668 return retval;
@@ -6876,7 +6906,7 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
6876 return -EINVAL; 6906 return -EINVAL;
6877 6907
6878 retval = -ESRCH; 6908 retval = -ESRCH;
6879 read_lock(&tasklist_lock); 6909 rcu_read_lock();
6880 p = find_process_by_pid(pid); 6910 p = find_process_by_pid(pid);
6881 if (!p) 6911 if (!p)
6882 goto out_unlock; 6912 goto out_unlock;
@@ -6889,13 +6919,13 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
6889 time_slice = p->sched_class->get_rr_interval(rq, p); 6919 time_slice = p->sched_class->get_rr_interval(rq, p);
6890 task_rq_unlock(rq, &flags); 6920 task_rq_unlock(rq, &flags);
6891 6921
6892 read_unlock(&tasklist_lock); 6922 rcu_read_unlock();
6893 jiffies_to_timespec(time_slice, &t); 6923 jiffies_to_timespec(time_slice, &t);
6894 retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0; 6924 retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;
6895 return retval; 6925 return retval;
6896 6926
6897out_unlock: 6927out_unlock:
6898 read_unlock(&tasklist_lock); 6928 rcu_read_unlock();
6899 return retval; 6929 return retval;
6900} 6930}
6901 6931
@@ -6986,6 +7016,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
6986 raw_spin_lock_irqsave(&rq->lock, flags); 7016 raw_spin_lock_irqsave(&rq->lock, flags);
6987 7017
6988 __sched_fork(idle); 7018 __sched_fork(idle);
7019 idle->state = TASK_RUNNING;
6989 idle->se.exec_start = sched_clock(); 7020 idle->se.exec_start = sched_clock();
6990 7021
6991 cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); 7022 cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu));
@@ -7100,7 +7131,23 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
7100 struct rq *rq; 7131 struct rq *rq;
7101 int ret = 0; 7132 int ret = 0;
7102 7133
7134 /*
7135 * Since we rely on wake-ups to migrate sleeping tasks, don't change
7136 * the ->cpus_allowed mask from under waking tasks, which would be
7137 * possible when we change rq->lock in ttwu(), so synchronize against
7138 * TASK_WAKING to avoid that.
7139 */
7140again:
7141 while (p->state == TASK_WAKING)
7142 cpu_relax();
7143
7103 rq = task_rq_lock(p, &flags); 7144 rq = task_rq_lock(p, &flags);
7145
7146 if (p->state == TASK_WAKING) {
7147 task_rq_unlock(rq, &flags);
7148 goto again;
7149 }
7150
7104 if (!cpumask_intersects(new_mask, cpu_active_mask)) { 7151 if (!cpumask_intersects(new_mask, cpu_active_mask)) {
7105 ret = -EINVAL; 7152 ret = -EINVAL;
7106 goto out; 7153 goto out;
@@ -7156,7 +7203,7 @@ EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
7156static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) 7203static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
7157{ 7204{
7158 struct rq *rq_dest, *rq_src; 7205 struct rq *rq_dest, *rq_src;
7159 int ret = 0, on_rq; 7206 int ret = 0;
7160 7207
7161 if (unlikely(!cpu_active(dest_cpu))) 7208 if (unlikely(!cpu_active(dest_cpu)))
7162 return ret; 7209 return ret;
@@ -7172,12 +7219,13 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
7172 if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed)) 7219 if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
7173 goto fail; 7220 goto fail;
7174 7221
7175 on_rq = p->se.on_rq; 7222 /*
7176 if (on_rq) 7223 * If we're not on a rq, the next wake-up will ensure we're
7224 * placed properly.
7225 */
7226 if (p->se.on_rq) {
7177 deactivate_task(rq_src, p, 0); 7227 deactivate_task(rq_src, p, 0);
7178 7228 set_task_cpu(p, dest_cpu);
7179 set_task_cpu(p, dest_cpu);
7180 if (on_rq) {
7181 activate_task(rq_dest, p, 0); 7229 activate_task(rq_dest, p, 0);
7182 check_preempt_curr(rq_dest, p, 0); 7230 check_preempt_curr(rq_dest, p, 0);
7183 } 7231 }
@@ -7273,37 +7321,10 @@ static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu)
7273static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) 7321static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
7274{ 7322{
7275 int dest_cpu; 7323 int dest_cpu;
7276 const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(dead_cpu));
7277 7324
7278again: 7325again:
7279 /* Look for allowed, online CPU in same node. */ 7326 dest_cpu = select_fallback_rq(dead_cpu, p);
7280 for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask)
7281 if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
7282 goto move;
7283
7284 /* Any allowed, online CPU? */
7285 dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_active_mask);
7286 if (dest_cpu < nr_cpu_ids)
7287 goto move;
7288
7289 /* No more Mr. Nice Guy. */
7290 if (dest_cpu >= nr_cpu_ids) {
7291 cpuset_cpus_allowed_locked(p, &p->cpus_allowed);
7292 dest_cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed);
7293
7294 /*
7295 * Don't tell them about moving exiting tasks or
7296 * kernel threads (both mm NULL), since they never
7297 * leave kernel.
7298 */
7299 if (p->mm && printk_ratelimit()) {
7300 printk(KERN_INFO "process %d (%s) no "
7301 "longer affine to cpu%d\n",
7302 task_pid_nr(p), p->comm, dead_cpu);
7303 }
7304 }
7305 7327
7306move:
7307 /* It can have affinity changed while we were choosing. */ 7328 /* It can have affinity changed while we were choosing. */
7308 if (unlikely(!__migrate_task_irq(p, dead_cpu, dest_cpu))) 7329 if (unlikely(!__migrate_task_irq(p, dead_cpu, dest_cpu)))
7309 goto again; 7330 goto again;
@@ -9668,7 +9689,7 @@ void __init sched_init(void)
9668#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 9689#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
9669static inline int preempt_count_equals(int preempt_offset) 9690static inline int preempt_count_equals(int preempt_offset)
9670{ 9691{
9671 int nested = preempt_count() & ~PREEMPT_ACTIVE; 9692 int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
9672 9693
9673 return (nested == PREEMPT_INATOMIC_BASE + preempt_offset); 9694 return (nested == PREEMPT_INATOMIC_BASE + preempt_offset);
9674} 9695}
@@ -10083,7 +10104,7 @@ void sched_move_task(struct task_struct *tsk)
10083 10104
10084#ifdef CONFIG_FAIR_GROUP_SCHED 10105#ifdef CONFIG_FAIR_GROUP_SCHED
10085 if (tsk->sched_class->moved_group) 10106 if (tsk->sched_class->moved_group)
10086 tsk->sched_class->moved_group(tsk); 10107 tsk->sched_class->moved_group(tsk, on_rq);
10087#endif 10108#endif
10088 10109
10089 if (unlikely(running)) 10110 if (unlikely(running))
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 479ce5682d7c..5b496132c28a 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -236,6 +236,18 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
236} 236}
237EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event); 237EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
238 238
239unsigned long long cpu_clock(int cpu)
240{
241 unsigned long long clock;
242 unsigned long flags;
243
244 local_irq_save(flags);
245 clock = sched_clock_cpu(cpu);
246 local_irq_restore(flags);
247
248 return clock;
249}
250
239#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */ 251#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
240 252
241void sched_clock_init(void) 253void sched_clock_init(void)
@@ -251,17 +263,12 @@ u64 sched_clock_cpu(int cpu)
251 return sched_clock(); 263 return sched_clock();
252} 264}
253 265
254#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
255 266
256unsigned long long cpu_clock(int cpu) 267unsigned long long cpu_clock(int cpu)
257{ 268{
258 unsigned long long clock; 269 return sched_clock_cpu(cpu);
259 unsigned long flags; 270}
260 271
261 local_irq_save(flags); 272#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
262 clock = sched_clock_cpu(cpu);
263 local_irq_restore(flags);
264 273
265 return clock;
266}
267EXPORT_SYMBOL_GPL(cpu_clock); 274EXPORT_SYMBOL_GPL(cpu_clock);
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 5bedf6e3ebf3..42ac3c9f66f6 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -510,6 +510,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
510 curr->sum_exec_runtime += delta_exec; 510 curr->sum_exec_runtime += delta_exec;
511 schedstat_add(cfs_rq, exec_clock, delta_exec); 511 schedstat_add(cfs_rq, exec_clock, delta_exec);
512 delta_exec_weighted = calc_delta_fair(delta_exec, curr); 512 delta_exec_weighted = calc_delta_fair(delta_exec, curr);
513
513 curr->vruntime += delta_exec_weighted; 514 curr->vruntime += delta_exec_weighted;
514 update_min_vruntime(cfs_rq); 515 update_min_vruntime(cfs_rq);
515} 516}
@@ -765,16 +766,26 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
765 se->vruntime = vruntime; 766 se->vruntime = vruntime;
766} 767}
767 768
769#define ENQUEUE_WAKEUP 1
770#define ENQUEUE_MIGRATE 2
771
768static void 772static void
769enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup) 773enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
770{ 774{
771 /* 775 /*
776 * Update the normalized vruntime before updating min_vruntime
777 * through callig update_curr().
778 */
779 if (!(flags & ENQUEUE_WAKEUP) || (flags & ENQUEUE_MIGRATE))
780 se->vruntime += cfs_rq->min_vruntime;
781
782 /*
772 * Update run-time statistics of the 'current'. 783 * Update run-time statistics of the 'current'.
773 */ 784 */
774 update_curr(cfs_rq); 785 update_curr(cfs_rq);
775 account_entity_enqueue(cfs_rq, se); 786 account_entity_enqueue(cfs_rq, se);
776 787
777 if (wakeup) { 788 if (flags & ENQUEUE_WAKEUP) {
778 place_entity(cfs_rq, se, 0); 789 place_entity(cfs_rq, se, 0);
779 enqueue_sleeper(cfs_rq, se); 790 enqueue_sleeper(cfs_rq, se);
780 } 791 }
@@ -828,6 +839,14 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
828 __dequeue_entity(cfs_rq, se); 839 __dequeue_entity(cfs_rq, se);
829 account_entity_dequeue(cfs_rq, se); 840 account_entity_dequeue(cfs_rq, se);
830 update_min_vruntime(cfs_rq); 841 update_min_vruntime(cfs_rq);
842
843 /*
844 * Normalize the entity after updating the min_vruntime because the
845 * update can refer to the ->curr item and we need to reflect this
846 * movement in our normalized position.
847 */
848 if (!sleep)
849 se->vruntime -= cfs_rq->min_vruntime;
831} 850}
832 851
833/* 852/*
@@ -1038,13 +1057,19 @@ static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
1038{ 1057{
1039 struct cfs_rq *cfs_rq; 1058 struct cfs_rq *cfs_rq;
1040 struct sched_entity *se = &p->se; 1059 struct sched_entity *se = &p->se;
1060 int flags = 0;
1061
1062 if (wakeup)
1063 flags |= ENQUEUE_WAKEUP;
1064 if (p->state == TASK_WAKING)
1065 flags |= ENQUEUE_MIGRATE;
1041 1066
1042 for_each_sched_entity(se) { 1067 for_each_sched_entity(se) {
1043 if (se->on_rq) 1068 if (se->on_rq)
1044 break; 1069 break;
1045 cfs_rq = cfs_rq_of(se); 1070 cfs_rq = cfs_rq_of(se);
1046 enqueue_entity(cfs_rq, se, wakeup); 1071 enqueue_entity(cfs_rq, se, flags);
1047 wakeup = 1; 1072 flags = ENQUEUE_WAKEUP;
1048 } 1073 }
1049 1074
1050 hrtick_update(rq); 1075 hrtick_update(rq);
@@ -1120,6 +1145,14 @@ static void yield_task_fair(struct rq *rq)
1120 1145
1121#ifdef CONFIG_SMP 1146#ifdef CONFIG_SMP
1122 1147
1148static void task_waking_fair(struct rq *rq, struct task_struct *p)
1149{
1150 struct sched_entity *se = &p->se;
1151 struct cfs_rq *cfs_rq = cfs_rq_of(se);
1152
1153 se->vruntime -= cfs_rq->min_vruntime;
1154}
1155
1123#ifdef CONFIG_FAIR_GROUP_SCHED 1156#ifdef CONFIG_FAIR_GROUP_SCHED
1124/* 1157/*
1125 * effective_load() calculates the load change as seen from the root_task_group 1158 * effective_load() calculates the load change as seen from the root_task_group
@@ -1429,6 +1462,9 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
1429 } 1462 }
1430 1463
1431 for_each_domain(cpu, tmp) { 1464 for_each_domain(cpu, tmp) {
1465 if (!(tmp->flags & SD_LOAD_BALANCE))
1466 continue;
1467
1432 /* 1468 /*
1433 * If power savings logic is enabled for a domain, see if we 1469 * If power savings logic is enabled for a domain, see if we
1434 * are not overloaded, if so, don't balance wider. 1470 * are not overloaded, if so, don't balance wider.
@@ -1975,6 +2011,8 @@ static void task_fork_fair(struct task_struct *p)
1975 resched_task(rq->curr); 2011 resched_task(rq->curr);
1976 } 2012 }
1977 2013
2014 se->vruntime -= cfs_rq->min_vruntime;
2015
1978 raw_spin_unlock_irqrestore(&rq->lock, flags); 2016 raw_spin_unlock_irqrestore(&rq->lock, flags);
1979} 2017}
1980 2018
@@ -2028,12 +2066,13 @@ static void set_curr_task_fair(struct rq *rq)
2028} 2066}
2029 2067
2030#ifdef CONFIG_FAIR_GROUP_SCHED 2068#ifdef CONFIG_FAIR_GROUP_SCHED
2031static void moved_group_fair(struct task_struct *p) 2069static void moved_group_fair(struct task_struct *p, int on_rq)
2032{ 2070{
2033 struct cfs_rq *cfs_rq = task_cfs_rq(p); 2071 struct cfs_rq *cfs_rq = task_cfs_rq(p);
2034 2072
2035 update_curr(cfs_rq); 2073 update_curr(cfs_rq);
2036 place_entity(cfs_rq, &p->se, 1); 2074 if (!on_rq)
2075 place_entity(cfs_rq, &p->se, 1);
2037} 2076}
2038#endif 2077#endif
2039 2078
@@ -2073,6 +2112,8 @@ static const struct sched_class fair_sched_class = {
2073 .move_one_task = move_one_task_fair, 2112 .move_one_task = move_one_task_fair,
2074 .rq_online = rq_online_fair, 2113 .rq_online = rq_online_fair,
2075 .rq_offline = rq_offline_fair, 2114 .rq_offline = rq_offline_fair,
2115
2116 .task_waking = task_waking_fair,
2076#endif 2117#endif
2077 2118
2078 .set_curr_task = set_curr_task_fair, 2119 .set_curr_task = set_curr_task_fair,
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index d2ea2828164e..f48328ac216f 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1472,7 +1472,7 @@ static void post_schedule_rt(struct rq *rq)
1472 * If we are not running and we are not going to reschedule soon, we should 1472 * If we are not running and we are not going to reschedule soon, we should
1473 * try to push tasks away now 1473 * try to push tasks away now
1474 */ 1474 */
1475static void task_wake_up_rt(struct rq *rq, struct task_struct *p) 1475static void task_woken_rt(struct rq *rq, struct task_struct *p)
1476{ 1476{
1477 if (!task_running(rq, p) && 1477 if (!task_running(rq, p) &&
1478 !test_tsk_need_resched(rq->curr) && 1478 !test_tsk_need_resched(rq->curr) &&
@@ -1753,7 +1753,7 @@ static const struct sched_class rt_sched_class = {
1753 .rq_offline = rq_offline_rt, 1753 .rq_offline = rq_offline_rt,
1754 .pre_schedule = pre_schedule_rt, 1754 .pre_schedule = pre_schedule_rt,
1755 .post_schedule = post_schedule_rt, 1755 .post_schedule = post_schedule_rt,
1756 .task_wake_up = task_wake_up_rt, 1756 .task_woken = task_woken_rt,
1757 .switched_from = switched_from_rt, 1757 .switched_from = switched_from_rt,
1758#endif 1758#endif
1759 1759
diff --git a/kernel/signal.c b/kernel/signal.c
index 1814e68e4de3..934ae5e687b9 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -218,13 +218,13 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi
218 struct user_struct *user; 218 struct user_struct *user;
219 219
220 /* 220 /*
221 * We won't get problems with the target's UID changing under us 221 * Protect access to @t credentials. This can go away when all
222 * because changing it requires RCU be used, and if t != current, the 222 * callers hold rcu read lock.
223 * caller must be holding the RCU readlock (by way of a spinlock) and
224 * we use RCU protection here
225 */ 223 */
224 rcu_read_lock();
226 user = get_uid(__task_cred(t)->user); 225 user = get_uid(__task_cred(t)->user);
227 atomic_inc(&user->sigpending); 226 atomic_inc(&user->sigpending);
227 rcu_read_unlock();
228 228
229 if (override_rlimit || 229 if (override_rlimit ||
230 atomic_read(&user->sigpending) <= 230 atomic_read(&user->sigpending) <=
@@ -979,7 +979,8 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
979 for (i = 0; i < 16; i++) { 979 for (i = 0; i < 16; i++) {
980 unsigned char insn; 980 unsigned char insn;
981 981
982 __get_user(insn, (unsigned char *)(regs->ip + i)); 982 if (get_user(insn, (unsigned char *)(regs->ip + i)))
983 break;
983 printk("%02x ", insn); 984 printk("%02x ", insn);
984 } 985 }
985 } 986 }
@@ -1179,11 +1180,12 @@ int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid,
1179 int ret = -EINVAL; 1180 int ret = -EINVAL;
1180 struct task_struct *p; 1181 struct task_struct *p;
1181 const struct cred *pcred; 1182 const struct cred *pcred;
1183 unsigned long flags;
1182 1184
1183 if (!valid_signal(sig)) 1185 if (!valid_signal(sig))
1184 return ret; 1186 return ret;
1185 1187
1186 read_lock(&tasklist_lock); 1188 rcu_read_lock();
1187 p = pid_task(pid, PIDTYPE_PID); 1189 p = pid_task(pid, PIDTYPE_PID);
1188 if (!p) { 1190 if (!p) {
1189 ret = -ESRCH; 1191 ret = -ESRCH;
@@ -1199,14 +1201,16 @@ int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid,
1199 ret = security_task_kill(p, info, sig, secid); 1201 ret = security_task_kill(p, info, sig, secid);
1200 if (ret) 1202 if (ret)
1201 goto out_unlock; 1203 goto out_unlock;
1202 if (sig && p->sighand) { 1204
1203 unsigned long flags; 1205 if (sig) {
1204 spin_lock_irqsave(&p->sighand->siglock, flags); 1206 if (lock_task_sighand(p, &flags)) {
1205 ret = __send_signal(sig, info, p, 1, 0); 1207 ret = __send_signal(sig, info, p, 1, 0);
1206 spin_unlock_irqrestore(&p->sighand->siglock, flags); 1208 unlock_task_sighand(p, &flags);
1209 } else
1210 ret = -ESRCH;
1207 } 1211 }
1208out_unlock: 1212out_unlock:
1209 read_unlock(&tasklist_lock); 1213 rcu_read_unlock();
1210 return ret; 1214 return ret;
1211} 1215}
1212EXPORT_SYMBOL_GPL(kill_pid_info_as_uid); 1216EXPORT_SYMBOL_GPL(kill_pid_info_as_uid);
diff --git a/kernel/sys.c b/kernel/sys.c
index 20ccfb5da6af..26a6b73a6b85 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -162,6 +162,7 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
162 if (niceval > 19) 162 if (niceval > 19)
163 niceval = 19; 163 niceval = 19;
164 164
165 rcu_read_lock();
165 read_lock(&tasklist_lock); 166 read_lock(&tasklist_lock);
166 switch (which) { 167 switch (which) {
167 case PRIO_PROCESS: 168 case PRIO_PROCESS:
@@ -199,6 +200,7 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
199 } 200 }
200out_unlock: 201out_unlock:
201 read_unlock(&tasklist_lock); 202 read_unlock(&tasklist_lock);
203 rcu_read_unlock();
202out: 204out:
203 return error; 205 return error;
204} 206}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 45e4bef0012a..8a68b2448468 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1131,7 +1131,7 @@ static struct ctl_table vm_table[] = {
1131 .data = &sysctl_max_map_count, 1131 .data = &sysctl_max_map_count,
1132 .maxlen = sizeof(sysctl_max_map_count), 1132 .maxlen = sizeof(sysctl_max_map_count),
1133 .mode = 0644, 1133 .mode = 0644,
1134 .proc_handler = proc_dointvec, 1134 .proc_handler = proc_dointvec_minmax,
1135 .extra1 = &zero, 1135 .extra1 = &zero,
1136 }, 1136 },
1137#else 1137#else
@@ -1214,6 +1214,7 @@ static struct ctl_table vm_table[] = {
1214 .proc_handler = proc_dointvec_jiffies, 1214 .proc_handler = proc_dointvec_jiffies,
1215 }, 1215 },
1216#endif 1216#endif
1217#ifdef CONFIG_MMU
1217 { 1218 {
1218 .procname = "mmap_min_addr", 1219 .procname = "mmap_min_addr",
1219 .data = &dac_mmap_min_addr, 1220 .data = &dac_mmap_min_addr,
@@ -1221,6 +1222,7 @@ static struct ctl_table vm_table[] = {
1221 .mode = 0644, 1222 .mode = 0644,
1222 .proc_handler = mmap_min_addr_handler, 1223 .proc_handler = mmap_min_addr_handler,
1223 }, 1224 },
1225#endif
1224#ifdef CONFIG_NUMA 1226#ifdef CONFIG_NUMA
1225 { 1227 {
1226 .procname = "numa_zonelist_order", 1228 .procname = "numa_zonelist_order",
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index 112533d5fc08..8f5d16e0707a 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1417,6 +1417,35 @@ static void deprecated_sysctl_warning(const int *name, int nlen)
1417 return; 1417 return;
1418} 1418}
1419 1419
1420#define WARN_ONCE_HASH_BITS 8
1421#define WARN_ONCE_HASH_SIZE (1<<WARN_ONCE_HASH_BITS)
1422
1423static DECLARE_BITMAP(warn_once_bitmap, WARN_ONCE_HASH_SIZE);
1424
1425#define FNV32_OFFSET 2166136261U
1426#define FNV32_PRIME 0x01000193
1427
1428/*
1429 * Print each legacy sysctl (approximately) only once.
1430 * To avoid making the tables non-const use a external
1431 * hash-table instead.
1432 * Worst case hash collision: 6, but very rarely.
1433 * NOTE! We don't use the SMP-safe bit tests. We simply
1434 * don't care enough.
1435 */
1436static void warn_on_bintable(const int *name, int nlen)
1437{
1438 int i;
1439 u32 hash = FNV32_OFFSET;
1440
1441 for (i = 0; i < nlen; i++)
1442 hash = (hash ^ name[i]) * FNV32_PRIME;
1443 hash %= WARN_ONCE_HASH_SIZE;
1444 if (__test_and_set_bit(hash, warn_once_bitmap))
1445 return;
1446 deprecated_sysctl_warning(name, nlen);
1447}
1448
1420static ssize_t do_sysctl(int __user *args_name, int nlen, 1449static ssize_t do_sysctl(int __user *args_name, int nlen,
1421 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) 1450 void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
1422{ 1451{
@@ -1431,7 +1460,7 @@ static ssize_t do_sysctl(int __user *args_name, int nlen,
1431 if (get_user(name[i], args_name + i)) 1460 if (get_user(name[i], args_name + i))
1432 return -EFAULT; 1461 return -EFAULT;
1433 1462
1434 deprecated_sysctl_warning(name, nlen); 1463 warn_on_bintable(name, nlen);
1435 1464
1436 return binary_sysctl(name, nlen, oldval, oldlen, newval, newlen); 1465 return binary_sysctl(name, nlen, oldval, oldlen, newval, newlen);
1437} 1466}
diff --git a/kernel/time.c b/kernel/time.c
index c6324d96009e..804798005d19 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -136,6 +136,7 @@ static inline void warp_clock(void)
136 write_seqlock_irq(&xtime_lock); 136 write_seqlock_irq(&xtime_lock);
137 wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60; 137 wall_to_monotonic.tv_sec -= sys_tz.tz_minuteswest * 60;
138 xtime.tv_sec += sys_tz.tz_minuteswest * 60; 138 xtime.tv_sec += sys_tz.tz_minuteswest * 60;
139 update_xtime_cache(0);
139 write_sequnlock_irq(&xtime_lock); 140 write_sequnlock_irq(&xtime_lock);
140 clock_was_set(); 141 clock_was_set();
141} 142}
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 3d5fc0fd1cca..6f740d9f0948 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -238,8 +238,9 @@ void clockevents_exchange_device(struct clock_event_device *old,
238 */ 238 */
239void clockevents_notify(unsigned long reason, void *arg) 239void clockevents_notify(unsigned long reason, void *arg)
240{ 240{
241 struct list_head *node, *tmp; 241 struct clock_event_device *dev, *tmp;
242 unsigned long flags; 242 unsigned long flags;
243 int cpu;
243 244
244 raw_spin_lock_irqsave(&clockevents_lock, flags); 245 raw_spin_lock_irqsave(&clockevents_lock, flags);
245 clockevents_do_notify(reason, arg); 246 clockevents_do_notify(reason, arg);
@@ -250,8 +251,19 @@ void clockevents_notify(unsigned long reason, void *arg)
250 * Unregister the clock event devices which were 251 * Unregister the clock event devices which were
251 * released from the users in the notify chain. 252 * released from the users in the notify chain.
252 */ 253 */
253 list_for_each_safe(node, tmp, &clockevents_released) 254 list_for_each_entry_safe(dev, tmp, &clockevents_released, list)
254 list_del(node); 255 list_del(&dev->list);
256 /*
257 * Now check whether the CPU has left unused per cpu devices
258 */
259 cpu = *((int *)arg);
260 list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) {
261 if (cpumask_test_cpu(cpu, dev->cpumask) &&
262 cpumask_weight(dev->cpumask) == 1) {
263 BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
264 list_del(&dev->list);
265 }
266 }
255 break; 267 break;
256 default: 268 default:
257 break; 269 break;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index af4135f05825..7faaa32fbf4f 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -165,6 +165,13 @@ struct timespec raw_time;
165/* flag for if timekeeping is suspended */ 165/* flag for if timekeeping is suspended */
166int __read_mostly timekeeping_suspended; 166int __read_mostly timekeeping_suspended;
167 167
168static struct timespec xtime_cache __attribute__ ((aligned (16)));
169void update_xtime_cache(u64 nsec)
170{
171 xtime_cache = xtime;
172 timespec_add_ns(&xtime_cache, nsec);
173}
174
168/* must hold xtime_lock */ 175/* must hold xtime_lock */
169void timekeeping_leap_insert(int leapsecond) 176void timekeeping_leap_insert(int leapsecond)
170{ 177{
@@ -325,6 +332,8 @@ int do_settimeofday(struct timespec *tv)
325 332
326 xtime = *tv; 333 xtime = *tv;
327 334
335 update_xtime_cache(0);
336
328 timekeeper.ntp_error = 0; 337 timekeeper.ntp_error = 0;
329 ntp_clear(); 338 ntp_clear();
330 339
@@ -550,6 +559,7 @@ void __init timekeeping_init(void)
550 } 559 }
551 set_normalized_timespec(&wall_to_monotonic, 560 set_normalized_timespec(&wall_to_monotonic,
552 -boot.tv_sec, -boot.tv_nsec); 561 -boot.tv_sec, -boot.tv_nsec);
562 update_xtime_cache(0);
553 total_sleep_time.tv_sec = 0; 563 total_sleep_time.tv_sec = 0;
554 total_sleep_time.tv_nsec = 0; 564 total_sleep_time.tv_nsec = 0;
555 write_sequnlock_irqrestore(&xtime_lock, flags); 565 write_sequnlock_irqrestore(&xtime_lock, flags);
@@ -583,6 +593,7 @@ static int timekeeping_resume(struct sys_device *dev)
583 wall_to_monotonic = timespec_sub(wall_to_monotonic, ts); 593 wall_to_monotonic = timespec_sub(wall_to_monotonic, ts);
584 total_sleep_time = timespec_add_safe(total_sleep_time, ts); 594 total_sleep_time = timespec_add_safe(total_sleep_time, ts);
585 } 595 }
596 update_xtime_cache(0);
586 /* re-base the last cycle value */ 597 /* re-base the last cycle value */
587 timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock); 598 timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock);
588 timekeeper.ntp_error = 0; 599 timekeeper.ntp_error = 0;
@@ -722,6 +733,7 @@ static void timekeeping_adjust(s64 offset)
722 timekeeper.ntp_error_shift; 733 timekeeper.ntp_error_shift;
723} 734}
724 735
736
725/** 737/**
726 * logarithmic_accumulation - shifted accumulation of cycles 738 * logarithmic_accumulation - shifted accumulation of cycles
727 * 739 *
@@ -765,6 +777,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
765 return offset; 777 return offset;
766} 778}
767 779
780
768/** 781/**
769 * update_wall_time - Uses the current clocksource to increment the wall time 782 * update_wall_time - Uses the current clocksource to increment the wall time
770 * 783 *
@@ -774,6 +787,7 @@ void update_wall_time(void)
774{ 787{
775 struct clocksource *clock; 788 struct clocksource *clock;
776 cycle_t offset; 789 cycle_t offset;
790 u64 nsecs;
777 int shift = 0, maxshift; 791 int shift = 0, maxshift;
778 792
779 /* Make sure we're fully resumed: */ 793 /* Make sure we're fully resumed: */
@@ -839,6 +853,9 @@ void update_wall_time(void)
839 timekeeper.ntp_error += timekeeper.xtime_nsec << 853 timekeeper.ntp_error += timekeeper.xtime_nsec <<
840 timekeeper.ntp_error_shift; 854 timekeeper.ntp_error_shift;
841 855
856 nsecs = clocksource_cyc2ns(offset, timekeeper.mult, timekeeper.shift);
857 update_xtime_cache(nsecs);
858
842 /* check to see if there is a new clocksource to use */ 859 /* check to see if there is a new clocksource to use */
843 update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult); 860 update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
844} 861}
@@ -875,13 +892,13 @@ void monotonic_to_bootbased(struct timespec *ts)
875 892
876unsigned long get_seconds(void) 893unsigned long get_seconds(void)
877{ 894{
878 return xtime.tv_sec; 895 return xtime_cache.tv_sec;
879} 896}
880EXPORT_SYMBOL(get_seconds); 897EXPORT_SYMBOL(get_seconds);
881 898
882struct timespec __current_kernel_time(void) 899struct timespec __current_kernel_time(void)
883{ 900{
884 return xtime; 901 return xtime_cache;
885} 902}
886 903
887struct timespec current_kernel_time(void) 904struct timespec current_kernel_time(void)
@@ -891,7 +908,8 @@ struct timespec current_kernel_time(void)
891 908
892 do { 909 do {
893 seq = read_seqbegin(&xtime_lock); 910 seq = read_seqbegin(&xtime_lock);
894 now = xtime; 911
912 now = xtime_cache;
895 } while (read_seqretry(&xtime_lock, seq)); 913 } while (read_seqretry(&xtime_lock, seq));
896 914
897 return now; 915 return now;
@@ -905,7 +923,8 @@ struct timespec get_monotonic_coarse(void)
905 923
906 do { 924 do {
907 seq = read_seqbegin(&xtime_lock); 925 seq = read_seqbegin(&xtime_lock);
908 now = xtime; 926
927 now = xtime_cache;
909 mono = wall_to_monotonic; 928 mono = wall_to_monotonic;
910 } while (read_seqretry(&xtime_lock, seq)); 929 } while (read_seqretry(&xtime_lock, seq));
911 930
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index 28265636b6c2..bdfb8dd1050c 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -237,10 +237,10 @@ static void timer_list_show_tickdevices(struct seq_file *m)
237#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 237#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
238 print_tickdevice(m, tick_get_broadcast_device(), -1); 238 print_tickdevice(m, tick_get_broadcast_device(), -1);
239 SEQ_printf(m, "tick_broadcast_mask: %08lx\n", 239 SEQ_printf(m, "tick_broadcast_mask: %08lx\n",
240 tick_get_broadcast_mask()->bits[0]); 240 cpumask_bits(tick_get_broadcast_mask())[0]);
241#ifdef CONFIG_TICK_ONESHOT 241#ifdef CONFIG_TICK_ONESHOT
242 SEQ_printf(m, "tick_broadcast_oneshot_mask: %08lx\n", 242 SEQ_printf(m, "tick_broadcast_oneshot_mask: %08lx\n",
243 tick_get_broadcast_oneshot_mask()->bits[0]); 243 cpumask_bits(tick_get_broadcast_oneshot_mask())[0]);
244#endif 244#endif
245 SEQ_printf(m, "\n"); 245 SEQ_printf(m, "\n");
246#endif 246#endif
diff --git a/kernel/timer.c b/kernel/timer.c
index 5db5a8d26811..15533b792397 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -656,8 +656,6 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
656 656
657 debug_activate(timer, expires); 657 debug_activate(timer, expires);
658 658
659 new_base = __get_cpu_var(tvec_bases);
660
661 cpu = smp_processor_id(); 659 cpu = smp_processor_id();
662 660
663#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) 661#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index d006554888dc..6c22d8a2f289 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -12,17 +12,17 @@ config NOP_TRACER
12config HAVE_FTRACE_NMI_ENTER 12config HAVE_FTRACE_NMI_ENTER
13 bool 13 bool
14 help 14 help
15 See Documentation/trace/ftrace-implementation.txt 15 See Documentation/trace/ftrace-design.txt
16 16
17config HAVE_FUNCTION_TRACER 17config HAVE_FUNCTION_TRACER
18 bool 18 bool
19 help 19 help
20 See Documentation/trace/ftrace-implementation.txt 20 See Documentation/trace/ftrace-design.txt
21 21
22config HAVE_FUNCTION_GRAPH_TRACER 22config HAVE_FUNCTION_GRAPH_TRACER
23 bool 23 bool
24 help 24 help
25 See Documentation/trace/ftrace-implementation.txt 25 See Documentation/trace/ftrace-design.txt
26 26
27config HAVE_FUNCTION_GRAPH_FP_TEST 27config HAVE_FUNCTION_GRAPH_FP_TEST
28 bool 28 bool
@@ -34,17 +34,17 @@ config HAVE_FUNCTION_GRAPH_FP_TEST
34config HAVE_FUNCTION_TRACE_MCOUNT_TEST 34config HAVE_FUNCTION_TRACE_MCOUNT_TEST
35 bool 35 bool
36 help 36 help
37 See Documentation/trace/ftrace-implementation.txt 37 See Documentation/trace/ftrace-design.txt
38 38
39config HAVE_DYNAMIC_FTRACE 39config HAVE_DYNAMIC_FTRACE
40 bool 40 bool
41 help 41 help
42 See Documentation/trace/ftrace-implementation.txt 42 See Documentation/trace/ftrace-design.txt
43 43
44config HAVE_FTRACE_MCOUNT_RECORD 44config HAVE_FTRACE_MCOUNT_RECORD
45 bool 45 bool
46 help 46 help
47 See Documentation/trace/ftrace-implementation.txt 47 See Documentation/trace/ftrace-design.txt
48 48
49config HAVE_HW_BRANCH_TRACER 49config HAVE_HW_BRANCH_TRACER
50 bool 50 bool
@@ -52,7 +52,7 @@ config HAVE_HW_BRANCH_TRACER
52config HAVE_SYSCALL_TRACEPOINTS 52config HAVE_SYSCALL_TRACEPOINTS
53 bool 53 bool
54 help 54 help
55 See Documentation/trace/ftrace-implementation.txt 55 See Documentation/trace/ftrace-design.txt
56 56
57config TRACER_MAX_TRACE 57config TRACER_MAX_TRACE
58 bool 58 bool
@@ -83,7 +83,7 @@ config RING_BUFFER_ALLOW_SWAP
83# This allows those options to appear when no other tracer is selected. But the 83# This allows those options to appear when no other tracer is selected. But the
84# options do not appear when something else selects it. We need the two options 84# options do not appear when something else selects it. We need the two options
85# GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the 85# GENERIC_TRACER and TRACING to avoid circular dependencies to accomplish the
86# hidding of the automatic options. 86# hiding of the automatic options.
87 87
88config TRACING 88config TRACING
89 bool 89 bool
@@ -119,7 +119,7 @@ menuconfig FTRACE
119 bool "Tracers" 119 bool "Tracers"
120 default y if DEBUG_KERNEL 120 default y if DEBUG_KERNEL
121 help 121 help
122 Enable the kernel tracing infrastructure. 122 Enable the kernel tracing infrastructure.
123 123
124if FTRACE 124if FTRACE
125 125
@@ -133,7 +133,7 @@ config FUNCTION_TRACER
133 help 133 help
134 Enable the kernel to trace every kernel function. This is done 134 Enable the kernel to trace every kernel function. This is done
135 by using a compiler feature to insert a small, 5-byte No-Operation 135 by using a compiler feature to insert a small, 5-byte No-Operation
136 instruction to the beginning of every kernel function, which NOP 136 instruction at the beginning of every kernel function, which NOP
137 sequence is then dynamically patched into a tracer call when 137 sequence is then dynamically patched into a tracer call when
138 tracing is enabled by the administrator. If it's runtime disabled 138 tracing is enabled by the administrator. If it's runtime disabled
139 (the bootup default), then the overhead of the instructions is very 139 (the bootup default), then the overhead of the instructions is very
@@ -150,7 +150,7 @@ config FUNCTION_GRAPH_TRACER
150 and its entry. 150 and its entry.
151 Its first purpose is to trace the duration of functions and 151 Its first purpose is to trace the duration of functions and
152 draw a call graph for each thread with some information like 152 draw a call graph for each thread with some information like
153 the return value. This is done by setting the current return 153 the return value. This is done by setting the current return
154 address on the current task structure into a stack of calls. 154 address on the current task structure into a stack of calls.
155 155
156 156
@@ -173,7 +173,7 @@ config IRQSOFF_TRACER
173 173
174 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency 174 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
175 175
176 (Note that kernel size and overhead increases with this option 176 (Note that kernel size and overhead increase with this option
177 enabled. This option and the preempt-off timing option can be 177 enabled. This option and the preempt-off timing option can be
178 used together or separately.) 178 used together or separately.)
179 179
@@ -186,7 +186,7 @@ config PREEMPT_TRACER
186 select TRACER_MAX_TRACE 186 select TRACER_MAX_TRACE
187 select RING_BUFFER_ALLOW_SWAP 187 select RING_BUFFER_ALLOW_SWAP
188 help 188 help
189 This option measures the time spent in preemption off critical 189 This option measures the time spent in preemption-off critical
190 sections, with microsecond accuracy. 190 sections, with microsecond accuracy.
191 191
192 The default measurement method is a maximum search, which is 192 The default measurement method is a maximum search, which is
@@ -195,7 +195,7 @@ config PREEMPT_TRACER
195 195
196 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency 196 echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
197 197
198 (Note that kernel size and overhead increases with this option 198 (Note that kernel size and overhead increase with this option
199 enabled. This option and the irqs-off timing option can be 199 enabled. This option and the irqs-off timing option can be
200 used together or separately.) 200 used together or separately.)
201 201
@@ -222,7 +222,7 @@ config ENABLE_DEFAULT_TRACERS
222 depends on !GENERIC_TRACER 222 depends on !GENERIC_TRACER
223 select TRACING 223 select TRACING
224 help 224 help
225 This tracer hooks to various trace points in the kernel 225 This tracer hooks to various trace points in the kernel,
226 allowing the user to pick and choose which trace point they 226 allowing the user to pick and choose which trace point they
227 want to trace. It also includes the sched_switch tracer plugin. 227 want to trace. It also includes the sched_switch tracer plugin.
228 228
@@ -265,19 +265,19 @@ choice
265 The likely/unlikely profiler only looks at the conditions that 265 The likely/unlikely profiler only looks at the conditions that
266 are annotated with a likely or unlikely macro. 266 are annotated with a likely or unlikely macro.
267 267
268 The "all branch" profiler will profile every if statement in the 268 The "all branch" profiler will profile every if-statement in the
269 kernel. This profiler will also enable the likely/unlikely 269 kernel. This profiler will also enable the likely/unlikely
270 profiler as well. 270 profiler.
271 271
272 Either of the above profilers add a bit of overhead to the system. 272 Either of the above profilers adds a bit of overhead to the system.
273 If unsure choose "No branch profiling". 273 If unsure, choose "No branch profiling".
274 274
275config BRANCH_PROFILE_NONE 275config BRANCH_PROFILE_NONE
276 bool "No branch profiling" 276 bool "No branch profiling"
277 help 277 help
278 No branch profiling. Branch profiling adds a bit of overhead. 278 No branch profiling. Branch profiling adds a bit of overhead.
279 Only enable it if you want to analyse the branching behavior. 279 Only enable it if you want to analyse the branching behavior.
280 Otherwise keep it disabled. 280 Otherwise keep it disabled.
281 281
282config PROFILE_ANNOTATED_BRANCHES 282config PROFILE_ANNOTATED_BRANCHES
283 bool "Trace likely/unlikely profiler" 283 bool "Trace likely/unlikely profiler"
@@ -288,7 +288,7 @@ config PROFILE_ANNOTATED_BRANCHES
288 288
289 /sys/kernel/debug/tracing/profile_annotated_branch 289 /sys/kernel/debug/tracing/profile_annotated_branch
290 290
291 Note: this will add a significant overhead, only turn this 291 Note: this will add a significant overhead; only turn this
292 on if you need to profile the system's use of these macros. 292 on if you need to profile the system's use of these macros.
293 293
294config PROFILE_ALL_BRANCHES 294config PROFILE_ALL_BRANCHES
@@ -305,7 +305,7 @@ config PROFILE_ALL_BRANCHES
305 305
306 This configuration, when enabled, will impose a great overhead 306 This configuration, when enabled, will impose a great overhead
307 on the system. This should only be enabled when the system 307 on the system. This should only be enabled when the system
308 is to be analyzed 308 is to be analyzed in much detail.
309endchoice 309endchoice
310 310
311config TRACING_BRANCHES 311config TRACING_BRANCHES
@@ -335,7 +335,7 @@ config POWER_TRACER
335 depends on X86 335 depends on X86
336 select GENERIC_TRACER 336 select GENERIC_TRACER
337 help 337 help
338 This tracer helps developers to analyze and optimize the kernels 338 This tracer helps developers to analyze and optimize the kernel's
339 power management decisions, specifically the C-state and P-state 339 power management decisions, specifically the C-state and P-state
340 behavior. 340 behavior.
341 341
@@ -391,14 +391,14 @@ config HW_BRANCH_TRACER
391 select GENERIC_TRACER 391 select GENERIC_TRACER
392 help 392 help
393 This tracer records all branches on the system in a circular 393 This tracer records all branches on the system in a circular
394 buffer giving access to the last N branches for each cpu. 394 buffer, giving access to the last N branches for each cpu.
395 395
396config KMEMTRACE 396config KMEMTRACE
397 bool "Trace SLAB allocations" 397 bool "Trace SLAB allocations"
398 select GENERIC_TRACER 398 select GENERIC_TRACER
399 help 399 help
400 kmemtrace provides tracing for slab allocator functions, such as 400 kmemtrace provides tracing for slab allocator functions, such as
401 kmalloc, kfree, kmem_cache_alloc, kmem_cache_free etc.. Collected 401 kmalloc, kfree, kmem_cache_alloc, kmem_cache_free, etc. Collected
402 data is then fed to the userspace application in order to analyse 402 data is then fed to the userspace application in order to analyse
403 allocation hotspots, internal fragmentation and so on, making it 403 allocation hotspots, internal fragmentation and so on, making it
404 possible to see how well an allocator performs, as well as debug 404 possible to see how well an allocator performs, as well as debug
@@ -417,15 +417,15 @@ config WORKQUEUE_TRACER
417 bool "Trace workqueues" 417 bool "Trace workqueues"
418 select GENERIC_TRACER 418 select GENERIC_TRACER
419 help 419 help
420 The workqueue tracer provides some statistical informations 420 The workqueue tracer provides some statistical information
421 about each cpu workqueue thread such as the number of the 421 about each cpu workqueue thread such as the number of the
422 works inserted and executed since their creation. It can help 422 works inserted and executed since their creation. It can help
423 to evaluate the amount of work each of them have to perform. 423 to evaluate the amount of work each of them has to perform.
424 For example it can help a developer to decide whether he should 424 For example it can help a developer to decide whether he should
425 choose a per cpu workqueue instead of a singlethreaded one. 425 choose a per-cpu workqueue instead of a singlethreaded one.
426 426
427config BLK_DEV_IO_TRACE 427config BLK_DEV_IO_TRACE
428 bool "Support for tracing block io actions" 428 bool "Support for tracing block IO actions"
429 depends on SYSFS 429 depends on SYSFS
430 depends on BLOCK 430 depends on BLOCK
431 select RELAY 431 select RELAY
@@ -456,15 +456,15 @@ config KPROBE_EVENT
456 select TRACING 456 select TRACING
457 default y 457 default y
458 help 458 help
459 This allows the user to add tracing events (similar to tracepoints) on the fly 459 This allows the user to add tracing events (similar to tracepoints)
460 via the ftrace interface. See Documentation/trace/kprobetrace.txt 460 on the fly via the ftrace interface. See
461 for more details. 461 Documentation/trace/kprobetrace.txt for more details.
462 462
463 Those events can be inserted wherever kprobes can probe, and record 463 Those events can be inserted wherever kprobes can probe, and record
464 various register and memory values. 464 various register and memory values.
465 465
466 This option is also required by perf-probe subcommand of perf tools. If 466 This option is also required by perf-probe subcommand of perf tools.
467 you want to use perf tools, this option is strongly recommended. 467 If you want to use perf tools, this option is strongly recommended.
468 468
469config DYNAMIC_FTRACE 469config DYNAMIC_FTRACE
470 bool "enable/disable ftrace tracepoints dynamically" 470 bool "enable/disable ftrace tracepoints dynamically"
@@ -472,32 +472,32 @@ config DYNAMIC_FTRACE
472 depends on HAVE_DYNAMIC_FTRACE 472 depends on HAVE_DYNAMIC_FTRACE
473 default y 473 default y
474 help 474 help
475 This option will modify all the calls to ftrace dynamically 475 This option will modify all the calls to ftrace dynamically
476 (will patch them out of the binary image and replaces them 476 (will patch them out of the binary image and replace them
477 with a No-Op instruction) as they are called. A table is 477 with a No-Op instruction) as they are called. A table is
478 created to dynamically enable them again. 478 created to dynamically enable them again.
479 479
480 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but otherwise 480 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
481 has native performance as long as no tracing is active. 481 otherwise has native performance as long as no tracing is active.
482 482
483 The changes to the code are done by a kernel thread that 483 The changes to the code are done by a kernel thread that
484 wakes up once a second and checks to see if any ftrace calls 484 wakes up once a second and checks to see if any ftrace calls
485 were made. If so, it runs stop_machine (stops all CPUS) 485 were made. If so, it runs stop_machine (stops all CPUS)
486 and modifies the code to jump over the call to ftrace. 486 and modifies the code to jump over the call to ftrace.
487 487
488config FUNCTION_PROFILER 488config FUNCTION_PROFILER
489 bool "Kernel function profiler" 489 bool "Kernel function profiler"
490 depends on FUNCTION_TRACER 490 depends on FUNCTION_TRACER
491 default n 491 default n
492 help 492 help
493 This option enables the kernel function profiler. A file is created 493 This option enables the kernel function profiler. A file is created
494 in debugfs called function_profile_enabled which defaults to zero. 494 in debugfs called function_profile_enabled which defaults to zero.
495 When a 1 is echoed into this file profiling begins, and when a 495 When a 1 is echoed into this file profiling begins, and when a
496 zero is entered, profiling stops. A file in the trace_stats 496 zero is entered, profiling stops. A "functions" file is created in
497 directory called functions, that show the list of functions that 497 the trace_stats directory; this file shows the list of functions that
498 have been hit and their counters. 498 have been hit and their counters.
499 499
500 If in doubt, say N 500 If in doubt, say N.
501 501
502config FTRACE_MCOUNT_RECORD 502config FTRACE_MCOUNT_RECORD
503 def_bool y 503 def_bool y
@@ -556,8 +556,8 @@ config RING_BUFFER_BENCHMARK
556 tristate "Ring buffer benchmark stress tester" 556 tristate "Ring buffer benchmark stress tester"
557 depends on RING_BUFFER 557 depends on RING_BUFFER
558 help 558 help
559 This option creates a test to stress the ring buffer and bench mark it. 559 This option creates a test to stress the ring buffer and benchmark it.
560 It creates its own ring buffer such that it will not interfer with 560 It creates its own ring buffer such that it will not interfere with
561 any other users of the ring buffer (such as ftrace). It then creates 561 any other users of the ring buffer (such as ftrace). It then creates
562 a producer and consumer that will run for 10 seconds and sleep for 562 a producer and consumer that will run for 10 seconds and sleep for
563 10 seconds. Each interval it will print out the number of events 563 10 seconds. Each interval it will print out the number of events
@@ -566,7 +566,7 @@ config RING_BUFFER_BENCHMARK
566 It does not disable interrupts or raise its priority, so it may be 566 It does not disable interrupts or raise its priority, so it may be
567 affected by processes that are running. 567 affected by processes that are running.
568 568
569 If unsure, say N 569 If unsure, say N.
570 570
571endif # FTRACE 571endif # FTRACE
572 572
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 06ba26747d7e..0df1b0f2cb9e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -12,7 +12,7 @@
12 * Copyright (C) 2004 William Lee Irwin III 12 * Copyright (C) 2004 William Lee Irwin III
13 */ 13 */
14#include <linux/ring_buffer.h> 14#include <linux/ring_buffer.h>
15#include <linux/utsrelease.h> 15#include <generated/utsrelease.h>
16#include <linux/stacktrace.h> 16#include <linux/stacktrace.h>
17#include <linux/writeback.h> 17#include <linux/writeback.h>
18#include <linux/kallsyms.h> 18#include <linux/kallsyms.h>
@@ -3949,7 +3949,7 @@ trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt,
3949 if (!!(topt->flags->val & topt->opt->bit) != val) { 3949 if (!!(topt->flags->val & topt->opt->bit) != val) {
3950 mutex_lock(&trace_types_lock); 3950 mutex_lock(&trace_types_lock);
3951 ret = __set_tracer_option(current_trace, topt->flags, 3951 ret = __set_tracer_option(current_trace, topt->flags,
3952 topt->opt, val); 3952 topt->opt, !val);
3953 mutex_unlock(&trace_types_lock); 3953 mutex_unlock(&trace_types_lock);
3954 if (ret) 3954 if (ret)
3955 return ret; 3955 return ret;
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 458e5bfe26d0..d4fa5dc1ee4e 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -158,7 +158,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \
158 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 158 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
159 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 159 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
160 offsetof(typeof(field), item), \ 160 offsetof(typeof(field), item), \
161 sizeof(field.item), 0, FILTER_OTHER); \ 161 sizeof(field.item), \
162 is_signed_type(type), FILTER_OTHER); \
162 if (ret) \ 163 if (ret) \
163 return ret; 164 return ret;
164 165
@@ -168,8 +169,8 @@ ftrace_format_##name(struct ftrace_event_call *unused, \
168 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 169 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
169 offsetof(typeof(field), \ 170 offsetof(typeof(field), \
170 container.item), \ 171 container.item), \
171 sizeof(field.container.item), 0, \ 172 sizeof(field.container.item), \
172 FILTER_OTHER); \ 173 is_signed_type(type), FILTER_OTHER); \
173 if (ret) \ 174 if (ret) \
174 return ret; 175 return ret;
175 176
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 75d75dec226a..47f54ab57b68 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1201,10 +1201,11 @@ static int __probe_event_show_format(struct trace_seq *s,
1201#undef SHOW_FIELD 1201#undef SHOW_FIELD
1202#define SHOW_FIELD(type, item, name) \ 1202#define SHOW_FIELD(type, item, name) \
1203 do { \ 1203 do { \
1204 ret = trace_seq_printf(s, "\tfield: " #type " %s;\t" \ 1204 ret = trace_seq_printf(s, "\tfield:" #type " %s;\t" \
1205 "offset:%u;\tsize:%u;\n", name, \ 1205 "offset:%u;\tsize:%u;\tsigned:%d;\n", name,\
1206 (unsigned int)offsetof(typeof(field), item),\ 1206 (unsigned int)offsetof(typeof(field), item),\
1207 (unsigned int)sizeof(type)); \ 1207 (unsigned int)sizeof(type), \
1208 is_signed_type(type)); \
1208 if (!ret) \ 1209 if (!ret) \
1209 return 0; \ 1210 return 0; \
1210 } while (0) 1211 } while (0)
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c
index faf37fa4408c..94103cdcf9d8 100644
--- a/kernel/trace/trace_ksym.c
+++ b/kernel/trace/trace_ksym.c
@@ -26,12 +26,13 @@
26#include <linux/fs.h> 26#include <linux/fs.h>
27 27
28#include "trace_output.h" 28#include "trace_output.h"
29#include "trace_stat.h"
30#include "trace.h" 29#include "trace.h"
31 30
32#include <linux/hw_breakpoint.h> 31#include <linux/hw_breakpoint.h>
33#include <asm/hw_breakpoint.h> 32#include <asm/hw_breakpoint.h>
34 33
34#include <asm/atomic.h>
35
35/* 36/*
36 * For now, let us restrict the no. of symbols traced simultaneously to number 37 * For now, let us restrict the no. of symbols traced simultaneously to number
37 * of available hardware breakpoint registers. 38 * of available hardware breakpoint registers.
@@ -44,7 +45,7 @@ struct trace_ksym {
44 struct perf_event **ksym_hbp; 45 struct perf_event **ksym_hbp;
45 struct perf_event_attr attr; 46 struct perf_event_attr attr;
46#ifdef CONFIG_PROFILE_KSYM_TRACER 47#ifdef CONFIG_PROFILE_KSYM_TRACER
47 unsigned long counter; 48 atomic64_t counter;
48#endif 49#endif
49 struct hlist_node ksym_hlist; 50 struct hlist_node ksym_hlist;
50}; 51};
@@ -69,9 +70,8 @@ void ksym_collect_stats(unsigned long hbp_hit_addr)
69 70
70 rcu_read_lock(); 71 rcu_read_lock();
71 hlist_for_each_entry_rcu(entry, node, &ksym_filter_head, ksym_hlist) { 72 hlist_for_each_entry_rcu(entry, node, &ksym_filter_head, ksym_hlist) {
72 if ((entry->attr.bp_addr == hbp_hit_addr) && 73 if (entry->attr.bp_addr == hbp_hit_addr) {
73 (entry->counter <= MAX_UL_INT)) { 74 atomic64_inc(&entry->counter);
74 entry->counter++;
75 break; 75 break;
76 } 76 }
77 } 77 }
@@ -197,7 +197,6 @@ int process_new_ksym_entry(char *ksymname, int op, unsigned long addr)
197 entry->attr.bp_addr = addr; 197 entry->attr.bp_addr = addr;
198 entry->attr.bp_len = HW_BREAKPOINT_LEN_4; 198 entry->attr.bp_len = HW_BREAKPOINT_LEN_4;
199 199
200 ret = -EAGAIN;
201 entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr, 200 entry->ksym_hbp = register_wide_hw_breakpoint(&entry->attr,
202 ksym_hbp_handler); 201 ksym_hbp_handler);
203 202
@@ -300,8 +299,8 @@ static ssize_t ksym_trace_filter_write(struct file *file,
300 * 2: echo 0 > ksym_trace_filter 299 * 2: echo 0 > ksym_trace_filter
301 * 3: echo "*:---" > ksym_trace_filter 300 * 3: echo "*:---" > ksym_trace_filter
302 */ 301 */
303 if (!buf[0] || !strcmp(buf, "0") || 302 if (!input_string[0] || !strcmp(input_string, "0") ||
304 !strcmp(buf, "*:---")) { 303 !strcmp(input_string, "*:---")) {
305 __ksym_trace_reset(); 304 __ksym_trace_reset();
306 ret = 0; 305 ret = 0;
307 goto out; 306 goto out;
@@ -444,102 +443,77 @@ struct tracer ksym_tracer __read_mostly =
444 .print_line = ksym_trace_output 443 .print_line = ksym_trace_output
445}; 444};
446 445
447__init static int init_ksym_trace(void)
448{
449 struct dentry *d_tracer;
450 struct dentry *entry;
451
452 d_tracer = tracing_init_dentry();
453 ksym_filter_entry_count = 0;
454
455 entry = debugfs_create_file("ksym_trace_filter", 0644, d_tracer,
456 NULL, &ksym_tracing_fops);
457 if (!entry)
458 pr_warning("Could not create debugfs "
459 "'ksym_trace_filter' file\n");
460
461 return register_tracer(&ksym_tracer);
462}
463device_initcall(init_ksym_trace);
464
465
466#ifdef CONFIG_PROFILE_KSYM_TRACER 446#ifdef CONFIG_PROFILE_KSYM_TRACER
467static int ksym_tracer_stat_headers(struct seq_file *m) 447static int ksym_profile_show(struct seq_file *m, void *v)
468{ 448{
449 struct hlist_node *node;
450 struct trace_ksym *entry;
451 int access_type = 0;
452 char fn_name[KSYM_NAME_LEN];
453
469 seq_puts(m, " Access Type "); 454 seq_puts(m, " Access Type ");
470 seq_puts(m, " Symbol Counter\n"); 455 seq_puts(m, " Symbol Counter\n");
471 seq_puts(m, " ----------- "); 456 seq_puts(m, " ----------- ");
472 seq_puts(m, " ------ -------\n"); 457 seq_puts(m, " ------ -------\n");
473 return 0;
474}
475 458
476static int ksym_tracer_stat_show(struct seq_file *m, void *v) 459 rcu_read_lock();
477{ 460 hlist_for_each_entry_rcu(entry, node, &ksym_filter_head, ksym_hlist) {
478 struct hlist_node *stat = v;
479 struct trace_ksym *entry;
480 int access_type = 0;
481 char fn_name[KSYM_NAME_LEN];
482 461
483 entry = hlist_entry(stat, struct trace_ksym, ksym_hlist); 462 access_type = entry->attr.bp_type;
484 463
485 access_type = entry->attr.bp_type; 464 switch (access_type) {
465 case HW_BREAKPOINT_R:
466 seq_puts(m, " R ");
467 break;
468 case HW_BREAKPOINT_W:
469 seq_puts(m, " W ");
470 break;
471 case HW_BREAKPOINT_R | HW_BREAKPOINT_W:
472 seq_puts(m, " RW ");
473 break;
474 default:
475 seq_puts(m, " NA ");
476 }
486 477
487 switch (access_type) { 478 if (lookup_symbol_name(entry->attr.bp_addr, fn_name) >= 0)
488 case HW_BREAKPOINT_R: 479 seq_printf(m, " %-36s", fn_name);
489 seq_puts(m, " R "); 480 else
490 break; 481 seq_printf(m, " %-36s", "<NA>");
491 case HW_BREAKPOINT_W: 482 seq_printf(m, " %15llu\n",
492 seq_puts(m, " W "); 483 (unsigned long long)atomic64_read(&entry->counter));
493 break;
494 case HW_BREAKPOINT_R | HW_BREAKPOINT_W:
495 seq_puts(m, " RW ");
496 break;
497 default:
498 seq_puts(m, " NA ");
499 } 484 }
500 485 rcu_read_unlock();
501 if (lookup_symbol_name(entry->attr.bp_addr, fn_name) >= 0)
502 seq_printf(m, " %-36s", fn_name);
503 else
504 seq_printf(m, " %-36s", "<NA>");
505 seq_printf(m, " %15lu\n", entry->counter);
506 486
507 return 0; 487 return 0;
508} 488}
509 489
510static void *ksym_tracer_stat_start(struct tracer_stat *trace) 490static int ksym_profile_open(struct inode *node, struct file *file)
511{ 491{
512 return ksym_filter_head.first; 492 return single_open(file, ksym_profile_show, NULL);
513}
514
515static void *
516ksym_tracer_stat_next(void *v, int idx)
517{
518 struct hlist_node *stat = v;
519
520 return stat->next;
521} 493}
522 494
523static struct tracer_stat ksym_tracer_stats = { 495static const struct file_operations ksym_profile_fops = {
524 .name = "ksym_tracer", 496 .open = ksym_profile_open,
525 .stat_start = ksym_tracer_stat_start, 497 .read = seq_read,
526 .stat_next = ksym_tracer_stat_next, 498 .llseek = seq_lseek,
527 .stat_headers = ksym_tracer_stat_headers, 499 .release = single_release,
528 .stat_show = ksym_tracer_stat_show
529}; 500};
501#endif /* CONFIG_PROFILE_KSYM_TRACER */
530 502
531__init static int ksym_tracer_stat_init(void) 503__init static int init_ksym_trace(void)
532{ 504{
533 int ret; 505 struct dentry *d_tracer;
534 506
535 ret = register_stat_tracer(&ksym_tracer_stats); 507 d_tracer = tracing_init_dentry();
536 if (ret) {
537 printk(KERN_WARNING "Warning: could not register "
538 "ksym tracer stats\n");
539 return 1;
540 }
541 508
542 return 0; 509 trace_create_file("ksym_trace_filter", 0644, d_tracer,
510 NULL, &ksym_tracing_fops);
511
512#ifdef CONFIG_PROFILE_KSYM_TRACER
513 trace_create_file("ksym_profile", 0444, d_tracer,
514 NULL, &ksym_profile_fops);
515#endif
516
517 return register_tracer(&ksym_tracer);
543} 518}
544fs_initcall(ksym_tracer_stat_init); 519device_initcall(init_ksym_trace);
545#endif /* CONFIG_PROFILE_KSYM_TRACER */
diff --git a/lib/Kconfig b/lib/Kconfig
index 1cfe51628e1b..97b136ff117e 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2
117config DECOMPRESS_LZMA 117config DECOMPRESS_LZMA
118 tristate 118 tristate
119 119
120config DECOMPRESS_LZO
121 select LZO_DECOMPRESS
122 tristate
123
120# 124#
121# Generic allocator support is selected if needed 125# Generic allocator support is selected if needed
122# 126#
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 8cf9938dd147..25c3ed594c54 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -360,6 +360,7 @@ config DEBUG_KMEMLEAK
360 select DEBUG_FS if SYSFS 360 select DEBUG_FS if SYSFS
361 select STACKTRACE if STACKTRACE_SUPPORT 361 select STACKTRACE if STACKTRACE_SUPPORT
362 select KALLSYMS 362 select KALLSYMS
363 select CRC32
363 help 364 help
364 Say Y here if you want to enable the memory leak 365 Say Y here if you want to enable the memory leak
365 detector. The memory allocation/freeing is traced in a way 366 detector. The memory allocation/freeing is traced in a way
diff --git a/lib/Makefile b/lib/Makefile
index 347ad8db29d3..3b0b4a696db9 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -21,7 +21,7 @@ lib-y += kobject.o kref.o klist.o
21 21
22obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ 22obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
23 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ 23 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
24 string_helpers.o gcd.o 24 string_helpers.o gcd.o list_sort.o
25 25
26ifeq ($(CONFIG_DEBUG_KOBJECT),y) 26ifeq ($(CONFIG_DEBUG_KOBJECT),y)
27CFLAGS_kobject.o += -DDEBUG 27CFLAGS_kobject.o += -DDEBUG
@@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/
69lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o 69lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
70lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o 70lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
71lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o 71lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
72lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
72 73
73obj-$(CONFIG_TEXTSEARCH) += textsearch.o 74obj-$(CONFIG_TEXTSEARCH) += textsearch.o
74obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o 75obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o
diff --git a/lib/decompress.c b/lib/decompress.c
index d2842f571674..a7606815541f 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -9,6 +9,7 @@
9#include <linux/decompress/bunzip2.h> 9#include <linux/decompress/bunzip2.h>
10#include <linux/decompress/unlzma.h> 10#include <linux/decompress/unlzma.h>
11#include <linux/decompress/inflate.h> 11#include <linux/decompress/inflate.h>
12#include <linux/decompress/unlzo.h>
12 13
13#include <linux/types.h> 14#include <linux/types.h>
14#include <linux/string.h> 15#include <linux/string.h>
@@ -22,6 +23,9 @@
22#ifndef CONFIG_DECOMPRESS_LZMA 23#ifndef CONFIG_DECOMPRESS_LZMA
23# define unlzma NULL 24# define unlzma NULL
24#endif 25#endif
26#ifndef CONFIG_DECOMPRESS_LZO
27# define unlzo NULL
28#endif
25 29
26static const struct compress_format { 30static const struct compress_format {
27 unsigned char magic[2]; 31 unsigned char magic[2];
@@ -32,6 +36,7 @@ static const struct compress_format {
32 { {037, 0236}, "gzip", gunzip }, 36 { {037, 0236}, "gzip", gunzip },
33 { {0x42, 0x5a}, "bzip2", bunzip2 }, 37 { {0x42, 0x5a}, "bzip2", bunzip2 },
34 { {0x5d, 0x00}, "lzma", unlzma }, 38 { {0x5d, 0x00}, "lzma", unlzma },
39 { {0x89, 0x4c}, "lzo", unlzo },
35 { {0, 0}, NULL, NULL } 40 { {0, 0}, NULL, NULL }
36}; 41};
37 42
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
index 76074209f9a2..a4e971dee102 100644
--- a/lib/decompress_bunzip2.c
+++ b/lib/decompress_bunzip2.c
@@ -637,6 +637,8 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
637 637
638 /* Allocate bunzip_data. Most fields initialize to zero. */ 638 /* Allocate bunzip_data. Most fields initialize to zero. */
639 bd = *bdp = malloc(i); 639 bd = *bdp = malloc(i);
640 if (!bd)
641 return RETVAL_OUT_OF_MEMORY;
640 memset(bd, 0, sizeof(struct bunzip_data)); 642 memset(bd, 0, sizeof(struct bunzip_data));
641 /* Setup input buffer */ 643 /* Setup input buffer */
642 bd->inbuf = inbuf; 644 bd->inbuf = inbuf;
@@ -664,6 +666,8 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
664 bd->dbufSize = 100000*(i-BZh0); 666 bd->dbufSize = 100000*(i-BZh0);
665 667
666 bd->dbuf = large_malloc(bd->dbufSize * sizeof(int)); 668 bd->dbuf = large_malloc(bd->dbufSize * sizeof(int));
669 if (!bd->dbuf)
670 return RETVAL_OUT_OF_MEMORY;
667 return RETVAL_OK; 671 return RETVAL_OK;
668} 672}
669 673
@@ -686,7 +690,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len,
686 690
687 if (!outbuf) { 691 if (!outbuf) {
688 error("Could not allocate output bufer"); 692 error("Could not allocate output bufer");
689 return -1; 693 return RETVAL_OUT_OF_MEMORY;
690 } 694 }
691 if (buf) 695 if (buf)
692 inbuf = buf; 696 inbuf = buf;
@@ -694,6 +698,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len,
694 inbuf = malloc(BZIP2_IOBUF_SIZE); 698 inbuf = malloc(BZIP2_IOBUF_SIZE);
695 if (!inbuf) { 699 if (!inbuf) {
696 error("Could not allocate input bufer"); 700 error("Could not allocate input bufer");
701 i = RETVAL_OUT_OF_MEMORY;
697 goto exit_0; 702 goto exit_0;
698 } 703 }
699 i = start_bunzip(&bd, inbuf, len, fill); 704 i = start_bunzip(&bd, inbuf, len, fill);
@@ -720,11 +725,14 @@ STATIC int INIT bunzip2(unsigned char *buf, int len,
720 } else if (i == RETVAL_UNEXPECTED_OUTPUT_EOF) { 725 } else if (i == RETVAL_UNEXPECTED_OUTPUT_EOF) {
721 error("Compressed file ends unexpectedly"); 726 error("Compressed file ends unexpectedly");
722 } 727 }
728 if (!bd)
729 goto exit_1;
723 if (bd->dbuf) 730 if (bd->dbuf)
724 large_free(bd->dbuf); 731 large_free(bd->dbuf);
725 if (pos) 732 if (pos)
726 *pos = bd->inbufPos; 733 *pos = bd->inbufPos;
727 free(bd); 734 free(bd);
735exit_1:
728 if (!buf) 736 if (!buf)
729 free(inbuf); 737 free(inbuf);
730exit_0: 738exit_0:
diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c
new file mode 100644
index 000000000000..db521f45626e
--- /dev/null
+++ b/lib/decompress_unlzo.c
@@ -0,0 +1,209 @@
1/*
2 * LZO decompressor for the Linux kernel. Code borrowed from the lzo
3 * implementation by Markus Franz Xaver Johannes Oberhumer.
4 *
5 * Linux kernel adaptation:
6 * Copyright (C) 2009
7 * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com>
8 *
9 * Original code:
10 * Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer
11 * All Rights Reserved.
12 *
13 * lzop and the LZO library are free software; you can redistribute them
14 * and/or modify them under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; see the file COPYING.
25 * If not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 *
28 * Markus F.X.J. Oberhumer
29 * <markus@oberhumer.com>
30 * http://www.oberhumer.com/opensource/lzop/
31 */
32
33#ifdef STATIC
34#include "lzo/lzo1x_decompress.c"
35#else
36#include <linux/slab.h>
37#include <linux/decompress/unlzo.h>
38#endif
39
40#include <linux/types.h>
41#include <linux/lzo.h>
42#include <linux/decompress/mm.h>
43
44#include <linux/compiler.h>
45#include <asm/unaligned.h>
46
47static const unsigned char lzop_magic[] = {
48 0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a };
49
50#define LZO_BLOCK_SIZE (256*1024l)
51#define HEADER_HAS_FILTER 0x00000800L
52
53STATIC inline int INIT parse_header(u8 *input, u8 *skip)
54{
55 int l;
56 u8 *parse = input;
57 u8 level = 0;
58 u16 version;
59
60 /* read magic: 9 first bits */
61 for (l = 0; l < 9; l++) {
62 if (*parse++ != lzop_magic[l])
63 return 0;
64 }
65 /* get version (2bytes), skip library version (2),
66 * 'need to be extracted' version (2) and
67 * method (1) */
68 version = get_unaligned_be16(parse);
69 parse += 7;
70 if (version >= 0x0940)
71 level = *parse++;
72 if (get_unaligned_be32(parse) & HEADER_HAS_FILTER)
73 parse += 8; /* flags + filter info */
74 else
75 parse += 4; /* flags */
76
77 /* skip mode and mtime_low */
78 parse += 8;
79 if (version >= 0x0940)
80 parse += 4; /* skip mtime_high */
81
82 l = *parse++;
83 /* don't care about the file name, and skip checksum */
84 parse += l + 4;
85
86 *skip = parse - input;
87 return 1;
88}
89
90STATIC inline int INIT unlzo(u8 *input, int in_len,
91 int (*fill) (void *, unsigned int),
92 int (*flush) (void *, unsigned int),
93 u8 *output, int *posp,
94 void (*error_fn) (char *x))
95{
96 u8 skip = 0, r = 0;
97 u32 src_len, dst_len;
98 size_t tmp;
99 u8 *in_buf, *in_buf_save, *out_buf;
100 int obytes_processed = 0;
101
102 set_error_fn(error_fn);
103
104 if (output) {
105 out_buf = output;
106 } else if (!flush) {
107 error("NULL output pointer and no flush function provided");
108 goto exit;
109 } else {
110 out_buf = malloc(LZO_BLOCK_SIZE);
111 if (!out_buf) {
112 error("Could not allocate output buffer");
113 goto exit;
114 }
115 }
116
117 if (input && fill) {
118 error("Both input pointer and fill function provided, don't know what to do");
119 goto exit_1;
120 } else if (input) {
121 in_buf = input;
122 } else if (!fill || !posp) {
123 error("NULL input pointer and missing position pointer or fill function");
124 goto exit_1;
125 } else {
126 in_buf = malloc(lzo1x_worst_compress(LZO_BLOCK_SIZE));
127 if (!in_buf) {
128 error("Could not allocate input buffer");
129 goto exit_1;
130 }
131 }
132 in_buf_save = in_buf;
133
134 if (posp)
135 *posp = 0;
136
137 if (fill)
138 fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE));
139
140 if (!parse_header(input, &skip)) {
141 error("invalid header");
142 goto exit_2;
143 }
144 in_buf += skip;
145
146 if (posp)
147 *posp = skip;
148
149 for (;;) {
150 /* read uncompressed block size */
151 dst_len = get_unaligned_be32(in_buf);
152 in_buf += 4;
153
154 /* exit if last block */
155 if (dst_len == 0) {
156 if (posp)
157 *posp += 4;
158 break;
159 }
160
161 if (dst_len > LZO_BLOCK_SIZE) {
162 error("dest len longer than block size");
163 goto exit_2;
164 }
165
166 /* read compressed block size, and skip block checksum info */
167 src_len = get_unaligned_be32(in_buf);
168 in_buf += 8;
169
170 if (src_len <= 0 || src_len > dst_len) {
171 error("file corrupted");
172 goto exit_2;
173 }
174
175 /* decompress */
176 tmp = dst_len;
177 r = lzo1x_decompress_safe((u8 *) in_buf, src_len,
178 out_buf, &tmp);
179
180 if (r != LZO_E_OK || dst_len != tmp) {
181 error("Compressed data violation");
182 goto exit_2;
183 }
184
185 obytes_processed += dst_len;
186 if (flush)
187 flush(out_buf, dst_len);
188 if (output)
189 out_buf += dst_len;
190 if (posp)
191 *posp += src_len + 12;
192 if (fill) {
193 in_buf = in_buf_save;
194 fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE));
195 } else
196 in_buf += src_len;
197 }
198
199exit_2:
200 if (!input)
201 free(in_buf);
202exit_1:
203 if (!output)
204 free(out_buf);
205exit:
206 return obytes_processed;
207}
208
209#define decompress unlzo
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index d9b08e0f7f55..7d2f0b33e5a8 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -670,12 +670,13 @@ static int device_dma_allocations(struct device *dev)
670 return count; 670 return count;
671} 671}
672 672
673static int dma_debug_device_change(struct notifier_block *nb, 673static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data)
674 unsigned long action, void *data)
675{ 674{
676 struct device *dev = data; 675 struct device *dev = data;
677 int count; 676 int count;
678 677
678 if (global_disable)
679 return 0;
679 680
680 switch (action) { 681 switch (action) {
681 case BUS_NOTIFY_UNBOUND_DRIVER: 682 case BUS_NOTIFY_UNBOUND_DRIVER:
@@ -697,6 +698,9 @@ void dma_debug_add_bus(struct bus_type *bus)
697{ 698{
698 struct notifier_block *nb; 699 struct notifier_block *nb;
699 700
701 if (global_disable)
702 return;
703
700 nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); 704 nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
701 if (nb == NULL) { 705 if (nb == NULL) {
702 pr_err("dma_debug_add_bus: out of memory\n"); 706 pr_err("dma_debug_add_bus: out of memory\n");
@@ -909,6 +913,9 @@ static void check_sync(struct device *dev,
909 ref->size); 913 ref->size);
910 } 914 }
911 915
916 if (entry->direction == DMA_BIDIRECTIONAL)
917 goto out;
918
912 if (ref->direction != entry->direction) { 919 if (ref->direction != entry->direction) {
913 err_printk(dev, entry, "DMA-API: device driver syncs " 920 err_printk(dev, entry, "DMA-API: device driver syncs "
914 "DMA memory with different direction " 921 "DMA memory with different direction "
@@ -919,9 +926,6 @@ static void check_sync(struct device *dev,
919 dir2name[ref->direction]); 926 dir2name[ref->direction]);
920 } 927 }
921 928
922 if (entry->direction == DMA_BIDIRECTIONAL)
923 goto out;
924
925 if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) && 929 if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) &&
926 !(ref->direction == DMA_TO_DEVICE)) 930 !(ref->direction == DMA_TO_DEVICE))
927 err_printk(dev, entry, "DMA-API: device driver syncs " 931 err_printk(dev, entry, "DMA-API: device driver syncs "
@@ -944,7 +948,6 @@ static void check_sync(struct device *dev,
944 948
945out: 949out:
946 put_hash_bucket(bucket, &flags); 950 put_hash_bucket(bucket, &flags);
947
948} 951}
949 952
950void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, 953void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
diff --git a/lib/list_sort.c b/lib/list_sort.c
new file mode 100644
index 000000000000..19d11e0bb958
--- /dev/null
+++ b/lib/list_sort.c
@@ -0,0 +1,102 @@
1#include <linux/kernel.h>
2#include <linux/module.h>
3#include <linux/list_sort.h>
4#include <linux/slab.h>
5#include <linux/list.h>
6
7/**
8 * list_sort - sort a list.
9 * @priv: private data, passed to @cmp
10 * @head: the list to sort
11 * @cmp: the elements comparison function
12 *
13 * This function has been implemented by Mark J Roberts <mjr@znex.org>. It
14 * implements "merge sort" which has O(nlog(n)) complexity. The list is sorted
15 * in ascending order.
16 *
17 * The comparison function @cmp is supposed to return a negative value if @a is
18 * less than @b, and a positive value if @a is greater than @b. If @a and @b
19 * are equivalent, then it does not matter what this function returns.
20 */
21void list_sort(void *priv, struct list_head *head,
22 int (*cmp)(void *priv, struct list_head *a,
23 struct list_head *b))
24{
25 struct list_head *p, *q, *e, *list, *tail, *oldhead;
26 int insize, nmerges, psize, qsize, i;
27
28 if (list_empty(head))
29 return;
30
31 list = head->next;
32 list_del(head);
33 insize = 1;
34 for (;;) {
35 p = oldhead = list;
36 list = tail = NULL;
37 nmerges = 0;
38
39 while (p) {
40 nmerges++;
41 q = p;
42 psize = 0;
43 for (i = 0; i < insize; i++) {
44 psize++;
45 q = q->next == oldhead ? NULL : q->next;
46 if (!q)
47 break;
48 }
49
50 qsize = insize;
51 while (psize > 0 || (qsize > 0 && q)) {
52 if (!psize) {
53 e = q;
54 q = q->next;
55 qsize--;
56 if (q == oldhead)
57 q = NULL;
58 } else if (!qsize || !q) {
59 e = p;
60 p = p->next;
61 psize--;
62 if (p == oldhead)
63 p = NULL;
64 } else if (cmp(priv, p, q) <= 0) {
65 e = p;
66 p = p->next;
67 psize--;
68 if (p == oldhead)
69 p = NULL;
70 } else {
71 e = q;
72 q = q->next;
73 qsize--;
74 if (q == oldhead)
75 q = NULL;
76 }
77 if (tail)
78 tail->next = e;
79 else
80 list = e;
81 e->prev = tail;
82 tail = e;
83 }
84 p = q;
85 }
86
87 tail->next = list;
88 list->prev = tail;
89
90 if (nmerges <= 1)
91 break;
92
93 insize *= 2;
94 }
95
96 head->next = list;
97 head->prev = list->prev;
98 list->prev->next = head;
99 list->prev = head;
100}
101
102EXPORT_SYMBOL(list_sort);
diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c
index 5dc6b29c1575..f2fd09850223 100644
--- a/lib/lzo/lzo1x_decompress.c
+++ b/lib/lzo/lzo1x_decompress.c
@@ -11,11 +11,13 @@
11 * Richard Purdie <rpurdie@openedhand.com> 11 * Richard Purdie <rpurdie@openedhand.com>
12 */ 12 */
13 13
14#ifndef STATIC
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/lzo.h> 17#endif
17#include <asm/byteorder.h> 18
18#include <asm/unaligned.h> 19#include <asm/unaligned.h>
20#include <linux/lzo.h>
19#include "lzodefs.h" 21#include "lzodefs.h"
20 22
21#define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x)) 23#define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x))
@@ -244,9 +246,10 @@ lookbehind_overrun:
244 *out_len = op - out; 246 *out_len = op - out;
245 return LZO_E_LOOKBEHIND_OVERRUN; 247 return LZO_E_LOOKBEHIND_OVERRUN;
246} 248}
247 249#ifndef STATIC
248EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); 250EXPORT_SYMBOL_GPL(lzo1x_decompress_safe);
249 251
250MODULE_LICENSE("GPL"); 252MODULE_LICENSE("GPL");
251MODULE_DESCRIPTION("LZO1X Decompressor"); 253MODULE_DESCRIPTION("LZO1X Decompressor");
252 254
255#endif
diff --git a/lib/rational.c b/lib/rational.c
index b3c099b5478e..3ed247b80662 100644
--- a/lib/rational.c
+++ b/lib/rational.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/rational.h> 9#include <linux/rational.h>
10#include <linux/module.h>
10 11
11/* 12/*
12 * calculate best rational approximation for a given fraction 13 * calculate best rational approximation for a given fraction
diff --git a/lib/string.c b/lib/string.c
index afce96af3afd..9f75b4ec50b8 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -338,10 +338,10 @@ EXPORT_SYMBOL(strnchr);
338#endif 338#endif
339 339
340/** 340/**
341 * skip_spaces - Removes leading whitespace from @s. 341 * skip_spaces - Removes leading whitespace from @str.
342 * @s: The string to be stripped. 342 * @str: The string to be stripped.
343 * 343 *
344 * Returns a pointer to the first non-whitespace character in @s. 344 * Returns a pointer to the first non-whitespace character in @str.
345 */ 345 */
346char *skip_spaces(const char *str) 346char *skip_spaces(const char *str)
347{ 347{
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 735343fc857a..3b8aeec4e327 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -903,7 +903,7 @@ static char *uuid_string(char *buf, char *end, const u8 *addr,
903 * IPv6 omits the colons (01020304...0f) 903 * IPv6 omits the colons (01020304...0f)
904 * IPv4 uses dot-separated decimal with leading 0's (010.123.045.006) 904 * IPv4 uses dot-separated decimal with leading 0's (010.123.045.006)
905 * - 'I6c' for IPv6 addresses printed as specified by 905 * - 'I6c' for IPv6 addresses printed as specified by
906 * http://www.ietf.org/id/draft-kawamura-ipv6-text-representation-03.txt 906 * http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00
907 * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form 907 * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form
908 * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 908 * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
909 * Options for %pU are: 909 * Options for %pU are:
@@ -1179,7 +1179,18 @@ qualifier:
1179 * %ps output the name of a text symbol without offset 1179 * %ps output the name of a text symbol without offset
1180 * %pF output the name of a function pointer with its offset 1180 * %pF output the name of a function pointer with its offset
1181 * %pf output the name of a function pointer without its offset 1181 * %pf output the name of a function pointer without its offset
1182 * %pR output the address range in a struct resource 1182 * %pR output the address range in a struct resource with decoded flags
1183 * %pr output the address range in a struct resource with raw flags
1184 * %pM output a 6-byte MAC address with colons
1185 * %pm output a 6-byte MAC address without colons
1186 * %pI4 print an IPv4 address without leading zeros
1187 * %pi4 print an IPv4 address with leading zeros
1188 * %pI6 print an IPv6 address with colons
1189 * %pi6 print an IPv6 address without colons
1190 * %pI6c print an IPv6 address as specified by
1191 * http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-00
1192 * %pU[bBlL] print a UUID/GUID in big or little endian using lower or upper
1193 * case.
1183 * %n is ignored 1194 * %n is ignored
1184 * 1195 *
1185 * The return value is the number of characters which would 1196 * The return value is the number of characters which would
diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
index 8550b0c05d00..05e1559fa156 100644
--- a/lib/zlib_inflate/inffast.c
+++ b/lib/zlib_inflate/inffast.c
@@ -4,6 +4,8 @@
4 */ 4 */
5 5
6#include <linux/zutil.h> 6#include <linux/zutil.h>
7#include <asm/unaligned.h>
8#include <asm/byteorder.h>
7#include "inftrees.h" 9#include "inftrees.h"
8#include "inflate.h" 10#include "inflate.h"
9#include "inffast.h" 11#include "inffast.h"
@@ -24,9 +26,11 @@
24#ifdef POSTINC 26#ifdef POSTINC
25# define OFF 0 27# define OFF 0
26# define PUP(a) *(a)++ 28# define PUP(a) *(a)++
29# define UP_UNALIGNED(a) get_unaligned((a)++)
27#else 30#else
28# define OFF 1 31# define OFF 1
29# define PUP(a) *++(a) 32# define PUP(a) *++(a)
33# define UP_UNALIGNED(a) get_unaligned(++(a))
30#endif 34#endif
31 35
32/* 36/*
@@ -239,18 +243,47 @@ void inflate_fast(z_streamp strm, unsigned start)
239 } 243 }
240 } 244 }
241 else { 245 else {
246 unsigned short *sout;
247 unsigned long loops;
248
242 from = out - dist; /* copy direct from output */ 249 from = out - dist; /* copy direct from output */
243 do { /* minimum length is three */ 250 /* minimum length is three */
244 PUP(out) = PUP(from); 251 /* Align out addr */
245 PUP(out) = PUP(from); 252 if (!((long)(out - 1 + OFF) & 1)) {
246 PUP(out) = PUP(from); 253 PUP(out) = PUP(from);
247 len -= 3; 254 len--;
248 } while (len > 2); 255 }
249 if (len) { 256 sout = (unsigned short *)(out - OFF);
250 PUP(out) = PUP(from); 257 if (dist > 2) {
251 if (len > 1) 258 unsigned short *sfrom;
252 PUP(out) = PUP(from); 259
253 } 260 sfrom = (unsigned short *)(from - OFF);
261 loops = len >> 1;
262 do
263 PUP(sout) = UP_UNALIGNED(sfrom);
264 while (--loops);
265 out = (unsigned char *)sout + OFF;
266 from = (unsigned char *)sfrom + OFF;
267 } else { /* dist == 1 or dist == 2 */
268 unsigned short pat16;
269
270 pat16 = *(sout-2+2*OFF);
271 if (dist == 1)
272#if defined(__BIG_ENDIAN)
273 pat16 = (pat16 & 0xff) | ((pat16 & 0xff) << 8);
274#elif defined(__LITTLE_ENDIAN)
275 pat16 = (pat16 & 0xff00) | ((pat16 & 0xff00) >> 8);
276#else
277#error __BIG_ENDIAN nor __LITTLE_ENDIAN is defined
278#endif
279 loops = len >> 1;
280 do
281 PUP(sout) = pat16;
282 while (--loops);
283 out = (unsigned char *)sout + OFF;
284 }
285 if (len & 1)
286 PUP(out) = PUP(from);
254 } 287 }
255 } 288 }
256 else if ((op & 64) == 0) { /* 2nd level distance code */ 289 else if ((op & 64) == 0) { /* 2nd level distance code */
diff --git a/mm/Kconfig b/mm/Kconfig
index 43ea8c3a2bbf..17b8947aa7da 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -221,6 +221,7 @@ config KSM
221 221
222config DEFAULT_MMAP_MIN_ADDR 222config DEFAULT_MMAP_MIN_ADDR
223 int "Low address space to protect from user allocation" 223 int "Low address space to protect from user allocation"
224 depends on MMU
224 default 4096 225 default 4096
225 help 226 help
226 This is the portion of low virtual memory which should be protected 227 This is the portion of low virtual memory which should be protected
@@ -252,7 +253,7 @@ config MEMORY_FAILURE
252 253
253config HWPOISON_INJECT 254config HWPOISON_INJECT
254 tristate "HWPoison pages injector" 255 tristate "HWPoison pages injector"
255 depends on MEMORY_FAILURE && DEBUG_KERNEL 256 depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
256 select PROC_PAGE_MONITOR 257 select PROC_PAGE_MONITOR
257 258
258config NOMMU_INITIAL_TRIM_EXCESS 259config NOMMU_INITIAL_TRIM_EXCESS
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 65f38c218207..e91b81b63670 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -402,7 +402,7 @@ static void clear_huge_page(struct page *page,
402{ 402{
403 int i; 403 int i;
404 404
405 if (unlikely(sz > MAX_ORDER_NR_PAGES)) { 405 if (unlikely(sz/PAGE_SIZE > MAX_ORDER_NR_PAGES)) {
406 clear_gigantic_page(page, addr, sz); 406 clear_gigantic_page(page, addr, sz);
407 return; 407 return;
408 } 408 }
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 13f33b3081ec..5b069e4f5e48 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -93,6 +93,7 @@
93#include <linux/nodemask.h> 93#include <linux/nodemask.h>
94#include <linux/mm.h> 94#include <linux/mm.h>
95#include <linux/workqueue.h> 95#include <linux/workqueue.h>
96#include <linux/crc32.h>
96 97
97#include <asm/sections.h> 98#include <asm/sections.h>
98#include <asm/processor.h> 99#include <asm/processor.h>
@@ -108,7 +109,6 @@
108#define MSECS_MIN_AGE 5000 /* minimum object age for reporting */ 109#define MSECS_MIN_AGE 5000 /* minimum object age for reporting */
109#define SECS_FIRST_SCAN 60 /* delay before the first scan */ 110#define SECS_FIRST_SCAN 60 /* delay before the first scan */
110#define SECS_SCAN_WAIT 600 /* subsequent auto scanning delay */ 111#define SECS_SCAN_WAIT 600 /* subsequent auto scanning delay */
111#define GRAY_LIST_PASSES 25 /* maximum number of gray list scans */
112#define MAX_SCAN_SIZE 4096 /* maximum size of a scanned block */ 112#define MAX_SCAN_SIZE 4096 /* maximum size of a scanned block */
113 113
114#define BYTES_PER_POINTER sizeof(void *) 114#define BYTES_PER_POINTER sizeof(void *)
@@ -119,8 +119,8 @@
119/* scanning area inside a memory block */ 119/* scanning area inside a memory block */
120struct kmemleak_scan_area { 120struct kmemleak_scan_area {
121 struct hlist_node node; 121 struct hlist_node node;
122 unsigned long offset; 122 unsigned long start;
123 size_t length; 123 size_t size;
124}; 124};
125 125
126#define KMEMLEAK_GREY 0 126#define KMEMLEAK_GREY 0
@@ -149,6 +149,8 @@ struct kmemleak_object {
149 int min_count; 149 int min_count;
150 /* the total number of pointers found pointing to this object */ 150 /* the total number of pointers found pointing to this object */
151 int count; 151 int count;
152 /* checksum for detecting modified objects */
153 u32 checksum;
152 /* memory ranges to be scanned inside an object (empty for all) */ 154 /* memory ranges to be scanned inside an object (empty for all) */
153 struct hlist_head area_list; 155 struct hlist_head area_list;
154 unsigned long trace[MAX_TRACE]; 156 unsigned long trace[MAX_TRACE];
@@ -164,8 +166,6 @@ struct kmemleak_object {
164#define OBJECT_REPORTED (1 << 1) 166#define OBJECT_REPORTED (1 << 1)
165/* flag set to not scan the object */ 167/* flag set to not scan the object */
166#define OBJECT_NO_SCAN (1 << 2) 168#define OBJECT_NO_SCAN (1 << 2)
167/* flag set on newly allocated objects */
168#define OBJECT_NEW (1 << 3)
169 169
170/* number of bytes to print per line; must be 16 or 32 */ 170/* number of bytes to print per line; must be 16 or 32 */
171#define HEX_ROW_SIZE 16 171#define HEX_ROW_SIZE 16
@@ -241,8 +241,6 @@ struct early_log {
241 const void *ptr; /* allocated/freed memory block */ 241 const void *ptr; /* allocated/freed memory block */
242 size_t size; /* memory block size */ 242 size_t size; /* memory block size */
243 int min_count; /* minimum reference count */ 243 int min_count; /* minimum reference count */
244 unsigned long offset; /* scan area offset */
245 size_t length; /* scan area length */
246 unsigned long trace[MAX_TRACE]; /* stack trace */ 244 unsigned long trace[MAX_TRACE]; /* stack trace */
247 unsigned int trace_len; /* stack trace length */ 245 unsigned int trace_len; /* stack trace length */
248}; 246};
@@ -323,11 +321,6 @@ static bool color_gray(const struct kmemleak_object *object)
323 object->count >= object->min_count; 321 object->count >= object->min_count;
324} 322}
325 323
326static bool color_black(const struct kmemleak_object *object)
327{
328 return object->min_count == KMEMLEAK_BLACK;
329}
330
331/* 324/*
332 * Objects are considered unreferenced only if their color is white, they have 325 * Objects are considered unreferenced only if their color is white, they have
333 * not be deleted and have a minimum age to avoid false positives caused by 326 * not be deleted and have a minimum age to avoid false positives caused by
@@ -335,7 +328,7 @@ static bool color_black(const struct kmemleak_object *object)
335 */ 328 */
336static bool unreferenced_object(struct kmemleak_object *object) 329static bool unreferenced_object(struct kmemleak_object *object)
337{ 330{
338 return (object->flags & OBJECT_ALLOCATED) && color_white(object) && 331 return (color_white(object) && object->flags & OBJECT_ALLOCATED) &&
339 time_before_eq(object->jiffies + jiffies_min_age, 332 time_before_eq(object->jiffies + jiffies_min_age,
340 jiffies_last_scan); 333 jiffies_last_scan);
341} 334}
@@ -348,11 +341,13 @@ static void print_unreferenced(struct seq_file *seq,
348 struct kmemleak_object *object) 341 struct kmemleak_object *object)
349{ 342{
350 int i; 343 int i;
344 unsigned int msecs_age = jiffies_to_msecs(jiffies - object->jiffies);
351 345
352 seq_printf(seq, "unreferenced object 0x%08lx (size %zu):\n", 346 seq_printf(seq, "unreferenced object 0x%08lx (size %zu):\n",
353 object->pointer, object->size); 347 object->pointer, object->size);
354 seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu\n", 348 seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu (age %d.%03ds)\n",
355 object->comm, object->pid, object->jiffies); 349 object->comm, object->pid, object->jiffies,
350 msecs_age / 1000, msecs_age % 1000);
356 hex_dump_object(seq, object); 351 hex_dump_object(seq, object);
357 seq_printf(seq, " backtrace:\n"); 352 seq_printf(seq, " backtrace:\n");
358 353
@@ -381,6 +376,7 @@ static void dump_object_info(struct kmemleak_object *object)
381 pr_notice(" min_count = %d\n", object->min_count); 376 pr_notice(" min_count = %d\n", object->min_count);
382 pr_notice(" count = %d\n", object->count); 377 pr_notice(" count = %d\n", object->count);
383 pr_notice(" flags = 0x%lx\n", object->flags); 378 pr_notice(" flags = 0x%lx\n", object->flags);
379 pr_notice(" checksum = %d\n", object->checksum);
384 pr_notice(" backtrace:\n"); 380 pr_notice(" backtrace:\n");
385 print_stack_trace(&trace, 4); 381 print_stack_trace(&trace, 4);
386} 382}
@@ -522,12 +518,13 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
522 INIT_HLIST_HEAD(&object->area_list); 518 INIT_HLIST_HEAD(&object->area_list);
523 spin_lock_init(&object->lock); 519 spin_lock_init(&object->lock);
524 atomic_set(&object->use_count, 1); 520 atomic_set(&object->use_count, 1);
525 object->flags = OBJECT_ALLOCATED | OBJECT_NEW; 521 object->flags = OBJECT_ALLOCATED;
526 object->pointer = ptr; 522 object->pointer = ptr;
527 object->size = size; 523 object->size = size;
528 object->min_count = min_count; 524 object->min_count = min_count;
529 object->count = -1; /* no color initially */ 525 object->count = 0; /* white color initially */
530 object->jiffies = jiffies; 526 object->jiffies = jiffies;
527 object->checksum = 0;
531 528
532 /* task information */ 529 /* task information */
533 if (in_irq()) { 530 if (in_irq()) {
@@ -720,14 +717,13 @@ static void make_black_object(unsigned long ptr)
720 * Add a scanning area to the object. If at least one such area is added, 717 * Add a scanning area to the object. If at least one such area is added,
721 * kmemleak will only scan these ranges rather than the whole memory block. 718 * kmemleak will only scan these ranges rather than the whole memory block.
722 */ 719 */
723static void add_scan_area(unsigned long ptr, unsigned long offset, 720static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp)
724 size_t length, gfp_t gfp)
725{ 721{
726 unsigned long flags; 722 unsigned long flags;
727 struct kmemleak_object *object; 723 struct kmemleak_object *object;
728 struct kmemleak_scan_area *area; 724 struct kmemleak_scan_area *area;
729 725
730 object = find_and_get_object(ptr, 0); 726 object = find_and_get_object(ptr, 1);
731 if (!object) { 727 if (!object) {
732 kmemleak_warn("Adding scan area to unknown object at 0x%08lx\n", 728 kmemleak_warn("Adding scan area to unknown object at 0x%08lx\n",
733 ptr); 729 ptr);
@@ -741,7 +737,7 @@ static void add_scan_area(unsigned long ptr, unsigned long offset,
741 } 737 }
742 738
743 spin_lock_irqsave(&object->lock, flags); 739 spin_lock_irqsave(&object->lock, flags);
744 if (offset + length > object->size) { 740 if (ptr + size > object->pointer + object->size) {
745 kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr); 741 kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr);
746 dump_object_info(object); 742 dump_object_info(object);
747 kmem_cache_free(scan_area_cache, area); 743 kmem_cache_free(scan_area_cache, area);
@@ -749,8 +745,8 @@ static void add_scan_area(unsigned long ptr, unsigned long offset,
749 } 745 }
750 746
751 INIT_HLIST_NODE(&area->node); 747 INIT_HLIST_NODE(&area->node);
752 area->offset = offset; 748 area->start = ptr;
753 area->length = length; 749 area->size = size;
754 750
755 hlist_add_head(&area->node, &object->area_list); 751 hlist_add_head(&area->node, &object->area_list);
756out_unlock: 752out_unlock:
@@ -786,7 +782,7 @@ static void object_no_scan(unsigned long ptr)
786 * processed later once kmemleak is fully initialized. 782 * processed later once kmemleak is fully initialized.
787 */ 783 */
788static void __init log_early(int op_type, const void *ptr, size_t size, 784static void __init log_early(int op_type, const void *ptr, size_t size,
789 int min_count, unsigned long offset, size_t length) 785 int min_count)
790{ 786{
791 unsigned long flags; 787 unsigned long flags;
792 struct early_log *log; 788 struct early_log *log;
@@ -808,8 +804,6 @@ static void __init log_early(int op_type, const void *ptr, size_t size,
808 log->ptr = ptr; 804 log->ptr = ptr;
809 log->size = size; 805 log->size = size;
810 log->min_count = min_count; 806 log->min_count = min_count;
811 log->offset = offset;
812 log->length = length;
813 if (op_type == KMEMLEAK_ALLOC) 807 if (op_type == KMEMLEAK_ALLOC)
814 log->trace_len = __save_stack_trace(log->trace); 808 log->trace_len = __save_stack_trace(log->trace);
815 crt_early_log++; 809 crt_early_log++;
@@ -858,7 +852,7 @@ void __ref kmemleak_alloc(const void *ptr, size_t size, int min_count,
858 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 852 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
859 create_object((unsigned long)ptr, size, min_count, gfp); 853 create_object((unsigned long)ptr, size, min_count, gfp);
860 else if (atomic_read(&kmemleak_early_log)) 854 else if (atomic_read(&kmemleak_early_log))
861 log_early(KMEMLEAK_ALLOC, ptr, size, min_count, 0, 0); 855 log_early(KMEMLEAK_ALLOC, ptr, size, min_count);
862} 856}
863EXPORT_SYMBOL_GPL(kmemleak_alloc); 857EXPORT_SYMBOL_GPL(kmemleak_alloc);
864 858
@@ -873,7 +867,7 @@ void __ref kmemleak_free(const void *ptr)
873 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 867 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
874 delete_object_full((unsigned long)ptr); 868 delete_object_full((unsigned long)ptr);
875 else if (atomic_read(&kmemleak_early_log)) 869 else if (atomic_read(&kmemleak_early_log))
876 log_early(KMEMLEAK_FREE, ptr, 0, 0, 0, 0); 870 log_early(KMEMLEAK_FREE, ptr, 0, 0);
877} 871}
878EXPORT_SYMBOL_GPL(kmemleak_free); 872EXPORT_SYMBOL_GPL(kmemleak_free);
879 873
@@ -888,7 +882,7 @@ void __ref kmemleak_free_part(const void *ptr, size_t size)
888 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 882 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
889 delete_object_part((unsigned long)ptr, size); 883 delete_object_part((unsigned long)ptr, size);
890 else if (atomic_read(&kmemleak_early_log)) 884 else if (atomic_read(&kmemleak_early_log))
891 log_early(KMEMLEAK_FREE_PART, ptr, size, 0, 0, 0); 885 log_early(KMEMLEAK_FREE_PART, ptr, size, 0);
892} 886}
893EXPORT_SYMBOL_GPL(kmemleak_free_part); 887EXPORT_SYMBOL_GPL(kmemleak_free_part);
894 888
@@ -903,7 +897,7 @@ void __ref kmemleak_not_leak(const void *ptr)
903 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 897 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
904 make_gray_object((unsigned long)ptr); 898 make_gray_object((unsigned long)ptr);
905 else if (atomic_read(&kmemleak_early_log)) 899 else if (atomic_read(&kmemleak_early_log))
906 log_early(KMEMLEAK_NOT_LEAK, ptr, 0, 0, 0, 0); 900 log_early(KMEMLEAK_NOT_LEAK, ptr, 0, 0);
907} 901}
908EXPORT_SYMBOL(kmemleak_not_leak); 902EXPORT_SYMBOL(kmemleak_not_leak);
909 903
@@ -919,22 +913,21 @@ void __ref kmemleak_ignore(const void *ptr)
919 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 913 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
920 make_black_object((unsigned long)ptr); 914 make_black_object((unsigned long)ptr);
921 else if (atomic_read(&kmemleak_early_log)) 915 else if (atomic_read(&kmemleak_early_log))
922 log_early(KMEMLEAK_IGNORE, ptr, 0, 0, 0, 0); 916 log_early(KMEMLEAK_IGNORE, ptr, 0, 0);
923} 917}
924EXPORT_SYMBOL(kmemleak_ignore); 918EXPORT_SYMBOL(kmemleak_ignore);
925 919
926/* 920/*
927 * Limit the range to be scanned in an allocated memory block. 921 * Limit the range to be scanned in an allocated memory block.
928 */ 922 */
929void __ref kmemleak_scan_area(const void *ptr, unsigned long offset, 923void __ref kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp)
930 size_t length, gfp_t gfp)
931{ 924{
932 pr_debug("%s(0x%p)\n", __func__, ptr); 925 pr_debug("%s(0x%p)\n", __func__, ptr);
933 926
934 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 927 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
935 add_scan_area((unsigned long)ptr, offset, length, gfp); 928 add_scan_area((unsigned long)ptr, size, gfp);
936 else if (atomic_read(&kmemleak_early_log)) 929 else if (atomic_read(&kmemleak_early_log))
937 log_early(KMEMLEAK_SCAN_AREA, ptr, 0, 0, offset, length); 930 log_early(KMEMLEAK_SCAN_AREA, ptr, size, 0);
938} 931}
939EXPORT_SYMBOL(kmemleak_scan_area); 932EXPORT_SYMBOL(kmemleak_scan_area);
940 933
@@ -948,11 +941,25 @@ void __ref kmemleak_no_scan(const void *ptr)
948 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) 941 if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr))
949 object_no_scan((unsigned long)ptr); 942 object_no_scan((unsigned long)ptr);
950 else if (atomic_read(&kmemleak_early_log)) 943 else if (atomic_read(&kmemleak_early_log))
951 log_early(KMEMLEAK_NO_SCAN, ptr, 0, 0, 0, 0); 944 log_early(KMEMLEAK_NO_SCAN, ptr, 0, 0);
952} 945}
953EXPORT_SYMBOL(kmemleak_no_scan); 946EXPORT_SYMBOL(kmemleak_no_scan);
954 947
955/* 948/*
949 * Update an object's checksum and return true if it was modified.
950 */
951static bool update_checksum(struct kmemleak_object *object)
952{
953 u32 old_csum = object->checksum;
954
955 if (!kmemcheck_is_obj_initialized(object->pointer, object->size))
956 return false;
957
958 object->checksum = crc32(0, (void *)object->pointer, object->size);
959 return object->checksum != old_csum;
960}
961
962/*
956 * Memory scanning is a long process and it needs to be interruptable. This 963 * Memory scanning is a long process and it needs to be interruptable. This
957 * function checks whether such interrupt condition occured. 964 * function checks whether such interrupt condition occured.
958 */ 965 */
@@ -1031,11 +1038,14 @@ static void scan_block(void *_start, void *_end,
1031 * added to the gray_list. 1038 * added to the gray_list.
1032 */ 1039 */
1033 object->count++; 1040 object->count++;
1034 if (color_gray(object)) 1041 if (color_gray(object)) {
1035 list_add_tail(&object->gray_list, &gray_list); 1042 list_add_tail(&object->gray_list, &gray_list);
1036 else 1043 spin_unlock_irqrestore(&object->lock, flags);
1037 put_object(object); 1044 continue;
1045 }
1046
1038 spin_unlock_irqrestore(&object->lock, flags); 1047 spin_unlock_irqrestore(&object->lock, flags);
1048 put_object(object);
1039 } 1049 }
1040} 1050}
1041 1051
@@ -1075,14 +1085,47 @@ static void scan_object(struct kmemleak_object *object)
1075 } 1085 }
1076 } else 1086 } else
1077 hlist_for_each_entry(area, elem, &object->area_list, node) 1087 hlist_for_each_entry(area, elem, &object->area_list, node)
1078 scan_block((void *)(object->pointer + area->offset), 1088 scan_block((void *)area->start,
1079 (void *)(object->pointer + area->offset 1089 (void *)(area->start + area->size),
1080 + area->length), object, 0); 1090 object, 0);
1081out: 1091out:
1082 spin_unlock_irqrestore(&object->lock, flags); 1092 spin_unlock_irqrestore(&object->lock, flags);
1083} 1093}
1084 1094
1085/* 1095/*
1096 * Scan the objects already referenced (gray objects). More objects will be
1097 * referenced and, if there are no memory leaks, all the objects are scanned.
1098 */
1099static void scan_gray_list(void)
1100{
1101 struct kmemleak_object *object, *tmp;
1102
1103 /*
1104 * The list traversal is safe for both tail additions and removals
1105 * from inside the loop. The kmemleak objects cannot be freed from
1106 * outside the loop because their use_count was incremented.
1107 */
1108 object = list_entry(gray_list.next, typeof(*object), gray_list);
1109 while (&object->gray_list != &gray_list) {
1110 cond_resched();
1111
1112 /* may add new objects to the list */
1113 if (!scan_should_stop())
1114 scan_object(object);
1115
1116 tmp = list_entry(object->gray_list.next, typeof(*object),
1117 gray_list);
1118
1119 /* remove the object from the list and release it */
1120 list_del(&object->gray_list);
1121 put_object(object);
1122
1123 object = tmp;
1124 }
1125 WARN_ON(!list_empty(&gray_list));
1126}
1127
1128/*
1086 * Scan data sections and all the referenced memory blocks allocated via the 1129 * Scan data sections and all the referenced memory blocks allocated via the
1087 * kernel's standard allocators. This function must be called with the 1130 * kernel's standard allocators. This function must be called with the
1088 * scan_mutex held. 1131 * scan_mutex held.
@@ -1090,10 +1133,9 @@ out:
1090static void kmemleak_scan(void) 1133static void kmemleak_scan(void)
1091{ 1134{
1092 unsigned long flags; 1135 unsigned long flags;
1093 struct kmemleak_object *object, *tmp; 1136 struct kmemleak_object *object;
1094 int i; 1137 int i;
1095 int new_leaks = 0; 1138 int new_leaks = 0;
1096 int gray_list_pass = 0;
1097 1139
1098 jiffies_last_scan = jiffies; 1140 jiffies_last_scan = jiffies;
1099 1141
@@ -1114,7 +1156,6 @@ static void kmemleak_scan(void)
1114#endif 1156#endif
1115 /* reset the reference count (whiten the object) */ 1157 /* reset the reference count (whiten the object) */
1116 object->count = 0; 1158 object->count = 0;
1117 object->flags &= ~OBJECT_NEW;
1118 if (color_gray(object) && get_object(object)) 1159 if (color_gray(object) && get_object(object))
1119 list_add_tail(&object->gray_list, &gray_list); 1160 list_add_tail(&object->gray_list, &gray_list);
1120 1161
@@ -1172,62 +1213,36 @@ static void kmemleak_scan(void)
1172 1213
1173 /* 1214 /*
1174 * Scan the objects already referenced from the sections scanned 1215 * Scan the objects already referenced from the sections scanned
1175 * above. More objects will be referenced and, if there are no memory 1216 * above.
1176 * leaks, all the objects will be scanned. The list traversal is safe
1177 * for both tail additions and removals from inside the loop. The
1178 * kmemleak objects cannot be freed from outside the loop because their
1179 * use_count was increased.
1180 */ 1217 */
1181repeat: 1218 scan_gray_list();
1182 object = list_entry(gray_list.next, typeof(*object), gray_list);
1183 while (&object->gray_list != &gray_list) {
1184 cond_resched();
1185
1186 /* may add new objects to the list */
1187 if (!scan_should_stop())
1188 scan_object(object);
1189
1190 tmp = list_entry(object->gray_list.next, typeof(*object),
1191 gray_list);
1192
1193 /* remove the object from the list and release it */
1194 list_del(&object->gray_list);
1195 put_object(object);
1196
1197 object = tmp;
1198 }
1199
1200 if (scan_should_stop() || ++gray_list_pass >= GRAY_LIST_PASSES)
1201 goto scan_end;
1202 1219
1203 /* 1220 /*
1204 * Check for new objects allocated during this scanning and add them 1221 * Check for new or unreferenced objects modified since the previous
1205 * to the gray list. 1222 * scan and color them gray until the next scan.
1206 */ 1223 */
1207 rcu_read_lock(); 1224 rcu_read_lock();
1208 list_for_each_entry_rcu(object, &object_list, object_list) { 1225 list_for_each_entry_rcu(object, &object_list, object_list) {
1209 spin_lock_irqsave(&object->lock, flags); 1226 spin_lock_irqsave(&object->lock, flags);
1210 if ((object->flags & OBJECT_NEW) && !color_black(object) && 1227 if (color_white(object) && (object->flags & OBJECT_ALLOCATED)
1211 get_object(object)) { 1228 && update_checksum(object) && get_object(object)) {
1212 object->flags &= ~OBJECT_NEW; 1229 /* color it gray temporarily */
1230 object->count = object->min_count;
1213 list_add_tail(&object->gray_list, &gray_list); 1231 list_add_tail(&object->gray_list, &gray_list);
1214 } 1232 }
1215 spin_unlock_irqrestore(&object->lock, flags); 1233 spin_unlock_irqrestore(&object->lock, flags);
1216 } 1234 }
1217 rcu_read_unlock(); 1235 rcu_read_unlock();
1218 1236
1219 if (!list_empty(&gray_list)) 1237 /*
1220 goto repeat; 1238 * Re-scan the gray list for modified unreferenced objects.
1221 1239 */
1222scan_end: 1240 scan_gray_list();
1223 WARN_ON(!list_empty(&gray_list));
1224 1241
1225 /* 1242 /*
1226 * If scanning was stopped or new objects were being allocated at a 1243 * If scanning was stopped do not report any new unreferenced objects.
1227 * higher rate than gray list scanning, do not report any new
1228 * unreferenced objects.
1229 */ 1244 */
1230 if (scan_should_stop() || gray_list_pass >= GRAY_LIST_PASSES) 1245 if (scan_should_stop())
1231 return; 1246 return;
1232 1247
1233 /* 1248 /*
@@ -1642,8 +1657,7 @@ void __init kmemleak_init(void)
1642 kmemleak_ignore(log->ptr); 1657 kmemleak_ignore(log->ptr);
1643 break; 1658 break;
1644 case KMEMLEAK_SCAN_AREA: 1659 case KMEMLEAK_SCAN_AREA:
1645 kmemleak_scan_area(log->ptr, log->offset, log->length, 1660 kmemleak_scan_area(log->ptr, log->size, GFP_KERNEL);
1646 GFP_KERNEL);
1647 break; 1661 break;
1648 case KMEMLEAK_NO_SCAN: 1662 case KMEMLEAK_NO_SCAN:
1649 kmemleak_no_scan(log->ptr); 1663 kmemleak_no_scan(log->ptr);
diff --git a/mm/maccess.c b/mm/maccess.c
index 9073695ff25f..4e348dbaecd7 100644
--- a/mm/maccess.c
+++ b/mm/maccess.c
@@ -14,7 +14,11 @@
14 * Safely read from address @src to the buffer at @dst. If a kernel fault 14 * Safely read from address @src to the buffer at @dst. If a kernel fault
15 * happens, handle that and return -EFAULT. 15 * happens, handle that and return -EFAULT.
16 */ 16 */
17long probe_kernel_read(void *dst, void *src, size_t size) 17
18long __weak probe_kernel_read(void *dst, void *src, size_t size)
19 __attribute__((alias("__probe_kernel_read")));
20
21long __probe_kernel_read(void *dst, void *src, size_t size)
18{ 22{
19 long ret; 23 long ret;
20 mm_segment_t old_fs = get_fs(); 24 mm_segment_t old_fs = get_fs();
@@ -39,7 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read);
39 * Safely write to address @dst from the buffer at @src. If a kernel fault 43 * Safely write to address @dst from the buffer at @src. If a kernel fault
40 * happens, handle that and return -EFAULT. 44 * happens, handle that and return -EFAULT.
41 */ 45 */
42long notrace __weak probe_kernel_write(void *dst, void *src, size_t size) 46long __weak probe_kernel_write(void *dst, void *src, size_t size)
47 __attribute__((alias("__probe_kernel_write")));
48
49long __probe_kernel_write(void *dst, void *src, size_t size)
43{ 50{
44 long ret; 51 long ret;
45 mm_segment_t old_fs = get_fs(); 52 mm_segment_t old_fs = get_fs();
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 6a0466ed5bfd..17299fd4577c 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -52,6 +52,8 @@ int sysctl_memory_failure_recovery __read_mostly = 1;
52 52
53atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0); 53atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0);
54 54
55#if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE)
56
55u32 hwpoison_filter_enable = 0; 57u32 hwpoison_filter_enable = 0;
56u32 hwpoison_filter_dev_major = ~0U; 58u32 hwpoison_filter_dev_major = ~0U;
57u32 hwpoison_filter_dev_minor = ~0U; 59u32 hwpoison_filter_dev_minor = ~0U;
@@ -164,6 +166,13 @@ int hwpoison_filter(struct page *p)
164 166
165 return 0; 167 return 0;
166} 168}
169#else
170int hwpoison_filter(struct page *p)
171{
172 return 0;
173}
174#endif
175
167EXPORT_SYMBOL_GPL(hwpoison_filter); 176EXPORT_SYMBOL_GPL(hwpoison_filter);
168 177
169/* 178/*
diff --git a/mm/mmap.c b/mm/mmap.c
index d9c77b2dbe9d..ee2298936fe6 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1043,6 +1043,46 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1043} 1043}
1044EXPORT_SYMBOL(do_mmap_pgoff); 1044EXPORT_SYMBOL(do_mmap_pgoff);
1045 1045
1046SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1047 unsigned long, prot, unsigned long, flags,
1048 unsigned long, fd, unsigned long, pgoff)
1049{
1050 struct file *file = NULL;
1051 unsigned long retval = -EBADF;
1052
1053 if (!(flags & MAP_ANONYMOUS)) {
1054 if (unlikely(flags & MAP_HUGETLB))
1055 return -EINVAL;
1056 file = fget(fd);
1057 if (!file)
1058 goto out;
1059 } else if (flags & MAP_HUGETLB) {
1060 struct user_struct *user = NULL;
1061 /*
1062 * VM_NORESERVE is used because the reservations will be
1063 * taken when vm_ops->mmap() is called
1064 * A dummy user value is used because we are not locking
1065 * memory so no accounting is necessary
1066 */
1067 len = ALIGN(len, huge_page_size(&default_hstate));
1068 file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE,
1069 &user, HUGETLB_ANONHUGE_INODE);
1070 if (IS_ERR(file))
1071 return PTR_ERR(file);
1072 }
1073
1074 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
1075
1076 down_write(&current->mm->mmap_sem);
1077 retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
1078 up_write(&current->mm->mmap_sem);
1079
1080 if (file)
1081 fput(file);
1082out:
1083 return retval;
1084}
1085
1046/* 1086/*
1047 * Some shared mappigns will want the pages marked read-only 1087 * Some shared mappigns will want the pages marked read-only
1048 * to track write events. If so, we'll downgrade vm_page_prot 1088 * to track write events. If so, we'll downgrade vm_page_prot
diff --git a/mm/nommu.c b/mm/nommu.c
index 8687973462bb..17773862619b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -432,6 +432,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
432 /* 432 /*
433 * Ok, looks good - let it rip. 433 * Ok, looks good - let it rip.
434 */ 434 */
435 flush_icache_range(mm->brk, brk);
435 return mm->brk = brk; 436 return mm->brk = brk;
436} 437}
437 438
@@ -1353,10 +1354,14 @@ unsigned long do_mmap_pgoff(struct file *file,
1353share: 1354share:
1354 add_vma_to_mm(current->mm, vma); 1355 add_vma_to_mm(current->mm, vma);
1355 1356
1356 up_write(&nommu_region_sem); 1357 /* we flush the region from the icache only when the first executable
1358 * mapping of it is made */
1359 if (vma->vm_flags & VM_EXEC && !region->vm_icache_flushed) {
1360 flush_icache_range(region->vm_start, region->vm_end);
1361 region->vm_icache_flushed = true;
1362 }
1357 1363
1358 if (prot & PROT_EXEC) 1364 up_write(&nommu_region_sem);
1359 flush_icache_range(result, result + len);
1360 1365
1361 kleave(" = %lx", result); 1366 kleave(" = %lx", result);
1362 return result; 1367 return result;
@@ -1398,6 +1403,31 @@ error_getting_region:
1398} 1403}
1399EXPORT_SYMBOL(do_mmap_pgoff); 1404EXPORT_SYMBOL(do_mmap_pgoff);
1400 1405
1406SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1407 unsigned long, prot, unsigned long, flags,
1408 unsigned long, fd, unsigned long, pgoff)
1409{
1410 struct file *file = NULL;
1411 unsigned long retval = -EBADF;
1412
1413 if (!(flags & MAP_ANONYMOUS)) {
1414 file = fget(fd);
1415 if (!file)
1416 goto out;
1417 }
1418
1419 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
1420
1421 down_write(&current->mm->mmap_sem);
1422 retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
1423 up_write(&current->mm->mmap_sem);
1424
1425 if (file)
1426 fput(file);
1427out:
1428 return retval;
1429}
1430
1401/* 1431/*
1402 * split a vma into two pieces at address 'addr', a new vma is allocated either 1432 * split a vma into two pieces at address 'addr', a new vma is allocated either
1403 * for the first part or the tail. 1433 * for the first part or the tail.
@@ -1891,9 +1921,11 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
1891 1921
1892 /* only read or write mappings where it is permitted */ 1922 /* only read or write mappings where it is permitted */
1893 if (write && vma->vm_flags & VM_MAYWRITE) 1923 if (write && vma->vm_flags & VM_MAYWRITE)
1894 len -= copy_to_user((void *) addr, buf, len); 1924 copy_to_user_page(vma, NULL, addr,
1925 (void *) addr, buf, len);
1895 else if (!write && vma->vm_flags & VM_MAYREAD) 1926 else if (!write && vma->vm_flags & VM_MAYREAD)
1896 len -= copy_from_user(buf, (void *) addr, len); 1927 copy_from_user_page(vma, NULL, addr,
1928 buf, (void *) addr, len);
1897 else 1929 else
1898 len = 0; 1930 len = 0;
1899 } else { 1931 } else {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 74af449b1f1d..4e9f5cc5fb59 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -48,6 +48,7 @@
48#include <linux/page_cgroup.h> 48#include <linux/page_cgroup.h>
49#include <linux/debugobjects.h> 49#include <linux/debugobjects.h>
50#include <linux/kmemleak.h> 50#include <linux/kmemleak.h>
51#include <linux/memory.h>
51#include <trace/events/kmem.h> 52#include <trace/events/kmem.h>
52 53
53#include <asm/tlbflush.h> 54#include <asm/tlbflush.h>
@@ -2401,13 +2402,14 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
2401{ 2402{
2402 char saved_string[NUMA_ZONELIST_ORDER_LEN]; 2403 char saved_string[NUMA_ZONELIST_ORDER_LEN];
2403 int ret; 2404 int ret;
2405 static DEFINE_MUTEX(zl_order_mutex);
2404 2406
2407 mutex_lock(&zl_order_mutex);
2405 if (write) 2408 if (write)
2406 strncpy(saved_string, (char*)table->data, 2409 strcpy(saved_string, (char*)table->data);
2407 NUMA_ZONELIST_ORDER_LEN);
2408 ret = proc_dostring(table, write, buffer, length, ppos); 2410 ret = proc_dostring(table, write, buffer, length, ppos);
2409 if (ret) 2411 if (ret)
2410 return ret; 2412 goto out;
2411 if (write) { 2413 if (write) {
2412 int oldval = user_zonelist_order; 2414 int oldval = user_zonelist_order;
2413 if (__parse_numa_zonelist_order((char*)table->data)) { 2415 if (__parse_numa_zonelist_order((char*)table->data)) {
@@ -2420,7 +2422,9 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
2420 } else if (oldval != user_zonelist_order) 2422 } else if (oldval != user_zonelist_order)
2421 build_all_zonelists(); 2423 build_all_zonelists();
2422 } 2424 }
2423 return 0; 2425out:
2426 mutex_unlock(&zl_order_mutex);
2427 return ret;
2424} 2428}
2425 2429
2426 2430
@@ -3579,7 +3583,7 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid,
3579 * Return the number of holes in a range on a node. If nid is MAX_NUMNODES, 3583 * Return the number of holes in a range on a node. If nid is MAX_NUMNODES,
3580 * then all holes in the requested range will be accounted for. 3584 * then all holes in the requested range will be accounted for.
3581 */ 3585 */
3582static unsigned long __meminit __absent_pages_in_range(int nid, 3586unsigned long __meminit __absent_pages_in_range(int nid,
3583 unsigned long range_start_pfn, 3587 unsigned long range_start_pfn,
3584 unsigned long range_end_pfn) 3588 unsigned long range_end_pfn)
3585{ 3589{
@@ -4108,7 +4112,7 @@ static int __init cmp_node_active_region(const void *a, const void *b)
4108} 4112}
4109 4113
4110/* sort the node_map by start_pfn */ 4114/* sort the node_map by start_pfn */
4111static void __init sort_node_map(void) 4115void __init sort_node_map(void)
4112{ 4116{
4113 sort(early_node_map, (size_t)nr_nodemap_entries, 4117 sort(early_node_map, (size_t)nr_nodemap_entries,
4114 sizeof(struct node_active_region), 4118 sizeof(struct node_active_region),
@@ -5008,23 +5012,65 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
5008int set_migratetype_isolate(struct page *page) 5012int set_migratetype_isolate(struct page *page)
5009{ 5013{
5010 struct zone *zone; 5014 struct zone *zone;
5011 unsigned long flags; 5015 struct page *curr_page;
5016 unsigned long flags, pfn, iter;
5017 unsigned long immobile = 0;
5018 struct memory_isolate_notify arg;
5019 int notifier_ret;
5012 int ret = -EBUSY; 5020 int ret = -EBUSY;
5013 int zone_idx; 5021 int zone_idx;
5014 5022
5015 zone = page_zone(page); 5023 zone = page_zone(page);
5016 zone_idx = zone_idx(zone); 5024 zone_idx = zone_idx(zone);
5025
5017 spin_lock_irqsave(&zone->lock, flags); 5026 spin_lock_irqsave(&zone->lock, flags);
5027 if (get_pageblock_migratetype(page) == MIGRATE_MOVABLE ||
5028 zone_idx == ZONE_MOVABLE) {
5029 ret = 0;
5030 goto out;
5031 }
5032
5033 pfn = page_to_pfn(page);
5034 arg.start_pfn = pfn;
5035 arg.nr_pages = pageblock_nr_pages;
5036 arg.pages_found = 0;
5037
5018 /* 5038 /*
5019 * In future, more migrate types will be able to be isolation target. 5039 * It may be possible to isolate a pageblock even if the
5040 * migratetype is not MIGRATE_MOVABLE. The memory isolation
5041 * notifier chain is used by balloon drivers to return the
5042 * number of pages in a range that are held by the balloon
5043 * driver to shrink memory. If all the pages are accounted for
5044 * by balloons, are free, or on the LRU, isolation can continue.
5045 * Later, for example, when memory hotplug notifier runs, these
5046 * pages reported as "can be isolated" should be isolated(freed)
5047 * by the balloon driver through the memory notifier chain.
5020 */ 5048 */
5021 if (get_pageblock_migratetype(page) != MIGRATE_MOVABLE && 5049 notifier_ret = memory_isolate_notify(MEM_ISOLATE_COUNT, &arg);
5022 zone_idx != ZONE_MOVABLE) 5050 notifier_ret = notifier_to_errno(notifier_ret);
5051 if (notifier_ret || !arg.pages_found)
5023 goto out; 5052 goto out;
5024 set_pageblock_migratetype(page, MIGRATE_ISOLATE); 5053
5025 move_freepages_block(zone, page, MIGRATE_ISOLATE); 5054 for (iter = pfn; iter < (pfn + pageblock_nr_pages); iter++) {
5026 ret = 0; 5055 if (!pfn_valid_within(pfn))
5056 continue;
5057
5058 curr_page = pfn_to_page(iter);
5059 if (!page_count(curr_page) || PageLRU(curr_page))
5060 continue;
5061
5062 immobile++;
5063 }
5064
5065 if (arg.pages_found == immobile)
5066 ret = 0;
5067
5027out: 5068out:
5069 if (!ret) {
5070 set_pageblock_migratetype(page, MIGRATE_ISOLATE);
5071 move_freepages_block(zone, page, MIGRATE_ISOLATE);
5072 }
5073
5028 spin_unlock_irqrestore(&zone->lock, flags); 5074 spin_unlock_irqrestore(&zone->lock, flags);
5029 if (!ret) 5075 if (!ret)
5030 drain_all_pages(); 5076 drain_all_pages();
diff --git a/mm/percpu.c b/mm/percpu.c
index 442010cc91c6..083e7c91e5f6 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1271,7 +1271,7 @@ static void pcpu_reclaim(struct work_struct *work)
1271 */ 1271 */
1272void free_percpu(void *ptr) 1272void free_percpu(void *ptr)
1273{ 1273{
1274 void *addr = __pcpu_ptr_to_addr(ptr); 1274 void *addr;
1275 struct pcpu_chunk *chunk; 1275 struct pcpu_chunk *chunk;
1276 unsigned long flags; 1276 unsigned long flags;
1277 int off; 1277 int off;
@@ -1279,6 +1279,8 @@ void free_percpu(void *ptr)
1279 if (!ptr) 1279 if (!ptr)
1280 return; 1280 return;
1281 1281
1282 addr = __pcpu_ptr_to_addr(ptr);
1283
1282 spin_lock_irqsave(&pcpu_lock, flags); 1284 spin_lock_irqsave(&pcpu_lock, flags);
1283 1285
1284 chunk = pcpu_chunk_addr_search(addr); 1286 chunk = pcpu_chunk_addr_search(addr);
diff --git a/mm/readahead.c b/mm/readahead.c
index aa1aa2345235..033bc135a41f 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -547,5 +547,17 @@ page_cache_async_readahead(struct address_space *mapping,
547 547
548 /* do read-ahead */ 548 /* do read-ahead */
549 ondemand_readahead(mapping, ra, filp, true, offset, req_size); 549 ondemand_readahead(mapping, ra, filp, true, offset, req_size);
550
551#ifdef CONFIG_BLOCK
552 /*
553 * Normally the current page is !uptodate and lock_page() will be
554 * immediately called to implicitly unplug the device. However this
555 * is not always true for RAID conifgurations, where data arrives
556 * not strictly in their submission order. In this case we need to
557 * explicitly kick off the IO.
558 */
559 if (PageUptodate(page))
560 blk_run_backing_dev(mapping->backing_dev_info, NULL);
561#endif
550} 562}
551EXPORT_SYMBOL_GPL(page_cache_async_readahead); 563EXPORT_SYMBOL_GPL(page_cache_async_readahead);
diff --git a/mm/slab.c b/mm/slab.c
index 3f4822938f46..7451bdacaf18 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -654,7 +654,7 @@ static void init_node_lock_keys(int q)
654 654
655 l3 = s->cs_cachep->nodelists[q]; 655 l3 = s->cs_cachep->nodelists[q];
656 if (!l3 || OFF_SLAB(s->cs_cachep)) 656 if (!l3 || OFF_SLAB(s->cs_cachep))
657 return; 657 continue;
658 lockdep_set_class(&l3->list_lock, &on_slab_l3_key); 658 lockdep_set_class(&l3->list_lock, &on_slab_l3_key);
659 alc = l3->alien; 659 alc = l3->alien;
660 /* 660 /*
@@ -665,7 +665,7 @@ static void init_node_lock_keys(int q)
665 * for alloc_alien_cache, 665 * for alloc_alien_cache,
666 */ 666 */
667 if (!alc || (unsigned long)alc == BAD_ALIEN_MAGIC) 667 if (!alc || (unsigned long)alc == BAD_ALIEN_MAGIC)
668 return; 668 continue;
669 for_each_node(r) { 669 for_each_node(r) {
670 if (alc[r]) 670 if (alc[r])
671 lockdep_set_class(&alc[r]->lock, 671 lockdep_set_class(&alc[r]->lock,
@@ -1132,7 +1132,7 @@ static void __cpuinit cpuup_canceled(long cpu)
1132 if (nc) 1132 if (nc)
1133 free_block(cachep, nc->entry, nc->avail, node); 1133 free_block(cachep, nc->entry, nc->avail, node);
1134 1134
1135 if (!cpus_empty(*mask)) { 1135 if (!cpumask_empty(mask)) {
1136 spin_unlock_irq(&l3->list_lock); 1136 spin_unlock_irq(&l3->list_lock);
1137 goto free_array_cache; 1137 goto free_array_cache;
1138 } 1138 }
@@ -2275,9 +2275,11 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2275 /* 2275 /*
2276 * Determine if the slab management is 'on' or 'off' slab. 2276 * Determine if the slab management is 'on' or 'off' slab.
2277 * (bootstrapping cannot cope with offslab caches so don't do 2277 * (bootstrapping cannot cope with offslab caches so don't do
2278 * it too early on.) 2278 * it too early on. Always use on-slab management when
2279 * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak)
2279 */ 2280 */
2280 if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init) 2281 if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init &&
2282 !(flags & SLAB_NOLEAKTRACE))
2281 /* 2283 /*
2282 * Size is large, assume best to place the slab management obj 2284 * Size is large, assume best to place the slab management obj
2283 * off-slab (should allow better packing of objs). 2285 * off-slab (should allow better packing of objs).
@@ -2596,8 +2598,8 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,
2596 * kmemleak does not treat the ->s_mem pointer as a reference 2598 * kmemleak does not treat the ->s_mem pointer as a reference
2597 * to the object. Otherwise we will not report the leak. 2599 * to the object. Otherwise we will not report the leak.
2598 */ 2600 */
2599 kmemleak_scan_area(slabp, offsetof(struct slab, list), 2601 kmemleak_scan_area(&slabp->list, sizeof(struct list_head),
2600 sizeof(struct list_head), local_flags); 2602 local_flags);
2601 if (!slabp) 2603 if (!slabp)
2602 return NULL; 2604 return NULL;
2603 } else { 2605 } else {
diff --git a/mm/util.c b/mm/util.c
index b377ce430803..7c35ad95f927 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -4,10 +4,6 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/err.h> 5#include <linux/err.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/hugetlb.h>
8#include <linux/syscalls.h>
9#include <linux/mman.h>
10#include <linux/file.h>
11#include <asm/uaccess.h> 7#include <asm/uaccess.h>
12 8
13#define CREATE_TRACE_POINTS 9#define CREATE_TRACE_POINTS
@@ -272,46 +268,6 @@ int __attribute__((weak)) get_user_pages_fast(unsigned long start,
272} 268}
273EXPORT_SYMBOL_GPL(get_user_pages_fast); 269EXPORT_SYMBOL_GPL(get_user_pages_fast);
274 270
275SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
276 unsigned long, prot, unsigned long, flags,
277 unsigned long, fd, unsigned long, pgoff)
278{
279 struct file * file = NULL;
280 unsigned long retval = -EBADF;
281
282 if (!(flags & MAP_ANONYMOUS)) {
283 if (unlikely(flags & MAP_HUGETLB))
284 return -EINVAL;
285 file = fget(fd);
286 if (!file)
287 goto out;
288 } else if (flags & MAP_HUGETLB) {
289 struct user_struct *user = NULL;
290 /*
291 * VM_NORESERVE is used because the reservations will be
292 * taken when vm_ops->mmap() is called
293 * A dummy user value is used because we are not locking
294 * memory so no accounting is necessary
295 */
296 len = ALIGN(len, huge_page_size(&default_hstate));
297 file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE,
298 &user, HUGETLB_ANONHUGE_INODE);
299 if (IS_ERR(file))
300 return PTR_ERR(file);
301 }
302
303 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
304
305 down_write(&current->mm->mmap_sem);
306 retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
307 up_write(&current->mm->mmap_sem);
308
309 if (file)
310 fput(file);
311out:
312 return retval;
313}
314
315/* Tracepoints definitions. */ 271/* Tracepoints definitions. */
316EXPORT_TRACEPOINT_SYMBOL(kmalloc); 272EXPORT_TRACEPOINT_SYMBOL(kmalloc);
317EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc); 273EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc);
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 569750010fd3..18e7f5a43dc4 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -770,7 +770,7 @@ static int hidp_setup_hid(struct hidp_session *session,
770 770
771 hid = hid_allocate_device(); 771 hid = hid_allocate_device();
772 if (IS_ERR(hid)) 772 if (IS_ERR(hid))
773 return PTR_ERR(session->hid); 773 return PTR_ERR(hid);
774 774
775 session->hid = hid; 775 session->hid = hid;
776 session->req = req; 776 session->req = req;
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 5129b88c8e5b..1120cf14a548 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1212,6 +1212,7 @@ static void l2cap_monitor_timeout(unsigned long arg)
1212 bh_lock_sock(sk); 1212 bh_lock_sock(sk);
1213 if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) { 1213 if (l2cap_pi(sk)->retry_count >= l2cap_pi(sk)->remote_max_tx) {
1214 l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk); 1214 l2cap_send_disconn_req(l2cap_pi(sk)->conn, sk);
1215 bh_unlock_sock(sk);
1215 return; 1216 return;
1216 } 1217 }
1217 1218
@@ -3435,8 +3436,8 @@ static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, str
3435 (pi->unacked_frames > 0)) 3436 (pi->unacked_frames > 0))
3436 __mod_retrans_timer(); 3437 __mod_retrans_timer();
3437 3438
3438 l2cap_ertm_send(sk);
3439 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; 3439 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
3440 l2cap_ertm_send(sk);
3440 } 3441 }
3441 break; 3442 break;
3442 3443
@@ -3471,9 +3472,9 @@ static inline int l2cap_data_channel_sframe(struct sock *sk, u16 rx_control, str
3471 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; 3472 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
3472 3473
3473 if (rx_control & L2CAP_CTRL_POLL) { 3474 if (rx_control & L2CAP_CTRL_POLL) {
3474 l2cap_retransmit_frame(sk, tx_seq);
3475 pi->expected_ack_seq = tx_seq; 3475 pi->expected_ack_seq = tx_seq;
3476 l2cap_drop_acked_frames(sk); 3476 l2cap_drop_acked_frames(sk);
3477 l2cap_retransmit_frame(sk, tx_seq);
3477 l2cap_ertm_send(sk); 3478 l2cap_ertm_send(sk);
3478 if (pi->conn_state & L2CAP_CONN_WAIT_F) { 3479 if (pi->conn_state & L2CAP_CONN_WAIT_F) {
3479 pi->srej_save_reqseq = tx_seq; 3480 pi->srej_save_reqseq = tx_seq;
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index bd1c65425d4f..0b7f262cd148 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1406,6 +1406,9 @@ static int do_ebt_set_ctl(struct sock *sk,
1406{ 1406{
1407 int ret; 1407 int ret;
1408 1408
1409 if (!capable(CAP_NET_ADMIN))
1410 return -EPERM;
1411
1409 switch(cmd) { 1412 switch(cmd) {
1410 case EBT_SO_SET_ENTRIES: 1413 case EBT_SO_SET_ENTRIES:
1411 ret = do_replace(sock_net(sk), user, len); 1414 ret = do_replace(sock_net(sk), user, len);
@@ -1425,6 +1428,9 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
1425 struct ebt_replace tmp; 1428 struct ebt_replace tmp;
1426 struct ebt_table *t; 1429 struct ebt_table *t;
1427 1430
1431 if (!capable(CAP_NET_ADMIN))
1432 return -EPERM;
1433
1428 if (copy_from_user(&tmp, user, sizeof(tmp))) 1434 if (copy_from_user(&tmp, user, sizeof(tmp)))
1429 return -EFAULT; 1435 return -EFAULT;
1430 1436
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index a23b45f08ec9..de0c2c726420 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -250,8 +250,7 @@ struct pktgen_dev {
250 __u64 count; /* Default No packets to send */ 250 __u64 count; /* Default No packets to send */
251 __u64 sofar; /* How many pkts we've sent so far */ 251 __u64 sofar; /* How many pkts we've sent so far */
252 __u64 tx_bytes; /* How many bytes we've transmitted */ 252 __u64 tx_bytes; /* How many bytes we've transmitted */
253 __u64 errors; /* Errors when trying to transmit, 253 __u64 errors; /* Errors when trying to transmit, */
254 pkts will be re-sent */
255 254
256 /* runtime counters relating to clone_skb */ 255 /* runtime counters relating to clone_skb */
257 256
@@ -3465,6 +3464,12 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3465 pkt_dev->seq_num++; 3464 pkt_dev->seq_num++;
3466 pkt_dev->tx_bytes += pkt_dev->last_pkt_size; 3465 pkt_dev->tx_bytes += pkt_dev->last_pkt_size;
3467 break; 3466 break;
3467 case NET_XMIT_DROP:
3468 case NET_XMIT_CN:
3469 case NET_XMIT_POLICED:
3470 /* skb has been consumed */
3471 pkt_dev->errors++;
3472 break;
3468 default: /* Drivers are not supposed to return other values! */ 3473 default: /* Drivers are not supposed to return other values! */
3469 if (net_ratelimit()) 3474 if (net_ratelimit())
3470 pr_info("pktgen: %s xmit error: %d\n", 3475 pr_info("pktgen: %s xmit error: %d\n",
diff --git a/net/core/sock.c b/net/core/sock.c
index 76ff58d43e26..e1f6f225f012 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1205,6 +1205,10 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
1205 1205
1206 if (newsk->sk_prot->sockets_allocated) 1206 if (newsk->sk_prot->sockets_allocated)
1207 percpu_counter_inc(newsk->sk_prot->sockets_allocated); 1207 percpu_counter_inc(newsk->sk_prot->sockets_allocated);
1208
1209 if (sock_flag(newsk, SOCK_TIMESTAMP) ||
1210 sock_flag(newsk, SOCK_TIMESTAMPING_RX_SOFTWARE))
1211 net_enable_timestamp();
1208 } 1212 }
1209out: 1213out:
1210 return newsk; 1214 return newsk;
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index dc328425fa20..a1362dc8abb0 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -43,7 +43,7 @@ static int bufsize = 64 * 1024;
43static const char procname[] = "dccpprobe"; 43static const char procname[] = "dccpprobe";
44 44
45static struct { 45static struct {
46 struct kfifo *fifo; 46 struct kfifo fifo;
47 spinlock_t lock; 47 spinlock_t lock;
48 wait_queue_head_t wait; 48 wait_queue_head_t wait;
49 struct timespec tstart; 49 struct timespec tstart;
@@ -67,7 +67,7 @@ static void printl(const char *fmt, ...)
67 len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args); 67 len += vscnprintf(tbuf+len, sizeof(tbuf)-len, fmt, args);
68 va_end(args); 68 va_end(args);
69 69
70 kfifo_put(dccpw.fifo, tbuf, len); 70 kfifo_in_locked(&dccpw.fifo, tbuf, len, &dccpw.lock);
71 wake_up(&dccpw.wait); 71 wake_up(&dccpw.wait);
72} 72}
73 73
@@ -109,7 +109,7 @@ static struct jprobe dccp_send_probe = {
109 109
110static int dccpprobe_open(struct inode *inode, struct file *file) 110static int dccpprobe_open(struct inode *inode, struct file *file)
111{ 111{
112 kfifo_reset(dccpw.fifo); 112 kfifo_reset(&dccpw.fifo);
113 getnstimeofday(&dccpw.tstart); 113 getnstimeofday(&dccpw.tstart);
114 return 0; 114 return 0;
115} 115}
@@ -131,11 +131,11 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf,
131 return -ENOMEM; 131 return -ENOMEM;
132 132
133 error = wait_event_interruptible(dccpw.wait, 133 error = wait_event_interruptible(dccpw.wait,
134 __kfifo_len(dccpw.fifo) != 0); 134 kfifo_len(&dccpw.fifo) != 0);
135 if (error) 135 if (error)
136 goto out_free; 136 goto out_free;
137 137
138 cnt = kfifo_get(dccpw.fifo, tbuf, len); 138 cnt = kfifo_out_locked(&dccpw.fifo, tbuf, len, &dccpw.lock);
139 error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0; 139 error = copy_to_user(buf, tbuf, cnt) ? -EFAULT : 0;
140 140
141out_free: 141out_free:
@@ -156,10 +156,8 @@ static __init int dccpprobe_init(void)
156 156
157 init_waitqueue_head(&dccpw.wait); 157 init_waitqueue_head(&dccpw.wait);
158 spin_lock_init(&dccpw.lock); 158 spin_lock_init(&dccpw.lock);
159 dccpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &dccpw.lock); 159 if (kfifo_alloc(&dccpw.fifo, bufsize, GFP_KERNEL))
160 if (IS_ERR(dccpw.fifo)) 160 return ret;
161 return PTR_ERR(dccpw.fifo);
162
163 if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) 161 if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops))
164 goto err0; 162 goto err0;
165 163
@@ -172,14 +170,14 @@ static __init int dccpprobe_init(void)
172err1: 170err1:
173 proc_net_remove(&init_net, procname); 171 proc_net_remove(&init_net, procname);
174err0: 172err0:
175 kfifo_free(dccpw.fifo); 173 kfifo_free(&dccpw.fifo);
176 return ret; 174 return ret;
177} 175}
178module_init(dccpprobe_init); 176module_init(dccpprobe_init);
179 177
180static __exit void dccpprobe_exit(void) 178static __exit void dccpprobe_exit(void)
181{ 179{
182 kfifo_free(dccpw.fifo); 180 kfifo_free(&dccpw.fifo);
183 proc_net_remove(&init_net, procname); 181 proc_net_remove(&init_net, procname);
184 unregister_jprobe(&dccp_send_probe); 182 unregister_jprobe(&dccp_send_probe);
185 183
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5cdbc102a418..040c4f05b653 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1397,6 +1397,7 @@ static struct devinet_sysctl_table {
1397 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE, 1397 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE,
1398 "accept_source_route"), 1398 "accept_source_route"),
1399 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_LOCAL, "accept_local"), 1399 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_LOCAL, "accept_local"),
1400 DEVINET_SYSCTL_RW_ENTRY(SRC_VMARK, "src_valid_mark"),
1400 DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"), 1401 DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"),
1401 DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"), 1402 DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"),
1402 DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"), 1403 DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"),
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 3323168ee52d..82dbf711d6d0 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -252,6 +252,8 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
252 no_addr = in_dev->ifa_list == NULL; 252 no_addr = in_dev->ifa_list == NULL;
253 rpf = IN_DEV_RPFILTER(in_dev); 253 rpf = IN_DEV_RPFILTER(in_dev);
254 accept_local = IN_DEV_ACCEPT_LOCAL(in_dev); 254 accept_local = IN_DEV_ACCEPT_LOCAL(in_dev);
255 if (mark && !IN_DEV_SRC_VMARK(in_dev))
256 fl.mark = 0;
255 } 257 }
256 rcu_read_unlock(); 258 rcu_read_unlock();
257 259
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e34013a78ef4..3451799e3dbf 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -254,7 +254,7 @@ int ip_mc_output(struct sk_buff *skb)
254 */ 254 */
255 255
256 if (rt->rt_flags&RTCF_MULTICAST) { 256 if (rt->rt_flags&RTCF_MULTICAST) {
257 if ((!sk || inet_sk(sk)->mc_loop) 257 if (sk_mc_loop(sk)
258#ifdef CONFIG_IP_MROUTE 258#ifdef CONFIG_IP_MROUTE
259 /* Small optimization: do not loopback not local frames, 259 /* Small optimization: do not loopback not local frames,
260 which returned after forwarding; they will be dropped 260 which returned after forwarding; they will be dropped
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cd48801a8d6f..eb6d09728633 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -121,10 +121,9 @@ static int ip6_output2(struct sk_buff *skb)
121 skb->dev = dev; 121 skb->dev = dev;
122 122
123 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { 123 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
124 struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL;
125 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); 124 struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
126 125
127 if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) && 126 if (!(dev->flags & IFF_LOOPBACK) && sk_mc_loop(skb->sk) &&
128 ((mroute6_socket(dev_net(dev)) && 127 ((mroute6_socket(dev_net(dev)) &&
129 !(IP6CB(skb)->flags & IP6SKB_FORWARDED)) || 128 !(IP6CB(skb)->flags & IP6SKB_FORWARDED)) ||
130 ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr, 129 ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr,
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 3b3a95607125..2cddea3bd6be 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -708,7 +708,8 @@ static void ip6_frags_ns_sysctl_unregister(struct net *net)
708 708
709 table = net->ipv6.sysctl.frags_hdr->ctl_table_arg; 709 table = net->ipv6.sysctl.frags_hdr->ctl_table_arg;
710 unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr); 710 unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr);
711 kfree(table); 711 if (!net_eq(net, &init_net))
712 kfree(table);
712} 713}
713 714
714static struct ctl_table_header *ip6_ctl_header; 715static struct ctl_table_header *ip6_ctl_header;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index db3b27303890..c2bd74c5f8d9 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2630,6 +2630,7 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net)
2630 table[6].data = &net->ipv6.sysctl.ip6_rt_gc_elasticity; 2630 table[6].data = &net->ipv6.sysctl.ip6_rt_gc_elasticity;
2631 table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires; 2631 table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires;
2632 table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss; 2632 table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss;
2633 table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;
2633 } 2634 }
2634 2635
2635 return table; 2636 return table;
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 3787455fb696..d7dcee680728 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -34,9 +34,28 @@ void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
34 34
35 ht_cap->ht_supported = true; 35 ht_cap->ht_supported = true;
36 36
37 ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info) & sband->ht_cap.cap; 37 /*
38 ht_cap->cap &= ~IEEE80211_HT_CAP_SM_PS; 38 * The bits listed in this expression should be
39 ht_cap->cap |= sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS; 39 * the same for the peer and us, if the station
40 * advertises more then we can't use those thus
41 * we mask them out.
42 */
43 ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info) &
44 (sband->ht_cap.cap |
45 ~(IEEE80211_HT_CAP_LDPC_CODING |
46 IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
47 IEEE80211_HT_CAP_GRN_FLD |
48 IEEE80211_HT_CAP_SGI_20 |
49 IEEE80211_HT_CAP_SGI_40 |
50 IEEE80211_HT_CAP_DSSSCCK40));
51 /*
52 * The STBC bits are asymmetric -- if we don't have
53 * TX then mask out the peer's RX and vice versa.
54 */
55 if (!(sband->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC))
56 ht_cap->cap &= ~IEEE80211_HT_CAP_RX_STBC;
57 if (!(sband->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC))
58 ht_cap->cap &= ~IEEE80211_HT_CAP_TX_STBC;
40 59
41 ampdu_info = ht_cap_ie->ampdu_params_info; 60 ampdu_info = ht_cap_ie->ampdu_params_info;
42 ht_cap->ampdu_factor = 61 ht_cap->ampdu_factor =
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 10d13856f86c..1f2db647bb5c 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -382,6 +382,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
382struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 382struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
383 u8 *bssid,u8 *addr, u32 supp_rates) 383 u8 *bssid,u8 *addr, u32 supp_rates)
384{ 384{
385 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
385 struct ieee80211_local *local = sdata->local; 386 struct ieee80211_local *local = sdata->local;
386 struct sta_info *sta; 387 struct sta_info *sta;
387 int band = local->hw.conf.channel->band; 388 int band = local->hw.conf.channel->band;
@@ -397,6 +398,9 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
397 return NULL; 398 return NULL;
398 } 399 }
399 400
401 if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH)
402 return NULL;
403
400 if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) 404 if (compare_ether_addr(bssid, sdata->u.ibss.bssid))
401 return NULL; 405 return NULL;
402 406
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 8116d1a96a4a..0d2d94881f1f 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -515,6 +515,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
515 * and we need some headroom for passing the frame to monitor 515 * and we need some headroom for passing the frame to monitor
516 * interfaces, but never both at the same time. 516 * interfaces, but never both at the same time.
517 */ 517 */
518 BUILD_BUG_ON(IEEE80211_TX_STATUS_HEADROOM !=
519 sizeof(struct ieee80211_tx_status_rtap_hdr));
518 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, 520 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
519 sizeof(struct ieee80211_tx_status_rtap_hdr)); 521 sizeof(struct ieee80211_tx_status_rtap_hdr));
520 522
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d8d50fb5e823..c79e59f82fd9 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -915,6 +915,14 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
915 sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL | 915 sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
916 IEEE80211_STA_BEACON_POLL); 916 IEEE80211_STA_BEACON_POLL);
917 917
918 /*
919 * Always handle WMM once after association regardless
920 * of the first value the AP uses. Setting -1 here has
921 * that effect because the AP values is an unsigned
922 * 4-bit value.
923 */
924 sdata->u.mgd.wmm_last_param_set = -1;
925
918 ieee80211_led_assoc(local, 1); 926 ieee80211_led_assoc(local, 1);
919 927
920 sdata->vif.bss_conf.assoc = 1; 928 sdata->vif.bss_conf.assoc = 1;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8834cc93c716..27ceaefd7bc8 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1419,6 +1419,10 @@ static bool need_dynamic_ps(struct ieee80211_local *local)
1419 if (!local->ps_sdata) 1419 if (!local->ps_sdata)
1420 return false; 1420 return false;
1421 1421
1422 /* No point if we're going to suspend */
1423 if (local->quiescing)
1424 return false;
1425
1422 return true; 1426 return true;
1423} 1427}
1424 1428
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 78a6e924c7e1..dc76267e436e 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1039,7 +1039,19 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1039 1039
1040 /* restart hardware */ 1040 /* restart hardware */
1041 if (local->open_count) { 1041 if (local->open_count) {
1042 /*
1043 * Upon resume hardware can sometimes be goofy due to
1044 * various platform / driver / bus issues, so restarting
1045 * the device may at times not work immediately. Propagate
1046 * the error.
1047 */
1042 res = drv_start(local); 1048 res = drv_start(local);
1049 if (res) {
1050 WARN(local->suspended, "Harware became unavailable "
1051 "upon resume. This is could be a software issue"
1052 "prior to suspend or a harware issue\n");
1053 return res;
1054 }
1043 1055
1044 ieee80211_led_radio(local, true); 1056 ieee80211_led_radio(local, true);
1045 } 1057 }
diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig
index 79a698052218..f2d76238b9b5 100644
--- a/net/netfilter/ipvs/Kconfig
+++ b/net/netfilter/ipvs/Kconfig
@@ -112,7 +112,8 @@ config IP_VS_RR
112 module, choose M here. If unsure, say N. 112 module, choose M here. If unsure, say N.
113 113
114config IP_VS_WRR 114config IP_VS_WRR
115 tristate "weighted round-robin scheduling" 115 tristate "weighted round-robin scheduling"
116 select GCD
116 ---help--- 117 ---help---
117 The weighted robin-robin scheduling algorithm directs network 118 The weighted robin-robin scheduling algorithm directs network
118 connections to different real servers based on server weights 119 connections to different real servers based on server weights
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 6bde12da2fe0..c37ac2d7bec4 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -2077,6 +2077,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2077 if (!capable(CAP_NET_ADMIN)) 2077 if (!capable(CAP_NET_ADMIN))
2078 return -EPERM; 2078 return -EPERM;
2079 2079
2080 if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_SET_MAX)
2081 return -EINVAL;
2082 if (len < 0 || len > MAX_ARG_LEN)
2083 return -EINVAL;
2080 if (len != set_arglen[SET_CMDID(cmd)]) { 2084 if (len != set_arglen[SET_CMDID(cmd)]) {
2081 pr_err("set_ctl: len %u != %u\n", 2085 pr_err("set_ctl: len %u != %u\n",
2082 len, set_arglen[SET_CMDID(cmd)]); 2086 len, set_arglen[SET_CMDID(cmd)]);
@@ -2352,17 +2356,25 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2352{ 2356{
2353 unsigned char arg[128]; 2357 unsigned char arg[128];
2354 int ret = 0; 2358 int ret = 0;
2359 unsigned int copylen;
2355 2360
2356 if (!capable(CAP_NET_ADMIN)) 2361 if (!capable(CAP_NET_ADMIN))
2357 return -EPERM; 2362 return -EPERM;
2358 2363
2364 if (cmd < IP_VS_BASE_CTL || cmd > IP_VS_SO_GET_MAX)
2365 return -EINVAL;
2366
2359 if (*len < get_arglen[GET_CMDID(cmd)]) { 2367 if (*len < get_arglen[GET_CMDID(cmd)]) {
2360 pr_err("get_ctl: len %u < %u\n", 2368 pr_err("get_ctl: len %u < %u\n",
2361 *len, get_arglen[GET_CMDID(cmd)]); 2369 *len, get_arglen[GET_CMDID(cmd)]);
2362 return -EINVAL; 2370 return -EINVAL;
2363 } 2371 }
2364 2372
2365 if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) 2373 copylen = get_arglen[GET_CMDID(cmd)];
2374 if (copylen > 128)
2375 return -EINVAL;
2376
2377 if (copy_from_user(arg, user, copylen) != 0)
2366 return -EFAULT; 2378 return -EFAULT;
2367 2379
2368 if (mutex_lock_interruptible(&__ip_vs_mutex)) 2380 if (mutex_lock_interruptible(&__ip_vs_mutex))
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c
index 6182e8ea0be7..3c115fc19784 100644
--- a/net/netfilter/ipvs/ip_vs_wrr.c
+++ b/net/netfilter/ipvs/ip_vs_wrr.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/net.h> 26#include <linux/net.h>
27#include <linux/gcd.h>
27 28
28#include <net/ip_vs.h> 29#include <net/ip_vs.h>
29 30
@@ -38,20 +39,6 @@ struct ip_vs_wrr_mark {
38}; 39};
39 40
40 41
41/*
42 * Get the gcd of server weights
43 */
44static int gcd(int a, int b)
45{
46 int c;
47
48 while ((c = a % b)) {
49 a = b;
50 b = c;
51 }
52 return b;
53}
54
55static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc) 42static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)
56{ 43{
57 struct ip_vs_dest *dest; 44 struct ip_vs_dest *dest;
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index 38ea7ef3ccd2..f0732aa18e4f 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -323,24 +323,24 @@ static void update_nl_seq(struct nf_conn *ct, u32 nl_seq,
323 struct nf_ct_ftp_master *info, int dir, 323 struct nf_ct_ftp_master *info, int dir,
324 struct sk_buff *skb) 324 struct sk_buff *skb)
325{ 325{
326 unsigned int i, oldest = NUM_SEQ_TO_REMEMBER; 326 unsigned int i, oldest;
327 327
328 /* Look for oldest: if we find exact match, we're done. */ 328 /* Look for oldest: if we find exact match, we're done. */
329 for (i = 0; i < info->seq_aft_nl_num[dir]; i++) { 329 for (i = 0; i < info->seq_aft_nl_num[dir]; i++) {
330 if (info->seq_aft_nl[dir][i] == nl_seq) 330 if (info->seq_aft_nl[dir][i] == nl_seq)
331 return; 331 return;
332
333 if (oldest == info->seq_aft_nl_num[dir] ||
334 before(info->seq_aft_nl[dir][i],
335 info->seq_aft_nl[dir][oldest]))
336 oldest = i;
337 } 332 }
338 333
339 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) { 334 if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {
340 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq; 335 info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;
341 } else if (oldest != NUM_SEQ_TO_REMEMBER && 336 } else {
342 after(nl_seq, info->seq_aft_nl[dir][oldest])) { 337 if (before(info->seq_aft_nl[dir][0], info->seq_aft_nl[dir][1]))
343 info->seq_aft_nl[dir][oldest] = nl_seq; 338 oldest = 0;
339 else
340 oldest = 1;
341
342 if (after(nl_seq, info->seq_aft_nl[dir][oldest]))
343 info->seq_aft_nl[dir][oldest] = nl_seq;
344 } 344 }
345} 345}
346 346
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e0516a22be2e..f126d18dbdc4 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1021,8 +1021,20 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
1021 1021
1022 status = TP_STATUS_SEND_REQUEST; 1022 status = TP_STATUS_SEND_REQUEST;
1023 err = dev_queue_xmit(skb); 1023 err = dev_queue_xmit(skb);
1024 if (unlikely(err > 0 && (err = net_xmit_errno(err)) != 0)) 1024 if (unlikely(err > 0)) {
1025 goto out_xmit; 1025 err = net_xmit_errno(err);
1026 if (err && __packet_get_status(po, ph) ==
1027 TP_STATUS_AVAILABLE) {
1028 /* skb was destructed already */
1029 skb = NULL;
1030 goto out_status;
1031 }
1032 /*
1033 * skb was dropped but not destructed yet;
1034 * let's treat it like congestion or err < 0
1035 */
1036 err = 0;
1037 }
1026 packet_increment_head(&po->tx_ring); 1038 packet_increment_head(&po->tx_ring);
1027 len_sum += tp_len; 1039 len_sum += tp_len;
1028 } while (likely((ph != NULL) || 1040 } while (likely((ph != NULL) ||
@@ -1033,9 +1045,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
1033 err = len_sum; 1045 err = len_sum;
1034 goto out_put; 1046 goto out_put;
1035 1047
1036out_xmit:
1037 skb->destructor = sock_wfree;
1038 atomic_dec(&po->tx_ring.pending);
1039out_status: 1048out_status:
1040 __packet_set_status(po, ph, status); 1049 __packet_set_status(po, ph, status);
1041 kfree_skb(skb); 1050 kfree_skb(skb);
diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c
index 114df6eec8c3..968e8bac1b5d 100644
--- a/net/rose/rose_loopback.c
+++ b/net/rose/rose_loopback.c
@@ -75,7 +75,7 @@ static void rose_loopback_timer(unsigned long param)
75 lci_i = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF); 75 lci_i = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF);
76 frametype = skb->data[2]; 76 frametype = skb->data[2];
77 dest = (rose_address *)(skb->data + 4); 77 dest = (rose_address *)(skb->data + 4);
78 lci_o = 0xFFF - lci_i; 78 lci_o = ROSE_DEFAULT_MAXVC + 1 - lci_i;
79 79
80 skb_reset_transport_header(skb); 80 skb_reset_transport_header(skb);
81 81
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 89ab66e54740..67fdac9d2d33 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2087,8 +2087,7 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
2087 if (copy_from_user(&sp->autoclose, optval, optlen)) 2087 if (copy_from_user(&sp->autoclose, optval, optlen))
2088 return -EFAULT; 2088 return -EFAULT;
2089 /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */ 2089 /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
2090 if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) ) 2090 sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ);
2091 sp->autoclose = (__u32)(MAX_SCHEDULE_TIMEOUT / HZ) ;
2092 2091
2093 return 0; 2092 return 0;
2094} 2093}
diff --git a/net/socket.c b/net/socket.c
index dbfdfa96d29b..769c386bd428 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -312,18 +312,6 @@ static struct file_system_type sock_fs_type = {
312 .kill_sb = kill_anon_super, 312 .kill_sb = kill_anon_super,
313}; 313};
314 314
315static int sockfs_delete_dentry(struct dentry *dentry)
316{
317 /*
318 * At creation time, we pretended this dentry was hashed
319 * (by clearing DCACHE_UNHASHED bit in d_flags)
320 * At delete time, we restore the truth : not hashed.
321 * (so that dput() can proceed correctly)
322 */
323 dentry->d_flags |= DCACHE_UNHASHED;
324 return 0;
325}
326
327/* 315/*
328 * sockfs_dname() is called from d_path(). 316 * sockfs_dname() is called from d_path().
329 */ 317 */
@@ -334,7 +322,6 @@ static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen)
334} 322}
335 323
336static const struct dentry_operations sockfs_dentry_operations = { 324static const struct dentry_operations sockfs_dentry_operations = {
337 .d_delete = sockfs_delete_dentry,
338 .d_dname = sockfs_dname, 325 .d_dname = sockfs_dname,
339}; 326};
340 327
@@ -374,12 +361,6 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
374 path.mnt = mntget(sock_mnt); 361 path.mnt = mntget(sock_mnt);
375 362
376 path.dentry->d_op = &sockfs_dentry_operations; 363 path.dentry->d_op = &sockfs_dentry_operations;
377 /*
378 * We dont want to push this dentry into global dentry hash table.
379 * We pretend dentry is already hashed, by unsetting DCACHE_UNHASHED
380 * This permits a working /proc/$pid/fd/XXX on sockets
381 */
382 path.dentry->d_flags &= ~DCACHE_UNHASHED;
383 d_instantiate(path.dentry, SOCK_INODE(sock)); 364 d_instantiate(path.dentry, SOCK_INODE(sock));
384 SOCK_INODE(sock)->i_fop = &socket_file_ops; 365 SOCK_INODE(sock)->i_fop = &socket_file_ops;
385 366
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 3c3c50f38a1c..f7a7f8380e38 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -644,7 +644,22 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
644 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); 644 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
645 if (IS_ERR(p)) { 645 if (IS_ERR(p)) {
646 err = PTR_ERR(p); 646 err = PTR_ERR(p);
647 gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES; 647 switch (err) {
648 case -EACCES:
649 gss_msg->msg.errno = err;
650 err = mlen;
651 break;
652 case -EFAULT:
653 case -ENOMEM:
654 case -EINVAL:
655 case -ENOSYS:
656 gss_msg->msg.errno = -EAGAIN;
657 break;
658 default:
659 printk(KERN_CRIT "%s: bad return from "
660 "gss_fill_context: %zd\n", __func__, err);
661 BUG();
662 }
648 goto err_release_msg; 663 goto err_release_msg;
649 } 664 }
650 gss_msg->ctx = gss_get_ctx(ctx); 665 gss_msg->ctx = gss_get_ctx(ctx);
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index ef45eba22485..2deb0ed72ff4 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -131,8 +131,10 @@ gss_import_sec_context_kerberos(const void *p,
131 struct krb5_ctx *ctx; 131 struct krb5_ctx *ctx;
132 int tmp; 132 int tmp;
133 133
134 if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) 134 if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) {
135 p = ERR_PTR(-ENOMEM);
135 goto out_err; 136 goto out_err;
137 }
136 138
137 p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); 139 p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate));
138 if (IS_ERR(p)) 140 if (IS_ERR(p))
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index 6efbb0cd3c7c..76e4c6f4ac3c 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -252,7 +252,7 @@ gss_import_sec_context(const void *input_token, size_t bufsize,
252 struct gss_ctx **ctx_id) 252 struct gss_ctx **ctx_id)
253{ 253{
254 if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL))) 254 if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL)))
255 return GSS_S_FAILURE; 255 return -ENOMEM;
256 (*ctx_id)->mech_type = gss_mech_get(mech); 256 (*ctx_id)->mech_type = gss_mech_get(mech);
257 257
258 return mech->gm_ops 258 return mech->gm_ops
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 1c924ee0a1ef..7d1f9e928f69 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -699,7 +699,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
699 spin_unlock_bh(&pool->sp_lock); 699 spin_unlock_bh(&pool->sp_lock);
700 700
701 len = 0; 701 len = 0;
702 if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { 702 if (test_bit(XPT_LISTENER, &xprt->xpt_flags) &&
703 !test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
703 struct svc_xprt *newxpt; 704 struct svc_xprt *newxpt;
704 newxpt = xprt->xpt_ops->xpo_accept(xprt); 705 newxpt = xprt->xpt_ops->xpo_accept(xprt);
705 if (newxpt) { 706 if (newxpt) {
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 1001db4912f7..82e6002c8d67 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -93,7 +93,18 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
93 } 93 }
94 } 94 }
95 95
96 WARN_ON(!bss); 96 /*
97 * We might be coming here because the driver reported
98 * a successful association at the same time as the
99 * user requested a deauth. In that case, we will have
100 * removed the BSS from the auth_bsses list due to the
101 * deauth request when the assoc response makes it. If
102 * the two code paths acquire the lock the other way
103 * around, that's just the standard situation of a
104 * deauth being requested while connected.
105 */
106 if (!bss)
107 goto out;
97 } else if (wdev->conn) { 108 } else if (wdev->conn) {
98 cfg80211_sme_failed_assoc(wdev); 109 cfg80211_sme_failed_assoc(wdev);
99 /* 110 /*
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 12dfa62aad18..0c2cbbebca95 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -601,7 +601,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
601 struct cfg80211_registered_device *rdev; 601 struct cfg80211_registered_device *rdev;
602 struct wiphy *wiphy; 602 struct wiphy *wiphy;
603 struct iw_scan_req *wreq = NULL; 603 struct iw_scan_req *wreq = NULL;
604 struct cfg80211_scan_request *creq; 604 struct cfg80211_scan_request *creq = NULL;
605 int i, err, n_channels = 0; 605 int i, err, n_channels = 0;
606 enum ieee80211_band band; 606 enum ieee80211_band band;
607 607
@@ -694,8 +694,10 @@ int cfg80211_wext_siwscan(struct net_device *dev,
694 /* translate "Scan for SSID" request */ 694 /* translate "Scan for SSID" request */
695 if (wreq) { 695 if (wreq) {
696 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { 696 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
697 if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) 697 if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) {
698 return -EINVAL; 698 err = -EINVAL;
699 goto out;
700 }
699 memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); 701 memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len);
700 creq->ssids[0].ssid_len = wreq->essid_len; 702 creq->ssids[0].ssid_len = wreq->essid_len;
701 } 703 }
@@ -707,12 +709,15 @@ int cfg80211_wext_siwscan(struct net_device *dev,
707 err = rdev->ops->scan(wiphy, dev, creq); 709 err = rdev->ops->scan(wiphy, dev, creq);
708 if (err) { 710 if (err) {
709 rdev->scan_req = NULL; 711 rdev->scan_req = NULL;
710 kfree(creq); 712 /* creq will be freed below */
711 } else { 713 } else {
712 nl80211_send_scan_start(rdev, dev); 714 nl80211_send_scan_start(rdev, dev);
715 /* creq now owned by driver */
716 creq = NULL;
713 dev_hold(dev); 717 dev_hold(dev);
714 } 718 }
715 out: 719 out:
720 kfree(creq);
716 cfg80211_unlock_rdev(rdev); 721 cfg80211_unlock_rdev(rdev);
717 return err; 722 return err;
718} 723}
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index cb81ca35b0d6..4725a549ad4d 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1445,7 +1445,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
1445 if (!dev) 1445 if (!dev)
1446 goto free_dst; 1446 goto free_dst;
1447 1447
1448 /* Copy neighbout for reachability confirmation */ 1448 /* Copy neighbour for reachability confirmation */
1449 dst0->neighbour = neigh_clone(dst->neighbour); 1449 dst0->neighbour = neigh_clone(dst->neighbour);
1450 1450
1451 xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len); 1451 xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len);
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index c67e73ecd5be..ed2773edfe71 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -149,6 +149,12 @@ ld-option = $(call try-run,\
149# $(Q)$(MAKE) $(build)=dir 149# $(Q)$(MAKE) $(build)=dir
150build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj 150build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
151 151
152###
153# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj=
154# Usage:
155# $(Q)$(MAKE) $(modbuiltin)=dir
156modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj
157
152# Prefix -I with $(srctree) if it is not an absolute path. 158# Prefix -I with $(srctree) if it is not an absolute path.
153# skip if -I has no parameter 159# skip if -I has no parameter
154addtree = $(if $(patsubst -I%,%,$(1)), \ 160addtree = $(if $(patsubst -I%,%,$(1)), \
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 341b58902ffc..0b94d2fa3a88 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -207,6 +207,7 @@ endif
207 207
208ifdef CONFIG_FTRACE_MCOUNT_RECORD 208ifdef CONFIG_FTRACE_MCOUNT_RECORD
209cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ 209cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
210 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
210 "$(if $(CONFIG_64BIT),64,32)" \ 211 "$(if $(CONFIG_64BIT),64,32)" \
211 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ 212 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
212 "$(if $(part-of-module),1,0)" "$(@)"; 213 "$(if $(part-of-module),1,0)" "$(@)";
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 224d85e72ef1..0fe48cd91ffa 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -213,7 +213,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
213 213
214# Bzip2 and LZMA do not include size in file... so we have to fake that; 214# Bzip2 and LZMA do not include size in file... so we have to fake that;
215# append the size as a 32-bit littleendian number as gzip does. 215# append the size as a 32-bit littleendian number as gzip does.
216size_append = /bin/echo -ne $(shell \ 216size_append = printf $(shell \
217dec_size=0; \ 217dec_size=0; \
218for F in $1; do \ 218for F in $1; do \
219 fsize=$$(stat -c "%s" $$F); \ 219 fsize=$$(stat -c "%s" $$F); \
@@ -235,3 +235,8 @@ quiet_cmd_lzma = LZMA $@
235cmd_lzma = (cat $(filter-out FORCE,$^) | \ 235cmd_lzma = (cat $(filter-out FORCE,$^) | \
236 lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ 236 lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
237 (rm -f $@ ; false) 237 (rm -f $@ ; false)
238
239quiet_cmd_lzo = LZO $@
240cmd_lzo = (cat $(filter-out FORCE,$^) | \
241 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
242 (rm -f $@ ; false)
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin
new file mode 100644
index 000000000000..102a276f6eea
--- /dev/null
+++ b/scripts/Makefile.modbuiltin
@@ -0,0 +1,55 @@
1# ==========================================================================
2# Generating modules.builtin
3# ==========================================================================
4
5src := $(obj)
6
7PHONY := __modbuiltin
8__modbuiltin:
9
10-include include/config/auto.conf
11# tristate.conf sets tristate variables to uppercase 'Y' or 'M'
12# That way, we get the list of built-in modules in obj-Y
13-include include/config/tristate.conf
14
15include scripts/Kbuild.include
16
17# The filename Kbuild has precedence over Makefile
18kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
19kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
20include $(kbuild-file)
21
22include scripts/Makefile.lib
23__subdir-Y := $(patsubst %/,%,$(filter %/, $(obj-Y)))
24subdir-Y += $(__subdir-Y)
25subdir-ym := $(sort $(subdir-y) $(subdir-Y) $(subdir-m))
26subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
27obj-Y := $(addprefix $(obj)/,$(obj-Y))
28
29modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym))
30modbuiltin-mods := $(filter %.ko, $(obj-Y:.o=.ko))
31modbuiltin-target := $(obj)/modules.builtin
32
33__modbuiltin: $(modbuiltin-target) $(subdir-ym)
34 @:
35
36$(modbuiltin-target): $(subdir-ym) FORCE
37 $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \
38 cat /dev/null $(modbuiltin-subdirs)) > $@
39
40PHONY += FORCE
41
42FORCE:
43
44# Descending
45# ---------------------------------------------------------------------------
46
47PHONY += $(subdir-ym)
48$(subdir-ym):
49 $(Q)$(MAKE) $(modbuiltin)=$@
50
51
52# Declare the contents of the .PHONY variable as phony. We keep that
53# information in a variable se we can use it in if_changed and friends.
54
55.PHONY: $(PHONY)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 6bf21f83837d..ea26b23de082 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -16,15 +16,15 @@
16 * tells make when to remake a file. 16 * tells make when to remake a file.
17 * 17 *
18 * To use this list as-is however has the drawback that virtually 18 * To use this list as-is however has the drawback that virtually
19 * every file in the kernel includes <linux/autoconf.h>. 19 * every file in the kernel includes autoconf.h.
20 * 20 *
21 * If the user re-runs make *config, linux/autoconf.h will be 21 * If the user re-runs make *config, autoconf.h will be
22 * regenerated. make notices that and will rebuild every file which 22 * regenerated. make notices that and will rebuild every file which
23 * includes autoconf.h, i.e. basically all files. This is extremely 23 * includes autoconf.h, i.e. basically all files. This is extremely
24 * annoying if the user just changed CONFIG_HIS_DRIVER from n to m. 24 * annoying if the user just changed CONFIG_HIS_DRIVER from n to m.
25 * 25 *
26 * So we play the same trick that "mkdep" played before. We replace 26 * So we play the same trick that "mkdep" played before. We replace
27 * the dependency on linux/autoconf.h by a dependency on every config 27 * the dependency on autoconf.h by a dependency on every config
28 * option which is mentioned in any of the listed prequisites. 28 * option which is mentioned in any of the listed prequisites.
29 * 29 *
30 * kconfig populates a tree in include/config/ with an empty file 30 * kconfig populates a tree in include/config/ with an empty file
@@ -73,7 +73,7 @@
73 * cmd_<target> = <cmdline> 73 * cmd_<target> = <cmdline>
74 * 74 *
75 * and then basically copies the .<target>.d file to stdout, in the 75 * and then basically copies the .<target>.d file to stdout, in the
76 * process filtering out the dependency on linux/autoconf.h and adding 76 * process filtering out the dependency on autoconf.h and adding
77 * dependencies on include/config/my/option.h for every 77 * dependencies on include/config/my/option.h for every
78 * CONFIG_MY_OPTION encountered in any of the prequisites. 78 * CONFIG_MY_OPTION encountered in any of the prequisites.
79 * 79 *
@@ -324,7 +324,7 @@ static void parse_dep_file(void *map, size_t len)
324 p++; 324 p++;
325 } 325 }
326 memcpy(s, m, p-m); s[p-m] = 0; 326 memcpy(s, m, p-m); s[p-m] = 0;
327 if (strrcmp(s, "include/linux/autoconf.h") && 327 if (strrcmp(s, "include/generated/autoconf.h") &&
328 strrcmp(s, "arch/um/include/uml-config.h") && 328 strrcmp(s, "arch/um/include/uml-config.h") &&
329 strrcmp(s, ".ver")) { 329 strrcmp(s, ".ver")) {
330 printf(" %s \\\n", s); 330 printf(" %s \\\n", s);
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bc4114f1ab30..3257d3d96767 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1,5 +1,5 @@
1#!/usr/bin/perl -w 1#!/usr/bin/perl -w
2# (c) 2001, Dave Jones. <davej@redhat.com> (the file handling bit) 2# (c) 2001, Dave Jones. (the file handling bit)
3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) 3# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) 4# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
5# (c) 2008,2009, Andy Whitcroft <apw@canonical.com> 5# (c) 2008,2009, Andy Whitcroft <apw@canonical.com>
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.c_shipped
index 287467a2e8c7..8060e06798b3 100644
--- a/scripts/genksyms/keywords.c_shipped
+++ b/scripts/genksyms/keywords.c_shipped
@@ -1,4 +1,4 @@
1/* ANSI-C code produced by gperf version 3.0.3 */ 1/* ANSI-C code produced by gperf version 3.0.4 */
2/* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ 2/* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */
3 3
4#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ 4#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -34,7 +34,7 @@ struct resword;
34static const struct resword *is_reserved_word(register const char *str, register unsigned int len); 34static const struct resword *is_reserved_word(register const char *str, register unsigned int len);
35#line 5 "scripts/genksyms/keywords.gperf" 35#line 5 "scripts/genksyms/keywords.gperf"
36struct resword { const char *name; int token; }; 36struct resword { const char *name; int token; };
37/* maximum key range = 62, duplicates = 0 */ 37/* maximum key range = 64, duplicates = 0 */
38 38
39#ifdef __GNUC__ 39#ifdef __GNUC__
40__inline 40__inline
@@ -48,39 +48,39 @@ is_reserved_hash (register const char *str, register unsigned int len)
48{ 48{
49 static const unsigned char asso_values[] = 49 static const unsigned char asso_values[] =
50 { 50 {
51 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 51 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
52 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 52 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
53 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 53 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
54 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 54 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
55 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 55 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
56 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 56 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
57 65, 65, 65, 65, 65, 65, 65, 65, 65, 5, 57 67, 67, 67, 67, 67, 67, 67, 67, 67, 0,
58 65, 65, 65, 65, 65, 65, 35, 65, 65, 65, 58 67, 67, 67, 67, 67, 67, 15, 67, 67, 67,
59 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, 59 0, 67, 67, 67, 67, 67, 67, 67, 67, 67,
60 65, 65, 65, 65, 65, 0, 65, 0, 65, 5, 60 67, 67, 67, 67, 67, 0, 67, 0, 67, 5,
61 20, 15, 10, 30, 65, 15, 65, 65, 20, 0, 61 25, 20, 15, 30, 67, 15, 67, 67, 10, 0,
62 10, 35, 20, 65, 10, 5, 0, 10, 5, 65, 62 10, 40, 20, 67, 10, 5, 0, 10, 15, 67,
63 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 63 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
64 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 64 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
65 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
66 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
67 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
68 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 68 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
69 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 69 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
70 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 70 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
71 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 71 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
72 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 72 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
73 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 73 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
74 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 74 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
75 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 75 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
76 65, 65, 65, 65, 65, 65 76 67, 67, 67, 67, 67, 67
77 }; 77 };
78 return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; 78 return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
79} 79}
80 80
81#ifdef __GNUC__ 81#ifdef __GNUC__
82__inline 82__inline
83#ifdef __GNUC_STDC_INLINE__ 83#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
84__attribute__ ((__gnu_inline__)) 84__attribute__ ((__gnu_inline__))
85#endif 85#endif
86#endif 86#endif
@@ -89,116 +89,119 @@ is_reserved_word (register const char *str, register unsigned int len)
89{ 89{
90 enum 90 enum
91 { 91 {
92 TOTAL_KEYWORDS = 43, 92 TOTAL_KEYWORDS = 45,
93 MIN_WORD_LENGTH = 3, 93 MIN_WORD_LENGTH = 3,
94 MAX_WORD_LENGTH = 24, 94 MAX_WORD_LENGTH = 24,
95 MIN_HASH_VALUE = 3, 95 MIN_HASH_VALUE = 3,
96 MAX_HASH_VALUE = 64 96 MAX_HASH_VALUE = 66
97 }; 97 };
98 98
99 static const struct resword wordlist[] = 99 static const struct resword wordlist[] =
100 { 100 {
101 {""}, {""}, {""}, 101 {""}, {""}, {""},
102#line 28 "scripts/genksyms/keywords.gperf" 102#line 30 "scripts/genksyms/keywords.gperf"
103 {"asm", ASM_KEYW}, 103 {"asm", ASM_KEYW},
104 {""}, 104 {""},
105#line 10 "scripts/genksyms/keywords.gperf" 105#line 12 "scripts/genksyms/keywords.gperf"
106 {"__asm", ASM_KEYW}, 106 {"__asm", ASM_KEYW},
107 {""}, 107 {""},
108#line 11 "scripts/genksyms/keywords.gperf" 108#line 13 "scripts/genksyms/keywords.gperf"
109 {"__asm__", ASM_KEYW}, 109 {"__asm__", ASM_KEYW},
110 {""}, {""}, 110 {""}, {""},
111#line 54 "scripts/genksyms/keywords.gperf" 111#line 56 "scripts/genksyms/keywords.gperf"
112 {"__typeof__", TYPEOF_KEYW}, 112 {"__typeof__", TYPEOF_KEYW},
113 {""}, 113 {""},
114#line 14 "scripts/genksyms/keywords.gperf" 114#line 16 "scripts/genksyms/keywords.gperf"
115 {"__const", CONST_KEYW}, 115 {"__const", CONST_KEYW},
116#line 13 "scripts/genksyms/keywords.gperf"
117 {"__attribute__", ATTRIBUTE_KEYW},
118#line 15 "scripts/genksyms/keywords.gperf" 116#line 15 "scripts/genksyms/keywords.gperf"
117 {"__attribute__", ATTRIBUTE_KEYW},
118#line 17 "scripts/genksyms/keywords.gperf"
119 {"__const__", CONST_KEYW}, 119 {"__const__", CONST_KEYW},
120#line 20 "scripts/genksyms/keywords.gperf" 120#line 22 "scripts/genksyms/keywords.gperf"
121 {"__signed__", SIGNED_KEYW}, 121 {"__signed__", SIGNED_KEYW},
122#line 46 "scripts/genksyms/keywords.gperf" 122#line 48 "scripts/genksyms/keywords.gperf"
123 {"static", STATIC_KEYW}, 123 {"static", STATIC_KEYW},
124#line 22 "scripts/genksyms/keywords.gperf" 124 {""},
125 {"__volatile__", VOLATILE_KEYW}, 125#line 43 "scripts/genksyms/keywords.gperf"
126#line 41 "scripts/genksyms/keywords.gperf"
127 {"int", INT_KEYW}, 126 {"int", INT_KEYW},
128#line 34 "scripts/genksyms/keywords.gperf" 127#line 36 "scripts/genksyms/keywords.gperf"
129 {"char", CHAR_KEYW}, 128 {"char", CHAR_KEYW},
130#line 35 "scripts/genksyms/keywords.gperf" 129#line 37 "scripts/genksyms/keywords.gperf"
131 {"const", CONST_KEYW}, 130 {"const", CONST_KEYW},
132#line 47 "scripts/genksyms/keywords.gperf" 131#line 49 "scripts/genksyms/keywords.gperf"
133 {"struct", STRUCT_KEYW}, 132 {"struct", STRUCT_KEYW},
134#line 26 "scripts/genksyms/keywords.gperf" 133#line 28 "scripts/genksyms/keywords.gperf"
135 {"__restrict__", RESTRICT_KEYW}, 134 {"__restrict__", RESTRICT_KEYW},
136#line 27 "scripts/genksyms/keywords.gperf" 135#line 29 "scripts/genksyms/keywords.gperf"
137 {"restrict", RESTRICT_KEYW}, 136 {"restrict", RESTRICT_KEYW},
138#line 25 "scripts/genksyms/keywords.gperf" 137#line 9 "scripts/genksyms/keywords.gperf"
139 {"_restrict", RESTRICT_KEYW}, 138 {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW},
140#line 18 "scripts/genksyms/keywords.gperf" 139#line 20 "scripts/genksyms/keywords.gperf"
141 {"__inline__", INLINE_KEYW}, 140 {"__inline__", INLINE_KEYW},
142#line 12 "scripts/genksyms/keywords.gperf"
143 {"__attribute", ATTRIBUTE_KEYW},
144 {""}, 141 {""},
145#line 16 "scripts/genksyms/keywords.gperf" 142#line 24 "scripts/genksyms/keywords.gperf"
143 {"__volatile__", VOLATILE_KEYW},
144#line 7 "scripts/genksyms/keywords.gperf"
145 {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW},
146#line 27 "scripts/genksyms/keywords.gperf"
147 {"_restrict", RESTRICT_KEYW},
148 {""},
149#line 14 "scripts/genksyms/keywords.gperf"
150 {"__attribute", ATTRIBUTE_KEYW},
151#line 8 "scripts/genksyms/keywords.gperf"
152 {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
153#line 18 "scripts/genksyms/keywords.gperf"
146 {"__extension__", EXTENSION_KEYW}, 154 {"__extension__", EXTENSION_KEYW},
147#line 37 "scripts/genksyms/keywords.gperf" 155#line 39 "scripts/genksyms/keywords.gperf"
148 {"enum", ENUM_KEYW}, 156 {"enum", ENUM_KEYW},
149#line 21 "scripts/genksyms/keywords.gperf" 157#line 10 "scripts/genksyms/keywords.gperf"
150 {"__volatile", VOLATILE_KEYW}, 158 {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW},
151#line 38 "scripts/genksyms/keywords.gperf" 159#line 40 "scripts/genksyms/keywords.gperf"
152 {"extern", EXTERN_KEYW}, 160 {"extern", EXTERN_KEYW},
153 {""}, 161 {""},
154#line 19 "scripts/genksyms/keywords.gperf" 162#line 21 "scripts/genksyms/keywords.gperf"
155 {"__signed", SIGNED_KEYW}, 163 {"__signed", SIGNED_KEYW},
156#line 9 "scripts/genksyms/keywords.gperf" 164#line 11 "scripts/genksyms/keywords.gperf"
157 {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, 165 {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
158 {""}, 166#line 51 "scripts/genksyms/keywords.gperf"
159#line 53 "scripts/genksyms/keywords.gperf" 167 {"union", UNION_KEYW},
168#line 55 "scripts/genksyms/keywords.gperf"
160 {"typeof", TYPEOF_KEYW}, 169 {"typeof", TYPEOF_KEYW},
161#line 48 "scripts/genksyms/keywords.gperf" 170#line 50 "scripts/genksyms/keywords.gperf"
162 {"typedef", TYPEDEF_KEYW}, 171 {"typedef", TYPEDEF_KEYW},
163#line 17 "scripts/genksyms/keywords.gperf" 172#line 19 "scripts/genksyms/keywords.gperf"
164 {"__inline", INLINE_KEYW}, 173 {"__inline", INLINE_KEYW},
165#line 33 "scripts/genksyms/keywords.gperf" 174#line 35 "scripts/genksyms/keywords.gperf"
166 {"auto", AUTO_KEYW}, 175 {"auto", AUTO_KEYW},
167#line 49 "scripts/genksyms/keywords.gperf" 176#line 23 "scripts/genksyms/keywords.gperf"
168 {"union", UNION_KEYW}, 177 {"__volatile", VOLATILE_KEYW},
169 {""}, {""},
170#line 50 "scripts/genksyms/keywords.gperf"
171 {"unsigned", UNSIGNED_KEYW},
172#line 51 "scripts/genksyms/keywords.gperf"
173 {"void", VOID_KEYW},
174#line 44 "scripts/genksyms/keywords.gperf"
175 {"short", SHORT_KEYW},
176 {""}, {""}, 178 {""}, {""},
177#line 52 "scripts/genksyms/keywords.gperf" 179#line 52 "scripts/genksyms/keywords.gperf"
178 {"volatile", VOLATILE_KEYW}, 180 {"unsigned", UNSIGNED_KEYW},
179 {""},
180#line 39 "scripts/genksyms/keywords.gperf"
181 {"float", FLOAT_KEYW},
182#line 36 "scripts/genksyms/keywords.gperf"
183 {"double", DOUBLE_KEYW},
184 {""}, 181 {""},
185#line 7 "scripts/genksyms/keywords.gperf" 182#line 46 "scripts/genksyms/keywords.gperf"
186 {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, 183 {"short", SHORT_KEYW},
187 {""}, {""}, 184#line 42 "scripts/genksyms/keywords.gperf"
188#line 40 "scripts/genksyms/keywords.gperf"
189 {"inline", INLINE_KEYW}, 185 {"inline", INLINE_KEYW},
190#line 8 "scripts/genksyms/keywords.gperf"
191 {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW},
192#line 43 "scripts/genksyms/keywords.gperf"
193 {"register", REGISTER_KEYW},
194 {""}, 186 {""},
195#line 24 "scripts/genksyms/keywords.gperf" 187#line 54 "scripts/genksyms/keywords.gperf"
188 {"volatile", VOLATILE_KEYW},
189#line 44 "scripts/genksyms/keywords.gperf"
190 {"long", LONG_KEYW},
191#line 26 "scripts/genksyms/keywords.gperf"
196 {"_Bool", BOOL_KEYW}, 192 {"_Bool", BOOL_KEYW},
197#line 45 "scripts/genksyms/keywords.gperf"
198 {"signed", SIGNED_KEYW},
199 {""}, {""}, 193 {""}, {""},
200#line 42 "scripts/genksyms/keywords.gperf" 194#line 45 "scripts/genksyms/keywords.gperf"
201 {"long", LONG_KEYW} 195 {"register", REGISTER_KEYW},
196#line 53 "scripts/genksyms/keywords.gperf"
197 {"void", VOID_KEYW},
198#line 41 "scripts/genksyms/keywords.gperf"
199 {"float", FLOAT_KEYW},
200#line 38 "scripts/genksyms/keywords.gperf"
201 {"double", DOUBLE_KEYW},
202 {""}, {""}, {""}, {""},
203#line 47 "scripts/genksyms/keywords.gperf"
204 {"signed", SIGNED_KEYW}
202 }; 205 };
203 206
204 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 207 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf
index 8fe977a4d57b..e6349acb6f2f 100644
--- a/scripts/genksyms/keywords.gperf
+++ b/scripts/genksyms/keywords.gperf
@@ -7,6 +7,8 @@ struct resword { const char *name; int token; }
7EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW 7EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW
8EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW 8EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW
9EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW 9EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW
10EXPORT_UNUSED_SYMBOL, EXPORT_SYMBOL_KEYW
11EXPORT_UNUSED_SYMBOL_GPL, EXPORT_SYMBOL_KEYW
10__asm, ASM_KEYW 12__asm, ASM_KEYW
11__asm__, ASM_KEYW 13__asm__, ASM_KEYW
12__attribute, ATTRIBUTE_KEYW 14__attribute, ATTRIBUTE_KEYW
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 445e8845f0a4..090f24839700 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -296,46 +296,56 @@ my @status = ();
296 296
297foreach my $file (@files) { 297foreach my $file (@files) {
298 298
299#Do not match excluded file patterns 299 my %hash;
300 300 my $tvi = find_first_section();
301 my $exclude = 0; 301 while ($tvi < @typevalue) {
302 foreach my $line (@typevalue) { 302 my $start = find_starting_index($tvi);
303 if ($line =~ m/^(\C):\s*(.*)/) { 303 my $end = find_ending_index($tvi);
304 my $type = $1; 304 my $exclude = 0;
305 my $value = $2; 305 my $i;
306 if ($type eq 'X') { 306
307 if (file_match_pattern($file, $value)) { 307 #Do not match excluded file patterns
308 $exclude = 1;
309 last;
310 }
311 }
312 }
313 }
314 308
315 if (!$exclude) { 309 for ($i = $start; $i < $end; $i++) {
316 my $tvi = 0; 310 my $line = $typevalue[$i];
317 my %hash;
318 foreach my $line (@typevalue) {
319 if ($line =~ m/^(\C):\s*(.*)/) { 311 if ($line =~ m/^(\C):\s*(.*)/) {
320 my $type = $1; 312 my $type = $1;
321 my $value = $2; 313 my $value = $2;
322 if ($type eq 'F') { 314 if ($type eq 'X') {
323 if (file_match_pattern($file, $value)) { 315 if (file_match_pattern($file, $value)) {
324 my $value_pd = ($value =~ tr@/@@); 316 $exclude = 1;
325 my $file_pd = ($file =~ tr@/@@);
326 $value_pd++ if (substr($value,-1,1) ne "/");
327 if ($pattern_depth == 0 ||
328 (($file_pd - $value_pd) < $pattern_depth)) {
329 $hash{$tvi} = $value_pd;
330 }
331 } 317 }
332 } 318 }
333 } 319 }
334 $tvi++;
335 } 320 }
336 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { 321
337 add_categories($line); 322 if (!$exclude) {
323 for ($i = $start; $i < $end; $i++) {
324 my $line = $typevalue[$i];
325 if ($line =~ m/^(\C):\s*(.*)/) {
326 my $type = $1;
327 my $value = $2;
328 if ($type eq 'F') {
329 if (file_match_pattern($file, $value)) {
330 my $value_pd = ($value =~ tr@/@@);
331 my $file_pd = ($file =~ tr@/@@);
332 $value_pd++ if (substr($value,-1,1) ne "/");
333 if ($pattern_depth == 0 ||
334 (($file_pd - $value_pd) < $pattern_depth)) {
335 $hash{$tvi} = $value_pd;
336 }
337 }
338 }
339 }
340 }
338 } 341 }
342
343 $tvi += ($end - $start);
344
345 }
346
347 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
348 add_categories($line);
339 } 349 }
340 350
341 if ($email && $email_git) { 351 if ($email && $email_git) {
@@ -570,6 +580,20 @@ sub format_email {
570 return $formatted_email; 580 return $formatted_email;
571} 581}
572 582
583sub find_first_section {
584 my $index = 0;
585
586 while ($index < @typevalue) {
587 my $tv = $typevalue[$index];
588 if (($tv =~ m/^(\C):\s*(.*)/)) {
589 last;
590 }
591 $index++;
592 }
593
594 return $index;
595}
596
573sub find_starting_index { 597sub find_starting_index {
574 my ($index) = @_; 598 my ($index) = @_;
575 599
diff --git a/scripts/headers.sh b/scripts/headers.sh
index 0308ecc10d5b..1ddcdd38d97f 100755
--- a/scripts/headers.sh
+++ b/scripts/headers.sh
@@ -8,8 +8,6 @@ do_command()
8{ 8{
9 if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then 9 if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then
10 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 10 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
11 elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then
12 make ARCH=$2 KBUILD_HEADERS=$1 headers_$1
13 else 11 else
14 printf "Ignoring arch: %s\n" ${arch} 12 printf "Ignoring arch: %s\n" ${arch}
15 fi 13 fi
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 80599e3a7994..999e8a7d5bf7 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -27,6 +27,7 @@ oldconfig: $(obj)/conf
27 $< -o $(Kconfig) 27 $< -o $(Kconfig)
28 28
29silentoldconfig: $(obj)/conf 29silentoldconfig: $(obj)/conf
30 $(Q)mkdir -p include/generated
30 $< -s $(Kconfig) 31 $< -s $(Kconfig)
31 32
32localmodconfig: $(obj)/streamline_config.pl $(obj)/conf 33localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index b55e72ff2fc6..c4dec80cfd8e 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -677,7 +677,7 @@ int conf_write_autoconf(void)
677 struct symbol *sym; 677 struct symbol *sym;
678 const char *str; 678 const char *str;
679 const char *name; 679 const char *name;
680 FILE *out, *out_h; 680 FILE *out, *tristate, *out_h;
681 time_t now; 681 time_t now;
682 int i, l; 682 int i, l;
683 683
@@ -692,9 +692,16 @@ int conf_write_autoconf(void)
692 if (!out) 692 if (!out)
693 return 1; 693 return 1;
694 694
695 tristate = fopen(".tmpconfig_tristate", "w");
696 if (!tristate) {
697 fclose(out);
698 return 1;
699 }
700
695 out_h = fopen(".tmpconfig.h", "w"); 701 out_h = fopen(".tmpconfig.h", "w");
696 if (!out_h) { 702 if (!out_h) {
697 fclose(out); 703 fclose(out);
704 fclose(tristate);
698 return 1; 705 return 1;
699 } 706 }
700 707
@@ -707,6 +714,9 @@ int conf_write_autoconf(void)
707 "# %s" 714 "# %s"
708 "#\n", 715 "#\n",
709 sym_get_string_value(sym), ctime(&now)); 716 sym_get_string_value(sym), ctime(&now));
717 fprintf(tristate, "#\n"
718 "# Automatically generated - do not edit\n"
719 "\n");
710 fprintf(out_h, "/*\n" 720 fprintf(out_h, "/*\n"
711 " * Automatically generated C config: don't edit\n" 721 " * Automatically generated C config: don't edit\n"
712 " * Linux kernel version: %s\n" 722 " * Linux kernel version: %s\n"
@@ -727,10 +737,14 @@ int conf_write_autoconf(void)
727 break; 737 break;
728 case mod: 738 case mod:
729 fprintf(out, "CONFIG_%s=m\n", sym->name); 739 fprintf(out, "CONFIG_%s=m\n", sym->name);
740 fprintf(tristate, "CONFIG_%s=M\n", sym->name);
730 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); 741 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
731 break; 742 break;
732 case yes: 743 case yes:
733 fprintf(out, "CONFIG_%s=y\n", sym->name); 744 fprintf(out, "CONFIG_%s=y\n", sym->name);
745 if (sym->type == S_TRISTATE)
746 fprintf(tristate, "CONFIG_%s=Y\n",
747 sym->name);
734 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); 748 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
735 break; 749 break;
736 } 750 }
@@ -772,13 +786,19 @@ int conf_write_autoconf(void)
772 } 786 }
773 } 787 }
774 fclose(out); 788 fclose(out);
789 fclose(tristate);
775 fclose(out_h); 790 fclose(out_h);
776 791
777 name = getenv("KCONFIG_AUTOHEADER"); 792 name = getenv("KCONFIG_AUTOHEADER");
778 if (!name) 793 if (!name)
779 name = "include/linux/autoconf.h"; 794 name = "include/generated/autoconf.h";
780 if (rename(".tmpconfig.h", name)) 795 if (rename(".tmpconfig.h", name))
781 return 1; 796 return 1;
797 name = getenv("KCONFIG_TRISTATE");
798 if (!name)
799 name = "include/config/tristate.conf";
800 if (rename(".tmpconfig_tristate", name))
801 return 1;
782 name = conf_get_autoconfig_name(); 802 name = conf_get_autoconfig_name();
783 /* 803 /*
784 * This must be the last step, kbuild has a dependency on auto.conf 804 * This must be the last step, kbuild has a dependency on auto.conf
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index bce3d0fe6fbd..23dbad80cce9 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -14,7 +14,7 @@ vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; }
14# So "sudo make install" won't change the "compiled by <user>" 14# So "sudo make install" won't change the "compiled by <user>"
15# do "compiled by root" 15# do "compiled by root"
16 16
17if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then 17if [ -r $TARGET -a ! -O include/generated/autoconf.h ]; then
18 vecho " SKIPPED $TARGET" 18 vecho " SKIPPED $TARGET"
19 exit 0 19 exit 0
20fi 20fi
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 6c4ffc767b91..20923613467c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -15,7 +15,7 @@
15#include <stdio.h> 15#include <stdio.h>
16#include <ctype.h> 16#include <ctype.h>
17#include "modpost.h" 17#include "modpost.h"
18#include "../../include/linux/autoconf.h" 18#include "../../include/generated/autoconf.h"
19#include "../../include/linux/license.h" 19#include "../../include/linux/license.h"
20 20
21/* Some toolchains use a `_' prefix for all user symbols. */ 21/* Some toolchains use a `_' prefix for all user symbols. */
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index f67cc885c807..62fcc3a7f4d3 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -77,9 +77,27 @@ clean-files += $(objtree)/binkernel.spec
77 77
78# Deb target 78# Deb target
79# --------------------------------------------------------------------------- 79# ---------------------------------------------------------------------------
80quiet_cmd_builddeb = BUILDDEB
81 cmd_builddeb = set -e; \
82 test `id -u` = 0 || \
83 test -n "$(KBUILD_PKG_ROOTCMD)" || { \
84 which fakeroot >/dev/null 2>&1 && \
85 KBUILD_PKG_ROOTCMD="fakeroot -u"; \
86 } || { \
87 echo; \
88 echo "builddeb must be run as root (or using fakeroot)."; \
89 echo "KBUILD_PKG_ROOTCMD is unset and fakeroot not found."; \
90 echo "Try setting KBUILD_PKG_ROOTCMD to a command to acquire"; \
91 echo "root privileges (e.g., 'fakeroot -u' or 'sudo')."; \
92 false; \
93 } && \
94 \
95 $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \
96 $(srctree)/scripts/package/builddeb
97
80deb-pkg: FORCE 98deb-pkg: FORCE
81 $(MAKE) KBUILD_SRC= 99 $(MAKE) KBUILD_SRC=
82 $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb 100 $(call cmd,builddeb)
83 101
84clean-dirs += $(objtree)/debian/ 102clean-dirs += $(objtree)/debian/
85 103
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index b1fd48db1640..51b2aa0acb82 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -101,7 +101,11 @@ esac
101# 101#
102( 102(
103 cd "${tmpdir}" 103 cd "${tmpdir}"
104 tar cf - . | ${compress} > "${tarball}${file_ext}" 104 opts=
105 if tar --owner=root --group=root --help >/dev/null 2>&1; then
106 opts="--owner=root --group=root"
107 fi
108 tar cf - . $opts | ${compress} > "${tarball}${file_ext}"
105) 109)
106 110
107echo "Tarball successfully created in ${tarball}${file_ext}" 111echo "Tarball successfully created in ${tarball}${file_ext}"
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 9cf0a6fad6ba..92f09fe9639e 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -113,13 +113,13 @@ $P =~ s@.*/@@g;
113 113
114my $V = '0.1'; 114my $V = '0.1';
115 115
116if ($#ARGV != 10) { 116if ($#ARGV != 11) {
117 print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n"; 117 print "usage: $P arch endian bits objdump objcopy cc ld nm rm mv is_module inputfile\n";
118 print "version: $V\n"; 118 print "version: $V\n";
119 exit(1); 119 exit(1);
120} 120}
121 121
122my ($arch, $bits, $objdump, $objcopy, $cc, 122my ($arch, $endian, $bits, $objdump, $objcopy, $cc,
123 $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV; 123 $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV;
124 124
125# This file refers to mcount and shouldn't be ftraced, so lets' ignore it 125# This file refers to mcount and shouldn't be ftraced, so lets' ignore it
@@ -295,6 +295,58 @@ if ($arch eq "x86_64") {
295 $ld .= " -m elf64_sparc"; 295 $ld .= " -m elf64_sparc";
296 $cc .= " -m64"; 296 $cc .= " -m64";
297 $objcopy .= " -O elf64-sparc"; 297 $objcopy .= " -O elf64-sparc";
298} elsif ($arch eq "mips") {
299 # To enable module support, we need to enable the -mlong-calls option
300 # of gcc for module, after using this option, we can not get the real
301 # offset of the calling to _mcount, but the offset of the lui
302 # instruction or the addiu one. herein, we record the address of the
303 # first one, and then we can replace this instruction by a branch
304 # instruction to jump over the profiling function to filter the
305 # indicated functions, or swith back to the lui instruction to trace
306 # them, which means dynamic tracing.
307 #
308 # c: 3c030000 lui v1,0x0
309 # c: R_MIPS_HI16 _mcount
310 # c: R_MIPS_NONE *ABS*
311 # c: R_MIPS_NONE *ABS*
312 # 10: 64630000 daddiu v1,v1,0
313 # 10: R_MIPS_LO16 _mcount
314 # 10: R_MIPS_NONE *ABS*
315 # 10: R_MIPS_NONE *ABS*
316 # 14: 03e0082d move at,ra
317 # 18: 0060f809 jalr v1
318 #
319 # for the kernel:
320 #
321 # 10: 03e0082d move at,ra
322 # 14: 0c000000 jal 0 <loongson_halt>
323 # 14: R_MIPS_26 _mcount
324 # 14: R_MIPS_NONE *ABS*
325 # 14: R_MIPS_NONE *ABS*
326 # 18: 00020021 nop
327 if ($is_module eq "0") {
328 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
329 } else {
330 $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$";
331 }
332 $objdump .= " -Melf-trad".$endian."mips ";
333
334 if ($endian eq "big") {
335 $endian = " -EB ";
336 $ld .= " -melf".$bits."btsmip";
337 } else {
338 $endian = " -EL ";
339 $ld .= " -melf".$bits."ltsmip";
340 }
341
342 $cc .= " -mno-abicalls -fno-pic -mabi=" . $bits . $endian;
343 $ld .= $endian;
344
345 if ($bits == 64) {
346 $function_regex =
347 "^([0-9a-fA-F]+)\\s+<(.|[^\$]L.*?|\$[^L].*?|[^\$][^L].*?)>:";
348 $type = ".dword";
349 }
298} elsif ($arch eq "microblaze") { 350} elsif ($arch eq "microblaze") {
299 # Microblaze calls '_mcount' instead of plain 'mcount'. 351 # Microblaze calls '_mcount' instead of plain 'mcount'.
300 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; 352 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
diff --git a/scripts/tags.sh b/scripts/tags.sh
index d52f7a01557c..1a0c44d7c4a7 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -89,7 +89,13 @@ all_defconfigs()
89 89
90docscope() 90docscope()
91{ 91{
92 (echo \-k; echo \-q; all_sources) > cscope.files 92 # always use absolute paths for cscope, as recommended by cscope
93 # upstream
94 case "$tree" in
95 /*) ;;
96 *) tree=$PWD/$tree ;;
97 esac
98 (cd /; echo \-k; echo \-q; all_sources) > cscope.files
93 cscope -b -f cscope.out 99 cscope -b -f cscope.out
94} 100}
95 101
diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 30d459fb0709..44d39785e50d 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -1,13 +1,5 @@
1/* 1/*
2 * Copyright (c) 2002 - 2005 Tony Finch <dot@dotat.at>. All rights reserved. 2 * Copyright (c) 2002 - 2009 Tony Finch <dot@dotat.at>
3 *
4 * This code is derived from software contributed to Berkeley by Dave Yost.
5 * It was rewritten to support ANSI C by Tony Finch. The original version of
6 * unifdef carried the following copyright notice. None of its code remains
7 * in this version (though some of the names remain).
8 *
9 * Copyright (c) 1985, 1993
10 * The Regents of the University of California. All rights reserved.
11 * 3 *
12 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
@@ -31,23 +23,20 @@
31 * SUCH DAMAGE. 23 * SUCH DAMAGE.
32 */ 24 */
33 25
34#include <sys/cdefs.h> 26/*
27 * This code was derived from software contributed to Berkeley by Dave Yost.
28 * It was rewritten to support ANSI C by Tony Finch. The original version
29 * of unifdef carried the 4-clause BSD copyright licence. None of its code
30 * remains in this version (though some of the names remain) so it now
31 * carries a more liberal licence.
32 *
33 * The latest version is available from http://dotat.at/prog/unifdef
34 */
35 35
36#ifndef lint 36static const char * const copyright[] = {
37#if 0 37 "@(#) Copyright (c) 2002 - 2009 Tony Finch <dot@dotat.at>\n",
38static const char copyright[] = 38 "$dotat: unifdef/unifdef.c,v 1.190 2009/11/27 17:21:26 fanf2 Exp $",
39"@(#) Copyright (c) 1985, 1993\n\ 39};
40 The Regents of the University of California. All rights reserved.\n";
41#endif
42#ifdef __IDSTRING
43__IDSTRING(Berkeley, "@(#)unifdef.c 8.1 (Berkeley) 6/6/93");
44__IDSTRING(NetBSD, "$NetBSD: unifdef.c,v 1.8 2000/07/03 02:51:36 matt Exp $");
45__IDSTRING(dotat, "$dotat: things/unifdef.c,v 1.171 2005/03/08 12:38:48 fanf2 Exp $");
46#endif
47#endif /* not lint */
48#ifdef __FBSDID
49__FBSDID("$FreeBSD: /repoman/r/ncvs/src/usr.bin/unifdef/unifdef.c,v 1.20 2005/05/21 09:55:09 ru Exp $");
50#endif
51 40
52/* 41/*
53 * unifdef - remove ifdef'ed lines 42 * unifdef - remove ifdef'ed lines
@@ -72,8 +61,6 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/usr.bin/unifdef/unifdef.c,v 1.20 2005/05
72#include <string.h> 61#include <string.h>
73#include <unistd.h> 62#include <unistd.h>
74 63
75size_t strlcpy(char *dst, const char *src, size_t siz);
76
77/* types of input lines: */ 64/* types of input lines: */
78typedef enum { 65typedef enum {
79 LT_TRUEI, /* a true #if with ignore flag */ 66 LT_TRUEI, /* a true #if with ignore flag */
@@ -90,6 +77,7 @@ typedef enum {
90 LT_DODGY_LAST = LT_DODGY + LT_ENDIF, 77 LT_DODGY_LAST = LT_DODGY + LT_ENDIF,
91 LT_PLAIN, /* ordinary line */ 78 LT_PLAIN, /* ordinary line */
92 LT_EOF, /* end of file */ 79 LT_EOF, /* end of file */
80 LT_ERROR, /* unevaluable #if */
93 LT_COUNT 81 LT_COUNT
94} Linetype; 82} Linetype;
95 83
@@ -100,7 +88,7 @@ static char const * const linetype_name[] = {
100 "DODGY IF", "DODGY TRUE", "DODGY FALSE", 88 "DODGY IF", "DODGY TRUE", "DODGY FALSE",
101 "DODGY ELIF", "DODGY ELTRUE", "DODGY ELFALSE", 89 "DODGY ELIF", "DODGY ELTRUE", "DODGY ELFALSE",
102 "DODGY ELSE", "DODGY ENDIF", 90 "DODGY ELSE", "DODGY ENDIF",
103 "PLAIN", "EOF" 91 "PLAIN", "EOF", "ERROR"
104}; 92};
105 93
106/* state of #if processing */ 94/* state of #if processing */
@@ -168,11 +156,13 @@ static char const * const linestate_name[] = {
168 * Globals. 156 * Globals.
169 */ 157 */
170 158
159static bool compblank; /* -B: compress blank lines */
160static bool lnblank; /* -b: blank deleted lines */
171static bool complement; /* -c: do the complement */ 161static bool complement; /* -c: do the complement */
172static bool debugging; /* -d: debugging reports */ 162static bool debugging; /* -d: debugging reports */
173static bool iocccok; /* -e: fewer IOCCC errors */ 163static bool iocccok; /* -e: fewer IOCCC errors */
164static bool strictlogic; /* -K: keep ambiguous #ifs */
174static bool killconsts; /* -k: eval constant #ifs */ 165static bool killconsts; /* -k: eval constant #ifs */
175static bool lnblank; /* -l: blank deleted lines */
176static bool lnnum; /* -n: add #line directives */ 166static bool lnnum; /* -n: add #line directives */
177static bool symlist; /* -s: output symbol list */ 167static bool symlist; /* -s: output symbol list */
178static bool text; /* -t: this is a text file */ 168static bool text; /* -t: this is a text file */
@@ -196,7 +186,9 @@ static bool ignoring[MAXDEPTH]; /* ignore comments state */
196static int stifline[MAXDEPTH]; /* start of current #if */ 186static int stifline[MAXDEPTH]; /* start of current #if */
197static int depth; /* current #if nesting */ 187static int depth; /* current #if nesting */
198static int delcount; /* count of deleted lines */ 188static int delcount; /* count of deleted lines */
199static bool keepthis; /* don't delete constant #if */ 189static unsigned blankcount; /* count of blank lines */
190static unsigned blankmax; /* maximum recent blankcount */
191static bool constexpr; /* constant #if expression */
200 192
201static int exitstat; /* program exit status */ 193static int exitstat; /* program exit status */
202 194
@@ -206,13 +198,14 @@ static void done(void);
206static void error(const char *); 198static void error(const char *);
207static int findsym(const char *); 199static int findsym(const char *);
208static void flushline(bool); 200static void flushline(bool);
209static Linetype get_line(void); 201static Linetype parseline(void);
210static Linetype ifeval(const char **); 202static Linetype ifeval(const char **);
211static void ignoreoff(void); 203static void ignoreoff(void);
212static void ignoreon(void); 204static void ignoreon(void);
213static void keywordedit(const char *); 205static void keywordedit(const char *);
214static void nest(void); 206static void nest(void);
215static void process(void); 207static void process(void);
208static const char *skipargs(const char *);
216static const char *skipcomment(const char *); 209static const char *skipcomment(const char *);
217static const char *skipsym(const char *); 210static const char *skipsym(const char *);
218static void state(Ifstate); 211static void state(Ifstate);
@@ -220,7 +213,7 @@ static int strlcmp(const char *, const char *, size_t);
220static void unnest(void); 213static void unnest(void);
221static void usage(void); 214static void usage(void);
222 215
223#define endsym(c) (!isalpha((unsigned char)c) && !isdigit((unsigned char)c) && c != '_') 216#define endsym(c) (!isalnum((unsigned char)c) && c != '_')
224 217
225/* 218/*
226 * The main program. 219 * The main program.
@@ -230,7 +223,7 @@ main(int argc, char *argv[])
230{ 223{
231 int opt; 224 int opt;
232 225
233 while ((opt = getopt(argc, argv, "i:D:U:I:cdeklnst")) != -1) 226 while ((opt = getopt(argc, argv, "i:D:U:I:BbcdeKklnst")) != -1)
234 switch (opt) { 227 switch (opt) {
235 case 'i': /* treat stuff controlled by these symbols as text */ 228 case 'i': /* treat stuff controlled by these symbols as text */
236 /* 229 /*
@@ -255,6 +248,13 @@ main(int argc, char *argv[])
255 case 'I': 248 case 'I':
256 /* no-op for compatibility with cpp */ 249 /* no-op for compatibility with cpp */
257 break; 250 break;
251 case 'B': /* compress blank lines around removed section */
252 compblank = true;
253 break;
254 case 'b': /* blank deleted lines instead of omitting them */
255 case 'l': /* backwards compatibility */
256 lnblank = true;
257 break;
258 case 'c': /* treat -D as -U and vice versa */ 258 case 'c': /* treat -D as -U and vice versa */
259 complement = true; 259 complement = true;
260 break; 260 break;
@@ -264,12 +264,12 @@ main(int argc, char *argv[])
264 case 'e': /* fewer errors from dodgy lines */ 264 case 'e': /* fewer errors from dodgy lines */
265 iocccok = true; 265 iocccok = true;
266 break; 266 break;
267 case 'K': /* keep ambiguous #ifs */
268 strictlogic = true;
269 break;
267 case 'k': /* process constant #ifs */ 270 case 'k': /* process constant #ifs */
268 killconsts = true; 271 killconsts = true;
269 break; 272 break;
270 case 'l': /* blank deleted lines instead of omitting them */
271 lnblank = true;
272 break;
273 case 'n': /* add #line directive after deleted lines */ 273 case 'n': /* add #line directive after deleted lines */
274 lnnum = true; 274 lnnum = true;
275 break; 275 break;
@@ -284,6 +284,8 @@ main(int argc, char *argv[])
284 } 284 }
285 argc -= optind; 285 argc -= optind;
286 argv += optind; 286 argv += optind;
287 if (compblank && lnblank)
288 errx(2, "-B and -b are mutually exclusive");
287 if (argc > 1) { 289 if (argc > 1) {
288 errx(2, "can only do one file"); 290 errx(2, "can only do one file");
289 } else if (argc == 1 && strcmp(*argv, "-") != 0) { 291 } else if (argc == 1 && strcmp(*argv, "-") != 0) {
@@ -302,7 +304,7 @@ main(int argc, char *argv[])
302static void 304static void
303usage(void) 305usage(void)
304{ 306{
305 fprintf(stderr, "usage: unifdef [-cdeklnst] [-Ipath]" 307 fprintf(stderr, "usage: unifdef [-BbcdeKknst] [-Ipath]"
306 " [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file]\n"); 308 " [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file]\n");
307 exit(2); 309 exit(2);
308} 310}
@@ -383,46 +385,46 @@ static state_fn * const trans_table[IS_COUNT][LT_COUNT] = {
383/* IS_OUTSIDE */ 385/* IS_OUTSIDE */
384{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Eendif, 386{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Eendif,
385 Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eendif, 387 Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eendif,
386 print, done }, 388 print, done, abort },
387/* IS_FALSE_PREFIX */ 389/* IS_FALSE_PREFIX */
388{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Strue, Sfalse,Selse, Dendif, 390{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Strue, Sfalse,Selse, Dendif,
389 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Eioccc,Eioccc,Eioccc,Eioccc, 391 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Eioccc,Eioccc,Eioccc,Eioccc,
390 drop, Eeof }, 392 drop, Eeof, abort },
391/* IS_TRUE_PREFIX */ 393/* IS_TRUE_PREFIX */
392{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Dfalse,Dfalse,Dfalse,Delse, Dendif, 394{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Dfalse,Dfalse,Dfalse,Delse, Dendif,
393 Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc, 395 Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc,
394 print, Eeof }, 396 print, Eeof, abort },
395/* IS_PASS_MIDDLE */ 397/* IS_PASS_MIDDLE */
396{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Pelif, Mtrue, Delif, Pelse, Pendif, 398{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Pelif, Mtrue, Delif, Pelse, Pendif,
397 Oiffy, Oiffy, Fpass, Oif, Oif, Pelif, Oelif, Oelif, Pelse, Pendif, 399 Oiffy, Oiffy, Fpass, Oif, Oif, Pelif, Oelif, Oelif, Pelse, Pendif,
398 print, Eeof }, 400 print, Eeof, abort },
399/* IS_FALSE_MIDDLE */ 401/* IS_FALSE_MIDDLE */
400{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Pelif, Mtrue, Delif, Pelse, Pendif, 402{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Pelif, Mtrue, Delif, Pelse, Pendif,
401 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc, 403 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc,
402 drop, Eeof }, 404 drop, Eeof, abort },
403/* IS_TRUE_MIDDLE */ 405/* IS_TRUE_MIDDLE */
404{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Melif, Melif, Melif, Melse, Pendif, 406{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Melif, Melif, Melif, Melse, Pendif,
405 Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Pendif, 407 Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Pendif,
406 print, Eeof }, 408 print, Eeof, abort },
407/* IS_PASS_ELSE */ 409/* IS_PASS_ELSE */
408{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Pendif, 410{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Pendif,
409 Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Pendif, 411 Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Pendif,
410 print, Eeof }, 412 print, Eeof, abort },
411/* IS_FALSE_ELSE */ 413/* IS_FALSE_ELSE */
412{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Dendif, 414{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Dendif,
413 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Eioccc, 415 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Eioccc,
414 drop, Eeof }, 416 drop, Eeof, abort },
415/* IS_TRUE_ELSE */ 417/* IS_TRUE_ELSE */
416{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Dendif, 418{ Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Dendif,
417 Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eioccc, 419 Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eioccc,
418 print, Eeof }, 420 print, Eeof, abort },
419/* IS_FALSE_TRAILER */ 421/* IS_FALSE_TRAILER */
420{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Dendif, 422{ Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Dendif,
421 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Eioccc, 423 Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Eioccc,
422 drop, Eeof } 424 drop, Eeof, abort }
423/*TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF 425/*TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF
424 TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF (DODGY) 426 TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF (DODGY)
425 PLAIN EOF */ 427 PLAIN EOF ERROR */
426}; 428};
427 429
428/* 430/*
@@ -463,9 +465,11 @@ keywordedit(const char *replacement)
463static void 465static void
464nest(void) 466nest(void)
465{ 467{
466 depth += 1; 468 if (depth > MAXDEPTH-1)
467 if (depth >= MAXDEPTH) 469 abort(); /* bug */
470 if (depth == MAXDEPTH-1)
468 error("Too many levels of nesting"); 471 error("Too many levels of nesting");
472 depth += 1;
469 stifline[depth] = linenum; 473 stifline[depth] = linenum;
470} 474}
471static void 475static void
@@ -490,15 +494,23 @@ flushline(bool keep)
490 if (symlist) 494 if (symlist)
491 return; 495 return;
492 if (keep ^ complement) { 496 if (keep ^ complement) {
493 if (lnnum && delcount > 0) 497 bool blankline = tline[strspn(tline, " \t\n")] == '\0';
494 printf("#line %d\n", linenum); 498 if (blankline && compblank && blankcount != blankmax) {
495 fputs(tline, stdout); 499 delcount += 1;
496 delcount = 0; 500 blankcount += 1;
501 } else {
502 if (lnnum && delcount > 0)
503 printf("#line %d\n", linenum);
504 fputs(tline, stdout);
505 delcount = 0;
506 blankmax = blankcount = blankline ? blankcount + 1 : 0;
507 }
497 } else { 508 } else {
498 if (lnblank) 509 if (lnblank)
499 putc('\n', stdout); 510 putc('\n', stdout);
500 exitstat = 1; 511 exitstat = 1;
501 delcount += 1; 512 delcount += 1;
513 blankcount = 0;
502 } 514 }
503} 515}
504 516
@@ -510,9 +522,12 @@ process(void)
510{ 522{
511 Linetype lineval; 523 Linetype lineval;
512 524
525 /* When compressing blank lines, act as if the file
526 is preceded by a large number of blank lines. */
527 blankmax = blankcount = 1000;
513 for (;;) { 528 for (;;) {
514 linenum++; 529 linenum++;
515 lineval = get_line(); 530 lineval = parseline();
516 trans_table[ifstate[depth]][lineval](); 531 trans_table[ifstate[depth]][lineval]();
517 debug("process %s -> %s depth %d", 532 debug("process %s -> %s depth %d",
518 linetype_name[lineval], 533 linetype_name[lineval],
@@ -526,7 +541,7 @@ process(void)
526 * help from skipcomment(). 541 * help from skipcomment().
527 */ 542 */
528static Linetype 543static Linetype
529get_line(void) 544parseline(void)
530{ 545{
531 const char *cp; 546 const char *cp;
532 int cursym; 547 int cursym;
@@ -595,9 +610,21 @@ get_line(void)
595 if (incomment) 610 if (incomment)
596 linestate = LS_DIRTY; 611 linestate = LS_DIRTY;
597 } 612 }
598 /* skipcomment should have changed the state */ 613 /* skipcomment normally changes the state, except
599 if (linestate == LS_HASH) 614 if the last line of the file lacks a newline, or
600 abort(); /* bug */ 615 if there is too much whitespace in a directive */
616 if (linestate == LS_HASH) {
617 size_t len = cp - tline;
618 if (fgets(tline + len, MAXLINE - len, input) == NULL) {
619 /* append the missing newline */
620 tline[len+0] = '\n';
621 tline[len+1] = '\0';
622 cp++;
623 linestate = LS_START;
624 } else {
625 linestate = LS_DIRTY;
626 }
627 }
601 } 628 }
602 if (linestate == LS_DIRTY) { 629 if (linestate == LS_DIRTY) {
603 while (*cp != '\0') 630 while (*cp != '\0')
@@ -610,17 +637,40 @@ get_line(void)
610 637
611/* 638/*
612 * These are the binary operators that are supported by the expression 639 * These are the binary operators that are supported by the expression
613 * evaluator. Note that if support for division is added then we also 640 * evaluator.
614 * need short-circuiting booleans because of divide-by-zero.
615 */ 641 */
616static int op_lt(int a, int b) { return (a < b); } 642static Linetype op_strict(int *p, int v, Linetype at, Linetype bt) {
617static int op_gt(int a, int b) { return (a > b); } 643 if(at == LT_IF || bt == LT_IF) return (LT_IF);
618static int op_le(int a, int b) { return (a <= b); } 644 return (*p = v, v ? LT_TRUE : LT_FALSE);
619static int op_ge(int a, int b) { return (a >= b); } 645}
620static int op_eq(int a, int b) { return (a == b); } 646static Linetype op_lt(int *p, Linetype at, int a, Linetype bt, int b) {
621static int op_ne(int a, int b) { return (a != b); } 647 return op_strict(p, a < b, at, bt);
622static int op_or(int a, int b) { return (a || b); } 648}
623static int op_and(int a, int b) { return (a && b); } 649static Linetype op_gt(int *p, Linetype at, int a, Linetype bt, int b) {
650 return op_strict(p, a > b, at, bt);
651}
652static Linetype op_le(int *p, Linetype at, int a, Linetype bt, int b) {
653 return op_strict(p, a <= b, at, bt);
654}
655static Linetype op_ge(int *p, Linetype at, int a, Linetype bt, int b) {
656 return op_strict(p, a >= b, at, bt);
657}
658static Linetype op_eq(int *p, Linetype at, int a, Linetype bt, int b) {
659 return op_strict(p, a == b, at, bt);
660}
661static Linetype op_ne(int *p, Linetype at, int a, Linetype bt, int b) {
662 return op_strict(p, a != b, at, bt);
663}
664static Linetype op_or(int *p, Linetype at, int a, Linetype bt, int b) {
665 if (!strictlogic && (at == LT_TRUE || bt == LT_TRUE))
666 return (*p = 1, LT_TRUE);
667 return op_strict(p, a || b, at, bt);
668}
669static Linetype op_and(int *p, Linetype at, int a, Linetype bt, int b) {
670 if (!strictlogic && (at == LT_FALSE || bt == LT_FALSE))
671 return (*p = 0, LT_FALSE);
672 return op_strict(p, a && b, at, bt);
673}
624 674
625/* 675/*
626 * An evaluation function takes three arguments, as follows: (1) a pointer to 676 * An evaluation function takes three arguments, as follows: (1) a pointer to
@@ -629,8 +679,8 @@ static int op_and(int a, int b) { return (a && b); }
629 * value of the expression; and (3) a pointer to a char* that points to the 679 * value of the expression; and (3) a pointer to a char* that points to the
630 * expression to be evaluated and that is updated to the end of the expression 680 * expression to be evaluated and that is updated to the end of the expression
631 * when evaluation is complete. The function returns LT_FALSE if the value of 681 * when evaluation is complete. The function returns LT_FALSE if the value of
632 * the expression is zero, LT_TRUE if it is non-zero, or LT_IF if the 682 * the expression is zero, LT_TRUE if it is non-zero, LT_IF if the expression
633 * expression could not be evaluated. 683 * depends on an unknown symbol, or LT_ERROR if there is a parse failure.
634 */ 684 */
635struct ops; 685struct ops;
636 686
@@ -649,7 +699,7 @@ static const struct ops {
649 eval_fn *inner; 699 eval_fn *inner;
650 struct op { 700 struct op {
651 const char *str; 701 const char *str;
652 int (*fn)(int, int); 702 Linetype (*fn)(int *, Linetype, int, Linetype, int);
653 } op[5]; 703 } op[5];
654} eval_ops[] = { 704} eval_ops[] = {
655 { eval_table, { { "||", op_or } } }, 705 { eval_table, { { "||", op_or } } },
@@ -664,8 +714,8 @@ static const struct ops {
664 714
665/* 715/*
666 * Function for evaluating the innermost parts of expressions, 716 * Function for evaluating the innermost parts of expressions,
667 * viz. !expr (expr) defined(symbol) symbol number 717 * viz. !expr (expr) number defined(symbol) symbol
668 * We reset the keepthis flag when we find a non-constant subexpression. 718 * We reset the constexpr flag in the last two cases.
669 */ 719 */
670static Linetype 720static Linetype
671eval_unary(const struct ops *ops, int *valp, const char **cpp) 721eval_unary(const struct ops *ops, int *valp, const char **cpp)
@@ -673,68 +723,83 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp)
673 const char *cp; 723 const char *cp;
674 char *ep; 724 char *ep;
675 int sym; 725 int sym;
726 bool defparen;
727 Linetype lt;
676 728
677 cp = skipcomment(*cpp); 729 cp = skipcomment(*cpp);
678 if (*cp == '!') { 730 if (*cp == '!') {
679 debug("eval%d !", ops - eval_ops); 731 debug("eval%d !", ops - eval_ops);
680 cp++; 732 cp++;
681 if (eval_unary(ops, valp, &cp) == LT_IF) { 733 lt = eval_unary(ops, valp, &cp);
682 *cpp = cp; 734 if (lt == LT_ERROR)
683 return (LT_IF); 735 return (LT_ERROR);
736 if (lt != LT_IF) {
737 *valp = !*valp;
738 lt = *valp ? LT_TRUE : LT_FALSE;
684 } 739 }
685 *valp = !*valp;
686 } else if (*cp == '(') { 740 } else if (*cp == '(') {
687 cp++; 741 cp++;
688 debug("eval%d (", ops - eval_ops); 742 debug("eval%d (", ops - eval_ops);
689 if (eval_table(eval_ops, valp, &cp) == LT_IF) 743 lt = eval_table(eval_ops, valp, &cp);
690 return (LT_IF); 744 if (lt == LT_ERROR)
745 return (LT_ERROR);
691 cp = skipcomment(cp); 746 cp = skipcomment(cp);
692 if (*cp++ != ')') 747 if (*cp++ != ')')
693 return (LT_IF); 748 return (LT_ERROR);
694 } else if (isdigit((unsigned char)*cp)) { 749 } else if (isdigit((unsigned char)*cp)) {
695 debug("eval%d number", ops - eval_ops); 750 debug("eval%d number", ops - eval_ops);
696 *valp = strtol(cp, &ep, 0); 751 *valp = strtol(cp, &ep, 0);
752 if (ep == cp)
753 return (LT_ERROR);
754 lt = *valp ? LT_TRUE : LT_FALSE;
697 cp = skipsym(cp); 755 cp = skipsym(cp);
698 } else if (strncmp(cp, "defined", 7) == 0 && endsym(cp[7])) { 756 } else if (strncmp(cp, "defined", 7) == 0 && endsym(cp[7])) {
699 cp = skipcomment(cp+7); 757 cp = skipcomment(cp+7);
700 debug("eval%d defined", ops - eval_ops); 758 debug("eval%d defined", ops - eval_ops);
701 if (*cp++ != '(') 759 if (*cp == '(') {
702 return (LT_IF); 760 cp = skipcomment(cp+1);
703 cp = skipcomment(cp); 761 defparen = true;
762 } else {
763 defparen = false;
764 }
704 sym = findsym(cp); 765 sym = findsym(cp);
705 cp = skipsym(cp); 766 if (sym < 0) {
706 cp = skipcomment(cp); 767 lt = LT_IF;
707 if (*cp++ != ')') 768 } else {
708 return (LT_IF);
709 if (sym >= 0)
710 *valp = (value[sym] != NULL); 769 *valp = (value[sym] != NULL);
711 else { 770 lt = *valp ? LT_TRUE : LT_FALSE;
712 *cpp = cp;
713 return (LT_IF);
714 } 771 }
715 keepthis = false; 772 cp = skipsym(cp);
773 cp = skipcomment(cp);
774 if (defparen && *cp++ != ')')
775 return (LT_ERROR);
776 constexpr = false;
716 } else if (!endsym(*cp)) { 777 } else if (!endsym(*cp)) {
717 debug("eval%d symbol", ops - eval_ops); 778 debug("eval%d symbol", ops - eval_ops);
718 sym = findsym(cp); 779 sym = findsym(cp);
719 if (sym < 0) 780 cp = skipsym(cp);
720 return (LT_IF); 781 if (sym < 0) {
721 if (value[sym] == NULL) 782 lt = LT_IF;
783 cp = skipargs(cp);
784 } else if (value[sym] == NULL) {
722 *valp = 0; 785 *valp = 0;
723 else { 786 lt = LT_FALSE;
787 } else {
724 *valp = strtol(value[sym], &ep, 0); 788 *valp = strtol(value[sym], &ep, 0);
725 if (*ep != '\0' || ep == value[sym]) 789 if (*ep != '\0' || ep == value[sym])
726 return (LT_IF); 790 return (LT_ERROR);
791 lt = *valp ? LT_TRUE : LT_FALSE;
792 cp = skipargs(cp);
727 } 793 }
728 cp = skipsym(cp); 794 constexpr = false;
729 keepthis = false;
730 } else { 795 } else {
731 debug("eval%d bad expr", ops - eval_ops); 796 debug("eval%d bad expr", ops - eval_ops);
732 return (LT_IF); 797 return (LT_ERROR);
733 } 798 }
734 799
735 *cpp = cp; 800 *cpp = cp;
736 debug("eval%d = %d", ops - eval_ops, *valp); 801 debug("eval%d = %d", ops - eval_ops, *valp);
737 return (*valp ? LT_TRUE : LT_FALSE); 802 return (lt);
738} 803}
739 804
740/* 805/*
@@ -746,11 +811,13 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
746 const struct op *op; 811 const struct op *op;
747 const char *cp; 812 const char *cp;
748 int val; 813 int val;
749 Linetype lhs, rhs; 814 Linetype lt, rt;
750 815
751 debug("eval%d", ops - eval_ops); 816 debug("eval%d", ops - eval_ops);
752 cp = *cpp; 817 cp = *cpp;
753 lhs = ops->inner(ops+1, valp, &cp); 818 lt = ops->inner(ops+1, valp, &cp);
819 if (lt == LT_ERROR)
820 return (LT_ERROR);
754 for (;;) { 821 for (;;) {
755 cp = skipcomment(cp); 822 cp = skipcomment(cp);
756 for (op = ops->op; op->str != NULL; op++) 823 for (op = ops->op; op->str != NULL; op++)
@@ -760,32 +827,16 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
760 break; 827 break;
761 cp += strlen(op->str); 828 cp += strlen(op->str);
762 debug("eval%d %s", ops - eval_ops, op->str); 829 debug("eval%d %s", ops - eval_ops, op->str);
763 rhs = ops->inner(ops+1, &val, &cp); 830 rt = ops->inner(ops+1, &val, &cp);
764 if (op->fn == op_and && (lhs == LT_FALSE || rhs == LT_FALSE)) { 831 if (rt == LT_ERROR)
765 debug("eval%d: and always false", ops - eval_ops); 832 return (LT_ERROR);
766 if (lhs == LT_IF) 833 lt = op->fn(valp, lt, *valp, rt, val);
767 *valp = val;
768 lhs = LT_FALSE;
769 continue;
770 }
771 if (op->fn == op_or && (lhs == LT_TRUE || rhs == LT_TRUE)) {
772 debug("eval%d: or always true", ops - eval_ops);
773 if (lhs == LT_IF)
774 *valp = val;
775 lhs = LT_TRUE;
776 continue;
777 }
778 if (rhs == LT_IF)
779 lhs = LT_IF;
780 if (lhs != LT_IF)
781 *valp = op->fn(*valp, val);
782 } 834 }
783 835
784 *cpp = cp; 836 *cpp = cp;
785 debug("eval%d = %d", ops - eval_ops, *valp); 837 debug("eval%d = %d", ops - eval_ops, *valp);
786 if (lhs != LT_IF) 838 debug("eval%d lt = %s", ops - eval_ops, linetype_name[lt]);
787 lhs = (*valp ? LT_TRUE : LT_FALSE); 839 return (lt);
788 return lhs;
789} 840}
790 841
791/* 842/*
@@ -796,17 +847,14 @@ eval_table(const struct ops *ops, int *valp, const char **cpp)
796static Linetype 847static Linetype
797ifeval(const char **cpp) 848ifeval(const char **cpp)
798{ 849{
799 const char *cp = *cpp;
800 int ret; 850 int ret;
801 int val; 851 int val = 0;
802 852
803 debug("eval %s", *cpp); 853 debug("eval %s", *cpp);
804 keepthis = killconsts ? false : true; 854 constexpr = killconsts ? false : true;
805 ret = eval_table(eval_ops, &val, &cp); 855 ret = eval_table(eval_ops, &val, cpp);
806 if (ret != LT_IF)
807 *cpp = cp;
808 debug("eval = %d", val); 856 debug("eval = %d", val);
809 return (keepthis ? LT_IF : ret); 857 return (constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret);
810} 858}
811 859
812/* 860/*
@@ -918,6 +966,31 @@ skipcomment(const char *cp)
918} 966}
919 967
920/* 968/*
969 * Skip macro arguments.
970 */
971static const char *
972skipargs(const char *cp)
973{
974 const char *ocp = cp;
975 int level = 0;
976 cp = skipcomment(cp);
977 if (*cp != '(')
978 return (cp);
979 do {
980 if (*cp == '(')
981 level++;
982 if (*cp == ')')
983 level--;
984 cp = skipcomment(cp+1);
985 } while (level != 0 && *cp != '\0');
986 if (level == 0)
987 return (cp);
988 else
989 /* Rewind and re-detect the syntax error later. */
990 return (ocp);
991}
992
993/*
921 * Skip over an identifier. 994 * Skip over an identifier.
922 */ 995 */
923static const char * 996static const char *
@@ -929,7 +1002,7 @@ skipsym(const char *cp)
929} 1002}
930 1003
931/* 1004/*
932 * Look for the symbol in the symbol table. If is is found, we return 1005 * Look for the symbol in the symbol table. If it is found, we return
933 * the symbol table index, else we return -1. 1006 * the symbol table index, else we return -1.
934 */ 1007 */
935static int 1008static int
diff --git a/security/Makefile b/security/Makefile
index bb44e350c618..da20a193c8dd 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -8,7 +8,8 @@ subdir-$(CONFIG_SECURITY_SMACK) += smack
8subdir-$(CONFIG_SECURITY_TOMOYO) += tomoyo 8subdir-$(CONFIG_SECURITY_TOMOYO) += tomoyo
9 9
10# always enable default capabilities 10# always enable default capabilities
11obj-y += commoncap.o min_addr.o 11obj-y += commoncap.o
12obj-$(CONFIG_MMU) += min_addr.o
12 13
13# Object file lists 14# Object file lists
14obj-$(CONFIG_SECURITY) += security.o capability.o 15obj-$(CONFIG_SECURITY) += security.o capability.o
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 06ec722897be..e9c2e7c584d9 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1194,7 +1194,7 @@ long keyctl_get_security(key_serial_t keyid,
1194 * have the authorisation token handy */ 1194 * have the authorisation token handy */
1195 instkey = key_get_instantiation_authkey(keyid); 1195 instkey = key_get_instantiation_authkey(keyid);
1196 if (IS_ERR(instkey)) 1196 if (IS_ERR(instkey))
1197 return PTR_ERR(key_ref); 1197 return PTR_ERR(instkey);
1198 key_put(instkey); 1198 key_put(instkey);
1199 1199
1200 key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, 0); 1200 key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, 0);
@@ -1236,6 +1236,7 @@ long keyctl_get_security(key_serial_t keyid,
1236 */ 1236 */
1237long keyctl_session_to_parent(void) 1237long keyctl_session_to_parent(void)
1238{ 1238{
1239#ifdef TIF_NOTIFY_RESUME
1239 struct task_struct *me, *parent; 1240 struct task_struct *me, *parent;
1240 const struct cred *mycred, *pcred; 1241 const struct cred *mycred, *pcred;
1241 struct cred *cred, *oldcred; 1242 struct cred *cred, *oldcred;
@@ -1326,6 +1327,15 @@ not_permitted:
1326error_keyring: 1327error_keyring:
1327 key_ref_put(keyring_r); 1328 key_ref_put(keyring_r);
1328 return ret; 1329 return ret;
1330
1331#else /* !TIF_NOTIFY_RESUME */
1332 /*
1333 * To be removed when TIF_NOTIFY_RESUME has been implemented on
1334 * m68k/xtensa
1335 */
1336#warning TIF_NOTIFY_RESUME not implemented
1337 return -EOPNOTSUPP;
1338#endif /* !TIF_NOTIFY_RESUME */
1329} 1339}
1330 1340
1331/*****************************************************************************/ 1341/*****************************************************************************/
diff --git a/security/min_addr.c b/security/min_addr.c
index fc43c9d37084..e86f297522bf 100644
--- a/security/min_addr.c
+++ b/security/min_addr.c
@@ -43,7 +43,7 @@ int mmap_min_addr_handler(struct ctl_table *table, int write,
43 return ret; 43 return ret;
44} 44}
45 45
46int __init init_mmap_min_addr(void) 46static int __init init_mmap_min_addr(void)
47{ 47{
48 update_mmap_min_addr(); 48 update_mmap_min_addr();
49 49
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 7a374c2eb043..9a2ee845e9d4 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2365,7 +2365,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
2365 initrlim = init_task.signal->rlim + i; 2365 initrlim = init_task.signal->rlim + i;
2366 rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur); 2366 rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur);
2367 } 2367 }
2368 update_rlimit_cpu(rlim->rlim_cur); 2368 update_rlimit_cpu(current->signal->rlim[RLIMIT_CPU].rlim_cur);
2369 } 2369 }
2370} 2370}
2371 2371
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c
index 8346938809b1..9a6c58881c0a 100644
--- a/security/tomoyo/file.c
+++ b/security/tomoyo/file.c
@@ -12,7 +12,6 @@
12#include "common.h" 12#include "common.h"
13#include "tomoyo.h" 13#include "tomoyo.h"
14#include "realpath.h" 14#include "realpath.h"
15#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
16 15
17/* 16/*
18 * tomoyo_globally_readable_file_entry is a structure which is used for holding 17 * tomoyo_globally_readable_file_entry is a structure which is used for holding
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1497dce1b04a..656e474dca47 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -172,14 +172,15 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
172 return v; 172 return v;
173} 173}
174 174
175static inline void aaci_chan_wait_ready(struct aaci_runtime *aacirun) 175static inline void
176aaci_chan_wait_ready(struct aaci_runtime *aacirun, unsigned long mask)
176{ 177{
177 u32 val; 178 u32 val;
178 int timeout = 5000; 179 int timeout = 5000;
179 180
180 do { 181 do {
181 val = readl(aacirun->base + AACI_SR); 182 val = readl(aacirun->base + AACI_SR);
182 } while (val & (SR_TXB|SR_RXB) && timeout--); 183 } while (val & mask && timeout--);
183} 184}
184 185
185 186
@@ -208,8 +209,10 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
208 writel(0, aacirun->base + AACI_IE); 209 writel(0, aacirun->base + AACI_IE);
209 return; 210 return;
210 } 211 }
211 ptr = aacirun->ptr;
212 212
213 spin_lock(&aacirun->lock);
214
215 ptr = aacirun->ptr;
213 do { 216 do {
214 unsigned int len = aacirun->fifosz; 217 unsigned int len = aacirun->fifosz;
215 u32 val; 218 u32 val;
@@ -217,9 +220,9 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
217 if (aacirun->bytes <= 0) { 220 if (aacirun->bytes <= 0) {
218 aacirun->bytes += aacirun->period; 221 aacirun->bytes += aacirun->period;
219 aacirun->ptr = ptr; 222 aacirun->ptr = ptr;
220 spin_unlock(&aaci->lock); 223 spin_unlock(&aacirun->lock);
221 snd_pcm_period_elapsed(aacirun->substream); 224 snd_pcm_period_elapsed(aacirun->substream);
222 spin_lock(&aaci->lock); 225 spin_lock(&aacirun->lock);
223 } 226 }
224 if (!(aacirun->cr & CR_EN)) 227 if (!(aacirun->cr & CR_EN))
225 break; 228 break;
@@ -245,7 +248,10 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
245 ptr = aacirun->start; 248 ptr = aacirun->start;
246 } 249 }
247 } while(1); 250 } while(1);
251
248 aacirun->ptr = ptr; 252 aacirun->ptr = ptr;
253
254 spin_unlock(&aacirun->lock);
249 } 255 }
250 256
251 if (mask & ISR_URINTR) { 257 if (mask & ISR_URINTR) {
@@ -263,6 +269,8 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
263 return; 269 return;
264 } 270 }
265 271
272 spin_lock(&aacirun->lock);
273
266 ptr = aacirun->ptr; 274 ptr = aacirun->ptr;
267 do { 275 do {
268 unsigned int len = aacirun->fifosz; 276 unsigned int len = aacirun->fifosz;
@@ -271,9 +279,9 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
271 if (aacirun->bytes <= 0) { 279 if (aacirun->bytes <= 0) {
272 aacirun->bytes += aacirun->period; 280 aacirun->bytes += aacirun->period;
273 aacirun->ptr = ptr; 281 aacirun->ptr = ptr;
274 spin_unlock(&aaci->lock); 282 spin_unlock(&aacirun->lock);
275 snd_pcm_period_elapsed(aacirun->substream); 283 snd_pcm_period_elapsed(aacirun->substream);
276 spin_lock(&aaci->lock); 284 spin_lock(&aacirun->lock);
277 } 285 }
278 if (!(aacirun->cr & CR_EN)) 286 if (!(aacirun->cr & CR_EN))
279 break; 287 break;
@@ -301,6 +309,8 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
301 } while (1); 309 } while (1);
302 310
303 aacirun->ptr = ptr; 311 aacirun->ptr = ptr;
312
313 spin_unlock(&aacirun->lock);
304 } 314 }
305} 315}
306 316
@@ -310,7 +320,6 @@ static irqreturn_t aaci_irq(int irq, void *devid)
310 u32 mask; 320 u32 mask;
311 int i; 321 int i;
312 322
313 spin_lock(&aaci->lock);
314 mask = readl(aaci->base + AACI_ALLINTS); 323 mask = readl(aaci->base + AACI_ALLINTS);
315 if (mask) { 324 if (mask) {
316 u32 m = mask; 325 u32 m = mask;
@@ -320,7 +329,6 @@ static irqreturn_t aaci_irq(int irq, void *devid)
320 } 329 }
321 } 330 }
322 } 331 }
323 spin_unlock(&aaci->lock);
324 332
325 return mask ? IRQ_HANDLED : IRQ_NONE; 333 return mask ? IRQ_HANDLED : IRQ_NONE;
326} 334}
@@ -330,63 +338,6 @@ static irqreturn_t aaci_irq(int irq, void *devid)
330/* 338/*
331 * ALSA support. 339 * ALSA support.
332 */ 340 */
333
334struct aaci_stream {
335 unsigned char codec_idx;
336 unsigned char rate_idx;
337};
338
339static struct aaci_stream aaci_streams[] = {
340 [ACSTREAM_FRONT] = {
341 .codec_idx = 0,
342 .rate_idx = AC97_RATES_FRONT_DAC,
343 },
344 [ACSTREAM_SURROUND] = {
345 .codec_idx = 0,
346 .rate_idx = AC97_RATES_SURR_DAC,
347 },
348 [ACSTREAM_LFE] = {
349 .codec_idx = 0,
350 .rate_idx = AC97_RATES_LFE_DAC,
351 },
352};
353
354static inline unsigned int aaci_rate_mask(struct aaci *aaci, int streamid)
355{
356 struct aaci_stream *s = aaci_streams + streamid;
357 return aaci->ac97_bus->codec[s->codec_idx]->rates[s->rate_idx];
358}
359
360static unsigned int rate_list[] = {
361 5512, 8000, 11025, 16000, 22050, 32000, 44100,
362 48000, 64000, 88200, 96000, 176400, 192000
363};
364
365/*
366 * Double-rate rule: we can support double rate iff channels == 2
367 * (unimplemented)
368 */
369static int
370aaci_rule_rate_by_channels(struct snd_pcm_hw_params *p, struct snd_pcm_hw_rule *rule)
371{
372 struct aaci *aaci = rule->private;
373 unsigned int rate_mask = SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_5512;
374 struct snd_interval *c = hw_param_interval(p, SNDRV_PCM_HW_PARAM_CHANNELS);
375
376 switch (c->max) {
377 case 6:
378 rate_mask &= aaci_rate_mask(aaci, ACSTREAM_LFE);
379 case 4:
380 rate_mask &= aaci_rate_mask(aaci, ACSTREAM_SURROUND);
381 case 2:
382 rate_mask &= aaci_rate_mask(aaci, ACSTREAM_FRONT);
383 }
384
385 return snd_interval_list(hw_param_interval(p, rule->var),
386 ARRAY_SIZE(rate_list), rate_list,
387 rate_mask);
388}
389
390static struct snd_pcm_hardware aaci_hw_info = { 341static struct snd_pcm_hardware aaci_hw_info = {
391 .info = SNDRV_PCM_INFO_MMAP | 342 .info = SNDRV_PCM_INFO_MMAP |
392 SNDRV_PCM_INFO_MMAP_VALID | 343 SNDRV_PCM_INFO_MMAP_VALID |
@@ -400,10 +351,7 @@ static struct snd_pcm_hardware aaci_hw_info = {
400 */ 351 */
401 .formats = SNDRV_PCM_FMTBIT_S16_LE, 352 .formats = SNDRV_PCM_FMTBIT_S16_LE,
402 353
403 /* should this be continuous or knot? */ 354 /* rates are setup from the AC'97 codec */
404 .rates = SNDRV_PCM_RATE_CONTINUOUS,
405 .rate_max = 48000,
406 .rate_min = 4000,
407 .channels_min = 2, 355 .channels_min = 2,
408 .channels_max = 6, 356 .channels_max = 6,
409 .buffer_bytes_max = 64 * 1024, 357 .buffer_bytes_max = 64 * 1024,
@@ -423,6 +371,12 @@ static int __aaci_pcm_open(struct aaci *aaci,
423 aacirun->substream = substream; 371 aacirun->substream = substream;
424 runtime->private_data = aacirun; 372 runtime->private_data = aacirun;
425 runtime->hw = aaci_hw_info; 373 runtime->hw = aaci_hw_info;
374 runtime->hw.rates = aacirun->pcm->rates;
375 snd_pcm_limit_hw_rates(runtime);
376
377 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
378 aacirun->pcm->r[1].slots)
379 snd_ac97_pcm_double_rate_rules(runtime);
426 380
427 /* 381 /*
428 * FIXME: ALSA specifies fifo_size in bytes. If we're in normal 382 * FIXME: ALSA specifies fifo_size in bytes. If we're in normal
@@ -433,17 +387,6 @@ static int __aaci_pcm_open(struct aaci *aaci,
433 */ 387 */
434 runtime->hw.fifo_size = aaci->fifosize * 2; 388 runtime->hw.fifo_size = aaci->fifosize * 2;
435 389
436 /*
437 * Add rule describing hardware rate dependency
438 * on the number of channels.
439 */
440 ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
441 aaci_rule_rate_by_channels, aaci,
442 SNDRV_PCM_HW_PARAM_CHANNELS,
443 SNDRV_PCM_HW_PARAM_RATE, -1);
444 if (ret)
445 goto out;
446
447 ret = request_irq(aaci->dev->irq[0], aaci_irq, IRQF_SHARED|IRQF_DISABLED, 390 ret = request_irq(aaci->dev->irq[0], aaci_irq, IRQF_SHARED|IRQF_DISABLED,
448 DRIVER_NAME, aaci); 391 DRIVER_NAME, aaci);
449 if (ret) 392 if (ret)
@@ -498,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
498 struct snd_pcm_hw_params *params) 441 struct snd_pcm_hw_params *params)
499{ 442{
500 int err; 443 int err;
444 struct aaci *aaci = substream->private_data;
501 445
502 aaci_pcm_hw_free(substream); 446 aaci_pcm_hw_free(substream);
503 if (aacirun->pcm_open) { 447 if (aacirun->pcm_open) {
@@ -507,18 +451,22 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
507 451
508 err = snd_pcm_lib_malloc_pages(substream, 452 err = snd_pcm_lib_malloc_pages(substream,
509 params_buffer_bytes(params)); 453 params_buffer_bytes(params));
510 if (err < 0) 454 if (err >= 0) {
511 goto out; 455 unsigned int rate = params_rate(params);
456 int dbl = rate > 48000;
512 457
513 err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), 458 err = snd_ac97_pcm_open(aacirun->pcm, rate,
514 params_channels(params), 459 params_channels(params),
515 aacirun->pcm->r[0].slots); 460 aacirun->pcm->r[dbl].slots);
516 if (err)
517 goto out;
518 461
519 aacirun->pcm_open = 1; 462 aacirun->pcm_open = err == 0;
463 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
464 aacirun->fifosz = aaci->fifosize * 4;
465
466 if (aacirun->cr & CR_COMPACT)
467 aacirun->fifosz >>= 1;
468 }
520 469
521 out:
522 return err; 470 return err;
523} 471}
524 472
@@ -527,7 +475,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream)
527 struct snd_pcm_runtime *runtime = substream->runtime; 475 struct snd_pcm_runtime *runtime = substream->runtime;
528 struct aaci_runtime *aacirun = runtime->private_data; 476 struct aaci_runtime *aacirun = runtime->private_data;
529 477
530 aacirun->start = (void *)runtime->dma_area; 478 aacirun->start = runtime->dma_area;
531 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); 479 aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream);
532 aacirun->ptr = aacirun->start; 480 aacirun->ptr = aacirun->start;
533 aacirun->period = 481 aacirun->period =
@@ -613,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
613static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, 561static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
614 struct snd_pcm_hw_params *params) 562 struct snd_pcm_hw_params *params)
615{ 563{
616 struct aaci *aaci = substream->private_data;
617 struct aaci_runtime *aacirun = substream->runtime->private_data; 564 struct aaci_runtime *aacirun = substream->runtime->private_data;
618 unsigned int channels = params_channels(params); 565 unsigned int channels = params_channels(params);
619 int ret; 566 int ret;
@@ -627,14 +574,9 @@ static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
627 * Enable FIFO, compact mode, 16 bits per sample. 574 * Enable FIFO, compact mode, 16 bits per sample.
628 * FIXME: double rate slots? 575 * FIXME: double rate slots?
629 */ 576 */
630 if (ret >= 0) { 577 if (ret >= 0)
631 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
632 aacirun->cr |= channels_to_txmask[channels]; 578 aacirun->cr |= channels_to_txmask[channels];
633 579
634 aacirun->fifosz = aaci->fifosize * 4;
635 if (aacirun->cr & CR_COMPACT)
636 aacirun->fifosz >>= 1;
637 }
638 return ret; 580 return ret;
639} 581}
640 582
@@ -646,7 +588,7 @@ static void aaci_pcm_playback_stop(struct aaci_runtime *aacirun)
646 ie &= ~(IE_URIE|IE_TXIE); 588 ie &= ~(IE_URIE|IE_TXIE);
647 writel(ie, aacirun->base + AACI_IE); 589 writel(ie, aacirun->base + AACI_IE);
648 aacirun->cr &= ~CR_EN; 590 aacirun->cr &= ~CR_EN;
649 aaci_chan_wait_ready(aacirun); 591 aaci_chan_wait_ready(aacirun, SR_TXB);
650 writel(aacirun->cr, aacirun->base + AACI_TXCR); 592 writel(aacirun->cr, aacirun->base + AACI_TXCR);
651} 593}
652 594
@@ -654,7 +596,7 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun)
654{ 596{
655 u32 ie; 597 u32 ie;
656 598
657 aaci_chan_wait_ready(aacirun); 599 aaci_chan_wait_ready(aacirun, SR_TXB);
658 aacirun->cr |= CR_EN; 600 aacirun->cr |= CR_EN;
659 601
660 ie = readl(aacirun->base + AACI_IE); 602 ie = readl(aacirun->base + AACI_IE);
@@ -665,12 +607,12 @@ static void aaci_pcm_playback_start(struct aaci_runtime *aacirun)
665 607
666static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd) 608static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cmd)
667{ 609{
668 struct aaci *aaci = substream->private_data;
669 struct aaci_runtime *aacirun = substream->runtime->private_data; 610 struct aaci_runtime *aacirun = substream->runtime->private_data;
670 unsigned long flags; 611 unsigned long flags;
671 int ret = 0; 612 int ret = 0;
672 613
673 spin_lock_irqsave(&aaci->lock, flags); 614 spin_lock_irqsave(&aacirun->lock, flags);
615
674 switch (cmd) { 616 switch (cmd) {
675 case SNDRV_PCM_TRIGGER_START: 617 case SNDRV_PCM_TRIGGER_START:
676 aaci_pcm_playback_start(aacirun); 618 aaci_pcm_playback_start(aacirun);
@@ -697,7 +639,8 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm
697 default: 639 default:
698 ret = -EINVAL; 640 ret = -EINVAL;
699 } 641 }
700 spin_unlock_irqrestore(&aaci->lock, flags); 642
643 spin_unlock_irqrestore(&aacirun->lock, flags);
701 644
702 return ret; 645 return ret;
703} 646}
@@ -716,23 +659,14 @@ static struct snd_pcm_ops aaci_playback_ops = {
716static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
717 struct snd_pcm_hw_params *params) 660 struct snd_pcm_hw_params *params)
718{ 661{
719 struct aaci *aaci = substream->private_data;
720 struct aaci_runtime *aacirun = substream->runtime->private_data; 662 struct aaci_runtime *aacirun = substream->runtime->private_data;
721 int ret; 663 int ret;
722 664
723 ret = aaci_pcm_hw_params(substream, aacirun, params); 665 ret = aaci_pcm_hw_params(substream, aacirun, params);
724 666 if (ret >= 0)
725 if (ret >= 0) {
726 aacirun->cr = CR_FEN | CR_COMPACT | CR_SZ16;
727
728 /* Line in record: slot 3 and 4 */ 667 /* Line in record: slot 3 and 4 */
729 aacirun->cr |= CR_SL3 | CR_SL4; 668 aacirun->cr |= CR_SL3 | CR_SL4;
730 669
731 aacirun->fifosz = aaci->fifosize * 4;
732
733 if (aacirun->cr & CR_COMPACT)
734 aacirun->fifosz >>= 1;
735 }
736 return ret; 670 return ret;
737} 671}
738 672
@@ -740,7 +674,7 @@ static void aaci_pcm_capture_stop(struct aaci_runtime *aacirun)
740{ 674{
741 u32 ie; 675 u32 ie;
742 676
743 aaci_chan_wait_ready(aacirun); 677 aaci_chan_wait_ready(aacirun, SR_RXB);
744 678
745 ie = readl(aacirun->base + AACI_IE); 679 ie = readl(aacirun->base + AACI_IE);
746 ie &= ~(IE_ORIE | IE_RXIE); 680 ie &= ~(IE_ORIE | IE_RXIE);
@@ -755,7 +689,7 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
755{ 689{
756 u32 ie; 690 u32 ie;
757 691
758 aaci_chan_wait_ready(aacirun); 692 aaci_chan_wait_ready(aacirun, SR_RXB);
759 693
760#ifdef DEBUG 694#ifdef DEBUG
761 /* RX Timeout value: bits 28:17 in RXCR */ 695 /* RX Timeout value: bits 28:17 in RXCR */
@@ -772,12 +706,11 @@ static void aaci_pcm_capture_start(struct aaci_runtime *aacirun)
772 706
773static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd) 707static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd)
774{ 708{
775 struct aaci *aaci = substream->private_data;
776 struct aaci_runtime *aacirun = substream->runtime->private_data; 709 struct aaci_runtime *aacirun = substream->runtime->private_data;
777 unsigned long flags; 710 unsigned long flags;
778 int ret = 0; 711 int ret = 0;
779 712
780 spin_lock_irqsave(&aaci->lock, flags); 713 spin_lock_irqsave(&aacirun->lock, flags);
781 714
782 switch (cmd) { 715 switch (cmd) {
783 case SNDRV_PCM_TRIGGER_START: 716 case SNDRV_PCM_TRIGGER_START:
@@ -806,7 +739,7 @@ static int aaci_pcm_capture_trigger(struct snd_pcm_substream *substream, int cmd
806 ret = -EINVAL; 739 ret = -EINVAL;
807 } 740 }
808 741
809 spin_unlock_irqrestore(&aaci->lock, flags); 742 spin_unlock_irqrestore(&aacirun->lock, flags);
810 743
811 return ret; 744 return ret;
812} 745}
@@ -889,6 +822,12 @@ static struct ac97_pcm ac97_defs[] __devinitdata = {
889 (1 << AC97_SLOT_PCM_SRIGHT) | 822 (1 << AC97_SLOT_PCM_SRIGHT) |
890 (1 << AC97_SLOT_LFE), 823 (1 << AC97_SLOT_LFE),
891 }, 824 },
825 [1] = {
826 .slots = (1 << AC97_SLOT_PCM_LEFT) |
827 (1 << AC97_SLOT_PCM_RIGHT) |
828 (1 << AC97_SLOT_PCM_LEFT_0) |
829 (1 << AC97_SLOT_PCM_RIGHT_0),
830 },
892 }, 831 },
893 }, 832 },
894 [1] = { /* PCM in */ 833 [1] = { /* PCM in */
@@ -1001,7 +940,6 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
1001 940
1002 aaci = card->private_data; 941 aaci = card->private_data;
1003 mutex_init(&aaci->ac97_sem); 942 mutex_init(&aaci->ac97_sem);
1004 spin_lock_init(&aaci->lock);
1005 aaci->card = card; 943 aaci->card = card;
1006 aaci->dev = dev; 944 aaci->dev = dev;
1007 945
@@ -1028,7 +966,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
1028 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); 966 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops);
1029 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); 967 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops);
1030 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 968 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1031 NULL, 0, 64 * 104); 969 NULL, 0, 64 * 1024);
1032 } 970 }
1033 971
1034 return ret; 972 return ret;
@@ -1088,12 +1026,14 @@ static int __devinit aaci_probe(struct amba_device *dev, struct amba_id *id)
1088 /* 1026 /*
1089 * Playback uses AACI channel 0 1027 * Playback uses AACI channel 0
1090 */ 1028 */
1029 spin_lock_init(&aaci->playback.lock);
1091 aaci->playback.base = aaci->base + AACI_CSCH1; 1030 aaci->playback.base = aaci->base + AACI_CSCH1;
1092 aaci->playback.fifo = aaci->base + AACI_DR1; 1031 aaci->playback.fifo = aaci->base + AACI_DR1;
1093 1032
1094 /* 1033 /*
1095 * Capture uses AACI channel 0 1034 * Capture uses AACI channel 0
1096 */ 1035 */
1036 spin_lock_init(&aaci->capture.lock);
1097 aaci->capture.base = aaci->base + AACI_CSCH1; 1037 aaci->capture.base = aaci->base + AACI_CSCH1;
1098 aaci->capture.fifo = aaci->base + AACI_DR1; 1038 aaci->capture.fifo = aaci->base + AACI_DR1;
1099 1039
diff --git a/sound/arm/aaci.h b/sound/arm/aaci.h
index 924f69c1c44c..6a4a2eebdda1 100644
--- a/sound/arm/aaci.h
+++ b/sound/arm/aaci.h
@@ -202,6 +202,7 @@
202struct aaci_runtime { 202struct aaci_runtime {
203 void __iomem *base; 203 void __iomem *base;
204 void __iomem *fifo; 204 void __iomem *fifo;
205 spinlock_t lock;
205 206
206 struct ac97_pcm *pcm; 207 struct ac97_pcm *pcm;
207 int pcm_open; 208 int pcm_open;
@@ -232,7 +233,6 @@ struct aaci {
232 struct snd_ac97 *ac97; 233 struct snd_ac97 *ac97;
233 234
234 u32 maincr; 235 u32 maincr;
235 spinlock_t lock;
236 236
237 struct aaci_runtime playback; 237 struct aaci_runtime playback;
238 struct aaci_runtime capture; 238 struct aaci_runtime capture;
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index c15682a2f9db..475455c76610 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -5,6 +5,7 @@ config SND_TIMER
5config SND_PCM 5config SND_PCM
6 tristate 6 tristate
7 select SND_TIMER 7 select SND_TIMER
8 select GCD
8 9
9config SND_HWDEP 10config SND_HWDEP
10 tristate 11 tristate
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 30f410832a25..a27545b23ee9 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -758,7 +758,7 @@ int snd_interval_ratnum(struct snd_interval *i,
758 int diff; 758 int diff;
759 if (q == 0) 759 if (q == 0)
760 q = 1; 760 q = 1;
761 den = div_down(num, q); 761 den = div_up(num, q);
762 if (den < rats[k].den_min) 762 if (den < rats[k].den_min)
763 continue; 763 continue;
764 if (den > rats[k].den_max) 764 if (den > rats[k].den_max)
@@ -794,7 +794,7 @@ int snd_interval_ratnum(struct snd_interval *i,
794 i->empty = 1; 794 i->empty = 1;
795 return -EINVAL; 795 return -EINVAL;
796 } 796 }
797 den = div_up(num, q); 797 den = div_down(num, q);
798 if (den > rats[k].den_max) 798 if (den > rats[k].den_max)
799 continue; 799 continue;
800 if (den < rats[k].den_min) 800 if (den < rats[k].den_min)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 29ab46a12e11..25b0641e6b8c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1918,13 +1918,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1918 1918
1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
1920 hw->rate_min, hw->rate_max); 1920 hw->rate_min, hw->rate_max);
1921 if (err < 0) 1921 if (err < 0)
1922 return err; 1922 return err;
1923 1923
1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1925 hw->period_bytes_min, hw->period_bytes_max); 1925 hw->period_bytes_min, hw->period_bytes_max);
1926 if (err < 0) 1926 if (err < 0)
1927 return err; 1927 return err;
1928 1928
1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
1930 hw->periods_min, hw->periods_max); 1930 hw->periods_min, hw->periods_max);
diff --git a/sound/core/pcm_timer.c b/sound/core/pcm_timer.c
index ca8068b63d6c..b01d9481d632 100644
--- a/sound/core/pcm_timer.c
+++ b/sound/core/pcm_timer.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/time.h> 22#include <linux/time.h>
23#include <linux/gcd.h>
23#include <sound/core.h> 24#include <sound/core.h>
24#include <sound/pcm.h> 25#include <sound/pcm.h>
25#include <sound/timer.h> 26#include <sound/timer.h>
@@ -28,22 +29,6 @@
28 * Timer functions 29 * Timer functions
29 */ 30 */
30 31
31/* Greatest common divisor */
32static unsigned long gcd(unsigned long a, unsigned long b)
33{
34 unsigned long r;
35 if (a < b) {
36 r = a;
37 a = b;
38 b = r;
39 }
40 while ((r = a % b) != 0) {
41 a = b;
42 b = r;
43 }
44 return b;
45}
46
47void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) 32void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
48{ 33{
49 unsigned long rate, mult, fsize, l, post; 34 unsigned long rate, mult, fsize, l, post;
diff --git a/sound/isa/msnd/msnd_midi.c b/sound/isa/msnd/msnd_midi.c
index cb9aa4c4edd0..4be562b2cf21 100644
--- a/sound/isa/msnd/msnd_midi.c
+++ b/sound/isa/msnd/msnd_midi.c
@@ -162,7 +162,7 @@ int snd_msndmidi_new(struct snd_card *card, int device)
162 err = snd_rawmidi_new(card, "MSND-MIDI", device, 1, 1, &rmidi); 162 err = snd_rawmidi_new(card, "MSND-MIDI", device, 1, 1, &rmidi);
163 if (err < 0) 163 if (err < 0)
164 return err; 164 return err;
165 mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL); 165 mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
166 if (mpu == NULL) { 166 if (mpu == NULL) {
167 snd_device_free(card, rmidi); 167 snd_device_free(card, rmidi);
168 return -ENOMEM; 168 return -ENOMEM;
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 96678d5d3834..0c40951b6523 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -377,12 +377,13 @@ init_arrays(struct snd_emu8000 *emu)
377static void __devinit 377static void __devinit
378size_dram(struct snd_emu8000 *emu) 378size_dram(struct snd_emu8000 *emu)
379{ 379{
380 int i, size; 380 int i, size, detected_size;
381 381
382 if (emu->dram_checked) 382 if (emu->dram_checked)
383 return; 383 return;
384 384
385 size = 0; 385 size = 0;
386 detected_size = 0;
386 387
387 /* write out a magic number */ 388 /* write out a magic number */
388 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); 389 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE);
@@ -414,7 +415,9 @@ size_dram(struct snd_emu8000 *emu)
414 /*snd_emu8000_read_wait(emu);*/ 415 /*snd_emu8000_read_wait(emu);*/
415 EMU8000_SMLD_READ(emu); /* discard stale data */ 416 EMU8000_SMLD_READ(emu); /* discard stale data */
416 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 417 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
417 break; /* we must have wrapped around */ 418 break; /* no memory at this address */
419
420 detected_size = size;
418 421
419 snd_emu8000_read_wait(emu); 422 snd_emu8000_read_wait(emu);
420 423
@@ -442,9 +445,9 @@ size_dram(struct snd_emu8000 *emu)
442 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 445 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE);
443 446
444 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n",
445 emu->port1, size/1024); 448 emu->port1, detected_size/1024);
446 449
447 emu->mem_size = size; 450 emu->mem_size = detected_size;
448 emu->dram_checked = 1; 451 emu->dram_checked = 1;
449} 452}
450 453
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 8691f4cf6191..f1d9d16b5486 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -609,7 +609,7 @@ static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream,
609 /* alloc virtual 'dma' area */ 609 /* alloc virtual 'dma' area */
610 if (runtime->dma_area) 610 if (runtime->dma_area)
611 vfree(runtime->dma_area); 611 vfree(runtime->dma_area);
612 runtime->dma_area = vmalloc(size); 612 runtime->dma_area = vmalloc_user(size);
613 if (runtime->dma_area == NULL) 613 if (runtime->dma_area == NULL)
614 return -ENOMEM; 614 return -ENOMEM;
615 runtime->dma_bytes = size; 615 runtime->dma_bytes = size;
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c
index 08274c995d06..727bdb9ba2dc 100644
--- a/sound/oss/dev_table.c
+++ b/sound/oss/dev_table.c
@@ -67,14 +67,15 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
67 return -(EBUSY); 67 return -(EBUSY);
68 } 68 }
69 d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver))); 69 d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver)));
70 70 sound_nblocks++;
71 if (sound_nblocks < 1024) 71 if (sound_nblocks >= MAX_MEM_BLOCKS)
72 sound_nblocks++; 72 sound_nblocks = MAX_MEM_BLOCKS - 1;
73 73
74 op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); 74 op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations)));
75 sound_nblocks++;
76 if (sound_nblocks >= MAX_MEM_BLOCKS)
77 sound_nblocks = MAX_MEM_BLOCKS - 1;
75 78
76 if (sound_nblocks < 1024)
77 sound_nblocks++;
78 if (d == NULL || op == NULL) { 79 if (d == NULL || op == NULL) {
79 printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name); 80 printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name);
80 sound_unload_audiodev(num); 81 sound_unload_audiodev(num);
@@ -128,9 +129,10 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
128 until you unload sound! */ 129 until you unload sound! */
129 130
130 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); 131 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations)));
132 sound_nblocks++;
133 if (sound_nblocks >= MAX_MEM_BLOCKS)
134 sound_nblocks = MAX_MEM_BLOCKS - 1;
131 135
132 if (sound_nblocks < 1024)
133 sound_nblocks++;
134 if (op == NULL) { 136 if (op == NULL) {
135 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); 137 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name);
136 return -ENOMEM; 138 return -ENOMEM;
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index 83f5ee236b12..e19dd5dcc2de 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -269,7 +269,7 @@ static int pss_reset_dsp(pss_confdata * devc)
269 unsigned long i, limit = jiffies + HZ/10; 269 unsigned long i, limit = jiffies + HZ/10;
270 270
271 outw(0x2000, REG(PSS_CONTROL)); 271 outw(0x2000, REG(PSS_CONTROL));
272 for (i = 0; i < 32768 && (limit-jiffies >= 0); i++) 272 for (i = 0; i < 32768 && time_after_eq(limit, jiffies); i++)
273 inw(REG(PSS_CONTROL)); 273 inw(REG(PSS_CONTROL));
274 outw(0x0000, REG(PSS_CONTROL)); 274 outw(0x0000, REG(PSS_CONTROL));
275 return 1; 275 return 1;
@@ -369,11 +369,11 @@ static int pss_download_boot(pss_confdata * devc, unsigned char *block, int size
369 outw(0, REG(PSS_DATA)); 369 outw(0, REG(PSS_DATA));
370 370
371 limit = jiffies + HZ/10; 371 limit = jiffies + HZ/10;
372 for (i = 0; i < 32768 && (limit - jiffies >= 0); i++) 372 for (i = 0; i < 32768 && time_after_eq(limit, jiffies); i++)
373 val = inw(REG(PSS_STATUS)); 373 val = inw(REG(PSS_STATUS));
374 374
375 limit = jiffies + HZ/10; 375 limit = jiffies + HZ/10;
376 for (i = 0; i < 32768 && (limit-jiffies >= 0); i++) 376 for (i = 0; i < 32768 && time_after_eq(limit, jiffies); i++)
377 { 377 {
378 val = inw(REG(PSS_STATUS)); 378 val = inw(REG(PSS_STATUS));
379 if (val & 0x4000) 379 if (val & 0x4000)
diff --git a/sound/oss/sound_config.h b/sound/oss/sound_config.h
index 55271fbe7f49..9d35c4c65b9b 100644
--- a/sound/oss/sound_config.h
+++ b/sound/oss/sound_config.h
@@ -142,4 +142,6 @@ static inline int translate_mode(struct file *file)
142#define TIMER_ARMED 121234 142#define TIMER_ARMED 121234
143#define TIMER_NOT_ARMED 1 143#define TIMER_NOT_ARMED 1
144 144
145#define MAX_MEM_BLOCKS 1024
146
145#endif 147#endif
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 61aaedae6b7e..c62530943888 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -56,7 +56,7 @@
56/* 56/*
57 * Table for permanently allocated memory (used when unloading the module) 57 * Table for permanently allocated memory (used when unloading the module)
58 */ 58 */
59void * sound_mem_blocks[1024]; 59void * sound_mem_blocks[MAX_MEM_BLOCKS];
60int sound_nblocks = 0; 60int sound_nblocks = 0;
61 61
62/* Persistent DMA buffers */ 62/* Persistent DMA buffers */
@@ -574,7 +574,7 @@ static int __init oss_init(void)
574 NULL, "%s%d", dev_list[i].name, j); 574 NULL, "%s%d", dev_list[i].name, j);
575 } 575 }
576 576
577 if (sound_nblocks >= 1024) 577 if (sound_nblocks >= MAX_MEM_BLOCKS - 1)
578 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n"); 578 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n");
579 579
580 return 0; 580 return 0;
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index c11920623009..a7630e9edf8a 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -83,6 +83,7 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL }, 83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL },
84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL }, 84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL },
85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL }, 85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL },
86{ 0x53544d00, 0xffffff00, "STMicroelectronics", NULL, NULL },
86{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL }, 87{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL },
87{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL }, 88{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL },
88{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL }, 89{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL },
@@ -161,6 +162,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
161{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix 162{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix
162{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, 163{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL },
163{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH }, 164{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH },
165{ 0x53544d02, 0xffffffff, "ST7597", NULL, NULL },
164{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL }, 166{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL },
165{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL }, 167{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL },
166{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL }, 168{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL },
@@ -213,6 +215,14 @@ static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg)
213{ 215{
214 /* filter some registers for buggy codecs */ 216 /* filter some registers for buggy codecs */
215 switch (ac97->id) { 217 switch (ac97->id) {
218 case AC97_ID_ST_AC97_ID4:
219 if (reg == 0x08)
220 return 0;
221 /* fall through */
222 case AC97_ID_ST7597:
223 if (reg == 0x22 || reg == 0x7a)
224 return 1;
225 /* fall through */
216 case AC97_ID_AK4540: 226 case AC97_ID_AK4540:
217 case AC97_ID_AK4542: 227 case AC97_ID_AK4542:
218 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) 228 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c)
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h
index c129492c82b3..d603147c4a96 100644
--- a/sound/pci/ac97/ac97_id.h
+++ b/sound/pci/ac97/ac97_id.h
@@ -62,3 +62,5 @@
62#define AC97_ID_CM9761_78 0x434d4978 62#define AC97_ID_CM9761_78 0x434d4978
63#define AC97_ID_CM9761_82 0x434d4982 63#define AC97_ID_CM9761_82 0x434d4982
64#define AC97_ID_CM9761_83 0x434d4983 64#define AC97_ID_CM9761_83 0x434d4983
65#define AC97_ID_ST7597 0x53544d02
66#define AC97_ID_ST_AC97_ID4 0x53544d04
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 139cf3b2b9d7..d9266bae2849 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1870,6 +1870,7 @@ static unsigned int ad1981_jacks_blacklist[] = {
1870 0x10140554, /* Thinkpad T42p/R50p */ 1870 0x10140554, /* Thinkpad T42p/R50p */
1871 0x10140567, /* Thinkpad T43p 2668-G7U */ 1871 0x10140567, /* Thinkpad T43p 2668-G7U */
1872 0x10140581, /* Thinkpad X41-2527 */ 1872 0x10140581, /* Thinkpad X41-2527 */
1873 0x10280160, /* Dell Dimension 2400 */
1873 0x104380b0, /* Asus A7V8X-MX */ 1874 0x104380b0, /* Asus A7V8X-MX */
1874 0x11790241, /* Toshiba Satellite A-15 S127 */ 1875 0x11790241, /* Toshiba Satellite A-15 S127 */
1875 0x144dc01a, /* Samsung NP-X20C004/SEG */ 1876 0x144dc01a, /* Samsung NP-X20C004/SEG */
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index d6752dff2a44..42b4fbbd8e2b 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -297,6 +297,7 @@ static struct pci_device_id snd_atiixp_ids[] = {
297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); 297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
298 298
299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = { 299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = {
300 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
300 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), 301 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0),
301 { } /* terminator */ 302 { } /* terminator */
302}; 303};
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 5fe34a8d8c81..e4581a42ace5 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work)
42 return; 42 return;
43 43
44 /* generate tone */ 44 /* generate tone */
45 snd_hda_codec_write_cache(codec, beep->nid, 0, 45 snd_hda_codec_write(codec, beep->nid, 0,
46 AC_VERB_SET_BEEP_CONTROL, beep->tone); 46 AC_VERB_SET_BEEP_CONTROL, beep->tone);
47} 47}
48 48
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep)
119 beep->dev = NULL; 119 beep->dev = NULL;
120 cancel_work_sync(&beep->beep_work); 120 cancel_work_sync(&beep->beep_work);
121 /* turn off beep for sure */ 121 /* turn off beep for sure */
122 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 122 snd_hda_codec_write(beep->codec, beep->nid, 0,
123 AC_VERB_SET_BEEP_CONTROL, 0); 123 AC_VERB_SET_BEEP_CONTROL, 0);
124} 124}
125 125
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
192 beep->enabled = enable; 192 beep->enabled = enable;
193 if (!enable) { 193 if (!enable) {
194 /* turn off beep */ 194 /* turn off beep */
195 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 195 snd_hda_codec_write(beep->codec, beep->nid, 0,
196 AC_VERB_SET_BEEP_CONTROL, 0); 196 AC_VERB_SET_BEEP_CONTROL, 0);
197 } 197 }
198 if (beep->mode == HDA_BEEP_MODE_SWREG) { 198 if (beep->mode == HDA_BEEP_MODE_SWREG) {
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
239 mutex_init(&beep->mutex); 239 mutex_init(&beep->mutex);
240 240
241 if (beep->mode == HDA_BEEP_MODE_ON) { 241 if (beep->mode == HDA_BEEP_MODE_ON) {
242 beep->enabled = 1; 242 int err = snd_hda_do_attach(beep);
243 snd_hda_do_register(&beep->register_work); 243 if (err < 0) {
244 kfree(beep);
245 codec->beep = NULL;
246 return err;
247 }
244 } 248 }
245 249
246 return 0; 250 return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
253 if (beep) { 257 if (beep) {
254 cancel_work_sync(&beep->register_work); 258 cancel_work_sync(&beep->register_work);
255 cancel_delayed_work(&beep->unregister_work); 259 cancel_delayed_work(&beep->unregister_work);
256 if (beep->enabled) 260 if (beep->dev)
257 snd_hda_do_detach(beep); 261 snd_hda_do_detach(beep);
258 codec->beep = NULL; 262 codec->beep = NULL;
259 kfree(beep); 263 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 9cfdb771928c..f98b47cd6cfb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1086,11 +1086,6 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1086 if (err < 0) 1086 if (err < 0)
1087 return err; 1087 return err;
1088 } 1088 }
1089 /* audio codec should override the mixer name */
1090 if (codec->afg || !*codec->bus->card->mixername)
1091 snprintf(codec->bus->card->mixername,
1092 sizeof(codec->bus->card->mixername),
1093 "%s %s", codec->vendor_name, codec->chip_name);
1094 1089
1095 if (is_generic_config(codec)) { 1090 if (is_generic_config(codec)) {
1096 err = snd_hda_parse_generic_codec(codec); 1091 err = snd_hda_parse_generic_codec(codec);
@@ -1109,6 +1104,11 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1109 patched: 1104 patched:
1110 if (!err && codec->patch_ops.unsol_event) 1105 if (!err && codec->patch_ops.unsol_event)
1111 err = init_unsol_queue(codec->bus); 1106 err = init_unsol_queue(codec->bus);
1107 /* audio codec should override the mixer name */
1108 if (!err && (codec->afg || !*codec->bus->card->mixername))
1109 snprintf(codec->bus->card->mixername,
1110 sizeof(codec->bus->card->mixername),
1111 "%s %s", codec->vendor_name, codec->chip_name);
1112 return err; 1112 return err;
1113} 1113}
1114EXPORT_SYMBOL_HDA(snd_hda_codec_configure); 1114EXPORT_SYMBOL_HDA(snd_hda_codec_configure);
@@ -1327,11 +1327,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1327 */ 1327 */
1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) 1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1329{ 1329{
1330 u32 pincap = snd_hda_query_pin_caps(codec, nid); 1330 u32 pincap;
1331
1332 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1333 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1334 1331
1332 if (!codec->no_trigger_sense) {
1333 pincap = snd_hda_query_pin_caps(codec, nid);
1334 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1335 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1336 }
1335 return snd_hda_codec_read(codec, nid, 0, 1337 return snd_hda_codec_read(codec, nid, 0,
1336 AC_VERB_GET_PIN_SENSE, 0); 1338 AC_VERB_GET_PIN_SENSE, 0);
1337} 1339}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 1d541b7f5547..0a770a28e71f 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -817,6 +817,7 @@ struct hda_codec {
817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
818 * (e.g. Conexant codecs) 818 * (e.g. Conexant codecs)
819 */ 819 */
820 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
820#ifdef CONFIG_SND_HDA_POWER_SAVE 821#ifdef CONFIG_SND_HDA_POWER_SAVE
821 unsigned int power_on :1; /* current (global) power-state */ 822 unsigned int power_on :1; /* current (global) power-state */
822 unsigned int power_transition :1; /* power-state in transition */ 823 unsigned int power_transition :1; /* power-state in transition */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9b56f937913e..ec9c348336cc 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -356,6 +356,7 @@ struct azx_dev {
356 */ 356 */
357 unsigned char stream_tag; /* assigned stream */ 357 unsigned char stream_tag; /* assigned stream */
358 unsigned char index; /* stream index */ 358 unsigned char index; /* stream index */
359 int device; /* last device number assigned to */
359 360
360 unsigned int opened :1; 361 unsigned int opened :1;
361 unsigned int running :1; 362 unsigned int running :1;
@@ -1441,10 +1442,13 @@ static int __devinit azx_codec_configure(struct azx *chip)
1441 */ 1442 */
1442 1443
1443/* assign a stream for the PCM */ 1444/* assign a stream for the PCM */
1444static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) 1445static inline struct azx_dev *
1446azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
1445{ 1447{
1446 int dev, i, nums; 1448 int dev, i, nums;
1447 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1449 struct azx_dev *res = NULL;
1450
1451 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1448 dev = chip->playback_index_offset; 1452 dev = chip->playback_index_offset;
1449 nums = chip->playback_streams; 1453 nums = chip->playback_streams;
1450 } else { 1454 } else {
@@ -1453,10 +1457,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream)
1453 } 1457 }
1454 for (i = 0; i < nums; i++, dev++) 1458 for (i = 0; i < nums; i++, dev++)
1455 if (!chip->azx_dev[dev].opened) { 1459 if (!chip->azx_dev[dev].opened) {
1456 chip->azx_dev[dev].opened = 1; 1460 res = &chip->azx_dev[dev];
1457 return &chip->azx_dev[dev]; 1461 if (res->device == substream->pcm->device)
1462 break;
1458 } 1463 }
1459 return NULL; 1464 if (res) {
1465 res->opened = 1;
1466 res->device = substream->pcm->device;
1467 }
1468 return res;
1460} 1469}
1461 1470
1462/* release the assigned stream */ 1471/* release the assigned stream */
@@ -1505,7 +1514,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1505 int err; 1514 int err;
1506 1515
1507 mutex_lock(&chip->open_mutex); 1516 mutex_lock(&chip->open_mutex);
1508 azx_dev = azx_assign_device(chip, substream->stream); 1517 azx_dev = azx_assign_device(chip, substream);
1509 if (azx_dev == NULL) { 1518 if (azx_dev == NULL) {
1510 mutex_unlock(&chip->open_mutex); 1519 mutex_unlock(&chip->open_mutex);
1511 return -EBUSY; 1520 return -EBUSY;
@@ -2322,6 +2331,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2322 * white/black-list for enable_msi 2331 * white/black-list for enable_msi
2323 */ 2332 */
2324static struct snd_pci_quirk msi_black_list[] __devinitdata = { 2333static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2334 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2325 {} 2335 {}
2326}; 2336};
2327 2337
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1a36137e13ec..69a941c7b158 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1186,6 +1186,8 @@ static int patch_ad1986a(struct hda_codec *codec)
1186 */ 1186 */
1187 spec->multiout.no_share_stream = 1; 1187 spec->multiout.no_share_stream = 1;
1188 1188
1189 codec->no_trigger_sense = 1;
1190
1189 return 0; 1191 return 0;
1190} 1192}
1191 1193
@@ -1371,6 +1373,8 @@ static int patch_ad1983(struct hda_codec *codec)
1371 1373
1372 codec->patch_ops = ad198x_patch_ops; 1374 codec->patch_ops = ad198x_patch_ops;
1373 1375
1376 codec->no_trigger_sense = 1;
1377
1374 return 0; 1378 return 0;
1375} 1379}
1376 1380
@@ -1813,6 +1817,9 @@ static int patch_ad1981(struct hda_codec *codec)
1813 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1817 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1814 break; 1818 break;
1815 } 1819 }
1820
1821 codec->no_trigger_sense = 1;
1822
1816 return 0; 1823 return 0;
1817} 1824}
1818 1825
@@ -3118,6 +3125,8 @@ static int patch_ad1988(struct hda_codec *codec)
3118#endif 3125#endif
3119 spec->vmaster_nid = 0x04; 3126 spec->vmaster_nid = 0x04;
3120 3127
3128 codec->no_trigger_sense = 1;
3129
3121 return 0; 3130 return 0;
3122} 3131}
3123 3132
@@ -3330,6 +3339,8 @@ static int patch_ad1884(struct hda_codec *codec)
3330 3339
3331 codec->patch_ops = ad198x_patch_ops; 3340 codec->patch_ops = ad198x_patch_ops;
3332 3341
3342 codec->no_trigger_sense = 1;
3343
3333 return 0; 3344 return 0;
3334} 3345}
3335 3346
@@ -4287,6 +4298,8 @@ static int patch_ad1884a(struct hda_codec *codec)
4287 break; 4298 break;
4288 } 4299 }
4289 4300
4301 codec->no_trigger_sense = 1;
4302
4290 return 0; 4303 return 0;
4291} 4304}
4292 4305
@@ -4623,6 +4636,9 @@ static int patch_ad1882(struct hda_codec *codec)
4623 spec->mixers[2] = ad1882_6stack_mixers; 4636 spec->mixers[2] = ad1882_6stack_mixers;
4624 break; 4637 break;
4625 } 4638 }
4639
4640 codec->no_trigger_sense = 1;
4641
4626 return 0; 4642 return 0;
4627} 4643}
4628 4644
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 4b200da1bd18..fe0423c39598 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -66,6 +66,7 @@ struct cs_spec {
66/* available models */ 66/* available models */
67enum { 67enum {
68 CS420X_MBP55, 68 CS420X_MBP55,
69 CS420X_IMAC27,
69 CS420X_AUTO, 70 CS420X_AUTO,
70 CS420X_MODELS 71 CS420X_MODELS
71}; 72};
@@ -827,7 +828,8 @@ static void cs_automute(struct hda_codec *codec)
827 AC_VERB_SET_PIN_WIDGET_CONTROL, 828 AC_VERB_SET_PIN_WIDGET_CONTROL,
828 hp_present ? 0 : PIN_OUT); 829 hp_present ? 0 : PIN_OUT);
829 } 830 }
830 if (spec->board_config == CS420X_MBP55) { 831 if (spec->board_config == CS420X_MBP55 ||
832 spec->board_config == CS420X_IMAC27) {
831 unsigned int gpio = hp_present ? 0x02 : 0x08; 833 unsigned int gpio = hp_present ? 0x02 : 0x08;
832 snd_hda_codec_write(codec, 0x01, 0, 834 snd_hda_codec_write(codec, 0x01, 0,
833 AC_VERB_SET_GPIO_DATA, gpio); 835 AC_VERB_SET_GPIO_DATA, gpio);
@@ -1069,12 +1071,14 @@ static int cs_parse_auto_config(struct hda_codec *codec)
1069 1071
1070static const char *cs420x_models[CS420X_MODELS] = { 1072static const char *cs420x_models[CS420X_MODELS] = {
1071 [CS420X_MBP55] = "mbp55", 1073 [CS420X_MBP55] = "mbp55",
1074 [CS420X_IMAC27] = "imac27",
1072 [CS420X_AUTO] = "auto", 1075 [CS420X_AUTO] = "auto",
1073}; 1076};
1074 1077
1075 1078
1076static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1079static struct snd_pci_quirk cs420x_cfg_tbl[] = {
1077 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1080 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1081 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
1078 {} /* terminator */ 1082 {} /* terminator */
1079}; 1083};
1080 1084
@@ -1097,8 +1101,23 @@ static struct cs_pincfg mbp55_pincfgs[] = {
1097 {} /* terminator */ 1101 {} /* terminator */
1098}; 1102};
1099 1103
1104static struct cs_pincfg imac27_pincfgs[] = {
1105 { 0x09, 0x012b4050 },
1106 { 0x0a, 0x90100140 },
1107 { 0x0b, 0x90100142 },
1108 { 0x0c, 0x018b3020 },
1109 { 0x0d, 0x90a00110 },
1110 { 0x0e, 0x400000f0 },
1111 { 0x0f, 0x01cbe030 },
1112 { 0x10, 0x014be060 },
1113 { 0x12, 0x01ab9070 },
1114 { 0x15, 0x400000f0 },
1115 {} /* terminator */
1116};
1117
1100static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { 1118static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1101 [CS420X_MBP55] = mbp55_pincfgs, 1119 [CS420X_MBP55] = mbp55_pincfgs,
1120 [CS420X_IMAC27] = imac27_pincfgs,
1102}; 1121};
1103 1122
1104static void fix_pincfg(struct hda_codec *codec, int model) 1123static void fix_pincfg(struct hda_codec *codec, int model)
@@ -1128,6 +1147,7 @@ static int patch_cs420x(struct hda_codec *codec)
1128 fix_pincfg(codec, spec->board_config); 1147 fix_pincfg(codec, spec->board_config);
1129 1148
1130 switch (spec->board_config) { 1149 switch (spec->board_config) {
1150 case CS420X_IMAC27:
1131 case CS420X_MBP55: 1151 case CS420X_MBP55:
1132 /* GPIO1 = headphones */ 1152 /* GPIO1 = headphones */
1133 /* GPIO3 = speakers */ 1153 /* GPIO3 = speakers */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a09c03c3f62b..c578c28f368e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -29,6 +29,7 @@
29 29
30#include "hda_codec.h" 30#include "hda_codec.h"
31#include "hda_local.h" 31#include "hda_local.h"
32#include "hda_beep.h"
32 33
33#define CXT_PIN_DIR_IN 0x00 34#define CXT_PIN_DIR_IN 0x00
34#define CXT_PIN_DIR_OUT 0x01 35#define CXT_PIN_DIR_OUT 0x01
@@ -111,6 +112,7 @@ struct conexant_spec {
111 unsigned int dell_automute; 112 unsigned int dell_automute;
112 unsigned int port_d_mode; 113 unsigned int port_d_mode;
113 unsigned char ext_mic_bias; 114 unsigned char ext_mic_bias;
115 unsigned int dell_vostro;
114}; 116};
115 117
116static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, 118static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
@@ -476,6 +478,7 @@ static void conexant_free(struct hda_codec *codec)
476 snd_array_free(&spec->jacks); 478 snd_array_free(&spec->jacks);
477 } 479 }
478#endif 480#endif
481 snd_hda_detach_beep_device(codec);
479 kfree(codec->spec); 482 kfree(codec->spec);
480} 483}
481 484
@@ -2109,9 +2112,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol,
2109{ 2112{
2110 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2113 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2111 int val; 2114 int val;
2115 hda_nid_t nid = kcontrol->private_value & 0xff;
2116 int inout = (kcontrol->private_value & 0x100) ?
2117 AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT;
2112 2118
2113 val = snd_hda_codec_read(codec, 0x17, 0, 2119 val = snd_hda_codec_read(codec, nid, 0,
2114 AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); 2120 AC_VERB_GET_AMP_GAIN_MUTE, inout);
2115 2121
2116 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; 2122 ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN;
2117 return 0; 2123 return 0;
@@ -2123,6 +2129,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2123 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2129 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2124 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; 2130 const struct hda_input_mux *imux = &cxt5066_analog_mic_boost;
2125 unsigned int idx; 2131 unsigned int idx;
2132 hda_nid_t nid = kcontrol->private_value & 0xff;
2133 int inout = (kcontrol->private_value & 0x100) ?
2134 AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT;
2126 2135
2127 if (!imux->num_items) 2136 if (!imux->num_items)
2128 return 0; 2137 return 0;
@@ -2130,9 +2139,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol,
2130 if (idx >= imux->num_items) 2139 if (idx >= imux->num_items)
2131 idx = imux->num_items - 1; 2140 idx = imux->num_items - 1;
2132 2141
2133 snd_hda_codec_write_cache(codec, 0x17, 0, 2142 snd_hda_codec_write_cache(codec, nid, 0,
2134 AC_VERB_SET_AMP_GAIN_MUTE, 2143 AC_VERB_SET_AMP_GAIN_MUTE,
2135 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | 2144 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout |
2136 imux->items[idx].index); 2145 imux->items[idx].index);
2137 2146
2138 return 1; 2147 return 1;
@@ -2201,10 +2210,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2201 2210
2202 { 2211 {
2203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2204 .name = "Analog Mic Boost Capture Enum", 2213 .name = "Ext Mic Boost Capture Enum",
2205 .info = cxt5066_mic_boost_mux_enum_info, 2214 .info = cxt5066_mic_boost_mux_enum_info,
2206 .get = cxt5066_mic_boost_mux_enum_get, 2215 .get = cxt5066_mic_boost_mux_enum_get,
2207 .put = cxt5066_mic_boost_mux_enum_put, 2216 .put = cxt5066_mic_boost_mux_enum_put,
2217 .private_value = 0x17,
2208 }, 2218 },
2209 2219
2210 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), 2220 HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others),
@@ -2212,6 +2222,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2212 {} 2222 {}
2213}; 2223};
2214 2224
2225static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2226 {
2227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2228 .name = "Int Mic Boost Capture Enum",
2229 .info = cxt5066_mic_boost_mux_enum_info,
2230 .get = cxt5066_mic_boost_mux_enum_get,
2231 .put = cxt5066_mic_boost_mux_enum_put,
2232 .private_value = 0x23 | 0x100,
2233 },
2234 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
2235 {}
2236};
2237
2215static struct hda_verb cxt5066_init_verbs[] = { 2238static struct hda_verb cxt5066_init_verbs[] = {
2216 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2239 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2217 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2240 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
@@ -2397,11 +2420,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2397/* initialize jack-sensing, too */ 2420/* initialize jack-sensing, too */
2398static int cxt5066_init(struct hda_codec *codec) 2421static int cxt5066_init(struct hda_codec *codec)
2399{ 2422{
2423 struct conexant_spec *spec = codec->spec;
2424
2400 snd_printdd("CXT5066: init\n"); 2425 snd_printdd("CXT5066: init\n");
2401 conexant_init(codec); 2426 conexant_init(codec);
2402 if (codec->patch_ops.unsol_event) { 2427 if (codec->patch_ops.unsol_event) {
2403 cxt5066_hp_automute(codec); 2428 cxt5066_hp_automute(codec);
2404 cxt5066_automic(codec); 2429 if (spec->dell_vostro)
2430 cxt5066_vostro_automic(codec);
2431 else
2432 cxt5066_automic(codec);
2405 } 2433 }
2406 return 0; 2434 return 0;
2407} 2435}
@@ -2500,7 +2528,10 @@ static int patch_cxt5066(struct hda_codec *codec)
2500 spec->init_verbs[0] = cxt5066_init_verbs_vostro; 2528 spec->init_verbs[0] = cxt5066_init_verbs_vostro;
2501 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; 2529 spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc;
2502 spec->mixers[spec->num_mixers++] = cxt5066_mixers; 2530 spec->mixers[spec->num_mixers++] = cxt5066_mixers;
2531 spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers;
2503 spec->port_d_mode = 0; 2532 spec->port_d_mode = 0;
2533 spec->dell_vostro = 1;
2534 snd_hda_attach_beep_device(codec, 0x13);
2504 2535
2505 /* no S/PDIF out */ 2536 /* no S/PDIF out */
2506 spec->multiout.dig_out_nid = 0; 2537 spec->multiout.dig_out_nid = 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index aeed4cc5aa79..e3caa78ccd54 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -131,8 +131,8 @@ enum {
131enum { 131enum {
132 ALC269_BASIC, 132 ALC269_BASIC,
133 ALC269_QUANTA_FL1, 133 ALC269_QUANTA_FL1,
134 ALC269_ASUS_EEEPC_P703, 134 ALC269_ASUS_AMIC,
135 ALC269_ASUS_EEEPC_P901, 135 ALC269_ASUS_DMIC,
136 ALC269_FUJITSU, 136 ALC269_FUJITSU,
137 ALC269_LIFEBOOK, 137 ALC269_LIFEBOOK,
138 ALC269_AUTO, 138 ALC269_AUTO,
@@ -188,6 +188,8 @@ enum {
188 ALC663_ASUS_MODE4, 188 ALC663_ASUS_MODE4,
189 ALC663_ASUS_MODE5, 189 ALC663_ASUS_MODE5,
190 ALC663_ASUS_MODE6, 190 ALC663_ASUS_MODE6,
191 ALC663_ASUS_MODE7,
192 ALC663_ASUS_MODE8,
191 ALC272_DELL, 193 ALC272_DELL,
192 ALC272_DELL_ZM1, 194 ALC272_DELL_ZM1,
193 ALC272_SAMSUNG_NC10, 195 ALC272_SAMSUNG_NC10,
@@ -335,6 +337,9 @@ struct alc_spec {
335 /* hooks */ 337 /* hooks */
336 void (*init_hook)(struct hda_codec *codec); 338 void (*init_hook)(struct hda_codec *codec);
337 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340#ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
342#endif
338 343
339 /* for pin sensing */ 344 /* for pin sensing */
340 unsigned int sense_updated: 1; 345 unsigned int sense_updated: 1;
@@ -386,6 +391,7 @@ struct alc_config_preset {
386 void (*init_hook)(struct hda_codec *); 391 void (*init_hook)(struct hda_codec *);
387#ifdef CONFIG_SND_HDA_POWER_SAVE 392#ifdef CONFIG_SND_HDA_POWER_SAVE
388 struct hda_amp_list *loopbacks; 393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
389#endif 395#endif
390}; 396};
391 397
@@ -898,6 +904,7 @@ static void setup_preset(struct hda_codec *codec,
898 spec->unsol_event = preset->unsol_event; 904 spec->unsol_event = preset->unsol_event;
899 spec->init_hook = preset->init_hook; 905 spec->init_hook = preset->init_hook;
900#ifdef CONFIG_SND_HDA_POWER_SAVE 906#ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
901 spec->loopback.amplist = preset->loopbacks; 908 spec->loopback.amplist = preset->loopbacks;
902#endif 909#endif
903 910
@@ -1663,9 +1670,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1663/* some bit here disables the other DACs. Init=0x4900 */ 1670/* some bit here disables the other DACs. Init=0x4900 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, 1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666/* Enable amplifiers */
1667 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1668 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1669/* DMIC fix 1673/* DMIC fix
1670 * This laptop has a stereo digital microphone. The mics are only 1cm apart 1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1671 * which makes the stereo useless. However, either the mic or the ALC889 1675 * which makes the stereo useless. However, either the mic or the ALC889
@@ -1778,6 +1782,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1778 { } /* end */ 1782 { } /* end */
1779}; 1783};
1780 1784
1785static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1791 HDA_OUTPUT),
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1800 { } /* end */
1801};
1802
1803
1781static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) 1804static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1782{ 1805{
1783 struct alc_spec *spec = codec->spec; 1806 struct alc_spec *spec = codec->spec;
@@ -1808,6 +1831,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1808 spec->autocfg.speaker_pins[2] = 0x1b; 1831 spec->autocfg.speaker_pins[2] = 0x1b;
1809} 1832}
1810 1833
1834#ifdef CONFIG_SND_HDA_POWER_SAVE
1835static void alc889_power_eapd(struct hda_codec *codec, int power)
1836{
1837 snd_hda_codec_write(codec, 0x14, 0,
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1841}
1842#endif
1843
1811/* 1844/*
1812 * ALC880 3-stack model 1845 * ALC880 3-stack model
1813 * 1846 *
@@ -3601,12 +3634,29 @@ static void alc_free(struct hda_codec *codec)
3601 snd_hda_detach_beep_device(codec); 3634 snd_hda_detach_beep_device(codec);
3602} 3635}
3603 3636
3637#ifdef CONFIG_SND_HDA_POWER_SAVE
3638static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3639{
3640 struct alc_spec *spec = codec->spec;
3641 if (spec && spec->power_hook)
3642 spec->power_hook(codec, 0);
3643 return 0;
3644}
3645#endif
3646
3604#ifdef SND_HDA_NEEDS_RESUME 3647#ifdef SND_HDA_NEEDS_RESUME
3605static int alc_resume(struct hda_codec *codec) 3648static int alc_resume(struct hda_codec *codec)
3606{ 3649{
3650#ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3652#endif
3607 codec->patch_ops.init(codec); 3653 codec->patch_ops.init(codec);
3608 snd_hda_codec_resume_amp(codec); 3654 snd_hda_codec_resume_amp(codec);
3609 snd_hda_codec_resume_cache(codec); 3655 snd_hda_codec_resume_cache(codec);
3656#ifdef CONFIG_SND_HDA_POWER_SAVE
3657 if (spec && spec->power_hook)
3658 spec->power_hook(codec, 1);
3659#endif
3610 return 0; 3660 return 0;
3611} 3661}
3612#endif 3662#endif
@@ -3623,6 +3673,7 @@ static struct hda_codec_ops alc_patch_ops = {
3623 .resume = alc_resume, 3673 .resume = alc_resume,
3624#endif 3674#endif
3625#ifdef CONFIG_SND_HDA_POWER_SAVE 3675#ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3626 .check_power_status = alc_check_power_status, 3677 .check_power_status = alc_check_power_status,
3627#endif 3678#endif
3628}; 3679};
@@ -8919,7 +8970,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
8919 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 8970 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8920 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 8971 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8921 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ 8972 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8922 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), 8973 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
8923 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), 8974 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8924 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), 8975 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8925 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), 8976 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
@@ -9282,6 +9333,7 @@ static struct alc_config_preset alc882_presets[] = {
9282 .dac_nids = alc883_dac_nids, 9333 .dac_nids = alc883_dac_nids,
9283 .adc_nids = alc883_adc_nids_alt, 9334 .adc_nids = alc883_adc_nids_alt,
9284 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9335 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9336 .capsrc_nids = alc883_capsrc_nids,
9285 .dig_out_nid = ALC883_DIGOUT_NID, 9337 .dig_out_nid = ALC883_DIGOUT_NID,
9286 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9338 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9287 .channel_mode = alc883_3ST_2ch_modes, 9339 .channel_mode = alc883_3ST_2ch_modes,
@@ -9378,10 +9430,11 @@ static struct alc_config_preset alc882_presets[] = {
9378 .init_hook = alc_automute_amp, 9430 .init_hook = alc_automute_amp,
9379 }, 9431 },
9380 [ALC888_ACER_ASPIRE_8930G] = { 9432 [ALC888_ACER_ASPIRE_8930G] = {
9381 .mixers = { alc888_base_mixer, 9433 .mixers = { alc889_acer_aspire_8930g_mixer,
9382 alc883_chmode_mixer }, 9434 alc883_chmode_mixer },
9383 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 9435 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9384 alc889_acer_aspire_8930g_verbs }, 9436 alc889_acer_aspire_8930g_verbs,
9437 alc889_eapd_verbs},
9385 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9386 .dac_nids = alc883_dac_nids, 9439 .dac_nids = alc883_dac_nids,
9387 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), 9440 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
@@ -9398,6 +9451,9 @@ static struct alc_config_preset alc882_presets[] = {
9398 .unsol_event = alc_automute_amp_unsol_event, 9451 .unsol_event = alc_automute_amp_unsol_event,
9399 .setup = alc889_acer_aspire_8930g_setup, 9452 .setup = alc889_acer_aspire_8930g_setup,
9400 .init_hook = alc_automute_amp, 9453 .init_hook = alc_automute_amp,
9454#ifdef CONFIG_SND_HDA_POWER_SAVE
9455 .power_hook = alc889_power_eapd,
9456#endif
9401 }, 9457 },
9402 [ALC888_ACER_ASPIRE_7730G] = { 9458 [ALC888_ACER_ASPIRE_7730G] = {
9403 .mixers = { alc883_3ST_6ch_mixer, 9459 .mixers = { alc883_3ST_6ch_mixer,
@@ -9428,6 +9484,7 @@ static struct alc_config_preset alc882_presets[] = {
9428 .dac_nids = alc883_dac_nids, 9484 .dac_nids = alc883_dac_nids,
9429 .adc_nids = alc883_adc_nids_alt, 9485 .adc_nids = alc883_adc_nids_alt,
9430 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9486 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9487 .capsrc_nids = alc883_capsrc_nids,
9431 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9488 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9432 .channel_mode = alc883_sixstack_modes, 9489 .channel_mode = alc883_sixstack_modes,
9433 .input_mux = &alc883_capture_source, 9490 .input_mux = &alc883_capture_source,
@@ -9489,6 +9546,7 @@ static struct alc_config_preset alc882_presets[] = {
9489 .dac_nids = alc883_dac_nids, 9546 .dac_nids = alc883_dac_nids,
9490 .adc_nids = alc883_adc_nids_alt, 9547 .adc_nids = alc883_adc_nids_alt,
9491 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), 9548 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9549 .capsrc_nids = alc883_capsrc_nids,
9492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9550 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9493 .channel_mode = alc883_3ST_2ch_modes, 9551 .channel_mode = alc883_3ST_2ch_modes,
9494 .input_mux = &alc883_lenovo_101e_capture_source, 9552 .input_mux = &alc883_lenovo_101e_capture_source,
@@ -9668,6 +9726,7 @@ static struct alc_config_preset alc882_presets[] = {
9668 alc880_gpio1_init_verbs }, 9726 alc880_gpio1_init_verbs },
9669 .adc_nids = alc883_adc_nids, 9727 .adc_nids = alc883_adc_nids,
9670 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 9728 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9729 .capsrc_nids = alc883_capsrc_nids,
9671 .dac_nids = alc883_dac_nids, 9730 .dac_nids = alc883_dac_nids,
9672 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9731 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9673 .channel_mode = alc889A_mb31_6ch_modes, 9732 .channel_mode = alc889A_mb31_6ch_modes,
@@ -10678,6 +10737,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10678 {} 10737 {}
10679}; 10738};
10680 10739
10740static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10741 /* Front Mic pin: input vref at 50% */
10742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10744 {}
10745};
10746
10681static struct hda_input_mux alc262_fujitsu_capture_source = { 10747static struct hda_input_mux alc262_fujitsu_capture_source = {
10682 .num_items = 3, 10748 .num_items = 3,
10683 .items = { 10749 .items = {
@@ -11720,7 +11786,8 @@ static struct alc_config_preset alc262_presets[] = {
11720 [ALC262_LENOVO_3000] = { 11786 [ALC262_LENOVO_3000] = {
11721 .mixers = { alc262_lenovo_3000_mixer }, 11787 .mixers = { alc262_lenovo_3000_mixer },
11722 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 11788 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11723 alc262_lenovo_3000_unsol_verbs }, 11789 alc262_lenovo_3000_unsol_verbs,
11790 alc262_lenovo_3000_init_verbs },
11724 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11725 .dac_nids = alc262_dac_nids, 11792 .dac_nids = alc262_dac_nids,
11726 .hp_nid = 0x03, 11793 .hp_nid = 0x03,
@@ -12857,7 +12924,7 @@ static int patch_alc268(struct hda_codec *codec)
12857 int board_config; 12924 int board_config;
12858 int i, has_beep, err; 12925 int i, has_beep, err;
12859 12926
12860 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 12927 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12861 if (spec == NULL) 12928 if (spec == NULL)
12862 return -ENOMEM; 12929 return -ENOMEM;
12863 12930
@@ -13232,10 +13299,12 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13232/* toggle speaker-output according to the hp-jack state */ 13299/* toggle speaker-output according to the hp-jack state */
13233static void alc269_speaker_automute(struct hda_codec *codec) 13300static void alc269_speaker_automute(struct hda_codec *codec)
13234{ 13301{
13302 struct alc_spec *spec = codec->spec;
13303 unsigned int nid = spec->autocfg.hp_pins[0];
13235 unsigned int present; 13304 unsigned int present;
13236 unsigned char bits; 13305 unsigned char bits;
13237 13306
13238 present = snd_hda_jack_detect(codec, 0x15); 13307 present = snd_hda_jack_detect(codec, nid);
13239 bits = present ? AMP_IN_MUTE(0) : 0; 13308 bits = present ? AMP_IN_MUTE(0) : 0;
13240 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, 13309 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13241 AMP_IN_MUTE(0), bits); 13310 AMP_IN_MUTE(0), bits);
@@ -13460,8 +13529,8 @@ static void alc269_auto_init(struct hda_codec *codec)
13460static const char *alc269_models[ALC269_MODEL_LAST] = { 13529static const char *alc269_models[ALC269_MODEL_LAST] = {
13461 [ALC269_BASIC] = "basic", 13530 [ALC269_BASIC] = "basic",
13462 [ALC269_QUANTA_FL1] = "quanta", 13531 [ALC269_QUANTA_FL1] = "quanta",
13463 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", 13532 [ALC269_ASUS_AMIC] = "asus-amic",
13464 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", 13533 [ALC269_ASUS_DMIC] = "asus-dmic",
13465 [ALC269_FUJITSU] = "fujitsu", 13534 [ALC269_FUJITSU] = "fujitsu",
13466 [ALC269_LIFEBOOK] = "lifebook", 13535 [ALC269_LIFEBOOK] = "lifebook",
13467 [ALC269_AUTO] = "auto", 13536 [ALC269_AUTO] = "auto",
@@ -13470,18 +13539,41 @@ static const char *alc269_models[ALC269_MODEL_LAST] = {
13470static struct snd_pci_quirk alc269_cfg_tbl[] = { 13539static struct snd_pci_quirk alc269_cfg_tbl[] = {
13471 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), 13540 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13472 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 13541 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13473 ALC269_ASUS_EEEPC_P703), 13542 ALC269_ASUS_AMIC),
13474 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), 13543 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13475 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), 13544 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13476 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), 13545 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13477 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), 13546 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13478 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), 13547 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13479 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), 13548 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13549 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13550 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13551 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13552 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13553 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13554 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13555 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13556 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13557 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13558 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13559 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13560 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13561 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13562 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13563 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13564 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13565 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13566 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13567 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13568 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13569 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13570 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13480 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 13571 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13481 ALC269_ASUS_EEEPC_P901), 13572 ALC269_ASUS_DMIC),
13482 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", 13573 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13483 ALC269_ASUS_EEEPC_P901), 13574 ALC269_ASUS_DMIC),
13484 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), 13575 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13576 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13485 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), 13577 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13486 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), 13578 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13487 {} 13579 {}
@@ -13511,7 +13603,7 @@ static struct alc_config_preset alc269_presets[] = {
13511 .setup = alc269_quanta_fl1_setup, 13603 .setup = alc269_quanta_fl1_setup,
13512 .init_hook = alc269_quanta_fl1_init_hook, 13604 .init_hook = alc269_quanta_fl1_init_hook,
13513 }, 13605 },
13514 [ALC269_ASUS_EEEPC_P703] = { 13606 [ALC269_ASUS_AMIC] = {
13515 .mixers = { alc269_eeepc_mixer }, 13607 .mixers = { alc269_eeepc_mixer },
13516 .cap_mixer = alc269_epc_capture_mixer, 13608 .cap_mixer = alc269_epc_capture_mixer,
13517 .init_verbs = { alc269_init_verbs, 13609 .init_verbs = { alc269_init_verbs,
@@ -13525,7 +13617,7 @@ static struct alc_config_preset alc269_presets[] = {
13525 .setup = alc269_eeepc_amic_setup, 13617 .setup = alc269_eeepc_amic_setup,
13526 .init_hook = alc269_eeepc_inithook, 13618 .init_hook = alc269_eeepc_inithook,
13527 }, 13619 },
13528 [ALC269_ASUS_EEEPC_P901] = { 13620 [ALC269_ASUS_DMIC] = {
13529 .mixers = { alc269_eeepc_mixer }, 13621 .mixers = { alc269_eeepc_mixer },
13530 .cap_mixer = alc269_epc_capture_mixer, 13622 .cap_mixer = alc269_epc_capture_mixer,
13531 .init_verbs = { alc269_init_verbs, 13623 .init_verbs = { alc269_init_verbs,
@@ -15401,7 +15493,7 @@ static struct alc_config_preset alc861vd_presets[] = {
15401static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, 15493static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15402 const struct auto_pin_cfg *cfg) 15494 const struct auto_pin_cfg *cfg)
15403{ 15495{
15404 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); 15496 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15405} 15497}
15406 15498
15407 15499
@@ -16160,6 +16252,52 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16160 { } /* end */ 16252 { } /* end */
16161}; 16253};
16162 16254
16255static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16256 .ops = &snd_hda_bind_sw,
16257 .values = {
16258 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16259 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16260 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16261 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16262 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16263 0
16264 },
16265};
16266
16267static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16268 .ops = &snd_hda_bind_sw,
16269 .values = {
16270 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16271 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16272 0
16273 },
16274};
16275
16276static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16277 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16278 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16279 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16280 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16281 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16282 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16283 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16286 { } /* end */
16287};
16288
16289static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16290 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16291 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16292 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16293 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16294 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16297 { } /* end */
16298};
16299
16300
16163static struct snd_kcontrol_new alc662_chmode_mixer[] = { 16301static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16164 { 16302 {
16165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 16303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -16447,6 +16585,45 @@ static struct hda_verb alc272_dell_init_verbs[] = {
16447 {} 16585 {}
16448}; 16586};
16449 16587
16588static struct hda_verb alc663_mode7_init_verbs[] = {
16589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16590 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16591 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16592 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16593 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16594 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16595 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16596 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16597 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16598 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16599 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16600 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16601 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16602 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16603 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16604 {}
16605};
16606
16607static struct hda_verb alc663_mode8_init_verbs[] = {
16608 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16611 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16613 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16614 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16616 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16617 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16618 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16622 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16623 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16624 {}
16625};
16626
16450static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { 16627static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16451 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 16628 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16452 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 16629 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
@@ -16626,6 +16803,54 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16626 } 16803 }
16627} 16804}
16628 16805
16806static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16807{
16808 unsigned int present1, present2;
16809
16810 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16811 AC_VERB_GET_PIN_SENSE, 0)
16812 & AC_PINSENSE_PRESENCE;
16813 present2 = snd_hda_codec_read(codec, 0x21, 0,
16814 AC_VERB_GET_PIN_SENSE, 0)
16815 & AC_PINSENSE_PRESENCE;
16816
16817 if (present1 || present2) {
16818 snd_hda_codec_write_cache(codec, 0x14, 0,
16819 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16820 snd_hda_codec_write_cache(codec, 0x17, 0,
16821 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16822 } else {
16823 snd_hda_codec_write_cache(codec, 0x14, 0,
16824 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16825 snd_hda_codec_write_cache(codec, 0x17, 0,
16826 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16827 }
16828}
16829
16830static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16831{
16832 unsigned int present1, present2;
16833
16834 present1 = snd_hda_codec_read(codec, 0x21, 0,
16835 AC_VERB_GET_PIN_SENSE, 0)
16836 & AC_PINSENSE_PRESENCE;
16837 present2 = snd_hda_codec_read(codec, 0x15, 0,
16838 AC_VERB_GET_PIN_SENSE, 0)
16839 & AC_PINSENSE_PRESENCE;
16840
16841 if (present1 || present2) {
16842 snd_hda_codec_write_cache(codec, 0x14, 0,
16843 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16844 snd_hda_codec_write_cache(codec, 0x17, 0,
16845 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16846 } else {
16847 snd_hda_codec_write_cache(codec, 0x14, 0,
16848 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16849 snd_hda_codec_write_cache(codec, 0x17, 0,
16850 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16851 }
16852}
16853
16629static void alc663_m51va_unsol_event(struct hda_codec *codec, 16854static void alc663_m51va_unsol_event(struct hda_codec *codec,
16630 unsigned int res) 16855 unsigned int res)
16631{ 16856{
@@ -16645,7 +16870,7 @@ static void alc663_m51va_setup(struct hda_codec *codec)
16645 spec->ext_mic.pin = 0x18; 16870 spec->ext_mic.pin = 0x18;
16646 spec->ext_mic.mux_idx = 0; 16871 spec->ext_mic.mux_idx = 0;
16647 spec->int_mic.pin = 0x12; 16872 spec->int_mic.pin = 0x12;
16648 spec->int_mic.mux_idx = 1; 16873 spec->int_mic.mux_idx = 9;
16649 spec->auto_mic = 1; 16874 spec->auto_mic = 1;
16650} 16875}
16651 16876
@@ -16657,7 +16882,17 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
16657 16882
16658/* ***************** Mode1 ******************************/ 16883/* ***************** Mode1 ******************************/
16659#define alc663_mode1_unsol_event alc663_m51va_unsol_event 16884#define alc663_mode1_unsol_event alc663_m51va_unsol_event
16660#define alc663_mode1_setup alc663_m51va_setup 16885
16886static void alc663_mode1_setup(struct hda_codec *codec)
16887{
16888 struct alc_spec *spec = codec->spec;
16889 spec->ext_mic.pin = 0x18;
16890 spec->ext_mic.mux_idx = 0;
16891 spec->int_mic.pin = 0x19;
16892 spec->int_mic.mux_idx = 1;
16893 spec->auto_mic = 1;
16894}
16895
16661#define alc663_mode1_inithook alc663_m51va_inithook 16896#define alc663_mode1_inithook alc663_m51va_inithook
16662 16897
16663/* ***************** Mode2 ******************************/ 16898/* ***************** Mode2 ******************************/
@@ -16674,7 +16909,7 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec,
16674 } 16909 }
16675} 16910}
16676 16911
16677#define alc662_mode2_setup alc663_m51va_setup 16912#define alc662_mode2_setup alc663_mode1_setup
16678 16913
16679static void alc662_mode2_inithook(struct hda_codec *codec) 16914static void alc662_mode2_inithook(struct hda_codec *codec)
16680{ 16915{
@@ -16695,7 +16930,7 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec,
16695 } 16930 }
16696} 16931}
16697 16932
16698#define alc663_mode3_setup alc663_m51va_setup 16933#define alc663_mode3_setup alc663_mode1_setup
16699 16934
16700static void alc663_mode3_inithook(struct hda_codec *codec) 16935static void alc663_mode3_inithook(struct hda_codec *codec)
16701{ 16936{
@@ -16716,7 +16951,7 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec,
16716 } 16951 }
16717} 16952}
16718 16953
16719#define alc663_mode4_setup alc663_m51va_setup 16954#define alc663_mode4_setup alc663_mode1_setup
16720 16955
16721static void alc663_mode4_inithook(struct hda_codec *codec) 16956static void alc663_mode4_inithook(struct hda_codec *codec)
16722{ 16957{
@@ -16737,7 +16972,7 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec,
16737 } 16972 }
16738} 16973}
16739 16974
16740#define alc663_mode5_setup alc663_m51va_setup 16975#define alc663_mode5_setup alc663_mode1_setup
16741 16976
16742static void alc663_mode5_inithook(struct hda_codec *codec) 16977static void alc663_mode5_inithook(struct hda_codec *codec)
16743{ 16978{
@@ -16758,7 +16993,7 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec,
16758 } 16993 }
16759} 16994}
16760 16995
16761#define alc663_mode6_setup alc663_m51va_setup 16996#define alc663_mode6_setup alc663_mode1_setup
16762 16997
16763static void alc663_mode6_inithook(struct hda_codec *codec) 16998static void alc663_mode6_inithook(struct hda_codec *codec)
16764{ 16999{
@@ -16766,6 +17001,50 @@ static void alc663_mode6_inithook(struct hda_codec *codec)
16766 alc_mic_automute(codec); 17001 alc_mic_automute(codec);
16767} 17002}
16768 17003
17004/* ***************** Mode7 ******************************/
17005static void alc663_mode7_unsol_event(struct hda_codec *codec,
17006 unsigned int res)
17007{
17008 switch (res >> 26) {
17009 case ALC880_HP_EVENT:
17010 alc663_two_hp_m7_speaker_automute(codec);
17011 break;
17012 case ALC880_MIC_EVENT:
17013 alc_mic_automute(codec);
17014 break;
17015 }
17016}
17017
17018#define alc663_mode7_setup alc663_mode1_setup
17019
17020static void alc663_mode7_inithook(struct hda_codec *codec)
17021{
17022 alc663_two_hp_m7_speaker_automute(codec);
17023 alc_mic_automute(codec);
17024}
17025
17026/* ***************** Mode8 ******************************/
17027static void alc663_mode8_unsol_event(struct hda_codec *codec,
17028 unsigned int res)
17029{
17030 switch (res >> 26) {
17031 case ALC880_HP_EVENT:
17032 alc663_two_hp_m8_speaker_automute(codec);
17033 break;
17034 case ALC880_MIC_EVENT:
17035 alc_mic_automute(codec);
17036 break;
17037 }
17038}
17039
17040#define alc663_mode8_setup alc663_m51va_setup
17041
17042static void alc663_mode8_inithook(struct hda_codec *codec)
17043{
17044 alc663_two_hp_m8_speaker_automute(codec);
17045 alc_mic_automute(codec);
17046}
17047
16769static void alc663_g71v_hp_automute(struct hda_codec *codec) 17048static void alc663_g71v_hp_automute(struct hda_codec *codec)
16770{ 17049{
16771 unsigned int present; 17050 unsigned int present;
@@ -16900,6 +17179,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
16900 [ALC663_ASUS_MODE4] = "asus-mode4", 17179 [ALC663_ASUS_MODE4] = "asus-mode4",
16901 [ALC663_ASUS_MODE5] = "asus-mode5", 17180 [ALC663_ASUS_MODE5] = "asus-mode5",
16902 [ALC663_ASUS_MODE6] = "asus-mode6", 17181 [ALC663_ASUS_MODE6] = "asus-mode6",
17182 [ALC663_ASUS_MODE7] = "asus-mode7",
17183 [ALC663_ASUS_MODE8] = "asus-mode8",
16903 [ALC272_DELL] = "dell", 17184 [ALC272_DELL] = "dell",
16904 [ALC272_DELL_ZM1] = "dell-zm1", 17185 [ALC272_DELL_ZM1] = "dell-zm1",
16905 [ALC272_SAMSUNG_NC10] = "samsung-nc10", 17186 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
@@ -16916,12 +17197,22 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
16916 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 17197 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16917 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 17198 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16918 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 17199 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17200 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17201 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
16919 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 17202 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17203 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17204 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17205 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17206 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17207 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
16920 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 17208 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17209 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17210 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
16921 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 17211 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16922 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 17212 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16923 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 17213 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16924 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 17214 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17215 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
16925 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), 17216 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16926 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), 17217 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16927 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), 17218 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
@@ -17205,6 +17496,36 @@ static struct alc_config_preset alc662_presets[] = {
17205 .setup = alc663_mode6_setup, 17496 .setup = alc663_mode6_setup,
17206 .init_hook = alc663_mode6_inithook, 17497 .init_hook = alc663_mode6_inithook,
17207 }, 17498 },
17499 [ALC663_ASUS_MODE7] = {
17500 .mixers = { alc663_mode7_mixer },
17501 .cap_mixer = alc662_auto_capture_mixer,
17502 .init_verbs = { alc662_init_verbs,
17503 alc663_mode7_init_verbs },
17504 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17505 .hp_nid = 0x03,
17506 .dac_nids = alc662_dac_nids,
17507 .dig_out_nid = ALC662_DIGOUT_NID,
17508 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17509 .channel_mode = alc662_3ST_2ch_modes,
17510 .unsol_event = alc663_mode7_unsol_event,
17511 .setup = alc663_mode7_setup,
17512 .init_hook = alc663_mode7_inithook,
17513 },
17514 [ALC663_ASUS_MODE8] = {
17515 .mixers = { alc663_mode8_mixer },
17516 .cap_mixer = alc662_auto_capture_mixer,
17517 .init_verbs = { alc662_init_verbs,
17518 alc663_mode8_init_verbs },
17519 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17520 .hp_nid = 0x03,
17521 .dac_nids = alc662_dac_nids,
17522 .dig_out_nid = ALC662_DIGOUT_NID,
17523 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17524 .channel_mode = alc662_3ST_2ch_modes,
17525 .unsol_event = alc663_mode8_unsol_event,
17526 .setup = alc663_mode8_setup,
17527 .init_hook = alc663_mode8_inithook,
17528 },
17208 [ALC272_DELL] = { 17529 [ALC272_DELL] = {
17209 .mixers = { alc663_m51va_mixer }, 17530 .mixers = { alc663_m51va_mixer },
17210 .cap_mixer = alc272_auto_capture_mixer, 17531 .cap_mixer = alc272_auto_capture_mixer,
@@ -17688,7 +18009,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
17688 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 18009 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17689 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, 18010 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17690 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, 18011 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18012 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
17691 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 18013 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18014 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
17692 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 18015 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17693 .patch = patch_alc861 }, 18016 .patch = patch_alc861 },
17694 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 18017 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3d59f8325848..2291a8396817 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2104,6 +2104,7 @@ static unsigned int ref9205_pin_configs[12] = {
2104 10280204 2104 10280204
2105 1028021F 2105 1028021F
2106 10280228 (Dell Vostro 1500) 2106 10280228 (Dell Vostro 1500)
2107 10280229 (Dell Vostro 1700)
2107*/ 2108*/
2108static unsigned int dell_9205_m42_pin_configs[12] = { 2109static unsigned int dell_9205_m42_pin_configs[12] = {
2109 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, 2110 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
@@ -2189,6 +2190,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2189 "Dell Inspiron", STAC_9205_DELL_M44), 2190 "Dell Inspiron", STAC_9205_DELL_M44),
2190 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, 2191 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2191 "Dell Vostro 1500", STAC_9205_DELL_M42), 2192 "Dell Vostro 1500", STAC_9205_DELL_M42),
2193 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
2194 "Dell Vostro 1700", STAC_9205_DELL_M42),
2192 /* Gateway */ 2195 /* Gateway */
2193 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), 2196 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2194 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), 2197 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
@@ -3779,15 +3782,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3779 err = snd_hda_attach_beep_device(codec, nid); 3782 err = snd_hda_attach_beep_device(codec, nid);
3780 if (err < 0) 3783 if (err < 0)
3781 return err; 3784 return err;
3782 /* IDT/STAC codecs have linear beep tone parameter */ 3785 if (codec->beep) {
3783 codec->beep->linear_tone = 1; 3786 /* IDT/STAC codecs have linear beep tone parameter */
3784 /* if no beep switch is available, make its own one */ 3787 codec->beep->linear_tone = 1;
3785 caps = query_amp_caps(codec, nid, HDA_OUTPUT); 3788 /* if no beep switch is available, make its own one */
3786 if (codec->beep && 3789 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3787 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { 3790 if (!(caps & AC_AMPCAP_MUTE)) {
3788 err = stac92xx_beep_switch_ctl(codec); 3791 err = stac92xx_beep_switch_ctl(codec);
3789 if (err < 0) 3792 if (err < 0)
3790 return err; 3793 return err;
3794 }
3791 } 3795 }
3792 } 3796 }
3793#endif 3797#endif
@@ -4449,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4449{ 4453{
4450 if (!nid) 4454 if (!nid)
4451 return 0; 4455 return 0;
4452 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4456 return snd_hda_jack_detect(codec, nid);
4453 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4454 * the pincap gives TRIG_REQ bit.
4455 */
4456 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4457 AC_PINSENSE_PRESENCE)
4458 return 1;
4459 return 0;
4460} 4457}
4461 4458
4462static void stac92xx_line_out_detect(struct hda_codec *codec, 4459static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4958,6 +4955,7 @@ static int patch_stac9200(struct hda_codec *codec)
4958 if (spec == NULL) 4955 if (spec == NULL)
4959 return -ENOMEM; 4956 return -ENOMEM;
4960 4957
4958 codec->no_trigger_sense = 1;
4961 codec->spec = spec; 4959 codec->spec = spec;
4962 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4960 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4963 spec->pin_nids = stac9200_pin_nids; 4961 spec->pin_nids = stac9200_pin_nids;
@@ -5020,6 +5018,7 @@ static int patch_stac925x(struct hda_codec *codec)
5020 if (spec == NULL) 5018 if (spec == NULL)
5021 return -ENOMEM; 5019 return -ENOMEM;
5022 5020
5021 codec->no_trigger_sense = 1;
5023 codec->spec = spec; 5022 codec->spec = spec;
5024 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5023 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5025 spec->pin_nids = stac925x_pin_nids; 5024 spec->pin_nids = stac925x_pin_nids;
@@ -5104,6 +5103,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5104 if (spec == NULL) 5103 if (spec == NULL)
5105 return -ENOMEM; 5104 return -ENOMEM;
5106 5105
5106 codec->no_trigger_sense = 1;
5107 codec->spec = spec; 5107 codec->spec = spec;
5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5251,6 +5251,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5251 if (spec == NULL) 5251 if (spec == NULL)
5252 return -ENOMEM; 5252 return -ENOMEM;
5253 5253
5254 codec->no_trigger_sense = 1;
5254 codec->spec = spec; 5255 codec->spec = spec;
5255 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5256 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5256 spec->digbeep_nid = 0x21; 5257 spec->digbeep_nid = 0x21;
@@ -5414,6 +5415,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5414 if (spec == NULL) 5415 if (spec == NULL)
5415 return -ENOMEM; 5416 return -ENOMEM;
5416 5417
5418 codec->no_trigger_sense = 1;
5417 codec->spec = spec; 5419 codec->spec = spec;
5418 codec->patch_ops = stac92xx_patch_ops; 5420 codec->patch_ops = stac92xx_patch_ops;
5419 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5421 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5657,6 +5659,7 @@ static int patch_stac922x(struct hda_codec *codec)
5657 if (spec == NULL) 5659 if (spec == NULL)
5658 return -ENOMEM; 5660 return -ENOMEM;
5659 5661
5662 codec->no_trigger_sense = 1;
5660 codec->spec = spec; 5663 codec->spec = spec;
5661 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5664 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5662 spec->pin_nids = stac922x_pin_nids; 5665 spec->pin_nids = stac922x_pin_nids;
@@ -5760,6 +5763,7 @@ static int patch_stac927x(struct hda_codec *codec)
5760 if (spec == NULL) 5763 if (spec == NULL)
5761 return -ENOMEM; 5764 return -ENOMEM;
5762 5765
5766 codec->no_trigger_sense = 1;
5763 codec->spec = spec; 5767 codec->spec = spec;
5764 codec->slave_dig_outs = stac927x_slave_dig_outs; 5768 codec->slave_dig_outs = stac927x_slave_dig_outs;
5765 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5769 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5894,6 +5898,7 @@ static int patch_stac9205(struct hda_codec *codec)
5894 if (spec == NULL) 5898 if (spec == NULL)
5895 return -ENOMEM; 5899 return -ENOMEM;
5896 5900
5901 codec->no_trigger_sense = 1;
5897 codec->spec = spec; 5902 codec->spec = spec;
5898 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5903 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5899 spec->pin_nids = stac9205_pin_nids; 5904 spec->pin_nids = stac9205_pin_nids;
@@ -6049,6 +6054,7 @@ static int patch_stac9872(struct hda_codec *codec)
6049 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6050 if (spec == NULL) 6055 if (spec == NULL)
6051 return -ENOMEM; 6056 return -ENOMEM;
6057 codec->no_trigger_sense = 1;
6052 codec->spec = spec; 6058 codec->spec = spec;
6053 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6059 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6054 spec->pin_nids = stac9872_pin_nids; 6060 spec->pin_nids = stac9872_pin_nids;
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index b5ca02e2038c..e66ef2b69b5d 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1058,7 +1058,7 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
1058 rptr.retwords[2] != M && 1058 rptr.retwords[2] != M &&
1059 rptr.retwords[3] != N && 1059 rptr.retwords[3] != N &&
1060 i++ < MAX_WRITE_RETRY); 1060 i++ < MAX_WRITE_RETRY);
1061 if (i == MAX_WRITE_RETRY) { 1061 if (i > MAX_WRITE_RETRY) {
1062 snd_printdd("sent samplerate %d: %d failed\n", 1062 snd_printdd("sent samplerate %d: %d failed\n",
1063 *intdec, rate); 1063 *intdec, rate);
1064 return -EIO; 1064 return -EIO;
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index d057e6489643..5cfa608823f7 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -51,7 +51,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
51 return 0; /* already enough large */ 51 return 0; /* already enough large */
52 vfree(runtime->dma_area); 52 vfree(runtime->dma_area);
53 } 53 }
54 runtime->dma_area = vmalloc_32(size); 54 runtime->dma_area = vmalloc_32_user(size);
55 if (! runtime->dma_area) 55 if (! runtime->dma_area)
56 return -ENOMEM; 56 return -ENOMEM;
57 runtime->dma_bytes = size; 57 runtime->dma_bytes = size;
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 69bd0acc81c8..a1bbe16b7f96 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -102,6 +102,12 @@ static int ac97_soc_probe(struct platform_device *pdev)
102 INIT_LIST_HEAD(&codec->dapm_widgets); 102 INIT_LIST_HEAD(&codec->dapm_widgets);
103 INIT_LIST_HEAD(&codec->dapm_paths); 103 INIT_LIST_HEAD(&codec->dapm_paths);
104 104
105 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
106 if (ret < 0) {
107 printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n");
108 goto err;
109 }
110
105 /* register pcms */ 111 /* register pcms */
106 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 112 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
107 if (ret < 0) 113 if (ret < 0)
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index b69861d52161..3ef16bbc8c83 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -470,7 +470,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_ak4642);
470 470
471static int __init ak4642_modinit(void) 471static int __init ak4642_modinit(void)
472{ 472{
473 int ret; 473 int ret = 0;
474#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 474#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
475 ret = i2c_add_driver(&ak4642_i2c_driver); 475 ret = i2c_add_driver(&ak4642_i2c_driver);
476#endif 476#endif
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index bbc72c2ddfca..81b8c9dfe7fc 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -191,6 +191,7 @@ static int ac97_analog_prepare(struct snd_pcm_substream *substream,
191 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS); 191 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
192 192
193 vra |= 0x1; /* enable variable rate audio */ 193 vra |= 0x1; /* enable variable rate audio */
194 vra &= ~0x4; /* disable SPDIF output */
194 195
195 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra); 196 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
196 197
@@ -221,22 +222,6 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream,
221 return stac9766_ac97_write(codec, reg, runtime->rate); 222 return stac9766_ac97_write(codec, reg, runtime->rate);
222} 223}
223 224
224static int ac97_digital_trigger(struct snd_pcm_substream *substream,
225 int cmd, struct snd_soc_dai *dai)
226{
227 struct snd_soc_codec *codec = dai->codec;
228 unsigned short vra;
229
230 switch (cmd) {
231 case SNDRV_PCM_TRIGGER_STOP:
232 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
233 vra &= !0x04;
234 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
235 break;
236 }
237 return 0;
238}
239
240static int stac9766_set_bias_level(struct snd_soc_codec *codec, 225static int stac9766_set_bias_level(struct snd_soc_codec *codec,
241 enum snd_soc_bias_level level) 226 enum snd_soc_bias_level level)
242{ 227{
@@ -315,7 +300,6 @@ static struct snd_soc_dai_ops stac9766_dai_ops_analog = {
315 300
316static struct snd_soc_dai_ops stac9766_dai_ops_digital = { 301static struct snd_soc_dai_ops stac9766_dai_ops_digital = {
317 .prepare = ac97_digital_prepare, 302 .prepare = ac97_digital_prepare,
318 .trigger = ac97_digital_trigger,
319}; 303};
320 304
321struct snd_soc_dai stac9766_dai[] = { 305struct snd_soc_dai stac9766_dai[] = {
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index ebbf11b653a4..718ef912e758 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -925,7 +925,7 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
925 iface |= 0x3 << 8; 925 iface |= 0x3 << 8;
926 break; 926 break;
927 case SND_SOC_DAIFMT_DSP_B: 927 case SND_SOC_DAIFMT_DSP_B:
928 iface |= 0x3 << 8; /* lg not sure which mode */ 928 iface |= 0x3 << 8 | WM8350_AIF_LRCLK_INV;
929 break; 929 break;
930 default: 930 default:
931 return -EINVAL; 931 return -EINVAL;
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 265e68c75df8..af8cb6995a1f 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -424,23 +424,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
424 424
425 /* filter coefficient */ 425 /* filter coefficient */
426 switch (params_rate(params)) { 426 switch (params_rate(params)) {
427 case SNDRV_PCM_RATE_8000: 427 case 8000:
428 adn |= 0x5 << 1; 428 adn |= 0x5 << 1;
429 break; 429 break;
430 case SNDRV_PCM_RATE_11025: 430 case 11025:
431 adn |= 0x4 << 1; 431 adn |= 0x4 << 1;
432 break; 432 break;
433 case SNDRV_PCM_RATE_16000: 433 case 16000:
434 adn |= 0x3 << 1; 434 adn |= 0x3 << 1;
435 break; 435 break;
436 case SNDRV_PCM_RATE_22050: 436 case 22050:
437 adn |= 0x2 << 1; 437 adn |= 0x2 << 1;
438 break; 438 break;
439 case SNDRV_PCM_RATE_32000: 439 case 32000:
440 adn |= 0x1 << 1; 440 adn |= 0x1 << 1;
441 break; 441 break;
442 case SNDRV_PCM_RATE_44100: 442 case 44100:
443 case SNDRV_PCM_RATE_48000: 443 case 48000:
444 break; 444 break;
445 } 445 }
446 446
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 3d850b97037a..31e39ffd1d8e 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -378,23 +378,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
378 iface |= (1 << 9); 378 iface |= (1 << 9);
379 379
380 switch (params_rate(params)) { 380 switch (params_rate(params)) {
381 case SNDRV_PCM_RATE_8000: 381 case 8000:
382 addcntrl |= (0x5 << 1); 382 addcntrl |= (0x5 << 1);
383 break; 383 break;
384 case SNDRV_PCM_RATE_11025: 384 case 11025:
385 addcntrl |= (0x4 << 1); 385 addcntrl |= (0x4 << 1);
386 break; 386 break;
387 case SNDRV_PCM_RATE_16000: 387 case 16000:
388 addcntrl |= (0x3 << 1); 388 addcntrl |= (0x3 << 1);
389 break; 389 break;
390 case SNDRV_PCM_RATE_22050: 390 case 22050:
391 addcntrl |= (0x2 << 1); 391 addcntrl |= (0x2 << 1);
392 break; 392 break;
393 case SNDRV_PCM_RATE_32000: 393 case 32000:
394 addcntrl |= (0x1 << 1); 394 addcntrl |= (0x1 << 1);
395 break; 395 break;
396 case SNDRV_PCM_RATE_44100: 396 case 44100:
397 case SNDRV_PCM_RATE_48000: 397 case 48000:
398 break; 398 break;
399 } 399 }
400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); 400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl);
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 81c57b5c591c..8812751da8c9 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -47,7 +47,7 @@ static const u16 wm8974_reg[WM8974_CACHEREGNUM] = {
47}; 47};
48 48
49#define WM8974_POWER1_BIASEN 0x08 49#define WM8974_POWER1_BIASEN 0x08
50#define WM8974_POWER1_BUFIOEN 0x10 50#define WM8974_POWER1_BUFIOEN 0x04
51 51
52struct wm8974_priv { 52struct wm8974_priv {
53 struct snd_soc_codec codec; 53 struct snd_soc_codec codec;
@@ -482,23 +482,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
482 482
483 /* filter coefficient */ 483 /* filter coefficient */
484 switch (params_rate(params)) { 484 switch (params_rate(params)) {
485 case SNDRV_PCM_RATE_8000: 485 case 8000:
486 adn |= 0x5 << 1; 486 adn |= 0x5 << 1;
487 break; 487 break;
488 case SNDRV_PCM_RATE_11025: 488 case 11025:
489 adn |= 0x4 << 1; 489 adn |= 0x4 << 1;
490 break; 490 break;
491 case SNDRV_PCM_RATE_16000: 491 case 16000:
492 adn |= 0x3 << 1; 492 adn |= 0x3 << 1;
493 break; 493 break;
494 case SNDRV_PCM_RATE_22050: 494 case 22050:
495 adn |= 0x2 << 1; 495 adn |= 0x2 << 1;
496 break; 496 break;
497 case SNDRV_PCM_RATE_32000: 497 case 32000:
498 adn |= 0x1 << 1; 498 adn |= 0x1 << 1;
499 break; 499 break;
500 case SNDRV_PCM_RATE_44100: 500 case 44100:
501 case SNDRV_PCM_RATE_48000: 501 case 48000:
502 break; 502 break;
503 } 503 }
504 504
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 0ac1215dcd9b..e237bf615129 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -463,7 +463,8 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
463{ 463{
464 u16 *cache = codec->reg_cache; 464 u16 *cache = codec->reg_cache;
465 465
466 soc_ac97_ops.write(codec->ac97, reg, val); 466 if (reg < 0x7c)
467 soc_ac97_ops.write(codec->ac97, reg, val);
467 reg = reg >> 1; 468 reg = reg >> 1;
468 if (reg < (ARRAY_SIZE(wm9712_reg))) 469 if (reg < (ARRAY_SIZE(wm9712_reg)))
469 cache[reg] = val; 470 cache[reg] = val;
diff --git a/sound/soc/imx/mx27vis_wm8974.c b/sound/soc/imx/mx27vis_wm8974.c
index 0267d2d91685..07d2a248438c 100644
--- a/sound/soc/imx/mx27vis_wm8974.c
+++ b/sound/soc/imx/mx27vis_wm8974.c
@@ -180,7 +180,8 @@ static int mx27vis_hifi_hw_free(struct snd_pcm_substream *substream)
180 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 180 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
181 181
182 /* disable the PLL */ 182 /* disable the PLL */
183 return codec_dai->ops->set_pll(codec_dai, IGNORED_ARG, 0, 0); 183 return codec_dai->ops->set_pll(codec_dai, IGNORED_ARG, IGNORED_ARG,
184 0, 0);
184} 185}
185 186
186/* 187/*
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index c071f9603a38..3c85c0f92823 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -24,7 +24,7 @@
24 24
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl.h>
28#include <sound/core.h> 28#include <sound/core.h>
29#include <sound/pcm.h> 29#include <sound/pcm.h>
30#include <sound/soc.h> 30#include <sound/soc.h>
@@ -321,11 +321,11 @@ static int __init sdp3430_soc_init(void)
321 *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */ 321 *(unsigned int *)sdp3430_dai[1].cpu_dai->private_data = 2; /* McBSP3 */
322 322
323 /* Set TWL4030 GPIO6 as EXTMUTE signal */ 323 /* Set TWL4030 GPIO6 as EXTMUTE signal */
324 twl4030_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux, 324 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &pin_mux,
325 TWL4030_INTBR_PMBR1); 325 TWL4030_INTBR_PMBR1);
326 pin_mux &= ~TWL4030_GPIO6_PWM0_MUTE(0x03); 326 pin_mux &= ~TWL4030_GPIO6_PWM0_MUTE(0x03);
327 pin_mux |= TWL4030_GPIO6_PWM0_MUTE(0x02); 327 pin_mux |= TWL4030_GPIO6_PWM0_MUTE(0x02);
328 twl4030_i2c_write_u8(TWL4030_MODULE_INTBR, pin_mux, 328 twl_i2c_write_u8(TWL4030_MODULE_INTBR, pin_mux,
329 TWL4030_INTBR_PMBR1); 329 TWL4030_INTBR_PMBR1);
330 330
331 ret = platform_device_add(sdp3430_snd_device); 331 ret = platform_device_add(sdp3430_snd_device);
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index c7af09729c6e..5263ab18f827 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -42,42 +42,12 @@ static struct snd_soc_device fsi_snd_devdata = {
42 .codec_dev = &soc_codec_dev_ak4642, 42 .codec_dev = &soc_codec_dev_ak4642,
43}; 43};
44 44
45#define AK4642_BUS 0
46#define AK4642_ADR 0x12
47static int ak4642_add_i2c_device(void)
48{
49 struct i2c_board_info info;
50 struct i2c_adapter *adapter;
51 struct i2c_client *client;
52
53 memset(&info, 0, sizeof(struct i2c_board_info));
54 info.addr = AK4642_ADR;
55 strlcpy(info.type, "ak4642", I2C_NAME_SIZE);
56
57 adapter = i2c_get_adapter(AK4642_BUS);
58 if (!adapter) {
59 printk(KERN_DEBUG "can't get i2c adapter\n");
60 return -ENODEV;
61 }
62
63 client = i2c_new_device(adapter, &info);
64 i2c_put_adapter(adapter);
65 if (!client) {
66 printk(KERN_DEBUG "can't add i2c device\n");
67 return -ENODEV;
68 }
69
70 return 0;
71}
72
73static struct platform_device *fsi_snd_device; 45static struct platform_device *fsi_snd_device;
74 46
75static int __init fsi_ak4642_init(void) 47static int __init fsi_ak4642_init(void)
76{ 48{
77 int ret = -ENOMEM; 49 int ret = -ENOMEM;
78 50
79 ak4642_add_i2c_device();
80
81 fsi_snd_device = platform_device_alloc("soc-audio", -1); 51 fsi_snd_device = platform_device_alloc("soc-audio", -1);
82 if (!fsi_snd_device) 52 if (!fsi_snd_device)
83 goto out; 53 goto out;
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 9c49c11c43ce..42813b808389 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -876,7 +876,7 @@ static int fsi_probe(struct platform_device *pdev)
876 876
877 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 877 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
878 irq = platform_get_irq(pdev, 0); 878 irq = platform_get_irq(pdev, 0);
879 if (!res || !irq) { 879 if (!res || (int)irq <= 0) {
880 dev_err(&pdev->dev, "Not enough FSI platform resources.\n"); 880 dev_err(&pdev->dev, "Not enough FSI platform resources.\n");
881 ret = -ENODEV; 881 ret = -ENODEV;
882 goto exit; 882 goto exit;
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index b074a594c595..9edef4684978 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -752,7 +752,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
752 return 0; /* already large enough */ 752 return 0; /* already large enough */
753 vfree(runtime->dma_area); 753 vfree(runtime->dma_area);
754 } 754 }
755 runtime->dma_area = vmalloc(size); 755 runtime->dma_area = vmalloc_user(size);
756 if (!runtime->dma_area) 756 if (!runtime->dma_area)
757 return -ENOMEM; 757 return -ENOMEM;
758 runtime->dma_bytes = size; 758 runtime->dma_bytes = size;
@@ -1936,7 +1936,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
1936 struct snd_usb_stream *as = snd_pcm_substream_chip(substream); 1936 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1937 struct snd_usb_substream *subs = &as->substream[direction]; 1937 struct snd_usb_substream *subs = &as->substream[direction];
1938 1938
1939 if (subs->interface >= 0) { 1939 if (!as->chip->shutdown && subs->interface >= 0) {
1940 usb_set_interface(subs->dev, subs->interface, 0); 1940 usb_set_interface(subs->dev, subs->interface, 0);
1941 subs->interface = -1; 1941 subs->interface = -1;
1942 } 1942 }
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7c846424aebf..2c03a9411317 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -250,7 +250,19 @@ PTHREAD_LIBS = -lpthread
250# explicitly what architecture to check for. Fix this up for yours.. 250# explicitly what architecture to check for. Fix this up for yours..
251SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ 251SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
252 252
253ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y) 253ifeq ($(V), 2)
254 QUIET_STDERR = ">/dev/null"
255else
256 QUIET_STDERR = ">/dev/null 2>&1"
257endif
258
259BITBUCKET = "/dev/null"
260
261ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y)
262 BITBUCKET = .perf.dev.null
263endif
264
265ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo y"), y)
254 CFLAGS := $(CFLAGS) -fstack-protector-all 266 CFLAGS := $(CFLAGS) -fstack-protector-all
255endif 267endif
256 268
@@ -452,11 +464,6 @@ BUILTIN_OBJS += builtin-kmem.o
452 464
453PERFLIBS = $(LIB_FILE) 465PERFLIBS = $(LIB_FILE)
454 466
455ifeq ($(V), 2)
456 QUIET_STDERR = ">/dev/null"
457else
458 QUIET_STDERR = ">/dev/null 2>&1"
459endif
460# 467#
461# Platform specific tweaks 468# Platform specific tweaks
462# 469#
@@ -484,19 +491,19 @@ ifeq ($(uname_S),Darwin)
484 PTHREAD_LIBS = 491 PTHREAD_LIBS =
485endif 492endif
486 493
487ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 494ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
488ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 495ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
489 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); 496 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
490endif 497endif
491 498
492 ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 499 ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
493 BASIC_CFLAGS += -DLIBELF_NO_MMAP 500 BASIC_CFLAGS += -DLIBELF_NO_MMAP
494 endif 501 endif
495else 502else
496 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); 503 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
497endif 504endif
498 505
499ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y) 506ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
500 msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231); 507 msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
501 BASIC_CFLAGS += -DNO_LIBDWARF 508 BASIC_CFLAGS += -DNO_LIBDWARF
502else 509else
@@ -510,7 +517,7 @@ PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
510PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` 517PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
511endif 518endif
512 519
513ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o /dev/null $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y) 520ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o $(BITBUCKET) $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
514 BASIC_CFLAGS += -DNO_LIBPERL 521 BASIC_CFLAGS += -DNO_LIBPERL
515else 522else
516 ALL_LDFLAGS += $(PERL_EMBED_LDOPTS) 523 ALL_LDFLAGS += $(PERL_EMBED_LDOPTS)
@@ -520,20 +527,20 @@ endif
520ifdef NO_DEMANGLE 527ifdef NO_DEMANGLE
521 BASIC_CFLAGS += -DNO_DEMANGLE 528 BASIC_CFLAGS += -DNO_DEMANGLE
522else 529else
523 has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") 530 has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
524 531
525 ifeq ($(has_bfd),y) 532 ifeq ($(has_bfd),y)
526 EXTLIBS += -lbfd 533 EXTLIBS += -lbfd
527 else 534 else
528 has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") 535 has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
529 ifeq ($(has_bfd_iberty),y) 536 ifeq ($(has_bfd_iberty),y)
530 EXTLIBS += -lbfd -liberty 537 EXTLIBS += -lbfd -liberty
531 else 538 else
532 has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") 539 has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
533 ifeq ($(has_bfd_iberty_z),y) 540 ifeq ($(has_bfd_iberty_z),y)
534 EXTLIBS += -lbfd -liberty -lz 541 EXTLIBS += -lbfd -liberty -lz
535 else 542 else
536 has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") 543 has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
537 ifeq ($(has_cplus_demangle),y) 544 ifeq ($(has_cplus_demangle),y)
538 EXTLIBS += -liberty 545 EXTLIBS += -liberty
539 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE 546 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
@@ -781,7 +788,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
781 788
782SHELL = $(SHELL_PATH) 789SHELL = $(SHELL_PATH)
783 790
784all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS 791all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
785ifneq (,$X) 792ifneq (,$X)
786 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';) 793 $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
787endif 794endif
@@ -1108,6 +1115,11 @@ clean:
1108.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS 1115.PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
1109.PHONY: .FORCE-PERF-BUILD-OPTIONS 1116.PHONY: .FORCE-PERF-BUILD-OPTIONS
1110 1117
1118.perf.dev.null:
1119 touch .perf.dev.null
1120
1121.INTERMEDIATE: .perf.dev.null
1122
1111### Make sure built-ins do not have dups and listed in perf.c 1123### Make sure built-ins do not have dups and listed in perf.c
1112# 1124#
1113check-builtins:: 1125check-builtins::
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 05dc5a735039..88c570c18e3e 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -132,7 +132,7 @@ static void insert_alloc_stat(unsigned long call_site, unsigned long ptr,
132 if (data && data->ptr == ptr) { 132 if (data && data->ptr == ptr) {
133 data->hit++; 133 data->hit++;
134 data->bytes_req += bytes_req; 134 data->bytes_req += bytes_req;
135 data->bytes_alloc += bytes_req; 135 data->bytes_alloc += bytes_alloc;
136 } else { 136 } else {
137 data = malloc(sizeof(*data)); 137 data = malloc(sizeof(*data));
138 if (!data) 138 if (!data)
@@ -172,7 +172,7 @@ static void insert_caller_stat(unsigned long call_site,
172 if (data && data->call_site == call_site) { 172 if (data && data->call_site == call_site) {
173 data->hit++; 173 data->hit++;
174 data->bytes_req += bytes_req; 174 data->bytes_req += bytes_req;
175 data->bytes_alloc += bytes_req; 175 data->bytes_alloc += bytes_alloc;
176 } else { 176 } else {
177 data = malloc(sizeof(*data)); 177 data = malloc(sizeof(*data));
178 if (!data) 178 if (!data)
diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index f000c30877ac..8d0de5130db3 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -21,7 +21,7 @@ There's one file descriptor per virtual counter used.
21The special file descriptor is opened via the perf_event_open() 21The special file descriptor is opened via the perf_event_open()
22system call: 22system call:
23 23
24 int sys_perf_event_open(struct perf_event_hw_event *hw_event_uptr, 24 int sys_perf_event_open(struct perf_event_attr *hw_event_uptr,
25 pid_t pid, int cpu, int group_fd, 25 pid_t pid, int cpu, int group_fd,
26 unsigned long flags); 26 unsigned long flags);
27 27
@@ -32,9 +32,9 @@ can be used to set the blocking mode, etc.
32Multiple counters can be kept open at a time, and the counters 32Multiple counters can be kept open at a time, and the counters
33can be poll()ed. 33can be poll()ed.
34 34
35When creating a new counter fd, 'perf_event_hw_event' is: 35When creating a new counter fd, 'perf_event_attr' is:
36 36
37struct perf_event_hw_event { 37struct perf_event_attr {
38 /* 38 /*
39 * The MSB of the config word signifies if the rest contains cpu 39 * The MSB of the config word signifies if the rest contains cpu
40 * specific (raw) counter configuration data, if unset, the next 40 * specific (raw) counter configuration data, if unset, the next
@@ -399,7 +399,7 @@ Notification of new events is possible through poll()/select()/epoll() and
399fcntl() managing signals. 399fcntl() managing signals.
400 400
401Normally a notification is generated for every page filled, however one can 401Normally a notification is generated for every page filled, however one can
402additionally set perf_event_hw_event.wakeup_events to generate one every 402additionally set perf_event_attr.wakeup_events to generate one every
403so many counter overflow events. 403so many counter overflow events.
404 404
405Future work will include a splice() interface to the ring-buffer. 405Future work will include a splice() interface to the ring-buffer.
diff --git a/usr/Kconfig b/usr/Kconfig
index 1c3039f28909..e2721f5a3504 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -72,6 +72,15 @@ config RD_LZMA
72 Support loading of a LZMA encoded initial ramdisk or cpio buffer 72 Support loading of a LZMA encoded initial ramdisk or cpio buffer
73 If unsure, say N. 73 If unsure, say N.
74 74
75config RD_LZO
76 bool "Support initial ramdisks compressed using LZO" if EMBEDDED
77 default !EMBEDDED
78 depends on BLK_DEV_INITRD
79 select DECOMPRESS_LZO
80 help
81 Support loading of a LZO encoded initial ramdisk or cpio buffer
82 If unsure, say N.
83
75choice 84choice
76 prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" 85 prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!=""
77 help 86 help
@@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP
108 bool "Gzip" 117 bool "Gzip"
109 depends on RD_GZIP 118 depends on RD_GZIP
110 help 119 help
111 The old and tried gzip compression. Its compression ratio is 120 The old and tried gzip compression. It provides a good balance
112 the poorest among the 3 choices; however its speed (both 121 between compression ratio and decompression speed.
113 compression and decompression) is the fastest.
114 122
115config INITRAMFS_COMPRESSION_BZIP2 123config INITRAMFS_COMPRESSION_BZIP2
116 bool "Bzip2" 124 bool "Bzip2"
117 depends on RD_BZIP2 125 depends on RD_BZIP2
118 help 126 help
119 Its compression ratio and speed is intermediate. 127 Its compression ratio and speed is intermediate.
120 Decompression speed is slowest among the three. The initramfs 128 Decompression speed is slowest among the four. The initramfs
121 size is about 10% smaller with bzip2, in comparison to gzip. 129 size is about 10% smaller with bzip2, in comparison to gzip.
122 Bzip2 uses a large amount of memory. For modern kernels you 130 Bzip2 uses a large amount of memory. For modern kernels you
123 will need at least 8MB RAM or more for booting. 131 will need at least 8MB RAM or more for booting.
@@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA
128 help 136 help
129 The most recent compression algorithm. 137 The most recent compression algorithm.
130 Its ratio is best, decompression speed is between the other 138 Its ratio is best, decompression speed is between the other
131 two. Compression is slowest. The initramfs size is about 33% 139 three. Compression is slowest. The initramfs size is about 33%
132 smaller with LZMA in comparison to gzip. 140 smaller with LZMA in comparison to gzip.
133 141
142config INITRAMFS_COMPRESSION_LZO
143 bool "LZO"
144 depends on RD_LZO
145 help
146 Its compression ratio is the poorest among the four. The kernel
147 size is about about 10% bigger than gzip; however its speed
148 (both compression and decompression) is the fastest.
149
134endchoice 150endchoice
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 83b3dde1a83b..b2b3c2d1cf8b 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -354,7 +354,10 @@ static int cpio_mkfile(const char *name, const char *location,
354 push_pad(); 354 push_pad();
355 355
356 if (size) { 356 if (size) {
357 fwrite(filebuf, size, 1, stdout); 357 if (fwrite(filebuf, size, 1, stdout) != 1) {
358 fprintf(stderr, "writing filebuf failed\n");
359 goto error;
360 }
358 offset += size; 361 offset += size;
359 push_pad(); 362 push_pad();
360 } 363 }
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index fd9c097b760a..f73de631e3ee 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -508,8 +508,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
508 struct kvm_assigned_dev_kernel *match; 508 struct kvm_assigned_dev_kernel *match;
509 struct pci_dev *dev; 509 struct pci_dev *dev;
510 510
511 down_read(&kvm->slots_lock);
512 mutex_lock(&kvm->lock); 511 mutex_lock(&kvm->lock);
512 down_read(&kvm->slots_lock);
513 513
514 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, 514 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
515 assigned_dev->assigned_dev_id); 515 assigned_dev->assigned_dev_id);
@@ -573,8 +573,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
573 } 573 }
574 574
575out: 575out:
576 mutex_unlock(&kvm->lock);
577 up_read(&kvm->slots_lock); 576 up_read(&kvm->slots_lock);
577 mutex_unlock(&kvm->lock);
578 return r; 578 return r;
579out_list_del: 579out_list_del:
580 list_del(&match->list); 580 list_del(&match->list);
@@ -585,8 +585,8 @@ out_put:
585 pci_dev_put(dev); 585 pci_dev_put(dev);
586out_free: 586out_free:
587 kfree(match); 587 kfree(match);
588 mutex_unlock(&kvm->lock);
589 up_read(&kvm->slots_lock); 588 up_read(&kvm->slots_lock);
589 mutex_unlock(&kvm->lock);
590 return r; 590 return r;
591} 591}
592 592
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e1f2bf8d7b1e..a944be392d6e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -64,7 +64,7 @@ MODULE_LICENSE("GPL");
64/* 64/*
65 * Ordering of locks: 65 * Ordering of locks:
66 * 66 *
67 * kvm->slots_lock --> kvm->lock --> kvm->irq_lock 67 * kvm->lock --> kvm->slots_lock --> kvm->irq_lock
68 */ 68 */
69 69
70DEFINE_SPINLOCK(kvm_lock); 70DEFINE_SPINLOCK(kvm_lock);
@@ -406,8 +406,11 @@ static struct kvm *kvm_create_vm(void)
406out: 406out:
407 return kvm; 407 return kvm;
408 408
409#if defined(KVM_COALESCED_MMIO_PAGE_OFFSET) || \
410 (defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER))
409out_err: 411out_err:
410 hardware_disable_all(); 412 hardware_disable_all();
413#endif
411out_err_nodisable: 414out_err_nodisable:
412 kfree(kvm); 415 kfree(kvm);
413 return ERR_PTR(r); 416 return ERR_PTR(r);
@@ -1177,7 +1180,7 @@ static struct file_operations kvm_vcpu_fops = {
1177 */ 1180 */
1178static int create_vcpu_fd(struct kvm_vcpu *vcpu) 1181static int create_vcpu_fd(struct kvm_vcpu *vcpu)
1179{ 1182{
1180 return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, 0); 1183 return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, O_RDWR);
1181} 1184}
1182 1185
1183/* 1186/*
@@ -1638,7 +1641,7 @@ static int kvm_dev_ioctl_create_vm(void)
1638 kvm = kvm_create_vm(); 1641 kvm = kvm_create_vm();
1639 if (IS_ERR(kvm)) 1642 if (IS_ERR(kvm))
1640 return PTR_ERR(kvm); 1643 return PTR_ERR(kvm);
1641 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, 0); 1644 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR);
1642 if (fd < 0) 1645 if (fd < 0)
1643 kvm_put_kvm(kvm); 1646 kvm_put_kvm(kvm);
1644 1647